@dropins/storefront-pdp 0.5.0-beta4 → 1.0.0-beta1

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.
Files changed (74) hide show
  1. package/__mocks__/product-mocks.d.ts +1 -0
  2. package/api/fetchProductData/fetchProductData.d.ts +24 -0
  3. package/api/fetchProductData/index.d.ts +17 -0
  4. package/api/getFetchedProductData/getFetchedProductData.d.ts +4 -0
  5. package/api/getFetchedProductData/index.d.ts +17 -0
  6. package/api/getProductConfigurationValues/getProductConfigurationValues.d.ts +4 -0
  7. package/api/getProductConfigurationValues/index.d.ts +17 -0
  8. package/api/getProductData/getProductData.d.ts +4 -1
  9. package/api/getRefinedProduct/getRefinedProduct.d.ts +1 -1
  10. package/api/index.d.ts +6 -0
  11. package/api/initialize/initialize.d.ts +9 -1
  12. package/api/isProductConfigurationValid/index.d.ts +17 -0
  13. package/api/isProductConfigurationValid/isProductConfigurationValid.d.ts +17 -0
  14. package/api/setProductConfigurationValid/index.d.ts +17 -0
  15. package/api/setProductConfigurationValid/setProductConfigurationValid.d.ts +17 -0
  16. package/api/setProductConfigurationValues/index.d.ts +17 -0
  17. package/api/setProductConfigurationValues/setProductConfigurationValues.d.ts +4 -0
  18. package/api.js +3 -1
  19. package/chunks/PriceRange.js +3 -0
  20. package/chunks/Swatches.js +3 -0
  21. package/chunks/Zoom.js +3 -0
  22. package/chunks/date.js +3 -0
  23. package/chunks/fetchProductData.js +187 -0
  24. package/chunks/getFetchedProductData.js +3 -0
  25. package/chunks/getProductConfigurationValues.js +3 -0
  26. package/chunks/isProductConfigurationValid.js +3 -0
  27. package/components/Header/Header.d.ts +10 -0
  28. package/components/Header/index.d.ts +18 -0
  29. package/components/Price/Price.d.ts +9 -0
  30. package/components/Price/index.d.ts +18 -0
  31. package/components/index.d.ts +2 -0
  32. package/containers/ProductAttributes/ProductAttributes.d.ts +8 -0
  33. package/containers/ProductAttributes/index.d.ts +18 -0
  34. package/containers/ProductAttributes.d.ts +3 -0
  35. package/containers/ProductAttributes.js +3 -0
  36. package/containers/ProductDescription/ProductDescription.d.ts +8 -0
  37. package/containers/ProductDescription/index.d.ts +18 -0
  38. package/containers/ProductDescription.d.ts +3 -0
  39. package/containers/ProductDescription.js +3 -0
  40. package/containers/ProductDetails.js +3 -1
  41. package/containers/ProductGallery/ProductGallery.d.ts +18 -0
  42. package/containers/ProductGallery/index.d.ts +3 -0
  43. package/containers/ProductGallery.d.ts +3 -0
  44. package/containers/ProductGallery.js +3 -0
  45. package/containers/ProductHeader/ProductHeader.d.ts +9 -0
  46. package/containers/ProductHeader/index.d.ts +18 -0
  47. package/containers/ProductHeader.d.ts +3 -0
  48. package/containers/ProductHeader.js +3 -0
  49. package/containers/ProductOptions/ProductOptions.d.ts +22 -0
  50. package/containers/ProductOptions/index.d.ts +18 -0
  51. package/containers/ProductOptions.d.ts +3 -0
  52. package/containers/ProductOptions.js +3 -0
  53. package/containers/ProductPrice/ProductPrice.d.ts +8 -0
  54. package/containers/ProductPrice/index.d.ts +18 -0
  55. package/containers/ProductPrice.d.ts +3 -0
  56. package/containers/ProductPrice.js +3 -0
  57. package/containers/ProductQuantity/ProductQuantity.d.ts +9 -0
  58. package/containers/ProductQuantity/index.d.ts +18 -0
  59. package/containers/ProductQuantity.d.ts +3 -0
  60. package/containers/ProductQuantity.js +3 -0
  61. package/containers/ProductShortDescription/ProductShortDescription.d.ts +8 -0
  62. package/containers/ProductShortDescription/index.d.ts +18 -0
  63. package/containers/ProductShortDescription.d.ts +3 -0
  64. package/containers/ProductShortDescription.js +3 -0
  65. package/containers/index.d.ts +8 -0
  66. package/data/models/acdl-models.d.ts +9 -1
  67. package/data/models/index.d.ts +1 -0
  68. package/data/models/product-model.d.ts +4 -15
  69. package/data/models/values-model.d.ts +6 -0
  70. package/data/transforms/product-transform.d.ts +3 -1
  71. package/package.json +1 -1
  72. package/render.js +4 -2
  73. package/chunks/getRefinedProduct.js +0 -185
  74. package/chunks/initialize.js +0 -1
@@ -0,0 +1,3 @@
1
+ /*! Copyright 2024 Adobe
2
+ All Rights Reserved. */
3
+ import{jsxs as a,jsx as i}from"@dropins/tools/preact-jsx-runtime.js";import{useState as n,useEffect as b}from"@dropins/tools/preact-compat.js";import{classes as h}from"@dropins/tools/lib.js";import{events as l}from"@dropins/tools/event-bus.js";import{i as P,t as S}from"../chunks/date.js";import{g as x}from"../chunks/getFetchedProductData.js";import{useText as L}from"@dropins/tools/i18n.js";import{c as j}from"../chunks/fetchProductData.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getProductConfigurationValues.js";const I=({initialData:c=null,children:N,...r})=>{var s;const m=L("PDP.Product.Details.label").label,{defaultLocale:f="en-US"}=j.getConfig(),[u,p]=n(f),[o,d]=n(c);return b(()=>{const e=l.on("pdp/data",d),t=l.on("locale",p);return()=>{e==null||e.off(),t==null||t.off()}},[]),o?a("div",{...r,className:h(["pdp-attributes",r.className]),children:[m,i("ul",{children:(s=o==null?void 0:o.attributes)==null?void 0:s.map(({label:e,value:t},g)=>{const D=P(t)?S(t,u):t.toString();return a("li",{children:[e,": ",i("span",{dangerouslySetInnerHTML:{__html:D}})]},g)})})]}):null};I.getInitialData=x;export{I as ProductAttributes,I as default};
@@ -0,0 +1,8 @@
1
+ import { HTMLAttributes } from 'preact/compat';
2
+ import { Container } from '@dropins/tools/types/elsie/src/lib';
3
+ import { ProductModel } from '../../data/models';
4
+
5
+ export interface ProductDescriptionProps extends HTMLAttributes<HTMLDivElement> {
6
+ }
7
+ export declare const ProductDescription: Container<ProductDescriptionProps, ProductModel | null>;
8
+ //# sourceMappingURL=ProductDescription.d.ts.map
@@ -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 './ProductDescription';
17
+ export { ProductDescription as default } from './ProductDescription';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './ProductDescription/index'
2
+ import _default from './ProductDescription/index'
3
+ export default _default
@@ -0,0 +1,3 @@
1
+ /*! Copyright 2024 Adobe
2
+ All Rights Reserved. */
3
+ import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{useState as i,useEffect as a}from"@dropins/tools/preact-compat.js";import{classes as c}from"@dropins/tools/lib.js";import{events as m}from"@dropins/tools/event-bus.js";import{g as l}from"../chunks/getFetchedProductData.js";const f=({initialData:o=null,children:p,...r})=>{const[t,s]=i(o);return a(()=>{const e=m.on("pdp/data",s);return()=>{e==null||e.off()}},[]),t?n("div",{dangerouslySetInnerHTML:{__html:(t==null?void 0:t.description)??""},...r,className:c(["pdp-description",r.className])}):null};f.getInitialData=l;export{f as ProductDescription,f as default};
@@ -1 +1,3 @@
1
- import{jsxs as j,jsx as n,Fragment as Ae}from"@dropins/tools/preact-jsx-runtime.js";import*as fe from"@dropins/tools/preact-compat.js";import{useState as G,Children as he,useRef as Le,useMemo as Ne,useEffect as J,useCallback as se}from"@dropins/tools/preact-compat.js";import{debounce as xe,classes as $,VComponent as F,toLanguageTag as Me,Slot as Z}from"@dropins/tools/lib.js";import{Button as Pe,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 X}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=e=>fe.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},fe.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),ze=e=>fe.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},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 Ue=(e=>(e[e.small=16]="small",e[e.medium=24]="medium",e[e.large=64]="large",e))(Ue||{});const ye=({show:e=1,scrollbar:s=!1,peak:m=!1,arrows:u=!1,controls:i="dots",arrowsOnMainImage:w=!1,loop:p=!1,gap:P=null,direction:a="horizontal",width:Y="100%",height:o="100%",defaultIndex:b=0,className:R,children:M,thumbnails:T=null,isZoomed:C,...re})=>{const le=X("PDP.Carousel.label").label,r=X("PDP.Carousel.Slide.label").label,y=X("PDP.Carousel.Previous.label").label,_=X("PDP.Carousel.Next.label").label,L=X("PDP.Carousel.Controls.label").label,x=X("PDP.Carousel.Controls.Button.label").label,[v,g]=G(()=>$e(e)),d=Math.ceil(he.count(M)/v),E=m?Ze:0,t=P?Ue[P]:0,z=he.count(M)%v,[S,ae]=G(p?Q()?b-1:b+1:b),K=Le([]),[te,U]=G(0),[ce,pe]=G(0),_e=Ne(()=>he.toArray(T),[T]),V=Ne(()=>{const l=he.toArray(M).reduce((c,D,N)=>N%v===0?[...c,[D]]:[...c.slice(0,-1),[...c[c.length-1],D]],[]);return!p||l.length===1?l:p&&he.count(M)%v===0?[l[d-1]].concat(l).concat([l[0],l[1]]):[he.toArray(M).slice(-v)].concat(l).concat([l[0],l[1]])},[M,v,d,p]),oe=Le(null),ne=Le(null),k=i==="thumbnailsRow"||i==="thumbnailsColumn";J(()=>{const l=document.body,c=xe(()=>{var O,ie;U(((O=oe.current)==null?void 0:O.offsetWidth)??0),pe(((ie=oe.current)==null?void 0:ie.offsetHeight)??0);const N=window.innerWidth,I=$e(e,N);I!==v&&g(I)},50),D=new ResizeObserver(c);return D.observe(l),()=>{D.unobserve(l)}},[v,e]);const ee=se(l=>{const c=p?l-1:l,D=K==null?void 0:K.current[0],N=(D==null?void 0:D.offsetWidth)+Ee,I=(D==null?void 0:D.offsetHeight)+Ee,O=ne.current,ie=i==="thumbnailsRow",we=i==="thumbnailsColumn",de=ie?O==null?void 0:O.offsetWidth:O==null?void 0:O.offsetHeight,q=ie?N:I;(ie||we)&&de&&(q*(c+1)>de&&(O.style.scrollBehavior="smooth",ie?O.scrollLeft=Q()?O.scrollWidth-O.clientWidth-(c+ve)*q:(c+ve)*q:O.scrollTop=(c+ve)*q),(Q()&&(ie?O.scrollLeft:O.scrollTop)<=-q*c||!Q()&&(ie?O.scrollLeft:O.scrollTop)>q*c)&&(O.style.scrollBehavior="smooth",ie?O.scrollLeft=Q()?-(c-ve)*q:(c-ve)*q:O.scrollTop=(c-ve)*q))},[i,p]);J(()=>{ee(S)},[S,ee]);const B=se((l,c,D)=>{k&&ee(l);const N=oe.current,I=E?N.offsetWidth-E:N.offsetWidth-E+t;if(!Array.from(N.querySelectorAll("[data-index]")).filter(de=>{const q=Number(de.getAttribute("data-index"));return!isNaN(q)&&q>-1})[l])return;if(D){const de=l===0?d:0,q=I*(d+(z||v)/v);if(Q()){if(N.scrollLeft<=0&&N.scrollLeft>-(I-5)){B(1,!0);return}if(N.scrollLeft<I-q&&N.scrollLeft>=-q){B(d,!0);return}N.style.scrollBehavior="auto",N.scrollLeft=de===0?0:-q,B(de===0?1:d,!0)}else{if(N.scrollLeft>=0&&N.scrollLeft<I-5){B(1,!0);return}if(N.scrollLeft>q-I&&N.scrollLeft<=q){B(d,!0);return}N.style.scrollBehavior="auto",N.scrollLeft=de===0?0:q,B(de===0?1:d,!0);return}}const we=(N.offsetWidth-t)/v*V[l].length-E;N.style.scrollBehavior=c?"smooth":"auto",N.scrollLeft=Q()?-(V[l].length===v?I*l:I*(l-1)-we):V[l].length===v?I*l:I*(l-1)+we},[t,d,E,v,z,V,ee,i]),ue=se(()=>{if(p){const c=S-1;B(c,!0,Q()?S===d-1:S===1);return}const l=S<=0?0:S-1;B(l,!0)},[S,B,p]),me=se(()=>{const l=V.length-1;if(p){const D=S+1;B(D,!0,Q()?S===0:S===d);return}const c=S>=l?l:S+1;B(c,!0)},[V.length,p,S,B,d]);J(()=>{const l=c=>{c.key==="ArrowLeft"&&(c.preventDefault(),Q()?me():ue()),c.key==="ArrowRight"&&(c.preventDefault(),Q()?ue():me())};return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}},[me,ue]),J(()=>{B(p?b+1:b,!1)},[b,B,p]);const be=xe(()=>{const l=oe.current,c=E?l.offsetWidth-E:l.offsetWidth-E+t,D=Math.abs(l.scrollLeft)/c,N=Math.abs(Math.round(D)-D<1?Math.round(D):Math.ceil(D));if(k&&ee(N),p){const I=c*(d+(z||v)/v),O=Q()?-l.scrollLeft:l.scrollLeft;if(Math.ceil(Math.abs(O))>=Math.ceil(I)-5){l.style.scrollBehavior="auto",l.scrollLeft=Q()?-l.offsetWidth+(Math.ceil(O)-Math.ceil(I)-E):l.offsetWidth+(Math.ceil(O)-Math.ceil(I)-E);return}if(Math.abs(O)===0){l.style.scrollBehavior="auto",l.scrollLeft=Q()?-(I-l.offsetWidth+E):I-l.offsetWidth+E;return}}S!==N&&ae(N)},100);J(()=>{const l=oe.current;return l==null||l.addEventListener("scroll",be),()=>{l==null||l.removeEventListener("scroll",be)}},[be]);const h=(l,c,D)=>n(Pe,{className:$([["pdp-carousel__button",!l],[`pdp-carousel__button--${c}`,!l],[`pdp-carousel__button--${i}`,l]]),style:{"--height":`${ce}px`},variant:"tertiary","aria-label":c==="next"?_:y,onClick:D,disabled:p?!1:c==="next"?S>=V.length-1:S<1,children:n(Se,{className:$([["pdp-carousel__button__icon",!l],[`pdp-carousel__button__icon--${c}`,!l],[`pdp-carousel__button__icon--${i}--${c}`,l]]),size:Qe,source:Ke})}),f=u&&V.length!=1&&h(k,"prev",ue),A=u&&V.length!=1&&h(k,"next",me),W=u&&V.length!=1&&h(!1,"prev",ue),H=u&&V.length!=1&&h(!1,"next",me);return j("div",{role:"region","aria-roledescription":le,className:$(["pdp-carousel",["pdp-carousel--main-image-controls",w],["pdp-carousel--arrows",u&&!k],[`pdp-carousel--${i}`,k],R]),style:{"--flex-carousel":i==="thumbnailsColumn"?"row-reverse":"column","--gap":k?"0":"var(--spacing-small)","--width":Y},...re,children:[n("div",{ref:oe,className:$(["pdp-carousel__wrapper",`pdp-carousel__wrapper--${a}`,["pdp-carousel__wrapper--scrollbar",s],["pdp-carousel__wrapper--peak",m]]),style:{"--total-width":i==="thumbnailsColumn"?"81.6%":"100%","--height":i==="thumbnailsColumn"?"auto":o,"--gap":P?`var(--spacing-${P})`:"0px","--per-page":v},tabIndex:0,children:V.map((l,c)=>{const D=l.length<v;return n("div",{role:"group","aria-roledescription":r,"data-index":c,className:$(["pdp-carousel__slide",`pdp-carousel__slide--${a}`,["pdp-carousel__slide--active",S===c],["pdp-carousel__slide--orphan",D]]),style:{"--length":l.length},children:l},c)})}),!k&&j(Ae,{children:[f,A]}),k&&w&&j(Ae,{children:[W,H]}),i&&V.length!=1&&j("div",{className:$([[`pdp-carousel__controls__container--${i}`,k],["pdp-carousel__controls__container--no-arrows",!u||w]]),style:{"--width":i==="thumbnailsRow"?`${te}px`:Y,"--height":`${ce}px`,"--nr-thumbnails":_e.length},children:[(k||C)&&!w&&f,n("div",{ref:ne,className:$([[`pdp-carousel__controls__wrapper--${i}`,k],["pdp-carousel__controls__wrapper",k]]),children:n("div",{role:"group","aria-label":L,className:$(["pdp-carousel__controls",[`pdp-carousel__controls--${i}`,k]]),children:(p?V.slice(0,d):V).map((l,c)=>{const D=p?d:V.length,N=p?S-1===c:S===c;return k?j("label",{className:$(["pdp-carousel__thumbnail__container"]),ref:I=>{I&&(K.current[c]=I)},children:[n("input",{type:"radio",name:"carousel-thumbnails","aria-label":x.replace("{key}",String(c+1)).replace("{total}",String(D)),checked:N&&te!==0,onChange:()=>{B(p?c+1:c,!0)},...re,className:$(["pdp-carousel__thumbnail",["pdp-carousel__thumbnail--selected",N&&te!==0]])}),n("span",{className:$(["pdp-carousel__thumbnail__span"]),children:_e[c]})]},c):n("button",{"aria-label":x.replace("{key}",String(c+1)).replace("{total}",String(D)),onClick:()=>{B(p?c+1:c,!0)},className:$(["pdp-carousel__controls__button",["pdp-carousel__controls__button--active",N]])},c)})})}),(k||C)&&!w&&A]})]})};function $e(e,s=0){if(typeof e=="number")return e;const{small:m,medium:u,large:i}=e,p=[{breakpoint:1024,value:i},{breakpoint:786,value:u},{breakpoint:0,value:m}].find(({breakpoint:P})=>s>P);return p?p.value:m}function Q(){return document.documentElement.dir==="rtl"}const Je=({title:e,breadcrumbs:s,galleryContent:m,infoContent:u,productContent:i,sku:w,outOfStock:p,shortDescription:P,description:a,attributes:Y,images:o,options:b,price:R,specialPrice:M,className:T,children:C,quantity:re,actions:le,carouselConfig:r,zoomType:y="overlay",closeButton:_=!0,...L})=>{var ae,K,te,U,ce,pe,_e,V,oe;const x=X("PDP.Product.RegularPrice.label").label,v=X("PDP.Product.SpecialPrice.label").label,g=X("PDP.Product.OutOfStock.label").label,d=X("PDP.Product.Image.label").label,[E,t]=G(null),z=o!=null&&o.length?o.map((ne,k)=>{var B;const ee=((B=e==null?void 0:e.props)==null?void 0:B.children)&&(d==null?void 0:d.replace("{product}",e.props.children.toString()).replace("{key}",String(k+1)).replace("{total}",String(o.length)));return y==="zoom"?n(at,{closeButton:_,children:n(F,{node:ne,loading:k===0?"eager":"lazy",alt:ee},k)}):n(F,{node:ne,loading:k===0?"eager":"lazy",alt:ee,onClick:()=>t(k)},k)}):n("img",{src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",className:"pdp-product__images__placeholder","aria-hidden":!0}),S=(ae=r==null?void 0:r.thumbnails)!=null&&ae.length?r.thumbnails.map((ne,k)=>{var ee;return n(F,{node:ne,loading:(r==null?void 0:r.thumbnailsLoadingMode)||"lazy",alt:((ee=e==null?void 0:e.props)==null?void 0:ee.children)&&(d==null?void 0:d.replace("{product}",e.props.children.toString()).replace("{key}",String(k+1)).replace("{total}",String(o.length)))},k)}):n("img",{src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",className:"pdp-product__images__placeholder","aria-hidden":!0});return j("div",{...L,className:$(["pdp-product",T]),children:[s&&n(F,{node:s,className:"pdp-product__breadcrumbs"}),j("div",{className:"pdp-product__column-container pdp-product__gallery-column",children:[n("div",{className:"pdp-product__column-body",children:(K=r==null?void 0:r.controls)!=null&&K.desktop?n(ye,{className:"pdp-product__overlay__carousel",arrows:(o==null?void 0:o.length)>1,controls:(o==null?void 0:o.length)>1?r.controls.desktop:"dots",arrowsOnMainImage:r==null?void 0:r.arrowsOnMainImage,loop:(r==null?void 0:r.loopable)&&(o==null?void 0:o.length)>1,peak:((te=r==null?void 0:r.thumbnails)==null?void 0:te.length)>1&&((U=r==null?void 0:r.peak)==null?void 0:U.desktop)||!1,gap:(r==null?void 0:r.gap)||null,width:"100%",height:"100%",defaultIndex:E||0,thumbnails:S,children:z}):n(Ce,{className:"pdp-product__images",gap:"small",children:z})}),m&&n(F,{node:m,className:"pdp-product__gallery-content"})]}),j("div",{className:"pdp-product__column-container pdp-product__content-column",children:[j("div",{className:"pdp-product__column-body",children:[j("div",{className:"pdp-product__header",children:[e&&n(F,{node:e,className:"pdp-product__title"}),w&&n(F,{node:w,className:"pdp-product__sku"})]}),j("div",{className:"pdp-product__prices",children:[M&&n(F,{node:M,className:$(["pdp-product__price-special","pdp-product__price"]),"aria-label":v,role:"text"}),R&&n(F,{node:R,className:$(["pdp-product__price-regular","pdp-product__price--grey"]),"aria-label":x,role:"text"})]}),(ce=r==null?void 0:r.controls)!=null&&ce.mobile&&((pe=r==null?void 0:r.controls)==null?void 0:pe.mobile)==="thumbnailsRow"?n(ye,{className:"pdp-product__images pdp-product__images--carousel pdp-product__images--carousel--thumbnails",width:"100%",height:"auto",arrows:(o==null?void 0:o.length)>1,controls:(o==null?void 0:o.length)>1?"thumbnailsRow":null,loop:(r==null?void 0:r.loopable)&&(o==null?void 0:o.length)>1,peak:((_e=r==null?void 0:r.thumbnails)==null?void 0:_e.length)>1&&((V=r==null?void 0:r.peak)==null?void 0:V.mobile)||!1,gap:(r==null?void 0:r.gap)||null,thumbnails:S,children:z}):n(ye,{className:"pdp-product__images pdp-product__images--carousel",peak:((oe=r==null?void 0:r.peak)==null?void 0:oe.mobile)&&(o==null?void 0:o.length)>1,gap:(r==null?void 0:r.gap)||null,width:"100%",height:"auto",arrows:(o==null?void 0:o.length)>1,controls:(o==null?void 0:o.length)>1?"dots":null,loop:(r==null?void 0:r.loopable)&&(o==null?void 0:o.length)>1,children:z}),j("div",{className:$(["pdp-product__actions",["pdp-product__actions--out-of-stock",p]]),children:[p&&n("div",{className:"pdp-product__out-of-stock__text",children:g}),b&&n(F,{node:b,className:$(["pdp-product__options"])}),re&&n("div",{className:"pdp-product__quantity",children:n(F,{node:re})}),le&&n(F,{node:le,className:$(["pdp-product__buttons"])})]}),P&&n(F,{node:P,className:$(["pdp-product__short_description"])}),a&&n(F,{node:a,className:$(["pdp-product__description"])}),Y?n("div",{className:"pdp-product__attributes",children:Y}):null]}),u&&n(F,{node:u,className:"pdp-product__info-content"})]}),i&&n(F,{node:i,className:"pdp-product__content"}),E===null?null:n(et,{className:"pdp-product__overlay",onClose:()=>t(null),centered:!0,children:n(ye,{className:"pdp-product__overlay__carousel",arrows:(o==null?void 0:o.length)>1,width:"100%",height:"100%",defaultIndex:E||0,loop:(r==null?void 0:r.loopable)&&(o==null?void 0:o.length)>1,controls:(o==null?void 0:o.length)>1?"dots":null,isZoomed:!0,children:z})})]})},Ce=({children:e,gap:s=null,className:m,style:u,...i})=>{const w=he.count(e);return n("div",{...i,className:$(["pdp-gallery-grid",m]),style:{"--gap":s?`var(--spacing-${s})`:"0px",...u},children:he.map(e,(p,P)=>n("div",{className:"pdp-gallery-grid__item",children:n(F,{node:p,loading:P===0?"eager":"lazy"},p.props.src)},w+P))})},Ie=({amount:e,currency:s,locale:m,variant:u,sale:i,minimumAmount:w,maximumAmount:p,className:P,...a})=>n(Ae,{children:e||w===p?n("div",{className:"pdp-price-range",...a,children:n(ge,{amount:e||w,currency:s,locale:m,variant:u,sale:i,className:P})}):j("div",{className:"pdp-price-range",...a,children:[n(ge,{amount:w,currency:s,locale:m,className:P}),n("span",{className:"pdp-price-range__label",children:"-"}),n(ge,{amount:p,currency:s,locale:m,className:P})]})}),et=({centered:e,onClose:s,className:m,children:u,...i})=>{const w=X("PDP.Overlay.Close.label").label,p=se(()=>{s==null||s()},[s]);return J(()=>{const P=a=>{a.key==="Escape"&&p()};return document.addEventListener("keydown",P),()=>{document.removeEventListener("keydown",P)}},[p]),J(()=>{const P=document.scrollingElement,a=P.style.overflow;return P.style.overflow="hidden",()=>{P.style.overflow=a}},[]),j("div",{...i,className:$(["pdp-overlay",["pdp-overlay--centered",e],m]),children:[n("div",{className:"pdp-overlay__content",children:u}),n(Pe,{"aria-label":w,variant:"tertiary",className:"pdp-overlay__close-button",onClick:p,icon:n(ze,{})})]})},tt=["text","image","color","dropdown"],nt=e=>e.map(s=>({...s,text:s.label,disabled:!s.inStock}));function rt(e,s){return e.reduce((m,u)=>{const i=s==null?void 0:s.find(p=>p.items.find(P=>P.id===u));if(!i)return m;const w=i.items.find(p=>p.id===u);return{...m,[i.id]:{label:w.label,value:w.id}}},{})}const lt=({options:e,hideSelectedValue:s,disablePreselections:m,selectedUIDs:u,onValues:i,onErrors:w,defaultOptions:p,selectionsToUpdate:P,className:a,children:Y,...o})=>{const b=X("PDP.Swatches.Required.label").label,R=X("PDP.Swatches.ChooseOption.label").label,[M,T]=G(()=>e==null?void 0:e.reduce((y,_)=>{const{items:L}=_,x=L==null?void 0:L.find(g=>p==null?void 0:p.includes(g.id)),v=L==null?void 0:L.find(g=>g.selected);return x?{...y,[_.id]:{label:x.label,value:x.id}}:v?{...y,[_.id]:{label:v.label,value:v.id}}:y},{}));J(()=>{if(u){const r=rt(u,e);if(JSON.stringify(r)===JSON.stringify(M))return;T(y=>{let _={...y,...r};return i==null||i(_),_})}},[u]),J(()=>{P==null||P.forEach(r=>{T(y=>{var x;const _=(x=r==null?void 0:r.items)==null?void 0:x.find(v=>v.selected);return _?{...y,[r.id]:{label:_==null?void 0:_.label,value:_==null?void 0:_.id}}:y})})},[P,T]),Ne(()=>{const r=e==null?void 0:e.reduce((y,_)=>{var x;let L=!1;return(x=_==null?void 0:_.items)==null||x.forEach(v=>{var d;((d=M[_.id])==null?void 0:d.value)===v.id&&(L=!0)}),_.required&&!L&&(y[_.id]=b),y},{});return w==null||w(r),r},[M]);const C=se((r,y,_)=>{T(L=>{let x={...L,...r&&{[r]:{label:y,value:_}}};return y===R&&delete x[r],i==null||i(x,_),x})},[i]),re=(r,y)=>{var L;const _=((L=y.selectedOptions[0])==null?void 0:L.label)??"";C(r,_,y.value)},le=se(({items:r,id:y,required:_,type:L,selected:x,label:v})=>(r==null?void 0:r.length)>0&&n("div",{className:$(["pdp-swatches__options"]),children:(L==null?void 0:L.toLowerCase())==="dropdown"?n(qe,{"aria-label":v,placeholder:m?R:void 0,handleSelect:g=>re(y,g.target),options:nt(r),value:x}):r==null?void 0:r.map(g=>{const d={key:g.id,id:g.id,name:y,value:g.value,label:g.label,groupAriaLabel:v,selected:x===g.id,outOfStock:!g.inStock,required:_===null?!0:_,onValue:()=>{C(y,g.label,g.id)}};switch(L){case"text":return n(Fe,{...d,label:g.label});case"image":return n(Xe,{...d,src:g.value,alt:g.label});case"color":return n(je,{...d,size:"large",color:g.value});default:return console.warn(`Invalid swatch type ${L}`),null}})}),[C]);return n("div",{...o,className:$(["pdp-swatches",a]),children:e==null?void 0:e.map(({type:r,label:y,id:_,multiple:L,required:x,items:v})=>{var g;return tt.includes(r)||console.warn(`Invalid swatch type ${r}`),L&&console.warn("Multiple selection swatches are not currently supported."),j("div",{id:`swatch-item-${_}`,"data-slot-key":`product-swatch--${_}`,className:"pdp-swatches__field",children:[n("div",{className:"pdp-swatches__field__label",children:M[_]?s?`${y}`:`${y}: ${M[_].label}`:y}),n(le,{id:_,type:r,required:x,items:v,label:y,selected:(g=M[_])==null?void 0:g.value})]},`swatch-item-${_}`)})})},at=({children:e,scale:s=2,closeButton:m=!0})=>{const[u,i]=G(!1),[w,p]=G("pdp-zoom"),[P,a]=G(!1),[Y,o]=G({x:0,y:0}),[b,R]=G({x:0,y:0}),[M,T]=G({x:0,y:0}),C=d=>{!u||d.type!=="touchstart"||(o({x:d.touches[0].clientX,y:d.touches[0].clientY}),R({x:M.x,y:M.y}),a(!0))},re=d=>{var ce;if(!P||d.type!=="touchmove")return;const E=(ce=d.currentTarget)==null?void 0:ce.getBoundingClientRect(),t=(100-100/s)/2,z=d.touches[0].clientX-Y.x,S=d.touches[0].clientY-Y.y,ae=z*100/(E.width*s),K=S*100/(E.height*s),te=b.x+ae,U=b.y+K;T({x:Math.max(-t,Math.min(te,t))||0,y:Math.max(-t,Math.min(U,t))||0}),d.preventDefault()},le=d=>{var K;const E=(K=d.currentTarget)==null?void 0:K.getBoundingClientRect(),t=(100-100/s)/2;let z;if("touches"in d)z=d.touches[0];else if(d instanceof MouseEvent)z=d;else return;const S=t-(z.clientX-E.left)/E.width*100,ae=t-(z.clientY-E.top)/E.height*100;T({x:Math.max(-t,Math.min(S,t))||0,y:Math.max(-t,Math.min(ae,t))||0})},r=d=>{if(!P){if(u){if(m&&"touches"in d){C(d);return}m||i(!1)}else i(!0),le(d);d.preventDefault()}},y=d=>{if(m&&"touches"in d){re(d);return}u&&le(d)},_=()=>{if(m){a(!1);return}i(!1)},L=d=>{i(!1),d.stopPropagation()},x=u?`scale(${s}) translateX(${M.x}%) translateY(${M.y}%)`:"none",v=X("PDP.Zoom.Close.label").label,g=Ye(he.only(e),{draggable:!1,style:{"--transform":x}});return J(()=>{p(u?`pdp-zoom ${m?"pdp-zoom--no-effects":"pdp-zoom--zoomed"}`:"pdp-zoom")},[u,m]),j("figure",{className:w,onClick:r,onMouseMove:y,onMouseLeave:_,onTouchStart:r,onTouchMove:y,onTouchEnd:_,children:[g,m&&u&&n(Pe,{"aria-label":v,variant:"tertiary",className:"pdp-zoom__close-button",icon:n(ze,{}),onClick:L})]})};function ct(e,s="en_US"){if(!Ve(e))throw Error("Invalid date string");return e.split(" ")[1]||(e=`${e} 00:00:00`),new Date(e).toLocaleDateString(Me(s)).toString()}function Ve(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(u=>u.test(e)))return!1;const m=new Date(e);return!isNaN(m.getTime())}function ot(e){const s=new URLSearchParams(window.location.search);Object.entries(e).forEach(([u,i])=>{i===null?s.delete(u):s.set(u,String(i))});let m=window.location.pathname;m+=`?${s.toString()}`,m+=window.location.hash,window.history.replaceState({},"",m)}function it(){const e=new URLSearchParams(window.location.search),s={};return e.forEach((m,u)=>{s[u]=m}),s}function st(e){var s,m,u,i,w,p,P,a,Y,o,b,R;return{productId:Number(e==null?void 0:e.externalId),name:e==null?void 0:e.name,sku:(e==null?void 0:e.variantSku)||(e==null?void 0:e.sku),topLevelSku:e==null?void 0:e.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:((m=(s=e==null?void 0:e.prices)==null?void 0:s.regular)==null?void 0:m.amount)||0,minimalPrice:(i=(u=e==null?void 0:e.prices)==null?void 0:u.final)==null?void 0:i.minimumAmount,maximalPrice:(p=(w=e==null?void 0:e.prices)==null?void 0:w.final)==null?void 0:p.maximumAmount,specialPrice:(a=(P=e==null?void 0:e.prices)==null?void 0:P.final)==null?void 0:a.amount,tierPricing:void 0,currencyCode:((o=(Y=e==null?void 0:e.prices)==null?void 0:Y.final)==null?void 0:o.currency)||"USD"},canonicalUrl:e==null?void 0:e.url,mainImageUrl:(R=(b=e==null?void 0:e.images)==null?void 0:b[0])==null?void 0:R.url}}const dt={PRODUCT_CONTEXT:"productContext"},ht={PRODUCT_PAGE_VIEW:"product-page-view"};function He(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function pt(e,s){const m=He();m.push({[e]:null}),m.push({[e]:s})}function ut(e,s){He().push(u=>{const i=u.getState?u.getState():{};u.push({event:e,eventInfo:{...i,...s}})})}function Re(e){const s=st(e);pt(dt.PRODUCT_CONTEXT,s),ut(ht.PRODUCT_PAGE_VIEW)}const mt=({sku:e,hideSku:s,hideQuantity:m,hideShortDescription:u,hideDescription:i,hideAttributes:w,hideURLParams:p,hideSelectedOptionValue:P,slots:a,children:Y,initialData:o,carousel:b,optionsConfig:R,useACDL:M,onAddToCart:T,zoomType:C,closeButton:re=!0,disableDropdownPreselection:le,...r})=>{var B,ue,me,be;const y=X("PDP.Product.AddToCart.label").label,_=X("PDP.Product.Incrementer.label").label,L=X("PDP.Product.Details.label").label,x=X("PDP.Swatches.ChooseOption.label").label,[v,g]=G(We.getConfig().defaultLocale||"en-US"),[d,E]=G(),[t=null,z]=G(o),[S,ae]=G(()=>{const h={sku:e,quantity:1};return t!=null&&t.optionUIDs&&(h.optionsUIDs=t.optionUIDs),h}),[K,te]=G(()=>{var h,f;return!(t!=null&&t.options&&((h=t==null?void 0:t.options)==null?void 0:h.length)>0&&((f=t==null?void 0:t.optionUIDs)==null?void 0:f.length)!==(t==null?void 0:t.options.length))}),U={data:t,values:S,valid:K};function ce(h){return h==null?void 0:h.some(f=>(f==null?void 0:f.typename)==="ProductViewOptionValueProduct")}J(()=>{const h=ke.on("pdp/setValues",f=>{ae(A=>({...A,...f}))});return()=>{h==null||h.off()}},[]),J(()=>{const h=ke.on("locale",f=>{f!==v&&(g(f),Te(e).then(z))});return()=>{h==null||h.off()}},[v,e]),J(()=>{M&&o&&Object.keys(o).length>0&&Re(o)},[o]);const pe=se(h=>{ae(f=>({...f,...h}))},[]);J(()=>{ke.emit("pdp/values",S)},[JSON.stringify(S)]);const _e=se(h=>{var W,H;let f=Object.entries(h).filter(([l,c])=>c.label!==x).map(([l,c])=>h[l].value).filter(l=>l!==void 0);!p&&(t!=null&&t.options)&&!ce(t.options)&&ot({optionsUIDs:f.join(",")}),pe({optionsUIDs:f}),te((f==null?void 0:f.length)===((W=t==null?void 0:t.options)==null?void 0:W.length));const A=(H=t==null?void 0:t.options)==null?void 0:H.some(l=>ce([l]));Be(e,f,R==null?void 0:R.anchorOptions,A).then(l=>{var c;z(l),(c=R==null?void 0:R.anchorOptions)!=null&&c.length&&V(l,f),M&&(l==null?void 0:l.variantSku)!==e&&Re(l)})},[e]),V=se((h,f)=>{var H;const A=(h==null?void 0:h.optionUIDs)??[];f.every(l=>A.includes(l))||(E(h==null?void 0:h.options),pe({optionsUIDs:A}),te((A==null?void 0:A.length)===((H=h==null?void 0:h.options)==null?void 0:H.length)))},[e]),oe=se(h=>{Object.keys(h).length!==0&&te(!1)},[]),ne=Ne(()=>{var h;return(h=t==null?void 0:t.attributes)==null?void 0:h.map(({label:f,value:A},W)=>{const H=Ve(A)?ct(A,v):A.toString();return j("li",{children:[f,": ",n("span",{dangerouslySetInnerHTML:{__html:H}})]},W)})},[t==null?void 0:t.attributes,v]),k=!m&&(t!=null&&t.inStock)?n(Z,{name:"Quantity",slot:a==null?void 0:a.Quantity,context:{...U},children:n(Ge,{name:"quantity",defaultValue:S.quantity.toString(),value:S.quantity.toString(),min:1,"aria-label":_,className:"pdp-product__quantity",onValue:h=>{pe({quantity:Number(h)})}},"quantity")}):void 0,ee=()=>{if(t!=null&&t.options)return n(Z,{name:"Options",slot:a==null?void 0:a.Options,context:{...U},children:n(lt,{selectedUIDs:S.optionsUIDs,options:t.options,defaultOptions:S.optionsUIDs,selectionsToUpdate:d,hideSelectedValue:P,disablePreselections:le,onValues:_e,onErrors:oe})})};return n("div",{...r,children:n(Je,{title:n(Z,{name:"Title",slot:a==null?void 0:a.Title,context:{...U},children:t==null?void 0:t.name}),sku:s?void 0:n(Z,{name:"SKU",slot:a==null?void 0:a.SKU,context:{...U},children:t==null?void 0:t.sku}),options:ee(),breadcrumbs:(a==null?void 0:a.Breadcrumbs)&&n(Z,{name:"Breadcrumbs",slot:a==null?void 0:a.Breadcrumbs,context:{...U,setSeparator(h){this._registerMethod((...f)=>{const A=h(...f),W=A&&n(Se,{source:A});this._setProps(H=>({...H,separator:W,children:[n(De,{separator:W,categories:H.categories})]}))})},appendLink(h){this._registerMethod((...f)=>{const{text:A,...W}=h(...f),H=n("a",{...W,children:A});this._setProps(l=>{const c=[...l.categories||[],H];return{...l,categories:c,children:[n(De,{separator:l.separator,categories:c})]}})})},appendHTMLElement(h){this._registerMethod((...f)=>{const A=h(...f),W=this._htmlElementToVNode(A);this._setProps(H=>{const l=[...H.categories||[],W];return{...H,categories:l,children:[n(De,{separator:H.separator,categories:l})]}})})}}}),quantity:k,actions:n(Z,{name:"Actions",slot:a==null?void 0:a.Actions,context:{...U,appendButton(h){this._registerMethod((...f)=>{const A=h(...f);if(!A)return;const{text:W,icon:H,...l}=A,c=n(Pe,{type:"button",...l,icon:H&&n(Se,{source:H}),children:W});this._setProps(D=>({children:[...D.children||[],c]}))})}},children:!(a!=null&&a.Actions)&&n(Pe,{size:"medium",type:"submit",icon:n(Se,{source:"Cart"}),disabled:!(t!=null&&t.inStock)||!K,"aria-label":y,onClick:()=>T==null?void 0:T(S),children:y})}),shortDescription:u?void 0:n(Z,{name:"ShortDescription",slot:a==null?void 0:a.ShortDescription,context:{...U},children:n("div",{dangerouslySetInnerHTML:{__html:(t==null?void 0:t.shortDescription)??""}})}),description:i?void 0:n(Z,{name:"Description",slot:a==null?void 0:a.Description,context:{...U},children:n("div",{dangerouslySetInnerHTML:{__html:(t==null?void 0:t.description)??""}})}),images:((B=t==null?void 0:t.images)==null?void 0:B.map(({label:h,url:f})=>{var A,W;return n(Oe,{title:h,alt:h,src:f,width:((A=b==null?void 0:b.imageParams)==null?void 0:A.width)??960,height:((W=b==null?void 0:b.imageParams)==null?void 0:W.height)??1191,params:(b==null?void 0:b.imageParams)??{width:960}},f)}))??[],specialPrice:(ue=t==null?void 0:t.prices)!=null&&ue.visible?n(Z,{name:"SpecialPrice",slot:a==null?void 0:a.SpecialPrice,context:{...U},children:n(Ie,{...t.prices.final,locale:Me(v)})}):void 0,price:(me=t==null?void 0:t.prices)!=null&&me.visible&&t.prices.regular&&t.prices.final.amount!==(t==null?void 0:t.prices.regular.amount)?n(Z,{name:"RegularPrice",slot:a==null?void 0:a.RegularPrice,context:{...U},children:n(Ie,{...t.prices.regular,locale:Me(v)})}):void 0,zoomType:C,closeButton:re,carouselConfig:{...b,thumbnails:b&&Object.keys(b).length?((be=t==null?void 0:t.images)==null?void 0:be.map(({label:h,url:f})=>{var A,W;return n(Oe,{title:h,alt:h,src:f,width:((A=b==null?void 0:b.thumbnailParams)==null?void 0:A.width)??200,height:((W=b==null?void 0:b.thumbnailParams)==null?void 0:W.height)??248,params:(b==null?void 0:b.thumbnailParams)??{width:200}},f)}))??[]:[]},outOfStock:!(t!=null&&t.inStock),attributes:w?void 0:n(Z,{name:"Attributes",slot:a==null?void 0:a.Attributes,context:{...U},children:ne!=null&&ne.length?j(Ae,{children:[L,n("ul",{children:ne})]}):null}),galleryContent:(a==null?void 0:a.GalleryContent)&&n(Z,{name:"GalleryContent",slot:a.GalleryContent,context:{...U}}),infoContent:(a==null?void 0:a.InfoContent)&&n(Z,{name:"InfoContent",slot:a.InfoContent,context:{...U}}),productContent:(a==null?void 0:a.Content)&&n(Z,{name:"Content",slot:a.Content,context:{...U}})})})};mt.getInitialData=async function({sku:e,optionsConfig:s}){var P,a,Y,o,b,R,M;function m(T){return T.some(C=>C.__typename==="ProductViewOptionValueProduct")}let u;const i=We.getConfig(),w=((P=it().optionsUIDs)==null?void 0:P.split(","))||((o=(Y=(a=i==null?void 0:i.models)==null?void 0:a.ProductDetails)==null?void 0:Y.initialData)==null?void 0:o.optionsUIDs),p=(R=(b=i==null?void 0:i.models)==null?void 0:b.ProductDetails)==null?void 0:R.initialData;return p&&Object.keys(p).length>0&&(u=(M=p.options)==null?void 0:M.some(T=>m(T==null?void 0:T.values))),w!=null&&w.length?await Be(e,w,s==null?void 0:s.anchorOptions,u):await Te(e)};export{mt as ProductDetails,mt as default};
1
+ /*! Copyright 2024 Adobe
2
+ All Rights Reserved. */
3
+ import{jsx as e,jsxs as w,Fragment as Nt}from"@dropins/tools/preact-jsx-runtime.js";import{useState as q,Children as ot,useEffect as f,useCallback as g,useMemo as vt}from"@dropins/tools/preact-compat.js";import{VComponent as o,classes as D,Slot as A,toLanguageTag as ut}from"@dropins/tools/lib.js";import{Incrementer as Ot,Breadcrumbs as ct,Button as bt,Icon as dt,Image as At}from"@dropins/tools/components.js";/* empty css */import{Z as It,C,O as Dt}from"../chunks/Zoom.js";import{useText as x}from"@dropins/tools/i18n.js";import{P as Pt}from"../chunks/PriceRange.js";import{S as wt}from"../chunks/Swatches.js";import"@dropins/tools/preact.js";import{c as yt,h as ht,p as Vt,j as kt}from"../chunks/fetchProductData.js";import{events as lt}from"@dropins/tools/event-bus.js";import{i as Bt,t as xt}from"../chunks/date.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getProductConfigurationValues.js";const Lt=({title:i,breadcrumbs:v,galleryContent:S,infoContent:N,productContent:O,sku:s,outOfStock:L,shortDescription:U,description:r,attributes:tt,images:c,options:h,price:u,specialPrice:Z,className:z,children:it,quantity:K,actions:M,carouselConfig:n,zoomType:J="overlay",closeButton:et=!0,...nt})=>{var H,F,E,m,$,j,W,X,Y;const rt=x("PDP.Product.RegularPrice.label").label,V=x("PDP.Product.SpecialPrice.label").label,pt=x("PDP.Product.OutOfStock.label").label,k=x("PDP.Product.Image.label").label,[G,t]=q(null),B=c!=null&&c.length?c.map((I,y)=>{var Q;const R=((Q=i==null?void 0:i.props)==null?void 0:Q.children)&&(k==null?void 0:k.replace("{product}",i.props.children.toString()).replace("{key}",String(y+1)).replace("{total}",String(c.length)));return J==="zoom"?e(It,{closeButton:et,children:e(o,{node:I,loading:y===0?"eager":"lazy",alt:R},y)}):e(o,{node:I,loading:y===0?"eager":"lazy",alt:R,onClick:()=>t(y)},y)}):e("img",{src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",className:"pdp-product__images__placeholder","aria-hidden":!0}),P=(H=n==null?void 0:n.thumbnails)!=null&&H.length?n.thumbnails.map((I,y)=>{var R;return e(o,{node:I,loading:(n==null?void 0:n.thumbnailsLoadingMode)||"lazy",alt:((R=i==null?void 0:i.props)==null?void 0:R.children)&&(k==null?void 0:k.replace("{product}",i.props.children.toString()).replace("{key}",String(y+1)).replace("{total}",String(c.length)))},y)}):e("img",{src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",className:"pdp-product__images__placeholder","aria-hidden":!0});return w("div",{...nt,className:D(["pdp-product",z]),children:[v&&e(o,{node:v,className:"pdp-product__breadcrumbs"}),w("div",{className:"pdp-product__column-container pdp-product__gallery-column",children:[e("div",{className:"pdp-product__column-body",children:(F=n==null?void 0:n.controls)!=null&&F.desktop?e(C,{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:((E=n==null?void 0:n.thumbnails)==null?void 0:E.length)>1&&((m=n==null?void 0:n.peak)==null?void 0:m.desktop)||!1,gap:(n==null?void 0:n.gap)||null,width:"100%",height:"100%",defaultIndex:G||0,thumbnails:P,children:B}):e(Ut,{className:"pdp-product__images",gap:"small",children:B})}),S&&e(o,{node:S,className:"pdp-product__gallery-content"})]}),w("div",{className:"pdp-product__column-container pdp-product__content-column",children:[w("div",{className:"pdp-product__column-body",children:[w("div",{className:"pdp-product__header",children:[i&&e(o,{node:i,className:"pdp-product__title"}),s&&e(o,{node:s,className:"pdp-product__sku"})]}),w("div",{className:"pdp-product__prices",children:[Z&&e(o,{node:Z,className:D(["pdp-product__price-special","pdp-product__price"]),"aria-label":V,role:"text"}),u&&e(o,{node:u,className:D(["pdp-product__price-regular","pdp-product__price--grey"]),"aria-label":rt,role:"text"})]}),($=n==null?void 0:n.controls)!=null&&$.mobile&&((j=n==null?void 0:n.controls)==null?void 0:j.mobile)==="thumbnailsRow"?e(C,{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:((W=n==null?void 0:n.thumbnails)==null?void 0:W.length)>1&&((X=n==null?void 0:n.peak)==null?void 0:X.mobile)||!1,gap:(n==null?void 0:n.gap)||null,thumbnails:P,children:B}):e(C,{className:"pdp-product__images pdp-product__images--carousel",peak:((Y=n==null?void 0:n.peak)==null?void 0:Y.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:B}),w("div",{className:D(["pdp-product__actions",["pdp-product__actions--out-of-stock",L]]),children:[L&&e("div",{className:"pdp-product__out-of-stock__text",children:pt}),h&&e(o,{node:h,className:D(["pdp-product__options"])}),K&&e("div",{className:"pdp-product__quantity",children:e(o,{node:K})}),M&&e(o,{node:M,className:D(["pdp-product__buttons"])})]}),U&&e(o,{node:U,className:D(["pdp-product__short_description"])}),r&&e(o,{node:r,className:D(["pdp-product__description"])}),tt?e("div",{className:"pdp-product__attributes",children:tt}):null]}),N&&e(o,{node:N,className:"pdp-product__info-content"})]}),O&&e(o,{node:O,className:"pdp-product__content"}),G===null?null:e(Dt,{className:"pdp-product__overlay",onClose:()=>t(null),centered:!0,children:e(C,{className:"pdp-product__overlay__carousel",arrows:(c==null?void 0:c.length)>1,width:"100%",height:"100%",defaultIndex:G||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:B})})]})},Ut=({children:i,gap:v=null,className:S,style:N,...O})=>{const s=ot.count(i);return e("div",{...O,className:D(["pdp-gallery-grid",S]),style:{"--gap":v?`var(--spacing-${v})`:"0px",...N},children:ot.map(i,(L,U)=>e("div",{className:"pdp-gallery-grid__item",children:e(o,{node:L,loading:U===0?"eager":"lazy"},L.props.src)},s+U))})},Mt=({sku:i,hideSku:v,hideQuantity:S,hideShortDescription:N,hideDescription:O,hideAttributes:s,hideURLParams:L,hideSelectedOptionValue:U,slots:r,children:tt,initialData:c,carousel:h,optionsConfig:u,useACDL:Z,onAddToCart:z,zoomType:it,closeButton:K=!0,disableDropdownPreselection:M,...n})=>{var Q,at,_t,mt;const J=x("PDP.Product.AddToCart.label").label,et=x("PDP.Product.Incrementer.label").label,nt=x("PDP.Product.Details.label").label,rt=x("PDP.Swatches.ChooseOption.label").label,[V,pt]=q(yt.getConfig().defaultLocale||"en-US"),[k,G]=q(),[t=null,B]=q(c),[P,H]=q(()=>{const p={sku:i,quantity:1};return t!=null&&t.optionUIDs&&(p.optionsUIDs=t.optionUIDs),p}),[F,E]=q(()=>{var p,d;return!(t!=null&&t.options&&((p=t==null?void 0:t.options)==null?void 0:p.length)>0&&((d=t==null?void 0:t.optionUIDs)==null?void 0:d.length)!==(t==null?void 0:t.options.length))}),m={data:t,values:P,valid:F};function $(p){return p==null?void 0:p.some(d=>(d==null?void 0:d.typename)==="ProductViewOptionValueProduct")}f(()=>{const p=lt.on("pdp/setValues",d=>{H(l=>({...l,...d}))});return()=>{p==null||p.off()}},[]),f(()=>{const p=lt.on("locale",d=>{d!==V&&(pt(d),ht(i,{preselectFirstOption:!M,anchors:u==null?void 0:u.anchorOptions}).then(B))});return()=>{p==null||p.off()}},[M,V,u==null?void 0:u.anchorOptions,i]),f(()=>{Z&&c&&Object.keys(c).length>0&&Vt(c)},[c]);const j=g(p=>{H(d=>({...d,...p}))},[]);f(()=>{lt.emit("pdp/values",P)},[JSON.stringify(P)]);const W=g(async p=>{var a,_;let d=Object.entries(p).filter(([b,T])=>T.label!==rt).map(([b,T])=>p[b].value).filter(b=>b!==void 0);!L&&(t!=null&&t.options)&&!$(t.options)&&kt({optionsUIDs:d.join(",")}),j({optionsUIDs:d}),E((d==null?void 0:d.length)===((a=t==null?void 0:t.options)==null?void 0:a.length));const l=await ht(i,{anchors:u==null?void 0:u.anchorOptions,isBundle:t==null?void 0:t.isBundle,optionsUIDs:d,preselectFirstOption:!M});B(l),(_=u==null?void 0:u.anchorOptions)!=null&&_.length&&X(l,d)},[i]),X=g((p,d)=>{var _;const l=(p==null?void 0:p.optionUIDs)??[];d.every(b=>l.includes(b))||(G(p==null?void 0:p.options),j({optionsUIDs:l}),E((l==null?void 0:l.length)===((_=p==null?void 0:p.options)==null?void 0:_.length)))},[i]),Y=g(p=>{Object.keys(p).length!==0&&E(!1)},[]),I=vt(()=>{var p;return(p=t==null?void 0:t.attributes)==null?void 0:p.map(({label:d,value:l},a)=>{const _=Bt(l)?xt(l,V):l.toString();return w("li",{children:[d,": ",e("span",{dangerouslySetInnerHTML:{__html:_}})]},a)})},[t==null?void 0:t.attributes,V]),y=!S&&(t!=null&&t.inStock)?e(A,{name:"Quantity",slot:r==null?void 0:r.Quantity,context:{...m},children:e(Ot,{name:"quantity",defaultValue:P.quantity.toString(),value:P.quantity.toString(),min:1,"aria-label":et,className:"pdp-product__quantity",onValue:p=>{j({quantity:Number(p)})}},"quantity")}):void 0,R=()=>{if(t!=null&&t.options)return e(A,{name:"Options",slot:r==null?void 0:r.Options,context:{...m},children:e(wt,{selectedUIDs:P.optionsUIDs,options:t.options,defaultOptions:P.optionsUIDs,selectionsToUpdate:k,hideSelectedValue:U,disablePreselections:M,onValues:W,onErrors:Y})})};return e("div",{...n,children:e(Lt,{title:e(A,{name:"Title",slot:r==null?void 0:r.Title,context:{...m},children:t==null?void 0:t.name}),sku:v?void 0:e(A,{name:"SKU",slot:r==null?void 0:r.SKU,context:{...m},children:t==null?void 0:t.sku}),options:R(),breadcrumbs:(r==null?void 0:r.Breadcrumbs)&&e(A,{name:"Breadcrumbs",slot:r==null?void 0:r.Breadcrumbs,context:{...m,setSeparator(p){this._registerMethod((...d)=>{const l=p(...d),a=l&&e(dt,{source:l});this._setProps(_=>({..._,separator:a,children:[e(ct,{separator:a,categories:_.categories})]}))})},appendLink(p){this._registerMethod((...d)=>{const{text:l,...a}=p(...d),_=e("a",{...a,children:l});this._setProps(b=>{const T=[...b.categories||[],_];return{...b,categories:T,children:[e(ct,{separator:b.separator,categories:T})]}})})},appendHTMLElement(p){this._registerMethod((...d)=>{const l=p(...d),a=this._htmlElementToVNode(l);this._setProps(_=>{const b=[..._.categories||[],a];return{..._,categories:b,children:[e(ct,{separator:_.separator,categories:b})]}})})}}}),quantity:y,actions:e(A,{name:"Actions",slot:r==null?void 0:r.Actions,context:{...m,appendButton(p){this._registerMethod((...d)=>{const l=p(...d);if(!l)return;const{text:a,icon:_,...b}=l,T=e(bt,{type:"button",...b,icon:_&&e(dt,{source:_}),children:a});this._setProps(St=>({children:[...St.children||[],T]}))})}},children:!(r!=null&&r.Actions)&&e(bt,{size:"medium",type:"submit",icon:e(dt,{source:"Cart"}),disabled:!(t!=null&&t.inStock)||!F,"aria-label":J,onClick:()=>z==null?void 0:z(P),children:J})}),shortDescription:N?void 0:e(A,{name:"ShortDescription",slot:r==null?void 0:r.ShortDescription,context:{...m},children:e("div",{dangerouslySetInnerHTML:{__html:(t==null?void 0:t.shortDescription)??""}})}),description:O?void 0:e(A,{name:"Description",slot:r==null?void 0:r.Description,context:{...m},children:e("div",{dangerouslySetInnerHTML:{__html:(t==null?void 0:t.description)??""}})}),images:((Q=t==null?void 0:t.images)==null?void 0:Q.map(({label:p,url:d})=>{var l,a;return e(At,{title:p,alt:p,src:d,width:((l=h==null?void 0:h.imageParams)==null?void 0:l.width)??960,height:((a=h==null?void 0:h.imageParams)==null?void 0:a.height)??1191,params:(h==null?void 0:h.imageParams)??{width:960}},d)}))??[],specialPrice:(at=t==null?void 0:t.prices)!=null&&at.visible?e(A,{name:"SpecialPrice",slot:r==null?void 0:r.SpecialPrice,context:{...m},children:e(Pt,{...t.prices.final,locale:ut(V)})}):void 0,price:(_t=t==null?void 0:t.prices)!=null&&_t.visible&&t.prices.regular&&t.prices.final.amount!==(t==null?void 0:t.prices.regular.amount)?e(A,{name:"RegularPrice",slot:r==null?void 0:r.RegularPrice,context:{...m},children:e(Pt,{...t.prices.regular,locale:ut(V)})}):void 0,zoomType:it,closeButton:K,carouselConfig:{...h,thumbnails:h&&Object.keys(h).length?((mt=t==null?void 0:t.images)==null?void 0:mt.map(({label:p,url:d})=>{var l,a;return e(At,{title:p,alt:p,src:d,width:((l=h==null?void 0:h.thumbnailParams)==null?void 0:l.width)??200,height:((a=h==null?void 0:h.thumbnailParams)==null?void 0:a.height)??248,params:(h==null?void 0:h.thumbnailParams)??{width:200}},d)}))??[]:[]},outOfStock:!(t!=null&&t.inStock),attributes:s?void 0:e(A,{name:"Attributes",slot:r==null?void 0:r.Attributes,context:{...m},children:I!=null&&I.length?w(Nt,{children:[nt,e("ul",{children:I})]}):null}),galleryContent:(r==null?void 0:r.GalleryContent)&&e(A,{name:"GalleryContent",slot:r.GalleryContent,context:{...m}}),infoContent:(r==null?void 0:r.InfoContent)&&e(A,{name:"InfoContent",slot:r.InfoContent,context:{...m}}),productContent:(r==null?void 0:r.Content)&&e(A,{name:"Content",slot:r.Content,context:{...m}})})})};Mt.getInitialData=async function({sku:i,disableDropdownPreselection:v=!1,optionsConfig:S}){var O;const{models:N}=yt.getConfig();return ht(i,{preselectFirstOption:!v,anchors:S==null?void 0:S.anchorOptions,initialData:(O=N==null?void 0:N.ProductDetails)==null?void 0:O.initialData})};export{Mt as ProductDetails,Mt as default};
@@ -0,0 +1,18 @@
1
+ import { HTMLAttributes } from 'preact/compat';
2
+ import { Container, ResolveImageUrlOptions } from '@dropins/tools/types/elsie/src/lib';
3
+ import { ProductModel } from '../../data/models/product-model';
4
+
5
+ export interface ProductGalleryProps extends Omit<HTMLAttributes<HTMLDivElement>, 'controls'> {
6
+ controls?: 'thumbnailsRow' | 'thumbnailsColumn' | 'dots' | null;
7
+ loop?: boolean;
8
+ peak?: boolean;
9
+ gap?: 'small' | 'medium' | 'large' | null;
10
+ arrows?: boolean;
11
+ imageParams?: ResolveImageUrlOptions;
12
+ thumbnailParams?: ResolveImageUrlOptions;
13
+ zoom?: {
14
+ closeButton: boolean;
15
+ } | boolean;
16
+ }
17
+ export declare const ProductGallery: Container<ProductGalleryProps, ProductModel | null>;
18
+ //# sourceMappingURL=ProductGallery.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './ProductGallery';
2
+ export { ProductGallery as default } from './ProductGallery';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './ProductGallery/index'
2
+ import _default from './ProductGallery/index'
3
+ export default _default
@@ -0,0 +1,3 @@
1
+ /*! Copyright 2024 Adobe
2
+ All Rights Reserved. */
3
+ import{jsx as A,jsxs as M}from"@dropins/tools/preact-jsx-runtime.js";import{useState as D,useEffect as N,useMemo as O}from"@dropins/tools/preact-compat.js";import{Image as S}from"@dropins/tools/components.js";import{events as Q}from"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import{g as F}from"../chunks/getFetchedProductData.js";import{Z as q,C,O as z}from"../chunks/Zoom.js";/* empty css */import{useText as J}from"@dropins/tools/i18n.js";import"@dropins/tools/preact.js";const K=({initialData:E=null,controls:R="dots",loop:g=!0,peak:Z=!1,gap:j=null,arrows:v=!0,zoom:h=!1,imageParams:t,thumbnailParams:o,children:U,...G})=>{var w,u,B,y,I,_;const c=J("PDP.Product.Image.label").label,[e,T]=D(E),[d,f]=D(null);N(()=>{const l=Q.on("pdp/data",T);return()=>{l==null||l.off()}},[]);const s=O(()=>{var l;return((l=e==null?void 0:e.images)==null?void 0:l.map(({label:p,url:r},i)=>{const n=({...H})=>{var x;return A(S,{title:p,src:r,alt:c==null?void 0:c.replace("{product}",p).replace("{key}",String(i+1)).replace("{total}",String((x=e==null?void 0:e.images)==null?void 0:x.length)),width:(t==null?void 0:t.width)??960,height:(t==null?void 0:t.height)??1191,params:t??{width:960},loading:i===0?"eager":"lazy",...H})};return h?A(q,{closeButton:typeof h=="object"?h.closeButton:!1,children:A(n,{})},r):A(n,{onClick:()=>f(i)},r)}))??A("img",{src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",className:"pdp-product-gallery__images__placeholder",width:(t==null?void 0:t.width)??960,height:(t==null?void 0:t.height)??1191,"aria-hidden":!0},"pleaceholder")},[c,e==null?void 0:e.images,t,h]),k=O(()=>{var l;return((l=e==null?void 0:e.images)==null?void 0:l.map(({label:p,url:r},i)=>{var n;return A(S,{title:p,src:r,alt:c==null?void 0:c.replace("{product}",p).replace("{key}",String(i+1)).replace("{total}",String((n=e==null?void 0:e.images)==null?void 0:n.length)),width:(o==null?void 0:o.width)??200,height:(o==null?void 0:o.height)??248,params:o??{width:200},loading:"lazy"},r)}))??A("img",{src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",className:"pdp-product-gallery__thumbnail__placeholder",width:(o==null?void 0:o.width)??200,height:(o==null?void 0:o.height)??248,"aria-hidden":!0},"pleaceholder")},[c,e==null?void 0:e.images,o]);return e?M("div",{...G,children:[A(C,{arrows:!!((w=e==null?void 0:e.images)!=null&&w.length),arrowsOnMainImage:v,controls:(u=e==null?void 0:e.images)!=null&&u.length?R:void 0,loop:g&&!!((B=e.images)!=null&&B.length),peak:!!((y=e==null?void 0:e.images)!=null&&y.length)&&Z,gap:j,defaultIndex:d||0,thumbnails:k,children:s}),d===null?null:A(z,{onClose:()=>f(null),centered:!0,children:A(C,{arrows:!!((I=e==null?void 0:e.images)!=null&&I.length),width:"100%",height:"100%",defaultIndex:d,loop:g&&!!((_=e.images)!=null&&_.length),controls:"dots",isZoomed:!0,children:s})})]}):null};K.getInitialData=F;export{K as ProductGallery,K as default};
@@ -0,0 +1,9 @@
1
+ import { HTMLAttributes } from 'preact/compat';
2
+ import { Container } from '@dropins/tools/types/elsie/src/lib';
3
+ import { ProductModel } from '../../data/models';
4
+
5
+ export interface ProductHeaderProps extends HTMLAttributes<HTMLDivElement> {
6
+ hideSku?: boolean;
7
+ }
8
+ export declare const ProductHeader: Container<ProductHeaderProps, ProductModel | null>;
9
+ //# sourceMappingURL=ProductHeader.d.ts.map
@@ -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 './ProductHeader';
17
+ export { ProductHeader as default } from './ProductHeader';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './ProductHeader/index'
2
+ import _default from './ProductHeader/index'
3
+ export default _default
@@ -0,0 +1,3 @@
1
+ /*! Copyright 2024 Adobe
2
+ All Rights Reserved. */
3
+ import{jsxs as c,jsx as e,Fragment as i}from"@dropins/tools/preact-jsx-runtime.js";import{useState as m,useEffect as p}from"@dropins/tools/preact-compat.js";import{classes as u,VComponent as l}from"@dropins/tools/lib.js";import"@dropins/tools/components.js";/* empty css */import"@dropins/tools/preact.js";import{events as f}from"@dropins/tools/event-bus.js";import{g as h}from"../chunks/getFetchedProductData.js";const g=({className:r,title:a,sku:n,hideSku:s=!1,children:t,...d})=>c("div",{...d,className:u(["pdp-header",r]),children:[e("div",{className:"pdp-header__title",children:e(l,{node:a})}),!s&&e("div",{className:"pdp-header__sku",children:e(l,{node:n})})]}),_=({initialData:r=null,hideSku:a=!1,children:n,...s})=>{const[t,d]=m(r);return p(()=>{const o=f.on("pdp/data",d);return()=>{o==null||o.off()}},[]),t?e(g,{...s,title:e(i,{children:t.name}),sku:e(i,{children:t.sku}),hideSku:a}):null};_.getInitialData=h;export{_ as ProductHeader,_ as default};
@@ -0,0 +1,22 @@
1
+ import { HTMLAttributes } from 'preact/compat';
2
+ import { Container, SlotProps } from '@dropins/tools/types/elsie/src/lib';
3
+ import { ProductModel } from '../../data/models';
4
+
5
+ export interface ProductOptionsProps extends HTMLAttributes<HTMLDivElement> {
6
+ hideSelectedValue?: boolean;
7
+ onValues?: (optionsUIDs: string[]) => void;
8
+ onErrors?: (errors: {
9
+ [id: string]: string;
10
+ }) => void;
11
+ slots?: {
12
+ Swatches: SlotProps<{
13
+ data: ProductModel | null;
14
+ optionsUIDs: string[];
15
+ }>;
16
+ };
17
+ }
18
+ export declare const ProductOptions: Container<ProductOptionsProps, {
19
+ data: ProductModel | null;
20
+ optionsUIDs: string[];
21
+ }>;
22
+ //# sourceMappingURL=ProductOptions.d.ts.map
@@ -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 './ProductOptions';
17
+ export { ProductOptions as default } from './ProductOptions';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './ProductOptions/index'
2
+ import _default from './ProductOptions/index'
3
+ export default _default
@@ -0,0 +1,3 @@
1
+ /*! Copyright 2024 Adobe
2
+ All Rights Reserved. */
3
+ import{jsx as j}from"@dropins/tools/preact-jsx-runtime.js";import{useState as d,useEffect as q,useCallback as C}from"@dropins/tools/preact-compat.js";import{Slot as z}from"@dropins/tools/lib.js";import{events as g}from"@dropins/tools/event-bus.js";import"@dropins/tools/components.js";/* empty css */import{S as A}from"../chunks/Swatches.js";import"@dropins/tools/preact.js";import{c as I,j as G,h as H,p as J}from"../chunks/fetchProductData.js";import{g as v,s as w}from"../chunks/getProductConfigurationValues.js";import{s as b}from"../chunks/isProductConfigurationValid.js";import{g as K}from"../chunks/getFetchedProductData.js";import"@dropins/tools/i18n.js";import"@dropins/tools/fetch-graphql.js";const N=({initialData:a={data:null,optionsUIDs:[]},hideSelectedValue:l=!1,slots:r,onValues:p,onErrors:f,children:Q,...y})=>{var h;const[o,O]=d(a.data),[u,B]=d(a.optionsUIDs),[F,M]=d();q(()=>{const i=g.on("pdp/data",O),c=g.on("pdp/values",({optionsUIDs:e})=>{e&&B(e)});return()=>{i==null||i.off(),c==null||c.off()}},[]);const T=C(async i=>{var P,U,D,S;if(!(o!=null&&o.sku))return;const{persistURLParams:c,anchors:e,acdl:R}=I.getConfig()??{};let s=Object.keys(i).map(t=>i[t].value).filter(t=>t!==void 0);if(c&&!(o!=null&&o.isBundle)&&G({optionsUIDs:s.join(",")}),((U=(P=v())==null?void 0:P.optionsUIDs)==null?void 0:U.join("|"))!==(s==null?void 0:s.join("|"))){w(n=>({...n,optionsUIDs:s})),p==null||p(s);const t=await H(o.sku,{optionsUIDs:s??[],isBundle:o==null?void 0:o.isBundle,anchors:e});g.emit("pdp/data",t);let k=(s==null?void 0:s.length)===((D=t==null?void 0:t.options)==null?void 0:D.length);if(e!=null&&e.length){const n=(t==null?void 0:t.optionUIDs)??[];s.every(m=>n.includes(m))||(M(t==null?void 0:t.options),w(m=>({...m,optionsUIDs:n})),k=(n==null?void 0:n.length)===((S=t==null?void 0:t.options)==null?void 0:S.length))}b(()=>k),R&&t&&(t==null?void 0:t.variantSku)!==o.sku&&J(t)}},[o==null?void 0:o.isBundle,o==null?void 0:o.sku,p]),L=C(i=>{Object.keys(i).length!==0&&(b(()=>!1),f==null||f(i))},[f]);return!o||!o.options?null:j(z,{name:"Swatches",slot:r==null?void 0:r.Swatches,context:{data:o,optionsUIDs:u},children:j(A,{...y,options:o.options,selectedUIDs:u,defaultOptions:u,selectionsToUpdate:F,hideSelectedValue:l,disablePreselections:!((h=I.getConfig())!=null&&h.preselectFirstOption),onValues:T,onErrors:L})})};N.getInitialData=async function(){var r;const a=await K(),l=((r=v())==null?void 0:r.optionsUIDs)??[];return{data:a,optionsUIDs:l}};export{N as ProductOptions,N as default};
@@ -0,0 +1,8 @@
1
+ import { HTMLAttributes } from 'preact/compat';
2
+ import { Container } from '@dropins/tools/types/elsie/src/lib';
3
+ import { ProductModel } from '../../data/models';
4
+
5
+ export interface ProductPriceProps extends HTMLAttributes<HTMLDivElement> {
6
+ }
7
+ export declare const ProductPrice: Container<ProductPriceProps, ProductModel | null>;
8
+ //# sourceMappingURL=ProductPrice.d.ts.map
@@ -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 './ProductPrice';
17
+ export { ProductPrice as default } from './ProductPrice';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './ProductPrice/index'
2
+ import _default from './ProductPrice/index'
3
+ export default _default
@@ -0,0 +1,3 @@
1
+ /*! Copyright 2024 Adobe
2
+ All Rights Reserved. */
3
+ import{jsxs as D,jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{useState as d,useEffect as L}from"@dropins/tools/preact-compat.js";import{classes as s,VComponent as f,toLanguageTag as g}from"@dropins/tools/lib.js";import"@dropins/tools/components.js";/* empty css */import{P}from"../chunks/PriceRange.js";import"@dropins/tools/preact.js";import{useText as b}from"@dropins/tools/i18n.js";import{events as _}from"@dropins/tools/event-bus.js";import{g as h}from"../chunks/getFetchedProductData.js";import{c as v}from"../chunks/fetchProductData.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getProductConfigurationValues.js";const S=({className:t,price:i,specialPrice:a,children:n,...e})=>{const c=b("PDP.Product.RegularPrice.label").label,o=b("PDP.Product.SpecialPrice.label").label;return D("div",{...e,className:s(["pdp-price",t]),children:[a&&r(f,{node:a,className:s(["pdp-price__amount-special","pdp-price__amount"]),"aria-label":o,role:"text"}),i&&r(f,{node:i,className:s(["pdp-price__amount-regular","pdp-price__amount--grey"]),"aria-label":c,role:"text"})]})},N=({initialData:t=null,children:i,...a})=>{var m,u;const{defaultLocale:n="en-US"}=v.getConfig(),[e,c]=d(t),[o,x]=d(n);return L(()=>{const l=_.on("pdp/data",c),p=_.on("locale",x);return()=>{l==null||l.off(),p==null||p.off()}},[]),e?r(S,{...a,specialPrice:(m=e.prices)!=null&&m.visible?r(P,{...e.prices.final,locale:g(o)}):void 0,price:(u=e.prices)!=null&&u.visible&&e.prices.regular&&e.prices.final.amount!==e.prices.regular.amount?r(P,{...e.prices.regular,locale:g(o)}):void 0}):null};N.getInitialData=h;export{N as ProductPrice,N as default};
@@ -0,0 +1,9 @@
1
+ import { HTMLAttributes } from 'preact/compat';
2
+ import { Container } from '@dropins/tools/types/elsie/src/lib';
3
+ import { ProductModel } from '../../data/models';
4
+
5
+ export interface ProductQuantityProps extends HTMLAttributes<HTMLDivElement> {
6
+ onValue?: (quantity: number) => void;
7
+ }
8
+ export declare const ProductQuantity: Container<ProductQuantityProps, ProductModel | null>;
9
+ //# sourceMappingURL=ProductQuantity.d.ts.map
@@ -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 './ProductQuantity';
17
+ export { ProductQuantity as default } from './ProductQuantity';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './ProductQuantity/index'
2
+ import _default from './ProductQuantity/index'
3
+ export default _default
@@ -0,0 +1,3 @@
1
+ /*! Copyright 2024 Adobe
2
+ All Rights Reserved. */
3
+ import{jsx as d}from"@dropins/tools/preact-jsx-runtime.js";import{useState as s,useEffect as g}from"@dropins/tools/preact-compat.js";import{classes as P}from"@dropins/tools/lib.js";import{Incrementer as y}from"@dropins/tools/components.js";import{events as u}from"@dropins/tools/event-bus.js";import{s as I}from"../chunks/getProductConfigurationValues.js";import{g as b}from"../chunks/getFetchedProductData.js";import{useText as q}from"@dropins/tools/i18n.js";const D=({initialData:i=null,onValue:r,children:h,...n})=>{const m=q("PDP.Product.Incrementer.label").label,[c,l]=s(i),[o,f]=s(1);g(()=>{const e=u.on("pdp/data",l),t=u.on("pdp/values",({quantity:a})=>{f(a)},{eager:!0});return()=>{e==null||e.off(),t==null||t.off()}},[]);const p=e=>{const t=parseInt(e,10);I(a=>({...a,quantity:t})),r==null||r(t)};return c?d(y,{name:"quantity",defaultValue:o.toString(),value:o.toString(),min:1,"aria-label":m,onValue:p,...n,className:P(["pdp-quantity",n.className])},"quantity"):null};D.getInitialData=b;export{D as ProductQuantity,D as default};
@@ -0,0 +1,8 @@
1
+ import { HTMLAttributes } from 'preact/compat';
2
+ import { Container } from '@dropins/tools/types/elsie/src/lib';
3
+ import { ProductModel } from '../../data/models';
4
+
5
+ export interface ProductShortDescriptionProps extends HTMLAttributes<HTMLDivElement> {
6
+ }
7
+ export declare const ProductShortDescription: Container<ProductShortDescriptionProps, ProductModel | null>;
8
+ //# sourceMappingURL=ProductShortDescription.d.ts.map
@@ -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 './ProductShortDescription';
17
+ export { ProductShortDescription as default } from './ProductShortDescription';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './ProductShortDescription/index'
2
+ import _default from './ProductShortDescription/index'
3
+ export default _default
@@ -0,0 +1,3 @@
1
+ /*! Copyright 2024 Adobe
2
+ All Rights Reserved. */
3
+ import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{useState as i,useEffect as a}from"@dropins/tools/preact-compat.js";import{classes as c}from"@dropins/tools/lib.js";import{events as m}from"@dropins/tools/event-bus.js";import{g as l}from"../chunks/getFetchedProductData.js";const f=({initialData:o=null,children:p,...e})=>{const[t,s]=i(o);return a(()=>{const r=m.on("pdp/data",s);return()=>{r==null||r.off()}},[]),t?n("div",{dangerouslySetInnerHTML:{__html:(t==null?void 0:t.shortDescription)??""},...e,className:c(["pdp-short-description",e.className])}):null};f.getInitialData=l;export{f as ProductShortDescription,f as default};
@@ -14,4 +14,12 @@
14
14
  * from Adobe.
15
15
  */
16
16
  export * from './ProductDetails';
17
+ export * from './ProductPrice';
18
+ export * from './ProductOptions';
19
+ export * from './ProductQuantity';
20
+ export * from './ProductShortDescription';
21
+ export * from './ProductDescription';
22
+ export * from './ProductAttributes';
23
+ export * from './ProductGallery';
24
+ export * from './ProductHeader';
17
25
  //# sourceMappingURL=index.d.ts.map
@@ -31,7 +31,7 @@ export type Product = {
31
31
  manufacturer?: string | null;
32
32
  countryOfManufacture?: string | null;
33
33
  categories?: string[] | null;
34
- productType?: string | null;
34
+ productType?: ProductType;
35
35
  pricing?: {
36
36
  regularPrice: number;
37
37
  minimalPrice?: number;
@@ -47,4 +47,12 @@ export type Product = {
47
47
  canonicalUrl?: string | null;
48
48
  mainImageUrl?: string | null;
49
49
  };
50
+ export declare enum ProductType {
51
+ ComplexProduct = "complex",
52
+ SimpleProduct = "simple"
53
+ }
54
+ export declare enum ProductViewType {
55
+ ComplexProductView = "ComplexProductView",
56
+ SimpleProductView = "SimpleProductView"
57
+ }
50
58
  //# sourceMappingURL=acdl-models.d.ts.map
@@ -14,4 +14,5 @@
14
14
  * from Adobe.
15
15
  */
16
16
  export * from './product-model';
17
+ export * from './values-model';
17
18
  //# sourceMappingURL=index.d.ts.map
@@ -1,21 +1,9 @@
1
- /**
2
- * ADOBE CONFIDENTIAL
3
- * __________________
4
- * Copyright 2023 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
- */
1
+ import { ProductType } from './acdl-models';
2
+
16
3
  export interface ProductModel {
17
4
  name: string;
18
5
  sku: string;
6
+ isBundle: boolean;
19
7
  addToCartAllowed: boolean;
20
8
  inStock: boolean | null;
21
9
  shortDescription?: string;
@@ -33,6 +21,7 @@ export interface ProductModel {
33
21
  externalId?: string;
34
22
  externalParentId?: string;
35
23
  variantSku?: string;
24
+ productType?: ProductType | undefined;
36
25
  }
37
26
  interface Image {
38
27
  url: string;
@@ -0,0 +1,6 @@
1
+ export interface ValuesModel {
2
+ sku: string;
3
+ quantity: number;
4
+ optionsUIDs?: string[];
5
+ }
6
+ //# sourceMappingURL=values-model.d.ts.map
@@ -1,4 +1,6 @@
1
1
  import { ProductModel } from '../models';
2
2
 
3
- export declare function transformProductData(data: any, isBundle?: boolean): ProductModel | null;
3
+ export declare function transformProductData(data: any, options?: {
4
+ preselectFirstOption?: boolean;
5
+ }): ProductModel | null;
4
6
  //# sourceMappingURL=product-transform.d.ts.map
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-pdp", "version": "0.5.0-beta4", "@dropins/tools": "0.33.0"}
1
+ {"name": "@dropins/storefront-pdp", "version": "1.0.0-beta1", "@dropins/tools": "~0.35.0"}