website: restore only shareable routes, not order screens

This commit is contained in:
shum
2026-09-10 17:14:00 +00:00
parent 619222cddc
commit f601368992
+6 -2
View File
@@ -172,11 +172,15 @@ templateEngineOverride: njk
window.addEventListener("message", function (e) {
if (e.origin !== APP || !e.data) return;
// The frame announces itself on load; hand it the site's theme, background and route.
// The frame announces itself on load; hand it the site's theme and background, and
// restore the route we persisted — but only a non-empty one. An empty hash means the
// frame was last on the landing or an order/payment screen it resumes from its own
// store; posting "" would drive it to the landing over a payment mid-way through, so
// we stay out of the way and let it self-resume.
if (e.data.type === "simplex-embed-ready") {
post({ type: "simplex-theme", theme: siteTheme() });
postColors();
postRoute();
if (location.hash) postRoute();
}
// The buyer used the theme switch inside the frame; keep the site in step.
if (e.data.type === "simplex-theme") { applySiteTheme(e.data.theme); postColors(); }