@riverbankcms/sdk 0.174.0 → 0.175.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/dist/_dts/{BlocksIslandsHydrator-GqVX3I8E.d.ts → BlocksIslandsHydrator-hb2IWD8K.d.ts} +1 -1
- package/dist/_dts/{Page-BhUH31M-.d.ts → Page-BlY68ZF-.d.ts} +7 -7
- package/dist/_dts/{SdkPreviewMode-DBn2x0UL.d.ts → SdkPreviewMode-CA8hU7hW.d.ts} +2 -2
- package/dist/_dts/{client-Cr-sOeSl.d.ts → client-B6tCvmG4.d.ts} +487 -11
- package/dist/_dts/{content-types-DKw1yJdN.d.ts → content-types-B9qryk4R.d.ts} +2 -2
- package/dist/_dts/{contracts-CJ2O03nB.d.ts → contracts-DWoaRxj1.d.ts} +3 -3
- package/dist/_dts/{footerPageOutline-DoGHHKr_.d.ts → footerPageOutline-Djdrhp5s.d.ts} +6 -6
- package/dist/_dts/{generatePageMetadata-CJGu4hoa.d.ts → generatePageMetadata-CFi0vxov.d.ts} +2 -2
- package/dist/_dts/{index--39uLjrr.d.ts → index-Bl5_pjmq.d.ts} +1 -1
- package/dist/_dts/{index-DQZ5L0Gb.d.ts → index-Btp5nIoz.d.ts} +2 -2
- package/dist/_dts/{index-Bq-488M7.d.ts → index-CQUzwOxO.d.ts} +1 -1
- package/dist/_dts/{index-DYlfdT1O.d.ts → index-DmhFb6R1.d.ts} +1 -1
- package/dist/_dts/{index-3GzargmS.d.ts → index-OtazQE3U.d.ts} +2 -2
- package/dist/_dts/{index-DYsP4k6S.d.ts → index-YRQulWB4.d.ts} +3 -3
- package/dist/_dts/{index-DdEi2iXd.d.ts → index-_pXaCO12.d.ts} +4 -4
- package/dist/_dts/{loadContent-BVPagYmy.d.ts → loadContent-Hcuvs4pz.d.ts} +7 -7
- package/dist/_dts/{request-Be1E-H-V.d.ts → request-BT8i_vH-.d.ts} +2070 -503
- package/dist/_dts/{resolveBlockData-D1pL25bD.d.ts → resolveBlockData-B-dJrunl.d.ts} +5 -5
- package/dist/_dts/{resolvePageContent-B4sbTf96.d.ts → resolvePageContent-CVLYWcoI.d.ts} +2 -2
- 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 +6 -6
- 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 +13 -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 +3 -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 +5 -5
- 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 +2 -1
- package/dist/_dts/{types-Bm5_3VEd.d.ts → types-C0XZnjXz.d.ts} +3 -3
- package/dist/_dts/{types-5MeDI1w8.d.ts → types-CXL1QJSY.d.ts} +7 -7
- package/dist/_dts/{types-CVoCc_Ia.d.ts → types-OKzbqRBx.d.ts} +2 -2
- package/dist/_dts/{validation-lEtYD-Rh.d.ts → validation-Bxi66FtQ.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-DkflFLGQ.mjs → BlocksIslandsHydrator-2xzlERTG.mjs} +17 -16
- package/dist/client/{BookingMailingListNote-CAyoiAGD.mjs → BookingMailingListNote-qsohSEdQ.mjs} +6 -6
- package/dist/client/{BookingPanelArrangement-C7yiJrxm.mjs → BookingPanelArrangement-DrdtON0q.mjs} +1 -1
- package/dist/client/{BookingQuestionFields-DZMrGvBh.mjs → BookingQuestionFields-CUFxBaTM.mjs} +3 -3
- package/dist/client/{CalendarNavigationChevron-BPQU5Snc.mjs → CalendarNavigationChevron-Ch0w0Utn.mjs} +34 -9
- package/dist/client/DemoBookingPortalAccess-DGgsjqXK.mjs +545 -0
- package/dist/client/{EventCalendar.client-BiWQc28-.mjs → EventCalendar.client-Dg4PHFJJ.mjs} +15 -25
- package/dist/client/{EventCombined.client-B_ytWQtn.mjs → EventCombined.client-tky8JcnQ.mjs} +25 -17
- package/dist/client/{EventItem-C-mxXpX_.mjs → EventItem-BybMSKNL.mjs} +4 -3
- package/dist/client/{EventListWeekNavigation-Bm3Ap1Rd.mjs → EventListWeekNavigation-uvWRE5wi.mjs} +1 -1
- package/dist/client/{EventListing.client-Bs_8im5_.mjs → EventListing.client-DQx9dohz.mjs} +3 -3
- package/dist/client/{EventListing.view-CN7BjGgC.mjs → EventListing.view-r31k8Icz.mjs} +8 -7
- package/dist/client/{EventRegistrationPayment-DPkRcSdw.mjs → EventRegistrationPayment-BMmPDmSf.mjs} +664 -362
- package/dist/client/{LocationMapActions-BJT7MqP2.mjs → LocationMapActions-BecH-qhI.mjs} +1 -1
- package/dist/client/{MapDrawingSvg-DCIwlON6.mjs → MapDrawingSvg-BJzmFdcn.mjs} +18 -3
- package/dist/client/{Page--xJ23nA5.mjs → Page-CWN_8cLZ.mjs} +736 -1667
- package/dist/client/{DemoBookingPortalAccess-BnEgvJas.mjs → SiteTermsAgreementField-Dr5lj4oY.mjs} +4 -301
- package/dist/client/{StepIndicator-D391QRNc.mjs → StepIndicator-C7RJBOW3.mjs} +37 -249
- package/dist/client/{accordion-BQtTkDN8.mjs → accordion-uUi_N6mZ.mjs} +1 -1
- package/dist/client/{booking-form.client-D9M7TKGV.mjs → booking-form.client-CKHgxvsh.mjs} +229 -42
- package/dist/client/{bookingForm-BsOS0sl9.mjs → bookingForm-Bi74dmiS.mjs} +4 -4
- package/dist/client/bookings.mjs +22 -15
- package/dist/client/{boxStyleClassNames-CNDLpT06.mjs → boxStyleClassNames-C-gFwhnO.mjs} +3 -29
- package/dist/client/{carousel-CPsW-FPh.mjs → carousel-C0_BqMA0.mjs} +1 -1
- package/dist/client/{cart-CwElmocm.mjs → cart-BOHuppVu.mjs} +3 -3
- package/dist/client/{cart.client-RpqI56w8.mjs → cart.client-IfJE1zAp.mjs} +1 -1
- package/dist/client/{checkout-CfMgqY8H.mjs → checkout-C3Aj-aNa.mjs} +3 -3
- package/dist/client/{checkout.client-BpuPyOuJ.mjs → checkout.client-Tg9lfeYf.mjs} +1 -1
- package/dist/client/{checkoutUrls-VeHY6WYj.mjs → checkoutUrls-OLqQdAXD.mjs} +1 -1
- package/dist/client/client.mjs +113 -21
- package/dist/client/{context-CNlesLfF.mjs → context-D8TpQXjX.mjs} +76 -58
- package/dist/client/{course-q1sA4Cj-.mjs → course-DHmeQAvq.mjs} +2 -2
- package/dist/client/{creditProducts-KYMVIH3J.mjs → creditProducts-BQ1t1erI.mjs} +14 -61
- package/dist/client/{dateFormatting-B73Ll0s4.mjs → dateFormatting-ABCZWkpT.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-BVbLD4pi.mjs → demoPortalMagicLink-BdcuW_pa.mjs} +1 -1
- package/dist/client/display-DMqotaGU.mjs +11797 -0
- package/dist/client/{enhanceHeaderSection-BzjY6AiY.mjs → enhanceHeaderSection-Ciuhsk0E.mjs} +3 -3
- package/dist/client/{event-details.client-CseTWUFC.mjs → event-details.client-CJapNbTv.mjs} +1 -1
- package/dist/client/{event-registration.client-b5TLxntR.mjs → event-registration.client-CAdcpnLc.mjs} +295 -188
- package/dist/client/{eventCalendar-C-kJNIc9.mjs → eventCalendar-BlsD5R8M.mjs} +4 -4
- package/dist/client/{eventCombined-BgHJGhwE.mjs → eventCombined-B9Ly3024.mjs} +4 -4
- package/dist/client/{eventDetails-CAwbreD0.mjs → eventDetails-CbEGI4jO.mjs} +2 -2
- package/dist/client/{eventListing-_14atrj8.mjs → eventListing-ZSmvhWII.mjs} +4 -4
- package/dist/client/{eventRegistration-BOqSdstJ.mjs → eventRegistration-D-yUcIyO.mjs} +4 -4
- package/dist/client/{form-DfAB-llc.mjs → form-DG_YZSNn.mjs} +3 -3
- package/dist/client/{form.client-DN-I9_qC.mjs → form.client-BU6dM0-C.mjs} +4 -4
- package/dist/client/{form.parts-t2Q1neM6.mjs → form.parts-Db0Iq7nx.mjs} +1 -1
- package/dist/client/{formatDate-Dp7POa9Y.mjs → formatDate-DFfWHpQB.mjs} +1 -1
- package/dist/client/gifting/client.mjs +5 -3
- package/dist/client/gifting-DMrsN4B4.mjs +28 -0
- package/dist/client/gifting.client-BVa2XYJB.mjs +404 -0
- package/dist/client/gifting.parts-C2u4Y-pf.mjs +86 -0
- package/dist/client/{headerSection-Dces54pb.mjs → headerSection-D91EzlOR.mjs} +2 -2
- package/dist/client/{display-D8MW2b0e.mjs → lookSurfaces-BDZLALxj.mjs} +3084 -12938
- package/dist/client/{newsletter-form.client-D_YFUlR2.mjs → newsletter-form.client-BMGRiRpo.mjs} +7 -5
- package/dist/client/{newsletter-form.parts-URO5Mn_I.mjs → newsletter-form.parts-D5UfUaD3.mjs} +3 -3
- package/dist/client/{newsletterForm-_c9fKIzS.mjs → newsletterForm-B_67sNwa.mjs} +3 -3
- package/dist/client/{noop-D5mFWXtN.mjs → noop-DF8_EiFt.mjs} +93 -28
- package/dist/client/portal/client.mjs +313 -148
- package/dist/client/{product-detail.client-CVW1UIxJ.mjs → product-detail.client-D-XNir0m.mjs} +1 -1
- package/dist/client/{product-list.client-CF9hO23G.mjs → product-list.client-BLfYQ-qi.mjs} +1 -1
- package/dist/client/{productDetail-C_qbmUuP.mjs → productDetail-W0_0lDGe.mjs} +3 -3
- package/dist/client/{productList-Df5qDD0z.mjs → productList-ayAtPJdb.mjs} +3 -3
- package/dist/client/{propsDecoder-BiEyK2ii.mjs → propsDecoder-ChYKWjLA.mjs} +4 -3
- package/dist/client/{registry.server-ClcfWpvM.mjs → registry.server-B1EEZkcr.mjs} +311 -262
- package/dist/client/rendering/client.mjs +25 -491
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +7 -7
- package/dist/client/{richText-coerce-C32cRQ03.mjs → richText-coerce-CDAfpMQU.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-DAypPzSo.mjs → routeIslandApiConfig-CcGWvyht.mjs} +1 -1
- package/dist/client/{shop-gteEpeO5.mjs → shop-DbUUoHFJ.mjs} +3 -3
- package/dist/client/{shop-discount-apply.state-DidgH7ow.mjs → shop-add-feedback-DvC2kP1K.mjs} +1 -78
- package/dist/client/{shop-commerce-Bw4_BXQg.mjs → shop-commerce-aQqcDmyZ.mjs} +64 -32
- package/dist/client/{shop-commerce-store-Da6Ah-_4.mjs → shop-commerce-store-Cd7USpuY.mjs} +1 -1
- package/dist/client/shop-discount-apply.state-DGvPBmVP.mjs +83 -0
- package/dist/client/{shop.client-CbbdjWWd.mjs → shop.client-BNZ9M8cG.mjs} +56 -19
- package/dist/client/{shop.interactive-CKFORzux.mjs → shop.interactive-CJAINJr3.mjs} +118 -39
- package/dist/client/{shopShared-C7QjoywZ.mjs → shopShared-DwVAuGsx.mjs} +2 -2
- package/dist/client/{timetableModel-CtZiIj9q.mjs → timetableModel-DBTIFWTb.mjs} +11 -148
- package/dist/client/{useAvailableSlots-CUVRD1nx.mjs → useAvailableSlots-BomyyKeo.mjs} +3 -3
- package/dist/client/{useDiscountCodeUi-BuLgof7O.mjs → useDiscountCodeUi-CCxHMWlU.mjs} +32 -17
- package/dist/client/{useEventPagination-B4VPtSEF.mjs → useEventPagination-Bjin_qaN.mjs} +7 -6
- package/dist/client/{view-CvlTplao.mjs → view-BTk470k0.mjs} +3 -2
- package/dist/client/{view-CxUpgcM6.mjs → view-Cw4EmEPv.mjs} +100 -32
- package/dist/preview-next/client/{PageSectionToolbar-BFbSrDbi.mjs → PageSectionToolbar-bq7gbKvn.mjs} +4 -4
- package/dist/preview-next/client/{PreviewEditorSidebar-BtpzqQ-i.mjs → PreviewEditorSidebar-DVsPNcos.mjs} +32 -29
- package/dist/preview-next/client/{PreviewEditorUI-z22h-CCY.mjs → PreviewEditorUI-B-pq3aZc.mjs} +4 -4
- package/dist/preview-next/client/{PreviewShell-BW3Qpoa_.mjs → PreviewShell-ChyjB96e.mjs} +5 -5
- package/dist/preview-next/client/{SdkPreviewModeRuntime-BvVeK1hR.mjs → SdkPreviewModeRuntime-D_czeC0l.mjs} +84 -101
- package/dist/preview-next/client/{previewAssistantSlot-BUqAh1FL.mjs → previewAssistantSlot-B61mZd81.mjs} +4981 -3275
- package/dist/preview-next/client/{previewChromeRoot-NCy5zHO8.mjs → previewChromeRoot-dwOn9XtM.mjs} +1 -1
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-CxmKDVGZ.mjs → sdk-runtime-DZDfOxoW.mjs} +2 -2
- package/dist/preview-next/client/{siteStyleAccess-B_UaDyJO.mjs → siteStyleAccess-BZDIC-fA.mjs} +529 -238
- package/dist/preview-next/client/{useAutosaveStatus-BqmWvPLY.mjs → useAutosaveStatus-BbzLMf-l.mjs} +1 -1
- package/dist/preview-next/client/{useOpenBlockForSetup-LAllV0rU.mjs → useOpenBlockForSetup-BEXcWQeI.mjs} +25 -5
- package/dist/preview-next/container-responsive.css +51 -3
- package/dist/preview-next/keepAlive.mjs +1 -1
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{route-contract-DV6SeCNv.mjs → route-contract-0gSlK9S0.mjs} +87 -12
- package/dist/server/{Block.shared-Ch2FKAvU.mjs → Block.shared-DeXXycg8.mjs} +4 -4
- package/dist/server/{ThemeScopeCore-DFvjDVzi.mjs → ThemeScopeCore-DFEM1a85.mjs} +16 -2
- package/dist/server/{bindings-CQg2lzZn.mjs → bindings-7L3pC5Os.mjs} +13 -34
- package/dist/server/{client-aYRTVneD.mjs → client-CgghATBm.mjs} +112 -20
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/{customCss-BGB8gMVb.mjs → customCss-BZ8YSrQg.mjs} +1 -0
- package/dist/server/data/resolveBlockData.mjs +1 -1
- package/dist/server/index.mjs +2 -2
- package/dist/server/{loadContent-Cgpfr44e.mjs → loadContent-D7M5Vcug.mjs} +5 -5
- package/dist/server/{loadPage-RDk10NMP.mjs → loadPage-CiTId05y.mjs} +2 -2
- package/dist/server/{lookMediaFrame-CQtkvlDn.mjs → lookMediaFrame-CaH018pK.mjs} +129 -12
- package/dist/server/next.mjs +35 -9
- package/dist/server/{overrideResolution-VhhN94d8.mjs → overrideResolution-CJ3MRI5Q.mjs} +1 -1
- package/dist/server/page-converter.mjs +1 -1
- package/dist/server/{pageRenderPlan-CkFTsxkd.mjs → pageRenderPlan-Cuos4Xcd.mjs} +105 -357
- package/dist/server/{pageRuntimeSupport-CpAtzNxD.mjs → pageRuntimeSupport-CuVj3bkd.mjs} +4 -3
- package/dist/server/{pageShared-B8yLPjs0.mjs → pageShared-JxlV8_Bo.mjs} +1707 -1811
- package/dist/server/{parseThemeForPersistence-Cwqb5pZx.mjs → parseThemeForPersistence-DOsfofCy.mjs} +1 -1
- package/dist/server/{prebuild-DOu6QceG.mjs → prebuild-BDhlJbAx.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-CfOXFKYG.mjs → prefetchBlockData-kERh_c0v.mjs} +2 -2
- package/dist/server/{registry-34rkAfaU.mjs → registry-cQ9N5W-n.mjs} +21091 -20209
- 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 +3 -3
- package/dist/server/rendering.mjs +7 -7
- package/dist/server/{resolveBlockData-D7VeoWgr.mjs → resolveBlockData-CN4UmmTK.mjs} +1 -1
- package/dist/server/{schema-CUDHMirj.mjs → schema-BpsqaSSU.mjs} +2 -2
- package/dist/server/server.mjs +3 -3
- package/dist/server/theme-bridge.mjs +1 -1
- package/dist/server/theme.mjs +2 -2
- package/dist/server/{validation-CLVKoJrX.mjs → validation-3puM5SM8.mjs} +3 -3
- package/dist/server/{version-HVfdvBJ0.mjs → version-B8g-Wx57.mjs} +1 -1
- package/dist/styles/index.css +361 -57
- package/package.json +1 -1
- package/dist/client/bookability-CE637yDE.mjs +0 -17
- package/dist/client/useDiscountApply-BZU5DWZQ.mjs +0 -199
package/dist/client/{shop-discount-apply.state-DidgH7ow.mjs → shop-add-feedback-DvC2kP1K.mjs}
RENAMED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { p as assertNever } from "./creditProducts-KYMVIH3J.mjs";
|
|
3
2
|
import { t as FeedbackMessage } from "./FeedbackMessage-CSJrAuXH.mjs";
|
|
4
|
-
import { a as normalizeManualDiscountCode } from "./useDiscountApply-BZU5DWZQ.mjs";
|
|
5
3
|
import * as React$1 from "react";
|
|
6
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
5
|
//#region ../blocks/src/system/runtime/shared/utils/urlParams.ts
|
|
@@ -88,79 +86,4 @@ function ShopAddFeedback(props) {
|
|
|
88
86
|
});
|
|
89
87
|
}
|
|
90
88
|
//#endregion
|
|
91
|
-
|
|
92
|
-
const initialDiscountApplyState = {
|
|
93
|
-
isOpen: false,
|
|
94
|
-
draftCode: "",
|
|
95
|
-
status: { type: "idle" }
|
|
96
|
-
};
|
|
97
|
-
function discountApplyReducer(state, action) {
|
|
98
|
-
switch (action.type) {
|
|
99
|
-
case "open": return {
|
|
100
|
-
...state,
|
|
101
|
-
isOpen: true
|
|
102
|
-
};
|
|
103
|
-
case "draftChanged": return {
|
|
104
|
-
...state,
|
|
105
|
-
draftCode: action.draftCode,
|
|
106
|
-
status: { type: "idle" }
|
|
107
|
-
};
|
|
108
|
-
case "remove": return initialDiscountApplyState;
|
|
109
|
-
case "applyStarted": return {
|
|
110
|
-
...state,
|
|
111
|
-
status: { type: "applying" }
|
|
112
|
-
};
|
|
113
|
-
case "applySucceeded": return {
|
|
114
|
-
...state,
|
|
115
|
-
isOpen: true,
|
|
116
|
-
draftCode: action.discount.code,
|
|
117
|
-
status: {
|
|
118
|
-
type: "applied",
|
|
119
|
-
discount: action.discount
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
case "applyRejected": return {
|
|
123
|
-
...state,
|
|
124
|
-
isOpen: true,
|
|
125
|
-
status: {
|
|
126
|
-
type: "rejected",
|
|
127
|
-
reason: action.reason,
|
|
128
|
-
message: action.message
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
case "resetApplied":
|
|
132
|
-
if (state.status.type !== "applied") return state;
|
|
133
|
-
return {
|
|
134
|
-
...state,
|
|
135
|
-
status: { type: "idle" }
|
|
136
|
-
};
|
|
137
|
-
default: return assertNever(action);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
function getAppliedDiscountCode(state) {
|
|
141
|
-
if (state.status.type !== "applied") return null;
|
|
142
|
-
return normalizeManualDiscountCode(state.status.discount.code);
|
|
143
|
-
}
|
|
144
|
-
function isDiscountApplyInFlight(state) {
|
|
145
|
-
return state.status.type === "applying";
|
|
146
|
-
}
|
|
147
|
-
function getDiscountApplyFeedback(status, formatPrice) {
|
|
148
|
-
switch (status.type) {
|
|
149
|
-
case "idle":
|
|
150
|
-
case "applying": return null;
|
|
151
|
-
case "applied": {
|
|
152
|
-
const savings = formatPrice(status.discount.discountCents, status.discount.currency);
|
|
153
|
-
return {
|
|
154
|
-
tone: "success",
|
|
155
|
-
message: `${status.discount.publicLabel} applied. You save ${savings}.`
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
case "rejected": return {
|
|
159
|
-
tone: "error",
|
|
160
|
-
message: status.message
|
|
161
|
-
};
|
|
162
|
-
default: return assertNever(status);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
//#endregion
|
|
166
|
-
export { isDiscountApplyInFlight as a, consumeSearchParam as c, initialDiscountApplyState as i, consumeSearchParams as l, getAppliedDiscountCode as n, ShopAddFeedback as o, getDiscountApplyFeedback as r, useTransientShopAddFeedback as s, discountApplyReducer as t };
|
|
89
|
+
export { consumeSearchParams as i, useTransientShopAddFeedback as n, consumeSearchParam as r, ShopAddFeedback as t };
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { u as getShopDisplayForItems } from "./shop.interactive-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { i as
|
|
6
|
-
import { n as useBlockApi } from "./context-
|
|
2
|
+
import { u as getShopDisplayForItems } from "./shop.interactive-CJAINJr3.mjs";
|
|
3
|
+
import { _ as deriveCommerceCheckoutState, a as buildProductCardDisplay, c as formatCommercePrice, g as buildProductCartItem, o as buildProductDetailDisplay, wr as RichText, y as productItemKey } from "./display-DMqotaGU.mjs";
|
|
4
|
+
import { n as assertNever, o as clearWorkflowFeedback, s as reportWorkflowError } from "./noop-DF8_EiFt.mjs";
|
|
5
|
+
import { i as useSiteTermsAgreement, n as SiteTermsChangedNotice, t as SiteTermsAgreementField } from "./SiteTermsAgreementField-Dr5lj4oY.mjs";
|
|
6
|
+
import { n as useBlockApi } from "./context-D8TpQXjX.mjs";
|
|
7
7
|
import { i as ThemedButtonLink, r as ThemedButton } from "./ThemedButton-DuaYtnvG.mjs";
|
|
8
|
-
import {
|
|
8
|
+
import { a as useDiscountApply, d as planUnifiedCheckoutRequest, i as isDiscountCodeRefusal, l as planCartDiscountAvailabilityRequests, n as DemoBookingPortalAccess, o as aggregateCartDiscountUiState, p as DiscountCodeDisclosure, s as checkoutFormForDiscountUiState } from "./DemoBookingPortalAccess-DGgsjqXK.mjs";
|
|
9
|
+
import { t as buildCheckoutReturnUrls } from "./checkoutUrls-OLqQdAXD.mjs";
|
|
9
10
|
import { t as resolveDedicatedCheckoutPath } from "./checkoutRoute-DKlZRNZD.mjs";
|
|
10
|
-
import {
|
|
11
|
+
import { n as useTransientShopAddFeedback, r as consumeSearchParam, t as ShopAddFeedback } from "./shop-add-feedback-DvC2kP1K.mjs";
|
|
11
12
|
import { t as FeedbackMessage } from "./FeedbackMessage-CSJrAuXH.mjs";
|
|
12
|
-
import { t as coerceRichTextDoc } from "./richText-coerce-
|
|
13
|
-
import { c as ProductDetailView, f as VariantSelectView, l as ProductGalleryFrameView, n as CheckoutShellView, s as ProductCardView, t as CartShellView, u as ProductListSectionView } from "./view-
|
|
14
|
-
import { a as storeDemoBookingCheckoutReturn, i as readDemoBookingCheckoutReturnEmail } from "./demoPortalMagicLink-
|
|
15
|
-
import {
|
|
13
|
+
import { t as coerceRichTextDoc } from "./richText-coerce-CDAfpMQU.mjs";
|
|
14
|
+
import { c as ProductDetailView, f as VariantSelectView, l as ProductGalleryFrameView, n as CheckoutShellView, s as ProductCardView, t as CartShellView, u as ProductListSectionView } from "./view-BTk470k0.mjs";
|
|
15
|
+
import { a as storeDemoBookingCheckoutReturn, i as readDemoBookingCheckoutReturnEmail } from "./demoPortalMagicLink-BdcuW_pa.mjs";
|
|
16
|
+
import { a as initialDiscountApplyState, i as getDiscountApplyFeedback, n as discountDraftAwaitingApply, o as isDiscountApplyInFlight, r as getAppliedDiscountCode, t as discountApplyReducer } from "./shop-discount-apply.state-DGvPBmVP.mjs";
|
|
16
17
|
import { t as CarouselNodeClient } from "./carousel.client-h65clfUO.mjs";
|
|
17
|
-
import { n as useCommerceCart } from "./shop-commerce-store-
|
|
18
|
+
import { n as useCommerceCart } from "./shop-commerce-store-Cd7USpuY.mjs";
|
|
18
19
|
import * as React$1 from "react";
|
|
19
20
|
import { useEffect, useState } from "react";
|
|
20
21
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -258,6 +259,37 @@ function ShopCheckoutNoticeView(props) {
|
|
|
258
259
|
children: succeeded ? "Payment successful." : "Checkout cancelled."
|
|
259
260
|
}), succeeded && props.demoEmailSuppressed ? /* @__PURE__ */ jsx(DemoBookingPortalAccess, { email: props.email }) : null] });
|
|
260
261
|
}
|
|
262
|
+
function cartCheckoutForm(form, discountApply, uiState) {
|
|
263
|
+
return checkoutFormForDiscountUiState({
|
|
264
|
+
...form,
|
|
265
|
+
discountCode: getAppliedDiscountCode(discountApply) ?? ""
|
|
266
|
+
}, uiState);
|
|
267
|
+
}
|
|
268
|
+
function checkoutFailureMessage(error) {
|
|
269
|
+
return error instanceof Error ? error.message : "Checkout failed";
|
|
270
|
+
}
|
|
271
|
+
function cartDiscountHint(status) {
|
|
272
|
+
return status.type === "applied" && status.discount.totalAfterDiscountCents === 0 ? "There's nothing to pay. You won't need to enter card details." : void 0;
|
|
273
|
+
}
|
|
274
|
+
function cartSubmitLabel(status, fallback) {
|
|
275
|
+
if (status.type !== "applied") return fallback;
|
|
276
|
+
return status.discount.totalAfterDiscountCents === 0 ? "Complete purchase" : `Pay ${formatCommercePrice(status.discount.totalAfterDiscountCents, status.discount.currency)}`;
|
|
277
|
+
}
|
|
278
|
+
function CartDiscountNotice({ uiState }) {
|
|
279
|
+
if (uiState.type === "loading") return /* @__PURE__ */ jsx(FeedbackMessage, {
|
|
280
|
+
tone: "info",
|
|
281
|
+
className: "rb-caption status-muted",
|
|
282
|
+
role: "status",
|
|
283
|
+
children: "Checking available discounts."
|
|
284
|
+
});
|
|
285
|
+
if (uiState.type !== "auto-only") return null;
|
|
286
|
+
return /* @__PURE__ */ jsx(FeedbackMessage, {
|
|
287
|
+
tone: "info",
|
|
288
|
+
className: "rb-caption status-muted",
|
|
289
|
+
role: "status",
|
|
290
|
+
children: uiState.autoAppliedDiscount ? `${uiState.autoAppliedDiscount.publicLabel} will be applied at checkout.` : "Eligible discounts will be applied at checkout."
|
|
291
|
+
});
|
|
292
|
+
}
|
|
261
293
|
function CheckoutController(props) {
|
|
262
294
|
const api = useBlockApi();
|
|
263
295
|
const siteTerms = useSiteTermsAgreement({
|
|
@@ -311,16 +343,21 @@ function CheckoutController(props) {
|
|
|
311
343
|
const handleSubmit = async (event) => {
|
|
312
344
|
event.preventDefault();
|
|
313
345
|
if (display.state !== "ready" || state.submission === "submitting") return;
|
|
346
|
+
if (discountDraftAwaitingApply(discountApply)) {
|
|
347
|
+
dispatchDiscountApply({
|
|
348
|
+
type: "applyRejected",
|
|
349
|
+
reason: "invalid_or_not_applicable",
|
|
350
|
+
message: "Apply your code before paying."
|
|
351
|
+
});
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
314
354
|
if (!siteTerms.requireAgreement("commerce")) return;
|
|
315
355
|
dispatch({ type: "submitStarted" });
|
|
316
356
|
try {
|
|
317
357
|
const { successUrl, cancelUrl } = buildCheckoutReturnUrls("checkout", CHECKOUT_ANCHOR_ID);
|
|
318
358
|
const command = planUnifiedCheckoutRequest({
|
|
319
359
|
checkout: checkoutState,
|
|
320
|
-
form:
|
|
321
|
-
...state.form,
|
|
322
|
-
discountCode: getAppliedDiscountCode(discountApply) ?? ""
|
|
323
|
-
}, discountUiState),
|
|
360
|
+
form: cartCheckoutForm(state.form, discountApply, discountUiState),
|
|
324
361
|
successUrl,
|
|
325
362
|
cancelUrl
|
|
326
363
|
});
|
|
@@ -340,9 +377,14 @@ function CheckoutController(props) {
|
|
|
340
377
|
cart.clear();
|
|
341
378
|
window.location.href = successUrl;
|
|
342
379
|
} catch (submitError) {
|
|
380
|
+
if (isDiscountCodeRefusal(submitError)) dispatchDiscountApply({
|
|
381
|
+
type: "applyRejected",
|
|
382
|
+
reason: "invalid_or_not_applicable",
|
|
383
|
+
message: submitError.message
|
|
384
|
+
});
|
|
343
385
|
dispatch({
|
|
344
386
|
type: "submitFailed",
|
|
345
|
-
message: submitError
|
|
387
|
+
message: checkoutFailureMessage(submitError)
|
|
346
388
|
});
|
|
347
389
|
return;
|
|
348
390
|
} finally {
|
|
@@ -406,23 +448,13 @@ function CheckoutController(props) {
|
|
|
406
448
|
onRemove: () => dispatchDiscountApply({ type: "remove" }),
|
|
407
449
|
onApply: applyDiscountCode,
|
|
408
450
|
id: "shop-checkout-discount-code",
|
|
409
|
-
|
|
451
|
+
applied: discountApply.status.type === "applied",
|
|
452
|
+
hint: cartDiscountHint(discountApply.status),
|
|
410
453
|
feedback: discountApplyFeedback,
|
|
411
454
|
isApplying: isDiscountApplyInFlight(discountApply),
|
|
412
455
|
disabled: state.submission === "submitting"
|
|
413
456
|
}) : null,
|
|
414
|
-
|
|
415
|
-
tone: "info",
|
|
416
|
-
className: "rb-caption status-muted",
|
|
417
|
-
role: "status",
|
|
418
|
-
children: "Checking available discounts."
|
|
419
|
-
}) : null,
|
|
420
|
-
discountUiState.type === "auto-only" ? /* @__PURE__ */ jsx(FeedbackMessage, {
|
|
421
|
-
tone: "info",
|
|
422
|
-
className: "rb-caption status-muted",
|
|
423
|
-
role: "status",
|
|
424
|
-
children: discountUiState.autoAppliedDiscount ? `${discountUiState.autoAppliedDiscount.publicLabel} will be applied at checkout.` : "Eligible discounts will be applied at checkout."
|
|
425
|
-
}) : null,
|
|
457
|
+
/* @__PURE__ */ jsx(CartDiscountNotice, { uiState: discountUiState }),
|
|
426
458
|
state.feedback.tag === "error" ? /* @__PURE__ */ jsx(FeedbackMessage, {
|
|
427
459
|
tone: "error",
|
|
428
460
|
className: "rb-caption status-muted",
|
|
@@ -439,8 +471,8 @@ function CheckoutController(props) {
|
|
|
439
471
|
type: "submit",
|
|
440
472
|
variant: "default",
|
|
441
473
|
size: "md",
|
|
442
|
-
label: state.submission === "submitting" ? "Loading…" : display.submitButtonText,
|
|
443
|
-
disabled: state.submission === "submitting"
|
|
474
|
+
label: state.submission === "submitting" ? "Loading…" : cartSubmitLabel(discountApply.status, display.submitButtonText),
|
|
475
|
+
disabled: state.submission === "submitting" || discountDraftAwaitingApply(discountApply)
|
|
444
476
|
})
|
|
445
477
|
]
|
|
446
478
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { b as reduceCommerceCart, h as buildPassCartItem, m as EMPTY_COMMERCE_CART_STATE, v as parseStoredCommerceCartState } from "./display-DMqotaGU.mjs";
|
|
3
3
|
import * as React$1 from "react";
|
|
4
4
|
//#region ../blocks/src/system/runtime/nodes/shop-commerce-store.ts
|
|
5
5
|
const EMPTY_STATE = EMPTY_COMMERCE_CART_STATE;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { n as assertNever } from "./noop-DF8_EiFt.mjs";
|
|
3
|
+
import { c as normalizeManualDiscountCode } from "./DemoBookingPortalAccess-DGgsjqXK.mjs";
|
|
4
|
+
//#region ../blocks/src/system/runtime/nodes/shop-discount-apply.state.ts
|
|
5
|
+
const initialDiscountApplyState = {
|
|
6
|
+
isOpen: false,
|
|
7
|
+
draftCode: "",
|
|
8
|
+
status: { type: "idle" }
|
|
9
|
+
};
|
|
10
|
+
function discountApplyReducer(state, action) {
|
|
11
|
+
switch (action.type) {
|
|
12
|
+
case "open": return {
|
|
13
|
+
...state,
|
|
14
|
+
isOpen: true
|
|
15
|
+
};
|
|
16
|
+
case "draftChanged": return {
|
|
17
|
+
...state,
|
|
18
|
+
draftCode: action.draftCode,
|
|
19
|
+
status: { type: "idle" }
|
|
20
|
+
};
|
|
21
|
+
case "remove": return initialDiscountApplyState;
|
|
22
|
+
case "applyStarted": return {
|
|
23
|
+
...state,
|
|
24
|
+
status: { type: "applying" }
|
|
25
|
+
};
|
|
26
|
+
case "applySucceeded": return {
|
|
27
|
+
...state,
|
|
28
|
+
isOpen: true,
|
|
29
|
+
draftCode: action.discount.code,
|
|
30
|
+
status: {
|
|
31
|
+
type: "applied",
|
|
32
|
+
discount: action.discount
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
case "applyRejected": return {
|
|
36
|
+
...state,
|
|
37
|
+
isOpen: true,
|
|
38
|
+
status: {
|
|
39
|
+
type: "rejected",
|
|
40
|
+
reason: action.reason,
|
|
41
|
+
message: action.message
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
case "resetApplied":
|
|
45
|
+
if (state.status.type === "idle" || state.status.type === "rejected") return state;
|
|
46
|
+
return {
|
|
47
|
+
...state,
|
|
48
|
+
status: { type: "idle" }
|
|
49
|
+
};
|
|
50
|
+
default: return assertNever(action);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function getAppliedDiscountCode(state) {
|
|
54
|
+
if (state.status.type !== "applied") return null;
|
|
55
|
+
return normalizeManualDiscountCode(state.status.discount.code);
|
|
56
|
+
}
|
|
57
|
+
/** A typed code that hasn't been applied holds back paying, so nobody pays without the discount they expected. */
|
|
58
|
+
function discountDraftAwaitingApply(state) {
|
|
59
|
+
return Boolean(state.draftCode.trim()) && state.status.type !== "applied";
|
|
60
|
+
}
|
|
61
|
+
function isDiscountApplyInFlight(state) {
|
|
62
|
+
return state.status.type === "applying";
|
|
63
|
+
}
|
|
64
|
+
function getDiscountApplyFeedback(status, formatPrice) {
|
|
65
|
+
switch (status.type) {
|
|
66
|
+
case "idle":
|
|
67
|
+
case "applying": return null;
|
|
68
|
+
case "applied": {
|
|
69
|
+
const total = formatPrice(status.discount.totalAfterDiscountCents, status.discount.currency);
|
|
70
|
+
return {
|
|
71
|
+
tone: "success",
|
|
72
|
+
message: `${status.discount.publicLabel} applied. You'll pay ${total}.`
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
case "rejected": return {
|
|
76
|
+
tone: "error",
|
|
77
|
+
message: status.message
|
|
78
|
+
};
|
|
79
|
+
default: return assertNever(status);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
export { initialDiscountApplyState as a, getDiscountApplyFeedback as i, discountDraftAwaitingApply as n, isDiscountApplyInFlight as o, getAppliedDiscountCode as r, discountApplyReducer as t };
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { _ as shopProductPresentation } from "./shop.interactive-
|
|
3
|
-
import { c as formatInterval,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { n as
|
|
2
|
+
import { _ as shopProductPresentation } from "./shop.interactive-CJAINJr3.mjs";
|
|
3
|
+
import { c as formatCommercePrice, l as formatInterval, t as appliedDiscountHint, wi as getShopSuccessCopy } from "./display-DMqotaGU.mjs";
|
|
4
|
+
import { n as assertNever } from "./noop-DF8_EiFt.mjs";
|
|
5
|
+
import { T as assertNever$1 } from "./creditProducts-BQ1t1erI.mjs";
|
|
6
|
+
import { i as useSiteTermsAgreement, n as SiteTermsChangedNotice, t as SiteTermsAgreementField } from "./SiteTermsAgreementField-Dr5lj4oY.mjs";
|
|
7
|
+
import { n as useBlockApi } from "./context-D8TpQXjX.mjs";
|
|
7
8
|
import { r as ThemedButton } from "./ThemedButton-DuaYtnvG.mjs";
|
|
9
|
+
import { a as useDiscountApply, i as isDiscountCodeRefusal, p as DiscountCodeDisclosure, t as BookingConfirmation, u as planDirectShopCheckoutRequest } from "./DemoBookingPortalAccess-DGgsjqXK.mjs";
|
|
8
10
|
import { t as scrollToBlock } from "./scrollToBlock-DrgKE0qZ.mjs";
|
|
9
11
|
import { t as createBodyThemePortalRoot } from "./themePortalRoot-DeP49PT8.mjs";
|
|
10
|
-
import {
|
|
12
|
+
import { i as consumeSearchParams, n as useTransientShopAddFeedback, t as ShopAddFeedback } from "./shop-add-feedback-DvC2kP1K.mjs";
|
|
11
13
|
import { t as CheckIcon } from "./CheckIcon-CVcKteXH.mjs";
|
|
12
14
|
import { t as CrossIcon } from "./CrossIcon-CpG9VRyW.mjs";
|
|
13
15
|
import { t as FeedbackMessage } from "./FeedbackMessage-CSJrAuXH.mjs";
|
|
14
|
-
import { n as TerminalPanel, r as StateIcon, t as useDiscountCodeUi } from "./useDiscountCodeUi-
|
|
16
|
+
import { n as TerminalPanel, r as StateIcon, t as useDiscountCodeUi } from "./useDiscountCodeUi-CCxHMWlU.mjs";
|
|
15
17
|
import { t as ModalShell } from "./ModalShell-B_fHWK71.mjs";
|
|
16
|
-
import { a as PassPurchaseUnavailable, d as ShopPurchaseAction, i as PassCardView, o as PassesMembershipsSectionView, r as MembershipCardView } from "./view-
|
|
17
|
-
import { a as storeDemoBookingCheckoutReturn, i as readDemoBookingCheckoutReturnEmail } from "./demoPortalMagicLink-
|
|
18
|
-
import { n as
|
|
18
|
+
import { a as PassPurchaseUnavailable, d as ShopPurchaseAction, i as PassCardView, o as PassesMembershipsSectionView, r as MembershipCardView } from "./view-BTk470k0.mjs";
|
|
19
|
+
import { a as storeDemoBookingCheckoutReturn, i as readDemoBookingCheckoutReturnEmail } from "./demoPortalMagicLink-BdcuW_pa.mjs";
|
|
20
|
+
import { a as initialDiscountApplyState, i as getDiscountApplyFeedback, n as discountDraftAwaitingApply, o as isDiscountApplyInFlight, r as getAppliedDiscountCode, t as discountApplyReducer } from "./shop-discount-apply.state-DGvPBmVP.mjs";
|
|
19
21
|
import { t as CarouselNodeClient } from "./carousel.client-h65clfUO.mjs";
|
|
20
|
-
import { r as formatEntitlementEnd } from "./dateFormatting-
|
|
21
|
-
import { t as addPassToCommerceCart } from "./shop-commerce-store-
|
|
22
|
+
import { r as formatEntitlementEnd } from "./dateFormatting-ABCZWkpT.mjs";
|
|
23
|
+
import { t as addPassToCommerceCart } from "./shop-commerce-store-Cd7USpuY.mjs";
|
|
22
24
|
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
23
25
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
24
26
|
//#region ../blocks/src/system/runtime/shared/components/ActionRow.tsx
|
|
@@ -217,6 +219,10 @@ function buildDirectShopCheckoutPlan(input) {
|
|
|
217
219
|
async function submitDirectShopCheckout(input) {
|
|
218
220
|
const checkout = input.checkout;
|
|
219
221
|
if (!checkout) return;
|
|
222
|
+
if (discountDraftAwaitingApply(input.discountApply)) {
|
|
223
|
+
input.onDiscountRefused("Apply your code before paying.");
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
220
226
|
input.dispatch({ type: "submitStarted" });
|
|
221
227
|
try {
|
|
222
228
|
const attempt = buildDirectShopCheckoutPlan({
|
|
@@ -240,6 +246,7 @@ async function submitDirectShopCheckout(input) {
|
|
|
240
246
|
dispatch: input.dispatch
|
|
241
247
|
});
|
|
242
248
|
} catch (error) {
|
|
249
|
+
if (isDiscountCodeRefusal(error)) input.onDiscountRefused(error.message);
|
|
243
250
|
input.dispatch({
|
|
244
251
|
type: "submitFailed",
|
|
245
252
|
error: error instanceof Error ? error.message : "An error occurred"
|
|
@@ -353,8 +360,32 @@ function PurchasablePassCard(props) {
|
|
|
353
360
|
})
|
|
354
361
|
});
|
|
355
362
|
}
|
|
356
|
-
function checkoutProductLabel(checkout) {
|
|
357
|
-
return `${checkout.item.productType === "pass" && checkout.item.teamMember ? `${checkout.item.product.name} with ${checkout.item.teamMember.name}` : checkout.item.product.name} — ${formatCommercePrice(checkout.item.product.price, checkout.item.product.currency)}`;
|
|
363
|
+
function checkoutProductLabel(checkout, totalCents = checkout.item.product.price) {
|
|
364
|
+
return `${checkout.item.productType === "pass" && checkout.item.teamMember ? `${checkout.item.product.name} with ${checkout.item.teamMember.name}` : checkout.item.product.name} — ${formatCommercePrice(checkout.item.productType === "membership" ? checkout.item.product.price : totalCents, checkout.item.product.currency)}`;
|
|
365
|
+
}
|
|
366
|
+
function checkoutShownTotalCents(checkout, status) {
|
|
367
|
+
return status.type === "applied" ? status.discount.totalAfterDiscountCents : checkout.item.product.price;
|
|
368
|
+
}
|
|
369
|
+
function checkoutPayBlocked(checkout, discountApply) {
|
|
370
|
+
return checkout.submitting || discountDraftAwaitingApply(discountApply);
|
|
371
|
+
}
|
|
372
|
+
function checkoutDiscountHint(checkout, status) {
|
|
373
|
+
if (status.type !== "applied") return void 0;
|
|
374
|
+
return appliedDiscountHint({
|
|
375
|
+
totalAfterDiscountCents: status.discount.totalAfterDiscountCents,
|
|
376
|
+
currency: checkout.item.product.currency,
|
|
377
|
+
membership: checkout.item.productType === "membership" ? {
|
|
378
|
+
priceCents: checkout.item.product.price,
|
|
379
|
+
billingInterval: checkout.item.product.billingInterval
|
|
380
|
+
} : null
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
function checkoutSubmitLabel(checkout, status) {
|
|
384
|
+
if (checkout.submitting) return "Processing...";
|
|
385
|
+
if (status.type !== "applied") return "Continue to Payment";
|
|
386
|
+
const { totalAfterDiscountCents, currency } = status.discount;
|
|
387
|
+
if (totalAfterDiscountCents !== 0) return `Pay ${formatCommercePrice(totalAfterDiscountCents, currency)}`;
|
|
388
|
+
return checkout.item.productType === "membership" ? "Continue to payment" : "Complete purchase";
|
|
358
389
|
}
|
|
359
390
|
function getCheckoutModalTitle(checkout) {
|
|
360
391
|
if (!checkout) return "";
|
|
@@ -501,6 +532,11 @@ function PassesMembershipsController({ render }) {
|
|
|
501
532
|
api: siteTerms.api,
|
|
502
533
|
discountApply,
|
|
503
534
|
manualCodeEntryAllowed: discountUi.manualCodeEntryAllowed,
|
|
535
|
+
onDiscountRefused: (message) => dispatchDiscountApply({
|
|
536
|
+
type: "applyRejected",
|
|
537
|
+
reason: "invalid_or_not_applicable",
|
|
538
|
+
message
|
|
539
|
+
}),
|
|
504
540
|
dispatch
|
|
505
541
|
}), [
|
|
506
542
|
siteTerms.api,
|
|
@@ -597,7 +633,7 @@ function PassesMembershipsController({ render }) {
|
|
|
597
633
|
children: [
|
|
598
634
|
/* @__PURE__ */ jsxs("p", {
|
|
599
635
|
className: "shop__modal-product",
|
|
600
|
-
children: [checkoutProductLabel(checkout), checkout.item.productType === "membership" ? /* @__PURE__ */ jsx("span", {
|
|
636
|
+
children: [checkoutProductLabel(checkout, checkoutShownTotalCents(checkout, discountApply.status)), checkout.item.productType === "membership" ? /* @__PURE__ */ jsx("span", {
|
|
601
637
|
className: "shop__modal-interval",
|
|
602
638
|
children: formatInterval(checkout.item.product.billingInterval)
|
|
603
639
|
}) : null]
|
|
@@ -644,7 +680,7 @@ function PassesMembershipsController({ render }) {
|
|
|
644
680
|
size: "md",
|
|
645
681
|
label: checkout.submitting ? "Processing..." : "Subscribe Anyway",
|
|
646
682
|
onClick: handleConfirmDuplicate,
|
|
647
|
-
disabled: checkout
|
|
683
|
+
disabled: checkoutPayBlocked(checkout, discountApply)
|
|
648
684
|
})]
|
|
649
685
|
})
|
|
650
686
|
]
|
|
@@ -709,7 +745,8 @@ function PassesMembershipsController({ render }) {
|
|
|
709
745
|
},
|
|
710
746
|
onApply: applyDiscountCode,
|
|
711
747
|
id: "shop-discount-code",
|
|
712
|
-
|
|
748
|
+
applied: discountApply.status.type === "applied",
|
|
749
|
+
hint: checkoutDiscountHint(checkout, discountApply.status),
|
|
713
750
|
feedback: discountApplyFeedback,
|
|
714
751
|
isApplying: isDiscountApplyInFlight(discountApply),
|
|
715
752
|
disabled: checkout.submitting
|
|
@@ -745,8 +782,8 @@ function PassesMembershipsController({ render }) {
|
|
|
745
782
|
type: "submit",
|
|
746
783
|
variant: "default",
|
|
747
784
|
size: "md",
|
|
748
|
-
label: checkout.
|
|
749
|
-
disabled: checkout
|
|
785
|
+
label: checkoutSubmitLabel(checkout, discountApply.status),
|
|
786
|
+
disabled: checkoutPayBlocked(checkout, discountApply)
|
|
750
787
|
})]
|
|
751
788
|
})
|
|
752
789
|
]
|