efficient-storefront-blocks 0.75.0 → 0.76.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 (248) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/chunks/EditorPreviewCheckout-ANI7HUYX.js +4 -0
  3. package/dist/chunks/{SiteEditorProvider-N4T55FAV.js → SiteEditorProvider-AJUWZYHT.js} +1 -1
  4. package/dist/chunks/chunk-3IQQNZIM.js +311 -0
  5. package/dist/chunks/chunk-4F5CAFXO.js +1 -0
  6. package/dist/chunks/chunk-YAYHH5GY.js +1 -0
  7. package/dist/chunks/{chunk-K26JUDGZ.js → chunk-YFPWVNDB.js} +1 -1
  8. package/dist/chunks/{fitment-data-5ZSHENM3.js → fitment-data-IZYCNTET.js} +1 -1
  9. package/dist/contract.js +2 -2
  10. package/dist/editor/components/BlogSource.js +1 -1
  11. package/dist/editor/components/CategoryProductFields.d.ts +22 -0
  12. package/dist/editor/components/CategoryProductFields.js +1 -0
  13. package/dist/editor/components/CategorySource.d.ts +12 -0
  14. package/dist/editor/components/CategorySource.js +1 -1
  15. package/dist/editor/components/CollectionPicker.js +1 -1
  16. package/dist/editor/components/CountryShowAsTiles.js +1 -1
  17. package/dist/editor/components/EditorPreviewChat.js +1 -11
  18. package/dist/editor/components/EditorPreviewSurface.js +1 -1
  19. package/dist/editor/components/GalleryProductBinding.js +1 -1
  20. package/dist/editor/components/GalleryShowcaseSource.js +1 -1
  21. package/dist/editor/components/HeaderSettingsPanel.d.ts +8 -4
  22. package/dist/editor/components/HeaderSettingsPanel.js +1 -1
  23. package/dist/editor/components/MenuPicker.js +1 -1
  24. package/dist/editor/components/PreviewProductPicker.js +1 -1
  25. package/dist/editor/components/ProductHeroSource.js +1 -1
  26. package/dist/editor/components/ProductPicker.js +1 -1
  27. package/dist/editor/components/SocialLinksDoor.js +1 -1
  28. package/dist/editor/components/SpecTableSource.js +1 -1
  29. package/dist/editor/lib/document/block-align-row.d.ts +2 -0
  30. package/dist/editor/lib/document/block-align-row.js +1 -0
  31. package/dist/editor/lib/document/blocks/commerce/AccountBlock/fields.js +1 -1
  32. package/dist/editor/lib/document/blocks/commerce/AlloyWheelsListing/fields.js +1 -1
  33. package/dist/editor/lib/document/blocks/commerce/BundleOffer/fields.js +1 -1
  34. package/dist/editor/lib/document/blocks/commerce/CartBlock/fields.js +1 -1
  35. package/dist/editor/lib/document/blocks/commerce/CatalogFilterBar/fields.js +1 -1
  36. package/dist/editor/lib/document/blocks/commerce/CheckoutCTA/fields.js +1 -1
  37. package/dist/editor/lib/document/blocks/commerce/CollectionCard/fields.js +1 -1
  38. package/dist/editor/lib/document/blocks/commerce/Collections/fields.js +1 -1
  39. package/dist/editor/lib/document/blocks/commerce/CompatibleTyres/fields.js +1 -1
  40. package/dist/editor/lib/document/blocks/commerce/CountrySwitchBlock/fields.js +1 -1
  41. package/dist/editor/lib/document/blocks/commerce/DeliveryOptions/fields.js +1 -1
  42. package/dist/editor/lib/document/blocks/commerce/DetailRows/fields.js +1 -1
  43. package/dist/editor/lib/document/blocks/commerce/EuTyreLabel/fields.js +1 -1
  44. package/dist/editor/lib/document/blocks/commerce/FitmentFinder/fields.js +1 -1
  45. package/dist/editor/lib/document/blocks/commerce/FitmentTable/fields.js +1 -1
  46. package/dist/editor/lib/document/blocks/commerce/Gallery/fields.js +1 -1
  47. package/dist/editor/lib/document/blocks/commerce/GalleryB/fields.js +1 -1
  48. package/dist/editor/lib/document/blocks/commerce/GalleryItem/fields.js +1 -1
  49. package/dist/editor/lib/document/blocks/commerce/ProductGallery/fields.d.ts +2 -2
  50. package/dist/editor/lib/document/blocks/commerce/ProductGallery/fields.js +1 -1
  51. package/dist/editor/lib/document/blocks/commerce/ProductGrid/fields.js +1 -1
  52. package/dist/editor/lib/document/blocks/commerce/ProductHero/fields.js +1 -1
  53. package/dist/editor/lib/document/blocks/commerce/RelatedProducts/fields.js +1 -1
  54. package/dist/editor/lib/document/blocks/commerce/SearchBlock/fields.js +1 -1
  55. package/dist/editor/lib/document/blocks/commerce/SpecTable/fields.js +1 -1
  56. package/dist/editor/lib/document/blocks/commerce/TyreFitment/fields.js +1 -1
  57. package/dist/editor/lib/document/blocks/commerce/TyreSizes/fields.js +1 -1
  58. package/dist/editor/lib/document/blocks/commerce/shared-fields.d.ts +1 -0
  59. package/dist/editor/lib/document/blocks/commerce/shared-fields.js +1 -1
  60. package/dist/editor/lib/document/blocks/service/AppointmentBooking/fields.js +1 -1
  61. package/dist/editor/lib/document/blocks/service/BookingBox/fields.js +1 -1
  62. package/dist/editor/lib/document/blocks/service/ContactCards/fields.js +1 -1
  63. package/dist/editor/lib/document/blocks/service/ContactRouting/fields.js +1 -1
  64. package/dist/editor/lib/document/blocks/service/Events/fields.js +1 -1
  65. package/dist/editor/lib/document/blocks/service/Footer/fields.js +1 -1
  66. package/dist/editor/lib/document/blocks/service/FooterDivider/fields.js +1 -1
  67. package/dist/editor/lib/document/blocks/service/FooterEmailSignup/fields.js +1 -1
  68. package/dist/editor/lib/document/blocks/service/FooterGroup/fields.js +1 -1
  69. package/dist/editor/lib/document/blocks/service/FooterLogo/fields.js +1 -1
  70. package/dist/editor/lib/document/blocks/service/FooterMenu/fields.js +1 -1
  71. package/dist/editor/lib/document/blocks/service/FooterMessaging/fields.js +1 -1
  72. package/dist/editor/lib/document/blocks/service/FooterPayment/fields.js +1 -1
  73. package/dist/editor/lib/document/blocks/service/FooterSocial/fields.js +1 -1
  74. package/dist/editor/lib/document/blocks/service/FooterText/fields.js +1 -1
  75. package/dist/editor/lib/document/blocks/service/Form/fields.js +1 -1
  76. package/dist/editor/lib/document/blocks/service/MessagingCards/fields.js +1 -1
  77. package/dist/editor/lib/document/blocks/service/OpeningHours/fields.js +1 -1
  78. package/dist/editor/lib/document/blocks/service/RateTable/fields.js +1 -1
  79. package/dist/editor/lib/document/blocks/service/RatingBlock/fields.js +1 -1
  80. package/dist/editor/lib/document/blocks/service/ReviewForm/fields.js +1 -1
  81. package/dist/editor/lib/document/blocks/service/Reviews/fields.js +1 -1
  82. package/dist/editor/lib/document/blocks/service/SiteHeader/fields.js +1 -1
  83. package/dist/editor/lib/document/blocks/service/SubmitBox/fields.js +1 -1
  84. package/dist/editor/lib/document/blocks/service/SubmitBuild/fields.js +1 -1
  85. package/dist/editor/lib/document/blocks/service/Subscribe/fields.js +1 -1
  86. package/dist/editor/lib/document/blocks/service/SubscribeBlogs/fields.js +1 -1
  87. package/dist/editor/lib/document/box-header.js +1 -1
  88. package/dist/editor/lib/document/config.d.ts +16 -16
  89. package/dist/editor/lib/document/config.js +1 -1
  90. package/dist/editor/lib/editor-currency-source.js +1 -1
  91. package/dist/editor/lib/storefront-editor-words.d.ts +10 -13
  92. package/dist/editor/lib/storefront-editor-words.js +1 -1
  93. package/dist/editor.css +1 -1
  94. package/dist/index.js +214 -724
  95. package/dist/links.js +1 -1
  96. package/dist/render/app/globals.css +32 -79
  97. package/dist/render/built-with.json +1 -1
  98. package/dist/render/components/BoxHeaderBar.js +1 -1
  99. package/dist/render/components/CartContext.d.ts +1 -0
  100. package/dist/render/components/CartContext.js +1 -1
  101. package/dist/render/components/CartDrawer.js +2 -2
  102. package/dist/render/components/CatalogFilterBarSection.d.ts +1 -1
  103. package/dist/render/components/CatalogFilterBarSection.js +1 -1
  104. package/dist/render/components/Collections.js +1 -1
  105. package/dist/render/components/CompatibleTyres.js +1 -1
  106. package/dist/render/components/ConsentPanel.js +1 -1
  107. package/dist/render/components/ContactRouting.js +1 -1
  108. package/dist/render/components/CouponField.js +1 -1
  109. package/dist/render/components/CurrencyContext.js +1 -1
  110. package/dist/render/components/Events.js +1 -1
  111. package/dist/render/components/FitmentTable.js +1 -1
  112. package/dist/render/components/FooterGroup.d.ts +1 -1
  113. package/dist/render/components/FooterGroup.js +1 -1
  114. package/dist/render/components/FooterLogo.d.ts +2 -1
  115. package/dist/render/components/FooterMenu.js +1 -1
  116. package/dist/render/components/FooterPayment.d.ts +1 -2
  117. package/dist/render/components/FooterPayment.js +1 -1
  118. package/dist/render/components/FooterSocial.d.ts +1 -2
  119. package/dist/render/components/FooterSocial.js +1 -1
  120. package/dist/render/components/FormBlock.js +1 -1
  121. package/dist/render/components/GalleryItem.js +1 -1
  122. package/dist/render/components/GalleryShowcase.js +1 -1
  123. package/dist/render/components/Header.js +1 -1
  124. package/dist/render/components/HeaderTools.js +1 -1
  125. package/dist/render/components/Lightbox.d.ts +2 -2
  126. package/dist/render/components/Lightbox.js +1 -1
  127. package/dist/render/components/LinkedProductHero.d.ts +2 -0
  128. package/dist/render/components/PopupFrame.d.ts +17 -4
  129. package/dist/render/components/PopupFrame.js +1 -1
  130. package/dist/render/components/ProductGallery.js +1 -1
  131. package/dist/render/components/ProductGridSection.js +1 -1
  132. package/dist/render/components/ProductHeroPanel.d.ts +3 -1
  133. package/dist/render/components/ProductHeroPanel.js +1 -1
  134. package/dist/render/components/ProductLightbox.js +1 -1
  135. package/dist/render/components/ReviewForm.js +1 -1
  136. package/dist/render/components/SpecTable.d.ts +2 -1
  137. package/dist/render/components/SpecTable.js +1 -1
  138. package/dist/render/components/SubscribePopup.js +2 -2
  139. package/dist/render/components/TyreRenderSvg.js +1 -1
  140. package/dist/render/components/booking/BookingRegions.js +1 -1
  141. package/dist/render/components/catalog/CatalogFilterBar.d.ts +4 -4
  142. package/dist/render/components/catalog/CatalogFilterBar.js +1 -1
  143. package/dist/render/components/catalog/CatalogFilterContext.d.ts +5 -3
  144. package/dist/render/components/catalog/CatalogFilterContext.js +1 -1
  145. package/dist/render/components/catalog/FilterPill.d.ts +3 -1
  146. package/dist/render/components/catalog/FilterPill.js +1 -1
  147. package/dist/render/components/checkout/CheckoutPageClient.js +1 -1
  148. package/dist/render/components/checkout/checkout-parts.js +1 -1
  149. package/dist/render/components/checkout/checkout-state.d.ts +12 -0
  150. package/dist/render/components/checkout/checkout-state.js +3 -3
  151. package/dist/render/components/fitment/StockFitmentCard.js +1 -1
  152. package/dist/render/components/pdp-dynamic/DynamicProductGallery.js +1 -1
  153. package/dist/render/components/pdp-dynamic/DynamicProductHero.d.ts +2 -0
  154. package/dist/render/components/pdp-dynamic/DynamicRelatedProducts.js +1 -1
  155. package/dist/render/components/pdp-dynamic/DynamicSpecTable.js +1 -1
  156. package/dist/render/components/pdp-dynamic/RecordPhotoGallery.js +1 -1
  157. package/dist/render/components/product-hero/TyreHeroFitment.js +1 -1
  158. package/dist/render/components/product-hero/VehicleQuestion.d.ts +1 -2
  159. package/dist/render/components/product-hero/VehicleQuestion.js +1 -1
  160. package/dist/render/components/product-hero/WheelHeroFitment.js +1 -1
  161. package/dist/render/components/product-hero/trust-bullets.d.ts +5 -0
  162. package/dist/render/components/product-hero/trust-bullets.js +1 -0
  163. package/dist/render/components/useModalDismiss.d.ts +2 -1
  164. package/dist/render/components/useModalDismiss.js +1 -1
  165. package/dist/render/components/wheels-plp/AlloyWheelsListing.js +1 -1
  166. package/dist/render/components/wheels-plp/PlpNotifyMeDialog.js +1 -1
  167. package/dist/render/lib/booking/appointment-time.d.ts +2 -0
  168. package/dist/render/lib/booking/appointment-time.js +1 -0
  169. package/dist/render/lib/catalog/from-wheel.js +1 -1
  170. package/dist/render/lib/catalog/plp-item.js +1 -1
  171. package/dist/render/lib/checkout/stripe-appearance.d.ts +10 -0
  172. package/dist/render/lib/checkout/stripe-appearance.js +1 -0
  173. package/dist/render/lib/checkout/wallet-return.d.ts +1 -1
  174. package/dist/render/lib/commerce.d.ts +1 -0
  175. package/dist/render/lib/commerce.js +1 -1
  176. package/dist/render/lib/content/legacy-block-align.d.ts +2 -0
  177. package/dist/render/lib/content/legacy-block-align.js +1 -0
  178. package/dist/render/lib/content/menu-row.d.ts +0 -3
  179. package/dist/render/lib/content/menu-row.js +1 -1
  180. package/dist/render/lib/document/blocks/commerce/AlloyWheelsListing/meta.js +1 -1
  181. package/dist/render/lib/document/blocks/commerce/BundleOffer/meta.js +1 -1
  182. package/dist/render/lib/document/blocks/commerce/CheckoutCTA/meta.js +1 -1
  183. package/dist/render/lib/document/blocks/commerce/Collections/meta.js +1 -1
  184. package/dist/render/lib/document/blocks/commerce/CompatibleTyres/meta.js +1 -1
  185. package/dist/render/lib/document/blocks/commerce/DeliveryOptions/meta.js +1 -1
  186. package/dist/render/lib/document/blocks/commerce/DetailRows/meta.js +1 -1
  187. package/dist/render/lib/document/blocks/commerce/EuTyreLabel/meta.js +1 -1
  188. package/dist/render/lib/document/blocks/commerce/FitmentFinder/meta.js +1 -1
  189. package/dist/render/lib/document/blocks/commerce/FitmentTable/meta.js +1 -1
  190. package/dist/render/lib/document/blocks/commerce/ProductGrid/meta.js +1 -1
  191. package/dist/render/lib/document/blocks/commerce/ProductHero/meta.d.ts +6 -0
  192. package/dist/render/lib/document/blocks/commerce/ProductHero/meta.js +1 -1
  193. package/dist/render/lib/document/blocks/commerce/ProductHero/render.js +1 -1
  194. package/dist/render/lib/document/blocks/commerce/RelatedProducts/meta.js +1 -1
  195. package/dist/render/lib/document/blocks/commerce/SpecTable/meta.js +1 -1
  196. package/dist/render/lib/document/blocks/commerce/SpecTable/render.js +1 -1
  197. package/dist/render/lib/document/blocks/commerce/TyreFitment/meta.js +1 -1
  198. package/dist/render/lib/document/blocks/commerce/TyreSizes/meta.js +1 -1
  199. package/dist/render/lib/document/blocks/service/ContactCards/meta.js +1 -1
  200. package/dist/render/lib/document/blocks/service/ContactRouting/meta.js +1 -1
  201. package/dist/render/lib/document/blocks/service/FooterPayment/meta.js +1 -1
  202. package/dist/render/lib/document/blocks/service/FooterSocial/meta.js +1 -1
  203. package/dist/render/lib/document/blocks/service/MessagingCards/meta.js +1 -1
  204. package/dist/render/lib/document/blocks/service/OpeningHours/meta.js +1 -1
  205. package/dist/render/lib/document/blocks/service/RateTable/meta.js +1 -1
  206. package/dist/render/lib/document/blocks/service/SubmitBuild/meta.js +1 -1
  207. package/dist/render/lib/document/blocks/service/Subscribe/meta.js +1 -1
  208. package/dist/render/lib/document/blocks/service/SubscribeBlogs/meta.js +1 -1
  209. package/dist/render/lib/document/lazy-draws.js +1 -1
  210. package/dist/render/lib/document/render-client.d.ts +8 -3
  211. package/dist/render/lib/document/render-client.js +1 -1
  212. package/dist/render/lib/document/section-to-box-rows-reviews.js +1 -1
  213. package/dist/render/lib/document/storefront-root.d.ts +0 -2
  214. package/dist/render/lib/document/storefront-root.js +1 -1
  215. package/dist/render/lib/field-input.d.ts +1 -0
  216. package/dist/render/lib/field-input.js +1 -0
  217. package/dist/render/lib/sections/content-cap-gutter.d.ts +1 -0
  218. package/dist/render/lib/sections/content-cap-gutter.js +1 -0
  219. package/dist/render/lib/sections/hero-trust-bullets.d.ts +2 -0
  220. package/dist/render/lib/sections/hero-trust-bullets.js +1 -0
  221. package/dist/render/lib/tyres/spec-sheet.d.ts +17 -0
  222. package/dist/render/lib/tyres/spec-sheet.js +1 -1
  223. package/dist/render/lib/use-scope-class.d.ts +1 -0
  224. package/dist/render/lib/use-scope-class.js +1 -0
  225. package/dist/render/lib/wheels/catalog-default-layout.d.ts +3 -3
  226. package/dist/render/lib/wheels/catalog-default-layout.js +1 -1
  227. package/dist/render/lib/wheels/catalog-filters.d.ts +2 -2
  228. package/dist/render/lib/wheels/catalog-filters.js +1 -1
  229. package/dist/render/lib/wheels/grid-source.d.ts +7 -1
  230. package/dist/render/lib/wheels/grid-source.js +1 -1
  231. package/dist/render/lib/wheels/plp-hydrate.js +1 -1
  232. package/dist/words.d.ts +46 -45
  233. package/dist/words.js +6 -6
  234. package/package.json +4 -4
  235. package/dist/chunks/EditorPreviewCheckout-27GNLSNR.js +0 -4
  236. package/dist/chunks/chunk-3TBLX25X.js +0 -1
  237. package/dist/chunks/chunk-4V6BLJSG.js +0 -1
  238. package/dist/chunks/chunk-WPHE7RI4.js +0 -246
  239. package/dist/render/components/product-hero/hero-content.d.ts +0 -7
  240. package/dist/render/components/product-hero/hero-content.js +0 -1
  241. package/dist/render/components/useIsLightTheme.d.ts +0 -1
  242. package/dist/render/components/useIsLightTheme.js +0 -1
  243. package/dist/render/lib/content/product-hero.d.ts +0 -14
  244. package/dist/render/lib/content/product-hero.js +0 -1
  245. package/dist/render/lib/wheels/collections.d.ts +0 -22
  246. package/dist/render/lib/wheels/collections.js +0 -1
  247. /package/dist/chunks/{chunk-WPHE7RI4.js.LEGAL.txt → chunk-3IQQNZIM.js.LEGAL.txt} +0 -0
  248. /package/dist/chunks/{chunk-SJODSVWU.js → chunk-5NXOTPHK.js} +0 -0
@@ -1,4 +1,4 @@
1
- import type { FinishFamily, Process } from "../../lib/api/index.js";
1
+ import type { FinishFamily } from "../../lib/api/index.js";
2
2
  import { type CatalogFilterState, type SortKey } from "../../lib/wheels/catalog-filters.js";
3
3
  import type { VehicleFitment } from "../../lib/wheels/plp-fitment-match.js";
4
4
  export interface CatalogVehicleState {
@@ -10,7 +10,7 @@ export interface CatalogVehicleState {
10
10
  export declare const NO_VEHICLE: CatalogVehicleState;
11
11
  interface CatalogFilterContextValue {
12
12
  filters: CatalogFilterState;
13
- setProcess: (v: Process | null) => void;
13
+ setProcess: (v: string | null) => void;
14
14
  setSize: (v: number | null) => void;
15
15
  setLugs: (v: number | null) => void;
16
16
  setFinish: (v: FinishFamily | null) => void;
@@ -26,8 +26,10 @@ interface CatalogFilterContextValue {
26
26
  sizeOptions: number[];
27
27
  reportFinishes: (id: string, families: readonly string[]) => void;
28
28
  finishOptions: string[];
29
+ reportCategories: (id: string, names: readonly string[]) => void;
30
+ categoryOptions: string[];
29
31
  optionsReported: boolean;
30
- scrollProcess: Process | null;
32
+ scrollProcess: string | null;
31
33
  vehicle: CatalogVehicleState;
32
34
  publishVehicle: (v: CatalogVehicleState) => void;
33
35
  }
@@ -1 +1 @@
1
- "use client";import{jsx as W}from"react/jsx-runtime";import{createContext as X,useCallback as n,useContext as Z,useEffect as ee,useMemo as te,useRef as b,useState as a}from"react";import{EMPTY_FILTERS as L}from"../../lib/wheels/catalog-filters.js";import{compareFinishFamily as se}from"../../lib/wheels/finish-defaults.js";const j={fit:null,name:"",resolving:!1,unresolved:!1};function oe(o,s){return o.fit===s.fit&&o.name===s.name&&o.resolving===s.resolving&&o.unresolved===s.unresolved}const r=()=>{},k=X({filters:L,setProcess:r,setSize:r,setLugs:r,setFinish:r,setPriceMin:r,setPriceMax:r,setSort:r,clearAll:r,reportCount:r,total:0,reportLugs:r,lugOptions:[],reportSizes:r,sizeOptions:[],reportFinishes:r,finishOptions:[],optionsReported:!1,scrollProcess:null,vehicle:j,publishVehicle:r}),q="data-catalog-collection",B=(o,s)=>o-s;function D(o,s){return o.length===s.length&&o.every((i,u)=>i===s[u])}function R(o){const s=b(new Map),[i,u]=a([]),g=n((p,f)=>{const v=s.current.get(p);if(v&&D(v,f))return;s.current.set(p,f);const m=new Set;for(const c of s.current.values())for(const h of c)m.add(h);const d=[...m].sort(o);u(c=>D(c,d)?c:d)},[o]);return[i,g]}function le({children:o}){const[s,i]=a(L),u=n(t=>i(e=>({...e,process:t})),[]),g=n(t=>i(e=>({...e,size:t})),[]),p=n(t=>i(e=>({...e,lugs:t})),[]),f=n(t=>i(e=>({...e,finish:t})),[]),v=n(t=>i(e=>({...e,priceMin:t})),[]),m=n(t=>i(e=>({...e,priceMax:t})),[]),d=n(t=>i(e=>({...e,sort:t})),[]),c=n(()=>i(t=>({...L,sort:t.sort})),[]),[h,H]=a(j),x=n(t=>{H(e=>oe(e,t)?e:t)},[]),C=b(new Map),[P,$]=a(0),w=n((t,e)=>{if(C.current.get(t)===e)return;C.current.set(t,e);let l=0;for(const S of C.current.values())l+=S;$(l)},[]),[O,z]=R(B),[M,T]=R(B),[A,G]=R(se),[I,E]=a(!1),_=n((t,e)=>{E(!0),z(t,e)},[z]),V=n((t,e)=>{E(!0),T(t,e)},[T]),y=n((t,e)=>{E(!0),G(t,e)},[G]),[N,J]=a(null);ee(()=>{let e=0;const F=()=>{e=0;let S=null;const Q=document.querySelectorAll(`[${q}]`);for(const U of Q){const Y=U.getBoundingClientRect();if(Y.top<=140&&Y.bottom>140){S=U.getAttribute(q)??null;break}}J(S)},l=()=>{e||(e=requestAnimationFrame(F))};return F(),window.addEventListener("scroll",l,{passive:!0}),window.addEventListener("resize",l),()=>{window.removeEventListener("scroll",l),window.removeEventListener("resize",l),e&&cancelAnimationFrame(e)}},[]);const K=te(()=>({filters:s,setProcess:u,setSize:g,setLugs:p,setFinish:f,setPriceMin:v,setPriceMax:m,setSort:d,clearAll:c,reportCount:w,total:P,reportLugs:_,lugOptions:O,reportSizes:V,sizeOptions:M,reportFinishes:y,finishOptions:A,optionsReported:I,scrollProcess:N,vehicle:h,publishVehicle:x}),[s,u,g,p,f,v,m,d,c,w,P,_,O,V,M,y,A,I,N,h,x]);return W(k.Provider,{value:K,children:o})}function ue(){return Z(k)}export{q as COLLECTION_ATTR,le as CatalogFilterProvider,j as NO_VEHICLE,ue as useCatalogFilter};
1
+ "use client";import{jsx as Z}from"react/jsx-runtime";import{createContext as ee,useCallback as n,useContext as te,useEffect as oe,useMemo as se,useRef as k,useState as a}from"react";import{EMPTY_FILTERS as F}from"../../lib/wheels/catalog-filters.js";import{compareFinishFamily as ne}from"../../lib/wheels/finish-defaults.js";const q={fit:null,name:"",resolving:!1,unresolved:!1};function re(s,o){return s.fit===o.fit&&s.name===o.name&&s.resolving===o.resolving&&s.unresolved===o.unresolved}const r=()=>{},D=ee({filters:F,setProcess:r,setSize:r,setLugs:r,setFinish:r,setPriceMin:r,setPriceMax:r,setSort:r,clearAll:r,reportCount:r,total:0,reportLugs:r,lugOptions:[],reportSizes:r,sizeOptions:[],reportFinishes:r,finishOptions:[],reportCategories:r,categoryOptions:[],optionsReported:!1,scrollProcess:null,vehicle:q,publishVehicle:r}),B="data-catalog-collection",H=(s,o)=>s-o,ie=()=>0;function $(s,o){return s.length===o.length&&s.every((i,u)=>i===o[u])}function C(s){const o=k(new Map),[i,u]=a([]),d=n((p,f)=>{const g=o.current.get(p);if(g&&$(g,f))return;o.current.set(p,f);const v=new Set;for(const c of o.current.values())for(const h of c)v.add(h);const m=[...v].sort(s);u(c=>$(c,m)?c:m)},[s]);return[i,d]}function pe({children:s}){const[o,i]=a(F),u=n(t=>i(e=>({...e,process:t})),[]),d=n(t=>i(e=>({...e,size:t})),[]),p=n(t=>i(e=>({...e,lugs:t})),[]),f=n(t=>i(e=>({...e,finish:t})),[]),g=n(t=>i(e=>({...e,priceMin:t})),[]),v=n(t=>i(e=>({...e,priceMax:t})),[]),m=n(t=>i(e=>({...e,sort:t})),[]),c=n(()=>i(t=>({...F,sort:t.sort})),[]),[h,J]=a(q),L=n(t=>{J(e=>re(e,t)?e:t)},[]),E=k(new Map),[P,K]=a(0),x=n((t,e)=>{if(E.current.get(t)===e)return;E.current.set(t,e);let l=0;for(const R of E.current.values())l+=R;K(l)},[]),[w,z]=C(H),[M,T]=C(H),[_,A]=C(ne),[G,I]=C(ie),[y,O]=a(!1),N=n((t,e)=>{O(!0),z(t,e)},[z]),V=n((t,e)=>{O(!0),T(t,e)},[T]),U=n((t,e)=>{O(!0),A(t,e)},[A]),[Y,Q]=a(null);oe(()=>{let e=0;const S=()=>{e=0;let R=null;const X=document.querySelectorAll(`[${B}]`);for(const b of X){const j=b.getBoundingClientRect();if(j.top<=140&&j.bottom>140){R=b.getAttribute(B)??null;break}}Q(R)},l=()=>{e||(e=requestAnimationFrame(S))};return S(),window.addEventListener("scroll",l,{passive:!0}),window.addEventListener("resize",l),()=>{window.removeEventListener("scroll",l),window.removeEventListener("resize",l),e&&cancelAnimationFrame(e)}},[]);const W=se(()=>({filters:o,setProcess:u,setSize:d,setLugs:p,setFinish:f,setPriceMin:g,setPriceMax:v,setSort:m,clearAll:c,reportCount:x,total:P,reportLugs:N,lugOptions:w,reportSizes:V,sizeOptions:M,reportFinishes:U,finishOptions:_,reportCategories:I,categoryOptions:G,optionsReported:y,scrollProcess:Y,vehicle:h,publishVehicle:L}),[o,u,d,p,f,g,v,m,c,x,P,N,w,V,M,U,_,I,G,y,Y,h,L]);return Z(D.Provider,{value:W,children:s})}function fe(){return te(D)}export{B as COLLECTION_ATTR,pe as CatalogFilterProvider,q as NO_VEHICLE,fe as useCatalogFilter};
@@ -1,9 +1,11 @@
1
1
  import type React from "react";
2
- export declare function PillButton({ label, badge, open, onToggle, }: {
2
+ export declare function PillButton({ label, badge, open, onToggle, controls, buttonRef, }: {
3
3
  label: React.ReactNode;
4
4
  badge: number;
5
5
  open: boolean;
6
6
  onToggle: () => void;
7
+ controls?: string;
8
+ buttonRef?: React.Ref<HTMLButtonElement>;
7
9
  }): React.JSX.Element;
8
10
  export declare function FilterPill({ label, badge, open, onToggle, children, }: {
9
11
  name: string;
@@ -1 +1 @@
1
- import{jsx as a,jsxs as i}from"react/jsx-runtime";const l={body:"text-[length:var(--size-body,11px)]",labelSmall:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]"};function s({label:e,badge:r,open:t,onToggle:n}){const o=r>0;return i("button",{type:"button",onClick:n,className:[`inline-flex items-center gap-2 whitespace-nowrap border px-4 py-3 font-mono ${l.labelLarge} uppercase tracking-[0.2em] transition-colors`,o?"border-accent text-accent":"border-line hover:border-fg-dim"].join(" "),style:o?void 0:{color:"color-mix(in oklab, currentColor 80%, transparent)"},children:[e,r>0&&a("span",{className:`px-2 ${l.body} tracking-[0.1em] text-bg`,style:{background:"var(--accent)"},children:r}),a("span",{className:`${l.body} opacity-65 transition-transform ${t?"rotate-180":""}`,children:"▾"})]})}function d({label:e,badge:r,open:t,onToggle:n,children:o}){return i("div",{className:"relative",children:[a(s,{label:e,badge:r,open:t,onToggle:n}),t&&a("div",{className:"absolute left-0 top-[calc(100%+6px)] z-[60] min-w-[280px] border border-line bg-surface p-5 shadow-[0_24px_60px_rgba(0,0,0,0.4)]",onClick:c=>c.stopPropagation(),children:o})]})}function b({children:e}){return a("div",{className:`mb-3 font-mono ${l.labelSmall} uppercase tracking-[0.32em] text-fg-dim`,children:e})}function x({active:e,onClick:r,children:t,role:n,ariaChecked:o}){return a("button",{type:"button",role:n,"aria-checked":n==="radio"?o:void 0,onClick:r,className:[`border px-3 py-2 font-mono ${l.labelLarge} uppercase tracking-[0.18em] transition-colors`,e?"border-accent bg-accent text-bg":"border-line hover:border-fg-dim"].join(" "),style:e?void 0:{color:"color-mix(in oklab, currentColor 75%, transparent)"},children:t})}export{d as FilterPill,x as OptButton,b as PanelTitle,s as PillButton};
1
+ "use client";import{jsx as i,jsxs as m}from"react/jsx-runtime";import{useEffect as x,useId as g,useRef as f}from"react";const l={body:"text-[length:var(--size-body,11px)]",labelSmall:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]"};function h({label:n,badge:r,open:e,onToggle:t,controls:c,buttonRef:s}){const o=r>0;return m("button",{ref:s,type:"button","aria-haspopup":"dialog","aria-expanded":e,"aria-controls":c,onClick:t,className:[`inline-flex items-center gap-2 whitespace-nowrap border px-4 py-3 font-mono ${l.labelLarge} uppercase tracking-[0.2em] transition-colors`,o?"border-accent text-accent":"border-line hover:border-fg-dim"].join(" "),style:o?void 0:{color:"color-mix(in oklab, currentColor 80%, transparent)"},children:[n,r>0&&i("span",{className:`px-2 ${l.body} tracking-[0.1em] text-bg`,style:{background:"var(--accent)"},children:r}),i("span",{className:`${l.body} opacity-65 transition-transform ${e?"rotate-180":""}`,children:"▾"})]})}function k({label:n,badge:r,open:e,onToggle:t,children:c}){const s=g(),o=f(null),u=f(null);return x(()=>{if(!e)return;const a=o.current?.ownerDocument??document,p=d=>{d.key==="Escape"&&(t(),u.current?.focus())},b=d=>{o.current?.contains(d.target)||t()};return a.addEventListener("keydown",p),a.addEventListener("pointerdown",b),()=>{a.removeEventListener("keydown",p),a.removeEventListener("pointerdown",b)}},[e,t]),m("div",{ref:o,className:"relative",children:[i(h,{label:n,badge:r,open:e,onToggle:t,controls:e?s:void 0,buttonRef:u}),e&&i("div",{id:s,className:"absolute left-0 top-[calc(100%+6px)] z-[60] min-w-[280px] border border-line bg-surface p-5 shadow-[0_24px_60px_rgba(0,0,0,0.4)]",onClick:a=>a.stopPropagation(),children:c})]})}function w({children:n}){return i("div",{className:`mb-3 font-mono ${l.labelSmall} uppercase tracking-[0.32em] text-fg-dim`,children:n})}function E({active:n,onClick:r,children:e,role:t,ariaChecked:c}){return i("button",{type:"button",role:t,"aria-checked":t==="radio"?c:void 0,onClick:r,className:[`border px-3 py-2 font-mono ${l.labelLarge} uppercase tracking-[0.18em] transition-colors`,n?"border-accent bg-accent text-bg":"border-line hover:border-fg-dim"].join(" "),style:n?void 0:{color:"color-mix(in oklab, currentColor 75%, transparent)"},children:e})}export{k as FilterPill,E as OptButton,w as PanelTitle,h as PillButton};
@@ -1 +1 @@
1
- "use client";import{jsx as e,Fragment as N,jsxs as r}from"react/jsx-runtime";import S from"next/link";import{useEffect as D,useMemo as T,useRef as j,useState as v}from"react";import{Elements as O,PaymentElement as z,useElements as L,useStripe as M}from"@stripe/react-stripe-js";import{loadStripe as $}from"@stripe/stripe-js";import{useCurrency as E}from"../CurrencyContext.js";import{resolveCopyright as F}from"../../lib/content/site.js";import{ApiError as A,products as R}from"../../lib/api/index.js";import U from"efficient-web-builder/render/components/Logo";import{CheckoutStateProvider as G,useCheckout as H}from"./checkout-state.js";import{CheckoutContact as Q,CheckoutOrderSummary as V,CheckoutPayment as W,CheckoutShippingAddress as Z,CheckoutShippingMethod as J}from"./checkout-parts.js";function X(t){return e(G,{...t,children:e(ee,{})})}function ee(){const{site:t,logo:a,items:l,placing:m,email:p,me:o,addressSaveNote:n,idemKey:d,confirmation:s,setConfirmation:c,payment:f,paypalStep:x,squareStep:y,pendingConf:i,paid:k,setPaid:h,payNote:g,afterpayConfirming:q,gocardlessConfirming:b,zipConfirming:u,klarnaConfirming:P,checkoutRootRef:C,setCheckoutHeaderEl:_}=H();return s?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:k?"Payment received":"Order received"}),r("p",{className:"text-fg-dim",children:[k?r(N,{children:["Thank you — your payment for order"," ",e("span",{className:"font-mono text-fg",children:s.orderNumber})," has gone through."," "]}):r(N,{children:["Thank you — your order ",e("span",{className:"font-mono text-fg",children:s.orderNumber})," is being reviewed by our team."," "]}),o?r(N,{children:["Track it under"," ",e(S,{href:"/account/orders",className:"text-accent underline",children:"your orders"}),"."]}):e(N,{children:"We’ve emailed you a link to set a password and track it."})]}),g&&e("p",{className:"text-sm text-fg-dim",children:g}),n&&e("p",{className:"text-sm text-fg-dim",children:n}),!o&&r("p",{className:"text-sm text-fg-dim",children:["You can also"," ",e(S,{href:`/track?order=${encodeURIComponent(s.orderNumber)}`,className:"text-accent underline",children:"track this order"})," ","anytime with just your order number and email — no password needed."]}),e(S,{href:"/wheels",className:"mt-2 border-2 border-line px-6 py-3 font-mono text-[12px] uppercase tracking-[0.24em] hover:border-accent",children:"Continue browsing"})]}):q?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Afterpay — one moment."})]}):b?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Setting up your direct debit…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Confirming with GoCardless — one moment."})]}):u?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Zip — one moment."})]}):P?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Klarna — one moment."})]}):f?e(te,{payment:f,onPaid:()=>{h(!0),c(i)},onSkip:()=>c(i)}):x&&i?e(ae,{confirmation:i,clientId:t.paypalClientId??"",idemKey:d,onPaid:()=>{h(!0),c(i)},onSkip:()=>c(i)}):y&&i?e(se,{confirmation:i,applicationId:t.squareApplicationId??"",locationId:t.squareLocationId??"",environment:t.squareEnvironment??"production",idemKey:d,onPaid:()=>{h(!0),c(i)},onSkip:()=>c(i)}):r("div",{ref:C,className:"bg-bg text-fg",children:[r("header",{ref:_,className:"sticky top-0 z-30 grid grid-cols-[1fr_auto_1fr] items-center gap-8 border-b border-line px-[var(--sf-site-gutter,40px)] py-6 backdrop-blur-md max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))] max-[640px]:py-4",style:{background:"color-mix(in oklab, var(--bg) 92%, transparent)"},children:[r(S,{href:"/",className:"inline-flex items-center gap-3 font-mono text-[13px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["←",e("span",{className:"max-[640px]:hidden",children:"Back to shop"})]}),e(S,{href:"/","aria-label":`${t.name} home`,className:"inline-flex items-center justify-center",children:e(U,{variant:"header",scrolled:!0,src:a?.url??null,reverse:a?.reverse??!1,reversedSrc:a?.reversed??null,inkIsDark:a?.inkIsDark??null,size:a?.size??"medium",sizePx:a?.sizePx??null,siteName:t.name})}),t.cardPayments?r("span",{className:"flex items-center justify-end gap-3 font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim",children:[e("span",{className:"text-green",children:"●"}),e("span",{className:"max-[640px]:hidden",children:"Encrypted ·"})," Stripe"]}):e("span",{})]}),r("section",{className:"mx-auto flex max-w-[var(--sf-site-width,1600px)] flex-wrap items-center justify-between gap-x-8 gap-y-3 border-b border-line bg-surface px-[var(--sf-site-gutter,40px)] py-4 font-mono text-[13px] font-medium uppercase tracking-[0.24em] text-fg max-[1100px]:px-[min(24px,var(--sf-site-gutter,40px))]",children:[e("span",{className:"inline-flex items-center bg-accent px-3 py-1 font-bold text-bg",children:"Checkout"}),e("nav",{"aria-label":"Checkout steps",className:"flex flex-wrap items-center gap-5",children:[{n:"01",label:"Cart",state:"done"},{n:"02",label:"Ship & pay",state:"active"},{n:"03",label:"Confirmed",state:"pending"}].map(w=>r("span",{className:["relative flex items-center gap-2 transition-colors",w.state==="pending"?"text-fg-dim":"text-fg",w.state==="active"?"font-bold after:absolute after:inset-x-0 after:-bottom-1 after:h-[2px] after:bg-accent":""].join(" "),children:[e("span",{className:w.state==="done"?"text-accent font-bold":"",children:w.n}),e("span",{children:w.label})]},w.n))})]}),r("main",{className:"mx-auto grid max-w-[var(--sf-site-width,1600px)] grid-cols-[1fr_420px] items-start gap-16 px-[var(--sf-site-gutter,40px)] pt-10 pb-[100px] max-[1100px]:grid-cols-1 max-[1100px]:gap-10 max-[1100px]:px-[min(24px,var(--sf-site-gutter,40px))] max-[1100px]:pt-8 max-[1100px]:pb-20",children:[r("div",{children:[e(Q,{}),e(Z,{}),e(J,{}),e(W,{})]}),e(V,{})]}),e("footer",{className:"flex flex-wrap items-center justify-between gap-4 border-t border-line px-[var(--sf-site-gutter,40px)] py-6 font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))]",children:e("span",{children:F({legalName:t.legalName,foundedYear:t.foundedYear,siteName:t.name})})})]})}function te({payment:t,onPaid:a,onSkip:l}){const{formatMoney:m}=E(),p=T(()=>$(t.publishableKey),[t.publishableKey]),o=T(()=>{if(typeof document>"u")return;const n=getComputedStyle(document.documentElement),d=(c,f)=>n.getPropertyValue(c).trim()||f,s=document.documentElement.getAttribute("data-theme")!=="light";return{theme:s?"night":"stripe",variables:{colorPrimary:d("--accent",s?"#c9a461":"#8a6a2a"),colorBackground:d("--site-surface",s?"#131313":"#ffffff"),colorText:d("--fg",s?"#f5f1e8":"#0a0a0a"),borderRadius:"0px"}}},[]);return e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Payment"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:m(Number(t.amount),t.currency)})," ","by card to confirm it now."]}),e(O,{stripe:p,options:{clientSecret:t.clientSecret,appearance:o},children:e(re,{payment:t,onPaid:a,onSkip:l})})]})]})})}function re({payment:t,onPaid:a,onSkip:l}){const{formatMoney:m}=E(),p=M(),o=L(),[n,d]=v(!1),[s,c]=v(null);async function f(){if(!p||!o||n)return;d(!0),c(null);const x=await p.confirmPayment({elements:o,redirect:"if_required"});if(x.error){c(x.error.message??"Payment failed. Please try again."),d(!1);return}const y=x.paymentIntent?.status;if(y==="succeeded"||y==="processing"){a();return}c("Payment did not complete. Please try again."),d(!1)}return r("div",{className:"flex flex-col gap-4",children:[e(z,{}),s&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:s}),e("button",{type:"button",onClick:f,disabled:!p||!o||n,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!p||!o||n?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:n?r(N,{children:["Processing… ",e("span",{children:"·"})]}):r(N,{children:["Pay ",m(Number(t.amount),t.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),e("button",{type:"button",onClick:l,disabled:n,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later — our team will be in touch"})]})}const B="paypal-sdk-js";let I=null;function ne(t,a){const l=`${t}|${a}`;if(I?.key===l)return I.promise;const m=new Promise((p,o)=>{document.getElementById(B)?.remove();const n=document.createElement("script");n.id=B;const d=new URLSearchParams({"client-id":t,currency:a,intent:"capture"});n.src=`https://www.paypal.com/sdk/js?${d}`,n.onload=()=>{const s=window.paypal;s?p(s):o(new Error("PayPal SDK loaded without its namespace"))},n.onerror=()=>o(new Error("PayPal SDK failed to load")),document.head.appendChild(n)});return I={key:l,promise:m},m}function ae({confirmation:t,clientId:a,idemKey:l,onPaid:m,onSkip:p}){const{formatMoney:o}=E(),n=j(null),[d,s]=v(!1),[c,f]=v(null),x=j(m);return x.current=m,D(()=>{let y=!1,i=null;return ne(a,t.currency).then(k=>{if(!(y||!n.current))return i=k.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await R.createPaypalOrder({idempotencyKey:l})).paypalOrderId,onApprove:async h=>{try{if((await R.capturePaypalOrder({idempotencyKey:l,paypalOrderId:h.orderID})).status==="paid"){x.current();return}f("PayPal did not complete the payment. Please try again.")}catch(g){f(g instanceof A?g.message:"PayPal payment failed. Please try again.")}},onError:()=>{f("PayPal could not process the payment. Please try again.")}}),i.render(n.current).then(()=>{y||s(!0)})}).catch(()=>{y||f("PayPal could not be loaded. You can pay later — your order stands either way.")}),()=>{y=!0,i?.close?.()}},[a,t.currency,l]),e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"PayPal"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:o(Number(t.grandTotal),t.currency)})," ","with PayPal to confirm it now."]}),!d&&!c&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading PayPal…"}),e("div",{ref:n}),c&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:c}),e("button",{type:"button",onClick:p,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later — our team will be in touch"})]})]})})}const Y="square-web-sdk";let K=null;function oe(t){const a=t==="sandbox"?"sandbox":"production";if(K?.key===a)return K.promise;const l=new Promise((m,p)=>{document.getElementById(Y)?.remove();const o=document.createElement("script");o.id=Y,o.src=a==="sandbox"?"https://sandbox.web.squarecdn.com/v1/square.js":"https://web.squarecdn.com/v1/square.js",o.onload=()=>{const n=window.Square;n?m(n):p(new Error("Square SDK loaded without its namespace"))},o.onerror=()=>p(new Error("Square SDK failed to load")),document.head.appendChild(o)});return K={key:a,promise:l},l}function se({confirmation:t,applicationId:a,locationId:l,environment:m,idemKey:p,onPaid:o,onSkip:n}){const{formatMoney:d}=E(),s=j(null),c=j(null),f=j(null),[x,y]=v(!1),[i,k]=v(!1),[h,g]=v(null);D(()=>{let b=!1,u=null;return oe(m).then(async P=>{if(b||!s.current)return;const C=P.payments(a,l);f.current=C,u=await C.card(),await u.attach(s.current),c.current=u,b||y(!0)}).catch(()=>{b||g("Square could not be loaded. You can pay later — your order stands either way.")}),()=>{b=!0,u?.destroy?.()}},[a,l,m]);async function q(){const b=c.current;if(!(!b||i)){k(!0),g(null);try{const u=await b.tokenize();if(u.status!=="OK"||!u.token){g(u.errors?.[0]?.message??"Please check the card details and try again."),k(!1);return}let P;try{P=(await f.current?.verifyBuyer?.(u.token,{amount:String(t.grandTotal),currencyCode:t.currency,intent:"CHARGE"}))?.token}catch{}if((await R.chargeSquare({idempotencyKey:p,sourceId:u.token,...P?{verificationToken:P}:{}})).status==="paid"){o();return}g("Square did not complete the payment. Please try again.")}catch(u){g(u instanceof A?u.message:"Square payment failed. Please try again.")}k(!1)}}return e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Card"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:d(Number(t.grandTotal),t.currency)})," ","by card to confirm it now."]}),!x&&!h&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading card form…"}),e("div",{ref:s}),h&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:h}),e("button",{type:"button",onClick:q,disabled:!x||i,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!x||i?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:i?r(N,{children:["Processing… ",e("span",{children:"·"})]}):r(N,{children:["Pay ",d(Number(t.grandTotal),t.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),e("button",{type:"button",onClick:n,disabled:i,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later — our team will be in touch"})]})]})})}export{X as default};
1
+ "use client";import{jsx as e,jsxs as r,Fragment as b}from"react/jsx-runtime";import S from"next/link";import{useEffect as D,useMemo as T,useRef as j,useState as v}from"react";import{stripeAppearance as Y}from"../../lib/checkout/stripe-appearance.js";import{Elements as B,PaymentElement as z,useElements as L,useStripe as $}from"@stripe/react-stripe-js";import{loadStripe as F}from"@stripe/stripe-js";import{useCurrency as E}from"../CurrencyContext.js";import{resolveCopyright as U}from"../../lib/content/site.js";import{ApiError as A,products as R}from"../../lib/api/index.js";import G from"efficient-web-builder/render/components/Logo";import{CheckoutStateProvider as H,useCheckout as Q}from"./checkout-state.js";import{CheckoutContact as W,CheckoutOrderSummary as Z,CheckoutPayment as J,CheckoutShippingAddress as V,CheckoutShippingMethod as X}from"./checkout-parts.js";function ee(t){return e(H,{...t,children:e(re,{})})}function te({order:t,paid:n}){const{formatMoney:i}=E();if(!t.grandTotal||!t.currency)return null;const c=a=>i(Number(a),t.currency),l=Number(t.freightCharge??0),s=Number(t.discountAmount??0);return r("dl",{className:"grid w-full max-w-sm grid-cols-[1fr_auto] gap-x-6 gap-y-1 border-y border-line py-3 text-left text-sm",children:[(t.shippingMethod||l>0)&&r(b,{children:[r("dt",{className:"text-fg-dim",children:["Delivery",t.shippingMethod?` · ${t.shippingMethod}`:""]}),e("dd",{className:"text-right font-mono",children:c(t.freightCharge??"0")})]}),s>0&&r(b,{children:[r("dt",{className:"text-fg-dim",children:["Discount",t.couponCode?` · ${t.couponCode}`:""]}),r("dd",{className:"text-right font-mono",children:["−",c(t.discountAmount??"0")]})]}),e("dt",{className:"text-fg",children:n?"Total paid":"Order total"}),e("dd",{className:"text-right font-mono text-fg",children:c(t.grandTotal)})]})}function re(){const{site:t,logo:n,items:i,placing:c,email:l,me:s,addressSaveNote:a,idemKey:u,confirmation:d,setConfirmation:p,payment:f,paypalStep:x,squareStep:h,pendingConf:o,paid:N,setPaid:y,payNote:g,afterpayConfirming:q,gocardlessConfirming:k,zipConfirming:m,klarnaConfirming:P,checkoutRootRef:C,setCheckoutHeaderEl:_}=Q();return d?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:N?"Payment received":"Order received"}),r("p",{className:"text-fg-dim",children:[N?r(b,{children:["Thank you — your payment for order"," ",e("span",{className:"font-mono text-fg",children:d.orderNumber})," has gone through."," "]}):r(b,{children:["Thank you — your order ",e("span",{className:"font-mono text-fg",children:d.orderNumber})," is being reviewed by our team."," "]}),s?r(b,{children:["Track it under"," ",e(S,{href:"/account/orders",className:"text-accent underline",children:"your orders"}),"."]}):e(b,{children:"We’ve emailed you a link to set a password and track it."})]}),e(te,{order:d,paid:N}),g&&e("p",{className:"text-sm text-fg-dim",children:g}),a&&e("p",{className:"text-sm text-fg-dim",children:a}),!s&&r("p",{className:"text-sm text-fg-dim",children:["You can also"," ",e(S,{href:`/track?order=${encodeURIComponent(d.orderNumber)}`,className:"text-accent underline",children:"track this order"})," ","anytime with just your order number and email — no password needed."]}),e(S,{href:"/wheels",className:"mt-2 border-2 border-line px-6 py-3 font-mono text-[12px] uppercase tracking-[0.24em] hover:border-accent",children:"Continue browsing"})]}):q?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Afterpay — one moment."})]}):k?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Setting up your direct debit…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Confirming with GoCardless — one moment."})]}):m?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Zip — one moment."})]}):P?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Klarna — one moment."})]}):f?e(ne,{payment:f,onPaid:()=>{y(!0),p(o)},onSkip:()=>p(o)}):x&&o?e(oe,{confirmation:o,clientId:t.paypalClientId??"",idemKey:u,onPaid:()=>{y(!0),p(o)},onSkip:()=>p(o)}):h&&o?e(ce,{confirmation:o,applicationId:t.squareApplicationId??"",locationId:t.squareLocationId??"",environment:t.squareEnvironment??"production",idemKey:u,onPaid:()=>{y(!0),p(o)},onSkip:()=>p(o)}):r("div",{ref:C,className:"bg-bg text-fg",children:[r("header",{ref:_,className:"sticky top-0 z-30 grid grid-cols-[1fr_auto_1fr] items-center gap-8 border-b border-line px-[var(--sf-site-gutter,40px)] py-6 backdrop-blur-md max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))] max-[640px]:py-4",style:{background:"color-mix(in oklab, var(--bg) 92%, transparent)"},children:[r(S,{href:"/",className:"inline-flex items-center gap-3 font-mono text-[13px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["←",e("span",{className:"max-[640px]:hidden",children:"Back to shop"})]}),e(S,{href:"/","aria-label":`${t.name} home`,className:"inline-flex items-center justify-center",children:e(G,{variant:"header",scrolled:!0,src:n?.url??null,reverse:n?.reverse??!1,reversedSrc:n?.reversed??null,inkIsDark:n?.inkIsDark??null,size:n?.size??"medium",sizePx:n?.sizePx??null,siteName:t.name})}),t.cardPayments?r("span",{className:"flex items-center justify-end gap-3 font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim",children:[e("span",{className:"text-green",children:"●"}),e("span",{className:"max-[640px]:hidden",children:"Encrypted ·"})," Stripe"]}):e("span",{})]}),r("section",{className:"mx-auto flex max-w-[var(--sf-site-width,1600px)] flex-wrap items-center justify-between gap-x-8 gap-y-3 border-b border-line bg-surface px-[var(--sf-site-gutter,40px)] py-4 font-mono text-[13px] font-medium uppercase tracking-[0.24em] text-fg max-[1100px]:px-[min(24px,var(--sf-site-gutter,40px))]",children:[e("span",{className:"inline-flex items-center bg-accent px-3 py-1 font-bold text-bg",children:"Checkout"}),e("nav",{"aria-label":"Checkout steps",className:"flex flex-wrap items-center gap-5",children:[{n:"01",label:"Cart",state:"done"},{n:"02",label:"Ship & pay",state:"active"},{n:"03",label:"Confirmed",state:"pending"}].map(w=>r("span",{className:["relative flex items-center gap-2 transition-colors",w.state==="pending"?"text-fg-dim":"text-fg",w.state==="active"?"font-bold after:absolute after:inset-x-0 after:-bottom-1 after:h-[2px] after:bg-accent":""].join(" "),children:[e("span",{className:w.state==="done"?"text-accent font-bold":"",children:w.n}),e("span",{children:w.label})]},w.n))})]}),r("main",{className:"mx-auto grid max-w-[var(--sf-site-width,1600px)] grid-cols-[1fr_420px] items-start gap-16 px-[var(--sf-site-gutter,40px)] pt-10 pb-[100px] max-[1100px]:grid-cols-1 max-[1100px]:gap-10 max-[1100px]:px-[min(24px,var(--sf-site-gutter,40px))] max-[1100px]:pt-8 max-[1100px]:pb-20",children:[r("div",{children:[e(W,{}),e(V,{}),e(X,{}),e(J,{})]}),e(Z,{})]}),e("footer",{className:"flex flex-wrap items-center justify-between gap-4 border-t border-line px-[var(--sf-site-gutter,40px)] py-6 font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))]",children:e("span",{children:U({legalName:t.legalName,foundedYear:t.foundedYear,siteName:t.name})})})]})}function ne({payment:t,onPaid:n,onSkip:i}){const{formatMoney:c}=E(),l=T(()=>F(t.publishableKey),[t.publishableKey]),s=T(()=>Y(),[]);return e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Payment"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:c(Number(t.amount),t.currency)})," ","by card to confirm it now."]}),e(B,{stripe:l,options:{clientSecret:t.clientSecret,appearance:s},children:e(ae,{payment:t,onPaid:n,onSkip:i})})]})]})})}function ae({payment:t,onPaid:n,onSkip:i}){const{formatMoney:c}=E(),l=$(),s=L(),[a,u]=v(!1),[d,p]=v(null);async function f(){if(!l||!s||a)return;u(!0),p(null);const x=await l.confirmPayment({elements:s,redirect:"if_required"});if(x.error){p(x.error.message??"Payment failed. Please try again."),u(!1);return}const h=x.paymentIntent?.status;if(h==="succeeded"||h==="processing"){n();return}p("Payment did not complete. Please try again."),u(!1)}return r("div",{className:"flex flex-col gap-4",children:[e(z,{}),d&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:d}),e("button",{type:"button",onClick:f,disabled:!l||!s||a,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!l||!s||a?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:a?r(b,{children:["Processing… ",e("span",{children:"·"})]}):r(b,{children:["Pay ",c(Number(t.amount),t.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),e("button",{type:"button",onClick:i,disabled:a,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later — our team will be in touch"})]})}const M="paypal-sdk-js";let I=null;function se(t,n){const i=`${t}|${n}`;if(I?.key===i)return I.promise;const c=new Promise((l,s)=>{document.getElementById(M)?.remove();const a=document.createElement("script");a.id=M;const u=new URLSearchParams({"client-id":t,currency:n,intent:"capture"});a.src=`https://www.paypal.com/sdk/js?${u}`,a.onload=()=>{const d=window.paypal;d?l(d):s(new Error("PayPal SDK loaded without its namespace"))},a.onerror=()=>s(new Error("PayPal SDK failed to load")),document.head.appendChild(a)});return I={key:i,promise:c},c}function oe({confirmation:t,clientId:n,idemKey:i,onPaid:c,onSkip:l}){const{formatMoney:s}=E(),a=j(null),[u,d]=v(!1),[p,f]=v(null),x=j(c);return x.current=c,D(()=>{let h=!1,o=null;return se(n,t.currency).then(N=>{if(!(h||!a.current))return o=N.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await R.createPaypalOrder({idempotencyKey:i})).paypalOrderId,onApprove:async y=>{try{if((await R.capturePaypalOrder({idempotencyKey:i,paypalOrderId:y.orderID})).status==="paid"){x.current();return}f("PayPal did not complete the payment. Please try again.")}catch(g){f(g instanceof A?g.message:"PayPal payment failed. Please try again.")}},onError:()=>{f("PayPal could not process the payment. Please try again.")}}),o.render(a.current).then(()=>{h||d(!0)})}).catch(()=>{h||f("PayPal could not be loaded. You can pay later — your order stands either way.")}),()=>{h=!0,o?.close?.()}},[n,t.currency,i]),e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"PayPal"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:s(Number(t.grandTotal),t.currency)})," ","with PayPal to confirm it now."]}),!u&&!p&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading PayPal…"}),e("div",{ref:a}),p&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:p}),e("button",{type:"button",onClick:l,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later — our team will be in touch"})]})]})})}const O="square-web-sdk";let K=null;function ie(t){const n=t==="sandbox"?"sandbox":"production";if(K?.key===n)return K.promise;const i=new Promise((c,l)=>{document.getElementById(O)?.remove();const s=document.createElement("script");s.id=O,s.src=n==="sandbox"?"https://sandbox.web.squarecdn.com/v1/square.js":"https://web.squarecdn.com/v1/square.js",s.onload=()=>{const a=window.Square;a?c(a):l(new Error("Square SDK loaded without its namespace"))},s.onerror=()=>l(new Error("Square SDK failed to load")),document.head.appendChild(s)});return K={key:n,promise:i},i}function ce({confirmation:t,applicationId:n,locationId:i,environment:c,idemKey:l,onPaid:s,onSkip:a}){const{formatMoney:u}=E(),d=j(null),p=j(null),f=j(null),[x,h]=v(!1),[o,N]=v(!1),[y,g]=v(null);D(()=>{let k=!1,m=null;return ie(c).then(async P=>{if(k||!d.current)return;const C=P.payments(n,i);f.current=C,m=await C.card(),await m.attach(d.current),p.current=m,k||h(!0)}).catch(()=>{k||g("Square could not be loaded. You can pay later — your order stands either way.")}),()=>{k=!0,m?.destroy?.()}},[n,i,c]);async function q(){const k=p.current;if(!(!k||o)){N(!0),g(null);try{const m=await k.tokenize();if(m.status!=="OK"||!m.token){g(m.errors?.[0]?.message??"Please check the card details and try again."),N(!1);return}let P;try{P=(await f.current?.verifyBuyer?.(m.token,{amount:String(t.grandTotal),currencyCode:t.currency,intent:"CHARGE"}))?.token}catch{}if((await R.chargeSquare({idempotencyKey:l,sourceId:m.token,...P?{verificationToken:P}:{}})).status==="paid"){s();return}g("Square did not complete the payment. Please try again.")}catch(m){g(m instanceof A?m.message:"Square payment failed. Please try again.")}N(!1)}}return e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Card"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:u(Number(t.grandTotal),t.currency)})," ","by card to confirm it now."]}),!x&&!y&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading card form…"}),e("div",{ref:d}),y&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:y}),e("button",{type:"button",onClick:q,disabled:!x||o,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!x||o?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:o?r(b,{children:["Processing… ",e("span",{children:"·"})]}):r(b,{children:["Pay ",u(Number(t.grandTotal),t.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),e("button",{type:"button",onClick:a,disabled:o,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later — our team will be in touch"})]})]})})}export{ee as default};
@@ -1 +1 @@
1
- "use client";import{jsx as e,Fragment as N,jsxs as a}from"react/jsx-runtime";import H from"next/image";import O from"next/link";import{lineTotal as q,useCart as D}from"../CartContext.js";import{useCurrency as G}from"../CurrencyContext.js";import{FREE_PRICE as j}from"../../lib/wheels/price-display.js";import W from"../CouponField.js";import{COUPON_DEFERRED_TOTAL as K}from"../../lib/cart/coupon-preview.js";import{shippingWords as X,TAX_PENDING as Z}from"../../lib/cart/shipping-status.js";import{DEFAULT_FINISH_COLOR as J}from"../../lib/wheels/finish-defaults.js";import B from"../ThemedSelect.js";import h from"../WebFormField.js";import Q from"../WheelSvg.js";import{NO_PAYMENT_METHOD_NOTE as V,SHIPPING_RETRY_NOTE as ee,useCheckout as k}from"./checkout-state.js";function ye(){const{email:t,setEmail:i,firstName:n,setFirstName:l,lastName:s,setLastName:p,me:c,checkoutSignOut:b}=k();return a(w,{num:"N° 01",title:"Contact",children:[e(h,{label:"Email",hint:c?a(N,{children:["Signed in ·"," ",e("button",{type:"button",onClick:b,className:"underline transition-colors hover:text-accent",children:"Not you? Sign out"})]}):void 0,children:e("input",{type:"email",value:t,onChange:m=>i(m.target.value),placeholder:"you@example.com",readOnly:c!==null,className:u+(c?" opacity-70":"")})}),a(I,{children:[e(h,{label:"First name",children:e("input",{type:"text",value:n,onChange:m=>l(m.target.value),className:u})}),e(h,{label:"Last name",children:e("input",{type:"text",value:s,onChange:m=>p(m.target.value),className:u})})]})]})}function Ne(){const{pickupLocation:t,servedCountries:i,address1:n,setAddress1:l,address2:s,setAddress2:p,city:c,setCity:b,postcode:m,setPostcode:f,phone:x,setPhone:d,country:o,setCountry:y,subdivision:C,setSubdivision:g,subdivisions:E,destination:re,postcodeLabel:R,subdivisionLabel:$,me:A,savedAddresses:P,selectedAddressId:_,setSelectedAddressId:L,saveAddress:F,setSaveAddress:Y,saveLabel:M,setSaveLabel:U,fillFromAddress:z}=k();return a(w,{num:"N° 02",title:t?"Collection":"Shipping address",children:[t?a("div",{className:"grid gap-2 text-[14px] leading-[1.6]",children:[e("span",{className:"font-medium",children:t.name}),[t.address,t.city,t.state,t.zipCode,t.country].filter(Boolean).length>0&&e("span",{className:"opacity-80",children:[t.address,t.city,t.state,t.zipCode,t.country].filter(Boolean).join(", ")}),t.openingHours&&e("span",{className:"opacity-80",children:t.openingHours}),t.instructions&&e("span",{className:"opacity-80",children:t.instructions}),e("span",{className:"mt-1 font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"No delivery address needed"})]}):a(N,{children:[A!==null&&P.length>0&&a("div",{className:"grid gap-3",children:[P.map(r=>e(S,{active:_===r.id,onClick:()=>{L(r.id),z(r)},title:r.label,body:r.formatted_address,price:null},r.id)),e(S,{active:_==="new",onClick:()=>L("new"),title:"New address",body:null,price:null})]}),e(h,{label:"Address line 1",children:e("input",{type:"text",value:n,onChange:r=>l(r.target.value),className:u})}),e(h,{label:"Address line 2",children:e("input",{type:"text",value:s,onChange:r=>p(r.target.value),placeholder:"Apartment, unit, garage bay…",className:u})}),a(I,{cols:"three",children:[e(h,{label:"City",children:e("input",{type:"text",value:c,onChange:r=>b(r.target.value),className:u})}),e(h,{label:R,children:e("input",{type:"text",value:m,onChange:r=>f(r.target.value),className:u})}),e(h,{label:"Country",separate:!0,children:e(B,{value:o,onChange:r=>y(r.target.value),className:u+" pr-10",style:T,children:i.map(r=>e("option",{value:r.code,children:r.name},r.code))})})]}),e(h,{label:$,separate:!0,children:E.length>0?a(B,{value:C,onChange:r=>g(r.target.value),className:u+" pr-10",style:T,children:[e("option",{value:"",children:"Select…"}),E.map(r=>e("option",{value:r.code||r.name,children:r.name},r.code||r.name))]}):e("input",{type:"text",value:C,onChange:r=>g(r.target.value),className:u})})]}),e(h,{label:"Phone",children:e("input",{type:"tel",value:x,onChange:r=>d(r.target.value),className:u})}),!t&&A!==null&&_==="new"&&a(N,{children:[e(te,{checked:F,onChange:Y,label:"Save this address to my account"}),F&&e(h,{label:"Address label",children:e("input",{type:"text",value:M,onChange:r=>U(r.target.value),placeholder:"Home",className:u})})]})]})}function ve(){const{totals:t,coupon:i,deliveryOptions:n,shippingMethodId:l,setShippingMethodId:s,pickupLocation:p,formatMoney:c,city:b,destination:m,courierUnavailable:f,retryCourier:x}=k();return e(w,{num:"N° 03",title:"Shipping",children:a("div",{className:"grid gap-3",children:[n.map(d=>{const o=d.pickupLocation,y=o?[o.address,o.city,o.state,o.zipCode].filter(Boolean).join(", "):null;return e(S,{active:l===d.id,onClick:()=>s(d.id),title:o?`${d.name} — ${o.name}`:d.name,body:o?[y,o.openingHours,o.instructions,d.description].filter(Boolean).join(" · "):d.description||null,price:t.freeShipping||d.amount===0?j:c(d.amount,t.currency),tag:d.tag||void 0},d.id)}),f?a("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:[ee," ",e("button",{type:"button",onClick:x,className:"underline transition-colors hover:text-accent",children:"Try again"})]}):n.length===0&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Shipping is arranged after your order is reviewed."})]})})}function ke(){const{payChoice:t,setPayChoice:i,placing:n,payment:l,payOptions:s,noPaymentMethod:p}=k();return a(w,{num:"N° 04",title:"Payment",children:[p&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:V}),e("div",{className:"grid gap-3",children:s.map(c=>e(S,{active:t===c.key,onClick:()=>i(c.key),title:c.title,body:c.body,price:c.price,tag:c.tag},c.key))}),t==="card"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):t==="paypal"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll approve the payment with PayPal on the payment step after placing the order."}):t==="afterpay"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Afterpay to approve four interest-free payments, then brought straight back."}):t==="square"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):t==="gocardless"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll set up a bank direct debit with GoCardless, then be brought straight back. Direct debits clear in a few days."}):t==="zip"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Zip to approve four instalments, then brought straight back."}):t==="klarna"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Klarna to choose how to pay, then brought straight back."}):t==="bank"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Our team emails you the invoice and bank details after review."}):null]})}function Ce(){const{site:t,items:i,totals:n,coupon:l,formatMoney:s,payChoice:p,placing:c,email:b,orderError:m,payment:f,noPaymentMethod:x,placeOrder:d}=k();return a("aside",{className:"sticky top-[var(--sf-checkout-header-h,88px)] border border-line max-[1100px]:static",style:{background:"linear-gradient(180deg, color-mix(in oklab, var(--site-surface) 70%, var(--bg)) 0%, var(--bg) 100%)"},children:[a("header",{className:"flex items-center justify-between border-b border-accent bg-accent px-6 py-4 font-mono text-[13px] font-bold uppercase tracking-[0.28em] text-bg",children:[e("span",{children:"Your order"}),e(O,{href:"/wheels",className:"text-bg/80 transition-colors hover:text-bg",children:"Edit ↗"})]}),e("div",{className:"flex flex-col px-6 py-2",children:i.length===0?a("div",{className:"py-8 text-center font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:["Your cart is empty. ",e(O,{href:"/wheels",className:"text-accent underline-offset-4 hover:underline",children:"Browse the catalog →"})]}):i.map(o=>e(ne,{slug:o.slug,name:o.name,qty:o.qty,config:o.config,configSummary:ae(o.config),price:q(o,n.currency)??0,currency:n.currency},o.id))}),e("div",{className:"border-t border-line px-6 pt-5",children:e(W,{customerEmail:b})}),a("div",{className:"flex flex-col gap-2 border-t border-line mt-5 px-6 pt-5",children:[e(v,{label:"Subtotal",value:s(n.subtotal,n.currency)}),n.discount>0&&l?.valid&&e(v,{label:`Coupon · ${l.code}`,value:a("span",{className:"font-semibold text-green",children:["− ",s(n.discount,n.currency)]})}),l?.deferred&&e(v,{label:`Coupon · ${l.code}`,value:K}),l?.valid&&l.effects?.gift&&e(v,{label:`Free gift · ${l.effects.gift.partNumber}${l.effects.gift.quantity>1?` ×${l.effects.gift.quantity}`:""}`,value:e("span",{className:"font-semibold text-green",children:j})}),e(v,{label:"Shipping",value:n.shippingStatus==="free"?e("span",{className:"font-semibold text-green",children:j}):X(n.shippingStatus)??s(n.shipping,n.currency)}),n.tax&&(n.tax.charged?e(v,{label:n.tax.inclusive?`${n.tax.name} included · ${n.tax.rate}%`:n.tax.name,value:s(n.tax.amount,n.currency)}):n.tax.name?e(v,{label:n.tax.name,value:Z}):null)]}),a("div",{className:"mt-4 flex items-end justify-between border-y-2 border-accent px-6 py-4",style:{background:"color-mix(in oklab, var(--accent) 10%, var(--bg))"},children:[e("span",{className:"font-display text-[20px] font-bold uppercase tracking-[0.04em] text-fg",children:"Total"}),e("span",{className:"text-right font-display text-[34px] font-bold leading-none tracking-[-0.025em] text-fg",children:n.repricing?"…":s(n.grand,n.currency)})]}),a("div",{className:"flex flex-col gap-3 px-6 pt-5 pb-6",children:[m&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:m}),n.hasUnpricedLine&&a("p",{className:"border border-amber-300 bg-amber-50 px-3 py-2 text-[13px] text-amber-800",children:["One or more items have no price in ",n.currency,". Remove them, or switch region, to continue."]}),e("button",{type:"button",onClick:d,disabled:c||x||i.length===0||n.hasUnpricedLine||n.repricing,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",i.length===0||c||x||n.hasUnpricedLine||n.repricing?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:c?a(N,{children:["Building order… ",e("span",{children:"·"})]}):x?a(N,{children:["No online payment ",e("span",{children:"·"})]}):n.repricing?a(N,{children:["Updating total… ",e("span",{children:"·"})]}):a(N,{children:[p==="bank"?"Place order":"Continue to payment"," ·"," ",s(n.grand,n.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})})]})]})}const u="w-full border-2 border-line bg-bg px-4 py-4 font-display text-[17px] tracking-[-0.005em] text-fg outline-none transition-colors placeholder:text-fg-dim hover:border-fg-dim focus:border-accent",T={backgroundImage:"linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%)",backgroundPosition:"calc(100% - 18px) 50%, calc(100% - 12px) 50%",backgroundSize:"6px 6px",backgroundRepeat:"no-repeat"};function w({num:t,title:i,children:n}){return a("section",{className:"mb-6 border border-line bg-bg",children:[a("header",{className:"flex items-center gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t}),e("h2",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:i})]}),e("div",{className:"flex flex-col gap-4 px-6 py-6",children:n})]})}function I({cols:t="two",children:i}){return e("div",{className:["grid gap-3 max-[640px]:grid-cols-1",t==="two"?"grid-cols-2":"grid-cols-[1.2fr_1fr_1fr]"].join(" "),children:i})}function S({active:t,onClick:i,title:n,body:l,price:s,tag:p}){return a("button",{type:"button",onClick:i,"aria-pressed":t,className:["relative grid grid-cols-[auto_1fr_auto] items-center gap-5 border bg-bg px-6 py-5 text-left transition-colors",t?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-line hover:border-[color-mix(in_oklab,var(--accent)_50%,var(--site-line))]"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 14%, var(--bg))"}:void 0,children:[t&&e("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),e("span",{className:["flex h-[18px] w-[18px] items-center justify-center rounded-full border-2",t?"border-accent":"border-fg-dim"].join(" "),children:t&&e("span",{className:"block h-2.5 w-2.5 rounded-full bg-accent"})}),a("span",{className:"flex min-w-0 flex-col gap-1",children:[a("span",{className:"flex flex-wrap items-baseline gap-3 font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:[n,p&&e("span",{className:"border px-2 py-0.5 font-mono text-[11px] font-normal uppercase tracking-[0.24em] text-accent",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 45%, var(--site-line))"},children:p})]}),l&&e("span",{className:"font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim",children:l})]}),e("span",{className:"whitespace-nowrap font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:s})]})}function te({checked:t,onChange:i,label:n,sub:l}){return a("div",{className:"flex items-start gap-3 border-t border-line py-4 first:border-t-0 first:pt-0",children:[e("button",{type:"button",onClick:()=>i(!t),"aria-pressed":t,"aria-label":n,className:["mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center border transition-colors",t?"border-accent":"border-line"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 18%, transparent)"}:void 0,children:t&&e("span",{className:"text-[13px] text-accent",children:"✓"})}),a("span",{className:"flex-1 font-display text-[16px] leading-[1.5] text-fg",children:[n,l&&e("small",{className:"mt-1 block font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim",children:l})]})]})}function ne({slug:t,name:i,qty:n,config:l,configSummary:s,price:p,currency:c}){const{catalog:b}=D(),{formatMoney:m}=G(),f=b.find(g=>g.slug===t),x=f?.spokes??5,d=f?.mesh??!1,o=l.find(g=>g.gold)?.label,y=f?.finishes.find(g=>g.name===o&&g.src)??f?.finishes.find(g=>g.src),C=f?.finishes[0]?.color??J;return a("div",{className:"grid grid-cols-[60px_1fr_auto] items-center gap-4 border-b border-line py-4 last:border-b-0",children:[a("div",{className:"relative flex aspect-square items-center justify-center overflow-hidden border border-line bg-surface",children:[e("span",{className:"absolute -right-1.5 -top-1.5 z-[2] flex h-[18px] w-[18px] items-center justify-center rounded-full bg-accent font-mono text-[11px] font-bold text-bg",children:n}),y?.src?e(H,{src:y.src,alt:`${i.lead}${i.accent} — ${y.name}`,width:120,height:120,sizes:"60px",className:"relative block h-full w-full object-contain p-2"}):e("div",{className:"block w-[78%]",style:{color:C},children:e(Q,{spokes:x,mesh:d,className:"block w-full"})})]}),a("div",{className:"flex min-w-0 flex-col gap-0.5",children:[a("span",{className:"font-display text-[17px] font-bold uppercase leading-none tracking-[-0.005em] text-fg",children:[i.lead,e("em",{className:"font-serif font-normal italic text-accent tracking-[-0.005em] normal-case",children:i.accent})]}),e("span",{className:"font-mono text-[12px] uppercase leading-[1.5] tracking-[0.18em] text-fg-dim",children:s})]}),e("span",{className:"text-right font-display text-[17px] font-bold tracking-[-0.005em] text-fg",children:m(p,c)})]})}function v({label:t,value:i}){return a("div",{className:"flex items-center justify-between font-mono text-[13px] font-medium uppercase tracking-[0.18em] text-fg",children:[e("span",{children:t}),e("strong",{className:"font-display text-[16px] font-medium tracking-[-0.005em] normal-case text-fg",children:i})]})}function ae(t){return t.map(i=>i.label).join(" · ")}export{ye as CheckoutContact,Ce as CheckoutOrderSummary,ke as CheckoutPayment,Ne as CheckoutShippingAddress,ve as CheckoutShippingMethod};
1
+ "use client";import{jsx as e,Fragment as N,jsxs as a}from"react/jsx-runtime";import{useId as E}from"react";import G from"next/image";import T from"next/link";import{lineTotal as W,useCart as K}from"../CartContext.js";import{useCurrency as X}from"../CurrencyContext.js";import{FREE_PRICE as F}from"../../lib/wheels/price-display.js";import Z from"../CouponField.js";import{COUPON_DEFERRED_TOTAL as J}from"../../lib/cart/coupon-preview.js";import{shippingWords as Q,TAX_PENDING as V}from"../../lib/cart/shipping-status.js";import{DEFAULT_FINISH_COLOR as ee}from"../../lib/wheels/finish-defaults.js";import R from"../ThemedSelect.js";import f from"../WebFormField.js";import te from"../WheelSvg.js";import{NO_PAYMENT_METHOD_NOTE as ne,SHIPPING_RETRY_NOTE as ae,useCheckout as k}from"./checkout-state.js";import{FIELD_INPUT_CLASS as g}from"../../lib/field-input.js";function we(){const{email:t,setEmail:i,firstName:n,setFirstName:l,lastName:c,setLastName:u,me:o,checkoutSignOut:y}=k(),x=E();return a(w,{num:"N° 01",title:"Contact",children:[e(f,{label:"Email",htmlFor:x,hint:o?a(N,{children:["Signed in ·"," ",e("button",{type:"button",onClick:y,className:"underline transition-colors hover:text-accent",children:"Not you? Sign out"})]}):void 0,children:e("input",{id:x,type:"email",value:t,onChange:d=>i(d.target.value),placeholder:"you@example.com",readOnly:o!==null,className:g+(o?" opacity-70":"")})}),a(Y,{children:[e(f,{label:"First name",children:e("input",{type:"text",value:n,onChange:d=>l(d.target.value),className:g})}),e(f,{label:"Last name",children:e("input",{type:"text",value:c,onChange:d=>u(d.target.value),className:g})})]})]})}function Se(){const{pickupLocation:t,servedCountries:i,address1:n,setAddress1:l,address2:c,setAddress2:u,city:o,setCity:y,postcode:x,setPostcode:d,phone:b,setPhone:s,country:p,setCountry:m,subdivision:C,setSubdivision:h,subdivisions:A,destination:oe,postcodeLabel:M,subdivisionLabel:U,me:I,savedAddresses:L,selectedAddressId:_,setSelectedAddressId:P,saveAddress:O,setSaveAddress:z,saveLabel:D,setSaveLabel:H,fillFromAddress:q}=k(),B=E(),j=E();return a(w,{num:"N° 02",title:t?"Collection":"Shipping address",children:[t?a("div",{className:"grid gap-2 text-[14px] leading-[1.6]",children:[e("span",{className:"font-medium",children:t.name}),[t.address,t.city,t.state,t.zipCode,t.country].filter(Boolean).length>0&&e("span",{className:"opacity-80",children:[t.address,t.city,t.state,t.zipCode,t.country].filter(Boolean).join(", ")}),t.openingHours&&e("span",{className:"opacity-80",children:t.openingHours}),t.instructions&&e("span",{className:"opacity-80",children:t.instructions}),e("span",{className:"mt-1 font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"No delivery address needed"})]}):a(N,{children:[I!==null&&L.length>0&&a("div",{className:"grid gap-3",children:[L.map(r=>e(S,{active:_===r.id,onClick:()=>{P(r.id),q(r)},title:r.label,body:r.formatted_address,price:null},r.id)),e(S,{active:_==="new",onClick:()=>P("new"),title:"New address",body:null,price:null})]}),e(f,{label:"Address line 1",children:e("input",{type:"text",value:n,onChange:r=>l(r.target.value),className:g})}),e(f,{label:"Address line 2",children:e("input",{type:"text",value:c,onChange:r=>u(r.target.value),placeholder:"Apartment, unit, garage bay…",className:g})}),a(Y,{cols:"three",children:[e(f,{label:"City",children:e("input",{type:"text",value:o,onChange:r=>y(r.target.value),className:g})}),e(f,{label:M,children:e("input",{type:"text",value:x,onChange:r=>d(r.target.value),className:g})}),e(f,{label:"Country",separate:!0,htmlFor:B,children:e(R,{id:B,value:p,onChange:r=>m(r.target.value),className:g+" pr-10",style:$,children:i.map(r=>e("option",{value:r.code,children:r.name},r.code))})})]}),e(f,{label:U,separate:!0,htmlFor:j,children:A.length>0?a(R,{id:j,value:C,onChange:r=>h(r.target.value),className:g+" pr-10",style:$,children:[e("option",{value:"",children:"Select…"}),A.map(r=>e("option",{value:r.code||r.name,children:r.name},r.code||r.name))]}):e("input",{id:j,type:"text",value:C,onChange:r=>h(r.target.value),className:g})})]}),e(f,{label:"Phone",children:e("input",{type:"tel",value:b,onChange:r=>s(r.target.value),className:g})}),!t&&I!==null&&_==="new"&&a(N,{children:[e(re,{checked:O,onChange:z,label:"Save this address to my account"}),O&&e(f,{label:"Address label",children:e("input",{type:"text",value:D,onChange:r=>H(r.target.value),placeholder:"Home",className:g})})]})]})}function _e(){const{totals:t,coupon:i,deliveryOptions:n,shippingMethodId:l,setShippingMethodId:c,pickupLocation:u,formatMoney:o,city:y,destination:x,courierUnavailable:d,retryCourier:b}=k();return e(w,{num:"N° 03",title:"Shipping",children:a("div",{className:"grid gap-3",children:[n.map(s=>{const p=s.pickupLocation,m=p?[p.address,p.city,p.state,p.zipCode].filter(Boolean).join(", "):null;return e(S,{active:l===s.id,onClick:()=>c(s.id),title:p?`${s.name} — ${p.name}`:s.name,body:p?[m,p.openingHours,p.instructions,s.description].filter(Boolean).join(" · "):s.description||null,price:t.freeShipping||s.amount===0?F:o(s.amount,t.currency),tag:s.tag||void 0},s.id)}),d?a("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:[ae," ",e("button",{type:"button",onClick:b,className:"underline transition-colors hover:text-accent",children:"Try again"})]}):n.length===0&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Shipping is arranged after your order is reviewed."})]})})}function je(){const{payChoice:t,setPayChoice:i,placing:n,payment:l,payOptions:c,noPaymentMethod:u}=k();return a(w,{num:"N° 04",title:"Payment",children:[u&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:ne}),e("div",{className:"grid gap-3",children:c.map(o=>e(S,{active:t===o.key,onClick:()=>i(o.key),title:o.title,body:o.body,price:o.price,tag:o.tag},o.key))}),t==="card"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):t==="paypal"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll approve the payment with PayPal on the payment step after placing the order."}):t==="afterpay"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Afterpay to approve four interest-free payments, then brought straight back."}):t==="square"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):t==="gocardless"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll set up a bank direct debit with GoCardless, then be brought straight back. Direct debits clear in a few days."}):t==="zip"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Zip to approve four instalments, then brought straight back."}):t==="klarna"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Klarna to choose how to pay, then brought straight back."}):t==="bank"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Our team emails you the invoice and bank details after review."}):null]})}function Ee(){const{site:t,items:i,totals:n,coupon:l,formatMoney:c,payChoice:u,placing:o,email:y,orderError:x,payment:d,noPaymentMethod:b,unpaidOrder:s,placeOrder:p}=k();return a("aside",{className:"sticky top-[var(--sf-checkout-header-h,88px)] border border-line max-[1100px]:static",style:{background:"linear-gradient(180deg, color-mix(in oklab, var(--site-surface) 70%, var(--bg)) 0%, var(--bg) 100%)"},children:[a("header",{className:"flex items-center justify-between border-b border-accent bg-accent px-6 py-4 font-mono text-[13px] font-bold uppercase tracking-[0.28em] text-bg",children:[e("span",{children:"Your order"}),e(T,{href:"/wheels",className:"text-bg/80 transition-colors hover:text-bg",children:"Edit ↗"})]}),e("div",{className:"flex flex-col px-6 py-2",children:i.length===0?a("div",{className:"py-8 text-center font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:["Your cart is empty. ",e(T,{href:"/wheels",className:"text-accent underline-offset-4 hover:underline",children:"Browse the catalog →"})]}):i.map(m=>e(ie,{slug:m.slug,name:m.name,qty:m.qty,config:m.config,configSummary:le(m.config),price:W(m,n.currency)??0,currency:n.currency},m.id))}),e("div",{className:"border-t border-line px-6 pt-5",children:e(Z,{customerEmail:y})}),a("div",{className:"flex flex-col gap-2 border-t border-line mt-5 px-6 pt-5",children:[e(v,{label:"Subtotal",value:c(n.subtotal,n.currency)}),n.discount>0&&l?.valid&&e(v,{label:`Coupon · ${l.code}`,value:a("span",{className:"font-semibold text-green",children:["− ",c(n.discount,n.currency)]})}),l?.deferred&&e(v,{label:`Coupon · ${l.code}`,value:J}),l?.valid&&l.effects?.gift&&e(v,{label:`Free gift · ${l.effects.gift.partNumber}${l.effects.gift.quantity>1?` ×${l.effects.gift.quantity}`:""}`,value:e("span",{className:"font-semibold text-green",children:F})}),e(v,{label:"Shipping",value:n.shippingStatus==="free"?e("span",{className:"font-semibold text-green",children:F}):Q(n.shippingStatus)??c(n.shipping,n.currency)}),n.tax&&(n.tax.charged?e(v,{label:n.tax.inclusive?`${n.tax.name} included · ${n.tax.rate}%`:n.tax.name,value:c(n.tax.amount,n.currency)}):n.tax.name?e(v,{label:n.tax.name,value:V}):null)]}),a("div",{className:"mt-4 flex items-end justify-between border-y-2 border-accent px-6 py-4",style:{background:"color-mix(in oklab, var(--accent) 10%, var(--bg))"},children:[e("span",{className:"font-display text-[20px] font-bold uppercase tracking-[0.04em] text-fg",children:"Total"}),e("span",{className:"text-right font-display text-[34px] font-bold leading-none tracking-[-0.025em] text-fg",children:n.repricing?"…":c(n.grand,n.currency)})]}),a("div",{className:"flex flex-col gap-3 px-6 pt-5 pb-6",children:[x&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:x}),n.hasUnpricedLine&&a("p",{className:"border border-amber-300 bg-amber-50 px-3 py-2 text-[13px] text-amber-800",children:["One or more items have no price in ",n.currency,". Remove them, or switch region, to continue."]}),e("button",{type:"button",onClick:p,disabled:o||!s&&(b||i.length===0||n.hasUnpricedLine||n.repricing),className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",o||!s&&(i.length===0||b||n.hasUnpricedLine||n.repricing)?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:o?a(N,{children:["Building order… ",e("span",{children:"·"})]}):b?a(N,{children:["No online payment ",e("span",{children:"·"})]}):s?a(N,{children:["Try payment again · ",s.orderNumber,e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]}):n.repricing?a(N,{children:["Updating total… ",e("span",{children:"·"})]}):a(N,{children:[u==="bank"?"Place order":"Continue to payment"," ·"," ",c(n.grand,n.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})})]})]})}const $={backgroundImage:"linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%)",backgroundPosition:"calc(100% - 18px) 50%, calc(100% - 12px) 50%",backgroundSize:"6px 6px",backgroundRepeat:"no-repeat"};function w({num:t,title:i,children:n}){return a("section",{className:"mb-6 border border-line bg-bg",children:[a("header",{className:"flex items-center gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t}),e("h2",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:i})]}),e("div",{className:"flex flex-col gap-4 px-6 py-6",children:n})]})}function Y({cols:t="two",children:i}){return e("div",{className:["grid gap-3 max-[640px]:grid-cols-1",t==="two"?"grid-cols-2":"grid-cols-[1.2fr_1fr_1fr]"].join(" "),children:i})}function S({active:t,onClick:i,title:n,body:l,price:c,tag:u}){return a("button",{type:"button",onClick:i,"aria-pressed":t,className:["relative grid grid-cols-[auto_1fr_auto] items-center gap-5 border bg-bg px-6 py-5 text-left transition-colors",t?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-line hover:border-[color-mix(in_oklab,var(--accent)_50%,var(--site-line))]"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 14%, var(--bg))"}:void 0,children:[t&&e("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),e("span",{className:["flex h-[18px] w-[18px] items-center justify-center rounded-full border-2",t?"border-accent":"border-fg-dim"].join(" "),children:t&&e("span",{className:"block h-2.5 w-2.5 rounded-full bg-accent"})}),a("span",{className:"flex min-w-0 flex-col gap-1",children:[a("span",{className:"flex flex-wrap items-baseline gap-3 font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:[n,u&&e("span",{className:"border px-2 py-0.5 font-mono text-[11px] font-normal uppercase tracking-[0.24em] text-accent",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 45%, var(--site-line))"},children:u})]}),l&&e("span",{className:"font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim",children:l})]}),e("span",{className:"whitespace-nowrap font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:c})]})}function re({checked:t,onChange:i,label:n,sub:l}){return a("div",{className:"flex items-start gap-3 border-t border-line py-4 first:border-t-0 first:pt-0",children:[e("button",{type:"button",onClick:()=>i(!t),"aria-pressed":t,"aria-label":n,className:["mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center border transition-colors",t?"border-accent":"border-line"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 18%, transparent)"}:void 0,children:t&&e("span",{className:"text-[13px] text-accent",children:"✓"})}),a("span",{className:"flex-1 font-display text-[16px] leading-[1.5] text-fg",children:[n,l&&e("small",{className:"mt-1 block font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim",children:l})]})]})}function ie({slug:t,name:i,qty:n,config:l,configSummary:c,price:u,currency:o}){const{catalog:y}=K(),{formatMoney:x}=X(),d=y.find(h=>h.slug===t),b=d?.spokes??5,s=d?.mesh??!1,p=l.find(h=>h.gold)?.label,m=d?.finishes.find(h=>h.name===p&&h.src)??d?.finishes.find(h=>h.src),C=d?.finishes[0]?.color??ee;return a("div",{className:"grid grid-cols-[60px_1fr_auto] items-center gap-4 border-b border-line py-4 last:border-b-0",children:[a("div",{className:"relative flex aspect-square items-center justify-center overflow-hidden border border-line bg-surface",children:[e("span",{className:"absolute -right-1.5 -top-1.5 z-[2] flex h-[18px] w-[18px] items-center justify-center rounded-full bg-accent font-mono text-[11px] font-bold text-bg",children:n}),m?.src?e(G,{src:m.src,alt:`${i.lead}${i.accent} — ${m.name}`,width:120,height:120,sizes:"60px",className:"relative block h-full w-full object-contain p-2"}):e("div",{className:"block w-[78%]",style:{color:C},children:e(te,{spokes:b,mesh:s,className:"block w-full"})})]}),a("div",{className:"flex min-w-0 flex-col gap-0.5",children:[a("span",{className:"font-display text-[17px] font-bold uppercase leading-none tracking-[-0.005em] text-fg",children:[i.lead,e("em",{className:"font-serif font-normal italic text-accent tracking-[-0.005em] normal-case",children:i.accent})]}),e("span",{className:"font-mono text-[12px] uppercase leading-[1.5] tracking-[0.18em] text-fg-dim",children:c})]}),e("span",{className:"text-right font-display text-[17px] font-bold tracking-[-0.005em] text-fg",children:x(u,o)})]})}function v({label:t,value:i}){return a("div",{className:"flex items-center justify-between font-mono text-[13px] font-medium uppercase tracking-[0.18em] text-fg",children:[e("span",{children:t}),e("strong",{className:"font-display text-[16px] font-medium tracking-[-0.005em] normal-case text-fg",children:i})]})}function le(t){return t.map(i=>i.label).join(" · ")}export{we as CheckoutContact,Ee as CheckoutOrderSummary,je as CheckoutPayment,Se as CheckoutShippingAddress,_e as CheckoutShippingMethod};
@@ -13,6 +13,7 @@ export declare function buildPayOptions(site: SiteIdentity, { canParkContext, }?
13
13
  canParkContext: boolean;
14
14
  }): PayOption[];
15
15
  export declare const NO_PAYMENT_METHOD_NOTE = "This shop does not take payment online yet. Please contact the shop to order.";
16
+ export declare function paymentNotStartedMessage(orderNumber: string, err: unknown): string;
16
17
  export declare const SHIPPING_RETRY_NOTE = "Shipping cannot be calculated right now. Please try again.";
17
18
  export interface CheckoutProps {
18
19
  site: SiteIdentity;
@@ -153,6 +154,17 @@ declare function useCheckoutState({ site, logo, preview }: CheckoutProps): {
153
154
  } | null;
154
155
  paid: boolean;
155
156
  setPaid: import("react").Dispatch<import("react").SetStateAction<boolean>>;
157
+ unpaidOrder: {
158
+ orderNumber: string;
159
+ status: string;
160
+ total: string;
161
+ currency: string;
162
+ freightCharge: string;
163
+ discountAmount: string;
164
+ grandTotal: string;
165
+ shippingMethod?: string | null;
166
+ couponCode?: string | null;
167
+ } | null;
156
168
  payNote: string | null;
157
169
  afterpayConfirming: boolean;
158
170
  gocardlessConfirming: boolean;
@@ -1,3 +1,3 @@
1
- "use client";import{jsx as w}from"react/jsx-runtime";import{createContext as bt,useContext as St,useEffect as u,useMemo as Te,useRef as _e,useState as e}from"react";import{isOrderable as Re,useCart as At}from"../CartContext.js";import{useCurrency as vt}from"../CurrencyContext.js";import{getClickIds as xt}from"../../lib/click-ids.js";import{adConsentForOrder as Nt}from"../../lib/consent/choice.js";import{trackBeginCheckout as Et,trackPurchase as It}from"../../lib/google-tag.js";import{trackMetaPurchase as Kt}from"../../lib/meta-pixel.js";import{ApiError as Ot,api as K,products as m}from"../../lib/api/index.js";import{uuid as Tt}from"../../lib/uuid.js";import{orderLinesForSets as _t}from"../../lib/commerce.js";import{canPersist as Rt,safeSessionStorage as g}from"efficient-web-builder/format/lib/safe-storage";import{AFTERPAY_CONTEXT_KEY as Mt,AFTERPAY_RETURN as Lt,GOCARDLESS_CONTEXT_KEY as re,KLARNA_CONTEXT_KEY as se,ZIP_CONTEXT_KEY as $t,ZIP_RETURN as Ut,runWalletReturn as Me}from"../../lib/checkout/wallet-return.js";import{matchSubdivision as Yt}from"../../lib/checkout/match-subdivision.js";import{couponCodeForOrder as zt,couponRefusedByOrder as qt}from"../../lib/cart/coupon-preview.js";function Le(r){const y=r.indexOf(`
2
- `);return y===-1?[r,""]:[r.slice(0,y),r.slice(y+1)]}function $e(r,{canParkContext:y}={canParkContext:!0}){const l=r.paymentMethods,i=[];return l.includes("card")&&i.push({key:"card",title:"Card",body:null,price:w("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA · MC · AMEX"})}),l.includes("paypal")&&r.paypalClientId&&i.push({key:"paypal",title:"PayPal",body:null,price:w("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAYPAL · CARDS"})}),l.includes("afterpay")&&i.push({key:"afterpay",title:"Afterpay",body:null,price:w("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"4 × INTEREST-FREE"})}),l.includes("square")&&r.squareApplicationId&&r.squareLocationId&&i.push({key:"square",title:"Card (Square)",body:null,price:w("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA · MC · AMEX"})}),l.includes("gocardless")&&y&&i.push({key:"gocardless",title:"Bank Direct Debit",body:null,price:w("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY BY BANK"})}),l.includes("zip")&&i.push({key:"zip",title:"Zip",body:null,price:w("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY IN 4"})}),l.includes("klarna")&&y&&i.push({key:"klarna",title:"Klarna",body:null,price:w("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY LATER"})}),l.includes("bank")&&i.push({key:"bank",title:"Bank transfer",body:null,price:w("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Invoiced"})}),i}const sn="This shop does not take payment online yet. Please contact the shop to order.",cn="Shipping cannot be calculated right now. Please try again.";function Bt({site:r,logo:y,preview:l=!1}){const{items:i,totals:C,coupon:A,refuseCoupon:Ye,deliveryOptions:ce,shippingMethodId:q,setShippingMethodId:ze,setQuoteDestination:O,courier:qe,requote:Be,identify:ae,clearCapturedCart:T}=At(),Fe=ce.find(n=>n.id===q)?.pickupLocation??null,{country:De,countries:_,activeCountry:ie,formatMoney:He}=vt(),[p,le]=e(()=>$e(r)[0]?.key??null),[de,Je]=e(!0);u(()=>{Je(Rt(g))},[]);const[ue,pe]=e(!1),[R,me]=e(""),[v,fe]=e(""),[B,ye]=e(""),[M,F]=e(""),[D,H]=e(""),[L,J]=e(""),[x,X]=e(""),[Z,G]=e(""),[a,W]=e(()=>De||_[0]?.code||""),[b,j]=e(""),[N,he]=e([]),[Q,V]=e(null),[$,U]=e(null),ge=Te(()=>_.find(n=>n.code===a)??ie,[_,a,ie]),Xe=ge?.postalLabel||"Postal Code",Ze=N[0]?.divisionType||"State / Province";u(()=>{if(!a){he([]),V(a);return}V(null);let n=!1;return m.listCountrySubdivisions(a).then(t=>{n||(he(t),V(a),j(""))}),()=>{n=!0}},[a]);const ke=M.trim()!==""&&L.trim()!==""&&x.trim()!==""&&Q===a&&(N.length===0||b!=="")?x.trim():"";u(()=>{O(a?{country:a,subdivision:b,postcode:ke}:null)},[a,b,ke,O]),u(()=>()=>O(null),[O]);const Ge=qe?.status==="unavailable",We=Be,[ee,we]=e(null),[je,Ce]=e([]),[Pe,te]=e("new"),[be,Se]=e(!1),[Ae,Qe]=e("Home"),[Ve,ve]=e(null),[f]=e(()=>Tt()),[et,P]=e(null),[tt,E]=e(null),[nt,ot]=e(null),[rt,st]=e(!1),[ct,at]=e(!1),[it,ne]=e(null),[lt,Y]=e(!1),[dt,k]=e(null),[ut,pt]=e(!1),[mt,xe]=e(!1),[ft,yt]=e(!1),[ht,Ne]=e(!1),Ee=_e(!1);u(()=>{l||Ee.current||!i.some(Re)||(Ee.current=!0,Et({lines:i,currency:C.currency,value:C.subtotal-C.discount,coupon:A?.valid?A.code:void 0}))},[i,C,A,l]),u(()=>{ae(R,v.trim()||void 0)},[R,v,ae]);const Ie=_e(null),[z,gt]=e(null);u(()=>{const n=Ie.current;if(!z||!n)return;const t=()=>n.style.setProperty("--sf-checkout-header-h",`${z.offsetHeight}px`);t();const o=new ResizeObserver(t);return o.observe(z),()=>o.disconnect()},[z]),u(()=>{const n=o=>({setConfirming:o,land:P,markPaid:()=>Y(!0),note:k,fail:E,clearCart:T}),t={search:window.location.search,storage:g,scrubQuery:()=>window.history.replaceState(null,"",window.location.pathname)};Me(Lt,{...t,capture:m.captureAfterpayPayment,page:n(pt)}),Me(Ut,{...t,capture:m.captureZipPayment,page:n(yt)})},[]),u(()=>{const t=new URLSearchParams(window.location.search).get("gocardless");if(t!=="confirm"&&t!=="cancel")return;const o=g.getItem(re);if(g.removeItem(re),window.history.replaceState(null,"",window.location.pathname),!o)return;let c;try{c=JSON.parse(o)}catch{return}if(T(),t==="cancel"){k("The direct debit was not set up — our team will follow up on payment."),P(c.confirmation);return}xe(!0),m.completeGocardlessPayment({idempotencyKey:c.idempotencyKey}).then(s=>{s.status==="paid"?Y(!0):s.status==="declined"?k("The direct debit was declined — our team will follow up on payment."):k("Your direct debit is set up — the payment is collecting and will clear in a few days.")}).catch(()=>{k("We could not confirm the direct debit — our team will follow up on payment.")}).finally(()=>{P(c.confirmation),xe(!1)})},[]),u(()=>{const n=new URLSearchParams(window.location.search),t=n.get("klarna");if(t!=="confirm"&&t!=="cancel")return;const o=g.getItem(se);g.removeItem(se);const c=n.get("authorization_token");if(window.history.replaceState(null,"",window.location.pathname),!o)return;let s;try{s=JSON.parse(o)}catch{return}if(T(),t==="cancel"||!c){k("The Klarna payment was not completed — our team will follow up on payment."),P(s.confirmation);return}Ne(!0),m.captureKlarnaPayment({idempotencyKey:s.idempotencyKey,authorizationToken:c}).then(d=>{d.status==="paid"?Y(!0):d.status==="declined"?k("Klarna declined the payment — our team will follow up on payment."):k("Your Klarna payment is being reviewed — we'll confirm the outcome shortly.")}).catch(()=>{k("We could not confirm the Klarna payment — our team will follow up on payment.")}).finally(()=>{P(s.confirmation),Ne(!1)})},[]);function Ke(n){const[t,o]=Le(n.address);F(t),H(o),J(n.city),X(n.zip_code),n.country&&W(n.country),n.phone&&G(n.phone),U({country:n.country||null,state:n.state??""})}u(()=>{if($){if(($.country||a)!==a){U(null);return}Q===a&&(j(Yt(a,$.state,N)),U(null))}},[$,a,Q,N]),u(()=>{let n=!1;return(async()=>{try{const[t,o,c]=await Promise.all([K.me(),K.myProfile().catch(()=>null),K.myAddresses().catch(()=>[])]);if(n)return;we(t);const s=c.filter(I=>I.is_active);Ce(s),me(t.email);const d=(o?.contact_name??"").split(/\s+/);fe(t.first_name||d[0]||""),ye(t.last_name||d.slice(1).join(" "));const h=t.phone||o?.phone;h&&G(h);const oe=s.find(I=>I.id===t.default_delivery_location)??s[0];if(oe)te(oe.id),Ke(oe);else if(o){const[I,Pt]=Le(o.address??"");F(I),H(Pt),J(o.city??""),X(o.zip_code??""),o.country&&W(o.country),U({country:o.country||null,state:o.state??""})}}catch{}})(),()=>{n=!0}},[]);function kt(){K.logout(),we(null),Ce([]),te("new"),Se(!1)}const S=Te(()=>$e(r,{canParkContext:de}),[r,de]);u(()=>{S.some(n=>n.key===p)||le(S[0]?.key??null)},[S,p]);const wt=S.length===0,Oe=D.trim()?`${M}
3
- ${D.trim()}`:M;async function Ct(){if(l||ue||i.length===0||C.repricing||!p||!S.some(t=>t.key===p))return;const n=i.filter(Re).flatMap(t=>_t(t.components,t.qty));if(n.length===0){E("Pick a size on each wheel's product page before checking out.");return}pe(!0),E(null);try{const t=ee?m.createOrderAuthed:m.createOrder,o=Nt(),c=await t({customer:{email:R,name:`${v} ${B}`.trim(),phone:Z.trim()||void 0,address:Oe,city:L,state:b||void 0,zipCode:x,country:a},items:n,currency:C.currency,idempotencyKey:f,shippingMethodId:q??void 0,couponCode:zt(A),...o==="denied"?{}:xt(),...o?{adConsent:o}:{}});if(It({confirmation:c,lines:i,adsSendTo:r.googleAdsId&&r.googleAdsConversionLabel?`${r.googleAdsId}/${r.googleAdsConversionLabel}`:null}),Kt({confirmation:c,lines:i}),T(),ee&&be&&Pe==="new")try{await K.createAddress({label:Ae.trim()||"Home",contact_name:`${v} ${B}`.trim(),phone:Z.trim(),address:Oe,city:L,zip_code:x,state:b,country:a}),ve("Address saved to your account.")}catch{ve("We couldn't save the address to your account — you can add it under Account → Addresses.")}if(p==="card"&&r.paymentMethods.includes("card")){const s=await m.createPaymentIntent({idempotencyKey:f});ne(c),ot(s)}else if(p==="paypal"&&r.paymentMethods.includes("paypal"))ne(c),st(!0);else if(p==="afterpay"&&r.paymentMethods.includes("afterpay")){const s=window.location.origin,d=await m.createAfterpayCheckout({idempotencyKey:f,confirmUrl:`${s}/checkout?afterpay=confirm`,cancelUrl:`${s}/checkout?afterpay=cancel`}),h={idempotencyKey:f,confirmation:c};g.setItem(Mt,JSON.stringify(h)),window.location.assign(d.redirectCheckoutUrl);return}else if(p==="square"&&r.paymentMethods.includes("square"))ne(c),at(!0);else if(p==="gocardless"&&r.paymentMethods.includes("gocardless")){const s=window.location.origin,d=await m.createGocardlessBillingRequest({idempotencyKey:f,confirmUrl:`${s}/checkout?gocardless=confirm`,cancelUrl:`${s}/checkout?gocardless=cancel`}),h={idempotencyKey:f,confirmation:c};g.setItem(re,JSON.stringify(h)),window.location.assign(d.authorisationUrl);return}else if(p==="zip"&&r.paymentMethods.includes("zip")){const s=window.location.origin,d=await m.createZipCheckout({idempotencyKey:f,redirectUrl:`${s}/checkout?zip=return`}),h={idempotencyKey:f,confirmation:c};g.setItem($t,JSON.stringify(h)),window.location.assign(d.redirectUrl);return}else if(p==="klarna"&&r.paymentMethods.includes("klarna")){const s=window.location.origin,d=await m.createKlarnaCheckout({idempotencyKey:f,confirmUrl:`${s}/checkout?klarna=confirm`,cancelUrl:`${s}/checkout?klarna=cancel`}),h={idempotencyKey:f,confirmation:c};g.setItem(se,JSON.stringify(h)),window.location.assign(d.redirectUrl);return}else P(c)}catch(t){const o=qt(t);o?(Ye(o),E(`${o} Your order has not been placed. Place it again to continue without the code.`)):E(t instanceof Ot?t.message:"Could not place the order. Please try again."),pe(!1)}}return{site:r,logo:y,items:i,totals:C,coupon:A,deliveryOptions:ce,courierUnavailable:Ge,retryCourier:We,shippingMethodId:q,setShippingMethodId:ze,pickupLocation:Fe,servedCountries:_,formatMoney:He,payChoice:p,setPayChoice:le,placing:ue,email:R,setEmail:me,firstName:v,setFirstName:fe,lastName:B,setLastName:ye,address1:M,setAddress1:F,address2:D,setAddress2:H,city:L,setCity:J,postcode:x,setPostcode:X,phone:Z,setPhone:G,country:a,setCountry:W,subdivision:b,setSubdivision:j,subdivisions:N,destination:ge,postcodeLabel:Xe,subdivisionLabel:Ze,me:ee,savedAddresses:je,selectedAddressId:Pe,setSelectedAddressId:te,saveAddress:be,setSaveAddress:Se,saveLabel:Ae,setSaveLabel:Qe,addressSaveNote:Ve,idemKey:f,confirmation:et,setConfirmation:P,orderError:tt,payment:nt,paypalStep:rt,squareStep:ct,pendingConf:it,paid:lt,setPaid:Y,payNote:dt,afterpayConfirming:ut,gocardlessConfirming:mt,zipConfirming:ft,klarnaConfirming:ht,checkoutRootRef:Ie,setCheckoutHeaderEl:gt,fillFromAddress:Ke,checkoutSignOut:kt,payOptions:S,noPaymentMethod:wt,placeOrder:Ct}}const Ue=bt(null);function an({children:r,...y}){const l=Bt(y);return w(Ue.Provider,{value:l,children:r})}function ln(){const r=St(Ue);if(!r)throw new Error("useCheckout must be used inside CheckoutStateProvider");return r}export{an as CheckoutStateProvider,sn as NO_PAYMENT_METHOD_NOTE,cn as SHIPPING_RETRY_NOTE,$e as buildPayOptions,ln as useCheckout};
1
+ "use client";import{jsx as g}from"react/jsx-runtime";import{createContext as Kt,useContext as Tt,useEffect as l,useMemo as Je,useRef as ce,useState as o}from"react";import{isOrderable as Xe,useCart as _t}from"../CartContext.js";import{useCurrency as Mt}from"../CurrencyContext.js";import{getClickIds as Rt}from"../../lib/click-ids.js";import{adConsentForOrder as $t}from"../../lib/consent/choice.js";import{trackBeginCheckout as Lt,trackPurchase as Ut}from"../../lib/google-tag.js";import{trackMetaPurchase as Yt}from"../../lib/meta-pixel.js";import{ApiError as Ze,api as K,products as m}from"../../lib/api/index.js";import{uuid as zt}from"../../lib/uuid.js";import{orderLinesForSets as qt}from"../../lib/commerce.js";import{canPersist as Bt,safeSessionStorage as y}from"efficient-web-builder/format/lib/safe-storage";import{AFTERPAY_CONTEXT_KEY as Ft,AFTERPAY_RETURN as Dt,GOCARDLESS_CONTEXT_KEY as le,KLARNA_CONTEXT_KEY as de,ZIP_CONTEXT_KEY as Ht,ZIP_RETURN as Jt,runWalletReturn as Ge}from"../../lib/checkout/wallet-return.js";import{matchSubdivision as Xt}from"../../lib/checkout/match-subdivision.js";import{couponCodeForOrder as Zt,couponRefusedByOrder as Gt}from"../../lib/cart/coupon-preview.js";function We(r){const d=r.indexOf(`
2
+ `);return d===-1?[r,""]:[r.slice(0,d),r.slice(d+1)]}function je(r,{canParkContext:d}={canParkContext:!0}){const c=r.paymentMethods,i=[];return c.includes("card")&&i.push({key:"card",title:"Card",body:null,price:g("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA · MC · AMEX"})}),c.includes("paypal")&&r.paypalClientId&&i.push({key:"paypal",title:"PayPal",body:null,price:g("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAYPAL · CARDS"})}),c.includes("afterpay")&&i.push({key:"afterpay",title:"Afterpay",body:null,price:g("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"4 × INTEREST-FREE"})}),c.includes("square")&&r.squareApplicationId&&r.squareLocationId&&i.push({key:"square",title:"Card (Square)",body:null,price:g("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA · MC · AMEX"})}),c.includes("gocardless")&&d&&i.push({key:"gocardless",title:"Bank Direct Debit",body:null,price:g("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY BY BANK"})}),c.includes("zip")&&i.push({key:"zip",title:"Zip",body:null,price:g("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY IN 4"})}),c.includes("klarna")&&d&&i.push({key:"klarna",title:"Klarna",body:null,price:g("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY LATER"})}),c.includes("bank")&&i.push({key:"bank",title:"Bank transfer",body:null,price:g("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Invoiced"})}),i}const yn="This shop does not take payment online yet. Please contact the shop to order.";function Wt(r,d){const c=d instanceof Ze?` (${d.message})`:"";return`Your order ${r} is saved, but the payment did not start${c}. Try the payment again — your order will not be placed twice.`}const hn="Shipping cannot be calculated right now. Please try again.";function jt({site:r,logo:d,preview:c=!1}){const{items:i,totals:w,coupon:S,refuseCoupon:Ve,deliveryOptions:ue,shippingMethodId:Z,setShippingMethodId:et,setQuoteDestination:T,courier:tt,requote:nt,identify:pe,clearCapturedCart:_,replaceItems:me,removeCoupon:fe}=_t(),ot=ue.find(e=>e.id===Z)?.pickupLocation??null,{country:ye,countries:v,activeCountry:he,formatMoney:rt}=Mt(),[p,ge]=o(()=>je(r)[0]?.key??null),[we,at]=o(!0);l(()=>{at(Bt(y))},[]);const[ke,M]=o(!1),[R,G]=o(""),[A,W]=o(""),[j,Q]=o(""),[$,L]=o(""),[V,U]=o(""),[Y,z]=o(""),[x,q]=o(""),[ee,B]=o(""),[s,F]=o(()=>ye||v[0]?.code||""),[P,D]=o(""),[N,Ce]=o([]),[te,ne]=o(null),[H,E]=o(null),Pe=Je(()=>v.find(e=>e.code===s)??he,[v,s,he]),st=Pe?.postalLabel||"Postal Code",it=N[0]?.divisionType||"State / Province";l(()=>{if(!s){Ce([]),ne(s);return}ne(null);let e=!1;return m.listCountrySubdivisions(s).then(t=>{e||(Ce(t),ne(s),D(""))}),()=>{e=!0}},[s]);const be=$.trim()!==""&&Y.trim()!==""&&x.trim()!==""&&te===s&&(N.length===0||P!=="")?x.trim():"";l(()=>{T(s?{country:s,subdivision:P,postcode:be}:null)},[s,P,be,T]),l(()=>()=>T(null),[T]);const ct=tt?.status==="unavailable",lt=nt,[oe,Se]=o(null),[dt,ve]=o([]),[Ae,re]=o("new"),[xe,Ne]=o(!1),[Ee,ut]=o("Home"),[pt,Oe]=o(null),[u]=o(()=>zt()),Ie=ce(null),[Ke,k]=o(null),[mt,C]=o(null),[Te,ft]=o(null),[_e,yt]=o(!1),[Me,ht]=o(!1),[gt,ae]=o(null),[wt,J]=o(!1),[se,Re]=o(null),[kt,h]=o(null),[Ct,Pt]=o(!1),[bt,$e]=o(!1),[St,vt]=o(!1),[At,Le]=o(!1),Ue=!!(Ke||Te||_e||Me);l(()=>{Ue&&(me([]),fe())},[Ue,me,fe]);const Ye=ce(!1);l(()=>{c||Ye.current||!i.some(Xe)||(Ye.current=!0,Lt({lines:i,currency:w.currency,value:w.subtotal-w.discount,coupon:S?.valid?S.code:void 0}))},[i,w,S,c]),l(()=>{pe(R,A.trim()||void 0)},[R,A,pe]);const ze=ce(null),[X,xt]=o(null);l(()=>{const e=ze.current;if(!X||!e)return;const t=()=>e.style.setProperty("--sf-checkout-header-h",`${X.offsetHeight}px`);t();const n=new ResizeObserver(t);return n.observe(X),()=>n.disconnect()},[X]),l(()=>{const e=n=>({setConfirming:n,land:k,markPaid:()=>J(!0),note:h,fail:C,clearCart:_}),t={search:window.location.search,storage:y,scrubQuery:()=>window.history.replaceState(null,"",window.location.pathname)};Ge(Dt,{...t,capture:m.captureAfterpayPayment,page:e(Pt)}),Ge(Jt,{...t,capture:m.captureZipPayment,page:e(vt)})},[]),l(()=>{const t=new URLSearchParams(window.location.search).get("gocardless");if(t!=="confirm"&&t!=="cancel")return;const n=y.getItem(le);if(y.removeItem(le),window.history.replaceState(null,"",window.location.pathname),!n)return;let a;try{a=JSON.parse(n)}catch{return}if(_(),t==="cancel"){h("The direct debit was not set up — our team will follow up on payment."),k(a.confirmation);return}$e(!0),m.completeGocardlessPayment({idempotencyKey:a.idempotencyKey}).then(f=>{f.status==="paid"?J(!0):f.status==="declined"?h("The direct debit was declined — our team will follow up on payment."):h("Your direct debit is set up — the payment is collecting and will clear in a few days.")}).catch(()=>{h("We could not confirm the direct debit — our team will follow up on payment.")}).finally(()=>{k(a.confirmation),$e(!1)})},[]),l(()=>{const e=new URLSearchParams(window.location.search),t=e.get("klarna");if(t!=="confirm"&&t!=="cancel")return;const n=y.getItem(de);y.removeItem(de);const a=e.get("authorization_token");if(window.history.replaceState(null,"",window.location.pathname),!n)return;let f;try{f=JSON.parse(n)}catch{return}if(_(),t==="cancel"||!a){h("The Klarna payment was not completed — our team will follow up on payment."),k(f.confirmation);return}Le(!0),m.captureKlarnaPayment({idempotencyKey:f.idempotencyKey,authorizationToken:a}).then(O=>{O.status==="paid"?J(!0):O.status==="declined"?h("Klarna declined the payment — our team will follow up on payment."):h("Your Klarna payment is being reviewed — we'll confirm the outcome shortly.")}).catch(()=>{h("We could not confirm the Klarna payment — our team will follow up on payment.")}).finally(()=>{k(f.confirmation),Le(!1)})},[]);function qe(e){const[t,n]=We(e.address);L(t),U(n),z(e.city),q(e.zip_code),e.country&&F(e.country),e.phone&&B(e.phone),E({country:e.country||null,state:e.state??""})}l(()=>{if(H){if((H.country||s)!==s){E(null);return}te===s&&(D(Xt(s,H.state,N)),E(null))}},[H,s,te,N]),l(()=>{let e=!1;return(async()=>{try{const[t,n,a]=await Promise.all([K.me(),K.myProfile().catch(()=>null),K.myAddresses().catch(()=>[])]);if(e)return;Se(t);const f=a.filter(I=>I.is_active);ve(f),G(t.email);const O=(n?.contact_name??"").split(/\s+/);W(t.first_name||O[0]||""),Q(t.last_name||O.slice(1).join(" "));const He=t.phone||n?.phone;He&&B(He);const ie=f.find(I=>I.id===t.default_delivery_location)??f[0];if(ie)re(ie.id),qe(ie);else if(n){const[I,It]=We(n.address??"");L(I),U(It),z(n.city??""),q(n.zip_code??""),n.country&&F(n.country),E({country:n.country||null,state:n.state??""})}}catch{}})(),()=>{e=!0}},[]);function Nt(){K.logout(),Se(null),ve([]),re("new"),Ne(!1),G(""),W(""),Q(""),L(""),U(""),z(""),q(""),B(""),F(ye||v[0]?.code||""),D(""),E(null)}const b=Je(()=>je(r,{canParkContext:we}),[r,we]);l(()=>{b.some(e=>e.key===p)||ge(b[0]?.key??null)},[b,p]);const Et=b.length===0,Be=V.trim()?`${$}
3
+ ${V.trim()}`:$;async function Ot(){if(c||ke)return;if(se){M(!0),C(null),await Fe(),await De(se);return}if(i.length===0||w.repricing||!p||!b.some(n=>n.key===p))return;const e=i.filter(Xe).flatMap(n=>qt(n.components,n.qty));if(e.length===0){C("Pick a size on each wheel's product page before checking out.");return}M(!0),C(null);let t;try{const n=oe?m.createOrderAuthed:m.createOrder,a=$t();t=await n({customer:{email:R,name:`${A} ${j}`.trim(),phone:ee.trim()||void 0,address:Be,city:Y,state:P||void 0,zipCode:x,country:s},items:e,currency:w.currency,idempotencyKey:u,shippingMethodId:Z??void 0,couponCode:Zt(S),...a==="denied"?{}:Rt(),...a?{adConsent:a}:{}}),Ut({confirmation:t,lines:i,adsSendTo:r.googleAdsId&&r.googleAdsConversionLabel?`${r.googleAdsId}/${r.googleAdsConversionLabel}`:null}),Yt({confirmation:t,lines:i}),_(),await Fe()}catch(n){const a=Gt(n);a?(Ve(a),C(`${a} Your order has not been placed. Place it again to continue without the code.`)):C(n instanceof Ze?n.message:"Could not place the order. Please try again."),M(!1);return}await De(t)}async function Fe(){if(!(!oe||!xe||Ae!=="new"||Ie.current===u))try{await K.createAddress({label:Ee.trim()||"Home",contact_name:`${A} ${j}`.trim(),phone:ee.trim(),address:Be,city:Y,zip_code:x,state:P,country:s}),Ie.current=u,Oe("Address saved to your account.")}catch{Oe("We couldn't save the address to your account — you can add it under Account → Addresses.")}}async function De(e){Re(null);try{if(p==="card"&&r.paymentMethods.includes("card")){const t=await m.createPaymentIntent({idempotencyKey:u});ae(e),ft(t)}else if(p==="paypal"&&r.paymentMethods.includes("paypal"))ae(e),yt(!0);else if(p==="afterpay"&&r.paymentMethods.includes("afterpay")){const t=window.location.origin,n=await m.createAfterpayCheckout({idempotencyKey:u,confirmUrl:`${t}/checkout?afterpay=confirm`,cancelUrl:`${t}/checkout?afterpay=cancel`}),a={idempotencyKey:u,confirmation:e};y.setItem(Ft,JSON.stringify(a)),window.location.assign(n.redirectCheckoutUrl);return}else if(p==="square"&&r.paymentMethods.includes("square"))ae(e),ht(!0);else if(p==="gocardless"&&r.paymentMethods.includes("gocardless")){const t=window.location.origin,n=await m.createGocardlessBillingRequest({idempotencyKey:u,confirmUrl:`${t}/checkout?gocardless=confirm`,cancelUrl:`${t}/checkout?gocardless=cancel`}),a={idempotencyKey:u,confirmation:e};y.setItem(le,JSON.stringify(a)),window.location.assign(n.authorisationUrl);return}else if(p==="zip"&&r.paymentMethods.includes("zip")){const t=window.location.origin,n=await m.createZipCheckout({idempotencyKey:u,redirectUrl:`${t}/checkout?zip=return`}),a={idempotencyKey:u,confirmation:e};y.setItem(Ht,JSON.stringify(a)),window.location.assign(n.redirectUrl);return}else if(p==="klarna"&&r.paymentMethods.includes("klarna")){const t=window.location.origin,n=await m.createKlarnaCheckout({idempotencyKey:u,confirmUrl:`${t}/checkout?klarna=confirm`,cancelUrl:`${t}/checkout?klarna=cancel`}),a={idempotencyKey:u,confirmation:e};y.setItem(de,JSON.stringify(a)),window.location.assign(n.redirectUrl);return}else k(e)}catch(t){Re(e),C(Wt(e.orderNumber,t)),M(!1)}}return{site:r,logo:d,items:i,totals:w,coupon:S,deliveryOptions:ue,courierUnavailable:ct,retryCourier:lt,shippingMethodId:Z,setShippingMethodId:et,pickupLocation:ot,servedCountries:v,formatMoney:rt,payChoice:p,setPayChoice:ge,placing:ke,email:R,setEmail:G,firstName:A,setFirstName:W,lastName:j,setLastName:Q,address1:$,setAddress1:L,address2:V,setAddress2:U,city:Y,setCity:z,postcode:x,setPostcode:q,phone:ee,setPhone:B,country:s,setCountry:F,subdivision:P,setSubdivision:D,subdivisions:N,destination:Pe,postcodeLabel:st,subdivisionLabel:it,me:oe,savedAddresses:dt,selectedAddressId:Ae,setSelectedAddressId:re,saveAddress:xe,setSaveAddress:Ne,saveLabel:Ee,setSaveLabel:ut,addressSaveNote:pt,idemKey:u,confirmation:Ke,setConfirmation:k,orderError:mt,payment:Te,paypalStep:_e,squareStep:Me,pendingConf:gt,paid:wt,setPaid:J,unpaidOrder:se,payNote:kt,afterpayConfirming:Ct,gocardlessConfirming:bt,zipConfirming:St,klarnaConfirming:At,checkoutRootRef:ze,setCheckoutHeaderEl:xt,fillFromAddress:qe,checkoutSignOut:Nt,payOptions:b,noPaymentMethod:Et,placeOrder:Ot}}const Qe=Kt(null);function gn({children:r,...d}){const c=jt(d);return g(Qe.Provider,{value:c,children:r})}function wn(){const r=Tt(Qe);if(!r)throw new Error("useCheckout must be used inside CheckoutStateProvider");return r}export{gn as CheckoutStateProvider,yn as NO_PAYMENT_METHOD_NOTE,hn as SHIPPING_RETRY_NOTE,je as buildPayOptions,Wt as paymentNotStartedMessage,wn as useCheckout};
@@ -1 +1 @@
1
- "use client";import{jsx as l,jsxs as o}from"react/jsx-runtime";const t={body:"text-[length:var(--size-body,17px)]",labelSmall:"text-[length:var(--size-label,11px)]",labelLarge:"text-[length:var(--size-label,13px)]"};function i({loading:a,error:r,data:e}){return a?l("div",{className:`mt-10 border border-line bg-bg p-6 font-mono ${t.labelLarge} uppercase tracking-[0.24em] text-fg-dim`,children:"Loading stock fitment…"}):r?o("div",{className:`mt-10 border border-line bg-bg p-6 font-mono ${t.labelLarge} uppercase tracking-[0.22em] text-fg-dim`,children:["Couldn't load stock fitment — ",l("span",{className:"text-accent",children:r})]}):e?o("div",{className:"mt-10 grid grid-cols-6 gap-[2px] border border-line bg-line max-[1100px]:grid-cols-2 max-[700px]:grid-cols-1",children:[l(n,{label:"Bolt pattern",value:e.boltPattern??"—"}),l(n,{label:"PCD",value:e.pcd??"—"}),l(n,{label:"Hub bore",value:e.centreBore?`${e.centreBore} mm`:"—"}),l(n,{label:"ET range",value:e.etRange&&e.etRange.length===2?`${e.etRange[0]} – ${e.etRange[1]}`:"—"}),l(n,{label:"OEM front",value:e.frontWheels.length?e.frontWheels.join(" · "):"—"}),l(n,{label:"OEM rear",value:e.rearWheels.length?e.rearWheels.join(" · "):"—"})]}):null}function n({label:a,value:r}){return o("div",{className:"flex min-h-[96px] flex-col gap-2 bg-bg px-5 py-5",children:[l("span",{className:`font-mono ${t.labelSmall} uppercase tracking-[0.26em] text-fg-dim`,children:a}),l("span",{className:`mt-auto font-display ${t.body} font-medium tracking-[-0.01em] text-fg`,children:r})]})}export{i as default};
1
+ "use client";import{jsx as l,jsxs as a}from"react/jsx-runtime";const t={body:"text-[length:var(--size-body,17px)]",labelSmall:"text-[length:var(--size-label,11px)]",labelLarge:"text-[length:var(--size-label,13px)]"};function s({loading:o,error:n,data:e}){return o?l("div",{className:`mt-10 border border-line bg-bg p-6 font-mono ${t.labelLarge} uppercase tracking-[0.24em] text-fg-dim`,children:"Loading stock fitment…"}):n?a("div",{className:`mt-10 border border-line bg-bg p-6 font-mono ${t.labelLarge} uppercase tracking-[0.22em] text-fg-dim`,children:["Couldn't load stock fitment — ",l("span",{className:"text-accent",children:n})]}):e?a("div",{className:"mt-10 grid grid-cols-4 gap-[2px] border border-line bg-line max-[1100px]:grid-cols-2 max-[700px]:grid-cols-1",children:[l(r,{label:"Bolt pattern",value:e.boltPattern??"—"}),l(r,{label:"PCD",value:e.pcd??"—"}),l(r,{label:"Hub bore",value:e.centreBore?`${e.centreBore} mm`:"—"}),l(r,{label:"ET range",value:e.etRange&&e.etRange.length===2?`${e.etRange[0]} – ${e.etRange[1]}`:"—"}),l(r,{label:"OEM front",value:e.frontWheels.length?e.frontWheels.join(" · "):"—"}),l(r,{label:"OEM rear",value:e.rearWheels.length?e.rearWheels.join(" · "):"—"}),l(r,{label:"OEM front tyres",value:e.frontTyres.length?e.frontTyres.join(" · "):"—"}),l(r,{label:"OEM rear tyres",value:e.rearTyres.length?e.rearTyres.join(" · "):"—"})]}):null}function r({label:o,value:n}){return a("div",{className:"flex min-h-[96px] flex-col gap-2 bg-bg px-5 py-5",children:[l("span",{className:`font-mono ${t.labelSmall} uppercase tracking-[0.26em] text-fg-dim`,children:o}),l("span",{className:`mt-auto font-display ${t.body} font-medium tracking-[-0.01em] text-fg`,children:n})]})}export{s as default};
@@ -1 +1 @@
1
- "use client";import{jsx as e,Fragment as s,jsxs as c}from"react/jsx-runtime";import l from"../ProductGallery.js";import a from"../ProductLightbox.js";import{SECTION_NOTICE_TEXT_CLASS as p}from"../SectionNotice.js";import{heroView as d}from"../product-hero/hero-view.js";import{useIsLightTheme as f}from"../useIsLightTheme.js";import{useLightbox as g}from"../useLightbox.js";import{useProductSelection as x}from"../useProductSelection.js";import{useCurrentProduct as h}from"../../lib/document/current-product.js";import{say as L}from"efficient-web-builder/format/lib/editor-words";import{useSampleProduct as S}from"./useSampleProduct.js";function b({editing:o=!1,...t}){const r=h();return r?e(n,{product:r.product,selection:r.selection,onLightbox:r.openLightbox,editing:o,...t}):o?e(y,{...t}):null}function n({product:o,selection:t,onLightbox:r,editing:i,...u}){const m=f();return e(l,{product:o,view:d(o,t,i),angleIdx:t.angleIdx,onSelect:t.setAngleIdx,isLight:m,onLightbox:r,...u})}function y(o){const t=S(!0);return t?e(I,{product:t,...o}):e("p",{className:p,children:L("Loading sample product…")})}function I({product:o,...t}){const r=x(o,{editing:!0}),i=g();return c(s,{children:[e(n,{product:o,selection:r,onLightbox:i.open,editing:!0,...t}),e(a,{item:i.item,onClose:i.close})]})}export{b as default};
1
+ "use client";import{jsx as e,Fragment as m,jsxs as c}from"react/jsx-runtime";import l from"../ProductGallery.js";import a from"../ProductLightbox.js";import{SECTION_NOTICE_TEXT_CLASS as p}from"../SectionNotice.js";import{heroView as d}from"../product-hero/hero-view.js";import{useRootIsDark as f}from"efficient-shell/theme";import{useLightbox as g}from"../useLightbox.js";import{useProductSelection as x}from"../useProductSelection.js";import{useCurrentProduct as h}from"../../lib/document/current-product.js";import{say as L}from"efficient-web-builder/format/lib/editor-words";import{useSampleProduct as S}from"./useSampleProduct.js";function b({editing:o=!1,...t}){const r=h();return r?e(i,{product:r.product,selection:r.selection,onLightbox:r.openLightbox,editing:o,...t}):o?e(y,{...t}):null}function i({product:o,selection:t,onLightbox:r,editing:n,...u}){const s=!f({whenUnset:!0});return e(l,{product:o,view:d(o,t,n),angleIdx:t.angleIdx,onSelect:t.setAngleIdx,isLight:s,onLightbox:r,...u})}function y(o){const t=S(!0);return t?e(I,{product:t,...o}):e("p",{className:p,children:L("Loading sample product…")})}function I({product:o,...t}){const r=x(o,{editing:!0}),n=g();return c(m,{children:[e(i,{product:o,selection:r,onLightbox:n.open,editing:!0,...t}),e(a,{item:n.item,onClose:n.close})]})}export{b as default};
@@ -1,3 +1,4 @@
1
+ import type { ReactNode } from "react";
1
2
  import type { StoreProduct } from "../../lib/catalog/store-product.js";
2
3
  import type { HeroPricePlacement } from "../../lib/sections/hero-price-placement.js";
3
4
  import type { HeroLayout, HeroTextAlign } from "../../lib/sections/hero-arrangement.js";
@@ -10,6 +11,7 @@ interface HeroArrangement {
10
11
  showPriceQuote?: boolean;
11
12
  galleryMode?: HeroGalleryMode;
12
13
  imageFit?: HeroImageFit;
14
+ trustBullets?: ReactNode;
13
15
  }
14
16
  export declare const supportedKinds: readonly ("alloy-wheel" | "tyre")[];
15
17
  export default function DynamicProductHero({ editing, pricePlacement, showVehicleFitment, ...arrangement }: {
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as O}from"react/jsx-runtime";import A from"../SectionBand.js";import{GRID_CARD_SHOW as k}from"../../lib/sections/card-show-defaults.js";import{useEffect as W,useId as V,useState as X}from"react";import{resolveCardImageBackground as Z,THEME_CARD_IMAGE_BG as q}from"efficient-web-builder/format/lib/content/card-image-background";import{cardImageShapeTokens as B}from"efficient-web-builder/format/lib/content/card-image-shape";import{DEFAULT_COVER_INDEX as J}from"../../lib/wheels/cover-rendering.js";import{DEFAULT_CARD_INDEX_FORMAT as Q,DEFAULT_CARD_OUTLINE as Y,cardIndexCss as ee}from"efficient-web-builder/format/lib/sections/product-card-style";import re from"../CompatibleTyres.js";import oe from"../ProductCard.js";import{CARD_ROWS_GRID_CLASS as te,cardRowsGridStyle as ie}from"../WheelCardFrame.js";import{ProductCardChromeProvider as se}from"../ProductCardChrome.js";import{gridClassImageSizes as ne}from"../../lib/sections/card-image-sizes.js";import{fillRowCss as ae}from"../../lib/sections/fill-row.js";import le from"efficient-web-builder/render/components/SectionHeader";import de from"../ViewMoreLink.js";import{useSiteMenuLinks as ce}from"../catalog/SiteMenuLinks.js";import{renderGold as F,renderHeadline as me}from"efficient-web-builder/render/components/goldPhrases";import pe from"./KindGate.js";import{loadProductCatalog as ue}from"../useProductCatalog.js";import{PLP_KINDS as fe}from"../../lib/catalog/plp-item.js";import{relatedCardCount as he,relatedViewMore as ge}from"../../lib/catalog/related-cards.js";import{DEFAULT_RELATIONSHIP as xe,relationshipApplies as Ce,relationshipByKey as ye}from"../../lib/catalog/relationships.js";import{useCurrentProduct as we}from"../../lib/document/current-product.js";import{PLACEHOLDER_RELATED as H}from"../../lib/wheels/placeholder-wheel.js";import{say as T}from"efficient-web-builder/format/lib/editor-words";const G={label:"text-[length:var(--size-label,13px)]"},be=fe,$={2:"grid-cols-2 max-[800px]:grid-cols-1",3:"grid-cols-3 max-[1100px]:grid-cols-2 max-[800px]:grid-cols-1",4:"grid-cols-4 max-[1100px]:grid-cols-2 max-[800px]:grid-cols-1"};function _e(r){return e(pe,{kinds:be,type:"RelatedProducts",editing:r.editing,children:e(Se,{...r})})}function Se({num:r,title:t,description:c,columns:n=3,cardCount:_,relationship:S=xe,footnote:E,footnoteLinkText:R,footnoteLinkHref:D,editing:o=!1,omitHead:x=!1,cardImage:i,outline:m,indexBadge:p,showBadge:C,showCardPrice:y,showCardFinishes:a,showCardSizes:l,showCardBuy:u,showCardPage:f,coverIndex:h,imageBackground:g,spinOnHover:w}){const d=we(),U=ce(),I=he(_),[j,N]=X([]);W(()=>{if(d||!o)return;let v=!1;return ue().then(M=>{const K=M.length>0?M:H;v||N(K)}).catch(()=>{v||N(H)}),()=>{v=!0}},[d,o]);const s=ye(S);if(!s)return null;const L=ge(s,U),P=x?null:e(le,{num:r?F(r):void 0,title:me(t||s.heading,!1),description:c?F(c):void 0,accent:!0});if(!d)return o?e(z,{header:P,wheels:j.slice(0,I),columns:n,viewMore:L,cardImage:i,outline:m,indexBadge:p,showBadge:C,showCardPrice:y,showCardFinishes:a,showCardSizes:l,showCardBuy:u,showCardPage:f,coverIndex:h,imageBackground:g,spinOnHover:w}):null;if(!Ce(s,d.product.kind))return o?e(A,{className:"border-b border-line py-14 max-[1100px]:py-10",style:B(i),children:e("p",{className:`font-mono ${G.label} uppercase tracking-[0.18em] text-fg-dim`,children:T("“{relationship}” does not apply to this product. It is hidden on the live page.",{relationship:T(s.label)})})}):null;const b=s.resolve(d.product,d.relatedWheels);return b.kind==="tyre"?e(re,{omitHead:x,columns:n,cardImage:i,outline:m,indexBadge:p,num:r,title:t||s.heading,description:c,tyres:[...b.tyres].slice(0,I),footnote:E,footnoteLinkText:R,footnoteLinkHref:D,viewMore:L,editing:o}):b.wheels.length===0?o?O(A,{className:"border-b border-line py-[120px] max-[1100px]:py-20",style:B(i),children:[P,e("p",{className:`border-t border-line py-6 font-mono ${G.label} uppercase tracking-[0.18em] text-fg-dim`,children:T("Related products appear here on a product page.")})]}):null:e(z,{header:P,wheels:[...b.wheels].slice(0,I),columns:n,viewMore:L,cardImage:i,outline:m,indexBadge:p,showBadge:C,showCardPrice:y,showCardFinishes:a,showCardSizes:l,showCardBuy:u,showCardPage:f,coverIndex:h,imageBackground:g,spinOnHover:w})}function z({header:r,wheels:t,columns:c,viewMore:n,cardImage:_,outline:S,indexBadge:E,showBadge:R,showCardPrice:D,showCardFinishes:o,showCardSizes:x,showCardBuy:i,showCardPage:m,coverIndex:p,imageBackground:C,spinOnHover:y}){const a=`rp-${V().replace(/:/g,"")}`;if(t.length===0)return null;const l=$[Math.min(4,Math.max(2,c))]??$[3],u=E??Q,f=ee(a,u),h=ae(a,l,{cards:t.length});return O(A,{className:"border-b border-line py-[120px] max-[1100px]:py-20",style:B(_),children:[f&&e("style",{children:f}),h&&e("style",{children:h}),r,e(se,{imageSizes:ne(l,t.length),imageBackgroundFill:Z(C,q),spinOnHover:y??!0,coverIndex:p??J,outline:S??Y,indexBadge:u,showBadge:R??!0,showCardPrice:D??!0,showCardFinishes:o??!0,showCardSizes:x??k.showCardSizes,showCardBuy:i??k.showCardBuy,showCardPage:m??k.showCardPage,children:e("div",{className:`${a} grid gap-[2px] ${te} bg-[var(--catalog-grid-bg)] ${l}`,style:ie("2px"),children:t.map((g,w)=>e(oe,{wheel:g,variant:"catalog"},`${g.slug}-${w}`))})}),e("div",{className:"mt-10 flex",children:e(de,{href:n.href,label:n.label})})]})}export{Se as RelatedProductsBody,_e as default,be as supportedKinds};
1
+ "use client";import{jsx as e,jsxs as O}from"react/jsx-runtime";import I from"../SectionBand.js";import{useScopeClass as W}from"../../lib/use-scope-class.js";import{GRID_CARD_SHOW as k}from"../../lib/sections/card-show-defaults.js";import{useEffect as V,useState as X}from"react";import{resolveCardImageBackground as Z,THEME_CARD_IMAGE_BG as q}from"efficient-web-builder/format/lib/content/card-image-background";import{cardImageShapeTokens as B}from"efficient-web-builder/format/lib/content/card-image-shape";import{DEFAULT_COVER_INDEX as J}from"../../lib/wheels/cover-rendering.js";import{DEFAULT_CARD_INDEX_FORMAT as Q,DEFAULT_CARD_OUTLINE as Y,cardIndexCss as ee}from"efficient-web-builder/format/lib/sections/product-card-style";import re from"../CompatibleTyres.js";import oe from"../ProductCard.js";import{CARD_ROWS_GRID_CLASS as te,cardRowsGridStyle as ie}from"../WheelCardFrame.js";import{ProductCardChromeProvider as se}from"../ProductCardChrome.js";import{gridClassImageSizes as ne}from"../../lib/sections/card-image-sizes.js";import{fillRowCss as ae}from"../../lib/sections/fill-row.js";import le from"efficient-web-builder/render/components/SectionHeader";import de from"../ViewMoreLink.js";import{useSiteMenuLinks as ce}from"../catalog/SiteMenuLinks.js";import{renderGold as F,renderHeadline as me}from"efficient-web-builder/render/components/goldPhrases";import pe from"./KindGate.js";import{loadProductCatalog as ue}from"../useProductCatalog.js";import{PLP_KINDS as fe}from"../../lib/catalog/plp-item.js";import{relatedCardCount as he,relatedViewMore as ge}from"../../lib/catalog/related-cards.js";import{DEFAULT_RELATIONSHIP as xe,relationshipApplies as Ce,relationshipByKey as ye}from"../../lib/catalog/relationships.js";import{useCurrentProduct as we}from"../../lib/document/current-product.js";import{PLACEHOLDER_RELATED as H}from"../../lib/wheels/placeholder-wheel.js";import{say as T}from"efficient-web-builder/format/lib/editor-words";const G={label:"text-[length:var(--size-label,13px)]"},be=fe,$={2:"grid-cols-2 max-[800px]:grid-cols-1",3:"grid-cols-3 max-[1100px]:grid-cols-2 max-[800px]:grid-cols-1",4:"grid-cols-4 max-[1100px]:grid-cols-2 max-[800px]:grid-cols-1"};function Se(r){return e(pe,{kinds:be,type:"RelatedProducts",editing:r.editing,children:e(_e,{...r})})}function _e({num:r,title:t,description:c,columns:n=3,cardCount:S,relationship:_=xe,footnote:E,footnoteLinkText:R,footnoteLinkHref:D,editing:o=!1,omitHead:x=!1,cardImage:i,outline:m,indexBadge:p,showBadge:C,showCardPrice:y,showCardFinishes:a,showCardSizes:l,showCardBuy:u,showCardPage:f,coverIndex:h,imageBackground:g,spinOnHover:w}){const d=we(),U=ce(),L=he(S),[j,N]=X([]);V(()=>{if(d||!o)return;let A=!1;return ue().then(M=>{const K=M.length>0?M:H;A||N(K)}).catch(()=>{A||N(H)}),()=>{A=!0}},[d,o]);const s=ye(_);if(!s)return null;const P=ge(s,U),v=x?null:e(le,{num:r?F(r):void 0,title:me(t||s.heading,!1),description:c?F(c):void 0,accent:!0});if(!d)return o?e(z,{header:v,wheels:j.slice(0,L),columns:n,viewMore:P,cardImage:i,outline:m,indexBadge:p,showBadge:C,showCardPrice:y,showCardFinishes:a,showCardSizes:l,showCardBuy:u,showCardPage:f,coverIndex:h,imageBackground:g,spinOnHover:w}):null;if(!Ce(s,d.product.kind))return o?e(I,{className:"border-b border-line py-14 max-[1100px]:py-10",style:B(i),children:e("p",{className:`font-mono ${G.label} uppercase tracking-[0.18em] text-fg-dim`,children:T("“{relationship}” does not apply to this product. It is hidden on the live page.",{relationship:T(s.label)})})}):null;const b=s.resolve(d.product,d.relatedWheels);return b.kind==="tyre"?e(re,{omitHead:x,columns:n,cardImage:i,outline:m,indexBadge:p,num:r,title:t||s.heading,description:c,tyres:[...b.tyres].slice(0,L),footnote:E,footnoteLinkText:R,footnoteLinkHref:D,viewMore:P,editing:o}):b.wheels.length===0?o?O(I,{className:"border-b border-line py-[120px] max-[1100px]:py-20",style:B(i),children:[v,e("p",{className:`border-t border-line py-6 font-mono ${G.label} uppercase tracking-[0.18em] text-fg-dim`,children:T("Related products appear here on a product page.")})]}):null:e(z,{header:v,wheels:[...b.wheels].slice(0,L),columns:n,viewMore:P,cardImage:i,outline:m,indexBadge:p,showBadge:C,showCardPrice:y,showCardFinishes:a,showCardSizes:l,showCardBuy:u,showCardPage:f,coverIndex:h,imageBackground:g,spinOnHover:w})}function z({header:r,wheels:t,columns:c,viewMore:n,cardImage:S,outline:_,indexBadge:E,showBadge:R,showCardPrice:D,showCardFinishes:o,showCardSizes:x,showCardBuy:i,showCardPage:m,coverIndex:p,imageBackground:C,spinOnHover:y}){const a=W("rp");if(t.length===0)return null;const l=$[Math.min(4,Math.max(2,c))]??$[3],u=E??Q,f=ee(a,u),h=ae(a,l,{cards:t.length});return O(I,{className:"border-b border-line py-[120px] max-[1100px]:py-20",style:B(S),children:[f&&e("style",{children:f}),h&&e("style",{children:h}),r,e(se,{imageSizes:ne(l,t.length),imageBackgroundFill:Z(C,q),spinOnHover:y??!0,coverIndex:p??J,outline:_??Y,indexBadge:u,showBadge:R??!0,showCardPrice:D??!0,showCardFinishes:o??!0,showCardSizes:x??k.showCardSizes,showCardBuy:i??k.showCardBuy,showCardPage:m??k.showCardPage,children:e("div",{className:`${a} grid gap-[2px] ${te} bg-[var(--catalog-grid-bg)] ${l}`,style:ie("2px"),children:t.map((g,w)=>e(oe,{wheel:g,variant:"catalog"},`${g.slug}-${w}`))})}),e("div",{className:"mt-10 flex",children:e(de,{href:n.href,label:n.label})})]})}export{_e as RelatedProductsBody,Se as default,be as supportedKinds};
@@ -1 +1 @@
1
- "use client";import{jsx as c}from"react/jsx-runtime";import h from"../SpecTable.js";import v from"./KindGate.js";import{useEuTyreLabels as A}from"../useEuTyreLabels.js";import{buildSpecSheet as E,sourceFromWheel as P}from"../../lib/wheels/spec-sheet.js";import{buildTyreSpecSheet as k}from"../../lib/tyres/spec-sheet.js";import{partVariant as L}from"../../lib/catalog/from-wheel.js";import{useCurrentProduct as V}from"../../lib/document/current-product.js";import{applySpecAnswers as b}from"../../lib/content/field-usage.js";import{useSampleProduct as _}from"./useSampleProduct.js";const j=["alloy-wheel","tyre"],G=[],I=[];function K(n,r,s){const i=n.variants??[];return(r?i.find(t=>t.sku===r):void 0)??(s?i.find(t=>t.size===s):void 0)??i[0]??null}function M(n){return c(v,{kinds:j,type:"SpecTable",editing:n.editing,children:c(N,{...n})})}function N({num:n,title:r,description:s,showDiagram:i=!0,editing:t=!1,nodeId:d,omitHead:u=!1}){const e=V(),w=_(t&&!e),a=e?.product??w,l=a?.kind==="tyre"?a.source:null,y=A(l?.variants??G),p=e?.fieldUsage??I;if(l){const f=K(l,e?.selection.part?.id,e?.selection.shown.size),g=y.find(z=>z.size===f?.size)??null,x=k({brand:l.brand,variant:f,euLabel:g});return c(h,{capped:!1,num:n,title:r,description:s,rows:b(x.rows,p),diagram:null,editing:t,nodeId:d,omitHead:u})}const o=a?.kind==="alloy-wheel"?a.source:null,S=e?e.selection.shown.finish:o?.finishes[0]?.name,T=e&&o?L(o,e.selection.part)?.size??void 0:void 0,m=o?E(P(o),S,T):{rows:[],diagram:null};return c(h,{capped:!1,num:n,title:r,description:s,rows:b(m.rows,p),diagram:i?m.diagram:null,editing:t,nodeId:d,omitHead:u})}export{M as default,j as supportedKinds};
1
+ "use client";import{jsx as c}from"react/jsx-runtime";import b from"../SpecTable.js";import L from"./KindGate.js";import{useEuTyreLabels as v}from"../useEuTyreLabels.js";import{buildSpecSheet as A,sourceFromWheel as E}from"../../lib/wheels/spec-sheet.js";import{buildTyreSpecSheet as I}from"../../lib/tyres/spec-sheet.js";import{partVariant as P}from"../../lib/catalog/from-wheel.js";import{useCurrentProduct as k}from"../../lib/document/current-product.js";import{applySpecAnswers as h}from"../../lib/content/field-usage.js";import{useSampleProduct as V}from"./useSampleProduct.js";const _=["alloy-wheel","tyre"],j=[],G=[];function K(n,r,s){const i=n.variants??[];return(r?i.find(t=>t.sku===r):void 0)??(s?i.find(t=>t.size===s):void 0)??i[0]??null}function M(n){return c(L,{kinds:_,type:"SpecTable",editing:n.editing,children:c(N,{...n})})}function N({num:n,title:r,description:s,showDiagram:i=!0,editing:t=!1,nodeId:u,omitHead:d=!1}){const e=k(),w=V(t&&!e),a=e?.product??w,l=a?.kind==="tyre"?a.source:null,y=v(l?.variants??j),p=e?.fieldUsage??G;if(l){const f=K(l,e?.selection.part?.id,e?.selection.shown.size),g=y.find(z=>z.size===f?.size)??null,x=I({brand:l.brand,variant:f,euLabel:g});return c(b,{capped:!1,builtInLabels:!0,num:n,title:r,description:s,rows:h(x.rows,p),diagram:null,editing:t,nodeId:u,omitHead:d})}const o=a?.kind==="alloy-wheel"?a.source:null,S=e?e.selection.shown.finish:o?.finishes[0]?.name,T=e&&o?P(o,e.selection.part)?.size??void 0:void 0,m=o?A(E(o),S,T):{rows:[],diagram:null};return c(b,{capped:!1,builtInLabels:!0,num:n,title:r,description:s,rows:h(m.rows,p),diagram:i?m.diagram:null,editing:t,nodeId:u,omitHead:d})}export{M as default,_ as supportedKinds};
@@ -1 +1 @@
1
- "use client";import{jsx as t,Fragment as p,jsxs as c}from"react/jsx-runtime";import{useCallback as M,useRef as O,useState as E}from"react";import{sizedImage as P}from"efficient-web-builder/format/lib/sized-image";import A from"efficient-web-builder/render/components/Placeholder";import T,{LightboxClose as U}from"../Lightbox.js";import{GALLERY_GRID_ATTR as $}from"../GalleryItem.js";const z="(max-width: 1600px) 100vw, 1600px",R="(max-width: 1100px) 100vw, 50vw",D="(max-width: 800px) 30vw, 200px",G="100vw";function m(r,l){return r.video?l?`Play video of ${l}`:"Play video":l?`Open photo of ${l}`:"Open photo"}function H({small:r=!1}){return t("span",{"aria-hidden":!0,"data-play-badge":"",className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:t("span",{className:`flex items-center justify-center rounded-full bg-bg/75 text-fg ${r?"h-8 w-8 text-[length:12px]":"h-16 w-16 text-[length:22px]"}`,children:"▶"})})}const Z="relative block w-full overflow-hidden bg-surface-2",F="block h-[min(78vh,820px)] w-full object-cover max-[800px]:h-[min(70vh,560px)]",W="block aspect-[4/5] max-h-[80vh] w-full object-cover",X="grid grid-cols-4 gap-2",q="relative block aspect-square w-full overflow-hidden bg-surface-2",L="block h-full w-full object-cover",Y="grid grid-cols-6 gap-2 max-[800px]:grid-cols-4",J={3:"grid grid-cols-3 gap-2 max-[800px]:grid-cols-2",4:"grid grid-cols-4 gap-2 max-[800px]:grid-cols-2"},K="relative block aspect-[4/5] w-full overflow-hidden bg-surface-2",Q="(max-width: 800px) 50vw, 25vw",V="cursor-pointer text-left focus:outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2",I="absolute top-1/2 z-[2] flex h-14 w-14 -translate-y-1/2 cursor-pointer items-center justify-center border border-fg-dim/40 bg-overlay-scrim/40 font-mono text-[length:var(--size-label,22px)] text-fg-dim transition-colors hover:border-accent hover:text-accent max-[700px]:h-11 max-[700px]:w-11";function ee({pictures:r,name:l,editing:g=!1,fit:v="section",across:j=4}){const[S,w]=E(!1),[i,f]=E(0),x=O(null),B=M(e=>{e?x.current=e:(x.current?.pause(),x.current=null)},[]),o=r.length,y=v==="column";if(o===0)return null;const k=()=>f(e=>(e-1+o)%o),N=()=>f(e=>(e+1)%o),C=e=>{f(e),w(!0)},n=r[Math.min(i,o-1)],d=(e,a,s,h)=>e.url?t("span",{className:`${s} relative`,children:t(A,{label:e.alt||l||"photo",src:e.url,alt:e.alt||l,sizes:a,objectFit:"cover",showBackground:!1})}):t("span",{"aria-hidden":!0,className:`${s} bg-surface-2`}),u=v==="tiles",b=(e,a,s)=>{const h=c(p,{children:[u?d(e,Q,L,800):s?y?d(e,R,W,1200):d(e,z,F,1600):d(e,D,L,400),e.video&&t(H,{small:!s&&!u})]}),_=u?K:s?Z:q;return g?t("div",{className:_,children:h}):t("button",{type:"button","aria-label":m(e,l),onClick:()=>C(a),className:`${_} ${V}`,children:h})};return c(p,{children:[u?t("ul",{[$]:"","data-record-gallery":"tiles",className:J[j===3?3:4],children:r.map((e,a)=>t("li",{children:b(e,a,!1)},`${e.url}-${a}`))}):c("div",{[$]:"","data-record-gallery":"",className:"flex flex-col gap-2",children:[b(r[0],0,!0),o>1&&t("ul",{className:y?X:Y,children:r.slice(1).map((e,a)=>t("li",{children:b(e,a+1,!1)},`${e.url}-${a+1}`))})]}),!g&&t(T,{open:S,onClose:()=>w(!1),label:m(n,l),onPrev:o>1?k:void 0,onNext:o>1?N:void 0,className:"flex items-center justify-center p-6 backdrop-blur-[8px] max-[700px]:p-3",style:{background:"color-mix(in oklab, var(--bg) 86%, transparent)"},children:c("div",{onClick:e=>e.stopPropagation(),className:"relative flex h-full w-full items-center justify-center",children:[t(U,{className:"absolute right-0 top-0 z-[3] flex h-12 w-12 cursor-pointer items-center justify-center border border-line font-mono text-[length:var(--size-label,18px)] text-fg-dim transition-colors hover:border-accent hover:text-fg",style:{background:"color-mix(in oklab, var(--bg) 70%, transparent)"},children:"✕"}),n.video?t("video",{ref:B,controls:!0,playsInline:!0,preload:"metadata",poster:n.url,src:n.video,"aria-label":m(n,l),className:"block max-h-[calc(100vh-120px)] max-w-full bg-bg"},`video-${i}`):t("img",{...P(n.url,{fallbackWidth:1600}),sizes:G,alt:`${n.alt||l||"Photo"} — ${i+1} of ${o}`,className:"block max-h-[calc(100vh-120px)] max-w-full object-contain"},`photo-${i}`),o>1&&c(p,{children:[t("button",{type:"button","aria-label":"Previous photo",onClick:k,className:`${I} left-0`,children:"◁"}),t("button",{type:"button","aria-label":"Next photo",onClick:N,className:`${I} right-0`,children:"▷"}),c("span",{"data-gallery-counter":"",className:"absolute bottom-0 left-1/2 -translate-x-1/2 border border-fg-dim/30 bg-overlay-scrim/50 px-4 py-1.5 font-mono text-[length:var(--size-label,14px)] uppercase tracking-[0.22em] text-fg-dim backdrop-blur-[4px]",children:[i+1," / ",o]})]})]})})]})}export{ee as default,m as pictureLabel};
1
+ "use client";import{jsx as t,Fragment as m,jsxs as c}from"react/jsx-runtime";import{useCallback as B,useRef as C,useState as E}from"react";import{sizedImage as M}from"efficient-web-builder/format/lib/sized-image";import P from"efficient-web-builder/render/components/Placeholder";import A,{LightboxClose as U,LIGHTBOX_CLOSE_TINT as z}from"../Lightbox.js";import{GALLERY_GRID_ATTR as L}from"../GalleryItem.js";const R="(max-width: 1600px) 100vw, 1600px",G="(max-width: 1100px) 100vw, 50vw",D="(max-width: 800px) 30vw, 200px",H="100vw";function b(r,l){return r.video?l?`Play video of ${l}`:"Play video":l?`Open photo of ${l}`:"Open photo"}function Z({small:r=!1}){return t("span",{"aria-hidden":!0,"data-play-badge":"",className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:t("span",{className:`flex items-center justify-center rounded-full bg-bg/75 text-fg ${r?"h-8 w-8 text-[length:12px]":"h-16 w-16 text-[length:22px]"}`,children:"▶"})})}const F="relative block w-full overflow-hidden bg-surface-2",X="block h-[min(78vh,820px)] w-full object-cover max-[800px]:h-[min(70vh,560px)]",W="block aspect-[4/5] max-h-[80vh] w-full object-cover",q="grid grid-cols-4 gap-2",Y="relative block aspect-square w-full overflow-hidden bg-surface-2",I="block h-full w-full object-cover",J="grid grid-cols-6 gap-2 max-[800px]:grid-cols-4",K={3:"grid grid-cols-3 gap-2 max-[800px]:grid-cols-2",4:"grid grid-cols-4 gap-2 max-[800px]:grid-cols-2"},Q="relative block aspect-[4/5] w-full overflow-hidden bg-surface-2",V="(max-width: 800px) 50vw, 25vw",ee="cursor-pointer text-left focus:outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2",$="absolute top-1/2 z-[2] flex h-14 w-14 -translate-y-1/2 cursor-pointer items-center justify-center border border-fg-dim/40 bg-overlay-scrim/40 font-mono text-[length:var(--size-label,22px)] text-fg-dim transition-colors hover:border-accent hover:text-accent max-[700px]:h-11 max-[700px]:w-11";function te({pictures:r,name:l,editing:g=!1,fit:v="section",across:S=4}){const[j,w]=E(!1),[i,f]=E(0),x=C(null),O=B(e=>{e?x.current=e:(x.current?.pause(),x.current=null)},[]),o=r.length,y=v==="column";if(o===0)return null;const _=()=>f(e=>(e-1+o)%o),N=()=>f(e=>(e+1)%o),T=e=>{f(e),w(!0)},a=r[Math.min(i,o-1)],d=(e,s,n,p)=>e.url?t("span",{className:`${n} relative`,children:t(P,{label:e.alt||l||"photo",src:e.url,alt:e.alt||l,sizes:s,objectFit:"cover",showBackground:!1})}):t("span",{"aria-hidden":!0,className:`${n} bg-surface-2`}),u=v==="tiles",h=(e,s,n)=>{const p=c(m,{children:[u?d(e,V,I,800):n?y?d(e,G,W,1200):d(e,R,X,1600):d(e,D,I,400),e.video&&t(Z,{small:!n&&!u})]}),k=u?Q:n?F:Y;return g?t("div",{className:k,children:p}):t("button",{type:"button","aria-label":b(e,l),onClick:()=>T(s),className:`${k} ${ee}`,children:p})};return c(m,{children:[u?t("ul",{[L]:"","data-record-gallery":"tiles",className:K[S===3?3:4],children:r.map((e,s)=>t("li",{children:h(e,s,!1)},`${e.url}-${s}`))}):c("div",{[L]:"","data-record-gallery":"",className:"flex flex-col gap-2",children:[h(r[0],0,!0),o>1&&t("ul",{className:y?q:J,children:r.slice(1).map((e,s)=>t("li",{children:h(e,s+1,!1)},`${e.url}-${s+1}`))})]}),!g&&t(A,{open:j,onClose:()=>w(!1),label:b(a,l),onPrev:o>1?_:void 0,onNext:o>1?N:void 0,className:"flex items-center justify-center p-6 max-[700px]:p-3",children:c("div",{onClick:e=>e.stopPropagation(),className:"relative flex h-full w-full items-center justify-center",children:[t(U,{className:"absolute right-0 top-0 z-[3] flex h-12 w-12 cursor-pointer items-center justify-center border border-line font-mono text-[length:var(--size-label,18px)] text-fg-dim transition-colors hover:border-accent hover:text-fg",style:{background:z},children:"✕"}),a.video?t("video",{ref:O,controls:!0,playsInline:!0,preload:"metadata",poster:a.url,src:a.video,"aria-label":b(a,l),className:"block max-h-[calc(100vh-120px)] max-w-full bg-bg"},`video-${i}`):t("img",{...M(a.url,{fallbackWidth:1600}),sizes:H,alt:`${a.alt||l||"Photo"} — ${i+1} of ${o}`,className:"block max-h-[calc(100vh-120px)] max-w-full object-contain"},`photo-${i}`),o>1&&c(m,{children:[t("button",{type:"button","aria-label":"Previous photo",onClick:_,className:`${$} left-0`,children:"◁"}),t("button",{type:"button","aria-label":"Next photo",onClick:N,className:`${$} right-0`,children:"▷"}),c("span",{"data-gallery-counter":"",className:"absolute bottom-0 left-1/2 -translate-x-1/2 border border-fg-dim/30 bg-overlay-scrim/50 px-4 py-1.5 font-mono text-[length:var(--size-label,14px)] uppercase tracking-[0.22em] text-fg-dim backdrop-blur-[4px]",children:[i+1," / ",o]})]})]})})]})}export{te as default,b as pictureLabel};
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as t,Fragment as f}from"react/jsx-runtime";import p from"next/link";import y,{Box as m}from"./VehicleQuestion.js";import{useTyreFitAnswer as k}from"../useTyreFitAnswer.js";import{TYRE_FIT_LABEL as b,tyreFitHeadline as x}from"../../lib/tyres/tyre-fit-copy.js";import{TYRE_FIT_CHIP as g,tyreFitSizeChips as N}from"../../lib/tyres/tyre-size-fit.js";import{tyreFitQuery as F}from"../../lib/tyres/tyre-vehicle-fitment.js";function v({slug:s,variants:d,vehicle:r,manualMode:n,setManualMode:u}){const{answer:o,loading:a}=k(s,n?null:F(r.applied?.vehicle)),i=r.appliedName;return e(y,{vehicle:r,escape:e("button",{type:"button",className:"cursor-pointer text-right text-accent hover:underline",onClick:()=>u(l=>!l),children:n?"← Find by vehicle":"Select by specs instead →"}),override:n?t(m,{tone:"quiet",children:[e("strong",{className:"font-semibold text-fg",children:"You are choosing by size."}),t("span",{className:"mt-2 block",children:["Pick the size above. We have not checked it against any car — make sure it matches the placard on your door."," ",e(p,{href:"/contact",className:"text-accent hover:underline",children:"Ask us if you are unsure →"})]})]}):null,verdict:e(z,{answer:o,loading:a,car:i,variants:d,onChange:r.clear}),showChangeCar:!1,cascadeErrorNote:t(f,{children:["Vehicle data is unavailable right now. Pick your size above, or"," ",e(p,{href:"/contact",className:"text-accent hover:underline",children:"ask us to check it →"})]}),askNote:"Asked once. Every tyre after this one is already filled in."})}function z({answer:s,loading:d,car:r,variants:n,onChange:u}){if(d||!s)return t(m,{tone:"quiet",children:[e("strong",{className:"font-semibold text-fg",children:"Checking your car…"})," ",t("span",{children:["Reading the factory tyre sizes for your ",r,"."]})]});const o=N(s,n),a=s.status==="doesNotFit"?"You can still order any size here — check it suits your car first.":"",i=o.length===0?x(s):"",l=i&&a?`${i} ${a}`:i||a;return t(m,{tone:s.status==="fits"?"good":"quiet",children:[t("span",{className:"block",children:[s.status==="fits"?t("strong",{className:"font-semibold text-accent",children:["✓ Made in a size your ",r," takes"]}):s.status==="doesNotFit"?t("strong",{className:"font-semibold text-fg",children:["Not made in a size your ",r," takes"]}):t("strong",{className:"font-semibold text-fg",children:["We cannot check this tyre against your ",r]}),t("span",{className:"whitespace-nowrap",children:[" · ",e("button",{type:"button",onClick:u,"aria-label":`Change car - forget ${r} and ask again`,className:"cursor-pointer uppercase tracking-[0.16em] text-accent underline underline-offset-4 hover:text-fg",children:"Change car"})]})]}),l?e("span",{className:"mt-2 block",children:l}):null,o.length>0?t(f,{children:[e("span",{className:"mt-2 block",children:"Your car takes:"}),e("ul",{className:"mt-2 flex flex-wrap gap-2",children:o.map(c=>{const h=c.made?g.fits:g.doesNotFit;return e("li",{className:"border border-line px-2 py-1 text-[11px] uppercase tracking-[0.14em]",style:h.color?{color:h.color,borderColor:h.color}:void 0,children:c.made?`${c.size} · ${b.fits}`:c.size},c.size)})})]}):null]})}export{z as TyreHeroVerdict,v as default};
1
+ "use client";import{jsx as e,jsxs as t,Fragment as f}from"react/jsx-runtime";import p from"next/link";import y,{Box as m}from"./VehicleQuestion.js";import{useTyreFitAnswer as b}from"../useTyreFitAnswer.js";import{TYRE_FIT_LABEL as k,tyreFitHeadline as x}from"../../lib/tyres/tyre-fit-copy.js";import{TYRE_FIT_CHIP as g,tyreFitSizeChips as N}from"../../lib/tyres/tyre-size-fit.js";import{tyreFitQuery as F}from"../../lib/tyres/tyre-vehicle-fitment.js";function v({slug:s,variants:d,vehicle:r,manualMode:n,setManualMode:u}){const{answer:o,loading:a}=b(s,n?null:F(r.applied?.vehicle)),i=r.appliedName;return e(y,{vehicle:r,escape:e("button",{type:"button",className:"cursor-pointer text-right text-accent hover:underline",onClick:()=>u(l=>!l),children:n?"← Find by vehicle":"Select by specs instead →"}),override:n?t(m,{tone:"quiet",children:[e("strong",{className:"font-semibold text-fg",children:"You are choosing by size."}),t("span",{className:"mt-2 block",children:["Pick the size above. We have not checked it against any car — make sure it matches the placard on your door."," ",e(p,{href:"/contact",className:"text-accent hover:underline",children:"Ask us if you are unsure →"})]})]}):null,verdict:e(z,{answer:o,loading:a,car:i,variants:d,onChange:r.clear}),showChangeCar:!1,cascadeErrorNote:t(f,{children:["Vehicle data is unavailable right now. Pick your size above, or"," ",e(p,{href:"/contact",className:"text-accent hover:underline",children:"ask us to check it →"})]})})}function z({answer:s,loading:d,car:r,variants:n,onChange:u}){if(d||!s)return t(m,{tone:"quiet",children:[e("strong",{className:"font-semibold text-fg",children:"Checking your car…"})," ",t("span",{children:["Reading the factory tyre sizes for your ",r,"."]})]});const o=N(s,n),a=s.status==="doesNotFit"?"You can still order any size here — check it suits your car first.":"",i=o.length===0?x(s):"",l=i&&a?`${i} ${a}`:i||a;return t(m,{tone:s.status==="fits"?"good":"quiet",children:[t("span",{className:"block",children:[s.status==="fits"?t("strong",{className:"font-semibold text-accent",children:["✓ Made in a size your ",r," takes"]}):s.status==="doesNotFit"?t("strong",{className:"font-semibold text-fg",children:["Not made in a size your ",r," takes"]}):t("strong",{className:"font-semibold text-fg",children:["We cannot check this tyre against your ",r]}),t("span",{className:"whitespace-nowrap",children:[" · ",e("button",{type:"button",onClick:u,"aria-label":`Change car - forget ${r} and ask again`,className:"cursor-pointer uppercase tracking-[0.16em] text-accent underline underline-offset-4 hover:text-fg",children:"Change car"})]})]}),l?e("span",{className:"mt-2 block",children:l}):null,o.length>0?t(f,{children:[e("span",{className:"mt-2 block",children:"Your car takes:"}),e("ul",{className:"mt-2 flex flex-wrap gap-2",children:o.map(c=>{const h=c.made?g.fits:g.doesNotFit;return e("li",{className:"border border-line px-2 py-1 text-[11px] uppercase tracking-[0.14em]",style:h.color?{color:h.color,borderColor:h.color}:void 0,children:c.made?`${c.size} · ${k.fits}`:c.size},c.size)})})]}):null]})}export{z as TyreHeroVerdict,v as default};
@@ -1,13 +1,12 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { VehicleControl } from "../fitment/vehicle-control.js";
3
- export default function VehicleQuestion({ vehicle, escape, override, verdict, showChangeCar, cascadeErrorNote, askNote, }: {
3
+ export default function VehicleQuestion({ vehicle, escape, override, verdict, showChangeCar, cascadeErrorNote, }: {
4
4
  vehicle: VehicleControl;
5
5
  escape: ReactNode;
6
6
  override: ReactNode | null;
7
7
  verdict: ReactNode;
8
8
  showChangeCar: boolean;
9
9
  cascadeErrorNote: ReactNode;
10
- askNote: string;
11
10
  }): import("react").JSX.Element;
12
11
  export declare function HeroVehicleMemory({ vehicle }: {
13
12
  vehicle: VehicleControl;
@@ -1 +1 @@
1
- "use client";import{jsx as a,jsxs as t}from"react/jsx-runtime";import s from"../fitment/FitmentPickerGrid.js";function p({vehicle:e,escape:n,override:r,verdict:c,showChangeCar:o,cascadeErrorNote:i,askNote:l}){const d=e.appliedName!=="";return t("div",{className:"pb-2",children:[t("div",{className:"mb-3 flex items-center justify-between gap-4 font-mono text-[13px] font-semibold uppercase tracking-[0.2em] text-fg",children:[a("span",{children:"Vehicle Fitment"}),n]}),r?a("div",{className:"flex flex-col gap-3",children:r}):d?t("div",{className:"flex flex-col gap-3",children:[c,o&&a("div",{children:a("button",{type:"button",onClick:e.clear,"aria-label":`Change car - forget ${e.appliedName} and ask again`,className:"cursor-pointer font-mono text-[12px] uppercase tracking-[0.16em] text-accent underline underline-offset-4 hover:text-fg",children:"Change car"})})]}):t("div",{className:"flex flex-col gap-3",children:[a(s,{cascade:e.cascade,compact:!0}),e.cascade.cascadeError&&a("p",{className:"font-mono text-[12px] leading-relaxed tracking-[0.1em] text-fg-dim",children:i}),a("span",{className:"font-mono text-[12px] tracking-[0.1em] text-fg-dim",children:l})]})]})}function f({vehicle:e}){return e.appliedName?t("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 border border-accent px-3 py-2 font-mono text-[12px] tracking-[0.1em] text-fg-dim",style:{background:"color-mix(in oklab, var(--accent) 8%, transparent)"},children:[t("span",{children:["Showing fitment for your"," ",a("strong",{className:"font-semibold text-fg",children:e.appliedName})]}),a("button",{type:"button",onClick:e.clear,"aria-label":`Change car - forget ${e.appliedName} and ask again`,className:"ml-auto cursor-pointer uppercase tracking-[0.16em] text-accent underline underline-offset-4 hover:text-fg",children:"Change car"})]}):null}function g({tone:e,children:n}){return a("div",{className:["border px-3 py-3 font-mono text-[13px] leading-relaxed tracking-[0.1em] text-fg-dim",e==="good"?"border-accent":e==="bad"?"border-alert":"border-dashed border-line"].join(" "),children:n})}export{g as Box,f as HeroVehicleMemory,p as default};
1
+ "use client";import{jsx as a,jsxs as t}from"react/jsx-runtime";import d from"../fitment/FitmentPickerGrid.js";function s({vehicle:e,escape:r,override:n,verdict:c,showChangeCar:o,cascadeErrorNote:i}){const l=e.appliedName!=="";return t("div",{className:"pb-2",children:[t("div",{className:"mb-3 flex items-center justify-between gap-4 font-mono text-[13px] font-semibold uppercase tracking-[0.2em] text-fg",children:[a("span",{children:"Vehicle Fitment"}),r]}),n?a("div",{className:"flex flex-col gap-3",children:n}):l?t("div",{className:"flex flex-col gap-3",children:[c,o&&a("div",{children:a("button",{type:"button",onClick:e.clear,"aria-label":`Change car - forget ${e.appliedName} and ask again`,className:"cursor-pointer font-mono text-[12px] uppercase tracking-[0.16em] text-accent underline underline-offset-4 hover:text-fg",children:"Change car"})})]}):t("div",{className:"flex flex-col gap-3",children:[a(d,{cascade:e.cascade,compact:!0}),e.cascade.cascadeError&&a("p",{className:"font-mono text-[12px] leading-relaxed tracking-[0.1em] text-fg-dim",children:i})]})]})}function x({vehicle:e}){return e.appliedName?t("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 border border-accent px-3 py-2 font-mono text-[12px] tracking-[0.1em] text-fg-dim",style:{background:"color-mix(in oklab, var(--accent) 8%, transparent)"},children:[t("span",{children:["Showing fitment for your"," ",a("strong",{className:"font-semibold text-fg",children:e.appliedName})]}),a("button",{type:"button",onClick:e.clear,"aria-label":`Change car - forget ${e.appliedName} and ask again`,className:"ml-auto cursor-pointer uppercase tracking-[0.16em] text-accent underline underline-offset-4 hover:text-fg",children:"Change car"})]}):null}function f({tone:e,children:r}){return a("div",{className:["border px-3 py-3 font-mono text-[13px] leading-relaxed tracking-[0.1em] text-fg-dim",e==="good"?"border-accent":e==="bad"?"border-alert":"border-dashed border-line"].join(" "),children:r})}export{f as Box,x as HeroVehicleMemory,s as default};