diff --git a/portal/setup-wizard.html b/portal/setup-wizard.html
index 2e2b6f8..a38a455 100644
--- a/portal/setup-wizard.html
+++ b/portal/setup-wizard.html
@@ -1552,9 +1552,10 @@
const menuPages = discoverResult.menuPages || [];
const siteName = discoverResult.siteName || '';
- // Store business info and platform URLs from discovery
+ // Store business info, platform URLs, and header image from discovery
config.discoveredBusinessInfo = discoverResult.businessInfo || {};
config.platformPages = discoverResult.platformPages || [];
+ config.discoveredHeaderImageUrl = discoverResult.headerImageUrl || '';
if (menuPages.length > 1) {
// Multiple menus found — show confirmation step
@@ -2728,7 +2729,8 @@
// Header Image step - between business info and categories
function showHeaderImageStep() {
const hasAutoHeader = config.headerImageFile != null;
- const headerText = hasAutoHeader
+ const hasDiscoveredHeader = !hasAutoHeader && !!config.discoveredHeaderImageUrl;
+ const headerText = (hasAutoHeader || hasDiscoveredHeader)
? `
I found an image that would work great as your menu header!
`
: `This image appears at the top of your menu in the Payfrit app. It's the first thing customers see!
`;
@@ -2743,14 +2745,14 @@
Content: Your restaurant, food, or branding
-
+
@@ -2775,6 +2777,13 @@
}
};
reader.readAsDataURL(config.headerImageFile);
+ } else if (hasDiscoveredHeader) {
+ // Show preview from discovered URL
+ const preview = document.getElementById('headerUploadPreview');
+ if (preview) {
+ preview.style.backgroundImage = `url(${config.discoveredHeaderImageUrl})`;
+ preview.style.display = 'block';
+ }
}
}
@@ -3671,14 +3680,31 @@
showToast('Menu saved successfully!', 'success');
// Use the businessId from the response (in case it was newly created)
- // Lucee serializes struct keys as uppercase, so check both cases
const summary = result.summary || result.SUMMARY || {};
const finalBusinessId = summary.businessId || summary.BUSINESSID || summary.businessid || config.businessId;
// Update localStorage with the new business ID to keep user logged in
localStorage.setItem('payfrit_portal_business', finalBusinessId);
- // Upload header image if one was selected
+ // Upload header image if one was selected, or download from discovered URL
+ if (!config.headerImageFile && config.discoveredHeaderImageUrl && finalBusinessId) {
+ // Download header from discovered URL server-side
+ try {
+ const dlResp = await fetch(`${config.apiBaseUrl}/setup/downloadImages.php`, {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ businessID: finalBusinessId, headerUrl: config.discoveredHeaderImageUrl })
+ });
+ const dlResult = await dlResp.json();
+ if (dlResult.OK) {
+ console.log('Header image downloaded from URL:', config.discoveredHeaderImageUrl);
+ } else {
+ console.warn('Header URL download failed:', dlResult);
+ }
+ } catch (dlErr) {
+ console.warn('Header URL download error:', dlErr);
+ }
+ }
if (config.headerImageFile && finalBusinessId) {
try {
const formData = new FormData();