@ticketboothapp/booking 0.1.11 → 0.1.13
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 +2 -1
- package/src/app/photo-sessions/photo-packages.ts +75 -0
- package/src/assets/icons/partner-logos/getyourguide.svg +8 -0
- package/src/assets/icons/plus.svg +3 -0
- 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,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ticket selector - quantity controls per ticket category
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
.header {
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: flex-start;
|
|
9
|
+
gap: 0.5rem;
|
|
10
|
+
margin-bottom: 1rem;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.label {
|
|
14
|
+
display: block;
|
|
15
|
+
font-size: 0.875rem;
|
|
16
|
+
font-weight: 500;
|
|
17
|
+
color: var(--booking-stone-700, #44403c);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.list {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
gap: 1rem;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.row {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: space-between;
|
|
30
|
+
padding: 1rem;
|
|
31
|
+
background: var(--booking-stone-50, #fafaf9);
|
|
32
|
+
border-radius: 0.5rem;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.category {
|
|
36
|
+
font-weight: 500;
|
|
37
|
+
color: var(--booking-stone-900, #1c1917);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.ageHint {
|
|
41
|
+
font-size: 0.75rem;
|
|
42
|
+
font-weight: 400;
|
|
43
|
+
color: var(--booking-stone-500, #78716c);
|
|
44
|
+
margin-left: 0.25rem;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.price {
|
|
48
|
+
font-size: 0.875rem;
|
|
49
|
+
color: var(--booking-stone-500, #78716c);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.priceStrikethrough {
|
|
53
|
+
text-decoration: line-through;
|
|
54
|
+
color: var(--booking-stone-400, #a8a29e);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.priceDiscount {
|
|
58
|
+
color: var(--booking-emerald-600, #059669);
|
|
59
|
+
font-weight: 500;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.controls {
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
gap: 0.75rem;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.qtyBtn {
|
|
69
|
+
width: 2.5rem;
|
|
70
|
+
height: 2.5rem;
|
|
71
|
+
border-radius: 9999px;
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
justify-content: center;
|
|
75
|
+
font-size: 1.25rem;
|
|
76
|
+
transition: all 0.2s;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.qtyBtnDecrement {
|
|
80
|
+
width: 2.5rem;
|
|
81
|
+
height: 2.5rem;
|
|
82
|
+
border-radius: 9999px;
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
font-size: 1.25rem;
|
|
87
|
+
background: #fff;
|
|
88
|
+
border: 1px solid var(--booking-stone-300, #d6d3d1);
|
|
89
|
+
color: var(--booking-stone-600, #57534e);
|
|
90
|
+
transition: all 0.2s;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.qtyBtnDecrement:hover:not(:disabled) {
|
|
94
|
+
background: var(--booking-stone-100, #f5f5f4);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.qtyBtnDecrement:disabled {
|
|
98
|
+
opacity: 0.5;
|
|
99
|
+
cursor: not-allowed;
|
|
100
|
+
background: var(--booking-stone-100, #f5f5f4);
|
|
101
|
+
color: var(--booking-stone-400, #a8a29e);
|
|
102
|
+
border-color: var(--booking-stone-200, #e7e5e4);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.qtyBtnIncrement {
|
|
106
|
+
width: 2.5rem;
|
|
107
|
+
height: 2.5rem;
|
|
108
|
+
border-radius: 9999px;
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
justify-content: center;
|
|
112
|
+
font-size: 1.25rem;
|
|
113
|
+
background: #fff;
|
|
114
|
+
border: 1px solid var(--booking-stone-300, #d6d3d1);
|
|
115
|
+
color: var(--booking-stone-600, #57534e);
|
|
116
|
+
transition: all 0.2s;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.qtyBtnIncrement:hover:not(:disabled) {
|
|
120
|
+
background: var(--booking-stone-100, #f5f5f4);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.qtyBtnIncrement:disabled {
|
|
124
|
+
opacity: 0.5;
|
|
125
|
+
cursor: not-allowed;
|
|
126
|
+
background: var(--booking-stone-100, #f5f5f4);
|
|
127
|
+
color: var(--booking-stone-400, #a8a29e);
|
|
128
|
+
border-color: var(--booking-stone-200, #e7e5e4);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.qtyBtnOverbook {
|
|
132
|
+
width: 2.5rem;
|
|
133
|
+
height: 2.5rem;
|
|
134
|
+
border-radius: 9999px;
|
|
135
|
+
display: flex;
|
|
136
|
+
align-items: center;
|
|
137
|
+
justify-content: center;
|
|
138
|
+
font-size: 1.25rem;
|
|
139
|
+
background: #fee2e2;
|
|
140
|
+
border: 2px solid #ef4444;
|
|
141
|
+
color: #b91c1c;
|
|
142
|
+
cursor: pointer;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.qtyBtnOverbook:hover {
|
|
146
|
+
background: #fecaca;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.qtyValue {
|
|
150
|
+
width: 2rem;
|
|
151
|
+
text-align: center;
|
|
152
|
+
font-weight: 500;
|
|
153
|
+
color: var(--booking-stone-900, #1c1917);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.overbookWarning {
|
|
157
|
+
font-size: 1rem;
|
|
158
|
+
font-weight: 600;
|
|
159
|
+
color: #b91c1c;
|
|
160
|
+
margin-top: 1.75rem;
|
|
161
|
+
padding-top: 0.5rem;
|
|
162
|
+
text-align: center;
|
|
163
|
+
font-variant-numeric: tabular-nums;
|
|
164
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { parseISO } from 'date-fns';
|
|
5
|
+
import { enUS, fr } from 'date-fns/locale';
|
|
6
|
+
import { formatInTimeZone } from 'date-fns-tz';
|
|
7
|
+
import { formatCurrencyAmount } from '@/lib/currency';
|
|
8
|
+
import type { Currency } from './CurrencySwitcher';
|
|
9
|
+
import styles from './TicketSelector.module.css';
|
|
10
|
+
|
|
11
|
+
type TranslationFn = (key: string, params?: Record<string, string | number>) => string;
|
|
12
|
+
|
|
13
|
+
export interface TicketRate {
|
|
14
|
+
category: string;
|
|
15
|
+
rateId: string;
|
|
16
|
+
available: number;
|
|
17
|
+
price: number;
|
|
18
|
+
priceCAD: number;
|
|
19
|
+
baseInDisplayCurrency?: number;
|
|
20
|
+
appliedAdjustments?: Array<{ type: string; id: string; name: string; changeByCurrency?: Record<string, number> }>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface TicketSelectorProps {
|
|
24
|
+
pricing: TicketRate[];
|
|
25
|
+
quantities: Record<string, number>;
|
|
26
|
+
totalQuantity: number;
|
|
27
|
+
/** Min vacancies across pickup (and return when selected); party cannot exceed this without overbooking. */
|
|
28
|
+
selectedVacancies: number;
|
|
29
|
+
/** Company TZ + leg datetimes for overbooking copy (departure vs return vs both). */
|
|
30
|
+
companyTimezone: string;
|
|
31
|
+
pickupDateTime: string;
|
|
32
|
+
pickupVacancies: number;
|
|
33
|
+
returnDateTime: string | null;
|
|
34
|
+
returnVacancies: number | null;
|
|
35
|
+
resourceCount: number | null;
|
|
36
|
+
currency: Currency;
|
|
37
|
+
locale: string;
|
|
38
|
+
isAdmin: boolean;
|
|
39
|
+
isSimplifiedPricingView: boolean;
|
|
40
|
+
t: TranslationFn;
|
|
41
|
+
onQuantityChange: (category: string, delta: number) => void;
|
|
42
|
+
/**
|
|
43
|
+
* When set (e.g. change booking), decrement is disabled at or below these counts per category.
|
|
44
|
+
* Categories omitted are treated as minimum 0.
|
|
45
|
+
*/
|
|
46
|
+
minimumQuantities?: Record<string, number>;
|
|
47
|
+
/** Optional per-category unit floor (change flow). Keys are uppercased categories (e.g. ADULT). */
|
|
48
|
+
ticketUnitFloorByCategory?: Map<string, number>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function TicketSelector({
|
|
52
|
+
pricing,
|
|
53
|
+
quantities,
|
|
54
|
+
totalQuantity,
|
|
55
|
+
selectedVacancies,
|
|
56
|
+
companyTimezone,
|
|
57
|
+
pickupDateTime,
|
|
58
|
+
pickupVacancies,
|
|
59
|
+
returnDateTime,
|
|
60
|
+
returnVacancies,
|
|
61
|
+
resourceCount,
|
|
62
|
+
currency,
|
|
63
|
+
locale,
|
|
64
|
+
isAdmin,
|
|
65
|
+
isSimplifiedPricingView,
|
|
66
|
+
t,
|
|
67
|
+
onQuantityChange,
|
|
68
|
+
minimumQuantities,
|
|
69
|
+
ticketUnitFloorByCategory,
|
|
70
|
+
}: TicketSelectorProps) {
|
|
71
|
+
/** Party size vs tighter of pickup/return vacancies (parent passes min of both legs). */
|
|
72
|
+
const isOverbookedTickets = totalQuantity > selectedVacancies;
|
|
73
|
+
const isOverbooked = isOverbookedTickets;
|
|
74
|
+
|
|
75
|
+
const overbookingDetailMessage = useMemo(() => {
|
|
76
|
+
if (!isOverbooked) return null;
|
|
77
|
+
const dateFnsLocale = locale === 'fr' ? fr : enUS;
|
|
78
|
+
const timePattern = locale === 'fr' ? 'HH:mm' : 'h:mm a';
|
|
79
|
+
const timeLabel = (iso: string) => {
|
|
80
|
+
try {
|
|
81
|
+
return formatInTimeZone(parseISO(iso), companyTimezone, timePattern, { locale: dateFnsLocale });
|
|
82
|
+
} catch {
|
|
83
|
+
return '';
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const pickupT = timeLabel(pickupDateTime);
|
|
87
|
+
const puv = pickupVacancies;
|
|
88
|
+
if (returnVacancies == null) {
|
|
89
|
+
return t('booking.overbookingWarnDeparture', { count: puv, time: pickupT });
|
|
90
|
+
}
|
|
91
|
+
if (puv < returnVacancies) {
|
|
92
|
+
return t('booking.overbookingWarnDeparture', { count: puv, time: pickupT });
|
|
93
|
+
}
|
|
94
|
+
if (returnVacancies < puv) {
|
|
95
|
+
const retT = returnDateTime != null ? timeLabel(returnDateTime) : '';
|
|
96
|
+
return t('booking.overbookingWarnReturn', { count: returnVacancies, time: retT });
|
|
97
|
+
}
|
|
98
|
+
return t('booking.overbookingWarnBoth', { count: puv });
|
|
99
|
+
}, [
|
|
100
|
+
isOverbooked,
|
|
101
|
+
companyTimezone,
|
|
102
|
+
pickupDateTime,
|
|
103
|
+
pickupVacancies,
|
|
104
|
+
returnDateTime,
|
|
105
|
+
returnVacancies,
|
|
106
|
+
t,
|
|
107
|
+
locale,
|
|
108
|
+
]);
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<div>
|
|
112
|
+
<div className={styles.header}>
|
|
113
|
+
<label className={styles.label}>
|
|
114
|
+
{t('booking.tickets')}
|
|
115
|
+
</label>
|
|
116
|
+
</div>
|
|
117
|
+
<div className={styles.list}>
|
|
118
|
+
{pricing.map((rate) => {
|
|
119
|
+
const qty = quantities[rate.category] || 0;
|
|
120
|
+
const floorUnitPrice = ticketUnitFloorByCategory?.get(rate.category.toUpperCase());
|
|
121
|
+
const effectiveUnitPrice =
|
|
122
|
+
floorUnitPrice != null ? Math.max(rate.price ?? 0, floorUnitPrice) : (rate.price ?? 0);
|
|
123
|
+
const minQty = minimumQuantities
|
|
124
|
+
? Math.max(0, minimumQuantities[rate.category] ?? 0)
|
|
125
|
+
: 0;
|
|
126
|
+
const decrementDisabled = qty <= 0 || (minimumQuantities != null && qty <= minQty);
|
|
127
|
+
const isPublicMode = isSimplifiedPricingView;
|
|
128
|
+
let displayBasePrice = rate.baseInDisplayCurrency ?? 0;
|
|
129
|
+
if (isPublicMode && rate.appliedAdjustments) {
|
|
130
|
+
const dynamicIncreases = rate.appliedAdjustments
|
|
131
|
+
.filter(adj => adj.type === 'dynamic' && (adj.changeByCurrency?.[currency] ?? 0) > 0)
|
|
132
|
+
.reduce((sum, adj) => sum + (adj.changeByCurrency?.[currency] ?? 0), 0);
|
|
133
|
+
displayBasePrice += dynamicIncreases;
|
|
134
|
+
}
|
|
135
|
+
const hasDiscount = displayBasePrice > 0 && effectiveUnitPrice < displayBasePrice;
|
|
136
|
+
|
|
137
|
+
return (
|
|
138
|
+
<div key={rate.category} className={styles.row}>
|
|
139
|
+
<div>
|
|
140
|
+
<p className={styles.category}>
|
|
141
|
+
{rate.category}
|
|
142
|
+
{rate.category === 'CHILD' && (
|
|
143
|
+
<span className={styles.ageHint}>(2-10)</span>
|
|
144
|
+
)}
|
|
145
|
+
{rate.category === 'INFANT' && (
|
|
146
|
+
<span className={styles.ageHint}>(Under 2)</span>
|
|
147
|
+
)}
|
|
148
|
+
</p>
|
|
149
|
+
<p className={styles.price}>
|
|
150
|
+
{hasDiscount ? (
|
|
151
|
+
<>
|
|
152
|
+
<span className={styles.priceStrikethrough}>
|
|
153
|
+
{formatCurrencyAmount(displayBasePrice, currency, locale as 'en' | 'fr')}
|
|
154
|
+
</span>
|
|
155
|
+
{' '}
|
|
156
|
+
<span className={styles.priceDiscount}>
|
|
157
|
+
{formatCurrencyAmount(effectiveUnitPrice, currency, locale as 'en' | 'fr')}
|
|
158
|
+
</span>
|
|
159
|
+
</>
|
|
160
|
+
) : (
|
|
161
|
+
formatCurrencyAmount(effectiveUnitPrice, currency, locale as 'en' | 'fr')
|
|
162
|
+
)}
|
|
163
|
+
</p>
|
|
164
|
+
</div>
|
|
165
|
+
<div className={styles.controls}>
|
|
166
|
+
<button
|
|
167
|
+
type="button"
|
|
168
|
+
onClick={() => onQuantityChange(rate.category, -1)}
|
|
169
|
+
disabled={decrementDisabled}
|
|
170
|
+
className={styles.qtyBtnDecrement}
|
|
171
|
+
>
|
|
172
|
+
−
|
|
173
|
+
</button>
|
|
174
|
+
<span className={styles.qtyValue}>
|
|
175
|
+
{qty}
|
|
176
|
+
</span>
|
|
177
|
+
<button
|
|
178
|
+
onClick={() => onQuantityChange(rate.category, 1)}
|
|
179
|
+
disabled={!isAdmin && totalQuantity >= selectedVacancies}
|
|
180
|
+
className={isAdmin && isOverbookedTickets ? styles.qtyBtnOverbook : styles.qtyBtnIncrement}
|
|
181
|
+
>
|
|
182
|
+
+
|
|
183
|
+
</button>
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
);
|
|
187
|
+
})}
|
|
188
|
+
</div>
|
|
189
|
+
{isAdmin && isOverbooked && overbookingDetailMessage && (
|
|
190
|
+
<p className={styles.overbookWarning} role="status">
|
|
191
|
+
{overbookingDetailMessage}
|
|
192
|
+
{resourceCount != null
|
|
193
|
+
? ` ${t('booking.overbookingResourcesSuffix', { count: resourceCount })}`
|
|
194
|
+
: ''}
|
|
195
|
+
</p>
|
|
196
|
+
)}
|
|
197
|
+
</div>
|
|
198
|
+
);
|
|
199
|
+
}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
margin: 1rem 0;
|
|
3
|
+
padding-bottom: 1rem;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/* Higher specificity to override booking-flow-preflight button reset */
|
|
7
|
+
.root .mainToggle {
|
|
8
|
+
position: sticky;
|
|
9
|
+
top: 0;
|
|
10
|
+
z-index: 10;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: flex-start;
|
|
14
|
+
width: 100%;
|
|
15
|
+
padding: 0.625rem 2.5rem 0.625rem 1rem;
|
|
16
|
+
background: var(--light-orange-background-dark);
|
|
17
|
+
border-radius: 0.5rem;
|
|
18
|
+
border: none;
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
font-family: 'Poppins', sans-serif !important;
|
|
21
|
+
font-size: 1.125rem;
|
|
22
|
+
font-weight: 700;
|
|
23
|
+
text-transform: lowercase;
|
|
24
|
+
color: var(--accent-orange) !important;
|
|
25
|
+
text-align: left;
|
|
26
|
+
transition: opacity 0.2s;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.root .mainToggle:hover {
|
|
30
|
+
opacity: 0.9;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.root .mainToggle .toggleIcon {
|
|
34
|
+
position: absolute;
|
|
35
|
+
right: 0.75rem;
|
|
36
|
+
top: 50%;
|
|
37
|
+
transform: translateY(-50%) rotate(0deg);
|
|
38
|
+
flex-shrink: 0;
|
|
39
|
+
width: 24px;
|
|
40
|
+
height: 24px;
|
|
41
|
+
color: var(--accent-orange);
|
|
42
|
+
transition: transform 0.3s ease;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.root .mainToggle .toggleIcon svg {
|
|
46
|
+
display: block;
|
|
47
|
+
transition: transform 0.3s ease;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Same as FAQ accordion: indicator rotates -90deg when open (HeroUI accordionItem) */
|
|
51
|
+
.root .mainToggle .toggleIconExpanded {
|
|
52
|
+
transform: translateY(-50%) rotate(-90deg);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Counter-rotate minus so it stays horizontal when container rotates */
|
|
56
|
+
.root .mainToggle .toggleIconExpanded svg {
|
|
57
|
+
transform: rotate(180deg);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@media (min-width: 768px) {
|
|
61
|
+
.root .mainToggle {
|
|
62
|
+
font-size: 1.375rem;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.contentWrapper {
|
|
67
|
+
display: grid;
|
|
68
|
+
grid-template-rows: 0fr;
|
|
69
|
+
opacity: 0;
|
|
70
|
+
transition: grid-template-rows 0.5s ease-in-out, opacity 0.45s ease-in-out;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.contentWrapper.contentExpanded {
|
|
74
|
+
grid-template-rows: 1fr;
|
|
75
|
+
opacity: 1;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.contentWrapper > .content {
|
|
79
|
+
min-height: 0;
|
|
80
|
+
overflow: hidden;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.content {
|
|
84
|
+
margin-top: 0;
|
|
85
|
+
padding: 0;
|
|
86
|
+
transition: padding 0.3s ease-in-out;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.contentWrapper.contentExpanded > .content {
|
|
90
|
+
padding: 16px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* Higher specificity to override booking-flow-preflight p/blockquote { margin: 0 } */
|
|
94
|
+
.content .paragraph {
|
|
95
|
+
margin: 0 0 1rem 0;
|
|
96
|
+
font-size: 0.9375rem;
|
|
97
|
+
line-height: 1.6;
|
|
98
|
+
color: var(--primary-text);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.content .paragraph a,
|
|
102
|
+
.content .review a,
|
|
103
|
+
.content .bulletItem a {
|
|
104
|
+
color: var(--accent-orange);
|
|
105
|
+
text-decoration: underline;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.content .paragraph a:hover,
|
|
109
|
+
.content .review a:hover,
|
|
110
|
+
.content .bulletItem a:hover {
|
|
111
|
+
text-decoration-thickness: 2px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.content .review {
|
|
115
|
+
margin: 1.25rem 0;
|
|
116
|
+
padding: 1rem 1.25rem;
|
|
117
|
+
background: var(--booking-stone-50, #fafaf9);
|
|
118
|
+
border-left: 4px solid var(--accent-orange);
|
|
119
|
+
border-radius: 0 0.5rem 0.5rem 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.content .review .reviewText {
|
|
123
|
+
margin: 0 0 0.5rem 0;
|
|
124
|
+
font-size: 0.9375rem;
|
|
125
|
+
font-style: italic;
|
|
126
|
+
line-height: 1.6;
|
|
127
|
+
color: var(--booking-text, #1c1917);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.reviewName {
|
|
131
|
+
display: block;
|
|
132
|
+
font-size: 0.875rem;
|
|
133
|
+
font-style: normal;
|
|
134
|
+
color: var(--booking-text-muted, #78716c);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.bulletList {
|
|
138
|
+
margin: 0;
|
|
139
|
+
padding-left: 1.25rem;
|
|
140
|
+
list-style: disc;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.content > .bulletList {
|
|
144
|
+
margin-bottom: 1rem;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.bulletItem {
|
|
148
|
+
margin-bottom: 0.35rem;
|
|
149
|
+
font-size: 0.875rem;
|
|
150
|
+
line-height: 1.5;
|
|
151
|
+
color: var(--primary-text);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.bulletItem:last-child {
|
|
155
|
+
margin-bottom: 0;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.nestedSection {
|
|
159
|
+
margin-top: 0.75rem;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* Higher specificity to override booking-flow-preflight button reset */
|
|
163
|
+
.root .nestedToggle {
|
|
164
|
+
display: inline-flex;
|
|
165
|
+
align-items: center;
|
|
166
|
+
gap: 0.25rem;
|
|
167
|
+
padding: 0;
|
|
168
|
+
background: none;
|
|
169
|
+
border: none;
|
|
170
|
+
cursor: pointer;
|
|
171
|
+
font-size: 0.9375rem;
|
|
172
|
+
font-weight: 700 !important;
|
|
173
|
+
color: var(--accent-orange) !important;
|
|
174
|
+
text-align: left;
|
|
175
|
+
transition: opacity 0.2s;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.root .nestedToggle:hover {
|
|
179
|
+
opacity: 0.8;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.root .nestedToggle .chevron {
|
|
183
|
+
flex-shrink: 0;
|
|
184
|
+
margin-left: 0;
|
|
185
|
+
color: var(--accent-orange);
|
|
186
|
+
transition: transform 0.3s ease;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.root .nestedToggle[aria-expanded='true'] .chevron {
|
|
190
|
+
transform: rotate(90deg);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.nestedContentWrapper {
|
|
194
|
+
display: grid;
|
|
195
|
+
grid-template-rows: 0fr;
|
|
196
|
+
transition: grid-template-rows 0.3s ease-in-out;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.nestedContentWrapper.nestedContentOpen {
|
|
200
|
+
grid-template-rows: 1fr;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.nestedContentWrapper > .nestedContent {
|
|
204
|
+
min-height: 0;
|
|
205
|
+
overflow: hidden;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.nestedContent {
|
|
209
|
+
margin-top: 0.5rem;
|
|
210
|
+
padding-left: 0;
|
|
211
|
+
font-size: 0.875rem;
|
|
212
|
+
line-height: 1.6;
|
|
213
|
+
color: var(--primary-text);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.nestedContent .paragraph {
|
|
217
|
+
margin-bottom: 0.5rem;
|
|
218
|
+
font-size: 0.875rem;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.nestedContent .paragraph:last-child {
|
|
222
|
+
margin-bottom: 0;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.sectionHtml {
|
|
226
|
+
font-size: 0.875rem;
|
|
227
|
+
line-height: 1.6;
|
|
228
|
+
color: var(--primary-text);
|
|
229
|
+
white-space: pre-line;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.sectionHtmlLines {
|
|
233
|
+
font-size: 0.875rem;
|
|
234
|
+
line-height: 1.6;
|
|
235
|
+
color: var(--primary-text);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.sectionLineHeading {
|
|
239
|
+
margin-bottom: 0.25rem;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.sectionLineIndented {
|
|
243
|
+
padding-left: 1rem;
|
|
244
|
+
margin-bottom: 0.25rem;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.sectionHtmlLines .sectionLineIndented:last-child,
|
|
248
|
+
.sectionHtmlLines .sectionLineHeading:last-child {
|
|
249
|
+
margin-bottom: 0;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.sectionSubsections {
|
|
253
|
+
display: flex;
|
|
254
|
+
flex-direction: column;
|
|
255
|
+
gap: 1rem;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.sectionSubsectionTitle {
|
|
259
|
+
font-weight: 700;
|
|
260
|
+
margin-bottom: 0.35rem;
|
|
261
|
+
font-size: 0.875rem;
|
|
262
|
+
line-height: 1.5;
|
|
263
|
+
color: var(--primary-text);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.sectionSubsectionTitle:last-child {
|
|
267
|
+
margin-bottom: 0;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.sectionSubsection .bulletList {
|
|
271
|
+
margin-top: 0;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.sectionHtmlLines a {
|
|
275
|
+
color: var(--accent-orange);
|
|
276
|
+
text-decoration: underline;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.sectionHtml p {
|
|
280
|
+
margin: 0 0 0.5rem 0;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.sectionHtml p:last-child {
|
|
284
|
+
margin-bottom: 0;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.sectionHtml ul {
|
|
288
|
+
margin: 0.5rem 0 0 0;
|
|
289
|
+
padding-left: 1.25rem;
|
|
290
|
+
list-style: disc;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.sectionHtml li {
|
|
294
|
+
margin-bottom: 0.35rem;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.sectionHtml li:last-child {
|
|
298
|
+
margin-bottom: 0;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.sectionHtml a {
|
|
302
|
+
color: var(--accent-orange);
|
|
303
|
+
text-decoration: underline;
|
|
304
|
+
}
|