Revert auto header image discovery — header is manual upload only

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
John Mizerek 2026-03-15 09:46:24 -07:00
parent 390f409cf8
commit fc43d2af9c

View file

@ -1552,10 +1552,9 @@
const menuPages = discoverResult.menuPages || []; const menuPages = discoverResult.menuPages || [];
const siteName = discoverResult.siteName || ''; const siteName = discoverResult.siteName || '';
// Store business info, platform URLs, and header image from discovery // Store business info and platform URLs from discovery
config.discoveredBusinessInfo = discoverResult.businessInfo || {}; config.discoveredBusinessInfo = discoverResult.businessInfo || {};
config.platformPages = discoverResult.platformPages || []; config.platformPages = discoverResult.platformPages || [];
config.discoveredHeaderImageUrl = discoverResult.headerImageUrl || '';
if (menuPages.length > 1) { if (menuPages.length > 1) {
// Multiple menus found — show confirmation step // Multiple menus found — show confirmation step
@ -2729,8 +2728,7 @@
// Header Image step - between business info and categories // Header Image step - between business info and categories
function showHeaderImageStep() { function showHeaderImageStep() {
const hasAutoHeader = config.headerImageFile != null; const hasAutoHeader = config.headerImageFile != null;
const hasDiscoveredHeader = !hasAutoHeader && !!config.discoveredHeaderImageUrl; const headerText = hasAutoHeader
const headerText = (hasAutoHeader || hasDiscoveredHeader)
? `<p>I found an image that would work great as your menu header!</p>` ? `<p>I found an image that would work great as your menu header!</p>`
: `<p>This image appears at the top of your menu in the Payfrit app. It's the first thing customers see!</p>`; : `<p>This image appears at the top of your menu in the Payfrit app. It's the first thing customers see!</p>`;
@ -2745,14 +2743,14 @@
<li><strong>Content:</strong> Your restaurant, food, or branding</li> <li><strong>Content:</strong> Your restaurant, food, or branding</li>
</ul> </ul>
</div> </div>
<div id="headerUploadPreview" style="width:100%;aspect-ratio:3/1;background:#333;border-radius:8px;margin:12px 0;background-size:cover;background-position:center;display:${(hasAutoHeader || hasDiscoveredHeader) ? 'block' : 'none'};overflow:hidden;"></div> <div id="headerUploadPreview" style="width:100%;aspect-ratio:3/1;background:#333;border-radius:8px;margin:12px 0;background-size:cover;background-position:center;display:${hasAutoHeader ? 'block' : 'none'};overflow:hidden;"></div>
<div style="display:flex;gap:12px;margin-top:12px;"> <div style="display:flex;gap:12px;margin-top:12px;">
<label class="btn btn-secondary" style="cursor:pointer;flex:1;text-align:center;"> <label class="btn btn-secondary" style="cursor:pointer;flex:1;text-align:center;">
<input type="file" id="wizardHeaderFile" accept="image/png,image/jpeg,image/jpg" style="display:none;" onchange="previewWizardHeader(this)"> <input type="file" id="wizardHeaderFile" accept="image/png,image/jpeg,image/jpg" style="display:none;" onchange="previewWizardHeader(this)">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="margin-right:6px;vertical-align:middle;"> <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="margin-right:6px;vertical-align:middle;">
<path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4M17 8l-5-5-5 5M12 3v12"/> <path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4M17 8l-5-5-5 5M12 3v12"/>
</svg> </svg>
${(hasAutoHeader || hasDiscoveredHeader) ? 'Choose Different Image' : 'Choose Image'} ${hasAutoHeader ? 'Choose Different Image' : 'Choose Image'}
</label> </label>
</div> </div>
<div class="action-buttons" style="margin-top:16px;"> <div class="action-buttons" style="margin-top:16px;">
@ -2760,7 +2758,7 @@
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="20 6 9 17 4 12"/> <polyline points="20 6 9 17 4 12"/>
</svg> </svg>
${(hasAutoHeader || hasDiscoveredHeader) ? 'Use This Image' : 'Continue'} ${hasAutoHeader ? 'Use This Image' : 'Continue'}
</button> </button>
<button class="btn btn-secondary" onclick="skipHeaderImage()">Skip for Now</button> <button class="btn btn-secondary" onclick="skipHeaderImage()">Skip for Now</button>
</div> </div>
@ -2777,13 +2775,6 @@
} }
}; };
reader.readAsDataURL(config.headerImageFile); 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';
}
} }
} }
@ -3686,25 +3677,7 @@
// Update localStorage with the new business ID to keep user logged in // Update localStorage with the new business ID to keep user logged in
localStorage.setItem('payfrit_portal_business', finalBusinessId); localStorage.setItem('payfrit_portal_business', finalBusinessId);
// Upload header image if one was selected, or download from discovered URL // Upload header image if one was selected
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) { if (config.headerImageFile && finalBusinessId) {
try { try {
const formData = new FormData(); const formData = new FormData();