@dropins/storefront-pdp 0.4.0-alpha2 → 0.4.0-alpha9
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/__mocks__/product-mocks.d.ts +157 -0
- package/api/getRefinedProduct/getRefinedProduct.d.ts +1 -1
- package/api/graphql/ProductOptionFragment.graphql.d.ts +1 -1
- package/chunks/getRefinedProduct.js +12 -11
- package/containers/ProductDetails/ProductDetails.d.ts +1 -1
- package/containers/ProductDetails.js +1 -1
- package/data/models/product-model.d.ts +3 -2
- package/data/transforms/product-transform.d.ts +1 -1
- package/i18n/en_US.json.d.ts +1 -1
- package/package.json +1 -1
- package/render.js +1 -1
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
export declare const MOCK_DATA_BUNDLE: {
|
|
2
|
+
__typename: string;
|
|
3
|
+
id: string;
|
|
4
|
+
sku: string;
|
|
5
|
+
name: string;
|
|
6
|
+
shortDescription: string;
|
|
7
|
+
metaDescription: string;
|
|
8
|
+
metaKeyword: string;
|
|
9
|
+
metaTitle: string;
|
|
10
|
+
description: string;
|
|
11
|
+
inStock: boolean;
|
|
12
|
+
addToCartAllowed: boolean;
|
|
13
|
+
url: string;
|
|
14
|
+
urlKey: string;
|
|
15
|
+
externalId: string;
|
|
16
|
+
images: {
|
|
17
|
+
url: string;
|
|
18
|
+
label: string;
|
|
19
|
+
roles: string[];
|
|
20
|
+
}[];
|
|
21
|
+
options: {
|
|
22
|
+
id: string;
|
|
23
|
+
title: string;
|
|
24
|
+
required: boolean;
|
|
25
|
+
multi: null;
|
|
26
|
+
values: {
|
|
27
|
+
id: string;
|
|
28
|
+
title: string;
|
|
29
|
+
inStock: boolean;
|
|
30
|
+
__typename: string;
|
|
31
|
+
quantity: number;
|
|
32
|
+
isDefault: boolean;
|
|
33
|
+
product: {
|
|
34
|
+
sku: string;
|
|
35
|
+
shortDescription: string;
|
|
36
|
+
metaDescription: string;
|
|
37
|
+
metaKeyword: string;
|
|
38
|
+
metaTitle: string;
|
|
39
|
+
name: string;
|
|
40
|
+
price: {
|
|
41
|
+
final: {
|
|
42
|
+
amount: {
|
|
43
|
+
value: number;
|
|
44
|
+
currency: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
regular: {
|
|
48
|
+
amount: {
|
|
49
|
+
value: number;
|
|
50
|
+
currency: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
roles: string[];
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}[];
|
|
57
|
+
}[];
|
|
58
|
+
priceRange: {
|
|
59
|
+
maximum: {
|
|
60
|
+
final: {
|
|
61
|
+
amount: {
|
|
62
|
+
value: number;
|
|
63
|
+
currency: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
regular: {
|
|
67
|
+
amount: {
|
|
68
|
+
value: number;
|
|
69
|
+
currency: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
roles: string[];
|
|
73
|
+
};
|
|
74
|
+
minimum: {
|
|
75
|
+
final: {
|
|
76
|
+
amount: {
|
|
77
|
+
value: number;
|
|
78
|
+
currency: string;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
regular: {
|
|
82
|
+
amount: {
|
|
83
|
+
value: number;
|
|
84
|
+
currency: string;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
roles: string[];
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
export declare const MOCK_DATA_BUNDLE_TRANSFORMED: {
|
|
92
|
+
name: string;
|
|
93
|
+
sku: string;
|
|
94
|
+
addToCartAllowed: boolean;
|
|
95
|
+
inStock: boolean;
|
|
96
|
+
shortDescription: string;
|
|
97
|
+
metaDescription: string;
|
|
98
|
+
metaKeyword: string;
|
|
99
|
+
metaTitle: string;
|
|
100
|
+
description: string;
|
|
101
|
+
images: {
|
|
102
|
+
url: string;
|
|
103
|
+
label: string;
|
|
104
|
+
width: number;
|
|
105
|
+
height: number;
|
|
106
|
+
}[];
|
|
107
|
+
prices: {
|
|
108
|
+
final: {
|
|
109
|
+
amount: number;
|
|
110
|
+
currency: string;
|
|
111
|
+
};
|
|
112
|
+
regular: {
|
|
113
|
+
amount: number;
|
|
114
|
+
currency: string;
|
|
115
|
+
};
|
|
116
|
+
visible: boolean;
|
|
117
|
+
};
|
|
118
|
+
options: {
|
|
119
|
+
id: string;
|
|
120
|
+
type: "text" | "image" | "color" | "dropdown";
|
|
121
|
+
typename: "ProductViewOptionValueProduct" | "ProductViewOptionValueSwatch" | "ProductViewOptionValueConfiguration";
|
|
122
|
+
label: string;
|
|
123
|
+
required: boolean;
|
|
124
|
+
multiple: boolean;
|
|
125
|
+
items: {
|
|
126
|
+
id: string;
|
|
127
|
+
inStock: boolean;
|
|
128
|
+
label: string;
|
|
129
|
+
selected: boolean;
|
|
130
|
+
value: string;
|
|
131
|
+
product: {
|
|
132
|
+
sku: string;
|
|
133
|
+
shortDescription: string;
|
|
134
|
+
metaDescription: string;
|
|
135
|
+
metaKeyword: string;
|
|
136
|
+
metaTitle: string;
|
|
137
|
+
name: string;
|
|
138
|
+
price: {
|
|
139
|
+
final: {
|
|
140
|
+
amount: {
|
|
141
|
+
value: number;
|
|
142
|
+
currency: string;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
regular: {
|
|
146
|
+
amount: {
|
|
147
|
+
value: number;
|
|
148
|
+
currency: string;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
roles: string[];
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
}[];
|
|
155
|
+
}[];
|
|
156
|
+
};
|
|
157
|
+
//# sourceMappingURL=product-mocks.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ProductModel } from '../../data/models';
|
|
2
2
|
|
|
3
|
-
export declare const getRefinedProduct: (sku: string, optionUIDs: string[], anchorOptions?: string[]) => Promise<ProductModel | null>;
|
|
3
|
+
export declare const getRefinedProduct: (sku: string, optionUIDs: string[], anchorOptions?: string[], isBundle?: boolean) => Promise<ProductModel | null>;
|
|
4
4
|
//# sourceMappingURL=getRefinedProduct.d.ts.map
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* is strictly forbidden unless prior written permission is obtained
|
|
14
14
|
* from Adobe.
|
|
15
15
|
*/
|
|
16
|
-
export declare const ProductOptionFragment = "\nfragment ProductOptionFragment on ProductViewOption {\n id\n title\n required\n multi\n values {\n id\n title\n inStock\n __typename\n ... on ProductViewOptionValueProduct {\n title\n quantity\n isDefault\n product {\n sku\n shortDescription\n metaDescription\n metaKeyword\n metaTitle\n name\n price {\n final {\n amount {\n value\n currency\n }\n }\n regular {\n amount {\n value\n currency\n }\n }\n roles\n }\n }\n }\n ... on ProductViewOptionValueSwatch {\n id\n title\n type\n value\n inStock\n }\n }\n }\n";
|
|
16
|
+
export declare const ProductOptionFragment = "\nfragment ProductOptionFragment on ProductViewOption {\n id\n title\n required\n multi\n values {\n id\n title\n inStock\n __typename\n ... on ProductViewOptionValueProduct {\n title\n quantity\n isDefault\n __typename\n product {\n sku\n shortDescription\n metaDescription\n metaKeyword\n metaTitle\n name\n price {\n final {\n amount {\n value\n currency\n }\n }\n regular {\n amount {\n value\n currency\n }\n }\n roles\n }\n }\n }\n ... on ProductViewOptionValueSwatch {\n id\n title\n type\n value\n inStock\n }\n }\n }\n";
|
|
17
17
|
//# sourceMappingURL=ProductOptionFragment.graphql.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{c as B}from"./initialize.js";import{FetchGraphQL as et}from"@dropins/tools/fetch-graphql.js";const{setEndpoint:gt,setFetchGraphQlHeader:ht,removeFetchGraphQlHeader:wt,setFetchGraphQlHeaders:xt,fetchGraphQl:q,getConfig:_t}=new et().getMethods();function K(e,r){var i,u,o;const n=e?{name:e.name,sku:e.sku,addToCartAllowed:e.addToCartAllowed,inStock:e.inStock,shortDescription:e.shortDescription,metaDescription:e.metaDescription,metaKeyword:e.metaKeyword,metaTitle:e.metaTitle,description:e.description,images:rt(e),prices:mt(e,!!r),attributes:nt(e),options:ut(e),optionUIDs:at(e),url:e.url,urlKey:e.urlKey,externalId:e.externalId,externalParentId:e.externalParentId,variantSku:e.variantSku}:null,t=(o=(u=(i=B.getConfig())==null?void 0:i.models)==null?void 0:u.ProductDetails)==null?void 0:o.transform;return t&&n?t(n):n}function rt(e){var r;return(r=e.images)==null?void 0:r.map(n=>(n.url=n.url.replace(/^https?:/,""),n))}function nt(e){var r,n;return(n=(r=e.attributes)==null?void 0:r.filter(({roles:t})=>(t==null?void 0:t.indexOf("visible_in_pdp"))!==-1))==null?void 0:n.map(({label:t,value:i,name:u})=>({id:u,label:t,value:i.toString().split(",").join(", ")}))}function ut(e){const{options:r,optionUIDs:n}=e;return r==null?void 0:r.map(({id:t,title:i,required:u,multi:o,values:m})=>{var d,s;const a=(d=m==null?void 0:m[0])==null?void 0:d.__typename;let l=m==null?void 0:m[0].type;const c=((s=m==null?void 0:m[0])==null?void 0:s.__typename)==="ProductViewOptionValueProduct";return l?l=l.replace("COLOR_HEX","color").replace("TEXT","text").replace("IMAGE","image"):l="dropdown",{id:t,type:l,typename:a,label:i,required:u,multiple:o,items:c?it(m,n):ot(m,n,l)}})}function it(e,r){return e==null?void 0:e.map(({id:n,title:t,inStock:i,isDefault:u,product:o})=>({id:n,inStock:i,label:t,selected:(r==null?void 0:r.indexOf(n))>-1||u,value:n,product:o}))}function ot(e,r,n){return e==null?void 0:e.map(({id:t,title:i,inStock:u,value:o})=>({id:t,inStock:u,label:i,selected:(r==null?void 0:r.indexOf(t))>-1,value:(n==null?void 0:n.toLowerCase())==="dropdown"?t:o==null?void 0:o.replace(/^https?:/,"")}))}function mt(e,r){var E,x,H,I,L;const{price:n,priceRange:t,options:i,optionUIDs:u}=e;let{__typename:o}=e;function m(){var g;const P=n.regular.amount.value,f=((g=n.final)==null?void 0:g.amount.value)??n.regular.amount.value,y=n.regular.amount.currency==="NONE"?"USD":n==null?void 0:n.regular.amount.currency;return[P,f,f,y]}function a(){var _,b,S,V,T,C,D,A,F,$,G,M;const P=(_=t==null?void 0:t.minimum)==null?void 0:_.final.amount.value,f=(b=t==null?void 0:t.maximum)==null?void 0:b.final.amount.value;let y;((V=(S=t==null?void 0:t.minimum)==null?void 0:S.regular)==null?void 0:V.amount.value)===((C=(T=t==null?void 0:t.maximum)==null?void 0:T.regular)==null?void 0:C.amount.value)&&(y=(A=(D=t==null?void 0:t.minimum)==null?void 0:D.regular)==null?void 0:A.amount.value);const g=(($=(F=t==null?void 0:t.minimum)==null?void 0:F.final)==null?void 0:$.amount.currency)==="NONE"?"USD":(M=(G=t==null?void 0:t.minimum)==null?void 0:G.final)==null?void 0:M.amount.currency;return[y,P,f,g]}function l(){var S,V,T,C,D,A,F,$,G,M,X,Y;let P=0,f=0;i==null||i.forEach(k=>{var z;const j=k==null?void 0:k.values;if(j&&Array.isArray(j)){const h=j.map(p=>{var Q,N,J,W;return(W=(J=(N=(Q=p==null?void 0:p.product)==null?void 0:Q.price)==null?void 0:N.regular)==null?void 0:J.amount)==null?void 0:W.value}).filter(p=>p!==void 0),v=h.length>0?Math.max(...h):0;P+=v}else P+=0;(z=k==null?void 0:k.values)==null||z.forEach(h=>{var v,p,Q,N;u!=null&&u.includes(h.id)&&(f+=(N=(Q=(p=(v=h==null?void 0:h.product)==null?void 0:v.price)==null?void 0:p.final)==null?void 0:Q.amount)==null?void 0:N.value)})});const y=(S=t==null?void 0:t.minimum)==null?void 0:S.final.amount.value,g=(V=t==null?void 0:t.maximum)==null?void 0:V.final.amount.value;let _;((C=(T=t==null?void 0:t.minimum)==null?void 0:T.regular)==null?void 0:C.amount.value)===((A=(D=t==null?void 0:t.maximum)==null?void 0:D.regular)==null?void 0:A.amount.value)&&(_=($=(F=t==null?void 0:t.minimum)==null?void 0:F.regular)==null?void 0:$.amount.value);const b=((M=(G=t==null?void 0:t.minimum)==null?void 0:G.final)==null?void 0:M.amount.currency)==="NONE"?"USD":(Y=(X=t==null?void 0:t.minimum)==null?void 0:X.final)==null?void 0:Y.amount.currency;return r&&!u?[_,y,g,b]:P===(t==null?void 0:t.maximum.regular.amount.value)?[f,f,f,b]:[_,y,g,b]}const[c,d,s,w]=o==="SimpleProductView"?m():r?l():a(),O=o==="SimpleProductView"?(E=n==null?void 0:n.roles)==null?void 0:E.includes("visible"):((H=(x=t==null?void 0:t.maximum)==null?void 0:x.roles)==null?void 0:H.includes("visible"))&&((L=(I=t==null?void 0:t.minimum)==null?void 0:I.roles)==null?void 0:L.includes("visible"));return s&&d===s?{regular:{amount:c,currency:w,variant:c&&d!==c?"strikethrough":"default"},final:{amount:s,currency:w,variant:"default"},visible:O}:{final:{minimumAmount:d,maximumAmount:s,currency:w},visible:O}}function at(e){var n;let{optionUIDs:r}=e;return(n=e==null?void 0:e.options)==null||n.map(({values:t})=>{var u;((u=t==null?void 0:t[0])==null?void 0:u.__typename)==="ProductViewOptionValueProduct"&&!r&&(r=[],t==null||t.map(({id:o,isDefault:m})=>{m&&(r==null?void 0:r.indexOf(o))===-1&&r.push(o)}))}),r}const lt=`
|
|
2
2
|
fragment ProductOptionFragment on ProductViewOption {
|
|
3
3
|
id
|
|
4
4
|
title
|
|
@@ -13,6 +13,7 @@ fragment ProductOptionFragment on ProductViewOption {
|
|
|
13
13
|
title
|
|
14
14
|
quantity
|
|
15
15
|
isDefault
|
|
16
|
+
__typename
|
|
16
17
|
product {
|
|
17
18
|
sku
|
|
18
19
|
shortDescription
|
|
@@ -46,7 +47,7 @@ fragment ProductOptionFragment on ProductViewOption {
|
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
|
-
`,
|
|
50
|
+
`,R=`
|
|
50
51
|
fragment ProductFragment on ProductView {
|
|
51
52
|
__typename
|
|
52
53
|
id
|
|
@@ -137,16 +138,16 @@ fragment ProductFragment on ProductView {
|
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
|
|
140
|
-
${
|
|
141
|
-
`,
|
|
141
|
+
${lt}
|
|
142
|
+
`,tt=`
|
|
142
143
|
query GET_PRODUCT_DATA($skus: [String]) {
|
|
143
144
|
products(skus: $skus) {
|
|
144
145
|
...ProductFragment
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
148
|
|
|
148
|
-
${
|
|
149
|
-
|
|
149
|
+
${R}
|
|
150
|
+
`;function Z(e){return e.some(r=>(r==null?void 0:r.__typename)==="ProductViewOptionValueProduct")}const bt=async e=>{var u,o,m,a,l,c,d;const r=(a=(m=(o=(u=B)==null?void 0:u.getConfig())==null?void 0:o.models)==null?void 0:m.ProductDetails)==null?void 0:a.initialData;let n=(l=r==null?void 0:r.options)==null?void 0:l.some(s=>Z(s.values));if(r)return K(r,!!n);const{data:t}=await q(tt,{method:"GET",variables:{skus:[e]}}),i=(c=t==null?void 0:t.products)==null?void 0:c[0];return n=(d=i==null?void 0:i.options)==null?void 0:d.some(s=>Z(s.values)),K(i,!!n)},ct=`
|
|
150
151
|
query REFINE_PRODUCT_QUERY(
|
|
151
152
|
$optionIds: [String!]!
|
|
152
153
|
$sku: String!
|
|
@@ -167,11 +168,11 @@ query REFINE_PRODUCT_QUERY(
|
|
|
167
168
|
# %extendedPlaceholder%
|
|
168
169
|
}
|
|
169
170
|
|
|
170
|
-
${
|
|
171
|
-
`;async function
|
|
172
|
-
ProductOption${
|
|
171
|
+
${R}
|
|
172
|
+
`;async function U(e,r,n){var m;if(n)return{...(m=(await q(tt,{method:"GET",variables:{skus:[e]}})).data)==null?void 0:m.products[0],optionUIDs:r};const t=st(r),i=dt(t,e),u=ct.replace("# %extendedPlaceholder%",i),{data:o}=await q(u,{method:"GET",variables:{optionIds:r,sku:e}});return o}const kt=async(e,r,n,t)=>{var s,w,O,E;let i;if(i=await U(e,r,t),!i)return null;if(t)return K({...i,optionUIDs:r},!0);let{products:u,refineProduct:o,...m}=i;const a=u==null?void 0:u[0],l=ft(Object.values(m),a.options,n);if(n!=null&&n.length&&o===null){r=Pt(l,r,n);const x=await U(e,r);o=x==null?void 0:x.refineProduct}const c=K({...o||a,sku:a.sku,name:a.name,externalParentId:a==null?void 0:a.externalId,options:l,optionUIDs:r,variantSku:(o==null?void 0:o.__typename)==="SimpleProductView"?o==null?void 0:o.sku:void 0}),d=(E=(O=(w=(s=B)==null?void 0:s.getConfig())==null?void 0:w.models)==null?void 0:O.ProductDetails)==null?void 0:E.fallbackData;return d?d(a,c):c};function st(e){if(e.length<2)return[e];const r=[];return e.forEach(n=>{const t=[];e.forEach(i=>{n!==i&&t.push(i)}),r.push(t)}),r}function dt(e,r){return e.map((n,t)=>`
|
|
173
|
+
ProductOption${t}: refineProduct(
|
|
173
174
|
optionIds: [
|
|
174
|
-
${
|
|
175
|
+
${n.map(i=>`"${i}"`).join(", ")}
|
|
175
176
|
]
|
|
176
177
|
sku: "${r}"
|
|
177
178
|
) {
|
|
@@ -181,4 +182,4 @@ ${G}
|
|
|
181
182
|
}
|
|
182
183
|
}
|
|
183
184
|
}
|
|
184
|
-
`).join("")}function
|
|
185
|
+
`).join("")}function ft(e,r,n){const t=Object.values(e).filter(u=>!!u).reduce((u,o)=>o.options?[...u,...o.options]:[...u],[]),i=new Map(r.map(u=>[u.id,u]));return t.forEach(u=>{n!=null&&n.includes(u.id)||i.set(u.id,u)}),[...i.values()]}function Pt(e,r,n){const t=[];let i;return e.forEach(u=>{var o,m,a,l;n.includes(u.id)?i=((m=(o=u.values)==null?void 0:o.find(c=>r.includes(c==null?void 0:c.id)))==null?void 0:m.id)||((a=u.values[0])==null?void 0:a.id):i=(l=u.values[0])==null?void 0:l.id,t.push(i)}),t}export{ht as a,xt as b,bt as c,kt as d,q as f,_t as g,wt as r,gt as s};
|
|
@@ -74,7 +74,7 @@ export interface ProductDetailsProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
74
74
|
optionsConfig?: OptionsConfig;
|
|
75
75
|
useACDL?: boolean;
|
|
76
76
|
onAddToCart?: (values: Values) => void;
|
|
77
|
-
zoomType
|
|
77
|
+
zoomType?: 'zoom' | 'overlay';
|
|
78
78
|
closeButton?: boolean;
|
|
79
79
|
}
|
|
80
80
|
export declare const ProductDetails: Container<ProductDetailsProps, ProductModel | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as me from"@dropins/tools/preact-compat.js";import{useState as X,Children as de,useRef as Ne,useMemo as we,useEffect as Z,useCallback as ne}from"@dropins/tools/preact-compat.js";import{debounce as xe,classes as $,VComponent as j,toLanguageTag as De,Slot as K}from"@dropins/tools/lib.js";import{Button as _e,Icon as fe,Price as ge,Picker as He,ColorSwatch as Ve,ImageSwatch as qe,TextSwatch as je,Incrementer as Xe,Breadcrumbs as Fe,Image as ke}from"@dropins/tools/components.js";import{jsxs as V,jsx as r,Fragment as Pe}from"@dropins/tools/preact-jsx-runtime.js";import{useText as F}from"@dropins/tools/i18n.js";import{cloneElement as Ge}from"@dropins/tools/preact.js";import{c as $e,d as Re}from"../chunks/getRefinedProduct.js";import{events as Le}from"@dropins/tools/event-bus.js";import{c as Te}from"../chunks/initialize.js";import"@dropins/tools/fetch-graphql.js";const Ye=e=>me.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},me.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),Be=e=>me.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},me.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3599 5.64001L5.62988 18.37",stroke:"currentColor"}),me.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3599 18.37L5.62988 5.64001",stroke:"currentColor"})),Ke=24,Me=16,be=2,Ze="32";var We=(e=>(e[e.small=16]="small",e[e.medium=24]="medium",e[e.large=64]="large",e))(We||{});const ve=({show:e=1,scrollbar:o=!1,peak:d=!1,arrows:p=!1,controls:s="dots",arrowsOnMainImage:f=!1,loop:h=!1,gap:b=null,direction:l="horizontal",width:G="100%",height:c="100%",defaultIndex:m=0,className:B,children:R,thumbnails:Q=null,isZoomed:oe,...v})=>{const P=F("PDP.Carousel.label").label,n=F("PDP.Carousel.Slide.label").label,S=F("PDP.Carousel.Previous.label").label,E=F("PDP.Carousel.Next.label").label,I=F("PDP.Carousel.Controls.label").label,y=F("PDP.Carousel.Controls.Button.label").label,[x,he]=X(()=>Ee(e)),t=Math.ceil(de.count(R)/x),O=d?Ke:0,g=b?We[b]:0,T=de.count(R)%x,[L,C]=X(h?m+1:m),k=Ne([]),[ee,se]=X(0),[re,ue]=X(0),le=we(()=>de.toArray(Q),[Q]),W=we(()=>{const a=de.toArray(R).reduce((u,D,M)=>M%x===0?[...u,[D]]:[...u.slice(0,-1),[...u[u.length-1],D]],[]);return!h||a.length===1?a:h&&de.count(R)%x===0?[a[t-1]].concat(a).concat([a[0],a[1]]):[de.toArray(R).slice(-x)].concat(a).concat([a[0],a[1]])},[R,x,t,h]),te=Ne(null),ae=Ne(null),N=s==="thumbnailsRow"||s==="thumbnailsColumn";Z(()=>{const a=document.body,u=xe(()=>{var H,ce;se(((H=te.current)==null?void 0:H.offsetWidth)??0),ue(((ce=te.current)==null?void 0:ce.offsetHeight)??0);const M=window.innerWidth,q=Ee(e,M);q!==x&&he(q)},50),D=new ResizeObserver(u);return D.observe(a),()=>{D.unobserve(a)}},[x,e]);const Y=ne(a=>{const u=h?a-1:a,D=k==null?void 0:k.current[0],M=(D==null?void 0:D.offsetWidth)+Me,q=(D==null?void 0:D.offsetHeight)+Me,H=ae.current,ce=s==="thumbnailsRow",Ae=s==="thumbnailsColumn",pe=ce?H==null?void 0:H.offsetWidth:H==null?void 0:H.offsetHeight,J=ce?M:q;(ce||Ae)&&pe&&(J*(u+1)>pe&&(H.style.scrollBehavior="smooth",ce?H.scrollLeft=(u+be)*J:H.scrollTop=(u+be)*J),(ce?H.scrollLeft:H.scrollTop)>J*u&&(H.style.scrollBehavior="smooth",ce?H.scrollLeft=(u-be)*J:H.scrollTop=(u-be)*J))},[s,h]);Z(()=>{Y(L)},[L,Y]);const U=ne((a,u,D)=>{N&&Y(a);const M=te.current,q=O?M.offsetWidth-O:M.offsetWidth-O+g;if(!Array.from(M.querySelectorAll("[data-index]")).filter(pe=>{const J=Number(pe.getAttribute("data-index"));return!isNaN(J)&&J>-1})[a])return;if(D){const pe=a===0?t:0,J=q*(t+(T||x)/x);if(M.scrollLeft>=0&&M.scrollLeft<q-5){U(1,!0);return}if(M.scrollLeft>J-q&&M.scrollLeft<=J){U(t,!0);return}M.style.scrollBehavior="auto",M.scrollLeft=pe===0?0:J,U(pe===0?1:t,!0);return}const Ae=(M.offsetWidth-g)/x*W[a].length-O;M.style.scrollBehavior=u?"smooth":"auto",M.scrollLeft=W[a].length===x?q*a:q*(a-1)+Ae},[g,t,O,x,T,W,Y,s]),i=ne(()=>{if(h){const u=L-1;U(u,!0,L===1);return}const a=L<=0?0:L-1;U(a,!0)},[L,U,h]),_=ne(()=>{const a=W.length-1;if(h){const D=L+1;U(D,!0,L===t);return}const u=L>=a?a:L+1;U(u,!0)},[W.length,h,L,U,t]);Z(()=>{const a=u=>{u.key==="ArrowLeft"&&(u.preventDefault(),i()),u.key==="ArrowRight"&&(u.preventDefault(),_())};return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[_,i]),Z(()=>{U(h?m+1:m,!1)},[m,U,h]);const w=xe(()=>{const a=te.current,u=O?a.offsetWidth-O:a.offsetWidth-O+g,D=a.scrollLeft/u,M=Math.round(D)-D<1?Math.round(D):Math.ceil(D);if(N&&Y(M),h){const q=u*(t+(T||x)/x);if(Math.ceil(a.scrollLeft)>=Math.ceil(q)-5){a.style.scrollBehavior="auto",a.scrollLeft=a.offsetWidth*1+(Math.ceil(a.scrollLeft)-Math.ceil(q)-O);return}if(a.scrollLeft===0){a.style.scrollBehavior="auto",a.scrollLeft=q-a.offsetWidth+O;return}}L!==M&&C(M)},100);Z(()=>{const a=te.current;return a==null||a.addEventListener("scroll",w),()=>{a==null||a.removeEventListener("scroll",w)}},[w]);const A=(a,u,D)=>r(_e,{className:$([["pdp-carousel__button",!a],[`pdp-carousel__button--${u}`,!a],[`pdp-carousel__button--${s}`,a]]),style:{"--height":`${re}px`},variant:"tertiary","aria-label":u==="next"?E:S,onClick:D,disabled:h?!1:u==="next"?L>=W.length-1:L<1,children:r(fe,{className:$([["pdp-carousel__button__icon",!a],[`pdp-carousel__button__icon--${u}`,!a],[`pdp-carousel__button__icon--${s}--${u}`,a]]),size:Ze,source:Ye})}),z=p&&W.length!=1&&A(N,"prev",i),ie=p&&W.length!=1&&A(N,"next",_),ye=p&&W.length!=1&&A(!1,"prev",i),Se=p&&W.length!=1&&A(!1,"next",_);return V("div",{role:"region","aria-roledescription":P,className:$(["pdp-carousel",["pdp-carousel--main-image-controls",f],["pdp-carousel--arrows",p&&!N],[`pdp-carousel--${s}`,N],B]),style:{"--flex-carousel":s==="thumbnailsColumn"?"row-reverse":"column","--gap":N?"0":"var(--spacing-small)","--width":G},...v,children:[r("div",{ref:te,className:$(["pdp-carousel__wrapper",`pdp-carousel__wrapper--${l}`,["pdp-carousel__wrapper--scrollbar",o],["pdp-carousel__wrapper--peak",d]]),style:{"--total-width":s==="thumbnailsColumn"?"81.6%":"100%","--height":s==="thumbnailsColumn"?"auto":c,"--gap":b?`var(--spacing-${b})`:"0px","--per-page":x},tabIndex:0,children:W.map((a,u)=>{const D=a.length<x;return r("div",{role:"group","aria-roledescription":n,"data-index":u,className:$(["pdp-carousel__slide",`pdp-carousel__slide--${l}`,["pdp-carousel__slide--active",L===u],["pdp-carousel__slide--orphan",D]]),style:{"--length":a.length},children:a},u)})}),!N&&V(Pe,{children:[z,ie]}),N&&f&&V(Pe,{children:[ye,Se]}),s&&W.length!=1&&V("div",{className:$([[`pdp-carousel__controls__container--${s}`,N],["pdp-carousel__controls__container--no-arrows",!p||f]]),style:{"--width":s==="thumbnailsRow"?`${ee}px`:G,"--height":`${re}px`,"--nr-thumbnails":le.length},children:[(N||oe)&&!f&&z,r("div",{ref:ae,className:$([[`pdp-carousel__controls__wrapper--${s}`,N],["pdp-carousel__controls__wrapper",N]]),children:r("div",{role:"group","aria-label":I,className:$(["pdp-carousel__controls",[`pdp-carousel__controls--${s}`,N]]),children:(h?W.slice(0,t):W).map((a,u)=>{const D=h?t:W.length,M=h?L-1===u:L===u;return N?V("label",{className:$(["pdp-carousel__thumbnail__container"]),ref:q=>{q&&(k.current[u]=q)},children:[r("input",{type:"radio",name:"carousel-thumbnails","aria-label":y.replace("{key}",String(u+1)).replace("{total}",String(D)),checked:M&&ee!==0,onChange:()=>{U(h?u+1:u,!0)},...v,className:$(["pdp-carousel__thumbnail",["pdp-carousel__thumbnail--selected",M&&ee!==0]])}),r("span",{className:$(["pdp-carousel__thumbnail__span"]),children:le[u]})]},u):r("button",{"aria-label":y.replace("{key}",String(u+1)).replace("{total}",String(D)),onClick:()=>{U(h?u+1:u,!0)},className:$(["pdp-carousel__controls__button",["pdp-carousel__controls__button--active",M]])},u)})})}),(N||oe)&&!f&&ie]})]})};function Ee(e,o=0){if(typeof e=="number")return e;const{small:d,medium:p,large:s}=e,h=[{breakpoint:1024,value:s},{breakpoint:786,value:p},{breakpoint:0,value:d}].find(({breakpoint:b})=>o>b);return h?h.value:d}const Qe=({title:e,breadcrumbs:o,galleryContent:d,infoContent:p,productContent:s,sku:f,outOfStock:h,shortDescription:b,description:l,attributes:G,images:c,options:m,price:B,specialPrice:R,className:Q,children:oe,quantity:v,actions:P,carouselConfig:n,zoomType:S="overlay",closeButton:E=!0,...I})=>{var C,k,ee,se,re,ue,le,W,te;const y=F("PDP.Product.RegularPrice.label").label,x=F("PDP.Product.SpecialPrice.label").label,he=F("PDP.Product.OutOfStock.label").label,t=F("PDP.Product.Image.label").label,[O,g]=X(null),T=c!=null&&c.length?c.map((ae,N)=>{var U;const Y=((U=e==null?void 0:e.props)==null?void 0:U.children)&&(t==null?void 0:t.replace("{product}",e.props.children.toString()).replace("{key}",String(N+1)).replace("{total}",String(c.length)));return S==="zoom"?r(lt,{closeButton:E,children:r(j,{node:ae,loading:N===0?"eager":"lazy",alt:Y},N)}):r(j,{node:ae,loading:N===0?"eager":"lazy",alt:Y,onClick:()=>g(N)},N)}):r("img",{src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",className:"pdp-product__images__placeholder","aria-hidden":!0}),L=(C=n==null?void 0:n.thumbnails)!=null&&C.length?n.thumbnails.map((ae,N)=>{var Y;return r(j,{node:ae,loading:(n==null?void 0:n.thumbnailsLoadingMode)||"lazy",alt:((Y=e==null?void 0:e.props)==null?void 0:Y.children)&&(t==null?void 0:t.replace("{product}",e.props.children.toString()).replace("{key}",String(N+1)).replace("{total}",String(c.length)))},N)}):r("img",{src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",className:"pdp-product__images__placeholder","aria-hidden":!0});return V("div",{...I,className:$(["pdp-product",Q]),children:[o&&r(j,{node:o,className:"pdp-product__breadcrumbs"}),V("div",{className:"pdp-product__column-container pdp-product__gallery-column",children:[r("div",{className:"pdp-product__column-body",children:(k=n==null?void 0:n.controls)!=null&&k.desktop?r(ve,{className:"pdp-product__overlay__carousel",arrows:(c==null?void 0:c.length)>1,controls:(c==null?void 0:c.length)>1?n.controls.desktop:"dots",arrowsOnMainImage:n==null?void 0:n.arrowsOnMainImage,loop:(n==null?void 0:n.loopable)&&(c==null?void 0:c.length)>1,peak:((ee=n==null?void 0:n.thumbnails)==null?void 0:ee.length)>1&&((se=n==null?void 0:n.peak)==null?void 0:se.desktop)||!1,gap:(n==null?void 0:n.gap)||null,width:"100%",height:"100%",defaultIndex:O||0,thumbnails:L,children:T}):r(Je,{className:"pdp-product__images",gap:"small",children:T})}),d&&r(j,{node:d,className:"pdp-product__gallery-content"})]}),V("div",{className:"pdp-product__column-container pdp-product__content-column",children:[V("div",{className:"pdp-product__column-body",children:[V("div",{className:"pdp-product__header",children:[e&&r(j,{node:e,className:"pdp-product__title"}),f&&r(j,{node:f,className:"pdp-product__sku"})]}),V("div",{className:"pdp-product__prices",children:[R&&r(j,{node:R,className:$(["pdp-product__price-special","pdp-product__price"]),"aria-label":x,role:"text"}),B&&r(j,{node:B,className:$(["pdp-product__price-regular","pdp-product__price--grey"]),"aria-label":y,role:"text"})]}),(re=n==null?void 0:n.controls)!=null&&re.mobile&&((ue=n==null?void 0:n.controls)==null?void 0:ue.mobile)==="thumbnailsRow"?r(ve,{className:"pdp-product__images pdp-product__images--carousel pdp-product__images--carousel--thumbnails",width:"100%",height:"auto",arrows:(c==null?void 0:c.length)>1,controls:(c==null?void 0:c.length)>1?"thumbnailsRow":null,loop:(n==null?void 0:n.loopable)&&(c==null?void 0:c.length)>1,peak:((le=n==null?void 0:n.thumbnails)==null?void 0:le.length)>1&&((W=n==null?void 0:n.peak)==null?void 0:W.mobile)||!1,gap:(n==null?void 0:n.gap)||null,thumbnails:L,children:T}):r(ve,{className:"pdp-product__images pdp-product__images--carousel",peak:((te=n==null?void 0:n.peak)==null?void 0:te.mobile)&&(c==null?void 0:c.length)>1,gap:(n==null?void 0:n.gap)||null,width:"100%",height:"auto",arrows:(c==null?void 0:c.length)>1,controls:(c==null?void 0:c.length)>1?"dots":null,loop:(n==null?void 0:n.loopable)&&(c==null?void 0:c.length)>1,children:T}),V("div",{className:$(["pdp-product__actions",["pdp-product__actions--out-of-stock",h]]),children:[h&&r("div",{className:"pdp-product__out-of-stock__text",children:he}),m&&r(j,{node:m,className:$(["pdp-product__options"])}),v&&r("div",{className:"pdp-product__quantity",children:r(j,{node:v})}),P&&r(j,{node:P,className:$(["pdp-product__buttons"])})]}),b&&r(j,{node:b,className:$(["pdp-product__short_description"])}),l&&r(j,{node:l,className:$(["pdp-product__description"])}),G?r("div",{className:"pdp-product__attributes",children:G}):null]}),p&&r(j,{node:p,className:"pdp-product__info-content"})]}),s&&r(j,{node:s,className:"pdp-product__content"}),O===null?null:r(Ce,{className:"pdp-product__overlay",onClose:()=>g(null),centered:!0,children:r(ve,{className:"pdp-product__overlay__carousel",arrows:(c==null?void 0:c.length)>1,width:"100%",height:"100%",defaultIndex:O||0,loop:(n==null?void 0:n.loopable)&&(c==null?void 0:c.length)>1,controls:(c==null?void 0:c.length)>1?"dots":null,isZoomed:!0,children:T})})]})},Je=({children:e,gap:o=null,className:d,style:p,...s})=>{const f=de.count(e);return r("div",{...s,className:$(["pdp-gallery-grid",d]),style:{"--gap":o?`var(--spacing-${o})`:"0px",...p},children:de.map(e,(h,b)=>r("div",{className:"pdp-gallery-grid__item",children:r(j,{node:h,loading:b===0?"eager":"lazy"},h.props.src)},f+b))})},Ie=({amount:e,currency:o,locale:d,variant:p,sale:s,minimumAmount:f,maximumAmount:h,className:b,...l})=>r(Pe,{children:e||f===h?r("div",{className:"pdp-price-range",...l,children:r(ge,{amount:e||f,currency:o,locale:d,variant:p,sale:s,className:b})}):V("div",{className:"pdp-price-range",...l,children:[r(ge,{amount:f,currency:o,locale:d,className:b}),r("span",{className:"pdp-price-range__label",children:"-"}),r(ge,{amount:h,currency:o,locale:d,className:b})]})}),Ce=({centered:e,onClose:o,className:d,children:p,...s})=>{const f=F("PDP.Overlay.Close.label").label,h=ne(()=>{o==null||o()},[o]);return Z(()=>{const b=l=>{l.key==="Escape"&&h()};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b)}},[h]),Z(()=>{const b=document.scrollingElement,l=b.style.overflow;return b.style.overflow="hidden",()=>{b.style.overflow=l}},[]),V("div",{...s,className:$(["pdp-overlay",["pdp-overlay--centered",e],d]),children:[r("div",{className:"pdp-overlay__content",children:p}),r(_e,{"aria-label":f,variant:"tertiary",className:"pdp-overlay__close-button",onClick:h,icon:r(Be,{})})]})},et=["text","image","color","dropdown"],tt=e=>e.map(o=>({...o,text:o.label,disabled:!o.inStock}));function nt(e,o){return e.reduce((d,p)=>{const s=o==null?void 0:o.find(h=>h.items.find(b=>b.id===p));if(!s)return d;const f=s.items.find(h=>h.id===p);return{...d,[s.id]:{label:f.label,value:f.id}}},{})}const rt=({options:e,hideSelectedValue:o,selectedUIDs:d,onValues:p,onErrors:s,defaultOptions:f,selectionsToUpdate:h,className:b,children:l,...G})=>{const c=F("PDP.Swatches.Required.label").label,[m,B]=X(()=>e==null?void 0:e.reduce((P,n)=>{const{items:S}=n,E=S==null?void 0:S.find(y=>f==null?void 0:f.includes(y.id)),I=S==null?void 0:S.find(y=>y.selected);return E?{...P,[n.id]:{label:E.label,value:E.id}}:I?{...P,[n.id]:{label:I.label,value:I.id}}:P},{}));Z(()=>{if(d){const v=nt(d,e);if(JSON.stringify(v)===JSON.stringify(m))return;R(Object.keys(v)[0],v[Object.keys(v)[0]].label,d[0])}},[d]),Z(()=>{h==null||h.forEach(v=>{B(P=>{var E;const n=(E=v==null?void 0:v.items)==null?void 0:E.find(I=>I.selected);return n?{...P,[v.id]:{label:n==null?void 0:n.label,value:n==null?void 0:n.id}}:P})})},[h,B]),we(()=>{const v=e==null?void 0:e.reduce((P,n)=>{var S;return(S=n==null?void 0:n.items)==null||S.forEach(E=>{var y;const I=((y=m[n.id])==null?void 0:y.value)===E.id;n.required&&!I&&(P[n.id]=c)}),P},{});return s==null||s(v),v},[m]);const R=ne((v,P,n)=>{B(S=>{const E={...S,[v]:{label:P,value:n}};return p==null||p(E,n),E})},[p]),Q=(v,P)=>{var S;const n=((S=P.selectedOptions[0])==null?void 0:S.label)??"";R(v,n,P.value)},oe=ne(({items:v,id:P,required:n,type:S,selected:E,label:I})=>r("div",{className:$(["pdp-swatches__options"]),children:(S==null?void 0:S.toLowerCase())==="dropdown"?r(He,{"aria-label":I,handleSelect:y=>Q(P,y.target),options:tt(v),value:E}):v==null?void 0:v.map(y=>{const x={key:y.id,id:y.id,name:P,value:y.value,label:y.label,groupAriaLabel:I,selected:E===y.id,outOfStock:!y.inStock,required:n===null?!0:n,onValue:()=>{R(P,y.label,y.id)}};switch(S){case"text":return r(je,{...x,label:y.label});case"image":return r(qe,{...x,src:y.value,alt:y.label});case"color":return r(Ve,{...x,size:"large",color:y.value});default:return console.warn(`Invalid swatch type ${S}`),null}})}),[R]);return r("div",{...G,className:$(["pdp-swatches",b]),children:e==null?void 0:e.map(({type:v,label:P,id:n,multiple:S,required:E,items:I})=>{var y;if(!v){console.warn("Bundle product not supported on UI.");return}return et.includes(v)||console.warn(`Invalid swatch type ${v}`),S&&console.warn("Multiple selection swatches are not currently supported."),V("div",{id:`swatch-item-${n}`,"data-slot-key":`product-swatch--${n}`,className:"pdp-swatches__field",children:[r("div",{className:"pdp-swatches__field__label",children:m[n]?o?`${P}`:`${P}: ${m[n].label}`:P}),r(oe,{id:n,type:v,required:E,items:I,label:P,selected:(y=m[n])==null?void 0:y.value})]},`swatch-item-${n}`)})})},lt=({children:e,scale:o=2,closeButton:d=!0})=>{const[p,s]=X(!1),[f,h]=X("pdp-zoom"),[b,l]=X(!1),[G,c]=X({x:0,y:0}),[m,B]=X({x:0,y:0}),[R,Q]=X({x:0,y:0}),oe=t=>{!p||t.type!=="touchstart"||(c({x:t.touches[0].clientX,y:t.touches[0].clientY}),B({x:R.x,y:R.y}),l(!0))},v=t=>{var re;if(!b||t.type!=="touchmove")return;const O=(re=t.currentTarget)==null?void 0:re.getBoundingClientRect(),g=(100-100/o)/2,T=t.touches[0].clientX-G.x,L=t.touches[0].clientY-G.y,C=T*100/(O.width*o),k=L*100/(O.height*o),ee=m.x+C,se=m.y+k;Q({x:Math.max(-g,Math.min(ee,g))||0,y:Math.max(-g,Math.min(se,g))||0}),t.preventDefault()},P=t=>{var k;const O=(k=t.currentTarget)==null?void 0:k.getBoundingClientRect(),g=(100-100/o)/2;let T;if("touches"in t)T=t.touches[0];else if(t instanceof MouseEvent)T=t;else return;const L=g-(T.clientX-O.left)/O.width*100,C=g-(T.clientY-O.top)/O.height*100;Q({x:Math.max(-g,Math.min(L,g))||0,y:Math.max(-g,Math.min(C,g))||0})},n=t=>{if(!b){if(p){if(d&&"touches"in t){oe(t);return}d||s(!1)}else s(!0),P(t);t.preventDefault()}},S=t=>{if(d&&"touches"in t){v(t);return}p&&P(t)},E=()=>{if(d){l(!1);return}s(!1)},I=t=>{s(!1),t.stopPropagation()},y=p?`scale(${o}) translateX(${R.x}%) translateY(${R.y}%)`:"none",x=F("PDP.Zoom.Close.label").label,he=Ge(de.only(e),{draggable:!1,style:{"--transform":y}});return Z(()=>{h(p?`pdp-zoom ${d?"pdp-zoom--no-effects":"pdp-zoom--zoomed"}`:"pdp-zoom")},[p,d]),V("figure",{className:f,onClick:n,onMouseMove:S,onMouseLeave:E,onTouchStart:n,onTouchMove:S,onTouchEnd:E,children:[he,d&&p&&r(_e,{"aria-label":x,variant:"tertiary",className:"pdp-zoom__close-button",icon:r(Be,{}),onClick:I})]})};function at(e,o="en_US"){if(!ze(e))throw Error("Invalid date string");return e.split(" ")[1]||(e=`${e} 00:00:00`),new Date(e).toLocaleDateString(De(o)).toString()}function ze(e){if(![/^\d{4}-\d{2}-\d{2}$/,/^\d{1,2}\/\d{1,2}\/\d{4}$/,/^\d{2}\/\d{2}\/\d{4}$/,/^\d{4}\/\d{2}\/\d{2}$/,/^\d{1,2}\.\d{1,2}\.\d{4}$/,/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/].some(p=>p.test(e)))return!1;const d=new Date(e);return!isNaN(d.getTime())}function ct(e){const o=new URLSearchParams(window.location.search);Object.entries(e).forEach(([p,s])=>{s===null?o.delete(p):o.set(p,String(s))});let d=window.location.pathname;d+=`?${o.toString()}`,d+=window.location.hash,window.history.replaceState({},"",d)}function ot(){const e=new URLSearchParams(window.location.search),o={};return e.forEach((d,p)=>{o[p]=d}),o}function it(e){var o,d,p,s,f,h,b,l,G,c,m,B;return{productId:Number(e==null?void 0:e.externalId),name:e==null?void 0:e.name,sku:e==null?void 0:e.sku,topLevelSku:e==null?void 0:e.externalParentId,specialToDate:void 0,specialFromDate:void 0,newToDate:void 0,newFromDate:void 0,createdAt:void 0,updatedAt:void 0,manufacturer:void 0,countryOfManufacture:void 0,categories:void 0,productType:void 0,pricing:{regularPrice:((d=(o=e==null?void 0:e.prices)==null?void 0:o.regular)==null?void 0:d.amount)||0,minimalPrice:(s=(p=e==null?void 0:e.prices)==null?void 0:p.final)==null?void 0:s.minimumAmount,maximalPrice:(h=(f=e==null?void 0:e.prices)==null?void 0:f.final)==null?void 0:h.maximumAmount,specialPrice:(l=(b=e==null?void 0:e.prices)==null?void 0:b.final)==null?void 0:l.amount,tierPricing:void 0,currencyCode:((c=(G=e==null?void 0:e.prices)==null?void 0:G.final)==null?void 0:c.currency)||"USD"},canonicalUrl:e==null?void 0:e.url,mainImageUrl:(B=(m=e==null?void 0:e.images)==null?void 0:m[0])==null?void 0:B.url}}const dt={PRODUCT_CONTEXT:"productContext"},st={PRODUCT_PAGE_VIEW:"product-page-view"};function Ue(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function ht(e,o){const d=Ue();d.push({[e]:null}),d.push({[e]:o})}function pt(e,o){Ue().push(p=>{const s=p.getState?p.getState():{};p.push({event:e,eventInfo:{...s,...o}})})}function Oe(e){const o=it(e);ht(dt.PRODUCT_CONTEXT,o),pt(st.PRODUCT_PAGE_VIEW)}const ut=({sku:e,hideSku:o,hideQuantity:d,hideShortDescription:p,hideDescription:s,hideAttributes:f,hideURLParams:h,hideSelectedOptionValue:b,slots:l,children:G,initialData:c,carousel:m,optionsConfig:B,useACDL:R,onAddToCart:Q,zoomType:oe,closeButton:v=!0,...P})=>{var ae,N,Y,U;const n=F("PDP.Product.AddToCart.label").label,S=F("PDP.Product.Incrementer.label").label,E=F("PDP.Product.Details.label").label,[I,y]=X(Te.getConfig().defaultLocale||"en-US"),[x,he]=X(),[t=null,O]=X(c),[g,T]=X(()=>{const i={sku:e,quantity:1};return t!=null&&t.optionUIDs&&(i.optionsUIDs=t.optionUIDs),i}),[L,C]=X(()=>{var i,_;return!(t!=null&&t.options&&((i=t==null?void 0:t.options)==null?void 0:i.length)>0&&((_=t==null?void 0:t.optionUIDs)==null?void 0:_.length)!==(t==null?void 0:t.options.length))}),k={data:t,values:g,valid:L};Z(()=>{const i=Le.on("pdp/setValues",_=>{T(w=>({...w,..._}))});return()=>{i==null||i.off()}},[]),Z(()=>{const i=Le.on("locale",_=>{_!==I&&(y(_),$e(e).then(O))});return()=>{i==null||i.off()}},[I,e]),Z(()=>{R&&c&&Object.keys(c).length>0&&Oe(c)},[c]);const ee=ne(i=>{T(_=>({..._,...i}))},[]);Z(()=>{Le.emit("pdp/values",g)},[JSON.stringify(g)]);const se=ne(i=>{var w;let _=Object.keys(i).map(A=>i[A].value).filter(A=>A!==void 0);h||ct({optionsUIDs:_.join(",")}),ee({optionsUIDs:_}),C((_==null?void 0:_.length)===((w=t==null?void 0:t.options)==null?void 0:w.length)),Re(e,_,B==null?void 0:B.anchorOptions).then(A=>{var z;O(A),(z=B==null?void 0:B.anchorOptions)!=null&&z.length&&re(A,_),R&&(A==null?void 0:A.sku)!==e&&Oe(A)})},[e]),re=ne((i,_)=>{var z;const w=(i==null?void 0:i.optionUIDs)??[];_.every(ie=>w.includes(ie))||(he(i==null?void 0:i.options),ee({optionsUIDs:w}),C((w==null?void 0:w.length)===((z=i==null?void 0:i.options)==null?void 0:z.length)))},[e]),ue=ne(i=>{Object.keys(i).length!==0&&C(!1)},[]),le=we(()=>{var i;return(i=t==null?void 0:t.attributes)==null?void 0:i.map(({label:_,value:w},A)=>{const z=ze(w)?at(w,I):w.toString();return V("li",{children:[_,": ",r("span",{dangerouslySetInnerHTML:{__html:z}})]},A)})},[t==null?void 0:t.attributes,I]),W=!d&&(t!=null&&t.inStock)?r(K,{name:"Quantity",slot:l==null?void 0:l.Quantity,context:{...k},children:r(Xe,{name:"quantity",defaultValue:g.quantity.toString(),value:g.quantity.toString(),min:1,"aria-label":S,className:"pdp-product__quantity",onValue:i=>{ee({quantity:Number(i)})}},"quantity")}):void 0,te=()=>{if(t!=null&&t.options)return r(K,{name:"Options",slot:l==null?void 0:l.Options,context:{...k},children:r(rt,{selectedUIDs:g.optionsUIDs,options:t.options,defaultOptions:g.optionsUIDs,selectionsToUpdate:x,hideSelectedValue:b,onValues:se,onErrors:ue})})};return r("div",{...P,children:r(Qe,{title:r(K,{name:"Title",slot:l==null?void 0:l.Title,context:{...k},children:t==null?void 0:t.name}),sku:o?void 0:r(K,{name:"SKU",slot:l==null?void 0:l.SKU,context:{...k},children:t==null?void 0:t.sku}),options:te(),breadcrumbs:(l==null?void 0:l.Breadcrumbs)&&r(K,{name:"Breadcrumbs",slot:l==null?void 0:l.Breadcrumbs,context:{...k,setSeparator(i){this._registerMethod((..._)=>{const w=i(..._),A=w&&r(fe,{source:w});this._setProps(z=>({...z,separator:A}))})},appendLink(i){this._registerMethod((..._)=>{const{text:w,...A}=i(..._),z=r("a",{...A,children:w});this._setProps(ie=>({...ie,categories:[...ie.categories||[],z]}))})},appendHTMLElement(i){this._registerMethod((..._)=>{const w=i(..._),A=this._htmlElementToVNode(w);this._setProps(z=>({...z,categories:[...z.categories||[],A]}))})}},render:({separator:i,categories:_})=>r(Fe,{separator:i,categories:_})}),quantity:W,actions:r(K,{name:"Actions",slot:l==null?void 0:l.Actions,context:{...k,appendButton(i){this._registerMethod((..._)=>{const w=i(..._);if(!w)return;const{text:A,icon:z,...ie}=w,ye=r(_e,{type:"button",...ie,icon:z&&r(fe,{source:z}),children:A});this._setProps(Se=>({children:[...Se.children||[],ye]}))})}},children:!(l!=null&&l.Actions)&&r(_e,{size:"medium",type:"submit",icon:r(fe,{source:"Cart"}),disabled:!(t!=null&&t.inStock)||!L,"aria-label":n,onClick:()=>Q==null?void 0:Q(g),children:n})}),shortDescription:p?void 0:r(K,{name:"ShortDescription",slot:l==null?void 0:l.ShortDescription,context:{...k},children:r("div",{dangerouslySetInnerHTML:{__html:(t==null?void 0:t.shortDescription)??""}})}),description:s?void 0:r(K,{name:"Description",slot:l==null?void 0:l.Description,context:{...k},children:r("div",{dangerouslySetInnerHTML:{__html:(t==null?void 0:t.description)??""}})}),images:((ae=t==null?void 0:t.images)==null?void 0:ae.map(({label:i,url:_})=>{var w,A;return r(ke,{title:i,alt:i,src:_,width:((w=m==null?void 0:m.imageParams)==null?void 0:w.width)??960,height:((A=m==null?void 0:m.imageParams)==null?void 0:A.height)??1191,params:(m==null?void 0:m.imageParams)??{width:960}},_)}))??[],specialPrice:(N=t==null?void 0:t.prices)!=null&&N.visible?r(K,{name:"SpecialPrice",slot:l==null?void 0:l.SpecialPrice,context:{...k},children:r(Ie,{...t.prices.final,locale:De(I)})}):void 0,price:(Y=t==null?void 0:t.prices)!=null&&Y.visible&&t.prices.regular&&t.prices.final.amount!==(t==null?void 0:t.prices.regular.amount)?r(K,{name:"RegularPrice",slot:l==null?void 0:l.RegularPrice,context:{...k},children:r(Ie,{...t.prices.regular,locale:De(I)})}):void 0,zoomType:oe,closeButton:v,carouselConfig:{...m,thumbnails:m&&Object.keys(m).length?((U=t==null?void 0:t.images)==null?void 0:U.map(({label:i,url:_})=>{var w,A;return r(ke,{title:i,alt:i,src:_,width:((w=m==null?void 0:m.thumbnailParams)==null?void 0:w.width)??200,height:((A=m==null?void 0:m.thumbnailParams)==null?void 0:A.height)??248,params:(m==null?void 0:m.thumbnailParams)??{width:200}},_)}))??[]:[]},outOfStock:!(t!=null&&t.inStock),attributes:f?void 0:r(K,{name:"Attributes",slot:l==null?void 0:l.Attributes,context:{...k},children:le!=null&&le.length?V(Pe,{children:[E,r("ul",{children:le})]}):null}),galleryContent:(l==null?void 0:l.GalleryContent)&&r(K,{name:"GalleryContent",slot:l.GalleryContent,context:{...k}}),infoContent:(l==null?void 0:l.InfoContent)&&r(K,{name:"InfoContent",slot:l.InfoContent,context:{...k}}),productContent:(l==null?void 0:l.Content)&&r(K,{name:"Content",slot:l.Content,context:{...k}})})})};ut.getInitialData=async function({sku:e,optionsConfig:o}){var p,s,f,h,b,l;const d=((p=ot().optionsUIDs)==null?void 0:p.split(","))||((l=(b=(h=(f=(s=Te)==null?void 0:s.getConfig())==null?void 0:f.models)==null?void 0:h.ProductDetails)==null?void 0:b.initialData)==null?void 0:l.optionsUIDs);return d!=null&&d.length?await Re(e,d,o==null?void 0:o.anchorOptions):await $e(e)};export{ut as ProductDetails,ut as default};
|
|
1
|
+
import{jsxs as j,jsx as r,Fragment as ye}from"@dropins/tools/preact-jsx-runtime.js";import*as be from"@dropins/tools/preact-compat.js";import{useState as Y,Children as de,useRef as Ne,useMemo as Se,useEffect as J,useCallback as le}from"@dropins/tools/preact-compat.js";import{debounce as ke,classes as R,VComponent as G,toLanguageTag as xe,Slot as Q}from"@dropins/tools/lib.js";import{Button as ve,Icon as we,Price as ge,Picker as He,ColorSwatch as qe,ImageSwatch as je,TextSwatch as Xe,Incrementer as Fe,Breadcrumbs as Le,Image as Me}from"@dropins/tools/components.js";import{useText as K}from"@dropins/tools/i18n.js";import{cloneElement as Ge}from"@dropins/tools/preact.js";import{c as Re,d as Te}from"../chunks/getRefinedProduct.js";import{events as De}from"@dropins/tools/event-bus.js";import{c as Be}from"../chunks/initialize.js";import"@dropins/tools/fetch-graphql.js";const Ye=t=>be.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},be.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),Ve=t=>be.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},be.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3599 5.64001L5.62988 18.37",stroke:"currentColor"}),be.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3599 18.37L5.62988 5.64001",stroke:"currentColor"})),Ke=24,Oe=16,fe=2,Ze="32";var We=(t=>(t[t.small=16]="small",t[t.medium=24]="medium",t[t.large=64]="large",t))(We||{});const Pe=({show:t=1,scrollbar:o=!1,peak:h=!1,arrows:p=!1,controls:i="dots",arrowsOnMainImage:f=!1,loop:d=!1,gap:v=null,direction:l="horizontal",width:X="100%",height:c="100%",defaultIndex:m=0,className:T,children:O,thumbnails:U=null,isZoomed:te,...b})=>{const w=K("PDP.Carousel.label").label,n=K("PDP.Carousel.Slide.label").label,y=K("PDP.Carousel.Previous.label").label,k=K("PDP.Carousel.Next.label").label,E=K("PDP.Carousel.Controls.label").label,S=K("PDP.Carousel.Controls.Button.label").label,[A,he]=Y(()=>Ee(t)),e=Math.ceil(de.count(O)/A),I=h?Ke:0,g=v?We[v]:0,z=de.count(O)%A,[L,ee]=Y(d?m+1:m),x=Ne([]),[ne,ae]=Y(0),[ce,_e]=Y(0),pe=Se(()=>de.toArray(U),[U]),B=Se(()=>{const a=de.toArray(O).reduce((u,D,M)=>M%A===0?[...u,[D]]:[...u.slice(0,-1),[...u[u.length-1],D]],[]);return!d||a.length===1?a:d&&de.count(O)%A===0?[a[e-1]].concat(a).concat([a[0],a[1]]):[de.toArray(O).slice(-A)].concat(a).concat([a[0],a[1]])},[O,A,e,d]),re=Ne(null),ie=Ne(null),N=i==="thumbnailsRow"||i==="thumbnailsColumn";J(()=>{const a=document.body,u=ke(()=>{var q,oe;ae(((q=re.current)==null?void 0:q.offsetWidth)??0),_e(((oe=re.current)==null?void 0:oe.offsetHeight)??0);const M=window.innerWidth,F=Ee(t,M);F!==A&&he(F)},50),D=new ResizeObserver(u);return D.observe(a),()=>{D.unobserve(a)}},[A,t]);const Z=le(a=>{const u=d?a-1:a,D=x==null?void 0:x.current[0],M=(D==null?void 0:D.offsetWidth)+Oe,F=(D==null?void 0:D.offsetHeight)+Oe,q=ie.current,oe=i==="thumbnailsRow",Ae=i==="thumbnailsColumn",me=oe?q==null?void 0:q.offsetWidth:q==null?void 0:q.offsetHeight,C=oe?M:F;(oe||Ae)&&me&&(C*(u+1)>me&&(q.style.scrollBehavior="smooth",oe?q.scrollLeft=(u+fe)*C:q.scrollTop=(u+fe)*C),(oe?q.scrollLeft:q.scrollTop)>C*u&&(q.style.scrollBehavior="smooth",oe?q.scrollLeft=(u-fe)*C:q.scrollTop=(u-fe)*C))},[i,d]);J(()=>{Z(L)},[L,Z]);const H=le((a,u,D)=>{N&&Z(a);const M=re.current,F=I?M.offsetWidth-I:M.offsetWidth-I+g;if(!Array.from(M.querySelectorAll("[data-index]")).filter(me=>{const C=Number(me.getAttribute("data-index"));return!isNaN(C)&&C>-1})[a])return;if(D){const me=a===0?e:0,C=F*(e+(z||A)/A);if(M.scrollLeft>=0&&M.scrollLeft<F-5){H(1,!0);return}if(M.scrollLeft>C-F&&M.scrollLeft<=C){H(e,!0);return}M.style.scrollBehavior="auto",M.scrollLeft=me===0?0:C,H(me===0?1:e,!0);return}const Ae=(M.offsetWidth-g)/A*B[a].length-I;M.style.scrollBehavior=u?"smooth":"auto",M.scrollLeft=B[a].length===A?F*a:F*(a-1)+Ae},[g,e,I,A,z,B,Z,i]),ue=le(()=>{if(d){const u=L-1;H(u,!0,L===1);return}const a=L<=0?0:L-1;H(a,!0)},[L,H,d]),s=le(()=>{const a=B.length-1;if(d){const D=L+1;H(D,!0,L===e);return}const u=L>=a?a:L+1;H(u,!0)},[B.length,d,L,H,e]);J(()=>{const a=u=>{u.key==="ArrowLeft"&&(u.preventDefault(),ue()),u.key==="ArrowRight"&&(u.preventDefault(),s())};return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[s,ue]),J(()=>{H(d?m+1:m,!1)},[m,H,d]);const _=ke(()=>{const a=re.current,u=I?a.offsetWidth-I:a.offsetWidth-I+g,D=a.scrollLeft/u,M=Math.round(D)-D<1?Math.round(D):Math.ceil(D);if(N&&Z(M),d){const F=u*(e+(z||A)/A);if(Math.ceil(a.scrollLeft)>=Math.ceil(F)-5){a.style.scrollBehavior="auto",a.scrollLeft=a.offsetWidth*1+(Math.ceil(a.scrollLeft)-Math.ceil(F)-I);return}if(a.scrollLeft===0){a.style.scrollBehavior="auto",a.scrollLeft=F-a.offsetWidth+I;return}}L!==M&&ee(M)},100);J(()=>{const a=re.current;return a==null||a.addEventListener("scroll",_),()=>{a==null||a.removeEventListener("scroll",_)}},[_]);const P=(a,u,D)=>r(ve,{className:R([["pdp-carousel__button",!a],[`pdp-carousel__button--${u}`,!a],[`pdp-carousel__button--${i}`,a]]),style:{"--height":`${ce}px`},variant:"tertiary","aria-label":u==="next"?k:y,onClick:D,disabled:d?!1:u==="next"?L>=B.length-1:L<1,children:r(we,{className:R([["pdp-carousel__button__icon",!a],[`pdp-carousel__button__icon--${u}`,!a],[`pdp-carousel__button__icon--${i}--${u}`,a]]),size:Ze,source:Ye})}),V=p&&B.length!=1&&P(N,"prev",ue),W=p&&B.length!=1&&P(N,"next",s),$=p&&B.length!=1&&P(!1,"prev",ue),se=p&&B.length!=1&&P(!1,"next",s);return j("div",{role:"region","aria-roledescription":w,className:R(["pdp-carousel",["pdp-carousel--main-image-controls",f],["pdp-carousel--arrows",p&&!N],[`pdp-carousel--${i}`,N],T]),style:{"--flex-carousel":i==="thumbnailsColumn"?"row-reverse":"column","--gap":N?"0":"var(--spacing-small)","--width":X},...b,children:[r("div",{ref:re,className:R(["pdp-carousel__wrapper",`pdp-carousel__wrapper--${l}`,["pdp-carousel__wrapper--scrollbar",o],["pdp-carousel__wrapper--peak",h]]),style:{"--total-width":i==="thumbnailsColumn"?"81.6%":"100%","--height":i==="thumbnailsColumn"?"auto":c,"--gap":v?`var(--spacing-${v})`:"0px","--per-page":A},tabIndex:0,children:B.map((a,u)=>{const D=a.length<A;return r("div",{role:"group","aria-roledescription":n,"data-index":u,className:R(["pdp-carousel__slide",`pdp-carousel__slide--${l}`,["pdp-carousel__slide--active",L===u],["pdp-carousel__slide--orphan",D]]),style:{"--length":a.length},children:a},u)})}),!N&&j(ye,{children:[V,W]}),N&&f&&j(ye,{children:[$,se]}),i&&B.length!=1&&j("div",{className:R([[`pdp-carousel__controls__container--${i}`,N],["pdp-carousel__controls__container--no-arrows",!p||f]]),style:{"--width":i==="thumbnailsRow"?`${ne}px`:X,"--height":`${ce}px`,"--nr-thumbnails":pe.length},children:[(N||te)&&!f&&V,r("div",{ref:ie,className:R([[`pdp-carousel__controls__wrapper--${i}`,N],["pdp-carousel__controls__wrapper",N]]),children:r("div",{role:"group","aria-label":E,className:R(["pdp-carousel__controls",[`pdp-carousel__controls--${i}`,N]]),children:(d?B.slice(0,e):B).map((a,u)=>{const D=d?e:B.length,M=d?L-1===u:L===u;return N?j("label",{className:R(["pdp-carousel__thumbnail__container"]),ref:F=>{F&&(x.current[u]=F)},children:[r("input",{type:"radio",name:"carousel-thumbnails","aria-label":S.replace("{key}",String(u+1)).replace("{total}",String(D)),checked:M&&ne!==0,onChange:()=>{H(d?u+1:u,!0)},...b,className:R(["pdp-carousel__thumbnail",["pdp-carousel__thumbnail--selected",M&&ne!==0]])}),r("span",{className:R(["pdp-carousel__thumbnail__span"]),children:pe[u]})]},u):r("button",{"aria-label":S.replace("{key}",String(u+1)).replace("{total}",String(D)),onClick:()=>{H(d?u+1:u,!0)},className:R(["pdp-carousel__controls__button",["pdp-carousel__controls__button--active",M]])},u)})})}),(N||te)&&!f&&W]})]})};function Ee(t,o=0){if(typeof t=="number")return t;const{small:h,medium:p,large:i}=t,d=[{breakpoint:1024,value:i},{breakpoint:786,value:p},{breakpoint:0,value:h}].find(({breakpoint:v})=>o>v);return d?d.value:h}const Qe=({title:t,breadcrumbs:o,galleryContent:h,infoContent:p,productContent:i,sku:f,outOfStock:d,shortDescription:v,description:l,attributes:X,images:c,options:m,price:T,specialPrice:O,className:U,children:te,quantity:b,actions:w,carouselConfig:n,zoomType:y="overlay",closeButton:k=!0,...E})=>{var ee,x,ne,ae,ce,_e,pe,B,re;const S=K("PDP.Product.RegularPrice.label").label,A=K("PDP.Product.SpecialPrice.label").label,he=K("PDP.Product.OutOfStock.label").label,e=K("PDP.Product.Image.label").label,[I,g]=Y(null),z=c!=null&&c.length?c.map((ie,N)=>{var H;const Z=((H=t==null?void 0:t.props)==null?void 0:H.children)&&(e==null?void 0:e.replace("{product}",t.props.children.toString()).replace("{key}",String(N+1)).replace("{total}",String(c.length)));return y==="zoom"?r(lt,{closeButton:k,children:r(G,{node:ie,loading:N===0?"eager":"lazy",alt:Z},N)}):r(G,{node:ie,loading:N===0?"eager":"lazy",alt:Z,onClick:()=>g(N)},N)}):r("img",{src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",className:"pdp-product__images__placeholder","aria-hidden":!0}),L=(ee=n==null?void 0:n.thumbnails)!=null&&ee.length?n.thumbnails.map((ie,N)=>{var Z;return r(G,{node:ie,loading:(n==null?void 0:n.thumbnailsLoadingMode)||"lazy",alt:((Z=t==null?void 0:t.props)==null?void 0:Z.children)&&(e==null?void 0:e.replace("{product}",t.props.children.toString()).replace("{key}",String(N+1)).replace("{total}",String(c.length)))},N)}):r("img",{src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",className:"pdp-product__images__placeholder","aria-hidden":!0});return j("div",{...E,className:R(["pdp-product",U]),children:[o&&r(G,{node:o,className:"pdp-product__breadcrumbs"}),j("div",{className:"pdp-product__column-container pdp-product__gallery-column",children:[r("div",{className:"pdp-product__column-body",children:(x=n==null?void 0:n.controls)!=null&&x.desktop?r(Pe,{className:"pdp-product__overlay__carousel",arrows:(c==null?void 0:c.length)>1,controls:(c==null?void 0:c.length)>1?n.controls.desktop:"dots",arrowsOnMainImage:n==null?void 0:n.arrowsOnMainImage,loop:(n==null?void 0:n.loopable)&&(c==null?void 0:c.length)>1,peak:((ne=n==null?void 0:n.thumbnails)==null?void 0:ne.length)>1&&((ae=n==null?void 0:n.peak)==null?void 0:ae.desktop)||!1,gap:(n==null?void 0:n.gap)||null,width:"100%",height:"100%",defaultIndex:I||0,thumbnails:L,children:z}):r(Je,{className:"pdp-product__images",gap:"small",children:z})}),h&&r(G,{node:h,className:"pdp-product__gallery-content"})]}),j("div",{className:"pdp-product__column-container pdp-product__content-column",children:[j("div",{className:"pdp-product__column-body",children:[j("div",{className:"pdp-product__header",children:[t&&r(G,{node:t,className:"pdp-product__title"}),f&&r(G,{node:f,className:"pdp-product__sku"})]}),j("div",{className:"pdp-product__prices",children:[O&&r(G,{node:O,className:R(["pdp-product__price-special","pdp-product__price"]),"aria-label":A,role:"text"}),T&&r(G,{node:T,className:R(["pdp-product__price-regular","pdp-product__price--grey"]),"aria-label":S,role:"text"})]}),(ce=n==null?void 0:n.controls)!=null&&ce.mobile&&((_e=n==null?void 0:n.controls)==null?void 0:_e.mobile)==="thumbnailsRow"?r(Pe,{className:"pdp-product__images pdp-product__images--carousel pdp-product__images--carousel--thumbnails",width:"100%",height:"auto",arrows:(c==null?void 0:c.length)>1,controls:(c==null?void 0:c.length)>1?"thumbnailsRow":null,loop:(n==null?void 0:n.loopable)&&(c==null?void 0:c.length)>1,peak:((pe=n==null?void 0:n.thumbnails)==null?void 0:pe.length)>1&&((B=n==null?void 0:n.peak)==null?void 0:B.mobile)||!1,gap:(n==null?void 0:n.gap)||null,thumbnails:L,children:z}):r(Pe,{className:"pdp-product__images pdp-product__images--carousel",peak:((re=n==null?void 0:n.peak)==null?void 0:re.mobile)&&(c==null?void 0:c.length)>1,gap:(n==null?void 0:n.gap)||null,width:"100%",height:"auto",arrows:(c==null?void 0:c.length)>1,controls:(c==null?void 0:c.length)>1?"dots":null,loop:(n==null?void 0:n.loopable)&&(c==null?void 0:c.length)>1,children:z}),j("div",{className:R(["pdp-product__actions",["pdp-product__actions--out-of-stock",d]]),children:[d&&r("div",{className:"pdp-product__out-of-stock__text",children:he}),m&&r(G,{node:m,className:R(["pdp-product__options"])}),b&&r("div",{className:"pdp-product__quantity",children:r(G,{node:b})}),w&&r(G,{node:w,className:R(["pdp-product__buttons"])})]}),v&&r(G,{node:v,className:R(["pdp-product__short_description"])}),l&&r(G,{node:l,className:R(["pdp-product__description"])}),X?r("div",{className:"pdp-product__attributes",children:X}):null]}),p&&r(G,{node:p,className:"pdp-product__info-content"})]}),i&&r(G,{node:i,className:"pdp-product__content"}),I===null?null:r(Ce,{className:"pdp-product__overlay",onClose:()=>g(null),centered:!0,children:r(Pe,{className:"pdp-product__overlay__carousel",arrows:(c==null?void 0:c.length)>1,width:"100%",height:"100%",defaultIndex:I||0,loop:(n==null?void 0:n.loopable)&&(c==null?void 0:c.length)>1,controls:(c==null?void 0:c.length)>1?"dots":null,isZoomed:!0,children:z})})]})},Je=({children:t,gap:o=null,className:h,style:p,...i})=>{const f=de.count(t);return r("div",{...i,className:R(["pdp-gallery-grid",h]),style:{"--gap":o?`var(--spacing-${o})`:"0px",...p},children:de.map(t,(d,v)=>r("div",{className:"pdp-gallery-grid__item",children:r(G,{node:d,loading:v===0?"eager":"lazy"},d.props.src)},f+v))})},Ie=({amount:t,currency:o,locale:h,variant:p,sale:i,minimumAmount:f,maximumAmount:d,className:v,...l})=>r(ye,{children:t||f===d?r("div",{className:"pdp-price-range",...l,children:r(ge,{amount:t||f,currency:o,locale:h,variant:p,sale:i,className:v})}):j("div",{className:"pdp-price-range",...l,children:[r(ge,{amount:f,currency:o,locale:h,className:v}),r("span",{className:"pdp-price-range__label",children:"-"}),r(ge,{amount:d,currency:o,locale:h,className:v})]})}),Ce=({centered:t,onClose:o,className:h,children:p,...i})=>{const f=K("PDP.Overlay.Close.label").label,d=le(()=>{o==null||o()},[o]);return J(()=>{const v=l=>{l.key==="Escape"&&d()};return document.addEventListener("keydown",v),()=>{document.removeEventListener("keydown",v)}},[d]),J(()=>{const v=document.scrollingElement,l=v.style.overflow;return v.style.overflow="hidden",()=>{v.style.overflow=l}},[]),j("div",{...i,className:R(["pdp-overlay",["pdp-overlay--centered",t],h]),children:[r("div",{className:"pdp-overlay__content",children:p}),r(ve,{"aria-label":f,variant:"tertiary",className:"pdp-overlay__close-button",onClick:d,icon:r(Ve,{})})]})},et=["text","image","color","dropdown"],tt=t=>t.map(o=>({...o,text:o.label,disabled:!o.inStock}));function nt(t,o){return t.reduce((h,p)=>{const i=o==null?void 0:o.find(d=>d.items.find(v=>v.id===p));if(!i)return h;const f=i.items.find(d=>d.id===p);return{...h,[i.id]:{label:f.label,value:f.id}}},{})}const rt=({options:t,hideSelectedValue:o,selectedUIDs:h,onValues:p,onErrors:i,defaultOptions:f,selectionsToUpdate:d,className:v,children:l,...X})=>{const c=K("PDP.Swatches.Required.label").label,[m,T]=Y(()=>t==null?void 0:t.reduce((w,n)=>{const{items:y}=n,k=y==null?void 0:y.find(S=>f==null?void 0:f.includes(S.id)),E=y==null?void 0:y.find(S=>S.selected);return k?{...w,[n.id]:{label:k.label,value:k.id}}:E?{...w,[n.id]:{label:E.label,value:E.id}}:w},{}));J(()=>{if(h){const b=nt(h,t);if(JSON.stringify(b)===JSON.stringify(m))return;O(Object.keys(b)[0],b[Object.keys(b)[0]].label,h[0])}},[h]),J(()=>{d==null||d.forEach(b=>{T(w=>{var k;const n=(k=b==null?void 0:b.items)==null?void 0:k.find(E=>E.selected);return n?{...w,[b.id]:{label:n==null?void 0:n.label,value:n==null?void 0:n.id}}:w})})},[d,T]),Se(()=>{const b=t==null?void 0:t.reduce((w,n)=>{var k;let y=!1;return(k=n==null?void 0:n.items)==null||k.forEach(E=>{var A;((A=m[n.id])==null?void 0:A.value)===E.id&&(y=!0)}),n.required&&!y&&(w[n.id]=c),w},{});return i==null||i(b),b},[m]);const O=le((b,w,n)=>{T(y=>{const k={...y,[b]:{label:w,value:n}};return p==null||p(k,n),k})},[p]),U=(b,w)=>{var y;const n=((y=w.selectedOptions[0])==null?void 0:y.label)??"";O(b,n,w.value)},te=le(({items:b,id:w,required:n,type:y,selected:k,label:E})=>(b==null?void 0:b.length)>0&&r("div",{className:R(["pdp-swatches__options"]),children:(y==null?void 0:y.toLowerCase())==="dropdown"?r(He,{"aria-label":E,handleSelect:S=>U(w,S.target),options:tt(b),value:k}):b==null?void 0:b.map(S=>{const A={key:S.id,id:S.id,name:w,value:S.value,label:S.label,groupAriaLabel:E,selected:k===S.id,outOfStock:!S.inStock,required:n===null?!0:n,onValue:()=>{O(w,S.label,S.id)}};switch(y){case"text":return r(Xe,{...A,label:S.label});case"image":return r(je,{...A,src:S.value,alt:S.label});case"color":return r(qe,{...A,size:"large",color:S.value});default:return console.warn(`Invalid swatch type ${y}`),null}})}),[O]);return r("div",{...X,className:R(["pdp-swatches",v]),children:t==null?void 0:t.map(({type:b,label:w,id:n,multiple:y,required:k,items:E})=>{var S;return et.includes(b)||console.warn(`Invalid swatch type ${b}`),y&&console.warn("Multiple selection swatches are not currently supported."),j("div",{id:`swatch-item-${n}`,"data-slot-key":`product-swatch--${n}`,className:"pdp-swatches__field",children:[r("div",{className:"pdp-swatches__field__label",children:m[n]?o?`${w}`:`${w}: ${m[n].label}`:w}),r(te,{id:n,type:b,required:k,items:E,label:w,selected:(S=m[n])==null?void 0:S.value})]},`swatch-item-${n}`)})})},lt=({children:t,scale:o=2,closeButton:h=!0})=>{const[p,i]=Y(!1),[f,d]=Y("pdp-zoom"),[v,l]=Y(!1),[X,c]=Y({x:0,y:0}),[m,T]=Y({x:0,y:0}),[O,U]=Y({x:0,y:0}),te=e=>{!p||e.type!=="touchstart"||(c({x:e.touches[0].clientX,y:e.touches[0].clientY}),T({x:O.x,y:O.y}),l(!0))},b=e=>{var ce;if(!v||e.type!=="touchmove")return;const I=(ce=e.currentTarget)==null?void 0:ce.getBoundingClientRect(),g=(100-100/o)/2,z=e.touches[0].clientX-X.x,L=e.touches[0].clientY-X.y,ee=z*100/(I.width*o),x=L*100/(I.height*o),ne=m.x+ee,ae=m.y+x;U({x:Math.max(-g,Math.min(ne,g))||0,y:Math.max(-g,Math.min(ae,g))||0}),e.preventDefault()},w=e=>{var x;const I=(x=e.currentTarget)==null?void 0:x.getBoundingClientRect(),g=(100-100/o)/2;let z;if("touches"in e)z=e.touches[0];else if(e instanceof MouseEvent)z=e;else return;const L=g-(z.clientX-I.left)/I.width*100,ee=g-(z.clientY-I.top)/I.height*100;U({x:Math.max(-g,Math.min(L,g))||0,y:Math.max(-g,Math.min(ee,g))||0})},n=e=>{if(!v){if(p){if(h&&"touches"in e){te(e);return}h||i(!1)}else i(!0),w(e);e.preventDefault()}},y=e=>{if(h&&"touches"in e){b(e);return}p&&w(e)},k=()=>{if(h){l(!1);return}i(!1)},E=e=>{i(!1),e.stopPropagation()},S=p?`scale(${o}) translateX(${O.x}%) translateY(${O.y}%)`:"none",A=K("PDP.Zoom.Close.label").label,he=Ge(de.only(t),{draggable:!1,style:{"--transform":S}});return J(()=>{d(p?`pdp-zoom ${h?"pdp-zoom--no-effects":"pdp-zoom--zoomed"}`:"pdp-zoom")},[p,h]),j("figure",{className:f,onClick:n,onMouseMove:y,onMouseLeave:k,onTouchStart:n,onTouchMove:y,onTouchEnd:k,children:[he,h&&p&&r(ve,{"aria-label":A,variant:"tertiary",className:"pdp-zoom__close-button",icon:r(Ve,{}),onClick:E})]})};function at(t,o="en_US"){if(!ze(t))throw Error("Invalid date string");return t.split(" ")[1]||(t=`${t} 00:00:00`),new Date(t).toLocaleDateString(xe(o)).toString()}function ze(t){if(![/^\d{4}-\d{2}-\d{2}$/,/^\d{1,2}\/\d{1,2}\/\d{4}$/,/^\d{2}\/\d{2}\/\d{4}$/,/^\d{4}\/\d{2}\/\d{2}$/,/^\d{1,2}\.\d{1,2}\.\d{4}$/,/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/].some(p=>p.test(t)))return!1;const h=new Date(t);return!isNaN(h.getTime())}function ct(t){const o=new URLSearchParams(window.location.search);Object.entries(t).forEach(([p,i])=>{i===null?o.delete(p):o.set(p,String(i))});let h=window.location.pathname;h+=`?${o.toString()}`,h+=window.location.hash,window.history.replaceState({},"",h)}function ot(){const t=new URLSearchParams(window.location.search),o={};return t.forEach((h,p)=>{o[p]=h}),o}function it(t){var o,h,p,i,f,d,v,l,X,c,m,T;return{productId:Number(t==null?void 0:t.externalId),name:t==null?void 0:t.name,sku:t==null?void 0:t.sku,topLevelSku:t==null?void 0:t.externalParentId,specialToDate:void 0,specialFromDate:void 0,newToDate:void 0,newFromDate:void 0,createdAt:void 0,updatedAt:void 0,manufacturer:void 0,countryOfManufacture:void 0,categories:void 0,productType:void 0,pricing:{regularPrice:((h=(o=t==null?void 0:t.prices)==null?void 0:o.regular)==null?void 0:h.amount)||0,minimalPrice:(i=(p=t==null?void 0:t.prices)==null?void 0:p.final)==null?void 0:i.minimumAmount,maximalPrice:(d=(f=t==null?void 0:t.prices)==null?void 0:f.final)==null?void 0:d.maximumAmount,specialPrice:(l=(v=t==null?void 0:t.prices)==null?void 0:v.final)==null?void 0:l.amount,tierPricing:void 0,currencyCode:((c=(X=t==null?void 0:t.prices)==null?void 0:X.final)==null?void 0:c.currency)||"USD"},canonicalUrl:t==null?void 0:t.url,mainImageUrl:(T=(m=t==null?void 0:t.images)==null?void 0:m[0])==null?void 0:T.url}}const st={PRODUCT_CONTEXT:"productContext"},dt={PRODUCT_PAGE_VIEW:"product-page-view"};function Ue(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function ht(t,o){const h=Ue();h.push({[t]:null}),h.push({[t]:o})}function pt(t,o){Ue().push(p=>{const i=p.getState?p.getState():{};p.push({event:t,eventInfo:{...i,...o}})})}function $e(t){const o=it(t);ht(st.PRODUCT_CONTEXT,o),pt(dt.PRODUCT_PAGE_VIEW)}const ut=({sku:t,hideSku:o,hideQuantity:h,hideShortDescription:p,hideDescription:i,hideAttributes:f,hideURLParams:d,hideSelectedOptionValue:v,slots:l,children:X,initialData:c,carousel:m,optionsConfig:T,useACDL:O,onAddToCart:U,zoomType:te,closeButton:b=!0,...w})=>{var N,Z,H,ue;const n=K("PDP.Product.AddToCart.label").label,y=K("PDP.Product.Incrementer.label").label,k=K("PDP.Product.Details.label").label,[E,S]=Y(Be.getConfig().defaultLocale||"en-US"),[A,he]=Y(),[e=null,I]=Y(c),[g,z]=Y(()=>{const s={sku:t,quantity:1};return e!=null&&e.optionUIDs&&(s.optionsUIDs=e.optionUIDs),s}),[L,ee]=Y(()=>{var s,_;return!(e!=null&&e.options&&((s=e==null?void 0:e.options)==null?void 0:s.length)>0&&((_=e==null?void 0:e.optionUIDs)==null?void 0:_.length)!==(e==null?void 0:e.options.length))}),x={data:e,values:g,valid:L};function ne(s){return s==null?void 0:s.some(_=>(_==null?void 0:_.typename)==="ProductViewOptionValueProduct")}J(()=>{const s=De.on("pdp/setValues",_=>{z(P=>({...P,..._}))});return()=>{s==null||s.off()}},[]),J(()=>{const s=De.on("locale",_=>{_!==E&&(S(_),Re(t).then(I))});return()=>{s==null||s.off()}},[E,t]),J(()=>{O&&c&&Object.keys(c).length>0&&$e(c)},[c]);const ae=le(s=>{z(_=>({..._,...s}))},[]);J(()=>{De.emit("pdp/values",g)},[JSON.stringify(g)]);const ce=le(s=>{var V,W;let _=Object.keys(s).map($=>s[$].value).filter($=>$!==void 0);!d&&(e!=null&&e.options)&&!ne(e.options)&&ct({optionsUIDs:_.join(",")}),ae({optionsUIDs:_}),ee((_==null?void 0:_.length)===((V=e==null?void 0:e.options)==null?void 0:V.length));const P=(W=e==null?void 0:e.options)==null?void 0:W.some($=>ne([$]));Te(t,_,T==null?void 0:T.anchorOptions,P).then($=>{var se;I($),(se=T==null?void 0:T.anchorOptions)!=null&&se.length&&_e($,_),O&&($==null?void 0:$.variantSku)!==t&&$e($)})},[t]),_e=le((s,_)=>{var W;const P=(s==null?void 0:s.optionUIDs)??[];_.every($=>P.includes($))||(he(s==null?void 0:s.options),ae({optionsUIDs:P}),ee((P==null?void 0:P.length)===((W=s==null?void 0:s.options)==null?void 0:W.length)))},[t]),pe=le(s=>{Object.keys(s).length!==0&&ee(!1)},[]),B=Se(()=>{var s;return(s=e==null?void 0:e.attributes)==null?void 0:s.map(({label:_,value:P},V)=>{const W=ze(P)?at(P,E):P.toString();return j("li",{children:[_,": ",r("span",{dangerouslySetInnerHTML:{__html:W}})]},V)})},[e==null?void 0:e.attributes,E]),re=!h&&(e!=null&&e.inStock)?r(Q,{name:"Quantity",slot:l==null?void 0:l.Quantity,context:{...x},children:r(Fe,{name:"quantity",defaultValue:g.quantity.toString(),value:g.quantity.toString(),min:1,"aria-label":y,className:"pdp-product__quantity",onValue:s=>{ae({quantity:Number(s)})}},"quantity")}):void 0,ie=()=>{if(e!=null&&e.options)return r(Q,{name:"Options",slot:l==null?void 0:l.Options,context:{...x},children:r(rt,{selectedUIDs:g.optionsUIDs,options:e.options,defaultOptions:g.optionsUIDs,selectionsToUpdate:A,hideSelectedValue:v,onValues:ce,onErrors:pe})})};return r("div",{...w,children:r(Qe,{title:r(Q,{name:"Title",slot:l==null?void 0:l.Title,context:{...x},children:e==null?void 0:e.name}),sku:o?void 0:r(Q,{name:"SKU",slot:l==null?void 0:l.SKU,context:{...x},children:e==null?void 0:e.sku}),options:ie(),breadcrumbs:(l==null?void 0:l.Breadcrumbs)&&r(Q,{name:"Breadcrumbs",slot:l==null?void 0:l.Breadcrumbs,context:{...x,setSeparator(s){this._registerMethod((..._)=>{const P=s(..._),V=P&&r(we,{source:P});this._setProps(W=>({...W,separator:V,children:[r(Le,{separator:V,categories:W.categories})]}))})},appendLink(s){this._registerMethod((..._)=>{const{text:P,...V}=s(..._),W=r("a",{...V,children:P});this._setProps($=>{const se=[...$.categories||[],W];return{...$,categories:se,children:[r(Le,{separator:$.separator,categories:se})]}})})},appendHTMLElement(s){this._registerMethod((..._)=>{const P=s(..._),V=this._htmlElementToVNode(P);this._setProps(W=>{const $=[...W.categories||[],V];return{...W,categories:$,children:[r(Le,{separator:W.separator,categories:$})]}})})}}}),quantity:re,actions:r(Q,{name:"Actions",slot:l==null?void 0:l.Actions,context:{...x,appendButton(s){this._registerMethod((..._)=>{const P=s(..._);if(!P)return;const{text:V,icon:W,...$}=P,se=r(ve,{type:"button",...$,icon:W&&r(we,{source:W}),children:V});this._setProps(a=>({children:[...a.children||[],se]}))})}},children:!(l!=null&&l.Actions)&&r(ve,{size:"medium",type:"submit",icon:r(we,{source:"Cart"}),disabled:!(e!=null&&e.inStock)||!L,"aria-label":n,onClick:()=>U==null?void 0:U(g),children:n})}),shortDescription:p?void 0:r(Q,{name:"ShortDescription",slot:l==null?void 0:l.ShortDescription,context:{...x},children:r("div",{dangerouslySetInnerHTML:{__html:(e==null?void 0:e.shortDescription)??""}})}),description:i?void 0:r(Q,{name:"Description",slot:l==null?void 0:l.Description,context:{...x},children:r("div",{dangerouslySetInnerHTML:{__html:(e==null?void 0:e.description)??""}})}),images:((N=e==null?void 0:e.images)==null?void 0:N.map(({label:s,url:_})=>{var P,V;return r(Me,{title:s,alt:s,src:_,width:((P=m==null?void 0:m.imageParams)==null?void 0:P.width)??960,height:((V=m==null?void 0:m.imageParams)==null?void 0:V.height)??1191,params:(m==null?void 0:m.imageParams)??{width:960}},_)}))??[],specialPrice:(Z=e==null?void 0:e.prices)!=null&&Z.visible?r(Q,{name:"SpecialPrice",slot:l==null?void 0:l.SpecialPrice,context:{...x},children:r(Ie,{...e.prices.final,locale:xe(E)})}):void 0,price:(H=e==null?void 0:e.prices)!=null&&H.visible&&e.prices.regular&&e.prices.final.amount!==(e==null?void 0:e.prices.regular.amount)?r(Q,{name:"RegularPrice",slot:l==null?void 0:l.RegularPrice,context:{...x},children:r(Ie,{...e.prices.regular,locale:xe(E)})}):void 0,zoomType:te,closeButton:b,carouselConfig:{...m,thumbnails:m&&Object.keys(m).length?((ue=e==null?void 0:e.images)==null?void 0:ue.map(({label:s,url:_})=>{var P,V;return r(Me,{title:s,alt:s,src:_,width:((P=m==null?void 0:m.thumbnailParams)==null?void 0:P.width)??200,height:((V=m==null?void 0:m.thumbnailParams)==null?void 0:V.height)??248,params:(m==null?void 0:m.thumbnailParams)??{width:200}},_)}))??[]:[]},outOfStock:!(e!=null&&e.inStock),attributes:f?void 0:r(Q,{name:"Attributes",slot:l==null?void 0:l.Attributes,context:{...x},children:B!=null&&B.length?j(ye,{children:[k,r("ul",{children:B})]}):null}),galleryContent:(l==null?void 0:l.GalleryContent)&&r(Q,{name:"GalleryContent",slot:l.GalleryContent,context:{...x}}),infoContent:(l==null?void 0:l.InfoContent)&&r(Q,{name:"InfoContent",slot:l.InfoContent,context:{...x}}),productContent:(l==null?void 0:l.Content)&&r(Q,{name:"Content",slot:l.Content,context:{...x}})})})};ut.getInitialData=async function({sku:t,optionsConfig:o}){var v,l,X,c,m,T,O;function h(U){return U.some(te=>te.__typename==="ProductViewOptionValueProduct")}let p;const i=Be.getConfig(),f=((v=ot().optionsUIDs)==null?void 0:v.split(","))||((c=(X=(l=i==null?void 0:i.models)==null?void 0:l.ProductDetails)==null?void 0:X.initialData)==null?void 0:c.optionsUIDs),d=(T=(m=i==null?void 0:i.models)==null?void 0:m.ProductDetails)==null?void 0:T.initialData;return d&&Object.keys(d).length>0&&(p=(O=d.options)==null?void 0:O.some(U=>h(U==null?void 0:U.values))),f!=null&&f.length?await Te(t,f,o==null?void 0:o.anchorOptions,p):await Re(t)};export{ut as ProductDetails,ut as default};
|
|
@@ -52,9 +52,9 @@ interface Prices {
|
|
|
52
52
|
final: Price;
|
|
53
53
|
visible: boolean;
|
|
54
54
|
}
|
|
55
|
-
interface Option {
|
|
55
|
+
export interface Option {
|
|
56
56
|
id: string;
|
|
57
|
-
type: 'text' | 'image' | 'color';
|
|
57
|
+
type: 'text' | 'image' | 'color' | 'dropdown';
|
|
58
58
|
typename: 'ProductViewOptionValueProduct' | 'ProductViewOptionValueSwatch' | 'ProductViewOptionValueConfiguration';
|
|
59
59
|
label: string;
|
|
60
60
|
required: boolean;
|
|
@@ -67,6 +67,7 @@ interface OptionValue {
|
|
|
67
67
|
inStock: boolean;
|
|
68
68
|
value: string;
|
|
69
69
|
selected: boolean;
|
|
70
|
+
product?: any;
|
|
70
71
|
}
|
|
71
72
|
interface Attribute {
|
|
72
73
|
label: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ProductModel } from '../models';
|
|
2
2
|
|
|
3
|
-
export declare function transformProductData(data: any): ProductModel | null;
|
|
3
|
+
export declare function transformProductData(data: any, isBundle?: boolean): ProductModel | null;
|
|
4
4
|
//# sourceMappingURL=product-transform.d.ts.map
|
package/i18n/en_US.json.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name": "@dropins/storefront-pdp", "version": "0.4.0-
|
|
1
|
+
{"name": "@dropins/storefront-pdp", "version": "0.4.0-alpha9", "@dropins/tools": "~0.29.0"}
|
package/render.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
(function(p,o){try{if(typeof document<"u"){const r=document.createElement("style"),e=o.styleId;for(const a in o.attributes)r.setAttribute(a,o.attributes[a]);r.setAttribute("data-dropin",e),r.appendChild(document.createTextNode(p));const t=document.querySelector('style[data-dropin="sdk"]');if(t)t.after(r);else{const a=document.querySelector('link[rel="stylesheet"], style');a?a.before(r):document.head.append(r)}}}catch(r){console.error("dropin-styles (injectCodeFunction)",r)}})(".pdp-carousel{--icon-size: 32px;--icon-extra-padding: 8px;--thumb-peak: 32px;--thumbnails-col-width: 18.6%;position:relative;display:flex;flex-direction:var(--flex-carousel);align-items:center;gap:var(--gap);width:var(--width)}.pdp-carousel--thumbnailsColumn{justify-content:flex-end;align-items:start}.pdp-carousel--thumbnailsRow{align-items:center}.pdp-carousel--arrows{padding-left:calc(var(--icon-size) + var(--icon-extra-padding));padding-right:calc(var(--icon-size) + var(--icon-extra-padding));width:calc(var(--width) - 2 * var(--icon-size) - 2 * var(--icon-extra-padding))}.pdp-carousel__button{position:absolute;top:50%;transform:translateY(-50%);padding:0}.pdp-carousel__button--prev{left:0}.pdp-carousel__button--next{right:0}.pdp-carousel__button__icon--prev{transform:rotate(90deg)}.pdp-carousel__button__icon--next{right:0;transform:rotate(-90deg)}.pdp-carousel--main-image-controls.pdp-carousel--thumbnailsColumn .pdp-carousel__button--prev{left:var(--thumbnails-col-width)}.pdp-carousel--main-image-controls.pdp-carousel--thumbnailsRow .pdp-carousel__button--prev,.pdp-carousel--main-image-controls.pdp-carousel--thumbnailsRow .pdp-carousel__button--next{top:calc(var(--height) / 2)}.pdp-carousel__button--thumbnailsColumn{margin:auto;padding:0}.pdp-carousel__button--thumbnailsRow{padding:0}.pdp-carousel__button__icon--thumbnailsColumn--prev{transform:rotate(180deg)}.pdp-carousel__button__icon--thumbnailsRow--prev{transform:rotate(90deg)}.pdp-carousel__button__icon--thumbnailsRow--next{transform:rotate(-90deg)}.pdp-carousel__wrapper{--peak: 0px;scroll-padding:var(--peak);width:var(--total-width);height:var(--height);display:flex;flex-wrap:nowrap;gap:var(--gap);-webkit-overflow-scrolling:touch}.pdp-carousel__wrapper--horizontal{overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory}.pdp-carousel__slide{display:grid;grid-gap:var(--gap);grid-auto-columns:1fr;grid-auto-rows:100%;scroll-snap-align:end;scroll-snap-stop:always;flex-shrink:0}.pdp-carousel__slide--horizontal{grid-auto-flow:column;width:calc(100% - var(--peak))}.pdp-carousel__slide--horizontal.pdp-carousel__slide--orphan{width:calc((100% / var(--per-page) * var(--length)) - var(--peak) / var(--per-page) * var(--length) - var(--gap) / var(--per-page) * (var(--per-page) - var(--length)))}.pdp-carousel__slide>*{vertical-align:middle;max-width:100%;max-height:100%}.pdp-carousel__slide>img{object-fit:contain;width:100%;height:100%}.pdp-carousel__wrapper--peak{--peak: calc(var(--spacing-medium) + var(--gap))}.pdp-carousel__wrapper--scrollbar{--scroll-foreground: var(--color-neutral-600);--scroll-background: var(--color-neutral-400);scrollbar-color:var(--scroll-foreground) var(--scroll-background);scrollbar-width:thin}.pdp-carousel__wrapper:not(.pdp-carousel__wrapper--scrollbar){scrollbar-width:none}.pdp-carousel__wrapper:not(.pdp-carousel__wrapper--scrollbar)::-webkit-scrollbar{display:none}.pdp-carousel__wrapper--scrollbar::-webkit-scrollbar{width:4px;height:4px}.pdp-carousel__wrapper--scrollbar::-webkit-scrollbar-thumb{background:var(--scroll-foreground)}.pdp-carousel__wrapper--scrollbar::-webkit-scrollbar-track{background:var(--scroll-background)}.pdp-carousel__controls__container--thumbnailsRow{--thumbnails-spacing: var(--spacing-small);--thumbnails-box-width: var(--spacing-xxsmall);--thumbnails-rest: calc(var(--thumbnails-spacing) - var(--thumbnails-box-width));--thumbnails-width: calc((var(--width) - 2 * var(--icon-size) - 4 * var(--thumbnails-spacing) - var(--thumb-peak) - 2 * var(--thumbnails-box-width)) / 4);margin-top:var(--thumbnails-rest);width:var(--width);display:flex}.pdp-carousel__controls__container--thumbnailsColumn{--thumbnails-spacing: var(--spacing-small);--thumbnails-box-width: var(--spacing-xxsmall);--thumbnails-rest: calc(var(--thumbnails-spacing) - var(--thumbnails-box-width));--thumbnails-width: 100%;width:calc(var(--thumbnails-col-width) - var(--thumbnails-rest));margin-right:var(--thumbnails-rest)}.pdp-carousel__controls__container--thumbnailsColumn:not(.pdp-carousel__controls__container--no-arrows){height:calc(max(var(--height),4 * var(--thumbnails-spacing)) - 4 * var(--thumbnails-spacing))}.pdp-carousel__controls__container--thumbnailsColumn.pdp-carousel__controls__container--no-arrows{height:var(--height)}.pdp-carousel__controls__wrapper--thumbnailsColumn{max-height:100%;overflow-y:scroll}.pdp-carousel__controls__wrapper--thumbnailsRow{max-width:100%;overflow-x:scroll}.pdp-carousel__controls--thumbnailsRow>label>span:nth-last-child(1){margin-right:var(--thumbnails-box-width)}.pdp-carousel__controls__wrapper::-webkit-scrollbar{display:none}.pdp-carousel__controls__wrapper{-ms-overflow-style:none;scrollbar-width:none}.pdp-carousel__controls{display:flex;flex-direction:row;gap:var(--spacing-xsmall)}.pdp-carousel__controls--thumbnailsColumn{display:grid;grid-template-columns:repeat(1,1fr);grid-auto-rows:1fr;grid-row-gap:var(--thumbnails-spacing);padding:var(--thumbnails-box-width)}.pdp-carousel__controls--thumbnailsRow{grid-column-gap:var(--thumbnails-spacing);padding:var(--thumbnails-box-width)}.pdp-carousel__controls__button{border-radius:50%;width:10px;height:10px;padding:0;border:none;background:var(--color-neutral-400);cursor:pointer}.pdp-carousel__controls__button:hover{background:var(--color-neutral-500)}.pdp-carousel__controls__button:active,.pdp-carousel__controls__button--active{background:var(--color-neutral-600)}.pdp-carousel__slide--last{width:100%}.pdp-carousel__thumbnail__container input[type=radio]{opacity:0;position:absolute;width:0;height:0}.pdp-carousel__thumbnail__container .pdp-carousel__thumbnail__span{display:inline-block;--bg-color: var(--color-neutral-300);box-shadow:0 0 0 var(--shape-border-width-1) var(--color-neutral-400);position:relative;cursor:pointer;background-color:var(--bg-color);background-image:var(--background-image);background-repeat:no-repeat;background-size:cover;height:100%;width:100%;overflow:hidden}.pdp-carousel__thumbnail__content{width:inherit;position:absolute;top:-9999px;bottom:-9999px;left:-9999px;right:-9999px;margin:auto;overflow:hidden}.pdp-carousel__thumbnail__span:hover{box-shadow:0 0 0 var(--shape-border-width-3) var(--color-neutral-50),0 0 0 var(--shape-border-width-4) var(--color-neutral-500);outline:none}.pdp-carousel__controls__wrapper--thumbnailsRow .pdp-carousel__thumbnail__container{min-width:100px}.pdp-carousel__thumbnail__container input[type=radio]:not(:checked):active~.pdp-carousel-thumbnail__span{box-shadow:0 0 0 var(--shape-border-width-1) var(--color-neutral-500);outline:none}.pdp-carousel__thumbnail__container input[type=radio]:checked~.pdp-carousel__thumbnail__span,.pdp-carousel__thumbnail--selected{box-shadow:0 0 0 var(--shape-border-width-3) var(--color-neutral-50),0 0 0 var(--shape-border-width-4) var(--color-neutral-800)}.pdp-carousel__thumbnail__container input[type=radio]:checked:active~.pdp-carousel__thumbnail__span{box-shadow:0 0 0 var(--shape-border-width-3) var(--color-neutral-50),0 0 0 var(--shape-border-width-4) var(--color-neutral-600)}.pdp-carousel__thumbnail__container input[type=radio]:focus-visible+.pdp-carousel__thumbnail__span{box-shadow:0 0 0 var(--shape-border-width-3) var(--color-neutral-900),0 0 0 6px var(--color-neutral-400)}.pdp-carousel__thumbnail__span>img{object-fit:cover;width:100%;height:100%}.pdp-product{display:grid;grid-template-columns:repeat(var(--grid-1-columns),1fr);grid-column-gap:var(--grid-1-gutters);margin:0 var(--grid-1-margins)}.pdp-product__gallery-column{display:none}.pdp-product__content-column{grid-column:1 / span 4;color:var(--color-neutral-800)}.pdp-product__header{display:grid;grid-auto-rows:max-content;margin-bottom:var(--spacing-medium)}.pdp-product__breadcrumbs{grid-column:1 / -1;padding:var(--spacing-medium) 0 var(--spacing-xxbig)}.pdp-product__title{font:var(--type-display-3-font);letter-spacing:var(--type-display-3-letter-spacing);margin:0}.pdp-product__sku{font:var(--type-body-1-default-font);max-width:600px}.pdp-product__prices{display:flex;gap:var(--spacing-xsmall);margin-top:var(--spacing-medium)}.pdp-product__out-of-stock__text{font:var(--type-headline-2-strong-font)}.pdp-product__options{grid-column:1 / span 4}.pdp-product__price,.pdp-product__price-special{font:var(--type-headline-2-strong-font)}.pdp-product__price,.pdp-product__sku,.pdp-product__price-special,.pdp-product__out-of-stock__text{letter-spacing:var(--type-headline-2-strong-letter-spacing)}.pdp-product__price--grey{color:var(--color-neutral-500)}.pdp-product__actions,.pdp-product__actions--out-of-stock{display:grid;grid-auto-flow:row;gap:var(--grid-1-gutters);grid-auto-rows:max-content;margin-bottom:var(--spacing-xxbig);margin-top:var(--spacing-big)}.pdp-product__short_description,.pdp-product__attributes{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing);margin-bottom:var(--spacing-small)}.pdp-product__description,.pdp-product__attributes li{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.pdp-product__attributes{margin-top:var(--spacing-xsmall)}.pdp-product__short_description p,.pdp-product__description p,.pdp-product__attributes li p{margin:0}.pdp-product__short_description figure,.pdp-product__description figure{margin:0}.pdp-product__short_description img,.pdp-product__description img{max-width:100%}.pdp-product__images--carousel{max-height:60vh}.pdp-product__images--carousel--thumbnails{max-height:90vh}.pdp-product__images__placeholder{background-color:var(--color-neutral-200)}.pdp-product__buttons{display:grid;grid-auto-rows:max-content;grid-gap:var(--grid-1-gutters)}.pdp-product__buttons a{text-align:center}.pdp-product__buttons a:hover{text-decoration:none}.pdp-product__overlay .pdp-overlay__content{width:100%;height:100%}.pdp-product__overlay__carousel{width:100%;height:100%;box-sizing:border-box}.pdp-product__overlay__carousel img{width:100%;height:100%;object-fit:contain}.pdp-carousel__controls__container--thumbnailsRow img,.pdp-carousel__controls__container--thumbnailsColumn img{object-fit:cover}.pdp-product__quantity,.pdp-product__buttons{grid-column:1 / span 4}@media only screen and (min-width: 1024px){.pdp-product__breadcrumbs{grid-column:2 / -2}.pdp-product{grid-template-columns:repeat(var(--grid-3-columns),1fr);grid-column-gap:var(--grid-3-gutters);margin:0 var(--grid-3-margins);position:relative}.pdp-product__column-container{position:relative;display:flex;flex-direction:column}.pdp-product__column-body{position:sticky;bottom:30%;align-self:flex-end}.pdp-product__gallery-column{display:block;grid-column:2 / span 6}.pdp-product__content-column{grid-column:8 / span 4;padding-top:var(--spacing-medium)}.pdp-product__images--carousel{display:none}.pdp-product__header{margin-bottom:var(--spacing-small)}.pdp-product__actions{grid-template-columns:repeat(var(--grid-1-columns),1fr);grid-column-gap:var(--grid-1-gutters);grid-row-gap:var(--spacing-xxbig);margin-top:var(--spacing-xxbig)}.pdp-product__quantity{grid-column:1 / span 2}.pdp-product__actions--out-of-stock{grid-template-columns:repeat(var(--grid-1-columns),1fr);grid-column-gap:var(--grid-1-gutters);grid-row-gap:var(--spacing-xxbig);margin-top:var(--spacing-small)}.pdp-product__buttons{grid-column:1 / span 4}.pdp-product__out-of-stock__text{grid-column:1 / span 2}.pdp-product__gallery-content,.pdp-product__content{grid-column:2 / span 6}}.pdp-gallery-grid{display:grid;grid-gap:var(--gap);grid-template-columns:repeat(1,1fr);grid-auto-rows:max-content}.pdp-gallery-grid__item>*{height:100%;max-width:100%;min-width:100%;vertical-align:middle;width:100%;object-fit:contain}.pdp-gallery-grid__item:only-child{grid-column:1 / span 2}.pdp-gallery-grid__item:first-child:nth-last-child(2){grid-column:1 / span 2;grid-row:1}.pdp-gallery-grid__item:nth-child(2):last-child{grid-column:1 / 3;grid-row:2}@media only screen and (min-width: 1024px){.pdp-gallery-grid{grid-template-columns:repeat(2,1fr)}}.pdp-price-range .dropin-price{letter-spacing:var(--type-headline-2-strong-letter-spacing);font:var(--type-headline-2-strong-font)}.pdp-price-range__label{font:var(--type-headline-2-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing);margin-left:5px;margin-right:5px}.pdp-overlay{position:fixed;top:0;left:0;z-index:1000;right:0;bottom:0;background-color:var(--color-neutral-50);display:flex;padding:var(--spacing-medium)}.pdp-overlay--centered{align-items:center;justify-content:center}.pdp-overlay__close-button{position:absolute;top:var(--spacing-medium);right:var(--spacing-medium);z-index:1001}.pdp-swatches{display:grid;grid-auto-flow:row;grid-gap:var(--grid-1-gutters);grid-auto-rows:max-content}.pdp-swatches__field{display:grid;font:var(--type-body-2-strong-font);grid-auto-rows:max-content;gap:var(--spacing-xsmall)}.pdp-swatches__field__label{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-neutral-800)}.pdp-swatches__options{display:flex;flex-wrap:wrap;gap:var(--spacing-xsmall)}.pdp-zoom{cursor:zoom-in;overflow:hidden;margin:0;position:relative}.pdp-zoom img{height:100%;max-width:100%;min-width:100%;object-fit:contain;position:relative;transition:transform .2s;transform:var(--transform);vertical-align:middle;width:100%}.pdp-zoom .pdp-zoom__close-button{background-color:var(--color-neutral-50);border-radius:50%;position:absolute;right:var(--spacing-small);top:var(--spacing-small)}.pdp-zoom.pdp-zoom--zoomed{cursor:zoom-out}.pdp-zoom.pdp-zoom--no-effects{cursor:default}@media only screen and (max-width: 768px){.pdp-zoom img{display:block;width:100%;height:100%;transition:transform .2s;transform:var(--transform)}}",{styleId:"PDP"});
|
|
2
|
-
import{deepmerge as c,Render as u}from"@dropins/tools/lib.js";import{useState as f,useEffect as m}from"@dropins/tools/preact-hooks.js";import{UIProvider as b}from"@dropins/tools/components.js";import{events as d}from"@dropins/tools/event-bus.js";import{
|
|
2
|
+
import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{deepmerge as c,Render as u}from"@dropins/tools/lib.js";import{useState as f,useEffect as m}from"@dropins/tools/preact-hooks.js";import{UIProvider as b}from"@dropins/tools/components.js";import{events as d}from"@dropins/tools/event-bus.js";import{c as g}from"./chunks/initialize.js";const C={Product:{Incrementer:{label:"Item Quantity"},OutOfStock:{label:"Out of Stock"},AddToCart:{label:"Add to Cart"},Details:{label:"Details"},RegularPrice:{label:"Regular Price"},SpecialPrice:{label:"Special Price"},PriceRange:{From:{label:"From"},To:{label:"to"}},Image:{label:"{product} Image {key} of {total}"}},Swatches:{Required:{label:"Required"}},Carousel:{label:"Carousel",Next:{label:"Next"},Previous:{label:"Previous"},Slide:{label:"Slide"},Controls:{label:"Carousel Controls",Button:{label:"Show slide {key} of {total}"}}},Overlay:{Close:{label:"Close"}},Zoom:{Close:{label:"Close"}}},P={quantityLabel:"Quantity"},p={PDP:C,Custom:P},S={default:p},D=({children:a})=>{var l;const[e,i]=f(),n=(l=g.getConfig())==null?void 0:l.langDefinitions;m(()=>{const o=d.on("locale",t=>{t!==e&&i(t)},{eager:!0});return()=>{o==null||o.off()}},[e]);const s=c(S,n??{});return r(b,{lang:e,langDefinitions:s,children:a})},O=new u(r(D,{}));export{O as render};
|