@riverbankcms/sdk 0.149.0 → 0.150.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/EventEmbeddedCheckoutStep-D00Kc8Zj.mjs +285 -0
- package/dist/{PreviewEditorSidebar-DBKln68M.mjs → PreviewEditorSidebar-7ZhmmnBB.mjs} +3 -3
- package/dist/{PreviewEditorUI-DpRX4Mum.mjs → PreviewEditorUI-BIJucTRd.mjs} +2 -2
- package/dist/{SdkPreviewModeRuntime-DJPmPY-r.mjs → SdkPreviewModeRuntime-tj45gmCX.mjs} +4 -3
- package/dist/{SiteChromeCustomizeContext-JYA0cJ_Z.mjs → SiteChromeCustomizeContext-BFOt0ss-.mjs} +4454 -4059
- package/dist/_dts/ai/src/contracts/proposals.d.ts +660 -0
- package/dist/_dts/ai/src/contracts/siteStyleProposalSchemas.d.ts +510 -0
- package/dist/_dts/api/src/billing.d.ts +2 -2
- package/dist/_dts/api/src/contentRuntime.d.ts +5 -1
- package/dist/_dts/api/src/footerCompositionContracts.d.ts +9 -0
- package/dist/_dts/api/src/footerSettings.d.ts +3 -3
- package/dist/_dts/api/src/index.d.ts +1 -1
- package/dist/_dts/api/src/navigation/bookingPortalLink.d.ts +13 -0
- package/dist/_dts/api/src/navigation.d.ts +1 -0
- package/dist/_dts/api/src/publicExperience/eventEndpoints.d.ts +9 -173
- package/dist/_dts/api/src/sdkThemeWire.d.ts +12 -0
- package/dist/_dts/api/src/siteManagementEndpoints.d.ts +3 -3
- package/dist/_dts/api/src/siteSettings.d.ts +2 -0
- package/dist/_dts/blocks/src/client/site-chrome.d.ts +1 -1
- package/dist/_dts/blocks/src/client.d.ts +2 -1
- package/dist/_dts/blocks/src/rendering/server.d.ts +1 -1
- package/dist/_dts/blocks/src/system/blocks/site-footer-runtime.d.ts +30 -3
- package/dist/_dts/blocks/src/system/designCapabilities.d.ts +10 -1
- package/dist/_dts/blocks/src/system/runtime/api/index.d.ts +1 -1
- package/dist/_dts/blocks/src/system/runtime/api/types/events.d.ts +38 -18
- package/dist/_dts/blocks/src/system/runtime/hooks/useHeadlessEventRegistrationFlow.d.ts +1 -1
- package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.server.d.ts +6 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventEmbeddedCheckoutStep.d.ts +13 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventRegistrationPayment.d.ts +15 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventRegistrationWizardActions.d.ts +0 -1
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/FullyBookedStep.d.ts +6 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/PaymentBlockingPanel.d.ts +3 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/PaymentSelectionStep.d.ts +2 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/event-registration.headless.contract.d.ts +15 -5
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/event-registration.headless.planning.d.ts +4 -2
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/paymentLocation.d.ts +3 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/paymentResponse.d.ts +72 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationCompletion.d.ts +66 -5
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationErrorRecovery.d.ts +1 -4
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationStateMachine.d.ts +13 -5
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/sessionStorage.d.ts +11 -52
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/types.d.ts +19 -2
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationStripeReturn.d.ts +7 -42
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationSubmit.d.ts +7 -8
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationWizard.d.ts +90 -24
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useGuestRegistrationRecovery.d.ts +30 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/usePaymentStatusRecovery.d.ts +24 -12
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useRegistrationAdmission.d.ts +18 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/wizardSteps.d.ts +6 -1
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration.interactive.d.ts +1 -1
- package/dist/_dts/blocks/src/system/runtime/shared/stripe/browserStripe.d.ts +8 -0
- package/dist/_dts/blocks/src/system/transforms/registry/eventCalendar.d.ts +8 -0
- package/dist/_dts/commerce/src/purchase/checkoutCopy.d.ts +10 -0
- package/dist/_dts/commerce/src/purchase/checkoutPresentation.d.ts +49 -0
- package/dist/_dts/commerce/src/purchase/checkoutSessionMetadata.d.ts +4 -4
- package/dist/_dts/commerce/src/purchase/checkoutStripeFinalizationPlanning.d.ts +5 -1
- package/dist/_dts/commerce/src/purchase/event-registration-errors.d.ts +9 -0
- package/dist/_dts/commerce/src/purchase/index.d.ts +2 -0
- package/dist/_dts/commerce/src/purchase/orderItemMetadata.d.ts +1 -0
- package/dist/_dts/commerce/src/purchase/stripeCheckoutReturnUrl.d.ts +9 -2
- package/dist/_dts/commerce/src/purchase/types.d.ts +5 -6
- package/dist/_dts/content-editor/src/FooterComposerOverview.d.ts +3 -2
- package/dist/_dts/content-editor/src/footerPreviewRuntime.d.ts +6 -1
- package/dist/_dts/content-editor/src/useFooterComposerState.d.ts +7 -0
- package/dist/_dts/core/src/index.d.ts +1 -0
- package/dist/_dts/core/src/patch/index.d.ts +30 -0
- package/dist/_dts/db/src/generated/supabase/database.types.d.ts +30 -1
- package/dist/_dts/sdk/src/bookings/index.d.ts +2 -1
- package/dist/_dts/sdk/src/bookings/types.d.ts +1 -1
- package/dist/_dts/sdk/src/version.d.ts +1 -1
- package/dist/_dts/theme-core/src/blocks/index.d.ts +1 -0
- package/dist/_dts/theme-core/src/blocks/opaquePanels.d.ts +147 -0
- package/dist/_dts/theme-core/src/boxBackgroundSchema.d.ts +22 -0
- package/dist/_dts/theme-core/src/buttons/buttonSurfaceContext.d.ts +22 -0
- package/dist/_dts/theme-core/src/cards/roles.d.ts +12 -0
- package/dist/_dts/theme-core/src/generated/containerResponsiveThemeCss.d.ts +1 -1
- package/dist/_dts/theme-core/src/mock-themes/all.d.ts +198 -0
- package/dist/_dts/theme-core/src/palette/utils/index.d.ts +2 -0
- package/dist/_dts/theme-core/src/palette/utils/scrimContrast.d.ts +22 -0
- package/dist/_dts/theme-core/src/runtime/bridgeColourTokens.d.ts +10 -0
- package/dist/_dts/theme-core/src/schema.d.ts +330 -0
- package/dist/_dts/theme-core/src/site-styles/appearancePresetCatalog.d.ts +0 -51
- package/dist/_dts/theme-core/src/site-styles/blockAppearancePresets.d.ts +0 -51
- package/dist/_dts/theme-core/src/site-styles/lookResolution.d.ts +11 -0
- package/dist/_dts/theme-core/src/site-styles/pageDesignEditorCapabilities.d.ts +7 -1
- package/dist/_dts/theme-core/src/site-styles/pageDesignEditorModel.d.ts +7 -1
- package/dist/_dts/theme-core/src/site-styles/previewRuntimeCapabilities.d.ts +12 -6
- package/dist/_dts/theme-core/src/site-styles/runtimeCompiler.d.ts +7 -4
- package/dist/_dts/theme-core/src/site-styles/sectionSurfaceBackgrounds.d.ts +65 -0
- package/dist/_dts/theme-core/src/site-styles/types.d.ts +17 -0
- package/dist/_dts/theme-core/src/surfaces/opaqueSurface.d.ts +43 -0
- package/dist/client/{BookingMailingListNote-Cr3EeTP5.mjs → BookingMailingListNote-CYHOufsI.mjs} +10 -440
- package/dist/client/{CheckboxChoice-B33MqoUo.mjs → CheckboxChoice-M-3HycLw.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-BFGB1Fay.mjs → DemoBookingPortalAccess-Cvr9O_ca.mjs} +2 -2
- package/dist/client/{EventCombined.client-DKYV0_ft.mjs → EventCombined.client-m5UZIobP.mjs} +7 -7
- package/dist/client/EventEmbeddedCheckoutStep-DL6zFAkA.mjs +289 -0
- package/dist/client/{EventListing.client-B9UIcEYc.mjs → EventListing.client-DeMfCM04.mjs} +2 -2
- package/dist/client/{LeafletStaticMap-CFLPkP0K.mjs → LeafletStaticMap-CvZ3gOdD.mjs} +1 -1
- package/dist/client/{checkoutUrls-CXhko2Rv.mjs → RichText-BtfNvQV6.mjs} +2 -29
- package/dist/client/{TerminalPanel-JjmgxEsR.mjs → TerminalPanel-CUCNEwlH.mjs} +2 -18
- package/dist/client/{ThemedButton-CKV1Jh2m.mjs → ThemedButton-C7WhXuRl.mjs} +2 -2
- package/dist/client/{accordion-DXWIfT3T.mjs → accordion-cQm5mjqs.mjs} +1 -1
- package/dist/client/{bookingForm-CjZgHNvv.mjs → bookingForm-BVPJE5RQ.mjs} +11 -10
- package/dist/client/bookings.mjs +2668 -1134
- package/dist/client/{carousel-DSLikmvZ.mjs → carousel-3vgnY7LC.mjs} +2 -2
- package/dist/client/{carousel.client-A2lG-9od.mjs → carousel.client-CISsdZvg.mjs} +1 -1
- package/dist/client/{cart-HDjWReFt.mjs → cart-BGK4oOjm.mjs} +3 -3
- package/dist/client/{checkout-CUvRZA3W.mjs → checkout-GsBLUNJD.mjs} +3 -3
- package/dist/client/checkoutUrls-ChxwaNtO.mjs +28 -0
- package/dist/client/client.mjs +3042 -1868
- package/dist/client/{colorStyles-j5U9v5JA.mjs → colorStyles-D-32xHZh.mjs} +2 -30
- package/dist/client/{context-DFmaZa-Q.mjs → context-D_8s12Fp.mjs} +1 -1
- package/dist/client/{dates-BBep1JnF.mjs → dates-DeJQbQ9T.mjs} +2 -2
- package/dist/client/{eventCalendar-zEobhxo4.mjs → eventCalendar-cmucD4NR.mjs} +10 -10
- package/dist/client/{eventCombined-Dp7bz5k-.mjs → eventCombined-ku3E9FTl.mjs} +4 -4
- package/dist/client/{eventDetails-FE-zqTt7.mjs → eventDetails-CyKZ61sF.mjs} +5 -5
- package/dist/client/{eventListing-BMt5snal.mjs → eventListing-B7yxGIhX.mjs} +4 -4
- package/dist/client/{eventRegistration-O6ZxHfOb.mjs → eventRegistration-BoXfSFgZ.mjs} +1403 -857
- package/dist/client/{form-DFa1D8vt.mjs → form-CNQOWhJo.mjs} +5 -5
- package/dist/client/{headerSection-CmjHLR-N.mjs → headerSection-DahaBJGQ.mjs} +3 -3
- package/dist/client/hooks.mjs +123 -64
- package/dist/client/{locationMap-BXKP_lGh.mjs → locationMap-BoDjqYlW.mjs} +4 -4
- package/dist/client/{media-Cl38iOMI.mjs → media-BFY0y2rb.mjs} +2 -1
- package/dist/client/{newsletterForm-CU-HmxGx.mjs → newsletterForm-DtzXDklw.mjs} +4 -4
- package/dist/client/{pricing-KEAEsibq.mjs → pricing-DXEh2Lhh.mjs} +1 -1
- package/dist/client/{productDetail-Ckp7MGnt.mjs → productDetail-D7cPa-00.mjs} +3 -3
- package/dist/client/{productList-D91V0sYa.mjs → productList-D1XMap66.mjs} +3 -3
- package/dist/client/{propsDecoder-DZd6RJeA.mjs → propsDecoder-DiIeBopB.mjs} +758 -245
- package/dist/client/rendering/client.mjs +4381 -2892
- package/dist/client/rendering/islands.mjs +19 -19
- package/dist/client/rendering.mjs +3026 -1852
- package/dist/client/result-DRW7JWXz.mjs +30 -0
- package/dist/client/{routeIslandApiConfig-E1EkhhYY.mjs → routeIslandApiConfig-wzR4lKAY.mjs} +1 -1
- package/dist/client/scrollToBlock-C86BYkyV.mjs +17 -0
- package/dist/client/{shop-4F2jLQPI.mjs → shop-CYT5P-S5.mjs} +8 -8
- package/dist/client/{shop-commerce-store-vicweP2K.mjs → shop-commerce-store-wKhsJQxI.mjs} +1 -1
- package/dist/client/{shop-commerce-BbfCJjB3.mjs → shop-commerce-ypBu_dx4.mjs} +9 -9
- package/dist/client/{shopShared-DlONJt0T.mjs → shopShared-DFGhYrf2.mjs} +52 -6
- package/dist/client/{useEventFilters-COYyL3m7.mjs → useEventFilters-blSbN5o7.mjs} +8 -8
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/{sdk-runtime-CwvFFjB-.mjs → sdk-runtime-2p8uQk1V.mjs} +1 -1
- package/dist/{separator-ByL72zUT.mjs → separator-Cvvzk0Oo.mjs} +1 -1
- package/dist/server/components.mjs +4066 -3765
- package/dist/server/config-validation.mjs +185 -126
- package/dist/server/config.mjs +185 -126
- package/dist/server/data.mjs +123 -64
- package/dist/server/index.mjs +1 -1
- package/dist/server/next.mjs +615 -314
- package/dist/server/page-converter.mjs +100 -56
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/rendering/server.mjs +4041 -3751
- package/dist/server/rendering.mjs +4069 -3768
- package/dist/server/routing.mjs +149 -72
- package/dist/server/server.mjs +124 -65
- package/dist/server/theme-bridge.mjs +1122 -310
- package/dist/server/theme.mjs +126 -116
- package/dist/spinner-CDo6AkDz.mjs +658 -0
- package/dist/styles/index.css +75 -212
- package/package.json +1 -1
- package/dist/_dts/billing/src/checkout/platform.d.ts +0 -77
- package/dist/_dts/billing/src/config/env.d.ts +0 -29
- package/dist/_dts/billing/src/stripe/client.d.ts +0 -29
- package/dist/_dts/blocks/src/system/runtime/hooks/usePaymentVerification.d.ts +0 -63
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventCheckoutHandoffRestore.d.ts +0 -9
- package/dist/client/urlParams-D71VXFGx.mjs +0 -47
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as ok$1, t as err$1 } from "./result-DRW7JWXz.mjs";
|
|
2
|
+
import { _ as parseEventSeriesId, a as paletteColorEntries, c as themeColorTokenSchema, g as parseEventOfferingId, h as parseContentVersionId, l as parseColorTokenParts, o as paletteColorsFromEntries, p as parseAspectRatioValue, r as rgbColorValue, s as parseThemeColorToken } from "./colorStyles-D-32xHZh.mjs";
|
|
2
3
|
import "react";
|
|
3
4
|
import { z } from "zod";
|
|
4
5
|
import "react/jsx-runtime";
|
|
5
6
|
//#region ../core/src/assert-never.ts
|
|
6
|
-
function assertNever$
|
|
7
|
+
function assertNever$4(value, message = "Unexpected variant") {
|
|
7
8
|
throw new Error(`${message}: ${String(value)}`);
|
|
8
9
|
}
|
|
9
10
|
//#endregion
|
|
@@ -96,7 +97,7 @@ function isPublicEventPricingOptionDisplayable(option) {
|
|
|
96
97
|
case "not_on_sale_yet":
|
|
97
98
|
case "sale_ended":
|
|
98
99
|
case "attendance_mode_unavailable": return false;
|
|
99
|
-
default: return assertNever$
|
|
100
|
+
default: return assertNever$4(reason);
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
function publicEventPricingDisplay(pricing) {
|
|
@@ -226,7 +227,7 @@ function canonicalEventPricingDisplay(pricing) {
|
|
|
226
227
|
currency: pricing.currency,
|
|
227
228
|
purpose: "configured"
|
|
228
229
|
});
|
|
229
|
-
default: return assertNever$
|
|
230
|
+
default: return assertNever$4(pricing);
|
|
230
231
|
}
|
|
231
232
|
}
|
|
232
233
|
/**
|
|
@@ -245,7 +246,7 @@ function formatBookingPriceDisplay(display, options = {}) {
|
|
|
245
246
|
case "mixed": return display.paidToAmount > display.paidFromAmount ? `Free / ${formatCurrencyAmount(display.paidFromAmount, display.currency, options)} - ${formatCurrencyAmount(display.paidToAmount, display.currency, options)}` : `Free / ${formatCurrencyAmount(display.paidFromAmount, display.currency, options)}`;
|
|
246
247
|
case "unavailable": return "Pricing unavailable";
|
|
247
248
|
case "external": return display.label;
|
|
248
|
-
default: return assertNever$
|
|
249
|
+
default: return assertNever$4(display);
|
|
249
250
|
}
|
|
250
251
|
}
|
|
251
252
|
/** Render an event's price directly from its pricing value. */
|
|
@@ -357,6 +358,78 @@ function isRecord$9(value) {
|
|
|
357
358
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
358
359
|
}
|
|
359
360
|
//#endregion
|
|
361
|
+
//#region ../core/src/money-input.ts
|
|
362
|
+
function unsafeAsNonNegativeCents(value) {
|
|
363
|
+
return value;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Normalizes a derived amount to non-negative whole cents. This intentionally
|
|
367
|
+
* clamps negatives to zero; use parseNonNegativeCents for validation.
|
|
368
|
+
*/
|
|
369
|
+
function toNonNegativeCents(value) {
|
|
370
|
+
return unsafeAsNonNegativeCents(Math.max(0, Math.trunc(value)));
|
|
371
|
+
}
|
|
372
|
+
//#endregion
|
|
373
|
+
//#region ../core/src/booking-instalments.ts
|
|
374
|
+
function isDepositBearingBookingInstalmentPlan(plan) {
|
|
375
|
+
switch (plan.kind) {
|
|
376
|
+
case "deposit_plus_one_remainder":
|
|
377
|
+
case "deposit_plus_scheduled_instalments": return true;
|
|
378
|
+
case "equal_scheduled_instalments": return false;
|
|
379
|
+
default: return assertNever$3(plan);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
function getBookingInstalmentDepositRefundability(plan) {
|
|
383
|
+
return isDepositBearingBookingInstalmentPlan(plan) ? plan.depositRefundability : null;
|
|
384
|
+
}
|
|
385
|
+
function clampConfiguredAmount(amountCents, totalAmountCents) {
|
|
386
|
+
return Math.max(0, Math.min(amountCents, totalAmountCents));
|
|
387
|
+
}
|
|
388
|
+
function splitAmountWithRemainderInFirst(totalAmountCents, partCount) {
|
|
389
|
+
if (partCount <= 0) return [];
|
|
390
|
+
const baseAmountCents = Math.floor(totalAmountCents / partCount);
|
|
391
|
+
const remainderCents = totalAmountCents - baseAmountCents * partCount;
|
|
392
|
+
return Array.from({ length: partCount }, (_, index) => index === 0 ? baseAmountCents + remainderCents : baseAmountCents);
|
|
393
|
+
}
|
|
394
|
+
function addIntervalPreservingMonthAnchor(isoString, intervalCount, intervalUnit) {
|
|
395
|
+
const date = new Date(isoString);
|
|
396
|
+
if (!Number.isFinite(date.getTime())) return isoString;
|
|
397
|
+
switch (intervalUnit) {
|
|
398
|
+
case "day":
|
|
399
|
+
date.setUTCDate(date.getUTCDate() + intervalCount);
|
|
400
|
+
return date.toISOString();
|
|
401
|
+
case "week":
|
|
402
|
+
date.setUTCDate(date.getUTCDate() + intervalCount * 7);
|
|
403
|
+
return date.toISOString();
|
|
404
|
+
case "month": return addMonthsPreservingAnchorDay(date, intervalCount).toISOString();
|
|
405
|
+
default: return assertNever$3(intervalUnit);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
function getBookingInstalmentPlanIntervalCount(plan) {
|
|
409
|
+
switch (plan.kind) {
|
|
410
|
+
case "deposit_plus_one_remainder": return plan.remainderDueCount;
|
|
411
|
+
case "deposit_plus_scheduled_instalments":
|
|
412
|
+
case "equal_scheduled_instalments": return plan.intervalCount;
|
|
413
|
+
default: return assertNever$3(plan);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
function omitZeroAmountFutureRows(rows) {
|
|
417
|
+
if (rows.length <= 1) return rows;
|
|
418
|
+
const firstRow = rows[0];
|
|
419
|
+
if (firstRow === void 0) return [];
|
|
420
|
+
return [firstRow, ...rows.slice(1).filter((row) => row.amountCents > 0)];
|
|
421
|
+
}
|
|
422
|
+
function addMonthsPreservingAnchorDay(date, intervalCount) {
|
|
423
|
+
const anchorDay = date.getUTCDate();
|
|
424
|
+
const nextMonth = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth() + intervalCount, 1, date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds()));
|
|
425
|
+
const lastDayOfTargetMonth = new Date(Date.UTC(nextMonth.getUTCFullYear(), nextMonth.getUTCMonth() + 1, 0)).getUTCDate();
|
|
426
|
+
nextMonth.setUTCDate(Math.min(anchorDay, lastDayOfTargetMonth));
|
|
427
|
+
return nextMonth;
|
|
428
|
+
}
|
|
429
|
+
function assertNever$3(value) {
|
|
430
|
+
throw new Error(`Unexpected value: ${String(value)}`);
|
|
431
|
+
}
|
|
432
|
+
//#endregion
|
|
360
433
|
//#region ../core/src/booking-payment-options.ts
|
|
361
434
|
/** Automatic instalments and a flexible balance cannot share one booking offer. */
|
|
362
435
|
function validateBookingPaymentOptionKinds(kinds) {
|
|
@@ -1240,6 +1313,409 @@ const SURFACE_EVENT_PRESET_VALUES = [
|
|
|
1240
1313
|
"performance"
|
|
1241
1314
|
];
|
|
1242
1315
|
//#endregion
|
|
1316
|
+
//#region ../commerce/src/utils/assertNever.ts
|
|
1317
|
+
function assertNever$2(value, message) {
|
|
1318
|
+
if (message) throw new Error(message);
|
|
1319
|
+
throw new Error(`Unexpected value: ${String(value)}`);
|
|
1320
|
+
}
|
|
1321
|
+
//#endregion
|
|
1322
|
+
//#region ../commerce/src/purchase/bookingInstalmentSchedule.ts
|
|
1323
|
+
function resolveBookingInitialInstalmentAmountCents(input) {
|
|
1324
|
+
const totalAmountCents = Math.max(0, input.totalAmountCents);
|
|
1325
|
+
switch (input.plan.kind) {
|
|
1326
|
+
case "deposit_plus_one_remainder":
|
|
1327
|
+
case "deposit_plus_scheduled_instalments": return clampConfiguredAmount(input.plan.depositAmountCents, totalAmountCents);
|
|
1328
|
+
case "equal_scheduled_instalments": return splitAmountWithRemainderInFirst(totalAmountCents, input.plan.instalmentCount)[0] ?? 0;
|
|
1329
|
+
default: return assertNever$2(input.plan);
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
function buildBookingInstalmentSchedule(input) {
|
|
1333
|
+
const totalAmountCents = Math.max(0, input.totalAmountCents);
|
|
1334
|
+
switch (input.plan.kind) {
|
|
1335
|
+
case "deposit_plus_one_remainder": {
|
|
1336
|
+
const depositAmountCents = resolveBookingInitialInstalmentAmountCents(input);
|
|
1337
|
+
const remainderAmountCents = Math.max(0, totalAmountCents - depositAmountCents);
|
|
1338
|
+
return omitZeroAmountFutureRows([createScheduleRow({
|
|
1339
|
+
sequence: 1,
|
|
1340
|
+
stateAtBooking: "paid_today",
|
|
1341
|
+
dueAt: input.anchorAt,
|
|
1342
|
+
amountCents: depositAmountCents
|
|
1343
|
+
}), createScheduleRow({
|
|
1344
|
+
sequence: 2,
|
|
1345
|
+
stateAtBooking: "scheduled",
|
|
1346
|
+
dueAt: addIntervalPreservingMonthAnchor(input.anchorAt, input.plan.remainderDueCount, input.plan.intervalUnit),
|
|
1347
|
+
amountCents: remainderAmountCents
|
|
1348
|
+
})]);
|
|
1349
|
+
}
|
|
1350
|
+
case "deposit_plus_scheduled_instalments": {
|
|
1351
|
+
const plan = input.plan;
|
|
1352
|
+
const depositAmountCents = resolveBookingInitialInstalmentAmountCents(input);
|
|
1353
|
+
const instalmentAmounts = splitAmountWithRemainderInFirst(Math.max(0, totalAmountCents - depositAmountCents), plan.instalmentCount);
|
|
1354
|
+
return omitZeroAmountFutureRows([createScheduleRow({
|
|
1355
|
+
sequence: 1,
|
|
1356
|
+
stateAtBooking: "paid_today",
|
|
1357
|
+
dueAt: input.anchorAt,
|
|
1358
|
+
amountCents: depositAmountCents
|
|
1359
|
+
}), ...instalmentAmounts.map((amountCents, index) => createScheduleRow({
|
|
1360
|
+
sequence: index + 2,
|
|
1361
|
+
stateAtBooking: "scheduled",
|
|
1362
|
+
dueAt: addIntervalPreservingMonthAnchor(input.anchorAt, plan.intervalCount * (index + 1), plan.intervalUnit),
|
|
1363
|
+
amountCents
|
|
1364
|
+
}))]);
|
|
1365
|
+
}
|
|
1366
|
+
case "equal_scheduled_instalments": {
|
|
1367
|
+
const plan = input.plan;
|
|
1368
|
+
return omitZeroAmountFutureRows(splitAmountWithRemainderInFirst(totalAmountCents, plan.instalmentCount).map((amountCents, index) => createScheduleRow({
|
|
1369
|
+
sequence: index + 1,
|
|
1370
|
+
stateAtBooking: index === 0 ? "paid_today" : "scheduled",
|
|
1371
|
+
dueAt: index === 0 ? input.anchorAt : addIntervalPreservingMonthAnchor(input.anchorAt, plan.intervalCount * index, plan.intervalUnit),
|
|
1372
|
+
amountCents
|
|
1373
|
+
})));
|
|
1374
|
+
}
|
|
1375
|
+
default: return assertNever$2(input.plan);
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
function createScheduleRow(input) {
|
|
1379
|
+
return {
|
|
1380
|
+
id: `payment-${input.sequence}`,
|
|
1381
|
+
sequence: input.sequence,
|
|
1382
|
+
stateAtBooking: input.stateAtBooking,
|
|
1383
|
+
dueAt: input.dueAt,
|
|
1384
|
+
amountCents: input.amountCents
|
|
1385
|
+
};
|
|
1386
|
+
}
|
|
1387
|
+
//#endregion
|
|
1388
|
+
//#region ../commerce/src/purchase/checkoutPaymentFlow.ts
|
|
1389
|
+
function planCheckoutPaymentFlow(options) {
|
|
1390
|
+
const amountDueCents = toNonNegativeCents(options.amountDueCents);
|
|
1391
|
+
const discountCents = toNonNegativeCents(options.discountCents);
|
|
1392
|
+
const availableCreditCents = toNonNegativeCents(options.availableCreditCents);
|
|
1393
|
+
const minimumStripeChargeCents = toNonNegativeCents(options.minimumStripeChargeCents ?? 0);
|
|
1394
|
+
if (amountDueCents <= 0) return {
|
|
1395
|
+
kind: "bypass",
|
|
1396
|
+
bypassReason: discountCents > 0 ? "discount_free" : "free",
|
|
1397
|
+
reserveCreditCents: 0
|
|
1398
|
+
};
|
|
1399
|
+
if (!options.creditCurrencyMatches || availableCreditCents <= 0) return {
|
|
1400
|
+
kind: "stripe",
|
|
1401
|
+
reserveCreditCents: toNonNegativeCents(0)
|
|
1402
|
+
};
|
|
1403
|
+
if (availableCreditCents >= amountDueCents) return {
|
|
1404
|
+
kind: "store_credit_only",
|
|
1405
|
+
reserveCreditCents: amountDueCents
|
|
1406
|
+
};
|
|
1407
|
+
return {
|
|
1408
|
+
kind: "stripe",
|
|
1409
|
+
reserveCreditCents: planMixedPaymentCreditReservation({
|
|
1410
|
+
amountDueCents,
|
|
1411
|
+
availableCreditCents,
|
|
1412
|
+
minimumStripeChargeCents
|
|
1413
|
+
})
|
|
1414
|
+
};
|
|
1415
|
+
}
|
|
1416
|
+
function planMixedPaymentCreditReservation(input) {
|
|
1417
|
+
const chargeAfterFullCredit = input.amountDueCents - input.availableCreditCents;
|
|
1418
|
+
if (input.minimumStripeChargeCents <= 0 || chargeAfterFullCredit <= 0 || chargeAfterFullCredit >= input.minimumStripeChargeCents) return input.availableCreditCents;
|
|
1419
|
+
if (input.amountDueCents < input.minimumStripeChargeCents) return toNonNegativeCents(0);
|
|
1420
|
+
return toNonNegativeCents(input.amountDueCents - input.minimumStripeChargeCents);
|
|
1421
|
+
}
|
|
1422
|
+
/**
|
|
1423
|
+
* Apply site credit to a flexible-balance booking before card payment.
|
|
1424
|
+
*
|
|
1425
|
+
* Credit first reduces the configured payment due now. Once that payment is
|
|
1426
|
+
* covered, any remaining credit reduces the later balance. If a partial credit
|
|
1427
|
+
* application would leave a positive card charge below Stripe's minimum, less
|
|
1428
|
+
* credit is used so the configured payment can still be collected.
|
|
1429
|
+
*/
|
|
1430
|
+
function planFlexibleBalanceCreditFirst(input) {
|
|
1431
|
+
const totalCents = toNonNegativeCents(input.totalAfterDiscountCents);
|
|
1432
|
+
const configuredDueNowCents = toNonNegativeCents(Math.min(input.configuredPaymentDueNowCents, totalCents));
|
|
1433
|
+
const availableCreditCents = toNonNegativeCents(input.creditCurrencyMatches ? input.availableCreditCents : 0);
|
|
1434
|
+
const minimumStripeChargeCents = toNonNegativeCents(input.minimumStripeChargeCents ?? 0);
|
|
1435
|
+
if (availableCreditCents >= totalCents && totalCents > 0) return {
|
|
1436
|
+
kind: "credit_only",
|
|
1437
|
+
reserveCreditCents: totalCents,
|
|
1438
|
+
cardDueNowCents: toNonNegativeCents(0),
|
|
1439
|
+
laterBalanceCents: toNonNegativeCents(0)
|
|
1440
|
+
};
|
|
1441
|
+
let reserveCreditCents = toNonNegativeCents(Math.min(availableCreditCents, totalCents));
|
|
1442
|
+
if (reserveCreditCents >= configuredDueNowCents) return {
|
|
1443
|
+
kind: "flexible_balance",
|
|
1444
|
+
reserveCreditCents,
|
|
1445
|
+
cardDueNowCents: toNonNegativeCents(0),
|
|
1446
|
+
laterBalanceCents: toNonNegativeCents(totalCents - reserveCreditCents)
|
|
1447
|
+
};
|
|
1448
|
+
const plannedCardDueNowCents = toNonNegativeCents(configuredDueNowCents - reserveCreditCents);
|
|
1449
|
+
if (plannedCardDueNowCents > 0 && plannedCardDueNowCents < minimumStripeChargeCents) {
|
|
1450
|
+
if (configuredDueNowCents < minimumStripeChargeCents) return {
|
|
1451
|
+
kind: "card_below_minimum",
|
|
1452
|
+
reserveCreditCents: toNonNegativeCents(0),
|
|
1453
|
+
cardDueNowCents: configuredDueNowCents,
|
|
1454
|
+
laterBalanceCents: toNonNegativeCents(totalCents - configuredDueNowCents)
|
|
1455
|
+
};
|
|
1456
|
+
reserveCreditCents = toNonNegativeCents(configuredDueNowCents - minimumStripeChargeCents);
|
|
1457
|
+
}
|
|
1458
|
+
const cardDueNowCents = toNonNegativeCents(configuredDueNowCents - reserveCreditCents);
|
|
1459
|
+
return {
|
|
1460
|
+
kind: "flexible_balance",
|
|
1461
|
+
reserveCreditCents,
|
|
1462
|
+
cardDueNowCents,
|
|
1463
|
+
laterBalanceCents: toNonNegativeCents(totalCents - reserveCreditCents - cardDueNowCents)
|
|
1464
|
+
};
|
|
1465
|
+
}
|
|
1466
|
+
//#endregion
|
|
1467
|
+
//#region ../commerce/src/purchase/settlement.ts
|
|
1468
|
+
function normalizeCurrencyCode(raw) {
|
|
1469
|
+
const normalized = raw.trim().toUpperCase();
|
|
1470
|
+
if (!/^[A-Z]{3}$/.test(normalized)) throw new Error(`Invalid currency code: ${raw}`);
|
|
1471
|
+
return normalized;
|
|
1472
|
+
}
|
|
1473
|
+
//#endregion
|
|
1474
|
+
//#region ../commerce/src/purchase/checkoutSessionMetadata.ts
|
|
1475
|
+
const datedOfferingSharedEngineMetadataShape = {
|
|
1476
|
+
datedOfferingEngineContractVersion: z.literal("shared_v1"),
|
|
1477
|
+
datedOfferingEngineRouteKind: z.literal("shared_whole_series_registration"),
|
|
1478
|
+
datedOfferingCapacityHoldId: z.string().uuid(),
|
|
1479
|
+
datedOfferingCapacityHoldAuditRef: z.string().uuid(),
|
|
1480
|
+
customerId: z.string().uuid(),
|
|
1481
|
+
eventSeriesId: z.string().uuid()
|
|
1482
|
+
};
|
|
1483
|
+
z.object(datedOfferingSharedEngineMetadataShape);
|
|
1484
|
+
const orderCheckoutSessionMetadataBaseShape = {
|
|
1485
|
+
type: z.literal("order"),
|
|
1486
|
+
site_id: z.string().uuid(),
|
|
1487
|
+
order_id: z.string().uuid().optional(),
|
|
1488
|
+
customer_email: z.string().email().optional(),
|
|
1489
|
+
customer_name: z.string().optional(),
|
|
1490
|
+
product_id: z.string().uuid().optional(),
|
|
1491
|
+
attendee_id: z.string().uuid().optional(),
|
|
1492
|
+
occurrence_id: z.string().uuid().optional(),
|
|
1493
|
+
tickets_count: z.string().optional(),
|
|
1494
|
+
notes: z.string().optional(),
|
|
1495
|
+
discount_redemption_id: z.string().uuid().optional(),
|
|
1496
|
+
discount_code_id: z.string().uuid().optional(),
|
|
1497
|
+
discount_code: z.string().optional(),
|
|
1498
|
+
discount_public_label: z.string().optional(),
|
|
1499
|
+
credit_reservation_id: z.string().uuid().optional(),
|
|
1500
|
+
credit_reserved_cents: z.string().optional(),
|
|
1501
|
+
discount_code_amount_cents: z.string().optional(),
|
|
1502
|
+
order_payment_reason: z.enum([
|
|
1503
|
+
"instalment_payoff",
|
|
1504
|
+
"flexible_balance_initial",
|
|
1505
|
+
"flexible_balance_paydown"
|
|
1506
|
+
]).optional(),
|
|
1507
|
+
order_payment_plan_id: z.string().uuid().optional(),
|
|
1508
|
+
order_flexible_balance_contract_id: z.string().uuid().optional()
|
|
1509
|
+
};
|
|
1510
|
+
const absentDatedOfferingSharedEngineMetadataShape = {
|
|
1511
|
+
datedOfferingEngineContractVersion: z.never().optional(),
|
|
1512
|
+
datedOfferingEngineRouteKind: z.never().optional(),
|
|
1513
|
+
datedOfferingCapacityHoldId: z.never().optional(),
|
|
1514
|
+
datedOfferingCapacityHoldAuditRef: z.never().optional(),
|
|
1515
|
+
customerId: z.never().optional(),
|
|
1516
|
+
eventSeriesId: z.never().optional()
|
|
1517
|
+
};
|
|
1518
|
+
const LegacyOrderCheckoutSessionMetadataSchema = z.object({
|
|
1519
|
+
...orderCheckoutSessionMetadataBaseShape,
|
|
1520
|
+
...absentDatedOfferingSharedEngineMetadataShape
|
|
1521
|
+
});
|
|
1522
|
+
const SharedDatedOfferingOrderCheckoutSessionMetadataSchema = z.object({
|
|
1523
|
+
...orderCheckoutSessionMetadataBaseShape,
|
|
1524
|
+
...datedOfferingSharedEngineMetadataShape
|
|
1525
|
+
});
|
|
1526
|
+
z.union([SharedDatedOfferingOrderCheckoutSessionMetadataSchema, LegacyOrderCheckoutSessionMetadataSchema]);
|
|
1527
|
+
//#endregion
|
|
1528
|
+
//#region ../commerce/src/purchase/stripeCommissionMetadata.ts
|
|
1529
|
+
/** Reasons are payment evidence, not an independent pricing policy. */
|
|
1530
|
+
const STRIPE_COMMISSION_FREE_REASONS = [
|
|
1531
|
+
"managed_billing",
|
|
1532
|
+
"no_commission_plan",
|
|
1533
|
+
"billing_evidence_invalid",
|
|
1534
|
+
"fee_rounds_to_zero",
|
|
1535
|
+
"payment_not_stripe"
|
|
1536
|
+
];
|
|
1537
|
+
const historicalContext = {
|
|
1538
|
+
currency: z.string().refine((value) => parseCurrencyCode(value) !== null).optional(),
|
|
1539
|
+
sourcePlanId: z.string().trim().min(1).optional()
|
|
1540
|
+
};
|
|
1541
|
+
const percentSchema = z.number().finite().min(0).max(100);
|
|
1542
|
+
z.discriminatedUnion("kind", [
|
|
1543
|
+
z.object({
|
|
1544
|
+
kind: z.literal("commission_free"),
|
|
1545
|
+
reason: z.enum(STRIPE_COMMISSION_FREE_REASONS),
|
|
1546
|
+
...historicalContext
|
|
1547
|
+
}),
|
|
1548
|
+
z.object({
|
|
1549
|
+
kind: z.literal("application_fee_amount"),
|
|
1550
|
+
amountCents: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
1551
|
+
percent: percentSchema,
|
|
1552
|
+
...historicalContext
|
|
1553
|
+
}),
|
|
1554
|
+
z.object({
|
|
1555
|
+
kind: z.literal("application_fee_percent"),
|
|
1556
|
+
percent: percentSchema,
|
|
1557
|
+
...historicalContext
|
|
1558
|
+
})
|
|
1559
|
+
]);
|
|
1560
|
+
toNonNegativeCents(0);
|
|
1561
|
+
//#endregion
|
|
1562
|
+
//#region ../commerce/src/purchase/stripeMinimumCharge.ts
|
|
1563
|
+
const STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY = {
|
|
1564
|
+
GBP: 30,
|
|
1565
|
+
USD: 50,
|
|
1566
|
+
EUR: 50,
|
|
1567
|
+
AED: 200,
|
|
1568
|
+
AUD: 50,
|
|
1569
|
+
BGN: 100,
|
|
1570
|
+
BRL: 50,
|
|
1571
|
+
CAD: 50,
|
|
1572
|
+
CHF: 50,
|
|
1573
|
+
CZK: 1500,
|
|
1574
|
+
DKK: 250,
|
|
1575
|
+
HKD: 400,
|
|
1576
|
+
HUF: 17500,
|
|
1577
|
+
JPY: 50,
|
|
1578
|
+
MXN: 1e3,
|
|
1579
|
+
MYR: 200,
|
|
1580
|
+
NOK: 300,
|
|
1581
|
+
NZD: 50,
|
|
1582
|
+
PLN: 200,
|
|
1583
|
+
RON: 200,
|
|
1584
|
+
SEK: 300,
|
|
1585
|
+
SGD: 50,
|
|
1586
|
+
THB: 1e3
|
|
1587
|
+
};
|
|
1588
|
+
function isStripeMinimumChargeCurrency(currency) {
|
|
1589
|
+
return currency in STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY;
|
|
1590
|
+
}
|
|
1591
|
+
function getStripeMinimumChargeRequirement(rawCurrency) {
|
|
1592
|
+
let currency;
|
|
1593
|
+
try {
|
|
1594
|
+
currency = normalizeCurrencyCode(rawCurrency);
|
|
1595
|
+
} catch {
|
|
1596
|
+
return null;
|
|
1597
|
+
}
|
|
1598
|
+
const currencyKey = currency;
|
|
1599
|
+
if (!isStripeMinimumChargeCurrency(currencyKey)) return null;
|
|
1600
|
+
return {
|
|
1601
|
+
currency,
|
|
1602
|
+
minimumAmountCents: STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY[currencyKey]
|
|
1603
|
+
};
|
|
1604
|
+
}
|
|
1605
|
+
//#endregion
|
|
1606
|
+
//#region ../commerce/src/purchase/checkoutCopy.ts
|
|
1607
|
+
/**
|
|
1608
|
+
* Customer copy shared by checkout surfaces, so one approved wording reaches
|
|
1609
|
+
* every place that shows it.
|
|
1610
|
+
*/
|
|
1611
|
+
const checkoutCopy = {
|
|
1612
|
+
/** A payment is still being confirmed; checking again is safe. */
|
|
1613
|
+
checkoutStillConfirming: "We’re still confirming your payment. This can take a minute – you can check again, and you won’t be charged twice.",
|
|
1614
|
+
/** A previous attempt can't be confirmed automatically; the business needs to check it. */
|
|
1615
|
+
checkoutAssistanceRequired: "We can’t confirm your last payment attempt yet. Please don’t pay again – contact the business so they can check it."
|
|
1616
|
+
};
|
|
1617
|
+
//#endregion
|
|
1618
|
+
//#region ../commerce/src/purchase/event-registration-errors.ts
|
|
1619
|
+
const eventRegistrationErrors = {
|
|
1620
|
+
registrationClosed: {
|
|
1621
|
+
message: "Booking is currently closed for this event. Please contact the organiser if you’d like to find out more.",
|
|
1622
|
+
action: "none"
|
|
1623
|
+
},
|
|
1624
|
+
paymentInvestigationRequired: {
|
|
1625
|
+
message: "We still can’t confirm your payment. Please don’t make another payment. Contact the organiser so they can check your booking.",
|
|
1626
|
+
action: "none"
|
|
1627
|
+
},
|
|
1628
|
+
paymentProviderUnavailable: {
|
|
1629
|
+
message: "We couldn’t reach the payment provider. Please try again in a minute.",
|
|
1630
|
+
action: "retry"
|
|
1631
|
+
},
|
|
1632
|
+
paymentHostUnavailable: {
|
|
1633
|
+
message: "Card payments aren’t available on this web address yet. Please contact the organiser to book.",
|
|
1634
|
+
action: "none"
|
|
1635
|
+
},
|
|
1636
|
+
checkoutTemporarilyUnavailable: {
|
|
1637
|
+
message: "Event payments are temporarily unavailable while we make an update. Please try again later.",
|
|
1638
|
+
action: "retry"
|
|
1639
|
+
},
|
|
1640
|
+
paymentPageUnavailable: {
|
|
1641
|
+
message: "We couldn’t open the payment page. Please refresh this page and try again. If this keeps happening, contact the organiser for help.",
|
|
1642
|
+
action: "retry"
|
|
1643
|
+
},
|
|
1644
|
+
paymentUnavailable: {
|
|
1645
|
+
message: "Online payment is not available for this event right now. Please contact the organiser for help with booking.",
|
|
1646
|
+
action: "none"
|
|
1647
|
+
},
|
|
1648
|
+
capacityChanged: {
|
|
1649
|
+
message: "Sorry, there aren’t enough places left for your selection. Please check the available places and choose again.",
|
|
1650
|
+
action: "places"
|
|
1651
|
+
},
|
|
1652
|
+
selectionChanged: {
|
|
1653
|
+
message: "The booking options for this event have changed. Please check the latest options and choose your places again.",
|
|
1654
|
+
action: "places"
|
|
1655
|
+
},
|
|
1656
|
+
registrationPreparationChanged: {
|
|
1657
|
+
message: "The booking options for this event have changed. Please check the latest options and choose your places again.",
|
|
1658
|
+
action: "places"
|
|
1659
|
+
},
|
|
1660
|
+
registrationAlreadyExists: {
|
|
1661
|
+
message: "You already have a booking for this event. Please check your bookings to see its status. If you need help, contact the organiser.",
|
|
1662
|
+
action: "portal"
|
|
1663
|
+
},
|
|
1664
|
+
holdExpired: {
|
|
1665
|
+
message: "Your reservation has timed out. Please check availability and choose your places again.",
|
|
1666
|
+
action: "start"
|
|
1667
|
+
},
|
|
1668
|
+
waitlistUnavailable: {
|
|
1669
|
+
message: "Sorry, the waiting list place offered in this invitation is no longer available. Please check the event for available places or contact the organiser for help.",
|
|
1670
|
+
action: "event"
|
|
1671
|
+
},
|
|
1672
|
+
paymentContextMismatch: {
|
|
1673
|
+
message: "The payment options for this event have changed. Please check the latest options before continuing.",
|
|
1674
|
+
action: "payment-options"
|
|
1675
|
+
},
|
|
1676
|
+
verificationFailed: {
|
|
1677
|
+
message: "We couldn’t confirm this request came from a person. Please refresh the page and try again.",
|
|
1678
|
+
action: "none"
|
|
1679
|
+
},
|
|
1680
|
+
idempotencyConflict: {
|
|
1681
|
+
message: "You’ve already started booking this event. Please finish in the other tab if it’s still open, or check your booking status before starting again.",
|
|
1682
|
+
action: "portal"
|
|
1683
|
+
},
|
|
1684
|
+
invalidCommitInput: {
|
|
1685
|
+
message: "We couldn’t accept your booking details. Please check the information you entered and try again. If this keeps happening, contact the organiser for help.",
|
|
1686
|
+
action: "details"
|
|
1687
|
+
}
|
|
1688
|
+
};
|
|
1689
|
+
function parseEventRegistrationErrorReason(value) {
|
|
1690
|
+
return typeof value === "string" && Object.prototype.hasOwnProperty.call(eventRegistrationErrors, value) ? value : null;
|
|
1691
|
+
}
|
|
1692
|
+
//#endregion
|
|
1693
|
+
//#region ../commerce/src/purchase/checkoutPresentation.ts
|
|
1694
|
+
function publishableKeyMode(publishableKey) {
|
|
1695
|
+
if (publishableKey.startsWith("pk_live_")) return "live";
|
|
1696
|
+
if (publishableKey.startsWith("pk_test_")) return "test";
|
|
1697
|
+
return null;
|
|
1698
|
+
}
|
|
1699
|
+
function checkBrowserStripeKey(publishableKey, livemode) {
|
|
1700
|
+
const key = publishableKey?.trim();
|
|
1701
|
+
if (!key) return {
|
|
1702
|
+
tag: "unavailable",
|
|
1703
|
+
reason: "missing_key"
|
|
1704
|
+
};
|
|
1705
|
+
const mode = publishableKeyMode(key);
|
|
1706
|
+
if (mode === null) return {
|
|
1707
|
+
tag: "unavailable",
|
|
1708
|
+
reason: "invalid_key"
|
|
1709
|
+
};
|
|
1710
|
+
return mode === (livemode ? "live" : "test") ? {
|
|
1711
|
+
tag: "ready",
|
|
1712
|
+
publishableKey: key
|
|
1713
|
+
} : {
|
|
1714
|
+
tag: "unavailable",
|
|
1715
|
+
reason: "mode_mismatch"
|
|
1716
|
+
};
|
|
1717
|
+
}
|
|
1718
|
+
//#endregion
|
|
1243
1719
|
//#region ../blocks/src/contracts/runtime.ts
|
|
1244
1720
|
function decodeSuccess(value) {
|
|
1245
1721
|
return {
|
|
@@ -1592,7 +2068,7 @@ function resolveAppointmentCheckoutVerificationState(input) {
|
|
|
1592
2068
|
tag: "timeout",
|
|
1593
2069
|
sessionId: input.config.sessionId,
|
|
1594
2070
|
appointmentId,
|
|
1595
|
-
message:
|
|
2071
|
+
message: checkoutCopy.checkoutStillConfirming
|
|
1596
2072
|
};
|
|
1597
2073
|
if (input.pollingStatus === "failed") {
|
|
1598
2074
|
if (paymentStatus === "refunded") return {
|
|
@@ -2718,125 +3194,110 @@ function validateUniqueDeclaredCardVariantRoles(system, ctx) {
|
|
|
2718
3194
|
}
|
|
2719
3195
|
const cardSystemSchema = z.object({ variants: z.array(cardVariantSchema).min(1).max(3) }).superRefine(validateUniqueDeclaredCardVariantRoles).transform((system) => ({ variants: withInferredRoles(system.variants) }));
|
|
2720
3196
|
//#endregion
|
|
2721
|
-
//#region ../theme-core/src/
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
const
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
z.literal(180),
|
|
2739
|
-
z.literal(270)
|
|
2740
|
-
]);
|
|
2741
|
-
const rectSchema = z.tuple([
|
|
2742
|
-
z.number(),
|
|
2743
|
-
z.number(),
|
|
2744
|
-
z.number(),
|
|
2745
|
-
z.number()
|
|
2746
|
-
]);
|
|
2747
|
-
const aspectCropSchema = z.object({
|
|
2748
|
-
aspect: z.preprocess((value) => value == null ? void 0 : value, z.string().optional()),
|
|
2749
|
-
rect: z.preprocess((value) => value == null ? void 0 : value, rectSchema.optional()),
|
|
2750
|
-
hotspot: z.preprocess((value) => value == null ? void 0 : value, hotspotSchema.optional()),
|
|
2751
|
-
rotation: z.preprocess((value) => value == null ? void 0 : value, rotationSchema.optional())
|
|
2752
|
-
});
|
|
2753
|
-
const transformSchema = z.object({
|
|
2754
|
-
aspectCrops: z.preprocess((value) => {
|
|
2755
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return;
|
|
2756
|
-
return value;
|
|
2757
|
-
}, z.record(z.string(), aspectCropSchema.catch({}))).optional(),
|
|
2758
|
-
rect: rectSchema.optional(),
|
|
2759
|
-
hotspot: hotspotSchema.optional(),
|
|
2760
|
-
rotation: rotationSchema.optional()
|
|
2761
|
-
});
|
|
2762
|
-
const mediaPosterSchema = z.discriminatedUnion("tag", [z.object({
|
|
2763
|
-
tag: z.literal("storage"),
|
|
2764
|
-
assetId: z.string().optional(),
|
|
2765
|
-
storageBucket: z.string().min(1),
|
|
2766
|
-
storagePath: z.string().min(1)
|
|
2767
|
-
}), z.object({
|
|
2768
|
-
tag: z.literal("external-src"),
|
|
2769
|
-
assetId: z.string().optional(),
|
|
2770
|
-
src: z.string().url()
|
|
2771
|
-
})]);
|
|
2772
|
-
const mediaBaseSchema = z.object({
|
|
2773
|
-
purpose: z.string().optional(),
|
|
2774
|
-
placeholder: z.boolean().default(true).optional(),
|
|
2775
|
-
assetId: z.string().optional(),
|
|
2776
|
-
identifier: z.string().optional(),
|
|
2777
|
-
src: z.string().optional(),
|
|
2778
|
-
alt: z.string().optional(),
|
|
2779
|
-
filename: z.string().optional(),
|
|
2780
|
-
mimeType: z.string().optional(),
|
|
2781
|
-
width: z.number().optional(),
|
|
2782
|
-
height: z.number().optional(),
|
|
2783
|
-
storageBucket: z.string().optional(),
|
|
2784
|
-
storagePath: z.string().optional(),
|
|
2785
|
-
poster: mediaPosterSchema.optional(),
|
|
2786
|
-
transform: transformSchema.optional()
|
|
2787
|
-
});
|
|
2788
|
-
const mediaIdentifierSchema = z.string().trim().min(1).brand();
|
|
2789
|
-
const imageMediaSchema = mediaBaseSchema.extend({ type: z.literal("image") });
|
|
2790
|
-
const videoMediaSchema = mediaBaseSchema.extend({ type: z.literal("video") });
|
|
2791
|
-
const audioMediaSchema = mediaBaseSchema.extend({ type: z.literal("audio") });
|
|
2792
|
-
const documentMediaSchema = mediaBaseSchema.extend({ type: z.literal("document") });
|
|
2793
|
-
const spreadsheetMediaSchema = mediaBaseSchema.extend({ type: z.literal("spreadsheet") });
|
|
2794
|
-
const archiveMediaSchema = mediaBaseSchema.extend({ type: z.literal("archive") });
|
|
2795
|
-
const mediaSchema = z.discriminatedUnion("type", [
|
|
2796
|
-
imageMediaSchema,
|
|
2797
|
-
videoMediaSchema,
|
|
2798
|
-
audioMediaSchema,
|
|
2799
|
-
documentMediaSchema,
|
|
2800
|
-
spreadsheetMediaSchema,
|
|
2801
|
-
archiveMediaSchema
|
|
3197
|
+
//#region ../theme-core/src/utils/tokenOrColor.ts
|
|
3198
|
+
/**
|
|
3199
|
+
* Runtime color-reference fields intentionally accept any string, including
|
|
3200
|
+
* the legacy empty-string "no color" sentinel. Semantic validation needs
|
|
3201
|
+
* palette context and happens in `parseThemeColorReference`.
|
|
3202
|
+
*/
|
|
3203
|
+
const tokenOrCssColorValueSchema = z.string();
|
|
3204
|
+
const CSS_COLOR_FUNCTION_PATTERN = /^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|light-dark)\(/i;
|
|
3205
|
+
const CSS_HEX_COLOR_PATTERN = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
|
|
3206
|
+
const CSS_COLOR_KEYWORDS = /* @__PURE__ */ new Set([
|
|
3207
|
+
"transparent",
|
|
3208
|
+
"currentcolor",
|
|
3209
|
+
"inherit",
|
|
3210
|
+
"initial",
|
|
3211
|
+
"revert",
|
|
3212
|
+
"revert-layer",
|
|
3213
|
+
"unset"
|
|
2802
3214
|
]);
|
|
2803
|
-
const
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
3215
|
+
const COMMON_CSS_NAMED_COLORS = /* @__PURE__ */ new Set([
|
|
3216
|
+
"black",
|
|
3217
|
+
"blue",
|
|
3218
|
+
"gray",
|
|
3219
|
+
"green",
|
|
3220
|
+
"grey",
|
|
3221
|
+
"orange",
|
|
3222
|
+
"pink",
|
|
3223
|
+
"purple",
|
|
3224
|
+
"red",
|
|
3225
|
+
"white",
|
|
3226
|
+
"yellow"
|
|
2811
3227
|
]);
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
const
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
}
|
|
2824
|
-
const
|
|
2825
|
-
|
|
2826
|
-
ctx.addIssue({
|
|
2827
|
-
code: "custom",
|
|
2828
|
-
message: `Invalid complete palette: ${colors.error.kind}`
|
|
2829
|
-
});
|
|
2830
|
-
return z.NEVER;
|
|
2831
|
-
}
|
|
3228
|
+
function isCssColorLiteral(value) {
|
|
3229
|
+
const trimmed = value.trim();
|
|
3230
|
+
if (!trimmed) return false;
|
|
3231
|
+
return CSS_HEX_COLOR_PATTERN.test(trimmed) || CSS_COLOR_FUNCTION_PATTERN.test(trimmed) || /^var\(/i.test(trimmed) || CSS_COLOR_KEYWORDS.has(trimmed.toLowerCase());
|
|
3232
|
+
}
|
|
3233
|
+
function parseThemeToken(token) {
|
|
3234
|
+
const trimmed = token.trim();
|
|
3235
|
+
const match = trimmed.match(/^(.*?)-(\d{2,3})$/);
|
|
3236
|
+
if (!match) return {
|
|
3237
|
+
role: trimmed,
|
|
3238
|
+
shade: null
|
|
3239
|
+
};
|
|
3240
|
+
const role = match[1] ?? trimmed;
|
|
3241
|
+
const shade = match[2] ? Number(match[2]) : null;
|
|
2832
3242
|
return {
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
hex: String(hex)
|
|
2836
|
-
})),
|
|
2837
|
-
meta: palette.meta
|
|
3243
|
+
role,
|
|
3244
|
+
shade: Number.isFinite(shade) ? shade : null
|
|
2838
3245
|
};
|
|
2839
|
-
}
|
|
3246
|
+
}
|
|
3247
|
+
function parseContextThemeColorToken(value, context) {
|
|
3248
|
+
const parts = parseColorTokenParts(value);
|
|
3249
|
+
if (parts.kind !== "token") return null;
|
|
3250
|
+
if (!(Boolean(context?.palette?.[value.trim()]) || parts.opacityPercent !== null && Boolean(context?.palette?.[parts.token]))) return null;
|
|
3251
|
+
return value.trim();
|
|
3252
|
+
}
|
|
3253
|
+
function isTokenShapedTypo(value) {
|
|
3254
|
+
if (COMMON_CSS_NAMED_COLORS.has(value.toLowerCase())) return false;
|
|
3255
|
+
if (!/^[a-zA-Z][a-zA-Z0-9]*(?:-[a-zA-Z0-9]+)*(?:\/[^/]+)?$/.test(value)) return false;
|
|
3256
|
+
return !isCssColorLiteral(value);
|
|
3257
|
+
}
|
|
3258
|
+
function warnUnknownThemeColorReference(value) {
|
|
3259
|
+
if (!isTokenShapedTypo(value)) return;
|
|
3260
|
+
console.warn(`[theme-core] Unknown Theme V2 color token "${value}" treated as literal CSS. Use raw:* for deliberate custom CSS values.`);
|
|
3261
|
+
}
|
|
3262
|
+
function parseThemeColorReference(input, context) {
|
|
3263
|
+
const trimmed = input.trim();
|
|
3264
|
+
if (trimmed.startsWith("raw:")) return {
|
|
3265
|
+
kind: "literal-css",
|
|
3266
|
+
value: trimmed.slice(4)
|
|
3267
|
+
};
|
|
3268
|
+
const contextToken = parseContextThemeColorToken(trimmed, context);
|
|
3269
|
+
if (contextToken) return {
|
|
3270
|
+
kind: "palette-context-token",
|
|
3271
|
+
token: contextToken
|
|
3272
|
+
};
|
|
3273
|
+
const knownToken = parseThemeColorToken(trimmed);
|
|
3274
|
+
if (knownToken) return {
|
|
3275
|
+
kind: "theme-token",
|
|
3276
|
+
token: knownToken
|
|
3277
|
+
};
|
|
3278
|
+
warnUnknownThemeColorReference(trimmed);
|
|
3279
|
+
return {
|
|
3280
|
+
kind: "literal-css",
|
|
3281
|
+
value: trimmed
|
|
3282
|
+
};
|
|
3283
|
+
}
|
|
3284
|
+
function resolveThemeColorReferenceValue(input, context) {
|
|
3285
|
+
const reference = parseThemeColorReference(input, context);
|
|
3286
|
+
return reference.kind === "literal-css" ? reference.value : rgbColorValue(reference.token);
|
|
3287
|
+
}
|
|
3288
|
+
function resolveTokenOrCssColorValue(input, context) {
|
|
3289
|
+
return resolveThemeColorReferenceValue(input, context);
|
|
3290
|
+
}
|
|
3291
|
+
function resolveOnColorForThemeToken(token) {
|
|
3292
|
+
if (!parseThemeColorToken(token)) return null;
|
|
3293
|
+
const parts = parseColorTokenParts(token);
|
|
3294
|
+
if (parts.kind !== "token") return null;
|
|
3295
|
+
const { role, shade } = parseThemeToken(parts.token);
|
|
3296
|
+
const normalizedRole = role.trim();
|
|
3297
|
+
if (!normalizedRole) return null;
|
|
3298
|
+
if (!shade) return rgbColorValue(`on${normalizedRole.charAt(0).toUpperCase() + normalizedRole.slice(1)}`);
|
|
3299
|
+
return shade <= 400 ? "#000000" : "#FFFFFF";
|
|
3300
|
+
}
|
|
2840
3301
|
//#endregion
|
|
2841
3302
|
//#region ../theme-core/src/buttons/types.ts
|
|
2842
3303
|
/**
|
|
@@ -3244,6 +3705,126 @@ const buttonSystemSchema = z.strictObject({
|
|
|
3244
3705
|
});
|
|
3245
3706
|
});
|
|
3246
3707
|
//#endregion
|
|
3708
|
+
//#region ../theme-core/src/footer/mode.ts
|
|
3709
|
+
const footerModeSchema = z.enum([
|
|
3710
|
+
"default",
|
|
3711
|
+
"blocks",
|
|
3712
|
+
"default+blocks",
|
|
3713
|
+
"none"
|
|
3714
|
+
]);
|
|
3715
|
+
//#endregion
|
|
3716
|
+
//#region ../theme-core/src/lib/media.ts
|
|
3717
|
+
const hotspotSchema = z.object({
|
|
3718
|
+
x: z.number().min(0).max(1),
|
|
3719
|
+
y: z.number().min(0).max(1),
|
|
3720
|
+
radius: z.number().optional()
|
|
3721
|
+
});
|
|
3722
|
+
const rotationSchema = z.union([
|
|
3723
|
+
z.literal(0),
|
|
3724
|
+
z.literal(90),
|
|
3725
|
+
z.literal(180),
|
|
3726
|
+
z.literal(270)
|
|
3727
|
+
]);
|
|
3728
|
+
const rectSchema = z.tuple([
|
|
3729
|
+
z.number(),
|
|
3730
|
+
z.number(),
|
|
3731
|
+
z.number(),
|
|
3732
|
+
z.number()
|
|
3733
|
+
]);
|
|
3734
|
+
const aspectCropSchema = z.object({
|
|
3735
|
+
aspect: z.preprocess((value) => value == null ? void 0 : value, z.string().optional()),
|
|
3736
|
+
rect: z.preprocess((value) => value == null ? void 0 : value, rectSchema.optional()),
|
|
3737
|
+
hotspot: z.preprocess((value) => value == null ? void 0 : value, hotspotSchema.optional()),
|
|
3738
|
+
rotation: z.preprocess((value) => value == null ? void 0 : value, rotationSchema.optional())
|
|
3739
|
+
});
|
|
3740
|
+
const transformSchema = z.object({
|
|
3741
|
+
aspectCrops: z.preprocess((value) => {
|
|
3742
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return;
|
|
3743
|
+
return value;
|
|
3744
|
+
}, z.record(z.string(), aspectCropSchema.catch({}))).optional(),
|
|
3745
|
+
rect: rectSchema.optional(),
|
|
3746
|
+
hotspot: hotspotSchema.optional(),
|
|
3747
|
+
rotation: rotationSchema.optional()
|
|
3748
|
+
});
|
|
3749
|
+
const mediaPosterSchema = z.discriminatedUnion("tag", [z.object({
|
|
3750
|
+
tag: z.literal("storage"),
|
|
3751
|
+
assetId: z.string().optional(),
|
|
3752
|
+
storageBucket: z.string().min(1),
|
|
3753
|
+
storagePath: z.string().min(1)
|
|
3754
|
+
}), z.object({
|
|
3755
|
+
tag: z.literal("external-src"),
|
|
3756
|
+
assetId: z.string().optional(),
|
|
3757
|
+
src: z.string().url()
|
|
3758
|
+
})]);
|
|
3759
|
+
const mediaBaseSchema = z.object({
|
|
3760
|
+
purpose: z.string().optional(),
|
|
3761
|
+
placeholder: z.boolean().default(true).optional(),
|
|
3762
|
+
assetId: z.string().optional(),
|
|
3763
|
+
identifier: z.string().optional(),
|
|
3764
|
+
src: z.string().optional(),
|
|
3765
|
+
alt: z.string().optional(),
|
|
3766
|
+
filename: z.string().optional(),
|
|
3767
|
+
mimeType: z.string().optional(),
|
|
3768
|
+
width: z.number().optional(),
|
|
3769
|
+
height: z.number().optional(),
|
|
3770
|
+
storageBucket: z.string().optional(),
|
|
3771
|
+
storagePath: z.string().optional(),
|
|
3772
|
+
poster: mediaPosterSchema.optional(),
|
|
3773
|
+
transform: transformSchema.optional()
|
|
3774
|
+
});
|
|
3775
|
+
const mediaIdentifierSchema = z.string().trim().min(1).brand();
|
|
3776
|
+
const imageMediaSchema = mediaBaseSchema.extend({ type: z.literal("image") });
|
|
3777
|
+
const videoMediaSchema = mediaBaseSchema.extend({ type: z.literal("video") });
|
|
3778
|
+
const audioMediaSchema = mediaBaseSchema.extend({ type: z.literal("audio") });
|
|
3779
|
+
const documentMediaSchema = mediaBaseSchema.extend({ type: z.literal("document") });
|
|
3780
|
+
const spreadsheetMediaSchema = mediaBaseSchema.extend({ type: z.literal("spreadsheet") });
|
|
3781
|
+
const archiveMediaSchema = mediaBaseSchema.extend({ type: z.literal("archive") });
|
|
3782
|
+
const mediaSchema = z.discriminatedUnion("type", [
|
|
3783
|
+
imageMediaSchema,
|
|
3784
|
+
videoMediaSchema,
|
|
3785
|
+
audioMediaSchema,
|
|
3786
|
+
documentMediaSchema,
|
|
3787
|
+
spreadsheetMediaSchema,
|
|
3788
|
+
archiveMediaSchema
|
|
3789
|
+
]);
|
|
3790
|
+
const persistableMediaBaseSchema = mediaBaseSchema.extend({ identifier: mediaIdentifierSchema });
|
|
3791
|
+
z.discriminatedUnion("type", [
|
|
3792
|
+
persistableMediaBaseSchema.extend({ type: z.literal("image") }),
|
|
3793
|
+
persistableMediaBaseSchema.extend({ type: z.literal("video") }),
|
|
3794
|
+
persistableMediaBaseSchema.extend({ type: z.literal("audio") }),
|
|
3795
|
+
persistableMediaBaseSchema.extend({ type: z.literal("document") }),
|
|
3796
|
+
persistableMediaBaseSchema.extend({ type: z.literal("spreadsheet") }),
|
|
3797
|
+
persistableMediaBaseSchema.extend({ type: z.literal("archive") })
|
|
3798
|
+
]);
|
|
3799
|
+
//#endregion
|
|
3800
|
+
//#region ../theme-core/src/palette/schema.ts
|
|
3801
|
+
const colourHexString = z.string().regex(/^#([0-9A-Fa-f]{3}){1,2}$/);
|
|
3802
|
+
const paletteColorSchema = z.object({
|
|
3803
|
+
name: z.string().min(1),
|
|
3804
|
+
hex: colourHexString
|
|
3805
|
+
});
|
|
3806
|
+
const paletteMetaSchema = z.object({ mode: z.enum(["light", "dark"]) });
|
|
3807
|
+
const paletteSchema = z.object({
|
|
3808
|
+
colors: z.array(paletteColorSchema),
|
|
3809
|
+
meta: paletteMetaSchema
|
|
3810
|
+
}).transform((palette, ctx) => {
|
|
3811
|
+
const colors = paletteColorsFromEntries(palette.colors);
|
|
3812
|
+
if (!colors.ok) {
|
|
3813
|
+
ctx.addIssue({
|
|
3814
|
+
code: "custom",
|
|
3815
|
+
message: `Invalid complete palette: ${colors.error.kind}`
|
|
3816
|
+
});
|
|
3817
|
+
return z.NEVER;
|
|
3818
|
+
}
|
|
3819
|
+
return {
|
|
3820
|
+
colors: paletteColorEntries(colors.colors).map(({ name, hex }) => ({
|
|
3821
|
+
name: String(name),
|
|
3822
|
+
hex: String(hex)
|
|
3823
|
+
})),
|
|
3824
|
+
meta: palette.meta
|
|
3825
|
+
};
|
|
3826
|
+
});
|
|
3827
|
+
//#endregion
|
|
3247
3828
|
//#region ../theme-core/src/buttons/classNames.ts
|
|
3248
3829
|
function themeButtonVariantClassNames(variant) {
|
|
3249
3830
|
if (variant === "default") return [variant];
|
|
@@ -3305,111 +3886,6 @@ function shadeBackgroundEffect(config) {
|
|
|
3305
3886
|
}
|
|
3306
3887
|
};
|
|
3307
3888
|
}
|
|
3308
|
-
//#endregion
|
|
3309
|
-
//#region ../theme-core/src/utils/tokenOrColor.ts
|
|
3310
|
-
/**
|
|
3311
|
-
* Runtime color-reference fields intentionally accept any string, including
|
|
3312
|
-
* the legacy empty-string "no color" sentinel. Semantic validation needs
|
|
3313
|
-
* palette context and happens in `parseThemeColorReference`.
|
|
3314
|
-
*/
|
|
3315
|
-
const tokenOrCssColorValueSchema = z.string();
|
|
3316
|
-
const CSS_COLOR_FUNCTION_PATTERN = /^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|light-dark)\(/i;
|
|
3317
|
-
const CSS_HEX_COLOR_PATTERN = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
|
|
3318
|
-
const CSS_COLOR_KEYWORDS = /* @__PURE__ */ new Set([
|
|
3319
|
-
"transparent",
|
|
3320
|
-
"currentcolor",
|
|
3321
|
-
"inherit",
|
|
3322
|
-
"initial",
|
|
3323
|
-
"revert",
|
|
3324
|
-
"revert-layer",
|
|
3325
|
-
"unset"
|
|
3326
|
-
]);
|
|
3327
|
-
const COMMON_CSS_NAMED_COLORS = /* @__PURE__ */ new Set([
|
|
3328
|
-
"black",
|
|
3329
|
-
"blue",
|
|
3330
|
-
"gray",
|
|
3331
|
-
"green",
|
|
3332
|
-
"grey",
|
|
3333
|
-
"orange",
|
|
3334
|
-
"pink",
|
|
3335
|
-
"purple",
|
|
3336
|
-
"red",
|
|
3337
|
-
"white",
|
|
3338
|
-
"yellow"
|
|
3339
|
-
]);
|
|
3340
|
-
function isCssColorLiteral(value) {
|
|
3341
|
-
const trimmed = value.trim();
|
|
3342
|
-
if (!trimmed) return false;
|
|
3343
|
-
return CSS_HEX_COLOR_PATTERN.test(trimmed) || CSS_COLOR_FUNCTION_PATTERN.test(trimmed) || /^var\(/i.test(trimmed) || CSS_COLOR_KEYWORDS.has(trimmed.toLowerCase());
|
|
3344
|
-
}
|
|
3345
|
-
function parseThemeToken(token) {
|
|
3346
|
-
const trimmed = token.trim();
|
|
3347
|
-
const match = trimmed.match(/^(.*?)-(\d{2,3})$/);
|
|
3348
|
-
if (!match) return {
|
|
3349
|
-
role: trimmed,
|
|
3350
|
-
shade: null
|
|
3351
|
-
};
|
|
3352
|
-
const role = match[1] ?? trimmed;
|
|
3353
|
-
const shade = match[2] ? Number(match[2]) : null;
|
|
3354
|
-
return {
|
|
3355
|
-
role,
|
|
3356
|
-
shade: Number.isFinite(shade) ? shade : null
|
|
3357
|
-
};
|
|
3358
|
-
}
|
|
3359
|
-
function parseContextThemeColorToken(value, context) {
|
|
3360
|
-
const parts = parseColorTokenParts(value);
|
|
3361
|
-
if (parts.kind !== "token") return null;
|
|
3362
|
-
if (!(Boolean(context?.palette?.[value.trim()]) || parts.opacityPercent !== null && Boolean(context?.palette?.[parts.token]))) return null;
|
|
3363
|
-
return value.trim();
|
|
3364
|
-
}
|
|
3365
|
-
function isTokenShapedTypo(value) {
|
|
3366
|
-
if (COMMON_CSS_NAMED_COLORS.has(value.toLowerCase())) return false;
|
|
3367
|
-
if (!/^[a-zA-Z][a-zA-Z0-9]*(?:-[a-zA-Z0-9]+)*(?:\/[^/]+)?$/.test(value)) return false;
|
|
3368
|
-
return !isCssColorLiteral(value);
|
|
3369
|
-
}
|
|
3370
|
-
function warnUnknownThemeColorReference(value) {
|
|
3371
|
-
if (!isTokenShapedTypo(value)) return;
|
|
3372
|
-
console.warn(`[theme-core] Unknown Theme V2 color token "${value}" treated as literal CSS. Use raw:* for deliberate custom CSS values.`);
|
|
3373
|
-
}
|
|
3374
|
-
function parseThemeColorReference(input, context) {
|
|
3375
|
-
const trimmed = input.trim();
|
|
3376
|
-
if (trimmed.startsWith("raw:")) return {
|
|
3377
|
-
kind: "literal-css",
|
|
3378
|
-
value: trimmed.slice(4)
|
|
3379
|
-
};
|
|
3380
|
-
const contextToken = parseContextThemeColorToken(trimmed, context);
|
|
3381
|
-
if (contextToken) return {
|
|
3382
|
-
kind: "palette-context-token",
|
|
3383
|
-
token: contextToken
|
|
3384
|
-
};
|
|
3385
|
-
const knownToken = parseThemeColorToken(trimmed);
|
|
3386
|
-
if (knownToken) return {
|
|
3387
|
-
kind: "theme-token",
|
|
3388
|
-
token: knownToken
|
|
3389
|
-
};
|
|
3390
|
-
warnUnknownThemeColorReference(trimmed);
|
|
3391
|
-
return {
|
|
3392
|
-
kind: "literal-css",
|
|
3393
|
-
value: trimmed
|
|
3394
|
-
};
|
|
3395
|
-
}
|
|
3396
|
-
function resolveThemeColorReferenceValue(input, context) {
|
|
3397
|
-
const reference = parseThemeColorReference(input, context);
|
|
3398
|
-
return reference.kind === "literal-css" ? reference.value : rgbColorValue(reference.token);
|
|
3399
|
-
}
|
|
3400
|
-
function resolveTokenOrCssColorValue(input, context) {
|
|
3401
|
-
return resolveThemeColorReferenceValue(input, context);
|
|
3402
|
-
}
|
|
3403
|
-
function resolveOnColorForThemeToken(token) {
|
|
3404
|
-
if (!parseThemeColorToken(token)) return null;
|
|
3405
|
-
const parts = parseColorTokenParts(token);
|
|
3406
|
-
if (parts.kind !== "token") return null;
|
|
3407
|
-
const { role, shade } = parseThemeToken(parts.token);
|
|
3408
|
-
const normalizedRole = role.trim();
|
|
3409
|
-
if (!normalizedRole) return null;
|
|
3410
|
-
if (!shade) return rgbColorValue(`on${normalizedRole.charAt(0).toUpperCase() + normalizedRole.slice(1)}`);
|
|
3411
|
-
return shade <= 400 ? "#000000" : "#FFFFFF";
|
|
3412
|
-
}
|
|
3413
3889
|
buttonSizeNameSchema.options;
|
|
3414
3890
|
//#endregion
|
|
3415
3891
|
//#region ../theme-core/src/buttons/styles/domain.ts
|
|
@@ -6092,12 +6568,22 @@ const mediaPresentationSchema = commonSchema.extend({
|
|
|
6092
6568
|
const boxBackgroundSchema = z.discriminatedUnion("type", [
|
|
6093
6569
|
commonSchema.extend({
|
|
6094
6570
|
type: z.literal("color"),
|
|
6095
|
-
color: tokenOrCssColorValueSchema.nullable().optional()
|
|
6571
|
+
color: tokenOrCssColorValueSchema.nullable().optional(),
|
|
6572
|
+
/**
|
|
6573
|
+
* Compiler-owned. The scrim a site-style colour surface lays over media
|
|
6574
|
+
* that replaces it (a Look's band meeting an authored photo), sized so the
|
|
6575
|
+
* surface's foreground stays legible over any pixel. A colour background
|
|
6576
|
+
* never draws it itself; `resolveSectionBackground` moves it onto the
|
|
6577
|
+
* merged media background as its overlay.
|
|
6578
|
+
*/
|
|
6579
|
+
mediaScrim: boxBackgroundOverlaySchema.nullable().optional()
|
|
6096
6580
|
}),
|
|
6097
6581
|
commonSchema.extend({
|
|
6098
6582
|
type: z.literal("gradient"),
|
|
6099
6583
|
gradient: z.string().nullable().optional(),
|
|
6100
|
-
gradientPresetId: z.string().min(1).nullable().optional()
|
|
6584
|
+
gradientPresetId: z.string().min(1).nullable().optional(),
|
|
6585
|
+
/** Compiler-owned; see the colour branch. */
|
|
6586
|
+
mediaScrim: boxBackgroundOverlaySchema.nullable().optional()
|
|
6101
6587
|
}),
|
|
6102
6588
|
mediaPresentationSchema.extend({
|
|
6103
6589
|
type: z.literal("image"),
|
|
@@ -11025,15 +11511,36 @@ const eventCombinedInteractiveIslandPropsCodec = createInteractiveIslandCodec({
|
|
|
11025
11511
|
});
|
|
11026
11512
|
//#endregion
|
|
11027
11513
|
//#region ../blocks/src/system/runtime/nodes/event-registration/wizardSteps.ts
|
|
11028
|
-
/**
|
|
11029
|
-
|
|
11030
|
-
|
|
11031
|
-
|
|
11032
|
-
|
|
11033
|
-
|
|
11034
|
-
|
|
11035
|
-
|
|
11036
|
-
|
|
11514
|
+
/** Recovery uses the form surface without adding a progress step. */
|
|
11515
|
+
function getRegistrationStepPresentation(step, progressSteps) {
|
|
11516
|
+
switch (step) {
|
|
11517
|
+
case "select-event":
|
|
11518
|
+
case "select-tickets":
|
|
11519
|
+
case "enter-details":
|
|
11520
|
+
case "select-payment": return {
|
|
11521
|
+
isWizardStep: true,
|
|
11522
|
+
totalSteps: progressSteps.length
|
|
11523
|
+
};
|
|
11524
|
+
case "fully-booked": return {
|
|
11525
|
+
isWizardStep: true,
|
|
11526
|
+
totalSteps: 0
|
|
11527
|
+
};
|
|
11528
|
+
case "error":
|
|
11529
|
+
case "success":
|
|
11530
|
+
case "submitting":
|
|
11531
|
+
case "payment": return {
|
|
11532
|
+
isWizardStep: true,
|
|
11533
|
+
totalSteps: progressSteps.length
|
|
11534
|
+
};
|
|
11535
|
+
case "verifying-payment":
|
|
11536
|
+
case "verifying-timeout":
|
|
11537
|
+
case "payment-status":
|
|
11538
|
+
case "payment-failed": return {
|
|
11539
|
+
isWizardStep: false,
|
|
11540
|
+
totalSteps: 0
|
|
11541
|
+
};
|
|
11542
|
+
}
|
|
11543
|
+
}
|
|
11037
11544
|
/**
|
|
11038
11545
|
* Determine which wizard steps to show based on context and payment requirements.
|
|
11039
11546
|
*
|
|
@@ -11041,14 +11548,18 @@ const WIZARD_STEPS = [
|
|
|
11041
11548
|
* @param needsPaymentStep - Whether user must complete payment method selection
|
|
11042
11549
|
* @returns Array of wizard steps to display
|
|
11043
11550
|
*/
|
|
11044
|
-
function getWizardStepsForContext(hasPreSelectedContext, needsPaymentStep) {
|
|
11551
|
+
function getWizardStepsForContext(hasPreSelectedContext, needsPaymentStep, paymentActive = false) {
|
|
11045
11552
|
const baseSteps = hasPreSelectedContext ? ["select-tickets", "enter-details"] : [
|
|
11046
11553
|
"select-event",
|
|
11047
11554
|
"select-tickets",
|
|
11048
11555
|
"enter-details"
|
|
11049
11556
|
];
|
|
11050
11557
|
if (!needsPaymentStep) return baseSteps;
|
|
11051
|
-
return [
|
|
11558
|
+
return paymentActive ? [
|
|
11559
|
+
...baseSteps,
|
|
11560
|
+
"select-payment",
|
|
11561
|
+
"payment"
|
|
11562
|
+
] : [...baseSteps, "select-payment"];
|
|
11052
11563
|
}
|
|
11053
11564
|
/**
|
|
11054
11565
|
* Map wizard step to step number based on the active wizard steps
|
|
@@ -11225,6 +11736,7 @@ const EVENT_REGISTRATION_SHELL_STEP_LABELS = [
|
|
|
11225
11736
|
"Date",
|
|
11226
11737
|
"Tickets",
|
|
11227
11738
|
"Details",
|
|
11739
|
+
"Payment options",
|
|
11228
11740
|
"Payment"
|
|
11229
11741
|
];
|
|
11230
11742
|
const eventRegistrationPublicEventSchema = z.preprocess(normalizeEventRegistrationEventInput, publicEventSchema);
|
|
@@ -11368,12 +11880,13 @@ function shellLabelForRegistrationStep(step, events) {
|
|
|
11368
11880
|
switch (step) {
|
|
11369
11881
|
case "select-event": return isDateSelection(events) ? "Date" : "Event";
|
|
11370
11882
|
case "select-tickets": return "Tickets";
|
|
11883
|
+
case "fully-booked":
|
|
11371
11884
|
case "enter-details": return "Details";
|
|
11372
|
-
case "select-payment": return "Payment";
|
|
11885
|
+
case "select-payment": return "Payment options";
|
|
11886
|
+
case "payment": return "Payment";
|
|
11373
11887
|
case "error":
|
|
11374
11888
|
case "success":
|
|
11375
11889
|
case "submitting":
|
|
11376
|
-
case "redirecting":
|
|
11377
11890
|
case "verifying-payment":
|
|
11378
11891
|
case "verifying-timeout":
|
|
11379
11892
|
case "payment-status":
|
|
@@ -11385,7 +11898,7 @@ function isDateSelection(events) {
|
|
|
11385
11898
|
return Boolean(events.length > 1 && firstSeriesId && events.every((event) => event.seriesId === firstSeriesId));
|
|
11386
11899
|
}
|
|
11387
11900
|
function buildEventRegistrationShellBodyText(stepLabels) {
|
|
11388
|
-
if (stepLabels.includes("Payment")) return "Preparing tickets, details, and payment options.";
|
|
11901
|
+
if (stepLabels.includes("Payment options")) return "Preparing tickets, details, and payment options.";
|
|
11389
11902
|
if (stepLabels[0] === "Tickets") return "Preparing tickets and booking details.";
|
|
11390
11903
|
return "Preparing dates, tickets, and booking details.";
|
|
11391
11904
|
}
|
|
@@ -11974,14 +12487,14 @@ function projectNewsletterFormHydrationTarget(source) {
|
|
|
11974
12487
|
tag: "block-source",
|
|
11975
12488
|
sourceRef: null
|
|
11976
12489
|
};
|
|
11977
|
-
default: return assertNever$
|
|
12490
|
+
default: return assertNever$4(source.newsletterBlockSubmission);
|
|
11978
12491
|
}
|
|
11979
12492
|
case "signed-footer": return {
|
|
11980
12493
|
tag: "signed-footer-source",
|
|
11981
12494
|
sourceRef: source.sourceRef
|
|
11982
12495
|
};
|
|
11983
12496
|
case "preview": return { tag: "preview" };
|
|
11984
|
-
default: return assertNever$
|
|
12497
|
+
default: return assertNever$4(source);
|
|
11985
12498
|
}
|
|
11986
12499
|
}
|
|
11987
12500
|
function resolveRuntimeChoices(context, targeting) {
|
|
@@ -12985,4 +13498,4 @@ function defineIslandPropsDecoder(kind) {
|
|
|
12985
13498
|
};
|
|
12986
13499
|
}
|
|
12987
13500
|
//#endregion
|
|
12988
|
-
export { getContainerClass as $,
|
|
13501
|
+
export { getContainerClass as $, parseEventRegistrationErrorReason as $t, buildEventCalendarListingRender as A, publicEventPricingOptions as An, isBookingServiceSlidingAmountInRange as At, calendarWindowBounds as B, BOOKING_FORM_DATA_RESERVED_KEYS as Bt, resolveDiscountContext as C, getBookingInstalmentDepositRefundability as Cn, formatBookingSubmissionPreparationError as Ct, getRegistrationStepPresentation as D, isPublicEventPricingOptionDisplayable as Dn, getBookingSuccessCopy as Dt, toRegistrationRequestSubject as E, formatEventPricing as En, getBookingServiceSlidingScale as Et, resolveSpacing as F, resolveBookingSiteId as Ft, createHostedBlockApiConfig as G, clearWorkflowFeedback as Gt, calendarWindowPageSchema as H, RichTextDocSchema as Ht, calendarMonthDate as I, resolveDefaultBookingServiceId as It, getEventRuntimeFiltersKey as J, okWith as Jt, getBlockApiReadStage as K, err as Kt, calendarMonthKey as L, toSelectedCollectionOptionKind as Lt, resolveEventRegistrationScopedEvents as M, publicEventPricingType as Mn, prepareBookingSubmission as Mt, SEMANTIC_SPACING_VALUES as N, formatCurrencyAmount as Nn, resolveAppointmentCheckoutVerificationState as Nt, getStepNumber as O, publicEventPricingCurrency as On, getRegistrationSuccessCopy as Ot, isSemanticSpacing as P, assertNever$4 as Pn, resolveBookingPaymentStep as Pt, getCardOrientation as Q, eventRegistrationErrors as Qt, calendarPageResponseError as R, projectSelectedAppointmentConsentIntoForm as Rt, findPreSelectedEvent as S, toScheduledBookingDateTime as Sn, formatBookingCentsAsCurrencyInput as St, resolveRegistrationTarget as T, formatBookingPriceDisplay as Tn, getBookingServicePaymentSelectionMode as Tt, planCalendarMonthRanges as U, isRecord$5 as Ut, calendarWindowMonths as V, isBookingRequirementConsentFieldId as Vt, resolveCalendarReadProfile as W, assertNever$1 as Wt, normalizeCsvString as X, reportWorkflowSuccess as Xt, normalizeCsvIds as Y, reportWorkflowError as Yt, normalizeOptionalId as Z, checkBrowserStripeKey as Zt, buildEventRegistrationDisplayFromScopedEvents as _, getLocalScheduleDate as _n, resolveOnColorForThemeToken as _t, buildProductDetailDisplay as a, CANCELLED_SESSION_STATUS as an, getDayOfWeek as at, toWholeSeriesRegistrationEvents as b, toBookingTimeZone as bn, logger as bt, EMPTY_COMMERCE_CART_STATE as c, resolveBookingSignupOffer as cn, isSameCalendarDay as ct, deriveCommerceCheckoutState as d, formatBookingDateParts as dn, resolveRuntimeEventDestination as dt, getStripeMinimumChargeRequirement as en, MONTH_NAMES as et, parseStoredCommerceCartState as f, formatBookingDateTime as fn, groupPublicEventsByRun as ft, newsletterBlockSubmissionMessage as g, getBookingLocalDateKey as gn, isCssColorLiteral as gt, NEWSLETTER_SIGNUPS_PAUSED_MESSAGE as h, formatLocalScheduleDate as hn, themeButtonVariantClassNames as ht, buildProductCardDisplay as i, resolveBookingInitialInstalmentAmountCents as in, formatDateKey as it, staticHeaderChromeRuntime as j, publicEventPricingStrategy as jn, parseBookingCurrencyInputToCents as jt, getWizardStepsForContext as k, publicEventPricingDisplay as kn, getShopSuccessCopy as kt, buildPassCartItem as l, addLocalScheduleDays as ln, isToday as lt, reduceCommerceCart as m, formatBookingTime as mn, themeButtonSizeClassName as mt, getShopDisplayForItems as n, planFlexibleBalanceCreditFirst as nn, addMonths as nt, formatCommercePrice as o, resolveWholeSeriesBookingPhase as on, getOrderedDayNames as ot, productItemKey as p, formatBookingInstant as pn, boxBackgroundSchema as pt, buildEventRuntimeFilters as q, ok as qt, buildCartDisplay as r, buildBookingInstalmentSchedule as rn, buildCalendarViewport as rt, formatInterval as s, parseMailingListVisitorSelection as sn, getWeekCalendarDays as st, defineIslandPropsDecoder as t, planCheckoutPaymentFlow as tn, addDays as tt, buildProductCartItem as u, formatBookingDate as un, shiftCalendarAnchorDate as ut, getRegistrationStartAt as v, parseBookingLocalDate as vn, resolveTokenOrCssColorValue as vt, resolveEventRequiresPayment as w, getBookingInstalmentPlanIntervalCount as wn, getBookingRedirectStateFromLocation as wt, findEventByOccurrenceId as x, toScheduledBookingDateRange as xn, deriveBookingFormViewState as xt, toRegistrationEvents as y, resolveBookingTimeZoneId as yn, normalizeCardRole as yt, calendarQueryKey as z, resolveSelectedAppointmentConsent as zt };
|