efficient-storefront-blocks 0.86.0 → 0.88.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 +37 -0
- package/dist/chunks/{EditorPreviewCheckout-4LNXFNN7.js → EditorPreviewCheckout-ZGPS3Q3X.js} +1 -1
- package/dist/chunks/{SiteEditorProvider-A2HMVDKS.js → SiteEditorProvider-HZ47WOEX.js} +1 -1
- package/dist/chunks/{chunk-TGBNREUJ.js → chunk-7C2YH2AQ.js} +1 -1
- package/dist/chunks/chunk-O7GCI2MP.js +1 -0
- package/dist/chunks/chunk-RHNDIM7Z.js +382 -0
- package/dist/chunks/chunk-VOK5N3IB.js +1 -0
- package/dist/chunks/{fitment-data-TSYW6AFA.js → fitment-data-SH4US3BV.js} +1 -1
- package/dist/contract.js +32 -2
- package/dist/editor/components/CategorySource.d.ts +8 -1
- package/dist/editor/components/CategorySource.js +1 -1
- package/dist/editor/components/CollectionPicker.js +1 -1
- package/dist/editor/components/EditProductLink.js +1 -1
- package/dist/editor/components/FinishPicker.js +1 -1
- package/dist/editor/components/FormPicker.js +1 -1
- package/dist/editor/components/GalleryShowcaseSource.js +1 -1
- package/dist/editor/components/HeaderSettingsPanel.js +1 -1
- package/dist/editor/components/ProductHeroSource.js +1 -1
- package/dist/editor/components/ProductPicker.js +1 -1
- package/dist/editor/components/ReviewsProductSource.js +1 -1
- package/dist/editor/components/SocialLinksDoor.js +1 -1
- package/dist/editor/components/SpecTableSource.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/BundleOffer/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/FilterBlock/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/commerce/FilterBlock/fields.js +1 -0
- package/dist/editor/lib/document/blocks/commerce/FilterChipsBlock/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/commerce/FilterChipsBlock/fields.js +1 -0
- package/dist/editor/lib/document/blocks/commerce/GalleryItem/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/ProductBuy/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/commerce/ProductBuy/fields.js +1 -0
- package/dist/editor/lib/document/blocks/commerce/ProductBuyButton/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/commerce/ProductBuyButton/fields.js +1 -0
- package/dist/editor/lib/document/blocks/commerce/ProductEyebrow/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/commerce/ProductEyebrow/fields.js +1 -0
- package/dist/editor/lib/document/blocks/commerce/ProductGrid/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/ProductName/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/commerce/ProductName/fields.js +1 -0
- package/dist/editor/lib/document/blocks/commerce/ProductPicture/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/commerce/ProductPicture/fields.js +1 -0
- package/dist/editor/lib/document/blocks/commerce/ProductSpecs/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/commerce/ProductSpecs/fields.js +1 -0
- package/dist/editor/lib/document/blocks/commerce/RelatedProducts/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/controls.d.ts +4 -0
- package/dist/editor/lib/document/blocks/commerce/controls.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/index.d.ts +1 -1
- package/dist/editor/lib/document/blocks/commerce/index.js +1 -1
- package/dist/editor/lib/document/config.js +1 -1
- package/dist/editor/lib/document/section-text-regions.js +1 -1
- package/dist/editor/lib/editor-words-kept.d.ts +1 -0
- package/dist/editor/lib/editor-words-kept.js +1 -0
- package/dist/editor/lib/efficient-backend.d.ts +7 -1
- package/dist/editor/lib/efficient-backend.js +1 -1
- package/dist/editor/lib/storefront-document.js +1 -1
- package/dist/editor/lib/storefront-editor-words.d.ts +40 -12
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/editor.css +1 -1
- package/dist/fitment.js +1 -1
- package/dist/index.js +136 -83
- package/dist/links.js +1 -1
- package/dist/render/app/fonts/fallbacks.css +8 -0
- package/dist/render/app/fonts/jost/OFL.txt +93 -0
- package/dist/render/app/fonts/jost/cyrillic-italic.woff2 +0 -0
- package/dist/render/app/fonts/jost/cyrillic.woff2 +0 -0
- package/dist/render/app/fonts/jost/latin-ext-italic.woff2 +0 -0
- package/dist/render/app/fonts/jost/latin-ext.woff2 +0 -0
- package/dist/render/app/fonts/jost/latin-italic.woff2 +0 -0
- package/dist/render/app/fonts/jost/latin.woff2 +0 -0
- package/dist/render/app/globals.css +122 -11
- package/dist/render/built-with.json +1 -1
- package/dist/render/components/BundleCard.d.ts +2 -1
- package/dist/render/components/BundleCard.js +1 -1
- package/dist/render/components/Events.js +1 -1
- package/dist/render/components/FitmentTable.d.ts +1 -1
- package/dist/render/components/FitmentTable.js +1 -1
- package/dist/render/components/FooterMenu.d.ts +5 -1
- package/dist/render/components/FooterMenu.js +1 -1
- package/dist/render/components/GalleryGrid.js +1 -1
- package/dist/render/components/GalleryItem.d.ts +11 -1
- package/dist/render/components/GalleryItem.js +1 -1
- package/dist/render/components/GridCardTemplate.d.ts +40 -0
- package/dist/render/components/GridCardTemplate.js +1 -0
- package/dist/render/components/MenuLinkBlock.d.ts +5 -1
- package/dist/render/components/MenuLinkBlock.js +1 -1
- package/dist/render/components/ProductCardChrome.d.ts +1 -1
- package/dist/render/components/ProductCardChrome.js +1 -1
- package/dist/render/components/ProductGridSection.d.ts +9 -15
- package/dist/render/components/ProductGridSection.js +1 -1
- package/dist/render/components/ProductHeroPanel.js +1 -1
- package/dist/render/components/ProductRef.d.ts +8 -2
- package/dist/render/components/ProductRef.js +1 -1
- package/dist/render/components/SectionBand.d.ts +3 -2
- package/dist/render/components/SectionBand.js +1 -1
- package/dist/render/components/StorefrontProviders.d.ts +1 -1
- package/dist/render/components/StorefrontProviders.js +1 -1
- package/dist/render/components/TyreCard.js +1 -1
- package/dist/render/components/TyreFitVerdicts.d.ts +2 -1
- package/dist/render/components/TyreFitVerdicts.js +1 -1
- package/dist/render/components/TyrePlpCard.js +1 -1
- package/dist/render/components/card-pieces/CardBuyButton.d.ts +8 -1
- package/dist/render/components/card-pieces/CardBuyButton.js +1 -1
- package/dist/render/components/card-pieces/CardEyebrow.d.ts +3 -1
- package/dist/render/components/card-pieces/CardEyebrow.js +1 -1
- package/dist/render/components/card-pieces/CardName.d.ts +4 -1
- package/dist/render/components/card-pieces/CardName.js +1 -1
- package/dist/render/components/card-pieces/CardPrice.d.ts +2 -6
- package/dist/render/components/card-pieces/CardPrice.js +1 -1
- package/dist/render/components/card-pieces/CardProductBadge.d.ts +2 -1
- package/dist/render/components/card-pieces/CardProductBadge.js +1 -1
- package/dist/render/components/card-pieces/CardProductPicture.d.ts +13 -0
- package/dist/render/components/card-pieces/CardProductPicture.js +1 -0
- package/dist/render/components/card-pieces/CardSpecs.js +1 -1
- package/dist/render/components/card-pieces/HostPart.js +1 -1
- package/dist/render/components/card-pieces/ProductCardState.d.ts +25 -6
- package/dist/render/components/card-pieces/ProductCardState.js +1 -1
- package/dist/render/components/card-pieces/card-text-region.d.ts +18 -0
- package/dist/render/components/card-pieces/card-text-region.js +1 -0
- package/dist/render/components/catalog/CatalogFilterContext.d.ts +4 -1
- package/dist/render/components/catalog/CatalogFilterContext.js +1 -1
- package/dist/render/components/catalog/ClearAllButton.d.ts +4 -0
- package/dist/render/components/catalog/ClearAllButton.js +1 -0
- package/dist/render/components/catalog/FilterPill.d.ts +4 -2
- package/dist/render/components/catalog/FilterPill.js +1 -1
- package/dist/render/components/catalog/ShopperChips.d.ts +13 -0
- package/dist/render/components/catalog/ShopperChips.js +1 -0
- package/dist/render/components/catalog/ShopperFilters.d.ts +20 -0
- package/dist/render/components/catalog/ShopperFilters.js +1 -0
- package/dist/render/components/catalog/ShopperScope.d.ts +72 -0
- package/dist/render/components/catalog/ShopperScope.js +3 -0
- package/dist/render/components/catalog/SortSelect.js +1 -1
- package/dist/render/components/fitment/StockFitmentPart.d.ts +8 -1
- package/dist/render/components/fitment/StockFitmentPart.js +1 -1
- package/dist/render/components/fitment/fitment-answer-source.d.ts +12 -0
- package/dist/render/components/fitment/fitment-answer-source.js +1 -0
- package/dist/render/components/pdp-dynamic/DynamicFitmentTable.js +1 -1
- package/dist/render/components/pdp-dynamic/DynamicRelatedProducts.d.ts +10 -12
- 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/DynamicTyreSizes.js +1 -1
- package/dist/render/components/wheels-plp/AlloyWheelsListing.js +1 -1
- package/dist/render/components/wheels-plp/PlpActiveChips.js +1 -1
- package/dist/render/components/wheels-plp/PlpCard.d.ts +1 -1
- package/dist/render/components/wheels-plp/PlpCard.js +1 -1
- package/dist/render/components/wheels-plp/PlpPagination.d.ts +2 -1
- package/dist/render/components/wheels-plp/PlpPagination.js +1 -1
- package/dist/render/components/wheels-plp/PlpSidebar.js +1 -1
- package/dist/render/components/wheels-plp/usePlpFiltersInUrl.d.ts +2 -0
- package/dist/render/components/wheels-plp/usePlpFiltersInUrl.js +1 -1
- package/dist/render/lib/api/index.d.ts +6 -0
- package/dist/render/lib/api/index.js +1 -1
- package/dist/render/lib/catalog/related-cards.d.ts +4 -1
- package/dist/render/lib/catalog/relationships.d.ts +9 -2
- package/dist/render/lib/catalog/relationships.js +1 -1
- package/dist/render/lib/commerce.d.ts +2 -0
- package/dist/render/lib/commerce.js +1 -1
- package/dist/render/lib/content/article-body.js +1 -5
- package/dist/render/lib/content/field-usage.d.ts +1 -0
- package/dist/render/lib/content/field-usage.js +1 -1
- package/dist/render/lib/content/filter-card-seed.d.ts +10 -0
- package/dist/render/lib/content/filter-card-seed.js +1 -0
- package/dist/render/lib/content/product-card-seed.d.ts +34 -0
- package/dist/render/lib/content/product-card-seed.js +1 -0
- package/dist/render/lib/content/tab-strip.d.ts +17 -0
- package/dist/render/lib/content/tab-strip.js +1 -0
- package/dist/render/lib/document/blocks/commerce/BundleOffer/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/BundleOffer/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/FilterBlock/meta.d.ts +8 -0
- package/dist/render/lib/document/blocks/commerce/FilterBlock/meta.js +1 -0
- package/dist/render/lib/document/blocks/commerce/FilterBlock/render.d.ts +2 -0
- package/dist/render/lib/document/blocks/commerce/FilterBlock/render.js +1 -0
- package/dist/render/lib/document/blocks/commerce/FilterChipsBlock/meta.d.ts +8 -0
- package/dist/render/lib/document/blocks/commerce/FilterChipsBlock/meta.js +1 -0
- package/dist/render/lib/document/blocks/commerce/FilterChipsBlock/render.d.ts +2 -0
- package/dist/render/lib/document/blocks/commerce/FilterChipsBlock/render.js +1 -0
- package/dist/render/lib/document/blocks/commerce/GalleryB/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/GalleryItem/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductBuy/meta.d.ts +2 -0
- package/dist/render/lib/document/blocks/commerce/ProductBuy/meta.js +1 -0
- package/dist/render/lib/document/blocks/commerce/ProductBuy/render.d.ts +2 -0
- package/dist/render/lib/document/blocks/commerce/ProductBuy/render.js +1 -0
- package/dist/render/lib/document/blocks/commerce/ProductBuyButton/meta.d.ts +2 -0
- package/dist/render/lib/document/blocks/commerce/ProductBuyButton/meta.js +1 -0
- package/dist/render/lib/document/blocks/commerce/ProductBuyButton/render.d.ts +2 -0
- package/dist/render/lib/document/blocks/commerce/ProductBuyButton/render.js +1 -0
- package/dist/render/lib/document/blocks/commerce/ProductEyebrow/meta.d.ts +2 -0
- package/dist/render/lib/document/blocks/commerce/ProductEyebrow/meta.js +1 -0
- package/dist/render/lib/document/blocks/commerce/ProductEyebrow/render.d.ts +2 -0
- package/dist/render/lib/document/blocks/commerce/ProductEyebrow/render.js +1 -0
- package/dist/render/lib/document/blocks/commerce/ProductGrid/meta.d.ts +4 -0
- package/dist/render/lib/document/blocks/commerce/ProductGrid/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductGrid/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductHero/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductName/meta.d.ts +2 -0
- package/dist/render/lib/document/blocks/commerce/ProductName/meta.js +1 -0
- package/dist/render/lib/document/blocks/commerce/ProductName/render.d.ts +2 -0
- package/dist/render/lib/document/blocks/commerce/ProductName/render.js +1 -0
- package/dist/render/lib/document/blocks/commerce/ProductPicture/meta.d.ts +2 -0
- package/dist/render/lib/document/blocks/commerce/ProductPicture/meta.js +1 -0
- package/dist/render/lib/document/blocks/commerce/ProductPicture/render.d.ts +2 -0
- package/dist/render/lib/document/blocks/commerce/ProductPicture/render.js +1 -0
- package/dist/render/lib/document/blocks/commerce/ProductPrice/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductSpecs/meta.d.ts +2 -0
- package/dist/render/lib/document/blocks/commerce/ProductSpecs/meta.js +1 -0
- package/dist/render/lib/document/blocks/commerce/ProductSpecs/render.d.ts +2 -0
- package/dist/render/lib/document/blocks/commerce/ProductSpecs/render.js +1 -0
- package/dist/render/lib/document/blocks/commerce/RelatedProducts/meta.d.ts +0 -4
- package/dist/render/lib/document/blocks/commerce/RelatedProducts/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/RelatedProducts/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/StockFitment/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/metas.d.ts +8 -0
- package/dist/render/lib/document/blocks/commerce/metas.js +1 -1
- package/dist/render/lib/document/blocks/commerce/renders.d.ts +8 -0
- package/dist/render/lib/document/blocks/commerce/renders.js +1 -1
- package/dist/render/lib/document/blocks/text-part-shapes.json +0 -16
- package/dist/render/lib/document/card-templates.d.ts +1 -0
- package/dist/render/lib/document/card-templates.js +1 -1
- package/dist/render/lib/document/document-nodes.d.ts +24 -0
- package/dist/render/lib/document/document-nodes.js +1 -0
- package/dist/render/lib/document/footer-page-blocks.js +1 -1
- package/dist/render/lib/document/lazy-draws.js +1 -1
- package/dist/render/lib/document/render-config.js +1 -1
- package/dist/render/lib/document/storefront-root.js +1 -1
- package/dist/render/lib/font-table.json +209 -1
- package/dist/render/lib/links/link-rules.js +1 -1
- package/dist/render/lib/menu-link.d.ts +2 -0
- package/dist/render/lib/menu-link.js +1 -1
- package/dist/render/lib/next-fonts.js +1 -1
- package/dist/render/lib/sections/bundle-to-grid.d.ts +8 -0
- package/dist/render/lib/sections/bundle-to-grid.js +1 -0
- package/dist/render/lib/sections/catalog-text-size.d.ts +2 -0
- package/dist/render/lib/sections/catalog-text-size.js +1 -1
- package/dist/render/lib/sections/filter-option-rows.d.ts +37 -0
- package/dist/render/lib/sections/filter-option-rows.js +1 -0
- package/dist/render/lib/sections/gallery-toolbar.d.ts +27 -0
- package/dist/render/lib/sections/gallery-toolbar.js +1 -0
- package/dist/render/lib/sections/grid-no-hole.d.ts +4 -0
- package/dist/render/lib/sections/grid-no-hole.js +1 -1
- package/dist/render/lib/sections/product-card-text-regions.d.ts +3 -0
- package/dist/render/lib/sections/product-card-text-regions.js +1 -0
- package/dist/render/lib/sections/product-grid-columns.d.ts +13 -1
- package/dist/render/lib/sections/product-grid-columns.js +1 -1
- package/dist/render/lib/sections/product-grid-pages.d.ts +42 -0
- package/dist/render/lib/sections/product-grid-pages.js +1 -0
- package/dist/render/lib/sections/related-to-grid.d.ts +8 -0
- package/dist/render/lib/sections/related-to-grid.js +1 -0
- package/dist/render/lib/sections/shopper-filters.d.ts +45 -0
- package/dist/render/lib/sections/shopper-filters.js +1 -0
- package/dist/render/lib/storefront-page-groups.d.ts +0 -4
- package/dist/render/lib/storefront-page-groups.js +1 -1
- package/dist/render/lib/tyres/tyre-vehicle-fitment.d.ts +1 -0
- package/dist/render/lib/tyres/tyre-vehicle-fitment.js +1 -1
- package/dist/render/lib/wheels/plp-filters.d.ts +6 -3
- package/dist/render/lib/wheels/plp-filters.js +1 -1
- package/dist/render/lib/wheels/plp-hydrate.d.ts +5 -3
- package/dist/render/lib/wheels/plp-hydrate.js +1 -1
- package/dist/render/lib/wheels/selected-ranges.d.ts +16 -0
- package/dist/render/lib/wheels/selected-ranges.js +1 -0
- package/dist/render/lib/wheels/set-mode.d.ts +10 -0
- package/dist/render/lib/wheels/set-mode.js +1 -1
- package/dist/render/lib/wheels/shopper-first-paint.d.ts +28 -0
- package/dist/render/lib/wheels/shopper-first-paint.js +1 -0
- package/dist/render/lib/wheels/shopper-scope.d.ts +11 -0
- package/dist/render/lib/wheels/shopper-scope.js +1 -0
- package/dist/words.d.ts +92 -15
- package/dist/words.js +6 -6
- package/package.json +4 -4
- package/dist/chunks/chunk-EUKK2IN6.js +0 -1
- package/dist/chunks/chunk-FJRKNPNN.js +0 -340
- package/dist/chunks/chunk-SLRULFYY.js +0 -1
- package/dist/render/components/pdp-dynamic/DynamicBundleOffer.d.ts +0 -13
- package/dist/render/components/pdp-dynamic/DynamicBundleOffer.js +0 -1
- /package/dist/chunks/{chunk-ALMIS7CK.js → chunk-NQLVRCTI.js} +0 -0
- /package/dist/chunks/{chunk-FJRKNPNN.js.LEGAL.txt → chunk-RHNDIM7Z.js.LEGAL.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ApiError as y,PRODUCT_API_BASE as m,apiFetch as l}from"../api/index.js";import{parseTyreSize as u,tyreSizeLabel as c}from"./tyre-size.js";function z(t){if(!t||t.year===null)return null;const{make:n,model:e,year:r,modification:o}=t;return!n||!e||!o?null:{make:n,model:e,year:r,modification:o}}function p(t,n){const e=new URLSearchParams({make:n.make,model:n.model,year:String(n.year),modification:n.modification});return`/api/v1/tyres/${encodeURIComponent(t)}/fitment?${e.toString()}`}function s(t,n=""){return{vehicle:{...t,region:n},status:"unknown",oemSizes:[],variants:[]}}function d(t,n){if(typeof n!="object"||n===null)return s(t);const e=n,r=typeof e.vehicle=="object"&&e.vehicle!==null?e.vehicle:{},o=typeof r.region=="string"?r.region:"",a=e.status;if(a!=="fits"&&a!=="doesNotFit")return s(t,o);const f=Array.isArray(e.variants)?e.variants.filter(i=>typeof i=="object"&&i!==null&&typeof i.sku=="string"&&typeof i.fits=="boolean"):[];return f.length===0?s(t,o):{vehicle:{make:typeof r.make=="string"?r.make:t.make,model:typeof r.model=="string"?r.model:t.model,year:typeof r.year=="number"?r.year:t.year,modification:typeof r.modification=="string"?r.modification:t.modification,region:o},status:a,oemSizes:Array.isArray(e.oemSizes)?e.oemSizes.filter(i=>typeof i=="string"):[],variants:f.map(i=>({sku:i.sku,size:typeof i.size=="string"?i.size:"",fits:i.fits}))}}async function S(t,n){try{const e=await l(p(t,n),{baseUrl:m});return d(n,e)}catch(e){return e instanceof y&&e.status>=400&&e.status<500?s(n):{...s(n),failed:!0}}}function b(t){if(!t)return[];const n=[];for(const e of[...t.frontTyres,...t.rearTyres]){const r=u(e);if(!r)continue;const o=c(r);n.includes(o)||n.push(o)}return n}function A(t,n){if(n.length===0)return null;for(const e of t){const r=u(e);if(!r)continue;const o=c(r);if(n.includes(o))return o}return null}function
|
|
1
|
+
import{ApiError as y,PRODUCT_API_BASE as m,apiFetch as l}from"../api/index.js";import{parseTyreSize as u,tyreSizeLabel as c}from"./tyre-size.js";function z(t){if(!t||t.year===null)return null;const{make:n,model:e,year:r,modification:o}=t;return!n||!e||!o?null:{make:n,model:e,year:r,modification:o}}function p(t,n){const e=new URLSearchParams({make:n.make,model:n.model,year:String(n.year),modification:n.modification});return`/api/v1/tyres/${encodeURIComponent(t)}/fitment?${e.toString()}`}function s(t,n=""){return{vehicle:{...t,region:n},status:"unknown",oemSizes:[],variants:[]}}function d(t,n){if(typeof n!="object"||n===null)return s(t);const e=n,r=typeof e.vehicle=="object"&&e.vehicle!==null?e.vehicle:{},o=typeof r.region=="string"?r.region:"",a=e.status;if(a!=="fits"&&a!=="doesNotFit")return s(t,o);const f=Array.isArray(e.variants)?e.variants.filter(i=>typeof i=="object"&&i!==null&&typeof i.sku=="string"&&typeof i.fits=="boolean"):[];return f.length===0?s(t,o):{vehicle:{make:typeof r.make=="string"?r.make:t.make,model:typeof r.model=="string"?r.model:t.model,year:typeof r.year=="number"?r.year:t.year,modification:typeof r.modification=="string"?r.modification:t.modification,region:o},status:a,oemSizes:Array.isArray(e.oemSizes)?e.oemSizes.filter(i=>typeof i=="string"):[],variants:f.map(i=>({sku:i.sku,size:typeof i.size=="string"?i.size:"",fits:i.fits}))}}async function S(t,n){try{const e=await l(p(t,n),{baseUrl:m});return d(n,e)}catch(e){return e instanceof y&&e.status>=400&&e.status<500?s(n):{...s(n),failed:!0}}}function b(t){if(!t)return[];const n=[];for(const e of[...t.frontTyres,...t.rearTyres]){const r=u(e);if(!r)continue;const o=c(r);n.includes(o)||n.push(o)}return n}function A(t,n){if(n.length===0)return null;for(const e of t){const r=u(e);if(!r)continue;const o=c(r);if(n.includes(o))return o}return null}function x(t,n){if(!t||t.status==="unknown")return"unknown";const e=t.variants.find(r=>r.sku===n);return e?e.fits?"fits":"doesNotFit":"unknown"}export{S as loadTyreVehicleFitment,A as oemBadgeSize,b as oemTyreSizes,d as toTyreFitAnswer,z as tyreFitQuery,p as tyreVehicleFitmentPath,s as unknownAnswer,x as variantFitStatus};
|
|
@@ -22,6 +22,8 @@ export interface PlpFilterState {
|
|
|
22
22
|
tyreTypes: string[];
|
|
23
23
|
speedRatings: string[];
|
|
24
24
|
priceMax: number | null;
|
|
25
|
+
priceMin?: number | null;
|
|
26
|
+
lugs?: number[];
|
|
25
27
|
inStockOnly: boolean;
|
|
26
28
|
kind: ProductKind | null;
|
|
27
29
|
sort: PlpSortKey;
|
|
@@ -31,10 +33,11 @@ export declare const EMPTY_PLP_FILTERS: PlpFilterState;
|
|
|
31
33
|
export declare function sizePairLabel(pair: SizePair): string;
|
|
32
34
|
export declare function wheelSizeLabels(wheel: WheelSummary): string[];
|
|
33
35
|
export declare function formatWidth(width: number): string;
|
|
34
|
-
export declare function itemMatchesPlp(item: PlpItem, f: PlpFilterState, currency: Currency, except?: PlpFacetKey | "price" | "inStock" | "kind" | null): boolean;
|
|
36
|
+
export declare function itemMatchesPlp(item: PlpItem, f: PlpFilterState, currency: Currency, except?: PlpFacetKey | "price" | "inStock" | "kind" | "lugs" | null, otherKinds?: "fail" | "pass"): boolean;
|
|
35
37
|
export declare function plpInStockCount(items: readonly PlpItem[], f: PlpFilterState, currency: Currency): number;
|
|
36
38
|
export declare function sortPlpItems<T extends PlpItem>(items: readonly T[], sort: PlpSortKey, currency: Currency): T[];
|
|
37
39
|
export declare function applyPlpFilters<T extends PlpItem>(items: readonly T[], f: PlpFilterState, currency: Currency): T[];
|
|
40
|
+
export declare function applyShopperFilters<T extends PlpItem>(items: readonly T[], f: PlpFilterState, currency: Currency): T[];
|
|
38
41
|
export declare function hasActivePlpFilters(f: PlpFilterState): boolean;
|
|
39
42
|
export interface PlpFacetOption {
|
|
40
43
|
value: string;
|
|
@@ -49,7 +52,7 @@ export interface PlpFacetGroup {
|
|
|
49
52
|
options: PlpFacetOption[];
|
|
50
53
|
}
|
|
51
54
|
export declare const PLP_FACET_LABELS: Record<PlpFacetKey, string>;
|
|
52
|
-
export declare function buildPlpFacets(items: readonly PlpItem[], f: PlpFilterState, currency: Currency, kinds?: readonly ProductKind[], fieldUsage?: readonly FieldUsageAnswer[]): PlpFacetGroup[];
|
|
55
|
+
export declare function buildPlpFacets(items: readonly PlpItem[], f: PlpFilterState, currency: Currency, kinds?: readonly ProductKind[], fieldUsage?: readonly FieldUsageAnswer[], otherKinds?: "fail" | "pass"): PlpFacetGroup[];
|
|
53
56
|
export declare const PLP_ONE_VALUE_MAX = 1;
|
|
54
57
|
export declare function listingHiddenFacets(props: Readonly<Record<string, unknown>>): PlpFacetKey[];
|
|
55
58
|
export declare function facetWantedByAnyKind(key: PlpFacetKey, kinds: readonly ProductKind[], fieldUsage: readonly FieldUsageAnswer[]): boolean;
|
|
@@ -79,7 +82,7 @@ export declare function plpPriceBounds(items: readonly PlpItem[], currency: Curr
|
|
|
79
82
|
max: number;
|
|
80
83
|
} | null;
|
|
81
84
|
export interface PlpChip {
|
|
82
|
-
key: PlpFacetKey | "price" | "inStock" | "kind";
|
|
85
|
+
key: PlpFacetKey | "price" | "priceMin" | "inStock" | "kind" | "lugs";
|
|
83
86
|
value: string;
|
|
84
87
|
label: string;
|
|
85
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{answerOrder as
|
|
1
|
+
import{answerOrder as G,answersForKind as k,facetFieldKey as L,keepForFilter as H,NO_FIELD_ANSWERS as J,orderByAnswers as Q}from"../content/field-usage.js";import{STOCK_WORDS as ee}from"../content/stock-words.js";import{parseOption as te}from"efficient-web-builder/format/lib/parse-option";import{comparePrice as R,FROM_PREFIX_START as ne,priceIn as re,withinPriceRange as ie}from"./price-display.js";import{trimDecimal as se,wheelSizeLabel as oe}from"./spec-format.js";import{itemLugs as le,lugFilterLabel as ce}from"./lug-count.js";import{itemBrand as z,itemCollections as ae,itemDiameters as ue,itemFinishFamilies as pe,itemFinishes as fe,itemInStock as F,itemIsNew as E,itemKind as M,itemName as O,itemPcds as de,itemPrices as g,itemSpeedRatings as me,itemTyreSizes as _,itemTyreTypes as he,PLP_ANY_TYPE_LABEL as Se,PLP_KIND_LABELS as N,PLP_KINDS as ye}from"../catalog/plp-item.js";import{parseTyreSize as ge,tyreSizeLabel as v,tyreSizeLabels as Pe,TYRE_SIZE_PARTS as S,TYRE_SIZE_PART_LABELS as we}from"../tyres/tyre-size.js";const xe={recommended:"Recommended","price-asc":"Price · low to high","price-desc":"Price · high to low",new:"Newest",name:"Name A–Z"},I=Object.keys(xe);function B(e){return te(I,"recommended",e)}function be(e){return I.filter(t=>t!=="recommended"||e.length<=1)}function Ke(e,t){const r=B(e);return be(t).includes(r)?r:"name"}const P=["tyreSizes","brands","finishes","diameters","collections","pcds","tyreTypes","speedRatings"],T={tyreSizes:["tyre"],brands:["alloy-wheel","tyre"],finishes:["alloy-wheel"],diameters:["alloy-wheel","tyre"],collections:["alloy-wheel"],pcds:["alloy-wheel"],tyreTypes:["tyre"],speedRatings:["tyre"]},Me={diameters:"tyreSizes"};function C(e){if(e.length===0)return[];const t=P.filter(r=>e.every(n=>T[r].includes(n)));return t.filter(r=>{const n=Me[r];return!n||!t.includes(n)})}function De(e,t){return t&&e.includes(t)?[t]:[...e]}function K(e){const t=new Set;for(const r of e)t.add(M(r));return[...t]}const Ye={tyreSizes:[],brands:[],finishes:[],diameters:[],collections:[],pcds:[],tyreTypes:[],speedRatings:[],priceMax:null,inStockOnly:!1,kind:null,sort:"recommended",page:1};function $e(e){return`${_e(e.width)}×${e.diameter}`}function We(e){return[...new Set((e.sizePairs??[]).map(t=>oe(t.diameter,t.width)))]}function _e(e){return se(e)}function w(e,t,r,n=null,s="fail"){const i=M(e),o=l=>s==="fail"||(l==="lugs"?i==="alloy-wheel":T[l].includes(i));if(n!=="kind"&&t.kind&&i!==t.kind)return!1;for(const l of P){if(n===l)continue;const a=t[l];if(a.length===0||!o(l))continue;const f=a.map(String);if(!Y(e,l).some(u=>f.includes(u)))return!1}if(n!=="lugs"&&t.lugs&&t.lugs.length>0&&o("lugs")){const l=le(e);if(l===null||!t.lugs.includes(l))return!1}return!(n!=="price"&&!ie(g(e),r,t.priceMin??null,t.priceMax)||n!=="inStock"&&t.inStockOnly&&!F(e))}function Ze(e,t,r){return e.filter(n=>F(n)&&w(n,t,r,"inStock")).length}function D(e,t,r){const n=[...e],s=(o,l)=>O(o).localeCompare(O(l)),i=K(e).length>1;switch(t){case"price-asc":return n.sort((o,l)=>R(g(o),g(l),r,"asc"));case"price-desc":return n.sort((o,l)=>R(g(o),g(l),r,"desc"));case"name":return n.sort(s);case"new":return n.sort((o,l)=>{const a=(E(l)?1:0)-(E(o)?1:0);return a!==0||!i?a:s(o,l)});default:return n}}function je(e,t,r){return D(e.filter(n=>w(n,t,r)),t.sort,r)}function qe(e,t,r){return D(e.filter(n=>w(n,t,r,null,"pass")),t.sort,r)}function Ue(e){return P.some(t=>e[t].length>0)||(e.lugs?.length??0)>0||e.priceMin!=null||e.priceMax!=null||e.inStockOnly||e.kind!=null}const Te={tyreSizes:"Size",brands:"Brand",finishes:"Colour",diameters:"Size · diameter",collections:"Collection",pcds:"PCD · fitment",tyreTypes:"Tyre type",speedRatings:"Speed rating"};function Y(e,t){switch(t){case"tyreSizes":return[...new Set(_(e).flatMap(Pe))];case"brands":return z(e)?[z(e)]:[];case"finishes":return pe(e);case"diameters":return ue(e).map(String);case"collections":return ae(e);case"pcds":return de(e);case"tyreTypes":return he(e);case"speedRatings":return me(e)}}function Ae(e){const t=new Map;for(const r of e)for(const n of fe(r))n.color&&!t.has(n.family)&&t.set(n.family,n.color);return t}function Ve(e,t,r,n=K(e),s=J,i="fail"){const o=c=>ke(c,n,s),l=Ae(e),f=(i==="pass"?P.filter(c=>n.some(y=>T[c].includes(y))):C(n)).filter(c=>c!=="tyreSizes").filter(o).map(c=>{const y=t[c].map(String),A=new Set,b=new Map,x=new Map;for(const p of e){const h=Y(p,c);for(const d of h)A.add(d);for(const d of new Set(h))x.set(d,(x.get(d)??0)+1);if(w(p,t,r,c,i))for(const d of new Set(h))b.set(d,(b.get(d)??0)+1)}const X=[...A].map(p=>({value:p,label:c==="diameters"?`${p}″`:p,count:b.get(p)??0,checked:y.includes(p),swatch:c==="finishes"?l.get(p)??null:null})).sort((p,h)=>{if(c==="diameters")return Number(p.value)-Number(h.value);const d=(x.get(h.value)??0)-(x.get(p.value)??0);return d!==0?d:p.value.localeCompare(h.value)});return{key:c,label:Te[c],options:X}}).filter(c=>c.options.length>$),u=[];for(const c of f){const y=Le(c.key,n,s);y!==void 0&&u.push({fieldKey:c.key,filterOrder:y})}return[...Q(f,c=>c.key,u,"filterOrder")]}const $=1;function Xe(e){return e.showCollection===!1?["collections"]:[]}function ke(e,t,r){return t.length===0||r.length===0?!0:t.some(n=>H(k(r,n))(L(e,n)))}function Le(e,t,r){if(r.length===0)return;let n;for(const s of t){const i=G(k(r,s),"filter")(L(e,s));i!==void 0&&(n===void 0||i<n)&&(n=i)}return n}function Re(e){const t=new Set;for(const r of e)for(const n of _(r))t.add(v(n));return t.size}function Ge(e,t){return C(t).includes("tyreSizes")?Re(e)>$:!1}function W(e){const t=ge(e);if(t)return t;const[r,n]=e.split("/");return{width:r?Number(r):void 0,profile:n?Number(n):void 0}}function ze(e,t,r){return S.slice(0,S.indexOf(r)).every(n=>{const s=t[n];return s==null||e[n]===s})}function He(e,t,r){const n=W(t.tyreSizes[0]??""),s=new Set(e.filter(i=>w(i,t,r,"tyreSizes")));return S.map(i=>{const o=new Map;for(const a of e){const f=_(a).filter(u=>ze(u,n,i));for(const u of new Set(f.map(c=>c[i])))o.has(u)||o.set(u,0),s.has(a)&&o.set(u,(o.get(u)??0)+1)}const l=[...o.keys()].sort((a,f)=>a-f).map(a=>({value:a,label:i==="rim"?`R${a}`:String(a),count:o.get(a)??0}));return{part:i,label:we[i],value:n[i]??null,options:l}})}function Je(e,t,r,n){const s={...W(t)},i=S.indexOf(r);s[r]=n??void 0;for(const o of S.slice(i+1))s[o]!=null&&e.some(f=>S.slice(0,S.indexOf(o)+1).every(u=>s[u]==null||f[u]===s[u]))||(s[o]=void 0);return v(s)}function Qe(e,t,r,n){if(t.length<2)return[];const s=e.filter(i=>w(i,r,n,"kind"));return[{kind:null,label:Se,count:s.length,checked:r.kind===null},...t.map(i=>({kind:i,label:N[i],count:s.filter(o=>M(o)===i).length,checked:r.kind===i}))]}function et(e,t){if(e.length===0)return null;const r=e.map(i=>re(g(i),t)).filter(i=>i!==null);if(r.length===0)return null;const n=Math.floor(Math.min(...r)),s=Math.ceil(Math.max(...r));return s>n?{min:n,max:s}:null}function tt(e,t,r){const n=[];e.kind&&n.push({key:"kind",value:e.kind,label:N[e.kind]}),e.inStockOnly&&n.push({key:"inStock",value:"",label:ee.inStock});for(const s of P)for(const i of e[s]){const o=String(i);n.push({key:s,value:o,label:s==="diameters"?`${o}″`:s==="pcds"?`PCD ${o}`:o})}for(const s of e.lugs??[])n.push({key:"lugs",value:String(s),label:ce(s)});return e.priceMin!=null&&n.push({key:"priceMin",value:"",label:`${ne}${r(e.priceMin,t)}`}),e.priceMax!=null&&n.push({key:"price",value:"",label:`Up to ${r(e.priceMax,t)}`}),n}const m={tyreSizes:"tyreSize",brands:"brand",finishes:"colour",diameters:"size",collections:"collection",pcds:"pcd",tyreTypes:"tyreType",speedRatings:"speed"},Z="type",j="maxPrice",q="inStock",U="sort",V="page";function nt(e){const t=i=>e.getAll(i).flatMap(o=>o.split(",")).filter(Boolean),r=Number(e.get(j)),n=Number(e.get(V)),s=e.get(Z);return{tyreSizes:t(m.tyreSizes),brands:t(m.brands),finishes:t(m.finishes),diameters:t(m.diameters).map(Number).filter(Number.isFinite),collections:t(m.collections),pcds:t(m.pcds),tyreTypes:t(m.tyreTypes),speedRatings:t(m.speedRatings),priceMax:Number.isFinite(r)&&r>0?r:null,inStockOnly:e.get(q)==="1",kind:ye.find(i=>i===s)??null,sort:B(e.get(U)),page:Number.isFinite(n)&&n>=1?Math.floor(n):1}}function rt(e){const t=new URLSearchParams;for(const r of P){const n=e[r];n.length>0&&t.set(m[r],n.join(","))}return e.priceMax!=null&&t.set(j,String(e.priceMax)),e.inStockOnly&&t.set(q,"1"),e.kind&&t.set(Z,e.kind),e.sort!=="recommended"&&t.set(U,e.sort),e.page>1&&t.set(V,String(e.page)),t}function it(e,t){if(e<=7)return Array.from({length:e},(i,o)=>o+1);const r=[1],n=Math.max(2,t-1),s=Math.min(e-1,t+1);n>2&&r.push(null);for(let i=n;i<=s;i++)r.push(i);return s<e-1&&r.push(null),r.push(e),r}function st(e,t,r){const n=e.length,s=Math.max(1,Math.floor(r)),i=Math.max(1,Math.ceil(n/s)),o=Math.min(Math.max(1,Math.floor(t)),i),l=(o-1)*s;return{items:e.slice(l,l+s),page:o,pageCount:i,total:n,from:n===0?0:l+1,to:Math.min(l+s,n)}}export{Ye as EMPTY_PLP_FILTERS,P as PLP_FACET_KEYS,Te as PLP_FACET_LABELS,$ as PLP_ONE_VALUE_MAX,m as PLP_PARAM,xe as PLP_SORT_LABELS,Z as PLP_TYPE_PARAM,je as applyPlpFilters,qe as applyShopperFilters,B as asPlpSortKey,Ve as buildPlpFacets,Qe as buildPlpTypeOptions,He as buildTyreSizeBoxes,ke as facetWantedByAnyKind,_e as formatWidth,Ue as hasActivePlpFilters,w as itemMatchesPlp,Xe as listingHiddenFacets,st as paginatePlp,Je as pickTyreSize,tt as plpActiveChips,C as plpFacetKeysFor,nt as plpFiltersFromParams,rt as plpFiltersToParams,Ze as plpInStockCount,Ke as plpOpeningSort,it as plpPageSequence,et as plpPriceBounds,De as plpShownKinds,be as plpSortKeysFor,Ge as plpTyreSizeBoxesShown,Re as plpTyreSizeCount,$e as sizePairLabel,D as sortPlpItems,We as wheelSizeLabels};
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import type { Data } from "efficient-easel/blocks";
|
|
2
2
|
import type { ProductKind, ProductSummary, WheelSummary } from "../api/index.js";
|
|
3
3
|
import type { FieldUsageAnswer } from "../content/field-usage.js";
|
|
4
|
+
import { FILTER_BLOCK_TYPE, PRODUCT_GRID_TYPE } from "../document/document-nodes.js";
|
|
4
5
|
export declare const ALLOY_WHEELS_LISTING_TYPE = "AlloyWheelsListing";
|
|
5
|
-
export
|
|
6
|
+
export { PRODUCT_GRID_TYPE };
|
|
6
7
|
export declare const GRID_CATALOG_PROP = "catalog";
|
|
7
8
|
export declare const CATALOG_FILTER_BAR_TYPE = "CatalogFilterBar";
|
|
8
9
|
export declare const FIELD_USAGE_PROP = "fieldUsage";
|
|
9
10
|
export declare const LISTING_QUERY_PROP = "requestQuery";
|
|
11
|
+
export { FILTER_BLOCK_TYPE };
|
|
10
12
|
interface ContentNode {
|
|
11
13
|
type?: string;
|
|
12
14
|
props?: Record<string, unknown>;
|
|
13
15
|
}
|
|
14
16
|
export declare function pageHasWheelsListing(data: Data | null | undefined): boolean;
|
|
17
|
+
export declare function pageHasHydratedValues(data: Data | null | undefined): boolean;
|
|
15
18
|
export declare function pageReadsFieldUsage(data: Data | null | undefined): boolean;
|
|
16
19
|
export declare function hydrateFieldUsage(data: Data, answers: readonly FieldUsageAnswer[]): Data;
|
|
17
20
|
export declare function listingCatalogKinds(data: Data | null | undefined): ProductKind[];
|
|
@@ -19,5 +22,4 @@ export declare function listingWantsWheelsOnly(kinds: readonly ProductKind[]): b
|
|
|
19
22
|
export declare function hydrateWheelsListing(data: Data, products: ProductSummary[] | WheelSummary[]): Data;
|
|
20
23
|
export declare function stampListingQuery(data: Data, query: string): Data;
|
|
21
24
|
export declare function dehydrateWheelsListing(data: Data): Data;
|
|
22
|
-
export declare function dehydrateWheelsListingNode<T extends ContentNode>(
|
|
23
|
-
export {};
|
|
25
|
+
export declare function dehydrateWheelsListingNode<T extends ContentNode>(stamped: T): T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolvePlpKinds as O}from"../catalog/plp-item.js";import{gridKindsOf as
|
|
1
|
+
import{resolvePlpKinds as O}from"../catalog/plp-item.js";import{gridKindsOf as E,gridRowsOf as S,isLinkedSource as T}from"./grid-source.js";import{FILTER_BLOCK_TYPE as y,PRODUCT_GRID_TYPE as L,documentNodes as W,mapDocumentNodes as G}from"../document/document-nodes.js";import{selectedRangesOf as I,stripSelectedRanges as f}from"./selected-ranges.js";import{withShopperFirstPaint as N,withoutShopperFirstPaint as A,withoutShopperFirstPaintNode as P}from"./shopper-first-paint.js";const p="AlloyWheelsListing",x="catalog",U="CatalogFilterBar",i="fieldUsage",R="requestQuery";function l(r){return r.props?.source}function o(r){return r?.type===L&&T(l(r))}function a(r){return r?.type===U||r?.type===y}function g(r){return r?.type===p||o(r)||a(r)}const u=r=>W(r);function d(r){return r?u(r).some(t=>t?.type===p||o(t)):!1}function K(r){return r?d(r)||u(r).some(t=>P(t)!==t)||f(r)!==r:!1}function Q(r){return r?u(r).some(g):!1}function q(r,t){return t.length===0?r:c(r,g,e=>({...e,props:{...e.props??{},[i]:t}}))}function v(r){if(!r)return[];const t=new Set;for(const e of u(r)){if(e?.type!==p&&!o(e))continue;const s=e.props?.kinds;for(const n of o(e)?E(l(e),s):O(s))t.add(n)}return[...t]}function V(r){return r.length===1&&r[0]==="alloy-wheel"}function b(r,t){const e=I(r.root?.props);return N(C(r,s=>o(s)?{...s,props:{...h(s).props,[x]:S(l(s),s.props?.kinds,t)}}:{...s,props:{..._(s).props,products:t}}),e)}function j(r,t){const e=t.replace(/^\?/,"");return e?c(r,s=>s?.type===p,s=>({...s,props:{...s.props??{},[R]:e}})):r}function z(r){return A(c(f(r),g,t=>a(t)?w(t):o(t)?h(t):_(t)))}function w(r){if(!r.props||!(i in r.props))return r;const{[i]:t,...e}=r.props;return{...r,props:e}}function h(r){const{[x]:t,[i]:e,...s}=r.props??{},n=s.source;if(n&&"wheels"in n){const{wheels:m,...F}=n;s.source=F}return{...r,props:s}}function J(r){const t=f({content:[r]}).content[0],e=P(t);return o(e)?h(e):a(e)?w(e):e?.type===p?_(e):e}function _(r){const{wheels:t,products:e,[i]:s,[R]:n,...m}=r.props??{};return{...r,props:m}}function C(r,t){return c(r,e=>e?.type===p||o(e),t)}function c(r,t,e){return G(r,s=>t(s)?e(s):s)}export{p as ALLOY_WHEELS_LISTING_TYPE,U as CATALOG_FILTER_BAR_TYPE,i as FIELD_USAGE_PROP,y as FILTER_BLOCK_TYPE,x as GRID_CATALOG_PROP,R as LISTING_QUERY_PROP,L as PRODUCT_GRID_TYPE,z as dehydrateWheelsListing,J as dehydrateWheelsListingNode,q as hydrateFieldUsage,b as hydrateWheelsListing,v as listingCatalogKinds,V as listingWantsWheelsOnly,K as pageHasHydratedValues,d as pageHasWheelsListing,Q as pageReadsFieldUsage,j as stampListingQuery};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Data } from "efficient-easel/blocks";
|
|
2
|
+
import type { SelectedRanges } from "efficient-web-builder/render/lib/content/box-show-for";
|
|
3
|
+
import { type PlpSortKey } from "./plp-filters.js";
|
|
4
|
+
export declare const SELECTED_RANGES_PROP = "selectedRanges";
|
|
5
|
+
export declare const SHOPPER_ADDRESS_PROP = "shopperAddress";
|
|
6
|
+
export interface ShopperAddressMark {
|
|
7
|
+
writes: boolean;
|
|
8
|
+
sort: PlpSortKey;
|
|
9
|
+
}
|
|
10
|
+
export type AddressQuery = string | URLSearchParams | Readonly<Record<string, string | readonly string[] | undefined>>;
|
|
11
|
+
export declare function readSelectedRanges(query: AddressQuery, knownNames: readonly string[]): readonly string[];
|
|
12
|
+
export declare function selectedRangesOf(rootProps: Readonly<Record<string, unknown>> | null | undefined): SelectedRanges | null;
|
|
13
|
+
export declare function shopperAddressMarkOf(props: Readonly<Record<string, unknown>> | null | undefined): ShopperAddressMark | null;
|
|
14
|
+
export declare function stampSelectedRanges(data: Data, query: AddressQuery, knownNames: readonly string[]): Data;
|
|
15
|
+
export declare function stripSelectedRanges(data: Data): Data;
|
|
16
|
+
export declare function pageReadsSelectedRanges(data: Data | null | undefined): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{SHOW_FOR_PROP as R,showForOf as g}from"efficient-web-builder/format/lib/content/box-show-for-choices";import{asPlpSortKey as l,plpFiltersFromParams as w}from"./plp-filters.js";import{FILTER_BLOCK_TYPE as P,documentNodes as O,mapDocumentNodes as d}from"../document/document-nodes.js";import{documentShopperScopes as h,pageReachFilterOf as y}from"./shopper-first-paint.js";const u="selectedRanges",i="shopperAddress";function k(r){if(typeof r=="string")return new URLSearchParams(r.replace(/^\?/,""));if(r instanceof URLSearchParams)return r;const e=new URLSearchParams;for(const[o,t]of Object.entries(r))if(typeof t=="string")e.append(o,t);else if(Array.isArray(t))for(const s of t)typeof s=="string"&&e.append(o,s);return e}function A(r,e){const o=new Set(e),t=[];for(const s of w(k(r)).collections)o.has(s)&&!t.includes(s)&&t.push(s);return t}function L(r){const e=r?.[u];if(!e||!Array.isArray(e.selected)||!Array.isArray(e.known))return null;const o=s=>s.filter(n=>typeof n=="string"),t=o(e.known);return{selected:o(e.selected).filter(s=>t.includes(s)),known:t}}function D(r){const e=r?.[i];return!e||typeof e!="object"?null:{writes:e.writes===!0,sort:l(typeof e.sort=="string"?e.sort:void 0)}}function b(r,e,o){const t=[...new Set(o)],s={selected:A(e,t),known:t},n=y(r),p=new Map;if(n){const c=l(typeof n.props?.openingSort=="string"?n.props.openingSort:void 0);p.set(n,{[i]:{writes:!0,sort:c}});for(const[a,S]of h(r))S===n&&p.set(a,{[i]:{writes:!1,sort:c}})}const f=p.size?d(r,(c,a)=>p.has(a)?{...c,props:{...c.props,...p.get(a)}}:c):r,m=f.root??{};return{...f,root:{...m,props:{...m.props??{},[u]:s}}}}function N(r){const e=d(r,n=>{if(!(i in n.props))return n;const{[i]:p,...f}=n.props;return{...n,props:f}}),o=e.root;if(!o?.props||!(u in o.props))return e;const{[u]:t,...s}=o.props;return{...e,root:{...o,props:s}}}function T(r){return r?O(r).some(e=>e.type===P||g(e.props[R])!==void 0):!1}export{u as SELECTED_RANGES_PROP,i as SHOPPER_ADDRESS_PROP,T as pageReadsSelectedRanges,A as readSelectedRanges,L as selectedRangesOf,D as shopperAddressMarkOf,b as stampSelectedRanges,N as stripSelectedRanges};
|
|
@@ -32,3 +32,13 @@ export declare function setSecondSrc(finish: {
|
|
|
32
32
|
} | null | undefined, painted: string | null): string | null;
|
|
33
33
|
export declare const PER_WHEEL_UNIT = "per wheel";
|
|
34
34
|
export declare function wheelCardPriceLine(label: string, priced: boolean): string;
|
|
35
|
+
export declare const SET_PICTURE_POINTS: readonly [{
|
|
36
|
+
readonly label: "Pair";
|
|
37
|
+
readonly value: "pair";
|
|
38
|
+
}, {
|
|
39
|
+
readonly label: "One wheel";
|
|
40
|
+
readonly value: "one";
|
|
41
|
+
}];
|
|
42
|
+
export type SetPicture = (typeof SET_PICTURE_POINTS)[number]["value"];
|
|
43
|
+
export declare const SET_PICTURE_DEFAULT: SetPicture;
|
|
44
|
+
export declare function parseSetPicture(raw: unknown): SetPicture;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{WHEELS_PER_SET as r}from"../commerce.js";function u(e){return(e.components??[]).reduce((o,s)=>o+s.wheels,0)>r}function R(e){return e.kind==="alloy-wheel"&&(e.source.variants??[]).some(u)}const a=150,c="Front + rear",w="L/R pair",
|
|
1
|
+
import{WHEELS_PER_SET as r}from"../commerce.js";function u(e){return(e.components??[]).reduce((o,s)=>o+s.wheels,0)>r}function R(e){return e.kind==="alloy-wheel"&&(e.source.variants??[]).some(u)}const a=150,c="Front + rear",w="L/R pair",D="Not handed",l="L/R";function i(e){return e.et==null||e.rearEt==null?0:Math.abs(e.rearEt-e.et)}function n(e){return i(e)>=a}function O(e){return e.kind==="alloy-wheel"&&(e.source.variants??[]).some(n)}function p(e){return e.directional===!0}function d(e){return e.kind==="staggered"}function T(e){return e.rearWidth!=null||e.rearEt!=null&&e.rearEt!==e.et}function m(e){return{twoObjects:n(e),handed:p(e),staggered:d(e)}}function I(e){return{twoObjects:E(e),handed:e.handed??!1,staggered:!1}}function P(e){const t=[e.twoObjects?c:"",e.handed?l:""].filter(Boolean);return t.length?t.join(" · "):null}function g(e){return e.handed}function x(e){return new Set((e.components??[]).map(t=>t.partNumber)).size>1}function W(e){return e.kind==="alloy-wheel"&&(e.source.variants??[]).some(x)}function E(e){return(e.setWheelCount??0)>r}const S=new Set(["boltPattern"]);function b(e,t){return e&&S.has(t)}function H(e,t){return!e?.srcRight||!t||t!==e.src?null:e.srcRight}const f="per wheel";function C(e,t){return t?`${e} ${f}`:e}const L=[{label:"Pair",value:"pair"},{label:"One wheel",value:"one"}],_="pair";function N(e){return e==="one"?"one":_}export{c as AXLE_WORDS,l as CARD_HAND_WORDS,w as HAND_WORDS,D as NOT_HANDED_WORDS,f as PER_WHEEL_UNIT,_ as SET_PICTURE_DEFAULT,L as SET_PICTURE_POINTS,a as TWO_OBJECT_ET_SPREAD_MM,N as parseSetPicture,W as productHasComposedRender,R as productIsDually,O as productIsTwoObjects,P as setBuildLabel,g as setIsWide,H as setSecondSrc,b as setSuppressesRow,E as summaryIsDually,I as summarySetBuild,i as variantEtSpread,x as variantHasComposedRender,T as variantHasDistinctRear,u as variantIsDually,p as variantIsHanded,d as variantIsStaggered,n as variantIsTwoObjects,m as variantSetBuild,C as wheelCardPriceLine};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Data } from "efficient-easel/blocks";
|
|
2
|
+
import { type DocNode } from "../document/document-nodes.js";
|
|
3
|
+
import type { ProductKind } from "../api/index.js";
|
|
4
|
+
import type { SelectedRanges } from "efficient-web-builder/render/lib/content/box-show-for";
|
|
5
|
+
import { type PlpSortKey } from "./plp-filters.js";
|
|
6
|
+
type ContentNode = DocNode;
|
|
7
|
+
export declare const FIRST_ROWS_PROP = "firstRows";
|
|
8
|
+
export declare const FIRST_SHOWN_PROP = "firstShown";
|
|
9
|
+
export declare const FIRST_COUNT_IN_CHIPS_PROP = "firstCountInChips";
|
|
10
|
+
export interface FirstShown {
|
|
11
|
+
total: number;
|
|
12
|
+
range: {
|
|
13
|
+
from: number;
|
|
14
|
+
to: number;
|
|
15
|
+
} | null;
|
|
16
|
+
kinds: ProductKind[];
|
|
17
|
+
sort: PlpSortKey;
|
|
18
|
+
}
|
|
19
|
+
export declare const SHOPPER_BLOCK_TYPES: ReadonlySet<string>;
|
|
20
|
+
export declare function pageReachFilterOf(data: Data): ContentNode | null;
|
|
21
|
+
export declare function documentShopperScopes(data: Data): Map<ContentNode, ContentNode | null>;
|
|
22
|
+
export declare function withShopperFirstPaint(data: Data, stamp?: SelectedRanges | null): Data;
|
|
23
|
+
export declare function withoutShopperFirstPaintNode<T extends {
|
|
24
|
+
type?: string;
|
|
25
|
+
props?: Record<string, unknown>;
|
|
26
|
+
}>(node: T): T;
|
|
27
|
+
export declare function withoutShopperFirstPaint(data: Data): Data;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{FILTER_BLOCK_TYPE as C,FILTER_CHIPS_TYPE as F,PRODUCT_GRID_TYPE as E,documentNodes as L,mapDocumentNodes as R,placedDocumentNodes as N}from"../document/document-nodes.js";import{itemKind as M}from"../catalog/plp-item.js";import{gridPagingOf as b,gridShownOf as D}from"../sections/product-grid-pages.js";import{parseOpeningSort as H}from"../sections/shopper-filters.js";import{EMPTY_PLP_FILTERS as Y,itemMatchesPlp as B}from"./plp-filters.js";const h="firstRows",m="firstShown",P="firstCountInChips",u=C,S=F,w=E,A=new Set([u,S,w]);function K(t){return L(t).find(o=>o.type===u&&o.props.filtersBelow===!0)??null}const I=t=>N(t);function G(t){return t.lists.length<2?null:t.lists.find(o=>o.length>1)??null}const U=(t,o)=>o.lists.includes(t);function T(t){const o=t.filter(e=>e.node.type===u),p=new Map(o.map(e=>[e,G(e)])),l=new Map;for(const e of t){if(e.node.type!==S&&e.node.type!==w)continue;let s=null;for(const r of o){const c=p.get(r);if(!c||!U(c,e))continue;const f=e.lists.length-e.lists.indexOf(c);(!s||f>s.depth)&&(s={f:r,depth:f})}if(s){l.set(e.node,s.f.node);continue}const i=o.filter(r=>r.node.props.filtersBelow===!0&&r.order<e.order).at(-1);l.set(e.node,i?.node??null)}return l}function _(t){const o=t.props.catalog;return Array.isArray(o)?o:null}function X(t){return T(I(t))}function W(t,o){if(!t||t.selected.length===0)return null;const p=K(o);return p?{filter:p,state:{...Y,collections:[...t.selected]}}:null}function k(t,o){return t.filter(p=>B(p,o,void 0,"price","pass"))}function Z(t,o=null){const p=I(t);if(!p.some(i=>i.node.type===u))return t;const l=T(p),e=W(o,t),s=new Map;for(const i of p.filter(r=>r.node.type===u).map(r=>r.node)){const r=[...l].filter(([,n])=>n===i).map(([n])=>n),c=r.filter(n=>n.type===w&&_(n)),f=r.filter(n=>n.type===S),g=c.flatMap(n=>_(n));s.set(i,{[h]:g});const O=e?.filter===i?e.state:null,d=c.map(n=>{const a=_(n);return D(O?k(a,O).length:a.length,b(n.props))}),x={total:d.reduce((n,a)=>n+a.total,0),range:d.length===1?d[0].range:null,kinds:[...new Set(g.map(M))],sort:H(i.props.openingSort)};for(const n of f)s.set(n,{[m]:x});const y=f.some(n=>n.props.showCount!==!1);for(const n of c)s.set(n,{[P]:y})}return R(t,(i,r)=>s.has(r)?{...i,props:{...i.props,...s.get(r)}}:i)}function v(t){if(!t?.type||!A.has(t.type)||!t.props)return t;const o=t.props;if(!(h in o)&&!(m in o)&&!(P in o))return t;const{[h]:p,[m]:l,[P]:e,...s}=o;return{...t,props:s}}function $(t){return R(t,o=>v(o))}export{P as FIRST_COUNT_IN_CHIPS_PROP,h as FIRST_ROWS_PROP,m as FIRST_SHOWN_PROP,A as SHOPPER_BLOCK_TYPES,X as documentShopperScopes,K as pageReachFilterOf,Z as withShopperFirstPaint,$ as withoutShopperFirstPaint,v as withoutShopperFirstPaintNode};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type ShopperRole = "filter" | "chips" | "grid" | "gallery";
|
|
2
|
+
export interface ScopeMember {
|
|
3
|
+
key: string;
|
|
4
|
+
role: ShopperRole;
|
|
5
|
+
boxId: string | null;
|
|
6
|
+
node: Element | null;
|
|
7
|
+
filtersBelow?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function boxContentOf(filter: Element): Element | null;
|
|
10
|
+
export declare function resolveShopperScopes(members: readonly ScopeMember[]): Map<string, string | null>;
|
|
11
|
+
export declare function resolveGalleryFollows(members: readonly ScopeMember[]): Map<string, string | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function a(r){let n=r;for(;n?.parentElement;){const o=n.parentElement;if(p(o)>1)return o;n=o}return null}function p(r){let n=0;for(const o of Array.from(r.children))y.has(o.tagName)||(n+=1);return n}const y=new Set(["STYLE","SCRIPT","TEMPLATE","LINK"]);function k(r){let n=0;for(let o=r;o;o=o.parentNode)n+=1;return n}function d(r,n){return(r.compareDocumentPosition(n)&4)!==0&&!r.contains(n)}function h(r){const n=r.filter(e=>e.role==="filter"&&e.node),o=new Map;for(const e of n)o.set(e.key,e.boxId===null?null:a(e.node));const t=new Map;for(const e of r){if(e.role==="filter"){t.set(e.key,e.key);continue}if(!e.node||e.role==="gallery"){t.set(e.key,null);continue}let c=null;for(const f of n){const u=o.get(f.key);if(!u||!u.contains(e.node))continue;const l=k(u);(!c||l>c.depth)&&(c={key:f.key,depth:l})}if(c){t.set(e.key,c.key);continue}let i=null;for(const f of n)!f.filtersBelow||!d(f.node,e.node)||(!i||d(i.node,f.node))&&(i=f);t.set(e.key,i?.key??null)}return t}function w(r){const n=r.filter(t=>t.role==="gallery"&&t.node),o=new Map;for(const t of r){if(t.role!=="chips")continue;const e=t.node&&t.boxId!==null?a(t.node):null;if(!e){o.set(t.key,null);continue}const c=n.filter(l=>e.contains(l.node)),i=c.filter(l=>d(t.node,l.node)),f=i.reduce((l,s)=>!l||d(s.node,l.node)?s:l,null),u=c.filter(l=>!i.includes(l)).reduce((l,s)=>!l||d(l.node,s.node)?s:l,null);o.set(t.key,(f??u)?.key??null)}return o}export{a as boxContentOf,w as resolveGalleryFollows,h as resolveShopperScopes};
|