@dropins/storefront-pdp 1.4.0-beta1 → 3.0.0-beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
Last Updated:
|
|
1
|
+
Last Updated: 8 December 2025
|
|
2
2
|
|
|
3
|
-
ADOBE COMMERCE DROP-IN LICENSE AGREEMENT
|
|
3
|
+
**ADOBE COMMERCE DROP-IN LICENSE AGREEMENT**
|
|
4
4
|
|
|
5
|
-
applicable to Adobe Commerce Customers
|
|
5
|
+
applicable to Adobe Commerce as a Cloud Service and Adobe Commerce Optimizer Customers
|
|
6
6
|
|
|
7
7
|
**Effective Date:** first date you download or use the Drop-in
|
|
8
8
|
|
|
9
|
-
NOTICE TO USER: The Adobe Commerce Drop-in (
|
|
9
|
+
NOTICE TO USER: The Adobe Commerce Drop-ins are licensed only for use with Adobe Commerce as a Cloud Service and Adobe Commerce Optimizer. The Adobe Commerce Drop-in ("Drop-in") is licensed to you subject to the terms and conditions below which form a binding agreement between you and Adobe. **By downloading, installing, or making use of any portion of the Drop-in, you are agreeing to the following terms and conditions. If you do not agree to the terms and conditions below, do not use the Drop-in**. If you agree to be bound by this agreement on behalf of your employer or other entity, you must have the legal authority to do so. If you are not authorized to so bind your employer or such entity, do not download and do not use the Drop-in.
|
|
10
10
|
|
|
11
11
|
Your access to and use of the Drop-in is governed by the Adobe Enterprise Licensing Terms previously agreed to by you and Adobe or an authorized Adobe Reseller in a separate agreement. If you have not previously agreed to licensing terms then your installation and use of the Drop-in is subject to the current applicable Adobe Enterprise Licensing Terms available at <http://www.adobe.com/legal/terms/enterprise-licensing.html>. You agree that this agreement will have the same effect as any written negotiated agreement signed by you.
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ By downloading, installing or making use of any portion of the Drop-in, you acce
|
|
|
14
14
|
|
|
15
15
|
This agreement is enforceable against any person or entity that installs and uses the Drop-in and any person or entity (e.g., system integrator, consultant or contractor) that installs or uses the drop-in on another person's or entity's behalf (e.g., Adobe Customer).
|
|
16
16
|
|
|
17
|
-
Notice to U.S. Government End Users: Products and services are
|
|
17
|
+
Notice to U.S. Government End Users: Products and services are "Commercial Product(s)," and "Commercial Service(s)" as those terms are defined at 48 C.F.R. section 2.101, consisting of "Commercial Computer Software" and "Commercial Computer Software Documentation," as the terms are used in 48 C.F.R. section 12.212 or 48 C.F.R. section 227.7202, as applicable. Customer agrees, consistent with 48 C.F.R. section 12.212 or 48 C.F.R. sections 227.7202-1 through 227.72024, as applicable, the Commercial Computer Software and Commercial Computer Software Documentation are being licensed to U.S. Government end users (A) only as Commercial Products and Services; and (B) with only those rights as are granted to all other end users pursuant to the terms and conditions herein. Unpublished rights are reserved under the copyright laws of the United States.
|
|
18
18
|
|
|
19
19
|
**ADOBE COMMERCE DROP-IN LICENSE AGREEMENT**
|
|
20
20
|
|
|
@@ -22,21 +22,21 @@ applicable to Developers
|
|
|
22
22
|
|
|
23
23
|
**Effective Date:** first date you download or use the Drop-in
|
|
24
24
|
|
|
25
|
-
The Adobe Commerce Drop-in (
|
|
25
|
+
The Adobe Commerce Drop-ins are licensed only for use with Adobe Commerce as a Cloud Service and Adobe Commerce Optimizer. The Adobe Commerce Drop-in ("Drop-in") is licensed to you subject to the terms and conditions below which form a binding agreement between you and Adobe. **By downloading, installing, or making use of any portion of the Drop-in, you are agreeing to the following terms and conditions. If you do not agree to the terms and conditions below, do not use the Drop-in**. If you agree to be bound by this agreement on behalf of your employer or other entity, you must have the legal authority to do so. If you are not authorized to so bind your employer or such entity, do not download and do not use the Drop-in.
|
|
26
26
|
|
|
27
27
|
**AGREED TERMS AND CONDITIONS**
|
|
28
28
|
|
|
29
29
|
1. **DEFINITIONS**.
|
|
30
30
|
|
|
31
|
-
1.1
|
|
31
|
+
1.1 "**Adobe**" means collectively, Adobe Inc., a company incorporated in Delaware, U.S.A., having a place of business at 345 Park Avenue, San Jose, California USA 95110-2704, U.S.A. ("**Adobe US**") and Adobe Systems Software Ireland, company incorporated in Ireland, having a place of business 4-6 Riverwalk, City West Business Campus, Saggart, Dublin 24, Ireland ("**Adobe Ireland**").
|
|
32
32
|
|
|
33
|
-
1.2
|
|
33
|
+
1.2 "**Adobe Product(s)**" means software applications, programs and other technologies not included in or with the Drop-in which are or may be made available by Adobe for licensing to the general public. This agreement does not govern use of Adobe Products. See the end user license agreement accompanying an Adobe Product for terms governing its use.
|
|
34
34
|
|
|
35
|
-
1.3
|
|
35
|
+
1.3 "**Developer Product(s)**" means any software application(s), program(s) and other technolog(y/ies) you develop with use of the Drop-in to function or interoperate with Adobe Products.
|
|
36
36
|
|
|
37
|
-
1.4
|
|
37
|
+
1.4 "**Intellectual Property Rights**" means copyright, moral rights, trademark, trade dress, patent, trade secret, unfair competition, and any other intellectual and proprietary rights.
|
|
38
38
|
|
|
39
|
-
1.5
|
|
39
|
+
1.5 "**Adobe Commerce Drop-in**" or "Drop-in" means all items comprising the application and all associated materials licensed to you by Adobe as part of the Drop-in, including all Drop-in system files, tools, programs and utilities, as well as any plug-ins or other application programming interfaces, header or JAR files ("**API**"), sample images, sounds, or similar assets ("**Content** **Files**"), software code samples, runtimes and libraries, including any portion(s) that is modified by you, or merged or incorporated with your Developer Products ("**Sample Code**"), and any related documentation, technical specifications, notes and explanatory materials, as well any modifications, updates, upgrades, or copies of, any of the foregoing items, that may be made available by Adobe, whether online or recorded on media, or manually downloaded by you.
|
|
40
40
|
|
|
41
41
|
2. **LICENSES GRANTED TO YOU**.
|
|
42
42
|
|
|
@@ -50,23 +50,23 @@ The Adobe Commerce Drop-in (“Drop-in”) is licensed to you subject to the ter
|
|
|
50
50
|
|
|
51
51
|
3. **SCOPE OF LICENSE; LIMITATIONS AND RESTRICTIONS**
|
|
52
52
|
|
|
53
|
-
3.1 You may not distribute the Drop-ins or any of its component parts to interoperate with or to run on a platform other than
|
|
53
|
+
3.1 You may not distribute the Drop-ins or any of its component parts to interoperate with or to run on a platform other than Adobe Commerce as a Cloud Service and Adobe Commerce Optimizer.
|
|
54
54
|
|
|
55
55
|
3.2 Third-Party Software. The Drop-ins may contain third-party software, subject to additional terms and conditions, available at <http://www.adobe.com/go/thirdparty>; and
|
|
56
56
|
|
|
57
|
-
3.3 You may not modify, port, adapt,
|
|
57
|
+
3.3 You may not modify, port, adapt, create derivate works, redistribute, or translate any portion of this Drop-in; or add or delete any Drop-in program files that would in any way result in modifying the functionality or appearance of any element of the Adobe Products.
|
|
58
58
|
|
|
59
|
-
3.4 You may not reverse engineer, decompile, disassemble, or otherwise attempt to discover the source code of, any portion of the Drop-in, except and only to the extent that applicable laws of the jurisdiction where you are located grant you the right to decompile the Drop-in in order to obtain information necessary to render the Drop-in interoperable with other software; in which case you must first request the information from Adobe in writing and Adobe may, in its discretion, either provide such information to you or impose reasonable conditions, including reasonable fees, on your use of the Drop-in to ensure that Adobe
|
|
59
|
+
3.4 You may not reverse engineer, decompile, disassemble, or otherwise attempt to discover the source code of, any portion of the Drop-in, except and only to the extent that applicable laws of the jurisdiction where you are located grant you the right to decompile the Drop-in in order to obtain information necessary to render the Drop-in interoperable with other software; in which case you must first request the information from Adobe in writing and Adobe may, in its discretion, either provide such information to you or impose reasonable conditions, including reasonable fees, on your use of the Drop-in to ensure that Adobe's and its licensors' Intellectual Proprietary Rights in the Drop-in are protected.
|
|
60
60
|
|
|
61
|
-
3.5 You may not unbundle, repackage, distribute, rent, lease, offer, sell, resale, sublicense, assign or transfer all, or any component parts of the Drop-in, or any of your rights in the Drop-in, nor authorize any portion of the Drop-in to be copied onto another
|
|
61
|
+
3.5 You may not unbundle, repackage, distribute, rent, lease, offer, sell, resale, sublicense, assign or transfer all, or any component parts of the Drop-in, or any of your rights in the Drop-in, nor authorize any portion of the Drop-in to be copied onto another's device, computer or platform, including on a service bureau basis to other providers (i.e., volume printing, banking, payroll service providers, etc) who provide you free or fee-based business services.
|
|
62
62
|
|
|
63
63
|
4. **VIRAL OPEN SOURCE SOFTWARE AND SERVICES**
|
|
64
64
|
|
|
65
|
-
You are not
|
|
65
|
+
You are not licensed to (and you agree that you will not) merge, integrate or use the Drop-in with any Viral Open Source Software or Viral Service, or otherwise take any action that could require disclosure, distribution, or licensing of all or any part of the Drop-in in source code form for any purpose whatsoever. For purposes of this Section, "**Viral Open Source Software**" means software licensed under the GNU General Public License, the GNU Affero General Public License (AGPL), the GNU Lesser General Public License (LGPL), or any other license terms that would require, or condition your use, modification, or distribution of such licensed software on the disclosure, distribution, or licensing of any other software in source code form, for the purpose of making derivative works, or at no charge, and "**Viral Service**" means any service that contains any viruses, Trojan horses, worms, time bombs, cancelbots or other computer programming routines that are intended to damage, detrimentally interfere with, surreptitiously intercept, expropriate or deprive owners' possession of any system, data or personal information, or that in any way violates any law, statute, ordinance, regulation or rights (including any law, regulations or rights respecting intellectual property, computer spyware, privacy, export control, unfair competition, antidiscrimination or false advertising), or otherwise interferes with the operability of Adobe Products or third-party programs or software.
|
|
66
66
|
|
|
67
67
|
5. **NON-BLOCKING OF ADOBE DEVELOPMENT**
|
|
68
68
|
|
|
69
|
-
You acknowledge that Adobe is currently developing or may develop technologies and Adobe Products in the future that have, or may have, design or functionality similar to Developer Products that you may develop based on the license granted to you in this agreement. Nothing in this agreement will impair, limit or curtail Adobe
|
|
69
|
+
You acknowledge that Adobe is currently developing or may develop technologies and Adobe Products in the future that have, or may have, design or functionality similar to Developer Products that you may develop based on the license granted to you in this agreement. Nothing in this agreement will impair, limit or curtail Adobe's right to continue with its development, maintenance or distribution of Adobe Products. You agree that you will not assert in any way any patent owned by you arising out of or in connection with your use of the Drop-in, or any Drop-in modifications made by you, against Adobe, its customers, subsidiaries or affiliates, or any of their customers, direct or indirect, agents and contractors for the manufacture, use, import, license, offer for sale, or sale of any Adobe Products.
|
|
70
70
|
|
|
71
71
|
6. **OWNERSHIP; INTELLECTUAL PROPERTY RIGHTS**
|
|
72
72
|
|
|
@@ -74,13 +74,13 @@ The Adobe Commerce Drop-in (“Drop-in”) is licensed to you subject to the ter
|
|
|
74
74
|
|
|
75
75
|
6.2 The Drop-in, or any of its component parts, may be supplied to you with certain accompanying proprietary notices, including patent, copyright and trademark notices. You agree to protect all copyright and other ownership interests of Adobe and its licensors in the Drop-in supplied to you under this agreement; to preserve exactly (and not remove or alter) all proprietary notices displayed in or on the Drop-in; to reproduce the same proprietary notices in all copies you make of any portion of the Drop-in.
|
|
76
76
|
|
|
77
|
-
6.3 You agree to include in your Developer Products Adobe
|
|
77
|
+
6.3 You agree to include in your Developer Products Adobe's copyright notices, wherever such notices are customarily posted, in substantially the following form: _Portions of software used to develop this product copyrighted by Adobe and its licensors. All Rights Reserved_.
|
|
78
78
|
|
|
79
79
|
6.4 Nothing in this agreement gives you a right to use the name, logo or trademarks of Adobe or its licensors to market your Developer Products.
|
|
80
80
|
|
|
81
81
|
7. **CONFIDENTIAL INFORMATION**
|
|
82
82
|
|
|
83
|
-
With respect to the API, and any portion, included in the Drop-in (for purposes of this Section,
|
|
83
|
+
With respect to the API, and any portion, included in the Drop-in (for purposes of this Section, "**Adobe Confidential Information**"), you will treat the Adobe Confidential Information, and exercise the same degree of care to protect it, as you afford to your own confidential information. Your obligations under this Section will terminate when you can document that (a) the Adobe Confidential Information was in the public domain at or subsequent to the time Adobe communicated or provided it to you with no fault of your own; (b) your employees or agents developed independently without reference to any Adobe Confidential Information Adobe communicated or provided to you; or (c) your communication of Adobe Confidential Information was in response to a valid order by a court or other governmental body, was otherwise required by law, or was necessary to establish the rights of a party under this agreement.
|
|
84
84
|
|
|
85
85
|
8. **TERM; TERMINATION**
|
|
86
86
|
|
|
@@ -90,13 +90,13 @@ The Adobe Commerce Drop-in (“Drop-in”) is licensed to you subject to the ter
|
|
|
90
90
|
|
|
91
91
|
You expressly understand and agree that, to the maximum extent permitted by applicable law:
|
|
92
92
|
|
|
93
|
-
9.1 **Use
|
|
93
|
+
9.1 **Use of the DROP-IN is entirely at your own risk. The Drop-in is provided by Adobe "AS-IS" and with all faults. Adobe and its licensors are not liable to you or anyone else for any special, incidental, indirect, consequential, or punitive damages whatsoever (even if Adobe has been advised of the possibility of such damages), including (a) damages resulting from loss of use, data, or profits, whether or not foreseeable, (b) damages based on any theory of liability, including breach of contract or warranty, negligence or other tortious action, or (c) damages arising from any other claim arising out of or in connection with your use of the Drop-in.**
|
|
94
94
|
|
|
95
|
-
9.2 **Adobe
|
|
95
|
+
9.2 **Adobe's total liability in any matter arising out of or related to these terms is limited to US $100. This limitation will apply even if Adobe has been advised of the possibility of such damages and regardless of any failure of the essential purpose of any limited remedy.**
|
|
96
96
|
|
|
97
97
|
10. **INDEMNIFICATION**
|
|
98
98
|
|
|
99
|
-
To the maximum extent permitted by law, you agree to indemnify Adobe, its subsidiaries, affiliates, officers, agents, employees, partners, licensors, or suppliers from any claim or demand, including reasonable attorneys
|
|
99
|
+
To the maximum extent permitted by law, you agree to indemnify Adobe, its subsidiaries, affiliates, officers, agents, employees, partners, licensors, or suppliers from any claim or demand, including reasonable attorneys' fees, that arise from the use and distribution of your Developer Products that contain or are based upon any portion of the Drop-in, or from your violation of the terms of this agreement.
|
|
100
100
|
|
|
101
101
|
11. **DISPUTE RESOLUTION**
|
|
102
102
|
|
|
@@ -104,7 +104,7 @@ The Adobe Commerce Drop-in (“Drop-in”) is licensed to you subject to the ter
|
|
|
104
104
|
|
|
105
105
|
11.2 **Venue.** You agree that any claim or dispute you may have against Adobe must be resolved by a court located in Santa Clara County, California, United States of America. You agree to submit to the personal jurisdiction of the courts located in Santa Clara County, California, United States of America when the laws of California apply, and the courts of Dublin, Ireland, when the laws of Ireland applies, for the purpose of litigating such claims or disputes. The parties specifically disclaim the U.N. Convention on Contracts for the International Sale of Goods.
|
|
106
106
|
|
|
107
|
-
11.3 **Injunctive Relief.** Notwithstanding the foregoing, in the event of your or others
|
|
107
|
+
11.3 **Injunctive Relief.** Notwithstanding the foregoing, in the event of your or others' unauthorized access to or use of the Drop-in in violation of this Agreement, you agree that Adobe is entitled to apply for injunctive remedies (or an equivalent type of urgent legal relief) in any jurisdiction.
|
|
108
108
|
|
|
109
109
|
12. **EXPORT RULES**
|
|
110
110
|
|
|
@@ -112,7 +112,7 @@ The Adobe Commerce Drop-in (“Drop-in”) is licensed to you subject to the ter
|
|
|
112
112
|
|
|
113
113
|
13. **NOTICE TO U.S. GOVERNMENT END USERS**
|
|
114
114
|
|
|
115
|
-
Products and services are
|
|
115
|
+
Products and services are "Commercial Product(s)," and "Commercial Service(s)" as those terms are defined at 48 C.F.R. section 2.101, consisting of "Commercial Computer Software" and "Commercial Computer Software Documentation," as the terms are used in 48 C.F.R. section 12.212 or 48 C.F.R. section 227.7202, as applicable. Customer agrees, consistent with 48 C.F.R. section 12.212 or 48 C.F.R. sections 227.7202-1 through 227.72024, as applicable, the Commercial Computer Software and Commercial Computer Software Documentation are being licensed to U.S. Government end users (A) only as Commercial Products and Services; and (B) with only those rights as are granted to all other end users pursuant to the terms and conditions herein. Unpublished rights are reserved under the copyright laws of the United States.
|
|
116
116
|
|
|
117
117
|
14. **GENERAL PROVISIONS**
|
|
118
118
|
|
|
@@ -124,4 +124,4 @@ The Adobe Commerce Drop-in (“Drop-in”) is licensed to you subject to the ter
|
|
|
124
124
|
|
|
125
125
|
14.4 **Entire Agreement.** This Agreement is the entire agreement, superseding any prior written or oral agreements, between you and Adobe relating to the Drop-in.
|
|
126
126
|
|
|
127
|
-
Adobe Commerce Drop-in License Agreement_en_US-
|
|
127
|
+
Adobe Commerce Drop-in License Agreement_en_US-20251208_v1
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{merge as fe,Initializer as Pe}from"@dropins/tools/lib.js";import{events as q}from"@dropins/tools/event-bus.js";import{PRODUCT_FRAGMENT as se}from"../fragments.js";import{FetchGraphQL as de}from"@dropins/tools/fetch-graphql.js";import{s as ye,a as he}from"./isProductConfigurationValid.js";function je(e){const r=new URLSearchParams(window.location.search);Object.entries(e).forEach(([n,t])=>{t===null?r.delete(n):r.set(n,String(t))});let i=window.location.pathname;i+=`?${r.toString()}`,i+=window.location.hash,window.history.replaceState({},"",i)}function ae(){const e=new URLSearchParams(window.location.search),r={};return e.forEach((i,n)=>{r[n]=i}),r}function ge(e=1){const i=(ae()||{}).quantity;if(i){const n=parseInt(i,10);if(!isNaN(n)&&Number.isInteger(n)&&n>0)return n}return e}function we(e){var r,i,n,t,a,s,l,o,m,u,c,f;return{productId:Number(e==null?void 0:e.externalId),name:e==null?void 0:e.name,sku:(e==null?void 0:e.variantSku)||(e==null?void 0:e.sku),topLevelSku:e==null?void 0:e.sku,specialToDate:void 0,specialFromDate:void 0,newToDate:void 0,newFromDate:void 0,createdAt:void 0,updatedAt:void 0,manufacturer:void 0,countryOfManufacture:void 0,categories:void 0,productType:e==null?void 0:e.productType,pricing:{regularPrice:((i=(r=e==null?void 0:e.prices)==null?void 0:r.regular)==null?void 0:i.amount)||0,minimalPrice:(t=(n=e==null?void 0:e.prices)==null?void 0:n.final)==null?void 0:t.minimumAmount,maximalPrice:(s=(a=e==null?void 0:e.prices)==null?void 0:a.final)==null?void 0:s.maximumAmount,specialPrice:(o=(l=e==null?void 0:e.prices)==null?void 0:l.final)==null?void 0:o.amount,tierPricing:void 0,currencyCode:((u=(m=e==null?void 0:e.prices)==null?void 0:m.final)==null?void 0:u.currency)||"USD"},canonicalUrl:e==null?void 0:e.url,mainImageUrl:(f=(c=e==null?void 0:e.images)==null?void 0:c[0])==null?void 0:f.url}}const oe={PRODUCT_CONTEXT:"productContext",CHANNEL_CONTEXT:"channelContext"},Ce={PRODUCT_PAGE_VIEW:"product-page-view"};function ue(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function xe(){return{_id:"https://ns.adobe.com/xdm/channels/web",_type:"https://ns.adobe.com/xdm/channel-types/web"}}function le(e,r){const i=ue();i.push({[e]:null}),i.push({[e]:r})}function De(){typeof window>"u"||le(oe.CHANNEL_CONTEXT,xe())}function Te(e,r){ue().push(n=>{const t=n.getState?n.getState():{};n.push({event:e,eventInfo:{...t,...r}})})}function Oe(e){const r=we(e);le(oe.PRODUCT_CONTEXT,r),De(),Te(Ce.PRODUCT_PAGE_VIEW)}var H=(e=>(e.ComplexProduct="complex",e.SimpleProduct="simple",e))(H||{}),me=(e=>(e.ComplexProductView="ComplexProductView",e.SimpleProductView="SimpleProductView",e))(me||{});function K(e,r){var s,l,o,m,u,c,f,g,w,T,y,A;const i=((m=(o=(l=(s=e==null?void 0:e.options)==null?void 0:s[0])==null?void 0:l.values)==null?void 0:o[0])==null?void 0:m.__typename)==="ProductViewOptionValueProduct",n=be(e,i,r==null?void 0:r.preselectFirstOption),t=(e==null?void 0:e.__typename)===me.SimpleProductView?H.SimpleProduct:H.ComplexProduct,a=e?{name:e.name,sku:e.sku,isBundle:i,addToCartAllowed:e.addToCartAllowed,inStock:e.inStock,shortDescription:e.shortDescription,metaDescription:e.metaDescription,metaKeyword:e.metaKeyword,metaTitle:e.metaTitle,description:e.description,images:Ee(e),prices:Ae(e,i,n),attributes:Se(e),options:_e(e,i),optionUIDs:n,url:e.url,urlKey:e.urlKey,externalId:e.externalId,externalParentId:e.externalParentId,variantSku:e.variantSku,productType:t}:null;return fe(a,((g=(f=(c=(u=k.getConfig())==null?void 0:u.models)==null?void 0:c.ProductDetails)==null?void 0:f.transformer)==null?void 0:g.call(f,e))??((A=(y=(T=(w=k.getConfig())==null?void 0:w.models)==null?void 0:T.ProductDetails)==null?void 0:y.transform)==null?void 0:A.call(y,e)))}function Ee(e){var r,i;return(i=(r=e.images)==null?void 0:r.filter(n=>{var t;return!((t=n.roles)!=null&&t.includes("hide_from_pdp"))}))==null?void 0:i.map(n=>(n.url=n.url.replace(/^https?:/,""),n))}function Se(e){var r,i;return(i=(r=e.attributes)==null?void 0:r.filter(({roles:n})=>(n==null?void 0:n.indexOf("visible_in_pdp"))!==-1))==null?void 0:i.map(({label:n,value:t,name:a})=>{if(a==="ac_giftcard")try{let s;typeof t=="string"?s=JSON.parse(t):typeof t=="object"&&(s=t);const l=j(s);return{id:a,label:n,value:JSON.stringify(l)}}catch{return{id:a,label:n,value:t.toString().split(",").join(", ")}}return{id:a,label:n,value:t.toString().split(",").join(", ")}})}function j(e){if(Array.isArray(e))return e.map(j);if(e!==null&&typeof e=="object"){const r={};for(const[i,n]of Object.entries(e)){let t=i;i==="validation_rule"?t="validationRule":i==="min_length"?t="minLength":i==="max_length"&&(t="maxLength"),r[t]=j(n)}return r}return e}function _e(e,r){const{options:i,optionUIDs:n}=e;return i==null?void 0:i.map(({id:t,title:a,required:s,multi:l,values:o})=>{var c;const m=(c=o==null?void 0:o[0])==null?void 0:c.__typename;let u=o==null?void 0:o[0].type;return u?u=u.replace("COLOR_HEX","color").replace("TEXT","text").replace("IMAGE","image"):u="dropdown",{id:t,type:u,typename:m,label:a,required:s,multiple:l,items:r?pe(o,n):ke(o,n,u)}})}function pe(e,r){return e==null?void 0:e.filter(({enabled:i})=>typeof i>"u"||i).map(({id:i,title:n,inStock:t,isDefault:a,product:s})=>({id:i,inStock:t,label:n,selected:(r==null?void 0:r.indexOf(i))>-1||a,value:i,product:s}))}function ke(e,r,i){return e==null?void 0:e.map(({id:n,title:t,inStock:a,value:s})=>({id:n,inStock:a,label:t,selected:(r==null?void 0:r.indexOf(n))>-1,value:(i==null?void 0:i.toLowerCase())==="dropdown"?n:s==null?void 0:s.replace(/^https?:/,"")}))}function Ae(e,r,i){var A,B,z,J,W;const{price:n,priceRange:t,options:a,optionUIDs:s=i}=e;let{__typename:l}=e;function o(){var C;const h=n==null?void 0:n.regular.amount.value,P=((C=n==null?void 0:n.final)==null?void 0:C.amount.value)??(n==null?void 0:n.regular.amount.value),d=(n==null?void 0:n.regular.amount.currency)==="NONE"?"USD":n==null?void 0:n.regular.amount.currency;return[h,P,P,d]}function m(){var x,D,O,E,b,U,N,I,v,F,V,L;const h=(x=t==null?void 0:t.minimum)==null?void 0:x.final.amount.value,P=(D=t==null?void 0:t.maximum)==null?void 0:D.final.amount.value;let d;((E=(O=t==null?void 0:t.minimum)==null?void 0:O.regular)==null?void 0:E.amount.value)===((U=(b=t==null?void 0:t.maximum)==null?void 0:b.regular)==null?void 0:U.amount.value)&&(d=(I=(N=t==null?void 0:t.minimum)==null?void 0:N.regular)==null?void 0:I.amount.value);const C=((F=(v=t==null?void 0:t.minimum)==null?void 0:v.final)==null?void 0:F.amount.currency)==="NONE"?"USD":(L=(V=t==null?void 0:t.minimum)==null?void 0:V.final)==null?void 0:L.amount.currency;return[d,h,P,C]}function u(){var O,E,b,U,N,I,v,F,V,L,Y,Z,R;let h=0,P=0;a==null||a.forEach(p=>{var ee;const Q=p==null?void 0:p.values;if(Q&&Array.isArray(Q)){const _=Q.map(S=>{var G,M,te,ne;return(ne=(te=(M=(G=S==null?void 0:S.product)==null?void 0:G.price)==null?void 0:M.regular)==null?void 0:te.amount)==null?void 0:ne.value}).filter(S=>S!==void 0),$=_.length>0?Math.max(..._):0;h+=$}(ee=p==null?void 0:p.values)==null||ee.forEach(_=>{var $,S,G,M;s!=null&&s.includes(_.id)&&(P+=(M=(G=(S=($=_==null?void 0:_.product)==null?void 0:$.price)==null?void 0:S.final)==null?void 0:G.amount)==null?void 0:M.value)})});const d=(O=t==null?void 0:t.minimum)==null?void 0:O.final.amount.value,C=(E=t==null?void 0:t.maximum)==null?void 0:E.final.amount.value;let x;((U=(b=t==null?void 0:t.minimum)==null?void 0:b.regular)==null?void 0:U.amount.value)===((I=(N=t==null?void 0:t.maximum)==null?void 0:N.regular)==null?void 0:I.amount.value)&&(x=(F=(v=t==null?void 0:t.minimum)==null?void 0:v.regular)==null?void 0:F.amount.value);const D=((L=(V=t==null?void 0:t.minimum)==null?void 0:V.final)==null?void 0:L.amount.currency)==="NONE"?"USD":(Z=(Y=t==null?void 0:t.minimum)==null?void 0:Y.final)==null?void 0:Z.amount.currency;return r&&(s==null?void 0:s.length)<1?[x,d,C,D]:h===((R=t==null?void 0:t.maximum)==null?void 0:R.regular.amount.value)?[P,P,P,D]:[x,d,C,D]}const[c,f,g,w]=l==="SimpleProductView"?o():r?u():m(),T=l==="SimpleProductView"?(A=n==null?void 0:n.roles)==null?void 0:A.includes("visible"):((z=(B=t==null?void 0:t.maximum)==null?void 0:B.roles)==null?void 0:z.includes("visible"))&&((W=(J=t==null?void 0:t.minimum)==null?void 0:J.roles)==null?void 0:W.includes("visible"));function y(h){return!h||!Array.isArray(h)?[]:h.map(P=>{var d,C,x,D,O,E;return{tier:{amount:(C=(d=P.tier)==null?void 0:d.amount)==null?void 0:C.value,currency:((D=(x=P.tier)==null?void 0:x.amount)==null?void 0:D.currency)||w},quantity:((O=P.quantity[0])==null?void 0:O.gte)||((E=P.quantity[0])==null?void 0:E.lt)||0}}).sort((P,d)=>P.quantity-d.quantity)}return g&&f===g?{regular:{amount:c,currency:w,variant:c&&f!==c?"strikethrough":"default"},final:{amount:g,currency:w,variant:"default"},tiers:y(n==null?void 0:n.tiers),visible:T}:{final:{minimumAmount:f,maximumAmount:g,currency:w},tiers:y(n==null?void 0:n.tiers),visible:T}}function be(e,r,i){var n;return r?((n=e==null?void 0:e.options)==null?void 0:n.map(({values:a})=>{var o;const s=((o=a==null?void 0:a.find(({isDefault:m})=>m))==null?void 0:o.id)??null,l=i?a[0].id:null;return s||l})).filter(a=>a!==null):e==null?void 0:e.optionUIDs}const X=new Pe({init:async e=>{var l,o,m;const r=(o=(l=e==null?void 0:e.models)==null?void 0:l.ProductDetails)==null?void 0:o.initialData,n=((m=(ae()||{}).optionsUIDs)==null?void 0:m.split(","))||(r==null?void 0:r.optionsUIDs),t=ge(1),s={...{defaultLocale:"en-US",globalLocale:"en-US",persistURLParams:!1,acdl:!1,optionsUIDs:n},...e};if(X.config.setConfig({...s}),s!=null&&s.sku){const u=r?K(r):await ie(s.sku,{preselectFirstOption:s.preselectFirstOption});q.emit("pdp/data",u,{scope:s.scope});const c={sku:s.sku,quantity:t,optionsUIDs:u==null?void 0:u.optionUIDs};ye(()=>({...c}),{scope:s.scope}),he(()=>{var f;return u!=null&&u.options?u.options.length===((f=u==null?void 0:u.optionUIDs)==null?void 0:f.length):!0},{scope:s.scope}),s.acdl&&u&&Oe(u)}},listeners:()=>[q.on("locale",async()=>{const{sku:e,scope:r}=X.config.getConfig();if(e){const i=await ie(e);q.emit("pdp/data",i,{scope:r})}})]}),k=X.config,{setEndpoint:Xe,setFetchGraphQlHeader:Ke,removeFetchGraphQlHeader:Be,setFetchGraphQlHeaders:ze,getFetchGraphQlHeader:Je,fetchGraphQl:ce,getConfig:We}=new de().getMethods(),Ue=`
|
|
3
|
+
import{merge as fe,Initializer as Pe}from"@dropins/tools/lib.js";import{events as q}from"@dropins/tools/event-bus.js";import{PRODUCT_FRAGMENT as se}from"../fragments.js";import{FetchGraphQL as de}from"@dropins/tools/fetch-graphql.js";import{s as ye,a as he}from"./isProductConfigurationValid.js";function je(e){const r=new URLSearchParams(window.location.search);Object.entries(e).forEach(([n,t])=>{t===null?r.delete(n):r.set(n,String(t))});let i=window.location.pathname;i+=`?${r.toString()}`,i+=window.location.hash,window.history.replaceState({},"",i)}function ae(){const e=new URLSearchParams(window.location.search),r={};return e.forEach((i,n)=>{r[n]=i}),r}function ge(e=1){const i=(ae()||{}).quantity;if(i){const n=parseInt(i,10);if(!isNaN(n)&&Number.isInteger(n)&&n>0)return n}return e}function we(e){var r,i,n,t,s,a,l,o,m,u,c,f;return{productId:Number(e==null?void 0:e.externalId),name:e==null?void 0:e.name,sku:(e==null?void 0:e.variantSku)||(e==null?void 0:e.sku),topLevelSku:e==null?void 0:e.sku,specialToDate:void 0,specialFromDate:void 0,newToDate:void 0,newFromDate:void 0,createdAt:void 0,updatedAt:void 0,manufacturer:void 0,countryOfManufacture:void 0,categories:void 0,productType:e==null?void 0:e.productType,pricing:{regularPrice:((i=(r=e==null?void 0:e.prices)==null?void 0:r.regular)==null?void 0:i.amount)||0,minimalPrice:(t=(n=e==null?void 0:e.prices)==null?void 0:n.final)==null?void 0:t.minimumAmount,maximalPrice:(a=(s=e==null?void 0:e.prices)==null?void 0:s.final)==null?void 0:a.maximumAmount,specialPrice:(o=(l=e==null?void 0:e.prices)==null?void 0:l.final)==null?void 0:o.amount,tierPricing:void 0,currencyCode:((u=(m=e==null?void 0:e.prices)==null?void 0:m.final)==null?void 0:u.currency)||"USD"},canonicalUrl:e==null?void 0:e.url,mainImageUrl:(f=(c=e==null?void 0:e.images)==null?void 0:c[0])==null?void 0:f.url}}const oe={PRODUCT_CONTEXT:"productContext",CHANNEL_CONTEXT:"channelContext"},Ce={PRODUCT_PAGE_VIEW:"product-page-view"};function ue(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function xe(){return{_id:"https://ns.adobe.com/xdm/channels/web",_type:"https://ns.adobe.com/xdm/channel-types/web"}}function le(e,r){const i=ue();i.push({[e]:null}),i.push({[e]:r})}function De(){typeof window>"u"||le(oe.CHANNEL_CONTEXT,xe())}function Te(e,r){ue().push(n=>{const t=n.getState?n.getState():{};n.push({event:e,eventInfo:{...t,...r}})})}function Oe(e){const r=we(e);le(oe.PRODUCT_CONTEXT,r),De(),Te(Ce.PRODUCT_PAGE_VIEW)}var H=(e=>(e.ComplexProduct="complex",e.SimpleProduct="simple",e))(H||{}),me=(e=>(e.ComplexProductView="ComplexProductView",e.SimpleProductView="SimpleProductView",e))(me||{});function K(e,r){var a,l,o,m,u,c,f,g,w,T,y,A;const i=((m=(o=(l=(a=e==null?void 0:e.options)==null?void 0:a[0])==null?void 0:l.values)==null?void 0:o[0])==null?void 0:m.__typename)==="ProductViewOptionValueProduct",n=be(e,i,r==null?void 0:r.preselectFirstOption),t=(e==null?void 0:e.__typename)===me.SimpleProductView?H.SimpleProduct:H.ComplexProduct,s=e?{name:e.name,sku:e.sku,isBundle:i,addToCartAllowed:e.addToCartAllowed,inStock:e.inStock,shortDescription:e.shortDescription,metaDescription:e.metaDescription,metaKeyword:e.metaKeyword,metaTitle:e.metaTitle,description:e.description,images:Ee(e),prices:Ae(e,i,n),attributes:Se(e),options:_e(e,i),optionUIDs:n,url:e.url,urlKey:e.urlKey,externalId:e.externalId,externalParentId:e.externalParentId,variantSku:e.variantSku,productType:t}:null;return fe(s,((g=(f=(c=(u=k.getConfig())==null?void 0:u.models)==null?void 0:c.ProductDetails)==null?void 0:f.transformer)==null?void 0:g.call(f,e))??((A=(y=(T=(w=k.getConfig())==null?void 0:w.models)==null?void 0:T.ProductDetails)==null?void 0:y.transform)==null?void 0:A.call(y,e)))}function Ee(e){var r,i;return(i=(r=e.images)==null?void 0:r.filter(n=>{var t;return!((t=n.roles)!=null&&t.includes("hide_from_pdp"))}))==null?void 0:i.map(n=>(n.url=n.url.replace(/^https?:/,""),n))}function Se(e){var r,i;return(i=(r=e.attributes)==null?void 0:r.filter(({roles:n})=>(n==null?void 0:n.indexOf("visible_in_pdp"))!==-1))==null?void 0:i.map(({label:n,value:t,name:s})=>{if(s!=null&&s.startsWith("ac_"))try{let a;typeof t=="string"?a=JSON.parse(t):typeof t=="object"&&(a=t);const l=j(a);return{id:s,label:n,value:JSON.stringify(l)}}catch{return{id:s,label:n,value:t.toString().split(",").join(", ")}}return{id:s,label:n,value:t.toString().split(",").join(", ")}})}function j(e){if(Array.isArray(e))return e.map(j);if(e!==null&&typeof e=="object"){const r={};for(const[i,n]of Object.entries(e)){let t=i;i==="validation_rule"?t="validationRule":i==="min_length"?t="minLength":i==="max_length"&&(t="maxLength"),r[t]=j(n)}return r}return e}function _e(e,r){const{options:i,optionUIDs:n}=e;return i==null?void 0:i.map(({id:t,title:s,required:a,multi:l,values:o})=>{var c;const m=(c=o==null?void 0:o[0])==null?void 0:c.__typename;let u=o==null?void 0:o[0].type;return u?u=u.replace("COLOR_HEX","color").replace("TEXT","text").replace("IMAGE","image"):u="dropdown",{id:t,type:u,typename:m,label:s,required:a,multiple:l,items:r?pe(o,n):ke(o,n,u)}})}function pe(e,r){return e==null?void 0:e.filter(({enabled:i})=>typeof i>"u"||i).map(({id:i,title:n,inStock:t,isDefault:s,product:a})=>({id:i,inStock:t,label:n,selected:(r==null?void 0:r.indexOf(i))>-1||s,value:i,product:a}))}function ke(e,r,i){return e==null?void 0:e.map(({id:n,title:t,inStock:s,value:a})=>({id:n,inStock:s,label:t,selected:(r==null?void 0:r.indexOf(n))>-1,value:(i==null?void 0:i.toLowerCase())==="dropdown"?n:a==null?void 0:a.replace(/^https?:/,"")}))}function Ae(e,r,i){var A,B,W,z,J;const{price:n,priceRange:t,options:s,optionUIDs:a=i}=e;let{__typename:l}=e;function o(){var C;const h=n==null?void 0:n.regular.amount.value,P=((C=n==null?void 0:n.final)==null?void 0:C.amount.value)??(n==null?void 0:n.regular.amount.value),d=(n==null?void 0:n.regular.amount.currency)==="NONE"?"USD":n==null?void 0:n.regular.amount.currency;return[h,P,P,d]}function m(){var x,D,O,E,b,U,N,I,v,F,V,L;const h=(x=t==null?void 0:t.minimum)==null?void 0:x.final.amount.value,P=(D=t==null?void 0:t.maximum)==null?void 0:D.final.amount.value;let d;((E=(O=t==null?void 0:t.minimum)==null?void 0:O.regular)==null?void 0:E.amount.value)===((U=(b=t==null?void 0:t.maximum)==null?void 0:b.regular)==null?void 0:U.amount.value)&&(d=(I=(N=t==null?void 0:t.minimum)==null?void 0:N.regular)==null?void 0:I.amount.value);const C=((F=(v=t==null?void 0:t.minimum)==null?void 0:v.final)==null?void 0:F.amount.currency)==="NONE"?"USD":(L=(V=t==null?void 0:t.minimum)==null?void 0:V.final)==null?void 0:L.amount.currency;return[d,h,P,C]}function u(){var O,E,b,U,N,I,v,F,V,L,Y,Z,R;let h=0,P=0;s==null||s.forEach(p=>{var ee;const Q=p==null?void 0:p.values;if(Q&&Array.isArray(Q)){const _=Q.map(S=>{var G,M,te,ne;return(ne=(te=(M=(G=S==null?void 0:S.product)==null?void 0:G.price)==null?void 0:M.regular)==null?void 0:te.amount)==null?void 0:ne.value}).filter(S=>S!==void 0),$=_.length>0?Math.max(..._):0;h+=$}(ee=p==null?void 0:p.values)==null||ee.forEach(_=>{var $,S,G,M;a!=null&&a.includes(_.id)&&(P+=(M=(G=(S=($=_==null?void 0:_.product)==null?void 0:$.price)==null?void 0:S.final)==null?void 0:G.amount)==null?void 0:M.value)})});const d=(O=t==null?void 0:t.minimum)==null?void 0:O.final.amount.value,C=(E=t==null?void 0:t.maximum)==null?void 0:E.final.amount.value;let x;((U=(b=t==null?void 0:t.minimum)==null?void 0:b.regular)==null?void 0:U.amount.value)===((I=(N=t==null?void 0:t.maximum)==null?void 0:N.regular)==null?void 0:I.amount.value)&&(x=(F=(v=t==null?void 0:t.minimum)==null?void 0:v.regular)==null?void 0:F.amount.value);const D=((L=(V=t==null?void 0:t.minimum)==null?void 0:V.final)==null?void 0:L.amount.currency)==="NONE"?"USD":(Z=(Y=t==null?void 0:t.minimum)==null?void 0:Y.final)==null?void 0:Z.amount.currency;return r&&(a==null?void 0:a.length)<1?[x,d,C,D]:h===((R=t==null?void 0:t.maximum)==null?void 0:R.regular.amount.value)?[P,P,P,D]:[x,d,C,D]}const[c,f,g,w]=l==="SimpleProductView"?o():r?u():m(),T=l==="SimpleProductView"?(A=n==null?void 0:n.roles)==null?void 0:A.includes("visible"):((W=(B=t==null?void 0:t.maximum)==null?void 0:B.roles)==null?void 0:W.includes("visible"))&&((J=(z=t==null?void 0:t.minimum)==null?void 0:z.roles)==null?void 0:J.includes("visible"));function y(h){return!h||!Array.isArray(h)?[]:h.map(P=>{var d,C,x,D,O,E;return{tier:{amount:(C=(d=P.tier)==null?void 0:d.amount)==null?void 0:C.value,currency:((D=(x=P.tier)==null?void 0:x.amount)==null?void 0:D.currency)||w},quantity:((O=P.quantity[0])==null?void 0:O.gte)||((E=P.quantity[0])==null?void 0:E.lt)||0}}).sort((P,d)=>P.quantity-d.quantity)}return g&&f===g?{regular:{amount:c,currency:w,variant:c&&f!==c?"strikethrough":"default"},final:{amount:g,currency:w,variant:"default"},tiers:y(n==null?void 0:n.tiers),visible:T}:{final:{minimumAmount:f,maximumAmount:g,currency:w},tiers:y(n==null?void 0:n.tiers),visible:T}}function be(e,r,i){var n;return r?((n=e==null?void 0:e.options)==null?void 0:n.map(({values:s})=>{var o;const a=((o=s==null?void 0:s.find(({isDefault:m})=>m))==null?void 0:o.id)??null,l=i?s[0].id:null;return a||l})).filter(s=>s!==null):e==null?void 0:e.optionUIDs}const X=new Pe({init:async e=>{var l,o,m;const r=(o=(l=e==null?void 0:e.models)==null?void 0:l.ProductDetails)==null?void 0:o.initialData,n=((m=(ae()||{}).optionsUIDs)==null?void 0:m.split(","))||(r==null?void 0:r.optionsUIDs),t=ge(1),a={...{defaultLocale:"en-US",globalLocale:"en-US",persistURLParams:!1,acdl:!1,optionsUIDs:n},...e};if(X.config.setConfig({...a}),a!=null&&a.sku){const u=r?K(r):await ie(a.sku,{preselectFirstOption:a.preselectFirstOption});q.emit("pdp/data",u,{scope:a.scope});const c={sku:a.sku,quantity:t,optionsUIDs:u==null?void 0:u.optionUIDs};ye(()=>({...c}),{scope:a.scope}),he(()=>{var f;return u!=null&&u.options?u.options.length===((f=u==null?void 0:u.optionUIDs)==null?void 0:f.length):!0},{scope:a.scope}),a.acdl&&u&&Oe(u)}},listeners:()=>[q.on("locale",async()=>{const{sku:e,scope:r}=X.config.getConfig();if(e){const i=await ie(e);q.emit("pdp/data",i,{scope:r})}})]}),k=X.config,{setEndpoint:Xe,setFetchGraphQlHeader:Ke,removeFetchGraphQlHeader:Be,setFetchGraphQlHeaders:We,getFetchGraphQlHeader:ze,fetchGraphQl:ce,getConfig:Je}=new de().getMethods(),Ue=`
|
|
4
4
|
query GET_PRODUCT_DATA($skus: [String]) {
|
|
5
5
|
products(skus: $skus) {
|
|
6
6
|
...PRODUCT_FRAGMENT
|
|
@@ -8,7 +8,7 @@ query GET_PRODUCT_DATA($skus: [String]) {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
${se}
|
|
11
|
-
`,Ne=async(e,r,i)=>{var
|
|
11
|
+
`,Ne=async(e,r,i)=>{var s;const{data:n}=await ce(Ue,{method:"GET",variables:{skus:[e]}}),t=(s=n==null?void 0:n.products)==null?void 0:s[0];return r!=null&&r.optionsUIDs&&(t.optionUIDs=r.optionsUIDs),t?i?t:K(t,{preselectFirstOption:r==null?void 0:r.preselectFirstOption}):null},Ie=`
|
|
12
12
|
query REFINE_PRODUCT_QUERY(
|
|
13
13
|
$optionIds: [String!]!
|
|
14
14
|
$sku: String!
|
|
@@ -30,7 +30,7 @@ query REFINE_PRODUCT_QUERY(
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
${se}
|
|
33
|
-
`;async function re(e,r){const i=Fe(r),n=Ve(i,e),t=Ie.replace("# %extendedPlaceholder%",n),{data:
|
|
33
|
+
`;async function re(e,r){const i=Fe(r),n=Ve(i,e),t=Ie.replace("# %extendedPlaceholder%",n),{data:s}=await ce(t,{method:"GET",variables:{optionIds:r,sku:e}});return s}const ve=async(e,r,i,n)=>{var g,w,T;const t=await re(e,r);if(!t)return null;let{products:s,refineProduct:a,...l}=t;const o=s==null?void 0:s[0],m=Le(Object.values(l),o.options,i);if(i!=null&&i.length&&a===null){r=Ge(m,r,i);const y=await re(e,r);a=y==null?void 0:y.refineProduct}const u={...a||o,sku:o.sku,name:o.name,externalParentId:o==null?void 0:o.externalId,options:m,optionUIDs:r,variantSku:(a==null?void 0:a.__typename)==="SimpleProductView"?a==null?void 0:a.sku:void 0},c=n?u:K(u),f=(T=(w=(g=k==null?void 0:k.getConfig())==null?void 0:g.models)==null?void 0:w.ProductDetails)==null?void 0:T.fallbackData;return f?f(o,c):c};function Fe(e){if(e.length<2)return[e];const r=[];return e.forEach(i=>{const n=[];e.forEach(t=>{i!==t&&n.push(t)}),r.push(n)}),r}function Ve(e,r){return e.map((i,n)=>`
|
|
34
34
|
ProductOption${n}: refineProduct(
|
|
35
35
|
optionIds: [
|
|
36
36
|
${i.map(t=>`"${t}"`).join(", ")}
|
|
@@ -43,5 +43,5 @@ ${se}
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
`).join("")}function Le(e,r=[],i){const n=Object.values(e).filter(
|
|
46
|
+
`).join("")}function Le(e,r=[],i){const n=Object.values(e).filter(s=>!!s).reduce((s,a)=>a.options?[...s,...a.options]:[...s],[]),t=new Map(r.map(s=>[s.id,s]));return n.forEach(s=>{i!=null&&i.includes(s.id)||t.set(s.id,s)}),[...t.values()]}function Ge(e,r,i){const n=[];let t;return e.forEach(s=>{var a,l,o,m;i.includes(s.id)?t=((l=(a=s.values)==null?void 0:a.find(u=>r.includes(u==null?void 0:u.id)))==null?void 0:l.id)||((o=s.values[0])==null?void 0:o.id):t=(m=s.values[0])==null?void 0:m.id,n.push(t)}),n}const ie=async(e,r)=>{const{anchors:i,optionsUIDs:n}=k.getConfig(),{optionsUIDs:t=n,anchors:s=i,preselectFirstOption:a,isBundle:l,skipTransform:o}=r??{};return!l&&t?await ve(e,t,s,o):await Ne(e,{preselectFirstOption:a,optionsUIDs:t},o)};export{Ke as a,We as b,k as c,Je as d,Ne as e,ce as f,ze as g,ve as h,X as i,ie as j,ge as k,je as l,Oe as p,Be as r,Xe as s,K as t};
|
|
47
47
|
//# sourceMappingURL=fetchProductData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchProductData.js","sources":["/@dropins/storefront-pdp/src/lib/url-params.ts","/@dropins/storefront-pdp/src/data/transforms/acdl-context.ts","/@dropins/storefront-pdp/src/lib/acdl.ts","/@dropins/storefront-pdp/src/data/models/acdl-models.ts","/@dropins/storefront-pdp/src/data/transforms/product-transform.ts","/@dropins/storefront-pdp/src/api/initialize/initialize.ts","/@dropins/storefront-pdp/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-pdp/src/api/getProductData/graphql/getProductData.graphql.ts","/@dropins/storefront-pdp/src/api/getProductData/getProductData.ts","/@dropins/storefront-pdp/src/api/getRefinedProduct/graphql/RefineProductQuery.graphql.ts","/@dropins/storefront-pdp/src/api/getRefinedProduct/getRefinedProduct.ts","/@dropins/storefront-pdp/src/api/fetchProductData/fetchProductData.ts"],"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\nexport function setUrlParams(\n params: Record<string, string | number | null>\n): void {\n const urlSearchParams = new URLSearchParams(window.location.search);\n\n Object.entries(params).forEach(([key, value]) => {\n if (value === null) {\n urlSearchParams.delete(key);\n } else {\n urlSearchParams.set(key, String(value));\n }\n });\n\n let url = window.location.pathname;\n url += `?${urlSearchParams.toString()}`;\n url += window.location.hash;\n\n window.history.replaceState({}, '', url);\n}\n\nexport function getUrlParams(): Record<string, string> {\n const urlSearchParams = new URLSearchParams(window.location.search);\n const params: Record<string, string> = {};\n\n urlSearchParams.forEach((value, key) => {\n params[key] = value;\n });\n\n return params;\n}\n\nexport function getValidatedQuantityFromUrl(\n defaultQuantity: number = 1\n): number {\n const urlParams = getUrlParams() || {};\n const quantityParam = urlParams.quantity; // 'quantity' is the key\n\n if (quantityParam) {\n const parsedQuantity = parseInt(quantityParam, 10);\n\n if (\n !isNaN(parsedQuantity) &&\n Number.isInteger(parsedQuantity) &&\n parsedQuantity > 0\n ) {\n // Return the valid quantity from the URL\n return parsedQuantity;\n }\n }\n\n // Return the default quantity if the parameter is missing, invalid, or not positive\n return defaultQuantity;\n}\n","/**\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 { ProductModel } from '../models';\n\nimport { Product } from '../models/acdl-models';\n\nexport function transformProduct(product: ProductModel): Product {\n return {\n productId: Number(product?.externalId),\n name: product?.name,\n sku: product?.variantSku || product?.sku,\n topLevelSku: product?.sku,\n specialToDate: undefined,\n specialFromDate: undefined,\n newToDate: undefined,\n newFromDate: undefined,\n createdAt: undefined,\n updatedAt: undefined,\n manufacturer: undefined,\n countryOfManufacture: undefined,\n categories: undefined,\n productType: product?.productType,\n pricing: {\n regularPrice: product?.prices?.regular?.amount || 0,\n minimalPrice: product?.prices?.final?.minimumAmount,\n maximalPrice: product?.prices?.final?.maximumAmount,\n specialPrice: product?.prices?.final?.amount,\n tierPricing: undefined,\n currencyCode: product?.prices?.final?.currency || 'USD',\n },\n canonicalUrl: product?.url,\n mainImageUrl: product?.images?.[0]?.url,\n };\n}\n","/**\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\n/* Publish functions for the Adobe Client Data Layer (ACDL) */\n\nimport { ProductModel } from '../data/models';\nimport { transformProduct } from '../data/transforms/acdl-context';\n\n/**\n * See: https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-sdk/src/contexts.ts\n */\nexport const contexts = {\n PRODUCT_CONTEXT: 'productContext',\n CHANNEL_CONTEXT: 'channelContext',\n};\n\n/**\n * See: https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-sdk/src/events.ts\n */\nexport const events = {\n PRODUCT_PAGE_VIEW: 'product-page-view',\n};\n\nexport function getAdobeDataLayer() {\n // @ts-ignore\n window.adobeDataLayer = window.adobeDataLayer || [];\n // @ts-ignore\n return window.adobeDataLayer;\n}\n\nexport function getChannelContext() {\n return {\n _id: 'https://ns.adobe.com/xdm/channels/web',\n _type: 'https://ns.adobe.com/xdm/channel-types/web',\n };\n}\n\n/**\n * Sets a context in the Adobe Client Data Layer (ACDL)\n * Logic based on: https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-sdk/src/Base.ts#L6\n */\nfunction setContext(name: string, data: any) {\n const adobeDataLayer = getAdobeDataLayer();\n\n // Clear existing context\n adobeDataLayer.push({\n [name]: null,\n });\n\n // Set new context\n adobeDataLayer.push({\n [name]: data,\n });\n}\n\nexport function setChannelContext() {\n if (typeof window === 'undefined') {\n return;\n }\n\n setContext(contexts.CHANNEL_CONTEXT, getChannelContext());\n}\n\n/**\n * Pushes an event to the Adobe Client Data Layer (ACDL)\n * Logic based on: https://github.com/adobe/commerce-events/blob/1973d0ce28471ef190fa06dad6359ffa0ab51db6/packages/storefront-events-sdk/src/Base.ts#L34\n */\nfunction pushEvent(event: string, additionalContext?: any) {\n const adobeDataLayer = getAdobeDataLayer();\n\n adobeDataLayer.push((acdl: any) => {\n const state = acdl.getState ? acdl.getState() : {};\n\n acdl.push({\n event,\n eventInfo: {\n ...state,\n ...additionalContext,\n },\n });\n });\n}\n\n// Triggered when a product page is viewed\nexport function publishProductPageViewEvent(product: ProductModel) {\n const productItem = transformProduct(product);\n setContext(contexts.PRODUCT_CONTEXT, productItem);\n setChannelContext();\n pushEvent(events.PRODUCT_PAGE_VIEW);\n}\n","/**\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\n/**\n * ACDL Product Types from:\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-sdk/src/types/schemas/product.ts\n */\n\nexport type Product = {\n productId: number;\n name: string;\n sku: string;\n topLevelSku?: string | null;\n specialToDate?: string | null;\n specialFromDate?: string | null;\n newToDate?: string | null;\n newFromDate?: string | null;\n createdAt?: string | null;\n updatedAt?: string | null;\n manufacturer?: string | null;\n countryOfManufacture?: string | null;\n categories?: string[] | null;\n productType?: ProductType;\n pricing?: {\n regularPrice: number;\n minimalPrice?: number;\n maximalPrice?: number;\n specialPrice?: number;\n tierPricing?: {\n customerGroupId?: number | null;\n qty: number;\n value: number;\n }[];\n currencyCode: string | null;\n };\n canonicalUrl?: string | null;\n mainImageUrl?: string | null;\n};\n\nexport enum ProductType {\n ComplexProduct = 'complex',\n SimpleProduct = 'simple'\n}\n\nexport enum ProductViewType {\n ComplexProductView = 'ComplexProductView',\n SimpleProductView = 'SimpleProductView'\n}\n","/**\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 */\nimport { merge } from '@adobe-commerce/elsie/lib';\nimport { config } from '@/pdp/api';\nimport { ProductModel } from '@/pdp/data/models';\nimport { ProductType, ProductViewType } from '../models/acdl-models';\n\nexport function transformProductData(\n data: any,\n options?: {\n preselectFirstOption?: boolean;\n }\n): ProductModel | null {\n const isBundle =\n data?.options?.[0]?.values?.[0]?.__typename ===\n 'ProductViewOptionValueProduct';\n const optionUIDs = getOptionUIDs(\n data,\n isBundle,\n options?.preselectFirstOption\n );\n const productType =\n data?.__typename === ProductViewType.SimpleProductView\n ? ProductType.SimpleProduct\n : ProductType.ComplexProduct;\n\n const productData = data\n ? ({\n name: data.name,\n sku: data.sku,\n isBundle,\n addToCartAllowed: data.addToCartAllowed,\n inStock: data.inStock,\n shortDescription: data.shortDescription,\n metaDescription: data.metaDescription,\n metaKeyword: data.metaKeyword,\n metaTitle: data.metaTitle,\n description: data.description,\n images: transformImages(data),\n prices: transformPrices(data, isBundle, optionUIDs),\n attributes: transformAttributes(data),\n options: transformOptions(data, isBundle),\n optionUIDs,\n url: data.url,\n urlKey: data.urlKey,\n externalId: data.externalId,\n externalParentId: data.externalParentId,\n variantSku: data.variantSku,\n productType,\n } as ProductModel)\n : null;\n\n // extend the model with custom transformer\n return merge(\n productData,\n config.getConfig()?.models?.ProductDetails?.transformer?.(data) ??\n config.getConfig()?.models?.ProductDetails?.transform?.(data)\n );\n}\n\nfunction transformImages(data: any) {\n return data.images\n ?.filter((image: any) => !image.roles?.includes('hide_from_pdp'))\n ?.map((image: any) => {\n // Remove protocol from image URL\n image.url = image.url.replace(/^https?:/, '');\n\n return image;\n });\n}\n\nfunction transformAttributes(data: any) {\n return (\n data.attributes\n // only show attributes that are visible in PDP\n ?.filter(({ roles }: any) => roles?.indexOf('visible_in_pdp') !== -1)\n // transform attribute values\n ?.map(({ label, value, name }: any) => {\n // Special handling for ac_giftcard attribute\n if (name === 'ac_giftcard') {\n try {\n let parsedValue;\n\n if (typeof value === 'string') {\n parsedValue = JSON.parse(value);\n } else if (typeof value === 'object') {\n parsedValue = value;\n }\n\n // Transform specific snake_case fields to camelCase\n const transformedValue = transformSnakeToCamel(parsedValue);\n return {\n id: name,\n label,\n value: JSON.stringify(transformedValue),\n };\n } catch {\n // If parsing fails, return original value\n return {\n id: name,\n label,\n value: value.toString().split(',').join(', '),\n };\n }\n }\n\n return {\n id: name,\n label,\n value: value.toString().split(',').join(', '),\n };\n })\n );\n}\n\nfunction transformSnakeToCamel(obj: any): any {\n if (Array.isArray(obj)) {\n return obj.map(transformSnakeToCamel);\n }\n\n if (obj !== null && typeof obj === 'object') {\n const transformed: any = {};\n for (const [key, value] of Object.entries(obj)) {\n // Only transform specific snake_case fields to camelCase\n let camelKey = key;\n if (key === 'validation_rule') {\n camelKey = 'validationRule';\n } else if (key === 'min_length') {\n camelKey = 'minLength';\n } else if (key === 'max_length') {\n camelKey = 'maxLength';\n }\n\n transformed[camelKey] = transformSnakeToCamel(value);\n }\n return transformed;\n }\n\n return obj;\n}\n\nfunction transformOptions(data: any, isBundle?: boolean) {\n const { options, optionUIDs } = data;\n\n return options?.map(({ id, title, required, multi, values }: any) => {\n const typename = values?.[0]?.__typename;\n let type: string = values?.[0].type;\n\n if (type) {\n type = type\n .replace('COLOR_HEX', 'color')\n .replace('TEXT', 'text')\n .replace('IMAGE', 'image');\n } else {\n type = 'dropdown';\n }\n\n return {\n id,\n type,\n typename,\n label: title,\n required,\n multiple: multi,\n items: isBundle\n ? mapBundleOptionValues(values, optionUIDs)\n : mapOptionValues(values, optionUIDs, type),\n };\n });\n}\n\nfunction mapBundleOptionValues(values: any, optionUIDs: string[]) {\n return values\n ?.filter(({ enabled }: any) => typeof enabled === 'undefined' || enabled)\n .map(({ id, title, inStock, isDefault, product }: any) => {\n return {\n id,\n inStock,\n label: title,\n selected: optionUIDs?.indexOf(id) > -1 || isDefault,\n value: id,\n product,\n };\n });\n}\n\nfunction mapOptionValues(values: any, optionUIDs: string[], type: string) {\n return values?.map(({ id, title, inStock, value }: any) => {\n return {\n id,\n inStock,\n label: title,\n selected: optionUIDs?.indexOf(id) > -1,\n value:\n type?.toLowerCase() === 'dropdown'\n ? id\n : value?.replace(/^https?:/, ''),\n };\n });\n}\n\nfunction transformPrices(\n data: any,\n isBundle: boolean,\n defaultOptionUIDs?: string[]\n) {\n const { price, priceRange, options, optionUIDs = defaultOptionUIDs } = data;\n let { __typename: type } = data;\n\n function getSimpleProductPrices() {\n const regularPrice = price?.regular.amount.value;\n const finalPrice =\n price?.final?.amount.value ?? price?.regular.amount.value;\n\n const currency =\n price?.regular.amount.currency === 'NONE' //temporary fix if there is no currency\n ? 'USD'\n : price?.regular.amount.currency;\n\n return [regularPrice, finalPrice, finalPrice, currency];\n }\n\n function getComplexProductPrices() {\n const finalMinimumPrice = priceRange?.minimum?.final.amount.value;\n const finalMaximumPrice = priceRange?.maximum?.final.amount.value;\n let regularPrice;\n\n if (\n priceRange?.minimum?.regular?.amount.value ===\n priceRange?.maximum?.regular?.amount.value\n ) {\n regularPrice = priceRange?.minimum?.regular?.amount.value;\n }\n\n const currency =\n priceRange?.minimum?.final?.amount.currency === 'NONE'\n ? 'USD'\n : priceRange?.minimum?.final?.amount.currency;\n\n return [regularPrice, finalMinimumPrice, finalMaximumPrice, currency];\n }\n\n function getBundleProductPrice() {\n // Currently the Catalog Service does not have support for the individual prices of the options of a fixed bundle,\n // so the price used in UI is taken from the priceRange object.\n\n // The dynamic bundle has full support in Catalog Service.\n // If there are pre-selected values of the option, then the starting price is the sum of those and\n // after each selection, the price is updated with the sum of prices for the selected options.\n // This is not supported by default and needs to be updated in the drop-in upon each selection.\n\n let maxSumRegular = 0;\n let bundlePrice = 0;\n options?.forEach((option: any) => {\n const values = option?.values;\n if (values && Array.isArray(values)) {\n const regularAmounts = values\n .map((value) => value?.product?.price?.regular?.amount?.value)\n .filter((amount) => amount !== undefined);\n\n const maxRegularAmount =\n regularAmounts.length > 0 ? Math.max(...regularAmounts) : 0;\n maxSumRegular += maxRegularAmount;\n }\n option?.values?.forEach((value: any) => {\n if (optionUIDs?.includes(value.id)) {\n bundlePrice += value?.product?.price?.final?.amount?.value;\n }\n });\n });\n\n const finalMinimumPrice = priceRange?.minimum?.final.amount.value;\n const finalMaximumPrice = priceRange?.maximum?.final.amount.value;\n let regularPrice;\n\n if (\n priceRange?.minimum?.regular?.amount.value ===\n priceRange?.maximum?.regular?.amount.value\n ) {\n regularPrice = priceRange?.minimum?.regular?.amount.value;\n }\n\n const currency =\n priceRange?.minimum?.final?.amount.currency === 'NONE'\n ? 'USD'\n : priceRange?.minimum?.final?.amount.currency;\n\n if (isBundle && optionUIDs?.length < 1) {\n return [regularPrice, finalMinimumPrice, finalMaximumPrice, currency];\n }\n\n return maxSumRegular === priceRange?.maximum?.regular.amount.value\n ? [bundlePrice, bundlePrice, bundlePrice, currency]\n : [regularPrice, finalMinimumPrice, finalMaximumPrice, currency];\n }\n\n const [regularPrice, finalMinimumPrice, finalMaximumPrice, currency] =\n type === 'SimpleProductView'\n ? getSimpleProductPrices()\n : isBundle\n ? getBundleProductPrice()\n : getComplexProductPrices();\n\n const visible =\n type === 'SimpleProductView'\n ? price?.roles?.includes('visible')\n : priceRange?.maximum?.roles?.includes('visible') &&\n priceRange?.minimum?.roles?.includes('visible');\n\n function transformTiers(tiers: any[]): any[] {\n if (!tiers || !Array.isArray(tiers)) {\n return [];\n }\n\n return tiers\n .map((tier) => ({\n tier: {\n amount: tier.tier?.amount?.value,\n currency: tier.tier?.amount?.currency || currency,\n },\n quantity: tier.quantity[0]?.gte || tier.quantity[0]?.lt || 0,\n }))\n .sort((a, b) => a.quantity - b.quantity);\n }\n\n if (finalMaximumPrice && finalMinimumPrice === finalMaximumPrice) {\n const hasDiscount = regularPrice && finalMinimumPrice !== regularPrice;\n\n return {\n regular: {\n amount: regularPrice,\n currency,\n variant: hasDiscount ? 'strikethrough' : 'default',\n },\n final: {\n amount: finalMaximumPrice,\n currency,\n variant: 'default',\n },\n tiers: transformTiers(price?.tiers),\n visible,\n };\n }\n\n return {\n final: {\n minimumAmount: finalMinimumPrice,\n maximumAmount: finalMaximumPrice,\n currency,\n },\n tiers: transformTiers(price?.tiers),\n visible,\n };\n}\n\nfunction getOptionUIDs(\n data: any,\n isBundle?: boolean,\n preselectFirstOption?: boolean\n): string[] {\n if (isBundle) {\n const selections: Array<string | null> = data?.options?.map(\n ({ values }: any) => {\n const defaultSelection =\n values?.find(({ isDefault }: any) => isDefault)?.id ?? null;\n const preselectedFirstOption = preselectFirstOption\n ? values[0].id\n : null;\n return defaultSelection || preselectedFirstOption;\n }\n );\n\n return selections.filter((selection) => selection !== null) as string[];\n }\n\n return data?.optionUIDs;\n}\n","/**\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 { Initializer } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { ProductModel } from '@/pdp/data/models';\nimport {\n fetchProductData,\n setProductConfigurationValid,\n setProductConfigurationValues,\n} from '@/pdp/api';\nimport { events } from '@adobe-commerce/event-bus';\nimport {\n getUrlParams,\n getValidatedQuantityFromUrl,\n} from '@/pdp/lib/url-params';\nimport { publishProductPageViewEvent } from '@/pdp/lib/acdl';\nimport { transformProductData } from '@/pdp/data/transforms/product-transform';\n\ntype ConfigProps = {\n scope?: string;\n langDefinitions?: Lang;\n defaultLocale?: string;\n globalLocale?: string;\n sku?: string;\n acdl?: boolean;\n anchors?: string[];\n persistURLParams?: boolean;\n preselectFirstOption?: boolean;\n optionsUIDs?: string[];\n models?: {\n [name: string]: {\n initialData: any;\n /** @deprecated Use \"transformer\" instead */\n transform?: (data?: ProductModel) => ProductModel;\n transformer?: (data?: ProductModel) => ProductModel;\n fallbackData?: (\n parentProduct: any,\n simpleProduct: ProductModel\n ) => ProductModel;\n };\n };\n};\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (_config) => {\n const initialData = _config?.models?.ProductDetails?.initialData;\n\n // Get URL parameters safely\n const urlParams = getUrlParams() || {};\n\n // Get optionsUIDs from URL params or config\n const optionsUIDs =\n urlParams.optionsUIDs?.split(',') || initialData?.optionsUIDs;\n\n // Get and validate quantity from URL params\n const initialQuantity = getValidatedQuantityFromUrl(1); // Default quantity to 1 - Ensures backward compatibility\n\n // Set default config\n const defaultConfig: ConfigProps = {\n defaultLocale: 'en-US',\n globalLocale: 'en-US',\n persistURLParams: false,\n acdl: false,\n optionsUIDs,\n };\n\n const config = { ...defaultConfig, ..._config };\n\n initialize.config.setConfig({ ...config });\n\n if (config?.sku) {\n // Get PDP data\n const data = initialData\n ? transformProductData(initialData)\n : await fetchProductData(config.sku, {\n preselectFirstOption: config.preselectFirstOption,\n });\n\n // Emit PDP initial data\n events.emit('pdp/data', data, { scope: config.scope });\n\n // Set default values for product configuration\n const defaultValues = {\n sku: config.sku,\n quantity: initialQuantity, // Use the determined quantity from URL params or default to 1\n optionsUIDs: data?.optionUIDs,\n };\n\n setProductConfigurationValues(() => ({ ...defaultValues }), {\n scope: config.scope,\n });\n\n setProductConfigurationValid(\n () => {\n // configurable product, check if all options are selected\n if (data?.options) {\n // all selections should be made\n return data.options.length === data?.optionUIDs?.length;\n }\n\n // simple product\n return true;\n },\n { scope: config.scope }\n );\n\n // Publish ACDL event\n if (config.acdl && data) {\n publishProductPageViewEvent(data);\n }\n }\n },\n\n listeners: () => [\n events.on('locale', async () => {\n const { sku, scope } = initialize.config.getConfig();\n\n if (sku) {\n const next = await fetchProductData(sku);\n events.emit('pdp/data', next, { scope });\n }\n }),\n ],\n});\n\nexport const config = initialize.config;\n","/**\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 { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n getFetchGraphQlHeader,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n","/**\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 { PRODUCT_FRAGMENT } from '@/pdp/api/graphql/ProductFragment.graphql';\n\nexport const GET_PRODUCT_DATA = `\nquery GET_PRODUCT_DATA($skus: [String]) {\n products(skus: $skus) {\n ...PRODUCT_FRAGMENT\n }\n}\n\n${PRODUCT_FRAGMENT}\n`;\n","/**\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 { fetchGraphQl } from '@/pdp/api';\nimport { ProductModel } from '@/pdp/data/models';\nimport { transformProductData } from '@/pdp/data/transforms';\nimport { GET_PRODUCT_DATA } from './graphql/getProductData.graphql';\n\nexport const getProductData = async (\n sku: string,\n options?: {\n preselectFirstOption?: boolean;\n optionsUIDs?: string[];\n },\n raw?: boolean\n): Promise<ProductModel | null> => {\n const { data } = await fetchGraphQl(GET_PRODUCT_DATA, {\n method: 'GET',\n variables: { skus: [sku] },\n });\n\n const product = data?.products?.[0];\n\n // If optionsUIDs are provided, override the optionsUIDs from the response\n if (options?.optionsUIDs) {\n product.optionUIDs = options.optionsUIDs;\n }\n\n if (!product) {\n return null;\n }\n return raw\n ? product\n : transformProductData(product, {\n preselectFirstOption: options?.preselectFirstOption,\n });\n};\n","/**\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 { PRODUCT_FRAGMENT } from '@/pdp/api/graphql/ProductFragment.graphql';\n\nexport const REFINE_PRODUCT_QUERY = `\nquery REFINE_PRODUCT_QUERY(\n $optionIds: [String!]!\n $sku: String!\n) {\n # Refined Product\n refineProduct(\n optionIds: $optionIds \n sku: $sku\n ) {\n ...PRODUCT_FRAGMENT\n }\n\n # Parent Product\n products(skus: [$sku]) {\n ...PRODUCT_FRAGMENT\n }\n\n # %extendedPlaceholder%\n}\n\n${PRODUCT_FRAGMENT}\n`;\n","/**\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 { fetchGraphQl, config } from '@/pdp/api';\nimport { ProductModel } from '@/pdp/data/models';\nimport { transformProductData } from '@/pdp/data/transforms';\nimport { REFINE_PRODUCT_QUERY } from './graphql/RefineProductQuery.graphql';\n\nasync function getProductData(sku: string, optionUIDs: string[]): Promise<any> {\n const optionPairCombinations = getPairCombination(optionUIDs);\n const optionQueries = getProductOptionQuery(optionPairCombinations, sku);\n\n const mergedQueries = REFINE_PRODUCT_QUERY.replace(\n '# %extendedPlaceholder%',\n optionQueries\n );\n\n const { data } = await fetchGraphQl(mergedQueries, {\n method: 'GET',\n variables: { optionIds: optionUIDs, sku },\n });\n return data;\n}\n\nexport const getRefinedProduct = async (\n sku: string,\n optionUIDs: string[],\n anchorOptions?: string[],\n raw?: boolean\n): Promise<ProductModel | null> => {\n const data = await getProductData(sku, optionUIDs);\n if (!data) return null;\n\n let { products, refineProduct, ...refinedOptions } = data;\n\n const parent = products?.[0];\n\n const options = mergeRefinedOptions(\n Object.values(refinedOptions),\n parent.options,\n anchorOptions\n );\n\n // needed when anchor options exist\n if (anchorOptions?.length && refineProduct === null) {\n optionUIDs = updateSelections(options, optionUIDs, anchorOptions);\n const updatedRefinedData = await getProductData(sku, optionUIDs);\n refineProduct = updatedRefinedData?.refineProduct;\n }\n\n const response = {\n ...(refineProduct || parent),\n sku: parent.sku,\n name: parent.name,\n externalParentId: parent?.externalId,\n options,\n optionUIDs,\n variantSku:\n refineProduct?.__typename === 'SimpleProductView'\n ? refineProduct?.sku\n : undefined,\n };\n\n const refinedData = raw ? response : transformProductData(response);\n\n const fallback = config?.getConfig()?.models?.ProductDetails?.fallbackData;\n\n if (fallback) {\n return fallback(parent, refinedData!);\n }\n\n return refinedData;\n};\n\nfunction getPairCombination(arr: string[]): string[][] {\n if (arr.length < 2) {\n return [arr];\n }\n\n const result: string[][] = [];\n\n arr.forEach((item) => {\n const temp: string[] = [];\n\n arr.forEach((item2) => {\n if (item !== item2) {\n temp.push(item2);\n }\n });\n\n result.push(temp);\n });\n\n return result;\n}\n\nfunction getProductOptionQuery(optionUIDs: string[][], sku: string): string {\n return optionUIDs\n .map((ids: string[], i: number) => {\n return `\n ProductOption${i}: refineProduct(\n optionIds: [\n ${ids.map((id) => `\"${id}\"`).join(', ')}\n ]\n sku: \"${sku}\"\n ) {\n ... on ComplexProductView {\n options {\n ...PRODUCT_OPTION_FRAGMENT\n }\n }\n }\n `;\n })\n .join('');\n}\n\nfunction mergeRefinedOptions(\n options: {},\n parent: [] = [],\n anchorOptions?: string[]\n) {\n // flat _refined[].options[] to _refinedOptions[]\n const refinedOptions: any = Object.values(options)\n .filter((x) => !!x)\n .reduce((acc: any, curr: any) => {\n if (!curr.options) return [...acc];\n\n return [...acc, ...curr.options];\n }, []);\n\n // Create a map to store items by their id from original\n const map = new Map(parent.map((item: any) => [item.id, item]));\n\n // Iterate through refinedOptions and merge items\n refinedOptions.forEach((current: any) => {\n // anchor options should display all values, so no merge is performed\n if (anchorOptions?.includes(current.id)) {\n return;\n }\n\n map.set(current.id, current);\n });\n\n return [...map.values()];\n}\n\nfunction updateSelections(\n options: any[],\n optionsUIDs: string[],\n anchorOptions: string[]\n): string[] {\n const updatedOptionsUIDs: string[] = [];\n\n let optionValue: string;\n options.forEach((option: any) => {\n if (anchorOptions.includes(option.id)) {\n optionValue =\n option.values?.find((value: any) => optionsUIDs.includes(value?.id))\n ?.id || option.values[0]?.id;\n } else {\n optionValue = option.values[0]?.id; // TODO check if we should use default value instead\n }\n updatedOptionsUIDs.push(optionValue);\n });\n return updatedOptionsUIDs;\n}\n","/**\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 { getProductData, getRefinedProduct, config } from '@/pdp/api';\n\nexport type Options = {\n anchors?: string[];\n optionsUIDs?: string[];\n preselectFirstOption?: boolean;\n isBundle?: boolean;\n skipTransform?: boolean;\n};\n\nexport const fetchProductData = async (sku: string, options?: Options) => {\n // Get the default configuration values\n const { anchors: defaultAnchors, optionsUIDs: defaultOptionsUIDs } =\n config.getConfig();\n\n // Destructure the options object\n const {\n optionsUIDs = defaultOptionsUIDs,\n anchors = defaultAnchors,\n preselectFirstOption,\n isBundle,\n skipTransform,\n } = options ?? {};\n\n // ❗️ Warning ❗️\n // If we have default selections, but we cannot determine that the product is of type bundle, then the response is going to result in null objects and error(s).\n // Only the `products` object will be populated correctly, the `ProductOption${i}` and `refinedProduct` will be set as null.\n // This does not affect the UI, but the error message(s) can be detected by 3rd party tools that the client might be using.\n // This is accepted as a known behaviour, since a bundle product does not have variants.\n // However, if initialData is passed from the integration layer, then we can determine if the product is a bundle and set the isBundle flag accordingly.\n return !isBundle && optionsUIDs\n ? await getRefinedProduct(sku, optionsUIDs, anchors, skipTransform)\n : await getProductData(\n sku,\n {\n preselectFirstOption,\n optionsUIDs,\n },\n skipTransform\n );\n};\n"],"names":["setUrlParams","params","urlSearchParams","key","value","url","getUrlParams","getValidatedQuantityFromUrl","defaultQuantity","quantityParam","parsedQuantity","transformProduct","product","_b","_a","_d","_c","_f","_e","_h","_g","_j","_i","_l","_k","contexts","events","getAdobeDataLayer","getChannelContext","setContext","name","data","adobeDataLayer","setChannelContext","pushEvent","event","additionalContext","acdl","state","publishProductPageViewEvent","productItem","ProductType","ProductViewType","transformProductData","options","isBundle","optionUIDs","getOptionUIDs","productType","productData","transformImages","transformPrices","transformAttributes","transformOptions","merge","config","image","roles","label","parsedValue","transformedValue","transformSnakeToCamel","obj","transformed","camelKey","id","title","required","multi","values","typename","type","mapBundleOptionValues","mapOptionValues","enabled","inStock","isDefault","defaultOptionUIDs","price","priceRange","getSimpleProductPrices","regularPrice","finalPrice","currency","getComplexProductPrices","finalMinimumPrice","finalMaximumPrice","getBundleProductPrice","maxSumRegular","bundlePrice","option","regularAmounts","amount","maxRegularAmount","_m","visible","transformTiers","tiers","tier","a","b","preselectFirstOption","defaultSelection","preselectedFirstOption","selection","initialize","Initializer","_config","initialData","optionsUIDs","initialQuantity","fetchProductData","defaultValues","setProductConfigurationValues","setProductConfigurationValid","sku","scope","next","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","getFetchGraphQlHeader","fetchGraphQl","getConfig","FetchGraphQL","GET_PRODUCT_DATA","PRODUCT_FRAGMENT","getProductData","raw","REFINE_PRODUCT_QUERY","optionPairCombinations","getPairCombination","optionQueries","getProductOptionQuery","mergedQueries","getRefinedProduct","anchorOptions","products","refineProduct","refinedOptions","parent","mergeRefinedOptions","updateSelections","updatedRefinedData","response","refinedData","fallback","arr","result","item","temp","item2","ids","i","x","acc","curr","map","current","updatedOptionsUIDs","optionValue","defaultAnchors","defaultOptionsUIDs","anchors","skipTransform"],"mappings":"wSAgBO,SAASA,GACdC,EACM,CACN,MAAMC,EAAkB,IAAI,gBAAgB,OAAO,SAAS,MAAM,EAE3D,OAAA,QAAQD,CAAM,EAAE,QAAQ,CAAC,CAACE,EAAKC,CAAK,IAAM,CAC3CA,IAAU,KACZF,EAAgB,OAAOC,CAAG,EAE1BD,EAAgB,IAAIC,EAAK,OAAOC,CAAK,CAAC,CACxC,CACD,EAEG,IAAAC,EAAM,OAAO,SAAS,SACnBA,GAAA,IAAIH,EAAgB,SAAU,CAAA,GACrCG,GAAO,OAAO,SAAS,KAEvB,OAAO,QAAQ,aAAa,CAAA,EAAI,GAAIA,CAAG,CACzC,CAEO,SAASC,IAAuC,CACrD,MAAMJ,EAAkB,IAAI,gBAAgB,OAAO,SAAS,MAAM,EAC5DD,EAAiC,CAAC,EAExB,OAAAC,EAAA,QAAQ,CAACE,EAAOD,IAAQ,CACtCF,EAAOE,CAAG,EAAIC,CAAA,CACf,EAEMH,CACT,CAEgB,SAAAM,GACdC,EAA0B,EAClB,CAER,MAAMC,GADYH,GAAa,GAAK,CAAC,GACL,SAEhC,GAAIG,EAAe,CACX,MAAAC,EAAiB,SAASD,EAAe,EAAE,EAG/C,GAAA,CAAC,MAAMC,CAAc,GACrB,OAAO,UAAUA,CAAc,GAC/BA,EAAiB,EAGV,OAAAA,CACT,CAIK,OAAAF,CACT,CChDO,SAASG,GAAiBC,EAAgC,6BACxD,MAAA,CACL,UAAW,OAAOA,GAAA,YAAAA,EAAS,UAAU,EACrC,KAAMA,GAAA,YAAAA,EAAS,KACf,KAAKA,GAAA,YAAAA,EAAS,cAAcA,GAAA,YAAAA,EAAS,KACr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AAe,SAASsB,EAAQ,KAIhCD,EAAA,IAAIC,EAAQ,GAAIA,CAAO,CAAA,CAC5B,EAEM,CAAC,GAAGD,EAAI,QAAQ,CACzB,CAEA,SAASf,GACPnG,EACAiE,EACA4B,EACU,CACV,MAAMuB,EAA+B,CAAC,EAElC,IAAAC,EACI,OAAArH,EAAA,QAAS8C,GAAgB,aAC3B+C,EAAc,SAAS/C,EAAO,EAAE,EAClCuE,IACEpJ,GAAAC,EAAA4E,EAAO,SAAP,YAAA5E,EAAe,KAAMV,GAAeyG,EAAY,SAASzG,GAAA,YAAAA,EAAO,EAAE,KAAlE,YAAAS,EACI,OAAMG,EAAA0E,EAAO,OAAO,CAAC,IAAf,YAAA1E,EAAkB,IAEhBiJ,GAAAlJ,EAAA2E,EAAO,OAAO,CAAC,IAAf,YAAA3E,EAAkB,GAElCiJ,EAAmB,KAAKC,CAAW,CAAA,CACpC,EACMD,CACT,CCzJa,MAAAjD,GAAmB,MAAOI,EAAavE,IAAsB,CAExE,KAAM,CAAE,QAASsH,EAAgB,YAAaC,CAAmB,EAC/D5G,EAAO,UAAU,EAGb,CACJ,YAAAsD,EAAcsD,EACd,QAAAC,EAAUF,EACV,qBAAA7D,EACA,SAAAxD,EACA,cAAAwH,CACF,EAAIzH,GAAW,CAAC,EAQT,MAAA,CAACC,GAAYgE,EAChB,MAAM2B,GAAkBrB,EAAKN,EAAauD,EAASC,CAAa,EAChE,MAAMrC,GACJb,EACA,CACE,qBAAAd,EACA,YAAAQ,CACF,EACAwD,CACF,CACN"}
|
|
1
|
+
{"version":3,"file":"fetchProductData.js","sources":["/@dropins/storefront-pdp/src/lib/url-params.ts","/@dropins/storefront-pdp/src/data/transforms/acdl-context.ts","/@dropins/storefront-pdp/src/lib/acdl.ts","/@dropins/storefront-pdp/src/data/models/acdl-models.ts","/@dropins/storefront-pdp/src/data/transforms/product-transform.ts","/@dropins/storefront-pdp/src/api/initialize/initialize.ts","/@dropins/storefront-pdp/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-pdp/src/api/getProductData/graphql/getProductData.graphql.ts","/@dropins/storefront-pdp/src/api/getProductData/getProductData.ts","/@dropins/storefront-pdp/src/api/getRefinedProduct/graphql/RefineProductQuery.graphql.ts","/@dropins/storefront-pdp/src/api/getRefinedProduct/getRefinedProduct.ts","/@dropins/storefront-pdp/src/api/fetchProductData/fetchProductData.ts"],"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\nexport function setUrlParams(\n params: Record<string, string | number | null>\n): void {\n const urlSearchParams = new URLSearchParams(window.location.search);\n\n Object.entries(params).forEach(([key, value]) => {\n if (value === null) {\n urlSearchParams.delete(key);\n } else {\n urlSearchParams.set(key, String(value));\n }\n });\n\n let url = window.location.pathname;\n url += `?${urlSearchParams.toString()}`;\n url += window.location.hash;\n\n window.history.replaceState({}, '', url);\n}\n\nexport function getUrlParams(): Record<string, string> {\n const urlSearchParams = new URLSearchParams(window.location.search);\n const params: Record<string, string> = {};\n\n urlSearchParams.forEach((value, key) => {\n params[key] = value;\n });\n\n return params;\n}\n\nexport function getValidatedQuantityFromUrl(\n defaultQuantity: number = 1\n): number {\n const urlParams = getUrlParams() || {};\n const quantityParam = urlParams.quantity; // 'quantity' is the key\n\n if (quantityParam) {\n const parsedQuantity = parseInt(quantityParam, 10);\n\n if (\n !isNaN(parsedQuantity) &&\n Number.isInteger(parsedQuantity) &&\n parsedQuantity > 0\n ) {\n // Return the valid quantity from the URL\n return parsedQuantity;\n }\n }\n\n // Return the default quantity if the parameter is missing, invalid, or not positive\n return defaultQuantity;\n}\n","/**\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 { ProductModel } from '../models';\n\nimport { Product } from '../models/acdl-models';\n\nexport function transformProduct(product: ProductModel): Product {\n return {\n productId: Number(product?.externalId),\n name: product?.name,\n sku: product?.variantSku || product?.sku,\n topLevelSku: product?.sku,\n specialToDate: undefined,\n specialFromDate: undefined,\n newToDate: undefined,\n newFromDate: undefined,\n createdAt: undefined,\n updatedAt: undefined,\n manufacturer: undefined,\n countryOfManufacture: undefined,\n categories: undefined,\n productType: product?.productType,\n pricing: {\n regularPrice: product?.prices?.regular?.amount || 0,\n minimalPrice: product?.prices?.final?.minimumAmount,\n maximalPrice: product?.prices?.final?.maximumAmount,\n specialPrice: product?.prices?.final?.amount,\n tierPricing: undefined,\n currencyCode: product?.prices?.final?.currency || 'USD',\n },\n canonicalUrl: product?.url,\n mainImageUrl: product?.images?.[0]?.url,\n };\n}\n","/**\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\n/* Publish functions for the Adobe Client Data Layer (ACDL) */\n\nimport { ProductModel } from '../data/models';\nimport { transformProduct } from '../data/transforms/acdl-context';\n\n/**\n * See: https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-sdk/src/contexts.ts\n */\nexport const contexts = {\n PRODUCT_CONTEXT: 'productContext',\n CHANNEL_CONTEXT: 'channelContext',\n};\n\n/**\n * See: https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-sdk/src/events.ts\n */\nexport const events = {\n PRODUCT_PAGE_VIEW: 'product-page-view',\n};\n\nexport function getAdobeDataLayer() {\n // @ts-ignore\n window.adobeDataLayer = window.adobeDataLayer || [];\n // @ts-ignore\n return window.adobeDataLayer;\n}\n\nexport function getChannelContext() {\n return {\n _id: 'https://ns.adobe.com/xdm/channels/web',\n _type: 'https://ns.adobe.com/xdm/channel-types/web',\n };\n}\n\n/**\n * Sets a context in the Adobe Client Data Layer (ACDL)\n * Logic based on: https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-sdk/src/Base.ts#L6\n */\nfunction setContext(name: string, data: any) {\n const adobeDataLayer = getAdobeDataLayer();\n\n // Clear existing context\n adobeDataLayer.push({\n [name]: null,\n });\n\n // Set new context\n adobeDataLayer.push({\n [name]: data,\n });\n}\n\nexport function setChannelContext() {\n if (typeof window === 'undefined') {\n return;\n }\n\n setContext(contexts.CHANNEL_CONTEXT, getChannelContext());\n}\n\n/**\n * Pushes an event to the Adobe Client Data Layer (ACDL)\n * Logic based on: https://github.com/adobe/commerce-events/blob/1973d0ce28471ef190fa06dad6359ffa0ab51db6/packages/storefront-events-sdk/src/Base.ts#L34\n */\nfunction pushEvent(event: string, additionalContext?: any) {\n const adobeDataLayer = getAdobeDataLayer();\n\n adobeDataLayer.push((acdl: any) => {\n const state = acdl.getState ? acdl.getState() : {};\n\n acdl.push({\n event,\n eventInfo: {\n ...state,\n ...additionalContext,\n },\n });\n });\n}\n\n// Triggered when a product page is viewed\nexport function publishProductPageViewEvent(product: ProductModel) {\n const productItem = transformProduct(product);\n setContext(contexts.PRODUCT_CONTEXT, productItem);\n setChannelContext();\n pushEvent(events.PRODUCT_PAGE_VIEW);\n}\n","/**\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\n/**\n * ACDL Product Types from:\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-sdk/src/types/schemas/product.ts\n */\n\nexport type Product = {\n productId: number;\n name: string;\n sku: string;\n topLevelSku?: string | null;\n specialToDate?: string | null;\n specialFromDate?: string | null;\n newToDate?: string | null;\n newFromDate?: string | null;\n createdAt?: string | null;\n updatedAt?: string | null;\n manufacturer?: string | null;\n countryOfManufacture?: string | null;\n categories?: string[] | null;\n productType?: ProductType;\n pricing?: {\n regularPrice: number;\n minimalPrice?: number;\n maximalPrice?: number;\n specialPrice?: number;\n tierPricing?: {\n customerGroupId?: number | null;\n qty: number;\n value: number;\n }[];\n currencyCode: string | null;\n };\n canonicalUrl?: string | null;\n mainImageUrl?: string | null;\n};\n\nexport enum ProductType {\n ComplexProduct = 'complex',\n SimpleProduct = 'simple'\n}\n\nexport enum ProductViewType {\n ComplexProductView = 'ComplexProductView',\n SimpleProductView = 'SimpleProductView'\n}\n","/**\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 */\nimport { merge } from '@adobe-commerce/elsie/lib';\nimport { config } from '@/pdp/api';\nimport { ProductModel } from '@/pdp/data/models';\nimport { ProductType, ProductViewType } from '../models/acdl-models';\n\nexport function transformProductData(\n data: any,\n options?: {\n preselectFirstOption?: boolean;\n }\n): ProductModel | null {\n const isBundle =\n data?.options?.[0]?.values?.[0]?.__typename ===\n 'ProductViewOptionValueProduct';\n const optionUIDs = getOptionUIDs(\n data,\n isBundle,\n options?.preselectFirstOption\n );\n const productType =\n data?.__typename === ProductViewType.SimpleProductView\n ? ProductType.SimpleProduct\n : ProductType.ComplexProduct;\n\n const productData = data\n ? ({\n name: data.name,\n sku: data.sku,\n isBundle,\n addToCartAllowed: data.addToCartAllowed,\n inStock: data.inStock,\n shortDescription: data.shortDescription,\n metaDescription: data.metaDescription,\n metaKeyword: data.metaKeyword,\n metaTitle: data.metaTitle,\n description: data.description,\n images: transformImages(data),\n prices: transformPrices(data, isBundle, optionUIDs),\n attributes: transformAttributes(data),\n options: transformOptions(data, isBundle),\n optionUIDs,\n url: data.url,\n urlKey: data.urlKey,\n externalId: data.externalId,\n externalParentId: data.externalParentId,\n variantSku: data.variantSku,\n productType,\n } as ProductModel)\n : null;\n\n // extend the model with custom transformer\n return merge(\n productData,\n config.getConfig()?.models?.ProductDetails?.transformer?.(data) ??\n config.getConfig()?.models?.ProductDetails?.transform?.(data)\n );\n}\n\nfunction transformImages(data: any) {\n return data.images\n ?.filter((image: any) => !image.roles?.includes('hide_from_pdp'))\n ?.map((image: any) => {\n // Remove protocol from image URL\n image.url = image.url.replace(/^https?:/, '');\n\n return image;\n });\n}\n\nfunction transformAttributes(data: any) {\n return (\n data.attributes\n // only show attributes that are visible in PDP\n ?.filter(({ roles }: any) => roles?.indexOf('visible_in_pdp') !== -1)\n // transform attribute values\n ?.map(({ label, value, name }: any) => {\n // Special handling for ac_giftcard attribute\n if (name?.startsWith('ac_')) {\n try {\n let parsedValue;\n\n if (typeof value === 'string') {\n parsedValue = JSON.parse(value);\n } else if (typeof value === 'object') {\n parsedValue = value;\n }\n\n // Transform specific snake_case fields to camelCase\n const transformedValue = transformSnakeToCamel(parsedValue);\n return {\n id: name,\n label,\n value: JSON.stringify(transformedValue),\n };\n } catch {\n // If parsing fails, return original value\n return {\n id: name,\n label,\n value: value.toString().split(',').join(', '),\n };\n }\n }\n\n return {\n id: name,\n label,\n value: value.toString().split(',').join(', '),\n };\n })\n );\n}\n\nfunction transformSnakeToCamel(obj: any): any {\n if (Array.isArray(obj)) {\n return obj.map(transformSnakeToCamel);\n }\n\n if (obj !== null && typeof obj === 'object') {\n const transformed: any = {};\n for (const [key, value] of Object.entries(obj)) {\n // Only transform specific snake_case fields to camelCase\n let camelKey = key;\n if (key === 'validation_rule') {\n camelKey = 'validationRule';\n } else if (key === 'min_length') {\n camelKey = 'minLength';\n } else if (key === 'max_length') {\n camelKey = 'maxLength';\n }\n\n transformed[camelKey] = transformSnakeToCamel(value);\n }\n return transformed;\n }\n\n return obj;\n}\n\nfunction transformOptions(data: any, isBundle?: boolean) {\n const { options, optionUIDs } = data;\n\n return options?.map(({ id, title, required, multi, values }: any) => {\n const typename = values?.[0]?.__typename;\n let type: string = values?.[0].type;\n\n if (type) {\n type = type\n .replace('COLOR_HEX', 'color')\n .replace('TEXT', 'text')\n .replace('IMAGE', 'image');\n } else {\n type = 'dropdown';\n }\n\n return {\n id,\n type,\n typename,\n label: title,\n required,\n multiple: multi,\n items: isBundle\n ? mapBundleOptionValues(values, optionUIDs)\n : mapOptionValues(values, optionUIDs, type),\n };\n });\n}\n\nfunction mapBundleOptionValues(values: any, optionUIDs: string[]) {\n return values\n ?.filter(({ enabled }: any) => typeof enabled === 'undefined' || enabled)\n .map(({ id, title, inStock, isDefault, product }: any) => {\n return {\n id,\n inStock,\n label: title,\n selected: optionUIDs?.indexOf(id) > -1 || isDefault,\n value: id,\n product,\n };\n });\n}\n\nfunction mapOptionValues(values: any, optionUIDs: string[], type: string) {\n return values?.map(({ id, title, inStock, value }: any) => {\n return {\n id,\n inStock,\n label: title,\n selected: optionUIDs?.indexOf(id) > -1,\n value:\n type?.toLowerCase() === 'dropdown'\n ? id\n : value?.replace(/^https?:/, ''),\n };\n });\n}\n\nfunction transformPrices(\n data: any,\n isBundle: boolean,\n defaultOptionUIDs?: string[]\n) {\n const { price, priceRange, options, optionUIDs = defaultOptionUIDs } = data;\n let { __typename: type } = data;\n\n function getSimpleProductPrices() {\n const regularPrice = price?.regular.amount.value;\n const finalPrice =\n price?.final?.amount.value ?? price?.regular.amount.value;\n\n const currency =\n price?.regular.amount.currency === 'NONE' //temporary fix if there is no currency\n ? 'USD'\n : price?.regular.amount.currency;\n\n return [regularPrice, finalPrice, finalPrice, currency];\n }\n\n function getComplexProductPrices() {\n const finalMinimumPrice = priceRange?.minimum?.final.amount.value;\n const finalMaximumPrice = priceRange?.maximum?.final.amount.value;\n let regularPrice;\n\n if (\n priceRange?.minimum?.regular?.amount.value ===\n priceRange?.maximum?.regular?.amount.value\n ) {\n regularPrice = priceRange?.minimum?.regular?.amount.value;\n }\n\n const currency =\n priceRange?.minimum?.final?.amount.currency === 'NONE'\n ? 'USD'\n : priceRange?.minimum?.final?.amount.currency;\n\n return [regularPrice, finalMinimumPrice, finalMaximumPrice, currency];\n }\n\n function getBundleProductPrice() {\n // Currently the Catalog Service does not have support for the individual prices of the options of a fixed bundle,\n // so the price used in UI is taken from the priceRange object.\n\n // The dynamic bundle has full support in Catalog Service.\n // If there are pre-selected values of the option, then the starting price is the sum of those and\n // after each selection, the price is updated with the sum of prices for the selected options.\n // This is not supported by default and needs to be updated in the drop-in upon each selection.\n\n let maxSumRegular = 0;\n let bundlePrice = 0;\n options?.forEach((option: any) => {\n const values = option?.values;\n if (values && Array.isArray(values)) {\n const regularAmounts = values\n .map((value) => value?.product?.price?.regular?.amount?.value)\n .filter((amount) => amount !== undefined);\n\n const maxRegularAmount =\n regularAmounts.length > 0 ? Math.max(...regularAmounts) : 0;\n maxSumRegular += maxRegularAmount;\n }\n option?.values?.forEach((value: any) => {\n if (optionUIDs?.includes(value.id)) {\n bundlePrice += value?.product?.price?.final?.amount?.value;\n }\n });\n });\n\n const finalMinimumPrice = priceRange?.minimum?.final.amount.value;\n const finalMaximumPrice = priceRange?.maximum?.final.amount.value;\n let regularPrice;\n\n if (\n priceRange?.minimum?.regular?.amount.value ===\n priceRange?.maximum?.regular?.amount.value\n ) {\n regularPrice = priceRange?.minimum?.regular?.amount.value;\n }\n\n const currency =\n priceRange?.minimum?.final?.amount.currency === 'NONE'\n ? 'USD'\n : priceRange?.minimum?.final?.amount.currency;\n\n if (isBundle && optionUIDs?.length < 1) {\n return [regularPrice, finalMinimumPrice, finalMaximumPrice, currency];\n }\n\n return maxSumRegular === priceRange?.maximum?.regular.amount.value\n ? [bundlePrice, bundlePrice, bundlePrice, currency]\n : [regularPrice, finalMinimumPrice, finalMaximumPrice, currency];\n }\n\n const [regularPrice, finalMinimumPrice, finalMaximumPrice, currency] =\n type === 'SimpleProductView'\n ? getSimpleProductPrices()\n : isBundle\n ? getBundleProductPrice()\n : getComplexProductPrices();\n\n const visible =\n type === 'SimpleProductView'\n ? price?.roles?.includes('visible')\n : priceRange?.maximum?.roles?.includes('visible') &&\n priceRange?.minimum?.roles?.includes('visible');\n\n function transformTiers(tiers: any[]): any[] {\n if (!tiers || !Array.isArray(tiers)) {\n return [];\n }\n\n return tiers\n .map((tier) => ({\n tier: {\n amount: tier.tier?.amount?.value,\n currency: tier.tier?.amount?.currency || currency,\n },\n quantity: tier.quantity[0]?.gte || tier.quantity[0]?.lt || 0,\n }))\n .sort((a, b) => a.quantity - b.quantity);\n }\n\n if (finalMaximumPrice && finalMinimumPrice === finalMaximumPrice) {\n const hasDiscount = regularPrice && finalMinimumPrice !== regularPrice;\n\n return {\n regular: {\n amount: regularPrice,\n currency,\n variant: hasDiscount ? 'strikethrough' : 'default',\n },\n final: {\n amount: finalMaximumPrice,\n currency,\n variant: 'default',\n },\n tiers: transformTiers(price?.tiers),\n visible,\n };\n }\n\n return {\n final: {\n minimumAmount: finalMinimumPrice,\n maximumAmount: finalMaximumPrice,\n currency,\n },\n tiers: transformTiers(price?.tiers),\n visible,\n };\n}\n\nfunction getOptionUIDs(\n data: any,\n isBundle?: boolean,\n preselectFirstOption?: boolean\n): string[] {\n if (isBundle) {\n const selections: Array<string | null> = data?.options?.map(\n ({ values }: any) => {\n const defaultSelection =\n values?.find(({ isDefault }: any) => isDefault)?.id ?? null;\n const preselectedFirstOption = preselectFirstOption\n ? values[0].id\n : null;\n return defaultSelection || preselectedFirstOption;\n }\n );\n\n return selections.filter((selection) => selection !== null) as string[];\n }\n\n return data?.optionUIDs;\n}\n","/**\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 { Initializer } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { ProductModel } from '@/pdp/data/models';\nimport {\n fetchProductData,\n setProductConfigurationValid,\n setProductConfigurationValues,\n} from '@/pdp/api';\nimport { events } from '@adobe-commerce/event-bus';\nimport {\n getUrlParams,\n getValidatedQuantityFromUrl,\n} from '@/pdp/lib/url-params';\nimport { publishProductPageViewEvent } from '@/pdp/lib/acdl';\nimport { transformProductData } from '@/pdp/data/transforms/product-transform';\n\ntype ConfigProps = {\n scope?: string;\n langDefinitions?: Lang;\n defaultLocale?: string;\n globalLocale?: string;\n sku?: string;\n acdl?: boolean;\n anchors?: string[];\n persistURLParams?: boolean;\n preselectFirstOption?: boolean;\n optionsUIDs?: string[];\n models?: {\n [name: string]: {\n initialData: any;\n /** @deprecated Use \"transformer\" instead */\n transform?: (data?: ProductModel) => ProductModel;\n transformer?: (data?: ProductModel) => ProductModel;\n fallbackData?: (\n parentProduct: any,\n simpleProduct: ProductModel\n ) => ProductModel;\n };\n };\n};\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (_config) => {\n const initialData = _config?.models?.ProductDetails?.initialData;\n\n // Get URL parameters safely\n const urlParams = getUrlParams() || {};\n\n // Get optionsUIDs from URL params or config\n const optionsUIDs =\n urlParams.optionsUIDs?.split(',') || initialData?.optionsUIDs;\n\n // Get and validate quantity from URL params\n const initialQuantity = getValidatedQuantityFromUrl(1); // Default quantity to 1 - Ensures backward compatibility\n\n // Set default config\n const defaultConfig: ConfigProps = {\n defaultLocale: 'en-US',\n globalLocale: 'en-US',\n persistURLParams: false,\n acdl: false,\n optionsUIDs,\n };\n\n const config = { ...defaultConfig, ..._config };\n\n initialize.config.setConfig({ ...config });\n\n if (config?.sku) {\n // Get PDP data\n const data = initialData\n ? transformProductData(initialData)\n : await fetchProductData(config.sku, {\n preselectFirstOption: config.preselectFirstOption,\n });\n\n // Emit PDP initial data\n events.emit('pdp/data', data, { scope: config.scope });\n\n // Set default values for product configuration\n const defaultValues = {\n sku: config.sku,\n quantity: initialQuantity, // Use the determined quantity from URL params or default to 1\n optionsUIDs: data?.optionUIDs,\n };\n\n setProductConfigurationValues(() => ({ ...defaultValues }), {\n scope: config.scope,\n });\n\n setProductConfigurationValid(\n () => {\n // configurable product, check if all options are selected\n if (data?.options) {\n // all selections should be made\n return data.options.length === data?.optionUIDs?.length;\n }\n\n // simple product\n return true;\n },\n { scope: config.scope }\n );\n\n // Publish ACDL event\n if (config.acdl && data) {\n publishProductPageViewEvent(data);\n }\n }\n },\n\n listeners: () => [\n events.on('locale', async () => {\n const { sku, scope } = initialize.config.getConfig();\n\n if (sku) {\n const next = await fetchProductData(sku);\n events.emit('pdp/data', next, { scope });\n }\n }),\n ],\n});\n\nexport const config = initialize.config;\n","/**\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 { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n getFetchGraphQlHeader,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n","/**\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 { PRODUCT_FRAGMENT } from '@/pdp/api/graphql/ProductFragment.graphql';\n\nexport const GET_PRODUCT_DATA = `\nquery GET_PRODUCT_DATA($skus: [String]) {\n products(skus: $skus) {\n ...PRODUCT_FRAGMENT\n }\n}\n\n${PRODUCT_FRAGMENT}\n`;\n","/**\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 { fetchGraphQl } from '@/pdp/api';\nimport { ProductModel } from '@/pdp/data/models';\nimport { transformProductData } from '@/pdp/data/transforms';\nimport { GET_PRODUCT_DATA } from './graphql/getProductData.graphql';\n\nexport const getProductData = async (\n sku: string,\n options?: {\n preselectFirstOption?: boolean;\n optionsUIDs?: string[];\n },\n raw?: boolean\n): Promise<ProductModel | null> => {\n const { data } = await fetchGraphQl(GET_PRODUCT_DATA, {\n method: 'GET',\n variables: { skus: [sku] },\n });\n\n const product = data?.products?.[0];\n\n // If optionsUIDs are provided, override the optionsUIDs from the response\n if (options?.optionsUIDs) {\n product.optionUIDs = options.optionsUIDs;\n }\n\n if (!product) {\n return null;\n }\n return raw\n ? product\n : transformProductData(product, {\n preselectFirstOption: options?.preselectFirstOption,\n });\n};\n","/**\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 { PRODUCT_FRAGMENT } from '@/pdp/api/graphql/ProductFragment.graphql';\n\nexport const REFINE_PRODUCT_QUERY = `\nquery REFINE_PRODUCT_QUERY(\n $optionIds: [String!]!\n $sku: String!\n) {\n # Refined Product\n refineProduct(\n optionIds: $optionIds \n sku: $sku\n ) {\n ...PRODUCT_FRAGMENT\n }\n\n # Parent Product\n products(skus: [$sku]) {\n ...PRODUCT_FRAGMENT\n }\n\n # %extendedPlaceholder%\n}\n\n${PRODUCT_FRAGMENT}\n`;\n","/**\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 { fetchGraphQl, config } from '@/pdp/api';\nimport { ProductModel } from '@/pdp/data/models';\nimport { transformProductData } from '@/pdp/data/transforms';\nimport { REFINE_PRODUCT_QUERY } from './graphql/RefineProductQuery.graphql';\n\nasync function getProductData(sku: string, optionUIDs: string[]): Promise<any> {\n const optionPairCombinations = getPairCombination(optionUIDs);\n const optionQueries = getProductOptionQuery(optionPairCombinations, sku);\n\n const mergedQueries = REFINE_PRODUCT_QUERY.replace(\n '# %extendedPlaceholder%',\n optionQueries\n );\n\n const { data } = await fetchGraphQl(mergedQueries, {\n method: 'GET',\n variables: { optionIds: optionUIDs, sku },\n });\n return data;\n}\n\nexport const getRefinedProduct = async (\n sku: string,\n optionUIDs: string[],\n anchorOptions?: string[],\n raw?: boolean\n): Promise<ProductModel | null> => {\n const data = await getProductData(sku, optionUIDs);\n if (!data) return null;\n\n let { products, refineProduct, ...refinedOptions } = data;\n\n const parent = products?.[0];\n\n const options = mergeRefinedOptions(\n Object.values(refinedOptions),\n parent.options,\n anchorOptions\n );\n\n // needed when anchor options exist\n if (anchorOptions?.length && refineProduct === null) {\n optionUIDs = updateSelections(options, optionUIDs, anchorOptions);\n const updatedRefinedData = await getProductData(sku, optionUIDs);\n refineProduct = updatedRefinedData?.refineProduct;\n }\n\n const response = {\n ...(refineProduct || parent),\n sku: parent.sku,\n name: parent.name,\n externalParentId: parent?.externalId,\n options,\n optionUIDs,\n variantSku:\n refineProduct?.__typename === 'SimpleProductView'\n ? refineProduct?.sku\n : undefined,\n };\n\n const refinedData = raw ? response : transformProductData(response);\n\n const fallback = config?.getConfig()?.models?.ProductDetails?.fallbackData;\n\n if (fallback) {\n return fallback(parent, refinedData!);\n }\n\n return refinedData;\n};\n\nfunction getPairCombination(arr: string[]): string[][] {\n if (arr.length < 2) {\n return [arr];\n }\n\n const result: string[][] = [];\n\n arr.forEach((item) => {\n const temp: string[] = [];\n\n arr.forEach((item2) => {\n if (item !== item2) {\n temp.push(item2);\n }\n });\n\n result.push(temp);\n });\n\n return result;\n}\n\nfunction getProductOptionQuery(optionUIDs: string[][], sku: string): string {\n return optionUIDs\n .map((ids: string[], i: number) => {\n return `\n ProductOption${i}: refineProduct(\n optionIds: [\n ${ids.map((id) => `\"${id}\"`).join(', ')}\n ]\n sku: \"${sku}\"\n ) {\n ... on ComplexProductView {\n options {\n ...PRODUCT_OPTION_FRAGMENT\n }\n }\n }\n `;\n })\n .join('');\n}\n\nfunction mergeRefinedOptions(\n options: {},\n parent: [] = [],\n anchorOptions?: string[]\n) {\n // flat _refined[].options[] to _refinedOptions[]\n const refinedOptions: any = Object.values(options)\n .filter((x) => !!x)\n .reduce((acc: any, curr: any) => {\n if (!curr.options) return [...acc];\n\n return [...acc, ...curr.options];\n }, []);\n\n // Create a map to store items by their id from original\n const map = new Map(parent.map((item: any) => [item.id, item]));\n\n // Iterate through refinedOptions and merge items\n refinedOptions.forEach((current: any) => {\n // anchor options should display all values, so no merge is performed\n if (anchorOptions?.includes(current.id)) {\n return;\n }\n\n map.set(current.id, current);\n });\n\n return [...map.values()];\n}\n\nfunction updateSelections(\n options: any[],\n optionsUIDs: string[],\n anchorOptions: string[]\n): string[] {\n const updatedOptionsUIDs: string[] = [];\n\n let optionValue: string;\n options.forEach((option: any) => {\n if (anchorOptions.includes(option.id)) {\n optionValue =\n option.values?.find((value: any) => optionsUIDs.includes(value?.id))\n ?.id || option.values[0]?.id;\n } else {\n optionValue = option.values[0]?.id; // TODO check if we should use default value instead\n }\n updatedOptionsUIDs.push(optionValue);\n });\n return updatedOptionsUIDs;\n}\n","/**\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 { getProductData, getRefinedProduct, config } from '@/pdp/api';\n\nexport type Options = {\n anchors?: string[];\n optionsUIDs?: string[];\n preselectFirstOption?: boolean;\n isBundle?: boolean;\n skipTransform?: boolean;\n};\n\nexport const fetchProductData = async (sku: string, options?: Options) => {\n // Get the default configuration values\n const { anchors: defaultAnchors, optionsUIDs: defaultOptionsUIDs } =\n config.getConfig();\n\n // Destructure the options object\n const {\n optionsUIDs = defaultOptionsUIDs,\n anchors = defaultAnchors,\n preselectFirstOption,\n isBundle,\n skipTransform,\n } = options ?? {};\n\n // ❗️ Warning ❗️\n // If we have default selections, but we cannot determine that the product is of type bundle, then the response is going to result in null objects and error(s).\n // Only the `products` object will be populated correctly, the `ProductOption${i}` and `refinedProduct` will be set as null.\n // This does not affect the UI, but the error message(s) can be detected by 3rd party tools that the client might be using.\n // This is accepted as a known behaviour, since a bundle product does not have variants.\n // However, if initialData is passed from the integration layer, then we can determine if the product is a bundle and set the isBundle flag accordingly.\n return !isBundle && optionsUIDs\n ? await getRefinedProduct(sku, optionsUIDs, anchors, skipTransform)\n : await getProductData(\n sku,\n {\n preselectFirstOption,\n optionsUIDs,\n },\n skipTransform\n );\n};\n"],"names":["setUrlParams","params","urlSearchParams","key","value","url","getUrlParams","getValidatedQuantityFromUrl","defaultQuantity","quantityParam","parsedQuantity","transformProduct","product","_b","_a","_d","_c","_f","_e","_h","_g","_j","_i","_l","_k","contexts","events","getAdobeDataLayer","getChannelContext","setContext","name","data","adobeDataLayer","setChannelContext","pushEvent","event","additionalContext","acdl","state","publishProductPageViewEvent","productItem","ProductType","ProductViewType","transformProductData","options","isBundle","optionUIDs","getOptionUIDs","productType","productData","transformImages","transformPrices","transformAttributes","transformOptions","merge","config","image","roles","label","parsedValue","transformedValue","transformSnakeToCamel","obj","transformed","camelKey","id","title","required","multi","values","typename","type","mapBundleOptionValues","mapOptionValues","enabled","inStock","isDefault","defaultOptionUIDs","price","priceRange","getSimpleProductPrices","regularPrice","finalPrice","currency","getComplexProductPrices","finalMinimumPrice","finalMaximumPrice","getBundleProductPrice","maxSumRegular","bundlePrice","option","regularAmounts","amount","maxRegularAmount","_m","visible","transformTiers","tiers","tier","a","b","preselectFirstOption","defaultSelection","preselectedFirstOption","selection","initialize","Initializer","_config","initialData","optionsUIDs","initialQuantity","fetchProductData","defaultValues","setProductConfigurationValues","setProductConfigurationValid","sku","scope","next","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","getFetchGraphQlHeader","fetchGraphQl","getConfig","FetchGraphQL","GET_PRODUCT_DATA","PRODUCT_FRAGMENT","getProductData","raw","REFINE_PRODUCT_QUERY","optionPairCombinations","getPairCombination","optionQueries","getProductOptionQuery","mergedQueries","getRefinedProduct","anchorOptions","products","refineProduct","refinedOptions","parent","mergeRefinedOptions","updateSelections","updatedRefinedData","response","refinedData","fallback","arr","result","item","temp","item2","ids","i","x","acc","curr","map","current","updatedOptionsUIDs","optionValue","defaultAnchors","defaultOptionsUIDs","anchors","skipTransform"],"mappings":"wSAgBO,SAASA,GACdC,EACM,CACN,MAAMC,EAAkB,IAAI,gBAAgB,OAAO,SAAS,MAAM,EAE3D,OAAA,QAAQD,CAAM,EAAE,QAAQ,CAAC,CAACE,EAAKC,CAAK,IAAM,CAC3CA,IAAU,KACZF,EAAgB,OAAOC,CAAG,EAE1BD,EAAgB,IAAIC,EAAK,OAAOC,CAAK,CAAC,CACxC,CACD,EAEG,IAAAC,EAAM,OAAO,SAAS,SACnBA,GAAA,IAAIH,EAAgB,SAAU,CAAA,GACrCG,GAAO,OAAO,SAAS,KAEvB,OAAO,QAAQ,aAAa,CAAA,EAAI,GAAIA,CAAG,CACzC,CAEO,SAASC,IAAuC,CACrD,MAAMJ,EAAkB,IAAI,gBAAgB,OAAO,SAAS,MAAM,EAC5DD,EAAiC,CAAC,EAExB,OAAAC,EAAA,QAAQ,CAACE,EAAOD,IAAQ,CACtCF,EAAOE,CAAG,EAAIC,CAAA,CACf,EAEMH,CACT,CAEgB,SAAAM,GACdC,EAA0B,EAClB,CAER,MAAMC,GADYH,GAAa,GAAK,CAAC,GACL,SAEhC,GAAIG,EAAe,CACX,MAAAC,EAAiB,SAASD,EAAe,EAAE,EAG/C,GAAA,CAAC,MAAMC,CAAc,GACrB,OAAO,UAAUA,CAAc,GAC/BA,EAA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copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsxs as m,jsx as
|
|
3
|
+
import{jsxs as m,jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{useState as s,useMemo as P,useEffect as A}from"@dropins/tools/preact-compat.js";import{classes as L,Slot as _}from"@dropins/tools/lib.js";import{events as u}from"@dropins/tools/event-bus.js";import{i as j,t as C}from"../chunks/date.js";import{g as I}from"../chunks/getFetchedProductData.js";import{useText as M}from"@dropins/tools/i18n.js";import{c as N}from"../chunks/fetchProductData.js";import"../fragments.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/isProductConfigurationValid.js";const T=({initialData:f=null,scope:i,children:y,slots:e,...c})=>{var l;const p=M("PDP.Product.Details.label").label,{globalLocale:b="en-US"}=N.getConfig(),[d,g]=s(b),[r,D]=s(f),h=P(()=>({data:r}),[r]);return A(()=>{const t=u.on("pdp/data",D,{scope:i}),o=u.on("locale",g);return()=>{t==null||t.off(),o==null||o.off()}},[i]),r?m("div",{...c,className:L(["pdp-attributes",c.className]),children:[p,e!=null&&e.Attributes?n(_,{name:"Attributes",slot:e==null?void 0:e.Attributes,context:{...h}}):n("ul",{children:(l=r==null?void 0:r.attributes)==null?void 0:l.map(({id:t,label:o,value:a},S)=>{if(t!=null&&t.startsWith("ac_")||!a)return null;const x=j(a)?C(a,d):a.toString();return m("li",{children:[o,": ",n("span",{dangerouslySetInnerHTML:{__html:x}})]},`attribute-${S}`)})})]}):null};T.getInitialData=I;export{T as ProductAttributes,T as default};
|
|
4
4
|
//# sourceMappingURL=ProductAttributes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductAttributes.js","sources":["/@dropins/storefront-pdp/src/containers/ProductAttributes/ProductAttributes.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, useMemo } from 'preact/compat';\nimport { classes, Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { ProductModel } from '@/pdp/data/models';\nimport { isDateValid, toDateString } from '@/pdp/lib/date';\nimport { config, getFetchedProductData } from '@/pdp/api';\n\ntype DefaultSlotContext = {\n data: ProductModel | null;\n};\n\nexport interface ProductAttributesProps extends HTMLAttributes<HTMLDivElement> {\n scope?: string;\n slots?: {\n Attributes?: SlotProps<DefaultSlotContext>;\n };\n}\n\nexport const ProductAttributes: Container<\n ProductAttributesProps,\n ProductModel | null\n> = ({ initialData = null, scope, children, slots, ...props }) => {\n const DetailsLabel = useText('PDP.Product.Details.label').label;\n const { globalLocale = 'en-US' } = config.getConfig();\n\n const [locale, setLocale] = useState<string>(globalLocale);\n const [data, setData] = useState<ProductModel | null>(initialData);\n\n const defaultSlotContext: DefaultSlotContext = useMemo(\n () => ({ data }),\n [data]\n );\n\n // Listen for events\n useEffect(() => {\n const dataEvent = events.on('pdp/data', setData, { scope });\n const localeEvent = events.on('locale', setLocale);\n\n return () => {\n dataEvent?.off();\n localeEvent?.off();\n };\n }, [scope]);\n\n if (!data) return null;\n\n return (\n <div {...props} className={classes(['pdp-attributes', props.className])}>\n {DetailsLabel}\n {slots?.Attributes ? (\n <Slot\n name=\"Attributes\"\n slot={slots?.Attributes}\n context={{ ...defaultSlotContext }}\n />\n ) : (\n <ul>\n {data?.attributes?.map(\n (\n { id, label, value }: { id: string; label: string; value: any },\n index: number\n ) => {\n if (id
|
|
1
|
+
{"version":3,"file":"ProductAttributes.js","sources":["/@dropins/storefront-pdp/src/containers/ProductAttributes/ProductAttributes.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, useMemo } from 'preact/compat';\nimport { classes, Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { ProductModel } from '@/pdp/data/models';\nimport { isDateValid, toDateString } from '@/pdp/lib/date';\nimport { config, getFetchedProductData } from '@/pdp/api';\n\ntype DefaultSlotContext = {\n data: ProductModel | null;\n};\n\nexport interface ProductAttributesProps extends HTMLAttributes<HTMLDivElement> {\n scope?: string;\n slots?: {\n Attributes?: SlotProps<DefaultSlotContext>;\n };\n}\n\nexport const ProductAttributes: Container<\n ProductAttributesProps,\n ProductModel | null\n> = ({ initialData = null, scope, children, slots, ...props }) => {\n const DetailsLabel = useText('PDP.Product.Details.label').label;\n const { globalLocale = 'en-US' } = config.getConfig();\n\n const [locale, setLocale] = useState<string>(globalLocale);\n const [data, setData] = useState<ProductModel | null>(initialData);\n\n const defaultSlotContext: DefaultSlotContext = useMemo(\n () => ({ data }),\n [data]\n );\n\n // Listen for events\n useEffect(() => {\n const dataEvent = events.on('pdp/data', setData, { scope });\n const localeEvent = events.on('locale', setLocale);\n\n return () => {\n dataEvent?.off();\n localeEvent?.off();\n };\n }, [scope]);\n\n if (!data) return null;\n\n return (\n <div {...props} className={classes(['pdp-attributes', props.className])}>\n {DetailsLabel}\n {slots?.Attributes ? (\n <Slot\n name=\"Attributes\"\n slot={slots?.Attributes}\n context={{ ...defaultSlotContext }}\n />\n ) : (\n <ul>\n {data?.attributes?.map(\n (\n { id, label, value }: { id: string; label: string; value: any },\n index: number\n ) => {\n if (id?.startsWith('ac_') || !value) {\n return null;\n }\n\n const __html = isDateValid(value)\n ? toDateString(value, locale)\n : value.toString();\n\n return (\n <li key={`attribute-${index}`}>\n {/* eslint-disable-next-line react/no-danger */}\n {label}: <span dangerouslySetInnerHTML={{ __html }} />\n </li>\n );\n }\n )}\n </ul>\n )}\n </div>\n );\n};\n\nProductAttributes.getInitialData = getFetchedProductData;\n"],"names":["ProductAttributes","initialData","scope","children","slots","props","DetailsLabel","useText","globalLocale","config","locale","setLocale","useState","data","setData","defaultSlotContext","useMemo","useEffect","dataEvent","events","localeEvent","jsxs","classes","jsx","Slot","_a","id","label","value","index","__html","isDateValid","toDateString","getFetchedProductData"],"mappings":"mkBAmCa,MAAAA,EAGT,CAAC,CAAE,YAAAC,EAAc,KAAM,MAAAC,EAAO,SAAAC,EAAU,MAAAC,EAAO,GAAGC,KAAY,OAC1D,MAAAC,EAAeC,EAAQ,2BAA2B,EAAE,MACpD,CAAE,aAAAC,EAAe,SAAYC,EAAO,UAAU,EAE9C,CAACC,EAAQC,CAAS,EAAIC,EAAiBJ,CAAY,EACnD,CAACK,EAAMC,CAAO,EAAIF,EAA8BX,CAAW,EAE3Dc,EAAyCC,EAC7C,KAAO,CAAE,KAAAH,CAAK,GACd,CAACA,CAAI,CACP,EAaI,OAVJI,EAAU,IAAM,CACd,MAAMC,EAAYC,EAAO,GAAG,WAAYL,EAAS,CAAE,MAAAZ,EAAO,EACpDkB,EAAcD,EAAO,GAAG,SAAUR,CAAS,EAEjD,MAAO,IAAM,CACXO,GAAA,MAAAA,EAAW,MACXE,GAAA,MAAAA,EAAa,KACf,CAAA,EACC,CAAClB,CAAK,CAAC,EAELW,EAGHQ,EAAC,MAAK,CAAA,GAAGhB,EAAO,UAAWiB,EAAQ,CAAC,iBAAkBjB,EAAM,SAAS,CAAC,EACnE,SAAA,CAAAC,EACAF,GAAA,MAAAA,EAAO,WACNmB,EAACC,EAAA,CACC,KAAK,aACL,KAAMpB,GAAA,YAAAA,EAAO,WACb,QAAS,CAAE,GAAGW,CAAmB,CAAA,CAAA,EAGnCQ,EAAC,KACE,CAAA,UAAAE,EAAAZ,GAAA,YAAAA,EAAM,aAAN,YAAAY,EAAkB,IACjB,CACE,CAAE,GAAAC,EAAI,MAAAC,EAAO,MAAAC,CAAA,EACbC,IACG,CACH,GAAIH,GAAA,MAAAA,EAAI,WAAW,QAAU,CAACE,EACrB,OAAA,KAGH,MAAAE,EAASC,EAAYH,CAAK,EAC5BI,EAAaJ,EAAOlB,CAAM,EAC1BkB,EAAM,SAAS,EAEnB,SACG,KAEE,CAAA,SAAA,CAAAD,EAAM,KAAGJ,EAAA,OAAA,CAAK,wBAAyB,CAAE,OAAAO,EAAU,CAAA,CAF7C,CAAA,EAAA,aAAaD,CAAK,EAG3B,CAAA,EAIR,CAAA,CAAA,EAEJ,EApCgB,IAsCpB,EAEA7B,EAAkB,eAAiBiC"}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name": "@dropins/storefront-pdp", "version": "
|
|
1
|
+
{"name": "@dropins/storefront-pdp", "version": "3.0.0-beta1", "@dropins/tools": "~1.5.0", "license": "SEE LICENSE IN LICENSE.md"}
|