@dropins/storefront-pdp 3.3.0-beta.1 → 3.3.1-alpha-20260730090417

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @dropins/storefront-pdp
2
2
 
3
+ ## 3.3.1-alpha-20260730090417
4
+
5
+ ### Patch Changes
6
+
7
+ - 1385284: Always render the top-level quantity `Incrementer` (`ProductQuantity` and the monolith quantity slot), including for bundle products. Per-option bundle quantities in `Swatches` write `bundleOptionQuantities`/`enteredOptions`, which describe bundle composition, not how many bundles to add to cart — hiding the top-level control left `values.quantity` fixed at its initial value with no way for shoppers to change it.
8
+
9
+ ## 3.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 3a3bfc1: Respect per-option `canEditQuantity` for bundle option quantities on the PDP.
14
+
15
+ - **Transform:** Read `canEditQuantity` from `ProductViewOptionValueProduct` values (now included in the GraphQL fragment) and expose it on each bundle option value in the model.
16
+ - **Swatches:** Render a quantity `Incrementer` for selected bundle option values; enabled when `canEditQuantity` is true, disabled when false or unset. Hide `ProductQuantity` (and the monolith quantity slot) when `isBundle` so shoppers do not see two quantity controls.
17
+ - **Configuration:** Sync `bundleOptionQuantities` and `enteredOptions` on bundle init and when selections change; keep both shapes aligned in `setProductConfigurationValues`.
18
+
19
+ ### Patch Changes
20
+
21
+ - a6f404d: Fix accessibility issue where the product name and "Details" section title were rendered as plain `<div>` text instead of headings, so screen reader users could not navigate to them by heading (WCAG 1.3.1 - Info and Relationships).
22
+ - 2413664: Make the ProductGallery main image keyboard-operable when it opens the image preview overlay (WCAG 2.1.1 Keyboard, Level A).
23
+
24
+ - **ProductGallery:** In the non-`zoom` (overlay) path, expose the clickable main image as a control with `role="button"`, `tabindex="0"`, and an `onKeyDown` handler so it can be activated with Enter and Space, not just clicked. The interactive attributes are only applied to the displayed layer; the `aria-hidden` crossfade layer stays non-interactive and unfocusable.
25
+ - **Tests:** Add coverage asserting the main image is focusable, exposed as a button, and opens the preview overlay via Enter and Space.
26
+
3
27
  ## 3.3.0-beta.1
4
28
 
5
29
  ### Minor Changes
@@ -13,11 +13,11 @@
13
13
  * is strictly forbidden unless prior written permission is obtained
14
14
  * from Adobe.
15
15
  */
16
- export declare const setEndpoint: (endpoint: string) => void, setFetchGraphQlHeader: (key: string, value: string | null) => void, removeFetchGraphQlHeader: (key: string) => void, setFetchGraphQlHeaders: (header: import('@adobe-commerce/fetch-graphql').Header | ((prev: import('@adobe-commerce/fetch-graphql').Header) => import('@adobe-commerce/fetch-graphql').Header)) => void, getFetchGraphQlHeader: (key: string) => string | null | undefined, fetchGraphQl: <T = any>(query: string, options?: import('@adobe-commerce/fetch-graphql').FetchOptions | undefined) => Promise<{
17
- errors?: import('@adobe-commerce/fetch-graphql').FetchQueryError | undefined;
16
+ export declare const setEndpoint: (endpoint: string) => void, setFetchGraphQlHeader: (key: string, value: string | null) => void, removeFetchGraphQlHeader: (key: string) => void, setFetchGraphQlHeaders: (header: import('@adobe-commerce/fetch-graphql', { assert: { "resolution-mode": "import" } }).Header | ((prev: import('@adobe-commerce/fetch-graphql', { assert: { "resolution-mode": "import" } }).Header) => import('@adobe-commerce/fetch-graphql', { assert: { "resolution-mode": "import" } }).Header)) => void, getFetchGraphQlHeader: (key: string) => string | null | undefined, fetchGraphQl: <T = any>(query: string, options?: import('@adobe-commerce/fetch-graphql', { assert: { "resolution-mode": "import" } }).FetchOptions | undefined) => Promise<{
17
+ errors?: import('@adobe-commerce/fetch-graphql', { assert: { "resolution-mode": "import" } }).FetchQueryError | undefined;
18
18
  data: T;
19
19
  }>, getConfig: () => {
20
20
  endpoint: string | undefined;
21
- fetchGraphQlHeaders: import('@adobe-commerce/fetch-graphql').Header;
21
+ fetchGraphQlHeaders: import('@adobe-commerce/fetch-graphql', { assert: { "resolution-mode": "import" } }).Header;
22
22
  };
23
23
  //# sourceMappingURL=fetch-graphql.d.ts.map
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
- import{jsxs as fe,jsx as c,Fragment as Je}from"@dropins/tools/preact-jsx-runtime.js";import{useState as w,useEffect as T,useCallback as V,useMemo as He}from"@dropins/tools/preact-compat.js";import{Slot as l,toLanguageTag as be}from"@dropins/tools/lib.js";import{Incrementer as Ae,Image as Oe,Button as ge,Icon as K,Breadcrumbs as R}from"@dropins/tools/components.js";import{P as ze,a as De,D as Ke,G as Re,S as $e}from"../chunks/components.js";import"@dropins/tools/preact.js";import{config as Se,g as xe,b as We,a as $,i as x,m as Xe,fetchProductData as W,p as Ye,s as Ze,c as Pe,t as et}from"../api.js";import{events as q}from"@dropins/tools/event-bus.js";import{i as tt,t as nt}from"../chunks/date.js";import{useText as j}from"@dropins/tools/i18n.js";import"@dropins/tools/preact-hooks.js";import"../fragments.js";import"@dropins/tools/fetch-graphql.js";const it=({sku:D,hideSku:F,hideQuantity:I,hideShortDescription:Q,hideDescription:B,hideAttributes:E,hideURLParams:X,hideSelectedOptionValue:Ie,slots:i,children:rt,initialData:y,carousel:u,optionsConfig:d,useACDL:ye,onAddToCart:G,zoomType:_e,closeButton:ve=!0,disableDropdownPreselection:C,...Ue})=>{var ne,ie,re,oe,ce,se,ae,ue,pe,le,de;const Y=j("PDP.Product.AddToCart.label").label,we=j("PDP.Product.Incrementer.label").label,Ve=j("PDP.Product.Details.label").label,Qe=j("PDP.Swatches.ChooseOption.label").label,[S,Be]=w(Se.getConfig().defaultLocale||"en-US"),[Ee,Ce]=w(),[e=null,L]=w(y),[m,N]=w(()=>{const t=xe(1),r={sku:D,quantity:t};if(e!=null&&e.optionUIDs&&(r.optionsUIDs=e.optionUIDs),e!=null&&e.isBundle&&(e!=null&&e.options)){const n=We(e.options,e.optionUIDs??[]);r.bundleOptionQuantities=n,r.enteredOptions=$(n)}return r}),[Z,k]=w(()=>{var t;return(t=e==null?void 0:e.options)!=null&&t.length?x(e.options,e.optionUIDs,e.isBundle):!0}),p={data:e,values:m,valid:Z};function ee(t){return t==null?void 0:t.some(r=>(r==null?void 0:r.typename)==="ProductViewOptionValueProduct")}T(()=>{const t=q.on("pdp/data",n=>{n&&(L(n),N(o=>{const s={...o,sku:n.sku,optionsUIDs:n.optionUIDs};if(n.isBundle&&n.options){const a=Xe(o.bundleOptionQuantities,n.options,n.optionUIDs??[]);s.bundleOptionQuantities=a,s.enteredOptions=$(a)}return s}))}),r=q.on("pdp/setValues",n=>{N(o=>({...o,...n}))});return()=>{r==null||r.off(),t==null||t.off()}},[]),T(()=>{const t=q.on("locale",r=>{r!==S&&(Be(r),W(D,{preselectFirstOption:!C,anchors:d==null?void 0:d.anchorOptions}).then(L))});return()=>{t==null||t.off()}},[C,S,d==null?void 0:d.anchorOptions,D]),T(()=>{ye&&y&&Object.keys(y).length>0&&Ye(y)},[y]);const _=V(t=>{N(r=>({...r,...t}))},[]),Le=V((t,r)=>{var o;const n=(o=e==null?void 0:e.options)==null?void 0:o.flatMap(s=>s.items).find(s=>s.id===t);n!=null&&n.canEditQuantity&&N(s=>{const a={...s.bundleOptionQuantities??{},[t]:r};return{...s,bundleOptionQuantities:a,enteredOptions:$(a)}})},[e==null?void 0:e.options]);T(()=>{q.emit("pdp/values",m)},[JSON.stringify(m)]);const Ne=V(async t=>{var s;const r=Object.fromEntries(Object.entries(t).filter(([,a])=>a.label!==Qe));let n=Ze(r,e==null?void 0:e.options);!X&&(e!=null&&e.options)&&!ee(e.options)&&Pe({optionsUIDs:n.join(",")}),_({optionsUIDs:n});const o=await W(D,{anchors:d==null?void 0:d.anchorOptions,isBundle:e==null?void 0:e.isBundle,optionsUIDs:n,preselectFirstOption:!C});L(o),k(x(o==null?void 0:o.options,(o==null?void 0:o.optionUIDs)??n,o==null?void 0:o.isBundle)),(s=d==null?void 0:d.anchorOptions)!=null&&s.length&&ke(o,n)},[D]),ke=V((t,r)=>{const n=(t==null?void 0:t.optionUIDs)??[];r.every(s=>n.includes(s))||(Ce(t==null?void 0:t.options),_({optionsUIDs:n}),k(x(t==null?void 0:t.options,n,t==null?void 0:t.isBundle)))},[D]),te=V(t=>{Object.keys(t).length!==0&&k(!1)},[]),M=He(()=>{var t;return(t=e==null?void 0:e.attributes)==null?void 0:t.map(({label:r,value:n,id:o},s)=>{if(o==="ac_giftcard")return"";const a=tt(n)?nt(n,S):n.toString();return fe("li",{children:[r,": ",c("span",{dangerouslySetInnerHTML:{__html:a}})]},s)})},[e==null?void 0:e.attributes,S]),Me=!I&&(e!=null&&e.inStock)&&!(e!=null&&e.isBundle)?c(l,{name:"Quantity",slot:i==null?void 0:i.Quantity,context:{...p},children:c(Ae,{name:"quantity",defaultValue:m.quantity.toString(),value:m.quantity.toString(),min:1,"aria-label":we,className:"pdp-product__quantity",onValue:t=>{const r=Number(t);_({quantity:r}),!X&&(e!=null&&e.options)&&(ee(e.options)||Pe({quantity:r}))}},"quantity")}):void 0,Te=()=>{if(e!=null&&e.options)return c(l,{name:"Options",slot:i==null?void 0:i.Options,context:{...p},children:c($e,{selectedUIDs:m.optionsUIDs,options:e.options,defaultOptions:m.optionsUIDs,selectionsToUpdate:Ee,hideSelectedValue:Ie,disablePreselections:C,onValues:Ne,onErrors:te,bundleOptionQuantities:m.bundleOptionQuantities,onBundleOptionQuantityChange:Le})})},qe=()=>{if(e!=null&&e.attributes){const t=e.attributes.filter(r=>r.id==="ac_giftcard");if(t.length>0){const n=t.map((o,s)=>{var a;try{const h=JSON.parse(o.value),P=m.enteredOptions||[],v=((a=h.options)==null?void 0:a.map(f=>{const b=P.find(O=>O.uid===f.uid);return{id:f.uid,value:(b==null?void 0:b.value)||""}}))||[];return c(Re,{options:h.options||[],optionValues:v,onOptionChange:(f,b)=>{var me;const O=m.enteredOptions||[],J=O.findIndex(g=>g.uid===f);let H;if(J!==-1?H=O.map(g=>g.uid===f?{...g,value:b}:g):H=[...O,{uid:f,value:b}],_({enteredOptions:H}),e){const g={...e},Fe=((me=g.attributes)==null?void 0:me.map(U=>{var he;if(U.id==="ac_giftcard")try{const A=JSON.parse(U.value),Ge=((he=A.options)==null?void 0:he.map(z=>z.uid===f?{...z,value:b}:z))||[];return{...U,value:JSON.stringify({...A,options:Ge})}}catch{return U}return U}))||[];g.attributes=Fe,L(g)}},onValidationChange:f=>{f||te({giftCard:"Invalid gift card data"}),k(f)},className:"pdp-product__gift-card-options"},`giftcard-${s}`)}catch(h){return console.warn("Invalid gift card data format:",h),null}}).filter(o=>o!==null);return n.length>0?c("div",{className:"pdp-product__gift-card-options-container",children:n}):void 0}}},je=()=>{if(e!=null&&e.attributes){const t=e.attributes.filter(r=>{var n;return r.id==="ac_downloadable"&&((n=r.roles)==null?void 0:n.includes("visible_in_pdp"))});if(t.length>0){const n=t.map((o,s)=>{var a,h;try{const P=typeof o.value=="string"?JSON.parse(o.value):o.value;return c(Ke,{label:o.label,value:P,onLinkChange:(v,f)=>{const b=m.optionsUIDs||[];let O;f?b.includes(v)?O=b:O=[...b,v]:O=b.filter(J=>J!==v),_({optionsUIDs:O})},currency:(h=(a=e.prices)==null?void 0:a.final)==null?void 0:h.currency,className:"pdp-product__downloadable-options"},`downloadable-${s}`)}catch(P){return console.warn("Invalid downloadable data format:",P),null}}).filter(o=>o!==null);return n.length>0?c("div",{className:"pdp-product__downloadable-options-container",children:n}):void 0}}};return c("div",{...Ue,children:c(ze,{title:c(l,{name:"Title",slot:i==null?void 0:i.Title,context:{...p},children:e==null?void 0:e.name}),sku:F?void 0:c(l,{name:"SKU",slot:i==null?void 0:i.SKU,context:{...p},children:e==null?void 0:e.sku}),options:Te(),giftCardOptions:qe(),downloadableOptions:je(),breadcrumbs:(i==null?void 0:i.Breadcrumbs)&&c(l,{name:"Breadcrumbs",slot:i==null?void 0:i.Breadcrumbs,context:{...p,setSeparator(t){this._registerMethod((...r)=>{const n=t(...r),o=n&&c(K,{source:n});this._setProps(s=>({...s,separator:o,children:[c(R,{separator:o,categories:s.categories})]}))})},appendLink(t){this._registerMethod((...r)=>{const{text:n,...o}=t(...r),s=c("a",{...o,children:n});this._setProps(a=>{const h=[...a.categories||[],s];return{...a,categories:h,children:[c(R,{separator:a.separator,categories:h})]}})})},appendHTMLElement(t){this._registerMethod((...r)=>{const n=t(...r),o=this._htmlElementToVNode(n);this._setProps(s=>{const a=[...s.categories||[],o];return{...s,categories:a,children:[c(R,{separator:s.separator,categories:a})]}})})}}}),quantity:Me,actions:c(l,{name:"Actions",slot:i==null?void 0:i.Actions,context:{...p,appendButton(t){this._registerMethod((...r)=>{const n=t(...r);if(!n)return;const{text:o,icon:s,...a}=n,h=c(ge,{type:"button",...a,icon:s&&c(K,{source:s}),children:o});this._setProps(P=>({children:[...P.children||[],h]}))})}},children:!(i!=null&&i.Actions)&&c(ge,{size:"medium",type:"submit",icon:c(K,{source:"Cart"}),disabled:!(e!=null&&e.inStock)||!Z,"aria-label":Y,onClick:()=>G==null?void 0:G(m),children:Y})}),shortDescription:Q?void 0:c(l,{name:"ShortDescription",slot:i==null?void 0:i.ShortDescription,context:{...p},children:c("div",{dangerouslySetInnerHTML:{__html:(e==null?void 0:e.shortDescription)??""}})}),description:B?void 0:c(l,{name:"Description",slot:i==null?void 0:i.Description,context:{...p},children:c("div",{dangerouslySetInnerHTML:{__html:(e==null?void 0:e.description)??""}})}),images:((ne=e==null?void 0:e.images)==null?void 0:ne.map(({label:t,url:r})=>{var n,o;return c(Oe,{title:t,alt:t,src:r,width:((n=u==null?void 0:u.imageParams)==null?void 0:n.width)??960,height:((o=u==null?void 0:u.imageParams)==null?void 0:o.height)??1191,params:(u==null?void 0:u.imageParams)??{width:960}},r)}))??[],specialPrice:(ie=e==null?void 0:e.prices)!=null&&ie.visible?c(l,{name:"SpecialPrice",slot:i==null?void 0:i.SpecialPrice,context:{...p},children:c(De,{...(re=e.prices)==null?void 0:re.final,locale:be(S)})}):void 0,price:(oe=e==null?void 0:e.prices)!=null&&oe.visible&&((ce=e==null?void 0:e.prices)!=null&&ce.regular)&&((ae=(se=e==null?void 0:e.prices)==null?void 0:se.final)==null?void 0:ae.amount)!==((pe=(ue=e==null?void 0:e.prices)==null?void 0:ue.regular)==null?void 0:pe.amount)?c(l,{name:"RegularPrice",slot:i==null?void 0:i.RegularPrice,context:{...p},children:c(De,{...(le=e.prices)==null?void 0:le.regular,locale:be(S)})}):void 0,zoomType:_e,closeButton:ve,carouselConfig:{...u,thumbnails:u&&Object.keys(u).length?((de=e==null?void 0:e.images)==null?void 0:de.map(({label:t,url:r})=>{var n,o;return c(Oe,{title:t,alt:t,src:r,width:((n=u==null?void 0:u.thumbnailParams)==null?void 0:n.width)??200,height:((o=u==null?void 0:u.thumbnailParams)==null?void 0:o.height)??248,params:(u==null?void 0:u.thumbnailParams)??{width:200}},r)}))??[]:[]},outOfStock:!(e!=null&&e.inStock),attributes:E?void 0:c(l,{name:"Attributes",slot:i==null?void 0:i.Attributes,context:{...p},children:M!=null&&M.length?fe(Je,{children:[Ve,c("ul",{children:M})]}):null}),galleryContent:(i==null?void 0:i.GalleryContent)&&c(l,{name:"GalleryContent",slot:i.GalleryContent,context:{...p}}),infoContent:(i==null?void 0:i.InfoContent)&&c(l,{name:"InfoContent",slot:i.InfoContent,context:{...p}}),productContent:(i==null?void 0:i.Content)&&c(l,{name:"Content",slot:i.Content,context:{...p}})})})};it.getInitialData=async function({sku:D,disableDropdownPreselection:F=!1,optionsConfig:I}){var B,E;const Q=(E=(B=Se.getConfig().models)==null?void 0:B.ProductDetails)==null?void 0:E.initialData;return Q?et(Q):W(D,{preselectFirstOption:!F,anchors:I==null?void 0:I.anchorOptions})};export{it as ProductDetails,it as default};
3
+ import{jsxs as fe,jsx as c,Fragment as Je}from"@dropins/tools/preact-jsx-runtime.js";import{useState as w,useEffect as T,useCallback as V,useMemo as He}from"@dropins/tools/preact-compat.js";import{Slot as l,toLanguageTag as be}from"@dropins/tools/lib.js";import{Incrementer as Ae,Image as Oe,Button as ge,Icon as K,Breadcrumbs as R}from"@dropins/tools/components.js";import{P as ze,a as De,D as Ke,G as Re,S as $e}from"../chunks/components.js";import"@dropins/tools/preact.js";import{config as Se,g as xe,b as We,a as $,i as x,m as Xe,fetchProductData as W,p as Ye,s as Ze,c as Pe,t as et}from"../api.js";import{events as q}from"@dropins/tools/event-bus.js";import{i as tt,t as nt}from"../chunks/date.js";import{useText as j}from"@dropins/tools/i18n.js";import"@dropins/tools/preact-hooks.js";import"../fragments.js";import"@dropins/tools/fetch-graphql.js";const it=({sku:D,hideSku:F,hideQuantity:I,hideShortDescription:Q,hideDescription:B,hideAttributes:E,hideURLParams:X,hideSelectedOptionValue:Ie,slots:i,children:rt,initialData:y,carousel:u,optionsConfig:d,useACDL:ye,onAddToCart:G,zoomType:_e,closeButton:ve=!0,disableDropdownPreselection:C,...Ue})=>{var ne,ie,re,oe,ce,ae,se,ue,pe,le,de;const Y=j("PDP.Product.AddToCart.label").label,we=j("PDP.Product.Incrementer.label").label,Ve=j("PDP.Product.Details.label").label,Qe=j("PDP.Swatches.ChooseOption.label").label,[S,Be]=w(Se.getConfig().defaultLocale||"en-US"),[Ee,Ce]=w(),[e=null,L]=w(y),[m,N]=w(()=>{const t=xe(1),r={sku:D,quantity:t};if(e!=null&&e.optionUIDs&&(r.optionsUIDs=e.optionUIDs),e!=null&&e.isBundle&&(e!=null&&e.options)){const n=We(e.options,e.optionUIDs??[]);r.bundleOptionQuantities=n,r.enteredOptions=$(n)}return r}),[Z,k]=w(()=>{var t;return(t=e==null?void 0:e.options)!=null&&t.length?x(e.options,e.optionUIDs,e.isBundle):!0}),p={data:e,values:m,valid:Z};function ee(t){return t==null?void 0:t.some(r=>(r==null?void 0:r.typename)==="ProductViewOptionValueProduct")}T(()=>{const t=q.on("pdp/data",n=>{n&&(L(n),N(o=>{const a={...o,sku:n.sku,optionsUIDs:n.optionUIDs};if(n.isBundle&&n.options){const s=Xe(o.bundleOptionQuantities,n.options,n.optionUIDs??[]);a.bundleOptionQuantities=s,a.enteredOptions=$(s)}return a}))}),r=q.on("pdp/setValues",n=>{N(o=>({...o,...n}))});return()=>{r==null||r.off(),t==null||t.off()}},[]),T(()=>{const t=q.on("locale",r=>{r!==S&&(Be(r),W(D,{preselectFirstOption:!C,anchors:d==null?void 0:d.anchorOptions}).then(L))});return()=>{t==null||t.off()}},[C,S,d==null?void 0:d.anchorOptions,D]),T(()=>{ye&&y&&Object.keys(y).length>0&&Ye(y)},[y]);const _=V(t=>{N(r=>({...r,...t}))},[]),Le=V((t,r)=>{var o;const n=(o=e==null?void 0:e.options)==null?void 0:o.flatMap(a=>a.items).find(a=>a.id===t);n!=null&&n.canEditQuantity&&N(a=>{const s={...a.bundleOptionQuantities??{},[t]:r};return{...a,bundleOptionQuantities:s,enteredOptions:$(s)}})},[e==null?void 0:e.options]);T(()=>{q.emit("pdp/values",m)},[JSON.stringify(m)]);const Ne=V(async t=>{var a;const r=Object.fromEntries(Object.entries(t).filter(([,s])=>s.label!==Qe));let n=Ze(r,e==null?void 0:e.options);!X&&(e!=null&&e.options)&&!ee(e.options)&&Pe({optionsUIDs:n.join(",")}),_({optionsUIDs:n});const o=await W(D,{anchors:d==null?void 0:d.anchorOptions,isBundle:e==null?void 0:e.isBundle,optionsUIDs:n,preselectFirstOption:!C});L(o),k(x(o==null?void 0:o.options,(o==null?void 0:o.optionUIDs)??n,o==null?void 0:o.isBundle)),(a=d==null?void 0:d.anchorOptions)!=null&&a.length&&ke(o,n)},[D]),ke=V((t,r)=>{const n=(t==null?void 0:t.optionUIDs)??[];r.every(a=>n.includes(a))||(Ce(t==null?void 0:t.options),_({optionsUIDs:n}),k(x(t==null?void 0:t.options,n,t==null?void 0:t.isBundle)))},[D]),te=V(t=>{Object.keys(t).length!==0&&k(!1)},[]),M=He(()=>{var t;return(t=e==null?void 0:e.attributes)==null?void 0:t.map(({label:r,value:n,id:o},a)=>{if(o==="ac_giftcard")return"";const s=tt(n)?nt(n,S):n.toString();return fe("li",{children:[r,": ",c("span",{dangerouslySetInnerHTML:{__html:s}})]},a)})},[e==null?void 0:e.attributes,S]),Me=!I&&(e!=null&&e.inStock)?c(l,{name:"Quantity",slot:i==null?void 0:i.Quantity,context:{...p},children:c(Ae,{name:"quantity",defaultValue:m.quantity.toString(),value:m.quantity.toString(),min:1,"aria-label":we,className:"pdp-product__quantity",onValue:t=>{const r=Number(t);_({quantity:r}),!X&&(e!=null&&e.options)&&(ee(e.options)||Pe({quantity:r}))}},"quantity")}):void 0,Te=()=>{if(e!=null&&e.options)return c(l,{name:"Options",slot:i==null?void 0:i.Options,context:{...p},children:c($e,{selectedUIDs:m.optionsUIDs,options:e.options,defaultOptions:m.optionsUIDs,selectionsToUpdate:Ee,hideSelectedValue:Ie,disablePreselections:C,onValues:Ne,onErrors:te,bundleOptionQuantities:m.bundleOptionQuantities,onBundleOptionQuantityChange:Le})})},qe=()=>{if(e!=null&&e.attributes){const t=e.attributes.filter(r=>r.id==="ac_giftcard");if(t.length>0){const n=t.map((o,a)=>{var s;try{const h=JSON.parse(o.value),P=m.enteredOptions||[],v=((s=h.options)==null?void 0:s.map(f=>{const b=P.find(O=>O.uid===f.uid);return{id:f.uid,value:(b==null?void 0:b.value)||""}}))||[];return c(Re,{options:h.options||[],optionValues:v,onOptionChange:(f,b)=>{var me;const O=m.enteredOptions||[],J=O.findIndex(g=>g.uid===f);let H;if(J!==-1?H=O.map(g=>g.uid===f?{...g,value:b}:g):H=[...O,{uid:f,value:b}],_({enteredOptions:H}),e){const g={...e},Fe=((me=g.attributes)==null?void 0:me.map(U=>{var he;if(U.id==="ac_giftcard")try{const A=JSON.parse(U.value),Ge=((he=A.options)==null?void 0:he.map(z=>z.uid===f?{...z,value:b}:z))||[];return{...U,value:JSON.stringify({...A,options:Ge})}}catch{return U}return U}))||[];g.attributes=Fe,L(g)}},onValidationChange:f=>{f||te({giftCard:"Invalid gift card data"}),k(f)},className:"pdp-product__gift-card-options"},`giftcard-${a}`)}catch(h){return console.warn("Invalid gift card data format:",h),null}}).filter(o=>o!==null);return n.length>0?c("div",{className:"pdp-product__gift-card-options-container",children:n}):void 0}}},je=()=>{if(e!=null&&e.attributes){const t=e.attributes.filter(r=>{var n;return r.id==="ac_downloadable"&&((n=r.roles)==null?void 0:n.includes("visible_in_pdp"))});if(t.length>0){const n=t.map((o,a)=>{var s,h;try{const P=typeof o.value=="string"?JSON.parse(o.value):o.value;return c(Ke,{label:o.label,value:P,onLinkChange:(v,f)=>{const b=m.optionsUIDs||[];let O;f?b.includes(v)?O=b:O=[...b,v]:O=b.filter(J=>J!==v),_({optionsUIDs:O})},currency:(h=(s=e.prices)==null?void 0:s.final)==null?void 0:h.currency,className:"pdp-product__downloadable-options"},`downloadable-${a}`)}catch(P){return console.warn("Invalid downloadable data format:",P),null}}).filter(o=>o!==null);return n.length>0?c("div",{className:"pdp-product__downloadable-options-container",children:n}):void 0}}};return c("div",{...Ue,children:c(ze,{title:c(l,{name:"Title",slot:i==null?void 0:i.Title,context:{...p},children:e==null?void 0:e.name}),sku:F?void 0:c(l,{name:"SKU",slot:i==null?void 0:i.SKU,context:{...p},children:e==null?void 0:e.sku}),options:Te(),giftCardOptions:qe(),downloadableOptions:je(),breadcrumbs:(i==null?void 0:i.Breadcrumbs)&&c(l,{name:"Breadcrumbs",slot:i==null?void 0:i.Breadcrumbs,context:{...p,setSeparator(t){this._registerMethod((...r)=>{const n=t(...r),o=n&&c(K,{source:n});this._setProps(a=>({...a,separator:o,children:[c(R,{separator:o,categories:a.categories})]}))})},appendLink(t){this._registerMethod((...r)=>{const{text:n,...o}=t(...r),a=c("a",{...o,children:n});this._setProps(s=>{const h=[...s.categories||[],a];return{...s,categories:h,children:[c(R,{separator:s.separator,categories:h})]}})})},appendHTMLElement(t){this._registerMethod((...r)=>{const n=t(...r),o=this._htmlElementToVNode(n);this._setProps(a=>{const s=[...a.categories||[],o];return{...a,categories:s,children:[c(R,{separator:a.separator,categories:s})]}})})}}}),quantity:Me,actions:c(l,{name:"Actions",slot:i==null?void 0:i.Actions,context:{...p,appendButton(t){this._registerMethod((...r)=>{const n=t(...r);if(!n)return;const{text:o,icon:a,...s}=n,h=c(ge,{type:"button",...s,icon:a&&c(K,{source:a}),children:o});this._setProps(P=>({children:[...P.children||[],h]}))})}},children:!(i!=null&&i.Actions)&&c(ge,{size:"medium",type:"submit",icon:c(K,{source:"Cart"}),disabled:!(e!=null&&e.inStock)||!Z,"aria-label":Y,onClick:()=>G==null?void 0:G(m),children:Y})}),shortDescription:Q?void 0:c(l,{name:"ShortDescription",slot:i==null?void 0:i.ShortDescription,context:{...p},children:c("div",{dangerouslySetInnerHTML:{__html:(e==null?void 0:e.shortDescription)??""}})}),description:B?void 0:c(l,{name:"Description",slot:i==null?void 0:i.Description,context:{...p},children:c("div",{dangerouslySetInnerHTML:{__html:(e==null?void 0:e.description)??""}})}),images:((ne=e==null?void 0:e.images)==null?void 0:ne.map(({label:t,url:r})=>{var n,o;return c(Oe,{title:t,alt:t,src:r,width:((n=u==null?void 0:u.imageParams)==null?void 0:n.width)??960,height:((o=u==null?void 0:u.imageParams)==null?void 0:o.height)??1191,params:(u==null?void 0:u.imageParams)??{width:960}},r)}))??[],specialPrice:(ie=e==null?void 0:e.prices)!=null&&ie.visible?c(l,{name:"SpecialPrice",slot:i==null?void 0:i.SpecialPrice,context:{...p},children:c(De,{...(re=e.prices)==null?void 0:re.final,locale:be(S)})}):void 0,price:(oe=e==null?void 0:e.prices)!=null&&oe.visible&&((ce=e==null?void 0:e.prices)!=null&&ce.regular)&&((se=(ae=e==null?void 0:e.prices)==null?void 0:ae.final)==null?void 0:se.amount)!==((pe=(ue=e==null?void 0:e.prices)==null?void 0:ue.regular)==null?void 0:pe.amount)?c(l,{name:"RegularPrice",slot:i==null?void 0:i.RegularPrice,context:{...p},children:c(De,{...(le=e.prices)==null?void 0:le.regular,locale:be(S)})}):void 0,zoomType:_e,closeButton:ve,carouselConfig:{...u,thumbnails:u&&Object.keys(u).length?((de=e==null?void 0:e.images)==null?void 0:de.map(({label:t,url:r})=>{var n,o;return c(Oe,{title:t,alt:t,src:r,width:((n=u==null?void 0:u.thumbnailParams)==null?void 0:n.width)??200,height:((o=u==null?void 0:u.thumbnailParams)==null?void 0:o.height)??248,params:(u==null?void 0:u.thumbnailParams)??{width:200}},r)}))??[]:[]},outOfStock:!(e!=null&&e.inStock),attributes:E?void 0:c(l,{name:"Attributes",slot:i==null?void 0:i.Attributes,context:{...p},children:M!=null&&M.length?fe(Je,{children:[Ve,c("ul",{children:M})]}):null}),galleryContent:(i==null?void 0:i.GalleryContent)&&c(l,{name:"GalleryContent",slot:i.GalleryContent,context:{...p}}),infoContent:(i==null?void 0:i.InfoContent)&&c(l,{name:"InfoContent",slot:i.InfoContent,context:{...p}}),productContent:(i==null?void 0:i.Content)&&c(l,{name:"Content",slot:i.Content,context:{...p}})})})};it.getInitialData=async function({sku:D,disableDropdownPreselection:F=!1,optionsConfig:I}){var B,E;const Q=(E=(B=Se.getConfig().models)==null?void 0:B.ProductDetails)==null?void 0:E.initialData;return Q?et(Q):W(D,{preselectFirstOption:!F,anchors:I==null?void 0:I.anchorOptions})};export{it as ProductDetails,it as default};
4
4
  //# sourceMappingURL=ProductDetails.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProductDetails.js","sources":["/@dropins/storefront-pdp/src/containers/ProductDetails/ProductDetails.tsx"],"sourcesContent":["/**\n * ADOBE CONFIDENTIAL\n * __________________\n * Copyright 2023 Adobe\n * All Rights Reserved.\n * __________________\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n */\n\nimport {\n HTMLAttributes,\n useEffect,\n useState,\n useCallback,\n useMemo,\n} from 'preact/compat';\n\nimport {\n Container,\n toLanguageTag,\n SlotProps,\n SlotMethod,\n Slot,\n ResolveImageUrlOptions,\n} from '@adobe-commerce/elsie/lib';\n\nimport {\n Button,\n Icon,\n ButtonProps,\n Image,\n Incrementer,\n Breadcrumbs,\n} from '@adobe-commerce/elsie/components';\nimport {\n Product,\n Swatches,\n PriceRange,\n Option,\n GiftCardOptions,\n DownloadableOptions,\n} from '@/pdp/components';\nimport { config, fetchProductData } from '@/pdp/api';\nimport { events } from '@adobe-commerce/event-bus';\nimport { Lang, useText } from '@adobe-commerce/elsie/i18n';\nimport { isDateValid, toDateString } from '@/pdp/lib/date';\nimport {\n isProductOptionsSelectionComplete,\n selectionMapToOptionUIDs,\n type ProductOptionSelectionMap,\n} from '@/pdp/lib/product-option-selection';\nimport {\n setUrlParams,\n getValidatedQuantityFromUrl,\n} from '@/pdp/lib/url-params';\nimport { publishProductPageViewEvent } from '@/pdp/lib/acdl';\nimport { ProductModel, Option as ProductOption } from '@/pdp/data/models';\nimport { transformProductData } from '@/pdp/data/transforms/product-transform';\nimport {\n buildBundleOptionQuantitiesFromOptions,\n bundleOptionQuantitiesToEnteredOptions,\n mergeBundleOptionQuantities,\n} from '@/pdp/lib/bundle-option-quantities';\n\ntype IconType = keyof typeof import('@adobe-commerce/elsie/icons');\n\n/** @deprecated This type is part of the deprecated ProductDetails component. */\nexport type Values = {\n sku: string;\n quantity: number;\n optionsUIDs?: string[];\n enteredOptions?: Array<{ uid: string; value: string }>;\n bundleOptionQuantities?: Record<string, number>;\n};\n\n/** @deprecated This type is part of the deprecated ProductDetails component. */\ntype DefaultSlotContext = {\n data: ProductModel | null;\n values: Values;\n valid: boolean;\n};\n\n/** @deprecated This type is part of the deprecated ProductDetails component. */\nexport type CarouselConfig = {\n controls?: {\n desktop?: 'thumbnailsRow' | 'thumbnailsColumn' | 'dots' | null;\n mobile?: 'dots' | 'thumbnailsRow' | null;\n };\n arrowsOnMainImage?: boolean;\n loopable?: boolean;\n peak?: {\n desktop: boolean;\n mobile: boolean;\n };\n gap?: 'small' | 'medium' | 'large' | null;\n thumbnailsLoadingMode?: 'lazy' | 'eager';\n imageParams?: ResolveImageUrlOptions;\n thumbnailParams?: ResolveImageUrlOptions;\n};\n\n/** @deprecated This type is part of the deprecated ProductDetails component. */\nexport type OptionsConfig = {\n anchorOptions?: string[];\n};\n\n/** @deprecated This interface is part of the deprecated ProductDetails component. */\nexport interface ProductDetailsProps extends HTMLAttributes<HTMLDivElement> {\n sku: string;\n productData?: ProductModel;\n hideSku?: boolean;\n hideQuantity?: boolean;\n hideShortDescription?: boolean;\n hideDescription?: boolean;\n hideAttributes?: boolean;\n hideSelectedOptionValue?: boolean;\n hideURLParams?: boolean;\n slots?: {\n Title?: SlotProps<DefaultSlotContext>;\n\n SKU?: SlotProps<DefaultSlotContext>;\n\n RegularPrice?: SlotProps<DefaultSlotContext>;\n\n SpecialPrice?: SlotProps<DefaultSlotContext>;\n\n Options?: SlotProps<DefaultSlotContext>;\n\n Quantity?: SlotProps<DefaultSlotContext>;\n\n Actions?: SlotProps<\n DefaultSlotContext & {\n appendButton: SlotMethod<\n Omit<ButtonProps, 'icon'> & {\n text?: string;\n icon?: IconType;\n }\n >;\n }\n >;\n\n ShortDescription?: SlotProps<DefaultSlotContext>;\n\n Description?: SlotProps<DefaultSlotContext>;\n\n Attributes?: SlotProps<DefaultSlotContext>;\n\n Breadcrumbs?: SlotProps<\n DefaultSlotContext & {\n setSeparator: SlotMethod<IconType>;\n\n appendLink: SlotMethod<\n HTMLAttributes<HTMLAnchorElement> & { text?: string }\n >;\n\n appendHTMLElement: SlotMethod<HTMLElement>;\n }\n >;\n\n GalleryContent?: SlotProps<DefaultSlotContext>;\n\n InfoContent?: SlotProps<DefaultSlotContext>;\n\n Content?: SlotProps<DefaultSlotContext>;\n };\n carousel?: CarouselConfig;\n optionsConfig?: OptionsConfig;\n useACDL?: boolean;\n onAddToCart?: (values: Values) => void;\n zoomType?: 'zoom' | 'overlay';\n closeButton?: boolean;\n disableDropdownPreselection?: boolean;\n}\n\n/**\n * @deprecated This container has been deprecated and will be removed in a future release.\n * Please use the different composable containers to build your product details page.xs\n */\nexport const ProductDetails: Container<\n ProductDetailsProps,\n ProductModel | null\n> = ({\n sku,\n hideSku,\n hideQuantity,\n hideShortDescription,\n hideDescription,\n hideAttributes,\n hideURLParams,\n hideSelectedOptionValue,\n slots,\n children,\n initialData,\n carousel,\n optionsConfig,\n useACDL,\n onAddToCart,\n zoomType,\n closeButton = true,\n disableDropdownPreselection,\n ...props\n}) => {\n // i18n\n const AddToCartLabel = useText('PDP.Product.AddToCart.label').label;\n const IncrementerLabel = useText('PDP.Product.Incrementer.label').label;\n const DetailsLabel = useText('PDP.Product.Details.label').label;\n const ChooseOptionLabel = useText('PDP.Swatches.ChooseOption.label').label;\n\n // TODO: Investigate if the \"|| 'en-US' \" is really necessary\n const [locale, setLocale] = useState<Lang>(\n (config.getConfig().defaultLocale as Lang) || 'en-US'\n );\n\n const [selectionsToUpdate, setSelectionsToUpdate] = useState<Option[]>();\n\n const [data = null, setData] = useState(initialData);\n\n const [values, setValues] = useState<Values>(() => {\n const initialQuantity = getValidatedQuantityFromUrl(1); // Default quantity to 1\n\n const defaultValues: Values = {\n sku,\n quantity: initialQuantity,\n };\n\n if (data?.optionUIDs) {\n defaultValues.optionsUIDs = data.optionUIDs;\n }\n\n if (data?.isBundle && data?.options) {\n const bundleOptionQuantities = buildBundleOptionQuantitiesFromOptions(\n data.options,\n data.optionUIDs ?? []\n );\n defaultValues.bundleOptionQuantities = bundleOptionQuantities;\n defaultValues.enteredOptions = bundleOptionQuantitiesToEnteredOptions(\n bundleOptionQuantities\n );\n }\n\n return defaultValues;\n });\n\n // the context is invalid for a configurable product that doesn't have all the options selected\n const [valid, setValid] = useState(() => {\n if (!data?.options?.length) {\n return true;\n }\n return isProductOptionsSelectionComplete(\n data.options,\n data.optionUIDs,\n data.isBundle\n );\n });\n const defaultSlotContext: DefaultSlotContext = { data, values, valid };\n\n function hasProductViewOptionValueProduct(options: ProductOption[]) {\n return options?.some(\n (option) => option?.typename === 'ProductViewOptionValueProduct'\n );\n }\n\n useEffect(() => {\n const dataEvent = events.on('pdp/data', (payload) => {\n if (payload) {\n setData(payload);\n setValues((prev: Values) => {\n const next: Values = {\n ...prev,\n sku: payload.sku,\n optionsUIDs: payload.optionUIDs,\n };\n\n if (payload.isBundle && payload.options) {\n const bundleOptionQuantities = mergeBundleOptionQuantities(\n prev.bundleOptionQuantities,\n payload.options,\n payload.optionUIDs ?? []\n );\n next.bundleOptionQuantities = bundleOptionQuantities;\n next.enteredOptions = bundleOptionQuantitiesToEnteredOptions(\n bundleOptionQuantities\n );\n }\n\n return next;\n });\n }\n });\n\n // @ts-ignore - Type error with event bus events\n const updateDataEvent = events.on(\n 'pdp/setValues',\n (payload: Partial<Values>) => {\n setValues((prev: Values) => ({ ...prev, ...payload }));\n }\n );\n\n return () => {\n updateDataEvent?.off();\n dataEvent?.off();\n };\n }, []);\n\n // Locale\n useEffect(() => {\n const localeEvent = events.on('locale', (payload: string) => {\n if (payload === locale) return;\n\n setLocale(payload as Lang);\n\n fetchProductData(sku, {\n preselectFirstOption: !disableDropdownPreselection,\n anchors: optionsConfig?.anchorOptions,\n }).then(setData);\n });\n return () => {\n localeEvent?.off();\n };\n }, [disableDropdownPreselection, locale, optionsConfig?.anchorOptions, sku]);\n\n useEffect(() => {\n if (useACDL && initialData && Object.keys(initialData).length > 0) {\n publishProductPageViewEvent(initialData);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [initialData]);\n\n // Callbacks\n const handleOnValues = useCallback((newValues: Partial<Values>) => {\n setValues((prev) => ({ ...prev, ...newValues }));\n }, []);\n\n const handleBundleOptionQuantityChange = useCallback(\n (optionValueId: string, quantity: number) => {\n const optionValue = data?.options\n ?.flatMap((option) => option.items)\n .find((item) => item.id === optionValueId);\n\n if (!optionValue?.canEditQuantity) {\n return;\n }\n\n setValues((prev) => {\n const bundleOptionQuantities = {\n ...(prev.bundleOptionQuantities ?? {}),\n [optionValueId]: quantity,\n };\n return {\n ...prev,\n bundleOptionQuantities,\n enteredOptions: bundleOptionQuantitiesToEnteredOptions(\n bundleOptionQuantities\n ),\n };\n });\n },\n [data?.options]\n );\n\n useEffect(() => {\n events.emit('pdp/values', values);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [JSON.stringify(values)]);\n\n const handleOptionSelected = useCallback(\n async (selections: ProductOptionSelectionMap) => {\n // options Selected\n const sanitizedSelections = Object.fromEntries(\n Object.entries(selections).filter(\n ([, value]) => value.label !== ChooseOptionLabel\n )\n ) as ProductOptionSelectionMap;\n\n let optionsUIDs = selectionMapToOptionUIDs(\n sanitizedSelections,\n data?.options\n );\n\n // set optionUIDs to URL params\n // ?optionsUIDs=1,2,3\n // only set the URL params if the hideURLParams is not set to true and the product is not a bundle type\n if (\n !hideURLParams &&\n data?.options &&\n !hasProductViewOptionValueProduct(data.options)\n ) {\n setUrlParams({ optionsUIDs: optionsUIDs.join(',') });\n }\n\n // update state\n handleOnValues({ optionsUIDs });\n\n // get refined product data and update state\n const next = await fetchProductData(sku, {\n anchors: optionsConfig?.anchorOptions,\n isBundle: data?.isBundle,\n optionsUIDs,\n preselectFirstOption: !disableDropdownPreselection,\n });\n\n setData(next);\n setValid(\n isProductOptionsSelectionComplete(\n next?.options,\n next?.optionUIDs ?? optionsUIDs,\n next?.isBundle\n )\n );\n\n // special processing for anchor options (options that should not be refined when other options are selected)\n if (optionsConfig?.anchorOptions?.length) {\n processUpdates(next, optionsUIDs);\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [sku]\n );\n\n const processUpdates = useCallback(\n (next: ProductModel | null, previousOptionsUIDs: string[]) => {\n const updatedOptionsUIDs = next?.optionUIDs ?? [];\n const haveSameValues = previousOptionsUIDs.every((item) =>\n updatedOptionsUIDs.includes(item)\n );\n if (!haveSameValues) {\n setSelectionsToUpdate(next?.options);\n handleOnValues({ optionsUIDs: updatedOptionsUIDs });\n setValid(\n isProductOptionsSelectionComplete(\n next?.options,\n updatedOptionsUIDs,\n next?.isBundle\n )\n );\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [sku]\n );\n\n const handleOnErrors = useCallback((_errors: { [id: string]: string }) => {\n if (Object.keys(_errors).length !== 0) setValid(false);\n }, []);\n\n // Product Attributes\n const attributes = useMemo(() => {\n return data?.attributes?.map(({ label, value, id }, key: number) => {\n // Return empty string for gift card attributes\n if (id === 'ac_giftcard') {\n return '';\n }\n\n const __html = isDateValid(value)\n ? toDateString(value, locale)\n : value.toString();\n\n return (\n <li key={key}>\n {/* eslint-disable-next-line react/no-danger */}\n {label}: <span dangerouslySetInnerHTML={{ __html }} />\n </li>\n );\n });\n }, [data?.attributes, locale]);\n\n const quantity =\n !hideQuantity && data?.inStock && !data?.isBundle ? (\n <Slot\n name=\"Quantity\"\n slot={slots?.Quantity}\n context={{ ...defaultSlotContext }}\n >\n <Incrementer\n key=\"quantity\"\n name=\"quantity\"\n defaultValue={values.quantity.toString()}\n value={values.quantity.toString()}\n min={1}\n aria-label={IncrementerLabel}\n className=\"pdp-product__quantity\"\n onValue={(quantity) => {\n const quantityValue = Number(quantity);\n handleOnValues({ quantity: quantityValue });\n\n // Add quantity to URL parameters if not set to hide\n if (!hideURLParams && data?.options) {\n // Only update URL if the product is not a bundle type\n if (!hasProductViewOptionValueProduct(data.options)) {\n setUrlParams({ quantity: quantityValue });\n }\n }\n }}\n />\n </Slot>\n ) : undefined;\n\n const renderOptions = () => {\n if (data?.options) {\n return (\n <Slot\n name=\"Options\"\n slot={slots?.Options}\n context={{ ...defaultSlotContext }}\n >\n <Swatches\n selectedUIDs={values.optionsUIDs}\n options={data.options}\n defaultOptions={values.optionsUIDs}\n selectionsToUpdate={selectionsToUpdate}\n hideSelectedValue={hideSelectedOptionValue}\n disablePreselections={disableDropdownPreselection}\n onValues={handleOptionSelected}\n onErrors={handleOnErrors}\n bundleOptionQuantities={values.bundleOptionQuantities}\n onBundleOptionQuantityChange={handleBundleOptionQuantityChange}\n />\n </Slot>\n );\n }\n };\n\n const renderGiftCardOptions = () => {\n if (data?.attributes) {\n const giftCardAttributes = data.attributes.filter(\n (attr) => attr.id === 'ac_giftcard'\n );\n\n if (giftCardAttributes.length > 0) {\n const giftCardElements = giftCardAttributes.map(\n (giftCardAttr, index) => {\n try {\n const giftCardData = JSON.parse(giftCardAttr.value);\n const prevOptions = values.enteredOptions || [];\n const optionValues =\n giftCardData.options?.map((option: any) => {\n const existingOption = prevOptions.find(\n (opt: { uid: string; value: string }) =>\n opt.uid === option.uid\n );\n return {\n id: option.uid,\n value: existingOption?.value || '',\n };\n }) || [];\n\n return (\n <GiftCardOptions\n key={`giftcard-${index}`}\n options={giftCardData.options || []}\n optionValues={optionValues}\n onOptionChange={(uid: string, value: string) => {\n const prevOptions = values.enteredOptions || [];\n const idx = prevOptions.findIndex(\n (field: { uid: string; value: string }) =>\n field.uid === uid\n );\n let newEnteredOptions;\n if (idx !== -1) {\n newEnteredOptions = prevOptions.map(\n (field: { uid: string; value: string }) =>\n field.uid === uid ? { ...field, value } : field\n );\n } else {\n newEnteredOptions = [...prevOptions, { uid, value }];\n }\n\n handleOnValues({ enteredOptions: newEnteredOptions });\n\n if (data) {\n const updatedData = { ...data };\n const giftCardAttributes =\n updatedData.attributes?.map((attr) => {\n if (attr.id === 'ac_giftcard') {\n try {\n const giftCardData = JSON.parse(attr.value);\n const updatedOptions =\n giftCardData.options?.map((option: any) => {\n if (option.uid === uid) {\n return { ...option, value };\n }\n return option;\n }) || [];\n return {\n ...attr,\n value: JSON.stringify({\n ...giftCardData,\n options: updatedOptions,\n }),\n };\n } catch (error) {\n return attr;\n }\n }\n return attr;\n }) || [];\n updatedData.attributes = giftCardAttributes;\n setData(updatedData);\n }\n }}\n onValidationChange={(valid: boolean) => {\n if (!valid) {\n handleOnErrors({ giftCard: 'Invalid gift card data' });\n }\n\n setValid(valid);\n }}\n className=\"pdp-product__gift-card-options\"\n />\n );\n } catch (error) {\n console.warn('Invalid gift card data format:', error);\n return null;\n }\n }\n );\n\n // Filter out null values and return a single element\n const validElements = giftCardElements.filter(\n (element) => element !== null\n );\n return validElements.length > 0 ? (\n <div className=\"pdp-product__gift-card-options-container\">\n {validElements}\n </div>\n ) : undefined;\n }\n }\n return undefined;\n };\n\n const renderDownloadableOptions = () => {\n if (data?.attributes) {\n const downloadableAttributes = data.attributes.filter(\n (attr) =>\n attr.id === 'ac_downloadable' &&\n attr.roles?.includes('visible_in_pdp')\n );\n\n if (downloadableAttributes.length > 0) {\n const downloadableElements = downloadableAttributes.map(\n (downloadableAttr, index) => {\n try {\n const downloadableValue =\n typeof downloadableAttr.value === 'string'\n ? JSON.parse(downloadableAttr.value)\n : downloadableAttr.value;\n\n return (\n <DownloadableOptions\n key={`downloadable-${index}`}\n label={downloadableAttr.label}\n value={downloadableValue}\n onLinkChange={(uid: string, selected: boolean) => {\n const prevUIDs = values.optionsUIDs || [];\n let newOptionsUIDs;\n\n if (selected) {\n if (!prevUIDs.includes(uid)) {\n newOptionsUIDs = [...prevUIDs, uid];\n } else {\n newOptionsUIDs = prevUIDs;\n }\n } else {\n newOptionsUIDs = prevUIDs.filter(\n (id: string) => id !== uid\n );\n }\n\n handleOnValues({ optionsUIDs: newOptionsUIDs });\n }}\n currency={data.prices?.final?.currency}\n className=\"pdp-product__downloadable-options\"\n />\n );\n } catch (error) {\n console.warn('Invalid downloadable data format:', error);\n return null;\n }\n }\n );\n\n // Filter out null values and return a wrapper div\n const validElements = downloadableElements.filter(\n (element) => element !== null\n );\n return validElements.length > 0 ? (\n <div className=\"pdp-product__downloadable-options-container\">\n {validElements}\n </div>\n ) : undefined;\n }\n }\n return undefined;\n };\n\n return (\n <div {...props}>\n <Product\n title={\n <Slot\n name=\"Title\"\n slot={slots?.Title}\n context={{ ...defaultSlotContext }}\n >\n {data?.name}\n </Slot>\n }\n sku={\n !hideSku ? (\n <Slot\n name=\"SKU\"\n slot={slots?.SKU}\n context={{ ...defaultSlotContext }}\n >\n {data?.sku}\n </Slot>\n ) : undefined\n }\n options={renderOptions()}\n giftCardOptions={renderGiftCardOptions()}\n downloadableOptions={renderDownloadableOptions()}\n breadcrumbs={\n slots?.Breadcrumbs && (\n <Slot\n name=\"Breadcrumbs\"\n slot={slots?.Breadcrumbs}\n context={{\n ...defaultSlotContext,\n\n setSeparator(callback) {\n this._registerMethod((...attrs) => {\n const nextSeparator = callback(...attrs);\n\n const separator = nextSeparator && (\n <Icon source={nextSeparator} />\n );\n\n this._setProps((prev: any) => {\n return {\n ...prev,\n separator,\n children: [\n // eslint-disable-next-line react/jsx-key\n <Breadcrumbs\n separator={separator}\n categories={prev.categories}\n />,\n ],\n };\n });\n });\n },\n\n appendLink(callback) {\n this._registerMethod((...attrs) => {\n const { text, ...p } = callback(...attrs);\n\n const link = <a {...p}>{text}</a>;\n\n this._setProps((prev: any) => {\n const categories = [...(prev.categories || []), link];\n return {\n ...prev,\n categories,\n children: [\n // eslint-disable-next-line react/jsx-key\n <Breadcrumbs\n separator={prev.separator}\n categories={categories}\n />,\n ],\n };\n });\n });\n },\n\n appendHTMLElement(callback) {\n this._registerMethod((...attrs) => {\n const domElement = callback(...attrs);\n\n const vnode = this._htmlElementToVNode(domElement);\n\n this._setProps((prev: any) => {\n const categories = [...(prev.categories || []), vnode];\n\n return {\n ...prev,\n categories,\n children: [\n // eslint-disable-next-line react/jsx-key\n <Breadcrumbs\n separator={prev.separator}\n categories={categories}\n />,\n ],\n };\n });\n });\n },\n }}\n />\n )\n }\n quantity={quantity}\n actions={\n <Slot\n name=\"Actions\"\n slot={slots?.Actions}\n context={{\n ...defaultSlotContext,\n\n appendButton(callback) {\n this._registerMethod((...attrs) => {\n const _button = callback(...attrs);\n\n if (!_button) return;\n\n const { text, icon, ...buttonProps } = _button;\n\n const button = (\n <Button\n type=\"button\"\n {...buttonProps}\n icon={icon && <Icon source={icon} />}\n >\n {text}\n </Button>\n );\n\n this._setProps((prev: any) => ({\n children: [...(prev.children || []), button],\n }));\n });\n },\n }}\n >\n {\n // Default Add to Cart button if no slot is provided\n !slots?.Actions && (\n <Button\n size=\"medium\"\n type=\"submit\"\n icon={<Icon source=\"Cart\" />}\n disabled={!data?.inStock || !valid}\n aria-label={AddToCartLabel}\n onClick={() => {\n return onAddToCart?.(values);\n }}\n >\n {AddToCartLabel}\n </Button>\n )\n }\n </Slot>\n }\n shortDescription={\n !hideShortDescription ? (\n <Slot\n name=\"ShortDescription\"\n slot={slots?.ShortDescription}\n context={{ ...defaultSlotContext }}\n >\n <div\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{\n __html: data?.shortDescription ?? '',\n }}\n />\n </Slot>\n ) : undefined\n }\n description={\n !hideDescription ? (\n <Slot\n name=\"Description\"\n slot={slots?.Description}\n context={{ ...defaultSlotContext }}\n >\n <div\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{ __html: data?.description ?? '' }}\n />\n </Slot>\n ) : undefined\n }\n images={\n data?.images?.map(({ label, url }) => (\n <Image\n key={url}\n title={label}\n alt={label}\n src={url}\n // TODO: change width/height for image aspect ratio\n // pending https://jira.corp.adobe.com/browse/DATA-5122\n width={carousel?.imageParams?.width ?? 960}\n height={carousel?.imageParams?.height ?? 1191}\n params={carousel?.imageParams ?? { width: 960 }}\n />\n )) ?? []\n }\n specialPrice={\n data?.prices?.visible ? (\n <Slot\n name=\"SpecialPrice\"\n slot={slots?.SpecialPrice}\n context={{ ...defaultSlotContext }}\n >\n <PriceRange\n {...data.prices?.final}\n locale={toLanguageTag(locale)}\n />\n </Slot>\n ) : undefined\n }\n price={\n data?.prices?.visible &&\n data?.prices?.regular &&\n data?.prices?.final?.amount !== data?.prices?.regular?.amount ? (\n <Slot\n name=\"RegularPrice\"\n slot={slots?.RegularPrice}\n context={{ ...defaultSlotContext }}\n >\n <PriceRange\n {...data.prices?.regular}\n locale={toLanguageTag(locale)}\n />\n </Slot>\n ) : undefined\n }\n zoomType={zoomType}\n closeButton={closeButton}\n carouselConfig={{\n ...carousel,\n thumbnails:\n carousel && Object.keys(carousel).length\n ? data?.images?.map(({ label, url }) => (\n <Image\n key={url}\n title={label}\n alt={label}\n src={url}\n // TODO: change width/height for image aspect ratio\n // pending https://jira.corp.adobe.com/browse/DATA-5122\n width={carousel?.thumbnailParams?.width ?? 200}\n height={carousel?.thumbnailParams?.height ?? 248}\n params={carousel?.thumbnailParams ?? { width: 200 }}\n />\n )) ?? []\n : [],\n }}\n outOfStock={!data?.inStock}\n attributes={\n !hideAttributes ? (\n <Slot\n name=\"Attributes\"\n slot={slots?.Attributes}\n context={{ ...defaultSlotContext }}\n >\n {attributes?.length ? (\n <>\n {DetailsLabel}\n <ul>{attributes}</ul>\n </>\n ) : null}\n </Slot>\n ) : undefined\n }\n galleryContent={\n slots?.GalleryContent && (\n <Slot\n name=\"GalleryContent\"\n slot={slots.GalleryContent}\n context={{ ...defaultSlotContext }}\n />\n )\n }\n infoContent={\n slots?.InfoContent && (\n <Slot\n name=\"InfoContent\"\n slot={slots.InfoContent}\n context={{ ...defaultSlotContext }}\n />\n )\n }\n productContent={\n slots?.Content && (\n <Slot\n name=\"Content\"\n slot={slots.Content}\n context={{ ...defaultSlotContext }}\n />\n )\n }\n />\n </div>\n );\n};\n\n/** @deprecated This method is part of the deprecated ProductDetails component. */\nProductDetails.getInitialData = async function ({\n sku,\n disableDropdownPreselection = false,\n optionsConfig,\n}) {\n const initialData = config.getConfig().models?.ProductDetails?.initialData;\n\n return initialData\n ? transformProductData(initialData)\n : fetchProductData(sku, {\n preselectFirstOption: !disableDropdownPreselection,\n anchors: optionsConfig?.anchorOptions,\n });\n};\n"],"names":["ProductDetails","sku","hideSku","hideQuantity","hideShortDescription","hideDescription","hideAttributes","hideURLParams","hideSelectedOptionValue","slots","children","initialData","carousel","optionsConfig","useACDL","onAddToCart","zoomType","closeButton","disableDropdownPreselection","props","AddToCartLabel","useText","IncrementerLabel","DetailsLabel","ChooseOptionLabel","locale","setLocale","useState","config","selectionsToUpdate","setSelectionsToUpdate","data","setData","values","setValues","initialQuantity","getValidatedQuantityFromUrl","defaultValues","bundleOptionQuantities","buildBundleOptionQuantitiesFromOptions","bundleOptionQuantitiesToEnteredOptions","valid","setValid","_a","isProductOptionsSelectionComplete","defaultSlotContext","hasProductViewOptionValueProduct","options","option","useEffect","dataEvent","events","payload","prev","next","mergeBundleOptionQuantities","updateDataEvent","localeEvent","fetchProductData","publishProductPageViewEvent","handleOnValues","useCallback","newValues","handleBundleOptionQuantityChange","optionValueId","quantity","optionValue","item","handleOptionSelected","selections","sanitizedSelections","value","optionsUIDs","selectionMapToOptionUIDs","setUrlParams","processUpdates","previousOptionsUIDs","updatedOptionsUIDs","handleOnErrors","_errors","attributes","useMemo","label","id","key","__html","isDateValid","toDateString","jsx","Slot","Incrementer","quantityValue","renderOptions","Swatches","renderGiftCardOptions","giftCardAttributes","attr","validElements","giftCardAttr","index","giftCardData","prevOptions","optionValues","existingOption","opt","GiftCardOptions","uid","idx","field","newEnteredOptions","updatedData","updatedOptions","error","element","renderDownloadableOptions","downloadableAttributes","downloadableAttr","downloadableValue","DownloadableOptions","selected","prevUIDs","newOptionsUIDs","_b","Product","callback","attrs","nextSeparator","separator","Icon","Breadcrumbs","text","p","link","categories","domElement","vnode","_button","icon","buttonProps","button","Button","url","Image","PriceRange","_c","toLanguageTag","_d","_e","_g","_f","_i","_h","_j","_k","jsxs","Fragment","transformProductData"],"mappings":"y1BAwLO,MAAMA,GAGT,CAAC,CACH,IAAAC,EACA,QAAAC,EACA,aAAAC,EACA,qBAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,cAAAC,EACA,wBAAAC,GACA,MAAAC,EACA,SAAAC,GACA,YAAAC,EACA,SAAAC,EACA,cAAAC,EACA,QAAAC,GACA,YAAAC,EACA,SAAAC,GACA,YAAAC,GAAc,GACd,4BAAAC,EACA,GAAGC,EACL,IAAM,sCAEJ,MAAMC,EAAiBC,EAAQ,6BAA6B,EAAE,MACxDC,GAAmBD,EAAQ,+BAA+B,EAAE,MAC5DE,GAAeF,EAAQ,2BAA2B,EAAE,MACpDG,GAAoBH,EAAQ,iCAAiC,EAAE,MAG/D,CAACI,EAAQC,EAAS,EAAIC,EACzBC,GAAO,UAAA,EAAY,eA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,CAAA,CACnC,CAAA,EAIR,CAEJ,EAGA7C,GAAe,eAAiB,eAAgB,CAC9C,IAAAC,EACA,4BAAAiB,EAA8B,GAC9B,cAAAL,CACF,EAAG,SACD,MAAMF,GAAc+G,GAAA/E,EAAAf,GAAO,UAAA,EAAY,SAAnB,YAAAe,EAA2B,iBAA3B,YAAA+E,EAA2C,YAE/D,OAAO/G,EACHiJ,GAAqBjJ,CAAW,EAChC+C,EAAiBzD,EAAK,CACpB,qBAAsB,CAACiB,EACvB,QAASL,GAAA,YAAAA,EAAe,aAAA,CACzB,CACP"}
1
+ {"version":3,"file":"ProductDetails.js","sources":["/@dropins/storefront-pdp/src/containers/ProductDetails/ProductDetails.tsx"],"sourcesContent":["/**\n * ADOBE CONFIDENTIAL\n * __________________\n * Copyright 2023 Adobe\n * All Rights Reserved.\n * __________________\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n */\n\nimport {\n HTMLAttributes,\n useEffect,\n useState,\n useCallback,\n useMemo,\n} from 'preact/compat';\n\nimport {\n Container,\n toLanguageTag,\n SlotProps,\n SlotMethod,\n Slot,\n ResolveImageUrlOptions,\n} from '@adobe-commerce/elsie/lib';\n\nimport {\n Button,\n Icon,\n ButtonProps,\n Image,\n Incrementer,\n Breadcrumbs,\n} from '@adobe-commerce/elsie/components';\nimport {\n Product,\n Swatches,\n PriceRange,\n Option,\n GiftCardOptions,\n DownloadableOptions,\n} from '@/pdp/components';\nimport { config, fetchProductData } from '@/pdp/api';\nimport { events } from '@adobe-commerce/event-bus';\nimport { Lang, useText } from '@adobe-commerce/elsie/i18n';\nimport { isDateValid, toDateString } from '@/pdp/lib/date';\nimport {\n isProductOptionsSelectionComplete,\n selectionMapToOptionUIDs,\n type ProductOptionSelectionMap,\n} from '@/pdp/lib/product-option-selection';\nimport {\n setUrlParams,\n getValidatedQuantityFromUrl,\n} from '@/pdp/lib/url-params';\nimport { publishProductPageViewEvent } from '@/pdp/lib/acdl';\nimport { ProductModel, Option as ProductOption } from '@/pdp/data/models';\nimport { transformProductData } from '@/pdp/data/transforms/product-transform';\nimport {\n buildBundleOptionQuantitiesFromOptions,\n bundleOptionQuantitiesToEnteredOptions,\n mergeBundleOptionQuantities,\n} from '@/pdp/lib/bundle-option-quantities';\n\ntype IconType = keyof typeof import('@adobe-commerce/elsie/icons');\n\n/** @deprecated This type is part of the deprecated ProductDetails component. */\nexport type Values = {\n sku: string;\n quantity: number;\n optionsUIDs?: string[];\n enteredOptions?: Array<{ uid: string; value: string }>;\n bundleOptionQuantities?: Record<string, number>;\n};\n\n/** @deprecated This type is part of the deprecated ProductDetails component. */\ntype DefaultSlotContext = {\n data: ProductModel | null;\n values: Values;\n valid: boolean;\n};\n\n/** @deprecated This type is part of the deprecated ProductDetails component. */\nexport type CarouselConfig = {\n controls?: {\n desktop?: 'thumbnailsRow' | 'thumbnailsColumn' | 'dots' | null;\n mobile?: 'dots' | 'thumbnailsRow' | null;\n };\n arrowsOnMainImage?: boolean;\n loopable?: boolean;\n peak?: {\n desktop: boolean;\n mobile: boolean;\n };\n gap?: 'small' | 'medium' | 'large' | null;\n thumbnailsLoadingMode?: 'lazy' | 'eager';\n imageParams?: ResolveImageUrlOptions;\n thumbnailParams?: ResolveImageUrlOptions;\n};\n\n/** @deprecated This type is part of the deprecated ProductDetails component. */\nexport type OptionsConfig = {\n anchorOptions?: string[];\n};\n\n/** @deprecated This interface is part of the deprecated ProductDetails component. */\nexport interface ProductDetailsProps extends HTMLAttributes<HTMLDivElement> {\n sku: string;\n productData?: ProductModel;\n hideSku?: boolean;\n hideQuantity?: boolean;\n hideShortDescription?: boolean;\n hideDescription?: boolean;\n hideAttributes?: boolean;\n hideSelectedOptionValue?: boolean;\n hideURLParams?: boolean;\n slots?: {\n Title?: SlotProps<DefaultSlotContext>;\n\n SKU?: SlotProps<DefaultSlotContext>;\n\n RegularPrice?: SlotProps<DefaultSlotContext>;\n\n SpecialPrice?: SlotProps<DefaultSlotContext>;\n\n Options?: SlotProps<DefaultSlotContext>;\n\n Quantity?: SlotProps<DefaultSlotContext>;\n\n Actions?: SlotProps<\n DefaultSlotContext & {\n appendButton: SlotMethod<\n Omit<ButtonProps, 'icon'> & {\n text?: string;\n icon?: IconType;\n }\n >;\n }\n >;\n\n ShortDescription?: SlotProps<DefaultSlotContext>;\n\n Description?: SlotProps<DefaultSlotContext>;\n\n Attributes?: SlotProps<DefaultSlotContext>;\n\n Breadcrumbs?: SlotProps<\n DefaultSlotContext & {\n setSeparator: SlotMethod<IconType>;\n\n appendLink: SlotMethod<\n HTMLAttributes<HTMLAnchorElement> & { text?: string }\n >;\n\n appendHTMLElement: SlotMethod<HTMLElement>;\n }\n >;\n\n GalleryContent?: SlotProps<DefaultSlotContext>;\n\n InfoContent?: SlotProps<DefaultSlotContext>;\n\n Content?: SlotProps<DefaultSlotContext>;\n };\n carousel?: CarouselConfig;\n optionsConfig?: OptionsConfig;\n useACDL?: boolean;\n onAddToCart?: (values: Values) => void;\n zoomType?: 'zoom' | 'overlay';\n closeButton?: boolean;\n disableDropdownPreselection?: boolean;\n}\n\n/**\n * @deprecated This container has been deprecated and will be removed in a future release.\n * Please use the different composable containers to build your product details page.xs\n */\nexport const ProductDetails: Container<\n ProductDetailsProps,\n ProductModel | null\n> = ({\n sku,\n hideSku,\n hideQuantity,\n hideShortDescription,\n hideDescription,\n hideAttributes,\n hideURLParams,\n hideSelectedOptionValue,\n slots,\n children,\n initialData,\n carousel,\n optionsConfig,\n useACDL,\n onAddToCart,\n zoomType,\n closeButton = true,\n disableDropdownPreselection,\n ...props\n}) => {\n // i18n\n const AddToCartLabel = useText('PDP.Product.AddToCart.label').label;\n const IncrementerLabel = useText('PDP.Product.Incrementer.label').label;\n const DetailsLabel = useText('PDP.Product.Details.label').label;\n const ChooseOptionLabel = useText('PDP.Swatches.ChooseOption.label').label;\n\n // TODO: Investigate if the \"|| 'en-US' \" is really necessary\n const [locale, setLocale] = useState<Lang>(\n (config.getConfig().defaultLocale as Lang) || 'en-US'\n );\n\n const [selectionsToUpdate, setSelectionsToUpdate] = useState<Option[]>();\n\n const [data = null, setData] = useState(initialData);\n\n const [values, setValues] = useState<Values>(() => {\n const initialQuantity = getValidatedQuantityFromUrl(1); // Default quantity to 1\n\n const defaultValues: Values = {\n sku,\n quantity: initialQuantity,\n };\n\n if (data?.optionUIDs) {\n defaultValues.optionsUIDs = data.optionUIDs;\n }\n\n if (data?.isBundle && data?.options) {\n const bundleOptionQuantities = buildBundleOptionQuantitiesFromOptions(\n data.options,\n data.optionUIDs ?? []\n );\n defaultValues.bundleOptionQuantities = bundleOptionQuantities;\n defaultValues.enteredOptions = bundleOptionQuantitiesToEnteredOptions(\n bundleOptionQuantities\n );\n }\n\n return defaultValues;\n });\n\n // the context is invalid for a configurable product that doesn't have all the options selected\n const [valid, setValid] = useState(() => {\n if (!data?.options?.length) {\n return true;\n }\n return isProductOptionsSelectionComplete(\n data.options,\n data.optionUIDs,\n data.isBundle\n );\n });\n const defaultSlotContext: DefaultSlotContext = { data, values, valid };\n\n function hasProductViewOptionValueProduct(options: ProductOption[]) {\n return options?.some(\n (option) => option?.typename === 'ProductViewOptionValueProduct'\n );\n }\n\n useEffect(() => {\n const dataEvent = events.on('pdp/data', (payload) => {\n if (payload) {\n setData(payload);\n setValues((prev: Values) => {\n const next: Values = {\n ...prev,\n sku: payload.sku,\n optionsUIDs: payload.optionUIDs,\n };\n\n if (payload.isBundle && payload.options) {\n const bundleOptionQuantities = mergeBundleOptionQuantities(\n prev.bundleOptionQuantities,\n payload.options,\n payload.optionUIDs ?? []\n );\n next.bundleOptionQuantities = bundleOptionQuantities;\n next.enteredOptions = bundleOptionQuantitiesToEnteredOptions(\n bundleOptionQuantities\n );\n }\n\n return next;\n });\n }\n });\n\n // @ts-ignore - Type error with event bus events\n const updateDataEvent = events.on(\n 'pdp/setValues',\n (payload: Partial<Values>) => {\n setValues((prev: Values) => ({ ...prev, ...payload }));\n }\n );\n\n return () => {\n updateDataEvent?.off();\n dataEvent?.off();\n };\n }, []);\n\n // Locale\n useEffect(() => {\n const localeEvent = events.on('locale', (payload: string) => {\n if (payload === locale) return;\n\n setLocale(payload as Lang);\n\n fetchProductData(sku, {\n preselectFirstOption: !disableDropdownPreselection,\n anchors: optionsConfig?.anchorOptions,\n }).then(setData);\n });\n return () => {\n localeEvent?.off();\n };\n }, [disableDropdownPreselection, locale, optionsConfig?.anchorOptions, sku]);\n\n useEffect(() => {\n if (useACDL && initialData && Object.keys(initialData).length > 0) {\n publishProductPageViewEvent(initialData);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [initialData]);\n\n // Callbacks\n const handleOnValues = useCallback((newValues: Partial<Values>) => {\n setValues((prev) => ({ ...prev, ...newValues }));\n }, []);\n\n const handleBundleOptionQuantityChange = useCallback(\n (optionValueId: string, quantity: number) => {\n const optionValue = data?.options\n ?.flatMap((option) => option.items)\n .find((item) => item.id === optionValueId);\n\n if (!optionValue?.canEditQuantity) {\n return;\n }\n\n setValues((prev) => {\n const bundleOptionQuantities = {\n ...(prev.bundleOptionQuantities ?? {}),\n [optionValueId]: quantity,\n };\n return {\n ...prev,\n bundleOptionQuantities,\n enteredOptions: bundleOptionQuantitiesToEnteredOptions(\n bundleOptionQuantities\n ),\n };\n });\n },\n [data?.options]\n );\n\n useEffect(() => {\n events.emit('pdp/values', values);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [JSON.stringify(values)]);\n\n const handleOptionSelected = useCallback(\n async (selections: ProductOptionSelectionMap) => {\n // options Selected\n const sanitizedSelections = Object.fromEntries(\n Object.entries(selections).filter(\n ([, value]) => value.label !== ChooseOptionLabel\n )\n ) as ProductOptionSelectionMap;\n\n let optionsUIDs = selectionMapToOptionUIDs(\n sanitizedSelections,\n data?.options\n );\n\n // set optionUIDs to URL params\n // ?optionsUIDs=1,2,3\n // only set the URL params if the hideURLParams is not set to true and the product is not a bundle type\n if (\n !hideURLParams &&\n data?.options &&\n !hasProductViewOptionValueProduct(data.options)\n ) {\n setUrlParams({ optionsUIDs: optionsUIDs.join(',') });\n }\n\n // update state\n handleOnValues({ optionsUIDs });\n\n // get refined product data and update state\n const next = await fetchProductData(sku, {\n anchors: optionsConfig?.anchorOptions,\n isBundle: data?.isBundle,\n optionsUIDs,\n preselectFirstOption: !disableDropdownPreselection,\n });\n\n setData(next);\n setValid(\n isProductOptionsSelectionComplete(\n next?.options,\n next?.optionUIDs ?? optionsUIDs,\n next?.isBundle\n )\n );\n\n // special processing for anchor options (options that should not be refined when other options are selected)\n if (optionsConfig?.anchorOptions?.length) {\n processUpdates(next, optionsUIDs);\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [sku]\n );\n\n const processUpdates = useCallback(\n (next: ProductModel | null, previousOptionsUIDs: string[]) => {\n const updatedOptionsUIDs = next?.optionUIDs ?? [];\n const haveSameValues = previousOptionsUIDs.every((item) =>\n updatedOptionsUIDs.includes(item)\n );\n if (!haveSameValues) {\n setSelectionsToUpdate(next?.options);\n handleOnValues({ optionsUIDs: updatedOptionsUIDs });\n setValid(\n isProductOptionsSelectionComplete(\n next?.options,\n updatedOptionsUIDs,\n next?.isBundle\n )\n );\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [sku]\n );\n\n const handleOnErrors = useCallback((_errors: { [id: string]: string }) => {\n if (Object.keys(_errors).length !== 0) setValid(false);\n }, []);\n\n // Product Attributes\n const attributes = useMemo(() => {\n return data?.attributes?.map(({ label, value, id }, key: number) => {\n // Return empty string for gift card attributes\n if (id === 'ac_giftcard') {\n return '';\n }\n\n const __html = isDateValid(value)\n ? toDateString(value, locale)\n : value.toString();\n\n return (\n <li key={key}>\n {/* eslint-disable-next-line react/no-danger */}\n {label}: <span dangerouslySetInnerHTML={{ __html }} />\n </li>\n );\n });\n }, [data?.attributes, locale]);\n\n const quantity =\n !hideQuantity && data?.inStock ? (\n <Slot\n name=\"Quantity\"\n slot={slots?.Quantity}\n context={{ ...defaultSlotContext }}\n >\n <Incrementer\n key=\"quantity\"\n name=\"quantity\"\n defaultValue={values.quantity.toString()}\n value={values.quantity.toString()}\n min={1}\n aria-label={IncrementerLabel}\n className=\"pdp-product__quantity\"\n onValue={(quantity) => {\n const quantityValue = Number(quantity);\n handleOnValues({ quantity: quantityValue });\n\n // Add quantity to URL parameters if not set to hide\n if (!hideURLParams && data?.options) {\n // Only update URL if the product is not a bundle type\n if (!hasProductViewOptionValueProduct(data.options)) {\n setUrlParams({ quantity: quantityValue });\n }\n }\n }}\n />\n </Slot>\n ) : undefined;\n\n const renderOptions = () => {\n if (data?.options) {\n return (\n <Slot\n name=\"Options\"\n slot={slots?.Options}\n context={{ ...defaultSlotContext }}\n >\n <Swatches\n selectedUIDs={values.optionsUIDs}\n options={data.options}\n defaultOptions={values.optionsUIDs}\n selectionsToUpdate={selectionsToUpdate}\n hideSelectedValue={hideSelectedOptionValue}\n disablePreselections={disableDropdownPreselection}\n onValues={handleOptionSelected}\n onErrors={handleOnErrors}\n bundleOptionQuantities={values.bundleOptionQuantities}\n onBundleOptionQuantityChange={handleBundleOptionQuantityChange}\n />\n </Slot>\n );\n }\n };\n\n const renderGiftCardOptions = () => {\n if (data?.attributes) {\n const giftCardAttributes = data.attributes.filter(\n (attr) => attr.id === 'ac_giftcard'\n );\n\n if (giftCardAttributes.length > 0) {\n const giftCardElements = giftCardAttributes.map(\n (giftCardAttr, index) => {\n try {\n const giftCardData = JSON.parse(giftCardAttr.value);\n const prevOptions = values.enteredOptions || [];\n const optionValues =\n giftCardData.options?.map((option: any) => {\n const existingOption = prevOptions.find(\n (opt: { uid: string; value: string }) =>\n opt.uid === option.uid\n );\n return {\n id: option.uid,\n value: existingOption?.value || '',\n };\n }) || [];\n\n return (\n <GiftCardOptions\n key={`giftcard-${index}`}\n options={giftCardData.options || []}\n optionValues={optionValues}\n onOptionChange={(uid: string, value: string) => {\n const prevOptions = values.enteredOptions || [];\n const idx = prevOptions.findIndex(\n (field: { uid: string; value: string }) =>\n field.uid === uid\n );\n let newEnteredOptions;\n if (idx !== -1) {\n newEnteredOptions = prevOptions.map(\n (field: { uid: string; value: string }) =>\n field.uid === uid ? { ...field, value } : field\n );\n } else {\n newEnteredOptions = [...prevOptions, { uid, value }];\n }\n\n handleOnValues({ enteredOptions: newEnteredOptions });\n\n if (data) {\n const updatedData = { ...data };\n const giftCardAttributes =\n updatedData.attributes?.map((attr) => {\n if (attr.id === 'ac_giftcard') {\n try {\n const giftCardData = JSON.parse(attr.value);\n const updatedOptions =\n giftCardData.options?.map((option: any) => {\n if (option.uid === uid) {\n return { ...option, value };\n }\n return option;\n }) || [];\n return {\n ...attr,\n value: JSON.stringify({\n ...giftCardData,\n options: updatedOptions,\n }),\n };\n } catch (error) {\n return attr;\n }\n }\n return attr;\n }) || [];\n updatedData.attributes = giftCardAttributes;\n setData(updatedData);\n }\n }}\n onValidationChange={(valid: boolean) => {\n if (!valid) {\n handleOnErrors({ giftCard: 'Invalid gift card data' });\n }\n\n setValid(valid);\n }}\n className=\"pdp-product__gift-card-options\"\n />\n );\n } catch (error) {\n console.warn('Invalid gift card data format:', error);\n return null;\n }\n }\n );\n\n // Filter out null values and return a single element\n const validElements = giftCardElements.filter(\n (element) => element !== null\n );\n return validElements.length > 0 ? (\n <div className=\"pdp-product__gift-card-options-container\">\n {validElements}\n </div>\n ) : undefined;\n }\n }\n return undefined;\n };\n\n const renderDownloadableOptions = () => {\n if (data?.attributes) {\n const downloadableAttributes = data.attributes.filter(\n (attr) =>\n attr.id === 'ac_downloadable' &&\n attr.roles?.includes('visible_in_pdp')\n );\n\n if (downloadableAttributes.length > 0) {\n const downloadableElements = downloadableAttributes.map(\n (downloadableAttr, index) => {\n try {\n const downloadableValue =\n typeof downloadableAttr.value === 'string'\n ? JSON.parse(downloadableAttr.value)\n : downloadableAttr.value;\n\n return (\n <DownloadableOptions\n key={`downloadable-${index}`}\n label={downloadableAttr.label}\n value={downloadableValue}\n onLinkChange={(uid: string, selected: boolean) => {\n const prevUIDs = values.optionsUIDs || [];\n let newOptionsUIDs;\n\n if (selected) {\n if (!prevUIDs.includes(uid)) {\n newOptionsUIDs = [...prevUIDs, uid];\n } else {\n newOptionsUIDs = prevUIDs;\n }\n } else {\n newOptionsUIDs = prevUIDs.filter(\n (id: string) => id !== uid\n );\n }\n\n handleOnValues({ optionsUIDs: newOptionsUIDs });\n }}\n currency={data.prices?.final?.currency}\n className=\"pdp-product__downloadable-options\"\n />\n );\n } catch (error) {\n console.warn('Invalid downloadable data format:', error);\n return null;\n }\n }\n );\n\n // Filter out null values and return a wrapper div\n const validElements = downloadableElements.filter(\n (element) => element !== null\n );\n return validElements.length > 0 ? (\n <div className=\"pdp-product__downloadable-options-container\">\n {validElements}\n </div>\n ) : undefined;\n }\n }\n return undefined;\n };\n\n return (\n <div {...props}>\n <Product\n title={\n <Slot\n name=\"Title\"\n slot={slots?.Title}\n context={{ ...defaultSlotContext }}\n >\n {data?.name}\n </Slot>\n }\n sku={\n !hideSku ? (\n <Slot\n name=\"SKU\"\n slot={slots?.SKU}\n context={{ ...defaultSlotContext }}\n >\n {data?.sku}\n </Slot>\n ) : undefined\n }\n options={renderOptions()}\n giftCardOptions={renderGiftCardOptions()}\n downloadableOptions={renderDownloadableOptions()}\n breadcrumbs={\n slots?.Breadcrumbs && (\n <Slot\n name=\"Breadcrumbs\"\n slot={slots?.Breadcrumbs}\n context={{\n ...defaultSlotContext,\n\n setSeparator(callback) {\n this._registerMethod((...attrs) => {\n const nextSeparator = callback(...attrs);\n\n const separator = nextSeparator && (\n <Icon source={nextSeparator} />\n );\n\n this._setProps((prev: any) => {\n return {\n ...prev,\n separator,\n children: [\n // eslint-disable-next-line react/jsx-key\n <Breadcrumbs\n separator={separator}\n categories={prev.categories}\n />,\n ],\n };\n });\n });\n },\n\n appendLink(callback) {\n this._registerMethod((...attrs) => {\n const { text, ...p } = callback(...attrs);\n\n const link = <a {...p}>{text}</a>;\n\n this._setProps((prev: any) => {\n const categories = [...(prev.categories || []), link];\n return {\n ...prev,\n categories,\n children: [\n // eslint-disable-next-line react/jsx-key\n <Breadcrumbs\n separator={prev.separator}\n categories={categories}\n />,\n ],\n };\n });\n });\n },\n\n appendHTMLElement(callback) {\n this._registerMethod((...attrs) => {\n const domElement = callback(...attrs);\n\n const vnode = this._htmlElementToVNode(domElement);\n\n this._setProps((prev: any) => {\n const categories = [...(prev.categories || []), vnode];\n\n return {\n ...prev,\n categories,\n children: [\n // eslint-disable-next-line react/jsx-key\n <Breadcrumbs\n separator={prev.separator}\n categories={categories}\n />,\n ],\n };\n });\n });\n },\n }}\n />\n )\n }\n quantity={quantity}\n actions={\n <Slot\n name=\"Actions\"\n slot={slots?.Actions}\n context={{\n ...defaultSlotContext,\n\n appendButton(callback) {\n this._registerMethod((...attrs) => {\n const _button = callback(...attrs);\n\n if (!_button) return;\n\n const { text, icon, ...buttonProps } = _button;\n\n const button = (\n <Button\n type=\"button\"\n {...buttonProps}\n icon={icon && <Icon source={icon} />}\n >\n {text}\n </Button>\n );\n\n this._setProps((prev: any) => ({\n children: [...(prev.children || []), button],\n }));\n });\n },\n }}\n >\n {\n // Default Add to Cart button if no slot is provided\n !slots?.Actions && (\n <Button\n size=\"medium\"\n type=\"submit\"\n icon={<Icon source=\"Cart\" />}\n disabled={!data?.inStock || !valid}\n aria-label={AddToCartLabel}\n onClick={() => {\n return onAddToCart?.(values);\n }}\n >\n {AddToCartLabel}\n </Button>\n )\n }\n </Slot>\n }\n shortDescription={\n !hideShortDescription ? (\n <Slot\n name=\"ShortDescription\"\n slot={slots?.ShortDescription}\n context={{ ...defaultSlotContext }}\n >\n <div\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{\n __html: data?.shortDescription ?? '',\n }}\n />\n </Slot>\n ) : undefined\n }\n description={\n !hideDescription ? (\n <Slot\n name=\"Description\"\n slot={slots?.Description}\n context={{ ...defaultSlotContext }}\n >\n <div\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{ __html: data?.description ?? '' }}\n />\n </Slot>\n ) : undefined\n }\n images={\n data?.images?.map(({ label, url }) => (\n <Image\n key={url}\n title={label}\n alt={label}\n src={url}\n // TODO: change width/height for image aspect ratio\n // pending https://jira.corp.adobe.com/browse/DATA-5122\n width={carousel?.imageParams?.width ?? 960}\n height={carousel?.imageParams?.height ?? 1191}\n params={carousel?.imageParams ?? { width: 960 }}\n />\n )) ?? []\n }\n specialPrice={\n data?.prices?.visible ? (\n <Slot\n name=\"SpecialPrice\"\n slot={slots?.SpecialPrice}\n context={{ ...defaultSlotContext }}\n >\n <PriceRange\n {...data.prices?.final}\n locale={toLanguageTag(locale)}\n />\n </Slot>\n ) : undefined\n }\n price={\n data?.prices?.visible &&\n data?.prices?.regular &&\n data?.prices?.final?.amount !== data?.prices?.regular?.amount ? (\n <Slot\n name=\"RegularPrice\"\n slot={slots?.RegularPrice}\n context={{ ...defaultSlotContext }}\n >\n <PriceRange\n {...data.prices?.regular}\n locale={toLanguageTag(locale)}\n />\n </Slot>\n ) : undefined\n }\n zoomType={zoomType}\n closeButton={closeButton}\n carouselConfig={{\n ...carousel,\n thumbnails:\n carousel && Object.keys(carousel).length\n ? data?.images?.map(({ label, url }) => (\n <Image\n key={url}\n title={label}\n alt={label}\n src={url}\n // TODO: change width/height for image aspect ratio\n // pending https://jira.corp.adobe.com/browse/DATA-5122\n width={carousel?.thumbnailParams?.width ?? 200}\n height={carousel?.thumbnailParams?.height ?? 248}\n params={carousel?.thumbnailParams ?? { width: 200 }}\n />\n )) ?? []\n : [],\n }}\n outOfStock={!data?.inStock}\n attributes={\n !hideAttributes ? (\n <Slot\n name=\"Attributes\"\n slot={slots?.Attributes}\n context={{ ...defaultSlotContext }}\n >\n {attributes?.length ? (\n <>\n {DetailsLabel}\n <ul>{attributes}</ul>\n </>\n ) : null}\n </Slot>\n ) : undefined\n }\n galleryContent={\n slots?.GalleryContent && (\n <Slot\n name=\"GalleryContent\"\n slot={slots.GalleryContent}\n context={{ ...defaultSlotContext }}\n />\n )\n }\n infoContent={\n slots?.InfoContent && (\n <Slot\n name=\"InfoContent\"\n slot={slots.InfoContent}\n context={{ ...defaultSlotContext }}\n />\n )\n }\n productContent={\n slots?.Content && (\n <Slot\n name=\"Content\"\n slot={slots.Content}\n context={{ ...defaultSlotContext }}\n />\n )\n }\n />\n </div>\n );\n};\n\n/** @deprecated This method is part of the deprecated ProductDetails component. */\nProductDetails.getInitialData = async function ({\n sku,\n disableDropdownPreselection = false,\n optionsConfig,\n}) {\n const initialData = config.getConfig().models?.ProductDetails?.initialData;\n\n return initialData\n ? transformProductData(initialData)\n : fetchProductData(sku, {\n preselectFirstOption: !disableDropdownPreselection,\n anchors: optionsConfig?.anchorOptions,\n });\n};\n"],"names":["ProductDetails","sku","hideSku","hideQuantity","hideShortDescription","hideDescription","hideAttributes","hideURLParams","hideSelectedOptionValue","slots","children","initialData","carousel","optionsConfig","useACDL","onAddToCart","zoomType","closeButton","disableDropdownPreselection","props","AddToCartLabel","useText","IncrementerLabel","DetailsLabel","ChooseOptionLabel","locale","setLocale","useState","config","selectionsToUpdate","setSelectionsToUpdate","data","setData","values","setValues","initialQuantity","getValidatedQuantityFromUrl","defaultValues","bundleOptionQuantities","buildBundleOptionQuantitiesFromOptions","bundleOptionQuantitiesToEnteredOptions","valid","setValid","_a","isProductOptionsSelectionComplete","defaultSlotContext","hasProductViewOptionValueProduct","options","option","useEffect","dataEvent","events","payload","prev","next","mergeBundleOptionQuantities","updateDataEvent","localeEvent","fetchProductData","publishProductPageViewEvent","handleOnValues","useCallback","newValues","handleBundleOptionQuantityChange","optionValueId","quantity","optionValue","item","handleOptionSelected","selections","sanitizedSelections","value","optionsUIDs","selectionMapToOptionUIDs","setUrlParams","processUpdates","previousOptionsUIDs","updatedOptionsUIDs","handleOnErrors","_errors","attributes","useMemo","label","id","key","__html","isDateValid","toDateString","jsx","Slot","Incrementer","quantityValue","renderOptions","Swatches","renderGiftCardOptions","giftCardAttributes","attr","validElements","giftCardAttr","index","giftCardData","prevOptions","optionValues","existingOption","opt","GiftCardOptions","uid","idx","field","newEnteredOptions","updatedData","updatedOptions","error","element","renderDownloadableOptions","downloadableAttributes","downloadableAttr","downloadableValue","DownloadableOptions","selected","prevUIDs","newOptionsUIDs","_b","Product","callback","attrs","nextSeparator","separator","Icon","Breadcrumbs","text","p","link","categories","domElement","vnode","_button","icon","buttonProps","button","Button","url","Image","PriceRange","_c","toLanguageTag","_d","_e","_g","_f","_i","_h","_j","_k","jsxs","Fragment","transformProductData"],"mappings":"y1BAwLO,MAAMA,GAGT,CAAC,CACH,IAAAC,EACA,QAAAC,EACA,aAAAC,EACA,qBAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,cAAAC,EACA,wBAAAC,GACA,MAAAC,EACA,SAAAC,GACA,YAAAC,EACA,SAAAC,EACA,cAAAC,EACA,QAAAC,GACA,YAAAC,EACA,SAAAC,GACA,YAAAC,GAAc,GACd,4BAAAC,EACA,GAAGC,EACL,IAAM,sCAEJ,MAAMC,EAAiBC,EAAQ,6BAA6B,EAAE,MACxDC,GAAmBD,EAAQ,+BAA+B,EAAE,MAC5DE,GAAeF,EAAQ,2BAA2B,EAAE,MACpDG,GAAoBH,EAAQ,iCAAiC,EAAE,MAG/D,CAACI,EAAQC,EAAS,EAAIC,EACzBC,GAAO,UAAA,EAAY,eAA0B,OAAA,EAG1C,CAACC,GAAoBC,EAAqB,EAAIH,EAAA,EAE9C,CAACI,EAAO,KAAMC,CAAO,EAAIL,EAAShB,CAAW,EAE7C,CAACsB,EAAQC,CAAS,EAAIP,EAAiB,IAAM,CACjD,MAAMQ,EAAkBC,GAA4B,CAAC,EAE/CC,EAAwB,CAC5B,IAAApC,EACA,SAAUkC,CAAA,EAOZ,GAJIJ,GAAA,MAAAA,EAAM,aACRM,EAAc,YAAcN,EAAK,YAG/BA,GAAA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,CACzB,CACP"}
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as P}from"@dropins/tools/preact-jsx-runtime.js";import{useState as u,useEffect as y}from"@dropins/tools/preact-compat.js";import{classes as I}from"@dropins/tools/lib.js";import{Incrementer as b}from"@dropins/tools/components.js";import{events as l}from"@dropins/tools/event-bus.js";import{g as q,setProductConfigurationValues as D,config as h,c as x,getFetchedProductData as C}from"../api.js";import{useText as S}from"@dropins/tools/i18n.js";import"../fragments.js";import"@dropins/tools/fetch-graphql.js";const U=({initialData:m=null,scope:e,onValue:a,children:F,...i})=>{const c=S("PDP.Product.Incrementer.label").label,[o,f]=u(m),[s,d]=u(()=>q(1));y(()=>{const r=l.on("pdp/data",f,{scope:e}),t=l.on("pdp/values",({quantity:n})=>{d(n)},{eager:!0,scope:e});return()=>{r==null||r.off(),t==null||t.off()}},[e]);const p=r=>{const t=parseInt(r,10);D(g=>({...g,quantity:t}),{scope:e});const{persistURLParams:n}=h.getConfig()??{};n&&x({quantity:t}),a==null||a(t)};return!o||o.isBundle?null:P(b,{name:"quantity",defaultValue:String(s),value:String(s),min:1,"aria-label":c,onValue:p,...i,className:I(["pdp-quantity",i.className])},"quantity")};U.getInitialData=C;export{U as ProductQuantity,U as default};
3
+ import{jsx as P}from"@dropins/tools/preact-jsx-runtime.js";import{useState as s,useEffect as y}from"@dropins/tools/preact-compat.js";import{classes as I}from"@dropins/tools/lib.js";import{Incrementer as b}from"@dropins/tools/components.js";import{events as m}from"@dropins/tools/event-bus.js";import{g as q,setProductConfigurationValues as D,config as h,c as x,getFetchedProductData as C}from"../api.js";import{useText as S}from"@dropins/tools/i18n.js";import"../fragments.js";import"@dropins/tools/fetch-graphql.js";const U=({initialData:u=null,scope:e,onValue:a,children:F,...o})=>{const l=S("PDP.Product.Incrementer.label").label,[c,f]=s(u),[i,d]=s(()=>q(1));y(()=>{const r=m.on("pdp/data",f,{scope:e}),t=m.on("pdp/values",({quantity:n})=>{d(n)},{eager:!0,scope:e});return()=>{r==null||r.off(),t==null||t.off()}},[e]);const p=r=>{const t=parseInt(r,10);D(g=>({...g,quantity:t}),{scope:e});const{persistURLParams:n}=h.getConfig()??{};n&&x({quantity:t}),a==null||a(t)};return c?P(b,{name:"quantity",defaultValue:String(i),value:String(i),min:1,"aria-label":l,onValue:p,...o,className:I(["pdp-quantity",o.className])},"quantity"):null};U.getInitialData=C;export{U as ProductQuantity,U as default};
4
4
  //# sourceMappingURL=ProductQuantity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProductQuantity.js","sources":["/@dropins/storefront-pdp/src/containers/ProductQuantity/ProductQuantity.tsx"],"sourcesContent":["/**\n * ADOBE CONFIDENTIAL\n * __________________\n * Copyright 2024 Adobe\n * All Rights Reserved.\n * __________________\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n */\n\nimport { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { classes, Container } from '@adobe-commerce/elsie/lib';\nimport { Incrementer } from '@adobe-commerce/elsie/components';\nimport { events } from '@adobe-commerce/event-bus';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { ProductModel } from '@/pdp/data/models';\nimport {\n setProductConfigurationValues,\n getFetchedProductData,\n} from '@/pdp/api';\nimport {\n setUrlParams,\n getValidatedQuantityFromUrl,\n} from '@/pdp/lib/url-params';\nimport { config } from '@/pdp/api/initialize';\n\nexport interface ProductQuantityProps extends HTMLAttributes<HTMLDivElement> {\n scope?: string;\n onValue?: (quantity: number) => void;\n}\n\nexport const ProductQuantity: Container<\n ProductQuantityProps,\n ProductModel | null\n> = ({ initialData = null, scope, onValue, children, ...props }) => {\n const IncrementerLabel = useText('PDP.Product.Incrementer.label').label;\n\n const [data, setData] = useState<ProductModel | null>(initialData);\n\n const [current, setCurrent] = useState(() => getValidatedQuantityFromUrl(1)); // Default quantity to 1\n\n useEffect(() => {\n const dataEvent = events.on('pdp/data', setData, { scope });\n\n const valuesEvent = events.on(\n 'pdp/values',\n ({ quantity }) => {\n setCurrent(quantity);\n },\n { eager: true, scope }\n );\n\n return () => {\n dataEvent?.off();\n valuesEvent?.off();\n };\n }, [scope]);\n\n const handleOnValue = (value: string) => {\n const quantity = parseInt(value, 10);\n setProductConfigurationValues((prev) => ({ ...prev, quantity }), { scope });\n\n // Update URL parameters if persistURLParams is enabled\n const { persistURLParams } = config.getConfig() ?? {};\n if (persistURLParams) {\n setUrlParams({ quantity });\n }\n\n onValue?.(quantity);\n };\n\n if (!data) return null;\n\n // Bundle child quantities are configured per option value in ProductOptions/Swatches.\n if (data.isBundle) return null;\n\n return (\n <Incrementer\n key=\"quantity\"\n name=\"quantity\"\n defaultValue={String(current)}\n value={String(current)}\n min={1}\n aria-label={IncrementerLabel}\n onValue={handleOnValue}\n {...props}\n className={classes(['pdp-quantity', props.className])}\n />\n );\n};\n\nProductQuantity.getInitialData = getFetchedProductData;\n"],"names":["ProductQuantity","initialData","scope","onValue","children","props","IncrementerLabel","useText","data","setData","useState","current","setCurrent","getValidatedQuantityFromUrl","useEffect","dataEvent","events","valuesEvent","quantity","handleOnValue","value","setProductConfigurationValues","prev","persistURLParams","config","setUrlParams","jsx","Incrementer","classes","getFetchedProductData"],"mappings":"qgBAqCO,MAAMA,EAGT,CAAC,CAAE,YAAAC,EAAc,KAAM,MAAAC,EAAO,QAAAC,EAAS,SAAAC,EAAU,GAAGC,KAAY,CAClE,MAAMC,EAAmBC,EAAQ,+BAA+B,EAAE,MAE5D,CAACC,EAAMC,CAAO,EAAIC,EAA8BT,CAAW,EAE3D,CAACU,EAASC,CAAU,EAAIF,EAAS,IAAMG,EAA4B,CAAC,CAAC,EAE3EC,EAAU,IAAM,CACd,MAAMC,EAAYC,EAAO,GAAG,WAAYP,EAAS,CAAE,MAAAP,EAAO,EAEpDe,EAAcD,EAAO,GACzB,aACA,CAAC,CAAE,SAAAE,CAAA,IAAe,CAChBN,EAAWM,CAAQ,CACrB,EACA,CAAE,MAAO,GAAM,MAAAhB,CAAA,CAAM,EAGvB,MAAO,IAAM,CACXa,GAAA,MAAAA,EAAW,MACXE,GAAA,MAAAA,EAAa,KACf,CACF,EAAG,CAACf,CAAK,CAAC,EAEV,MAAMiB,EAAiBC,GAAkB,CACvC,MAAMF,EAAW,SAASE,EAAO,EAAE,EACnCC,EAA+BC,IAAU,CAAE,GAAGA,EAAM,SAAAJ,IAAa,CAAE,MAAAhB,EAAO,EAG1E,KAAM,CAAE,iBAAAqB,CAAA,EAAqBC,EAAO,UAAA,GAAe,CAAA,EAC/CD,GACFE,EAAa,CAAE,SAAAP,EAAU,EAG3Bf,GAAA,MAAAA,EAAUe,EACZ,EAKA,MAHI,CAACV,GAGDA,EAAK,SAAiB,KAGxBkB,EAACC,EAAA,CAEC,KAAK,WACL,aAAc,OAAOhB,CAAO,EAC5B,MAAO,OAAOA,CAAO,EACrB,IAAK,EACL,aAAYL,EACZ,QAASa,EACR,GAAGd,EACJ,UAAWuB,EAAQ,CAAC,eAAgBvB,EAAM,SAAS,CAAC,CAAA,EARhD,UAAA,CAWV,EAEAL,EAAgB,eAAiB6B"}
1
+ {"version":3,"file":"ProductQuantity.js","sources":["/@dropins/storefront-pdp/src/containers/ProductQuantity/ProductQuantity.tsx"],"sourcesContent":["/**\n * ADOBE CONFIDENTIAL\n * __________________\n * Copyright 2024 Adobe\n * All Rights Reserved.\n * __________________\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n */\n\nimport { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { classes, Container } from '@adobe-commerce/elsie/lib';\nimport { Incrementer } from '@adobe-commerce/elsie/components';\nimport { events } from '@adobe-commerce/event-bus';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { ProductModel } from '@/pdp/data/models';\nimport {\n setProductConfigurationValues,\n getFetchedProductData,\n} from '@/pdp/api';\nimport {\n setUrlParams,\n getValidatedQuantityFromUrl,\n} from '@/pdp/lib/url-params';\nimport { config } from '@/pdp/api/initialize';\n\nexport interface ProductQuantityProps extends HTMLAttributes<HTMLDivElement> {\n scope?: string;\n onValue?: (quantity: number) => void;\n}\n\nexport const ProductQuantity: Container<\n ProductQuantityProps,\n ProductModel | null\n> = ({ initialData = null, scope, onValue, children, ...props }) => {\n const IncrementerLabel = useText('PDP.Product.Incrementer.label').label;\n\n const [data, setData] = useState<ProductModel | null>(initialData);\n\n const [current, setCurrent] = useState(() => getValidatedQuantityFromUrl(1)); // Default quantity to 1\n\n useEffect(() => {\n const dataEvent = events.on('pdp/data', setData, { scope });\n\n const valuesEvent = events.on(\n 'pdp/values',\n ({ quantity }) => {\n setCurrent(quantity);\n },\n { eager: true, scope }\n );\n\n return () => {\n dataEvent?.off();\n valuesEvent?.off();\n };\n }, [scope]);\n\n const handleOnValue = (value: string) => {\n const quantity = parseInt(value, 10);\n setProductConfigurationValues((prev) => ({ ...prev, quantity }), { scope });\n\n // Update URL parameters if persistURLParams is enabled\n const { persistURLParams } = config.getConfig() ?? {};\n if (persistURLParams) {\n setUrlParams({ quantity });\n }\n\n onValue?.(quantity);\n };\n\n if (!data) return null;\n\n return (\n <Incrementer\n key=\"quantity\"\n name=\"quantity\"\n defaultValue={String(current)}\n value={String(current)}\n min={1}\n aria-label={IncrementerLabel}\n onValue={handleOnValue}\n {...props}\n className={classes(['pdp-quantity', props.className])}\n />\n );\n};\n\nProductQuantity.getInitialData = getFetchedProductData;\n"],"names":["ProductQuantity","initialData","scope","onValue","children","props","IncrementerLabel","useText","data","setData","useState","current","setCurrent","getValidatedQuantityFromUrl","useEffect","dataEvent","events","valuesEvent","quantity","handleOnValue","value","setProductConfigurationValues","prev","persistURLParams","config","setUrlParams","jsx","Incrementer","classes","getFetchedProductData"],"mappings":"qgBAqCO,MAAMA,EAGT,CAAC,CAAE,YAAAC,EAAc,KAAM,MAAAC,EAAO,QAAAC,EAAS,SAAAC,EAAU,GAAGC,KAAY,CAClE,MAAMC,EAAmBC,EAAQ,+BAA+B,EAAE,MAE5D,CAACC,EAAMC,CAAO,EAAIC,EAA8BT,CAAW,EAE3D,CAACU,EAASC,CAAU,EAAIF,EAAS,IAAMG,EAA4B,CAAC,CAAC,EAE3EC,EAAU,IAAM,CACd,MAAMC,EAAYC,EAAO,GAAG,WAAYP,EAAS,CAAE,MAAAP,EAAO,EAEpDe,EAAcD,EAAO,GACzB,aACA,CAAC,CAAE,SAAAE,CAAA,IAAe,CAChBN,EAAWM,CAAQ,CACrB,EACA,CAAE,MAAO,GAAM,MAAAhB,CAAA,CAAM,EAGvB,MAAO,IAAM,CACXa,GAAA,MAAAA,EAAW,MACXE,GAAA,MAAAA,EAAa,KACf,CACF,EAAG,CAACf,CAAK,CAAC,EAEV,MAAMiB,EAAiBC,GAAkB,CACvC,MAAMF,EAAW,SAASE,EAAO,EAAE,EACnCC,EAA+BC,IAAU,CAAE,GAAGA,EAAM,SAAAJ,IAAa,CAAE,MAAAhB,EAAO,EAG1E,KAAM,CAAE,iBAAAqB,CAAA,EAAqBC,EAAO,UAAA,GAAe,CAAA,EAC/CD,GACFE,EAAa,CAAE,SAAAP,EAAU,EAG3Bf,GAAA,MAAAA,EAAUe,EACZ,EAEA,OAAKV,EAGHkB,EAACC,EAAA,CAEC,KAAK,WACL,aAAc,OAAOhB,CAAO,EAC5B,MAAO,OAAOA,CAAO,EACrB,IAAK,EACL,aAAYL,EACZ,QAASa,EACR,GAAGd,EACJ,UAAWuB,EAAQ,CAAC,eAAgBvB,EAAM,SAAS,CAAC,CAAA,EARhD,UAAA,EAJU,IAepB,EAEAL,EAAgB,eAAiB6B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dropins/storefront-pdp",
3
- "version": "3.3.0-beta.1",
3
+ "version": "3.3.1-alpha-20260730090417",
4
4
  "@dropins/tools": "~1.9.0",
5
5
  "license": "SEE LICENSE IN LICENSE.md"
6
6
  }