From 61c10d9175a9fbe1d0ed7746261aef306326189c Mon Sep 17 00:00:00 2001 From: John Mizerek Date: Wed, 28 Jan 2026 17:36:46 -0800 Subject: [PATCH] Use sessionStorage instead of URL params for wizard menu context Co-Authored-By: Claude Opus 4.5 --- portal/menu-builder.html | 9 +++++++-- portal/setup-wizard.html | 21 +++++++++++++-------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/portal/menu-builder.html b/portal/menu-builder.html index 048592b..775fbd9 100644 --- a/portal/menu-builder.html +++ b/portal/menu-builder.html @@ -3504,8 +3504,13 @@ const data = await response.json(); if (data.OK) { if (data.ACTION === 'created') { - // New menu — redirect to wizard to populate it - window.location.href = `${BASE_PATH}/portal/setup-wizard.html?businessId=${this.config.businessId}&menuId=${data.MENUID}&menuName=${encodeURIComponent(menuName)}`; + // New menu — store context and redirect to wizard to populate it + sessionStorage.setItem('payfrit_wizard_menu', JSON.stringify({ + businessId: this.config.businessId, + menuId: data.MENUID, + menuName: menuName + })); + window.location.href = `${BASE_PATH}/portal/setup-wizard.html`; return; } this.toast(`Menu ${data.ACTION}!`, 'success'); diff --git a/portal/setup-wizard.html b/portal/setup-wizard.html index edb88e6..4ccc430 100644 --- a/portal/setup-wizard.html +++ b/portal/setup-wizard.html @@ -1054,14 +1054,19 @@ }); function initializeConfig() { - // Parse URL parameters for add-menu mode - const params = new URLSearchParams(window.location.search); - const paramBusinessId = params.get('businessId'); - const paramMenuId = params.get('menuId'); - - config.businessId = paramBusinessId ? parseInt(paramBusinessId) : null; - config.menuId = paramMenuId ? parseInt(paramMenuId) : null; - config.menuName = params.get('menuName') || null; + // Check for add-menu context from sessionStorage + const wizardMenu = sessionStorage.getItem('payfrit_wizard_menu'); + if (wizardMenu) { + try { + const ctx = JSON.parse(wizardMenu); + config.businessId = ctx.businessId || null; + config.menuId = ctx.menuId || null; + config.menuName = ctx.menuName || null; + sessionStorage.removeItem('payfrit_wizard_menu'); + } catch (e) { + sessionStorage.removeItem('payfrit_wizard_menu'); + } + } // Determine API base URL const basePath = window.location.pathname.includes('/biz.payfrit.com/')