@ticketboothapp/booking 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/colours.css +23 -0
- package/src/components/BookingDetails.module.css +1591 -0
- package/src/components/BookingDetails.tsx +2072 -354
- package/src/components/BookingWidget.tsx +28 -248
- package/src/components/JobApplicationDialog.module.css +440 -0
- package/src/components/JobApplicationDialog.tsx +620 -0
- package/src/components/ManageBookingView.tsx +28 -36
- package/src/components/PhoneInputWithCountry.module.css +131 -0
- package/src/components/PhoneInputWithCountry.tsx +44 -0
- package/src/components/PickupLocationDialog.module.css +360 -0
- package/src/components/PickupLocationDialog.tsx +357 -0
- package/src/components/PickupLocationMap.tsx +110 -0
- package/src/components/PostBookingDependentAddOnUpsell.module.css +174 -0
- package/src/components/PostBookingDependentAddOnUpsell.tsx +407 -0
- package/src/components/accordion.css +27 -0
- package/src/components/accordion.tsx +29 -0
- package/src/components/analytics/AnalyticsConsentRestore.tsx +19 -0
- package/src/components/analytics/AnalyticsScripts.tsx +106 -0
- package/src/components/analytics/CookieConsentBanner.css +86 -0
- package/src/components/analytics/CookieConsentBanner.tsx +102 -0
- package/src/components/booking/AddOnsSection.module.css +10 -0
- package/src/components/booking/AddOnsSection.tsx +184 -0
- package/src/components/booking/AdminPaymentChoiceModal.tsx +98 -0
- package/src/components/booking/BookingDialog.module.css +643 -0
- package/src/components/booking/BookingDialog.tsx +356 -0
- package/src/components/booking/BookingFlow.tsx +4385 -0
- package/src/components/booking/BookingFlowCollage.module.css +148 -0
- package/src/components/booking/BookingFlowCollage.tsx +184 -0
- package/src/components/booking/BookingFlowPlaceholder.module.css +27 -0
- package/src/components/booking/BookingFlowPlaceholder.tsx +25 -0
- package/src/components/booking/BookingFlowPreview.tsx +51 -0
- package/src/components/booking/BookingProductGrid.module.css +359 -0
- package/src/components/booking/BookingProductGrid.tsx +497 -0
- package/src/components/booking/Calendar.module.css +616 -0
- package/src/components/{Calendar.tsx → booking/Calendar.tsx} +464 -247
- package/src/components/booking/CancellationPolicySelector.module.css +124 -0
- package/src/components/booking/CancellationPolicySelector.tsx +142 -0
- package/src/components/booking/ChangeBookingDialog.tsx +562 -0
- package/src/components/booking/CheckoutForm.module.css +244 -0
- package/src/components/booking/CheckoutForm.tsx +364 -0
- package/src/components/{CheckoutModal.tsx → booking/CheckoutModal.tsx} +176 -19
- package/src/components/booking/DapFlowCollage.tsx +88 -0
- package/src/components/booking/DapTourDescription.tsx +35 -0
- package/src/components/booking/DependentAddOnBookingDialog.tsx +1350 -0
- package/src/components/booking/DependentAddOnPaymentForm.tsx +124 -0
- package/src/components/booking/InfoTooltip.tsx +108 -0
- package/src/components/booking/ItineraryBox.module.css +258 -0
- package/src/components/booking/ItineraryBox.tsx +550 -0
- package/src/components/{ItineraryBuilder.tsx → booking/ItineraryBuilder.tsx} +1 -2
- package/src/components/booking/ItineraryPlaceholder.module.css +45 -0
- package/src/components/booking/ItineraryPlaceholder.tsx +26 -0
- package/src/components/{MealDrinkAddOnSelector.tsx → booking/MealDrinkAddOnSelector.tsx} +21 -13
- package/src/components/booking/PickupLocationSelector.module.css +124 -0
- package/src/components/{PickupLocationSelector.tsx → booking/PickupLocationSelector.tsx} +315 -290
- package/src/components/booking/PickupTimeSelector.module.css +134 -0
- package/src/components/booking/PickupTimeSelector.tsx +112 -0
- package/src/components/{PriceBreakdown.tsx → booking/PriceBreakdown.tsx} +3 -3
- package/src/components/{PriceSummary.tsx → booking/PriceSummary.tsx} +51 -28
- package/src/components/booking/PrivateShuttleBookingFlow.module.css +357 -0
- package/src/components/booking/PrivateShuttleBookingFlow.tsx +2662 -0
- package/src/components/booking/PromoCodeInput.module.css +166 -0
- package/src/components/booking/PromoCodeInput.tsx +99 -0
- package/src/components/booking/ReturnTimeSelector.module.css +173 -0
- package/src/components/booking/ReturnTimeSelector.tsx +145 -0
- package/src/components/{TermsAcceptance.tsx → booking/TermsAcceptance.tsx} +9 -8
- package/src/components/booking/TicketSelector.module.css +164 -0
- package/src/components/booking/TicketSelector.tsx +199 -0
- package/src/components/booking/TourDescription.module.css +304 -0
- package/src/components/booking/TourDescription.tsx +273 -0
- package/src/components/booking/booking-flow-ui.ts +15 -1
- package/src/components/booking/booking-flow.css +944 -0
- package/src/components/bottom-sheet.module.css +78 -0
- package/src/components/bottom-sheet.tsx +60 -0
- package/src/components/breadcrumb.module.css +40 -0
- package/src/components/breadcrumb.tsx +36 -0
- package/src/components/button.css +245 -0
- package/src/components/button.tsx +152 -0
- package/src/components/client-bottom-sheet.tsx +14 -0
- package/src/components/colorable-svg.tsx +29 -0
- package/src/components/conditional-footer.tsx +27 -0
- package/src/components/contact-us.module.css +147 -0
- package/src/components/contact-us.tsx +49 -0
- package/src/components/email-signup.css +151 -0
- package/src/components/email-signup.tsx +63 -0
- package/src/components/faq-wrapper.module.css +47 -0
- package/src/components/faq-wrapper.tsx +15 -0
- package/src/components/footer.css +187 -0
- package/src/components/footer.tsx +143 -0
- package/src/components/global-simple-modal.tsx +33 -0
- package/src/components/google-review-summary.module.css +77 -0
- package/src/components/google-review-summary.tsx +50 -0
- package/src/components/hero-image.css +13 -0
- package/src/components/hero-image.tsx +44 -0
- package/src/components/image.css +29 -0
- package/src/components/image.tsx +113 -0
- package/src/components/language-aware-link.tsx +72 -0
- package/src/components/language-switcher.module.css +124 -0
- package/src/components/language-switcher.tsx +75 -0
- package/src/components/map-section.css +59 -0
- package/src/components/map-section.tsx +63 -0
- package/src/components/navbar.module.css +152 -0
- package/src/components/navbar.tsx +125 -0
- package/src/components/parallax-provider.tsx +11 -0
- package/src/components/partner/PartnerBookingPage.module.css +130 -0
- package/src/components/partner/PartnerBookingPage.tsx +390 -0
- package/src/components/partner/PartnerBookingPageWithBrowserMetadata.tsx +19 -35
- package/src/components/product-tag.module.css +30 -0
- package/src/components/product-tag.tsx +34 -0
- package/src/components/product-theme-pages/best-option.module.css +70 -0
- package/src/components/product-theme-pages/best-option.tsx +35 -0
- package/src/components/product-theme-pages/extended-tour-options.module.css +22 -0
- package/src/components/product-theme-pages/extended-tour-options.tsx +11 -0
- package/src/components/product-theme-pages/image-modal.tsx +248 -0
- package/src/components/product-theme-pages/photo-gallery.module.css +200 -0
- package/src/components/product-theme-pages/photo-gallery.tsx +90 -0
- package/src/components/product-theme-pages/product-theme-page-layout.module.css +13 -0
- package/src/components/product-theme-pages/product-theme-page-layout.tsx +67 -0
- package/src/components/product-theme-pages/top-of-fold.module.css +179 -0
- package/src/components/product-theme-pages/top-of-fold.tsx +80 -0
- package/src/components/product-tile/image-only-product-tile-desktop.module.css +106 -0
- package/src/components/product-tile/image-only-product-tile-desktop.tsx +56 -0
- package/src/components/product-tile/image-only-product-tile-mobile.module.css +122 -0
- package/src/components/product-tile/image-only-product-tile-mobile.tsx +89 -0
- package/src/components/product-tile/image-only-product-tile.tsx +44 -0
- package/src/components/product-tile/product-tile-card.module.css +84 -0
- package/src/components/product-tile/product-tile-card.tsx +61 -0
- package/src/components/review-highlights-section.css +85 -0
- package/src/components/review-highlights-section.tsx +127 -0
- package/src/components/season-closure-overlay.module.css +99 -0
- package/src/components/season-closure-overlay.tsx +98 -0
- package/src/components/simple-modal.tsx +69 -0
- package/src/components/simple-top-of-fold.module.css +76 -0
- package/src/components/simple-top-of-fold.tsx +34 -0
- package/src/components/spacer.css +41 -0
- package/src/components/spacer.tsx +23 -0
- package/src/components/star-rating.module.css +74 -0
- package/src/components/star-rating.tsx +48 -0
- package/src/components/terms/TermsContent.tsx +178 -0
- package/src/components/title-subtitle.module.css +10 -0
- package/src/components/title-subtitle.tsx +30 -0
- package/src/components/translatable-reviews.tsx +75 -0
- package/src/components/value-pill.module.css +59 -0
- package/src/components/value-pill.tsx +46 -0
- package/src/components/value-props.css +185 -0
- package/src/components/value-props.tsx +88 -0
- package/src/constants/booking-guide-quiz.ts +64 -0
- package/src/constants/contact-info.ts +2 -0
- package/src/constants/faq.ts +44 -0
- package/src/constants/images.ts +556 -0
- package/src/constants/json-ld/faq-json-ld.tsx +170 -0
- package/src/constants/json-ld/homepage-json-ld.tsx +138 -0
- package/src/constants/json-ld/job-posting-json-ld.tsx +92 -0
- package/src/constants/json-ld/organization-json-ld.tsx +62 -0
- package/src/constants/json-ld/page-json-ld.tsx +6 -0
- package/src/constants/json-ld/product-json-ld.tsx +154 -0
- package/src/constants/json-ld/review-json-ld.tsx +377 -0
- package/src/constants/navigation-links/footer-links.ts +48 -0
- package/src/constants/navigation-links/nav-bar-links.ts +41 -0
- package/src/constants/navigation-links/navigation-link.ts +6 -0
- package/src/constants/pill-values.ts +210 -0
- package/src/constants/products.ts +155 -0
- package/src/constants/quiz-recommendations.ts +506 -0
- package/src/constants/reviews.ts +75 -0
- package/src/constants/staff.ts +197 -0
- package/src/constants/value-props.ts +58 -0
- package/src/data/dap-descriptions/session-couples-families-friends.en.json +61 -0
- package/src/data/dap-descriptions/session-elopements.en.json +60 -0
- package/src/data/dap-descriptions/session-proposals.en.json +60 -0
- package/src/data/product-descriptions/afternoon-delight.en.json +35 -0
- package/src/data/product-descriptions/emerald-lake-escape.en.json +68 -0
- package/src/data/product-descriptions/lake-louise-adventure.en.json +74 -0
- package/src/data/product-descriptions/moraine-lake-adventure.en.json +78 -0
- package/src/data/product-descriptions/moraine-lake-sunrise-lake-louise-golden-hour.en.json +65 -0
- package/src/data/product-descriptions/moraine-lake-sunrise.en.json +64 -0
- package/src/data/product-descriptions/private-tour.en.json +80 -0
- package/src/data/product-descriptions/two-lakes-combo.en.json +65 -0
- package/src/data/products-config.json +101 -0
- package/src/hooks/use-bottom-sheet.tsx +15 -0
- package/src/hooks/use-simple-modal.tsx +27 -0
- package/src/hooks/useBookingSourceMetadataFromLocation.ts +21 -0
- package/src/hooks/useEmailSubscription.tsx +103 -0
- package/src/hooks/useEmbeddedInIframe.ts +16 -0
- package/src/hooks/useIsBookingLaunchLive.ts +49 -0
- package/src/hooks/useQuiz.tsx +210 -0
- package/src/index.ts +27 -2
- package/src/lib/analytics.ts +197 -0
- package/src/lib/booking/booking-source.ts +20 -2
- package/src/lib/{checkout-breakdown.ts → booking/checkout-breakdown.ts} +1 -1
- package/src/lib/booking/correlation-id.ts +46 -0
- package/src/lib/{i18n → booking/i18n}/messages/en.json +48 -4
- package/src/lib/{i18n → booking/i18n}/messages/fr.json +48 -4
- package/src/lib/booking/itinerary-display.ts +36 -0
- package/src/lib/{itinerary-labels.ts → booking/itinerary-labels.ts} +1 -1
- package/src/lib/{location-calculations.ts → booking/location-calculations.ts} +4 -4
- package/src/lib/{location-utils.ts → booking/location-utils.ts} +26 -0
- package/src/lib/{map-utils.ts → booking/map-utils.ts} +3 -3
- package/src/lib/booking/normalize-booking-product-id.ts +7 -0
- package/src/lib/{pickup-location-types.ts → booking/pickup-location-types.ts} +2 -2
- package/src/lib/{pricing.ts → booking/pricing.ts} +2 -2
- package/src/lib/booking/product-option-id.ts +35 -0
- package/src/lib/booking/source-metadata.ts +72 -7
- package/src/lib/booking/sunday-week.ts +14 -0
- package/src/lib/booking/trace-context.ts +62 -0
- package/src/lib/booking-api.ts +1793 -0
- package/src/lib/{constants.ts → booking-constants.ts} +11 -5
- package/src/lib/booking-types.ts +36 -0
- package/src/lib/currency.ts +38 -45
- package/src/lib/dap-descriptions.ts +50 -0
- package/src/lib/dap-itinerary-preview.ts +315 -0
- package/src/lib/dependent-add-on-api.ts +434 -0
- package/src/lib/env.ts +89 -5
- package/src/lib/firebase.ts +20 -0
- package/src/lib/job-application-api.ts +83 -0
- package/src/lib/manage-booking-embed-print.ts +16 -0
- package/src/lib/manage-booking-post-checkout.ts +68 -0
- package/src/lib/photo-dap-config.ts +228 -0
- package/src/lib/pickup/map-utils.ts +56 -0
- package/src/lib/pickup/marker-icons.ts +19 -0
- package/src/lib/product-descriptions.ts +66 -0
- package/src/lib/products-config.ts +73 -0
- package/src/providers/booking-dialog-provider.tsx +107 -38
- package/src/providers/bottom-sheet-provider.tsx +40 -0
- package/src/providers/dependent-add-on-dialog-provider.tsx +105 -0
- package/src/radius.css +5 -0
- package/src/spacing.css +7 -0
- package/src/strings/en.json +1774 -0
- package/src/strings/es.json +1573 -0
- package/src/strings/fr.json +1573 -0
- package/src/strings/index.js +23 -0
- package/src/text-style.css +97 -0
- package/src/types/fareharbor.d.ts +12 -0
- package/src/types/quiz.ts +59 -0
- package/src/utils/currency-converter.ts +101 -0
- package/src/components/BookingFlow.tsx +0 -2952
- package/src/components/LanguageSwitcher.tsx +0 -30
- package/src/components/PrivateShuttleBookingFlow.tsx +0 -2290
- package/src/components/ProductList.tsx +0 -78
- package/src/components/WhatsAppPhoneInput.tsx +0 -224
- package/src/components/index.ts +0 -31
- package/src/lib/api.ts +0 -801
- package/src/lib/booking-api-auth.ts +0 -9
- package/src/lib/checkout-breakdown.test.ts +0 -70
- package/src/types/google-maps.d.ts +0 -2
- /package/src/components/{CurrencySwitcher.tsx → booking/CurrencySwitcher.tsx} +0 -0
- /package/src/components/{ErrorBoundary.tsx → booking/ErrorBoundary.tsx} +0 -0
- /package/src/lib/{i18n → booking/i18n}/config.ts +0 -0
- /package/src/lib/{i18n → booking/i18n}/index.tsx +0 -0
- /package/src/lib/{marker-icons.ts → booking/marker-icons.ts} +0 -0
- /package/src/lib/{places-api.ts → booking/places-api.ts} +0 -0
- /package/src/lib/{theme.ts → booking/theme.ts} +0 -0
- /package/src/lib/{utils.ts → booking/utils.ts} +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manage-booking post-checkout helpers.
|
|
3
|
+
*
|
|
4
|
+
* Next.js `router.replace` remounts the page; React state for a success banner is lost.
|
|
5
|
+
* We stash a one-time marker in sessionStorage immediately before cleaning the URL
|
|
6
|
+
* (only paid *change booking* Stripe returns). New bookings use `reservationRef` → `ref`
|
|
7
|
+
* and never set this flag.
|
|
8
|
+
*
|
|
9
|
+
* We intentionally do not poll the booking API here: one landing fetch + optional remount
|
|
10
|
+
* fetch after `replace` is enough; avoid timers/retry loops that feel like “random” refreshes.
|
|
11
|
+
*/
|
|
12
|
+
const STORAGE_KEY = 'viavia:manage-booking:flash:v1';
|
|
13
|
+
|
|
14
|
+
export const MANAGE_BOOKING_QUERY_FROM = 'from';
|
|
15
|
+
/** Only paid *change booking* Stripe returns add this; new bookings must not use it. */
|
|
16
|
+
export const MANAGE_BOOKING_FROM_CHANGE_PAYMENT = 'change_payment';
|
|
17
|
+
|
|
18
|
+
/** Success copy for any self-serve booking change (no-pay, paid-after-Stripe, etc.). */
|
|
19
|
+
export function manageBookingChangeSuccessMessage(
|
|
20
|
+
preview: {
|
|
21
|
+
dateChanged?: boolean;
|
|
22
|
+
ticketsChanged?: boolean;
|
|
23
|
+
} | null,
|
|
24
|
+
): string {
|
|
25
|
+
const updates: string[] = [];
|
|
26
|
+
if (preview?.dateChanged) updates.push('date/time');
|
|
27
|
+
if (preview?.ticketsChanged) updates.push('ticket selection');
|
|
28
|
+
const suffix =
|
|
29
|
+
updates.length > 0 ? ` Updated ${updates.join(' and ')}.` : '';
|
|
30
|
+
return `Your booking was updated successfully.${suffix}`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type ManageBookingFlashPayload = {
|
|
34
|
+
v: 1;
|
|
35
|
+
kind: 'change_payment_success';
|
|
36
|
+
t: number;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export function setManageBookingFlashChangePaymentSuccess(): void {
|
|
40
|
+
if (typeof window === 'undefined') return;
|
|
41
|
+
try {
|
|
42
|
+
const payload: ManageBookingFlashPayload = {
|
|
43
|
+
v: 1,
|
|
44
|
+
kind: 'change_payment_success',
|
|
45
|
+
t: Date.now(),
|
|
46
|
+
};
|
|
47
|
+
sessionStorage.setItem(STORAGE_KEY, JSON.stringify(payload));
|
|
48
|
+
} catch {
|
|
49
|
+
/* private mode / quota */
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Read and clear. Returns user-facing message or null. */
|
|
54
|
+
export function consumeManageBookingFlash(): string | null {
|
|
55
|
+
if (typeof window === 'undefined') return null;
|
|
56
|
+
try {
|
|
57
|
+
const raw = sessionStorage.getItem(STORAGE_KEY);
|
|
58
|
+
if (!raw) return null;
|
|
59
|
+
sessionStorage.removeItem(STORAGE_KEY);
|
|
60
|
+
const j = JSON.parse(raw) as ManageBookingFlashPayload;
|
|
61
|
+
if (j?.v === 1 && j.kind === 'change_payment_success') {
|
|
62
|
+
return manageBookingChangeSuccessMessage(null);
|
|
63
|
+
}
|
|
64
|
+
} catch {
|
|
65
|
+
/* ignore */
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps photo-sessions packages to TicketBooth dependent add-on product (and optional option) IDs.
|
|
3
|
+
* Set NEXT_PUBLIC_DAP_* in .env.local to override seed defaults (e.g. other envs or 60/90 min options).
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { IMAGES } from '@/constants/images';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Default full-refund cancellation window (days before the scheduled photo session).
|
|
10
|
+
* Override per catalog entry in `getPhotoDapCatalog` when a DAP product differs.
|
|
11
|
+
*/
|
|
12
|
+
export const DEFAULT_PHOTO_DAP_CANCELLATION_DAYS_BEFORE_SESSION = 30;
|
|
13
|
+
|
|
14
|
+
/** Seeded test DAP: Friends, Family, & Couples (`dependent-add-on-products.json`) */
|
|
15
|
+
const COUPLES_SESSION_DEFAULT_PRODUCT_ID = 'dap_sM8pSzbFfU7P';
|
|
16
|
+
const ELOPEMENTS_SESSION_DEFAULT_PRODUCT_ID = 'dap_6tITweGzVyg8';
|
|
17
|
+
const PROPOSALS_SESSION_DEFAULT_PRODUCT_ID = 'dap_Xy3OCPIKQ7vr';
|
|
18
|
+
|
|
19
|
+
/** Session lengths for couples / families card — matches `dependent-add-on-products.json` options */
|
|
20
|
+
const COUPLES_SESSION_PRODUCT_OPTIONS = [
|
|
21
|
+
{
|
|
22
|
+
dependentAddOnProductOptionId: 'dapo_Ey0v4O7BjFaD',
|
|
23
|
+
label: '30 minutes',
|
|
24
|
+
photosLabel: '25 photos',
|
|
25
|
+
startingAtLabel: 'Starting at $499',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
dependentAddOnProductOptionId: 'dapo_caJh25HsTwKx',
|
|
29
|
+
label: '60 minutes',
|
|
30
|
+
photosLabel: '50 photos',
|
|
31
|
+
startingAtLabel: 'Starting at $799',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
dependentAddOnProductOptionId: 'dapo_6Km5njalQBp1',
|
|
35
|
+
label: '90 minutes',
|
|
36
|
+
photosLabel: '75 photos',
|
|
37
|
+
startingAtLabel: 'Starting at $799',
|
|
38
|
+
},
|
|
39
|
+
] as const;
|
|
40
|
+
|
|
41
|
+
const ELOPEMENTS_SESSION_PRODUCT_OPTIONS = [
|
|
42
|
+
{
|
|
43
|
+
dependentAddOnProductOptionId: 'dapo_XTeJt09NyNfX',
|
|
44
|
+
label: '30 minutes',
|
|
45
|
+
photosLabel: '25 photos',
|
|
46
|
+
startingAtLabel: 'Starting at $799',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
dependentAddOnProductOptionId: 'dapo_Y8AxYt6Tjaam',
|
|
50
|
+
label: '60 minutes',
|
|
51
|
+
photosLabel: '50 photos',
|
|
52
|
+
startingAtLabel: 'Starting at $999',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
dependentAddOnProductOptionId: 'dapo_YdmxIiQPxEJg',
|
|
56
|
+
label: '90 minutes',
|
|
57
|
+
photosLabel: '75 photos',
|
|
58
|
+
startingAtLabel: 'Starting at $1199',
|
|
59
|
+
},
|
|
60
|
+
] as const;
|
|
61
|
+
|
|
62
|
+
const PROPOSALS_SESSION_PRODUCT_OPTIONS = [
|
|
63
|
+
{
|
|
64
|
+
dependentAddOnProductOptionId: 'dapo_SMRxjfDpIvwU',
|
|
65
|
+
label: '30 minutes',
|
|
66
|
+
photosLabel: '25 photos',
|
|
67
|
+
startingAtLabel: 'Starting at $799',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
dependentAddOnProductOptionId: 'dapo_FyMbFgrBU4L8',
|
|
71
|
+
label: '60 minutes',
|
|
72
|
+
photosLabel: '50 photos',
|
|
73
|
+
startingAtLabel: 'Starting at $999',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
dependentAddOnProductOptionId: 'dapo_EOohfF0g2i1D',
|
|
77
|
+
label: '90 minutes',
|
|
78
|
+
photosLabel: '75 photos',
|
|
79
|
+
startingAtLabel: 'Starting at $1199',
|
|
80
|
+
},
|
|
81
|
+
] as const;
|
|
82
|
+
|
|
83
|
+
export const PHOTO_DAP_SLUGS = [
|
|
84
|
+
'session-couples-families-friends',
|
|
85
|
+
'session-elopements',
|
|
86
|
+
'session-proposals',
|
|
87
|
+
] as const;
|
|
88
|
+
|
|
89
|
+
export type PhotoDapSlug = (typeof PHOTO_DAP_SLUGS)[number];
|
|
90
|
+
|
|
91
|
+
export type PhotoDapProductOption = {
|
|
92
|
+
dependentAddOnProductOptionId: string;
|
|
93
|
+
/** First line on the tile (e.g. duration). */
|
|
94
|
+
label: string;
|
|
95
|
+
/** Second line (e.g. edited photo count). */
|
|
96
|
+
photosLabel?: string;
|
|
97
|
+
/** Third line (e.g. "Starting at $399"). */
|
|
98
|
+
startingAtLabel?: string;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export type PhotoDapCatalog = {
|
|
102
|
+
dependentAddOnProductId: string;
|
|
103
|
+
/** When set, that option is fixed (no picker). Env `NEXT_PUBLIC_DAP_PHOTO_SESSION_COUPLES_OPTION_ID` forces this for couples. */
|
|
104
|
+
dependentAddOnProductOptionId?: string;
|
|
105
|
+
/** When multiple entries and no fixed option id, the dialog shows a session-length control */
|
|
106
|
+
productOptions?: PhotoDapProductOption[];
|
|
107
|
+
/** Bunny CDN IDs for DapFlowCollage (hero + four-tile grid) */
|
|
108
|
+
collageImageIds: string[];
|
|
109
|
+
/**
|
|
110
|
+
* Days before the scheduled photo session that a full refund still applies for this DAP product.
|
|
111
|
+
* Should match TicketBooth dependent add-on product config; availability API may override when present.
|
|
112
|
+
*/
|
|
113
|
+
cancellationDaysBeforeSession: number;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/** Image sets for the dependent add-on dialog collage (photos only; no video). */
|
|
117
|
+
export function photoDapCollageImageIds(slug: PhotoDapSlug): string[] {
|
|
118
|
+
switch (slug) {
|
|
119
|
+
case 'session-couples-families-friends':
|
|
120
|
+
return [
|
|
121
|
+
IMAGES.FAMILY_MORIANE_LAKE_ROCKPILE.id,
|
|
122
|
+
IMAGES.PRIVATE_TOUR_FAMILY_MORAINE_LAKE.id,
|
|
123
|
+
IMAGES.GIRLS_DAY_RAINY_LAKE_LOUISE.id,
|
|
124
|
+
IMAGES.MORAINE_LAKE_COUPLE_AT_WATER.id,
|
|
125
|
+
IMAGES.MORAINE_LAKE_SUNRISE_GIRL_FRIENDS.id,
|
|
126
|
+
];
|
|
127
|
+
case 'session-elopements':
|
|
128
|
+
return [
|
|
129
|
+
IMAGES.MORAINE_LAKE_SUNRISE_ELOPEMENT.id,
|
|
130
|
+
IMAGES.SENTINEL_PASS_ELOPEMENT_SNOW.id,
|
|
131
|
+
IMAGES.MORAINE_LAKE_ELOPEMENT.id,
|
|
132
|
+
IMAGES.SENTINEL_PASS_ELOPEMENT_SNOW_HORIZONTAL.id,
|
|
133
|
+
IMAGES.MORAINE_LAKE_ELOPEMENT_LAKESHORE.id,
|
|
134
|
+
];
|
|
135
|
+
case 'session-proposals':
|
|
136
|
+
return [
|
|
137
|
+
IMAGES.LAKE_LOUISE_KISS.id,
|
|
138
|
+
IMAGES.MORAINE_LAKE_PROPOSE_CRY.id,
|
|
139
|
+
IMAGES.MORAINE_LAKE_OVERCAST_PROPOSE.id,
|
|
140
|
+
IMAGES.MORAINE_LAKE_PROPOSAL.id,
|
|
141
|
+
IMAGES.MORAINE_LAKE_PROPOSE.id,
|
|
142
|
+
];
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function trimEnv(value: string | undefined): string {
|
|
147
|
+
return (value ?? '').trim();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Returns catalog when product id is known (env or built-in default for couples session).
|
|
152
|
+
* Otherwise null (card falls back to #book-now).
|
|
153
|
+
*/
|
|
154
|
+
export function getPhotoDapCatalog(slug: PhotoDapSlug): PhotoDapCatalog | null {
|
|
155
|
+
if (slug === 'session-couples-families-friends') {
|
|
156
|
+
const productId =
|
|
157
|
+
trimEnv(process.env.NEXT_PUBLIC_DAP_PHOTO_SESSION_COUPLES_PRODUCT_ID) ||
|
|
158
|
+
COUPLES_SESSION_DEFAULT_PRODUCT_ID;
|
|
159
|
+
const forcedOptionId = trimEnv(
|
|
160
|
+
process.env.NEXT_PUBLIC_DAP_PHOTO_SESSION_COUPLES_OPTION_ID
|
|
161
|
+
);
|
|
162
|
+
const collageImageIds = photoDapCollageImageIds('session-couples-families-friends');
|
|
163
|
+
if (forcedOptionId) {
|
|
164
|
+
return {
|
|
165
|
+
dependentAddOnProductId: productId,
|
|
166
|
+
dependentAddOnProductOptionId: forcedOptionId,
|
|
167
|
+
collageImageIds,
|
|
168
|
+
cancellationDaysBeforeSession: DEFAULT_PHOTO_DAP_CANCELLATION_DAYS_BEFORE_SESSION,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
return {
|
|
172
|
+
dependentAddOnProductId: productId,
|
|
173
|
+
productOptions: [...COUPLES_SESSION_PRODUCT_OPTIONS],
|
|
174
|
+
collageImageIds,
|
|
175
|
+
cancellationDaysBeforeSession: DEFAULT_PHOTO_DAP_CANCELLATION_DAYS_BEFORE_SESSION,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (slug === 'session-elopements') {
|
|
180
|
+
const productId =
|
|
181
|
+
trimEnv(process.env.NEXT_PUBLIC_DAP_PHOTO_SESSION_ELOPEMENTS_PRODUCT_ID) ||
|
|
182
|
+
ELOPEMENTS_SESSION_DEFAULT_PRODUCT_ID;
|
|
183
|
+
const forcedOptionId = trimEnv(
|
|
184
|
+
process.env.NEXT_PUBLIC_DAP_PHOTO_SESSION_ELOPEMENTS_OPTION_ID
|
|
185
|
+
);
|
|
186
|
+
const collageImageIds = photoDapCollageImageIds('session-elopements');
|
|
187
|
+
if (forcedOptionId) {
|
|
188
|
+
return {
|
|
189
|
+
dependentAddOnProductId: productId,
|
|
190
|
+
dependentAddOnProductOptionId: forcedOptionId,
|
|
191
|
+
collageImageIds,
|
|
192
|
+
cancellationDaysBeforeSession: DEFAULT_PHOTO_DAP_CANCELLATION_DAYS_BEFORE_SESSION,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
dependentAddOnProductId: productId,
|
|
197
|
+
productOptions: [...ELOPEMENTS_SESSION_PRODUCT_OPTIONS],
|
|
198
|
+
collageImageIds,
|
|
199
|
+
cancellationDaysBeforeSession: DEFAULT_PHOTO_DAP_CANCELLATION_DAYS_BEFORE_SESSION,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (slug === 'session-proposals') {
|
|
204
|
+
const productId =
|
|
205
|
+
trimEnv(process.env.NEXT_PUBLIC_DAP_PHOTO_SESSION_PROPOSALS_PRODUCT_ID) ||
|
|
206
|
+
PROPOSALS_SESSION_DEFAULT_PRODUCT_ID;
|
|
207
|
+
const forcedOptionId = trimEnv(
|
|
208
|
+
process.env.NEXT_PUBLIC_DAP_PHOTO_SESSION_PROPOSALS_OPTION_ID
|
|
209
|
+
);
|
|
210
|
+
const collageImageIds = photoDapCollageImageIds('session-proposals');
|
|
211
|
+
if (forcedOptionId) {
|
|
212
|
+
return {
|
|
213
|
+
dependentAddOnProductId: productId,
|
|
214
|
+
dependentAddOnProductOptionId: forcedOptionId,
|
|
215
|
+
collageImageIds,
|
|
216
|
+
cancellationDaysBeforeSession: DEFAULT_PHOTO_DAP_CANCELLATION_DAYS_BEFORE_SESSION,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
return {
|
|
220
|
+
dependentAddOnProductId: productId,
|
|
221
|
+
productOptions: [...PROPOSALS_SESSION_PRODUCT_OPTIONS],
|
|
222
|
+
collageImageIds,
|
|
223
|
+
cancellationDaysBeforeSession: DEFAULT_PHOTO_DAP_CANCELLATION_DAYS_BEFORE_SESSION,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Maps utilities for pickup location picker
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface MapCenter {
|
|
6
|
+
lat: number;
|
|
7
|
+
lng: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface PickupLocationWithCoords {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
address: string;
|
|
14
|
+
coordinates?: { lat: number; lng: number };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const DEFAULT_CENTER: MapCenter = { lat: 51.1784, lng: -115.5708 };
|
|
18
|
+
|
|
19
|
+
export function calculateMapCenter(pickupLocations: PickupLocationWithCoords[]): MapCenter {
|
|
20
|
+
const withCoords = pickupLocations.filter((l) => l.coordinates);
|
|
21
|
+
if (withCoords.length > 0 && withCoords[0].coordinates) {
|
|
22
|
+
return withCoords[0].coordinates;
|
|
23
|
+
}
|
|
24
|
+
return DEFAULT_CENTER;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function getMapOptions(): google.maps.MapOptions {
|
|
28
|
+
return {
|
|
29
|
+
disableDefaultUI: false,
|
|
30
|
+
clickableIcons: false,
|
|
31
|
+
scrollwheel: true,
|
|
32
|
+
zoomControl: true,
|
|
33
|
+
streetViewControl: false,
|
|
34
|
+
mapTypeControl: false,
|
|
35
|
+
fullscreenControl: true,
|
|
36
|
+
gestureHandling: 'cooperative',
|
|
37
|
+
} as google.maps.MapOptions;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function calculateMapBounds(
|
|
41
|
+
pickupLocations: PickupLocationWithCoords[]
|
|
42
|
+
): google.maps.LatLngBounds | null {
|
|
43
|
+
if (typeof google === 'undefined' || !google.maps) return null;
|
|
44
|
+
try {
|
|
45
|
+
const bounds = new google.maps.LatLngBounds();
|
|
46
|
+
pickupLocations.forEach((loc) => {
|
|
47
|
+
if (loc.coordinates) bounds.extend(loc.coordinates);
|
|
48
|
+
});
|
|
49
|
+
return bounds.getNorthEast().lat() !== bounds.getSouthWest().lat() ||
|
|
50
|
+
bounds.getNorthEast().lng() !== bounds.getSouthWest().lng()
|
|
51
|
+
? bounds
|
|
52
|
+
: null;
|
|
53
|
+
} catch {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marker icon generation for pickup location pins
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
function validateColor(color: string): string {
|
|
6
|
+
const hexColorRegex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
|
|
7
|
+
return hexColorRegex.test(color) ? color : '#dc2626';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function createPinMarkerIcon(color: string): string {
|
|
11
|
+
const safeColor = validateColor(color);
|
|
12
|
+
return `data:image/svg+xml;charset=UTF-8,${encodeURIComponent(`
|
|
13
|
+
<svg width="32" height="40" viewBox="0 0 32 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
14
|
+
<path d="M16 0C7.163 0 0 7.163 0 16C0 24.837 16 40 16 40C16 40 32 24.837 32 16C32 7.163 24.837 0 16 0Z" fill="#ffffff"/>
|
|
15
|
+
<path d="M16 2C8.268 2 2 8.268 2 16C2 22.177 16 38 16 38C16 38 30 22.177 30 16C30 8.268 23.732 2 16 2Z" fill="${safeColor}"/>
|
|
16
|
+
<circle cx="16" cy="16" r="6" fill="#ffffff"/>
|
|
17
|
+
</svg>
|
|
18
|
+
`)}`;
|
|
19
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product description content loader.
|
|
3
|
+
* Loads full tour descriptions from src/data/product-descriptions/{slug}.{locale}.json
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface ProductDescriptionReview {
|
|
7
|
+
text: string;
|
|
8
|
+
name: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Section content: string for HTML, string[] for bullet list OR joined HTML (array of lines for readability) */
|
|
12
|
+
export type SectionContent = string | string[];
|
|
13
|
+
|
|
14
|
+
export interface ProductDescriptionResult {
|
|
15
|
+
shortDescription?: string;
|
|
16
|
+
paragraphs: string[];
|
|
17
|
+
review?: ProductDescriptionReview;
|
|
18
|
+
sections: { title: string; content: SectionContent }[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface ProductDescriptionData {
|
|
22
|
+
shortDescription?: string;
|
|
23
|
+
paragraphs: string[];
|
|
24
|
+
review?: ProductDescriptionReview;
|
|
25
|
+
sections: { title: string; content: SectionContent }[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Static imports - add new locales here when available
|
|
29
|
+
import moraineLakeSunriseLakeLouiseGoldenHourEn from '@/data/product-descriptions/moraine-lake-sunrise-lake-louise-golden-hour.en.json';
|
|
30
|
+
import moraineLakeSunriseEn from '@/data/product-descriptions/moraine-lake-sunrise.en.json';
|
|
31
|
+
import twoLakesComboEn from '@/data/product-descriptions/two-lakes-combo.en.json';
|
|
32
|
+
import moraineLakeAdventureEn from '@/data/product-descriptions/moraine-lake-adventure.en.json';
|
|
33
|
+
import lakeLouiseAdventureEn from '@/data/product-descriptions/lake-louise-adventure.en.json';
|
|
34
|
+
import emeraldLakeEscapeEn from '@/data/product-descriptions/emerald-lake-escape.en.json';
|
|
35
|
+
import afternoonDelightEn from '@/data/product-descriptions/afternoon-delight.en.json';
|
|
36
|
+
import privateTourEn from '@/data/product-descriptions/private-tour.en.json';
|
|
37
|
+
|
|
38
|
+
const DESCRIPTIONS: Record<string, Record<string, ProductDescriptionData>> = {
|
|
39
|
+
en: {
|
|
40
|
+
'moraine-lake-sunrise-lake-louise-golden-hour': moraineLakeSunriseLakeLouiseGoldenHourEn as ProductDescriptionData,
|
|
41
|
+
'moraine-lake-sunrise': moraineLakeSunriseEn as ProductDescriptionData,
|
|
42
|
+
'two-lakes-combo': twoLakesComboEn as ProductDescriptionData,
|
|
43
|
+
'moraine-lake-adventure': moraineLakeAdventureEn as ProductDescriptionData,
|
|
44
|
+
'lake-louise-adventure': lakeLouiseAdventureEn as ProductDescriptionData,
|
|
45
|
+
'emerald-lake-escape': emeraldLakeEscapeEn as ProductDescriptionData,
|
|
46
|
+
'afternoon-delight': afternoonDelightEn as ProductDescriptionData,
|
|
47
|
+
'private-tour': privateTourEn as ProductDescriptionData,
|
|
48
|
+
},
|
|
49
|
+
// Add fr, es etc. when files exist:
|
|
50
|
+
// fr: { ... },
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export function getProductDescription(
|
|
54
|
+
slug: string,
|
|
55
|
+
locale: string
|
|
56
|
+
): ProductDescriptionResult | null {
|
|
57
|
+
const localeData = DESCRIPTIONS[locale] ?? DESCRIPTIONS.en;
|
|
58
|
+
const data = localeData?.[slug];
|
|
59
|
+
if (!data) return null;
|
|
60
|
+
return {
|
|
61
|
+
shortDescription: data.shortDescription,
|
|
62
|
+
paragraphs: data.paragraphs ?? [],
|
|
63
|
+
review: data.review,
|
|
64
|
+
sections: data.sections ?? [],
|
|
65
|
+
};
|
|
66
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Load products config from JSON (build-time / static).
|
|
3
|
+
* Later: can be swapped for API fetch or generated by TicketBooth script.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { ProductsConfig, ProductConfig } from './booking-types';
|
|
7
|
+
import type { Product, ProductOption } from '@/lib/booking-api';
|
|
8
|
+
import { getImageUrl } from '@/constants/images';
|
|
9
|
+
|
|
10
|
+
// Import JSON - Next.js supports this; ensure tsconfig has "resolveJsonModule": true
|
|
11
|
+
import productsConfigJson from '@/data/products-config.json';
|
|
12
|
+
|
|
13
|
+
const config = productsConfigJson as ProductsConfig;
|
|
14
|
+
|
|
15
|
+
export function getProductsConfig(): ProductsConfig {
|
|
16
|
+
return config;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function getProductsForBooking(): ProductConfig[] {
|
|
20
|
+
return config.products;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function getProductBySlug(slug: string): ProductConfig | null {
|
|
24
|
+
return config.products.find((p) => p.display.slug === slug) ?? null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function getProductByOptionId(optionId: string): ProductConfig | null {
|
|
28
|
+
return (
|
|
29
|
+
config.products.find((p) => p.optionIds.includes(optionId)) ?? null
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Find product by productId, optionId, or slug */
|
|
34
|
+
export function getProductByIdOrSlug(idOrSlug: string): ProductConfig | null {
|
|
35
|
+
const bySlug = getProductBySlug(idOrSlug);
|
|
36
|
+
if (bySlug) return bySlug;
|
|
37
|
+
const byOption = getProductByOptionId(idOrSlug);
|
|
38
|
+
if (byOption) return byOption;
|
|
39
|
+
return config.products.find((p) => p.productId === idOrSlug) ?? null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Build a minimal Product from config for immediate availability fetch.
|
|
44
|
+
* Use when API product is still loading - allows get-availabilities to run in parallel with /products.
|
|
45
|
+
*/
|
|
46
|
+
export function buildMinimalProductFromConfig(
|
|
47
|
+
config: ProductConfig,
|
|
48
|
+
companyId: string
|
|
49
|
+
): Product {
|
|
50
|
+
const options: ProductOption[] = config.optionIds.map((optionId) => ({
|
|
51
|
+
optionId,
|
|
52
|
+
name: '',
|
|
53
|
+
description: null,
|
|
54
|
+
pricing: {},
|
|
55
|
+
status: 'ACTIVE',
|
|
56
|
+
}));
|
|
57
|
+
return {
|
|
58
|
+
productId: config.productId,
|
|
59
|
+
companyId,
|
|
60
|
+
name: config.display.shortName,
|
|
61
|
+
description: null,
|
|
62
|
+
status: 'ACTIVE',
|
|
63
|
+
productType: config.productType ?? 'STANDARD',
|
|
64
|
+
options,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Get image URL for a product (first image from config) */
|
|
69
|
+
export function getProductImageUrl(product: ProductConfig): string {
|
|
70
|
+
const imageId = product.display.imageIds[0];
|
|
71
|
+
if (!imageId) return '';
|
|
72
|
+
return getImageUrl(imageId);
|
|
73
|
+
}
|