PageSourceSearch

https://adobestore.shop/scripts/__dropins__/storefront-pdp/containers/ProductOptions.js

js adobestore.shop collected 2026-10-02 02:09:35 UTC 3,043 bytes, 4 lines download raw bytes

1/*! Copyright 2025 Adobe
2All Rights Reserved. */
3import{jsx as d}from"@dropins/tools/preact-jsx-runtime.js";import{useState as h,useEffect as z,useCallback as j}from"@dropins/tools/preact-compat.js";import{Slot as C}from"@dropins/tools/lib.js";import{events as S}from"@dropins/tools/event-bus.js";import"@dropins/tools/components.js";/* empty css             */import{S as A}from"../chunks/Swatches.js";import"@dropins/tools/preact.js";import"@dropins/tools/preact-hooks.js";/* empty css                       */import{c as v,l as G,j as H,p as J}from"../chunks/fetchProductData.js";import{g as O,s as b,a as y}from"../chunks/isProductConfigurationValid.js";import{g as K}from"../chunks/getFetchedProductData.js";import"@dropins/tools/i18n.js";import"../fragments.js";import"@dropins/tools/fetch-graphql.js";const Q=({initialData:s={data:null,optionsUIDs:[]},scope:i,hideSelectedValue:l=!1,slots:n,onValues:u,onErrors:m,children:V,...B})=>{var I;const[t,T]=h(s.data),[p,F]=h(s.optionsUIDs),[M,L]=h();z(()=>{const o=S.on("pdp/data",T,{scope:i}),c=S.on("pdp/values",({optionsUIDs:f})=>{f&&F(f)},{scope:i});return()=>{o==null||o.off(),c==null||c.off()}},[]);const N=j(async o=>{var U,w,D,k;if(!(t!=null&&t.sku))return;const{persistURLParams:c,anchors:f,acdl:q}=v.getConfig()??{};let a=Object.keys(o).map(r=>o[r].value).filter(r=>r!==void 0);c&&!(t!=null&&t.isBundle)&&G({optionsUIDs:a.join(",")}),((w=(U=O({scope:i}))==null?void 0:U.optionsUIDs)==null?void 0:w.join("|"))!==(a==null?void 0:a.join("|"))&&b(r=>({...r,optionsUIDs:a}),{scope:i}),u==null||u(a);const e=await H(t.sku,{optionsUIDs:a??[],isBundle:t==null?void 0:t.isBundle,anchors:f});S.emit("pdp/data",e,{scope:i});let P=(a==null?void 0:a.length)===((D=e==null?void 0:e.options)==null?void 0:D.length);if(f!=null&&f.length){const r=(e==null?void 0:e.optionUIDs)??[];a.every(g=>r.includes(g))||(L(e==null?void 0:e.options),b(g=>({...g,optionsUIDs:r}),{scope:i}),P=(r==null?void 0:r.length)===((k=e==null?void 0:e.options)==null?void 0:k.length))}y(()=>P,{scope:i}),q&&e&&(e==null?void 0:e.variantSku)!==t.sku&&J(e)},[t==null?void 0:t.isBundle,t==null?void 0:t.sku,u,i]),R=j(o=>{Object.keys(o).length!==0&&(y(()=>!1,{scope:i}),m==null||m(o))},[m,i]);return!t||!t.options?null:d(C,{name:"Swatches",slot:n==null?void 0:n.Swatches,context:{data:t,optionsUIDs:p},children:d(A,{...B,options:t.options,selectedUIDs:p,defaultOptions:p,selectionsToUpdate:M,hideSelectedValue:l,disablePreselections:!((I=v.getConfig())!=null&&I.preselectFirstOption),onValues:N,onErrors:R,imageSwatchNode:n!=null&&n.SwatchImage?({imageSwatchContext:o,...c})=>d(C,{name:"SwatchImage",slot:n==null?void 0:n.SwatchImage,slotTag:"span",contentTag:"span",context:{data:t,optionsUIDs:p,defaultImageProps:c,imageSwatchContext:o}}):void 0})})};Q.getInitialData=async function(s){var n;const i=await K({scope:s==null?void 0:s.scope}),l=((n=O({scope:s==null?void 0:s.scope}))==null?void 0:n.optionsUIDs)??[];return{data:i,optionsUIDs:l}};export{Q as ProductOptions,Q as default};
4//# sourceMappingURL=ProductOptions.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.