@riverbankcms/sdk 0.140.0 → 0.141.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.
Files changed (112) hide show
  1. package/dist/{PreviewEditorSidebar-CUyTzd5z.mjs → PreviewEditorSidebar-Q-fy9GYw.mjs} +3 -3
  2. package/dist/{PreviewEditorUI-Agkw4v5i.mjs → PreviewEditorUI-LYGzgk85.mjs} +2 -2
  3. package/dist/{SdkPreviewModeRuntime-DdbeAdS8.mjs → SdkPreviewModeRuntime-CoPYI5Jq.mjs} +72 -46
  4. package/dist/{SiteChromeCustomizeContext-CqGOz-Kv.mjs → SiteChromeCustomizeContext-D8LePX8x.mjs} +681 -196
  5. package/dist/_dts/api/src/contentRuntime.d.ts +12 -31
  6. package/dist/_dts/api/src/domainConnection.d.ts +4 -0
  7. package/dist/_dts/api/src/footerCompositionContracts.d.ts +25 -0
  8. package/dist/_dts/api/src/index.d.ts +1 -1
  9. package/dist/_dts/api/src/launchReadiness.d.ts +1 -0
  10. package/dist/_dts/api/src/navigation/dashboardSiteNav.d.ts +2 -1
  11. package/dist/_dts/api/src/siteManagementEndpoints.d.ts +3 -26
  12. package/dist/_dts/api/src/siteOnboarding.d.ts +7 -0
  13. package/dist/_dts/billing/src/site-arrangements.d.ts +12 -3
  14. package/dist/_dts/blocks/src/contracts/proof-block-islands.d.ts +4 -0
  15. package/dist/_dts/blocks/src/pageRendererContracts.d.ts +2 -0
  16. package/dist/_dts/blocks/src/system/blocks/events/event-calendar.d.ts +2 -0
  17. package/dist/_dts/blocks/src/system/blocks/events/eventSelectionFields.d.ts +122 -0
  18. package/dist/_dts/blocks/src/system/blocks/events/shared/calendarWindow.d.ts +2 -1
  19. package/dist/_dts/blocks/src/system/blocks/events/shared/eventSelection.d.ts +11 -0
  20. package/dist/_dts/blocks/src/system/blocks/location-map.d.ts +2 -2
  21. package/dist/_dts/blocks/src/system/blocks/media-text.d.ts +47 -47
  22. package/dist/_dts/blocks/src/system/data/prefetchBlockData.d.ts +5 -0
  23. package/dist/_dts/blocks/src/system/data/utils.d.ts +1 -1
  24. package/dist/_dts/blocks/src/system/manifest/schema.d.ts +27 -1
  25. package/dist/_dts/blocks/src/system/runtime/components/registry.client.d.ts +12 -180
  26. package/dist/_dts/blocks/src/system/runtime/components/runtime-backed-blocks.d.ts +6 -90
  27. package/dist/_dts/blocks/src/system/runtime/hooks/useEventFilters.d.ts +2 -1
  28. package/dist/_dts/blocks/src/system/runtime/nodes/appointment-services.d.ts +5 -1
  29. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/hooks.d.ts +4 -0
  30. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/hooks.state.d.ts +5 -0
  31. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useDiscountCodeUi.d.ts +3 -0
  32. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useDiscountCodeUi.state.d.ts +10 -3
  33. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventCheckoutHandoffRestore.d.ts +9 -0
  34. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationWizard.d.ts +4 -5
  35. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useSettledCommerceView.d.ts +37 -0
  36. package/dist/_dts/blocks/src/system/runtime/nodes/events/EventCombined.client.d.ts +4 -3
  37. package/dist/_dts/blocks/src/system/runtime/nodes/events/EventCombined.interactive.d.ts +3 -0
  38. package/dist/_dts/blocks/src/system/runtime/nodes/events/EventListing.interactive.d.ts +11 -101
  39. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/eventCollectionContract.d.ts +7 -2
  40. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/listOptions.d.ts +2 -0
  41. package/dist/_dts/blocks/src/system/transforms/registry/eventCalendar.d.ts +12 -0
  42. package/dist/_dts/commerce/src/purchase/bookingInstalmentSchedule.d.ts +4 -0
  43. package/dist/_dts/db/src/generated/supabase/database.types.d.ts +3 -0
  44. package/dist/_dts/editor-blocks/src/widgets/site-option-picker/loaders.d.ts +27 -1
  45. package/dist/_dts/sdk/src/public-api/contracts.d.ts +1 -1
  46. package/dist/_dts/sdk/src/version.d.ts +1 -1
  47. package/dist/_dts/theme-core/src/ThemeFontLoader.d.ts +17 -1
  48. package/dist/_dts/theme-core/src/buttons/affordanceSuppression.d.ts +17 -0
  49. package/dist/_dts/theme-core/src/buttons/buttonColourContract.d.ts +1 -1
  50. package/dist/_dts/theme-core/src/buttons/classNames.d.ts +16 -0
  51. package/dist/_dts/theme-core/src/buttons/generateButtonCss.d.ts +0 -6
  52. package/dist/_dts/theme-core/src/buttons/resolvedButtonCss.d.ts +4 -4
  53. package/dist/_dts/theme-core/src/generated/containerResponsiveThemeCss.d.ts +1 -1
  54. package/dist/_dts/theme-core/src/hosted-booking-appearance.d.ts +54 -12
  55. package/dist/_dts/theme-core/src/index.d.ts +1 -1
  56. package/dist/client/{BookingConsentAgreement-CuKa82V4.mjs → BookingConsentAgreement-xJeYNdnb.mjs} +2 -2
  57. package/dist/client/{DiscountCodeDisclosure-BbYieKWB.mjs → DiscountCodeDisclosure-DdT6uzl9.mjs} +1 -1
  58. package/dist/client/{EventCombined.client-LTfR1Aby.mjs → EventCombined.client-Cp28uYuM.mjs} +11 -15
  59. package/dist/client/{EventListing.client-DUHpYSuo.mjs → EventListing.client-CD6AJsMr.mjs} +4 -17
  60. package/dist/client/{LeafletStaticMap-CHRupL6m.mjs → LeafletStaticMap-DBsAi9-e.mjs} +1 -1
  61. package/dist/client/{accordion-6HiIFxNL.mjs → accordion-6dwbOKYR.mjs} +1 -1
  62. package/dist/client/{bookingForm-Dlmid43H.mjs → bookingForm-CZE9_qPQ.mjs} +5 -5
  63. package/dist/client/bookings.mjs +175 -93
  64. package/dist/client/{carousel-DmkZRRq_.mjs → carousel-7VHGQARz.mjs} +1 -1
  65. package/dist/client/{cart-CIC24330.mjs → cart-Qg_mvQhh.mjs} +3 -3
  66. package/dist/client/{checkout-D1Zw9imo.mjs → checkout-D84rpgdr.mjs} +3 -3
  67. package/dist/client/client.mjs +602 -139
  68. package/dist/client/{context-Cy1OayHx.mjs → context-Ctp3T0Wr.mjs} +1 -1
  69. package/dist/client/{dates-aDcfoLHr.mjs → dates-DJKFcI_N.mjs} +2 -2
  70. package/dist/client/{eventCalendar-FQxMPAjf.mjs → eventCalendar-CK31z3vs.mjs} +11 -7
  71. package/dist/client/{eventCombined-Dr3ac6Hb.mjs → eventCombined-DiXd-ewn.mjs} +3 -3
  72. package/dist/client/{eventDetails-D-AzUHFQ.mjs → eventDetails-CTRgt2DK.mjs} +4 -4
  73. package/dist/client/{eventListing-B3XxBf3i.mjs → eventListing-Dy9vi_j_.mjs} +3 -3
  74. package/dist/client/{eventRegistration-I6EaokFD.mjs → eventRegistration-CnalYMr2.mjs} +124 -31
  75. package/dist/client/{form-BbWckVWY.mjs → form-eUiMveTT.mjs} +2 -2
  76. package/dist/client/{headerSection-C9qU4Y7x.mjs → headerSection-Dy9kQpB1.mjs} +2 -2
  77. package/dist/client/hooks.mjs +247 -32
  78. package/dist/client/{locationMap-CLCShvlG.mjs → locationMap-DalCmWU0.mjs} +2 -2
  79. package/dist/client/{newsletterForm-Briukxzi.mjs → newsletterForm-SDDPvhS0.mjs} +23 -10
  80. package/dist/client/{pricing-Copadu-2.mjs → pricing-OcMz4SnX.mjs} +1 -1
  81. package/dist/client/{productDetail-oujlRd-r.mjs → productDetail-BQrgHElM.mjs} +3 -3
  82. package/dist/client/{productList-BRiIRUcd.mjs → productList-OnPn_UJj.mjs} +3 -3
  83. package/dist/client/{propsDecoder-CB2KS_ko.mjs → propsDecoder-zBdsnS-N.mjs} +38 -8
  84. package/dist/client/rendering/client.mjs +446 -121
  85. package/dist/client/rendering/islands.mjs +17 -17
  86. package/dist/client/rendering.mjs +601 -138
  87. package/dist/client/{scrollToBlock-B1IS1_ua.mjs → scrollToBlock-BNM4Ob2Y.mjs} +28 -11
  88. package/dist/client/{shop-Vn6yNFED.mjs → shop-Bv1fPTwQ.mjs} +6 -6
  89. package/dist/client/{shop-commerce-BVTqipYp.mjs → shop-commerce-D4KNGaW8.mjs} +5 -5
  90. package/dist/client/{shop-commerce-store-BVnJVy7v.mjs → shop-commerce-store-2N5EV0Rc.mjs} +1 -1
  91. package/dist/client/{shopShared-COIeK77T.mjs → shopShared-DvJGdHTV.mjs} +3 -3
  92. package/dist/client/{useEventFilters-DzIUcS9n.mjs → useEventFilters-BBBvGDHQ.mjs} +17 -11
  93. package/dist/preview-next/client/runtime.mjs +3 -3
  94. package/dist/preview-next/editor-chrome.css +4 -8
  95. package/dist/{sdk-runtime-CnCLvZRv.mjs → sdk-runtime-Defnbfzw.mjs} +1 -1
  96. package/dist/{separator-DKDRJ1oH.mjs → separator-CZXO3Sb0.mjs} +1 -1
  97. package/dist/server/components.mjs +384 -62
  98. package/dist/server/config-validation.mjs +232 -26
  99. package/dist/server/config.mjs +232 -26
  100. package/dist/server/data.mjs +247 -32
  101. package/dist/server/index.mjs +1 -1
  102. package/dist/server/next.mjs +400 -69
  103. package/dist/server/page-converter.mjs +189 -25
  104. package/dist/server/prebuild.mjs +1 -1
  105. package/dist/server/rendering/server.mjs +399 -68
  106. package/dist/server/rendering.mjs +399 -68
  107. package/dist/server/routing.mjs +261 -33
  108. package/dist/server/server.mjs +248 -33
  109. package/dist/server/theme-bridge.mjs +47 -15
  110. package/dist/server/theme.mjs +1 -1
  111. package/dist/styles/index.css +28 -2
  112. package/package.json +1 -1
@@ -8196,6 +8196,7 @@ z.object({
8196
8196
  eventSurface: z.enum(eventSurfaceScopeValues).optional(),
8197
8197
  eventPresets: z.string().optional(),
8198
8198
  scheduleScope: z.enum(eventScheduleScopeValues).optional(),
8199
+ seriesIds: z.string().optional(),
8199
8200
  categoryIds: z.string().optional(),
8200
8201
  venueId: z.string().transform(normalizeCalendarFilterId).optional(),
8201
8202
  staffMemberId: z.string().transform(normalizeCalendarFilterId).optional()
@@ -10625,10 +10626,14 @@ function buildDiscountAvailabilityRequestPlan(options) {
10625
10626
  }
10626
10627
  };
10627
10628
  }
10628
- function discountAvailabilityStateFromResponse(response) {
10629
- if (!discountAvailabilityHasDiscounts(response)) return { tag: "unavailable" };
10629
+ function discountAvailabilityStateFromResponse(requestKey, response) {
10630
+ if (!discountAvailabilityHasDiscounts(response)) return {
10631
+ tag: "unavailable",
10632
+ requestKey
10633
+ };
10630
10634
  return {
10631
10635
  tag: "available",
10636
+ requestKey,
10632
10637
  manualCodeEntryAllowed: discountAvailabilityAllowsManualEntry(response),
10633
10638
  autoAppliedDiscount: getAutoAppliedDiscountPreview(response)
10634
10639
  };
@@ -10638,10 +10643,13 @@ function discountCodeUiReducer(state, event) {
10638
10643
  case "availability-disabled": return initialDiscountCodeUiState;
10639
10644
  case "availability-loading": return {
10640
10645
  ...state,
10641
- availability: { tag: "loading" }
10646
+ availability: {
10647
+ tag: "loading",
10648
+ previous: state.availability.tag === "available" || state.availability.tag === "unavailable" ? state.availability : state.availability.tag === "loading" ? state.availability.previous : null
10649
+ }
10642
10650
  };
10643
10651
  case "availability-loaded": {
10644
- const availability = discountAvailabilityStateFromResponse(event.response);
10652
+ const availability = discountAvailabilityStateFromResponse(event.requestKey, event.response);
10645
10653
  if (availability.tag !== "available" || !availability.manualCodeEntryAllowed) return {
10646
10654
  ...state,
10647
10655
  discountUiOpen: false,
@@ -10657,7 +10665,10 @@ function discountCodeUiReducer(state, event) {
10657
10665
  ...state,
10658
10666
  discountUiOpen: false,
10659
10667
  discountCode: "",
10660
- availability: { tag: "error" }
10668
+ availability: {
10669
+ tag: "error",
10670
+ requestKey: event.requestKey
10671
+ }
10661
10672
  };
10662
10673
  case "discount-code-changed": return {
10663
10674
  ...state,
@@ -10693,11 +10704,15 @@ function useDiscountCodeUi(options) {
10693
10704
  if (cancelled) return;
10694
10705
  dispatch({
10695
10706
  type: "availability-loaded",
10707
+ requestKey: requestPlan.key,
10696
10708
  response: res
10697
10709
  });
10698
10710
  } catch {
10699
10711
  if (cancelled) return;
10700
- dispatch({ type: "availability-failed" });
10712
+ dispatch({
10713
+ type: "availability-failed",
10714
+ requestKey: requestPlan.key
10715
+ });
10701
10716
  }
10702
10717
  }
10703
10718
  checkDiscountAvailability();
@@ -10706,8 +10721,9 @@ function useDiscountCodeUi(options) {
10706
10721
  };
10707
10722
  }, [options.api, requestPlan]);
10708
10723
  const availability = state.availability;
10709
- const isAvailable = availability.tag === "available";
10710
- const manualCodeEntryAllowed = isAvailable ? availability.manualCodeEntryAllowed : false;
10724
+ const settledAvailability = availability.tag === "loading" ? availability.previous : availability.tag === "available" || availability.tag === "unavailable" ? availability : null;
10725
+ const isAvailable = settledAvailability?.tag === "available";
10726
+ const manualCodeEntryAllowed = isAvailable ? settledAvailability.manualCodeEntryAllowed : false;
10711
10727
  return {
10712
10728
  discountUiOpen: state.discountUiOpen,
10713
10729
  setDiscountUiOpen: (isOpen) => dispatch({
@@ -10721,8 +10737,10 @@ function useDiscountCodeUi(options) {
10721
10737
  }),
10722
10738
  discountsAvailable: isAvailable,
10723
10739
  manualCodeEntryAllowed,
10724
- autoAppliedDiscount: isAvailable ? availability.autoAppliedDiscount : null,
10725
- discountsAvailableLoading: availability.tag === "loading"
10740
+ autoAppliedDiscount: isAvailable ? settledAvailability.autoAppliedDiscount : null,
10741
+ discountsAvailableLoading: availability.tag === "loading",
10742
+ discountAvailabilityRequestKey: requestPlan.key,
10743
+ settledDiscountAvailabilityRequestKey: availability.tag === "error" ? availability.requestKey : settledAvailability?.requestKey ?? null
10726
10744
  };
10727
10745
  }
10728
10746
  //#endregion
@@ -15249,6 +15267,7 @@ function hasValidPricingOptionSelection(input) {
15249
15267
  const initialEligibilityLookupState = {
15250
15268
  tag: "idle",
15251
15269
  eligibility: null,
15270
+ settledRequestKey: null,
15252
15271
  error: null
15253
15272
  };
15254
15273
  function eligibilityLookupReducer(state, action) {
@@ -15257,16 +15276,19 @@ function eligibilityLookupReducer(state, action) {
15257
15276
  case "loading-started": return {
15258
15277
  tag: "loading",
15259
15278
  eligibility: state.eligibility,
15279
+ settledRequestKey: state.settledRequestKey,
15260
15280
  error: null
15261
15281
  };
15262
15282
  case "resolved": return {
15263
15283
  tag: "resolved",
15264
15284
  eligibility: action.eligibility,
15285
+ settledRequestKey: action.requestKey,
15265
15286
  error: null
15266
15287
  };
15267
15288
  case "failed": return {
15268
15289
  tag: "failed",
15269
15290
  eligibility: null,
15291
+ settledRequestKey: null,
15270
15292
  error: action.message
15271
15293
  };
15272
15294
  default: return assertNever(action);
@@ -15372,9 +15394,23 @@ function toRegistrationOptionsSubject(subject, attendanceMode) {
15372
15394
  function useEligibility(params) {
15373
15395
  return useEligibilityWithDeps(params, eventRegistrationHooksDeps);
15374
15396
  }
15397
+ function eligibilityRequestKey(params) {
15398
+ return JSON.stringify({
15399
+ enabled: params.enabled,
15400
+ refreshKey: params.refreshKey ?? 0,
15401
+ subject: params.subject,
15402
+ attendanceMode: params.attendanceMode ?? null,
15403
+ ticketSelections: params.ticketSelectionsKey,
15404
+ selectedSlidingAmount: params.selectedSlidingAmount ?? null
15405
+ });
15406
+ }
15375
15407
  function useEligibilityWithDeps(params, deps) {
15376
15408
  const api = deps.useBlockApi();
15377
15409
  const ticketSelectionsKey = JSON.stringify(normalizeTicketSelectionLines(params.ticketSelections));
15410
+ const requestKey = eligibilityRequestKey({
15411
+ ...params,
15412
+ ticketSelectionsKey
15413
+ });
15378
15414
  const [state, dispatch] = useReducer(eligibilityLookupReducer, initialEligibilityLookupState);
15379
15415
  const requestIdRef = useRef(0);
15380
15416
  useEffect(() => {
@@ -15407,7 +15443,8 @@ function useEligibilityWithDeps(params, deps) {
15407
15443
  if (cancelled || requestIdRef.current !== requestId) return;
15408
15444
  dispatch({
15409
15445
  type: "resolved",
15410
- eligibility: transformRegistrationOptionsResponse(result)
15446
+ eligibility: transformRegistrationOptionsResponse(result),
15447
+ requestKey
15411
15448
  });
15412
15449
  } catch {
15413
15450
  if (cancelled || requestIdRef.current !== requestId) return;
@@ -15436,6 +15473,8 @@ function useEligibilityWithDeps(params, deps) {
15436
15473
  return {
15437
15474
  state,
15438
15475
  eligibility: state.eligibility,
15476
+ settledRequestKey: state.settledRequestKey,
15477
+ requestKey,
15439
15478
  isLoading: state.tag === "loading",
15440
15479
  error: state.error,
15441
15480
  creditState
@@ -16569,6 +16608,126 @@ function buildOccurrenceRegistrationRequest(options, prepared, method, passId, m
16569
16608
  };
16570
16609
  }
16571
16610
  //#endregion
16611
+ //#region ../blocks/src/system/runtime/nodes/event-registration/registrationDerivations.ts
16612
+ function eventMatchesOccurrenceId(event, occurrenceId) {
16613
+ return event.registrationSubject.kind === "occurrence" && (event.registrationSubject.occurrenceId === occurrenceId || event.selectionId === occurrenceId);
16614
+ }
16615
+ function findEventByOccurrenceId(events, occurrenceId) {
16616
+ return events.find((event) => eventMatchesOccurrenceId(event, occurrenceId)) ?? null;
16617
+ }
16618
+ function findPreSelectedEvent(input) {
16619
+ const occurrenceContext = input.occurrenceContext;
16620
+ if (!occurrenceContext) return input.scopedEvents.length === 1 ? input.scopedEvents[0] ?? null : null;
16621
+ const contextDate = getBookingLocalDateKey(toScheduledBookingDateTime({
16622
+ startsAt: occurrenceContext.startsAt,
16623
+ timeZone: occurrenceContext.timeZone
16624
+ }));
16625
+ return input.scopedEvents.find((event) => eventMatchesOccurrenceId(event, occurrenceContext.id) || getBookingLocalDateKey(toScheduledBookingDateTime({
16626
+ startsAt: event.startsAt,
16627
+ timeZone: event.timeZone
16628
+ })) === contextDate) ?? null;
16629
+ }
16630
+ function resolveRegistrationTarget(input) {
16631
+ const subject = input.occurrenceContext ? {
16632
+ kind: "occurrence",
16633
+ occurrenceId: input.occurrenceContext.id
16634
+ } : input.selectedEvent?.registrationSubject ?? null;
16635
+ if (!subject) return null;
16636
+ return {
16637
+ subject,
16638
+ selectedEventId: input.selectedEvent?.selectionId ?? null
16639
+ };
16640
+ }
16641
+ function resolveEventRequiresPayment(input) {
16642
+ if (input.eligibility) return input.eligibility.requiresPayment;
16643
+ if (input.selectedTicketType) return input.selectedTicketType.priceAmount > 0;
16644
+ if (!input.event) return false;
16645
+ return publicEventPricingType(input.event.pricing) === "paid";
16646
+ }
16647
+ function resolveDiscountContext(input) {
16648
+ const selection = input.paymentSelection.method ? input.paymentSelection : null;
16649
+ if (!input.event) return null;
16650
+ if (selection?.method === "pass_bundle" && selection.bundlePassId) return {
16651
+ type: "pass",
16652
+ passId: selection.bundlePassId
16653
+ };
16654
+ if (selection?.method === "membership_bundle" && selection.bundleMembershipId) return {
16655
+ type: "membership",
16656
+ membershipId: selection.bundleMembershipId
16657
+ };
16658
+ if (!input.eventRequiresPayment) return null;
16659
+ if (input.ticketsCount <= 0) return null;
16660
+ if (selection?.method && selection.method !== "stripe") return null;
16661
+ return {
16662
+ type: "event",
16663
+ eventSeriesId: input.event.seriesId,
16664
+ eventCategoryId: input.event.eventCategory?.id ?? null,
16665
+ ticketsCount: input.ticketsCount
16666
+ };
16667
+ }
16668
+ //#endregion
16669
+ //#region ../blocks/src/system/runtime/nodes/event-registration/useSettledCommerceView.ts
16670
+ function buildCandidate(input) {
16671
+ if (!input.eligibilityIsSettled || !input.eligibility || !input.currentEvent) return null;
16672
+ return {
16673
+ eventSelectionId: input.currentEvent.selectionId,
16674
+ discountContext: resolveDiscountContext({
16675
+ paymentSelection: input.paymentSelection,
16676
+ event: input.currentEvent,
16677
+ eventRequiresPayment: input.eventRequiresPayment,
16678
+ ticketsCount: input.ticketsCount
16679
+ }),
16680
+ subtotalCents: input.eligibility.price,
16681
+ summaryLines: input.eligibility.ticketLines.map((line) => ({
16682
+ pricingOptionId: line.pricingOptionId,
16683
+ label: line.label,
16684
+ quantity: line.quantity,
16685
+ unitPriceCents: line.unitPriceCents,
16686
+ subtotalCents: line.subtotalCents
16687
+ }))
16688
+ };
16689
+ }
16690
+ function eligibilityIsSettled(result) {
16691
+ return result.settledRequestKey === result.requestKey;
16692
+ }
16693
+ function viewIsStale(view, currentEvent, eligibilityState) {
16694
+ return view.eventSelectionId !== currentEvent?.selectionId || eligibilityState?.tag === "failed" || eligibilityState?.tag === "idle";
16695
+ }
16696
+ function requestIsSettled(discountUi) {
16697
+ return discountUi.discountAvailabilityRequestKey === "disabled" || discountUi.settledDiscountAvailabilityRequestKey === discountUi.discountAvailabilityRequestKey;
16698
+ }
16699
+ function discountRequest(view) {
16700
+ const discountContext = view?.discountContext ?? null;
16701
+ return {
16702
+ discountContext,
16703
+ subtotalCents: discountContext?.type === "event" && view?.subtotalCents !== null ? view?.subtotalCents : void 0
16704
+ };
16705
+ }
16706
+ function useSettledCommerceView(input) {
16707
+ const candidate = buildCandidate({
16708
+ eligibilityIsSettled: eligibilityIsSettled(input.eligibilityResult),
16709
+ eligibility: input.eligibility,
16710
+ currentEvent: input.currentEvent,
16711
+ paymentSelection: input.paymentSelection,
16712
+ eventRequiresPayment: input.eventRequiresPayment,
16713
+ ticketsCount: input.ticketsCount
16714
+ });
16715
+ const settledRef = useRef(candidate);
16716
+ if (settledRef.current && viewIsStale(settledRef.current, input.currentEvent, input.eligibilityResult.state)) settledRef.current = null;
16717
+ const requestView = candidate ?? settledRef.current;
16718
+ const discountUi = input.useDiscountCodeUi({
16719
+ api: input.api,
16720
+ ...discountRequest(requestView)
16721
+ });
16722
+ if (candidate && requestIsSettled(discountUi)) settledRef.current = candidate;
16723
+ return {
16724
+ discountUi,
16725
+ discountContext: settledRef.current?.discountContext ?? null,
16726
+ ticketSelectionSubtotalCents: settledRef.current?.subtotalCents ?? null,
16727
+ ticketSelectionSummaryLines: settledRef.current?.summaryLines ?? []
16728
+ };
16729
+ }
16730
+ //#endregion
16572
16731
  //#region ../blocks/src/system/runtime/nodes/event-registration/eventPaymentOptions.ts
16573
16732
  function getApprovedDirectPaymentCollectionOptionKinds(paymentOptions) {
16574
16733
  return paymentOptions.flatMap((option) => {
@@ -17210,64 +17369,6 @@ function getStepLabel(step) {
17210
17369
  }
17211
17370
  }
17212
17371
  //#endregion
17213
- //#region ../blocks/src/system/runtime/nodes/event-registration/registrationDerivations.ts
17214
- function eventMatchesOccurrenceId(event, occurrenceId) {
17215
- return event.registrationSubject.kind === "occurrence" && (event.registrationSubject.occurrenceId === occurrenceId || event.selectionId === occurrenceId);
17216
- }
17217
- function findEventByOccurrenceId(events, occurrenceId) {
17218
- return events.find((event) => eventMatchesOccurrenceId(event, occurrenceId)) ?? null;
17219
- }
17220
- function findPreSelectedEvent(input) {
17221
- const occurrenceContext = input.occurrenceContext;
17222
- if (!occurrenceContext) return input.scopedEvents.length === 1 ? input.scopedEvents[0] ?? null : null;
17223
- const contextDate = getBookingLocalDateKey(toScheduledBookingDateTime({
17224
- startsAt: occurrenceContext.startsAt,
17225
- timeZone: occurrenceContext.timeZone
17226
- }));
17227
- return input.scopedEvents.find((event) => eventMatchesOccurrenceId(event, occurrenceContext.id) || getBookingLocalDateKey(toScheduledBookingDateTime({
17228
- startsAt: event.startsAt,
17229
- timeZone: event.timeZone
17230
- })) === contextDate) ?? null;
17231
- }
17232
- function resolveRegistrationTarget(input) {
17233
- const subject = input.occurrenceContext ? {
17234
- kind: "occurrence",
17235
- occurrenceId: input.occurrenceContext.id
17236
- } : input.selectedEvent?.registrationSubject ?? null;
17237
- if (!subject) return null;
17238
- return {
17239
- subject,
17240
- selectedEventId: input.selectedEvent?.selectionId ?? null
17241
- };
17242
- }
17243
- function resolveEventRequiresPayment(input) {
17244
- if (input.eligibility) return input.eligibility.requiresPayment;
17245
- if (input.selectedTicketType) return input.selectedTicketType.priceAmount > 0;
17246
- if (!input.event) return false;
17247
- return publicEventPricingType(input.event.pricing) === "paid";
17248
- }
17249
- function resolveDiscountContext(input) {
17250
- const selection = input.paymentSelection.method ? input.paymentSelection : null;
17251
- if (!input.event) return null;
17252
- if (selection?.method === "pass_bundle" && selection.bundlePassId) return {
17253
- type: "pass",
17254
- passId: selection.bundlePassId
17255
- };
17256
- if (selection?.method === "membership_bundle" && selection.bundleMembershipId) return {
17257
- type: "membership",
17258
- membershipId: selection.bundleMembershipId
17259
- };
17260
- if (!input.eventRequiresPayment) return null;
17261
- if (input.ticketsCount <= 0) return null;
17262
- if (selection?.method && selection.method !== "stripe") return null;
17263
- return {
17264
- type: "event",
17265
- eventSeriesId: input.event.seriesId,
17266
- eventCategoryId: input.event.eventCategory?.id ?? null,
17267
- ticketsCount: input.ticketsCount
17268
- };
17269
- }
17270
- //#endregion
17271
17372
  //#region ../blocks/src/system/blocks/events/shared/runGrouping.ts
17272
17373
  function isWholeSeriesPublicEvent(event) {
17273
17374
  return event.bookingScope === "whole_series";
@@ -17506,10 +17607,6 @@ function isSoldOutWithoutWaitlist(input) {
17506
17607
  }
17507
17608
  //#endregion
17508
17609
  //#region ../blocks/src/system/runtime/nodes/event-registration/useEventRegistrationWizard.ts
17509
- function resolveDiscountSubtotalCents(context, subtotalCents) {
17510
- if (context?.type !== "event" || subtotalCents === null) return void 0;
17511
- return subtotalCents;
17512
- }
17513
17610
  function usesTieredPricing(event) {
17514
17611
  return event !== null && event !== void 0 ? publicEventPricingStrategy(event.pricing) === "tiered" : false;
17515
17612
  }
@@ -17961,30 +18058,15 @@ function useEventRegistrationWizardWithDeps(options, deps) {
17961
18058
  }
17962
18059
  setStep("select-tickets");
17963
18060
  };
17964
- const discountContext = useMemo(() => resolveDiscountContext({
17965
- paymentSelection,
17966
- event: currentEvent,
17967
- eventRequiresPayment,
17968
- ticketsCount
17969
- }), [
18061
+ const { discountUi, discountContext, ticketSelectionSubtotalCents, ticketSelectionSummaryLines } = useSettledCommerceView({
18062
+ api,
18063
+ useDiscountCodeUi: deps.useDiscountCodeUi,
18064
+ eligibilityResult,
18065
+ eligibility,
17970
18066
  currentEvent,
17971
18067
  eventRequiresPayment,
17972
18068
  paymentSelection,
17973
18069
  ticketsCount
17974
- ]);
17975
- const ticketSelectionSubtotalCents = eligibility?.price ?? null;
17976
- const ticketSelectionSummaryLines = useMemo(() => eligibility?.ticketLines.map((line) => ({
17977
- pricingOptionId: line.pricingOptionId,
17978
- label: line.label,
17979
- quantity: line.quantity,
17980
- unitPriceCents: line.unitPriceCents,
17981
- subtotalCents: line.subtotalCents
17982
- })) ?? [], [eligibility]);
17983
- const discountSubtotalCents = resolveDiscountSubtotalCents(discountContext, ticketSelectionSubtotalCents);
17984
- const discountUi = deps.useDiscountCodeUi({
17985
- api,
17986
- discountContext,
17987
- subtotalCents: discountSubtotalCents
17988
18070
  });
17989
18071
  const selectionMethod = paymentSelection.method;
17990
18072
  const shouldShowDiscountToggle = discountContext !== null && discountUi.manualCodeEntryAllowed && (selectionMethod === "stripe" || selectionMethod === "pass_bundle" || selectionMethod === "membership_bundle");
@@ -1,4 +1,4 @@
1
- import { t as defineIslandPropsDecoder } from "./propsDecoder-CB2KS_ko.mjs";
1
+ import { t as defineIslandPropsDecoder } from "./propsDecoder-zBdsnS-N.mjs";
2
2
  import { t as mountReactIsland } from "./reactMount-SY8AVRof.mjs";
3
3
  import { n as normalizeCarouselProps, t as CarouselNodeClient } from "./carousel.client-DQTjCVQT.mjs";
4
4
  import "react";
@@ -1,6 +1,6 @@
1
- import { t as defineIslandPropsDecoder } from "./propsDecoder-CB2KS_ko.mjs";
2
- import { t as CartController } from "./shop-commerce-BVTqipYp.mjs";
3
- import { t as mountShopBlockIsland } from "./shopShared-COIeK77T.mjs";
1
+ import { t as defineIslandPropsDecoder } from "./propsDecoder-zBdsnS-N.mjs";
2
+ import { t as CartController } from "./shop-commerce-D4KNGaW8.mjs";
3
+ import { t as mountShopBlockIsland } from "./shopShared-DvJGdHTV.mjs";
4
4
  import "react";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  //#region ../blocks/src/system/runtime/nodes/cart.client.tsx
@@ -1,6 +1,6 @@
1
- import { t as defineIslandPropsDecoder } from "./propsDecoder-CB2KS_ko.mjs";
2
- import { n as CheckoutController } from "./shop-commerce-BVTqipYp.mjs";
3
- import { t as mountShopBlockIsland } from "./shopShared-COIeK77T.mjs";
1
+ import { t as defineIslandPropsDecoder } from "./propsDecoder-zBdsnS-N.mjs";
2
+ import { n as CheckoutController } from "./shop-commerce-D4KNGaW8.mjs";
3
+ import { t as mountShopBlockIsland } from "./shopShared-DvJGdHTV.mjs";
4
4
  import "react";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  //#region ../blocks/src/system/runtime/nodes/checkout.client.tsx