efficient-storefront-blocks 0.74.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.
- package/CHANGELOG.md +48 -0
- package/dist/chunks/EditorPreviewCheckout-ANI7HUYX.js +4 -0
- package/dist/chunks/{SiteEditorProvider-Z33JB5BA.js → SiteEditorProvider-AJUWZYHT.js} +1 -1
- package/dist/chunks/chunk-3IQQNZIM.js +311 -0
- package/dist/chunks/chunk-4F5CAFXO.js +1 -0
- package/dist/chunks/{chunk-5OFEWRWI.js → chunk-5NXOTPHK.js} +1 -1
- package/dist/chunks/chunk-YAYHH5GY.js +1 -0
- package/dist/chunks/{chunk-QJDTP7K6.js → chunk-YFPWVNDB.js} +1 -1
- package/dist/chunks/{fitment-data-DHKRLKNI.js → fitment-data-IZYCNTET.js} +1 -1
- package/dist/contract.js +2 -2
- package/dist/editor/components/BlogSource.js +1 -1
- package/dist/editor/components/CategoryProductFields.d.ts +22 -0
- package/dist/editor/components/CategoryProductFields.js +1 -0
- package/dist/editor/components/CategorySource.d.ts +12 -0
- package/dist/editor/components/CategorySource.js +1 -1
- package/dist/editor/components/CollectionPicker.js +1 -1
- package/dist/editor/components/CountryShowAsTiles.js +1 -1
- package/dist/editor/components/EditorPreviewChat.js +1 -11
- package/dist/editor/components/EditorPreviewSurface.js +1 -1
- package/dist/editor/components/GalleryProductBinding.js +1 -1
- package/dist/editor/components/GalleryShowcaseSource.js +1 -1
- package/dist/editor/components/HeaderSettingsPanel.d.ts +8 -4
- package/dist/editor/components/HeaderSettingsPanel.js +1 -1
- package/dist/editor/components/MenuPicker.js +1 -1
- package/dist/editor/components/PreviewProductPicker.js +1 -1
- package/dist/editor/components/ProductHeroSource.js +1 -1
- package/dist/editor/components/ProductPicker.js +1 -1
- package/dist/editor/components/SocialLinksDoor.js +1 -1
- package/dist/editor/components/SpecTableSource.js +1 -1
- package/dist/editor/lib/document/block-align-row.d.ts +2 -0
- package/dist/editor/lib/document/block-align-row.js +1 -0
- package/dist/editor/lib/document/blocks/commerce/AccountBlock/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/AlloyWheelsListing/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/BundleOffer/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/CartBlock/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/CatalogFilterBar/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/CheckoutCTA/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/CollectionCard/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/Collections/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/CompatibleTyres/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/CountrySwitchBlock/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/DeliveryOptions/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/DetailRows/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/EuTyreLabel/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/FitmentFinder/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/FitmentTable/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/Gallery/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/GalleryB/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/GalleryItem/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/ProductGallery/fields.d.ts +2 -2
- package/dist/editor/lib/document/blocks/commerce/ProductGallery/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/ProductGrid/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/ProductHero/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/RelatedProducts/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/SearchBlock/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/SpecTable/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/TyreFitment/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/TyreSizes/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/shared-fields.d.ts +1 -0
- package/dist/editor/lib/document/blocks/commerce/shared-fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/AppointmentBooking/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/BookingBox/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/ContactCards/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/ContactRouting/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/Events/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/Footer/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/FooterDivider/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/FooterEmailSignup/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/FooterGroup/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/FooterLogo/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/FooterMenu/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/FooterMessaging/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/FooterPayment/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/FooterSocial/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/FooterText/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/Form/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/MessagingCards/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/OpeningHours/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/RateTable/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/RatingBlock/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/ReviewForm/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/Reviews/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/SiteHeader/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/SubmitBox/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/SubmitBuild/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/Subscribe/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/SubscribeBlogs/fields.js +1 -1
- package/dist/editor/lib/document/box-header.js +1 -1
- package/dist/editor/lib/document/config.d.ts +16 -16
- package/dist/editor/lib/document/config.js +1 -1
- package/dist/editor/lib/editor-currency-source.js +1 -1
- package/dist/editor/lib/efficient-backend.js +1 -1
- package/dist/editor/lib/storefront-editor-words.d.ts +12 -16
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/editor.css +1 -1
- package/dist/index.js +413 -724
- package/dist/links.js +1 -1
- package/dist/render/app/globals.css +32 -79
- package/dist/render/built-with.json +1 -1
- package/dist/render/components/BoxHeaderBar.js +1 -1
- package/dist/render/components/CartContext.d.ts +4 -0
- package/dist/render/components/CartContext.js +1 -1
- package/dist/render/components/CartDrawer.js +2 -2
- package/dist/render/components/CatalogFilterBarSection.d.ts +1 -1
- package/dist/render/components/CatalogFilterBarSection.js +1 -1
- package/dist/render/components/Collections.js +1 -1
- package/dist/render/components/CompatibleTyres.js +1 -1
- package/dist/render/components/ConsentPanel.js +1 -1
- package/dist/render/components/ContactRouting.js +1 -1
- package/dist/render/components/CouponField.js +1 -1
- package/dist/render/components/CurrencyContext.js +1 -1
- package/dist/render/components/Events.js +1 -1
- package/dist/render/components/FitmentTable.js +1 -1
- package/dist/render/components/FooterGroup.d.ts +1 -1
- package/dist/render/components/FooterGroup.js +1 -1
- package/dist/render/components/FooterLogo.d.ts +2 -1
- package/dist/render/components/FooterMenu.js +1 -1
- package/dist/render/components/FooterPayment.d.ts +1 -2
- package/dist/render/components/FooterPayment.js +1 -1
- package/dist/render/components/FooterSocial.d.ts +1 -2
- package/dist/render/components/FooterSocial.js +1 -1
- package/dist/render/components/FormBlock.js +1 -1
- package/dist/render/components/GalleryItem.js +1 -1
- package/dist/render/components/GalleryShowcase.js +1 -1
- package/dist/render/components/Header.js +1 -1
- package/dist/render/components/HeaderToolBlocks.d.ts +1 -2
- package/dist/render/components/HeaderToolBlocks.js +1 -1
- package/dist/render/components/HeaderTools.js +1 -1
- package/dist/render/components/Lightbox.d.ts +2 -2
- package/dist/render/components/Lightbox.js +1 -1
- package/dist/render/components/LinkedProductHero.d.ts +2 -0
- package/dist/render/components/PopupFrame.d.ts +17 -4
- package/dist/render/components/PopupFrame.js +1 -1
- package/dist/render/components/ProductGallery.js +1 -1
- package/dist/render/components/ProductGridSection.js +1 -1
- package/dist/render/components/ProductHeroPanel.d.ts +3 -1
- package/dist/render/components/ProductHeroPanel.js +1 -1
- package/dist/render/components/ProductLightbox.js +1 -1
- package/dist/render/components/ReviewForm.js +1 -1
- package/dist/render/components/SectionGroupBody.js +1 -1
- package/dist/render/components/SpecTable.d.ts +2 -1
- package/dist/render/components/SpecTable.js +1 -1
- package/dist/render/components/SubscribePopup.js +2 -2
- package/dist/render/components/TyreRenderSvg.js +1 -1
- package/dist/render/components/booking/BookingRegions.js +1 -1
- package/dist/render/components/catalog/CatalogFilterBar.d.ts +4 -4
- package/dist/render/components/catalog/CatalogFilterBar.js +1 -1
- package/dist/render/components/catalog/CatalogFilterContext.d.ts +5 -3
- package/dist/render/components/catalog/CatalogFilterContext.js +1 -1
- package/dist/render/components/catalog/FilterPill.d.ts +3 -1
- package/dist/render/components/catalog/FilterPill.js +1 -1
- package/dist/render/components/checkout/CheckoutPageClient.js +1 -1
- package/dist/render/components/checkout/checkout-parts.js +1 -1
- package/dist/render/components/checkout/checkout-state.d.ts +19 -2
- package/dist/render/components/checkout/checkout-state.js +3 -3
- package/dist/render/components/fitment/StockFitmentCard.js +1 -1
- package/dist/render/components/pdp-dynamic/DynamicProductGallery.js +1 -1
- package/dist/render/components/pdp-dynamic/DynamicProductHero.d.ts +2 -0
- package/dist/render/components/pdp-dynamic/DynamicRelatedProducts.js +1 -1
- package/dist/render/components/pdp-dynamic/DynamicSpecTable.js +1 -1
- package/dist/render/components/pdp-dynamic/RecordPhotoGallery.js +1 -1
- package/dist/render/components/product-hero/TyreHeroFitment.js +1 -1
- package/dist/render/components/product-hero/VehicleQuestion.d.ts +1 -2
- package/dist/render/components/product-hero/VehicleQuestion.js +1 -1
- package/dist/render/components/product-hero/WheelHeroFitment.js +1 -1
- package/dist/render/components/product-hero/trust-bullets.d.ts +5 -0
- package/dist/render/components/product-hero/trust-bullets.js +1 -0
- package/dist/render/components/useModalDismiss.d.ts +2 -1
- package/dist/render/components/useModalDismiss.js +1 -1
- package/dist/render/components/wheels-plp/AlloyWheelsListing.js +1 -1
- package/dist/render/components/wheels-plp/PlpNotifyMeDialog.js +1 -1
- package/dist/render/lib/api/index.d.ts +0 -8
- package/dist/render/lib/api/index.js +1 -1
- package/dist/render/lib/api/types.d.ts +7 -3
- package/dist/render/lib/booking/appointment-time.d.ts +2 -0
- package/dist/render/lib/booking/appointment-time.js +1 -0
- package/dist/render/lib/catalog/from-wheel.js +1 -1
- package/dist/render/lib/catalog/plp-item.js +1 -1
- package/dist/render/lib/checkout/stripe-appearance.d.ts +10 -0
- package/dist/render/lib/checkout/stripe-appearance.js +1 -0
- package/dist/render/lib/checkout/wallet-return.d.ts +1 -1
- package/dist/render/lib/commerce.d.ts +1 -0
- package/dist/render/lib/commerce.js +1 -1
- package/dist/render/lib/content/legacy-block-align.d.ts +2 -0
- package/dist/render/lib/content/legacy-block-align.js +1 -0
- package/dist/render/lib/content/menu-row.d.ts +0 -3
- package/dist/render/lib/content/menu-row.js +1 -1
- package/dist/render/lib/content/site.d.ts +1 -1
- package/dist/render/lib/document/blocks/commerce/AlloyWheelsListing/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/BundleOffer/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/CheckoutCTA/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/Collections/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/CompatibleTyres/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/CountrySwitchBlock/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/DeliveryOptions/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/DetailRows/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/EuTyreLabel/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/FitmentFinder/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/FitmentTable/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductGrid/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductHero/meta.d.ts +6 -0
- package/dist/render/lib/document/blocks/commerce/ProductHero/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductHero/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/RelatedProducts/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/SpecTable/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/SpecTable/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/TyreFitment/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/TyreSizes/meta.js +1 -1
- package/dist/render/lib/document/blocks/service/ContactCards/meta.js +1 -1
- package/dist/render/lib/document/blocks/service/ContactRouting/meta.js +1 -1
- package/dist/render/lib/document/blocks/service/FooterPayment/meta.js +1 -1
- package/dist/render/lib/document/blocks/service/FooterSocial/meta.js +1 -1
- package/dist/render/lib/document/blocks/service/MessagingCards/meta.js +1 -1
- package/dist/render/lib/document/blocks/service/OpeningHours/meta.js +1 -1
- package/dist/render/lib/document/blocks/service/RateTable/meta.js +1 -1
- package/dist/render/lib/document/blocks/service/SubmitBuild/meta.js +1 -1
- package/dist/render/lib/document/blocks/service/Subscribe/meta.js +1 -1
- package/dist/render/lib/document/blocks/service/SubscribeBlogs/meta.js +1 -1
- package/dist/render/lib/document/lazy-draws.js +1 -1
- package/dist/render/lib/document/render-client.d.ts +8 -3
- package/dist/render/lib/document/render-client.js +1 -1
- package/dist/render/lib/document/section-to-box-rows-reviews.js +1 -1
- package/dist/render/lib/document/storefront-root.d.ts +0 -2
- package/dist/render/lib/document/storefront-root.js +1 -1
- package/dist/render/lib/field-input.d.ts +1 -0
- package/dist/render/lib/field-input.js +1 -0
- package/dist/render/lib/sections/content-cap-gutter.d.ts +1 -0
- package/dist/render/lib/sections/content-cap-gutter.js +1 -0
- package/dist/render/lib/sections/hero-trust-bullets.d.ts +2 -0
- package/dist/render/lib/sections/hero-trust-bullets.js +1 -0
- package/dist/render/lib/tyres/spec-sheet.d.ts +17 -0
- package/dist/render/lib/tyres/spec-sheet.js +1 -1
- package/dist/render/lib/use-scope-class.d.ts +1 -0
- package/dist/render/lib/use-scope-class.js +1 -0
- package/dist/render/lib/wheels/catalog-default-layout.d.ts +3 -3
- package/dist/render/lib/wheels/catalog-default-layout.js +1 -1
- package/dist/render/lib/wheels/catalog-filters.d.ts +2 -2
- package/dist/render/lib/wheels/catalog-filters.js +1 -1
- package/dist/render/lib/wheels/grid-source.d.ts +7 -1
- package/dist/render/lib/wheels/grid-source.js +1 -1
- package/dist/render/lib/wheels/plp-hydrate.js +1 -1
- package/dist/words.d.ts +48 -48
- package/dist/words.js +6 -6
- package/package.json +7 -4
- package/dist/chunks/EditorPreviewCheckout-YQ3F5MSG.js +0 -4
- package/dist/chunks/chunk-BZDVZUF4.js +0 -1
- package/dist/chunks/chunk-UGXNUQRA.js +0 -246
- package/dist/chunks/chunk-UJW4B64R.js +0 -1
- package/dist/render/components/product-hero/hero-content.d.ts +0 -7
- package/dist/render/components/product-hero/hero-content.js +0 -1
- package/dist/render/components/useIsLightTheme.d.ts +0 -1
- package/dist/render/components/useIsLightTheme.js +0 -1
- package/dist/render/lib/content/product-hero.d.ts +0 -14
- package/dist/render/lib/content/product-hero.js +0 -1
- package/dist/render/lib/wheels/collections.d.ts +0 -22
- package/dist/render/lib/wheels/collections.js +0 -1
- /package/dist/chunks/{chunk-UGXNUQRA.js.LEGAL.txt → chunk-3IQQNZIM.js.LEGAL.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,Fragment as
|
|
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
|
|
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,
|
|
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
|
|
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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as n,Fragment as g}from"react/jsx-runtime";import o from"next/link";import b,{Box as s}from"./VehicleQuestion.js";import{resolvingRowsAnswered as w}from"../../lib/catalog/product-options.js";import{fitRefusal as h,pdpFitVerdict as x}from"../../lib/wheels/pdp-fit-verdict.js";import{variantIsDually as k}from"../../lib/wheels/set-mode.js";function y({selection:a,spec:r,vehicle:t,wheel:l}){const{manualMode:c,setManualMode:d}=a,u=w(a.rows,a.preOrder),m=t.appliedName!=="",f=(l?.variants??[]).some(k),i=x({wheel:l,applied:m,fit:t.fit,resolving:t.resolving});return e(b,{vehicle:t,escape:e("button",{type:"button",className:"cursor-pointer text-right text-accent hover:underline",onClick:()=>d(p=>!p),children:c?"← Find by vehicle":"Select by specs instead →"}),override:c?n(s,{tone:"quiet",children:[e("strong",{className:"font-semibold text-fg",children:"You are choosing by the numbers."}),n("span",{className:"mt-2 block",children:[r?`${f?"The set is":"All four wheels are"} ${r}. We have not checked that against any car — make sure it matches yours.`:u?"Answer the bolt pattern and the offset below. We will not check them against a car.":"Pick a finish and a size below. The bolt pattern and the offset come next, and we will not check them against a car."," ",e(o,{href:"/fitment",className:"text-accent hover:underline",children:"Talk to an engineer →"})]})]}):null,verdict:e(N,{verdict:i,car:t.appliedName}),showChangeCar:i.state!=="fits"&&i.state!=="checking",cascadeErrorNote:n(g,{children:["Vehicle data is unavailable right now. Pick your wheel by its specs instead, or"," ",e(o,{href:"/contact",className:"text-accent hover:underline",children:"ask us to check it →"})]})
|
|
1
|
+
"use client";import{jsx as e,jsxs as n,Fragment as g}from"react/jsx-runtime";import o from"next/link";import b,{Box as s}from"./VehicleQuestion.js";import{resolvingRowsAnswered as w}from"../../lib/catalog/product-options.js";import{fitRefusal as h,pdpFitVerdict as x}from"../../lib/wheels/pdp-fit-verdict.js";import{variantIsDually as k}from"../../lib/wheels/set-mode.js";function y({selection:a,spec:r,vehicle:t,wheel:l}){const{manualMode:c,setManualMode:d}=a,u=w(a.rows,a.preOrder),m=t.appliedName!=="",f=(l?.variants??[]).some(k),i=x({wheel:l,applied:m,fit:t.fit,resolving:t.resolving});return e(b,{vehicle:t,escape:e("button",{type:"button",className:"cursor-pointer text-right text-accent hover:underline",onClick:()=>d(p=>!p),children:c?"← Find by vehicle":"Select by specs instead →"}),override:c?n(s,{tone:"quiet",children:[e("strong",{className:"font-semibold text-fg",children:"You are choosing by the numbers."}),n("span",{className:"mt-2 block",children:[r?`${f?"The set is":"All four wheels are"} ${r}. We have not checked that against any car — make sure it matches yours.`:u?"Answer the bolt pattern and the offset below. We will not check them against a car.":"Pick a finish and a size below. The bolt pattern and the offset come next, and we will not check them against a car."," ",e(o,{href:"/fitment",className:"text-accent hover:underline",children:"Talk to an engineer →"})]})]}):null,verdict:e(N,{verdict:i,car:t.appliedName}),showChangeCar:i.state!=="fits"&&i.state!=="checking",cascadeErrorNote:n(g,{children:["Vehicle data is unavailable right now. Pick your wheel by its specs instead, or"," ",e(o,{href:"/contact",className:"text-accent hover:underline",children:"ask us to check it →"})]})})}function N({verdict:a,car:r}){switch(a.state){case"checking":return n(s,{tone:"quiet",children:[e("strong",{className:"font-semibold text-fg",children:"Checking fitment…"})," ",n("span",{children:["Reading the factory wheel specs for your ",r,"."]})]});case"fits":return n(s,{tone:"good",children:[n("strong",{className:"font-semibold text-accent",children:["✓ Fits your ",r]}),e("ul",{className:"mt-2 flex flex-wrap gap-2",children:a.checks.map(t=>e("li",{className:["px-2 py-1 text-[11px] uppercase tracking-[0.14em] text-fg-dim",t.value!==null?"border border-line":"border border-dashed border-line"].join(" "),children:t.value??`${t.name} not published, not checked`},t.key))})]});case"fits-with-warning":return n(s,{tone:"good",children:[n("strong",{className:"font-semibold text-accent",children:["✓ Fits your ",r]}),e("ul",{className:"mt-2 flex flex-wrap gap-2",children:a.checks.map(t=>e("li",{className:["px-2 py-1 text-[11px] uppercase tracking-[0.14em] text-fg-dim",t.value!==null?"border border-line":"border border-dashed border-line"].join(" "),children:t.value??`${t.name} not published, not checked`},t.key))}),n("span",{className:"mt-2 block border-l-2 border-alert pl-3",children:[e("strong",{className:"font-semibold text-fg",children:"Check the offset. "}),h(a.warning)," An offset this far out is what an aftermarket wheel is for, but it changes how far the wheel sits from the guard."," ",e(o,{href:"/contact",className:"text-accent hover:underline",children:"Ask us if you are unsure →"})]})]});case"no-fit":return n(s,{tone:"bad",children:[n("strong",{className:"font-semibold",style:{color:"var(--alert)"},children:["✗ Does not fit your ",r]}),e("span",{className:"mt-2 block",children:h(a.failure)})]});case"unknown":return n(s,{tone:"quiet",children:[e("strong",{className:"font-semibold text-fg",children:a.missing==="vehicle"?`We cannot check this wheel against your ${r}`:"We cannot check this wheel"}),n("span",{className:"mt-2 block",children:[a.missing==="vehicle"?`We have no factory wheel data for the ${r}, and we will not guess at a fit.`:"We do not hold a bolt pattern for this wheel, and we will not guess at a fit."," ",e(o,{href:"/contact",className:"text-accent hover:underline",children:"Ask us before you order →"})]})]});default:return null}}export{y as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { SlotComponent } from "efficient-easel/blocks";
|
|
3
|
+
export declare const TRUST_BULLETS_ROW_CLASS = "border-t border-line pt-5";
|
|
4
|
+
export declare function trustBulletsSlot(stored: unknown): SlotComponent | undefined;
|
|
5
|
+
export declare function trustBulletsRow(Slot: SlotComponent | undefined, editing: boolean): ReactNode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as s}from"react/jsx-runtime";const r="border-t border-line pt-5";function i(t){return t&&!Array.isArray(t)?t:void 0}function o(t,e){if(!t)return null;const n=e?r:`${r} empty:hidden`;return s(t,{className:n,minEmptyHeight:40})}export{r as TRUST_BULLETS_ROW_CLASS,o as trustBulletsRow,i as trustBulletsSlot};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type RefObject } from "react";
|
|
2
|
-
export declare function useModalDismiss({ active, onDismiss, focusRef, lockScroll, scopeRef, }: {
|
|
2
|
+
export declare function useModalDismiss({ active, onDismiss, focusRef, lockScroll, scopeRef, trapRef, }: {
|
|
3
3
|
active: boolean;
|
|
4
4
|
onDismiss: () => void;
|
|
5
5
|
focusRef?: RefObject<HTMLElement | null>;
|
|
6
6
|
lockScroll?: boolean;
|
|
7
7
|
scopeRef?: RefObject<HTMLElement | null>;
|
|
8
|
+
trapRef?: RefObject<HTMLElement | null>;
|
|
8
9
|
}): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useEffect as
|
|
1
|
+
"use client";import{useEffect as d}from"react";function D({active:n,onDismiss:f,focusRef:y,lockScroll:a=!0,scopeRef:r,trapRef:i}){d(()=>{if(!n)return;const t=r?.current?.ownerDocument??document,e=u=>{u.key==="Escape"&&f()};return t.addEventListener("keydown",e),()=>t.removeEventListener("keydown",e)},[n,f,r]),d(()=>{if(!n||!a)return;const t=(r?.current?.ownerDocument??document).body,e=t.style.overflow;return t.style.overflow="hidden",()=>{t.style.overflow=e}},[n,a,r]),d(()=>{if(!n)return;const t=(r?.current?.ownerDocument??document).documentElement,e=u=>{const o=Number(t.getAttribute(m)||0)+u;o>0?t.setAttribute(m,String(o)):t.removeAttribute(m)};return e(1),()=>e(-1)},[n,r]),d(()=>{if(!n||!i)return;const t=i.current?.ownerDocument??r?.current?.ownerDocument??document,e=t.activeElement,u=o=>{const s=i.current;if(o.key!=="Tab"||!s)return;const c=Array.from(s.querySelectorAll(E)).filter(A=>!A.hasAttribute("hidden")&&A.getAttribute("aria-hidden")!=="true");if(c.length===0){o.preventDefault(),s.focus();return}const b=c[0],w=c[c.length-1],l=t.activeElement;(!(l&&s.contains(l)&&l!==s)||l===(o.shiftKey?b:w))&&(o.preventDefault(),(o.shiftKey?w:b).focus())};return t.addEventListener("keydown",u),()=>{t.removeEventListener("keydown",u),e&&e!==t.body&&e.isConnected&&e.focus()}},[n,i,r]),d(()=>{n&&y?.current?.focus()},[n,y])}const E="a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])",m="data-sf-overlay";export{D as useModalDismiss};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,jsxs as s,Fragment as se}from"react/jsx-runtime";import{LISTING_CARD_SHOW as B}from"../../lib/sections/card-show-defaults.js";import{useCallback as d,useEffect as Qe,useId as Ze,useMemo as l,useRef as et,useState as tt}from"react";import{CARD_IMAGE_BG_OFF as ot,resolveCardImageBackground as rt}from"efficient-web-builder/format/lib/content/card-image-background";import{cardImageShapeTokens as nt}from"efficient-web-builder/format/lib/content/card-image-shape";import{cardIndexCss as st,DEFAULT_CARD_INDEX_FORMAT as it,DEFAULT_CARD_OUTLINE as lt}from"efficient-web-builder/format/lib/sections/product-card-style";import{answersForKind as ie}from"../../lib/content/field-usage.js";import{useCurrency as at}from"../CurrencyContext.js";import ct from"../NoCurrencyNote.js";import{usePreviewDevice as pt}from"efficient-easel/screen/components/PreviewDeviceContext";import{renderGold as dt,renderHeadline as mt}from"efficient-web-builder/render/components/goldPhrases";import{useUnifiedProductCatalog as ht}from"../useProductCatalog.js";import{scrollBehavior as ut}from"efficient-web-builder/render/components/useReducedMotion";import{normalizePlpColumns as ft,PLP_GRID_GAP_VAR as gt,plpGridVars as yt}from"../../lib/wheels/plp-grid.js";import{plpCardImageSizes as xt}from"../../lib/sections/card-image-sizes.js";import{CARD_ROWS_GRID_CLASS as St,cardRowsGridStyle as wt}from"../WheelCardFrame.js";import{applyPlpFilters as bt,asPlpSortKey as Ct,buildPlpFacets as Nt,buildPlpTypeOptions as vt,buildTyreSizeBoxes as Pt,EMPTY_PLP_FILTERS as le,hasActivePlpFilters as kt,paginatePlp as _t,pickTyreSize as Tt,plpTyreSizeBoxesShown as At,plpInStockCount as zt,plpOpeningSort as Ft,plpPriceBounds as It,plpShownKinds as Ot,plpSortKeysFor as Bt,PLP_SORT_LABELS as Lt}from"../../lib/wheels/plp-filters.js";import{itemKind as z,itemSlug as L,itemTyreSizes as Vt,plpBrandVaries as Rt,plpProcessVaries as Et,plpItemsOfKinds as Dt,plpKindNoun as V,resolvePlpKinds as Kt}from"../../lib/catalog/plp-item.js";import{plpGateWords as jt,plpVehicleCopy as Gt}from"../../lib/catalog/plp-vehicle-copy.js";import{oemBadgeSize as Mt,oemTyreSizes as $t}from"../../lib/tyres/tyre-vehicle-fitment.js";import Wt from"../TyreSummaryCard.js";import{wheelsFittingVehicle as Ht}from"../../lib/wheels/plp-fitment-match.js";import Ut from"./PlpActiveChips.js";import{DEFAULT_COVER_INDEX as Xt}from"../../lib/wheels/cover-rendering.js";import Yt from"./PlpCard.js";import qt from"./PlpPagination.js";import Jt from"./PlpSidebar.js";import Qt from"./PlpVehicleBar.js";import Zt from"./PlpVehicleGate.js";import{useVehicleCatalog as eo}from"./useVehicleCatalog.js";import{useVehicleFit as to}from"../fitment/useVehicleFit.js";import{usePlpFiltersInUrl as oo}from"./usePlpFiltersInUrl.js";import{say as R}from"efficient-web-builder/format/lib/editor-words";const Ko={heading:"Let's find wheels that fit your car.",intro:"Tell us what you drive and we'll show you every set that bolts straight on — bolt pattern, offset and hub bore checked for you."};function ro({level:C,className:N,children:v}){return r(C===2?"h2":"h1",{className:N,children:v})}const no=[];function so({heading:C="",intro:N="",askForCar:v=!0,gateHeading:E="",gateIntro:ae="",perPage:D=24,columns:ce,defaultSort:pe="recommended",hiddenFacets:de=[],fieldUsage:g=no,showPrice:K=!0,showInStock:me=!0,kinds:he,products:ue,wheels:fe,requestQuery:ge,editing:m=!1,coverIndex:ye=Xt,cardImage:xe,spinOnHover:Se=!1,imageBackground:we,showBadge:be=!0,showCardSizes:Ce,showCardBuy:Ne,showCardPage:ve,showCardPrice:Pe,showCardFinishes:ke,outline:_e=lt,indexBadge:j=it,titleLevel:Te}){const{currency:a}=at(),Ae=rt(we,ot),h=Kt(he),G=pt(),M=ft(ce),ze=yt(M,m?G:null),Fe=xt(M,m?G:null),$=`plp-${Ze().replace(/:/g,"")}`,F=st($,j),Ie=ht(),W=ue??fe??Ie??[],H=l(()=>Dt(W,h),[W,h.join(",")]),o=to({editing:m,enabled:v,autoApply:!0}),[Oe,I]=tt(!1),Be=Ft(pe,h),y=o.applied?.vehicle??null,[t,w]=oo({editing:m,openingSort:Be,appliedVehicle:y,vehicleRestored:o.restored,requestQuery:ge}),p=Ot(h,t.kind),i=d(e=>w(e),[w]),U=d((e,u)=>{const c=t[e],qe=c.map(String).includes(u)?c.filter(Je=>String(Je)!==u):[...c,e==="diameters"?Number(u):u];i({...t,[e]:qe,page:1})},[t,i]),X=d(e=>i({...t,priceMax:e,page:1}),[t,i]),Y=d(e=>i({...t,inStockOnly:e,page:1}),[t,i]),q=d(e=>i({...le,kind:e,inStockOnly:t.inStockOnly,priceMax:t.priceMax,sort:t.sort}),[t.inStockOnly,t.priceMax,t.sort,i]),Le=d(e=>i({...t,sort:e,page:1}),[t,i]),Ve=d(e=>{i({...t,page:e}),typeof window<"u"&&window.scrollTo({top:0,behavior:ut()})},[t,i]),J=d(()=>i({...le,sort:t.sort}),[t.sort,i]),{clear:k}=o,Q=d(()=>{k(),I(!0),w(e=>({...e,page:1}))},[k]),Re=d(()=>{k(),I(!1),w(e=>({...e,page:1}))},[k]),_=y?[y.make,y.model,y.year,y.modification].join("|"):"",T=et(null);Qe(()=>{if(o.restored){if(T.current===null){T.current=_;return}T.current!==_&&(T.current=_,w(e=>e.page===1?e:{...e,page:1}))}},[o.restored,_,w]);const A=eo({catalog:H,shownKinds:h,vehicle:y,editing:m}),n=l(()=>{if(!o.fit)return A;const e=A.filter(c=>z(c)==="alloy-wheel"),u=new Set(Ht(e,o.fit).map(c=>c.slug));return A.filter(c=>z(c)!=="alloy-wheel"||u.has(L(c)))},[A,o.fit]),b=de.join(","),Ee=l(()=>{const e=new Set(b?b.split(","):[]);return Nt(n,t,a,p,g).filter(u=>!e.has(u.key))},[n,t,a,b,p.join(","),g]),x=l(()=>bt(n,t,a),[n,t,a]),Z=p.length>1,De=l(()=>ie(g,"alloy-wheel"),[g]),Ke=l(()=>ie(g,"tyre"),[g]),ee=l(()=>Rt(x),[x]),je=l(()=>Et(x),[x]),Ge=l(()=>K?It(n,a):null,[n,a,K]),Me=l(()=>zt(n,t,a),[n,t,a]),$e=l(()=>vt(n,h,t,a),[n,h.join(","),t,a]),We=d((e,u)=>{const c=Tt(n.flatMap(Vt),t.tyreSizes[0]??"",e,u);i({...t,tyreSizes:c?[c]:[],page:1})},[n,t,i]),He=l(()=>{const e=new Set(b?b.split(","):[]);return!At(n,p)||e.has("tyreSizes")?null:Pt(n,t,a)},[n,t,a,b,p.join(","),g]),f=l(()=>_t(x,t.page,D),[x,t.page,D]),S=V(p),O=Gt(p),te=jt(E,ae,p,h),oe=p.length===1&&p[0]==="tyre",re=o.applied?.stock??null,P=l(()=>$t(re),[re]),Ue=l(()=>n.filter(e=>p.includes(z(e))).length,[n,p.join(",")]),ne=H.length===0,Xe=!ne&&n.length===0,Ye=v&&!m&&!o.applied&&!Oe;return h.length===0?null:s("section",{style:nt(xe),children:[v&&r(Qt,{cascade:o.cascade,appliedName:o.appliedName,fit:o.fit,fitSummary:oe&&P.length>0?`Takes ${P.join(" · ")}`:null,resolving:o.resolving,unresolved:oe?!!o.applied&&!o.resolving&&P.length===0:o.unresolved,matchCount:Ue,copy:O,onAmend:Re,onClear:Q}),Ye&&r(Zt,{cascade:o.cascade,heading:te.heading,intro:te.intro,ready:o.restored,copy:O,onSkip:()=>I(!0)}),s("div",{className:"px-5 py-10 md:px-[max(2.5rem,calc((100%_-_var(--sf-content-cap,100%))/2_+_2.5rem))]",children:[(C||N)&&s("header",{className:"mb-6",children:[C&&r(ro,{level:Te,className:"font-display text-[clamp(28px,4vw,40px)] [font-weight:var(--sf-heading-weight,500)] [text-transform:var(--sf-heading-case,uppercase)] leading-[1.05] tracking-[-0.02em]",children:mt(C,!1)}),N&&r("p",{className:"mt-2 max-w-[60ch] text-[15px] text-fg-dim",children:dt(N)})]}),s("div",{className:"flex flex-col gap-8 lg:flex-row lg:items-start",children:[r(Jt,{facets:Ee,filters:t,typeOptions:$e,sizeBoxes:He,sizeMatches:t.tyreSizes.length>0?x.length:null,noun:S,priceBounds:Ge,inStockCount:me?Me:null,onToggle:U,onPickType:q,onPickSize:We,onPriceMax:X,onInStockOnly:Y,onClearAll:J}),s("div",{className:"min-w-0 flex-1",children:[s("div",{className:"mb-4 flex min-h-[34px] flex-wrap items-center justify-between gap-x-4 gap-y-2 border-b border-line pb-3",children:[s("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-x-4 gap-y-2",children:[r("p",{className:"font-mono text-[12px] tabular-nums tracking-[0.08em]",children:f.total===0?s("span",{className:"text-fg-dim",children:["No ",S.many]}):s(se,{children:[s("span",{children:[f.from,"–",f.to]}),s("span",{className:"text-fg-dim",children:[" of ",f.total," ",S.many]})]})}),r(Ut,{filters:t,onToggle:U,onPriceMax:X,onInStockOnly:Y,onPickType:q})]}),s("label",{className:"flex items-center gap-2 font-mono text-[11px] uppercase tracking-[0.16em] text-fg-dim",children:["Sort by",r("select",{value:t.sort,onChange:e=>Le(Ct(e.target.value)),className:"cursor-pointer border border-line bg-transparent px-2 py-2 font-mono text-[12px] normal-case tracking-normal text-fg",children:Bt(h).map(e=>r("option",{value:e,children:Lt[e]},e))})]})]}),ne?r("div",{className:"border border-dashed border-line p-10",children:r("p",{className:"font-mono text-[12px] uppercase tracking-[0.16em] text-fg-dim",children:m?S.many==="wheels"?R("No wheels in this website's catalog yet — curate products to see them here."):S.many==="tyres"?R("No tyres in this website's catalog yet — curate products to see them here."):R("No products in this website's catalog yet — curate products to see them here."):"Our catalog is being updated. Please check back shortly."})}):Xe?s("div",{className:"border border-line p-10",children:[s("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No confirmed fit for your ",o.appliedName]}),r("p",{className:"mt-2 max-w-[52ch] text-[14px] text-fg-dim",children:O.nothingFits}),s("button",{type:"button",onClick:Q,className:"mt-4 cursor-pointer bg-btn px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:["Show all ",S.many]})]}):f.total===0?s("div",{className:"border border-line p-10",children:[s("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No ",S.many," match those filters"]}),r("p",{className:"mt-2 max-w-[46ch] text-[14px] text-fg-dim",children:"Try widening the price range or clearing a filter."}),kt(t)&&r("button",{type:"button",onClick:J,className:"mt-4 cursor-pointer bg-btn px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:"Clear all filters"})]}):s(se,{children:[F&&r("style",{children:F}),r("div",{className:`${F?`${$} plp-card-grid`:"plp-card-grid"} ${St}`,style:{...ze,...wt(`var(${gt})`)},children:f.items.map(e=>z(e)==="tyre"?r(Wt,{item:e,currency:a,fitSize:P.length>0?Mt(e.sizes,P):null,kindLabel:Z?V(["tyre"]).one:null,showBrand:ee,editing:m,fieldUsage:Ke},`tyre:${L(e)}`):r(Yt,{wheel:e,colours:t.finishes,fit:o.fit,editing:m,kindLabel:Z?V(["alloy-wheel"]).one:null,showBrand:ee,coverIndex:ye,fieldUsage:De,showProcess:je,spinOnHover:Se,imageBackgroundFill:Ae,showBadge:be,outline:_e,indexBadge:j,showCardSizes:Ce??B.showCardSizes,showCardBuy:Ne??B.showCardBuy,showCardPage:ve??B.showCardPage,showCardPrice:Pe??!0,showCardFinishes:ke??!0,imageSizes:Fe},`wheel:${L(e)}`))})]}),r(qt,{page:f.page,pageCount:f.pageCount,onPage:Ve}),r(ct,{editing:m})]})]})]})]})}export{Ko as PLP_GATE_DEFAULTS,so as default};
|
|
1
|
+
"use client";import{jsx as r,jsxs as s,Fragment as se}from"react/jsx-runtime";import{LISTING_CARD_SHOW as I}from"../../lib/sections/card-show-defaults.js";import{useScopeClass as Qe}from"../../lib/use-scope-class.js";import{useCallback as m,useEffect as Ze,useMemo as l,useRef as et,useState as tt}from"react";import{CARD_IMAGE_BG_OFF as ot,resolveCardImageBackground as rt}from"efficient-web-builder/format/lib/content/card-image-background";import{cardImageShapeTokens as nt}from"efficient-web-builder/format/lib/content/card-image-shape";import{cardIndexCss as st,DEFAULT_CARD_INDEX_FORMAT as it,DEFAULT_CARD_OUTLINE as lt}from"efficient-web-builder/format/lib/sections/product-card-style";import{answersForKind as ie}from"../../lib/content/field-usage.js";import{useCurrency as at}from"../CurrencyContext.js";import ct from"../NoCurrencyNote.js";import{usePreviewDevice as pt}from"efficient-easel/screen/components/PreviewDeviceContext";import{renderGold as mt,renderHeadline as dt}from"efficient-web-builder/render/components/goldPhrases";import{useUnifiedProductCatalog as ht}from"../useProductCatalog.js";import{scrollBehavior as ut}from"efficient-web-builder/render/components/useReducedMotion";import{normalizePlpColumns as ft,PLP_GRID_GAP_VAR as gt,plpGridVars as yt}from"../../lib/wheels/plp-grid.js";import{plpCardImageSizes as xt}from"../../lib/sections/card-image-sizes.js";import{CARD_ROWS_GRID_CLASS as St,cardRowsGridStyle as wt}from"../WheelCardFrame.js";import{applyPlpFilters as bt,asPlpSortKey as Ct,buildPlpFacets as Nt,buildPlpTypeOptions as vt,buildTyreSizeBoxes as Pt,EMPTY_PLP_FILTERS as le,hasActivePlpFilters as kt,paginatePlp as _t,pickTyreSize as Tt,plpTyreSizeBoxesShown as At,plpInStockCount as zt,plpOpeningSort as Ft,plpPriceBounds as Ot,plpShownKinds as Bt,plpSortKeysFor as It,PLP_SORT_LABELS as Lt}from"../../lib/wheels/plp-filters.js";import{itemKind as z,itemSlug as L,itemTyreSizes as Vt,plpBrandVaries as Rt,plpProcessVaries as Et,plpItemsOfKinds as Dt,plpKindNoun as V,resolvePlpKinds as Kt}from"../../lib/catalog/plp-item.js";import{plpGateWords as jt,plpVehicleCopy as Gt}from"../../lib/catalog/plp-vehicle-copy.js";import{oemBadgeSize as Mt,oemTyreSizes as $t}from"../../lib/tyres/tyre-vehicle-fitment.js";import Wt from"../TyreSummaryCard.js";import{wheelsFittingVehicle as Ht}from"../../lib/wheels/plp-fitment-match.js";import Ut from"./PlpActiveChips.js";import{DEFAULT_COVER_INDEX as Xt}from"../../lib/wheels/cover-rendering.js";import Yt from"./PlpCard.js";import qt from"./PlpPagination.js";import Jt from"./PlpSidebar.js";import Qt from"./PlpVehicleBar.js";import Zt from"./PlpVehicleGate.js";import{useVehicleCatalog as eo}from"./useVehicleCatalog.js";import{useVehicleFit as to}from"../fitment/useVehicleFit.js";import{usePlpFiltersInUrl as oo}from"./usePlpFiltersInUrl.js";import{say as R}from"efficient-web-builder/format/lib/editor-words";const jo={heading:"Let's find wheels that fit your car.",intro:"Tell us what you drive and we'll show you every set that bolts straight on — bolt pattern, offset and hub bore checked for you."};function ro({level:C,className:N,children:v}){return r(C===2?"h2":"h1",{className:N,children:v})}const no=[];function so({heading:C="",intro:N="",askForCar:v=!0,gateHeading:E="",gateIntro:ae="",perPage:D=24,columns:ce,defaultSort:pe="recommended",hiddenFacets:me=[],fieldUsage:g=no,showPrice:K=!0,showInStock:de=!0,kinds:he,products:ue,wheels:fe,requestQuery:ge,editing:d=!1,coverIndex:ye=Xt,cardImage:xe,spinOnHover:Se=!1,imageBackground:we,showBadge:be=!0,showCardSizes:Ce,showCardBuy:Ne,showCardPage:ve,showCardPrice:Pe,showCardFinishes:ke,outline:_e=lt,indexBadge:j=it,titleLevel:Te}){const{currency:a}=at(),Ae=rt(we,ot),h=Kt(he),G=pt(),M=ft(ce),ze=yt(M,d?G:null),Fe=xt(M,d?G:null),$=Qe("plp"),F=st($,j),Oe=ht(),W=ue??fe??Oe??[],H=l(()=>Dt(W,h),[W,h.join(",")]),o=to({editing:d,enabled:v,autoApply:!0}),[Be,O]=tt(!1),Ie=Ft(pe,h),y=o.applied?.vehicle??null,[t,w]=oo({editing:d,openingSort:Ie,appliedVehicle:y,vehicleRestored:o.restored,requestQuery:ge}),p=Bt(h,t.kind),i=m(e=>w(e),[w]),U=m((e,u)=>{const c=t[e],qe=c.map(String).includes(u)?c.filter(Je=>String(Je)!==u):[...c,e==="diameters"?Number(u):u];i({...t,[e]:qe,page:1})},[t,i]),X=m(e=>i({...t,priceMax:e,page:1}),[t,i]),Y=m(e=>i({...t,inStockOnly:e,page:1}),[t,i]),q=m(e=>i({...le,kind:e,inStockOnly:t.inStockOnly,priceMax:t.priceMax,sort:t.sort}),[t.inStockOnly,t.priceMax,t.sort,i]),Le=m(e=>i({...t,sort:e,page:1}),[t,i]),Ve=m(e=>{i({...t,page:e}),typeof window<"u"&&window.scrollTo({top:0,behavior:ut()})},[t,i]),J=m(()=>i({...le,sort:t.sort}),[t.sort,i]),{clear:k}=o,Q=m(()=>{k(),O(!0),w(e=>({...e,page:1}))},[k]),Re=m(()=>{k(),O(!1),w(e=>({...e,page:1}))},[k]),_=y?[y.make,y.model,y.year,y.modification].join("|"):"",T=et(null);Ze(()=>{if(o.restored){if(T.current===null){T.current=_;return}T.current!==_&&(T.current=_,w(e=>e.page===1?e:{...e,page:1}))}},[o.restored,_,w]);const A=eo({catalog:H,shownKinds:h,vehicle:y,editing:d}),n=l(()=>{if(!o.fit)return A;const e=A.filter(c=>z(c)==="alloy-wheel"),u=new Set(Ht(e,o.fit).map(c=>c.slug));return A.filter(c=>z(c)!=="alloy-wheel"||u.has(L(c)))},[A,o.fit]),b=me.join(","),Ee=l(()=>{const e=new Set(b?b.split(","):[]);return Nt(n,t,a,p,g).filter(u=>!e.has(u.key))},[n,t,a,b,p.join(","),g]),x=l(()=>bt(n,t,a),[n,t,a]),Z=p.length>1,De=l(()=>ie(g,"alloy-wheel"),[g]),Ke=l(()=>ie(g,"tyre"),[g]),ee=l(()=>Rt(x),[x]),je=l(()=>Et(x),[x]),Ge=l(()=>K?Ot(n,a):null,[n,a,K]),Me=l(()=>zt(n,t,a),[n,t,a]),$e=l(()=>vt(n,h,t,a),[n,h.join(","),t,a]),We=m((e,u)=>{const c=Tt(n.flatMap(Vt),t.tyreSizes[0]??"",e,u);i({...t,tyreSizes:c?[c]:[],page:1})},[n,t,i]),He=l(()=>{const e=new Set(b?b.split(","):[]);return!At(n,p)||e.has("tyreSizes")?null:Pt(n,t,a)},[n,t,a,b,p.join(","),g]),f=l(()=>_t(x,t.page,D),[x,t.page,D]),S=V(p),B=Gt(p),te=jt(E,ae,p,h),oe=p.length===1&&p[0]==="tyre",re=o.applied?.stock??null,P=l(()=>$t(re),[re]),Ue=l(()=>n.filter(e=>p.includes(z(e))).length,[n,p.join(",")]),ne=H.length===0,Xe=!ne&&n.length===0,Ye=v&&!d&&!o.applied&&!Be;return h.length===0?null:s("section",{style:nt(xe),children:[v&&r(Qt,{cascade:o.cascade,appliedName:o.appliedName,fit:o.fit,fitSummary:oe&&P.length>0?`Takes ${P.join(" · ")}`:null,resolving:o.resolving,unresolved:oe?!!o.applied&&!o.resolving&&P.length===0:o.unresolved,matchCount:Ue,copy:B,onAmend:Re,onClear:Q}),Ye&&r(Zt,{cascade:o.cascade,heading:te.heading,intro:te.intro,ready:o.restored,copy:B,onSkip:()=>O(!0)}),s("div",{className:"px-5 py-10 md:px-[max(2.5rem,calc((100%_-_var(--sf-content-cap,100%))/2_+_2.5rem))]",children:[(C||N)&&s("header",{className:"mb-6",children:[C&&r(ro,{level:Te,className:"font-display text-[clamp(28px,4vw,40px)] [font-weight:var(--sf-heading-weight,500)] [text-transform:var(--sf-heading-case,uppercase)] leading-[1.05] tracking-[-0.02em]",children:dt(C,!1)}),N&&r("p",{className:"mt-2 max-w-[60ch] text-[15px] text-fg-dim",children:mt(N)})]}),s("div",{className:"flex flex-col gap-8 lg:flex-row lg:items-start",children:[r(Jt,{facets:Ee,filters:t,typeOptions:$e,sizeBoxes:He,sizeMatches:t.tyreSizes.length>0?x.length:null,noun:S,priceBounds:Ge,inStockCount:de?Me:null,onToggle:U,onPickType:q,onPickSize:We,onPriceMax:X,onInStockOnly:Y,onClearAll:J}),s("div",{className:"min-w-0 flex-1",children:[s("div",{className:"mb-4 flex min-h-[34px] flex-wrap items-center justify-between gap-x-4 gap-y-2 border-b border-line pb-3",children:[s("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-x-4 gap-y-2",children:[r("p",{className:"font-mono text-[12px] tabular-nums tracking-[0.08em]",children:f.total===0?s("span",{className:"text-fg-dim",children:["No ",S.many]}):s(se,{children:[s("span",{children:[f.from,"–",f.to]}),s("span",{className:"text-fg-dim",children:[" of ",f.total," ",S.many]})]})}),r(Ut,{filters:t,onToggle:U,onPriceMax:X,onInStockOnly:Y,onPickType:q})]}),s("label",{className:"flex items-center gap-2 font-mono text-[11px] uppercase tracking-[0.16em] text-fg-dim",children:["Sort by",r("select",{value:t.sort,onChange:e=>Le(Ct(e.target.value)),className:"cursor-pointer border border-line bg-transparent px-2 py-2 font-mono text-[12px] normal-case tracking-normal text-fg",children:It(h).map(e=>r("option",{value:e,children:Lt[e]},e))})]})]}),ne?r("div",{className:"border border-dashed border-line p-10",children:r("p",{className:"font-mono text-[12px] uppercase tracking-[0.16em] text-fg-dim",children:d?S.many==="wheels"?R("No wheels in this website's catalog yet — curate products to see them here."):S.many==="tyres"?R("No tyres in this website's catalog yet — curate products to see them here."):R("No products in this website's catalog yet — curate products to see them here."):"Our catalog is being updated. Please check back shortly."})}):Xe?s("div",{className:"border border-line p-10",children:[s("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No confirmed fit for your ",o.appliedName]}),r("p",{className:"mt-2 max-w-[52ch] text-[14px] text-fg-dim",children:B.nothingFits}),s("button",{type:"button",onClick:Q,className:"mt-4 cursor-pointer bg-btn px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:["Show all ",S.many]})]}):f.total===0?s("div",{className:"border border-line p-10",children:[s("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No ",S.many," match those filters"]}),r("p",{className:"mt-2 max-w-[46ch] text-[14px] text-fg-dim",children:"Try widening the price range or clearing a filter."}),kt(t)&&r("button",{type:"button",onClick:J,className:"mt-4 cursor-pointer bg-btn px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:"Clear all filters"})]}):s(se,{children:[F&&r("style",{children:F}),r("div",{className:`${F?`${$} plp-card-grid`:"plp-card-grid"} ${St}`,style:{...ze,...wt(`var(${gt})`)},children:f.items.map(e=>z(e)==="tyre"?r(Wt,{item:e,currency:a,fitSize:P.length>0?Mt(e.sizes,P):null,kindLabel:Z?V(["tyre"]).one:null,showBrand:ee,editing:d,fieldUsage:Ke},`tyre:${L(e)}`):r(Yt,{wheel:e,colours:t.finishes,fit:o.fit,editing:d,kindLabel:Z?V(["alloy-wheel"]).one:null,showBrand:ee,coverIndex:ye,fieldUsage:De,showProcess:je,spinOnHover:Se,imageBackgroundFill:Ae,showBadge:be,outline:_e,indexBadge:j,showCardSizes:Ce??I.showCardSizes,showCardBuy:Ne??I.showCardBuy,showCardPage:ve??I.showCardPage,showCardPrice:Pe??!0,showCardFinishes:ke??!0,imageSizes:Fe},`wheel:${L(e)}`))})]}),r(qt,{page:f.page,pageCount:f.pageCount,onPage:Ve}),r(ct,{editing:d})]})]})]})]})}export{jo as PLP_GATE_DEFAULTS,so as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useId as y,useRef as S,useState as m}from"react";import{useCurrency as P}from"../CurrencyContext.js";import{formatPrice as _}from"../../lib/commerce.js";import{withRMark as k}from"efficient-web-builder/render/components/RMark";import I from"../PopupFrame.js";import{useStockAlertSignup as E}from"../useStockAlertSignup.js";import{UNPRICED_LABEL as A,resolveSetPrice as D}from"../../lib/wheels/price-display.js";function K({wheelName:p,productSlug:N,finishName:h,variants:i,initialSize:w,onClose:o,editing:C=!1}){const s=y(),f=y(),l=S(null),{currency:u}=P(),n=E(),[z,M]=m(()=>w??i[0]?.size??""),[c,W]=m(""),[x,j]=m(!1),a=i.find(r=>r.size===z)??i[0];if(!a)return null;const B=n.status==="sent",d=n.status==="sending",g=n.status==="invalid"?"Please enter a valid email address.":n.status==="error"?"Couldn't save that — please try again.":null;function R(){a&&n.submit({partNumbers:a.components.map(r=>r.partNumber),email:c,productSlug:N,subscribeToOffers:x,dryRun:C})}return e(I,{site:{blur:6,scroll:!0,focusRef:l,trapRef:l},labelledBy:s,onClose:o,children:t("div",{ref:l,tabIndex:-1,className:"relative w-[420px] max-w-full border-2 border-accent bg-surface text-left shadow-[0_24px_60px_rgba(0,0,0,0.55)] outline-none",children:[e("button",{type:"button",onClick:o,"aria-label":"Close",className:"absolute right-[10px] top-[10px] z-[2] flex h-9 w-9 cursor-pointer items-center justify-center text-fg-dim transition-colors hover:text-accent",children:e("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":!0,children:e("path",{d:"M6 6l12 12M18 6 6 18"})})}),B?t("div",{className:"px-6 py-8 text-center",children:[e("span",{className:"mx-auto mb-4 grid h-16 w-16 place-items-center rounded-full border-[1.5px] border-accent bg-accent/15",children:e("svg",{width:"30",height:"30",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2.5","aria-hidden":!0,children:e("path",{d:"M20 6 9 17l-5-5"})})}),e("h3",{id:s,className:"font-display text-[22px] font-medium uppercase leading-tight tracking-[-0.02em]",children:"You're on the list"}),t("p",{className:"mx-auto mt-2 max-w-[34ch] text-[13px] leading-[1.6] text-fg-dim",children:["We'll alert ",e("strong",{className:"font-normal text-fg",children:c.trim()})," as soon as the ",k(p)," in ",a.size," is back. Keep an eye on your inbox."]}),e("button",{type:"button",onClick:o,className:"mt-6 w-full cursor-pointer border border-line px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-fg transition-colors hover:border-accent hover:text-accent",children:"Continue browsing"})]}):t("form",{className:"p-6",noValidate:!0,onSubmit:r=>{r.preventDefault(),R()},children:[t("div",{className:"mb-2 flex items-center gap-3",children:[e("span",{className:"grid h-11 w-11 flex-none place-items-center border-[1.5px] border-accent bg-accent/15",children:t("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2","aria-hidden":!0,children:[e("path",{d:"M18 8a6 6 0 1 0-12 0c0 7-3 9-3 9h18s-3-2-3-9"}),e("path",{d:"M13.7 21a2 2 0 0 1-3.4 0"})]})}),t("div",{children:[e("div",{className:"font-mono text-[10px] uppercase tracking-[0.3em] text-accent",children:"Back-in-stock alert"}),e("h3",{id:s,className:"mt-0.5 font-display text-[22px] font-medium uppercase leading-tight tracking-[-0.02em]",children:"Notify me"})]})]}),t("p",{className:"mb-5 text-[13px] leading-[1.6] text-fg-dim",children:["We'll email you the moment the"," ",e("strong",{className:"font-normal text-fg",children:k(p)}),h?` in ${h}`:""," ","is back in stock. No spam — one alert, then we're done."]}),t("fieldset",{className:"mb-4 border-0 p-0",children:[e("legend",{className:"mb-2 font-mono text-[10px] uppercase tracking-[0.16em] text-fg-dim",children:"Which fitment?"}),e("div",{className:"flex flex-wrap gap-2",children:i.map(r=>{const b=r.size===a.size;return t("button",{type:"button","aria-pressed":b,onClick:()=>M(r.size),className:["flex min-w-[calc(50%-4px)] flex-1 cursor-pointer flex-col items-start gap-0.5 border-[1.5px] px-3 py-3 text-left transition-colors",b?"border-accent bg-accent/15":"border-line hover:border-accent/60"].join(" "),children:[e("span",{className:"font-mono text-[12px] font-bold tracking-[0.08em] text-fg",children:r.size}),e("span",{className:"font-mono text-[10px] tracking-[0.08em] text-fg-dim",children:(()=>{const v=D(r.components,u);return v.setTotal!=null?_(v.setTotal,u):A})()})]},r.size)})})]}),t("div",{className:"mb-4",children:[e("label",{htmlFor:f,className:"mb-2 block font-mono text-[10px] uppercase tracking-[0.16em] text-fg-dim",children:"Email address"}),e("input",{id:f,type:"email",value:c,onChange:r=>{W(r.target.value),(n.status==="invalid"||n.status==="error")&&n.reset()},placeholder:"you@example.com",disabled:d,className:"w-full border-2 border-line bg-bg px-4 py-3 font-display text-[15px] text-fg outline-none transition-colors placeholder:text-fg-dim hover:border-fg-dim focus:border-accent disabled:opacity-60"})]}),t("label",{className:"mb-5 flex cursor-pointer items-start gap-3 text-[12px] leading-[1.5] text-fg-dim",children:[e("input",{type:"checkbox",checked:x,onChange:r=>j(r.target.checked),className:"mt-0.5 h-[18px] w-[18px] flex-none cursor-pointer accent-[var(--accent)]"}),e("span",{children:"Also send me fitment tips and occasional offers for my vehicle."})]}),t("button",{type:"submit",disabled:d,className:"flex h-[50px] w-full cursor-pointer items-center justify-center gap-2 bg-btn px-4 font-mono text-[12px] font-bold uppercase tracking-[0.24em] text-btn-ink transition-colors hover:bg-fg disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:bg-btn",children:[t("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":!0,children:[e("path",{d:"m22 2-7 20-4-9-9-4Z"}),e("path",{d:"M22 2 11 13"})]}),d?"Sending…":"Notify me when available"]}),g&&e("p",{role:"alert",className:"mt-3 text-[12px] leading-[1.5]",style:{color:"var(--alert)"},children:g}),t("div",{className:"mt-3 flex items-center justify-center gap-2 text-[11px] text-fg-dim",children:[t("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":!0,children:[e("rect",{x:"3",y:"11",width:"18",height:"11",rx:"1"}),e("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"We never share your details."]})]})]})})}export{K as default};
|
|
@@ -471,15 +471,9 @@ export interface AdminStorefrontSite {
|
|
|
471
471
|
id: string;
|
|
472
472
|
name: string;
|
|
473
473
|
slug: string;
|
|
474
|
-
maps_api_key: string;
|
|
475
|
-
maps_map_id: string;
|
|
476
474
|
display_order?: number;
|
|
477
475
|
created_at?: string;
|
|
478
476
|
}
|
|
479
|
-
export type AdminStorefrontSitePatch = {
|
|
480
|
-
maps_api_key?: string;
|
|
481
|
-
maps_map_id?: string;
|
|
482
|
-
};
|
|
483
477
|
export interface AdminSiteChange {
|
|
484
478
|
kind: string;
|
|
485
479
|
id: string;
|
|
@@ -738,7 +732,6 @@ export declare function createStorefrontAdmin(client?: AdminClient): {
|
|
|
738
732
|
listSiteCurrencies: (siteId: string, token: string) => Promise<AdminStorefrontSiteCurrency[]>;
|
|
739
733
|
publishSite: (siteId: string, token: string) => Promise<AdminSitePublishResult>;
|
|
740
734
|
getSiteLiveState: (siteId: string, token: string) => Promise<AdminSiteLiveState>;
|
|
741
|
-
updateSite: (siteId: string, patch: AdminStorefrontSitePatch, token: string) => Promise<AdminStorefrontSite>;
|
|
742
735
|
getThemeSettings: (token: string, siteId?: string) => Promise<AdminThemeSettings>;
|
|
743
736
|
updateThemeSettings: (patch: AdminThemeSettingsPatch, token: string, siteId?: string) => Promise<AdminThemeSettings>;
|
|
744
737
|
getChatSettings: (token: string, siteId?: string) => Promise<AdminChatSettings>;
|
|
@@ -817,7 +810,6 @@ export declare const storefrontAdmin: {
|
|
|
817
810
|
listSiteCurrencies: (siteId: string, token: string) => Promise<AdminStorefrontSiteCurrency[]>;
|
|
818
811
|
publishSite: (siteId: string, token: string) => Promise<AdminSitePublishResult>;
|
|
819
812
|
getSiteLiveState: (siteId: string, token: string) => Promise<AdminSiteLiveState>;
|
|
820
|
-
updateSite: (siteId: string, patch: AdminStorefrontSitePatch, token: string) => Promise<AdminStorefrontSite>;
|
|
821
813
|
getThemeSettings: (token: string, siteId?: string) => Promise<AdminThemeSettings>;
|
|
822
814
|
updateThemeSettings: (patch: AdminThemeSettingsPatch, token: string, siteId?: string) => Promise<AdminThemeSettings>;
|
|
823
815
|
getChatSettings: (token: string, siteId?: string) => Promise<AdminChatSettings>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PREVIEW_TOKEN_HEADER as tt,SITE_HOST_HEADER as et,SITE_SLUG_HEADER as rt}from"../site-headers.js";import{PRODUCT_API_BASE as at,PRODUCT_BACKEND_URL as k}from"./origins.js";import{backendHopHeaders as st,clientIpFromForwardedFor as nt,FORWARDED_FOR_HEADER as ot,hopCachingOf as it}from"../forwarded-for.js";import ct from"efficient-web-builder/format/lib/document/media-manifest.json";import{auth as P}from"../auth.js";import{efficientClientOpen as dt}from"efficient-easel/screen/lib/session";import{listableWheelSummaries as J}from"../wheels/listable-wheels.js";import{dropRenderlessFinishes as L}from"../wheels/renderable-finishes.js";const ut=process.env.NEXT_PUBLIC_API_URL??"http://localhost:8000";class m extends Error{status;data;constructor(e,s,o){super(s),this.status=e,this.data=o}}const U="Unable to reach the server. This could be a problem with your internet connection, or the server may be undergoing maintenance or an upgrade. Please try again shortly.",lt=new Set([502,503,504]),I=0,pt="This editor runs on its host's own backend, which does not serve this request.",yt=5e3,ht=15e3,ft=()=>typeof window>"u"?yt:ht;function D(t){const e=(t.method??"GET").toUpperCase();if(!(t.body!=null||e!=="GET"&&e!=="HEAD")&&!(t.audience!=null&&t.audience!=="shop")&&typeof AbortSignal?.timeout=="function")return AbortSignal.timeout(ft())}const x=t=>t instanceof Error&&t.name==="TimeoutError",H=(t,e)=>lt.has(t)?U:e,gt=["admin","venue"];let M="admin";function ne(t){M=gt.includes(t)?t:"admin"}function mt(){return M}const wt=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/;let F=null;function oe(t){F=t&&wt.test(t)?t:null}function St(){return F}function Pt(t){if(typeof window>"u"||!t.startsWith("/api/v1/"))return t;const e=j();return!e||/[?&]site=/.test(t)?t:C(t,`site=${encodeURIComponent(e)}`)}async function i(t,e={}){const{token:s,baseUrl:o,headers:l,audience:p,...w}=e;if(typeof window<"u"&&!dt())throw new m(I,pt,null);if(typeof window>"u"&&o===void 0)throw new Error(`apiFetch(${JSON.stringify(t)}) ran on the server without an explicit baseUrl. The API_URL default it would inherit is browser-only (the prod image bakes NEXT_PUBLIC_API_URL="" for same-origin use, which a Node fetch cannot resolve). Pass a base explicitly: \`await backendOpts()\` (or baseUrl: PRODUCT_FETCH_BASE) for product reads, or the server-only PRODUCT_BACKEND_URL env for other backend surfaces.`);const a=typeof FormData<"u"&&w.body instanceof FormData;let r;try{r=await fetch(`${o??ut}${Pt(t)}`,{...w,headers:{...a?{}:{"Content-Type":"application/json"},...s?{Authorization:`Bearer ${s}`}:{},...p===null?{}:{"X-Portal-Audience":p??"shop"},...l},signal:w.signal??D({...w,audience:p})})}catch(y){throw y instanceof TypeError||x(y)?new m(I,U,null):y}let n;try{n=await r.text()}catch(y){throw x(y)?new m(I,U,null):y}let c=null;if(n)try{c=JSON.parse(n)}catch{throw new m(r.status,r.ok?"Expected JSON but received a non-JSON response":H(r.status,r.statusText),n)}if(!r.ok){const y=(c&&typeof c=="object"&&"detail"in c&&typeof c.detail=="string"?c.detail:null)??H(r.status,r.statusText);throw new m(r.status,y,c)}return c}let O=null;async function B(){return O||(O=bt().finally(()=>{O=null}),O)}async function bt(){const t=P.takeLegacyRefresh(),e=await Ot.refresh(t??void 0);return P.setTokens(e.access),e.access}async function q(){return P.getAccess()??B()}async function h(t,e={}){let s;try{s=await q()}catch{throw P.clear(),new m(401,"Not signed in",null)}try{return await i(t,{...e,token:s})}catch(o){if(!(o instanceof m)||o.status!==401)throw o;try{const l=await B();return await i(t,{...e,token:l})}catch{throw P.clear(),o}}}async function G(t,e={}){if(P.getAccess())try{return{data:await h(t,e),asShopper:!0}}catch(s){if(!(s instanceof m)||s.status!==401)throw s}return{data:await i(t,e),asShopper:!1}}async function W(){const t=await h("/api/auth/me/");if(t.portal!=="shop")throw P.clear(),new m(403,"This session is not valid for this shop.",null);return t}const Ot={login:(t,e)=>i("/api/auth/login/",{method:"POST",body:JSON.stringify({email:t,password:e,portal:"shop"}),credentials:"include"}),refresh:t=>i("/api/auth/refresh/",{method:"POST",body:JSON.stringify(t?{refresh:t,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{P.clear();try{await i("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{const t=await q();return await W(),t},me:W,updateMe:t=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify(t)}),changePassword:(t,e)=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:e,old_password:t})}),changeEmail:(t,e)=>h("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:t,current_password:e})}),myProfile:()=>h("/api/shop-portal/profile/"),updateMyProfile:t=>h("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(t)}),myAddresses:()=>h("/api/shop-portal/delivery-locations/"),createAddress:t=>h("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(t)}),updateAddress:(t,e)=>h(`/api/shop-portal/delivery-locations/${t}/`,{method:"PATCH",body:JSON.stringify(e)}),deleteAddress:t=>h(`/api/shop-portal/delivery-locations/${t}/`,{method:"DELETE"}),passwordResetRequest:t=>i("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:t})}),passwordResetConfirm:(t,e,s)=>i("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:t,token:e,new_password:s})}),brands:()=>h("/api/products/brands/"),myOrders:()=>h("/api/shop-portal/orders/").then(t=>t.results),myOrder:t=>h(`/api/shop-portal/orders/${t}/`),cancelOrder:t=>h(`/api/shop-portal/orders/${t}/cancel/`,{method:"POST"}),myReturns:t=>h(`/api/shop-portal/returns/${t?`?order=${encodeURIComponent(t)}`:""}`).then(e=>e.results),createReturn:t=>h("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(t)}),withdrawReturn:t=>h(`/api/shop-portal/returns/${t}/cancel/`,{method:"POST"}),uploadReturnPhoto:(t,e)=>{const s=new FormData;return s.append("claim_item",t),s.append("file",e),s.append("media_type",e.type.startsWith("video/")?"video":"image"),h("/api/shop-portal/return-media/",{method:"POST",body:s})}};import{media as At,absolutizeApiUrl as N}from"efficient-web-builder/render/lib/media";import{analyzeLogoSvg as Tt,isSvgUrl as Rt}from"efficient-web-builder/format/lib/logo/reverse-svg";import{getEditorSiteId as Et}from"efficient-web-builder/render/lib/editor-site";import{shopRouteBase as Ct,webRuntimeSiteSlug as j}from"efficient-web-builder/format/lib/web-runtime";function g(t){if(typeof t=="string")return t.startsWith("/media/")?At(t):t;if(Array.isArray(t))return t.map(g);if(t&&typeof t=="object"){const e={};for(const[s,o]of Object.entries(t))e[s]=s==="captions"&&o&&typeof o=="object"&&!Array.isArray(o)?Object.fromEntries(Object.entries(o).map(([l,p])=>[g(l),p])):g(o);return e}return t}import{PRODUCT_API_BASE as we}from"./origins.js";const z=typeof window>"u"&&k!=="",$t=z?k:at,_t=Ct,b=()=>({baseUrl:_t(),audience:null});function d(t,e){const s=e?`?process=${encodeURIComponent(e)}`:"";return`/api/v1${t}${s}`}const Ut=100,K=50;function V(t,e,s){const o=new URLSearchParams;for(const[l,p]of Object.entries(e))p!=null&&p!==""&&o.set(l,String(p));return o.set("pageSize",String(Ut)),s&&o.set("cursor",s),`/api/v1${t}?${o.toString()}`}function It(t,e){return V("/wheels",{process:t},e)}function Nt(t,e,s){return V("/products",{kind:t.join(","),make:e?.make,model:e?.model,year:e?.year,modification:e?.modification},s)}function vt(t){if(!t)return null;try{return new URL(t,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function X(t,e,s=()=>!1){const o=[];let l=null;try{for(let p=0;p<K;p++){const w=await i(await e(l),await u());if(o.push(...w.results),l=vt(w.next),!l)break}l&&console.warn(`[${t}] stopped at ${K} pages (${o.length} rows); catalog may be truncated`)}catch(p){if(s(p))throw p;console.warn(`[${t}] product API unavailable, returning []`,p)}return o}const kt=t=>t instanceof m&&t.status===400;function Jt(t){return t.flatMap(e=>e.kind==="alloy-wheel"?J([e]):[e])}async function Z(){return(await Lt()).host}async function Lt(){try{const{headers:t}=await import("next/headers"),e=await t(),s=p=>p?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,o=s(e.get(et)??e.get("x-forwarded-host")??e.get("host")),l=s(e.get("host"));return{host:o,matchesRequestHost:o!==null&&o===l}}catch{return{host:null,matchesRequestHost:!1}}}async function Dt(){try{const{headers:t}=await import("next/headers");return nt((await t()).get(ot))}catch{return null}}async function xt(){try{const{headers:t}=await import("next/headers");return(await t()).get(rt)||null}catch{return null}}async function Ht(){const t=await xt();if(t)return`site=${encodeURIComponent(t)}`;const e=await Z();return e?`host=${encodeURIComponent(e)}`:""}async function f(t){if(typeof window<"u"){const e=j();return e?C(t,`site=${encodeURIComponent(e)}`):t}return C(t,await Ht())}function C(t,e){return e?`${t}${t.includes("?")?"&":"?"}${e}`:t}const Mt="preview";async function Ft(){if(typeof window<"u")return null;try{const{headers:t}=await import("next/headers");return(await t()).get(tt)}catch{return null}}async function Bt(){try{const{headers:t}=await import("next/headers");return(await t()).get("user-agent")}catch{return null}}async function v(t,e){const s=await Ft();if(s===null)return[await f(t),await u(e)];const o=C(await f(t),`${Mt}=${encodeURIComponent(s)}`),{next:l,cache:p,...w}=e??{},a=await u({...w,cache:"no-store"}),r=await Bt();return r&&(a.headers={...a.headers,"user-agent":r}),[o,a]}async function qt(t){if(!z)return;const[e,s]=await Promise.all([Z(),Dt()]),o=st(e,s,t);return Object.keys(o).length>0?o:void 0}async function u(t){const e=await qt(it(t)),s={baseUrl:$t,...t};return e&&(s.headers={...e,...t?.headers}),s}const A=typeof window>"u";function T(t,e){const s=new URLSearchParams;for(const[l,p]of Object.entries(e))p!==void 0&&p!==""&&s.set(l,String(p));const o=s.toString();return`/api/v1/fitment${t}${o?`?${o}`:""}`}const le={listMakes:async t=>{if(A){const{fitmentData:s}=await import("./fitment-data.js");return s.makes(t)}return(await i(T("/makes",{region:t}),b())).results},listModels:async(t,e)=>{if(A){const{fitmentData:o}=await import("./fitment-data.js");return o.models(t,e)}return(await i(T("/models",{make:t,region:e}),b())).results},listYears:async(t,e,s)=>{if(A){const{fitmentData:l}=await import("./fitment-data.js");return l.years(t,e,s)}return(await i(T("/years",{make:t,model:e,region:s}),b())).results},listModifications:async(t,e,s,o)=>{if(A){const{fitmentData:p}=await import("./fitment-data.js");return p.modifications(t,e,s,o)}return(await i(T("/modifications",{make:t,model:e,year:s,region:o}),b())).results},getStockFitment:async(t,e,s,o,l)=>{if(A){const{fitmentData:p}=await import("./fitment-data.js");return p.stockFitment(t,e,s,o,l)}return i(T("/stock-fitment",{make:t,model:e,year:s,modification:o,region:l}),b())}},pe={listWheels:async t=>{const e=await X("products.listWheels",async s=>await f(It(t,s)));return J(g(e))},listCatalog:async(t,e)=>{if(t.length===0)throw new Error("products.listCatalog() needs at least one kind. An empty list would omit `kind`, which the contract reads as `alloy-wheel` — so the call would silently return the wheel catalog instead of nothing.");const s=await X("products.listCatalog",async o=>await f(Nt(t,e,o)),kt);return Jt(g(s))},getWheel:async t=>L(g(await i(await f(d(`/wheels/${t}`)),await u()))),getTyre:async t=>g(await i(await f(d(`/tyres/${t}`)),await u())),listBundles:async()=>{try{return await i(await f(d("/bundles")),await u())}catch{return[]}},getBundle:async t=>i(await f(d(`/bundles/${t}`)),await u()),listGalleryBuilds:async(t={})=>{const{process:e=null,wheelSlug:s=null}=t;if(typeof window>"u"){const{listGalleryBuilds:o}=await import("./gallery-builds-data.js");return g(o(e,s))}try{const o=new URLSearchParams;e&&o.set("process",e),s&&o.set("wheelSlug",s);const l=o.toString(),p=await i(`/api/v1/gallery-builds${l?`?${l}`:""}`,b());return g(p.results)}catch(o){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",o),[]}},getSite:async()=>i(await f(d("/site")),await u()),getSiteBySlug:async t=>i(`${d("/site")}?${new URLSearchParams({site:t})}`,typeof window>"u"?await u():void 0),listPages:async()=>g(await i(await f(d("/pages")),await u())),listPopups:async()=>i(await f(d("/popups")),await u()),listProductTemplates:async()=>{try{return await i(await f(d("/product-templates")),await u())}catch(t){return console.warn("[products.listProductTemplates] unavailable, returning []",t),[]}},listDynamicPages:async t=>{const e=t?`?recordType=${encodeURIComponent(t)}`:"";try{return await i(await f(`${d("/dynamic-pages")}${e}`),await u())}catch(s){if(s instanceof m&&s.status===404)return[];throw s}},getRecord:async(t,e)=>{try{return await i(await f(d(`/records/${encodeURIComponent(t)}/${encodeURIComponent(e)}`)),await u())}catch(s){if(s instanceof m&&s.status===404)return null;throw s}},listRecordKeys:async t=>{try{const e=await i(await f(d(`/records/${encodeURIComponent(t)}`)),await u({cache:"no-store"}));return Array.isArray(e?.keys)?e.keys.filter(s=>typeof s=="string"&&s!==""):[]}catch(e){if(e instanceof m&&e.status===404)return[];throw e}},listProductTypeChoices:async()=>{try{return await i(await f(d("/product-type-choices")),await u())}catch(t){return console.warn("[products.listProductTypeChoices] unavailable, returning []",t),[]}},listFieldUsage:async()=>{try{return await i(await f(d("/field-usage")),await u())}catch(t){return console.warn("[products.listFieldUsage] unavailable, returning []",t),[]}},getPage:async(t,e={})=>{const s=e.record?`?record=${encodeURIComponent(e.record)}`:"",[o,l]=await v(d(`/pages/${t}`)+s,e.revalidate!==void 0?{next:{revalidate:e.revalidate}}:void 0);return g(await i(o,l))},listBlogPosts:async(t={})=>{const e=t.category?`?category=${encodeURIComponent(t.category)}`:"";try{return(await i(d("/blog-posts")+e,await u())).map(o=>({...o,coverImage:N(o.coverImage)??""}))}catch(s){return console.warn("[products.listBlogPosts] blog API unavailable, returning []",s),[]}},getBlogPost:async t=>{const e=await i(d(`/blog-posts/${t}`),await u());return{...e,coverImage:N(e.coverImage)??""}},createOrder:async t=>i(d("/orders"),await u({method:"POST",body:JSON.stringify(t)})),createOrderAuthed:async t=>h(d("/orders"),await u({method:"POST",body:JSON.stringify(t)})),lookupOrder:async t=>i(d("/orders/lookup"),await u({method:"POST",body:JSON.stringify(t)})),createPaymentIntent:async t=>i(d("/payments/intent"),await u({method:"POST",body:JSON.stringify(t)})),createPaypalOrder:async t=>i(d("/payments/paypal/order"),await u({method:"POST",body:JSON.stringify(t)})),capturePaypalOrder:async t=>i(d("/payments/paypal/capture"),await u({method:"POST",body:JSON.stringify(t)})),createAfterpayCheckout:async t=>i(d("/payments/afterpay/checkout"),await u({method:"POST",body:JSON.stringify(t)})),captureAfterpayPayment:async t=>i(d("/payments/afterpay/capture"),await u({method:"POST",body:JSON.stringify(t)})),chargeSquare:async t=>i(d("/payments/square/charge"),await u({method:"POST",body:JSON.stringify(t)})),createGocardlessBillingRequest:async t=>i(d("/payments/gocardless/billing-request"),await u({method:"POST",body:JSON.stringify(t)})),completeGocardlessPayment:async t=>i(d("/payments/gocardless/complete"),await u({method:"POST",body:JSON.stringify(t)})),createZipCheckout:async t=>i(d("/payments/zip/checkout"),await u({method:"POST",body:JSON.stringify(t)})),captureZipPayment:async t=>i(d("/payments/zip/capture"),await u({method:"POST",body:JSON.stringify(t)})),createKlarnaCheckout:async t=>i(d("/payments/klarna/checkout"),await u({method:"POST",body:JSON.stringify(t)})),captureKlarnaPayment:async t=>i(d("/payments/klarna/capture"),await u({method:"POST",body:JSON.stringify(t)})),createStockAlert:async t=>i(d("/stock-alerts"),await u({method:"POST",body:JSON.stringify(t)})),createPreOrderIntent:async t=>i(d("/pre-order-intents"),await u({method:"POST",body:JSON.stringify(t)})),createNewsletterSubscription:async t=>i(d("/newsletter-subscriptions"),await u({method:"POST",body:JSON.stringify(t)})),unsubscribeNewsletter:async t=>i(d("/newsletter-unsubscribe"),await u({method:"POST",body:JSON.stringify(t)})),captureCart:async t=>i(d("/carts"),await u({method:"POST",body:JSON.stringify(t)})),restoreCart:async t=>i(d("/carts/restore"),await u({method:"POST",body:JSON.stringify(t)})),unsubscribeCartReminders:async t=>i(d("/carts/unsubscribe"),await u({method:"POST",body:JSON.stringify(t)})),listReviews:async(t={})=>{const e=new URLSearchParams;t.limit&&e.set("limit",String(t.limit)),t.designCode&&e.set("designCode",t.designCode);const s=d("/reviews"),o=e.toString();try{return await i(await f(o?`${s}?${o}`:s),await u())}catch(l){return console.warn("[products.listReviews] product API unavailable, returning []",l),[]}},submitReview:async t=>i(d("/reviews"),await u({method:"POST",body:JSON.stringify(t)})),getForm:async t=>i(d(`/forms/${encodeURIComponent(t)}`),await u()),submitForm:async(t,e)=>i(d(`/forms/${encodeURIComponent(t)}/submissions`),await u({method:"POST",body:JSON.stringify(e)})),listShippingMethods:async()=>{try{return await i(d("/shipping-methods"),await u())}catch(t){return console.warn("[products.listShippingMethods] product API unavailable, returning []",t),[]}},listCountrySubdivisions:async t=>{try{return await i(d(`/countries/${encodeURIComponent(t)}/subdivisions`),await u())}catch(e){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",e),[]}},quoteCart:async t=>{const e=d("/cart/quote"),s=await u({method:"POST",body:JSON.stringify(t)});return t.couponCode?(await G(e,s)).data:i(e,s)},validateCoupon:async t=>{const{data:e,asShopper:s}=await G(d("/coupons/validate"),await u({method:"POST",body:JSON.stringify(t)}));return{...e,askedAsShopper:s}},getHeaderSettings:async()=>{const t=D({method:"GET"}),e=await i(...await v(d("/header-settings"),{signal:t})),s=N(e.logoUrl);let o=null,l=null;if(s&&Rt(s)){const p=await Tt(s,t);p&&(o=p.reversed,l=p.inkIsDark)}return{...e,logoUrl:s,logoReversed:o,logoInkIsDark:l}},getThemeSettings:async()=>i(...await v(d("/theme-settings"))),getChatSettings:async()=>i(await f(d("/chat-settings")),await u())},ye={listServices:async()=>{try{return await i(d("/bookings/services"),await u())}catch(t){return console.warn("[bookings.listServices] API unavailable, returning []",t),{results:[],currency:"USD"}}},getAvailability:async(t,e)=>i(d(`/bookings/availability?service=${encodeURIComponent(t)}&date=${e}`),await u()),create:async t=>i(d("/bookings"),await u({method:"POST",body:JSON.stringify(t)})),get:async t=>i(d(`/bookings/manage/${encodeURIComponent(t)}`),await u()),cancel:async t=>i(d(`/bookings/manage/${encodeURIComponent(t)}/cancel`),await u({method:"POST"})),createPaymentIntent:async t=>i(d("/bookings/payments/intent"),await u({method:"POST",body:JSON.stringify({manageToken:t})}))};class Gt extends Error{slug;count;constructor(e,s){super(`Slug "${e}" exists on ${s} websites; a site is required to pick one.`),this.slug=e,this.count=s,this.name="AmbiguousPageSlugError"}}const $=(t,e,s)=>{const o=new URLSearchParams({...e?{site:e}:{},...s?{draft:"1"}:{}}).toString();return`/api/storefront/${t}/${o?`?${o}`:""}`},R=t=>`/api/storefront/sites/${encodeURIComponent(t)}/`,Wt=t=>`${R(t)}currencies/`,jt="/api/storefront/media/ingest/";class zt extends Error{constructor(){super("This editor is not connected to a website, so an upload has nowhere to go. Open the page from the website the file should belong to, then try again."),this.name="MediaUploadDestinationError"}}function Kt(){const t=Et();if(!t)throw new zt;return`${jt}?${new URLSearchParams({site:t})}`}const Vt="X-Puck-Media-Manifest",Y=ct.contentHash,_={"X-Media-Manifest":Y,[Vt]:Y},he=Q({});function Q(t){return(e,s={})=>{const o=St(),l=t.headers||o?{...o?{"Accept-Language":o}:{},...t.headers,...s.headers}:void 0;return i(e,{...s,...t.baseUrl!==void 0?{baseUrl:t.baseUrl}:{},...l?{headers:l}:{},audience:t.audience??mt()})}}function Xt(t={}){const e=Q(t),s=t.siteDrafts===!0,o=a=>$("header-settings",a,s),l=a=>$("theme-settings",a,s),p=a=>$("chat-settings",a,s),w=a=>$("social-settings",a,s);return{findPageBySlug:async(a,r,n)=>{const c=new URLSearchParams({slug:a});n&&c.set("site",n);const y=await e(`/api/storefront/pages/?${c.toString()}`,{token:r}),S=Array.isArray(y)?y:y.results??[];if(!n&&S.length>1)throw new Gt(a,S.length);return S[0]??null},getPageById:(a,r)=>e(`/api/storefront/pages/${a}/`,{token:r}),saveLayout:(a,r,n,c,y)=>e(`/api/storefront/pages/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r,expected_updated_at:c,...y?{client_id:y}:{}}),token:n}),duplicatePage:(a,r,n)=>e(`/api/storefront/pages/${a}/duplicate/`,{method:"POST",body:JSON.stringify({title:r.title,slug:r.slug}),token:n}),geocode:(a,r,n)=>e(`/api/storefront/geocode/?${new URLSearchParams(n?{q:a,country:n}:{q:a})}`,{token:r}),listBlockSources:a=>e("/api/storefront/block-sources/",{token:a}),listRecordTypes:a=>e("/api/storefront/record-types/",{token:a}),createPagePreviewLink:(a,r)=>e(`/api/storefront/pages/${a}/preview-link/`,{method:"POST",token:r}),claimPageEditLock:(a,r,n,c=!1)=>e(`/api/storefront/pages/${a}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:n,takeover:c}),token:r}),releasePageEditLock:(a,r)=>e(`/api/storefront/pages/${a}/edit-lock/`,{method:"DELETE",token:r}),createTemplate:(a,r,n)=>e("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:a,layout:r}),headers:_,token:n}),getTemplate:(a,r)=>e(`/api/storefront/page-templates/${a}/`,{token:r}),saveTemplateLayout:(a,r,n)=>e(`/api/storefront/page-templates/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r}),headers:_,token:n}),listTemplatePages:async(a,r)=>{const n=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(a)}`,{token:r});return Array.isArray(n)?n:n.results??[]},findTemplatePageBySlug:async(a,r,n)=>{const c=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(a)}&slug=${encodeURIComponent(r)}`,{token:n});return(Array.isArray(c)?c:c.results??[])[0]??null},createTemplatePage:(a,r,n)=>e("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:a,...r}),headers:_,token:n}),saveTemplatePageLayout:(a,r,n)=>e(`/api/storefront/template-pages/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r}),headers:_,token:n}),deleteTemplatePage:(a,r,n)=>e(`/api/storefront/template-pages/${a}/`,{method:"DELETE",token:r,...n?.keepalive?{keepalive:!0}:{}}),listPages:async(a,r)=>{const n=new URLSearchParams({no_page:"true"});r&&n.set("site",r);const c=await e(`/api/storefront/pages/?${n.toString()}`,{token:a});return Array.isArray(c)?c:c.results??[]},createPage:(a,r,n,c)=>e("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:a,slug:r,layout:n}),token:c}),deletePage:(a,r)=>e(`/api/storefront/pages/${a}/`,{method:"DELETE",token:r}),getHeaderSettings:(a,r)=>e(o(r),{token:a}),listMenus:async(a,r)=>{const n=new URLSearchParams({no_page:"true"});r&&n.set("site",r);const c=await e(`/api/storefront/menus/?${n}`,{token:a});return Array.isArray(c)?c:c.results??[]},listBlogPosts:async(a,r={})=>{const n=new URLSearchParams({no_page:"true"});r.visibleOnly&&n.set("is_visible","true"),r.siteId&&n.set("site",r.siteId);const c=await e(`/api/storefront/blog-posts/?${n.toString()}`,{token:a});return Array.isArray(c)?c:c.results??[]},listFieldUsage:async(a,r)=>{const n=await e(`/api/storefront/field-usage/?site=${encodeURIComponent(r)}`,{token:a});return Array.isArray(n?.entries)?n.entries:[]},listCategories:async(a,r={})=>{const n=new URLSearchParams({no_page:"true"});r.visibleOnly&&n.set("is_visible","true"),r.siteId&&n.set("site",r.siteId);const c=await e(`/api/storefront/categories/?${n.toString()}`,{token:a});return[...Array.isArray(c)?c:c.results??[]].sort((S,E)=>S.sort_order-E.sort_order||S.name.localeCompare(E.name))},listForms:async(a,r={})=>{const n=new URLSearchParams({no_page:"true"});r.siteId&&n.set("site",r.siteId);const c=await e(`/api/storefront/forms/?${n.toString()}`,{token:a});return[...Array.isArray(c)?c:c.results??[]].sort((S,E)=>S.title.localeCompare(E.title))},listWheelSummaries:async(a,r={})=>{const n=new URLSearchParams;r.siteId&&n.set("site",r.siteId);const c=n.toString(),y=await e(`/api/storefront/wheel-curations/summaries/${c?`?${c}`:""}`,{token:a});return g(y)},listProducts:async(a,r={})=>{const n=new URLSearchParams;r.kinds?.length&&n.set("kind",r.kinds.join(",")),r.siteId&&n.set("site",r.siteId);const c=n.toString(),y=await e(`/api/storefront/products/${c?`?${c}`:""}`,{token:a});return g(y)},getWheelDetail:async(a,r,n={})=>{const c=new URLSearchParams({slug:r});return n.siteId&&c.set("site",n.siteId),L(g(await e(`/api/storefront/wheel-curations/detail/?${c.toString()}`,{token:a})))},updateHeaderSettings:(a,r,n)=>e(o(n),{method:"PATCH",body:JSON.stringify(a),token:r}),getSite:(a,r)=>e(R(a),{token:r}),listSites:async a=>{const r=await e("/api/storefront/sites/?no_page=true",{token:a});return Array.isArray(r)?r:r.results??[]},listSiteCurrencies:async(a,r)=>{const n=await e(Wt(a),{token:r});return Array.isArray(n)?n:[]},publishSite:(a,r)=>e(`${R(a)}publish/`,{method:"POST",token:r}),getSiteLiveState:(a,r)=>e(`${R(a)}live-state/`,{token:r}),updateSite:(a,r,n)=>e(R(a),{method:"PATCH",body:JSON.stringify(r),token:n}),getThemeSettings:(a,r)=>e(l(r),{token:a}),updateThemeSettings:(a,r,n)=>e(l(n),{method:"PATCH",body:JSON.stringify(a),token:r}),getChatSettings:(a,r)=>e(p(r),{token:a}),updateChatSettings:(a,r,n)=>e(p(n),{method:"PATCH",body:JSON.stringify(a),token:r}),getSocialSettings:(a,r)=>e(w(r),{token:a}),updateSocialSettings:(a,r,n)=>e(w(n),{method:"PATCH",body:JSON.stringify(a),token:r}),uploadHeaderLogo:(a,r,n)=>{const c=new FormData;return c.append("logo",a),e(o(n),{method:"PATCH",body:c,token:r})},clearHeaderLogo:(a,r)=>e(o(r),{method:"PATCH",body:JSON.stringify({logo:null}),token:a}),setHeaderLogoFromAsset:(a,r,n)=>e(o(n),{method:"PATCH",body:JSON.stringify({logo_asset_id:a}),token:r}),uploadMedia:async(a,r)=>{const n=new FormData;return n.append("file",a),e(Kt(),{method:"POST",body:n,token:r})},listMedia:async(a,r)=>{const n=new URLSearchParams({no_page:"true"});r&&n.set("kind",r);const c=await e(`/api/storefront/media-assets/?${n.toString()}`,{token:a});return Array.isArray(c)?c:c.results??[]}}}const fe=Xt({siteDrafts:!0});export{ut as API_URL,Gt as AmbiguousPageSlugError,m as ApiError,ht as BROWSER_READ_TIMEOUT_MS,pt as EFFICIENT_CLIENT_CLOSED_MESSAGE,zt as MediaUploadDestinationError,Mt as PREVIEW_PARAM,we as PRODUCT_API_BASE,yt as SERVER_READ_TIMEOUT_MS,U as SERVER_UNREACHABLE_MESSAGE,I as STATUS_NETWORK_ERROR,he as adminFetch,Ot as api,i as apiFetch,C as appendSiteQuery,ye as bookings,Xt as createStorefrontAdmin,D as defaultRequestDeadline,Kt as editorMediaUploadPath,mt as editorPortalAudience,St as editorRequestLanguage,le as fitment,pe as products,ft as readDeadlineMs,Dt as resolveClientIp,g as resolveMediaUrls,Ft as resolvePreviewToken,Z as resolveSiteHost,Lt as resolveSiteHostSource,xt as resolveSiteSlug,oe as setEditorLanguage,ne as setEditorPortalAudience,fe as storefrontAdmin};
|
|
1
|
+
import{PREVIEW_TOKEN_HEADER as tt,SITE_HOST_HEADER as et,SITE_SLUG_HEADER as rt}from"../site-headers.js";import{PRODUCT_API_BASE as at,PRODUCT_BACKEND_URL as k}from"./origins.js";import{backendHopHeaders as st,clientIpFromForwardedFor as nt,FORWARDED_FOR_HEADER as ot,hopCachingOf as it}from"../forwarded-for.js";import ct from"efficient-web-builder/format/lib/document/media-manifest.json";import{auth as P}from"../auth.js";import{efficientClientOpen as dt}from"efficient-easel/screen/lib/session";import{listableWheelSummaries as J}from"../wheels/listable-wheels.js";import{dropRenderlessFinishes as L}from"../wheels/renderable-finishes.js";const ut=process.env.NEXT_PUBLIC_API_URL??"http://localhost:8000";class m extends Error{status;data;constructor(e,s,o){super(s),this.status=e,this.data=o}}const U="Unable to reach the server. This could be a problem with your internet connection, or the server may be undergoing maintenance or an upgrade. Please try again shortly.",lt=new Set([502,503,504]),I=0,pt="This editor runs on its host's own backend, which does not serve this request.",yt=5e3,ht=15e3,ft=()=>typeof window>"u"?yt:ht;function D(t){const e=(t.method??"GET").toUpperCase();if(!(t.body!=null||e!=="GET"&&e!=="HEAD")&&!(t.audience!=null&&t.audience!=="shop")&&typeof AbortSignal?.timeout=="function")return AbortSignal.timeout(ft())}const x=t=>t instanceof Error&&t.name==="TimeoutError",H=(t,e)=>lt.has(t)?U:e,gt=["admin","venue"];let M="admin";function ne(t){M=gt.includes(t)?t:"admin"}function mt(){return M}const wt=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/;let F=null;function oe(t){F=t&&wt.test(t)?t:null}function St(){return F}function Pt(t){if(typeof window>"u"||!t.startsWith("/api/v1/"))return t;const e=j();return!e||/[?&]site=/.test(t)?t:E(t,`site=${encodeURIComponent(e)}`)}async function i(t,e={}){const{token:s,baseUrl:o,headers:l,audience:p,...w}=e;if(typeof window<"u"&&!dt())throw new m(I,pt,null);if(typeof window>"u"&&o===void 0)throw new Error(`apiFetch(${JSON.stringify(t)}) ran on the server without an explicit baseUrl. The API_URL default it would inherit is browser-only (the prod image bakes NEXT_PUBLIC_API_URL="" for same-origin use, which a Node fetch cannot resolve). Pass a base explicitly: \`await backendOpts()\` (or baseUrl: PRODUCT_FETCH_BASE) for product reads, or the server-only PRODUCT_BACKEND_URL env for other backend surfaces.`);const a=typeof FormData<"u"&&w.body instanceof FormData;let r;try{r=await fetch(`${o??ut}${Pt(t)}`,{...w,headers:{...a?{}:{"Content-Type":"application/json"},...s?{Authorization:`Bearer ${s}`}:{},...p===null?{}:{"X-Portal-Audience":p??"shop"},...l},signal:w.signal??D({...w,audience:p})})}catch(y){throw y instanceof TypeError||x(y)?new m(I,U,null):y}let n;try{n=await r.text()}catch(y){throw x(y)?new m(I,U,null):y}let c=null;if(n)try{c=JSON.parse(n)}catch{throw new m(r.status,r.ok?"Expected JSON but received a non-JSON response":H(r.status,r.statusText),n)}if(!r.ok){const y=(c&&typeof c=="object"&&"detail"in c&&typeof c.detail=="string"?c.detail:null)??H(r.status,r.statusText);throw new m(r.status,y,c)}return c}let O=null;async function B(){return O||(O=bt().finally(()=>{O=null}),O)}async function bt(){const t=P.takeLegacyRefresh(),e=await Ot.refresh(t??void 0);return P.setTokens(e.access),e.access}async function q(){return P.getAccess()??B()}async function h(t,e={}){let s;try{s=await q()}catch{throw P.clear(),new m(401,"Not signed in",null)}try{return await i(t,{...e,token:s})}catch(o){if(!(o instanceof m)||o.status!==401)throw o;try{const l=await B();return await i(t,{...e,token:l})}catch{throw P.clear(),o}}}async function G(t,e={}){if(P.getAccess())try{return{data:await h(t,e),asShopper:!0}}catch(s){if(!(s instanceof m)||s.status!==401)throw s}return{data:await i(t,e),asShopper:!1}}async function W(){const t=await h("/api/auth/me/");if(t.portal!=="shop")throw P.clear(),new m(403,"This session is not valid for this shop.",null);return t}const Ot={login:(t,e)=>i("/api/auth/login/",{method:"POST",body:JSON.stringify({email:t,password:e,portal:"shop"}),credentials:"include"}),refresh:t=>i("/api/auth/refresh/",{method:"POST",body:JSON.stringify(t?{refresh:t,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{P.clear();try{await i("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{const t=await q();return await W(),t},me:W,updateMe:t=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify(t)}),changePassword:(t,e)=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:e,old_password:t})}),changeEmail:(t,e)=>h("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:t,current_password:e})}),myProfile:()=>h("/api/shop-portal/profile/"),updateMyProfile:t=>h("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(t)}),myAddresses:()=>h("/api/shop-portal/delivery-locations/"),createAddress:t=>h("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(t)}),updateAddress:(t,e)=>h(`/api/shop-portal/delivery-locations/${t}/`,{method:"PATCH",body:JSON.stringify(e)}),deleteAddress:t=>h(`/api/shop-portal/delivery-locations/${t}/`,{method:"DELETE"}),passwordResetRequest:t=>i("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:t})}),passwordResetConfirm:(t,e,s)=>i("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:t,token:e,new_password:s})}),brands:()=>h("/api/products/brands/"),myOrders:()=>h("/api/shop-portal/orders/").then(t=>t.results),myOrder:t=>h(`/api/shop-portal/orders/${t}/`),cancelOrder:t=>h(`/api/shop-portal/orders/${t}/cancel/`,{method:"POST"}),myReturns:t=>h(`/api/shop-portal/returns/${t?`?order=${encodeURIComponent(t)}`:""}`).then(e=>e.results),createReturn:t=>h("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(t)}),withdrawReturn:t=>h(`/api/shop-portal/returns/${t}/cancel/`,{method:"POST"}),uploadReturnPhoto:(t,e)=>{const s=new FormData;return s.append("claim_item",t),s.append("file",e),s.append("media_type",e.type.startsWith("video/")?"video":"image"),h("/api/shop-portal/return-media/",{method:"POST",body:s})}};import{media as At,absolutizeApiUrl as N}from"efficient-web-builder/render/lib/media";import{analyzeLogoSvg as Tt,isSvgUrl as Rt}from"efficient-web-builder/format/lib/logo/reverse-svg";import{getEditorSiteId as Et}from"efficient-web-builder/render/lib/editor-site";import{shopRouteBase as Ct,webRuntimeSiteSlug as j}from"efficient-web-builder/format/lib/web-runtime";function g(t){if(typeof t=="string")return t.startsWith("/media/")?At(t):t;if(Array.isArray(t))return t.map(g);if(t&&typeof t=="object"){const e={};for(const[s,o]of Object.entries(t))e[s]=s==="captions"&&o&&typeof o=="object"&&!Array.isArray(o)?Object.fromEntries(Object.entries(o).map(([l,p])=>[g(l),p])):g(o);return e}return t}import{PRODUCT_API_BASE as we}from"./origins.js";const z=typeof window>"u"&&k!=="",$t=z?k:at,_t=Ct,b=()=>({baseUrl:_t(),audience:null});function d(t,e){const s=e?`?process=${encodeURIComponent(e)}`:"";return`/api/v1${t}${s}`}const Ut=100,K=50;function V(t,e,s){const o=new URLSearchParams;for(const[l,p]of Object.entries(e))p!=null&&p!==""&&o.set(l,String(p));return o.set("pageSize",String(Ut)),s&&o.set("cursor",s),`/api/v1${t}?${o.toString()}`}function It(t,e){return V("/wheels",{process:t},e)}function Nt(t,e,s){return V("/products",{kind:t.join(","),make:e?.make,model:e?.model,year:e?.year,modification:e?.modification},s)}function vt(t){if(!t)return null;try{return new URL(t,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function X(t,e,s=()=>!1){const o=[];let l=null;try{for(let p=0;p<K;p++){const w=await i(await e(l),await u());if(o.push(...w.results),l=vt(w.next),!l)break}l&&console.warn(`[${t}] stopped at ${K} pages (${o.length} rows); catalog may be truncated`)}catch(p){if(s(p))throw p;console.warn(`[${t}] product API unavailable, returning []`,p)}return o}const kt=t=>t instanceof m&&t.status===400;function Jt(t){return t.flatMap(e=>e.kind==="alloy-wheel"?J([e]):[e])}async function Z(){return(await Lt()).host}async function Lt(){try{const{headers:t}=await import("next/headers"),e=await t(),s=p=>p?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,o=s(e.get(et)??e.get("x-forwarded-host")??e.get("host")),l=s(e.get("host"));return{host:o,matchesRequestHost:o!==null&&o===l}}catch{return{host:null,matchesRequestHost:!1}}}async function Dt(){try{const{headers:t}=await import("next/headers");return nt((await t()).get(ot))}catch{return null}}async function xt(){try{const{headers:t}=await import("next/headers");return(await t()).get(rt)||null}catch{return null}}async function Ht(){const t=await xt();if(t)return`site=${encodeURIComponent(t)}`;const e=await Z();return e?`host=${encodeURIComponent(e)}`:""}async function f(t){if(typeof window<"u"){const e=j();return e?E(t,`site=${encodeURIComponent(e)}`):t}return E(t,await Ht())}function E(t,e){return e?`${t}${t.includes("?")?"&":"?"}${e}`:t}const Mt="preview";async function Ft(){if(typeof window<"u")return null;try{const{headers:t}=await import("next/headers");return(await t()).get(tt)}catch{return null}}async function Bt(){try{const{headers:t}=await import("next/headers");return(await t()).get("user-agent")}catch{return null}}async function v(t,e){const s=await Ft();if(s===null)return[await f(t),await u(e)];const o=E(await f(t),`${Mt}=${encodeURIComponent(s)}`),{next:l,cache:p,...w}=e??{},a=await u({...w,cache:"no-store"}),r=await Bt();return r&&(a.headers={...a.headers,"user-agent":r}),[o,a]}async function qt(t){if(!z)return;const[e,s]=await Promise.all([Z(),Dt()]),o=st(e,s,t);return Object.keys(o).length>0?o:void 0}async function u(t){const e=await qt(it(t)),s={baseUrl:$t,...t};return e&&(s.headers={...e,...t?.headers}),s}const A=typeof window>"u";function T(t,e){const s=new URLSearchParams;for(const[l,p]of Object.entries(e))p!==void 0&&p!==""&&s.set(l,String(p));const o=s.toString();return`/api/v1/fitment${t}${o?`?${o}`:""}`}const le={listMakes:async t=>{if(A){const{fitmentData:s}=await import("./fitment-data.js");return s.makes(t)}return(await i(T("/makes",{region:t}),b())).results},listModels:async(t,e)=>{if(A){const{fitmentData:o}=await import("./fitment-data.js");return o.models(t,e)}return(await i(T("/models",{make:t,region:e}),b())).results},listYears:async(t,e,s)=>{if(A){const{fitmentData:l}=await import("./fitment-data.js");return l.years(t,e,s)}return(await i(T("/years",{make:t,model:e,region:s}),b())).results},listModifications:async(t,e,s,o)=>{if(A){const{fitmentData:p}=await import("./fitment-data.js");return p.modifications(t,e,s,o)}return(await i(T("/modifications",{make:t,model:e,year:s,region:o}),b())).results},getStockFitment:async(t,e,s,o,l)=>{if(A){const{fitmentData:p}=await import("./fitment-data.js");return p.stockFitment(t,e,s,o,l)}return i(T("/stock-fitment",{make:t,model:e,year:s,modification:o,region:l}),b())}},pe={listWheels:async t=>{const e=await X("products.listWheels",async s=>await f(It(t,s)));return J(g(e))},listCatalog:async(t,e)=>{if(t.length===0)throw new Error("products.listCatalog() needs at least one kind. An empty list would omit `kind`, which the contract reads as `alloy-wheel` — so the call would silently return the wheel catalog instead of nothing.");const s=await X("products.listCatalog",async o=>await f(Nt(t,e,o)),kt);return Jt(g(s))},getWheel:async t=>L(g(await i(await f(d(`/wheels/${t}`)),await u()))),getTyre:async t=>g(await i(await f(d(`/tyres/${t}`)),await u())),listBundles:async()=>{try{return await i(await f(d("/bundles")),await u())}catch{return[]}},getBundle:async t=>i(await f(d(`/bundles/${t}`)),await u()),listGalleryBuilds:async(t={})=>{const{process:e=null,wheelSlug:s=null}=t;if(typeof window>"u"){const{listGalleryBuilds:o}=await import("./gallery-builds-data.js");return g(o(e,s))}try{const o=new URLSearchParams;e&&o.set("process",e),s&&o.set("wheelSlug",s);const l=o.toString(),p=await i(`/api/v1/gallery-builds${l?`?${l}`:""}`,b());return g(p.results)}catch(o){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",o),[]}},getSite:async()=>i(await f(d("/site")),await u()),getSiteBySlug:async t=>i(`${d("/site")}?${new URLSearchParams({site:t})}`,typeof window>"u"?await u():void 0),listPages:async()=>g(await i(await f(d("/pages")),await u())),listPopups:async()=>i(await f(d("/popups")),await u()),listProductTemplates:async()=>{try{return await i(await f(d("/product-templates")),await u())}catch(t){return console.warn("[products.listProductTemplates] unavailable, returning []",t),[]}},listDynamicPages:async t=>{const e=t?`?recordType=${encodeURIComponent(t)}`:"";try{return await i(await f(`${d("/dynamic-pages")}${e}`),await u())}catch(s){if(s instanceof m&&s.status===404)return[];throw s}},getRecord:async(t,e)=>{try{return await i(await f(d(`/records/${encodeURIComponent(t)}/${encodeURIComponent(e)}`)),await u())}catch(s){if(s instanceof m&&s.status===404)return null;throw s}},listRecordKeys:async t=>{try{const e=await i(await f(d(`/records/${encodeURIComponent(t)}`)),await u({cache:"no-store"}));return Array.isArray(e?.keys)?e.keys.filter(s=>typeof s=="string"&&s!==""):[]}catch(e){if(e instanceof m&&e.status===404)return[];throw e}},listProductTypeChoices:async()=>{try{return await i(await f(d("/product-type-choices")),await u())}catch(t){return console.warn("[products.listProductTypeChoices] unavailable, returning []",t),[]}},listFieldUsage:async()=>{try{return await i(await f(d("/field-usage")),await u())}catch(t){return console.warn("[products.listFieldUsage] unavailable, returning []",t),[]}},getPage:async(t,e={})=>{const s=e.record?`?record=${encodeURIComponent(e.record)}`:"",[o,l]=await v(d(`/pages/${t}`)+s,e.revalidate!==void 0?{next:{revalidate:e.revalidate}}:void 0);return g(await i(o,l))},listBlogPosts:async(t={})=>{const e=t.category?`?category=${encodeURIComponent(t.category)}`:"";try{return(await i(d("/blog-posts")+e,await u())).map(o=>({...o,coverImage:N(o.coverImage)??""}))}catch(s){return console.warn("[products.listBlogPosts] blog API unavailable, returning []",s),[]}},getBlogPost:async t=>{const e=await i(d(`/blog-posts/${t}`),await u());return{...e,coverImage:N(e.coverImage)??""}},createOrder:async t=>i(d("/orders"),await u({method:"POST",body:JSON.stringify(t)})),createOrderAuthed:async t=>h(d("/orders"),await u({method:"POST",body:JSON.stringify(t)})),lookupOrder:async t=>i(d("/orders/lookup"),await u({method:"POST",body:JSON.stringify(t)})),createPaymentIntent:async t=>i(d("/payments/intent"),await u({method:"POST",body:JSON.stringify(t)})),createPaypalOrder:async t=>i(d("/payments/paypal/order"),await u({method:"POST",body:JSON.stringify(t)})),capturePaypalOrder:async t=>i(d("/payments/paypal/capture"),await u({method:"POST",body:JSON.stringify(t)})),createAfterpayCheckout:async t=>i(d("/payments/afterpay/checkout"),await u({method:"POST",body:JSON.stringify(t)})),captureAfterpayPayment:async t=>i(d("/payments/afterpay/capture"),await u({method:"POST",body:JSON.stringify(t)})),chargeSquare:async t=>i(d("/payments/square/charge"),await u({method:"POST",body:JSON.stringify(t)})),createGocardlessBillingRequest:async t=>i(d("/payments/gocardless/billing-request"),await u({method:"POST",body:JSON.stringify(t)})),completeGocardlessPayment:async t=>i(d("/payments/gocardless/complete"),await u({method:"POST",body:JSON.stringify(t)})),createZipCheckout:async t=>i(d("/payments/zip/checkout"),await u({method:"POST",body:JSON.stringify(t)})),captureZipPayment:async t=>i(d("/payments/zip/capture"),await u({method:"POST",body:JSON.stringify(t)})),createKlarnaCheckout:async t=>i(d("/payments/klarna/checkout"),await u({method:"POST",body:JSON.stringify(t)})),captureKlarnaPayment:async t=>i(d("/payments/klarna/capture"),await u({method:"POST",body:JSON.stringify(t)})),createStockAlert:async t=>i(d("/stock-alerts"),await u({method:"POST",body:JSON.stringify(t)})),createPreOrderIntent:async t=>i(d("/pre-order-intents"),await u({method:"POST",body:JSON.stringify(t)})),createNewsletterSubscription:async t=>i(d("/newsletter-subscriptions"),await u({method:"POST",body:JSON.stringify(t)})),unsubscribeNewsletter:async t=>i(d("/newsletter-unsubscribe"),await u({method:"POST",body:JSON.stringify(t)})),captureCart:async t=>i(d("/carts"),await u({method:"POST",body:JSON.stringify(t)})),restoreCart:async t=>i(d("/carts/restore"),await u({method:"POST",body:JSON.stringify(t)})),unsubscribeCartReminders:async t=>i(d("/carts/unsubscribe"),await u({method:"POST",body:JSON.stringify(t)})),listReviews:async(t={})=>{const e=new URLSearchParams;t.limit&&e.set("limit",String(t.limit)),t.designCode&&e.set("designCode",t.designCode);const s=d("/reviews"),o=e.toString();try{return await i(await f(o?`${s}?${o}`:s),await u())}catch(l){return console.warn("[products.listReviews] product API unavailable, returning []",l),[]}},submitReview:async t=>i(d("/reviews"),await u({method:"POST",body:JSON.stringify(t)})),getForm:async t=>i(d(`/forms/${encodeURIComponent(t)}`),await u()),submitForm:async(t,e)=>i(d(`/forms/${encodeURIComponent(t)}/submissions`),await u({method:"POST",body:JSON.stringify(e)})),listShippingMethods:async()=>{try{return await i(d("/shipping-methods"),await u())}catch(t){return console.warn("[products.listShippingMethods] product API unavailable, returning []",t),[]}},listCountrySubdivisions:async t=>{try{return await i(d(`/countries/${encodeURIComponent(t)}/subdivisions`),await u())}catch(e){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",e),[]}},quoteCart:async t=>{const e=d("/cart/quote"),s=await u({method:"POST",body:JSON.stringify(t)});return t.couponCode?(await G(e,s)).data:i(e,s)},validateCoupon:async t=>{const{data:e,asShopper:s}=await G(d("/coupons/validate"),await u({method:"POST",body:JSON.stringify(t)}));return{...e,askedAsShopper:s}},getHeaderSettings:async()=>{const t=D({method:"GET"}),e=await i(...await v(d("/header-settings"),{signal:t})),s=N(e.logoUrl);let o=null,l=null;if(s&&Rt(s)){const p=await Tt(s,t);p&&(o=p.reversed,l=p.inkIsDark)}return{...e,logoUrl:s,logoReversed:o,logoInkIsDark:l}},getThemeSettings:async()=>i(...await v(d("/theme-settings"))),getChatSettings:async()=>i(await f(d("/chat-settings")),await u())},ye={listServices:async()=>{try{return await i(d("/bookings/services"),await u())}catch(t){return console.warn("[bookings.listServices] API unavailable, returning []",t),{results:[],currency:"USD"}}},getAvailability:async(t,e)=>i(d(`/bookings/availability?service=${encodeURIComponent(t)}&date=${e}`),await u()),create:async t=>i(d("/bookings"),await u({method:"POST",body:JSON.stringify(t)})),get:async t=>i(d(`/bookings/manage/${encodeURIComponent(t)}`),await u()),cancel:async t=>i(d(`/bookings/manage/${encodeURIComponent(t)}/cancel`),await u({method:"POST"})),createPaymentIntent:async t=>i(d("/bookings/payments/intent"),await u({method:"POST",body:JSON.stringify({manageToken:t})}))};class Gt extends Error{slug;count;constructor(e,s){super(`Slug "${e}" exists on ${s} websites; a site is required to pick one.`),this.slug=e,this.count=s,this.name="AmbiguousPageSlugError"}}const C=(t,e,s)=>{const o=new URLSearchParams({...e?{site:e}:{},...s?{draft:"1"}:{}}).toString();return`/api/storefront/${t}/${o?`?${o}`:""}`},$=t=>`/api/storefront/sites/${encodeURIComponent(t)}/`,Wt=t=>`${$(t)}currencies/`,jt="/api/storefront/media/ingest/";class zt extends Error{constructor(){super("This editor is not connected to a website, so an upload has nowhere to go. Open the page from the website the file should belong to, then try again."),this.name="MediaUploadDestinationError"}}function Kt(){const t=Et();if(!t)throw new zt;return`${jt}?${new URLSearchParams({site:t})}`}const Vt="X-Puck-Media-Manifest",Y=ct.contentHash,_={"X-Media-Manifest":Y,[Vt]:Y},he=Q({});function Q(t){return(e,s={})=>{const o=St(),l=t.headers||o?{...o?{"Accept-Language":o}:{},...t.headers,...s.headers}:void 0;return i(e,{...s,...t.baseUrl!==void 0?{baseUrl:t.baseUrl}:{},...l?{headers:l}:{},audience:t.audience??mt()})}}function Xt(t={}){const e=Q(t),s=t.siteDrafts===!0,o=a=>C("header-settings",a,s),l=a=>C("theme-settings",a,s),p=a=>C("chat-settings",a,s),w=a=>C("social-settings",a,s);return{findPageBySlug:async(a,r,n)=>{const c=new URLSearchParams({slug:a});n&&c.set("site",n);const y=await e(`/api/storefront/pages/?${c.toString()}`,{token:r}),S=Array.isArray(y)?y:y.results??[];if(!n&&S.length>1)throw new Gt(a,S.length);return S[0]??null},getPageById:(a,r)=>e(`/api/storefront/pages/${a}/`,{token:r}),saveLayout:(a,r,n,c,y)=>e(`/api/storefront/pages/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r,expected_updated_at:c,...y?{client_id:y}:{}}),token:n}),duplicatePage:(a,r,n)=>e(`/api/storefront/pages/${a}/duplicate/`,{method:"POST",body:JSON.stringify({title:r.title,slug:r.slug}),token:n}),geocode:(a,r,n)=>e(`/api/storefront/geocode/?${new URLSearchParams(n?{q:a,country:n}:{q:a})}`,{token:r}),listBlockSources:a=>e("/api/storefront/block-sources/",{token:a}),listRecordTypes:a=>e("/api/storefront/record-types/",{token:a}),createPagePreviewLink:(a,r)=>e(`/api/storefront/pages/${a}/preview-link/`,{method:"POST",token:r}),claimPageEditLock:(a,r,n,c=!1)=>e(`/api/storefront/pages/${a}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:n,takeover:c}),token:r}),releasePageEditLock:(a,r)=>e(`/api/storefront/pages/${a}/edit-lock/`,{method:"DELETE",token:r}),createTemplate:(a,r,n)=>e("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:a,layout:r}),headers:_,token:n}),getTemplate:(a,r)=>e(`/api/storefront/page-templates/${a}/`,{token:r}),saveTemplateLayout:(a,r,n)=>e(`/api/storefront/page-templates/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r}),headers:_,token:n}),listTemplatePages:async(a,r)=>{const n=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(a)}`,{token:r});return Array.isArray(n)?n:n.results??[]},findTemplatePageBySlug:async(a,r,n)=>{const c=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(a)}&slug=${encodeURIComponent(r)}`,{token:n});return(Array.isArray(c)?c:c.results??[])[0]??null},createTemplatePage:(a,r,n)=>e("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:a,...r}),headers:_,token:n}),saveTemplatePageLayout:(a,r,n)=>e(`/api/storefront/template-pages/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r}),headers:_,token:n}),deleteTemplatePage:(a,r,n)=>e(`/api/storefront/template-pages/${a}/`,{method:"DELETE",token:r,...n?.keepalive?{keepalive:!0}:{}}),listPages:async(a,r)=>{const n=new URLSearchParams({no_page:"true"});r&&n.set("site",r);const c=await e(`/api/storefront/pages/?${n.toString()}`,{token:a});return Array.isArray(c)?c:c.results??[]},createPage:(a,r,n,c)=>e("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:a,slug:r,layout:n}),token:c}),deletePage:(a,r)=>e(`/api/storefront/pages/${a}/`,{method:"DELETE",token:r}),getHeaderSettings:(a,r)=>e(o(r),{token:a}),listMenus:async(a,r)=>{const n=new URLSearchParams({no_page:"true"});r&&n.set("site",r);const c=await e(`/api/storefront/menus/?${n}`,{token:a});return Array.isArray(c)?c:c.results??[]},listBlogPosts:async(a,r={})=>{const n=new URLSearchParams({no_page:"true"});r.visibleOnly&&n.set("is_visible","true"),r.siteId&&n.set("site",r.siteId);const c=await e(`/api/storefront/blog-posts/?${n.toString()}`,{token:a});return Array.isArray(c)?c:c.results??[]},listFieldUsage:async(a,r)=>{const n=await e(`/api/storefront/field-usage/?site=${encodeURIComponent(r)}`,{token:a});return Array.isArray(n?.entries)?n.entries:[]},listCategories:async(a,r={})=>{const n=new URLSearchParams({no_page:"true"});r.visibleOnly&&n.set("is_visible","true"),r.siteId&&n.set("site",r.siteId);const c=await e(`/api/storefront/categories/?${n.toString()}`,{token:a});return[...Array.isArray(c)?c:c.results??[]].sort((S,R)=>S.sort_order-R.sort_order||S.name.localeCompare(R.name))},listForms:async(a,r={})=>{const n=new URLSearchParams({no_page:"true"});r.siteId&&n.set("site",r.siteId);const c=await e(`/api/storefront/forms/?${n.toString()}`,{token:a});return[...Array.isArray(c)?c:c.results??[]].sort((S,R)=>S.title.localeCompare(R.title))},listWheelSummaries:async(a,r={})=>{const n=new URLSearchParams;r.siteId&&n.set("site",r.siteId);const c=n.toString(),y=await e(`/api/storefront/wheel-curations/summaries/${c?`?${c}`:""}`,{token:a});return g(y)},listProducts:async(a,r={})=>{const n=new URLSearchParams;r.kinds?.length&&n.set("kind",r.kinds.join(",")),r.siteId&&n.set("site",r.siteId);const c=n.toString(),y=await e(`/api/storefront/products/${c?`?${c}`:""}`,{token:a});return g(y)},getWheelDetail:async(a,r,n={})=>{const c=new URLSearchParams({slug:r});return n.siteId&&c.set("site",n.siteId),L(g(await e(`/api/storefront/wheel-curations/detail/?${c.toString()}`,{token:a})))},updateHeaderSettings:(a,r,n)=>e(o(n),{method:"PATCH",body:JSON.stringify(a),token:r}),getSite:(a,r)=>e($(a),{token:r}),listSites:async a=>{const r=await e("/api/storefront/sites/?no_page=true",{token:a});return Array.isArray(r)?r:r.results??[]},listSiteCurrencies:async(a,r)=>{const n=await e(Wt(a),{token:r});return Array.isArray(n)?n:[]},publishSite:(a,r)=>e(`${$(a)}publish/`,{method:"POST",token:r}),getSiteLiveState:(a,r)=>e(`${$(a)}live-state/`,{token:r}),getThemeSettings:(a,r)=>e(l(r),{token:a}),updateThemeSettings:(a,r,n)=>e(l(n),{method:"PATCH",body:JSON.stringify(a),token:r}),getChatSettings:(a,r)=>e(p(r),{token:a}),updateChatSettings:(a,r,n)=>e(p(n),{method:"PATCH",body:JSON.stringify(a),token:r}),getSocialSettings:(a,r)=>e(w(r),{token:a}),updateSocialSettings:(a,r,n)=>e(w(n),{method:"PATCH",body:JSON.stringify(a),token:r}),uploadHeaderLogo:(a,r,n)=>{const c=new FormData;return c.append("logo",a),e(o(n),{method:"PATCH",body:c,token:r})},clearHeaderLogo:(a,r)=>e(o(r),{method:"PATCH",body:JSON.stringify({logo:null}),token:a}),setHeaderLogoFromAsset:(a,r,n)=>e(o(n),{method:"PATCH",body:JSON.stringify({logo_asset_id:a}),token:r}),uploadMedia:async(a,r)=>{const n=new FormData;return n.append("file",a),e(Kt(),{method:"POST",body:n,token:r})},listMedia:async(a,r)=>{const n=new URLSearchParams({no_page:"true"});r&&n.set("kind",r);const c=await e(`/api/storefront/media-assets/?${n.toString()}`,{token:a});return Array.isArray(c)?c:c.results??[]}}}const fe=Xt({siteDrafts:!0});export{ut as API_URL,Gt as AmbiguousPageSlugError,m as ApiError,ht as BROWSER_READ_TIMEOUT_MS,pt as EFFICIENT_CLIENT_CLOSED_MESSAGE,zt as MediaUploadDestinationError,Mt as PREVIEW_PARAM,we as PRODUCT_API_BASE,yt as SERVER_READ_TIMEOUT_MS,U as SERVER_UNREACHABLE_MESSAGE,I as STATUS_NETWORK_ERROR,he as adminFetch,Ot as api,i as apiFetch,E as appendSiteQuery,ye as bookings,Xt as createStorefrontAdmin,D as defaultRequestDeadline,Kt as editorMediaUploadPath,mt as editorPortalAudience,St as editorRequestLanguage,le as fitment,pe as products,ft as readDeadlineMs,Dt as resolveClientIp,g as resolveMediaUrls,Ft as resolvePreviewToken,Z as resolveSiteHost,Lt as resolveSiteHostSource,xt as resolveSiteSlug,oe as setEditorLanguage,ne as setEditorPortalAudience,fe as storefrontAdmin};
|
|
@@ -1391,7 +1391,7 @@ export interface components {
|
|
|
1391
1391
|
foundedYear: number | null;
|
|
1392
1392
|
commerceEnabled: boolean;
|
|
1393
1393
|
cardPayments: boolean;
|
|
1394
|
-
paymentMethods: ("card" | "paypal" | "afterpay" | "square" | "gocardless" | "zip" | "klarna")[];
|
|
1394
|
+
paymentMethods: ("card" | "paypal" | "afterpay" | "square" | "gocardless" | "zip" | "klarna" | "bank")[];
|
|
1395
1395
|
paypalClientId: string | null;
|
|
1396
1396
|
paypalEnvironment: "live" | "sandbox" | null;
|
|
1397
1397
|
squareApplicationId: string | null;
|
|
@@ -1401,8 +1401,6 @@ export interface components {
|
|
|
1401
1401
|
googleAdsId: string | null;
|
|
1402
1402
|
googleAdsConversionLabel: string | null;
|
|
1403
1403
|
metaPixelId: string | null;
|
|
1404
|
-
mapsApiKey: string | null;
|
|
1405
|
-
mapsMapId: string | null;
|
|
1406
1404
|
socialLinks?: components["schemas"]["SiteSocialLinks"];
|
|
1407
1405
|
consentEnabled?: boolean;
|
|
1408
1406
|
consentPrivacyPage?: string | null;
|
|
@@ -1933,6 +1931,7 @@ export interface components {
|
|
|
1933
1931
|
customerEmail?: string;
|
|
1934
1932
|
country?: string;
|
|
1935
1933
|
subdivision?: string;
|
|
1934
|
+
postcode?: string;
|
|
1936
1935
|
};
|
|
1937
1936
|
CartQuoteTax: {
|
|
1938
1937
|
name: string;
|
|
@@ -1971,6 +1970,11 @@ export interface components {
|
|
|
1971
1970
|
grandTotal: number;
|
|
1972
1971
|
currency: components["schemas"]["Currency"];
|
|
1973
1972
|
deliveryOptions: components["schemas"]["DeliveryOption"][];
|
|
1973
|
+
courier: components["schemas"]["CartQuoteCourier"] | null;
|
|
1974
|
+
};
|
|
1975
|
+
CartQuoteCourier: {
|
|
1976
|
+
status: "quoted" | "unavailable";
|
|
1977
|
+
reason: string;
|
|
1974
1978
|
};
|
|
1975
1979
|
CountrySubdivision: {
|
|
1976
1980
|
code: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const r=void 0,n={hour:"numeric",minute:"2-digit"},o={weekday:"long",day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"};function i(t,e){try{return new Intl.DateTimeFormat(void 0,{...n,timeZone:e}).format(new Date(t))}catch{return new Date(t).toLocaleTimeString([],n)}}function m(t,e){try{return new Intl.DateTimeFormat(void 0,{...o,timeZone:e}).format(new Date(t))}catch{return new Date(t).toLocaleString()}}export{m as formatAppointment,i as formatAppointmentTime};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{variantsFittingVehicle as
|
|
1
|
+
import{variantsFittingVehicle as P}from"../wheels/plp-fitment-match.js";import{FALLBACK_FINISH as B}from"../wheels/finish-defaults.js";import{variantEtKey as y,variantSizeGroupKey as V,variantSizeGroupLabel as F,variantSizeGroupNote as N}from"../wheels/variant-spec.js";import{trimDecimal as S}from"../wheels/spec-format.js";import{findVariant as D,isVariantOutOfStock as O}from"../wheels/variants.js";import{HAND_WORDS as x,NOT_HANDED_WORDS as A,variantIsHanded as b}from"../wheels/set-mode.js";const g="handed",k="plain";function T(t){const l=t.variants??[],i=t.finishes.map(e=>({value:e.name,label:e.name,swatch:e.color}));function s(e){const a=[];for(const v of l){const h=e(v);!h||a.some(z=>z.value===h.value)||a.push(h)}return a}const f=s(e=>({value:V(e),label:F(e),note:N(e)})),p=s(e=>e.boltPattern?{value:e.boltPattern,label:e.boltPattern}:null),m=s(e=>{const a=y(e);return a===null?null:{value:a,label:`ET ${a}`}}),n=s(e=>e.centreBore==null?null:{value:S(e.centreBore),label:`${S(e.centreBore)} mm`}),o=l.some(b),r=o?s(e=>({value:b(e)?g:k,label:b(e)?x:A})):[],c=l.map(e=>({id:`${e.finishName}|${e.size}`,options:{finish:e.finishName,size:V(e),variantSize:e.size,...e.boltPattern?{boltPattern:e.boltPattern}:{},...y(e)!==null?{et:y(e)}:{},...e.centreBore==null?{}:{centreBore:S(e.centreBore)},...o?{pairing:b(e)?g:k}:{}},inStock:!O(e),image:null,components:e.components})),u=((t.defaultFinish?i.find(e=>e.value===t.defaultFinish):void 0)??i[0])?.value;return{kind:"alloy-wheel",source:t,slug:t.slug,name:t.name,eyebrow:t.process,badge:t.badge==="new"?"New 2026":t.badge?"Bestseller":"",href:`/wheels/${t.slug}`,crumbs:[{label:"Home",href:"/"},{label:"Wheels",href:"/wheels"},{label:t.process,href:"/wheels"},{label:t.name}],cover:t.coverImage??null,inStock:t.inStock===!0,mediaGroups:t.mediaGroups,optionFields:[{key:"finish",label:"Finish",prompt:"Select a finish",role:"resolves",display:"swatch",defaultValue:u},{key:"size",label:"Size",prompt:"Select a size",role:"resolves",display:"pill",empty:{text:"This wheel isn't available to order online in this finish.",linkText:"Contact us about it →",href:"/contact"}},{key:"boltPattern",label:"Bolt pattern",prompt:"Select a bolt pattern",role:"describes",display:"pill"},{key:"et",label:"Offset",prompt:"Select an offset",role:"describes",display:"pill"},{key:"centreBore",label:"Centre bore",prompt:"Select a centre bore",role:"describes",display:"pill"},{key:"pairing",label:"Wheels",prompt:"Select a pairing",role:"describes",display:"pill"}],optionValues:{finish:i,size:f,boltPattern:p,et:m,centreBore:n,pairing:r},parts:c,anchorPrices:t.prices,anchorMsrpPrices:t.msrpPrices??{}}}function _(t,l){if(t.kind!=="alloy-wheel"||l===null)return t;const i=new Set(P(t.source.variants??[],l));if(i.size===0)return t;const s=t.parts.filter(n=>{const o=H(t.source,n);return o!==null&&i.has(o)});if(s.length===0||s.length===t.parts.length)return t;const f=(n,o)=>new Set(n.map(r=>r.options[o]).filter(r=>r!==void 0)),p={},m=[];for(const n of t.optionFields){const o=f(t.parts,n.key),r=f(s,n.key),c=(t.optionValues[n.key]??[]).filter(u=>r.has(u.value)||!o.has(u.value));p[n.key]=c;const d=n.defaultValue!==void 0&&!c.some(u=>u.value===n.defaultValue)?c[0]?.value:n.defaultValue;m.push(d===n.defaultValue?n:{...n,defaultValue:d})}return{...t,optionFields:m,optionValues:p,parts:s}}function H(t,l){return l?D(t.variants??[],l.options.finish,l.options.variantSize)??null:null}function C(t,l){return t.finishes.find(i=>i.name===l)??t.finishes[0]??B}export{T as fromWheel,H as partVariant,C as wheelFinish,_ as wheelForVehicle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseTyreSize as l}from"../tyres/tyre-size.js";const s=["alloy-wheel","tyre"],u=["alloy-wheel"],
|
|
1
|
+
import{parseTyreSize as l}from"../tyres/tyre-size.js";const s=["alloy-wheel","tyre"],u=["alloy-wheel"],p={"alloy-wheel":"Alloy wheels",tyre:"Tyres"},m="All products",x="All product types";function P(e){return e.length===1&&e[0]==="alloy-wheel"?{one:"wheel",many:"wheels"}:e.length===1&&e[0]==="tyre"?{one:"tyre",many:"tyres"}:{one:"product",many:"products"}}const d=s.map(e=>({value:e,label:p[e]}));function w(e){return e==null?[...u]:Array.isArray(e)?s.filter(r=>e.includes(r)):[...u]}const t=e=>e;function o(e){return t(e).kind==="tyre"?"tyre":"alloy-wheel"}function A(e,r){return e.filter(n=>r.includes(o(n)))}function L(e){return t(e).slug??""}function h(e){return t(e).name??""}function c(e){return t(e).brand??""}function S(e){const r=new Set;for(const n of e)if(r.add(c(n)),r.size>1)return!0;return!1}function f(e){return t(e).process??""}function _(e){const r=new Set;for(const n of e)if(r.add(f(n)),r.size>1)return!0;return!1}function g(e){return t(e).prices??void 0}function T(e){return t(e).inStock!==!1}function N(e){const r=t(e),n=o(e)==="tyre"?r.rimDiameters:r.sizes;return Array.isArray(n)?n.filter(i=>typeof i=="number"&&Number.isFinite(i)):[]}function D(e){return o(e)!=="tyre"&&t(e).badge==="new"}function a(e){return o(e)==="tyre"?[]:(t(e).finishes??[]).filter(r=>typeof r?.family=="string").map(r=>({family:r.family,color:r.color??null}))}function I(e){return a(e).map(r=>r.family)}function K(e){if(o(e)==="tyre")return[];const r=t(e);return Array.isArray(r.categories)?r.categories:r.process?[r.process]:[]}function z(e){return o(e)==="tyre"?[]:t(e).spec?.pcds??[]}function E(e){return o(e)!=="tyre"?[]:t(e).tyreTypes??[]}function B(e){return o(e)!=="tyre"?[]:t(e).speedRatings??[]}function F(e){if(o(e)!=="tyre")return[];const r=t(e).sizes;return Array.isArray(r)?r.map(n=>l(typeof n=="string"?n:null)).filter(n=>n!==null):[]}export{x as PLP_ALL_TYPES_LABEL,m as PLP_ANY_TYPE_LABEL,u as PLP_DEFAULT_KINDS,s as PLP_KINDS,p as PLP_KIND_LABELS,d as PRODUCT_KIND_OPTIONS,c as itemBrand,K as itemCollections,N as itemDiameters,I as itemFinishFamilies,a as itemFinishes,T as itemInStock,D as itemIsNew,o as itemKind,h as itemName,z as itemPcds,g as itemPrices,f as itemProcess,L as itemSlug,B as itemSpeedRatings,F as itemTyreSizes,E as itemTyreTypes,S as plpBrandVaries,A as plpItemsOfKinds,P as plpKindNoun,_ as plpProcessVaries,w as resolvePlpKinds};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface StripeAppearance {
|
|
2
|
+
theme: "night" | "stripe";
|
|
3
|
+
variables: {
|
|
4
|
+
colorPrimary: string;
|
|
5
|
+
colorBackground: string;
|
|
6
|
+
colorText: string;
|
|
7
|
+
borderRadius: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export declare function stripeAppearance(): StripeAppearance | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{rootIsDark as a}from"efficient-shell/format";function f(){if(typeof document>"u")return;const r=getComputedStyle(document.documentElement),t=(o,n)=>r.getPropertyValue(o).trim()||n,e=a({whenUnset:!0});return{theme:e?"night":"stripe",variables:{colorPrimary:t("--accent",e?"#c9a461":"#8a6a2a"),colorBackground:t("--site-surface",e?"#131313":"#ffffff"),colorText:t("--fg",e?"#f5f1e8":"#0a0a0a"),borderRadius:"0px"}}}export{f as stripeAppearance};
|
|
@@ -8,7 +8,7 @@ export interface WalletContext {
|
|
|
8
8
|
idempotencyKey: string;
|
|
9
9
|
confirmation: OrderConfirmation;
|
|
10
10
|
}
|
|
11
|
-
export type LandingOrder = Pick<OrderConfirmation, "orderNumber"
|
|
11
|
+
export type LandingOrder = Pick<OrderConfirmation, "orderNumber"> & Partial<Pick<OrderConfirmation, "currency" | "grandTotal" | "freightCharge" | "discountAmount" | "shippingMethod" | "couponCode">>;
|
|
12
12
|
export type WalletReturn<C> = {
|
|
13
13
|
action: "ignore";
|
|
14
14
|
} | {
|
|
@@ -38,5 +38,6 @@ export declare function packLabel(choice: PurchaseChoice): string;
|
|
|
38
38
|
export declare const ADD_TO_BASKET_ATTR = "data-add-to-basket";
|
|
39
39
|
export declare const MAX_QTY_PER_LINE = 9;
|
|
40
40
|
export declare const PRICE_LOCALE = "en";
|
|
41
|
+
export declare function currencyFormat(currency: string, minimumFractionDigits?: number, maximumFractionDigits?: number): Intl.NumberFormat;
|
|
41
42
|
export declare function formatPrice(amount: number, currency: string, decimalPlaces?: number): string;
|
|
42
43
|
export declare function formatMoneyInCurrency(amount: number, currency: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const E=4;function x(e,t){return e.map(r=>({partNumber:r.partNumber,quantity:r.wheels*t}))}function S(e,t){if(e.length===0)return null;let r=0;for(const s of e){const n=s.prices?.[t];if(typeof n!="number"||!Number.isFinite(n)||n<=0)return null;r+=n*s.wheels}return r}const u=4,_=1,h={unit:"set",spares:0,spareSide:"left"};function f(e){return e.unit==="single"?1:u+e.spares}function P(e,t){return[{partNumber:e.partNumber,wheels:f(t),prices:e.prices}]}function T(e,t){const r=f(t)-u;if(r<=0||e.length===0)return e;const s=l(e),n=s?s[t.spareSide]:0;return e.map((o,a)=>a===n?{...o,wheels:o.wheels+r}:o)}function l(e){let t,r;for(let s=0;s<e.length;s+=1){const n=e[s].hand;if(n!=="left"&&n!=="right")continue;if((n==="left"?t:r)!==void 0)return null;n==="left"?t=s:r=s}return t!==void 0&&r!==void 0?{left:t,right:r}:null}function y(e){const t=typeof e.spares=="number"?e.spares:e.spare?1:0;return{unit:e.unit,spares:t,spareSide:e.spareSide??"left"}}function c(e,t){return t.spares>0?`${e} + spare`:e}function b(e){return e.unit==="single"?"Single":c(`Set of ${u}`,e)}const A="data-add-to-basket",C=9,d="en",p=new Map;function i(e,t,r){const s=`${e}|${t??""}|${r??""}`;let n=p.get(s);return n||(n=new Intl.NumberFormat(d,{style:"currency",currency:e,...t===void 0?{}:{minimumFractionDigits:t},...r===void 0?{}:{maximumFractionDigits:r}}),p.set(s,n)),n}function g(e,t,r=0){return i(t,0,r).format(e)}function w(e,t){return i(t).format(e)}export{A as ADD_TO_BASKET_ATTR,h as DEFAULT_PURCHASE_CHOICE,C as MAX_QTY_PER_LINE,_ as MAX_SPARES,d as PRICE_LOCALE,u as UNITS_PER_SET,E as WHEELS_PER_SET,i as currencyFormat,w as formatMoneyInCurrency,g as formatPrice,x as orderLinesForSets,P as packComposition,b as packLabel,y as purchaseChoiceFromPack,T as setPackComposition,S as setPrice,l as spareTargetsByHand,f as unitsPerPack,c as withSpare};
|