@riverbankcms/sdk 0.174.1 → 0.176.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 (198) hide show
  1. package/dist/_dts/{BlocksIslandsHydrator-YRmc-Yxz.d.ts → BlocksIslandsHydrator-DvoTk7Py.d.ts} +1 -1
  2. package/dist/_dts/{Page-Du0zX1B-.d.ts → Page-D-l374tU.d.ts} +8 -16
  3. package/dist/_dts/{SdkPreviewMode-4L8v3FkY.d.ts → SdkPreviewMode-22DdQAj5.d.ts} +2 -2
  4. package/dist/_dts/{client-B1J6Akyf.d.ts → client-D4p0J1lK.d.ts} +487 -11
  5. package/dist/_dts/{content-types-CGGYI0u_.d.ts → content-types-0WWR6dC4.d.ts} +2 -2
  6. package/dist/_dts/{contracts-CHMlw9hT.d.ts → contracts-f_ZG_SwY.d.ts} +8 -8
  7. package/dist/_dts/{footerPageOutline-DIHSU1Vr.d.ts → footerPageOutline-DSeZvOaj.d.ts} +85 -8
  8. package/dist/_dts/{generatePageMetadata-JITXD6BU.d.ts → generatePageMetadata-BlitPA2D.d.ts} +2 -2
  9. package/dist/_dts/{index-BLEKFHt1.d.ts → index-CKkkCgb6.d.ts} +1 -1
  10. package/dist/_dts/{index-yWDbUojb.d.ts → index-CoLcwjqJ.d.ts} +1 -1
  11. package/dist/_dts/{index-DpJm0NpL.d.ts → index-D-ai8IQd.d.ts} +4 -4
  12. package/dist/_dts/{index-CXZSy_9M.d.ts → index-DDsfmM4d.d.ts} +2 -2
  13. package/dist/_dts/{index-CF62FntA.d.ts → index-EJMo-KSo.d.ts} +2 -2
  14. package/dist/_dts/{index-D9ZYmGAJ.d.ts → index-ZKEDvLuN.d.ts} +1 -1
  15. package/dist/_dts/{index-BgOr1Xyz.d.ts → index-tcPtGdag.d.ts} +3 -3
  16. package/dist/_dts/{loadContent-M-s0p0rq.d.ts → loadContent-Ci932ORy.d.ts} +7 -7
  17. package/dist/_dts/{request-BK-pHf0P.d.ts → request-B8jVdvgI.d.ts} +1993 -407
  18. package/dist/_dts/{resolveBlockData-DZAlnhwt.d.ts → resolveBlockData-DrSMuD76.d.ts} +5 -5
  19. package/dist/_dts/{resolvePageContent-DXUCWJ3y.d.ts → resolvePageContent-Be4iL6-F.d.ts} +2 -2
  20. package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
  21. package/dist/_dts/sdk/src/client/types.d.ts +2 -2
  22. package/dist/_dts/sdk/src/client.d.ts +7 -7
  23. package/dist/_dts/sdk/src/config/index.d.ts +6 -6
  24. package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
  25. package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
  26. package/dist/_dts/sdk/src/data/dataLoaderContext.d.ts +2 -2
  27. package/dist/_dts/sdk/src/data/resolveBlockData.d.ts +1 -1
  28. package/dist/_dts/sdk/src/data/types.d.ts +2 -2
  29. package/dist/_dts/sdk/src/gifting/client.d.ts +13 -1
  30. package/dist/_dts/sdk/src/index.d.ts +8 -8
  31. package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
  32. package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
  33. package/dist/_dts/sdk/src/navigation/index.d.ts +3 -3
  34. package/dist/_dts/sdk/src/next/index.d.ts +7 -7
  35. package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
  36. package/dist/_dts/sdk/src/page-converter/index.d.ts +3 -3
  37. package/dist/_dts/sdk/src/portal/client.d.ts +3 -2
  38. package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
  39. package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
  40. package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
  41. package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
  42. package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
  43. package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +1 -1
  44. package/dist/_dts/sdk/src/rendering/helpers/loadPage.d.ts +1 -1
  45. package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +5 -177
  46. package/dist/_dts/sdk/src/rendering/index.d.ts +7 -7
  47. package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
  48. package/dist/_dts/sdk/src/rendering/server.d.ts +3 -3
  49. package/dist/_dts/sdk/src/rendering/themeAdmission.d.ts +1 -1
  50. package/dist/_dts/sdk/src/routing/index.d.ts +5 -5
  51. package/dist/_dts/sdk/src/server.d.ts +5 -5
  52. package/dist/_dts/sdk/src/spam-protection/index.d.ts +2 -2
  53. package/dist/_dts/sdk/src/theme/index.d.ts +2 -1
  54. package/dist/_dts/{types-CwmB2NHU.d.ts → types-BXMX4z2j.d.ts} +7 -7
  55. package/dist/_dts/{types-DjVNADXR.d.ts → types-DXY64Xh4.d.ts} +4 -4
  56. package/dist/_dts/{types-Dmow_FI6.d.ts → types-lwSgCWZ4.d.ts} +11 -2
  57. package/dist/_dts/{validation-h8t1HLlL.d.ts → validation-C5xp--Fu.d.ts} +7 -4
  58. package/dist/client/{BlocksIslandsHydrator-DRVx_XLi.mjs → BlocksIslandsHydrator-CeYQQQs7.mjs} +17 -16
  59. package/dist/client/{BookingMailingListNote-CwrMzj-k.mjs → BookingMailingListNote-CDDWrY_W.mjs} +6 -6
  60. package/dist/client/{BookingPanelArrangement-C2_hFT6K.mjs → BookingPanelArrangement-BShQSial.mjs} +1 -1
  61. package/dist/client/{BookingQuestionFields-DZMrGvBh.mjs → BookingQuestionFields-MbvIo2jS.mjs} +3 -3
  62. package/dist/client/{CalendarNavigationChevron-Az1-TIEI.mjs → CalendarNavigationChevron-C6CSVfEB.mjs} +36 -11
  63. package/dist/client/DemoBookingPortalAccess-C9Ggcfx3.mjs +545 -0
  64. package/dist/client/{EventCalendar.client-CDkkP-Lv.mjs → EventCalendar.client-BSMuSqg0.mjs} +15 -25
  65. package/dist/client/{EventCombined.client-DK3aaz62.mjs → EventCombined.client-BTrmSyUB.mjs} +25 -17
  66. package/dist/client/{EventItem-WeUipfIP.mjs → EventItem-B0WjGXsH.mjs} +4 -3
  67. package/dist/client/{EventListWeekNavigation-D3sbAeDo.mjs → EventListWeekNavigation-8Ij7vuxY.mjs} +1 -1
  68. package/dist/client/{EventListing.client-DL3gGGmF.mjs → EventListing.client-CWk2NEwd.mjs} +3 -3
  69. package/dist/client/{EventListing.view-DKFImKOx.mjs → EventListing.view-BEH4UbSL.mjs} +18 -8
  70. package/dist/client/{EventRegistrationPayment-Dn9TpWyL.mjs → EventRegistrationPayment-B2EikR3f.mjs} +635 -359
  71. package/dist/client/{LocationMapActions-BJT7MqP2.mjs → LocationMapActions-myIQIvQL.mjs} +1 -1
  72. package/dist/client/{MapDrawingSvg-DCIwlON6.mjs → MapDrawingSvg-BfsVyPvB.mjs} +2 -22
  73. package/dist/client/{Page-BpeP9xdt.mjs → Page-F3lhDvw1.mjs} +1036 -953
  74. package/dist/client/{DemoBookingPortalAccess-1p-pJ1lg.mjs → SiteTermsAgreementField-BYACYP0T.mjs} +4 -301
  75. package/dist/client/{StepIndicator-CP6zrwkl.mjs → StepIndicator-Bb7rPtSq.mjs} +37 -12
  76. package/dist/client/{accordion-nR7D4m1a.mjs → accordion-BfsOiweL.mjs} +1 -1
  77. package/dist/client/{booking-form.client-Ce-mQZ7W.mjs → booking-form.client-B8ohIj13.mjs} +229 -42
  78. package/dist/client/{bookingForm-B-qT_AQB.mjs → bookingForm-CXsck2oH.mjs} +4 -4
  79. package/dist/client/bookings.mjs +22 -15
  80. package/dist/client/{boxStyleClassNames-CrE3TDpW.mjs → boxStyleClassNames-B_hcuT06.mjs} +2 -1
  81. package/dist/client/{carousel-CVUOatsY.mjs → carousel-Cz5Ddbsx.mjs} +1 -1
  82. package/dist/client/{cart-DE0K6E0R.mjs → cart-CTC2oS3p.mjs} +3 -3
  83. package/dist/client/{cart.client-C23E6WQ5.mjs → cart.client-c1YkTC-Q.mjs} +1 -1
  84. package/dist/client/{checkout-76cdHyPL.mjs → checkout-BeW1ufaH.mjs} +3 -3
  85. package/dist/client/{checkout.client-DJOzqb26.mjs → checkout.client-BeU32khQ.mjs} +1 -1
  86. package/dist/client/{checkoutUrls-CvIP5DCO.mjs → checkoutUrls-DVfSUSKp.mjs} +1 -1
  87. package/dist/client/client.mjs +145 -21
  88. package/dist/client/{context-CNlesLfF.mjs → context-R9p5c8IH.mjs} +76 -58
  89. package/dist/client/{course-DHIrXqNT.mjs → course-CUFVJEAc.mjs} +2 -2
  90. package/dist/client/{creditProducts-KYMVIH3J.mjs → creditProducts-BQ1t1erI.mjs} +14 -61
  91. package/dist/client/{dateFormatting-B73Ll0s4.mjs → dateFormatting-CF6FWCoo.mjs} +1 -1
  92. package/dist/client/{demoPortalMagicLink-BVbLD4pi.mjs → demoPortalMagicLink-tZxIm3RL.mjs} +1 -1
  93. package/dist/client/display-4HYOb-AK.mjs +11844 -0
  94. package/dist/client/{enhanceHeaderSection-5GD5o4Mt.mjs → enhanceHeaderSection-DEYDI54E.mjs} +3 -3
  95. package/dist/client/{event-details.client-D7Oz1q2L.mjs → event-details.client-BwjBJP-f.mjs} +1 -1
  96. package/dist/client/{event-registration.client-zbuX36aA.mjs → event-registration.client-DWvSODTI.mjs} +176 -75
  97. package/dist/client/{eventCalendar-uZrksODt.mjs → eventCalendar-C9Pn9eeZ.mjs} +4 -4
  98. package/dist/client/{eventCombined-DxhvNAx8.mjs → eventCombined-Bdhk0fp0.mjs} +4 -4
  99. package/dist/client/{eventDetails-DCIH4BYG.mjs → eventDetails-C2LfNW_o.mjs} +2 -2
  100. package/dist/client/{eventListing-B9KrnPvc.mjs → eventListing-B-bJOQUk.mjs} +4 -4
  101. package/dist/client/{eventRegistration-TjnURMKl.mjs → eventRegistration-CbdmUiDT.mjs} +4 -4
  102. package/dist/client/{form-CfqIAhfN.mjs → form-BbUUt784.mjs} +3 -3
  103. package/dist/client/{form.client-CL6fF0cW.mjs → form.client-BVlz-9_t.mjs} +4 -4
  104. package/dist/client/{form.parts-Bf-L66Gg.mjs → form.parts-TB4UIrML.mjs} +1 -1
  105. package/dist/client/{formatDate-Dp7POa9Y.mjs → formatDate-TDHhFjFN.mjs} +1 -1
  106. package/dist/client/gifting/client.mjs +5 -3
  107. package/dist/client/gifting-CbNSrp7C.mjs +28 -0
  108. package/dist/client/gifting.client-B__bGhFc.mjs +404 -0
  109. package/dist/client/gifting.parts-CTA1sDW6.mjs +86 -0
  110. package/dist/client/{headerSection-WVXtOcuW.mjs → headerSection-5Wn9nUW_.mjs} +2 -2
  111. package/dist/client/{display-Cf_j5stk.mjs → lookSurfaces-BwiNdgMU.mjs} +2951 -14395
  112. package/dist/client/{newsletter-form.client-Bb7GAZpO.mjs → newsletter-form.client-B17WYHxZ.mjs} +7 -5
  113. package/dist/client/{newsletter-form.parts-BqOVRdIc.mjs → newsletter-form.parts-DN9wD1ZG.mjs} +3 -3
  114. package/dist/client/{newsletterForm-DOVe-qY3.mjs → newsletterForm-DLMlxInp.mjs} +3 -3
  115. package/dist/client/{noop-D5mFWXtN.mjs → noop-CaQxI-Js.mjs} +94 -36
  116. package/dist/client/portal/client.mjs +313 -148
  117. package/dist/client/{product-detail.client-CNzeFnFf.mjs → product-detail.client-Di_anRGR.mjs} +1 -1
  118. package/dist/client/{product-list.client-LKpzC7pj.mjs → product-list.client-Duhl6rtL.mjs} +1 -1
  119. package/dist/client/{productDetail-D2JNeEgx.mjs → productDetail-BgKmCwA8.mjs} +3 -3
  120. package/dist/client/{productList-DTgZXOEq.mjs → productList-C_wMKsYS.mjs} +3 -3
  121. package/dist/client/{propsDecoder-mpBQt2AT.mjs → propsDecoder-y3LvxaiG.mjs} +4 -3
  122. package/dist/client/{registry.server-DdTJyar2.mjs → registry.server-CIWYKz1V.mjs} +369 -246
  123. package/dist/client/rendering/client.mjs +25 -491
  124. package/dist/client/rendering/islands.mjs +1 -1
  125. package/dist/client/rendering.mjs +87 -21
  126. package/dist/client/{richText-coerce-C32cRQ03.mjs → richText-coerce-DkPBFb_a.mjs} +1 -1
  127. package/dist/client/{routeIslandApiConfig-8cfSgT0E.mjs → routeIslandApiConfig-BgO0rZce.mjs} +1 -1
  128. package/dist/client/{shop-5LBhftWx.mjs → shop-CFbWlv_W.mjs} +3 -3
  129. package/dist/client/{shop-discount-apply.state-D0ifS6KX.mjs → shop-add-feedback-DvC2kP1K.mjs} +1 -78
  130. package/dist/client/{shop-commerce-DkValjZj.mjs → shop-commerce-C-I29eaA.mjs} +64 -32
  131. package/dist/client/{shop-commerce-store-BOmXFmk_.mjs → shop-commerce-store-DGcc7twO.mjs} +1 -1
  132. package/dist/client/shop-discount-apply.state-DOm7vx0X.mjs +83 -0
  133. package/dist/client/{shop.client-BTtZqNmv.mjs → shop.client-GHTWUKD6.mjs} +56 -19
  134. package/dist/client/{shop.interactive-DNRqG4aX.mjs → shop.interactive-CxDJ8P2r.mjs} +113 -35
  135. package/dist/client/{shopShared-Nky6kPYr.mjs → shopShared-Be9QJJpT.mjs} +2 -2
  136. package/dist/client/{timetableModel-DZArznD_.mjs → timetableModel--R0zVzZO.mjs} +10 -10
  137. package/dist/client/{useAvailableSlots-CUVRD1nx.mjs → useAvailableSlots-BGu_2F50.mjs} +3 -3
  138. package/dist/client/{useDiscountCodeUi-d7viY_mu.mjs → useDiscountCodeUi-I_mXI9Yd.mjs} +32 -17
  139. package/dist/client/{useEventPagination-Da2JqxGC.mjs → useEventPagination-DxIJ--JZ.mjs} +7 -6
  140. package/dist/client/{view-BvuYmQJ5.mjs → view-3foOzGWR.mjs} +3 -2
  141. package/dist/client/{view-D9ObkFtz.mjs → view-BbzH5MQb.mjs} +128 -32
  142. package/dist/preview-next/client/{PageSectionToolbar-DwxHT-2k.mjs → PageSectionToolbar-0xyUPWUB.mjs} +4 -4
  143. package/dist/preview-next/client/{PreviewEditorSidebar-D4SBxGU6.mjs → PreviewEditorSidebar-D8vUzXtI.mjs} +61 -55
  144. package/dist/preview-next/client/{PreviewEditorUI-D8mUct32.mjs → PreviewEditorUI-CRjS4gAu.mjs} +4 -4
  145. package/dist/preview-next/client/{PreviewShell-L2AEdNUQ.mjs → PreviewShell-BvdBdeH_.mjs} +5 -5
  146. package/dist/preview-next/client/{SdkPreviewModeRuntime-bhVAU2D2.mjs → SdkPreviewModeRuntime-DWTyKbFj.mjs} +156 -143
  147. package/dist/preview-next/client/{previewAssistantSlot-Jpj_HDra.mjs → previewAssistantSlot-BqY2TTcZ.mjs} +4535 -2913
  148. package/dist/preview-next/client/{previewChromeRoot-CYTDvx4u.mjs → previewChromeRoot-BuRYe2iL.mjs} +1 -1
  149. package/dist/preview-next/client/runtime.mjs +3 -3
  150. package/dist/preview-next/client/{sdk-runtime-CZHX6J_4.mjs → sdk-runtime-BnK5kH9f.mjs} +2 -2
  151. package/dist/preview-next/client/{siteStyleAccess-DmGIG9Hk.mjs → siteStyleAccess-DbKozRSn.mjs} +527 -236
  152. package/dist/preview-next/client/{useAutosaveStatus-DQCyswQ-.mjs → useAutosaveStatus-D9s6dyMW.mjs} +1 -1
  153. package/dist/preview-next/client/{useOpenBlockForSetup-LwE5yXvL.mjs → useOpenBlockForSetup-Ce4WCxpT.mjs} +28 -5
  154. package/dist/preview-next/container-responsive.css +51 -3
  155. package/dist/preview-next/keepAlive.mjs +1 -1
  156. package/dist/preview-next/middleware.mjs +1 -1
  157. package/dist/preview-next/{route-contract-BOuNcOcN.mjs → route-contract-BYezcMx5.mjs} +94 -12
  158. package/dist/server/{Block.shared-wfJfhs08.mjs → Block.shared-Cn7gg13_.mjs} +84 -16
  159. package/dist/server/{ThemeScopeCore-BtrJNHTB.mjs → ThemeScopeCore-DFEM1a85.mjs} +16 -2
  160. package/dist/server/{bindings-P1CF2Gm6.mjs → bindings-VGgS6UvF.mjs} +13 -34
  161. package/dist/server/{client-CGtU5fHI.mjs → client-Bvag5OtW.mjs} +145 -22
  162. package/dist/server/config-validation.mjs +1 -1
  163. package/dist/server/config.mjs +2 -2
  164. package/dist/server/{customCss-BGB8gMVb.mjs → customCss-BZ8YSrQg.mjs} +1 -0
  165. package/dist/server/data/resolveBlockData.mjs +1 -1
  166. package/dist/server/index.mjs +2 -2
  167. package/dist/server/{loadContent-ChnkJSay.mjs → loadContent-CxASA3PE.mjs} +6 -9
  168. package/dist/server/{loadPage-DesHhgxj.mjs → loadPage-CQgde5DN.mjs} +2 -2
  169. package/dist/server/{lookMediaFrame-BBr0mkze.mjs → lookMediaFrame-CaH018pK.mjs} +24 -5
  170. package/dist/server/mapLocation-BM5WX7FY.mjs +315 -0
  171. package/dist/server/next.mjs +35 -9
  172. package/dist/server/{overrideResolution-DHEkHcZs.mjs → overrideResolution-BqVLO4gX.mjs} +1 -1
  173. package/dist/server/page-converter.mjs +1 -1
  174. package/dist/server/{pageRenderPlan-0jvm0RBk.mjs → pageRenderPlan-CfSnAkCO.mjs} +67 -40
  175. package/dist/server/{pageRuntimeSupport-8-f1Zr9e.mjs → pageRuntimeSupport-uz4gzBOo.mjs} +7 -15
  176. package/dist/server/{pageShared-CuVFoV4z.mjs → pageShared-D23o5QgC.mjs} +1068 -891
  177. package/dist/server/{parseThemeForPersistence-Cwqb5pZx.mjs → parseThemeForPersistence-DOsfofCy.mjs} +1 -1
  178. package/dist/server/{prebuild-Bms_Y7wQ.mjs → prebuild-BuoXWT9y.mjs} +1 -1
  179. package/dist/server/prebuild.mjs +1 -1
  180. package/dist/server/{prefetchBlockData-5oC5kyHe.mjs → prefetchBlockData-CCiYV8_s.mjs} +21 -6
  181. package/dist/server/{registry-DmqxC8th.mjs → registry-CXRXsFSx.mjs} +19721 -19621
  182. package/dist/server/rendering/components/pageShared.mjs +1 -1
  183. package/dist/server/rendering/helpers/loadPage.mjs +1 -1
  184. package/dist/server/rendering/helpers/pageRuntimeSupport.mjs +1 -1
  185. package/dist/server/rendering/server.mjs +4 -4
  186. package/dist/server/rendering.mjs +7 -7
  187. package/dist/server/{resolveBlockData-EYogtwQc.mjs → resolveBlockData-yfe8WLEA.mjs} +1 -1
  188. package/dist/server/{responseMedia-DpBC1hTM.mjs → responseMedia-F-ElH2Rd.mjs} +1 -0
  189. package/dist/server/{schema-CUDHMirj.mjs → schema-BpsqaSSU.mjs} +2 -2
  190. package/dist/server/server.mjs +3 -3
  191. package/dist/server/theme-bridge.mjs +1 -1
  192. package/dist/server/theme.mjs +2 -2
  193. package/dist/server/{validation-Bt_8IL1g.mjs → validation-CozQ7wE0.mjs} +4 -4
  194. package/dist/server/{version-DT_efohp.mjs → version-CgCWRFEY.mjs} +1 -1
  195. package/dist/styles/index.css +295 -37
  196. package/package.json +1 -1
  197. package/dist/client/useDiscountApply-BBnStWXU.mjs +0 -199
  198. package/dist/server/identity-DQD_8lNO.mjs +0 -6
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { t as BlockApiProvider } from "./context-R9p5c8IH.mjs";
3
+ import { t as defineIslandPropsDecoder } from "./propsDecoder-y3LvxaiG.mjs";
4
+ import { s as readChosenGiftAmounts } from "./gifting.parts-CTA1sDW6.mjs";
5
+ import { t as GiftingClient } from "./gifting.client-B__bGhFc.mjs";
6
+ import { t as mountReactIsland } from "./reactMount-DFQy3CmO.mjs";
7
+ import "react";
8
+ import { jsx } from "react/jsx-runtime";
9
+ //#region src/rendering/islands/enhancers/gifting.tsx
10
+ const decode = defineIslandPropsDecoder("gifting");
11
+ const enhance = (root, props) => {
12
+ const { siteId, apiBaseUrl } = props;
13
+ if (!siteId) throw new Error("[sdk:islands] gifting requires siteId");
14
+ if (!apiBaseUrl) throw new Error("[sdk:islands] gifting requires apiBaseUrl");
15
+ return mountReactIsland(root, /* @__PURE__ */ jsx(BlockApiProvider, {
16
+ config: {
17
+ baseUrl: apiBaseUrl,
18
+ auth: { type: "none" },
19
+ siteId
20
+ },
21
+ children: /* @__PURE__ */ jsx(GiftingClient, {
22
+ ...props,
23
+ chosenAmounts: readChosenGiftAmounts(root)
24
+ })
25
+ }));
26
+ };
27
+ //#endregion
28
+ export { decode, enhance };
@@ -0,0 +1,404 @@
1
+ "use client";
2
+ import { bn as formatCurrencyAmount, n as assertNever } from "./noop-CaQxI-Js.mjs";
3
+ import { i as useSiteTermsAgreement, n as SiteTermsChangedNotice, t as SiteTermsAgreementField } from "./SiteTermsAgreementField-BYACYP0T.mjs";
4
+ import { n as useBlockApi } from "./context-R9p5c8IH.mjs";
5
+ import { r as ThemedButton } from "./ThemedButton-DuaYtnvG.mjs";
6
+ import { t as FeedbackMessage } from "./FeedbackMessage-CSJrAuXH.mjs";
7
+ import { a as giftingEyebrow, i as firstGiftAmountChoice, n as GiftCardAmounts, o as giftingSlot, r as GiftingPanelHead } from "./gifting.parts-CTA1sDW6.mjs";
8
+ import { startTransition, useEffect, useReducer, useRef, useState } from "react";
9
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ //#region ../blocks/src/system/runtime/nodes/gifting.client.state.ts
11
+ function createInitialGiftingClientState(initialOffers) {
12
+ return {
13
+ offers: initialOffers,
14
+ submittingOfferId: null,
15
+ errorMessage: null,
16
+ purchaseNotice: null,
17
+ submissions: /* @__PURE__ */ new Map()
18
+ };
19
+ }
20
+ function giftingClientReducer(state, action) {
21
+ switch (action.type) {
22
+ case "offersLoaded": return {
23
+ ...state,
24
+ offers: action.offers,
25
+ errorMessage: null
26
+ };
27
+ case "offersFailed": return {
28
+ ...state,
29
+ errorMessage: action.message
30
+ };
31
+ case "checkoutStarted": return {
32
+ ...state,
33
+ submittingOfferId: action.offerId,
34
+ errorMessage: null,
35
+ submissions: new Map([...state.submissions, [action.offerId, action.submission]])
36
+ };
37
+ case "checkoutFailed": return {
38
+ ...state,
39
+ submittingOfferId: null,
40
+ errorMessage: action.message
41
+ };
42
+ case "purchaseNoticeResolved": return {
43
+ ...state,
44
+ purchaseNotice: action.notice
45
+ };
46
+ case "pageRestored": return {
47
+ ...state,
48
+ submittingOfferId: null
49
+ };
50
+ default: return assertNever(action);
51
+ }
52
+ }
53
+ function resolveGiftingPurchaseNotice(search, defaultSuccessMessage) {
54
+ switch (new URLSearchParams(search).get("gifting")) {
55
+ case null: return null;
56
+ case "success": return {
57
+ kind: "success",
58
+ message: defaultSuccessMessage
59
+ };
60
+ case "cancelled": return {
61
+ kind: "cancelled",
62
+ message: "Purchase cancelled."
63
+ };
64
+ default: return null;
65
+ }
66
+ }
67
+ function toGiftingControllerProps(props) {
68
+ return {
69
+ className: props.render.display.className,
70
+ heading: props.render.display.heading,
71
+ intro: props.render.display.intro,
72
+ giftCardsHeading: props.render.display.giftCardsHeading,
73
+ vouchersHeading: props.render.display.vouchersHeading,
74
+ emptyStateText: props.render.display.emptyStateText,
75
+ checkoutButtonText: props.render.hydration.checkoutButtonText,
76
+ successMessage: props.render.hydration.successMessage
77
+ };
78
+ }
79
+ function buildGiftingCheckoutReturnUrl(currentHref, kind) {
80
+ const url = new URL(currentHref);
81
+ url.searchParams.set("gifting", kind);
82
+ return url.toString();
83
+ }
84
+ function hasPublicGiftingOffers(offers) {
85
+ return Boolean((offers?.giftCards.length ?? 0) > 0 || (offers?.vouchers.length ?? 0) > 0);
86
+ }
87
+ function buildGiftingCheckoutInput(formData, input) {
88
+ const readFormString = (name) => {
89
+ const value = formData.get(name);
90
+ return typeof value === "string" ? value : "";
91
+ };
92
+ const selectedAmount = formData.get("amountChoice");
93
+ const customAmount = formData.get("customAmount");
94
+ const amountCents = input.kind === "gift_card" ? selectedAmount === "custom" ? Math.round(Number(customAmount ?? 0) * 100) : Number(selectedAmount ?? 0) : null;
95
+ return {
96
+ purchaseToken: input.purchaseToken,
97
+ offerId: input.offerId,
98
+ purchaserName: readFormString("purchaserName") || null,
99
+ purchaserEmail: readFormString("purchaserEmail"),
100
+ recipientName: readFormString("recipientName") || null,
101
+ recipientEmail: readFormString("recipientEmail"),
102
+ message: readFormString("message") || null,
103
+ amountCents,
104
+ sendOnDate: readFormString("sendOnDate") || null,
105
+ successUrl: input.successUrl,
106
+ cancelUrl: input.cancelUrl
107
+ };
108
+ }
109
+ /** Retries of the same form keep one purchase; changed details start another. */
110
+ function giftingSubmission(previous, fields, createToken) {
111
+ return previous?.fields === fields ? previous : {
112
+ fields,
113
+ token: createToken()
114
+ };
115
+ }
116
+ //#endregion
117
+ //#region ../blocks/src/system/runtime/nodes/gifting.client.tsx
118
+ function GiftingClient(props) {
119
+ const api = useBlockApi();
120
+ const siteTerms = useSiteTermsAgreement({
121
+ terms: props.render.hydration.siteTerms,
122
+ context: { kind: "purchase" }
123
+ });
124
+ const controller = toGiftingControllerProps(props);
125
+ const [state, dispatch] = useReducer(giftingClientReducer, props.render.hydration.offers, createInitialGiftingClientState);
126
+ useEffect(() => {
127
+ dispatch({
128
+ type: "purchaseNoticeResolved",
129
+ notice: resolveGiftingPurchaseNotice(window.location.search, props.render.hydration.successMessage)
130
+ });
131
+ }, [props.render.hydration.successMessage]);
132
+ useEffect(() => {
133
+ if (state.offers) return;
134
+ let cancelled = false;
135
+ startTransition(() => {
136
+ api.getPublicGiftingOffers().then((nextOffers) => {
137
+ if (!cancelled) dispatch({
138
+ type: "offersLoaded",
139
+ offers: nextOffers
140
+ });
141
+ }).catch((error) => {
142
+ if (!cancelled) dispatch({
143
+ type: "offersFailed",
144
+ message: error instanceof Error ? error.message : "Unable to load gift offers."
145
+ });
146
+ });
147
+ });
148
+ return () => {
149
+ cancelled = true;
150
+ };
151
+ }, [api, state.offers]);
152
+ useEffect(() => {
153
+ const onPageShow = (event) => {
154
+ if (event.persisted) dispatch({ type: "pageRestored" });
155
+ };
156
+ window.addEventListener("pageshow", onPageShow);
157
+ return () => window.removeEventListener("pageshow", onPageShow);
158
+ }, []);
159
+ const hasOffers = hasPublicGiftingOffers(state.offers);
160
+ async function handleSubmit(event, offerId, kind) {
161
+ event.preventDefault();
162
+ if (!siteTerms.requireAgreement("commerce")) return;
163
+ const formData = new FormData(event.currentTarget);
164
+ const fields = JSON.stringify([...formData.entries()]);
165
+ const submission = giftingSubmission(state.submissions.get(offerId), fields, () => crypto.randomUUID());
166
+ dispatch({
167
+ type: "checkoutStarted",
168
+ offerId,
169
+ submission
170
+ });
171
+ try {
172
+ const checkout = await siteTerms.api.createGiftingCheckout(buildGiftingCheckoutInput(formData, {
173
+ offerId,
174
+ purchaseToken: submission.token,
175
+ kind,
176
+ successUrl: buildGiftingCheckoutReturnUrl(window.location.href, "success"),
177
+ cancelUrl: buildGiftingCheckoutReturnUrl(window.location.href, "cancelled")
178
+ }));
179
+ window.location.href = checkout.checkoutUrl;
180
+ } catch (error) {
181
+ dispatch({
182
+ type: "checkoutFailed",
183
+ message: error instanceof Error ? error.message : "Unable to start checkout."
184
+ });
185
+ }
186
+ }
187
+ const offers = state.offers;
188
+ const currency = offers?.currency ?? "GBP";
189
+ const giftCards = offers?.giftCards ?? [];
190
+ const vouchers = offers?.vouchers ?? [];
191
+ const eyebrow = giftingEyebrow(offers, {
192
+ giftCards: controller.giftCardsHeading ?? "Gift cards",
193
+ vouchers: controller.vouchersHeading ?? "Vouchers"
194
+ });
195
+ const look = props.render.display;
196
+ const purchaseFields = (offerId) => /* @__PURE__ */ jsx(GiftingPurchaseFields, {
197
+ siteTerms,
198
+ submitting: state.submittingOfferId === offerId,
199
+ buttonText: controller.checkoutButtonText ?? "Continue"
200
+ });
201
+ return /* @__PURE__ */ jsx("section", {
202
+ className: controller.className ?? void 0,
203
+ "data-block": "gifting",
204
+ children: /* @__PURE__ */ jsxs("div", {
205
+ className: "gifting-panel",
206
+ ...giftingSlot(look, "panel"),
207
+ children: [
208
+ /* @__PURE__ */ jsx(GiftingPanelHead, {
209
+ eyebrow,
210
+ heading: props.render.display.heading,
211
+ intro: props.render.display.intro,
212
+ look
213
+ }),
214
+ state.purchaseNotice ? /* @__PURE__ */ jsx(FeedbackMessage, {
215
+ tone: state.purchaseNotice.kind === "success" ? "success" : "warning",
216
+ className: "gifting-feedback",
217
+ role: "status",
218
+ children: state.purchaseNotice.message
219
+ }) : null,
220
+ state.errorMessage ? /* @__PURE__ */ jsx(FeedbackMessage, {
221
+ tone: "error",
222
+ className: "gifting-feedback",
223
+ role: "alert",
224
+ children: state.errorMessage
225
+ }) : null,
226
+ /* @__PURE__ */ jsx(SiteTermsChangedNotice, { message: siteTerms.notice }),
227
+ hasOffers ? /* @__PURE__ */ jsxs("div", {
228
+ className: "gifting-panel-offers",
229
+ children: [giftCards.map((offer) => /* @__PURE__ */ jsx(GiftCardOfferForm, {
230
+ offer,
231
+ currency,
232
+ showTitle: giftCards.length > 1,
233
+ initialAmount: props.chosenAmounts?.[offer.id],
234
+ look,
235
+ onSubmit: (event) => void handleSubmit(event, offer.id, "gift_card"),
236
+ fields: purchaseFields(offer.id)
237
+ }, offer.id)), vouchers.map((offer) => /* @__PURE__ */ jsxs(RevealingOfferForm, {
238
+ buyLabel: "Buy this voucher",
239
+ look,
240
+ onSubmit: (event) => void handleSubmit(event, offer.id, "voucher"),
241
+ fields: purchaseFields(offer.id),
242
+ children: [/* @__PURE__ */ jsxs("div", {
243
+ className: "gifting-offer-summary",
244
+ children: [/* @__PURE__ */ jsx("h3", {
245
+ className: "gifting-offer-title",
246
+ children: offer.title
247
+ }), /* @__PURE__ */ jsx("strong", { children: formatCurrencyAmount(offer.voucher.purchaseAmountCents, currency) })]
248
+ }), offer.description ? /* @__PURE__ */ jsx("p", {
249
+ className: "gifting-offer-description",
250
+ children: offer.description
251
+ }) : null]
252
+ }, offer.id))]
253
+ }) : /* @__PURE__ */ jsx("p", {
254
+ className: "gifting-empty",
255
+ children: controller.emptyStateText ?? "Nothing is available right now."
256
+ })
257
+ ]
258
+ })
259
+ });
260
+ }
261
+ function GiftCardOfferForm(props) {
262
+ const { offer, currency } = props;
263
+ const [amountChoice, setAmountChoice] = useState(() => props.initialAmount ?? firstGiftAmountChoice(offer));
264
+ return /* @__PURE__ */ jsxs(RevealingOfferForm, {
265
+ buyLabel: "Buy a gift card",
266
+ look: props.look,
267
+ onSubmit: props.onSubmit,
268
+ fields: props.fields,
269
+ row: /* @__PURE__ */ jsx(GiftCardAmounts, {
270
+ offer,
271
+ currency,
272
+ initialChoice: props.initialAmount,
273
+ onChoose: setAmountChoice,
274
+ look: props.look
275
+ }),
276
+ extraFields: amountChoice === "custom" ? /* @__PURE__ */ jsx(CustomGiftAmount, { offer }) : null,
277
+ children: [props.showTitle ? /* @__PURE__ */ jsx("h3", {
278
+ className: "gifting-offer-title",
279
+ children: offer.title
280
+ }) : null, offer.description ? /* @__PURE__ */ jsx("p", {
281
+ className: "gifting-offer-description",
282
+ children: offer.description
283
+ }) : null]
284
+ });
285
+ }
286
+ function CustomGiftAmount({ offer }) {
287
+ const min = offer.giftCard.customAmountMinCents / 100;
288
+ const max = offer.giftCard.customAmountMaxCents / 100;
289
+ return /* @__PURE__ */ jsxs("label", {
290
+ className: "gifting-field",
291
+ children: [/* @__PURE__ */ jsx("span", { children: "Amount" }), /* @__PURE__ */ jsx("input", {
292
+ type: "number",
293
+ name: "customAmount",
294
+ required: true,
295
+ min,
296
+ max,
297
+ step: "1",
298
+ placeholder: `${min} - ${max}`
299
+ })]
300
+ });
301
+ }
302
+ /** The panel stays short until someone wants to buy: the details open from the buy button, and focus moves to them. */
303
+ function RevealingOfferForm(props) {
304
+ const [open, setOpen] = useState(false);
305
+ const detailsRef = useRef(null);
306
+ useEffect(() => {
307
+ if (open) detailsRef.current?.querySelector("input")?.focus();
308
+ }, [open]);
309
+ return /* @__PURE__ */ jsxs("form", {
310
+ onSubmit: props.onSubmit,
311
+ className: "gifting-offer",
312
+ children: [
313
+ props.children,
314
+ /* @__PURE__ */ jsxs("div", {
315
+ className: "gifting-offer-row",
316
+ "data-gift-offer-row": "",
317
+ children: [props.row, open ? null : /* @__PURE__ */ jsx(ThemedButton, {
318
+ ...giftingSlot(props.look, "action"),
319
+ type: "button",
320
+ variant: "primary",
321
+ size: "md",
322
+ extraClassName: "gifting-buy",
323
+ label: props.buyLabel,
324
+ onClick: () => setOpen(true)
325
+ })]
326
+ }),
327
+ open ? /* @__PURE__ */ jsxs("div", {
328
+ ref: detailsRef,
329
+ className: "gifting-fields",
330
+ children: [props.extraFields, props.fields]
331
+ }) : null
332
+ ]
333
+ });
334
+ }
335
+ function GiftingCustomerFields() {
336
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
337
+ /* @__PURE__ */ jsxs("div", {
338
+ className: "gifting-field-grid",
339
+ children: [
340
+ /* @__PURE__ */ jsxs("label", {
341
+ className: "gifting-field",
342
+ children: [/* @__PURE__ */ jsx("span", { children: "Your name" }), /* @__PURE__ */ jsx("input", { name: "purchaserName" })]
343
+ }),
344
+ /* @__PURE__ */ jsxs("label", {
345
+ className: "gifting-field",
346
+ children: [/* @__PURE__ */ jsx("span", { children: "Your email" }), /* @__PURE__ */ jsx("input", {
347
+ name: "purchaserEmail",
348
+ type: "email",
349
+ required: true
350
+ })]
351
+ }),
352
+ /* @__PURE__ */ jsxs("label", {
353
+ className: "gifting-field",
354
+ children: [/* @__PURE__ */ jsx("span", { children: "Recipient name" }), /* @__PURE__ */ jsx("input", { name: "recipientName" })]
355
+ }),
356
+ /* @__PURE__ */ jsxs("label", {
357
+ className: "gifting-field",
358
+ children: [/* @__PURE__ */ jsx("span", { children: "Recipient email" }), /* @__PURE__ */ jsx("input", {
359
+ name: "recipientEmail",
360
+ type: "email",
361
+ required: true
362
+ })]
363
+ })
364
+ ]
365
+ }),
366
+ /* @__PURE__ */ jsxs("label", {
367
+ className: "gifting-field",
368
+ children: [/* @__PURE__ */ jsx("span", { children: "Message" }), /* @__PURE__ */ jsx("textarea", {
369
+ name: "message",
370
+ rows: 4
371
+ })]
372
+ }),
373
+ /* @__PURE__ */ jsxs("label", {
374
+ className: "gifting-field",
375
+ children: [/* @__PURE__ */ jsx("span", { children: "Send on" }), /* @__PURE__ */ jsx("input", {
376
+ name: "sendOnDate",
377
+ type: "date"
378
+ })]
379
+ })
380
+ ] });
381
+ }
382
+ function GiftingPurchaseFields(props) {
383
+ const { siteTerms } = props;
384
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
385
+ /* @__PURE__ */ jsx(GiftingCustomerFields, {}),
386
+ /* @__PURE__ */ jsx(SiteTermsAgreementField, {
387
+ agreement: siteTerms.view,
388
+ onChange: siteTerms.onChange,
389
+ error: siteTerms.error,
390
+ disabled: siteTerms.disabled || props.submitting
391
+ }),
392
+ /* @__PURE__ */ jsx(ThemedButton, {
393
+ type: "submit",
394
+ variant: "primary",
395
+ size: "md",
396
+ extraClassName: "gifting-buy",
397
+ pending: props.submitting ? { label: "Starting checkout…" } : void 0,
398
+ disabled: props.submitting,
399
+ label: props.buttonText
400
+ })
401
+ ] });
402
+ }
403
+ //#endregion
404
+ export { GiftingClient as t };
@@ -0,0 +1,86 @@
1
+ "use client";
2
+ import { bn as formatCurrencyAmount } from "./noop-CaQxI-Js.mjs";
3
+ import { r as listLookSlot } from "./lookSurfaces-BwiNdgMU.mjs";
4
+ import "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ //#region ../blocks/src/system/runtime/nodes/gifting.parts.tsx
7
+ const CUSTOM_GIFT_AMOUNT = "custom";
8
+ /** A Look's hook (and, for the panel, its surface) on one part of the gifting panel; nothing outside a Look. */
9
+ function giftingSlot(look, slot) {
10
+ return listLookSlot(look ?? {}, slot);
11
+ }
12
+ /** The word above the heading: only one kind on offer names it here, two kinds label their own groups. */
13
+ function giftingEyebrow(offers, headings) {
14
+ const giftCards = offers?.giftCards.length ?? 0;
15
+ const vouchers = offers?.vouchers.length ?? 0;
16
+ if (giftCards > 0 && vouchers === 0) return headings.giftCards;
17
+ if (vouchers > 0 && giftCards === 0) return headings.vouchers;
18
+ return null;
19
+ }
20
+ function GiftingPanelHead(props) {
21
+ const { look } = props;
22
+ return /* @__PURE__ */ jsxs("div", {
23
+ className: "gifting-panel-head",
24
+ ...giftingSlot(look, "head"),
25
+ children: [
26
+ props.eyebrow ? /* @__PURE__ */ jsx("span", {
27
+ className: "gifting-eyebrow",
28
+ ...giftingSlot(look, "eyebrow"),
29
+ children: props.eyebrow
30
+ }) : null,
31
+ /* @__PURE__ */ jsx("h2", {
32
+ className: "gifting-heading",
33
+ ...giftingSlot(look, "heading"),
34
+ children: props.heading
35
+ }),
36
+ props.intro ? /* @__PURE__ */ jsx("p", {
37
+ className: "gifting-intro",
38
+ ...giftingSlot(look, "intro"),
39
+ children: props.intro
40
+ }) : null
41
+ ]
42
+ });
43
+ }
44
+ /** Amount buttons are radios, so they keep working from the keyboard and post with the form. */
45
+ function GiftCardAmounts(props) {
46
+ const { offer, currency, disabled, onChoose } = props;
47
+ const denominations = offer.giftCard.fixedDenominations;
48
+ const checkedChoice = props.initialChoice ?? firstGiftAmountChoice(offer);
49
+ const chip = (value, label) => /* @__PURE__ */ jsxs("label", {
50
+ className: "gifting-amount",
51
+ children: [/* @__PURE__ */ jsx("input", {
52
+ type: "radio",
53
+ name: props.groupName ?? "amountChoice",
54
+ value,
55
+ required: true,
56
+ disabled,
57
+ defaultChecked: value === checkedChoice,
58
+ onChange: onChoose ? () => onChoose(value) : void 0
59
+ }), /* @__PURE__ */ jsx("span", {
60
+ ...giftingSlot(props.look, "chip"),
61
+ children: label
62
+ })]
63
+ }, value);
64
+ return /* @__PURE__ */ jsxs("fieldset", {
65
+ className: "gifting-amounts",
66
+ ...giftingSlot(props.look, "chips"),
67
+ children: [
68
+ /* @__PURE__ */ jsx("legend", {
69
+ className: "gifting-visually-hidden",
70
+ children: "Amount"
71
+ }),
72
+ denominations.map((amount) => chip(String(amount), formatCurrencyAmount(amount, currency))),
73
+ offer.giftCard.customAmountEnabled ? chip(CUSTOM_GIFT_AMOUNT, "Another amount") : null
74
+ ]
75
+ });
76
+ }
77
+ function firstGiftAmountChoice(offer) {
78
+ const first = offer.giftCard.fixedDenominations[0];
79
+ return first === void 0 ? CUSTOM_GIFT_AMOUNT : String(first);
80
+ }
81
+ function readChosenGiftAmounts(root) {
82
+ const entries = Array.from(root.querySelectorAll("[data-gift-offer]"), (offer) => [offer.dataset.giftOffer ?? "", offer.querySelector("input[type=\"radio\"]:checked")?.value ?? ""]);
83
+ return Object.fromEntries(entries.filter(([id, amount]) => id !== "" && amount !== ""));
84
+ }
85
+ //#endregion
86
+ export { giftingEyebrow as a, firstGiftAmountChoice as i, GiftCardAmounts as n, giftingSlot as o, GiftingPanelHead as r, readChosenGiftAmounts as s, CUSTOM_GIFT_AMOUNT as t };
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { t as defineIslandPropsDecoder } from "./propsDecoder-mpBQt2AT.mjs";
3
- import { t as mountHeaderChromeRuntime } from "./enhanceHeaderSection-5GD5o4Mt.mjs";
2
+ import { t as defineIslandPropsDecoder } from "./propsDecoder-y3LvxaiG.mjs";
3
+ import { t as mountHeaderChromeRuntime } from "./enhanceHeaderSection-DEYDI54E.mjs";
4
4
  //#region src/rendering/islands/enhancers/headerSection.ts
5
5
  const decode = defineIslandPropsDecoder("headerSection");
6
6
  const enhance = (root, props) => {