@dropins/storefront-pdp 0.4.0-alpha1 → 0.4.0-alpha12
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/components/Product/Product.d.ts +2 -0
- package/components/Zoom/Zoom.d.ts +9 -0
- package/components/Zoom/index.d.ts +18 -0
- package/components/index.d.ts +1 -0
- package/containers/ProductDetails/ProductDetails.d.ts +2 -0
- 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 +6 -1
- package/package.json +1 -1
- package/render.js +2 -2
|
@@ -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};
|
|
@@ -23,6 +23,8 @@ export interface ProductProps extends Omit<HTMLAttributes<HTMLDivElement>, 'titl
|
|
|
23
23
|
actions?: VNode;
|
|
24
24
|
quantity?: VNode;
|
|
25
25
|
carouselConfig?: ProductCarouselConfig;
|
|
26
|
+
zoomType?: 'zoom' | 'overlay';
|
|
27
|
+
closeButton?: boolean;
|
|
26
28
|
}
|
|
27
29
|
export declare const Product: FunctionComponent<ProductProps>;
|
|
28
30
|
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
* Copyright 2024 Adobe
|
|
5
|
+
* All Rights Reserved.
|
|
6
|
+
* __________________
|
|
7
|
+
* NOTICE: All information contained herein is, and remains
|
|
8
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
9
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
10
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
11
|
+
* property laws, including trade secret and copyright laws.
|
|
12
|
+
* Dissemination of this information or reproduction of this material
|
|
13
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
14
|
+
* from Adobe.
|
|
15
|
+
*/
|
|
16
|
+
export * from './Zoom';
|
|
17
|
+
export { Zoom as default } from './Zoom';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
package/components/index.d.ts
CHANGED
|
@@ -74,6 +74,8 @@ export interface ProductDetailsProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
74
74
|
optionsConfig?: OptionsConfig;
|
|
75
75
|
useACDL?: boolean;
|
|
76
76
|
onAddToCart?: (values: Values) => void;
|
|
77
|
+
zoomType?: 'zoom' | 'overlay';
|
|
78
|
+
closeButton?: boolean;
|
|
77
79
|
}
|
|
78
80
|
export declare const ProductDetails: Container<ProductDetailsProps, ProductModel | null>;
|
|
79
81
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as pe from"@dropins/tools/preact-compat.js";import{useState as X,Children as ae,useRef as ye,useMemo as we,useEffect as z,useCallback as Z}from"@dropins/tools/preact-compat.js";import{debounce as De,classes as g,VComponent as V,toLanguageTag as Le,Slot as j}from"@dropins/tools/lib.js";import{Button as Pe,Icon as ve,Price as Se,Picker as He,ColorSwatch as Ve,ImageSwatch as qe,TextSwatch as je,Incrementer as Ge,Breadcrumbs as ze,Image as ke}from"@dropins/tools/components.js";import{jsxs as H,jsx as r,Fragment as fe}from"@dropins/tools/preact-jsx-runtime.js";import{useText as q}from"@dropins/tools/i18n.js";import{c as xe,d as $e}from"../chunks/getRefinedProduct.js";import{events as Ne}from"@dropins/tools/event-bus.js";import{c as Be}from"../chunks/initialize.js";import"@dropins/tools/fetch-graphql.js";const Fe=e=>pe.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},pe.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),Ke=e=>pe.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},pe.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3599 5.64001L5.62988 18.37",stroke:"currentColor"}),pe.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3599 18.37L5.62988 5.64001",stroke:"currentColor"})),Qe=24,ge=16,me=2,Je="32";var Me=(e=>(e[e.small=16]="small",e[e.medium=24]="medium",e[e.large=64]="large",e))(Me||{});const be=({show:e=1,scrollbar:d=!1,peak:u=!1,arrows:_=!1,controls:p="dots",arrowsOnMainImage:A=!1,loop:o=!1,gap:w=null,direction:l="horizontal",width:K="100%",height:a="100%",defaultIndex:m=0,className:B,children:T,thumbnails:Y=null,isZoomed:ie,...b})=>{const N=q("PDP.Carousel.label").label,n=q("PDP.Carousel.Slide.label").label,f=q("PDP.Carousel.Previous.label").label,I=q("PDP.Carousel.Next.label").label,M=q("PDP.Carousel.Controls.label").label,S=q("PDP.Carousel.Controls.Button.label").label,[t,re]=X(()=>Ie(e)),k=Math.ceil(ae.count(T)/t),x=u?Qe:0,C=w?Me[w]:0,F=ae.count(T)%t,[v,le]=X(o?m+1:m),ne=ye([]),[ce,se]=X(0),[ee,he]=X(0),de=we(()=>ae.toArray(Y),[Y]),E=we(()=>{const c=ae.toArray(T).reduce((h,L,D)=>D%t===0?[...h,[L]]:[...h.slice(0,-1),[...h[h.length-1],L]],[]);return!o||c.length===1?c:o&&ae.count(T)%t===0?[c[k-1]].concat(c).concat([c[0],c[1]]):[ae.toArray(T).slice(-t)].concat(c).concat([c[0],c[1]])},[T,t,k,o]),W=ye(null),Q=ye(null),$=p==="thumbnailsRow"||p==="thumbnailsColumn";z(()=>{const c=document.body,h=De(()=>{var R,te;se(((R=W.current)==null?void 0:R.offsetWidth)??0),he(((te=W.current)==null?void 0:te.offsetHeight)??0);const D=window.innerWidth,U=Ie(e,D);U!==t&&re(U)},50),L=new ResizeObserver(h);return L.observe(c),()=>{L.unobserve(c)}},[t,e]);const i=Z(c=>{const h=o?c-1:c,L=ne==null?void 0:ne.current[0],D=(L==null?void 0:L.offsetWidth)+ge,U=(L==null?void 0:L.offsetHeight)+ge,R=Q.current,te=p==="thumbnailsRow",Ae=p==="thumbnailsColumn",oe=te?R==null?void 0:R.offsetWidth:R==null?void 0:R.offsetHeight,G=te?D:U;(te||Ae)&&oe&&(G*(h+1)>oe&&(R.style.scrollBehavior="smooth",te?R.scrollLeft=(h+me)*G:R.scrollTop=(h+me)*G),(te?R.scrollLeft:R.scrollTop)>G*h&&(R.style.scrollBehavior="smooth",te?R.scrollLeft=(h-me)*G:R.scrollTop=(h-me)*G))},[p,o]);z(()=>{i(v)},[v,i]);const s=Z((c,h,L)=>{$&&i(c);const D=W.current,U=x?D.offsetWidth-x:D.offsetWidth-x+C;if(!Array.from(D.querySelectorAll("[data-index]")).filter(oe=>{const G=Number(oe.getAttribute("data-index"));return!isNaN(G)&&G>-1})[c])return;if(L){const oe=c===0?k:0,G=U*(k+(F||t)/t);if(D.scrollLeft>=0&&D.scrollLeft<U-5){s(1,!0);return}if(D.scrollLeft>G-U&&D.scrollLeft<=G){s(k,!0);return}D.style.scrollBehavior="auto",D.scrollLeft=oe===0?0:G,s(oe===0?1:k,!0);return}const Ae=(D.offsetWidth-C)/t*E[c].length-x;D.style.scrollBehavior=h?"smooth":"auto",D.scrollLeft=E[c].length===t?U*c:U*(c-1)+Ae},[C,k,x,t,F,E,i,p]),P=Z(()=>{if(o){const h=v-1;s(h,!0,v===1);return}const c=v<=0?0:v-1;s(c,!0)},[v,s,o]),y=Z(()=>{const c=E.length-1;if(o){const L=v+1;s(L,!0,v===k);return}const h=v>=c?c:v+1;s(h,!0)},[E.length,o,v,s,k]);z(()=>{const c=h=>{h.key==="ArrowLeft"&&(h.preventDefault(),P()),h.key==="ArrowRight"&&(h.preventDefault(),y())};return window.addEventListener("keydown",c),()=>{window.removeEventListener("keydown",c)}},[y,P]),z(()=>{s(o?m+1:m,!1)},[m,s,o]);const O=De(()=>{const c=W.current,h=x?c.offsetWidth-x:c.offsetWidth-x+C,L=c.scrollLeft/h,D=Math.round(L)-L<1?Math.round(L):Math.ceil(L);if($&&i(D),o){const U=h*(k+(F||t)/t);if(Math.ceil(c.scrollLeft)>=Math.ceil(U)-5){c.style.scrollBehavior="auto",c.scrollLeft=c.offsetWidth*1+(Math.ceil(c.scrollLeft)-Math.ceil(U)-x);return}if(c.scrollLeft===0){c.style.scrollBehavior="auto",c.scrollLeft=U-c.offsetWidth+x;return}}v!==D&&le(D)},100);z(()=>{const c=W.current;return c==null||c.addEventListener("scroll",O),()=>{c==null||c.removeEventListener("scroll",O)}},[O]);const J=(c,h,L)=>r(Pe,{className:g([["pdp-carousel__button",!c],[`pdp-carousel__button--${h}`,!c],[`pdp-carousel__button--${p}`,c]]),style:{"--height":`${ee}px`},variant:"tertiary","aria-label":h==="next"?I:f,onClick:L,disabled:o?!1:h==="next"?v>=E.length-1:v<1,children:r(ve,{className:g([["pdp-carousel__button__icon",!c],[`pdp-carousel__button__icon--${h}`,!c],[`pdp-carousel__button__icon--${p}--${h}`,c]]),size:Je,source:Fe})}),ue=_&&E.length!=1&&J($,"prev",P),_e=_&&E.length!=1&&J($,"next",y),We=_&&E.length!=1&&J(!1,"prev",P),Ue=_&&E.length!=1&&J(!1,"next",y);return H("div",{role:"region","aria-roledescription":N,className:g(["pdp-carousel",["pdp-carousel--main-image-controls",A],["pdp-carousel--arrows",_&&!$],[`pdp-carousel--${p}`,$],B]),style:{"--flex-carousel":p==="thumbnailsColumn"?"row-reverse":"column","--gap":$?"0":"var(--spacing-small)","--width":K},...b,children:[r("div",{ref:W,className:g(["pdp-carousel__wrapper",`pdp-carousel__wrapper--${l}`,["pdp-carousel__wrapper--scrollbar",d],["pdp-carousel__wrapper--peak",u]]),style:{"--total-width":p==="thumbnailsColumn"?"81.6%":"100%","--height":p==="thumbnailsColumn"?"auto":a,"--gap":w?`var(--spacing-${w})`:"0px","--per-page":t},tabIndex:0,children:E.map((c,h)=>{const L=c.length<t;return r("div",{role:"group","aria-roledescription":n,"data-index":h,className:g(["pdp-carousel__slide",`pdp-carousel__slide--${l}`,["pdp-carousel__slide--active",v===h],["pdp-carousel__slide--orphan",L]]),style:{"--length":c.length},children:c},h)})}),!$&&H(fe,{children:[ue,_e]}),$&&A&&H(fe,{children:[We,Ue]}),p&&E.length!=1&&H("div",{className:g([[`pdp-carousel__controls__container--${p}`,$],["pdp-carousel__controls__container--no-arrows",!_||A]]),style:{"--width":p==="thumbnailsRow"?`${ce}px`:K,"--height":`${ee}px`,"--nr-thumbnails":de.length},children:[($||ie)&&!A&&ue,r("div",{ref:Q,className:g([[`pdp-carousel__controls__wrapper--${p}`,$],["pdp-carousel__controls__wrapper",$]]),children:r("div",{role:"group","aria-label":M,className:g(["pdp-carousel__controls",[`pdp-carousel__controls--${p}`,$]]),children:(o?E.slice(0,k):E).map((c,h)=>{const L=o?k:E.length,D=o?v-1===h:v===h;return $?H("label",{className:g(["pdp-carousel__thumbnail__container"]),ref:U=>{U&&(ne.current[h]=U)},children:[r("input",{type:"radio",name:"carousel-thumbnails","aria-label":S.replace("{key}",String(h+1)).replace("{total}",String(L)),checked:D&&ce!==0,onChange:()=>{s(o?h+1:h,!0)},...b,className:g(["pdp-carousel__thumbnail",["pdp-carousel__thumbnail--selected",D&&ce!==0]])}),r("span",{className:g(["pdp-carousel__thumbnail__span"]),children:de[h]})]},h):r("button",{"aria-label":S.replace("{key}",String(h+1)).replace("{total}",String(L)),onClick:()=>{s(o?h+1:h,!0)},className:g(["pdp-carousel__controls__button",["pdp-carousel__controls__button--active",D]])},h)})})}),($||ie)&&!A&&_e]})]})};function Ie(e,d=0){if(typeof e=="number")return e;const{small:u,medium:_,large:p}=e,o=[{breakpoint:1024,value:p},{breakpoint:786,value:_},{breakpoint:0,value:u}].find(({breakpoint:w})=>d>w);return o?o.value:u}const Xe=({title:e,breadcrumbs:d,galleryContent:u,infoContent:_,productContent:p,sku:A,outOfStock:o,shortDescription:w,description:l,attributes:K,images:a,options:m,price:B,specialPrice:T,className:Y,children:ie,quantity:b,actions:N,carouselConfig:n,...f})=>{var F,v,le,ne,ce,se,ee,he,de;const I=q("PDP.Product.RegularPrice.label").label,M=q("PDP.Product.SpecialPrice.label").label,S=q("PDP.Product.OutOfStock.label").label,t=q("PDP.Product.Image.label").label,[re,k]=X(null),x=a!=null&&a.length?a.map((E,W)=>{var Q;return r(V,{node:E,loading:W===0?"eager":"lazy",alt:((Q=e==null?void 0:e.props)==null?void 0:Q.children)&&(t==null?void 0:t.replace("{product}",e.props.children.toString()).replace("{key}",String(W+1)).replace("{total}",String(a.length))),onClick:()=>k(W)},W)}):r("img",{src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",className:"pdp-product__images__placeholder","aria-hidden":!0}),C=(F=n==null?void 0:n.thumbnails)!=null&&F.length?n.thumbnails.map((E,W)=>{var Q;return r(V,{node:E,loading:(n==null?void 0:n.thumbnailsLoadingMode)||"lazy",alt:((Q=e==null?void 0:e.props)==null?void 0:Q.children)&&(t==null?void 0:t.replace("{product}",e.props.children.toString()).replace("{key}",String(W+1)).replace("{total}",String(a.length)))},W)}):r("img",{src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",className:"pdp-product__images__placeholder","aria-hidden":!0});return H("div",{...f,className:g(["pdp-product",Y]),children:[d&&r(V,{node:d,className:"pdp-product__breadcrumbs"}),H("div",{className:"pdp-product__column-container pdp-product__gallery-column",children:[r("div",{className:"pdp-product__column-body",children:(v=n==null?void 0:n.controls)!=null&&v.desktop?r(be,{className:"pdp-product__overlay__carousel",arrows:(a==null?void 0:a.length)>1,controls:(a==null?void 0:a.length)>1?n.controls.desktop:"dots",arrowsOnMainImage:n==null?void 0:n.arrowsOnMainImage,loop:(n==null?void 0:n.loopable)&&(a==null?void 0:a.length)>1,peak:((le=n==null?void 0:n.thumbnails)==null?void 0:le.length)>1&&((ne=n==null?void 0:n.peak)==null?void 0:ne.desktop)||!1,gap:(n==null?void 0:n.gap)||null,width:"100%",height:"100%",defaultIndex:re||0,thumbnails:C,children:x}):r(Ze,{className:"pdp-product__images",gap:"small",children:x})}),u&&r(V,{node:u,className:"pdp-product__gallery-content"})]}),H("div",{className:"pdp-product__column-container pdp-product__content-column",children:[H("div",{className:"pdp-product__column-body",children:[H("div",{className:"pdp-product__header",children:[e&&r(V,{node:e,className:"pdp-product__title"}),A&&r(V,{node:A,className:"pdp-product__sku"})]}),H("div",{className:"pdp-product__prices",children:[T&&r(V,{node:T,className:g(["pdp-product__price-special","pdp-product__price"]),"aria-label":M,role:"text"}),B&&r(V,{node:B,className:g(["pdp-product__price-regular","pdp-product__price--grey"]),"aria-label":I,role:"text"})]}),(ce=n==null?void 0:n.controls)!=null&&ce.mobile&&((se=n==null?void 0:n.controls)==null?void 0:se.mobile)==="thumbnailsRow"?r(be,{className:"pdp-product__images pdp-product__images--carousel pdp-product__images--carousel--thumbnails",width:"100%",height:"auto",arrows:(a==null?void 0:a.length)>1,controls:(a==null?void 0:a.length)>1?"thumbnailsRow":null,loop:(n==null?void 0:n.loopable)&&(a==null?void 0:a.length)>1,peak:((ee=n==null?void 0:n.thumbnails)==null?void 0:ee.length)>1&&((he=n==null?void 0:n.peak)==null?void 0:he.mobile)||!1,gap:(n==null?void 0:n.gap)||null,thumbnails:C,children:x}):r(be,{className:"pdp-product__images pdp-product__images--carousel",peak:((de=n==null?void 0:n.peak)==null?void 0:de.mobile)&&(a==null?void 0:a.length)>1,gap:(n==null?void 0:n.gap)||null,width:"100%",height:"auto",arrows:(a==null?void 0:a.length)>1,controls:(a==null?void 0:a.length)>1?"dots":null,loop:(n==null?void 0:n.loopable)&&(a==null?void 0:a.length)>1,children:x}),H("div",{className:g(["pdp-product__actions",["pdp-product__actions--out-of-stock",o]]),children:[o&&r("div",{className:"pdp-product__out-of-stock__text",children:S}),m&&r(V,{node:m,className:g(["pdp-product__options"])}),b&&r("div",{className:"pdp-product__quantity",children:r(V,{node:b})}),N&&r(V,{node:N,className:g(["pdp-product__buttons"])})]}),w&&r(V,{node:w,className:g(["pdp-product__short_description"])}),l&&r(V,{node:l,className:g(["pdp-product__description"])}),K?r("div",{className:"pdp-product__attributes",children:K}):null]}),_&&r(V,{node:_,className:"pdp-product__info-content"})]}),p&&r(V,{node:p,className:"pdp-product__content"}),re===null?null:r(Ye,{className:"pdp-product__overlay",onClose:()=>k(null),centered:!0,children:r(be,{className:"pdp-product__overlay__carousel",arrows:(a==null?void 0:a.length)>1,width:"100%",height:"100%",defaultIndex:re||0,loop:(n==null?void 0:n.loopable)&&(a==null?void 0:a.length)>1,controls:(a==null?void 0:a.length)>1?"dots":null,isZoomed:!0,children:x})})]})},Ze=({children:e,gap:d=null,className:u,style:_,...p})=>{const A=ae.count(e);return r("div",{...p,className:g(["pdp-gallery-grid",u]),style:{"--gap":d?`var(--spacing-${d})`:"0px",..._},children:ae.map(e,(o,w)=>r("div",{className:"pdp-gallery-grid__item",children:r(V,{node:o,loading:w===0?"eager":"lazy"},o.props.src)},A+w))})},Ee=({amount:e,currency:d,locale:u,variant:_,sale:p,minimumAmount:A,maximumAmount:o,className:w,...l})=>r(fe,{children:e||A===o?r("div",{className:"pdp-price-range",...l,children:r(Se,{amount:e||A,currency:d,locale:u,variant:_,sale:p,className:w})}):H("div",{className:"pdp-price-range",...l,children:[r(Se,{amount:A,currency:d,locale:u,className:w}),r("span",{className:"pdp-price-range__label",children:"-"}),r(Se,{amount:o,currency:d,locale:u,className:w})]})}),Ye=({centered:e,onClose:d,className:u,children:_,...p})=>{const A=q("PDP.Overlay.Close.label").label,o=Z(()=>{d==null||d()},[d]);return z(()=>{const w=l=>{l.key==="Escape"&&o()};return document.addEventListener("keydown",w),()=>{document.removeEventListener("keydown",w)}},[o]),z(()=>{const w=document.scrollingElement,l=w.style.overflow;return w.style.overflow="hidden",()=>{w.style.overflow=l}},[]),H("div",{...p,className:g(["pdp-overlay",["pdp-overlay--centered",e],u]),children:[r("div",{className:"pdp-overlay__content",children:_}),r(Pe,{"aria-label":A,variant:"tertiary",className:"pdp-overlay__close-button",onClick:o,icon:r(Ke,{})})]})},Ce=["text","image","color","dropdown"],et=e=>e.map(d=>({...d,text:d.label,disabled:!d.inStock}));function tt(e,d){return e.reduce((u,_)=>{const p=d==null?void 0:d.find(o=>o.items.find(w=>w.id===_));if(!p)return u;const A=p.items.find(o=>o.id===_);return{...u,[p.id]:{label:A.label,value:A.id}}},{})}const nt=({options:e,hideSelectedValue:d,selectedUIDs:u,onValues:_,onErrors:p,defaultOptions:A,selectionsToUpdate:o,className:w,children:l,...K})=>{const a=q("PDP.Swatches.Required.label").label,[m,B]=X(()=>e==null?void 0:e.reduce((N,n)=>{const{items:f}=n,I=f==null?void 0:f.find(S=>A==null?void 0:A.includes(S.id)),M=f==null?void 0:f.find(S=>S.selected);return I?{...N,[n.id]:{label:I.label,value:I.id}}:M?{...N,[n.id]:{label:M.label,value:M.id}}:N},{}));z(()=>{if(u){const b=tt(u,e);if(JSON.stringify(b)===JSON.stringify(m))return;T(Object.keys(b)[0],b[Object.keys(b)[0]].label,u[0])}},[u]),z(()=>{o==null||o.forEach(b=>{B(N=>{var I;const n=(I=b==null?void 0:b.items)==null?void 0:I.find(M=>M.selected);return n?{...N,[b.id]:{label:n==null?void 0:n.label,value:n==null?void 0:n.id}}:N})})},[o,B]),we(()=>{const b=e==null?void 0:e.reduce((N,n)=>{var f;return(f=n==null?void 0:n.items)==null||f.forEach(I=>{var S;const M=((S=m[n.id])==null?void 0:S.value)===I.id;n.required&&!M&&(N[n.id]=a)}),N},{});return p==null||p(b),b},[m]);const T=Z((b,N,n)=>{B(f=>{const I={...f,[b]:{label:N,value:n}};return _==null||_(I,n),I})},[_]),Y=(b,N)=>{var f;const n=((f=N.selectedOptions[0])==null?void 0:f.label)??"";T(b,n,N.value)},ie=Z(({items:b,id:N,required:n,type:f,selected:I,label:M})=>r("div",{className:g(["pdp-swatches__options"]),children:(f==null?void 0:f.toLowerCase())==="dropdown"?r(He,{"aria-label":M,handleSelect:S=>Y(N,S.target),options:et(b),value:I}):b==null?void 0:b.map(S=>{const t={key:S.id,id:S.id,name:N,value:S.value,label:S.label,groupAriaLabel:M,selected:I===S.id,outOfStock:!S.inStock,required:n===null?!0:n,onValue:()=>{T(N,S.label,S.id)}};switch(f){case"text":return r(je,{...t,label:S.label});case"image":return r(qe,{...t,src:S.value,alt:S.label});case"color":return r(Ve,{...t,size:"large",color:S.value});default:return console.warn(`Invalid swatch type ${f}`),null}})}),[T]);return r("div",{...K,className:g(["pdp-swatches",w]),children:e==null?void 0:e.map(({type:b,label:N,id:n,multiple:f,required:I,items:M})=>{var S;if(!b){console.warn("Bundle product not supported on UI.");return}return Ce.includes(b)||console.warn(`Invalid swatch type ${b}`),f&&console.warn("Multiple selection swatches are not currently supported."),H("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]?d?`${N}`:`${N}: ${m[n].label}`:N}),r(ie,{id:n,type:b,required:I,items:M,label:N,selected:(S=m[n])==null?void 0:S.value})]},`swatch-item-${n}`)})})};function rt(e,d="en_US"){if(!Re(e))throw Error("Invalid date string");return e.split(" ")[1]||(e=`${e} 00:00:00`),new Date(e).toLocaleDateString(Le(d)).toString()}function Re(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(_=>_.test(e)))return!1;const u=new Date(e);return!isNaN(u.getTime())}function lt(e){const d=new URLSearchParams(window.location.search);Object.entries(e).forEach(([_,p])=>{p===null?d.delete(_):d.set(_,String(p))});let u=window.location.pathname;u+=`?${d.toString()}`,u+=window.location.hash,window.history.replaceState({},"",u)}function ct(){const e=new URLSearchParams(window.location.search),d={};return e.forEach((u,_)=>{d[_]=u}),d}function at(e){var d,u,_,p,A,o,w,l,K,a,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:((u=(d=e==null?void 0:e.prices)==null?void 0:d.regular)==null?void 0:u.amount)||0,minimalPrice:(p=(_=e==null?void 0:e.prices)==null?void 0:_.final)==null?void 0:p.minimumAmount,maximalPrice:(o=(A=e==null?void 0:e.prices)==null?void 0:A.final)==null?void 0:o.maximumAmount,specialPrice:(l=(w=e==null?void 0:e.prices)==null?void 0:w.final)==null?void 0:l.amount,tierPricing:void 0,currencyCode:((a=(K=e==null?void 0:e.prices)==null?void 0:K.final)==null?void 0:a.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 it={PRODUCT_CONTEXT:"productContext"},dt={PRODUCT_PAGE_VIEW:"product-page-view"};function Te(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function ot(e,d){const u=Te();u.push({[e]:null}),u.push({[e]:d})}function st(e,d){Te().push(_=>{const p=_.getState?_.getState():{};_.push({event:e,eventInfo:{...p,...d}})})}function Oe(e){const d=at(e);ot(it.PRODUCT_CONTEXT,d),st(dt.PRODUCT_PAGE_VIEW)}const ht=({sku:e,hideSku:d,hideQuantity:u,hideShortDescription:_,hideDescription:p,hideAttributes:A,hideURLParams:o,hideSelectedOptionValue:w,slots:l,children:K,initialData:a,carousel:m,optionsConfig:B,useACDL:T,onAddToCart:Y,...ie})=>{var E,W,Q,$;const b=q("PDP.Product.AddToCart.label").label,N=q("PDP.Product.Incrementer.label").label,n=q("PDP.Product.Details.label").label,[f,I]=X(Be.getConfig().defaultLocale||"en-US"),[M,S]=X(),[t=null,re]=X(a),[k,x]=X(()=>{const i={sku:e,quantity:1};return t!=null&&t.optionUIDs&&(i.optionsUIDs=t.optionUIDs),i}),[C,F]=X(()=>{var i,s;return!(t!=null&&t.options&&((i=t==null?void 0:t.options)==null?void 0:i.length)>0&&((s=t==null?void 0:t.optionUIDs)==null?void 0:s.length)!==(t==null?void 0:t.options.length))}),v={data:t,values:k,valid:C};z(()=>{const i=Ne.on("pdp/setValues",s=>{x(P=>({...P,...s}))});return()=>{i==null||i.off()}},[]),z(()=>{const i=Ne.on("locale",s=>{s!==f&&(I(s),xe(e).then(re))});return()=>{i==null||i.off()}},[f,e]),z(()=>{T&&a&&Object.keys(a).length>0&&Oe(a)},[a]);const le=Z(i=>{x(s=>({...s,...i}))},[]);z(()=>{Ne.emit("pdp/values",k)},[JSON.stringify(k)]);const ne=Z(i=>{var P;let s=Object.keys(i).map(y=>i[y].value).filter(y=>y!==void 0);o||lt({optionsUIDs:s.join(",")}),le({optionsUIDs:s}),F((s==null?void 0:s.length)===((P=t==null?void 0:t.options)==null?void 0:P.length)),$e(e,s,B==null?void 0:B.anchorOptions).then(y=>{var O;re(y),(O=B==null?void 0:B.anchorOptions)!=null&&O.length&&ce(y,s),T&&(y==null?void 0:y.sku)!==e&&Oe(y)})},[e]),ce=Z((i,s)=>{var O;const P=(i==null?void 0:i.optionUIDs)??[];s.every(J=>P.includes(J))||(S(i==null?void 0:i.options),le({optionsUIDs:P}),F((P==null?void 0:P.length)===((O=i==null?void 0:i.options)==null?void 0:O.length)))},[e]),se=Z(i=>{Object.keys(i).length!==0&&F(!1)},[]),ee=we(()=>{var i;return(i=t==null?void 0:t.attributes)==null?void 0:i.map(({label:s,value:P},y)=>{const O=Re(P)?rt(P,f):P.toString();return H("li",{children:[s,": ",r("span",{dangerouslySetInnerHTML:{__html:O}})]},y)})},[t==null?void 0:t.attributes,f]),he=!u&&(t!=null&&t.inStock)?r(j,{name:"Quantity",slot:l==null?void 0:l.Quantity,context:{...v},children:r(Ge,{name:"quantity",defaultValue:k.quantity.toString(),value:k.quantity.toString(),min:1,"aria-label":N,className:"pdp-product__quantity",onValue:i=>{le({quantity:Number(i)})}},"quantity")}):void 0,de=()=>{if(t!=null&&t.options)return r(j,{name:"Options",slot:l==null?void 0:l.Options,context:{...v},children:r(nt,{selectedUIDs:k.optionsUIDs,options:t.options,defaultOptions:k.optionsUIDs,selectionsToUpdate:M,hideSelectedValue:w,onValues:ne,onErrors:se})})};return r("div",{...ie,children:r(Xe,{title:r(j,{name:"Title",slot:l==null?void 0:l.Title,context:{...v},children:t==null?void 0:t.name}),sku:d?void 0:r(j,{name:"SKU",slot:l==null?void 0:l.SKU,context:{...v},children:t==null?void 0:t.sku}),options:de(),breadcrumbs:(l==null?void 0:l.Breadcrumbs)&&r(j,{name:"Breadcrumbs",slot:l==null?void 0:l.Breadcrumbs,context:{...v,setSeparator(i){this._registerMethod((...s)=>{const P=i(...s),y=P&&r(ve,{source:P});this._setProps(O=>({...O,separator:y}))})},appendLink(i){this._registerMethod((...s)=>{const{text:P,...y}=i(...s),O=r("a",{...y,children:P});this._setProps(J=>({...J,categories:[...J.categories||[],O]}))})},appendHTMLElement(i){this._registerMethod((...s)=>{const P=i(...s),y=this._htmlElementToVNode(P);this._setProps(O=>({...O,categories:[...O.categories||[],y]}))})}},render:({separator:i,categories:s})=>r(ze,{separator:i,categories:s})}),quantity:he,actions:r(j,{name:"Actions",slot:l==null?void 0:l.Actions,context:{...v,appendButton(i){this._registerMethod((...s)=>{const P=i(...s);if(!P)return;const{text:y,icon:O,...J}=P,ue=r(Pe,{type:"button",...J,icon:O&&r(ve,{source:O}),children:y});this._setProps(_e=>({children:[..._e.children||[],ue]}))})}},children:!(l!=null&&l.Actions)&&r(Pe,{size:"medium",type:"submit",icon:r(ve,{source:"Cart"}),disabled:!(t!=null&&t.inStock)||!C,"aria-label":b,onClick:()=>Y==null?void 0:Y(k),children:b})}),shortDescription:_?void 0:r(j,{name:"ShortDescription",slot:l==null?void 0:l.ShortDescription,context:{...v},children:r("div",{dangerouslySetInnerHTML:{__html:(t==null?void 0:t.shortDescription)??""}})}),description:p?void 0:r(j,{name:"Description",slot:l==null?void 0:l.Description,context:{...v},children:r("div",{dangerouslySetInnerHTML:{__html:(t==null?void 0:t.description)??""}})}),images:((E=t==null?void 0:t.images)==null?void 0:E.map(({label:i,url:s})=>{var P,y;return r(ke,{title:i,alt:i,src:s,width:((P=m==null?void 0:m.imageParams)==null?void 0:P.width)??960,height:((y=m==null?void 0:m.imageParams)==null?void 0:y.height)??1191,params:(m==null?void 0:m.imageParams)??{width:960}},s)}))??[],specialPrice:(W=t==null?void 0:t.prices)!=null&&W.visible?r(j,{name:"SpecialPrice",slot:l==null?void 0:l.SpecialPrice,context:{...v},children:r(Ee,{...t.prices.final,locale:Le(f)})}):void 0,price:(Q=t==null?void 0:t.prices)!=null&&Q.visible&&t.prices.regular&&t.prices.final.amount!==(t==null?void 0:t.prices.regular.amount)?r(j,{name:"RegularPrice",slot:l==null?void 0:l.RegularPrice,context:{...v},children:r(Ee,{...t.prices.regular,locale:Le(f)})}):void 0,carouselConfig:{...m,thumbnails:m&&Object.keys(m).length?(($=t==null?void 0:t.images)==null?void 0:$.map(({label:i,url:s})=>{var P,y;return r(ke,{title:i,alt:i,src:s,width:((P=m==null?void 0:m.thumbnailParams)==null?void 0:P.width)??200,height:((y=m==null?void 0:m.thumbnailParams)==null?void 0:y.height)??248,params:(m==null?void 0:m.thumbnailParams)??{width:200}},s)}))??[]:[]},outOfStock:!(t!=null&&t.inStock),attributes:A?void 0:r(j,{name:"Attributes",slot:l==null?void 0:l.Attributes,context:{...v},children:ee!=null&&ee.length?H(fe,{children:[n,r("ul",{children:ee})]}):null}),galleryContent:(l==null?void 0:l.GalleryContent)&&r(j,{name:"GalleryContent",slot:l.GalleryContent,context:{...v}}),infoContent:(l==null?void 0:l.InfoContent)&&r(j,{name:"InfoContent",slot:l.InfoContent,context:{...v}}),productContent:(l==null?void 0:l.Content)&&r(j,{name:"Content",slot:l.Content,context:{...v}})})})};ht.getInitialData=async function({sku:e,optionsConfig:d}){var _,p,A,o,w,l;const u=((_=ct().optionsUIDs)==null?void 0:_.split(","))||((l=(w=(o=(A=(p=Be)==null?void 0:p.getConfig())==null?void 0:A.models)==null?void 0:o.ProductDetails)==null?void 0:w.initialData)==null?void 0:l.optionsUIDs);return u!=null&&u.length?await $e(e,u,d==null?void 0:d.anchorOptions):await xe(e)};export{ht as ProductDetails,ht as default};
|
|
1
|
+
import{jsxs as F,jsx as r,Fragment as Ae}from"@dropins/tools/preact-jsx-runtime.js";import*as fe from"@dropins/tools/preact-compat.js";import{useState as K,Children as ue,useRef as Le,useMemo as Ne,useEffect as ee,useCallback as ce}from"@dropins/tools/preact-compat.js";import{debounce as xe,classes as B,VComponent as Y,toLanguageTag as Me,Slot as J}from"@dropins/tools/lib.js";import{Button as we,Icon as Se,Price as ge,Picker as qe,ColorSwatch as je,ImageSwatch as Xe,TextSwatch as Fe,Incrementer as Ge,Breadcrumbs as De,Image as Oe}from"@dropins/tools/components.js";import{useText as Z}from"@dropins/tools/i18n.js";import{cloneElement as Ye}from"@dropins/tools/preact.js";import{c as Te,d as Be}from"../chunks/getRefinedProduct.js";import{events as ke}from"@dropins/tools/event-bus.js";import{c as We}from"../chunks/initialize.js";import"@dropins/tools/fetch-graphql.js";const Ke=t=>fe.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},fe.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),Ve=t=>fe.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},fe.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3599 5.64001L5.62988 18.37",stroke:"currentColor"}),fe.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3599 18.37L5.62988 5.64001",stroke:"currentColor"})),Ze=24,Ee=16,ve=2,Qe="32";var ze=(t=>(t[t.small=16]="small",t[t.medium=24]="medium",t[t.large=64]="large",t))(ze||{});const ye=({show:t=1,scrollbar:o=!1,peak:u=!1,arrows:p=!1,controls:s="dots",arrowsOnMainImage:f=!1,loop:d=!1,gap:v=null,direction:l="horizontal",width:G="100%",height:c="100%",defaultIndex:m=0,className:W,children:$,thumbnails:j=null,isZoomed:ne,...b})=>{const P=Z("PDP.Carousel.label").label,n=Z("PDP.Carousel.Slide.label").label,y=Z("PDP.Carousel.Previous.label").label,E=Z("PDP.Carousel.Next.label").label,I=Z("PDP.Carousel.Controls.label").label,A=Z("PDP.Carousel.Controls.Button.label").label,[N,me]=K(()=>$e(t)),e=Math.ceil(ue.count($)/N),M=u?Ze:0,D=v?ze[v]:0,q=ue.count($)%N,[L,te]=K(d?C()?m-1:m+1:m),x=Le([]),[re,oe]=K(0),[ie,be]=K(0),_e=Ne(()=>ue.toArray(j),[j]),T=Ne(()=>{const a=ue.toArray($).reduce((h,k,S)=>S%N===0?[...h,[k]]:[...h.slice(0,-1),[...h[h.length-1],k]],[]);return!d||a.length===1?a:d&&ue.count($)%N===0?[a[e-1]].concat(a).concat([a[0],a[1]]):[ue.toArray($).slice(-N)].concat(a).concat([a[0],a[1]])},[$,N,e,d]),le=Le(null),se=Le(null),g=s==="thumbnailsRow"||s==="thumbnailsColumn";ee(()=>{const a=document.body,h=xe(()=>{var O,ae;oe(((O=le.current)==null?void 0:O.offsetWidth)??0),be(((ae=le.current)==null?void 0:ae.offsetHeight)??0);const S=window.innerWidth,z=$e(t,S);z!==N&&me(z)},50),k=new ResizeObserver(h);return k.observe(a),()=>{k.unobserve(a)}},[N,t]);const Q=ce(a=>{const h=d?a-1:a,k=x==null?void 0:x.current[0],S=(k==null?void 0:k.offsetWidth)+Ee,z=(k==null?void 0:k.offsetHeight)+Ee,O=se.current,ae=s==="thumbnailsRow",Pe=s==="thumbnailsColumn",he=ae?O==null?void 0:O.offsetWidth:O==null?void 0:O.offsetHeight,X=ae?S:z;(ae||Pe)&&he&&(X*(h+1)>he&&(O.style.scrollBehavior="smooth",ae?O.scrollLeft=C()?O.scrollWidth-O.clientWidth-(h+ve)*X:(h+ve)*X:O.scrollTop=(h+ve)*X),(C()&&(ae?O.scrollLeft:O.scrollTop)<=-X*h||!C()&&(ae?O.scrollLeft:O.scrollTop)>X*h)&&(O.style.scrollBehavior="smooth",ae?O.scrollLeft=C()?-(h-ve)*X:(h-ve)*X:O.scrollTop=(h-ve)*X))},[s,d]);ee(()=>{Q(L)},[L,Q]);const U=ce((a,h,k)=>{g&&Q(a);const S=le.current,z=M?S.offsetWidth-M:S.offsetWidth-M+D;if(!Array.from(S.querySelectorAll("[data-index]")).filter(he=>{const X=Number(he.getAttribute("data-index"));return!isNaN(X)&&X>-1})[a])return;if(k){const he=a===0?e:0,X=z*(e+(q||N)/N);if(C()){if(S.scrollLeft<=0&&S.scrollLeft>-(z-5)){U(1,!0);return}if(S.scrollLeft<z-X&&S.scrollLeft>=-X){U(e,!0);return}S.style.scrollBehavior="auto",S.scrollLeft=he===0?0:-X,U(he===0?1:e,!0)}else{if(S.scrollLeft>=0&&S.scrollLeft<z-5){U(1,!0);return}if(S.scrollLeft>X-z&&S.scrollLeft<=X){U(e,!0);return}S.style.scrollBehavior="auto",S.scrollLeft=he===0?0:X,U(he===0?1:e,!0);return}}const Pe=(S.offsetWidth-D)/N*T[a].length-M;S.style.scrollBehavior=h?"smooth":"auto",S.scrollLeft=C()?-(T[a].length===N?z*a:z*(a-1)-Pe):T[a].length===N?z*a:z*(a-1)+Pe},[D,e,M,N,q,T,Q,s]),pe=ce(()=>{if(d){const h=L-1;U(h,!0,C()?L===e-1:L===1);return}const a=L<=0?0:L-1;U(a,!0)},[L,U,d]),i=ce(()=>{const a=T.length-1;if(d){const k=L+1;U(k,!0,C()?L===0:L===e);return}const h=L>=a?a:L+1;U(h,!0)},[T.length,d,L,U,e]);ee(()=>{const a=h=>{h.key==="ArrowLeft"&&(h.preventDefault(),C()?i():pe()),h.key==="ArrowRight"&&(h.preventDefault(),C()?pe():i())};return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[i,pe]),ee(()=>{U(d?m+1:m,!1)},[m,U,d]);const _=xe(()=>{const a=le.current,h=M?a.offsetWidth-M:a.offsetWidth-M+D,k=Math.abs(a.scrollLeft)/h,S=Math.abs(Math.round(k)-k<1?Math.round(k):Math.ceil(k));if(g&&Q(S),d){const z=h*(e+(q||N)/N),O=C()?-a.scrollLeft:a.scrollLeft;if(Math.ceil(Math.abs(O))>=Math.ceil(z)-5){a.style.scrollBehavior="auto",a.scrollLeft=C()?-a.offsetWidth+(Math.ceil(O)-Math.ceil(z)-M):a.offsetWidth+(Math.ceil(O)-Math.ceil(z)-M);return}if(Math.abs(O)===0){a.style.scrollBehavior="auto",a.scrollLeft=C()?-(z-a.offsetWidth+M):z-a.offsetWidth+M;return}}L!==S&&te(S)},100);ee(()=>{const a=le.current;return a==null||a.addEventListener("scroll",_),()=>{a==null||a.removeEventListener("scroll",_)}},[_]);const w=(a,h,k)=>r(we,{className:B([["pdp-carousel__button",!a],[`pdp-carousel__button--${h}`,!a],[`pdp-carousel__button--${s}`,a]]),style:{"--height":`${ie}px`},variant:"tertiary","aria-label":h==="next"?E:y,onClick:k,disabled:d?!1:h==="next"?L>=T.length-1:L<1,children:r(Se,{className:B([["pdp-carousel__button__icon",!a],[`pdp-carousel__button__icon--${h}`,!a],[`pdp-carousel__button__icon--${s}--${h}`,a]]),size:Qe,source:Ke})}),V=p&&T.length!=1&&w(g,"prev",pe),H=p&&T.length!=1&&w(g,"next",i),R=p&&T.length!=1&&w(!1,"prev",pe),de=p&&T.length!=1&&w(!1,"next",i);return F("div",{role:"region","aria-roledescription":P,className:B(["pdp-carousel",["pdp-carousel--main-image-controls",f],["pdp-carousel--arrows",p&&!g],[`pdp-carousel--${s}`,g],W]),style:{"--flex-carousel":s==="thumbnailsColumn"?"row-reverse":"column","--gap":g?"0":"var(--spacing-small)","--width":G},...b,children:[r("div",{ref:le,className:B(["pdp-carousel__wrapper",`pdp-carousel__wrapper--${l}`,["pdp-carousel__wrapper--scrollbar",o],["pdp-carousel__wrapper--peak",u]]),style:{"--total-width":s==="thumbnailsColumn"?"81.6%":"100%","--height":s==="thumbnailsColumn"?"auto":c,"--gap":v?`var(--spacing-${v})`:"0px","--per-page":N},tabIndex:0,children:T.map((a,h)=>{const k=a.length<N;return r("div",{role:"group","aria-roledescription":n,"data-index":h,className:B(["pdp-carousel__slide",`pdp-carousel__slide--${l}`,["pdp-carousel__slide--active",L===h],["pdp-carousel__slide--orphan",k]]),style:{"--length":a.length},children:a},h)})}),!g&&F(Ae,{children:[V,H]}),g&&f&&F(Ae,{children:[R,de]}),s&&T.length!=1&&F("div",{className:B([[`pdp-carousel__controls__container--${s}`,g],["pdp-carousel__controls__container--no-arrows",!p||f]]),style:{"--width":s==="thumbnailsRow"?`${re}px`:G,"--height":`${ie}px`,"--nr-thumbnails":_e.length},children:[(g||ne)&&!f&&V,r("div",{ref:se,className:B([[`pdp-carousel__controls__wrapper--${s}`,g],["pdp-carousel__controls__wrapper",g]]),children:r("div",{role:"group","aria-label":I,className:B(["pdp-carousel__controls",[`pdp-carousel__controls--${s}`,g]]),children:(d?T.slice(0,e):T).map((a,h)=>{const k=d?e:T.length,S=d?L-1===h:L===h;return g?F("label",{className:B(["pdp-carousel__thumbnail__container"]),ref:z=>{z&&(x.current[h]=z)},children:[r("input",{type:"radio",name:"carousel-thumbnails","aria-label":A.replace("{key}",String(h+1)).replace("{total}",String(k)),checked:S&&re!==0,onChange:()=>{U(d?h+1:h,!0)},...b,className:B(["pdp-carousel__thumbnail",["pdp-carousel__thumbnail--selected",S&&re!==0]])}),r("span",{className:B(["pdp-carousel__thumbnail__span"]),children:_e[h]})]},h):r("button",{"aria-label":A.replace("{key}",String(h+1)).replace("{total}",String(k)),onClick:()=>{U(d?h+1:h,!0)},className:B(["pdp-carousel__controls__button",["pdp-carousel__controls__button--active",S]])},h)})})}),(g||ne)&&!f&&H]})]})};function $e(t,o=0){if(typeof t=="number")return t;const{small:u,medium:p,large:s}=t,d=[{breakpoint:1024,value:s},{breakpoint:786,value:p},{breakpoint:0,value:u}].find(({breakpoint:v})=>o>v);return d?d.value:u}function C(){return document.documentElement.dir==="rtl"}const Je=({title:t,breadcrumbs:o,galleryContent:u,infoContent:p,productContent:s,sku:f,outOfStock:d,shortDescription:v,description:l,attributes:G,images:c,options:m,price:W,specialPrice:$,className:j,children:ne,quantity:b,actions:P,carouselConfig:n,zoomType:y="overlay",closeButton:E=!0,...I})=>{var te,x,re,oe,ie,be,_e,T,le;const A=Z("PDP.Product.RegularPrice.label").label,N=Z("PDP.Product.SpecialPrice.label").label,me=Z("PDP.Product.OutOfStock.label").label,e=Z("PDP.Product.Image.label").label,[M,D]=K(null),q=c!=null&&c.length?c.map((se,g)=>{var U;const Q=((U=t==null?void 0:t.props)==null?void 0:U.children)&&(e==null?void 0:e.replace("{product}",t.props.children.toString()).replace("{key}",String(g+1)).replace("{total}",String(c.length)));return y==="zoom"?r(at,{closeButton:E,children:r(Y,{node:se,loading:g===0?"eager":"lazy",alt:Q},g)}):r(Y,{node:se,loading:g===0?"eager":"lazy",alt:Q,onClick:()=>D(g)},g)}):r("img",{src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",className:"pdp-product__images__placeholder","aria-hidden":!0}),L=(te=n==null?void 0:n.thumbnails)!=null&&te.length?n.thumbnails.map((se,g)=>{var Q;return r(Y,{node:se,loading:(n==null?void 0:n.thumbnailsLoadingMode)||"lazy",alt:((Q=t==null?void 0:t.props)==null?void 0:Q.children)&&(e==null?void 0:e.replace("{product}",t.props.children.toString()).replace("{key}",String(g+1)).replace("{total}",String(c.length)))},g)}):r("img",{src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",className:"pdp-product__images__placeholder","aria-hidden":!0});return F("div",{...I,className:B(["pdp-product",j]),children:[o&&r(Y,{node:o,className:"pdp-product__breadcrumbs"}),F("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(ye,{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:((re=n==null?void 0:n.thumbnails)==null?void 0:re.length)>1&&((oe=n==null?void 0:n.peak)==null?void 0:oe.desktop)||!1,gap:(n==null?void 0:n.gap)||null,width:"100%",height:"100%",defaultIndex:M||0,thumbnails:L,children:q}):r(Ce,{className:"pdp-product__images",gap:"small",children:q})}),u&&r(Y,{node:u,className:"pdp-product__gallery-content"})]}),F("div",{className:"pdp-product__column-container pdp-product__content-column",children:[F("div",{className:"pdp-product__column-body",children:[F("div",{className:"pdp-product__header",children:[t&&r(Y,{node:t,className:"pdp-product__title"}),f&&r(Y,{node:f,className:"pdp-product__sku"})]}),F("div",{className:"pdp-product__prices",children:[$&&r(Y,{node:$,className:B(["pdp-product__price-special","pdp-product__price"]),"aria-label":N,role:"text"}),W&&r(Y,{node:W,className:B(["pdp-product__price-regular","pdp-product__price--grey"]),"aria-label":A,role:"text"})]}),(ie=n==null?void 0:n.controls)!=null&&ie.mobile&&((be=n==null?void 0:n.controls)==null?void 0:be.mobile)==="thumbnailsRow"?r(ye,{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:((_e=n==null?void 0:n.thumbnails)==null?void 0:_e.length)>1&&((T=n==null?void 0:n.peak)==null?void 0:T.mobile)||!1,gap:(n==null?void 0:n.gap)||null,thumbnails:L,children:q}):r(ye,{className:"pdp-product__images pdp-product__images--carousel",peak:((le=n==null?void 0:n.peak)==null?void 0:le.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:q}),F("div",{className:B(["pdp-product__actions",["pdp-product__actions--out-of-stock",d]]),children:[d&&r("div",{className:"pdp-product__out-of-stock__text",children:me}),m&&r(Y,{node:m,className:B(["pdp-product__options"])}),b&&r("div",{className:"pdp-product__quantity",children:r(Y,{node:b})}),P&&r(Y,{node:P,className:B(["pdp-product__buttons"])})]}),v&&r(Y,{node:v,className:B(["pdp-product__short_description"])}),l&&r(Y,{node:l,className:B(["pdp-product__description"])}),G?r("div",{className:"pdp-product__attributes",children:G}):null]}),p&&r(Y,{node:p,className:"pdp-product__info-content"})]}),s&&r(Y,{node:s,className:"pdp-product__content"}),M===null?null:r(et,{className:"pdp-product__overlay",onClose:()=>D(null),centered:!0,children:r(ye,{className:"pdp-product__overlay__carousel",arrows:(c==null?void 0:c.length)>1,width:"100%",height:"100%",defaultIndex:M||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:q})})]})},Ce=({children:t,gap:o=null,className:u,style:p,...s})=>{const f=ue.count(t);return r("div",{...s,className:B(["pdp-gallery-grid",u]),style:{"--gap":o?`var(--spacing-${o})`:"0px",...p},children:ue.map(t,(d,v)=>r("div",{className:"pdp-gallery-grid__item",children:r(Y,{node:d,loading:v===0?"eager":"lazy"},d.props.src)},f+v))})},Ie=({amount:t,currency:o,locale:u,variant:p,sale:s,minimumAmount:f,maximumAmount:d,className:v,...l})=>r(Ae,{children:t||f===d?r("div",{className:"pdp-price-range",...l,children:r(ge,{amount:t||f,currency:o,locale:u,variant:p,sale:s,className:v})}):F("div",{className:"pdp-price-range",...l,children:[r(ge,{amount:f,currency:o,locale:u,className:v}),r("span",{className:"pdp-price-range__label",children:"-"}),r(ge,{amount:d,currency:o,locale:u,className:v})]})}),et=({centered:t,onClose:o,className:u,children:p,...s})=>{const f=Z("PDP.Overlay.Close.label").label,d=ce(()=>{o==null||o()},[o]);return ee(()=>{const v=l=>{l.key==="Escape"&&d()};return document.addEventListener("keydown",v),()=>{document.removeEventListener("keydown",v)}},[d]),ee(()=>{const v=document.scrollingElement,l=v.style.overflow;return v.style.overflow="hidden",()=>{v.style.overflow=l}},[]),F("div",{...s,className:B(["pdp-overlay",["pdp-overlay--centered",t],u]),children:[r("div",{className:"pdp-overlay__content",children:p}),r(we,{"aria-label":f,variant:"tertiary",className:"pdp-overlay__close-button",onClick:d,icon:r(Ve,{})})]})},tt=["text","image","color","dropdown"],nt=t=>t.map(o=>({...o,text:o.label,disabled:!o.inStock}));function rt(t,o){return t.reduce((u,p)=>{const s=o==null?void 0:o.find(d=>d.items.find(v=>v.id===p));if(!s)return u;const f=s.items.find(d=>d.id===p);return{...u,[s.id]:{label:f.label,value:f.id}}},{})}const lt=({options:t,hideSelectedValue:o,selectedUIDs:u,onValues:p,onErrors:s,defaultOptions:f,selectionsToUpdate:d,className:v,children:l,...G})=>{const c=Z("PDP.Swatches.Required.label").label,[m,W]=K(()=>t==null?void 0:t.reduce((P,n)=>{const{items:y}=n,E=y==null?void 0:y.find(A=>f==null?void 0:f.includes(A.id)),I=y==null?void 0:y.find(A=>A.selected);return E?{...P,[n.id]:{label:E.label,value:E.id}}:I?{...P,[n.id]:{label:I.label,value:I.id}}:P},{}));ee(()=>{if(u){const b=rt(u,t);if(JSON.stringify(b)===JSON.stringify(m))return;$(Object.keys(b)[0],b[Object.keys(b)[0]].label,u[0])}},[u]),ee(()=>{d==null||d.forEach(b=>{W(P=>{var E;const n=(E=b==null?void 0:b.items)==null?void 0:E.find(I=>I.selected);return n?{...P,[b.id]:{label:n==null?void 0:n.label,value:n==null?void 0:n.id}}:P})})},[d,W]),Ne(()=>{const b=t==null?void 0:t.reduce((P,n)=>{var E;let y=!1;return(E=n==null?void 0:n.items)==null||E.forEach(I=>{var N;((N=m[n.id])==null?void 0:N.value)===I.id&&(y=!0)}),n.required&&!y&&(P[n.id]=c),P},{});return s==null||s(b),b},[m]);const $=ce((b,P,n)=>{W(y=>{const E={...y,[b]:{label:P,value:n}};return p==null||p(E,n),E})},[p]),j=(b,P)=>{var y;const n=((y=P.selectedOptions[0])==null?void 0:y.label)??"";$(b,n,P.value)},ne=ce(({items:b,id:P,required:n,type:y,selected:E,label:I})=>(b==null?void 0:b.length)>0&&r("div",{className:B(["pdp-swatches__options"]),children:(y==null?void 0:y.toLowerCase())==="dropdown"?r(qe,{"aria-label":I,handleSelect:A=>j(P,A.target),options:nt(b),value:E}):b==null?void 0:b.map(A=>{const N={key:A.id,id:A.id,name:P,value:A.value,label:A.label,groupAriaLabel:I,selected:E===A.id,outOfStock:!A.inStock,required:n===null?!0:n,onValue:()=>{$(P,A.label,A.id)}};switch(y){case"text":return r(Fe,{...N,label:A.label});case"image":return r(Xe,{...N,src:A.value,alt:A.label});case"color":return r(je,{...N,size:"large",color:A.value});default:return console.warn(`Invalid swatch type ${y}`),null}})}),[$]);return r("div",{...G,className:B(["pdp-swatches",v]),children:t==null?void 0:t.map(({type:b,label:P,id:n,multiple:y,required:E,items:I})=>{var A;return tt.includes(b)||console.warn(`Invalid swatch type ${b}`),y&&console.warn("Multiple selection swatches are not currently supported."),F("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(ne,{id:n,type:b,required:E,items:I,label:P,selected:(A=m[n])==null?void 0:A.value})]},`swatch-item-${n}`)})})},at=({children:t,scale:o=2,closeButton:u=!0})=>{const[p,s]=K(!1),[f,d]=K("pdp-zoom"),[v,l]=K(!1),[G,c]=K({x:0,y:0}),[m,W]=K({x:0,y:0}),[$,j]=K({x:0,y:0}),ne=e=>{!p||e.type!=="touchstart"||(c({x:e.touches[0].clientX,y:e.touches[0].clientY}),W({x:$.x,y:$.y}),l(!0))},b=e=>{var ie;if(!v||e.type!=="touchmove")return;const M=(ie=e.currentTarget)==null?void 0:ie.getBoundingClientRect(),D=(100-100/o)/2,q=e.touches[0].clientX-G.x,L=e.touches[0].clientY-G.y,te=q*100/(M.width*o),x=L*100/(M.height*o),re=m.x+te,oe=m.y+x;j({x:Math.max(-D,Math.min(re,D))||0,y:Math.max(-D,Math.min(oe,D))||0}),e.preventDefault()},P=e=>{var x;const M=(x=e.currentTarget)==null?void 0:x.getBoundingClientRect(),D=(100-100/o)/2;let q;if("touches"in e)q=e.touches[0];else if(e instanceof MouseEvent)q=e;else return;const L=D-(q.clientX-M.left)/M.width*100,te=D-(q.clientY-M.top)/M.height*100;j({x:Math.max(-D,Math.min(L,D))||0,y:Math.max(-D,Math.min(te,D))||0})},n=e=>{if(!v){if(p){if(u&&"touches"in e){ne(e);return}u||s(!1)}else s(!0),P(e);e.preventDefault()}},y=e=>{if(u&&"touches"in e){b(e);return}p&&P(e)},E=()=>{if(u){l(!1);return}s(!1)},I=e=>{s(!1),e.stopPropagation()},A=p?`scale(${o}) translateX(${$.x}%) translateY(${$.y}%)`:"none",N=Z("PDP.Zoom.Close.label").label,me=Ye(ue.only(t),{draggable:!1,style:{"--transform":A}});return ee(()=>{d(p?`pdp-zoom ${u?"pdp-zoom--no-effects":"pdp-zoom--zoomed"}`:"pdp-zoom")},[p,u]),F("figure",{className:f,onClick:n,onMouseMove:y,onMouseLeave:E,onTouchStart:n,onTouchMove:y,onTouchEnd:E,children:[me,u&&p&&r(we,{"aria-label":N,variant:"tertiary",className:"pdp-zoom__close-button",icon:r(Ve,{}),onClick:I})]})};function ct(t,o="en_US"){if(!Ue(t))throw Error("Invalid date string");return t.split(" ")[1]||(t=`${t} 00:00:00`),new Date(t).toLocaleDateString(Me(o)).toString()}function Ue(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 u=new Date(t);return!isNaN(u.getTime())}function ot(t){const o=new URLSearchParams(window.location.search);Object.entries(t).forEach(([p,s])=>{s===null?o.delete(p):o.set(p,String(s))});let u=window.location.pathname;u+=`?${o.toString()}`,u+=window.location.hash,window.history.replaceState({},"",u)}function it(){const t=new URLSearchParams(window.location.search),o={};return t.forEach((u,p)=>{o[p]=u}),o}function st(t){var o,u,p,s,f,d,v,l,G,c,m,W;return{productId:Number(t==null?void 0:t.externalId),name:t==null?void 0:t.name,sku:(t==null?void 0:t.variantSku)||(t==null?void 0:t.sku),topLevelSku:t==null?void 0:t.sku,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:((u=(o=t==null?void 0:t.prices)==null?void 0:o.regular)==null?void 0:u.amount)||0,minimalPrice:(s=(p=t==null?void 0:t.prices)==null?void 0:p.final)==null?void 0:s.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=(G=t==null?void 0:t.prices)==null?void 0:G.final)==null?void 0:c.currency)||"USD"},canonicalUrl:t==null?void 0:t.url,mainImageUrl:(W=(m=t==null?void 0:t.images)==null?void 0:m[0])==null?void 0:W.url}}const dt={PRODUCT_CONTEXT:"productContext"},ht={PRODUCT_PAGE_VIEW:"product-page-view"};function He(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function ut(t,o){const u=He();u.push({[t]:null}),u.push({[t]:o})}function pt(t,o){He().push(p=>{const s=p.getState?p.getState():{};p.push({event:t,eventInfo:{...s,...o}})})}function Re(t){const o=st(t);ut(dt.PRODUCT_CONTEXT,o),pt(ht.PRODUCT_PAGE_VIEW)}const mt=({sku:t,hideSku:o,hideQuantity:u,hideShortDescription:p,hideDescription:s,hideAttributes:f,hideURLParams:d,hideSelectedOptionValue:v,slots:l,children:G,initialData:c,carousel:m,optionsConfig:W,useACDL:$,onAddToCart:j,zoomType:ne,closeButton:b=!0,...P})=>{var g,Q,U,pe;const n=Z("PDP.Product.AddToCart.label").label,y=Z("PDP.Product.Incrementer.label").label,E=Z("PDP.Product.Details.label").label,[I,A]=K(We.getConfig().defaultLocale||"en-US"),[N,me]=K(),[e=null,M]=K(c),[D,q]=K(()=>{const i={sku:t,quantity:1};return e!=null&&e.optionUIDs&&(i.optionsUIDs=e.optionUIDs),i}),[L,te]=K(()=>{var i,_;return!(e!=null&&e.options&&((i=e==null?void 0:e.options)==null?void 0:i.length)>0&&((_=e==null?void 0:e.optionUIDs)==null?void 0:_.length)!==(e==null?void 0:e.options.length))}),x={data:e,values:D,valid:L};function re(i){return i==null?void 0:i.some(_=>(_==null?void 0:_.typename)==="ProductViewOptionValueProduct")}ee(()=>{const i=ke.on("pdp/setValues",_=>{q(w=>({...w,..._}))});return()=>{i==null||i.off()}},[]),ee(()=>{const i=ke.on("locale",_=>{_!==I&&(A(_),Te(t).then(M))});return()=>{i==null||i.off()}},[I,t]),ee(()=>{$&&c&&Object.keys(c).length>0&&Re(c)},[c]);const oe=ce(i=>{q(_=>({..._,...i}))},[]);ee(()=>{ke.emit("pdp/values",D)},[JSON.stringify(D)]);const ie=ce(i=>{var V,H;let _=Object.keys(i).map(R=>i[R].value).filter(R=>R!==void 0);!d&&(e!=null&&e.options)&&!re(e.options)&&ot({optionsUIDs:_.join(",")}),oe({optionsUIDs:_}),te((_==null?void 0:_.length)===((V=e==null?void 0:e.options)==null?void 0:V.length));const w=(H=e==null?void 0:e.options)==null?void 0:H.some(R=>re([R]));Be(t,_,W==null?void 0:W.anchorOptions,w).then(R=>{var de;M(R),(de=W==null?void 0:W.anchorOptions)!=null&&de.length&&be(R,_),$&&(R==null?void 0:R.variantSku)!==t&&Re(R)})},[t]),be=ce((i,_)=>{var H;const w=(i==null?void 0:i.optionUIDs)??[];_.every(R=>w.includes(R))||(me(i==null?void 0:i.options),oe({optionsUIDs:w}),te((w==null?void 0:w.length)===((H=i==null?void 0:i.options)==null?void 0:H.length)))},[t]),_e=ce(i=>{Object.keys(i).length!==0&&te(!1)},[]),T=Ne(()=>{var i;return(i=e==null?void 0:e.attributes)==null?void 0:i.map(({label:_,value:w},V)=>{const H=Ue(w)?ct(w,I):w.toString();return F("li",{children:[_,": ",r("span",{dangerouslySetInnerHTML:{__html:H}})]},V)})},[e==null?void 0:e.attributes,I]),le=!u&&(e!=null&&e.inStock)?r(J,{name:"Quantity",slot:l==null?void 0:l.Quantity,context:{...x},children:r(Ge,{name:"quantity",defaultValue:D.quantity.toString(),value:D.quantity.toString(),min:1,"aria-label":y,className:"pdp-product__quantity",onValue:i=>{oe({quantity:Number(i)})}},"quantity")}):void 0,se=()=>{if(e!=null&&e.options)return r(J,{name:"Options",slot:l==null?void 0:l.Options,context:{...x},children:r(lt,{selectedUIDs:D.optionsUIDs,options:e.options,defaultOptions:D.optionsUIDs,selectionsToUpdate:N,hideSelectedValue:v,onValues:ie,onErrors:_e})})};return r("div",{...P,children:r(Je,{title:r(J,{name:"Title",slot:l==null?void 0:l.Title,context:{...x},children:e==null?void 0:e.name}),sku:o?void 0:r(J,{name:"SKU",slot:l==null?void 0:l.SKU,context:{...x},children:e==null?void 0:e.sku}),options:se(),breadcrumbs:(l==null?void 0:l.Breadcrumbs)&&r(J,{name:"Breadcrumbs",slot:l==null?void 0:l.Breadcrumbs,context:{...x,setSeparator(i){this._registerMethod((..._)=>{const w=i(..._),V=w&&r(Se,{source:w});this._setProps(H=>({...H,separator:V,children:[r(De,{separator:V,categories:H.categories})]}))})},appendLink(i){this._registerMethod((..._)=>{const{text:w,...V}=i(..._),H=r("a",{...V,children:w});this._setProps(R=>{const de=[...R.categories||[],H];return{...R,categories:de,children:[r(De,{separator:R.separator,categories:de})]}})})},appendHTMLElement(i){this._registerMethod((..._)=>{const w=i(..._),V=this._htmlElementToVNode(w);this._setProps(H=>{const R=[...H.categories||[],V];return{...H,categories:R,children:[r(De,{separator:H.separator,categories:R})]}})})}}}),quantity:le,actions:r(J,{name:"Actions",slot:l==null?void 0:l.Actions,context:{...x,appendButton(i){this._registerMethod((..._)=>{const w=i(..._);if(!w)return;const{text:V,icon:H,...R}=w,de=r(we,{type:"button",...R,icon:H&&r(Se,{source:H}),children:V});this._setProps(a=>({children:[...a.children||[],de]}))})}},children:!(l!=null&&l.Actions)&&r(we,{size:"medium",type:"submit",icon:r(Se,{source:"Cart"}),disabled:!(e!=null&&e.inStock)||!L,"aria-label":n,onClick:()=>j==null?void 0:j(D),children:n})}),shortDescription:p?void 0:r(J,{name:"ShortDescription",slot:l==null?void 0:l.ShortDescription,context:{...x},children:r("div",{dangerouslySetInnerHTML:{__html:(e==null?void 0:e.shortDescription)??""}})}),description:s?void 0:r(J,{name:"Description",slot:l==null?void 0:l.Description,context:{...x},children:r("div",{dangerouslySetInnerHTML:{__html:(e==null?void 0:e.description)??""}})}),images:((g=e==null?void 0:e.images)==null?void 0:g.map(({label:i,url:_})=>{var w,V;return r(Oe,{title:i,alt:i,src:_,width:((w=m==null?void 0:m.imageParams)==null?void 0:w.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:(Q=e==null?void 0:e.prices)!=null&&Q.visible?r(J,{name:"SpecialPrice",slot:l==null?void 0:l.SpecialPrice,context:{...x},children:r(Ie,{...e.prices.final,locale:Me(I)})}):void 0,price:(U=e==null?void 0:e.prices)!=null&&U.visible&&e.prices.regular&&e.prices.final.amount!==(e==null?void 0:e.prices.regular.amount)?r(J,{name:"RegularPrice",slot:l==null?void 0:l.RegularPrice,context:{...x},children:r(Ie,{...e.prices.regular,locale:Me(I)})}):void 0,zoomType:ne,closeButton:b,carouselConfig:{...m,thumbnails:m&&Object.keys(m).length?((pe=e==null?void 0:e.images)==null?void 0:pe.map(({label:i,url:_})=>{var w,V;return r(Oe,{title:i,alt:i,src:_,width:((w=m==null?void 0:m.thumbnailParams)==null?void 0:w.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(J,{name:"Attributes",slot:l==null?void 0:l.Attributes,context:{...x},children:T!=null&&T.length?F(Ae,{children:[E,r("ul",{children:T})]}):null}),galleryContent:(l==null?void 0:l.GalleryContent)&&r(J,{name:"GalleryContent",slot:l.GalleryContent,context:{...x}}),infoContent:(l==null?void 0:l.InfoContent)&&r(J,{name:"InfoContent",slot:l.InfoContent,context:{...x}}),productContent:(l==null?void 0:l.Content)&&r(J,{name:"Content",slot:l.Content,context:{...x}})})})};mt.getInitialData=async function({sku:t,optionsConfig:o}){var v,l,G,c,m,W,$;function u(j){return j.some(ne=>ne.__typename==="ProductViewOptionValueProduct")}let p;const s=We.getConfig(),f=((v=it().optionsUIDs)==null?void 0:v.split(","))||((c=(G=(l=s==null?void 0:s.models)==null?void 0:l.ProductDetails)==null?void 0:G.initialData)==null?void 0:c.optionsUIDs),d=(W=(m=s==null?void 0:s.models)==null?void 0:m.ProductDetails)==null?void 0:W.initialData;return d&&Object.keys(d).length>0&&(p=($=d.options)==null?void 0:$.some(j=>u(j==null?void 0:j.values))),f!=null&&f.length?await Be(t,f,o==null?void 0:o.anchorOptions,p):await Te(t)};export{mt as ProductDetails,mt 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-alpha12", "@dropins/tools": "~0.29.0"}
|
package/render.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(p,t){try{if(typeof document<"u"){const r=document.createElement("style"),e=t.styleId;for(const a in t.attributes)r.setAttribute(a,t.attributes[a]);r.setAttribute("data-dropin",e),r.appendChild(document.createTextNode(p));const o=document.querySelector('style[data-dropin="sdk"]');if(o)o.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)}",{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{
|
|
1
|
+
(function(p,t){try{if(typeof document<"u"){const r=document.createElement("style"),e=t.styleId;for(const a in t.attributes)r.setAttribute(a,t.attributes[a]);r.setAttribute("data-dropin",e),r.appendChild(document.createTextNode(p));const o=document.querySelector('style[data-dropin="sdk"]');if(o)o.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 .dropin-button--tertiary--disabled:hover{color:var(--color-neutral-500)}.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}[dir=rtl] .pdp-carousel__button--prev{left:auto;right:0}[dir=rtl] .pdp-carousel__button--next{right:auto;left:0}.pdp-carousel__button__icon--next{transform:rotate(-90deg)}.pdp-carousel__button--next{right:0}.pdp-carousel__button__icon--prev{transform:rotate(90deg)}[dir=rtl] .pdp-carousel__button__icon--prev{transform:rotate(-90deg)}[dir=rtl] .pdp-carousel__button__icon--next{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)}[dir=rtl] .pdp-carousel__button__icon--thumbnailsRow--prev,.pdp-carousel__button__icon--thumbnailsRow--next{transform:rotate(-90deg)}[dir=rtl] .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%;margin-right:var(--thumbnails-rest);width:calc(var(--thumbnails-col-width) - 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-left:0;margin-right:var(--thumbnails-box-width)}[dir=rtl] .pdp-carousel__controls--thumbnailsRow>label>span:nth-last-child(1){margin-left:var(--thumbnails-box-width);margin-right:0}.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{--bg-color: var(--color-neutral-300);display:inline-block;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{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};
|