@riverbankcms/sdk 0.89.1 → 0.90.1
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/README.md +27 -4
- package/dist/{PreviewEditorSidebar-JDR64FEC.mjs → PreviewEditorSidebar-FNFRVSIM.mjs} +3 -3
- package/dist/{PreviewEditorUI-67TMJMAF.mjs → PreviewEditorUI-3WXJFQXG.mjs} +3 -3
- package/dist/SdkPreviewModeRuntime-2UCIMKUB.mjs +8 -0
- package/dist/_dts/ai/src/contracts/proposals.d.ts +216 -0
- package/dist/_dts/altcha/src/AltchaWidget.d.ts +1 -1
- package/dist/_dts/api/src/bookingConfig.d.ts +3 -0
- package/dist/_dts/api/src/bookingOperations.d.ts +2 -0
- package/dist/_dts/api/src/bookingRecords.d.ts +4 -2
- package/dist/_dts/api/src/bookings.d.ts +3 -1
- package/dist/_dts/api/src/event-listing-destination.d.ts +59 -0
- package/dist/_dts/api/src/index.d.ts +10 -5
- package/dist/_dts/api/src/navigation/dashboardSettingsNav.d.ts +0 -1
- package/dist/_dts/api/src/navigation.d.ts +2 -0
- package/dist/_dts/api/src/publicExperienceEndpoints.d.ts +18 -6
- package/dist/_dts/api/src/request.d.ts +21 -0
- package/dist/_dts/api/src/sdk-event-upsert.d.ts +3 -1
- package/dist/_dts/api/src/sdkContracts.d.ts +2 -0
- package/dist/_dts/api/src/settings/permissions.d.ts +273 -0
- package/dist/_dts/api/src/types.d.ts +4 -1
- package/dist/_dts/api/src/url.d.ts +6 -3
- package/dist/_dts/block-form/src/utils/visibleWhen.d.ts +1 -0
- package/dist/_dts/block-form/src/widgets/RepeaterField/components/RepeaterThumbnailCard.d.ts +5 -1
- package/dist/_dts/block-form/src/widgets/RepeaterField/components/RepeaterThumbnailGrid.d.ts +9 -1
- package/dist/_dts/block-form/src/widgets/RepeaterField/components/index.d.ts +1 -0
- package/dist/_dts/blocks/src/contracts/non-block-islands.d.ts +7 -11
- package/dist/_dts/blocks/src/contracts/proof-block-islands.d.ts +6 -0
- package/dist/_dts/blocks/src/index.d.ts +2 -1
- package/dist/_dts/blocks/src/system/blocks/events/event-calendar.d.ts +14 -6
- package/dist/_dts/blocks/src/system/blocks/events/shared/schemas.d.ts +60 -2
- package/dist/_dts/blocks/src/system/blocks/events/shared/types.d.ts +16 -5
- package/dist/_dts/blocks/src/system/blocks/hero.d.ts +0 -2
- package/dist/_dts/blocks/src/system/blocks/media-text.d.ts +9 -9
- package/dist/_dts/blocks/src/system/blocks/shop.d.ts +3 -3
- package/dist/_dts/blocks/src/system/blocks/shop.shared.d.ts +8 -0
- package/dist/_dts/blocks/src/system/blocks/team-members.d.ts +1 -1
- package/dist/_dts/blocks/src/system/constants/events.d.ts +4 -1
- package/dist/_dts/blocks/src/system/manifest/schema.d.ts +3 -1
- package/dist/_dts/blocks/src/system/runtime/api/index.d.ts +1 -0
- package/dist/_dts/blocks/src/system/runtime/api/types.d.ts +17 -5
- package/dist/_dts/blocks/src/system/runtime/components/registry.client.d.ts +51 -6
- package/dist/_dts/blocks/src/system/runtime/components/runtime-backed-blocks.d.ts +24 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/course-registration/useCourseRegistrationWizard.d.ts +2 -2
- package/dist/_dts/blocks/src/system/runtime/nodes/event-details/logic.d.ts +1 -17
- package/dist/_dts/blocks/src/system/runtime/nodes/event-details.client.d.ts +5 -9
- package/dist/_dts/blocks/src/system/runtime/nodes/event-details.server.d.ts +5 -9
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/event-registration.headless.contract.d.ts +7 -1
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/eventPaymentOptions.d.ts +48 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/types.d.ts +5 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useDiscountCodeUi.d.ts +4 -4
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useDiscountCodeUi.state.d.ts +50 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationWizard.d.ts +2 -2
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration.interactive.d.ts +21 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration.server.d.ts +1 -1
- package/dist/_dts/blocks/src/system/runtime/nodes/events/EventCalendar.interactive.d.ts +11 -1
- package/dist/_dts/blocks/src/system/runtime/nodes/events/EventCombined.client.d.ts +2 -1
- package/dist/_dts/blocks/src/system/runtime/nodes/events/EventCombined.interactive.d.ts +11 -1
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/calendarViewOptions.d.ts +10 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/destination.d.ts +8 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/eventProductEligibility.d.ts +24 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/pricing.d.ts +3 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/utils.d.ts +7 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/shared/contract-schemas.d.ts +5 -2
- package/dist/_dts/blocks/src/system/runtime/nodes/shop-checkout-form.d.ts +2 -2
- package/dist/_dts/content-model/src/entry-slots/index.d.ts +1 -0
- package/dist/_dts/content-model/src/entry-slots/sdkBlocks.d.ts +21 -0
- package/dist/_dts/content-model/src/entry-slots/types.d.ts +7 -0
- package/dist/_dts/core/src/event-pricing.d.ts +12 -2
- package/dist/_dts/core/src/money-input.d.ts +18 -0
- package/dist/_dts/db/src/generated/supabase/database.types.d.ts +50 -0
- package/dist/_dts/media-editor/src/MediaEditor.d.ts +2 -1
- package/dist/_dts/media-editor/src/fieldUi.d.ts +6 -0
- package/dist/_dts/media-editor/src/index.d.ts +1 -1
- package/dist/_dts/preview-next/src/client/index.d.ts +1 -0
- package/dist/_dts/preview-next/src/client/preview/PreviewShell.d.ts +3 -2
- package/dist/_dts/preview-next/src/client/preview/PreviewShellLayout.d.ts +3 -2
- package/dist/_dts/preview-next/src/client/preview/PreviewThemedSiteDocument.d.ts +3 -2
- package/dist/_dts/preview-next/src/client/preview/SiteChromeEditableSurface.d.ts +2 -2
- package/dist/_dts/preview-next/src/client/preview/themeRuntime.d.ts +6 -0
- package/dist/_dts/preview-next/src/client/sdk/SdkPreviewMode.d.ts +2 -1
- package/dist/_dts/sdk/src/cli/commands/pull-dated-offering-scope.d.ts +10 -0
- package/dist/_dts/sdk/src/cli/content/reader.d.ts +12 -5
- package/dist/_dts/sdk/src/client/management/types.d.ts +6 -55
- package/dist/_dts/sdk/src/components.d.ts +1 -0
- package/dist/_dts/sdk/src/config/field-definitions.d.ts +3 -1
- package/dist/_dts/sdk/src/contracts/system-block-content.d.ts +3 -1
- package/dist/_dts/sdk/src/next/types.d.ts +8 -11
- package/dist/_dts/sdk/src/preview-next/client/index.d.ts +1 -1
- package/dist/_dts/sdk/src/public-api/contracts.d.ts +11 -1
- package/dist/_dts/sdk/src/rendering/blocks-theme-scope.d.ts +2 -1
- package/dist/_dts/sdk/src/rendering/components/Layout.d.ts +8 -7
- package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +5 -6
- package/dist/_dts/sdk/src/rendering/index.d.ts +1 -0
- package/dist/_dts/sdk/src/rendering/islands/types.d.ts +11 -1
- package/dist/_dts/sdk/src/rendering/server.d.ts +1 -0
- package/dist/_dts/sdk/src/rendering/themeRuntime.d.ts +26 -0
- package/dist/_dts/sdk/src/version.d.ts +1 -1
- package/dist/_dts/site-commands/src/commands.d.ts +18 -0
- package/dist/_dts/theme-core/src/ResponsiveScope.d.ts +12 -0
- package/dist/_dts/theme-core/src/accordions/types.d.ts +1 -1
- package/dist/_dts/theme-core/src/buttons/personalities/types.d.ts +2 -2
- package/dist/_dts/theme-core/src/buttons/types.d.ts +5 -5
- package/dist/_dts/theme-core/src/cards/types.d.ts +2 -2
- package/dist/_dts/theme-core/src/index.d.ts +2 -0
- package/dist/_dts/theme-core/src/mock-themes/all.d.ts +21 -21
- package/dist/_dts/theme-core/src/schema.d.ts +18 -18
- package/dist/_dts/theme-core/src/site-styles/designState.d.ts +2 -2
- package/dist/_dts/theme-core/src/site-styles/generatedSchemas.d.ts +2 -2
- package/dist/_dts/theme-core/src/site-styles/logoBranding.d.ts +4 -4
- package/dist/_dts/theme-core/src/themeRuntime.d.ts +11 -0
- package/dist/{chunk-F645A5UV.mjs → chunk-BOQXMCSP.mjs} +129 -101
- package/dist/{chunk-7YUAXONX.mjs → chunk-CR2VX432.mjs} +1563 -877
- package/dist/{chunk-HKJQERFR.mjs → chunk-FA6LVZ7C.mjs} +91 -55
- package/dist/{chunk-TGBJWKMP.mjs → chunk-H6TT5ZXI.mjs} +9 -1
- package/dist/{chunk-ZQRBLCW5.mjs → chunk-SYYJZPKU.mjs} +2 -2
- package/dist/{chunk-7N46MZHI.mjs → chunk-UG7I7S7W.mjs} +1 -1
- package/dist/cli/index.mjs +1057 -632
- package/dist/cli/init-docs/content/cli-reference.md +6 -1
- package/dist/cli/init-docs/content/content-management.md +27 -0
- package/dist/client/{accordion-MUCVNGQ7.mjs → accordion-4K7VGZ3I.mjs} +2 -2
- package/dist/client/{bookingForm-PKD6EFIE.mjs → bookingForm-3QXA3CIS.mjs} +26 -271
- package/dist/client/bookings.mjs +1586 -825
- package/dist/client/{carousel-3TKQSNJC.mjs → carousel-BEJKNGQ7.mjs} +3 -3
- package/dist/client/{cart-6XHSZK23.mjs → cart-44BBM6XG.mjs} +7 -8
- package/dist/client/{checkout-FVSPM6FI.mjs → checkout-THMHEYKF.mjs} +7 -8
- package/dist/client/{chunk-25W2EQUN.mjs → chunk-3H5CLFKT.mjs} +8 -0
- package/dist/client/{chunk-ZJZZA5EP.mjs → chunk-4COPESPO.mjs} +13 -16
- package/dist/client/chunk-5AJIMWKS.mjs +436 -0
- package/dist/client/{chunk-UQFY4AHX.mjs → chunk-B4H6QMPY.mjs} +157 -49
- package/dist/client/{chunk-VGLXACVK.mjs → chunk-DQIRKNZE.mjs} +1 -1
- package/dist/client/{chunk-7DH35FGA.mjs → chunk-EJBHK74Y.mjs} +1 -1
- package/dist/client/{chunk-SDIYSQAY.mjs → chunk-HIHOQGIP.mjs} +2 -3
- package/dist/client/{chunk-CQKKFEQD.mjs → chunk-JV7ZNAOU.mjs} +378 -111
- package/dist/client/{chunk-FHU6PFPM.mjs → chunk-KNTLBQ3N.mjs} +1 -1
- package/dist/client/{chunk-RSQWWUAD.mjs → chunk-PEDNDLPB.mjs} +4 -4
- package/dist/client/{chunk-EY42X22F.mjs → chunk-SLY6UDAS.mjs} +157 -5
- package/dist/client/{chunk-STJ2NCQM.mjs → chunk-WHZQDPBZ.mjs} +19 -1
- package/dist/client/{chunk-ZT5XE7FK.mjs → chunk-ZIAF2DA4.mjs} +1 -1
- package/dist/client/client.mjs +3552 -2898
- package/dist/client/{courseRegistration-ATZSYDHM.mjs → courseRegistration-URX7RCCK.mjs} +20 -58
- package/dist/client/{eventCalendar-6T2UGKKP.mjs → eventCalendar-GTENOQCE.mjs} +10 -11
- package/dist/client/{eventCombined-Q4VANXVF.mjs → eventCombined-EZVB72MF.mjs} +10 -11
- package/dist/client/{eventDetails-DW37E7VW.mjs → eventDetails-CH4BJR5Z.mjs} +10 -11
- package/dist/client/{eventListing-XURTSAUW.mjs → eventListing-4BVOI5HS.mjs} +10 -11
- package/dist/client/{eventRegistration-MRKEVAXW.mjs → eventRegistration-37LPIKIE.mjs} +10 -11
- package/dist/client/{form-WZZFFGMU.mjs → form-FX3Y54YK.mjs} +7 -7
- package/dist/client/{headerSection-EQYVQBLM.mjs → headerSection-UOZZGVYL.mjs} +3 -3
- package/dist/client/hooks.mjs +1169 -1063
- package/dist/client/{locationMap-MFF5VAZR.mjs → locationMap-VSIPKV35.mjs} +3 -3
- package/dist/client/{newsletterForm-JQ77UYIE.mjs → newsletterForm-6FRJKNAF.mjs} +5 -5
- package/dist/client/{productDetail-25LMT3IZ.mjs → productDetail-6AHMLXCO.mjs} +7 -8
- package/dist/client/{productList-5ABEMKUG.mjs → productList-M2CYIZVH.mjs} +7 -8
- package/dist/client/rendering/client.mjs +2912 -2316
- package/dist/client/rendering/islands.mjs +19 -19
- package/dist/client/rendering.mjs +2874 -2230
- package/dist/client/{shop-OMMQZ6YO.mjs → shop-AUOT6GEX.mjs} +7 -8
- package/dist/client/spam-protection.mjs +4 -5
- package/dist/preview-next/before-render.mjs +2 -2
- package/dist/preview-next/client/runtime.mjs +5 -5
- package/dist/{sdk-runtime-WNLBZ3ZH.mjs → sdk-runtime-6GPJNLU6.mjs} +6 -6
- package/dist/server/components.mjs +1856 -1509
- package/dist/server/config-validation.mjs +1394 -1288
- package/dist/server/config.mjs +1394 -1288
- package/dist/server/data.mjs +1169 -1063
- package/dist/server/index.mjs +135 -100
- package/dist/server/navigation.mjs +20 -30
- package/dist/server/next.mjs +1936 -1576
- package/dist/server/page-converter.mjs +1081 -967
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/rendering/server.mjs +1868 -1521
- package/dist/server/rendering.mjs +1878 -1531
- package/dist/server/routing.mjs +1248 -1089
- package/dist/server/server.mjs +1312 -1171
- package/dist/server/theme-bridge.mjs +8 -5
- package/package.json +3 -3
- package/dist/SdkPreviewModeRuntime-ZBEMRV7N.mjs +0 -8
- package/dist/client/chunk-LQFDYWPJ.mjs +0 -184
- package/dist/client/chunk-ZFHRN6W2.mjs +0 -66
|
@@ -90,6 +90,9 @@ riverbankcms pull theme # Theme to content/themes/current.json
|
|
|
90
90
|
riverbankcms pull venues # Event venues
|
|
91
91
|
riverbankcms pull event-categories # Event categories
|
|
92
92
|
riverbankcms pull events # Event series
|
|
93
|
+
riverbankcms pull events summer-fest # Specific event series
|
|
94
|
+
riverbankcms pull courses # Courses
|
|
95
|
+
riverbankcms pull courses beginners # Specific course
|
|
93
96
|
riverbankcms pull --with-theme # Pull content and theme together
|
|
94
97
|
|
|
95
98
|
# Custom output directory
|
|
@@ -142,7 +145,7 @@ riverbankcms push forms # Forms
|
|
|
142
145
|
riverbankcms push theme # Push content/themes/{activeTheme|current}.json
|
|
143
146
|
riverbankcms push venues # Event venues
|
|
144
147
|
riverbankcms push event-categories # Event categories
|
|
145
|
-
riverbankcms push events # Event series
|
|
148
|
+
riverbankcms push events # Event series, routes, and entry slot blocks
|
|
146
149
|
riverbankcms push --with-theme # Also push theme when pushing all content
|
|
147
150
|
|
|
148
151
|
# JSON diff output for agents
|
|
@@ -826,6 +829,8 @@ riverbankcms event cancel summer-fest
|
|
|
826
829
|
riverbankcms event delete summer-fest --yes
|
|
827
830
|
```
|
|
828
831
|
|
|
832
|
+
`event upsert` and `push events` accept canonical event files with `path` and `blocks`. `path` updates the linked event content entry route. `blocks` maps slot keys to entry-slot blocks, for example `blocks.main` for the built-in event template. Use stable block identifiers so repeat pushes update existing slot blocks safely. Unknown slot keys or block kinds fail validation; default slots accept enabled SDK `custom.*` blocks, while explicit template `allowedBlocks` lists remain authoritative.
|
|
833
|
+
|
|
829
834
|
### course
|
|
830
835
|
|
|
831
836
|
Manage course runs directly through the CLI.
|
|
@@ -284,6 +284,9 @@ riverbankcms pull forms
|
|
|
284
284
|
riverbankcms pull venues # Event venues
|
|
285
285
|
riverbankcms pull event-categories # Event categories
|
|
286
286
|
riverbankcms pull events # Event series
|
|
287
|
+
riverbankcms pull events summer-fest # Specific event series
|
|
288
|
+
riverbankcms pull courses # Courses
|
|
289
|
+
riverbankcms pull courses beginners # Specific course
|
|
287
290
|
```
|
|
288
291
|
|
|
289
292
|
**Output directory structure:**
|
|
@@ -601,6 +604,7 @@ Footer links are managed via the site's footer navigation menu (see `content/nav
|
|
|
601
604
|
"identifier": "yoga-class",
|
|
602
605
|
"title": "Morning Yoga Class",
|
|
603
606
|
"slug": "yoga-class",
|
|
607
|
+
"path": "/events/yoga-class",
|
|
604
608
|
"status": "active",
|
|
605
609
|
"visibility": "public",
|
|
606
610
|
"venueRef": "main-hall",
|
|
@@ -622,6 +626,24 @@ Footer links are managed via the site's footer navigation menu (see `content/nav
|
|
|
622
626
|
"content": {
|
|
623
627
|
"summary": "Start your day with energizing yoga",
|
|
624
628
|
"body": "<p>Join us for a revitalizing morning yoga session.</p>"
|
|
629
|
+
},
|
|
630
|
+
"blocks": {
|
|
631
|
+
"main": [
|
|
632
|
+
{
|
|
633
|
+
"identifier": "class-introduction",
|
|
634
|
+
"kind": "block.body-text",
|
|
635
|
+
"content": {
|
|
636
|
+
"body": "<p>Bring a mat and arrive ten minutes early.</p>"
|
|
637
|
+
}
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
"identifier": "what-to-expect",
|
|
641
|
+
"kind": "custom.event-callout",
|
|
642
|
+
"content": {
|
|
643
|
+
"headline": "Gentle, steady, welcoming"
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
]
|
|
625
647
|
}
|
|
626
648
|
}
|
|
627
649
|
```
|
|
@@ -634,6 +656,11 @@ Footer links are managed via the site's footer navigation menu (see `content/nav
|
|
|
634
656
|
- `venueRef` and `categoryRef` reference slugs/identifiers from venues and event-categories
|
|
635
657
|
- `status`: "draft", "active", "completed", "cancelled", or "archived"
|
|
636
658
|
- `visibility`: "private", "public", or "unlisted"
|
|
659
|
+
- `path` overrides the linked event content entry route. Omit it to keep the CMS-generated route.
|
|
660
|
+
- `blocks` writes to the event template's `system.entry-slot` blocks. The default event template declares `blocks.main`.
|
|
661
|
+
- Use stable block `identifier` values. Re-pushing the same event updates matching slot blocks instead of creating duplicates.
|
|
662
|
+
- Default entry slots accept built-in content blocks plus enabled SDK custom blocks. If a template sets `allowedBlocks`, that explicit list is authoritative.
|
|
663
|
+
- `riverbankcms push events` aborts when two `content/events/*.json` files use the same `identifier`; merge or delete stale duplicates before pushing.
|
|
637
664
|
|
|
638
665
|
See `cli-reference.md` for event-related CLI commands: `riverbankcms push/pull venues|event-categories|events`.
|
|
639
666
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineIslandPropsDecoder } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
import { defineIslandPropsDecoder } from './chunk-B4H6QMPY.mjs';
|
|
2
|
+
import './chunk-3H5CLFKT.mjs';
|
|
3
3
|
|
|
4
4
|
// src/rendering/islands/enhancers/accordion.ts
|
|
5
5
|
var decode = defineIslandPropsDecoder("accordion");
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { usePolling } from './chunk-
|
|
3
|
-
import { SpinnerNode } from './chunk-
|
|
4
|
-
import { useDiscountCodeUi } from './chunk-ZFHRN6W2.mjs';
|
|
2
|
+
import { buildBookingPaymentSelectionViewModel, usePolling } from './chunk-5AJIMWKS.mjs';
|
|
3
|
+
import { SpinnerNode } from './chunk-KNTLBQ3N.mjs';
|
|
5
4
|
import { buildRouteIslandApiConfig } from './chunk-L4J5Y62O.mjs';
|
|
6
|
-
import { scrollToBlock, buildCheckoutReturnUrls, DiscountCodeDisclosure
|
|
5
|
+
import { scrollToBlock, useDiscountCodeUi, buildCheckoutReturnUrls, DiscountCodeDisclosure } from './chunk-SLY6UDAS.mjs';
|
|
7
6
|
import { FieldValidationMessage, getFieldValidationControlProps } from './chunk-3DCJ45Z2.mjs';
|
|
8
7
|
import './chunk-WBQG7VJA.mjs';
|
|
9
|
-
import { isSpamProtectionEnabled, getChallengeUrl, AltchaWidget } from './chunk-
|
|
10
|
-
import { BlockApiProvider, useBlockApi, FeedbackMessage } from './chunk-
|
|
8
|
+
import { isSpamProtectionEnabled, getChallengeUrl, AltchaWidget } from './chunk-HIHOQGIP.mjs';
|
|
9
|
+
import { BlockApiProvider, useBlockApi, FeedbackMessage } from './chunk-WHZQDPBZ.mjs';
|
|
11
10
|
import { mountReactIsland } from './chunk-N7PBWBWQ.mjs';
|
|
12
|
-
import { defineIslandPropsDecoder, resolveBookingSiteId, resolveDefaultBookingServiceId, getBookingRedirectStateFromLocation, deriveBookingFormViewState, logger, getBookingSuccessMessage, resolveAppointmentCheckoutVerificationState, themeButtonClassName, toSelectedCollectionOptionKind,
|
|
13
|
-
import { resolveBookingTimeZoneId, DEFAULT_BOOKING_TIME_ZONE, unsafeAsFormId, unsafeAsAppointmentResourceId, unsafeAsCustomerPassId, unsafeAsAppointmentServiceId, formatLocalScheduleDate, addLocalScheduleDays, parseBookingLocalDate,
|
|
11
|
+
import { defineIslandPropsDecoder, resolveBookingSiteId, resolveDefaultBookingServiceId, getBookingRedirectStateFromLocation, deriveBookingFormViewState, logger, getBookingSuccessMessage, resolveAppointmentCheckoutVerificationState, themeButtonClassName, toSelectedCollectionOptionKind, assertNever, prepareBookingSubmission, formatBookingSubmissionPreparationError, resolveBookingPaymentStep, BOOKING_FORM_DATA_RESERVED_KEYS, clearWorkflowFeedback, reportWorkflowError, reportWorkflowSuccess, okWith, err } from './chunk-B4H6QMPY.mjs';
|
|
12
|
+
import { resolveBookingTimeZoneId, DEFAULT_BOOKING_TIME_ZONE, unsafeAsFormId, unsafeAsAppointmentResourceId, unsafeAsCustomerPassId, unsafeAsAppointmentServiceId, formatLocalScheduleDate, addLocalScheduleDays, parseBookingLocalDate, unsafeAsPassId, formatBookingInstant } from './chunk-3H5CLFKT.mjs';
|
|
14
13
|
import React2, { useRef, useState, useMemo, useReducer, useEffect, useCallback, useLayoutEffect } from 'react';
|
|
15
14
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
16
15
|
|
|
@@ -205,7 +204,7 @@ function availableDatesReducer(state, action) {
|
|
|
205
204
|
case "load-failed":
|
|
206
205
|
return { tag: "error", data: state.data, message: action.message };
|
|
207
206
|
default:
|
|
208
|
-
return
|
|
207
|
+
return assertNever(action);
|
|
209
208
|
}
|
|
210
209
|
}
|
|
211
210
|
|
|
@@ -256,11 +255,11 @@ function useAvailableDates({
|
|
|
256
255
|
endDate: data.endDate,
|
|
257
256
|
append
|
|
258
257
|
});
|
|
259
|
-
} catch (
|
|
258
|
+
} catch (err2) {
|
|
260
259
|
if (requestId !== requestIdRef.current) return;
|
|
261
260
|
dispatch({
|
|
262
261
|
type: "load-failed",
|
|
263
|
-
message:
|
|
262
|
+
message: err2 instanceof Error ? err2.message : "Failed to load available dates"
|
|
264
263
|
});
|
|
265
264
|
}
|
|
266
265
|
},
|
|
@@ -326,7 +325,7 @@ function getAvailableSlots(state) {
|
|
|
326
325
|
case "error":
|
|
327
326
|
return state.slots;
|
|
328
327
|
default:
|
|
329
|
-
return
|
|
328
|
+
return assertNever(state);
|
|
330
329
|
}
|
|
331
330
|
}
|
|
332
331
|
function hasLoadedAvailableSlots(state) {
|
|
@@ -340,7 +339,7 @@ function hasLoadedAvailableSlots(state) {
|
|
|
340
339
|
case "loaded":
|
|
341
340
|
return true;
|
|
342
341
|
default:
|
|
343
|
-
return
|
|
342
|
+
return assertNever(state);
|
|
344
343
|
}
|
|
345
344
|
}
|
|
346
345
|
function isLoadingAvailableSlots(state) {
|
|
@@ -374,7 +373,7 @@ function availableSlotsReducer(state, action) {
|
|
|
374
373
|
message: action.message
|
|
375
374
|
};
|
|
376
375
|
default:
|
|
377
|
-
return
|
|
376
|
+
return assertNever(action);
|
|
378
377
|
}
|
|
379
378
|
}
|
|
380
379
|
|
|
@@ -423,11 +422,11 @@ function useAvailableSlots({
|
|
|
423
422
|
resourceId: unsafeAsAppointmentResourceId(slot.resourceId)
|
|
424
423
|
}))
|
|
425
424
|
});
|
|
426
|
-
} catch (
|
|
425
|
+
} catch (err2) {
|
|
427
426
|
if (requestId !== requestIdRef.current) return;
|
|
428
427
|
dispatch({
|
|
429
428
|
type: "load-failed",
|
|
430
|
-
message:
|
|
429
|
+
message: err2 instanceof Error ? err2.message : "Failed to load available times"
|
|
431
430
|
});
|
|
432
431
|
}
|
|
433
432
|
},
|
|
@@ -480,7 +479,7 @@ function bookingSubmissionReducer(state, action) {
|
|
|
480
479
|
case "feedback-cleared":
|
|
481
480
|
return clearWorkflowFeedback(state);
|
|
482
481
|
default:
|
|
483
|
-
return
|
|
482
|
+
return assertNever(action);
|
|
484
483
|
}
|
|
485
484
|
}
|
|
486
485
|
function selectIsSubmitting(state) {
|
|
@@ -524,7 +523,7 @@ function useBookingSubmission(_siteId) {
|
|
|
524
523
|
type: "submission-succeeded",
|
|
525
524
|
message: response.type === "checkout_redirect" ? "Redirecting to secure checkout..." : "Booking submitted successfully."
|
|
526
525
|
});
|
|
527
|
-
return
|
|
526
|
+
return okWith(response);
|
|
528
527
|
} catch (error) {
|
|
529
528
|
console.error("Booking submission error:", error);
|
|
530
529
|
const message = error instanceof Error ? error.message : "Failed to book appointment";
|
|
@@ -532,7 +531,7 @@ function useBookingSubmission(_siteId) {
|
|
|
532
531
|
type: "submission-failed",
|
|
533
532
|
message
|
|
534
533
|
});
|
|
535
|
-
return
|
|
534
|
+
return err(message);
|
|
536
535
|
}
|
|
537
536
|
};
|
|
538
537
|
return {
|
|
@@ -544,253 +543,6 @@ function useBookingSubmission(_siteId) {
|
|
|
544
543
|
};
|
|
545
544
|
}
|
|
546
545
|
|
|
547
|
-
// ../blocks/src/system/runtime/shared/bookingPaymentOptionCopy.ts
|
|
548
|
-
function buildUpfrontBookingPaymentOptionCopy(formattedTotal) {
|
|
549
|
-
return {
|
|
550
|
-
title: "Pay in full",
|
|
551
|
-
description: "Pay everything today and your booking is confirmed.",
|
|
552
|
-
ctaLabel: `Pay ${formattedTotal} now`
|
|
553
|
-
};
|
|
554
|
-
}
|
|
555
|
-
function buildDeferredManualBookingPaymentOptionCopy() {
|
|
556
|
-
return {
|
|
557
|
-
title: "Pay offline",
|
|
558
|
-
description: "Book now and pay the business later, outside the platform.",
|
|
559
|
-
helperText: "Nothing is due today.",
|
|
560
|
-
ctaLabel: "Book now"
|
|
561
|
-
};
|
|
562
|
-
}
|
|
563
|
-
function buildInstalmentBookingPaymentOptionCopy(input) {
|
|
564
|
-
return {
|
|
565
|
-
title: "Payment plan",
|
|
566
|
-
description: describeInstalmentPlanCopy(input),
|
|
567
|
-
helperText: "You can pay the rest early any time in your customer portal.",
|
|
568
|
-
ctaLabel: `Pay ${input.formattedDueToday} now`
|
|
569
|
-
};
|
|
570
|
-
}
|
|
571
|
-
function describeInstalmentPlanCopy(input) {
|
|
572
|
-
if (input.depositRefundability) {
|
|
573
|
-
return `Pay ${input.formattedDueToday} today, then continue with scheduled payments. Your deposit is ${formatDepositRefundabilityLabel(input.depositRefundability)}.`;
|
|
574
|
-
}
|
|
575
|
-
if (input.futurePaymentCount === 0) {
|
|
576
|
-
return `Pay ${input.formattedDueToday} today.`;
|
|
577
|
-
}
|
|
578
|
-
if (input.futurePaymentCount === 1) {
|
|
579
|
-
return `Pay ${input.formattedDueToday} today, then one more payment later.`;
|
|
580
|
-
}
|
|
581
|
-
const formattedFirstFuture = input.formattedFirstFuture ?? input.formattedDueToday;
|
|
582
|
-
return `Pay ${input.formattedDueToday} today, then ${input.futurePaymentCount} more ${input.cadenceLabel} payments from ${formattedFirstFuture}.`;
|
|
583
|
-
}
|
|
584
|
-
function buildFlexibleBalanceBookingPaymentOptionCopy(input) {
|
|
585
|
-
return {
|
|
586
|
-
title: "Deposit now, pay the rest later",
|
|
587
|
-
description: `Pay ${input.formattedDueToday} today, then pay the remaining balance any time before ${input.dueDateLabel}. Your deposit is ${formatDepositRefundabilityLabel(input.depositRefundability)}.`,
|
|
588
|
-
helperText: "You can return in your customer portal to pay the rest before the due date.",
|
|
589
|
-
ctaLabel: `Pay ${input.formattedDueToday} now`
|
|
590
|
-
};
|
|
591
|
-
}
|
|
592
|
-
function formatDepositRefundabilityLabel(depositRefundability) {
|
|
593
|
-
return depositRefundability === "non_refundable" ? "non-refundable" : "refundable";
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
// ../blocks/src/system/runtime/shared/bookingPaymentOptions.ts
|
|
597
|
-
function buildBookingPaymentSelectionViewModel(input) {
|
|
598
|
-
const currency = input.priceCurrency ?? "USD";
|
|
599
|
-
const totalCents = Math.max(0, input.priceAmount ?? 0);
|
|
600
|
-
const allowedOptions = input.paymentTerms?.allowedOptions ?? [{ kind: "upfront" }];
|
|
601
|
-
const mode = allowedOptions.length > 1 ? "choice_required" : "single_option";
|
|
602
|
-
return {
|
|
603
|
-
mode,
|
|
604
|
-
sectionTitle: mode === "choice_required" ? "Choose how you'd like to pay" : "Payment",
|
|
605
|
-
serviceTitle: input.serviceTitle,
|
|
606
|
-
options: allowedOptions.map((option) => buildBookingPaymentOptionViewModel({
|
|
607
|
-
option,
|
|
608
|
-
totalCents,
|
|
609
|
-
currency,
|
|
610
|
-
bookingStartAt: input.bookingStartAt,
|
|
611
|
-
locale: input.locale
|
|
612
|
-
}))
|
|
613
|
-
};
|
|
614
|
-
}
|
|
615
|
-
function buildBookingPaymentOptionViewModel(input) {
|
|
616
|
-
switch (input.option.kind) {
|
|
617
|
-
case "upfront": {
|
|
618
|
-
const formattedTotal = formatPrice(input.totalCents, input.currency, input.locale);
|
|
619
|
-
const copy = buildUpfrontBookingPaymentOptionCopy(formattedTotal);
|
|
620
|
-
return {
|
|
621
|
-
kind: "upfront",
|
|
622
|
-
title: copy.title,
|
|
623
|
-
description: copy.description,
|
|
624
|
-
summaryRows: [
|
|
625
|
-
{ label: "Total", value: formattedTotal },
|
|
626
|
-
{ label: "Due today", value: formattedTotal }
|
|
627
|
-
],
|
|
628
|
-
ctaLabel: copy.ctaLabel
|
|
629
|
-
};
|
|
630
|
-
}
|
|
631
|
-
case "deferred_manual": {
|
|
632
|
-
const formattedTotal = formatPrice(input.totalCents, input.currency, input.locale);
|
|
633
|
-
const copy = buildDeferredManualBookingPaymentOptionCopy();
|
|
634
|
-
return {
|
|
635
|
-
kind: "deferred_manual",
|
|
636
|
-
title: copy.title,
|
|
637
|
-
description: copy.description,
|
|
638
|
-
summaryRows: [
|
|
639
|
-
{ label: "Total", value: formattedTotal },
|
|
640
|
-
{ label: "Due today", value: formatPrice(0, input.currency, input.locale) }
|
|
641
|
-
],
|
|
642
|
-
helperText: copy.helperText,
|
|
643
|
-
ctaLabel: copy.ctaLabel
|
|
644
|
-
};
|
|
645
|
-
}
|
|
646
|
-
case "instalment_plan": {
|
|
647
|
-
const schedulePreview = buildInstalmentSchedulePreview({
|
|
648
|
-
totalCents: input.totalCents,
|
|
649
|
-
option: input.option,
|
|
650
|
-
bookingStartAt: input.bookingStartAt
|
|
651
|
-
});
|
|
652
|
-
const dueToday = schedulePreview[0]?.amountCents ?? input.totalCents;
|
|
653
|
-
const futureRows = schedulePreview.slice(1);
|
|
654
|
-
const formattedTotal = formatPrice(input.totalCents, input.currency, input.locale);
|
|
655
|
-
const formattedDueToday = formatPrice(dueToday, input.currency, input.locale);
|
|
656
|
-
const depositRefundability = getBookingInstalmentDepositRefundability(input.option.plan);
|
|
657
|
-
const copy = buildInstalmentBookingPaymentOptionCopy({
|
|
658
|
-
formattedDueToday,
|
|
659
|
-
futurePaymentCount: futureRows.length,
|
|
660
|
-
formattedFirstFuture: futureRows[0] ? formatPrice(futureRows[0].amountCents, input.currency, input.locale) : null,
|
|
661
|
-
cadenceLabel: getPaymentCadenceLabel(input.option.plan),
|
|
662
|
-
depositRefundability
|
|
663
|
-
});
|
|
664
|
-
return {
|
|
665
|
-
kind: "instalment_plan",
|
|
666
|
-
title: copy.title,
|
|
667
|
-
description: copy.description,
|
|
668
|
-
summaryRows: [
|
|
669
|
-
{ label: "Total", value: formattedTotal },
|
|
670
|
-
{ label: "Due today", value: formattedDueToday },
|
|
671
|
-
...depositRefundability ? [{
|
|
672
|
-
label: "Deposit policy",
|
|
673
|
-
value: depositRefundability === "non_refundable" ? "Non-refundable" : "Refundable"
|
|
674
|
-
}] : [],
|
|
675
|
-
...futureRows.map((row) => ({
|
|
676
|
-
label: formatScheduleDate(row.dueAt, input.locale),
|
|
677
|
-
value: formatPrice(row.amountCents, input.currency, input.locale)
|
|
678
|
-
}))
|
|
679
|
-
],
|
|
680
|
-
helperText: copy.helperText,
|
|
681
|
-
ctaLabel: copy.ctaLabel
|
|
682
|
-
};
|
|
683
|
-
}
|
|
684
|
-
case "flexible_balance": {
|
|
685
|
-
const dueToday = resolveFlexibleBalanceInitialPaymentCents({
|
|
686
|
-
totalAmountCents: input.totalCents,
|
|
687
|
-
config: input.option.config
|
|
688
|
-
});
|
|
689
|
-
const formattedTotal = formatPrice(input.totalCents, input.currency, input.locale);
|
|
690
|
-
const formattedDueToday = formatPrice(dueToday, input.currency, input.locale);
|
|
691
|
-
const dueAt = resolveFlexibleBalanceDueAt({
|
|
692
|
-
bookingStartAt: input.bookingStartAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
693
|
-
dueDateRule: input.option.config.dueDateRule
|
|
694
|
-
});
|
|
695
|
-
const copy = buildFlexibleBalanceBookingPaymentOptionCopy({
|
|
696
|
-
formattedDueToday,
|
|
697
|
-
dueDateLabel: formatScheduleDate(dueAt, input.locale),
|
|
698
|
-
depositRefundability: input.option.config.depositRefundability
|
|
699
|
-
});
|
|
700
|
-
return {
|
|
701
|
-
kind: "flexible_balance",
|
|
702
|
-
title: copy.title,
|
|
703
|
-
description: copy.description,
|
|
704
|
-
summaryRows: [
|
|
705
|
-
{ label: "Total", value: formattedTotal },
|
|
706
|
-
{ label: "Due today", value: formattedDueToday },
|
|
707
|
-
{ label: "Balance due by", value: formatScheduleDate(dueAt, input.locale) },
|
|
708
|
-
{
|
|
709
|
-
label: "Deposit policy",
|
|
710
|
-
value: input.option.config.depositRefundability === "non_refundable" ? "Non-refundable" : "Refundable"
|
|
711
|
-
}
|
|
712
|
-
],
|
|
713
|
-
helperText: copy.helperText,
|
|
714
|
-
ctaLabel: copy.ctaLabel
|
|
715
|
-
};
|
|
716
|
-
}
|
|
717
|
-
default:
|
|
718
|
-
return assertNever11(input.option);
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
function buildInstalmentSchedulePreview(input) {
|
|
722
|
-
const startAt = input.bookingStartAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
723
|
-
switch (input.option.plan.kind) {
|
|
724
|
-
case "deposit_plus_one_remainder": {
|
|
725
|
-
const deposit = clampConfiguredAmount(input.option.plan.depositAmountCents, input.totalCents);
|
|
726
|
-
const remainder = Math.max(0, input.totalCents - deposit);
|
|
727
|
-
return compactSchedulePreview([
|
|
728
|
-
{ dueAt: startAt, amountCents: deposit },
|
|
729
|
-
{
|
|
730
|
-
dueAt: addIntervalPreservingMonthAnchor(
|
|
731
|
-
startAt,
|
|
732
|
-
input.option.plan.remainderDueCount,
|
|
733
|
-
input.option.plan.intervalUnit
|
|
734
|
-
),
|
|
735
|
-
amountCents: remainder
|
|
736
|
-
}
|
|
737
|
-
]);
|
|
738
|
-
}
|
|
739
|
-
case "deposit_plus_scheduled_instalments": {
|
|
740
|
-
const plan = input.option.plan;
|
|
741
|
-
const deposit = clampConfiguredAmount(plan.depositAmountCents, input.totalCents);
|
|
742
|
-
const remaining = Math.max(0, input.totalCents - deposit);
|
|
743
|
-
const instalments = splitAmountWithRemainderInFirst(
|
|
744
|
-
remaining,
|
|
745
|
-
plan.instalmentCount
|
|
746
|
-
);
|
|
747
|
-
return compactSchedulePreview([
|
|
748
|
-
{ dueAt: startAt, amountCents: deposit },
|
|
749
|
-
...instalments.map((amountCents, index) => ({
|
|
750
|
-
dueAt: addIntervalPreservingMonthAnchor(
|
|
751
|
-
startAt,
|
|
752
|
-
plan.intervalCount * (index + 1),
|
|
753
|
-
plan.intervalUnit
|
|
754
|
-
),
|
|
755
|
-
amountCents
|
|
756
|
-
}))
|
|
757
|
-
]);
|
|
758
|
-
}
|
|
759
|
-
case "equal_scheduled_instalments": {
|
|
760
|
-
const plan = input.option.plan;
|
|
761
|
-
const instalments = splitAmountWithRemainderInFirst(
|
|
762
|
-
input.totalCents,
|
|
763
|
-
plan.instalmentCount
|
|
764
|
-
);
|
|
765
|
-
return compactSchedulePreview(instalments.map((amountCents, index) => ({
|
|
766
|
-
dueAt: index === 0 ? startAt : addIntervalPreservingMonthAnchor(
|
|
767
|
-
startAt,
|
|
768
|
-
plan.intervalCount * index,
|
|
769
|
-
plan.intervalUnit
|
|
770
|
-
),
|
|
771
|
-
amountCents
|
|
772
|
-
})));
|
|
773
|
-
}
|
|
774
|
-
default:
|
|
775
|
-
return assertNever11(input.option.plan);
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
function getPaymentCadenceLabel(plan) {
|
|
779
|
-
const intervalCount = getBookingInstalmentPlanIntervalCount(plan);
|
|
780
|
-
const unitLabel = intervalCount === 1 ? plan.intervalUnit : `${plan.intervalUnit}s`;
|
|
781
|
-
return intervalCount === 1 ? unitLabel : `every ${intervalCount} ${unitLabel}`;
|
|
782
|
-
}
|
|
783
|
-
function compactSchedulePreview(schedule) {
|
|
784
|
-
return omitZeroAmountFutureRows(schedule);
|
|
785
|
-
}
|
|
786
|
-
function formatScheduleDate(isoString, locale) {
|
|
787
|
-
const date = new Date(isoString);
|
|
788
|
-
if (!Number.isFinite(date.getTime())) {
|
|
789
|
-
return isoString;
|
|
790
|
-
}
|
|
791
|
-
return new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format(date);
|
|
792
|
-
}
|
|
793
|
-
|
|
794
546
|
// ../blocks/src/system/runtime/nodes/booking-form.headless.state.ts
|
|
795
547
|
var unsafeAsBookingFieldId = (id) => id;
|
|
796
548
|
function createEmptyBookingValidationErrors() {
|
|
@@ -996,7 +748,7 @@ function bookingFlowReducer(state, event) {
|
|
|
996
748
|
case "reset":
|
|
997
749
|
return event.initial;
|
|
998
750
|
default:
|
|
999
|
-
return
|
|
751
|
+
return assertNever(event);
|
|
1000
752
|
}
|
|
1001
753
|
}
|
|
1002
754
|
function clearAvailabilityFeedback(feedback) {
|
|
@@ -1125,7 +877,7 @@ function validateBookingStep(input) {
|
|
|
1125
877
|
return Object.keys(errors).length > 0 ? { ok: false, errors: createFieldBookingValidationErrors(errors) } : { ok: true };
|
|
1126
878
|
}
|
|
1127
879
|
default:
|
|
1128
|
-
return
|
|
880
|
+
return assertNever(input.stepId);
|
|
1129
881
|
}
|
|
1130
882
|
}
|
|
1131
883
|
function validateBookingFields(input) {
|
|
@@ -1417,7 +1169,7 @@ function resolveAppointmentPackagesModel(input) {
|
|
|
1417
1169
|
};
|
|
1418
1170
|
}
|
|
1419
1171
|
default:
|
|
1420
|
-
return
|
|
1172
|
+
return assertNever(input.state);
|
|
1421
1173
|
}
|
|
1422
1174
|
}
|
|
1423
1175
|
function toHeadlessEligibleAppointmentPackage(appointmentPackage) {
|
|
@@ -1741,7 +1493,10 @@ function useHeadlessBookingFlow(options) {
|
|
|
1741
1493
|
state.selectedDate,
|
|
1742
1494
|
state.selectedSlot
|
|
1743
1495
|
]);
|
|
1744
|
-
const appointmentDiscountContext =
|
|
1496
|
+
const appointmentDiscountContext = useMemo(
|
|
1497
|
+
() => selectedService && (selectedService.priceAmount ?? 0) > 0 ? { type: "appointment", serviceId: selectedService.id } : null,
|
|
1498
|
+
[selectedService?.id, selectedService?.priceAmount]
|
|
1499
|
+
);
|
|
1745
1500
|
const discountUi = useDiscountCodeUi({
|
|
1746
1501
|
api,
|
|
1747
1502
|
discountContext: appointmentDiscountContext,
|
|
@@ -2327,7 +2082,7 @@ function DefaultBookingStepContent({
|
|
|
2327
2082
|
case "custom-fields":
|
|
2328
2083
|
return /* @__PURE__ */ jsx(DefaultDynamicFields, { fields: booking.fields.items, booking });
|
|
2329
2084
|
default:
|
|
2330
|
-
return
|
|
2085
|
+
return assertNever(stepId);
|
|
2331
2086
|
}
|
|
2332
2087
|
}
|
|
2333
2088
|
function DefaultServiceSelectionStep({
|