efficient-storefront-blocks 0.129.0 → 0.130.1
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 +40 -0
- package/dist/index.js +26 -26
- package/dist/render/components/CompatibleTyres.js +1 -1
- package/dist/render/components/pdp-dynamic/DynamicRelatedProducts.js +1 -1
- package/dist/render/components/product-hero/SpinLayer.js +1 -1
- package/dist/render/lib/document/blocks/commerce/BundleOffer/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/CompatibleTyres/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/RelatedProducts/meta.js +1 -1
- package/dist/render/lib/sections/spin-sets.d.ts +19 -1
- package/dist/render/lib/sections/spin-sets.js +1 -1
- package/dist/routine-index.json +1 -1
- package/dist/value-index.json +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as h}from"react/jsx-runtime";import I from"./SectionBand.js";import{SPEC_TABLE_BAND as x}from"../lib/sections/spec-table-band.js";import{useScopeClass as L}from"../lib/use-scope-class.js";import O from"efficient-web-builder/render/components/SectionHeader";import z from"./SectionFootnote.js";import B from"./TyreCard.js";import D from"./ViewMoreLink.js";import{renderGold as T,renderHeadline as F}from"efficient-web-builder/render/components/goldPhrases";import{useCurrency as P}from"./CurrencyContext.js";import{tyrePagePath as R}from"../lib/tyres/tyre-page-path.js";import{TYRE_ILLUSTRATION_NOTE as H}from"../lib/wheels/tyre-render.js";import{cardImageShapeTokens as $}from"efficient-web-builder/format/lib/content/card-image-shape";import{DEFAULT_CARD_INDEX_FORMAT as U,cardIndexCss as Y}from"efficient-web-builder/format/lib/sections/product-card-style";import{say as G}from"efficient-web-builder/format/lib/editor-words";function b({frameClassName:i,omitHead:t,style:o,children:n}){return i!==void 0?e("section",{className:i,style:o,children:n}):e(I,{className:t?x.ownBox:x.inline,style:o,children:n})}const m={2:"grid grid-cols-2 gap-2 max-view-tablet:grid-cols-1",3:"grid grid-cols-3 gap-2 max-view-desktop:grid-cols-2 max-view-tablet:grid-cols-1",4:"grid grid-cols-4 gap-2 max-view-desktop:grid-cols-2 max-view-tablet:grid-cols-1"};function V({num:i,title:t,description:o,tyres:n,footnote:k,footnoteLinkText:w,footnoteLinkHref:y,viewMore:s,editing:N=!1,frameClassName:d,omitHead:a=!1,columns:f=3,cardImage:S,outline:_,indexBadge:C}){const{currency:v,formatPrice:E}=P(),l=n??[],p=L("ct"),u=C??U,c=Y(p,u),j=l.some(r=>!r.image),A=[k,j?H:null].filter(Boolean).join(" "),g=a?null:e(O,{num:i!=null?T(i):void 0,title:t!=null?F(t,!1):void 0,description:o!=null?T(o):void 0,accent:!0});return l.length===0?N?h(b,{frameClassName:d,omitHead:a,children:[g,e("p",{className:"border-t border-line py-6 font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.18em] text-fg-dim",children:G("No compatible tyres found for this wheel’s sizes yet — tyres appear automatically when a matching size is active and priced in the catalog.")})]}):null:h(b,{frameClassName:d,omitHead:a,style:$(S),children:[c&&e("style",{children:c}),g,e("div",{className:`${c?`${p} `:""}${(Object.hasOwn(m,f)?m[f]:void 0)??m[3]}`,children:l.map(r=>e(B,{outline:_,showIndex:u!=="off",size:r.size,specs:r.specs,prices:r.prices,image:r.image,inStock:r.inStock,href:R(r.slug),currency:v,formatPrice:E},r.sku))}),s&&e("div",{className:"mt-10 flex",children:e(D,{href:s.href,label:s.label})}),e(z,{text:A,linkText:w,linkHref:y})]})}export{V as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as $}from"react/jsx-runtime";import
|
|
1
|
+
"use client";import{jsx as e,jsxs as $}from"react/jsx-runtime";import A from"../SectionBand.js";import{useScopeClass as q}from"../../lib/use-scope-class.js";import{useEffect as J,useState as Q}from"react";import{cardHoverOf as Y}from"efficient-web-builder/format/lib/animation/hover";const ee=Y({},"ProductGrid");import re from"../CompatibleTyres.js";import{cardRowsGrid as te,GridBundleCards as oe,GridCardProvider as ne,GridCards as le,gridIndexCss as se}from"../GridCardTemplate.js";import{productGridColumnsClass as ie}from"../../lib/sections/product-grid-columns.js";import{containerGapProps as H}from"efficient-web-builder/format/lib/content/container-gap";import{SPEC_TABLE_BAND as S}from"../../lib/sections/spec-table-band.js";import{cardImageShapeTokens as M}from"efficient-web-builder/format/lib/content/card-image-shape";import{NO_FIELD_ANSWERS as ae}from"../../lib/content/field-usage.js";import{gridClassImageSizes as de}from"../../lib/sections/card-image-sizes.js";import{fillRowCss as ce}from"../../lib/sections/fill-row.js";import pe from"efficient-web-builder/render/components/SectionHeader";import ue from"../ViewMoreLink.js";import{useSiteMenuLinks as me}from"../catalog/SiteMenuLinks.js";import{renderGold as O,renderHeadline as fe}from"efficient-web-builder/render/components/goldPhrases";import he from"./KindGate.js";import{loadProductCatalog as ge}from"../useProductCatalog.js";import{PLP_KINDS as be}from"../../lib/catalog/plp-item.js";import{relatedCardCount as we,relatedViewMore as ye}from"../../lib/catalog/related-cards.js";import{answersWithProducts as j,DEFAULT_RELATIONSHIP as xe,relationshipApplies as K,relationshipByKey as Ce}from"../../lib/catalog/relationships.js";import{useCurrentProduct as ke}from"../../lib/document/current-product.js";import{PLACEHOLDER_RELATED as W}from"../../lib/wheels/placeholder-wheel.js";import{say as v}from"efficient-web-builder/format/lib/editor-words";const z={label:"text-[length:var(--size-label,13px)]"},Ee=be;function Pe(o){return e(he,{kinds:Ee,type:"RelatedProducts",editing:o.editing,children:e(Se,{...o})})}function Se({num:o,title:r,description:s,columns:d=3,cardCount:N,relationship:L=xe,footnote:w,footnoteLinkText:y,footnoteLinkHref:G,editing:n=!1,omitHead:a=!1,hover:R,ownerId:T="",template:c,cardImage:i,outline:p,indexBadge:x,columnsPhone:m,columnsTablet:C,gap:k,gapPhone:E}){const f={columns:d,columnsPhone:m,columnsTablet:C,gap:k,gapPhone:E,hover:R,ownerId:T,template:c,editing:n,omitHead:a},l=ke(),U=me(),P=we(N),t=Ce(L),I=t?j(t):!1,[Z,D]=Q([]);if(J(()=>{if(l||!n||!I)return;let u=!1;return ge().then(b=>{const X=b.length>0?b:W;u||D(X)}).catch(()=>{u||D(W)}),()=>{u=!0}},[l,n,I]),!t)return null;const h=a?null:e(pe,{num:o?O(o):void 0,title:fe(r||t.heading,!1),description:s?O(s):void 0,accent:!0});if(!j(t)){if(l&&!K(t,l.product.kind))return n?e(V,{relationship:t,cardImage:i}):null;const u=l?t.resolve(l.product,l.relatedWheels):null,b=u?.kind==="bundle"?u.bundles.slice(0,P):[];return b.length===0?n?e(F,{header:h,omitHead:a,cardImage:i,words:v("Bundles containing this product appear here on a product page.")}):null:e(B,{header:h,cards:{bundles:b},...f})}const _=ye(t,U);if(!l)return n?e(B,{header:h,cards:{wheels:Z.slice(0,P)},viewMore:_,...f}):null;if(!K(t,l.product.kind))return n?e(V,{relationship:t,cardImage:i}):null;const g=t.resolve(l.product,l.relatedWheels);return g.kind==="tyre"?e(re,{omitHead:a,columns:d,cardImage:i,outline:p,indexBadge:x,num:o,title:r||t.heading,description:s,tyres:[...g.tyres].slice(0,P),footnote:w,footnoteLinkText:y,footnoteLinkHref:G,viewMore:_,editing:n}):g.kind!=="alloy-wheel"?null:g.wheels.length===0?n?e(F,{header:h,omitHead:a,cardImage:i,words:v("Related products appear here on a product page.")}):null:e(B,{header:h,cards:{wheels:[...g.wheels].slice(0,P)},viewMore:_,...f})}function V({relationship:o,cardImage:r}){return e(A,{className:"border-b border-line py-14 max-view-desktop:py-10",style:M(r),children:e("p",{className:`font-mono ${z.label} uppercase tracking-[0.18em] text-fg-dim`,children:v("“{relationship}” does not apply to this product. It is hidden on the live page.",{relationship:v(o.label)})})})}function F({header:o,omitHead:r,cardImage:s,words:d}){return $(A,{className:r?S.ownBox:S.inline,style:M(s),children:[o,e("p",{className:`border-t border-line py-6 font-mono ${z.label} uppercase tracking-[0.18em] text-fg-dim`,children:d})]})}function B({header:o,cards:r,viewMore:s,columns:d,columnsPhone:N,columnsTablet:L,gap:w,gapPhone:y,hover:G,ownerId:n,template:a,editing:R,omitHead:T}){const c=q("rp"),i="wheels"in r?r.wheels.length:r.bundles.length;if(i===0)return null;const p=ie(d,N,L),x="bundles"in r,m=x?H("ProductGrid",w,"both",y):te(H("ProductGrid",w,"both",y)),C=se(c),k=ce(c,p,{cards:i}),E=f=>e("div",{className:x?`${c} mt-10 grid${m.className} ${p}`:`${c} grid${m.className} bg-[var(--catalog-grid-bg)] ${p}`,style:m.style,children:f});return $(A,{className:T?S.ownBox:S.inline,children:[C&&e("style",{children:C}),k&&e("style",{children:k}),o,e(ne,{value:{ownerId:n,Template:a,hover:G??ee,imageSizes:de(p,i),fieldUsage:ae,reserveEyebrow:!1,editing:R},children:"wheels"in r?e(le,{wheels:r.wheels,children:E}):e(oe,{bundles:r.bundles,children:E})}),s?e("div",{className:"mt-10 flex",children:e(ue,{href:s.href,label:s.label})}):null]})}export{Se as RelatedProductsBody,Pe as default,Ee as supportedKinds};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as x}from"react/jsx-runtime";import{useCallback as z,useEffect as b,useRef as p,useState as $}from"react";import{VIEW_TABLET_MIN as oe}from"efficient-easel/screen/lib/content/view-tiers";import{cssStringBody as se}from"efficient-web-builder/format/lib/document/style-text";import{HALF_SIZES as L,sizedImage as ae}from"efficient-web-builder/format/lib/sized-image";import{prefersReducedMotion as ce}from"efficient-web-builder/render/components/useReducedMotion";import{isFullTurn as H,spinClampPosition as ie,spinFrameIndex as K,spinPositionAfterDrag as U,spinCell as j,spinStartPosition as T}from"../../lib/sections/spin-sets.js";const le=.3,ue=.85,B=24,G=4,q=1e3,Z=77/72,Q=`${(1-Z)/2*100}%`,V=`${Z*100}%`,Y={left:Q,top:Q,width:V,height:V},de=`(max-width: ${oe-.02}px)`,R=new Map;function J(n,E){let f=R.get(n);return f||(f=new Promise(k=>{const o=new Image;o.onload=()=>k({w:o.naturalWidth,h:o.naturalHeight}),o.onerror=()=>{R.delete(n),k(null)},E&&(o.sizes=L,o.srcset=E),o.src=n}),R.set(n,f)),f}const ee=new Set,W=n=>ae(n,{fallbackWidth:q,maxWidth:q});function fe({set:n,name:E}){const[f,k]=$(()=>T(n)),o=p(null),F=p(0),P=p(f),v=p(null),w=p(null),r=n.count,[M,C]=$(null),I=p(null),[D,X]=$(null),_=H(n),g=K(f,r,_),y=z(e=>{const t=ie(e,r,_);return P.current=t,k(t),t},[r,_]),A=z(()=>cancelAnimationFrame(F.current),[]);b(()=>{const e=window.matchMedia?.(de);if(!e)return X(!1);const t=()=>X(e.matches);return t(),e.addEventListener?.("change",t),()=>e.removeEventListener?.("change",t)},[]),b(()=>{if(!n.sheets||!n.startFrame||D===null)return;const e=D?n.sheets.phone:n.sheets.desktop,t=`${n.startFrame} ${e.urls[0]}`;if(w.current===t)return;w.current=t,C({key:t,sheet:e,ready:new Set});const c=Math.floor(T(n)/(e.cols*e.rows)),l=e.urls.map((h,d)=>e.urls[(c+d)%e.urls.length]),u=W(n.startFrame);J(u.src,u.srcSet).then(()=>{for(const h of l)J(h).then(d=>{!d||d.w!==e.cols*e.frame||d.h!==e.rows*e.frame||w.current===t&&C(i=>i?.key===t?{...i,ready:new Set(i.ready).add(h)}:i)})})},[n,D]),b(()=>{if(!n.frames)return;const e=n.frames,t=e[0];if(w.current===t||(w.current=t,ee.has(t)))return;ee.add(t);const c=K(T(n),r,H(n)),l=[];for(let i=0;i<G;i+=1)for(let m=i;m<r;m+=G)l.push((c+m)%r);const u=i=>{const m=W(e[i]),S=new Image;return S.sizes=L,m.srcSet&&(S.srcset=m.srcSet),S.src=m.src,S},h=u(l[0]),d=()=>l.slice(1).forEach(u);h.onload=d,h.onerror=d},[r,n]),b(()=>A,[A]);const te=e=>{A(),e.currentTarget.setPointerCapture?.(e.pointerId),v.current={x0:e.clientX,f0:P.current,last:e.clientX,speed:0}},ne=e=>{const t=v.current,c=o.current;!t||!c||(t.speed=e.clientX-t.last,t.last=e.clientX,y(U(t.f0,e.clientX-t.x0,c.clientWidth,r)))},N=()=>{const e=v.current;v.current=null;const t=o.current;if(!e||!t||ce())return;let c=Math.max(-B,Math.min(B,e.speed));const l=()=>{if(Math.abs(c)<le)return;const u=U(P.current,c,t.clientWidth,r);y(u)===u&&(c*=ue,F.current=requestAnimationFrame(l))};F.current=requestAnimationFrame(l)},re=e=>{const t=e.key==="ArrowRight"||e.key==="ArrowUp"?1:e.key==="ArrowLeft"||e.key==="ArrowDown"?-1:0;if(e.key==="Home")y(0);else if(e.key==="End")y(r-1);else if(t)y(Math.round(P.current)+t);else return;A(),e.preventDefault()},s=n.sheets&&M&&M.key.startsWith(`${n.startFrame} `)?M:null;s&&s.ready.has(j(s.sheet,g).url)&&(I.current={key:s.key,frame:g});const O=s&&I.current?.key===s.key?I.current.frame:null,a=s&&O!==null?{...j(s.sheet,O),cols:s.sheet.cols,rows:s.sheet.rows}:null;return x("div",{ref:o,"data-spin-well":!0,role:"slider",tabIndex:0,"aria-label":`${E}, 360° view: drag or use the arrow keys to turn`,"aria-valuemin":1,"aria-valuemax":r,"aria-valuenow":g+1,"aria-valuetext":`Angle ${g+1} of ${r}`,onKeyDown:re,className:"absolute inset-0 select-none overflow-hidden cursor-grab active:cursor-grabbing focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-fg",style:{touchAction:"pan-y"},onPointerDown:te,onPointerMove:ne,onPointerUp:N,onPointerCancel:N,onTouchStart:e=>e.stopPropagation(),onTouchMove:e=>e.stopPropagation(),onTouchEnd:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:a?x("div",{"data-spin-frame":!0,className:"pointer-events-none absolute",style:{...Y,backgroundImage:`url("${se(a.url)}")`,backgroundSize:`${a.cols*100}% ${a.rows*100}%`,backgroundPosition:`${a.cols>1?a.col*100/(a.cols-1):0}% ${a.rows>1?a.row*100/(a.rows-1):0}%`}}):x("img",{...W(n.frames?n.frames[g]:n.startFrame??""),sizes:L,alt:"",draggable:!1,fetchPriority:"high","data-spin-frame":!0,className:"pointer-events-none absolute max-w-none object-contain",style:Y})})}export{fe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ProductGridSlots as t}from"../ProductGrid/meta.js";import{
|
|
1
|
+
import{ProductGridSlots as t}from"../ProductGrid/meta.js";import{BAND_120_OWN as e}from"../../../../content/block-own-pads.js";const r={ownPad:e,label:"Bundle Products",fields:{template:t.template},defaultProps:{num:"",title:"",description:"",columns:3}};export{r as BundleOfferMeta};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PH as o}from"efficient-web-builder/format/lib/document/blocks/placeholders";import{
|
|
1
|
+
import{PH as o}from"efficient-web-builder/format/lib/document/blocks/placeholders";import{BAND_120_OWN as t}from"../../../../content/block-own-pads.js";const i={num:o.sectionNumber,title:"Compatible *tyres.*",description:o.body,footnote:"Tyres shown are fitment-matched companions.",footnoteLinkText:"Enquire about tyres"},r={ownPad:t,label:"Compatible Tyres",defaultProps:{num:"",title:"",description:"",footnote:"",footnoteLinkText:"",footnoteLinkHref:""}};export{i as COMPATIBLETYRES_PH,r as CompatibleTyresMeta};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{RELATED_CARDS_DEFAULT as t}from"../../../../catalog/related-cards.js";import{DEFAULT_RELATIONSHIP as o}from"../../../../catalog/relationships.js";import{ProductGridSlots as r}from"../ProductGrid/meta.js";import{
|
|
1
|
+
import{RELATED_CARDS_DEFAULT as t}from"../../../../catalog/related-cards.js";import{DEFAULT_RELATIONSHIP as o}from"../../../../catalog/relationships.js";import{ProductGridSlots as r}from"../ProductGrid/meta.js";import{BAND_120_OWN as e}from"../../../../content/block-own-pads.js";const a={ownPad:e,label:"Related Products",fields:{template:r.template},defaultProps:{num:"",title:"",description:"",cardCount:t,columns:3,relationship:o}};export{a as RelatedProductsMeta};
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
+
export interface SpinSheet {
|
|
2
|
+
frame: number;
|
|
3
|
+
cols: number;
|
|
4
|
+
rows: number;
|
|
5
|
+
urls: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare const SPIN_SHEET_MAX_SIDE = 4096;
|
|
1
8
|
export interface SpinSet {
|
|
2
|
-
|
|
9
|
+
count: number;
|
|
10
|
+
frames?: string[];
|
|
11
|
+
startFrame?: string;
|
|
12
|
+
sheets?: {
|
|
13
|
+
desktop: SpinSheet;
|
|
14
|
+
phone: SpinSheet;
|
|
15
|
+
};
|
|
3
16
|
arc?: number;
|
|
4
17
|
start?: number;
|
|
5
18
|
}
|
|
@@ -11,3 +24,8 @@ export declare function spinStartPosition(set: SpinSet): number;
|
|
|
11
24
|
export declare function spinFrameIndex(position: number, count: number, loop?: boolean): number;
|
|
12
25
|
export declare function spinClampPosition(position: number, count: number, loop: boolean): number;
|
|
13
26
|
export declare function spinPositionAfterDrag(start: number, dx: number, width: number, count: number): number;
|
|
27
|
+
export declare function spinCell(sheet: SpinSheet, i: number): {
|
|
28
|
+
url: string;
|
|
29
|
+
col: number;
|
|
30
|
+
row: number;
|
|
31
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const l=360,y=.9,
|
|
1
|
+
import{resolveMedia as h}from"efficient-web-builder/render/lib/media";const l=4096,a=360,y=.9,p=t=>Array.isArray(t)&&t.length>0&&t.every(r=>typeof r=="string"&&r.length>0),c=t=>h(t)??t,f=t=>Number.isInteger(t)&&t>0;function m(t,r){if(!t||typeof t!="object")return null;const{frame:n,cols:e,rows:o,urls:s}=t;return!f(n)||!f(e)||!f(o)||!p(s)||n*e>l||n*o>l||s.length!==Math.ceil(r/(e*o))?null:{frame:n,cols:e,rows:o,urls:s.map(c)}}function x(t){const{frames:r,count:n,startFrame:e,sheets:o}=t,s=p(r)?{count:r.length,frames:r.map(c)}:null;if(o&&typeof o=="object"&&f(n)&&typeof e=="string"&&e){const u=m(o.desktop,n),i=m(o.phone,n);if(u&&i)return{count:n,startFrame:c(e),sheets:{desktop:u,phone:i}}}return s}function M(t){if(!t||typeof t!="object")return null;const{arc:r,start:n}=t,e=x(t);if(!e)return null;if(r!==void 0){if(typeof r!="number"||!(r>0&&r<=a))return null;e.arc=r}return Number.isInteger(n)&&n>=0&&n<e.count&&(e.start=n),e}function S(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const r={};for(const[n,e]of Object.entries(t)){if(!e||typeof e!="object"||Array.isArray(e))continue;const o={};for(const[s,u]of Object.entries(e)){const i=M(u);i&&(o[s]=i)}Object.keys(o).length>0&&(r[n]=o)}return r}function j(t,r,n){return n?t[r]?.[n]??null:null}function b(t){return t.arc===void 0||t.arc>=a}function g(t){return b(t)?0:Math.floor(t.count/2)}function A(t){return t.start??g(t)}function F(t,r,n=!0){return n?(Math.floor(t)%r+r)%r:Math.max(0,Math.min(r-1,Math.floor(t)))}function P(t,r,n){return n?t:Math.max(0,Math.min(r-1,t))}function T(t,r,n,e){return n<=0?t:t-r/n*e*y}function _(t,r){const n=t.cols*t.rows,e=r%n;return{url:t.urls[Math.floor(r/n)],col:e%t.cols,row:Math.floor(e/t.cols)}}export{l as SPIN_SHEET_MAX_SIDE,b as isFullTurn,S as parseSpinSets,_ as spinCell,P as spinClampPosition,F as spinFrameIndex,T as spinPositionAfterDrag,j as spinSetFor,A as spinStartPosition};
|