@riverbankcms/sdk 0.182.0 → 0.184.0
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/CHANGELOG.md +79 -0
- package/README.md +83 -4
- package/dist/_dts/{BlocksIslandsHydrator-Bvw2bUif.d.ts → BlocksIslandsHydrator-DjBTJYiF.d.ts} +1 -1
- package/dist/_dts/{Page-B2EAT-bE.d.ts → Page-BpXEM2ET.d.ts} +7 -7
- package/dist/_dts/{SdkPreviewMode-D0vww6rh.d.ts → SdkPreviewMode-Bb3h7KRE.d.ts} +2 -2
- package/dist/_dts/{client-D6T430bk.d.ts → client-DgTRRtl_.d.ts} +14 -1
- package/dist/_dts/{content-types-wZVWccC6.d.ts → content-types-DZQJp_ak.d.ts} +9 -16
- package/dist/_dts/{contracts-B-vtOcr8.d.ts → contracts-Ww1fmd-c.d.ts} +3 -3
- package/dist/_dts/{generatePageMetadata-CxfwHE6z.d.ts → generatePageMetadata-BGc7dju6.d.ts} +2 -2
- package/dist/_dts/{index-CciRW_w1.d.ts → index-BECaUNYs.d.ts} +2 -2
- package/dist/_dts/{index-CEyYMhLJ.d.ts → index-Cc85KVLW.d.ts} +3 -3
- package/dist/_dts/{index-CQrb3Ccc.d.ts → index-Cni4jykw.d.ts} +4 -4
- package/dist/_dts/{index-DIU-wL1M.d.ts → index-DxxTQ_0V.d.ts} +2 -2
- package/dist/_dts/{index-Cqxis-nv.d.ts → index-W9-7djG3.d.ts} +1 -1
- package/dist/_dts/{index-DqPKdeTk.d.ts → index-ukS-Ffem.d.ts} +1 -1
- package/dist/_dts/{loadContent-D0wrxiSp.d.ts → loadContent-BlSWTlbD.d.ts} +7 -7
- package/dist/_dts/{request-DEwxUSw8.d.ts → request-CZz2BoXJ.d.ts} +89478 -88093
- package/dist/_dts/{resolveBlockData-VaG_MYbN.d.ts → resolveBlockData-D12HXnS3.d.ts} +5 -5
- package/dist/_dts/{resolvePageContent-DTwklC_v.d.ts → resolvePageContent-BteMsSGP.d.ts} +1 -1
- package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
- package/dist/_dts/sdk/src/client/types.d.ts +2 -2
- package/dist/_dts/sdk/src/client.d.ts +7 -7
- package/dist/_dts/sdk/src/config/index.d.ts +7 -7
- package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
- package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
- package/dist/_dts/sdk/src/data/dataLoaderContext.d.ts +2 -2
- package/dist/_dts/sdk/src/data/resolveBlockData.d.ts +1 -1
- package/dist/_dts/sdk/src/data/types.d.ts +2 -2
- package/dist/_dts/sdk/src/gifting/client.d.ts +1 -1
- package/dist/_dts/sdk/src/index.d.ts +8 -8
- package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
- package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
- package/dist/_dts/sdk/src/navigation/index.d.ts +3 -3
- package/dist/_dts/sdk/src/next/index.d.ts +7 -7
- package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
- package/dist/_dts/sdk/src/page-converter/index.d.ts +3 -3
- package/dist/_dts/sdk/src/portal/client.d.ts +1 -1
- package/dist/_dts/sdk/src/portal/index.d.ts +10 -2
- package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
- package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/helpers/loadPage.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +4 -4
- package/dist/_dts/sdk/src/rendering/index.d.ts +6 -6
- package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/themeAdmission.d.ts +1 -1
- package/dist/_dts/sdk/src/routing/index.d.ts +6 -6
- package/dist/_dts/sdk/src/server.d.ts +5 -5
- package/dist/_dts/sdk/src/spam-protection/index.d.ts +2 -2
- package/dist/_dts/sdk/src/theme/index.d.ts +126 -2
- package/dist/_dts/{serviceBookingOutline-DtQuFlID.d.ts → serviceBookingOutline-aTlOvO3U.d.ts} +16 -8
- package/dist/_dts/{types-B3RjeBLV.d.ts → types-Bi7R07RX.d.ts} +45 -4
- package/dist/_dts/{types-BvUSGQrw.d.ts → types-CCcQlRBi.d.ts} +22 -12
- package/dist/_dts/{types-CkRFtBqd.d.ts → types-Du4aMnWC.d.ts} +13 -15
- package/dist/_dts/{validation-BZA3DhcV.d.ts → validation-CjCWVmwe.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-CQMf0HdN.mjs → BlocksIslandsHydrator-CFLWxjxR.mjs} +22 -18
- package/dist/client/{BookingMailingListNote-7kdvuPow.mjs → BookingMailingListNote-C4LcfwyA.mjs} +8 -8
- package/dist/client/{BookingQuestionFields-BJI7mZuV.mjs → BookingQuestionFields-DdcmoHqQ.mjs} +2 -2
- package/dist/client/{CalendarAction-D_Glwvz2.mjs → CalendarAction-DYGewmvh.mjs} +1 -1
- package/dist/client/{CalendarNavigationChevron-DPUD6wjy.mjs → CalendarNavigationChevron-ZfrUiiiI.mjs} +25 -8
- package/dist/client/{CheckboxChoice-C8i4NraK.mjs → CheckboxChoice-CTMIII37.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-8kwNF9HN.mjs → DemoBookingPortalAccess-pzkGVkgG.mjs} +7 -5
- package/dist/client/{EventCalendar.client-Dhb14bcC.mjs → EventCalendar.client-Ct1B3xI4.mjs} +10 -10
- package/dist/client/{EventCombined.client-C1jEZBN9.mjs → EventCombined.client-DgfNtcgW.mjs} +9 -9
- package/dist/client/{EventEmbeddedCheckoutStep-BGkbUhuw.mjs → EventEmbeddedCheckoutStep-CjoaG1zy.mjs} +1 -1
- package/dist/client/{EventItem-Bb0ppG2N.mjs → EventItem-KGKkK19N.mjs} +29 -14
- package/dist/client/{EventListWeekNavigation-DMryCaNV.mjs → EventListWeekNavigation-Ba9ezxuC.mjs} +1 -1
- package/dist/client/{EventListing.client-BuH5kKA3.mjs → EventListing.client-xFKRDLwC.mjs} +3 -3
- package/dist/client/{EventListing.view-DsqvuulZ.mjs → EventListing.view-Dy36vWHi.mjs} +84 -7
- package/dist/client/{EventRegistrationPayment-D4FvQSFF.mjs → EventRegistrationPayment-Dth9L00x.mjs} +118 -76
- package/dist/client/{Page-sV6BJkXX.mjs → Page-DB5KODiu.mjs} +4491 -1398
- package/dist/client/{ProtectedSubmitButton-BNnKuir8.mjs → ProtectedSubmitButton-CY6u5sQa.mjs} +1 -1
- package/dist/client/{SiteTermsAgreementField-VfSd6JU-.mjs → SiteTermsAgreementField-BDVP_HeK.mjs} +3 -3
- package/dist/client/{StepIndicator-B6o5B7g3.mjs → StepIndicator-CLgDVzCs.mjs} +1 -1
- package/dist/client/{StepIndicator-BTqO7cJl.mjs → StepIndicator-DRyZ8igu.mjs} +7 -7
- package/dist/client/{ThemedButton-PFOhXktM.mjs → ThemedButton-C4rCsPCt.mjs} +52 -10
- package/dist/client/{accessibleSurfaces-BogaGutk.mjs → accessibleSurfaces-CqroimVQ.mjs} +1024 -619
- package/dist/client/{accordion-6cuswD_s.mjs → accordion-BQYRP5xV.mjs} +1 -1
- package/dist/client/{booking-form.client-BOMe_SKi.mjs → booking-form.client-B7ckDuOC.mjs} +191 -71
- package/dist/client/{bookingForm-DSCH-VHo.mjs → bookingForm-BeD4650p.mjs} +7 -6
- package/dist/client/bookings.mjs +5 -5
- package/dist/client/{boxStyleClassNames-BFuqZCfz.mjs → boxStyleClassNames-CA7FirMH.mjs} +2 -2
- package/dist/client/buttonParts-C39GC0kz.mjs +1518 -0
- package/dist/client/{carousel-CGyQVV1M.mjs → carousel-DJ9Aa1m3.mjs} +2 -2
- package/dist/client/{carousel.client-BtLwHefX.mjs → carousel.client-DKWqVHHh.mjs} +1 -1
- package/dist/client/{cart-BYOe7MCh.mjs → cart-DdCenbTy.mjs} +3 -3
- package/dist/client/{cart.client-BKFkaXdV.mjs → cart.client-BQm06qNw.mjs} +1 -1
- package/dist/client/{checkout-Dwd7Di77.mjs → checkout-45wPQULN.mjs} +3 -3
- package/dist/client/{checkout.client-C25hpi-z.mjs → checkout.client-bSv4cc5z.mjs} +1 -1
- package/dist/client/{checkoutUrls-tG788sw0.mjs → checkoutUrls-CwlaMl3W.mjs} +1 -1
- package/dist/client/client.mjs +460 -119
- package/dist/client/{constants-DdxFG3Ic.mjs → constants-DXV4KR7l.mjs} +1 -1
- package/dist/client/{context-Hi1RuYEM.mjs → context-lCPfX-xe.mjs} +15 -5
- package/dist/client/{dateFormatting-C8vBCHuo.mjs → dateFormatting-HvfmS_cH.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-BAL5UIDG.mjs → demoPortalMagicLink-Ce3Gyin_.mjs} +1 -1
- package/dist/client/{enhanceHeaderSection-Dv1Lr9kJ.mjs → enhanceHeaderSection-CGcDE9aE.mjs} +4 -4
- package/dist/client/{event-registration.client-dB_Z7bb-.mjs → event-registration.client-DlPfn4YG.mjs} +52 -29
- package/dist/client/{eventCalendar-CQnRA4Ww.mjs → eventCalendar-CioAdryV.mjs} +4 -4
- package/dist/client/{eventCombined-BDOG1hVp.mjs → eventCombined-Dwt0G6ez.mjs} +4 -4
- package/dist/client/{eventListing-DSVmhy9n.mjs → eventListing-B3H9ifOC.mjs} +4 -4
- package/dist/client/{eventRegistration-CD5mRtEH.mjs → eventRegistration-Do7cAhXb.mjs} +7 -6
- package/dist/client/{form-DWnlEVSK.mjs → form-CsqzgC6v.mjs} +3 -3
- package/dist/client/{form.client-D7zmeqNI.mjs → form.client-DVDB7hY6.mjs} +5 -5
- package/dist/client/{form.parts-C-G6N_MK.mjs → form.parts-1q2rzSYt.mjs} +3 -3
- package/dist/client/gifting/client.mjs +16 -9
- package/dist/client/{gifting-Cn0jidP5.mjs → gifting-BrXQGX-k.mjs} +4 -4
- package/dist/client/{gifting.client-DVo1YFLs.mjs → gifting.client--zAjnY5N.mjs} +155 -85
- package/dist/client/gifting.interactive-CrwHpUJG.mjs +207 -0
- package/dist/client/gifting.parts-CcKdDaQq.mjs +124 -0
- package/dist/client/{headerSection-DjQuj_6v.mjs → headerSection-DlcDH4bi.mjs} +2 -2
- package/dist/client/{noop-jesvJXEE.mjs → islands-dMh0Oxli.mjs} +16103 -7965
- package/dist/client/{newsletter-form.client-rIYPziZC.mjs → newsletter-form.client-BxA1PsdS.mjs} +6 -6
- package/dist/client/{newsletter-form.interactive-DVt3enLr.mjs → newsletter-form.interactive-D0iRg7p2.mjs} +229 -197
- package/dist/client/{newsletter-form.parts-CH6dGfdn.mjs → newsletter-form.parts-Dmuklz0r.mjs} +2 -2
- package/dist/client/{newsletterForm-Cg8cBDHd.mjs → newsletterForm-CBzvgIfg.mjs} +3 -3
- package/dist/client/portal/client.mjs +51 -35
- package/dist/client/{portalOrders-oEoTvzkW.mjs → portalOrders-tCxS04g0.mjs} +3 -2
- package/dist/client/{portalRoutes-ByyVZfVq.mjs → portalRoutes-DiGibcZI.mjs} +31 -9
- package/dist/client/portalSession-0XhXyTxT.mjs +41 -0
- package/dist/client/{product-detail.client-5aHq-vuu.mjs → product-detail.client-D9MP8hvH.mjs} +1 -1
- package/dist/client/{product-list.client-CyAk5rnC.mjs → product-list.client-wCz1qcUY.mjs} +1 -1
- package/dist/client/{productDetail-B8aZ2mqY.mjs → productDetail-D9-fCY6c.mjs} +3 -3
- package/dist/client/{productList-BuLemmod.mjs → productList-PJyxXSac.mjs} +3 -3
- package/dist/client/{propsDecoder-0Unsqn3R.mjs → propsDecoder-B8lrKGPw.mjs} +4 -2
- package/dist/client/{registry.server-DzvtVVD0.mjs → registry.server-CI63JVHW.mjs} +2444 -1078
- package/dist/client/rendering/client.mjs +32 -28
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +5 -5
- package/dist/client/{richText-coerce-Bnng7JFA.mjs → richText-coerce-Jt9hDHdh.mjs} +2 -2
- package/dist/client/{routeIslandApiConfig-BGfcc9sk.mjs → routeIslandApiConfig-ZSPcJWx1.mjs} +1 -1
- package/dist/client/runtimeResponse-DlPBWBd9.mjs +3 -0
- package/dist/client/{runtimeResponse-DAPVRToN.mjs → runtimeResponse-_iW9oEYc.mjs} +1 -1
- package/dist/client/{shop-GuMqnDL-.mjs → shop-CbdJlWOw.mjs} +3 -3
- package/dist/client/{shop-commerce-D5bDY1o1.mjs → shop-commerce-BqLbzUUn.mjs} +47 -28
- package/dist/client/{shop-commerce-store-B7sHnLwI.mjs → shop-commerce-store-BT0-zRqN.mjs} +1 -1
- package/dist/client/{shop-discount-apply.state-Dos2zdC2.mjs → shop-discount-apply.state-Cws0lnSb.mjs} +2 -2
- package/dist/client/{shop.client-uvj5GDZb.mjs → shop.client-0cNErhJT.mjs} +54 -24
- package/dist/client/{shopShared-3giNWE3H.mjs → shopShared-COuQ2MhQ.mjs} +2 -2
- package/dist/client/spam-protection.mjs +1 -1
- package/dist/client/{src-CmXh3JWs.mjs → src-Do_s2lqH.mjs} +11 -18
- package/dist/client/{timetableModel-GA-hn1qM.mjs → timetableModel-DqI6U1BS.mjs} +11 -8
- package/dist/client/{urlParams-C2QHo1Pa.mjs → useAutomaticDiscountPreview-CeVUVzGf.mjs} +44 -1
- package/dist/client/{useAvailableSlots-CBneCxbG.mjs → useAvailableSlots-B0mjVhZr.mjs} +2 -2
- package/dist/client/{useDiscountCodeUi-D0kGF0C7.mjs → useDiscountCodeUi-B_hfgdAP.mjs} +6 -2
- package/dist/client/{useEventPagination-xX8n_Tuu.mjs → useEventPagination-Ct4A6iR1.mjs} +14 -16
- package/dist/client/{view-DOyZc-DF.mjs → view-Cj151w4m.mjs} +24 -9
- package/dist/client/{wizardSteps-B952ify5.mjs → wizardSteps-B3gsXNnb.mjs} +283 -222
- package/dist/preview-next/client/{EventEmbeddedCheckoutStep-aRJjq4x8.mjs → EventEmbeddedCheckoutStep-CVy9oapv.mjs} +1 -1
- package/dist/preview-next/client/{LocationPickerEnvironment-BW3dRFIv.mjs → LocationPickerEnvironment-DuRUwUrK.mjs} +1 -1
- package/dist/preview-next/client/{MapLibreEditMap-Db9BHyXh.mjs → MapLibreEditMap-CdSDYBq9.mjs} +2 -2
- package/dist/preview-next/client/{PageSectionToolbar-BI3UCdpu.mjs → PageSectionToolbar-Dv4CW0AQ.mjs} +952 -138
- package/dist/preview-next/client/{PreviewEditorSidebar-jkfLVOgY.mjs → PreviewEditorSidebar-B7WW58uE.mjs} +4774 -2040
- package/dist/preview-next/client/{PreviewEditorUI-DwJQs4hM.mjs → PreviewEditorUI-BnJ1ughv.mjs} +71 -47
- package/dist/preview-next/client/{PreviewShell-BAxAkuz8.mjs → PreviewShell-C7qWzAe4.mjs} +72 -40
- package/dist/preview-next/client/{SdkPreviewModeRuntime-0UVB-39f.mjs → SdkPreviewModeRuntime-CYi4UHtG.mjs} +135 -30
- package/dist/preview-next/client/{ThemedButton-CVYz7h68.mjs → ThemedButton-CRgbU75r.mjs} +799 -17
- package/dist/preview-next/client/{lucide-react-00FF_oar.mjs → lucide-react-B4c6U3ZU.mjs} +11 -1
- package/dist/preview-next/client/{previewAssistantSlot-BgiYk3PB.mjs → previewAssistantSlot-DrUoRNu9.mjs} +24203 -9291
- package/dist/preview-next/client/{previewChromeRoot-tieNdF3E.mjs → previewChromeRoot-CEYp90mM.mjs} +3 -90
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-DXb_Evl0.mjs → sdk-runtime-DnO2_c0A.mjs} +2 -2
- package/dist/preview-next/client/{siteStyleAccess-BlN0jt2c.mjs → siteStyleAccess-B3PwHw2z.mjs} +46 -11
- package/dist/preview-next/client/{useAutosaveStatus-BUEPA4oL.mjs → useAutosaveStatus-DrdQ4ier.mjs} +49 -3
- package/dist/preview-next/client/{useOpenBlockForSetup-BVfr5P--.mjs → useOpenBlockForSetup-kuGRKaRL.mjs} +2008 -448
- package/dist/preview-next/container-responsive.css +469 -2
- package/dist/preview-next/editor-chrome.css +23 -2
- package/dist/preview-next/keepAlive.mjs +1 -1
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{route-contract-BHTBA48n.mjs → route-contract-CwrXkLT3.mjs} +177 -43
- package/dist/server/{Block.shared-hGoyEdjJ.mjs → Block.shared-C5ucphCJ.mjs} +5 -5
- package/dist/server/{ThemeScopeCore-BfUCTOwj.mjs → ThemeScopeCore-DvbqYXdK.mjs} +46 -10
- package/dist/server/{accessibleSurfaces-Dskni4Xj.mjs → accessibleSurfaces-CAcf1lHT.mjs} +732 -176
- package/dist/server/{accordions-By_0Ykks.mjs → accordions-DjcsqjCK.mjs} +1 -1
- package/dist/server/{bindings-DMJH4bvo.mjs → bindings-CFw4M-gZ.mjs} +69 -248
- package/dist/server/{client-DrwlRNAH.mjs → client-D0XCgITW.mjs} +488 -119
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/{constants-CeMywaiD.mjs → constants-BZduY8jG.mjs} +31 -8
- package/dist/server/data/resolveBlockData.mjs +1 -1
- package/dist/server/index.mjs +4 -4
- package/dist/server/{loadContent-D0prFflT.mjs → loadContent-C-qyB8Tq.mjs} +11 -10
- package/dist/server/{loadPage-CBLke9pJ.mjs → loadPage-BpKKmi8E.mjs} +3 -3
- package/dist/server/lookMediaFrame-EFws7tAj.mjs +31835 -0
- package/dist/server/manifest.mjs +2 -2
- package/dist/server/{navigation-wrcuWmgp.mjs → navigation-DYkuiNXa.mjs} +1 -1
- package/dist/server/navigation.mjs +1 -1
- package/dist/server/next.mjs +9 -9
- package/dist/server/{overrideResolution-DUgCEH8z.mjs → overrideResolution-DmZn4xUE.mjs} +1 -1
- package/dist/server/page-converter.mjs +18 -5
- package/dist/server/{pageRenderPlan-BHrmogsW.mjs → pageRenderPlan-DRB7cUZ0.mjs} +674 -298
- package/dist/server/{pageRuntimeSupport-D2-YMRei.mjs → pageRuntimeSupport-Uv1xDieJ.mjs} +13 -6
- package/dist/server/{pageShared-CG8O31Eo.mjs → pageShared-BdQF875z.mjs} +911 -516
- package/dist/server/{parseThemeForPersistence-CrPlbJEN.mjs → parseThemeForPersistence-CwcWZL7u.mjs} +3 -3
- package/dist/server/{portal-pG_uhsI2.mjs → portal-BQ8qiQnk.mjs} +22 -2
- package/dist/server/portal.mjs +3 -3
- package/dist/server/{prebuild-C8Amvzce.mjs → prebuild-B51QZVNe.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-BxUETRIZ.mjs → prefetchBlockData-CppDAfJW.mjs} +4 -4
- package/dist/server/{registry-Cc88-23f.mjs → registry-Bf4W8Qa7.mjs} +7585 -24378
- package/dist/server/rendering/components/pageShared.mjs +1 -1
- package/dist/server/rendering/helpers/loadPage.mjs +1 -1
- package/dist/server/rendering/helpers/pageRuntimeSupport.mjs +1 -1
- package/dist/server/rendering/server.mjs +4 -4
- package/dist/server/rendering.mjs +10 -10
- package/dist/server/{resolveBlockData-OG3KOkig.mjs → resolveBlockData-DMHAZooQ.mjs} +2 -2
- package/dist/server/{expandPalette-ehuW8r2g.mjs → resolveButtonColourStates-BMtAAPzp.mjs} +1670 -1346
- package/dist/server/{responseMedia-IfH65QAH.mjs → responseMedia-DKYfR518.mjs} +1 -1
- package/dist/server/{schema-CwfxQjc4.mjs → schema-DGaihVwp.mjs} +300 -29
- package/dist/server/server.mjs +3 -3
- package/dist/server/{servicePageContent-BcFuhhD7.mjs → servicePageContent-CRvmreX7.mjs} +40 -16
- package/dist/server/theme-bridge.mjs +5 -4
- package/dist/server/theme.mjs +2 -2
- package/dist/server/{three-pass-converter-DPaUPTfl.mjs → three-pass-converter-mcy2E1Yd.mjs} +2 -2
- package/dist/server/{titleSourceSchema-NhK6azFS.mjs → titleSourceSchema-B2qFOUwZ.mjs} +4 -5
- package/dist/server/{typeGuards-CTW_9AXq.mjs → typeGuards-DZOaGTEv.mjs} +126 -126
- package/dist/server/{types-BKaBZFjD.mjs → types-C_S0pWbR.mjs} +487 -9
- package/dist/server/{validation-BovmbS8N.mjs → validation-CUtNT_EZ.mjs} +14 -10
- package/dist/server/{version-hws4hgyX.mjs → version-DebJQ4zn.mjs} +1 -1
- package/dist/server/{video-Cdr3wh-q.mjs → video-DBaeSawZ.mjs} +1 -1
- package/dist/styles/index.css +2987 -168
- package/package.json +1 -1
- package/dist/client/gifting.parts-Bak93gD2.mjs +0 -86
- package/dist/client/runtimeResponse-nXT8VAMl.mjs +0 -3
- package/dist/client/types-BEaKfam_.mjs +0 -778
- package/dist/server/customCss-C9kgPHvr.mjs +0 -247
- package/dist/server/lookMediaFrame-H0fi4bJk.mjs +0 -2701
- package/dist/server/media-gvfIw3z8.mjs +0 -216
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { i as useSiteTermsAgreement, n as SiteTermsChangedNotice, t as SiteTermsAgreementField } from "./SiteTermsAgreementField-
|
|
4
|
-
import { n as useBlockApi } from "./context-
|
|
5
|
-
import { n as ThemedButton } from "./ThemedButton-
|
|
2
|
+
import { t as assertNever } from "./src-Do_s2lqH.mjs";
|
|
3
|
+
import { i as useSiteTermsAgreement, n as SiteTermsChangedNotice, t as SiteTermsAgreementField } from "./SiteTermsAgreementField-BDVP_HeK.mjs";
|
|
4
|
+
import { n as useBlockApi } from "./context-lCPfX-xe.mjs";
|
|
5
|
+
import { n as ThemedButton } from "./ThemedButton-C4rCsPCt.mjs";
|
|
6
|
+
import { t as buildGiftingDisplay } from "./gifting.interactive-CrwHpUJG.mjs";
|
|
6
7
|
import { t as FeedbackMessage } from "./FeedbackMessage-CSJrAuXH.mjs";
|
|
7
|
-
import { a as
|
|
8
|
-
import { startTransition, useEffect, useReducer, useRef, useState } from "react";
|
|
8
|
+
import { a as GiftingPanelHead, c as giftingSlot, i as GiftGroup, n as GIFTING_NOTHING_TO_SHOW, o as firstGiftAmountChoice, r as GiftCardAmounts, s as formatGiftAmount } from "./gifting.parts-CcKdDaQq.mjs";
|
|
9
|
+
import React, { startTransition, useEffect, useReducer, useRef, useState } from "react";
|
|
9
10
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
11
|
//#region ../blocks/src/system/runtime/nodes/gifting.client.state.ts
|
|
11
12
|
function createInitialGiftingClientState(initialOffers) {
|
|
@@ -50,16 +51,20 @@ function giftingClientReducer(state, action) {
|
|
|
50
51
|
default: return assertNever(action);
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
|
-
function resolveGiftingPurchaseNotice(search, defaultSuccessMessage) {
|
|
54
|
-
|
|
54
|
+
function resolveGiftingPurchaseNotice(search, defaultSuccessMessage, today = /* @__PURE__ */ new Date()) {
|
|
55
|
+
const params = new URLSearchParams(search);
|
|
56
|
+
switch (params.get("gifting")) {
|
|
55
57
|
case null: return null;
|
|
56
|
-
case "success":
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
case "success": {
|
|
59
|
+
const day = formatSendOnDay(params.get("gift_send_on"), today);
|
|
60
|
+
return {
|
|
61
|
+
kind: "success",
|
|
62
|
+
message: day ? `Thanks, that's all paid for. We'll email the gift to them on ${day}.` : defaultSuccessMessage
|
|
63
|
+
};
|
|
64
|
+
}
|
|
60
65
|
case "cancelled": return {
|
|
61
66
|
kind: "cancelled",
|
|
62
|
-
message: "
|
|
67
|
+
message: "You didn't finish paying, so nothing's been charged. You can try again whenever you're ready."
|
|
63
68
|
};
|
|
64
69
|
default: return null;
|
|
65
70
|
}
|
|
@@ -69,16 +74,15 @@ function toGiftingControllerProps(props) {
|
|
|
69
74
|
className: props.render.display.className,
|
|
70
75
|
heading: props.render.display.heading,
|
|
71
76
|
intro: props.render.display.intro,
|
|
72
|
-
giftCardsHeading: props.render.display.giftCardsHeading,
|
|
73
|
-
vouchersHeading: props.render.display.vouchersHeading,
|
|
74
|
-
emptyStateText: props.render.display.emptyStateText,
|
|
75
77
|
checkoutButtonText: props.render.hydration.checkoutButtonText,
|
|
76
78
|
successMessage: props.render.hydration.successMessage
|
|
77
79
|
};
|
|
78
80
|
}
|
|
79
|
-
function buildGiftingCheckoutReturnUrl(currentHref, kind) {
|
|
81
|
+
function buildGiftingCheckoutReturnUrl(currentHref, kind, sendOnDate = null) {
|
|
80
82
|
const url = new URL(currentHref);
|
|
81
83
|
url.searchParams.set("gifting", kind);
|
|
84
|
+
if (kind === "success" && sendOnDate) url.searchParams.set("gift_send_on", sendOnDate);
|
|
85
|
+
else url.searchParams.delete("gift_send_on");
|
|
82
86
|
return url.toString();
|
|
83
87
|
}
|
|
84
88
|
function hasPublicGiftingOffers(offers) {
|
|
@@ -113,10 +117,29 @@ function giftingSubmission(previous, fields, createToken) {
|
|
|
113
117
|
token: createToken()
|
|
114
118
|
};
|
|
115
119
|
}
|
|
120
|
+
/** Calendar dates are constructed and compared locally, without parsing an ISO instant. */
|
|
121
|
+
function formatSendOnDay(isoDate, today) {
|
|
122
|
+
if (!isoDate || !/^\d{4}-\d{2}-\d{2}$/.test(isoDate)) return null;
|
|
123
|
+
const [year = 0, month = 0, day = 0] = isoDate.split("-").map(Number);
|
|
124
|
+
const date = new Date(year, month - 1, day);
|
|
125
|
+
if (date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day || date < new Date(today.getFullYear(), today.getMonth(), today.getDate())) return null;
|
|
126
|
+
return new Intl.DateTimeFormat("en-GB", {
|
|
127
|
+
weekday: "long",
|
|
128
|
+
day: "numeric",
|
|
129
|
+
month: "long"
|
|
130
|
+
}).format(date);
|
|
131
|
+
}
|
|
132
|
+
function giftingReturnUrlWithoutNotice(currentHref) {
|
|
133
|
+
const url = new URL(currentHref);
|
|
134
|
+
url.searchParams.delete("gifting");
|
|
135
|
+
url.searchParams.delete("gift_send_on");
|
|
136
|
+
return url.toString();
|
|
137
|
+
}
|
|
116
138
|
//#endregion
|
|
117
139
|
//#region ../blocks/src/system/runtime/nodes/gifting.client.tsx
|
|
118
140
|
function GiftingClient(props) {
|
|
119
141
|
const api = useBlockApi();
|
|
142
|
+
const noticeRef = useRef(null);
|
|
120
143
|
const siteTerms = useSiteTermsAgreement({
|
|
121
144
|
terms: props.render.hydration.siteTerms,
|
|
122
145
|
context: { kind: "purchase" }
|
|
@@ -124,11 +147,18 @@ function GiftingClient(props) {
|
|
|
124
147
|
const controller = toGiftingControllerProps(props);
|
|
125
148
|
const [state, dispatch] = useReducer(giftingClientReducer, props.render.hydration.offers, createInitialGiftingClientState);
|
|
126
149
|
useEffect(() => {
|
|
150
|
+
const notice = resolveGiftingPurchaseNotice(window.location.search, props.render.hydration.successMessage);
|
|
127
151
|
dispatch({
|
|
128
152
|
type: "purchaseNoticeResolved",
|
|
129
|
-
notice
|
|
153
|
+
notice
|
|
130
154
|
});
|
|
155
|
+
if (notice) window.history.replaceState(window.history.state, "", giftingReturnUrlWithoutNotice(window.location.href));
|
|
131
156
|
}, [props.render.hydration.successMessage]);
|
|
157
|
+
useEffect(() => {
|
|
158
|
+
if (!state.purchaseNotice) return;
|
|
159
|
+
noticeRef.current?.scrollIntoView({ block: "center" });
|
|
160
|
+
noticeRef.current?.focus({ preventScroll: true });
|
|
161
|
+
}, [state.purchaseNotice]);
|
|
132
162
|
useEffect(() => {
|
|
133
163
|
if (state.offers) return;
|
|
134
164
|
let cancelled = false;
|
|
@@ -161,6 +191,7 @@ function GiftingClient(props) {
|
|
|
161
191
|
event.preventDefault();
|
|
162
192
|
if (!siteTerms.requireAgreement("commerce")) return;
|
|
163
193
|
const formData = new FormData(event.currentTarget);
|
|
194
|
+
const sendOnDate = formData.get("sendOnDate");
|
|
164
195
|
const fields = JSON.stringify([...formData.entries()]);
|
|
165
196
|
const submission = giftingSubmission(state.submissions.get(offerId), fields, () => crypto.randomUUID());
|
|
166
197
|
dispatch({
|
|
@@ -173,10 +204,10 @@ function GiftingClient(props) {
|
|
|
173
204
|
offerId,
|
|
174
205
|
purchaseToken: submission.token,
|
|
175
206
|
kind,
|
|
176
|
-
successUrl: buildGiftingCheckoutReturnUrl(window.location.href, "success"),
|
|
207
|
+
successUrl: buildGiftingCheckoutReturnUrl(window.location.href, "success", typeof sendOnDate === "string" ? sendOnDate : null),
|
|
177
208
|
cancelUrl: buildGiftingCheckoutReturnUrl(window.location.href, "cancelled")
|
|
178
209
|
}));
|
|
179
|
-
window.location.
|
|
210
|
+
window.location.assign(checkout.checkoutUrl);
|
|
180
211
|
} catch (error) {
|
|
181
212
|
dispatch({
|
|
182
213
|
type: "checkoutFailed",
|
|
@@ -188,73 +219,81 @@ function GiftingClient(props) {
|
|
|
188
219
|
const currency = offers?.currency ?? "GBP";
|
|
189
220
|
const giftCards = offers?.giftCards ?? [];
|
|
190
221
|
const vouchers = offers?.vouchers ?? [];
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
222
|
+
const look = state.offers === props.render.hydration.offers ? props.render.display : buildGiftingDisplay({
|
|
223
|
+
...props.render.display,
|
|
224
|
+
...props.render.hydration.groupHeadings,
|
|
225
|
+
offers: state.offers
|
|
194
226
|
});
|
|
195
|
-
const look = props.render.display;
|
|
196
227
|
const purchaseFields = (offerId) => /* @__PURE__ */ jsx(GiftingPurchaseFields, {
|
|
197
228
|
siteTerms,
|
|
198
229
|
submitting: state.submittingOfferId === offerId,
|
|
199
|
-
buttonText: controller.checkoutButtonText ?? "Continue"
|
|
230
|
+
buttonText: controller.checkoutButtonText ?? "Continue to payment"
|
|
200
231
|
});
|
|
201
232
|
return /* @__PURE__ */ jsx("section", {
|
|
202
233
|
className: controller.className ?? void 0,
|
|
203
234
|
"data-block": "gifting",
|
|
204
235
|
children: /* @__PURE__ */ jsxs("div", {
|
|
205
|
-
className: "gifting
|
|
206
|
-
...
|
|
207
|
-
children: [
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
look,
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
236
|
+
className: "gifting",
|
|
237
|
+
...look.lookSlots ? { "data-slot": "layout" } : {},
|
|
238
|
+
children: [/* @__PURE__ */ jsx(GiftingPanelHead, {
|
|
239
|
+
heading: look.heading,
|
|
240
|
+
intro: look.intro,
|
|
241
|
+
look
|
|
242
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
243
|
+
className: "gifting-main",
|
|
244
|
+
children: [
|
|
245
|
+
state.purchaseNotice ? /* @__PURE__ */ jsx("div", {
|
|
246
|
+
ref: noticeRef,
|
|
247
|
+
tabIndex: -1,
|
|
248
|
+
className: "gifting-notice",
|
|
249
|
+
children: /* @__PURE__ */ jsx(FeedbackMessage, {
|
|
250
|
+
tone: state.purchaseNotice.kind === "success" ? "success" : "warning",
|
|
251
|
+
className: "gifting-feedback",
|
|
252
|
+
role: "status",
|
|
253
|
+
children: state.purchaseNotice.message
|
|
254
|
+
})
|
|
255
|
+
}) : null,
|
|
256
|
+
state.errorMessage ? /* @__PURE__ */ jsx(FeedbackMessage, {
|
|
257
|
+
tone: "error",
|
|
258
|
+
className: "gifting-feedback",
|
|
259
|
+
role: "alert",
|
|
260
|
+
children: state.errorMessage
|
|
261
|
+
}) : null,
|
|
262
|
+
/* @__PURE__ */ jsx(SiteTermsChangedNotice, { message: siteTerms.notice }),
|
|
263
|
+
hasOffers ? /* @__PURE__ */ jsx("div", {
|
|
264
|
+
className: "gifting-groups",
|
|
265
|
+
"data-group-count": look.groups.length,
|
|
266
|
+
children: look.groups.map((group) => /* @__PURE__ */ jsx(GiftGroup, {
|
|
267
|
+
group,
|
|
268
|
+
look,
|
|
269
|
+
children: group.kind === "gift_card" ? giftCards.map((offer) => /* @__PURE__ */ jsx(GiftCardOfferForm, {
|
|
270
|
+
offer,
|
|
271
|
+
currency,
|
|
272
|
+
showTitle: giftCards.length > 1,
|
|
273
|
+
initialAmount: props.chosenAmounts?.[offer.id],
|
|
274
|
+
look,
|
|
275
|
+
onSubmit: (event) => void handleSubmit(event, offer.id, "gift_card"),
|
|
276
|
+
fields: purchaseFields(offer.id)
|
|
277
|
+
}, offer.id)) : /* @__PURE__ */ jsx("ul", {
|
|
278
|
+
className: "gifting-voucher-list",
|
|
279
|
+
children: vouchers.map((offer) => /* @__PURE__ */ jsx("li", {
|
|
280
|
+
className: "gifting-voucher",
|
|
281
|
+
children: /* @__PURE__ */ jsx(VoucherOfferForm, {
|
|
282
|
+
offer,
|
|
283
|
+
currency,
|
|
284
|
+
look,
|
|
285
|
+
onSubmit: (event) => void handleSubmit(event, offer.id, "voucher"),
|
|
286
|
+
fields: purchaseFields(offer.id)
|
|
287
|
+
})
|
|
288
|
+
}, offer.id))
|
|
289
|
+
})
|
|
290
|
+
}, group.kind))
|
|
291
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
292
|
+
className: "gifting-empty",
|
|
293
|
+
children: GIFTING_NOTHING_TO_SHOW
|
|
294
|
+
})
|
|
295
|
+
]
|
|
296
|
+
})]
|
|
258
297
|
})
|
|
259
298
|
});
|
|
260
299
|
}
|
|
@@ -274,7 +313,7 @@ function GiftCardOfferForm(props) {
|
|
|
274
313
|
look: props.look
|
|
275
314
|
}),
|
|
276
315
|
extraFields: amountChoice === "custom" ? /* @__PURE__ */ jsx(CustomGiftAmount, { offer }) : null,
|
|
277
|
-
children: [props.showTitle ? /* @__PURE__ */ jsx("
|
|
316
|
+
children: [props.showTitle ? /* @__PURE__ */ jsx("h4", {
|
|
278
317
|
className: "gifting-offer-title",
|
|
279
318
|
children: offer.title
|
|
280
319
|
}) : null, offer.description ? /* @__PURE__ */ jsx("p", {
|
|
@@ -283,6 +322,28 @@ function GiftCardOfferForm(props) {
|
|
|
283
322
|
}) : null]
|
|
284
323
|
});
|
|
285
324
|
}
|
|
325
|
+
function VoucherOfferForm(props) {
|
|
326
|
+
return /* @__PURE__ */ jsxs(RevealingOfferForm, {
|
|
327
|
+
buyLabel: "Buy this voucher",
|
|
328
|
+
variant: "secondary",
|
|
329
|
+
look: props.look,
|
|
330
|
+
onSubmit: props.onSubmit,
|
|
331
|
+
fields: props.fields,
|
|
332
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
333
|
+
className: "gifting-offer-summary",
|
|
334
|
+
children: [/* @__PURE__ */ jsx("h4", {
|
|
335
|
+
className: "gifting-offer-title",
|
|
336
|
+
children: props.offer.title
|
|
337
|
+
}), /* @__PURE__ */ jsx("strong", {
|
|
338
|
+
className: "gifting-offer-price",
|
|
339
|
+
children: formatGiftAmount(props.offer.voucher.purchaseAmountCents, props.currency)
|
|
340
|
+
})]
|
|
341
|
+
}), props.offer.description ? /* @__PURE__ */ jsx("p", {
|
|
342
|
+
className: "gifting-offer-description",
|
|
343
|
+
children: props.offer.description
|
|
344
|
+
}) : null]
|
|
345
|
+
});
|
|
346
|
+
}
|
|
286
347
|
function CustomGiftAmount({ offer }) {
|
|
287
348
|
const min = offer.giftCard.customAmountMinCents / 100;
|
|
288
349
|
const max = offer.giftCard.customAmountMaxCents / 100;
|
|
@@ -317,7 +378,7 @@ function RevealingOfferForm(props) {
|
|
|
317
378
|
children: [props.row, open ? null : /* @__PURE__ */ jsx(ThemedButton, {
|
|
318
379
|
...giftingSlot(props.look, "action"),
|
|
319
380
|
type: "button",
|
|
320
|
-
variant: "primary",
|
|
381
|
+
variant: props.variant ?? "primary",
|
|
321
382
|
size: "md",
|
|
322
383
|
extraClassName: "gifting-buy",
|
|
323
384
|
label: props.buyLabel,
|
|
@@ -333,6 +394,7 @@ function RevealingOfferForm(props) {
|
|
|
333
394
|
});
|
|
334
395
|
}
|
|
335
396
|
function GiftingCustomerFields() {
|
|
397
|
+
const hintId = React.useId();
|
|
336
398
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
337
399
|
/* @__PURE__ */ jsxs("div", {
|
|
338
400
|
className: "gifting-field-grid",
|
|
@@ -365,16 +427,24 @@ function GiftingCustomerFields() {
|
|
|
365
427
|
}),
|
|
366
428
|
/* @__PURE__ */ jsxs("label", {
|
|
367
429
|
className: "gifting-field",
|
|
368
|
-
children: [/* @__PURE__ */ jsx("span", { children: "Message" }), /* @__PURE__ */ jsx("textarea", {
|
|
430
|
+
children: [/* @__PURE__ */ jsx("span", { children: "Message (optional)" }), /* @__PURE__ */ jsx("textarea", {
|
|
369
431
|
name: "message",
|
|
370
432
|
rows: 4
|
|
371
433
|
})]
|
|
372
434
|
}),
|
|
373
|
-
/* @__PURE__ */ jsxs("
|
|
435
|
+
/* @__PURE__ */ jsxs("div", {
|
|
374
436
|
className: "gifting-field",
|
|
375
|
-
children: [/* @__PURE__ */
|
|
376
|
-
|
|
377
|
-
|
|
437
|
+
children: [/* @__PURE__ */ jsxs("label", {
|
|
438
|
+
className: "gifting-field",
|
|
439
|
+
children: [/* @__PURE__ */ jsx("span", { children: "Send on" }), /* @__PURE__ */ jsx("input", {
|
|
440
|
+
name: "sendOnDate",
|
|
441
|
+
type: "date",
|
|
442
|
+
"aria-describedby": hintId
|
|
443
|
+
})]
|
|
444
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
445
|
+
id: hintId,
|
|
446
|
+
className: "gifting-field-hint",
|
|
447
|
+
children: "Leave this blank to send it straight away."
|
|
378
448
|
})]
|
|
379
449
|
})
|
|
380
450
|
] });
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c as blockSiteTermsSchema } from "./src-Do_s2lqH.mjs";
|
|
3
|
+
import { a as defineClientOwnedBlockRuntime, f as lookListPresentationSchemaShape, i as createZodCodec, n as createInteractiveIslandCodec, r as defineInteractiveIslandMetaKeys, t as buildInteractiveIslandProps } from "./islands-dMh0Oxli.mjs";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
//#region ../blocks/src/system/blocks/giftingOffer.ts
|
|
6
|
+
function decideGiftingOffer(onOffer) {
|
|
7
|
+
if (onOffer.giftCards === 0 && onOffer.vouchers === 0) return { kind: "nothing-on-offer" };
|
|
8
|
+
return {
|
|
9
|
+
kind: "shows",
|
|
10
|
+
giftCards: onOffer.giftCards > 0,
|
|
11
|
+
vouchers: onOffer.vouchers > 0
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function giftingShowsKind(decision, kind) {
|
|
15
|
+
return decision.kind === "shows" && decision[kind];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The form's condition for one kind's group heading, written out from the
|
|
19
|
+
* decision: it holds for each mix of offers where that kind's group shows.
|
|
20
|
+
* Offers that couldn't be read leave the facts unknown, so the field stays.
|
|
21
|
+
*/
|
|
22
|
+
const formOffers = [
|
|
23
|
+
{
|
|
24
|
+
giftCards: 0,
|
|
25
|
+
vouchers: 0
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
giftCards: 1,
|
|
29
|
+
vouchers: 0
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
giftCards: 0,
|
|
33
|
+
vouchers: 1
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
giftCards: 1,
|
|
37
|
+
vouchers: 1
|
|
38
|
+
}
|
|
39
|
+
];
|
|
40
|
+
function giftingKindCondition(kind) {
|
|
41
|
+
return { anyOf: formOffers.filter((offers) => giftingShowsKind(decideGiftingOffer(offers), kind)).map((offers) => ({ allOf: [{
|
|
42
|
+
fact: "gifting.giftCards",
|
|
43
|
+
is: offers.giftCards > 0 ? "some" : "none"
|
|
44
|
+
}, {
|
|
45
|
+
fact: "gifting.vouchers",
|
|
46
|
+
is: offers.vouchers > 0 ? "some" : "none"
|
|
47
|
+
}] })) };
|
|
48
|
+
}
|
|
49
|
+
const giftCardsShownCondition = giftingKindCondition("giftCards");
|
|
50
|
+
const vouchersShownCondition = giftingKindCondition("vouchers");
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region ../blocks/src/system/runtime/nodes/gifting.interactive.ts
|
|
53
|
+
const publicGiftCardOfferSchema = z.object({
|
|
54
|
+
id: z.string(),
|
|
55
|
+
kind: z.literal("gift_card"),
|
|
56
|
+
title: z.string(),
|
|
57
|
+
description: z.string().nullable(),
|
|
58
|
+
sortOrder: z.number().int(),
|
|
59
|
+
giftCard: z.object({
|
|
60
|
+
fixedDenominations: z.array(z.number().int().positive()),
|
|
61
|
+
customAmountEnabled: z.boolean(),
|
|
62
|
+
customAmountMinCents: z.number().int().positive(),
|
|
63
|
+
customAmountMaxCents: z.number().int().positive()
|
|
64
|
+
}),
|
|
65
|
+
voucher: z.null()
|
|
66
|
+
});
|
|
67
|
+
const publicVoucherOfferSchema = z.object({
|
|
68
|
+
id: z.string(),
|
|
69
|
+
kind: z.literal("voucher"),
|
|
70
|
+
title: z.string(),
|
|
71
|
+
description: z.string().nullable(),
|
|
72
|
+
sortOrder: z.number().int(),
|
|
73
|
+
giftCard: z.null(),
|
|
74
|
+
voucher: z.object({ purchaseAmountCents: z.number().int().positive() })
|
|
75
|
+
});
|
|
76
|
+
const publicGiftingOffersResponseSchema = z.object({
|
|
77
|
+
currency: z.string(),
|
|
78
|
+
giftCards: z.array(publicGiftCardOfferSchema),
|
|
79
|
+
vouchers: z.array(publicVoucherOfferSchema)
|
|
80
|
+
});
|
|
81
|
+
const giftingSourceSchema = z.object({
|
|
82
|
+
lookSlots: lookListPresentationSchemaShape.lookSlots,
|
|
83
|
+
surfacePresentation: lookListPresentationSchemaShape.surfacePresentation,
|
|
84
|
+
siteTerms: blockSiteTermsSchema.optional(),
|
|
85
|
+
siteId: z.string().optional(),
|
|
86
|
+
apiBaseUrl: z.string().optional(),
|
|
87
|
+
offers: publicGiftingOffersResponseSchema.nullable().optional(),
|
|
88
|
+
className: z.string().nullable().optional(),
|
|
89
|
+
heading: z.string().nullable().optional(),
|
|
90
|
+
intro: z.string().nullable().optional(),
|
|
91
|
+
giftCardsHeading: z.string().nullable().optional(),
|
|
92
|
+
vouchersHeading: z.string().nullable().optional(),
|
|
93
|
+
checkoutButtonText: z.string().nullable().optional(),
|
|
94
|
+
successMessage: z.string().nullable().optional()
|
|
95
|
+
});
|
|
96
|
+
const giftingDisplaySchema = z.object({
|
|
97
|
+
lookSlots: lookListPresentationSchemaShape.lookSlots,
|
|
98
|
+
surfacePresentation: lookListPresentationSchemaShape.surfacePresentation,
|
|
99
|
+
kind: z.literal("gifting"),
|
|
100
|
+
state: z.literal("ready"),
|
|
101
|
+
className: z.string().nullable(),
|
|
102
|
+
heading: z.string(),
|
|
103
|
+
intro: z.string().nullable(),
|
|
104
|
+
groups: z.array(z.object({
|
|
105
|
+
kind: z.enum(["gift_card", "voucher"]),
|
|
106
|
+
heading: z.string(),
|
|
107
|
+
line: z.string()
|
|
108
|
+
}))
|
|
109
|
+
});
|
|
110
|
+
const giftingHydrationSchema = z.object({
|
|
111
|
+
groupHeadings: z.object({
|
|
112
|
+
giftCardsHeading: z.string().nullable().optional(),
|
|
113
|
+
vouchersHeading: z.string().nullable().optional()
|
|
114
|
+
}),
|
|
115
|
+
siteTerms: blockSiteTermsSchema.optional(),
|
|
116
|
+
offers: publicGiftingOffersResponseSchema.nullable(),
|
|
117
|
+
checkoutButtonText: z.string(),
|
|
118
|
+
successMessage: z.string()
|
|
119
|
+
});
|
|
120
|
+
const giftingRenderSchema = z.object({
|
|
121
|
+
display: giftingDisplaySchema,
|
|
122
|
+
hydration: giftingHydrationSchema
|
|
123
|
+
});
|
|
124
|
+
const giftingIslandMetaCodec = createZodCodec(z.object({
|
|
125
|
+
siteId: z.string().optional(),
|
|
126
|
+
apiBaseUrl: z.string().optional()
|
|
127
|
+
}));
|
|
128
|
+
const giftingIslandMetaKeys = defineInteractiveIslandMetaKeys("siteId", "apiBaseUrl");
|
|
129
|
+
/** The Look's slot hooks and surfaces, carried only when the block has a Look. */
|
|
130
|
+
function giftingLookPresentation({ lookSlots, surfacePresentation }) {
|
|
131
|
+
return {
|
|
132
|
+
...lookSlots ? { lookSlots } : {},
|
|
133
|
+
...surfacePresentation ? { surfacePresentation } : {}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/** A group for each kind the decision shows; none while the offers couldn't be read. */
|
|
137
|
+
function giftingGroups(source) {
|
|
138
|
+
const offers = source.offers;
|
|
139
|
+
if (!offers) return [];
|
|
140
|
+
const decision = decideGiftingOffer({
|
|
141
|
+
giftCards: offers.giftCards.length,
|
|
142
|
+
vouchers: offers.vouchers.length
|
|
143
|
+
});
|
|
144
|
+
return [...giftingShowsKind(decision, "giftCards") ? [giftingGroup("gift_card", offers.giftCards.length, source.giftCardsHeading)] : [], ...giftingShowsKind(decision, "vouchers") ? [giftingGroup("voucher", offers.vouchers.length, source.vouchersHeading)] : []];
|
|
145
|
+
}
|
|
146
|
+
function giftingGroup(kind, count, heading) {
|
|
147
|
+
const singular = kind === "gift_card" ? "Gift card" : "Voucher";
|
|
148
|
+
return {
|
|
149
|
+
kind,
|
|
150
|
+
heading: heading?.trim() || (count === 1 ? singular : `${singular}s`),
|
|
151
|
+
line: kind === "gift_card" ? "An amount they can spend on any booking here." : "Paid for in advance, for one particular thing."
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function buildGiftingDisplay(source) {
|
|
155
|
+
return {
|
|
156
|
+
kind: "gifting",
|
|
157
|
+
...giftingLookPresentation(source),
|
|
158
|
+
state: "ready",
|
|
159
|
+
className: source.className ?? null,
|
|
160
|
+
heading: source.heading?.trim() || "Gift cards & vouchers",
|
|
161
|
+
intro: source.intro?.trim() || null,
|
|
162
|
+
groups: giftingGroups(source)
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const giftingBlockRuntime = defineClientOwnedBlockRuntime({
|
|
166
|
+
kind: "client-owned",
|
|
167
|
+
contracts: {
|
|
168
|
+
source: createZodCodec(giftingSourceSchema),
|
|
169
|
+
render: createZodCodec(giftingRenderSchema)
|
|
170
|
+
},
|
|
171
|
+
buildRender: (source) => ({
|
|
172
|
+
display: buildGiftingDisplay(source),
|
|
173
|
+
hydration: {
|
|
174
|
+
groupHeadings: {
|
|
175
|
+
giftCardsHeading: source.giftCardsHeading,
|
|
176
|
+
vouchersHeading: source.vouchersHeading
|
|
177
|
+
},
|
|
178
|
+
siteTerms: source.siteTerms,
|
|
179
|
+
offers: source.offers ?? null,
|
|
180
|
+
checkoutButtonText: source.checkoutButtonText?.trim() || "Continue to payment",
|
|
181
|
+
successMessage: source.successMessage?.trim() || "Thanks, that's all paid for. We'll email the gift to them in the next few minutes."
|
|
182
|
+
}
|
|
183
|
+
})
|
|
184
|
+
});
|
|
185
|
+
const giftingInteractiveIslandPropsCodec = createInteractiveIslandCodec({
|
|
186
|
+
runtime: giftingBlockRuntime,
|
|
187
|
+
mode: "gifting",
|
|
188
|
+
meta: giftingIslandMetaCodec,
|
|
189
|
+
metaKeys: giftingIslandMetaKeys,
|
|
190
|
+
selectMeta: (value) => ({
|
|
191
|
+
siteId: value.siteId,
|
|
192
|
+
apiBaseUrl: value.apiBaseUrl
|
|
193
|
+
})
|
|
194
|
+
});
|
|
195
|
+
function buildGiftingInteractiveIslandProps(props) {
|
|
196
|
+
return buildInteractiveIslandProps({
|
|
197
|
+
runtime: giftingBlockRuntime,
|
|
198
|
+
mode: "gifting",
|
|
199
|
+
meta: {
|
|
200
|
+
siteId: props.siteId,
|
|
201
|
+
apiBaseUrl: props.apiBaseUrl
|
|
202
|
+
},
|
|
203
|
+
source: props
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
//#endregion
|
|
207
|
+
export { publicGiftingOffersResponseSchema as a, vouchersShownCondition as c, giftingInteractiveIslandPropsCodec as i, buildGiftingInteractiveIslandProps as n, decideGiftingOffer as o, giftingBlockRuntime as r, giftCardsShownCondition as s, buildGiftingDisplay as t };
|