diff --git a/public/index.html b/public/index.html index 861097c..2342a03 100644 --- a/public/index.html +++ b/public/index.html @@ -2286,6 +2286,41 @@ .filter(Boolean))]; } + function formatComponentLabel(value) { + const key = String(value || '').trim().toLowerCase(); + const labels = { + flight: 'Flight', + flights: 'Flight', + hotel: 'Hotel', + hoteltransfer: 'Hotel transfer', + hoteltransfers: 'Hotel transfers', + transfer: 'Transfer', + transfers: 'Transfers', + golf: 'Golf', + nightlife: 'Nightlife', + excursion: 'Excursion', + incidentals: 'Incidentals', + amenities: 'Amenities', + }; + if (labels[key]) return labels[key]; + return String(value || '') + .replace(/([a-z])([A-Z])/g, '$1 $2') + .replace(/[_-]+/g, ' ') + .replace(/\s+/g, ' ') + .trim() + .replace(/\b\w/g, (char) => char.toUpperCase()); + } + + function renderComponentChips(items) { + const chips = normalizeTextList(items).map(formatComponentLabel); + if (!chips.length) return ''; + return ` +
+ ${chips.map(item => `${escapeHtml(item)}`).join('')} +
+ `; + } + function renderTextChips(items) { const chips = normalizeTextList(items); if (!chips.length) return ''; @@ -2390,7 +2425,9 @@ const inclusions = filterStandaloneDetails(selectedPoint?.inclusions || opt.automationInsights?.inclusions); const limitations = filterStandaloneDetails(selectedPoint?.limitations || opt.automationInsights?.limitations); const includedComponents = normalizeTextList(selectedPoint?.includedComponents || opt.automationInsights?.includedComponents); - const flightsIncluded = includedComponents.some(item => /flight/i.test(item)); + const excludedComponents = normalizeTextList(selectedPoint?.excludedComponents || opt.automationInsights?.excludedComponents); + const packageHighlights = normalizeTextList(selectedPoint?.highlights || opt.automationInsights?.highlights); + const packageInclusions = normalizeTextList(selectedPoint?.inclusions || opt.automationInsights?.inclusions); const sourceMetaLine = selectedMeta ? [formatSourcePrice(selectedMeta) || priceLabel, selectedMeta.pointCount ? `${selectedMeta.pointCount} point${selectedMeta.pointCount === 1 ? '' : 's'}` : ''] .filter(Boolean) @@ -2465,11 +2502,38 @@ `); } - if (tabId === BUNDLE_TAB_ID && flightsIncluded) { + if (tabId === BUNDLE_TAB_ID && includedComponents.length) { sections.push(`
-
Flights included
- ${renderTextChips(includedComponents)} +
What's included
+ ${renderComponentChips(includedComponents)} +
+ `); + } + + if (tabId === BUNDLE_TAB_ID && excludedComponents.length) { + sections.push(` +
+
Not included
+ ${renderComponentChips(excludedComponents)} +
+ `); + } + + if (tabId === BUNDLE_TAB_ID && packageHighlights.length) { + sections.push(` +
+
Package perks
+ ${renderTextChips(packageHighlights)} +
+ `); + } + + if (tabId === BUNDLE_TAB_ID && packageInclusions.length) { + sections.push(` +
+
Package inclusions
+ ${renderTextChips(packageInclusions)}
`); }