@dropins/storefront-checkout 3.0.0-beta2 → 3.0.0-beta4

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: 28 October 2024
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 (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.
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 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.
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 (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.
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 “**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**”).__
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 “**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.
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 “**Developer Product(s)**” means any software application(s), program(s) and other teconolog(y/ies) you develop with use of the Drop-in to function or interoperate with Adobe Products.
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 “**Intellectual Property Rights**” means copyright, moral rights, trademark, trade dress, patent, trade secret, unfair competition, and any other intellectual and proprietary rights.
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 “**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.
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 the Adobe-approved platform.
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, creative 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.
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 Adobes and its licensors Intellectual Proprietary Rights in the Drop-in are protected.
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 anothers 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.
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 license 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.
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 Adobes 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.
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 Adobes 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_.
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, “**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.
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 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.**
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 **Adobes 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.**
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 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.
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 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.
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 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.
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-20241028_v1
127
+ Adobe Commerce Drop-in License Agreement_en_US-20251208_v1
package/api.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{a as A,c as G,g as S,b as T,i as k,d as y,r as O,s as F}from"./chunks/synchronizeCheckout.js";import{e as b,s as H}from"./chunks/setShippingAddress.js";import{d as o}from"./chunks/fetch-graphql.js";import{D as Q,S as U,f as R,g as q,e as v,i as z,r as D,a as K,b as L,c as w}from"./chunks/fetch-graphql.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import{A as s}from"./chunks/checkout.js";import{g as I}from"./chunks/getCompanyCredit.js";import{g as V,i as Y,s as j}from"./chunks/setGuestEmailOnCart.js";import{s as W}from"./chunks/setBillingAddress.js";import{s as Z}from"./chunks/setPaymentMethod.js";import{s as ee,s as te}from"./chunks/setShippingMethods.js";import"./fragments.js";import"./chunks/transform-shipping-methods.js";import"./chunks/classifiers.js";import"./chunks/transform-shipping-estimate.js";import"./chunks/values.js";import"./chunks/guards.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";const r=t=>t?t.filter(e=>!!e).map(e=>({id:e.agreement_id,name:e.name,mode:s[e.mode],text:e.checkbox_text,content:{value:e.content,html:e.is_html,height:e.content_height??null}})):[],a=`
3
+ import{a as A,c as G,g as S,b as T,i as k,d as y,r as O,s as F}from"./chunks/synchronizeCheckout.js";import{e as b,s as H}from"./chunks/setShippingAddress.js";import{d as o}from"./chunks/fetch-graphql.js";import{D as Q,S as U,f as R,g as q,e as v,j as z,r as D,a as K,b as L,c as j}from"./chunks/fetch-graphql.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import{A as s}from"./chunks/checkout.js";import{g as B}from"./chunks/getCompanyCredit.js";import{g as P,i as V,s as Y}from"./chunks/setGuestEmailOnCart.js";import{s as W}from"./chunks/setBillingAddress.js";import{s as Z}from"./chunks/setPaymentMethod.js";import{s as ee,s as te}from"./chunks/setShippingMethods.js";import"./fragments.js";import"./chunks/transform-shipping-methods.js";import"./chunks/classifiers.js";import"./chunks/transform-shipping-estimate.js";import"./chunks/values.js";import"./chunks/guards.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";const r=t=>t?t.filter(e=>!!e).map(e=>({id:e.agreement_id,name:e.name,mode:s[e.mode],text:e.checkbox_text,content:{value:e.content,html:e.is_html,height:e.content_height??null}})):[],a=`
4
4
  query GET_CHECKOUT_AGREEMENTS {
5
5
  checkoutAgreements {
6
6
  agreement_id
@@ -12,5 +12,5 @@ import{a as A,c as G,g as S,b as T,i as k,d as y,r as O,s as F}from"./chunks/syn
12
12
  name
13
13
  }
14
14
  }
15
- `,E=async()=>await o({defaultValueOnFail:[],options:{method:"GET",cache:"no-cache"},path:"checkoutAgreements",query:a,transformer:r,type:"query"});export{Q as DEFAULT_COUNTRY,U as STORE_CONFIG_DEFAULTS,A as authenticateCustomer,G as config,b as estimateShippingMethods,R as fetchGraphQl,S as getCart,E as getCheckoutAgreements,I as getCompanyCredit,q as getConfig,V as getCustomer,T as getNegotiableQuote,v as getStoreConfig,z as getStoreConfigCache,k as initialize,y as initializeCheckout,Y as isEmailAvailable,D as removeFetchGraphQlHeader,O as resetCheckout,W as setBillingAddress,K as setEndpoint,L as setFetchGraphQlHeader,w as setFetchGraphQlHeaders,j as setGuestEmailOnCart,Z as setPaymentMethod,H as setShippingAddress,ee as setShippingMethods,te as setShippingMethodsOnCart,F as synchronizeCheckout};
15
+ `,E=async()=>await o({defaultValueOnFail:[],options:{method:"GET",cache:"no-cache"},path:"checkoutAgreements",query:a,transformer:r,type:"query"});export{Q as DEFAULT_COUNTRY,U as STORE_CONFIG_DEFAULTS,A as authenticateCustomer,G as config,b as estimateShippingMethods,R as fetchGraphQl,S as getCart,E as getCheckoutAgreements,B as getCompanyCredit,q as getConfig,P as getCustomer,T as getNegotiableQuote,v as getStoreConfig,z as getStoreConfigCache,k as initialize,y as initializeCheckout,V as isEmailAvailable,D as removeFetchGraphQlHeader,O as resetCheckout,W as setBillingAddress,K as setEndpoint,L as setFetchGraphQlHeader,j as setFetchGraphQlHeaders,Y as setGuestEmailOnCart,Z as setPaymentMethod,H as setShippingAddress,ee as setShippingMethods,te as setShippingMethodsOnCart,F as synchronizeCheckout};
16
16
  //# sourceMappingURL=api.js.map
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import"@dropins/tools/lib.js";import{events as D}from"@dropins/tools/event-bus.js";import{signal as S,computed as m}from"@dropins/tools/signals.js";import{FetchGraphQL as U}from"@dropins/tools/fetch-graphql.js";const G={authenticated:!1,cartId:null,config:null,initialized:!1,quoteId:null},I=new Proxy(G,{set(e,t,s){return e[t]=s,!0},get(e,t){return e[t]}});function V(){return I.quoteId!==null}var u=(e=>(e.EXCLUDING_TAX="EXCLUDING_TAX",e.INCLUDING_EXCLUDING_TAX="INCLUDING_AND_EXCLUDING_TAX",e.INCLUDING_TAX="INCLUDING_TAX",e))(u||{}),w=(e=>(e.Updates="updates",e.Default="default",e.ShippingEstimate="shippingEstimate",e))(w||{});const d=new Map,g=new Map,c=S(new Set),E=new Map;E.set("updates",e=>{D.emit("checkout/updated",e)});async function A(e){g.set(e,!0);const t=d.get(e);let s;for(;t.length>0;){const i=t.shift();try{const r=await i.requestFn();i.resolve(r),s=r}catch(r){i.reject(r)}}g.set(e,!1);const n=new Set(c.value);n.delete(e),c.value=n;const a=E.get(e);a&&s&&a(s)}function q(e,t="default"){d.has(t)||d.set(t,[]);const s=d.get(t),n=new Promise((i,r)=>{s.push({requestFn:e,resolve:i,reject:r})}),a=new Set(c.value);return a.add(t),c.value=a,g.get(t)||A(t),n}const B=m(()=>c.value.has("updates")),$=m(()=>c.value.has("shippingEstimate")),X=["sender_email","recipient_email"];function v(e){return e.filter(t=>!t.path||!X.some(s=>{var n;return((n=t.path)==null?void 0:n.at(-1))===s}))}class T extends Error{constructor(t){super(t.map(s=>s.message).join(" ")),this.name="FetchError"}}class N extends Error{constructor(t){super(t),this.name="InvalidInput"}}class o extends N{constructor(t){super(`${t} is required.`)}}class z extends o{constructor(){super("Cart ID")}}class Y extends N{constructor(){super("Either Cart ID or Quote ID is required.")}}class J extends Error{constructor(){super("User is not authenticated")}}class K extends o{constructor(){super("Negotiable Quote ID")}}class W extends o{constructor(){super("Email")}}class Z extends o{constructor(){super("Payment method code")}}class ee extends o{constructor(){super("Shipping address")}}class te extends o{constructor(){super("Shipping method")}}class se extends o{constructor(){super("Billing address")}}class ne extends o{constructor(){super("Country Code")}}function L(e,t){return t.split(".").reduce((s,n)=>s&&s[n]!==void 0?s[n]:void 0,e)}async function M(e){const{defaultValueOnFail:t,options:s,path:n,query:a,queueName:i,transformer:r,type:p}=e;try{const l=async()=>{const{data:y,errors:C}=await P(a,{method:p==="query"?"GET":"POST",cache:p==="query"?"no-cache":void 0,...s});if(C){const _=v(C);if(_.length>0)throw new T(_)}let h=L(y,n);if(h===void 0)throw new Error(`No data found at path: ${n}`);return r?r(h):h};return p==="mutation"?await q(l,i):await l()}catch(l){if(t!==void 0)return t;throw l}}const x=`
3
+ import"@dropins/tools/lib.js";import{signal as m,computed as I}from"@dropins/tools/signals.js";import{events as D}from"@dropins/tools/event-bus.js";import{FetchGraphQL as U}from"@dropins/tools/fetch-graphql.js";const A={authenticated:!1,cartId:null,config:null,initialized:!1,quoteId:null},E=new Proxy(A,{set(e,t,s){return e[t]=s,!0},get(e,t){return e[t]}});function V(){return E.quoteId!==null}var u=(e=>(e.EXCLUDING_TAX="EXCLUDING_TAX",e.INCLUDING_EXCLUDING_TAX="INCLUDING_AND_EXCLUDING_TAX",e.INCLUDING_TAX="INCLUDING_TAX",e))(u||{});const B=m(!1);var G=(e=>(e.Updates="updates",e.Default="default",e.ShippingEstimate="shippingEstimate",e))(G||{});const d=new Map,g=new Map,c=m(new Set),N=new Map;N.set("updates",e=>{D.emit("checkout/updated",e)});async function q(e){g.set(e,!0);const t=d.get(e);let s;for(;t.length>0;){const i=t.shift();try{const r=await i.requestFn();i.resolve(r),s=r}catch(r){i.reject(r)}}g.set(e,!1);const n=new Set(c.value);n.delete(e),c.value=n;const o=N.get(e);o&&s&&o(s)}function w(e,t="default"){d.has(t)||d.set(t,[]);const s=d.get(t),n=new Promise((i,r)=>{s.push({requestFn:e,resolve:i,reject:r})}),o=new Set(c.value);return o.add(t),c.value=o,g.get(t)||q(t),n}const $=I(()=>c.value.has("updates")),z=I(()=>c.value.has("shippingEstimate")),v=["sender_email","recipient_email"];function X(e){return e.filter(t=>!t.path||!v.some(s=>{var n;return((n=t.path)==null?void 0:n.at(-1))===s}))}class T extends Error{constructor(t){super(t.map(s=>s.message).join(" ")),this.name="FetchError"}}class S extends Error{constructor(t){super(t),this.name="InvalidInput"}}class a extends S{constructor(t){super(`${t} is required.`)}}class Y extends a{constructor(){super("Cart ID")}}class J extends S{constructor(){super("Either Cart ID or Quote ID is required.")}}class K extends Error{constructor(){super("User is not authenticated")}}class W extends a{constructor(){super("Negotiable Quote ID")}}class Z extends a{constructor(){super("Email")}}class ee extends a{constructor(){super("Payment method code")}}class te extends a{constructor(){super("Shipping address")}}class se extends a{constructor(){super("Shipping method")}}class ne extends a{constructor(){super("Billing address")}}class re extends a{constructor(){super("Country Code")}}function L(e,t){return t.split(".").reduce((s,n)=>s&&s[n]!==void 0?s[n]:void 0,e)}async function M(e){const{defaultValueOnFail:t,options:s,path:n,query:o,queueName:i,transformer:r,type:p}=e;try{const l=async()=>{const{data:y,errors:C}=await b(o,{method:p==="query"?"GET":"POST",cache:p==="query"?"no-cache":void 0,...s});if(C){const _=X(C);if(_.length>0)throw new T(_)}let h=L(y,n);if(h===void 0)throw new Error(`No data found at path: ${n}`);return r?r(h):h};return p==="mutation"?await w(l,i):await l()}catch(l){if(t!==void 0)return t;throw l}}const x=`
4
4
  query getStoreConfig {
5
5
  storeConfig {
6
6
  default_country
@@ -10,5 +10,5 @@ import"@dropins/tools/lib.js";import{events as D}from"@dropins/tools/event-bus.j
10
10
  shopping_cart_display_shipping
11
11
  }
12
12
  }
13
- `,F="US",f={defaultCountry:F,agreementsEnabled:!0,shoppingCartDisplaySetting:{shipping:u.EXCLUDING_TAX}},re=async()=>await M({defaultValueOnFail:f,options:{method:"GET",cache:"no-cache"},path:"storeConfig",query:x,transformer:b,type:"query"}),oe=()=>I.config;function Q(e){switch(e){case 1:return u.EXCLUDING_TAX;case 2:return u.INCLUDING_TAX;case 3:return u.INCLUDING_EXCLUDING_TAX;default:return u.EXCLUDING_TAX}}function b(e){if(!e)return f;const{default_country:t,is_checkout_agreements_enabled:s,shopping_cart_display_shipping:n}=e;return{defaultCountry:t||f.defaultCountry,agreementsEnabled:s,shoppingCartDisplaySetting:{shipping:Q(n)}}}const{setEndpoint:ae,setFetchGraphQlHeader:ie,removeFetchGraphQlHeader:ue,setFetchGraphQlHeaders:ce,fetchGraphQl:P,getConfig:le}=new U().getMethods();export{F as D,N as I,Y as M,w as Q,f as S,u as T,J as U,ae as a,ie as b,ce as c,M as d,re as e,P as f,le as g,B as h,oe as i,te as j,Z as k,se as l,$ as m,V as n,z as o,ne as p,ee as q,ue as r,I as s,W as t,K as u};
13
+ `,F="US",f={defaultCountry:F,agreementsEnabled:!0,shoppingCartDisplaySetting:{shipping:u.EXCLUDING_TAX}},ae=async()=>await M({defaultValueOnFail:f,options:{method:"GET",cache:"no-cache"},path:"storeConfig",query:x,transformer:P,type:"query"}),oe=()=>E.config;function Q(e){switch(e){case 1:return u.EXCLUDING_TAX;case 2:return u.INCLUDING_TAX;case 3:return u.INCLUDING_EXCLUDING_TAX;default:return u.EXCLUDING_TAX}}function P(e){if(!e)return f;const{default_country:t,is_checkout_agreements_enabled:s,shopping_cart_display_shipping:n}=e;return{defaultCountry:t||f.defaultCountry,agreementsEnabled:s,shoppingCartDisplaySetting:{shipping:Q(n)}}}const{setEndpoint:ie,setFetchGraphQlHeader:ue,removeFetchGraphQlHeader:ce,setFetchGraphQlHeaders:le,fetchGraphQl:b,getConfig:de}=new U().getMethods();export{F as D,S as I,J as M,G as Q,f as S,u as T,K as U,ie as a,ue as b,le as c,M as d,ae as e,b as f,de as g,$ as h,B as i,oe as j,se as k,ee as l,ne as m,z as n,V as o,Y as p,re as q,ce as r,E as s,te as t,Z as u,W as v};
14
14
  //# sourceMappingURL=fetch-graphql.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetch-graphql.js","sources":["/@dropins/storefront-checkout/src/lib/state.ts","/@dropins/storefront-checkout/src/data/models/store-config.ts","/@dropins/storefront-checkout/src/lib/enqueueRequest.ts","/@dropins/storefront-checkout/src/lib/filterControlledErrors.ts","/@dropins/storefront-checkout/src/lib/errors/customErrors.ts","/@dropins/storefront-checkout/src/lib/dispatchApiCall.ts","/@dropins/storefront-checkout/src/api/getStoreConfig/graphql/getStoreConfig.graphql.ts","/@dropins/storefront-checkout/src/api/getStoreConfig/getStoreConfig.ts","/@dropins/storefront-checkout/src/data/transforms/transform-store-config.ts","/@dropins/storefront-checkout/src/api/fetch-graphql/fetch-graphql.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { StoreConfig } from '@/checkout/data/models';\n\ntype State = {\n authenticated: boolean;\n cartId?: string | null;\n config: StoreConfig | null;\n initialized: boolean;\n quoteId?: string | null;\n};\n\nconst _state: State = (() => ({\n authenticated: false,\n cartId: null,\n config: null,\n initialized: false,\n quoteId: null,\n}))();\n\n// Proxy state to allow reactivity\nexport const state = new Proxy(_state, {\n set(target, key, value) {\n // @ts-ignore\n target[key] = value;\n return true;\n },\n get(target, key) {\n return target[key as keyof State];\n },\n});\n\nexport function isQuoteCheckout(): boolean {\n return state.quoteId !== null;\n}\n\nexport function isCartCheckout(): boolean {\n return state.cartId !== null;\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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\nexport enum TaxDisplay {\n EXCLUDING_TAX = 'EXCLUDING_TAX',\n INCLUDING_EXCLUDING_TAX = 'INCLUDING_AND_EXCLUDING_TAX',\n INCLUDING_TAX = 'INCLUDING_TAX',\n}\n\nexport interface StoreConfig {\n defaultCountry: string;\n agreementsEnabled: boolean;\n shoppingCartDisplaySetting: {\n shipping: TaxDisplay;\n };\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { Cart, NegotiableQuote } from '@/checkout/data/models';\nimport {\n computed,\n ReadonlySignal,\n signal,\n} from '@adobe-commerce/elsie/lib/signals';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport enum QueueName {\n Updates = 'updates',\n Default = 'default',\n ShippingEstimate = 'shippingEstimate',\n}\n\ntype Request<T> = () => Promise<T>;\ntype QueueCompletedHandler<T> = (result: T) => void;\n\ninterface QueuedRequest<T> {\n requestFn: Request<T>;\n resolve: (value: T) => void;\n reject: (error: any) => void;\n}\n\nconst queues = new Map<QueueName, QueuedRequest<any>[]>();\nconst processing = new Map<QueueName, boolean>();\nconst pendingRequests = signal<Set<QueueName>>(new Set());\nconst onQueueCompleted = new Map<QueueName, QueueCompletedHandler<any>>();\n\nonQueueCompleted.set(\n QueueName.Updates,\n (latestResult: Cart | NegotiableQuote) => {\n events.emit('checkout/updated', latestResult);\n }\n);\n\nasync function processQueue(type: QueueName): Promise<void> {\n processing.set(type, true);\n\n const queue = queues.get(type)!;\n let latestSuccessResult: any;\n\n while (queue.length > 0) {\n const request = queue.shift()!;\n\n try {\n const result = await request.requestFn();\n request.resolve(result);\n latestSuccessResult = result;\n } catch (error) {\n request.reject(error);\n }\n }\n\n processing.set(type, false);\n\n const pendingSet = new Set(pendingRequests.value);\n pendingSet.delete(type);\n pendingRequests.value = pendingSet;\n\n const handler = onQueueCompleted.get(type);\n\n if (handler && latestSuccessResult) {\n handler(latestSuccessResult);\n }\n}\n\nexport function enqueueRequest<T>(\n requestFn: Request<T>,\n name: QueueName = QueueName.Default\n): Promise<T> {\n if (!queues.has(name)) {\n queues.set(name, []);\n }\n\n const queue = queues.get(name)!;\n\n const promise = new Promise<T>((resolve, reject) => {\n queue.push({ requestFn, resolve, reject });\n });\n\n const pendingSet = new Set(pendingRequests.value);\n pendingSet.add(name);\n pendingRequests.value = pendingSet;\n\n if (!processing.get(name)) {\n processQueue(name);\n }\n\n return promise;\n}\n\nexport const hasPendingUpdates: ReadonlySignal<boolean> = computed(() => {\n return pendingRequests.value.has(QueueName.Updates);\n});\n\nexport const hasPendingShippingEstimate: ReadonlySignal<boolean> = computed(\n () => {\n return pendingRequests.value.has(QueueName.ShippingEstimate);\n }\n);\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { FetchQueryError } from '@/checkout/api/fetch-graphql';\n\ntype ErrorPath = (string | number)[];\n\nexport type ErrorWithPath = FetchQueryError[number] & {\n path?: ErrorPath;\n};\n\nconst controlledErrorProps: string[] = ['sender_email', 'recipient_email'];\n\n/**\n * Filters out errors with known paths from a list of errors generated by a GraphQL query.\n *\n * Known issue: The query does not differentiate between physical and virtual gift cards, leading\n * to errors for physical ones as they don't have 'sender_email' and 'recipient_email' properties.\n *\n * @param {ErrorWithPath[]} errors - Array of errors to be filtered.\n * @return {ErrorWithPath[]} Uncontrolled (unexpected) errors not matching predefined paths.\n */\n\nexport function filterControlledErrors(errors: ErrorWithPath[]) {\n return errors.filter(\n (error) =>\n !error.path ||\n !controlledErrorProps.some((controlledErrorProp) => {\n return error.path?.at(-1) === controlledErrorProp;\n })\n );\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { FetchQueryError } from '@/checkout/api/fetch-graphql';\n\nexport class FetchError extends Error {\n constructor(reasons: FetchQueryError) {\n super(reasons.map((e: any) => e.message).join(' '));\n this.name = 'FetchError';\n }\n}\n\nexport class InvalidInput extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'InvalidInput';\n }\n}\n\nexport class MissingArgument extends InvalidInput {\n constructor(argumentName: string) {\n super(`${argumentName} is required.`);\n }\n}\n\nexport class MissingCart extends MissingArgument {\n constructor() {\n super('Cart ID');\n }\n}\n\nexport class MissingCartAndQuote extends InvalidInput {\n constructor() {\n super('Either Cart ID or Quote ID is required.');\n }\n}\n\nexport class Unauthenticated extends Error {\n constructor() {\n super('User is not authenticated');\n }\n}\n\nexport class MissingNegotiableQuoteId extends MissingArgument {\n constructor() {\n super('Negotiable Quote ID');\n }\n}\n\nexport class MissingEmail extends MissingArgument {\n constructor() {\n super('Email');\n }\n}\n\nexport class MissingPaymentMethod extends MissingArgument {\n constructor() {\n super('Payment method code');\n }\n}\n\nexport class MissingShippingAddress extends MissingArgument {\n constructor() {\n super('Shipping address');\n }\n}\n\nexport class MissingShippingMethod extends MissingArgument {\n constructor() {\n super('Shipping method');\n }\n}\n\nexport class MissingBillingAddress extends MissingArgument {\n constructor() {\n super('Billing address');\n }\n}\n\nexport class MissingCountry extends MissingArgument {\n constructor() {\n super('Country Code');\n }\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { fetchGraphQl, FetchOptions, FetchQueryError } from '@/checkout/api';\nimport { enqueueRequest, QueueName } from '@/checkout/lib/enqueueRequest';\nimport { filterControlledErrors } from '@/checkout/lib/filterControlledErrors';\nimport { FetchError } from '@/checkout/lib/errors';\n\ntype DispatchApiCallParams<T> = {\n defaultValueOnFail?: T;\n options?: FetchOptions;\n path: string;\n query: string;\n queueName?: QueueName;\n transformer?: (data: any) => T;\n type: 'query' | 'mutation';\n};\n\nexport function getValueAtPath(obj: any, path: string) {\n return path\n .split('.')\n .reduce(\n (acc, part) => (acc && acc[part] !== undefined ? acc[part] : undefined),\n obj\n );\n}\n\nasync function dispatchApiCall<T>(\n params: DispatchApiCallParams<T>\n): Promise<T> {\n const {\n defaultValueOnFail,\n options,\n path,\n query,\n queueName,\n transformer,\n type,\n } = params;\n\n try {\n const processApiCall = async () => {\n const { data, errors } = await fetchGraphQl<T>(query, {\n method: type === 'query' ? 'GET' : 'POST',\n cache: type === 'query' ? 'no-cache' : undefined,\n ...options,\n });\n\n if (errors) {\n const uncontrolledErrors = filterControlledErrors(errors);\n\n if (uncontrolledErrors.length > 0) {\n throw new FetchError(uncontrolledErrors as FetchQueryError);\n }\n }\n\n let result = getValueAtPath(data, path);\n\n if (result === undefined) {\n throw new Error(`No data found at path: ${path}`);\n }\n\n return transformer ? transformer(result) : result;\n };\n\n // Execute the API call, either directly or through the queue\n const result =\n type === 'mutation'\n ? await enqueueRequest<T>(processApiCall, queueName)\n : await processApiCall();\n\n return result;\n } catch (error: any) {\n if (defaultValueOnFail !== undefined) return defaultValueOnFail;\n throw error;\n }\n}\n\nexport { dispatchApiCall };\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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\nexport const getStoreConfigQuery = /* GraphQL */ `\n query getStoreConfig {\n storeConfig {\n default_country\n is_checkout_agreements_enabled\n is_guest_checkout_enabled\n is_one_page_checkout_enabled\n shopping_cart_display_shipping\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { StoreConfig, TaxDisplay } from '@/checkout/data/models';\nimport { transformStoreConfig } from '@/checkout/data/transforms';\nimport { dispatchApiCall, state } from '@/checkout/lib';\nimport { getStoreConfigQuery } from './graphql/getStoreConfig.graphql';\n\nexport const DEFAULT_COUNTRY = 'US';\n\nexport const STORE_CONFIG_DEFAULTS: StoreConfig = {\n defaultCountry: DEFAULT_COUNTRY,\n agreementsEnabled: true,\n shoppingCartDisplaySetting: {\n shipping: TaxDisplay.EXCLUDING_TAX,\n },\n};\n\nexport const getStoreConfig = async () => {\n return await dispatchApiCall({\n defaultValueOnFail: STORE_CONFIG_DEFAULTS,\n options: { method: 'GET', cache: 'no-cache' },\n path: 'storeConfig',\n query: getStoreConfigQuery,\n transformer: transformStoreConfig,\n type: 'query',\n });\n};\n\nexport const getStoreConfigCache = () => state.config;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { GetStoreConfigQuery } from '@/checkout/__generated__/types';\nimport { STORE_CONFIG_DEFAULTS } from '@/checkout/api/getStoreConfig';\nimport { StoreConfig, TaxDisplay } from '@/checkout/data/models';\n\nexport function transformTaxDisplay(data: number | null | undefined) {\n switch (data) {\n case 1:\n return TaxDisplay.EXCLUDING_TAX;\n case 2:\n return TaxDisplay.INCLUDING_TAX;\n case 3:\n return TaxDisplay.INCLUDING_EXCLUDING_TAX;\n default:\n return TaxDisplay.EXCLUDING_TAX;\n }\n}\n\nexport function transformStoreConfig(\n data: GetStoreConfigQuery['storeConfig']\n): StoreConfig {\n if (!data) return STORE_CONFIG_DEFAULTS;\n\n const {\n default_country,\n is_checkout_agreements_enabled,\n shopping_cart_display_shipping,\n } = data;\n\n return {\n defaultCountry: default_country || STORE_CONFIG_DEFAULTS.defaultCountry,\n agreementsEnabled: is_checkout_agreements_enabled,\n shoppingCartDisplaySetting: {\n shipping: transformTaxDisplay(shopping_cart_display_shipping),\n },\n };\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n\nexport type {\n FetchOptions,\n FetchQueryError,\n} from '@adobe-commerce/fetch-graphql';\n"],"names":["_state","state","target","key","value","isQuoteCheckout","TaxDisplay","QueueName","queues","processing","pendingRequests","signal","onQueueCompleted","latestResult","events","processQueue","type","queue","latestSuccessResult","request","result","error","pendingSet","handler","enqueueRequest","requestFn","name","promise","resolve","reject","hasPendingUpdates","computed","hasPendingShippingEstimate","controlledErrorProps","filterControlledErrors","errors","controlledErrorProp","_a","FetchError","reasons","e","InvalidInput","message","MissingArgument","argumentName","MissingCart","MissingCartAndQuote","Unauthenticated","MissingNegotiableQuoteId","MissingEmail","MissingPaymentMethod","MissingShippingAddress","MissingShippingMethod","MissingBillingAddress","MissingCountry","getValueAtPath","obj","path","acc","part","dispatchApiCall","params","defaultValueOnFail","options","query","queueName","transformer","processApiCall","data","fetchGraphQl","uncontrolledErrors","getStoreConfigQuery","DEFAULT_COUNTRY","STORE_CONFIG_DEFAULTS","getStoreConfig","transformStoreConfig","getStoreConfigCache","transformTaxDisplay","default_country","is_checkout_agreements_enabled","shopping_cart_display_shipping","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","getConfig","FetchGraphQL"],"mappings":"mNA2BA,MAAMA,EAAwB,CAC5B,cAAe,GACf,OAAQ,KACR,OAAQ,KACR,YAAa,GACb,QAAS,IACX,EAGaC,EAAQ,IAAI,MAAMD,EAAQ,CACrC,IAAIE,EAAQC,EAAKC,EAAO,CAEtB,OAAAF,EAAOC,CAAG,EAAIC,EACP,EACT,EACA,IAAIF,EAAQC,EAAK,CACf,OAAOD,EAAOC,CAAkB,CAAA,CAEpC,CAAC,EAEM,SAASE,GAA2B,CACzC,OAAOJ,EAAM,UAAY,IAC3B,CChCY,IAAAK,GAAAA,IACVA,EAAA,cAAgB,gBAChBA,EAAA,wBAA0B,8BAC1BA,EAAA,cAAgB,gBAHNA,IAAAA,GAAA,CAAA,CAAA,ECQAC,GAAAA,IACVA,EAAA,QAAU,UACVA,EAAA,QAAU,UACVA,EAAA,iBAAmB,mBAHTA,IAAAA,GAAA,CAAA,CAAA,EAeZ,MAAMC,MAAa,IACbC,MAAiB,IACjBC,EAAkBC,EAA2B,IAAA,GAAK,EAClDC,MAAuB,IAE7BA,EAAiB,IACf,UACCC,GAAyC,CACjCC,EAAA,KAAK,mBAAoBD,CAAY,CAAA,CAEhD,EAEA,eAAeE,EAAaC,EAAgC,CAC/CP,EAAA,IAAIO,EAAM,EAAI,EAEnB,MAAAC,EAAQT,EAAO,IAAIQ,CAAI,EACzB,IAAAE,EAEG,KAAAD,EAAM,OAAS,GAAG,CACjB,MAAAE,EAAUF,EAAM,MAAM,EAExB,GAAA,CACI,MAAAG,EAAS,MAAMD,EAAQ,UAAU,EACvCA,EAAQ,QAAQC,CAAM,EACAF,EAAAE,QACfC,EAAO,CACdF,EAAQ,OAAOE,C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ACA,+BAAAC,CAAA,EACEZ,EAEG,MAAA,CACL,eAAgBU,GAAmBL,EAAsB,eACzD,kBAAmBM,EACnB,2BAA4B,CAC1B,SAAUF,EAAoBG,CAA8B,CAAA,CAEhE,CACF,CCjCa,KAAA,CACX,YAAAC,GACA,sBAAAC,GACA,yBAAAC,GACA,uBAAAC,GACA,aAAAf,EACA,UAAAgB,EACF,EAAI,IAAIC,EAAa,EAAE,WAAW"}
1
+ {"version":3,"file":"fetch-graphql.js","sources":["/@dropins/storefront-checkout/src/lib/state.ts","/@dropins/storefront-checkout/src/data/models/store-config.ts","/@dropins/storefront-checkout/src/store/ui.ts","/@dropins/storefront-checkout/src/lib/enqueueRequest.ts","/@dropins/storefront-checkout/src/lib/filterControlledErrors.ts","/@dropins/storefront-checkout/src/lib/errors/customErrors.ts","/@dropins/storefront-checkout/src/lib/dispatchApiCall.ts","/@dropins/storefront-checkout/src/api/getStoreConfig/graphql/getStoreConfig.graphql.ts","/@dropins/storefront-checkout/src/api/getStoreConfig/getStoreConfig.ts","/@dropins/storefront-checkout/src/data/transforms/transform-store-config.ts","/@dropins/storefront-checkout/src/api/fetch-graphql/fetch-graphql.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { StoreConfig } from '@/checkout/data/models';\n\ntype State = {\n authenticated: boolean;\n cartId?: string | null;\n config: StoreConfig | null;\n initialized: boolean;\n quoteId?: string | null;\n};\n\nconst _state: State = (() => ({\n authenticated: false,\n cartId: null,\n config: null,\n initialized: false,\n quoteId: null,\n}))();\n\n// Proxy state to allow reactivity\nexport const state = new Proxy(_state, {\n set(target, key, value) {\n // @ts-ignore\n target[key] = value;\n return true;\n },\n get(target, key) {\n return target[key as keyof State];\n },\n});\n\nexport function isQuoteCheckout(): boolean {\n return state.quoteId !== null;\n}\n\nexport function isCartCheckout(): boolean {\n return state.cartId !== null;\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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\nexport enum TaxDisplay {\n EXCLUDING_TAX = 'EXCLUDING_TAX',\n INCLUDING_EXCLUDING_TAX = 'INCLUDING_AND_EXCLUDING_TAX',\n INCLUDING_TAX = 'INCLUDING_TAX',\n}\n\nexport interface StoreConfig {\n defaultCountry: string;\n agreementsEnabled: boolean;\n shoppingCartDisplaySetting: {\n shipping: TaxDisplay;\n };\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { signal } from '@adobe-commerce/elsie/lib/signals';\n\n// Tracks when a set address call is expected and in the debounce period (set in api.ts).\n// Used to disable UI elements while pending: BillToShippingAddress checkbox and PlaceOrder button.\nexport const isSetAddressRequestPending = signal(false);\n\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { Cart, NegotiableQuote } from '@/checkout/data/models';\nimport {\n computed,\n ReadonlySignal,\n signal,\n} from '@adobe-commerce/elsie/lib/signals';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport enum QueueName {\n Updates = 'updates',\n Default = 'default',\n ShippingEstimate = 'shippingEstimate',\n}\n\ntype Request<T> = () => Promise<T>;\ntype QueueCompletedHandler<T> = (result: T) => void;\n\ninterface QueuedRequest<T> {\n requestFn: Request<T>;\n resolve: (value: T) => void;\n reject: (error: any) => void;\n}\n\nconst queues = new Map<QueueName, QueuedRequest<any>[]>();\nconst processing = new Map<QueueName, boolean>();\nconst pendingRequests = signal<Set<QueueName>>(new Set());\nconst onQueueCompleted = new Map<QueueName, QueueCompletedHandler<any>>();\n\nonQueueCompleted.set(\n QueueName.Updates,\n (latestResult: Cart | NegotiableQuote) => {\n events.emit('checkout/updated', latestResult);\n }\n);\n\nasync function processQueue(type: QueueName): Promise<void> {\n processing.set(type, true);\n\n const queue = queues.get(type)!;\n let latestSuccessResult: any;\n\n while (queue.length > 0) {\n const request = queue.shift()!;\n\n try {\n const result = await request.requestFn();\n request.resolve(result);\n latestSuccessResult = result;\n } catch (error) {\n request.reject(error);\n }\n }\n\n processing.set(type, false);\n\n const pendingSet = new Set(pendingRequests.value);\n pendingSet.delete(type);\n pendingRequests.value = pendingSet;\n\n const handler = onQueueCompleted.get(type);\n\n if (handler && latestSuccessResult) {\n handler(latestSuccessResult);\n }\n}\n\nexport function enqueueRequest<T>(\n requestFn: Request<T>,\n name: QueueName = QueueName.Default\n): Promise<T> {\n if (!queues.has(name)) {\n queues.set(name, []);\n }\n\n const queue = queues.get(name)!;\n\n const promise = new Promise<T>((resolve, reject) => {\n queue.push({ requestFn, resolve, reject });\n });\n\n const pendingSet = new Set(pendingRequests.value);\n pendingSet.add(name);\n pendingRequests.value = pendingSet;\n\n if (!processing.get(name)) {\n processQueue(name);\n }\n\n return promise;\n}\n\nexport const hasPendingUpdates: ReadonlySignal<boolean> = computed(() => {\n return pendingRequests.value.has(QueueName.Updates);\n});\n\nexport const hasPendingShippingEstimate: ReadonlySignal<boolean> = computed(\n () => {\n return pendingRequests.value.has(QueueName.ShippingEstimate);\n }\n);\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { FetchQueryError } from '@/checkout/api/fetch-graphql';\n\ntype ErrorPath = (string | number)[];\n\nexport type ErrorWithPath = FetchQueryError[number] & {\n path?: ErrorPath;\n};\n\nconst controlledErrorProps: string[] = ['sender_email', 'recipient_email'];\n\n/**\n * Filters out errors with known paths from a list of errors generated by a GraphQL query.\n *\n * Known issue: The query does not differentiate between physical and virtual gift cards, leading\n * to errors for physical ones as they don't have 'sender_email' and 'recipient_email' properties.\n *\n * @param {ErrorWithPath[]} errors - Array of errors to be filtered.\n * @return {ErrorWithPath[]} Uncontrolled (unexpected) errors not matching predefined paths.\n */\n\nexport function filterControlledErrors(errors: ErrorWithPath[]) {\n return errors.filter(\n (error) =>\n !error.path ||\n !controlledErrorProps.some((controlledErrorProp) => {\n return error.path?.at(-1) === controlledErrorProp;\n })\n );\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { FetchQueryError } from '@/checkout/api/fetch-graphql';\n\nexport class FetchError extends Error {\n constructor(reasons: FetchQueryError) {\n super(reasons.map((e: any) => e.message).join(' '));\n this.name = 'FetchError';\n }\n}\n\nexport class InvalidInput extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'InvalidInput';\n }\n}\n\nexport class MissingArgument extends InvalidInput {\n constructor(argumentName: string) {\n super(`${argumentName} is required.`);\n }\n}\n\nexport class MissingCart extends MissingArgument {\n constructor() {\n super('Cart ID');\n }\n}\n\nexport class MissingCartAndQuote extends InvalidInput {\n constructor() {\n super('Either Cart ID or Quote ID is required.');\n }\n}\n\nexport class Unauthenticated extends Error {\n constructor() {\n super('User is not authenticated');\n }\n}\n\nexport class MissingNegotiableQuoteId extends MissingArgument {\n constructor() {\n super('Negotiable Quote ID');\n }\n}\n\nexport class MissingEmail extends MissingArgument {\n constructor() {\n super('Email');\n }\n}\n\nexport class MissingPaymentMethod extends MissingArgument {\n constructor() {\n super('Payment method code');\n }\n}\n\nexport class MissingShippingAddress extends MissingArgument {\n constructor() {\n super('Shipping address');\n }\n}\n\nexport class MissingShippingMethod extends MissingArgument {\n constructor() {\n super('Shipping method');\n }\n}\n\nexport class MissingBillingAddress extends MissingArgument {\n constructor() {\n super('Billing address');\n }\n}\n\nexport class MissingCountry extends MissingArgument {\n constructor() {\n super('Country Code');\n }\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { fetchGraphQl, FetchOptions, FetchQueryError } from '@/checkout/api';\nimport { enqueueRequest, QueueName } from '@/checkout/lib/enqueueRequest';\nimport { filterControlledErrors } from '@/checkout/lib/filterControlledErrors';\nimport { FetchError } from '@/checkout/lib/errors';\n\ntype DispatchApiCallParams<T> = {\n defaultValueOnFail?: T;\n options?: FetchOptions;\n path: string;\n query: string;\n queueName?: QueueName;\n transformer?: (data: any) => T;\n type: 'query' | 'mutation';\n};\n\nexport function getValueAtPath(obj: any, path: string) {\n return path\n .split('.')\n .reduce(\n (acc, part) => (acc && acc[part] !== undefined ? acc[part] : undefined),\n obj\n );\n}\n\nasync function dispatchApiCall<T>(\n params: DispatchApiCallParams<T>\n): Promise<T> {\n const {\n defaultValueOnFail,\n options,\n path,\n query,\n queueName,\n transformer,\n type,\n } = params;\n\n try {\n const processApiCall = async () => {\n const { data, errors } = await fetchGraphQl<T>(query, {\n method: type === 'query' ? 'GET' : 'POST',\n cache: type === 'query' ? 'no-cache' : undefined,\n ...options,\n });\n\n if (errors) {\n const uncontrolledErrors = filterControlledErrors(errors);\n\n if (uncontrolledErrors.length > 0) {\n throw new FetchError(uncontrolledErrors as FetchQueryError);\n }\n }\n\n let result = getValueAtPath(data, path);\n\n if (result === undefined) {\n throw new Error(`No data found at path: ${path}`);\n }\n\n return transformer ? transformer(result) : result;\n };\n\n // Execute the API call, either directly or through the queue\n const result =\n type === 'mutation'\n ? await enqueueRequest<T>(processApiCall, queueName)\n : await processApiCall();\n\n return result;\n } catch (error: any) {\n if (defaultValueOnFail !== undefined) return defaultValueOnFail;\n throw error;\n }\n}\n\nexport { dispatchApiCall };\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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\nexport const getStoreConfigQuery = /* GraphQL */ `\n query getStoreConfig {\n storeConfig {\n default_country\n is_checkout_agreements_enabled\n is_guest_checkout_enabled\n is_one_page_checkout_enabled\n shopping_cart_display_shipping\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { StoreConfig, TaxDisplay } from '@/checkout/data/models';\nimport { transformStoreConfig } from '@/checkout/data/transforms';\nimport { dispatchApiCall, state } from '@/checkout/lib';\nimport { getStoreConfigQuery } from './graphql/getStoreConfig.graphql';\n\nexport const DEFAULT_COUNTRY = 'US';\n\nexport const STORE_CONFIG_DEFAULTS: StoreConfig = {\n defaultCountry: DEFAULT_COUNTRY,\n agreementsEnabled: true,\n shoppingCartDisplaySetting: {\n shipping: TaxDisplay.EXCLUDING_TAX,\n },\n};\n\nexport const getStoreConfig = async () => {\n return await dispatchApiCall({\n defaultValueOnFail: STORE_CONFIG_DEFAULTS,\n options: { method: 'GET', cache: 'no-cache' },\n path: 'storeConfig',\n query: getStoreConfigQuery,\n transformer: transformStoreConfig,\n type: 'query',\n });\n};\n\nexport const getStoreConfigCache = () => state.config;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { GetStoreConfigQuery } from '@/checkout/__generated__/types';\nimport { STORE_CONFIG_DEFAULTS } from '@/checkout/api/getStoreConfig';\nimport { StoreConfig, TaxDisplay } from '@/checkout/data/models';\n\nexport function transformTaxDisplay(data: number | null | undefined) {\n switch (data) {\n case 1:\n return TaxDisplay.EXCLUDING_TAX;\n case 2:\n return TaxDisplay.INCLUDING_TAX;\n case 3:\n return TaxDisplay.INCLUDING_EXCLUDING_TAX;\n default:\n return TaxDisplay.EXCLUDING_TAX;\n }\n}\n\nexport function transformStoreConfig(\n data: GetStoreConfigQuery['storeConfig']\n): StoreConfig {\n if (!data) return STORE_CONFIG_DEFAULTS;\n\n const {\n default_country,\n is_checkout_agreements_enabled,\n shopping_cart_display_shipping,\n } = data;\n\n return {\n defaultCountry: default_country || STORE_CONFIG_DEFAULTS.defaultCountry,\n agreementsEnabled: is_checkout_agreements_enabled,\n shoppingCartDisplaySetting: {\n shipping: transformTaxDisplay(shopping_cart_display_shipping),\n },\n };\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n\nexport type {\n FetchOptions,\n FetchQueryError,\n} from '@adobe-commerce/fetch-graphql';\n"],"names":["_state","state","target","key","value","isQuoteCheckout","TaxDisplay","isSetAddressRequestPending","signal","QueueName","queues","processing","pendingRequests","onQueueCompleted","latestResult","events","processQueue","type","queue","latestSuccessResult","request","result","error","pendingSet","handler","enqueueRequest","requestFn","name","promise","resolve","reject","hasPendingUpdates","computed","hasPendingShippingEstimate","controlledErrorProps","filterControlledErrors","errors","controlledErrorProp","_a","FetchError","reasons","e","InvalidInput","message","MissingArgument","argumentName","MissingCart","MissingCartAndQuote","Unauthenticated","MissingNegotiableQuoteId","MissingEmail","MissingPaymentMethod","MissingShippingAddress","MissingShippingMethod","MissingBillingAddress","MissingCountry","getValueAtPath","obj","path","acc","part","dispatchApiCall","params","defaultValueOnFail","options","query","queueName","transformer","processApiCall","data","fetchGraphQl","uncontrolledErrors","getStoreConfigQuery","DEFAULT_COUNTRY","STORE_CONFIG_DEFAULTS","getStoreConfig","transformStoreConfig","getStoreConfigCache","transformTaxDisplay","default_country","is_checkout_agreements_enabled","shopping_cart_display_shipping","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","getConfig","FetchGraphQL"],"mappings":"mNA2BA,MAAMA,EAAwB,CAC5B,cAAe,GACf,OAAQ,KACR,OAAQ,KACR,YAAa,GACb,QAAS,IACX,EAGaC,EAAQ,IAAI,MAAMD,EAAQ,CACrC,IAAIE,EAAQC,EAAKC,EAAO,CAEtB,OAAAF,EAAOC,CAAG,EAAIC,EACP,EACT,EACA,IAAIF,EAAQC,EAAK,CACf,OAAOD,EAAOC,CAAkB,CAAA,CAEpC,CAAC,EAEM,SAASE,GAA2B,CACzC,OAAOJ,EAAM,UAAY,IAC3B,CChCY,IAAAK,GAAAA,IACVA,EAAA,cAAgB,gBAChBA,EAAA,wBAA0B,8BAC1BA,EAAA,cAAgB,gBAHNA,IAAAA,GAAA,CAAA,CAAA,ECIC,MAAAC,EAA6BC,EAAO,EAAK,ECI1C,IAAAC,GAAAA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AkB,KAElBC,EAAqC,CAChD,eAAgBD,EAChB,kBAAmB,GACnB,2BAA4B,CAC1B,SAAUnE,EAAW,aAAA,CAEzB,EAEaqE,GAAiB,SACrB,MAAMd,EAAgB,CAC3B,mBAAoBa,EACpB,QAAS,CAAE,OAAQ,MAAO,MAAO,UAAW,EAC5C,KAAM,cACN,MAAOF,EACP,YAAaI,EACb,KAAM,OAAA,CACP,EAGUC,GAAsB,IAAM5E,EAAM,OCtBxC,SAAS6E,EAAoBT,EAAiC,CACnE,OAAQA,EAAM,CACZ,IAAK,GACH,OAAO/D,EAAW,cACpB,IAAK,GACH,OAAOA,EAAW,cACpB,IAAK,GACH,OAAOA,EAAW,wBACpB,QACE,OAAOA,EAAW,aAAA,CAExB,CAEO,SAASsE,EACdP,EACa,CACT,GAAA,CAACA,EAAa,OAAAK,EAEZ,KAAA,CACJ,gBAAAK,EACA,+BAAAC,EACA,+BAAAC,CAAA,EACEZ,EAEG,MAAA,CACL,eAAgBU,GAAmBL,EAAsB,eACzD,kBAAmBM,EACnB,2BAA4B,CAC1B,SAAUF,EAAoBG,CAA8B,CAAA,CAEhE,CACF,CCjCa,KAAA,CACX,YAAAC,GACA,sBAAAC,GACA,yBAAAC,GACA,uBAAAC,GACA,aAAAf,EACA,UAAAgB,EACF,EAAI,IAAIC,EAAa,EAAE,WAAW"}
package/chunks/render.js CHANGED
@@ -6,5 +6,5 @@ All Rights Reserved. */
6
6
  .checkout-payment-on-account{margin-bottom:var(--spacing-medium)}.checkout-payment-on-account__form{width:100%}.checkout-payment-on-account__credit{display:flex;justify-content:space-between;align-items:center;padding:var(--spacing-small);margin-bottom:var(--spacing-medium);background-color:var(--color-neutral-100);border:1px solid var(--color-neutral-300);border-radius:4px;font-size:14px;line-height:1.4}.checkout-payment-on-account__credit-label{font-weight:500;color:var(--color-neutral-700)}.checkout-payment-on-account__credit-amount{font-weight:600;color:var(--color-success-600)}.checkout-payment-on-account__exceed-message{margin-top:var(--spacing-medium);margin-bottom:var(--spacing-medium)}.checkout-payment-on-account .dropin-field{margin-bottom:0}
7
7
  .checkout-bill-to-shipping-address label{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);gap:0}.checkout-bill-to-shipping-address__error{margin-top:var(--spacing-medium)}
8
8
  .checkout-address-validation{display:grid;gap:var(--spacing-medium)}.checkout-address-validation__options--busy{opacity:.4;pointer-events:none}.checkout-address-validation__title{margin-bottom:var(--spacing-small)}.checkout-address-validation__subtitle{color:var(--color-neutral-700);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.checkout-address-validation__options{display:grid;gap:var(--spacing-xbig);grid-template-columns:1fr 1fr}.checkout-address-validation__option{margin:0}.checkout-address-validation__option-title{margin-bottom:var(--spacing-xsmall)}.checkout-estimate-shipping{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-xxsmall);align-items:center;color:var(--color-neutral-800)}.checkout-estimate-shipping__label,.checkout-estimate-shipping__price{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.checkout-estimate-shipping__label--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.checkout-estimate-shipping__price--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.checkout-estimate-shipping__price{text-align:right}.checkout-estimate-shipping__label--bold,.checkout-estimate-shipping__price--bold{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.checkout-estimate-shipping__caption{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-neutral-700)}.cart-order-summary__shipping .dropin-skeleton{grid-template-columns:1fr}.checkout-login-form__heading{display:grid;grid-template-columns:1fr max-content;grid-auto-rows:max-content;margin:0 0 var(--spacing-medium) 0;align-items:center}.checkout-login-form__heading:empty{display:none}.checkout-login-form__content{grid-auto-rows:max-content}.checkout-login-form__content .dropin-field__hint a{font-weight:400}.checkout-login-form__customer-details{display:grid;grid-auto-flow:row;gap:var(--spacing-xxsmall)}.checkout-login-form__customer-name{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.checkout-login-form__customer-email{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.checkout-login-form__title,.checkout-login-form__title h2{grid-column-start:1;color:var(--color-neutral-800);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing);margin:0}.checkout-login-form__heading-label,.checkout-login-form__sign-in,.checkout-login-form__sign-out{grid-column-start:2;color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);justify-self:flex-end}.checkout-login-form__heading-label a,a.checkout-login-form__link{font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing);margin-left:var(--spacing-xxsmall)}@media only screen and (min-width: 320px) and (max-width: 768px){.checkout-login-form__heading{grid-template-columns:1fr;grid-template-rows:1fr}.checkout-login-form__heading-label{grid-column-start:1;align-self:flex-start;justify-self:flex-start;margin-top:var(--spacing-medium)}}.checkout-out-of-stock.dropin-card{border-color:var(--color-warning-500)}.checkout-out-of-stock .dropin-card__content{gap:var(--spacing-small);padding:var(--spacing-small)}.checkout-out-of-stock__title{color:var(--color-neutral-900);font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing);margin:0;display:flex;gap:var(--spacing-xxsmall);align-items:center;justify-content:left;text-align:center}.checkout-out-of-stock__message{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin:0}.checkout-out-of-stock__items{display:grid;grid-template-columns:repeat(5,100px);grid-gap:var(--spacing-small);list-style:none;padding:0;margin:0}.checkout-out-of-stock__item img{width:100%;height:auto}.checkout-out-of-stock__actions{display:flex;gap:var(--spacing-small);justify-content:flex-end}a.checkout-out-of-stock__action{color:var(--color-brand-500);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing)}.checkout-out-of-stock__action{color:var(--color-brand-500);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);background:none;border:none;padding:0;cursor:pointer}.checkout-out-of-stock__action:hover{--textColor: var(--color-brand-700);text-decoration:solid underline var(--textColor);text-underline-offset:6px}@media only screen and (width >= 320px) and (width <= 768px){.checkout-out-of-stock__items{grid-template-columns:repeat(3,100px)}}.checkout-payment-methods__title,.checkout-payment-methods__title h2{color:var(--color-neutral-800);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing);margin:0 0 var(--spacing-medium) 0}.checkout-payment-methods__wrapper{position:relative;display:grid}.checkout-payment-methods__wrapper--busy{opacity:.4;pointer-events:none}.checkout-payment-methods__methods{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-medium)}.checkout-payment-methods__content{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:var(--spacing-xbig)}.checkout-payment-methods__content>div[data-slot=PaymentMethodSlot]:not(:empty){margin-top:var(--spacing-medium)}.checkout-payment-methods--full-width{grid-template-columns:1fr}.checkout-payment-methods__spinner{margin:0 auto;position:absolute;z-index:999;left:0;right:0;top:calc(50% - (var(--size) / 2));bottom:0}.checkout__content [data-slot=PaymentMethods]:empty{display:none}.checkout-payment-methods__error{margin-top:var(--spacing-medium)}@media only screen and (min-width: 320px) and (max-width: 768px){.checkout-payment-methods__methods{grid-template-columns:1fr}}.checkout-purchase-order{margin-bottom:var(--spacing-medium)}.checkout-purchase-order__form{width:100%}.checkout-purchase-order .dropin-field{margin-bottom:0}.checkout-server-error{position:relative;text-align:center}.checkout-server-error__icon .error-icon{color:var(--color-alert-500)}.checkout-server-error a{font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing)}.checkout-terms-and-conditions{display:grid}.checkout-terms-and-conditions__error{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-alert-800);text-align:left;margin-top:var(--spacing-xsmall)}.checkout-terms-and-conditions__error:empty{display:none}`,{styleId:"checkout"});
9
- import{jsx as d}from"@dropins/tools/preact-jsx-runtime.js";import{Render as f}from"@dropins/tools/lib.js";import"./fetch-graphql.js";import{events as y}from"@dropins/tools/event-bus.js";import{c as g}from"./synchronizeCheckout.js";import{UIProvider as b}from"@dropins/tools/components.js";import{useState as h,useEffect as p}from"@dropins/tools/preact-hooks.js";function w(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var O=function(r){return E(r)&&!v(r)};function E(e){return!!e&&typeof e=="object"}function v(e){var r=Object.prototype.toString.call(e);return r==="[object RegExp]"||r==="[object Date]"||A(e)}var S=typeof Symbol=="function"&&Symbol.for,P=S?Symbol.for("react.element"):60103;function A(e){return e.$$typeof===P}function j(e){return Array.isArray(e)?[]:{}}function o(e,r){return r.clone!==!1&&r.isMergeableObject(e)?i(j(e),e,r):e}function M(e,r,t){return e.concat(r).map(function(a){return o(a,t)})}function x(e,r){if(!r.customMerge)return i;var t=r.customMerge(e);return typeof t=="function"?t:i}function T(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(r){return Object.propertyIsEnumerable.call(e,r)}):[]}function l(e){return Object.keys(e).concat(T(e))}function m(e,r){try{return r in e}catch{return!1}}function I(e,r){return m(e,r)&&!(Object.hasOwnProperty.call(e,r)&&Object.propertyIsEnumerable.call(e,r))}function C(e,r,t){var a={};return t.isMergeableObject(e)&&l(e).forEach(function(n){a[n]=o(e[n],t)}),l(r).forEach(function(n){I(e,n)||(m(e,n)&&t.isMergeableObject(r[n])?a[n]=x(n,t)(e[n],r[n],t):a[n]=o(r[n],t))}),a}function i(e,r,t){t=t||{},t.arrayMerge=t.arrayMerge||M,t.isMergeableObject=t.isMergeableObject||O,t.cloneUnlessOtherwiseSpecified=o;var a=Array.isArray(r),n=Array.isArray(e),s=a===n;return s?a?t.arrayMerge(e,r,t):C(e,r,t):o(r,t)}i.all=function(r,t){if(!Array.isArray(r))throw new Error("first argument should be an array");return r.reduce(function(a,n){return i(a,n,t)},{})};var L=i,N=L;const D=w(N),R={AddressValidation:{title:"Verify your address",subtitle:"To ensure accurate delivery, we suggest the changes highlighted below. Please choose which address you would like to use. If neither option is correct, edit your address.",suggestedAddress:"Suggested Address",originalAddress:"Original Address"},BillToShippingAddress:{cartSyncError:"We were unable to save your changes. Please try again later.",title:"Bill to shipping address"},EmptyCart:{button:"Start shopping",title:"Your cart is empty"},EstimateShipping:{estimated:"Estimated Shipping",freeShipping:"Free",label:"Shipping",taxToBeDetermined:"TBD",withoutTaxes:"Excluding taxes",withTaxes:"Including taxes"},LoginForm:{account:"Already have an account?",ariaLabel:"Email",emailExists:{alreadyHaveAccount:"It looks like you already have an account.",forFasterCheckout:"for a faster checkout.",signInButton:"Sign in"},floatingLabel:"Email *",invalidEmailError:"Please enter a valid email address.",missingEmailError:"Enter an email address.",cartSyncError:"We were unable to save your changes. Please try again later.",placeholder:"Enter your email address",signIn:"Sign In",signOut:"Sign Out",switch:"Do you want to switch account?",title:"Contact details"},MergedCartBanner:{items:{many:"{{count}} items from a previous session were added to your cart. Please review your new subtotal.",one:"1 item from a previous session was added to your cart. Please review your new subtotal."}},OutOfStock:{actions:{removeOutOfStock:"Remove out of stock items",reviewCart:"Review cart"},alert:"Out of stock!",lowInventory:{many:"Only {{count}} left!",one:"Last item!"},message:"The following items are out of stock:",title:"Your cart contains items that are out of stock"},PaymentMethods:{cartSyncError:"We were unable to save your changes. Please try again later.",emptyState:"No payment methods available",title:"Payment"},PaymentOnAccount:{referenceNumberLabel:"Custom Reference Number",referenceNumberPlaceholder:"Enter custom reference number",referenceNumberHint:"",availableCreditLabel:"Available Credit",exceedLimitWarning:"The credit limit is {{creditLimit}}. It will be exceeded by {{exceededAmount}} with this order.",exceedLimitWarningPrefix:"The credit limit is",exceedLimitWarningMiddle:". It will be exceeded by",exceedLimitWarningSuffix:"with this order.",exceedLimitError:"Payment On Account cannot be used for this order because your order amount exceeds your credit amount."},PurchaseOrder:{missingReferenceNumberError:"Reference number is required",referenceNumberHint:"",referenceNumberLabel:"Custom Reference Number",referenceNumberPlaceholder:"Enter custom reference number"},PlaceOrder:{button:"Place Order"},ServerError:{button:"Try again",contactSupport:"If you continue to have issues, please contact support.",title:"We were unable to process your order",unexpected:"An unexpected error occurred while processing your order. Please try again later.",permissionDenied:"You do not have permission to complete checkout. Please contact your administrator for assistance."},Quote:{permissionDenied:"You do not have permission to checkout with this quote.",dataError:"We were unable to retrieve the quote data. Please try again later."},ShippingMethods:{cartSyncError:"We were unable to save your changes. Please try again later.",emptyState:"This order can't be shipped to the address provided. Please review the address details you entered and make sure they're correct.",title:"Shipping options"},Summary:{Edit:"Edit"},TermsAndConditions:{error:"Please accept the Terms and Conditions to continue.",label:"I have read, understand, and accept our <a href='https://www.adobe.com/legal/terms.html' target='_blank'>Terms of Use, Terms of Sales, Privacy Policy, and Return Policy</a>."},title:"Checkout"},W={Checkout:R},k={default:W},_=({children:e})=>{var s;const[r,t]=h(),a=(s=g.getConfig())==null?void 0:s.langDefinitions;p(()=>{const c=y.on("locale",u=>{u!==r&&t(u)},{eager:!0});return()=>{c==null||c.off()}},[r]);const n=D(k,a??{});return d(b,{lang:r,langDefinitions:n,children:e})},$=new f(d(_,{}));export{_ as P,$ as r};
9
+ import{jsx as d}from"@dropins/tools/preact-jsx-runtime.js";import{Render as f}from"@dropins/tools/lib.js";import"./fetch-graphql.js";import{events as g}from"@dropins/tools/event-bus.js";import{c as y}from"./synchronizeCheckout.js";import{UIProvider as b}from"@dropins/tools/components.js";import{useState as h,useEffect as p}from"@dropins/tools/preact-hooks.js";function w(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var O=function(r){return E(r)&&!S(r)};function E(e){return!!e&&typeof e=="object"}function S(e){var r=Object.prototype.toString.call(e);return r==="[object RegExp]"||r==="[object Date]"||A(e)}var v=typeof Symbol=="function"&&Symbol.for,P=v?Symbol.for("react.element"):60103;function A(e){return e.$$typeof===P}function j(e){return Array.isArray(e)?[]:{}}function o(e,r){return r.clone!==!1&&r.isMergeableObject(e)?i(j(e),e,r):e}function T(e,r,t){return e.concat(r).map(function(a){return o(a,t)})}function M(e,r){if(!r.customMerge)return i;var t=r.customMerge(e);return typeof t=="function"?t:i}function x(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(r){return Object.propertyIsEnumerable.call(e,r)}):[]}function u(e){return Object.keys(e).concat(x(e))}function m(e,r){try{return r in e}catch{return!1}}function C(e,r){return m(e,r)&&!(Object.hasOwnProperty.call(e,r)&&Object.propertyIsEnumerable.call(e,r))}function I(e,r,t){var a={};return t.isMergeableObject(e)&&u(e).forEach(function(n){a[n]=o(e[n],t)}),u(r).forEach(function(n){C(e,n)||(m(e,n)&&t.isMergeableObject(r[n])?a[n]=M(n,t)(e[n],r[n],t):a[n]=o(r[n],t))}),a}function i(e,r,t){t=t||{},t.arrayMerge=t.arrayMerge||T,t.isMergeableObject=t.isMergeableObject||O,t.cloneUnlessOtherwiseSpecified=o;var a=Array.isArray(r),n=Array.isArray(e),s=a===n;return s?a?t.arrayMerge(e,r,t):I(e,r,t):o(r,t)}i.all=function(r,t){if(!Array.isArray(r))throw new Error("first argument should be an array");return r.reduce(function(a,n){return i(a,n,t)},{})};var L=i,N=L;const D=w(N),R={AddressValidation:{title:"Verify your address",subtitle:"To ensure accurate delivery, we suggest the changes highlighted below. Please choose which address you would like to use. If neither option is correct, edit your address.",suggestedAddress:"Suggested Address",originalAddress:"Original Address"},BillToShippingAddress:{cartSyncError:"We were unable to save your changes. Please try again later.",title:"Bill to shipping address"},EmptyCart:{button:"Start shopping",title:"Your cart is empty"},EstimateShipping:{estimated:"Estimated Shipping",freeShipping:"Free",label:"Shipping",taxToBeDetermined:"TBD",withoutTaxes:"Excluding taxes",withTaxes:"Including taxes"},LoginForm:{account:"Already have an account?",ariaLabel:"Email",emailExists:{alreadyHaveAccount:"It looks like you already have an account.",forFasterCheckout:"for a faster checkout.",signInButton:"Sign in"},floatingLabel:"Email *",invalidEmailError:"Please enter a valid email address.",missingEmailError:"Enter an email address.",cartSyncError:"We were unable to save your changes. Please try again later.",placeholder:"Enter your email address",signIn:"Sign In",signOut:"Sign Out",switch:"Do you want to switch account?",title:"Contact details"},MergedCartBanner:{items:{many:"{{count}} items from a previous session were added to your cart. Please review your new subtotal.",one:"1 item from a previous session was added to your cart. Please review your new subtotal."}},OutOfStock:{actions:{removeOutOfStock:"Remove out of stock items",reviewCart:"Review cart"},alert:"Out of stock!",lowInventory:{many:"Only {{count}} left!",one:"Last item!"},message:"The following items are out of stock:",title:"Your cart contains items that are out of stock"},PaymentMethods:{cartSyncError:"We were unable to save your changes. Please try again later.",emptyState:"No payment methods available",title:"Payment"},PaymentOnAccount:{referenceNumberLabel:"Custom Reference Number",referenceNumberPlaceholder:"Enter custom reference number",referenceNumberHint:"",availableCreditLabel:"Available Credit",exceedLimitWarning:"The credit limit is {{creditLimit}}. It will be exceeded by {{exceededAmount}} with this order.",exceedLimitWarningPrefix:"The credit limit is",exceedLimitWarningMiddle:". It will be exceeded by",exceedLimitWarningSuffix:"with this order.",exceedLimitError:"Payment On Account cannot be used for this order because your order amount exceeds your credit amount."},PurchaseOrder:{missingReferenceNumberError:"Reference number is required",referenceNumberHint:"",referenceNumberLabel:"Custom Reference Number",referenceNumberPlaceholder:"Enter custom reference number"},PlaceOrder:{button:"Place Order"},ServerError:{button:"Try again",contactSupport:"If you continue to have issues, please contact support.",title:"We were unable to process your order",unexpected:"An unexpected error occurred while processing your order. Please try again later.",permissionDenied:"You do not have permission to complete checkout. Please contact your administrator for assistance."},Quote:{permissionDenied:"You do not have permission to checkout with this quote.",dataError:"We were unable to retrieve the quote data. Please try again later."},ShippingMethods:{cartSyncError:"We were unable to save your changes. Please try again later.",emptyState:"This order can't be shipped to the address provided. Please review the address details you entered and make sure they're correct.",title:"Shipping options"},Summary:{Edit:"Edit",heading:"Your Cart ({count})"},Addresses:{billToNewAddress:"Bill to new address",shippingAddressTitle:"Shipping address",billingAddressTitle:"Billing address"},TermsAndConditions:{error:"Please accept the Terms and Conditions to continue.",label:"I have read, understand, and accept our <a href='https://www.adobe.com/legal/terms.html' target='_blank'>Terms of Use, Terms of Sales, Privacy Policy, and Return Policy</a>."},title:"Checkout"},W={Checkout:R},k={default:W},B=({children:e})=>{var s;const[r,t]=h(),a=(s=y.getConfig())==null?void 0:s.langDefinitions;p(()=>{const c=g.on("locale",l=>{l!==r&&t(l)},{eager:!0});return()=>{c==null||c.off()}},[r]);const n=D(k,a??{});return d(b,{lang:r,langDefinitions:n,children:e})},$=new f(d(B,{}));export{B as P,$ as r};
10
10
  //# sourceMappingURL=render.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"render.js","sources":["../../node_modules/deepmerge/dist/cjs.js","/@dropins/storefront-checkout/src/render/Provider.tsx","/@dropins/storefront-checkout/src/render/render.tsx"],"sourcesContent":["'use strict';\n\nvar isMergeableObject = function isMergeableObject(value) {\n\treturn isNonNullObject(value)\n\t\t&& !isSpecial(value)\n};\n\nfunction isNonNullObject(value) {\n\treturn !!value && typeof value === 'object'\n}\n\nfunction isSpecial(value) {\n\tvar stringValue = Object.prototype.toString.call(value);\n\n\treturn stringValue === '[object RegExp]'\n\t\t|| stringValue === '[object Date]'\n\t\t|| isReactElement(value)\n}\n\n// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25\nvar canUseSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;\n\nfunction isReactElement(value) {\n\treturn value.$$typeof === REACT_ELEMENT_TYPE\n}\n\nfunction emptyTarget(val) {\n\treturn Array.isArray(val) ? [] : {}\n}\n\nfunction cloneUnlessOtherwiseSpecified(value, options) {\n\treturn (options.clone !== false && options.isMergeableObject(value))\n\t\t? deepmerge(emptyTarget(value), value, options)\n\t\t: value\n}\n\nfunction defaultArrayMerge(target, source, options) {\n\treturn target.concat(source).map(function(element) {\n\t\treturn cloneUnlessOtherwiseSpecified(element, options)\n\t})\n}\n\nfunction getMergeFunction(key, options) {\n\tif (!options.customMerge) {\n\t\treturn deepmerge\n\t}\n\tvar customMerge = options.customMerge(key);\n\treturn typeof customMerge === 'function' ? customMerge : deepmerge\n}\n\nfunction getEnumerableOwnPropertySymbols(target) {\n\treturn Object.getOwnPropertySymbols\n\t\t? Object.getOwnPropertySymbols(target).filter(function(symbol) {\n\t\t\treturn Object.propertyIsEnumerable.call(target, symbol)\n\t\t})\n\t\t: []\n}\n\nfunction getKeys(target) {\n\treturn Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))\n}\n\nfunction propertyIsOnObject(object, property) {\n\ttry {\n\t\treturn property in object\n\t} catch(_) {\n\t\treturn false\n\t}\n}\n\n// Protects from prototype poisoning and unexpected merging up the prototype chain.\nfunction propertyIsUnsafe(target, key) {\n\treturn propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,\n\t\t&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,\n\t\t\t&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.\n}\n\nfunction mergeObject(target, source, options) {\n\tvar destination = {};\n\tif (options.isMergeableObject(target)) {\n\t\tgetKeys(target).forEach(function(key) {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(target[key], options);\n\t\t});\n\t}\n\tgetKeys(source).forEach(function(key) {\n\t\tif (propertyIsUnsafe(target, key)) {\n\t\t\treturn\n\t\t}\n\n\t\tif (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {\n\t\t\tdestination[key] = getMergeFunction(key, options)(target[key], source[key], options);\n\t\t} else {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(source[key], options);\n\t\t}\n\t});\n\treturn destination\n}\n\nfunction deepmerge(target, source, options) {\n\toptions = options || {};\n\toptions.arrayMerge = options.arrayMerge || defaultArrayMerge;\n\toptions.isMergeableObject = options.isMergeableObject || isMergeableObject;\n\t// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()\n\t// implementations can use it. The caller may not replace it.\n\toptions.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;\n\n\tvar sourceIsArray = Array.isArray(source);\n\tvar targetIsArray = Array.isArray(target);\n\tvar sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;\n\n\tif (!sourceAndTargetTypesMatch) {\n\t\treturn cloneUnlessOtherwiseSpecified(source, options)\n\t} else if (sourceIsArray) {\n\t\treturn options.arrayMerge(target, source, options)\n\t} else {\n\t\treturn mergeObject(target, source, options)\n\t}\n}\n\ndeepmerge.all = function deepmergeAll(array, options) {\n\tif (!Array.isArray(array)) {\n\t\tthrow new Error('first argument should be an array')\n\t}\n\n\treturn array.reduce(function(prev, next) {\n\t\treturn deepmerge(prev, next, options)\n\t}, {})\n};\n\nvar deepmerge_1 = deepmerge;\n\nmodule.exports = deepmerge_1;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { config } from '@/checkout/api';\nimport { UIProvider } from '@adobe-commerce/elsie/components';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { deepmerge } from '@adobe-commerce/elsie/lib/deepmerge';\nimport { events } from '@adobe-commerce/event-bus';\nimport { FunctionComponent } from 'preact';\nimport { useEffect, useState } from 'preact/hooks';\n\nimport en_US from '../i18n/en_US.json';\n\n// Langs\nconst langDefinitions = {\n default: en_US,\n};\n\ninterface IntlProviderProps {\n children?: any;\n}\n\nexport const Provider: FunctionComponent<IntlProviderProps> = ({\n children,\n}) => {\n const [locale, setLang] = useState<Lang>();\n\n const userLangDefinitions = config.getConfig()?.langDefinitions;\n\n useEffect(() => {\n const localeEvent = events.on(\n 'locale',\n (payload) => {\n if (payload !== locale) setLang(payload as Lang);\n },\n { eager: true }\n );\n return () => {\n localeEvent?.off();\n };\n }, [locale]);\n\n // Merge language definitions with user language definitions\n const definitions = deepmerge(langDefinitions, userLangDefinitions ?? {});\n\n return (\n <UIProvider lang={locale} langDefinitions={definitions}>\n {children}\n </UIProvider>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { Render } from '@adobe-commerce/elsie/lib';\nimport { Provider } from './Provider';\nexport { Provider };\nexport const render = new Render(<Provider />);\n"],"names":["isMergeableObject","value","isNonNullObject","isSpecial","stringValue","isReactElement","canUseSymbol","REACT_ELEMENT_TYPE","emptyTarget","val","cloneUnlessOtherwiseSpecified","options","deepmerge","defaultArrayMerge","target","source","element","getMergeFunction","key","customMerge","getEnumerableOwnPropertySymbols","symbol","getKeys","propertyIsOnObject","object","property","propertyIsUnsafe","mergeObject","destination","sourceIsArray","targetIsArray","sourceAndTargetTypesMatch","array","prev","next","deepmerge_1","cjs","langDefinitions","en_US","Provider","children","locale","setLang","useState","userLangDefinitions","_a","config","useEffect","localeEvent","events","payload","definitions","UIProvider","render","Render","jsx"],"mappings":"8cAEA,IAAIA,EAAoB,SAA2BC,EAAO,CACzD,OAAOC,EAAgBD,CAAK,GACxB,CAACE,EAAUF,CAAK,CACr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AAsBoB,EAAOrB,EAAS,CACrD,GAAI,CAAC,MAAM,QAAQqB,CAAK,EACvB,MAAM,IAAI,MAAM,mCAAmC,EAGpD,OAAOA,EAAM,OAAO,SAASC,EAAMC,EAAM,CACxC,OAAOtB,EAAUqB,EAAMC,EAAMvB,CAAO,CACtC,EAAI,CAAE,CAAA,CACN,EAEA,IAAIwB,EAAcvB,EAElBwB,EAAiBD,+tHCxGXE,EAAkB,CACtB,QAASC,CACX,EAMaC,EAAiD,CAAC,CAC7D,SAAAC,CACF,IAAM,OACJ,KAAM,CAACC,EAAQC,CAAO,EAAIC,EAAe,EAEnCC,GAAsBC,EAAAC,EAAO,UAAA,IAAP,YAAAD,EAAoB,gBAEhDE,EAAU,IAAM,CACd,MAAMC,EAAcC,EAAO,GACzB,SACCC,GAAY,CACPA,IAAYT,GAAQC,EAAQQ,CAAe,CACjD,EACA,CAAE,MAAO,EAAK,CAChB,EACA,MAAO,IAAM,CACXF,GAAA,MAAAA,EAAa,KACf,CAAA,EACC,CAACP,CAAM,CAAC,EAGX,MAAMU,EAAcvC,EAAUyB,EAAiBO,GAAuB,CAAA,CAAE,EAExE,SACGQ,EAAW,CAAA,KAAMX,EAAQ,gBAAiBU,EACxC,SAAAX,EACH,CAEJ,EC5Caa,EAAS,IAAIC,EAAOC,EAAChB,IAAS,CAAE","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"render.js","sources":["../../node_modules/deepmerge/dist/cjs.js","/@dropins/storefront-checkout/src/render/Provider.tsx","/@dropins/storefront-checkout/src/render/render.tsx"],"sourcesContent":["'use strict';\n\nvar isMergeableObject = function isMergeableObject(value) {\n\treturn isNonNullObject(value)\n\t\t&& !isSpecial(value)\n};\n\nfunction isNonNullObject(value) {\n\treturn !!value && typeof value === 'object'\n}\n\nfunction isSpecial(value) {\n\tvar stringValue = Object.prototype.toString.call(value);\n\n\treturn stringValue === '[object RegExp]'\n\t\t|| stringValue === '[object Date]'\n\t\t|| isReactElement(value)\n}\n\n// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25\nvar canUseSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;\n\nfunction isReactElement(value) {\n\treturn value.$$typeof === REACT_ELEMENT_TYPE\n}\n\nfunction emptyTarget(val) {\n\treturn Array.isArray(val) ? [] : {}\n}\n\nfunction cloneUnlessOtherwiseSpecified(value, options) {\n\treturn (options.clone !== false && options.isMergeableObject(value))\n\t\t? deepmerge(emptyTarget(value), value, options)\n\t\t: value\n}\n\nfunction defaultArrayMerge(target, source, options) {\n\treturn target.concat(source).map(function(element) {\n\t\treturn cloneUnlessOtherwiseSpecified(element, options)\n\t})\n}\n\nfunction getMergeFunction(key, options) {\n\tif (!options.customMerge) {\n\t\treturn deepmerge\n\t}\n\tvar customMerge = options.customMerge(key);\n\treturn typeof customMerge === 'function' ? customMerge : deepmerge\n}\n\nfunction getEnumerableOwnPropertySymbols(target) {\n\treturn Object.getOwnPropertySymbols\n\t\t? Object.getOwnPropertySymbols(target).filter(function(symbol) {\n\t\t\treturn Object.propertyIsEnumerable.call(target, symbol)\n\t\t})\n\t\t: []\n}\n\nfunction getKeys(target) {\n\treturn Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))\n}\n\nfunction propertyIsOnObject(object, property) {\n\ttry {\n\t\treturn property in object\n\t} catch(_) {\n\t\treturn false\n\t}\n}\n\n// Protects from prototype poisoning and unexpected merging up the prototype chain.\nfunction propertyIsUnsafe(target, key) {\n\treturn propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,\n\t\t&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,\n\t\t\t&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.\n}\n\nfunction mergeObject(target, source, options) {\n\tvar destination = {};\n\tif (options.isMergeableObject(target)) {\n\t\tgetKeys(target).forEach(function(key) {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(target[key], options);\n\t\t});\n\t}\n\tgetKeys(source).forEach(function(key) {\n\t\tif (propertyIsUnsafe(target, key)) {\n\t\t\treturn\n\t\t}\n\n\t\tif (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {\n\t\t\tdestination[key] = getMergeFunction(key, options)(target[key], source[key], options);\n\t\t} else {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(source[key], options);\n\t\t}\n\t});\n\treturn destination\n}\n\nfunction deepmerge(target, source, options) {\n\toptions = options || {};\n\toptions.arrayMerge = options.arrayMerge || defaultArrayMerge;\n\toptions.isMergeableObject = options.isMergeableObject || isMergeableObject;\n\t// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()\n\t// implementations can use it. The caller may not replace it.\n\toptions.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;\n\n\tvar sourceIsArray = Array.isArray(source);\n\tvar targetIsArray = Array.isArray(target);\n\tvar sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;\n\n\tif (!sourceAndTargetTypesMatch) {\n\t\treturn cloneUnlessOtherwiseSpecified(source, options)\n\t} else if (sourceIsArray) {\n\t\treturn options.arrayMerge(target, source, options)\n\t} else {\n\t\treturn mergeObject(target, source, options)\n\t}\n}\n\ndeepmerge.all = function deepmergeAll(array, options) {\n\tif (!Array.isArray(array)) {\n\t\tthrow new Error('first argument should be an array')\n\t}\n\n\treturn array.reduce(function(prev, next) {\n\t\treturn deepmerge(prev, next, options)\n\t}, {})\n};\n\nvar deepmerge_1 = deepmerge;\n\nmodule.exports = deepmerge_1;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { config } from '@/checkout/api';\nimport { UIProvider } from '@adobe-commerce/elsie/components';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { deepmerge } from '@adobe-commerce/elsie/lib/deepmerge';\nimport { events } from '@adobe-commerce/event-bus';\nimport { FunctionComponent } from 'preact';\nimport { useEffect, useState } from 'preact/hooks';\n\nimport en_US from '../i18n/en_US.json';\n\n// Langs\nconst langDefinitions = {\n default: en_US,\n};\n\ninterface IntlProviderProps {\n children?: any;\n}\n\nexport const Provider: FunctionComponent<IntlProviderProps> = ({\n children,\n}) => {\n const [locale, setLang] = useState<Lang>();\n\n const userLangDefinitions = config.getConfig()?.langDefinitions;\n\n useEffect(() => {\n const localeEvent = events.on(\n 'locale',\n (payload) => {\n if (payload !== locale) setLang(payload as Lang);\n },\n { eager: true }\n );\n return () => {\n localeEvent?.off();\n };\n }, [locale]);\n\n // Merge language definitions with user language definitions\n const definitions = deepmerge(langDefinitions, userLangDefinitions ?? {});\n\n return (\n <UIProvider lang={locale} langDefinitions={definitions}>\n {children}\n </UIProvider>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { Render } from '@adobe-commerce/elsie/lib';\nimport { Provider } from './Provider';\nexport { Provider };\nexport const render = new Render(<Provider />);\n"],"names":["isMergeableObject","value","isNonNullObject","isSpecial","stringValue","isReactElement","canUseSymbol","REACT_ELEMENT_TYPE","emptyTarget","val","cloneUnlessOtherwiseSpecified","options","deepmerge","defaultArrayMerge","target","source","element","getMergeFunction","key","customMerge","getEnumerableOwnPropertySymbols","symbol","getKeys","propertyIsOnObject","object","property","propertyIsUnsafe","mergeObject","destination","sourceIsArray","targetIsArray","sourceAndTargetTypesMatch","array","prev","next","deepmerge_1","cjs","langDefinitions","en_US","Provider","children","locale","setLang","useState","userLangDefinitions","_a","config","useEffect","localeEvent","events","payload","definitions","UIProvider","render","Render","jsx"],"mappings":"8cAEA,IAAIA,EAAoB,SAA2BC,EAAO,CACzD,OAAOC,EAAgBD,CAAK,GACxB,CAACE,EAAUF,CAAK,CACrB,EAEA,SAASC,EAAgBD,EAAO,CAC/B,MAAO,CAAC,CAACA,GAAS,OAAOA,GAAU,QACpC,CAEA,SAASE,EAAUF,EAAO,CACzB,IAAIG,EAAc,OAAO,UAAU,SAAS,KAAKH,CAAK,EAEtD,OAAOG,IAAgB,mBACnBA,IAAgB,iBAChBC,EAAeJ,CAAK,CACzB,CAGA,IAAIK,EAAe,OAAO,QAAW,YAAc,OAAO,IACtDC,EAAqBD,EAAe,OAAO,IAAI,eAAe,EAAI,MAEtE,SAASD,EAAeJ,EAAO,CAC9B,OAAOA,EAAM,WAAaM,CAC3B,CAEA,SAASC,EAAYC,EAAK,CACzB,OAAO,MAAM,QAAQA,CAAG,EAAI,CAAA,EAAK,CAAA,CAClC,CAEA,SAASC,EAA8BT,EAAOU,EAAS,CACtD,OAAQA,EAAQ,QAAU,IAASA,EAAQ,kBAAkBV,CAAK,EAC/DW,EAAUJ,EAAYP,CAAK,EAAGA,EAAOU,CAAO,EAC5CV,CACJ,CAEA,SAASY,EAAkBC,EAAQC,EAAQJ,EAAS,CACnD,OAAOG,EAAO,OAAOC,CAAM,EAAE,IAAI,SAASC,EAAS,CAClD,OAAON,EAA8BM,EAASL,CAAO,CACrD,CAAA,CACF,CAEA,SAASM,EAAiBC,EAAKP,EAAS,CACvC,GAAI,CAACA,EAAQ,YACZ,OAAOC,EAER,IAAIO,EAAcR,EAAQ,YAAYO,CAAG,E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right 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{CHECKOUT_DATA_FRAGMENT as A,NEGOTIABLE_QUOTE_FRAGMENT as I}from"../fragments.js";import{e as g,c as p,d as c}from"./guards.js";import{t as B,e as m}from"./synchronizeCheckout.js";import{s as r,d as f,Q as C,I as o,l as a}from"./fetch-graphql.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";const Q=`
3
+ import{CHECKOUT_DATA_FRAGMENT as A,NEGOTIABLE_QUOTE_FRAGMENT as I}from"../fragments.js";import{e as g,c as p,d as c}from"./guards.js";import{t as m,e as B}from"./synchronizeCheckout.js";import{s as r,d as f,Q as C,I as o,m as a}from"./fetch-graphql.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";const Q=`
4
4
  mutation setBillingAddress(
5
5
  $cartId: String!
6
6
  $billingAddress: BillingAddressInput!
@@ -30,5 +30,5 @@ import{CHECKOUT_DATA_FRAGMENT as A,NEGOTIABLE_QUOTE_FRAGMENT as I}from"../fragme
30
30
  }
31
31
 
32
32
  ${I}
33
- `,n=(t,s,e,i,d,l)=>async u=>await f({type:"mutation",query:e,options:{variables:{[s]:t,billingAddress:d(u)}},path:l,queueName:C.Updates,transformer:i}),b=({address:t,customerAddressId:s,customerAddressUid:e,sameAsShipping:i=!1})=>{if(!s&&e)throw new o("customerAddressUid is not supported");if(!i&&!s&&!t)throw new a},E=({address:t,customerAddressId:s,customerAddressUid:e,sameAsShipping:i=!1})=>{if(!e&&s)throw new o("customerAddressId is not supported");if(!i&&!e&&!t)throw new a},N=t=>{const s=!!r.cartId,e=!!r.quoteId;s?b(t):e&&E(t)},G=async t=>(g(),N(t),await(!!r.cartId?n(r.cartId,"cartId",Q,B,p,"setBillingAddressOnCart.cart"):n(r.quoteId,"quoteId",T,m,c,"setNegotiableQuoteBillingAddress.quote"))(t));export{G as s};
33
+ `,n=(t,s,e,i,d,l)=>async u=>await f({type:"mutation",query:e,options:{variables:{[s]:t,billingAddress:d(u)}},path:l,queueName:C.Updates,transformer:i}),b=({address:t,customerAddressId:s,customerAddressUid:e,sameAsShipping:i=!1})=>{if(!s&&e)throw new o("customerAddressUid is not supported");if(!i&&!s&&!t)throw new a},E=({address:t,customerAddressId:s,customerAddressUid:e,sameAsShipping:i=!1})=>{if(!e&&s)throw new o("customerAddressId is not supported");if(!i&&!e&&!t)throw new a},N=t=>{const s=!!r.cartId,e=!!r.quoteId;s?b(t):e&&E(t)},G=async t=>(g(),N(t),await(!!r.cartId?n(r.cartId,"cartId",Q,m,p,"setBillingAddressOnCart.cart"):n(r.quoteId,"quoteId",T,B,c,"setNegotiableQuoteBillingAddress.quote"))(t));export{G as s};
34
34
  //# sourceMappingURL=setBillingAddress.js.map
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{CUSTOMER_FRAGMENT as o,CHECKOUT_DATA_FRAGMENT as n}from"../fragments.js";import{s as m,d as r,t as l,o as u,Q as c}from"./fetch-graphql.js";import{merge as E}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import{c as f,t as p}from"./synchronizeCheckout.js";const C=t=>{var i,a,s;if(!t)return null;const e={firstName:t.firstname||"",lastName:t.lastname||"",email:t.email||""};return E(e,(s=(a=(i=f.getConfig().models)==null?void 0:i.CustomerModel)==null?void 0:a.transformer)==null?void 0:s.call(a,t))},y=t=>!!(t!=null&&t.is_email_available),A=`
3
+ import{CUSTOMER_FRAGMENT as o,CHECKOUT_DATA_FRAGMENT as n}from"../fragments.js";import{s as m,d as r,u as l,p as u,Q as c}from"./fetch-graphql.js";import{merge as E}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import{c as p,t as f}from"./synchronizeCheckout.js";const C=t=>{var i,a,s;if(!t)return null;const e={firstName:t.firstname||"",lastName:t.lastname||"",email:t.email||""};return E(e,(s=(a=(i=p.getConfig().models)==null?void 0:i.CustomerModel)==null?void 0:a.transformer)==null?void 0:s.call(a,t))},y=t=>!!(t!=null&&t.is_email_available),A=`
4
4
  query getCustomer {
5
5
  customer {
6
6
  ...CUSTOMER_FRAGMENT
@@ -24,5 +24,5 @@ import{CUSTOMER_FRAGMENT as o,CHECKOUT_DATA_FRAGMENT as n}from"../fragments.js";
24
24
  }
25
25
 
26
26
  ${n}
27
- `,N=async t=>{const e=m.cartId;if(!e)throw new u;return await r({options:{variables:{cartId:e,email:t}},path:"setGuestEmailOnCart.cart",query:h,queueName:c.Updates,transformer:p,type:"mutation"})};export{M as g,q as i,N as s};
27
+ `,N=async t=>{const e=m.cartId;if(!e)throw new u;return await r({options:{variables:{cartId:e,email:t}},path:"setGuestEmailOnCart.cart",query:h,queueName:c.Updates,transformer:f,type:"mutation"})};export{M as g,q as i,N as s};
28
28
  //# sourceMappingURL=setGuestEmailOnCart.js.map
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{CHECKOUT_DATA_FRAGMENT as d,NEGOTIABLE_QUOTE_FRAGMENT as i}from"../fragments.js";import{e as p,a as M,b as y}from"./guards.js";import{t as c,e as h}from"./synchronizeCheckout.js";import{s as e,k as I,d as P,Q as C}from"./fetch-graphql.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";const T=`
3
+ import{CHECKOUT_DATA_FRAGMENT as d,NEGOTIABLE_QUOTE_FRAGMENT as i}from"../fragments.js";import{e as p,a as M,b as y}from"./guards.js";import{t as c,e as h}from"./synchronizeCheckout.js";import{s as e,l as I,d as P,Q as C}from"./fetch-graphql.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";const T=`
4
4
  mutation setPaymentMethodOnCart(
5
5
  $cartId: String!
6
6
  $input: PaymentMethodInput!
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{s as o,o as G,p as D,d as T,Q as E,I as l,q as Q}from"./fetch-graphql.js";import"@dropins/tools/lib.js";import{t as F,a as O}from"./transform-shipping-estimate.js";import{a as R}from"./transform-shipping-methods.js";import{events as $}from"@dropins/tools/event-bus.js";import{g as N}from"./values.js";import{c as w,t as x,e as H}from"./synchronizeCheckout.js";import{e as V,f as K,g as L}from"./guards.js";import{CHECKOUT_DATA_FRAGMENT as y,NEGOTIABLE_QUOTE_FRAGMENT as B}from"../fragments.js";const k=`
3
+ import{s as o,p as G,q as D,d as T,Q as E,I as l,t as Q}from"./fetch-graphql.js";import"@dropins/tools/lib.js";import{t as F,a as O}from"./transform-shipping-estimate.js";import{a as R}from"./transform-shipping-methods.js";import{events as $}from"@dropins/tools/event-bus.js";import{g as N}from"./values.js";import{c as w,t as x,e as H}from"./synchronizeCheckout.js";import{e as V,f as K,g as L}from"./guards.js";import{CHECKOUT_DATA_FRAGMENT as y,NEGOTIABLE_QUOTE_FRAGMENT as B}from"../fragments.js";const k=`
4
4
  mutation estimateShippingMethods(
5
5
  $cartId: String!
6
6
  $address: EstimateAddressInput!
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{CHECKOUT_DATA_FRAGMENT as r,NEGOTIABLE_QUOTE_FRAGMENT as h}from"../fragments.js";import{e as d,t as u}from"./guards.js";import{t as g,e as M}from"./synchronizeCheckout.js";import{s as e,j as m,d as c,Q as I}from"./fetch-graphql.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";const S=`
3
+ import{CHECKOUT_DATA_FRAGMENT as r,NEGOTIABLE_QUOTE_FRAGMENT as h}from"../fragments.js";import{e as d,t as u}from"./guards.js";import{t as g,e as M}from"./synchronizeCheckout.js";import{s as e,k as m,d as c,Q as I}from"./fetch-graphql.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";const S=`
4
4
  mutation setShippingMethodsOnCart(
5
5
  $cartId: String!
6
6
  $shippingMethods: [ShippingMethodInput]!
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{s as r,o as D,d as _,U as S,u as N,e as Q}from"./fetch-graphql.js";import{merge as k,Initializer as z,deepmerge as O}from"@dropins/tools/lib.js";import{events as d}from"@dropins/tools/event-bus.js";import{CHECKOUT_DATA_FRAGMENT as C,NEGOTIABLE_QUOTE_FRAGMENT as G}from"../fragments.js";import{b as P,c as R,d as U,a as L,e as x,f as B,g as $}from"./transform-shipping-methods.js";import{E as p}from"./classifiers.js";const F=async(e=!1)=>{r.authenticated=e},b=e=>{if(!e)return;const{code:t,title:a,...s}=e;return{code:t,title:a,additionalData:s}},I=e=>{if(e)return e.filter(t=>!!t).map(t=>{const{code:a,title:s,...c}=t;return{code:a,title:s,additionalData:c}})},H=e=>{var a,s,c;if(!e)return;const t={type:"cart",availablePaymentMethods:I(e.available_payment_methods),billingAddress:R(e.billing_address),email:e.email??void 0,id:e.id,isEmpty:e.total_quantity===0,isVirtual:e.is_virtual,selectedPaymentMethod:b(e.selected_payment_method),shippingAddresses:P(e.shipping_addresses),isGuest:!r.authenticated};return k(t,(c=(s=(a=te.getConfig().models)==null?void 0:a.CartModel)==null?void 0:s.transformer)==null?void 0:c.call(s,e))},q=e=>{const t=e.street.filter(Boolean);return{city:e.city,company:e.company||void 0,country:$(e.country),customAttributes:B(e.custom_attributes),customerAddressUid:e.customer_address_uid||void 0,fax:e.fax||void 0,firstName:e.firstname,lastName:e.lastname,middleName:e.middlename||void 0,postCode:e.postcode||void 0,prefix:e.prefix||void 0,region:x(e.region),street:t,suffix:e.suffix||void 0,telephone:e.telephone||void 0,uid:e.uid,vatId:e.vat_id||void 0}},K=e=>{if(e)return q(e)},V=e=>e.filter(t=>!!t).map(t=>{const{available_shipping_methods:a,selected_shipping_method:s,...c}=t;return{...q(c),availableShippingMethods:L(a),selectedShippingMethod:U(s)}}),Y=e=>e?{type:"quote",availablePaymentMethods:I(e.available_payment_methods),billingAddress:K(e.billing_address),email:e.email??"",isEmpty:e.total_quantity===0,isVirtual:e.is_virtual,name:e.name,selectedPaymentMethod:b(e.selected_payment_method),shippingAddresses:V(e.shipping_addresses),status:e.status,uid:e.uid}:null,W=`
3
+ import{s as r,p as D,d as _,U as S,v as N,e as Q}from"./fetch-graphql.js";import{merge as k,Initializer as z,deepmerge as O}from"@dropins/tools/lib.js";import{events as d}from"@dropins/tools/event-bus.js";import{CHECKOUT_DATA_FRAGMENT as C,NEGOTIABLE_QUOTE_FRAGMENT as G}from"../fragments.js";import{b as P,c as R,d as U,a as L,e as x,f as B,g as $}from"./transform-shipping-methods.js";import{E as p}from"./classifiers.js";const F=async(e=!1)=>{r.authenticated=e},b=e=>{if(!e)return;const{code:t,title:a,...s}=e;return{code:t,title:a,additionalData:s}},I=e=>{if(e)return e.filter(t=>!!t).map(t=>{const{code:a,title:s,...c}=t;return{code:a,title:s,additionalData:c}})},H=e=>{var a,s,c;if(!e)return;const t={type:"cart",availablePaymentMethods:I(e.available_payment_methods),billingAddress:R(e.billing_address),email:e.email??void 0,id:e.id,isEmpty:e.total_quantity===0,isVirtual:e.is_virtual,selectedPaymentMethod:b(e.selected_payment_method),shippingAddresses:P(e.shipping_addresses),isGuest:!r.authenticated};return k(t,(c=(s=(a=te.getConfig().models)==null?void 0:a.CartModel)==null?void 0:s.transformer)==null?void 0:c.call(s,e))},q=e=>{const t=e.street.filter(Boolean);return{city:e.city,company:e.company||void 0,country:$(e.country),customAttributes:B(e.custom_attributes),customerAddressUid:e.customer_address_uid||void 0,fax:e.fax||void 0,firstName:e.firstname,lastName:e.lastname,middleName:e.middlename||void 0,postCode:e.postcode||void 0,prefix:e.prefix||void 0,region:x(e.region),street:t,suffix:e.suffix||void 0,telephone:e.telephone||void 0,uid:e.uid,vatId:e.vat_id||void 0}},K=e=>{if(e)return q(e)},V=e=>e.filter(t=>!!t).map(t=>{const{available_shipping_methods:a,selected_shipping_method:s,...c}=t;return{...q(c),availableShippingMethods:L(a),selectedShippingMethod:U(s)}}),Y=e=>e?{type:"quote",availablePaymentMethods:I(e.available_payment_methods),billingAddress:K(e.billing_address),email:e.email??"",isEmpty:e.total_quantity===0,isVirtual:e.is_virtual,name:e.name,selectedPaymentMethod:b(e.selected_payment_method),shippingAddresses:V(e.shipping_addresses),status:e.status,uid:e.uid}:null,W=`
4
4
  query getCart($cartId: String!) {
5
5
  cart(cart_id: $cartId) {
6
6
  ...CHECKOUT_DATA_FRAGMENT
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as n,jsxs as j}from"@dropins/tools/preact-jsx-runtime.js";import{h as w}from"../chunks/fetch-graphql.js";import"@dropins/tools/lib.js";import{h as C,a as L}from"../chunks/events2.js";import{n as R,g as U}from"../chunks/values.js";import{events as D}from"@dropins/tools/event-bus.js";import{c as W}from"../chunks/synchronizeCheckout.js";import{s as V}from"../chunks/setBillingAddress.js";/* empty css */import{Skeleton as P,SkeletonRow as $,Checkbox as q,InLineAlert as y}from"@dropins/tools/components.js";import{W as F}from"../chunks/ConditionalWrapper.js";import{c as G}from"../chunks/classes.js";import{useText as E}from"@dropins/tools/i18n.js";import{useState as b,useRef as H,useCallback as A,useEffect as B}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/transform-shipping-methods.js";import"../chunks/classifiers.js";import"../chunks/guards.js";const J=()=>n(P,{className:"bill-to-shipping-address__skeleton","data-testid":"bill-to-shipping-skeleton",children:n($,{size:"small",variant:"row"})}),K=({className:i,checked:c,disabled:e,error:t=null,onChange:p=()=>{},onDismissError:a=()=>{}})=>{const f=E({title:"Checkout.BillToShippingAddress.title"}),g=t!==null,r=l=>{const d=l.target;p==null||p(d.checked)};return j("div",{className:"checkout-bill-to-shipping-address",children:[n(q,{checked:c,className:G(["checkout-bill-to-shipping-address__checkbox",i]),"data-testid":"bill-to-shipping-checkbox",disabled:e,label:f.title,name:"checkout-bill-to-shipping-address__checkbox",onChange:r}),g&&n("div",{className:"checkout-bill-to-shipping-address__error","data-testid":"checkout-bill-to-shipping-address-alert",children:n(y,{heading:t,type:"error",variant:"primary",onDismiss:a})})]})},M=F(K,J),fs=({active:i=!0,autoSync:c=!0,onCartSyncError:e,onChange:t})=>{const[p,a]=b(null),[f,g]=b(!1),[r,l]=b(),d=H(!1),I=w.value,{cartSyncError:S}=E({cartSyncError:"Checkout.BillToShippingAddress.cartSyncError"}),N=A(()=>{a(null)},[]),v=A(s=>{a(null),l(s),t==null||t(s),!(!c||!s||!C())&&V({sameAsShipping:!0}).catch(o=>{l(!1),e==null||e({error:o}),e||a(S)})},[c,S,e,t]),h=A(s=>{var _;const o=!s||s.isEmpty,u=!!(s!=null&&s.isVirtual);if(o||u){g(u),l(!1),d.current=!1;return}if(d.current)return;const x=s,k=(_=x.shippingAddresses)==null?void 0:_[0],T=!!x.billingAddress;let m;if(k)m=k.sameAsBilling??!T;else{const{defaults:z}=W.getConfig();m=z.isBillToShipping}l(m),d.current=!0,c&&m&&k&&!T&&V({sameAsShipping:!0}).catch(()=>{})},[]);return B(()=>{!i||r===void 0||R({isBillToShipping:r})},[i,r]),B(()=>{if(!i)return;const s=L();if(s){const u=U("isBillToShipping");u!=null&&l(u),h(s);return}const o=D.on("checkout/initialized",h,{eager:!0});return()=>{o==null||o.off()}},[i,h]),B(()=>{if(!i)return;const s=D.on("checkout/updated",h,{eager:!1});return()=>{s==null||s.off()}},[i,h]),n(M,{checked:r,disabled:I,error:p,initialized:r!==void 0,visible:i&&!f,onChange:v,onDismissError:N})};export{fs as BillToShippingAddress,fs as default};
3
+ import{jsx as n,jsxs as R}from"@dropins/tools/preact-jsx-runtime.js";import{h as j,i as w}from"../chunks/fetch-graphql.js";import"@dropins/tools/lib.js";import{h as C,a as L}from"../chunks/events2.js";import{n as P,g as U}from"../chunks/values.js";import{events as D}from"@dropins/tools/event-bus.js";import{c as W}from"../chunks/synchronizeCheckout.js";import{s as V}from"../chunks/setBillingAddress.js";/* empty css */import{Skeleton as q,SkeletonRow as $,Checkbox as y,InLineAlert as F}from"@dropins/tools/components.js";import{W as G}from"../chunks/ConditionalWrapper.js";import{c as H}from"../chunks/classes.js";import{useText as v}from"@dropins/tools/i18n.js";import{useState as b,useRef as J,useCallback as A,useEffect as B}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/transform-shipping-methods.js";import"../chunks/classifiers.js";import"../chunks/guards.js";const K=()=>n(q,{className:"bill-to-shipping-address__skeleton","data-testid":"bill-to-shipping-skeleton",children:n($,{size:"small",variant:"row"})}),M=({className:i,checked:c,disabled:e,error:t=null,onChange:p=()=>{},onDismissError:a=()=>{}})=>{const f=v({title:"Checkout.BillToShippingAddress.title"}),g=t!==null,r=l=>{const d=l.target;p==null||p(d.checked)};return R("div",{className:"checkout-bill-to-shipping-address",children:[n(y,{checked:c,className:H(["checkout-bill-to-shipping-address__checkbox",i]),"data-testid":"bill-to-shipping-checkbox",disabled:e,label:f.title,name:"checkout-bill-to-shipping-address__checkbox",onChange:r}),g&&n("div",{className:"checkout-bill-to-shipping-address__error","data-testid":"checkout-bill-to-shipping-address-alert",children:n(F,{heading:t,type:"error",variant:"primary",onDismiss:a})})]})},O=G(M,K),gs=({active:i=!0,autoSync:c=!0,onCartSyncError:e,onChange:t})=>{const[p,a]=b(null),[f,g]=b(!1),[r,l]=b(),d=J(!1),E=j.value||w.value,{cartSyncError:S}=v({cartSyncError:"Checkout.BillToShippingAddress.cartSyncError"}),I=A(()=>{a(null)},[]),N=A(s=>{a(null),l(s),t==null||t(s),!(!c||!s||!C())&&V({sameAsShipping:!0}).catch(o=>{l(!1),e==null||e({error:o}),e||a(S)})},[c,S,e,t]),h=A(s=>{var _;const o=!s||s.isEmpty,u=!!(s!=null&&s.isVirtual);if(o||u){g(u),l(!1),d.current=!1;return}if(d.current)return;const x=s,k=(_=x.shippingAddresses)==null?void 0:_[0],T=!!x.billingAddress;let m;if(k)m=k.sameAsBilling??!T;else{const{defaults:z}=W.getConfig();m=z.isBillToShipping}l(m),d.current=!0,c&&m&&k&&!T&&V({sameAsShipping:!0}).catch(()=>{})},[]);return B(()=>{!i||r===void 0||P({isBillToShipping:r})},[i,r]),B(()=>{if(!i)return;const s=L();if(s){const u=U("isBillToShipping");u!=null&&l(u),h(s);return}const o=D.on("checkout/initialized",h,{eager:!0});return()=>{o==null||o.off()}},[i,h]),B(()=>{if(!i)return;const s=D.on("checkout/updated",h,{eager:!1});return()=>{s==null||s.off()}},[i,h]),n(O,{checked:r,disabled:E,error:p,initialized:r!==void 0,visible:i&&!f,onChange:N,onDismissError:I})};export{gs as BillToShippingAddress,gs as default};
4
4
  //# sourceMappingURL=BillToShippingAddress.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BillToShippingAddress.js","sources":["/@dropins/storefront-checkout/src/components/BillToShippingAddress/BillToShippingAddressSkeleton.tsx","/@dropins/storefront-checkout/src/components/BillToShippingAddress/BillToShippingAddress.tsx","/@dropins/storefront-checkout/src/containers/BillToShippingAddress/BillToShippingAddress.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\nimport { FunctionComponent } from 'preact';\n\nexport const BillToShippingAddressSkeleton: FunctionComponent = () => {\n return (\n <Skeleton\n className=\"bill-to-shipping-address__skeleton\"\n data-testid=\"bill-to-shipping-skeleton\"\n >\n <SkeletonRow size=\"small\" variant=\"row\" />\n </Skeleton>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 '@/checkout/components/BillToShippingAddress/BillToShippingAddress.css';\nimport { BillToShippingAddressSkeleton } from '@/checkout/components/BillToShippingAddress/BillToShippingAddressSkeleton';\nimport { WithConditionals } from '@/checkout/components/ConditionalWrapper/ConditionalWrapper';\nimport { Checkbox, InLineAlert } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { classes } from '@adobe-commerce/elsie/lib/classes';\nimport { FunctionComponent } from 'preact';\nimport { ChangeEvent, HTMLAttributes } from 'preact/compat';\n\nexport interface BillToShippingAddressProps\n extends Omit<\n HTMLAttributes<HTMLInputElement>,\n 'loading' | 'disabled' | 'onChange'\n > {\n disabled?: boolean;\n error?: string | null;\n onChange?: (checked: boolean) => void;\n onDismissError?: () => void;\n}\n\nconst BillToShippingAddressComponent: FunctionComponent<\n BillToShippingAddressProps\n> = ({\n className,\n checked,\n disabled,\n error = null,\n onChange = () => {},\n onDismissError = () => {},\n}) => {\n const translations = useText({\n title: 'Checkout.BillToShippingAddress.title',\n });\n\n const hasError = error !== null;\n\n const handleChange = (event: Event | ChangeEvent<HTMLInputElement>) => {\n const checkbox = event.target as HTMLInputElement;\n onChange?.(checkbox.checked);\n };\n\n return (\n <div className=\"checkout-bill-to-shipping-address\">\n <Checkbox\n checked={checked}\n className={classes([\n 'checkout-bill-to-shipping-address__checkbox',\n className,\n ])}\n data-testid=\"bill-to-shipping-checkbox\"\n disabled={disabled}\n label={translations.title}\n name=\"checkout-bill-to-shipping-address__checkbox\"\n onChange={handleChange}\n />\n\n {hasError && (\n <div\n className=\"checkout-bill-to-shipping-address__error\"\n data-testid=\"checkout-bill-to-shipping-address-alert\"\n >\n <InLineAlert\n heading={error}\n type=\"error\"\n variant=\"primary\"\n onDismiss={onDismissError}\n />\n </div>\n )}\n </div>\n );\n};\n\nexport const BillToShippingAddress = WithConditionals(\n BillToShippingAddressComponent,\n BillToShippingAddressSkeleton\n);\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { config, setBillingAddress } from '@/checkout/api';\nimport { BillToShippingAddress as BillToShippingAddressComponent } from '@/checkout/components/BillToShippingAddress';\nimport { Cart, NegotiableQuote } from '@/checkout/data/models';\nimport {\n getLatestCheckoutUpdate,\n getValue,\n hasPendingUpdates,\n hasShippingAddress,\n notifyValues,\n} from '@/checkout/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { events } from '@adobe-commerce/event-bus';\nimport { HTMLAttributes } from 'preact/compat';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\n\ninterface CartSyncError {\n error: Error;\n}\n\nexport interface BillToShippingAddressProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {\n active?: boolean;\n autoSync?: boolean;\n onCartSyncError?: (error: CartSyncError) => void;\n onChange?: (checked: boolean) => void;\n}\n\nexport const BillToShippingAddress: Container<BillToShippingAddressProps> = ({\n active = true,\n autoSync = true,\n onCartSyncError,\n onChange,\n}) => {\n const [error, setError] = useState<string | null>(null);\n const [isVirtual, setIsVirtual] = useState(false);\n const [isChecked, setIsChecked] = useState<boolean | undefined>();\n\n const hasInitialCartData = useRef(false);\n\n const isDisabled = hasPendingUpdates.value;\n\n const { cartSyncError } = useText({\n cartSyncError: 'Checkout.BillToShippingAddress.cartSyncError',\n });\n\n const handleDismissError = useCallback(() => {\n setError(null);\n }, []);\n\n const handleChange = useCallback(\n (isBillToShipping: boolean) => {\n setError(null);\n setIsChecked(isBillToShipping);\n\n onChange?.(isBillToShipping);\n\n if (!autoSync || !isBillToShipping || !hasShippingAddress()) {\n return;\n }\n\n setBillingAddress({ sameAsShipping: true }).catch((error: any) => {\n setIsChecked(false);\n onCartSyncError?.({ error });\n\n if (!onCartSyncError) {\n setError(cartSyncError);\n }\n });\n },\n [autoSync, cartSyncError, onCartSyncError, onChange]\n );\n\n const handleCheckoutData = useCallback(\n (data: Cart | NegotiableQuote | null) => {\n const isCartEmpty = !data || data.isEmpty;\n const isCartVirtual = !!data?.isVirtual;\n\n if (isCartEmpty || isCartVirtual) {\n setIsVirtual(isCartVirtual);\n setIsChecked(false);\n hasInitialCartData.current = false;\n return;\n }\n\n // If we've already set the initial state from cart data, don't override it.\n // This preserves any changes the user might have made.\n if (hasInitialCartData.current) {\n return;\n }\n\n const cart = data as Cart;\n const shippingAddress = cart.shippingAddresses?.[0];\n const hasBillingAddress = !!cart.billingAddress;\n\n let initialIsChecked: boolean;\n\n if (!shippingAddress) {\n const { defaults } = config.getConfig();\n initialIsChecked = defaults!.isBillToShipping!;\n } else {\n initialIsChecked = shippingAddress.sameAsBilling ?? !hasBillingAddress;\n }\n\n setIsChecked(initialIsChecked);\n hasInitialCartData.current = true;\n\n if (autoSync && initialIsChecked && shippingAddress && !hasBillingAddress) {\n setBillingAddress({ sameAsShipping: true }).catch(() => {});\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n );\n\n useEffect(() => {\n if (!active || isChecked === undefined) return;\n notifyValues({ isBillToShipping: isChecked });\n }, [active, isChecked]);\n\n useEffect(() => {\n if (!active) return;\n\n const pastUpdate = getLatestCheckoutUpdate();\n\n if (pastUpdate) {\n // When component becomes active, restore key state so handleCheckoutData can work properly\n const userBillToShipping = getValue('isBillToShipping');\n if (userBillToShipping != null) {\n setIsChecked(userBillToShipping);\n }\n handleCheckoutData(pastUpdate);\n return;\n }\n\n const onCheckoutInit = events.on(\n 'checkout/initialized',\n handleCheckoutData,\n { eager: true }\n );\n\n return () => {\n onCheckoutInit?.off();\n };\n }, [active, handleCheckoutData]);\n\n useEffect(() => {\n if (!active) return;\n\n const onCheckoutUpdated = events.on(\n 'checkout/updated',\n handleCheckoutData,\n {\n eager: false,\n }\n );\n\n return () => {\n onCheckoutUpdated?.off();\n };\n }, [active, handleCheckoutData]);\n\n return (\n <BillToShippingAddressComponent\n checked={isChecked}\n disabled={isDisabled}\n error={error}\n initialized={isChecked !== undefined}\n visible={active && !isVirtual}\n onChange={handleChange}\n onDismissError={handleDismissError}\n />\n );\n};\n"],"names":["BillToShippingAddressSkeleton","jsx","Skeleton","SkeletonRow","BillToShippingAddressComponent","className","checked","disabled","error","onChange","onDismissError","translations","useText","hasError","handleChange","event","checkbox","jsxs","Checkbox","classes","InLineAlert","BillToShippingAddress","WithConditionals","active","autoSync","onCartSyncError","setError","useState","isVirtual","setIsVirtual","isChecked","setIsChecked","hasInitialCartData","useRef","isDisabled","hasPendingUpdates","cartSyncError","handleDismissError","useCallback","isBillToShipping","hasShippingAddress","setBillingAddress","handleCheckoutData","data","isCartEmpty","isCartVirtual","cart","shippingAddress","_a","hasBillingAddress","initialIsChecked","defaults","config","useEffect","notifyValues","pastUpdate","getLatestCheckoutUpdate","userBillToShipping","getValue","onCheckoutInit","events","onCheckoutUpdated"],"mappings":"o+BAoBO,MAAMA,EAAmD,IAE5DC,EAACC,EAAA,CACC,UAAU,qCACV,cAAY,4BAEZ,SAACD,EAAAE,EAAA,CAAY,KAAK,QAAQ,QAAQ,KAAM,CAAA,CAAA,CAC1C,ECUEC,EAEF,CAAC,CACH,UAAAC,EACA,QAAAC,EACA,SAAAC,EACA,MAAAC,EAAQ,KACR,SAAAC,EAAW,IAAM,CAAC,EAClB,eAAAC,EAAiB,IAAM,CAAA,CACzB,IAAM,CACJ,MAAMC,EAAeC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KAClB,CAAA,EACC,CAACpC,EAAQmB,CAAkB,CAAC,EAE/BW,EAAU,IAAM,CACd,GAAI,CAAC9B,EAAQ,OAEb,MAAMsC,EAAoBD,EAAO,GAC/B,mBACAlB,EACA,CACE,MAAO,EAAA,CAEX,EAEA,MAAO,IAAM,CACXmB,GAAA,MAAAA,EAAmB,KACrB,CAAA,EACC,CAACtC,EAAQmB,CAAkB,CAAC,EAG7BzC,EAACG,EAAA,CACC,QAAS0B,EACT,SAAUI,EACV,MAAA1B,EACA,YAAasB,IAAc,OAC3B,QAASP,GAAU,CAACK,EACpB,SAAUd,EACV,eAAgBuB,CAAA,CAClB,CAEJ"}
1
+ {"version":3,"file":"BillToShippingAddress.js","sources":["/@dropins/storefront-checkout/src/components/BillToShippingAddress/BillToShippingAddressSkeleton.tsx","/@dropins/storefront-checkout/src/components/BillToShippingAddress/BillToShippingAddress.tsx","/@dropins/storefront-checkout/src/containers/BillToShippingAddress/BillToShippingAddress.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\nimport { FunctionComponent } from 'preact';\n\nexport const BillToShippingAddressSkeleton: FunctionComponent = () => {\n return (\n <Skeleton\n className=\"bill-to-shipping-address__skeleton\"\n data-testid=\"bill-to-shipping-skeleton\"\n >\n <SkeletonRow size=\"small\" variant=\"row\" />\n </Skeleton>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 '@/checkout/components/BillToShippingAddress/BillToShippingAddress.css';\nimport { BillToShippingAddressSkeleton } from '@/checkout/components/BillToShippingAddress/BillToShippingAddressSkeleton';\nimport { WithConditionals } from '@/checkout/components/ConditionalWrapper/ConditionalWrapper';\nimport { Checkbox, InLineAlert } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { classes } from '@adobe-commerce/elsie/lib/classes';\nimport { FunctionComponent } from 'preact';\nimport { ChangeEvent, HTMLAttributes } from 'preact/compat';\n\nexport interface BillToShippingAddressProps\n extends Omit<\n HTMLAttributes<HTMLInputElement>,\n 'loading' | 'disabled' | 'onChange'\n > {\n disabled?: boolean;\n error?: string | null;\n onChange?: (checked: boolean) => void;\n onDismissError?: () => void;\n}\n\nconst BillToShippingAddressComponent: FunctionComponent<\n BillToShippingAddressProps\n> = ({\n className,\n checked,\n disabled,\n error = null,\n onChange = () => {},\n onDismissError = () => {},\n}) => {\n const translations = useText({\n title: 'Checkout.BillToShippingAddress.title',\n });\n\n const hasError = error !== null;\n\n const handleChange = (event: Event | ChangeEvent<HTMLInputElement>) => {\n const checkbox = event.target as HTMLInputElement;\n onChange?.(checkbox.checked);\n };\n\n return (\n <div className=\"checkout-bill-to-shipping-address\">\n <Checkbox\n checked={checked}\n className={classes([\n 'checkout-bill-to-shipping-address__checkbox',\n className,\n ])}\n data-testid=\"bill-to-shipping-checkbox\"\n disabled={disabled}\n label={translations.title}\n name=\"checkout-bill-to-shipping-address__checkbox\"\n onChange={handleChange}\n />\n\n {hasError && (\n <div\n className=\"checkout-bill-to-shipping-address__error\"\n data-testid=\"checkout-bill-to-shipping-address-alert\"\n >\n <InLineAlert\n heading={error}\n type=\"error\"\n variant=\"primary\"\n onDismiss={onDismissError}\n />\n </div>\n )}\n </div>\n );\n};\n\nexport const BillToShippingAddress = WithConditionals(\n BillToShippingAddressComponent,\n BillToShippingAddressSkeleton\n);\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { config, setBillingAddress } from '@/checkout/api';\nimport { BillToShippingAddress as BillToShippingAddressComponent } from '@/checkout/components/BillToShippingAddress';\nimport { Cart, NegotiableQuote } from '@/checkout/data/models';\nimport {\n getLatestCheckoutUpdate,\n getValue,\n hasPendingUpdates,\n hasShippingAddress,\n notifyValues,\n} from '@/checkout/lib';\nimport { isSetAddressRequestPending } from '@/checkout/store/ui';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { events } from '@adobe-commerce/event-bus';\nimport { HTMLAttributes } from 'preact/compat';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\n\ninterface CartSyncError {\n error: Error;\n}\n\nexport interface BillToShippingAddressProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {\n active?: boolean;\n autoSync?: boolean;\n onCartSyncError?: (error: CartSyncError) => void;\n onChange?: (checked: boolean) => void;\n}\n\nexport const BillToShippingAddress: Container<BillToShippingAddressProps> = ({\n active = true,\n autoSync = true,\n onCartSyncError,\n onChange,\n}) => {\n const [error, setError] = useState<string | null>(null);\n const [isVirtual, setIsVirtual] = useState(false);\n const [isChecked, setIsChecked] = useState<boolean | undefined>();\n\n const hasInitialCartData = useRef(false);\n\n const isDisabled = hasPendingUpdates.value || isSetAddressRequestPending.value;\n\n const { cartSyncError } = useText({\n cartSyncError: 'Checkout.BillToShippingAddress.cartSyncError',\n });\n\n const handleDismissError = useCallback(() => {\n setError(null);\n }, []);\n\n const handleChange = useCallback(\n (isBillToShipping: boolean) => {\n setError(null);\n setIsChecked(isBillToShipping);\n\n onChange?.(isBillToShipping);\n\n if (!autoSync || !isBillToShipping || !hasShippingAddress()) {\n return;\n }\n\n setBillingAddress({ sameAsShipping: true }).catch((error: any) => {\n setIsChecked(false);\n onCartSyncError?.({ error });\n\n if (!onCartSyncError) {\n setError(cartSyncError);\n }\n });\n },\n [autoSync, cartSyncError, onCartSyncError, onChange]\n );\n\n const handleCheckoutData = useCallback(\n (data: Cart | NegotiableQuote | null) => {\n const isCartEmpty = !data || data.isEmpty;\n const isCartVirtual = !!data?.isVirtual;\n\n if (isCartEmpty || isCartVirtual) {\n setIsVirtual(isCartVirtual);\n setIsChecked(false);\n hasInitialCartData.current = false;\n return;\n }\n\n // If we've already set the initial state from cart data, don't override it.\n // This preserves any changes the user might have made.\n if (hasInitialCartData.current) {\n return;\n }\n\n const cart = data as Cart;\n const shippingAddress = cart.shippingAddresses?.[0];\n const hasBillingAddress = !!cart.billingAddress;\n\n let initialIsChecked: boolean;\n\n if (!shippingAddress) {\n const { defaults } = config.getConfig();\n initialIsChecked = defaults!.isBillToShipping!;\n } else {\n initialIsChecked = shippingAddress.sameAsBilling ?? !hasBillingAddress;\n }\n\n setIsChecked(initialIsChecked);\n hasInitialCartData.current = true;\n\n if (\n autoSync &&\n initialIsChecked &&\n shippingAddress &&\n !hasBillingAddress\n ) {\n setBillingAddress({ sameAsShipping: true }).catch(() => {});\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n );\n\n useEffect(() => {\n if (!active || isChecked === undefined) return;\n notifyValues({ isBillToShipping: isChecked });\n }, [active, isChecked]);\n\n useEffect(() => {\n if (!active) return;\n\n const pastUpdate = getLatestCheckoutUpdate();\n\n if (pastUpdate) {\n // When component becomes active, restore key state so handleCheckoutData can work properly\n const userBillToShipping = getValue('isBillToShipping');\n if (userBillToShipping != null) {\n setIsChecked(userBillToShipping);\n }\n handleCheckoutData(pastUpdate);\n return;\n }\n\n const onCheckoutInit = events.on(\n 'checkout/initialized',\n handleCheckoutData,\n { eager: true }\n );\n\n return () => {\n onCheckoutInit?.off();\n };\n }, [active, handleCheckoutData]);\n\n useEffect(() => {\n if (!active) return;\n\n const onCheckoutUpdated = events.on(\n 'checkout/updated',\n handleCheckoutData,\n {\n eager: false,\n }\n );\n\n return () => {\n onCheckoutUpdated?.off();\n };\n }, [active, handleCheckoutData]);\n\n return (\n <BillToShippingAddressComponent\n checked={isChecked}\n disabled={isDisabled}\n error={error}\n initialized={isChecked !== undefined}\n visible={active && !isVirtual}\n onChange={handleChange}\n onDismissError={handleDismissError}\n />\n );\n};\n"],"names":["BillToShippingAddressSkeleton","jsx","Skeleton","SkeletonRow","BillToShippingAddressComponent","className","checked","disabled","error","onChange","onDismissError","translations","useText","hasError","handleChange","event","checkbox","jsxs","Checkbox","classes","InLineAlert","BillToShippingAddress","WithConditionals","active","autoSync","onCartSyncError","setError","useState","isVirtual","setIsVirtual","isChecked","setIsChecked","hasInitialCartData","useRef","isDisabled","hasPendingUpdates","isSetAddressRequestPending","cartSyncError","handleDismissError","useCallback","isBillToShipping","hasShippingAddress","setBillingAddress","handleCheckoutData","data","isCartEmpty","isCartVirtual","cart","shippingAddress","_a","hasBillingAddress","initialIsChecked","defaults","config","useEffect","notifyValues","pastUpdate","getLatestCheckoutUpdate","userBillToShipping","getValue","onCheckoutInit","events","onCheckoutUpdated"],"mappings":"2+BAoBO,MAAMA,EAAmD,IAE5DC,EAACC,EAAA,CACC,UAAU,qCACV,cAAY,4BAEZ,SAACD,EAAAE,EAAA,CAAY,KAAK,QAAQ,QAAQ,KAAM,CAAA,CAAA,CAC1C,ECUEC,EAEF,CAAC,CACH,UAAAC,EACA,QAAAC,EACA,SAAAC,EACA,MAAAC,EAAQ,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I,EAAiBC,EAAO,GAC5B,uBACAlB,EACA,CAAE,MAAO,EAAK,CAChB,EAEA,MAAO,IAAM,CACXiB,GAAA,MAAAA,EAAgB,KAClB,CAAA,EACC,CAACrC,EAAQoB,CAAkB,CAAC,EAE/BW,EAAU,IAAM,CACd,GAAI,CAAC/B,EAAQ,OAEb,MAAMuC,EAAoBD,EAAO,GAC/B,mBACAlB,EACA,CACE,MAAO,EAAA,CAEX,EAEA,MAAO,IAAM,CACXmB,GAAA,MAAAA,EAAmB,KACrB,CAAA,EACC,CAACvC,EAAQoB,CAAkB,CAAC,EAG7B1C,EAACG,EAAA,CACC,QAAS0B,EACT,SAAUI,EACV,MAAA1B,EACA,YAAasB,IAAc,OAC3B,QAASP,GAAU,CAACK,EACpB,SAAUd,EACV,eAAgBwB,CAAA,CAClB,CAEJ"}
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{P as d,P as l}from"../chunks/PaymentOnAccount2.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"../chunks/ConditionalWrapper.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/lib.js";import"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getCompanyCredit.js";export{d as PaymentOnAccount,l as default};
3
+ import{P as d,P as l}from"../chunks/PaymentOnAccount2.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"../chunks/ConditionalWrapper.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/lib.js";import"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/signals.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getCompanyCredit.js";export{d as PaymentOnAccount,l as default};
4
4
  //# sourceMappingURL=PaymentOnAccount.js.map
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsxs as R,jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{W as U}from"../chunks/ConditionalWrapper.js";/* empty css */import{Skeleton as W,SkeletonRow as E,Button as _}from"@dropins/tools/components.js";import{classes as B,Slot as j}from"@dropins/tools/lib.js";import{h as q,s as y}from"../chunks/fetch-graphql.js";import{c as w,E as b}from"../chunks/classifiers.js";import{events as u}from"@dropins/tools/event-bus.js";import{a as K}from"../chunks/events2.js";import{g}from"../chunks/values.js";import{useState as S,useCallback as m,useEffect as f}from"@dropins/tools/preact-hooks.js";import{useText as M}from"@dropins/tools/i18n.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";function Q(n){const r=w.find(o=>o.matches(n));return r?r.code:b.UNKNOWN_ERROR}const T=()=>R(W,{"data-testid":"place-order-skeleton",children:[s(E,{size:"small",variant:"empty"}),s(E,{size:"small"})]}),v=({children:n,className:r,disabled:o=!1,onClick:a})=>s("div",{className:B(["checkout-place-order",r]),children:s(_,{className:"checkout-place-order__button","data-testid":"place-order-button",disabled:o,size:"medium",type:"button",variant:"primary",onClick:a,children:n},"placeOrder")}),H=U(v,T),oe=({disabled:n=!1,active:r=!0,handleValidation:o,handlePlaceOrder:a,slots:d,...x})=>{var O;const[z,p]=S(!1),[I,h]=S(!1),N=q.value,l=M({CheckoutUnexpectedError:"Checkout.ServerError.unexpected",placeOrderButton:"Checkout.PlaceOrder.button"}),k=m(e=>{const t=Q(e),i=t===b.UNKNOWN_ERROR?l.CheckoutUnexpectedError:e.message;u.emit("checkout/error",{message:i,code:t})},[l]),P=m(async()=>{var e;try{if(o&&!o())return;await a({cartId:y.cartId,quoteId:y.quoteId,code:((e=g("selectedPaymentMethod"))==null?void 0:e.code)??""})}catch(t){k(t)}},[o,a,k]),c=m(e=>{(!e||"isEmpty"in e&&e.isEmpty)&&h(!1)},[]);return f(()=>{if(r===!1)return;const e=u.on("cart/initialized",t=>{const i=(t==null?void 0:t.items)||[];h(i.some(C=>C.outOfStock||C.insufficientQuantity))},{eager:!0});return()=>{e==null||e.off()}},[r]),f(()=>{if(!r)return;const e=K();if(e){p(!0),c(e);return}const t=u.on("checkout/initialized",i=>{p(!0),c(i)},{eager:!0});return()=>{t==null||t.off()}},[r,c]),f(()=>{if(!r)return;const e=u.on("checkout/updated",t=>{c(t)},{eager:!1});return()=>{e==null||e.off()}},[r,c]),s(H,{...x,disabled:n||I||N,initialized:z,visible:r,onClick:P,children:s(j,{context:{code:((O=g("selectedPaymentMethod"))==null?void 0:O.code)??""},name:"Content",slot:d==null?void 0:d.Content,children:l.placeOrderButton})})};export{oe as PlaceOrder,oe as default};
3
+ import{jsxs as R,jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{W as U}from"../chunks/ConditionalWrapper.js";/* empty css */import{Skeleton as W,SkeletonRow as E,Button as _}from"@dropins/tools/components.js";import{classes as q,Slot as B}from"@dropins/tools/lib.js";import{h as j,s as y,i as v}from"../chunks/fetch-graphql.js";import{c as w,E as P}from"../chunks/classifiers.js";import{events as u}from"@dropins/tools/event-bus.js";import{a as K}from"../chunks/events2.js";import{g}from"../chunks/values.js";import{useState as S,useCallback as m,useEffect as f}from"@dropins/tools/preact-hooks.js";import{useText as M}from"@dropins/tools/i18n.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";function Q(n){const r=w.find(o=>o.matches(n));return r?r.code:P.UNKNOWN_ERROR}const T=()=>R(W,{"data-testid":"place-order-skeleton",children:[s(E,{size:"small",variant:"empty"}),s(E,{size:"small"})]}),A=({children:n,className:r,disabled:o=!1,onClick:a})=>s("div",{className:q(["checkout-place-order",r]),children:s(_,{className:"checkout-place-order__button","data-testid":"place-order-button",disabled:o,size:"medium",type:"button",variant:"primary",onClick:a,children:n},"placeOrder")}),H=U(A,T),se=({disabled:n=!1,active:r=!0,handleValidation:o,handlePlaceOrder:a,slots:d,...b})=>{var O;const[x,p]=S(!1),[z,h]=S(!1),I=j.value,l=M({CheckoutUnexpectedError:"Checkout.ServerError.unexpected",placeOrderButton:"Checkout.PlaceOrder.button"}),k=m(e=>{const t=Q(e),i=t===P.UNKNOWN_ERROR?l.CheckoutUnexpectedError:e.message;u.emit("checkout/error",{message:i,code:t})},[l]),N=m(async()=>{var e;try{if(o&&!o())return;await a({cartId:y.cartId,quoteId:y.quoteId,code:((e=g("selectedPaymentMethod"))==null?void 0:e.code)??""})}catch(t){k(t)}},[o,a,k]),c=m(e=>{(!e||"isEmpty"in e&&e.isEmpty)&&h(!1)},[]);return f(()=>{if(r===!1)return;const e=u.on("cart/initialized",t=>{const i=(t==null?void 0:t.items)||[];h(i.some(C=>C.outOfStock||C.insufficientQuantity))},{eager:!0});return()=>{e==null||e.off()}},[r]),f(()=>{if(!r)return;const e=K();if(e){p(!0),c(e);return}const t=u.on("checkout/initialized",i=>{p(!0),c(i)},{eager:!0});return()=>{t==null||t.off()}},[r,c]),f(()=>{if(!r)return;const e=u.on("checkout/updated",t=>{c(t)},{eager:!1});return()=>{e==null||e.off()}},[r,c]),s(H,{...b,disabled:n||z||I||v.value,initialized:x,visible:r,onClick:N,children:s(B,{context:{code:((O=g("selectedPaymentMethod"))==null?void 0:O.code)??""},name:"Content",slot:d==null?void 0:d.Content,children:l.placeOrderButton})})};export{se as PlaceOrder,se as default};
4
4
  //# sourceMappingURL=PlaceOrder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlaceOrder.js","sources":["/@dropins/storefront-checkout/src/lib/errors/mapErrorToCode.ts","/@dropins/storefront-checkout/src/components/PlaceOrder/PlaceOrderSkeleton.tsx","/@dropins/storefront-checkout/src/components/PlaceOrder/PlaceOrder.tsx","/@dropins/storefront-checkout/src/containers/PlaceOrder/PlaceOrder.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n classifiers,\n ErrorCode,\n ErrorCodes,\n} from '@/checkout/lib/errors/classifiers';\n\nexport function mapErrorToCode(error: unknown): ErrorCode {\n const matchingClassifier = classifiers.find((classifier) =>\n classifier.matches(error)\n );\n\n if (matchingClassifier) {\n return matchingClassifier.code;\n }\n\n return ErrorCodes.UNKNOWN_ERROR;\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\nimport { FunctionComponent } from 'preact';\n\nexport const PlaceOrderSkeleton: FunctionComponent = () => {\n return (\n <Skeleton data-testid=\"place-order-skeleton\">\n <SkeletonRow size=\"small\" variant=\"empty\" />\n <SkeletonRow size=\"small\" />\n </Skeleton>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { WithConditionals } from '@/checkout/components/ConditionalWrapper/index';\nimport '@/checkout/components/PlaceOrder/PlaceOrder.css';\nimport { PlaceOrderSkeleton } from '@/checkout/components/PlaceOrder/PlaceOrderSkeleton';\nimport { Button } from '@adobe-commerce/elsie/components';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\n\nexport interface PlaceOrderProps extends HTMLAttributes<HTMLDivElement> {\n disabled?: boolean;\n onClick: (event: Event) => Promise<void>;\n}\n\nconst PlaceOrderComponent: FunctionComponent<PlaceOrderProps> = ({\n children,\n className,\n disabled = false,\n onClick,\n}) => {\n return (\n <div className={classes(['checkout-place-order', className])}>\n <Button\n key=\"placeOrder\"\n className=\"checkout-place-order__button\"\n data-testid=\"place-order-button\"\n disabled={disabled}\n size=\"medium\"\n type=\"button\"\n variant=\"primary\"\n onClick={onClick}\n >\n {children}\n </Button>\n </div>\n );\n};\n\nexport const PlaceOrder = WithConditionals(\n PlaceOrderComponent,\n PlaceOrderSkeleton\n);\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { PlaceOrder as PlaceOrderComponent } from '@/checkout/components/PlaceOrder/PlaceOrder';\nimport { Cart, NegotiableQuote } from '@/checkout/data/models';\nimport {\n getLatestCheckoutUpdate,\n getValue,\n hasPendingUpdates,\n state,\n} from '@/checkout/lib';\nimport { ErrorCodes, mapErrorToCode } from '@/checkout/lib/errors';\nimport { Item as ItemModel } from '@/checkout/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { events } from '@adobe-commerce/event-bus';\nimport { HTMLAttributes } from 'preact/compat';\nimport { useCallback, useEffect, useState } from 'preact/hooks';\n\nexport interface ContentSlotContext {\n code: string;\n}\n\nexport interface HandlePlaceOrderContext {\n code: string;\n cartId?: string | null;\n quoteId?: string | null;\n}\n\nexport interface PlaceOrderProps extends HTMLAttributes<HTMLDivElement> {\n disabled?: boolean;\n active?: boolean;\n handleValidation?: () => boolean;\n handlePlaceOrder: (ctx: HandlePlaceOrderContext) => Promise<void>;\n slots?: {\n Content?: SlotProps<ContentSlotContext>;\n };\n}\n\nexport const PlaceOrder: Container<PlaceOrderProps> = ({\n disabled: disabledViaProp = false,\n active = true,\n handleValidation,\n handlePlaceOrder,\n slots,\n ...props\n}) => {\n const [isInitialized, setIsInitialized] = useState(false);\n const [hasOutOfStockItems, setHasOutOfStockItems] = useState(false);\n\n const hasQueuedUpdates = hasPendingUpdates.value;\n\n const translations = useText({\n CheckoutUnexpectedError: 'Checkout.ServerError.unexpected',\n placeOrderButton: 'Checkout.PlaceOrder.button',\n });\n\n const handlePlaceOrderError = useCallback(\n (error: any) => {\n const code = mapErrorToCode(error);\n\n const message =\n code === ErrorCodes.UNKNOWN_ERROR\n ? translations.CheckoutUnexpectedError\n : error.message;\n\n events.emit('checkout/error', { message, code });\n },\n [translations]\n );\n\n const handleClick = useCallback(async () => {\n try {\n if (handleValidation && !handleValidation()) return;\n\n await handlePlaceOrder({\n cartId: state.cartId,\n quoteId: state.quoteId,\n code: getValue('selectedPaymentMethod')?.code ?? '',\n });\n } catch (error: any) {\n handlePlaceOrderError(error);\n }\n }, [handleValidation, handlePlaceOrder, handlePlaceOrderError]);\n\n const handleCheckoutData = useCallback(\n (data: Cart | NegotiableQuote | null) => {\n const isEmptyCart = !data || ('isEmpty' in data && data.isEmpty);\n\n if (isEmptyCart) {\n setHasOutOfStockItems(false);\n }\n },\n []\n );\n\n useEffect(() => {\n if (active === false) return;\n\n const onCartData = events.on(\n 'cart/initialized',\n (data) => {\n const items = (data?.items || []) as ItemModel[];\n setHasOutOfStockItems(\n items.some((item) => item.outOfStock || item.insufficientQuantity)\n );\n },\n { eager: true }\n );\n\n return () => {\n onCartData?.off();\n };\n }, [active]);\n\n useEffect(() => {\n if (!active) return;\n\n const pastUpdate = getLatestCheckoutUpdate();\n\n if (pastUpdate) {\n setIsInitialized(true);\n handleCheckoutData(pastUpdate);\n return;\n }\n\n const onCheckoutInit = events.on(\n 'checkout/initialized',\n (data) => {\n setIsInitialized(true);\n handleCheckoutData(data);\n },\n { eager: true }\n );\n\n return () => {\n onCheckoutInit?.off();\n };\n }, [active, handleCheckoutData]);\n\n useEffect(() => {\n if (!active) return;\n\n const onCheckoutUpdated = events.on(\n 'checkout/updated',\n (data) => {\n handleCheckoutData(data);\n },\n { eager: false }\n );\n\n return () => {\n onCheckoutUpdated?.off();\n };\n }, [active, handleCheckoutData]);\n\n return (\n <PlaceOrderComponent\n {...props}\n disabled={disabledViaProp || hasOutOfStockItems || hasQueuedUpdates}\n initialized={isInitialized}\n visible={active}\n onClick={handleClick}\n >\n <Slot\n context={{ code: getValue('selectedPaymentMethod')?.code ?? '' }}\n name=\"Content\"\n slot={slots?.Content}\n >\n {translations.placeOrderButton}\n </Slot>\n </PlaceOrderComponent>\n );\n};\n"],"names":["mapErrorToCode","error","matchingClassifier","classifiers","classifier","ErrorCodes","PlaceOrderSkeleton","jsxs","Skeleton","jsx","SkeletonRow","PlaceOrderComponent","children","className","disabled","onClick","classes","Button","PlaceOrder","WithConditionals","disabledViaProp","active","handleValidation","handlePlaceOrder","slots","props","isInitialized","setIsInitialized","useState","hasOutOfStockItems","setHasOutOfStockItems","hasQueuedUpdates","hasPendingUpdates","translations","useText","handlePlaceOrderError","useCallback","code","message","events","handleClick","state","_a","getValue","handleCheckoutData","data","useEffect","onCartData","items","item","pastUpdate","getLatestCheckoutUpdate","onCheckoutInit","onCheckoutUpdated","Slot"],"mappings":"wuBAuBO,SAASA,EAAeC,EAA2B,CACxD,MAAMC,EAAqBC,EAAY,KAAMC,GAC3CA,EAAW,QAAQH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ACE,GAAGc,EACJ,SAAUL,GAAmBS,GAAsBE,EACnD,YAAaL,EACb,QAASL,EACT,QAASmB,EAET,SAAA/B,EAAC6C,EAAA,CACC,QAAS,CAAE,OAAMZ,EAAAC,EAAS,uBAAuB,IAAhC,YAAAD,EAAmC,OAAQ,EAAG,EAC/D,KAAK,UACL,KAAMlB,GAAA,YAAAA,EAAO,QAEZ,SAAaS,EAAA,gBAAA,CAAA,CAChB,CACF,CAEJ"}
1
+ {"version":3,"file":"PlaceOrder.js","sources":["/@dropins/storefront-checkout/src/lib/errors/mapErrorToCode.ts","/@dropins/storefront-checkout/src/components/PlaceOrder/PlaceOrderSkeleton.tsx","/@dropins/storefront-checkout/src/components/PlaceOrder/PlaceOrder.tsx","/@dropins/storefront-checkout/src/containers/PlaceOrder/PlaceOrder.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n classifiers,\n ErrorCode,\n ErrorCodes,\n} from '@/checkout/lib/errors/classifiers';\n\nexport function mapErrorToCode(error: unknown): ErrorCode {\n const matchingClassifier = classifiers.find((classifier) =>\n classifier.matches(error)\n );\n\n if (matchingClassifier) {\n return matchingClassifier.code;\n }\n\n return ErrorCodes.UNKNOWN_ERROR;\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\nimport { FunctionComponent } from 'preact';\n\nexport const PlaceOrderSkeleton: FunctionComponent = () => {\n return (\n <Skeleton data-testid=\"place-order-skeleton\">\n <SkeletonRow size=\"small\" variant=\"empty\" />\n <SkeletonRow size=\"small\" />\n </Skeleton>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { WithConditionals } from '@/checkout/components/ConditionalWrapper/index';\nimport '@/checkout/components/PlaceOrder/PlaceOrder.css';\nimport { PlaceOrderSkeleton } from '@/checkout/components/PlaceOrder/PlaceOrderSkeleton';\nimport { Button } from '@adobe-commerce/elsie/components';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\n\nexport interface PlaceOrderProps extends HTMLAttributes<HTMLDivElement> {\n disabled?: boolean;\n onClick: (event: Event) => Promise<void>;\n}\n\nconst PlaceOrderComponent: FunctionComponent<PlaceOrderProps> = ({\n children,\n className,\n disabled = false,\n onClick,\n}) => {\n return (\n <div className={classes(['checkout-place-order', className])}>\n <Button\n key=\"placeOrder\"\n className=\"checkout-place-order__button\"\n data-testid=\"place-order-button\"\n disabled={disabled}\n size=\"medium\"\n type=\"button\"\n variant=\"primary\"\n onClick={onClick}\n >\n {children}\n </Button>\n </div>\n );\n};\n\nexport const PlaceOrder = WithConditionals(\n PlaceOrderComponent,\n PlaceOrderSkeleton\n);\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\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 { PlaceOrder as PlaceOrderComponent } from '@/checkout/components/PlaceOrder/PlaceOrder';\nimport { Cart, NegotiableQuote } from '@/checkout/data/models';\nimport {\n getLatestCheckoutUpdate,\n getValue,\n hasPendingUpdates,\n state,\n} from '@/checkout/lib';\nimport { isSetAddressRequestPending } from '@/checkout/store/ui';\nimport { ErrorCodes, mapErrorToCode } from '@/checkout/lib/errors';\nimport { Item as ItemModel } from '@/checkout/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { events } from '@adobe-commerce/event-bus';\nimport { HTMLAttributes } from 'preact/compat';\nimport { useCallback, useEffect, useState } from 'preact/hooks';\n\nexport interface ContentSlotContext {\n code: string;\n}\n\nexport interface HandlePlaceOrderContext {\n code: string;\n cartId?: string | null;\n quoteId?: string | null;\n}\n\nexport interface PlaceOrderProps extends HTMLAttributes<HTMLDivElement> {\n disabled?: boolean;\n active?: boolean;\n handleValidation?: () => boolean;\n handlePlaceOrder: (ctx: HandlePlaceOrderContext) => Promise<void>;\n slots?: {\n Content?: SlotProps<ContentSlotContext>;\n };\n}\n\nexport const PlaceOrder: Container<PlaceOrderProps> = ({\n disabled: disabledViaProp = false,\n active = true,\n handleValidation,\n handlePlaceOrder,\n slots,\n ...props\n}) => {\n const [isInitialized, setIsInitialized] = useState(false);\n const [hasOutOfStockItems, setHasOutOfStockItems] = useState(false);\n\n const hasQueuedUpdates = hasPendingUpdates.value;\n\n const translations = useText({\n CheckoutUnexpectedError: 'Checkout.ServerError.unexpected',\n placeOrderButton: 'Checkout.PlaceOrder.button',\n });\n\n const handlePlaceOrderError = useCallback(\n (error: any) => {\n const code = mapErrorToCode(error);\n\n const message =\n code === ErrorCodes.UNKNOWN_ERROR\n ? translations.CheckoutUnexpectedError\n : error.message;\n\n events.emit('checkout/error', { message, code });\n },\n [translations]\n );\n\n const handleClick = useCallback(async () => {\n try {\n if (handleValidation && !handleValidation()) return;\n\n await handlePlaceOrder({\n cartId: state.cartId,\n quoteId: state.quoteId,\n code: getValue('selectedPaymentMethod')?.code ?? '',\n });\n } catch (error: any) {\n handlePlaceOrderError(error);\n }\n }, [handleValidation, handlePlaceOrder, handlePlaceOrderError]);\n\n const handleCheckoutData = useCallback(\n (data: Cart | NegotiableQuote | null) => {\n const isEmptyCart = !data || ('isEmpty' in data && data.isEmpty);\n\n if (isEmptyCart) {\n setHasOutOfStockItems(false);\n }\n },\n []\n );\n\n useEffect(() => {\n if (active === false) return;\n\n const onCartData = events.on(\n 'cart/initialized',\n (data) => {\n const items = (data?.items || []) as ItemModel[];\n setHasOutOfStockItems(\n items.some((item) => item.outOfStock || item.insufficientQuantity)\n );\n },\n { eager: true }\n );\n\n return () => {\n onCartData?.off();\n };\n }, [active]);\n\n useEffect(() => {\n if (!active) return;\n\n const pastUpdate = getLatestCheckoutUpdate();\n\n if (pastUpdate) {\n setIsInitialized(true);\n handleCheckoutData(pastUpdate);\n return;\n }\n\n const onCheckoutInit = events.on(\n 'checkout/initialized',\n (data) => {\n setIsInitialized(true);\n handleCheckoutData(data);\n },\n { eager: true }\n );\n\n return () => {\n onCheckoutInit?.off();\n };\n }, [active, handleCheckoutData]);\n\n useEffect(() => {\n if (!active) return;\n\n const onCheckoutUpdated = events.on(\n 'checkout/updated',\n (data) => {\n handleCheckoutData(data);\n },\n { eager: false }\n );\n\n return () => {\n onCheckoutUpdated?.off();\n };\n }, [active, handleCheckoutData]);\n\n return (\n <PlaceOrderComponent\n {...props}\n disabled={\n disabledViaProp ||\n hasOutOfStockItems ||\n hasQueuedUpdates ||\n isSetAddressRequestPending.value\n }\n initialized={isInitialized}\n visible={active}\n onClick={handleClick}\n >\n <Slot\n context={{ code: getValue('selectedPaymentMethod')?.code ?? '' }}\n name=\"Content\"\n slot={slots?.Content}\n >\n {translations.placeOrderButton}\n </Slot>\n </PlaceOrderComponent>\n );\n};\n"],"names":["mapErrorToCode","error","matchingClassifier","classifiers","classifier","ErrorCodes","PlaceOrderSkeleton","jsxs","Skeleton","jsx","SkeletonRow","PlaceOrderComponent","children","className","disabled","onClick","classes","Button","PlaceOrder","WithConditionals","disabledViaProp","active","handleValidation","handlePlaceOrder","slots","props","isInitialized","setIsInitialized","useState","hasOutOfStockItems","setHasOutOfStockItems","hasQueuedUpdates","hasPendingUpdates","translations","useText","handlePlaceOrderError","useCallback","code","message","events","handleClick","state","_a","getValue","handleCheckoutData","data","useEffect","onCartData","items","item","pastUpdate","getLatestCheckoutUpdate","onCheckoutInit","onCheckoutUpdated","isSetAddressRequestPending","Slot"],"mappings":"+uBAuBO,SAASA,EAAeC,EAA2B,CACxD,MAAMC,EAAqBC,EAAY,KAAMC,GAC3CA,EAAW,QAAQH,CAAK,CAC1B,EAEA,OAAIC,EACKA,EAAmB,KAGrBG,EAAW,aACpB,CCbO,MAAMC,EAAwC,IAEjDC,EAACC,EAAS,CAAA,cAAY,uBACpB,SAAA,CAAAC,EAACC,EAAY,CAAA,KAAK,QAAQ,QAAQ,QAAQ,EAC1CD,EAACC,EAAY,CAAA,KAAK,OAAQ,CAAA,CAAA,EAC5B,ECKEC,EAA0D,CAAC,CAC/D,SAAAC,EACA,UAAAC,EACA,SAAAC,EAAW,GACX,QAAAC,CACF,IAEIN,EAAC,OAAI,UAAWO,EAAQ,CAAC,uBAAwBH,CAAS,CAAC,EACzD,SAAAJ,EAACQ,EAAA,CAEC,UAAU,+BACV,cAAY,qBACZ,SAAAH,EACA,KAAK,SACL,KAAK,SACL,QAAQ,UACR,QAAAC,EAEC,SAAA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AO,EAAK,CAChB,EAEA,MAAO,IAAM,CACXF,GAAA,MAAAA,EAAY,KACd,CAAA,EACC,CAAC1B,CAAM,CAAC,EAEXyB,EAAU,IAAM,CACd,GAAI,CAACzB,EAAQ,OAEb,MAAM6B,EAAaC,EAAwB,EAE3C,GAAID,EAAY,CACdvB,EAAiB,EAAI,EACrBiB,EAAmBM,CAAU,EAC7B,MAAA,CAGF,MAAME,EAAiBb,EAAO,GAC5B,uBACCM,GAAS,CACRlB,EAAiB,EAAI,EACrBiB,EAAmBC,CAAI,CACzB,EACA,CAAE,MAAO,EAAK,CAChB,EAEA,MAAO,IAAM,CACXO,GAAA,MAAAA,EAAgB,KAClB,CAAA,EACC,CAAC/B,EAAQuB,CAAkB,CAAC,EAE/BE,EAAU,IAAM,CACd,GAAI,CAACzB,EAAQ,OAEb,MAAMgC,EAAoBd,EAAO,GAC/B,mBACCM,GAAS,CACRD,EAAmBC,CAAI,CACzB,EACA,CAAE,MAAO,EAAM,CACjB,EAEA,MAAO,IAAM,CACXQ,GAAA,MAAAA,EAAmB,KACrB,CAAA,EACC,CAAChC,EAAQuB,CAAkB,CAAC,EAG7BnC,EAACE,EAAA,CACE,GAAGc,EACJ,SACEL,GACAS,GACAE,GACAuB,EAA2B,MAE7B,YAAa5B,EACb,QAASL,EACT,QAASmB,EAET,SAAA/B,EAAC8C,EAAA,CACC,QAAS,CAAE,OAAMb,EAAAC,EAAS,uBAAuB,IAAhC,YAAAD,EAAmC,OAAQ,EAAG,EAC/D,KAAK,UACL,KAAMlB,GAAA,YAAAA,EAAO,QAEZ,SAAaS,EAAA,gBAAA,CAAA,CAChB,CACF,CAEJ"}
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{P as b,P as g}from"../chunks/PurchaseOrder.js";import"@dropins/tools/preact-jsx-runtime.js";import"../chunks/TermsAndConditions.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";/* empty css */import"../chunks/fetch-graphql.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/validation.js";import"@dropins/tools/preact-compat.js";/* empty css *//* empty css */import"@dropins/tools/i18n.js";/* empty css */import"@dropins/tools/preact-hooks.js";export{b as PurchaseOrder,g as default};
3
+ import{P as b,P as g}from"../chunks/PurchaseOrder.js";import"@dropins/tools/preact-jsx-runtime.js";import"../chunks/TermsAndConditions.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";/* empty css */import"../chunks/fetch-graphql.js";import"@dropins/tools/signals.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/validation.js";import"@dropins/tools/preact-compat.js";/* empty css *//* empty css */import"@dropins/tools/i18n.js";/* empty css */import"@dropins/tools/preact-hooks.js";export{b as PurchaseOrder,g as default};
4
4
  //# sourceMappingURL=PurchaseOrder.js.map
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsxs as A,jsx as r,Fragment as K}from"@dropins/tools/preact-jsx-runtime.js";import{h as pe,m as de,n as X}from"../chunks/fetch-graphql.js";import{classes as D,VComponent as he,Slot as me}from"@dropins/tools/lib.js";import{t as fe}from"../chunks/transform-shipping-estimate.js";import{h as I,a as ge}from"../chunks/events2.js";import{n as ke,g as N}from"../chunks/values.js";import{events as B}from"@dropins/tools/event-bus.js";import{c as Y}from"../chunks/synchronizeCheckout.js";import{s as ve}from"../chunks/setShippingMethods.js";import{W as Se}from"../chunks/ConditionalWrapper.js";/* empty css */import{Skeleton as Ee,SkeletonRow as T,IllustratedMessage as Ce,Icon as Le,InLineAlert as Me,RadioButton as ye,Price as ee,ToggleButton as _e}from"@dropins/tools/components.js";import{s as We}from"../chunks/dom.js";import{useRef as ne,useEffect as R,useState as V,useCallback as p,useMemo as te}from"@dropins/tools/preact-hooks.js";import*as a from"@dropins/tools/preact-compat.js";import{useText as re}from"@dropins/tools/i18n.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/transform-shipping-methods.js";import"../chunks/classifiers.js";import"../chunks/guards.js";const je=i=>a.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.47266 4.90002H15.1851V10.9645H21.2495L23 12.715V17.6124H20.073",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M15.1758 5.87573H19.0019L21.0394 10.7636",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M9.76151 16.7898C9.76151 18.0525 8.72845 19.076 7.46582 19.076C6.20318 19.076 5.17969 18.0429 5.17969 16.7803C5.17969 15.5176 6.20318 14.4941 7.46582 14.4941C8.72845 14.4941 9.75195 15.5176 9.76151 16.7803C9.76151 16.7803 9.76151 16.7803 9.76151 16.7898Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.8726 16.7898C19.8726 18.062 18.8491 19.0855 17.5769 19.0855C16.3047 19.0855 15.2812 18.062 15.2812 16.7898C15.2812 15.5176 16.3047 14.4941 17.5769 14.4941C18.8491 14.4941 19.8726 15.5176 19.8726 16.7898Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M8.08792 7.63574H1.69824",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M7.11229 10.3619H1",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M5.16084 13.0402H1.92773",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M9.76172 16.7611H15.2809",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.38672 16.7611H5.17025",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),Be=()=>A(Ee,{"data-testid":"shipping-methods-skeleton",children:[r(T,{size:"small",variant:"heading"}),r(T,{size:"small",variant:"empty"}),r(T,{fullWidth:!0,size:"medium"}),r(T,{fullWidth:!0,size:"medium"})]}),Oe=({className:i,busy:n=!1,onSelectionChange:g=()=>{},options:v,selection:d,title:l,UIComponentType:u="RadioButton",error:h=null,onDismissError:b=()=>{},...U})=>{const S=re({EmptyState:"Checkout.ShippingMethods.emptyState"}),E=h!==null,C=ne(null);R(()=>{E&&C.current&&We(C.current)},[E]);const L=(o,x)=>{const M={busy:n,className:"checkout-shipping-methods__method",key:o.value,name:"shipping-method",value:o.value,onChange:()=>g(o)};return x==="RadioButton"?r(ye,{...M,checked:(d==null?void 0:d.value)===o.value,"data-testid":"shipping-method-radioButton",description:o.title,disabled:n,id:o.value,label:A(K,{children:[r(ee,{amount:o.amount.value,currency:o.amount.currency})," ",r("span",{children:o.carrier.title})]})}):r(_e,{...M,"data-testid":"shipping-method-toggleButton",label:A(K,{children:[r("span",{children:o.carrier.title}),r(ee,{amount:o.amount.value,currency:o.amount.currency})]}),selected:(d==null?void 0:d.value)===o.value})};return A("div",{...U,className:D(["checkout-shipping-methods",i]),"data-testid":"checkout-shipping-methods",children:[l&&r(he,{className:"checkout-shipping-methods__title",node:l}),r("div",{className:D(["checkout-shipping-methods__content"]),children:r("div",{className:D(["checkout-shipping-methods__options",["checkout-shipping-methods__options--busy",n],["checkout-shipping-methods__options--toggleButton",u==="ToggleButton"]]),"data-testid":"checkout-shipping-methods-options",children:v.length===0?r(Ce,{"data-testid":"checkout-shipping-methods-empty",icon:r(Le,{source:je}),message:r("p",{children:S.EmptyState})}):v.map(o=>L(o,u))})}),E&&r("div",{ref:C,className:"checkout-shipping-methods__error","data-testid":"checkout-shipping-methods-alert",children:r(Me,{heading:h,type:"error",variant:"primary",onDismiss:b})})]})},we=Se(Oe,Be);function P(i,n){return i?n.some(g=>Q(g,i)):!1}function Q(i,n){return!i||!n||i.amount.value!==n.amount.value?!1:i.code===n.code&&i.carrier.code===n.carrier.code}function He(i){const n=B.lastPayload("shipping/estimate");n&&B.emit("shipping/estimate",{...n,shippingMethod:fe(i)})}const Ye=({UIComponentType:i="RadioButton",active:n=!0,autoSync:g=!0,displayTitle:v=!0,initialData:d,slots:l,onCartSyncError:u,onSelectionChange:h,...b})=>{const[U,S]=V(null),[E,C]=V(!1),[L,o]=V(),[x,M]=V(null),O=ne(null),oe=pe.value,ie=de.value,{cartSyncError:Z,defaultTitle:q}=re({cartSyncError:"Checkout.ShippingMethods.cartSyncError",defaultTitle:"Checkout.ShippingMethods.title"}),w=p(e=>{if(!e||e.length===0)return[];const{shipping:t}=Y.getConfig();return t!=null&&t.filterOptions?e.filter(t.filterOptions):e},[]),F=p(e=>{if(e.length===0)return null;const{defaults:t}=Y.getConfig();return t.selectedShippingMethod(e)},[]),se=te(()=>w(L),[L,w]),ce=p(()=>{S(null)},[]),c=p(e=>{S(null),M(t=>Q(t,e)?t:(ke({selectedShippingMethod:e}),e))},[]),y=p(async(e,t)=>{if(!g||!I())return;const s={carrierCode:e.carrier.code,methodCode:e.code};ve([s]).catch(m=>{c(t??null),u==null||u({method:e,error:m}),u||S(Z)})},[g,c,u,Z]),ae=p(async e=>{const t=N("selectedShippingMethod");c(e),h==null||h(e),I()||He(e),await y(e,t)},[h,c,y]),_=p(e=>{var J;const t=!e||e.isEmpty,s=!!(e!=null&&e.isVirtual);if(t||s){C(s),c(null),o([]);return}const m=(J=e.shippingAddresses)==null?void 0:J[0];if(!m)return;const W=m.availableShippingMethods??[];X()&&!O.current&&(O.current=W);const G=X()&&O.current?O.current:W;o(G);const j=w(G);if(j.length===0){c(null);return}const f=m.selectedShippingMethod??null,k=N("selectedShippingMethod"),z=P(k,j),ue=Q(k,f);if(k&&z&&!ue){y(k,f);return}if((!k||!z)&&f&&P(f,j)){c(f);return}if((!k||!z)&&(!f||!P(f,j))){const H=F(j);c(H),H&&y(H)}},[w,F,c,y]),$=p(e=>{if(e===void 0)return;const{shippingMethod:t,availableShippingMethods:s}=e,m=(s==null?void 0:s.find(W=>W.code===(t==null?void 0:t.methodCode)&&W.carrier.code===(t==null?void 0:t.carrierCode)))??null;o(s),c(m)},[c]);R(()=>{if(!n)return;const e=ge();if(e){const s=N("selectedShippingMethod");s&&M(s),_(e);return}const t=B.on("checkout/initialized",_,{eager:!0});return()=>{t==null||t.off()}},[n,_]),R(()=>{if(!n)return;const e=B.on("checkout/updated",_,{eager:!1});return()=>{e==null||e.off()}},[n,_]),R(()=>{if(!n||I())return;const e=B.on("shipping/estimate",$,{eager:!0});return()=>{e==null||e.off()}},[n,$]);const le=te(()=>{if(v)return r(me,{name:"checkout-shipping-methods-title",slot:l==null?void 0:l.Title,children:r("h3",{children:q})})},[v,l==null?void 0:l.Title,q]);return r(we,{...b,UIComponentType:i,busy:oe||ie,error:U,initialized:L!==void 0,options:se,selection:x,title:le,visible:n&&!E,onDismissError:ce,onSelectionChange:ae})};export{Ye as ShippingMethods,Ye as default,He as emitShippingEstimateEvent};
3
+ import{jsxs as A,jsx as r,Fragment as K}from"@dropins/tools/preact-jsx-runtime.js";import{h as pe,n as de,o as X}from"../chunks/fetch-graphql.js";import{classes as D,VComponent as he,Slot as me}from"@dropins/tools/lib.js";import{t as fe}from"../chunks/transform-shipping-estimate.js";import{h as I,a as ge}from"../chunks/events2.js";import{n as ke,g as N}from"../chunks/values.js";import{events as B}from"@dropins/tools/event-bus.js";import{c as Y}from"../chunks/synchronizeCheckout.js";import{s as ve}from"../chunks/setShippingMethods.js";import{W as Se}from"../chunks/ConditionalWrapper.js";/* empty css */import{Skeleton as Ee,SkeletonRow as T,IllustratedMessage as Ce,Icon as Le,InLineAlert as Me,RadioButton as ye,Price as ee,ToggleButton as _e}from"@dropins/tools/components.js";import{s as We}from"../chunks/dom.js";import{useRef as ne,useEffect as R,useState as V,useCallback as p,useMemo as te}from"@dropins/tools/preact-hooks.js";import*as a from"@dropins/tools/preact-compat.js";import{useText as re}from"@dropins/tools/i18n.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/transform-shipping-methods.js";import"../chunks/classifiers.js";import"../chunks/guards.js";const je=i=>a.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.47266 4.90002H15.1851V10.9645H21.2495L23 12.715V17.6124H20.073",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M15.1758 5.87573H19.0019L21.0394 10.7636",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M9.76151 16.7898C9.76151 18.0525 8.72845 19.076 7.46582 19.076C6.20318 19.076 5.17969 18.0429 5.17969 16.7803C5.17969 15.5176 6.20318 14.4941 7.46582 14.4941C8.72845 14.4941 9.75195 15.5176 9.76151 16.7803C9.76151 16.7803 9.76151 16.7803 9.76151 16.7898Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.8726 16.7898C19.8726 18.062 18.8491 19.0855 17.5769 19.0855C16.3047 19.0855 15.2812 18.062 15.2812 16.7898C15.2812 15.5176 16.3047 14.4941 17.5769 14.4941C18.8491 14.4941 19.8726 15.5176 19.8726 16.7898Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M8.08792 7.63574H1.69824",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M7.11229 10.3619H1",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M5.16084 13.0402H1.92773",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M9.76172 16.7611H15.2809",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.38672 16.7611H5.17025",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),Be=()=>A(Ee,{"data-testid":"shipping-methods-skeleton",children:[r(T,{size:"small",variant:"heading"}),r(T,{size:"small",variant:"empty"}),r(T,{fullWidth:!0,size:"medium"}),r(T,{fullWidth:!0,size:"medium"})]}),Oe=({className:i,busy:n=!1,onSelectionChange:g=()=>{},options:v,selection:d,title:l,UIComponentType:u="RadioButton",error:h=null,onDismissError:b=()=>{},...U})=>{const S=re({EmptyState:"Checkout.ShippingMethods.emptyState"}),E=h!==null,C=ne(null);R(()=>{E&&C.current&&We(C.current)},[E]);const L=(o,x)=>{const M={busy:n,className:"checkout-shipping-methods__method",key:o.value,name:"shipping-method",value:o.value,onChange:()=>g(o)};return x==="RadioButton"?r(ye,{...M,checked:(d==null?void 0:d.value)===o.value,"data-testid":"shipping-method-radioButton",description:o.title,disabled:n,id:o.value,label:A(K,{children:[r(ee,{amount:o.amount.value,currency:o.amount.currency})," ",r("span",{children:o.carrier.title})]})}):r(_e,{...M,"data-testid":"shipping-method-toggleButton",label:A(K,{children:[r("span",{children:o.carrier.title}),r(ee,{amount:o.amount.value,currency:o.amount.currency})]}),selected:(d==null?void 0:d.value)===o.value})};return A("div",{...U,className:D(["checkout-shipping-methods",i]),"data-testid":"checkout-shipping-methods",children:[l&&r(he,{className:"checkout-shipping-methods__title",node:l}),r("div",{className:D(["checkout-shipping-methods__content"]),children:r("div",{className:D(["checkout-shipping-methods__options",["checkout-shipping-methods__options--busy",n],["checkout-shipping-methods__options--toggleButton",u==="ToggleButton"]]),"data-testid":"checkout-shipping-methods-options",children:v.length===0?r(Ce,{"data-testid":"checkout-shipping-methods-empty",icon:r(Le,{source:je}),message:r("p",{children:S.EmptyState})}):v.map(o=>L(o,u))})}),E&&r("div",{ref:C,className:"checkout-shipping-methods__error","data-testid":"checkout-shipping-methods-alert",children:r(Me,{heading:h,type:"error",variant:"primary",onDismiss:b})})]})},we=Se(Oe,Be);function P(i,n){return i?n.some(g=>Q(g,i)):!1}function Q(i,n){return!i||!n||i.amount.value!==n.amount.value?!1:i.code===n.code&&i.carrier.code===n.carrier.code}function He(i){const n=B.lastPayload("shipping/estimate");n&&B.emit("shipping/estimate",{...n,shippingMethod:fe(i)})}const Ye=({UIComponentType:i="RadioButton",active:n=!0,autoSync:g=!0,displayTitle:v=!0,initialData:d,slots:l,onCartSyncError:u,onSelectionChange:h,...b})=>{const[U,S]=V(null),[E,C]=V(!1),[L,o]=V(),[x,M]=V(null),O=ne(null),oe=pe.value,ie=de.value,{cartSyncError:Z,defaultTitle:q}=re({cartSyncError:"Checkout.ShippingMethods.cartSyncError",defaultTitle:"Checkout.ShippingMethods.title"}),w=p(e=>{if(!e||e.length===0)return[];const{shipping:t}=Y.getConfig();return t!=null&&t.filterOptions?e.filter(t.filterOptions):e},[]),F=p(e=>{if(e.length===0)return null;const{defaults:t}=Y.getConfig();return t.selectedShippingMethod(e)},[]),se=te(()=>w(L),[L,w]),ce=p(()=>{S(null)},[]),c=p(e=>{S(null),M(t=>Q(t,e)?t:(ke({selectedShippingMethod:e}),e))},[]),y=p(async(e,t)=>{if(!g||!I())return;const s={carrierCode:e.carrier.code,methodCode:e.code};ve([s]).catch(m=>{c(t??null),u==null||u({method:e,error:m}),u||S(Z)})},[g,c,u,Z]),ae=p(async e=>{const t=N("selectedShippingMethod");c(e),h==null||h(e),I()||He(e),await y(e,t)},[h,c,y]),_=p(e=>{var J;const t=!e||e.isEmpty,s=!!(e!=null&&e.isVirtual);if(t||s){C(s),c(null),o([]);return}const m=(J=e.shippingAddresses)==null?void 0:J[0];if(!m)return;const W=m.availableShippingMethods??[];X()&&!O.current&&(O.current=W);const G=X()&&O.current?O.current:W;o(G);const j=w(G);if(j.length===0){c(null);return}const f=m.selectedShippingMethod??null,k=N("selectedShippingMethod"),z=P(k,j),ue=Q(k,f);if(k&&z&&!ue){y(k,f);return}if((!k||!z)&&f&&P(f,j)){c(f);return}if((!k||!z)&&(!f||!P(f,j))){const H=F(j);c(H),H&&y(H)}},[w,F,c,y]),$=p(e=>{if(e===void 0)return;const{shippingMethod:t,availableShippingMethods:s}=e,m=(s==null?void 0:s.find(W=>W.code===(t==null?void 0:t.methodCode)&&W.carrier.code===(t==null?void 0:t.carrierCode)))??null;o(s),c(m)},[c]);R(()=>{if(!n)return;const e=ge();if(e){const s=N("selectedShippingMethod");s&&M(s),_(e);return}const t=B.on("checkout/initialized",_,{eager:!0});return()=>{t==null||t.off()}},[n,_]),R(()=>{if(!n)return;const e=B.on("checkout/updated",_,{eager:!1});return()=>{e==null||e.off()}},[n,_]),R(()=>{if(!n||I())return;const e=B.on("shipping/estimate",$,{eager:!0});return()=>{e==null||e.off()}},[n,$]);const le=te(()=>{if(v)return r(me,{name:"checkout-shipping-methods-title",slot:l==null?void 0:l.Title,children:r("h3",{children:q})})},[v,l==null?void 0:l.Title,q]);return r(we,{...b,UIComponentType:i,busy:oe||ie,error:U,initialized:L!==void 0,options:se,selection:x,title:le,visible:n&&!E,onDismissError:ce,onSelectionChange:ae})};export{Ye as ShippingMethods,Ye as default,He as emitShippingEstimateEvent};
4
4
  //# sourceMappingURL=ShippingMethods.js.map
@@ -101,7 +101,13 @@ declare const _default: {
101
101
  "title": "Shipping options"
102
102
  },
103
103
  "Summary": {
104
- "Edit": "Edit"
104
+ "Edit": "Edit",
105
+ "heading": "Your Cart ({count})"
106
+ },
107
+ "Addresses": {
108
+ "billToNewAddress": "Bill to new address",
109
+ "shippingAddressTitle": "Shipping address",
110
+ "billingAddressTitle": "Billing address"
105
111
  },
106
112
  "TermsAndConditions": {
107
113
  "error": "Please accept the Terms and Conditions to continue.",
@@ -1,13 +1,26 @@
1
- import { RenderAPI } from '../../types';
2
-
1
+ /********************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * __________________
4
+ *
5
+ * Copyright 2025 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+ *******************************************************************/
3
17
  type AddressFormChange = {
4
18
  data: Record<string, any>;
5
19
  isDataValid: boolean;
6
20
  };
7
- export declare function setAddressOnCart({ type, debounceMs, placeOrderBtn, }: {
21
+ export declare function setAddressOnCart({ type, debounceMs, }: {
8
22
  type?: 'shipping' | 'billing';
9
23
  debounceMs?: number;
10
- placeOrderBtn?: RenderAPI;
11
24
  }): ({ data, isDataValid }: AddressFormChange) => void;
12
25
  export declare function estimateShippingCost({ debounceMs }: {
13
26
  debounceMs?: number | undefined;
package/lib/utils.js CHANGED
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import"../chunks/fetch-graphql.js";import{s as l,e as C}from"../chunks/setShippingAddress.js";import{debounce as g}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import{s as y}from"../chunks/setBillingAddress.js";import{b as K,c as L,g as Q,a as W,i as X}from"../chunks/events.js";import{a as A}from"../chunks/dom.js";import{g as Z,s as B}from"../chunks/dom.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-shipping-estimate.js";import"../chunks/transform-shipping-methods.js";import"../chunks/values.js";import"../chunks/synchronizeCheckout.js";import"../fragments.js";import"../chunks/classifiers.js";import"../chunks/guards.js";import"../chunks/events2.js";let f=0;function D({type:e="shipping",debounceMs:t=0,placeOrderBtn:r}){const i=e==="shipping"?l:y,o=g(s=>{f+=1,i(s).catch(console.error).finally(()=>{f-=1,f===0&&(r==null||r.setProps(n=>({...n,disabled:!1})))})},t);return({data:s,isDataValid:n})=>{if(!n)return;r==null||r.setProps(c=>({...c,disabled:!0}));const u=d(s);o(u)}}function R({debounceMs:e=0}){let t={},r=!1;const i=g(o=>{var n,u,c,p;if(r)return;const s={country_code:o.countryCode,region_name:String(((n=o.region)==null?void 0:n.regionCode)||""),region_id:String(((u=o.region)==null?void 0:u.regionId)||""),zip:o.postcode};C({criteria:s}),t={countryCode:o.countryCode,regionCode:((c=o.region)==null?void 0:c.regionCode)||"",regionId:((p=o.region)==null?void 0:p.regionId)||"",postcode:o.postcode}},e);return({data:o,isDataValid:s})=>{var n,u;if(s){r=!0;return}t.countryCode===o.countryCode&&t.regionCode===(((n=o.region)==null?void 0:n.regionCode)||"")&&t.regionId===(((u=o.region)==null?void 0:u.regionId)||"")&&t.postcode===o.postcode||i(o)}}function h(e,t=!1){var n;const{name:r,ref:i}=e,o=document.forms.namedItem(r);if(!o||o.offsetParent===null)return!0;o.setAttribute("novalidate","");const s=((n=i==null?void 0:i.current)==null?void 0:n.handleValidationSubmit(!1))??o.checkValidity();return!s&&t&&A(o),s}function $(e){for(const t of e)if(!h(t,!0))return!1;return!0}function z(e){return document.createRange().createContextualFragment(e)}function U(e){return function(t){return e.querySelector(t)}}function m(e,t,r){if(!e||!r)return;const i=document.head.querySelector(`meta[${r}="${e}"]`);if(!t){i==null||i.remove();return}if(i)i.setAttribute("content",t);else{const o=document.createElement("meta");o.setAttribute(r,e),o.setAttribute("content",t),document.head.appendChild(o)}}function j(e){m("title",e,"name"),m("description",e,"name"),m("keywords",e,"name"),m("og:description",e,"property"),m("og:title",e,"property"),m("og:url",window.location.href,"property")}const d=e=>{var i,o,s;if(!(!(e!=null&&e.id)&&!(e!=null&&e.uid)))return{customerAddressId:e.id,customerAddressUid:e.uid};const r=(i=e.customAttributes)==null?void 0:i.map(({code:n,value:u})=>({code:n,value:String(u)}));return{address:{city:e.city,company:e==null?void 0:e.company,countryCode:e.countryCode,customAttributes:r,fax:e.fax,firstName:e.firstName,lastName:e.lastName,middleName:e.middleName,postcode:e.postcode,prefix:e.prefix,region:(o=e==null?void 0:e.region)==null?void 0:o.regionCode,regionId:(s=e==null?void 0:e.region)==null?void 0:s.regionId,street:e.street,suffix:e.suffix,telephone:e.telephone,vatId:e.vatId,saveInAddressBook:e.saveAddressBook}}},G=e=>{var t,r,i;return{city:e.city,company:e==null?void 0:e.company,countryCode:(t=e.country)==null?void 0:t.code,customAttributes:e.customAttributes,fax:e.fax,firstName:e.firstName,lastName:e.lastName,middleName:e.middleName,postcode:e.postCode,prefix:e.prefix,region:{regionCode:(r=e.region)==null?void 0:r.code,regionId:(i=e.region)==null?void 0:i.id},street:e.street,suffix:e.suffix,telephone:e.telephone,vatId:e.vatId}};export{z as createFragment,m as createMetaTag,U as createScopedSelector,R as estimateShippingCost,K as getCartAddress,L as getCartPaymentMethod,Q as getCartShippingMethod,Z as getParentContainer,W as isEmptyCart,X as isVirtualCart,B as scrollToElement,A as scrollToParentContainer,D as setAddressOnCart,j as setMetaTags,d as transformAddressFormValuesToAddressInput,G as transformCartAddressToFormValues,h as validateForm,$ as validateForms};
3
+ import{i as l}from"../chunks/fetch-graphql.js";import{s as C,e as d}from"../chunks/setShippingAddress.js";import{debounce as g}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import{s as A}from"../chunks/setBillingAddress.js";import{b as H,c as J,g as K,a as L,i as Q}from"../chunks/events.js";import{a as y}from"../chunks/dom.js";import{g as X,s as Y}from"../chunks/dom.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-shipping-estimate.js";import"../chunks/transform-shipping-methods.js";import"../chunks/values.js";import"../chunks/synchronizeCheckout.js";import"../fragments.js";import"../chunks/classifiers.js";import"../chunks/guards.js";import"../chunks/events2.js";let m=0;function R({type:e="shipping",debounceMs:t=0}){const i=e==="shipping"?C:A,r=g(o=>{m+=1,i(o).catch(console.error).finally(()=>{m-=1,m===0&&(l.value=!1)})},t);return({data:o,isDataValid:s})=>{if(!s)return;l.value=!0;const n=I(o);r(n)}}function _({debounceMs:e=0}){let t={},i=!1;const r=g(o=>{var n,c,p,f;if(i)return;const s={country_code:o.countryCode,region_name:String(((n=o.region)==null?void 0:n.regionCode)||""),region_id:String(((c=o.region)==null?void 0:c.regionId)||""),zip:o.postcode};d({criteria:s}),t={countryCode:o.countryCode,regionCode:((p=o.region)==null?void 0:p.regionCode)||"",regionId:((f=o.region)==null?void 0:f.regionId)||"",postcode:o.postcode}},e);return({data:o,isDataValid:s})=>{var n,c;if(s){i=!0;return}t.countryCode===o.countryCode&&t.regionCode===(((n=o.region)==null?void 0:n.regionCode)||"")&&t.regionId===(((c=o.region)==null?void 0:c.regionId)||"")&&t.postcode===o.postcode||r(o)}}function h(e,t=!1){var n;const{name:i,ref:r}=e,o=document.forms.namedItem(i);if(!o||o.offsetParent===null)return!0;o.setAttribute("novalidate","");const s=((n=r==null?void 0:r.current)==null?void 0:n.handleValidationSubmit(!1))??o.checkValidity();return!s&&t&&y(o),s}function D(e){for(const t of e)if(!h(t,!0))return!1;return!0}function $(e){return document.createRange().createContextualFragment(e)}function z(e){return function(t){return e.querySelector(t)}}function u(e,t,i){if(!e||!i)return;const r=document.head.querySelector(`meta[${i}="${e}"]`);if(!t){r==null||r.remove();return}if(r)r.setAttribute("content",t);else{const o=document.createElement("meta");o.setAttribute(i,e),o.setAttribute("content",t),document.head.appendChild(o)}}function O(e){u("title",e,"name"),u("description",e,"name"),u("keywords",e,"name"),u("og:description",e,"property"),u("og:title",e,"property"),u("og:url",window.location.href,"property")}const I=e=>{var r,o,s;if(!(!(e!=null&&e.id)&&!(e!=null&&e.uid)))return{customerAddressId:e.id,customerAddressUid:e.uid};const i=(r=e.customAttributes)==null?void 0:r.map(({code:n,value:c})=>({code:n,value:String(c)}));return{address:{city:e.city,company:e==null?void 0:e.company,countryCode:e.countryCode,customAttributes:i,fax:e.fax,firstName:e.firstName,lastName:e.lastName,middleName:e.middleName,postcode:e.postcode,prefix:e.prefix,region:(o=e==null?void 0:e.region)==null?void 0:o.regionCode,regionId:(s=e==null?void 0:e.region)==null?void 0:s.regionId,street:e.street,suffix:e.suffix,telephone:e.telephone,vatId:e.vatId,saveInAddressBook:e.saveAddressBook}}},U=e=>{var t,i,r;return{city:e.city,company:e==null?void 0:e.company,countryCode:(t=e.country)==null?void 0:t.code,customAttributes:e.customAttributes,fax:e.fax,firstName:e.firstName,lastName:e.lastName,middleName:e.middleName,postcode:e.postCode,prefix:e.prefix,region:{regionCode:(i=e.region)==null?void 0:i.code,regionId:(r=e.region)==null?void 0:r.id},street:e.street,suffix:e.suffix,telephone:e.telephone,vatId:e.vatId}};export{$ as createFragment,u as createMetaTag,z as createScopedSelector,_ as estimateShippingCost,H as getCartAddress,J as getCartPaymentMethod,K as getCartShippingMethod,X as getParentContainer,L as isEmptyCart,Q as isVirtualCart,Y as scrollToElement,y as scrollToParentContainer,R as setAddressOnCart,O as setMetaTags,I as transformAddressFormValuesToAddressInput,U as transformCartAddressToFormValues,h as validateForm,D as validateForms};
4
4
  //# sourceMappingURL=utils.js.map
package/lib/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["/@dropins/storefront-checkout/src/lib/utils/api.ts","/@dropins/storefront-checkout/src/lib/utils/forms.ts","/@dropins/storefront-checkout/src/lib/utils/fragments.ts","/@dropins/storefront-checkout/src/lib/utils/meta.ts","/@dropins/storefront-checkout/src/lib/utils/transformers.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n estimateShippingMethods,\n setBillingAddress,\n setShippingAddress,\n} from '@/checkout/api';\nimport {\n BillingAddressInput,\n ShippingAddressInput,\n} from '@/checkout/data/models/api';\nimport { transformAddressFormValuesToAddressInput } from '@/checkout/lib/utils';\nimport { RenderAPI } from '@/checkout/types';\nimport { debounce } from '@adobe-commerce/elsie/lib';\n\ntype AddressFormChange = {\n data: Record<string, any>;\n isDataValid: boolean;\n};\n\nlet ongoingSetAddressCalls = 0;\n\nexport function setAddressOnCart({\n type = 'shipping',\n debounceMs = 0,\n placeOrderBtn,\n}: {\n type?: 'shipping' | 'billing';\n debounceMs?: number;\n placeOrderBtn?: RenderAPI;\n}) {\n const api = type === 'shipping' ? setShippingAddress : setBillingAddress;\n\n const debouncedApi = debounce(\n (address: ShippingAddressInput | BillingAddressInput) => {\n ongoingSetAddressCalls += 1;\n api(address)\n .catch(console.error)\n .finally(() => {\n ongoingSetAddressCalls -= 1;\n if (ongoingSetAddressCalls === 0) {\n placeOrderBtn?.setProps((prev) => ({ ...prev, disabled: false }));\n }\n });\n },\n debounceMs\n );\n\n return ({ data, isDataValid }: AddressFormChange) => {\n if (!isDataValid) return;\n placeOrderBtn?.setProps((prev) => ({ ...prev, disabled: true }));\n const address = transformAddressFormValuesToAddressInput(data);\n debouncedApi(address);\n };\n}\n\nexport function estimateShippingCost({ debounceMs = 0 }) {\n let prevEstimateShippingData: {\n countryCode?: string;\n regionCode?: string;\n regionId?: string;\n postcode?: string;\n } = {};\n\n let shouldCancelDebounce = false;\n\n const debouncedApi = debounce((data: Record<string, any>) => {\n if (shouldCancelDebounce) return;\n\n const estimateShippingInputCriteria = {\n country_code: data.countryCode,\n region_name: String(data.region?.regionCode || ''),\n region_id: String(data.region?.regionId || ''),\n zip: data.postcode,\n };\n\n estimateShippingMethods({ criteria: estimateShippingInputCriteria });\n\n prevEstimateShippingData = {\n countryCode: data.countryCode,\n regionCode: data.region?.regionCode || '',\n regionId: data.region?.regionId || '',\n postcode: data.postcode,\n };\n }, debounceMs);\n\n return ({ data, isDataValid }: AddressFormChange) => {\n if (isDataValid) {\n shouldCancelDebounce = true;\n return;\n }\n\n if (\n prevEstimateShippingData.countryCode === data.countryCode &&\n prevEstimateShippingData.regionCode === (data.region?.regionCode || '') &&\n prevEstimateShippingData.regionId === (data.region?.regionId || '') &&\n prevEstimateShippingData.postcode === data.postcode\n )\n return;\n\n debouncedApi(data);\n };\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { scrollToParentContainer } from '@/checkout/lib/utils';\nimport { FormRef } from '@/checkout/types';\nimport { RefObject } from 'preact';\n\ntype HTMLForm = {\n name: string;\n ref?: RefObject<FormRef>;\n};\n\nexport function validateForm(\n form: HTMLForm,\n autoScrollOnError: boolean = false\n): boolean {\n const { name, ref } = form;\n const formElement = document.forms.namedItem(name);\n\n if (!formElement || formElement.offsetParent === null) {\n return true;\n }\n\n formElement.setAttribute('novalidate', '');\n\n const validationResult =\n ref?.current?.handleValidationSubmit(false) ?? formElement.checkValidity();\n\n if (!validationResult && autoScrollOnError) {\n scrollToParentContainer(formElement);\n }\n\n return validationResult;\n}\n\nexport function validateForms(forms: HTMLForm[]): boolean {\n for (const form of forms) {\n if (!validateForm(form, true)) {\n return false;\n }\n }\n return true;\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 createFragment(html: string): DocumentFragment {\n return document.createRange().createContextualFragment(html);\n}\n\nexport function createScopedSelector(\n fragment: DocumentFragment\n): (selector: string) => HTMLElement | null {\n return function (selector: string): HTMLElement | null {\n return fragment.querySelector(selector);\n };\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 createMetaTag(property: string, content: string, type: string) {\n if (!property || !type) {\n return;\n }\n\n const meta = document.head.querySelector<HTMLMetaElement>(\n `meta[${type}=\"${property}\"]`\n );\n\n if (!content) {\n meta?.remove();\n return;\n }\n\n if (meta) {\n meta.setAttribute('content', content);\n } else {\n const newMeta = document.createElement('meta');\n newMeta.setAttribute(type, property);\n newMeta.setAttribute('content', content);\n document.head.appendChild(newMeta);\n }\n}\n\nexport function setMetaTags(dropin: string) {\n createMetaTag('title', dropin, 'name');\n createMetaTag('description', dropin, 'name');\n createMetaTag('keywords', dropin, 'name');\n createMetaTag('og:description', dropin, 'property');\n createMetaTag('og:title', dropin, 'property');\n createMetaTag('og:url', window.location.href, 'property');\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n BillingAddressInput,\n ShippingAddressInput,\n} from '@/checkout/data/models/api';\nimport { CartAddress } from '@/checkout/data/models/cart';\n\nexport const transformAddressFormValuesToAddressInput = (\n data: Record<string, any>\n): ShippingAddressInput | BillingAddressInput => {\n const isNewAddress = !data?.id && !data?.uid;\n\n if (!isNewAddress) {\n return {\n customerAddressId: data.id,\n customerAddressUid: data.uid,\n };\n }\n\n const customAttributes = data.customAttributes?.map(\n ({ code, value }: { code: string; value: unknown }) => ({\n code,\n value: String(value),\n })\n );\n\n return {\n address: {\n city: data.city,\n company: data?.company,\n countryCode: data.countryCode,\n customAttributes,\n fax: data.fax,\n firstName: data.firstName,\n lastName: data.lastName,\n middleName: data.middleName,\n postcode: data.postcode,\n prefix: data.prefix,\n region: data?.region?.regionCode,\n regionId: data?.region?.regionId,\n street: data.street,\n suffix: data.suffix,\n telephone: data.telephone,\n vatId: data.vatId,\n saveInAddressBook: data.saveAddressBook,\n },\n };\n};\n\nexport const transformCartAddressToFormValues = (\n address: CartAddress\n): Record<string, any> => {\n return {\n city: address.city,\n company: address?.company,\n countryCode: address.country?.code,\n customAttributes: address.customAttributes,\n fax: address.fax,\n firstName: address.firstName,\n lastName: address.lastName,\n middleName: address.middleName,\n postcode: address.postCode,\n prefix: address.prefix,\n region: {\n regionCode: address.region?.code,\n regionId: address.region?.id,\n },\n street: address.street,\n suffix: address.suffix,\n telephone: address.telephone,\n vatId: address.vatId,\n };\n};\n"],"names":["ongoingSetAddressCalls","setAddressOnCart","type","debounceMs","placeOrderBtn","api","setShippingAddress","setBillingAddress","debouncedApi","debounce","address","prev","data","isDataValid","transformAddressFormValuesToAddressInput","estimateShippingCost","prevEstimateShippingData","shouldCancelDebounce","estimateShippingInputCriteria","_a","_b","estimateShippingMethods","_c","_d","validateForm","form","autoScrollOnError","name","ref","formElement","validationResult","scrollToParentContainer","validateForms","forms","createFragment","html","createScopedSelector","fragment","selector","createMetaTag","property","content","meta","newMeta","setMetaTags","dropin","customAttributes","code","value","transformCartAddressToFormValues"],"mappings":"6tBAmCA,IAAIA,EAAyB,EAEtB,SAASC,EAAiB,CAC/B,KAAAC,EAAO,WACP,WAAAC,EAAa,EACb,cAAAC,CACF,EAIG,CACK,MAAAC,EAAMH,IAAS,WAAaI,EAAqBC,EAEjDC,EAAeC,EAClBC,GAAwD,CAC7BV,GAAA,EAC1BK,EAAIK,CAAO,EACR,MAAM,QAAQ,KAAK,EACnB,QAAQ,IAAM,CACaV,GAAA,EACtBA,IAA2B,IACdI,GAAA,MAAAA,EAAA,SAAUO,IAAU,CAAE,GAAGA,EAAM,SAAU,MAC1D,CACD,CACL,EACAR,CACF,EAEA,MAAO,CAAC,CAAE,KAAAS,EAAM,YAAAC,KAAqC,CACnD,GAAI,CAACA,EAAa,OACHT,GAAA,MAAAA,EAAA,SAAUO,IAAU,CAAE,GAAGA,EAAM,SAAU,MAClD,MAAAD,EAAUI,EAAyCF,CAAI,EAC7DJ,EAAaE,CAAO,CACtB,CACF,CAEO,SAASK,EAAqB,CAAE,WAAAZ,EAAa,GAAK,CACvD,IAAIa,EAKA,CAAC,EAEDC,EAAuB,GAErB,MAAAT,EAAeC,EAAUG,GAA8B,aAC3D,GAAIK,EAAsB,OAE1B,MAAMC,EAAgC,CACpC,aAAcN,EAAK,YACnB,YAAa,SAAOO,EAAAP,EAAK,SAAL,YAAAO,EAAa,aAAc,EAAE,EACj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SACf,OAAQA,EAAK,OACb,QAAQQ,EAAAR,GAAA,YAAAA,EAAM,SAAN,YAAAQ,EAAc,WACtB,UAAUE,EAAAV,GAAA,YAAAA,EAAM,SAAN,YAAAU,EAAc,SACxB,OAAQV,EAAK,OACb,OAAQA,EAAK,OACb,UAAWA,EAAK,UAChB,MAAOA,EAAK,MACZ,kBAAmBA,EAAK,eAAA,CAE5B,CACF,EAEaqC,EACXvC,GACwB,WACjB,MAAA,CACL,KAAMA,EAAQ,KACd,QAASA,GAAA,YAAAA,EAAS,QAClB,aAAaS,EAAAT,EAAQ,UAAR,YAAAS,EAAiB,KAC9B,iBAAkBT,EAAQ,iBAC1B,IAAKA,EAAQ,IACb,UAAWA,EAAQ,UACnB,SAAUA,EAAQ,SAClB,WAAYA,EAAQ,WACpB,SAAUA,EAAQ,SAClB,OAAQA,EAAQ,OAChB,OAAQ,CACN,YAAYU,EAAAV,EAAQ,SAAR,YAAAU,EAAgB,KAC5B,UAAUE,EAAAZ,EAAQ,SAAR,YAAAY,EAAgB,EAC5B,EACA,OAAQZ,EAAQ,OAChB,OAAQA,EAAQ,OAChB,UAAWA,EAAQ,UACnB,MAAOA,EAAQ,KACjB,CACF"}
1
+ {"version":3,"file":"utils.js","sources":["/@dropins/storefront-checkout/src/lib/utils/api.ts","/@dropins/storefront-checkout/src/lib/utils/forms.ts","/@dropins/storefront-checkout/src/lib/utils/fragments.ts","/@dropins/storefront-checkout/src/lib/utils/meta.ts","/@dropins/storefront-checkout/src/lib/utils/transformers.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n estimateShippingMethods,\n setBillingAddress,\n setShippingAddress,\n} from '@/checkout/api';\nimport {\n BillingAddressInput,\n ShippingAddressInput,\n} from '@/checkout/data/models/api';\nimport { transformAddressFormValuesToAddressInput } from '@/checkout/lib/utils';\nimport { debounce } from '@adobe-commerce/elsie/lib';\nimport { isSetAddressRequestPending } from '@/checkout/store/ui';\n\ntype AddressFormChange = {\n data: Record<string, any>;\n isDataValid: boolean;\n};\n\nlet ongoingSetAddressCalls = 0;\n\nexport function setAddressOnCart({\n type = 'shipping',\n debounceMs = 0,\n}: {\n type?: 'shipping' | 'billing';\n debounceMs?: number;\n}) {\n const api = type === 'shipping' ? setShippingAddress : setBillingAddress;\n\n const debouncedApi = debounce(\n (address: ShippingAddressInput | BillingAddressInput) => {\n ongoingSetAddressCalls += 1;\n api(address)\n .catch(console.error)\n .finally(() => {\n ongoingSetAddressCalls -= 1;\n if (ongoingSetAddressCalls === 0) {\n isSetAddressRequestPending.value = false;\n }\n });\n },\n debounceMs\n );\n\n return ({ data, isDataValid }: AddressFormChange) => {\n if (!isDataValid) return;\n isSetAddressRequestPending.value = true;\n const address = transformAddressFormValuesToAddressInput(data);\n debouncedApi(address);\n };\n}\n\nexport function estimateShippingCost({ debounceMs = 0 }) {\n let prevEstimateShippingData: {\n countryCode?: string;\n regionCode?: string;\n regionId?: string;\n postcode?: string;\n } = {};\n\n let shouldCancelDebounce = false;\n\n const debouncedApi = debounce((data: Record<string, any>) => {\n if (shouldCancelDebounce) return;\n\n const estimateShippingInputCriteria = {\n country_code: data.countryCode,\n region_name: String(data.region?.regionCode || ''),\n region_id: String(data.region?.regionId || ''),\n zip: data.postcode,\n };\n\n estimateShippingMethods({ criteria: estimateShippingInputCriteria });\n\n prevEstimateShippingData = {\n countryCode: data.countryCode,\n regionCode: data.region?.regionCode || '',\n regionId: data.region?.regionId || '',\n postcode: data.postcode,\n };\n }, debounceMs);\n\n return ({ data, isDataValid }: AddressFormChange) => {\n if (isDataValid) {\n shouldCancelDebounce = true;\n return;\n }\n\n if (\n prevEstimateShippingData.countryCode === data.countryCode &&\n prevEstimateShippingData.regionCode === (data.region?.regionCode || '') &&\n prevEstimateShippingData.regionId === (data.region?.regionId || '') &&\n prevEstimateShippingData.postcode === data.postcode\n )\n return;\n\n debouncedApi(data);\n };\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { scrollToParentContainer } from '@/checkout/lib/utils';\nimport { FormRef } from '@/checkout/types';\nimport { RefObject } from 'preact';\n\ntype HTMLForm = {\n name: string;\n ref?: RefObject<FormRef>;\n};\n\nexport function validateForm(\n form: HTMLForm,\n autoScrollOnError: boolean = false\n): boolean {\n const { name, ref } = form;\n const formElement = document.forms.namedItem(name);\n\n if (!formElement || formElement.offsetParent === null) {\n return true;\n }\n\n formElement.setAttribute('novalidate', '');\n\n const validationResult =\n ref?.current?.handleValidationSubmit(false) ?? formElement.checkValidity();\n\n if (!validationResult && autoScrollOnError) {\n scrollToParentContainer(formElement);\n }\n\n return validationResult;\n}\n\nexport function validateForms(forms: HTMLForm[]): boolean {\n for (const form of forms) {\n if (!validateForm(form, true)) {\n return false;\n }\n }\n return true;\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 createFragment(html: string): DocumentFragment {\n return document.createRange().createContextualFragment(html);\n}\n\nexport function createScopedSelector(\n fragment: DocumentFragment\n): (selector: string) => HTMLElement | null {\n return function (selector: string): HTMLElement | null {\n return fragment.querySelector(selector);\n };\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 createMetaTag(property: string, content: string, type: string) {\n if (!property || !type) {\n return;\n }\n\n const meta = document.head.querySelector<HTMLMetaElement>(\n `meta[${type}=\"${property}\"]`\n );\n\n if (!content) {\n meta?.remove();\n return;\n }\n\n if (meta) {\n meta.setAttribute('content', content);\n } else {\n const newMeta = document.createElement('meta');\n newMeta.setAttribute(type, property);\n newMeta.setAttribute('content', content);\n document.head.appendChild(newMeta);\n }\n}\n\nexport function setMetaTags(dropin: string) {\n createMetaTag('title', dropin, 'name');\n createMetaTag('description', dropin, 'name');\n createMetaTag('keywords', dropin, 'name');\n createMetaTag('og:description', dropin, 'property');\n createMetaTag('og:title', dropin, 'property');\n createMetaTag('og:url', window.location.href, 'property');\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n BillingAddressInput,\n ShippingAddressInput,\n} from '@/checkout/data/models/api';\nimport { CartAddress } from '@/checkout/data/models/cart';\n\nexport const transformAddressFormValuesToAddressInput = (\n data: Record<string, any>\n): ShippingAddressInput | BillingAddressInput => {\n const isNewAddress = !data?.id && !data?.uid;\n\n if (!isNewAddress) {\n return {\n customerAddressId: data.id,\n customerAddressUid: data.uid,\n };\n }\n\n const customAttributes = data.customAttributes?.map(\n ({ code, value }: { code: string; value: unknown }) => ({\n code,\n value: String(value),\n })\n );\n\n return {\n address: {\n city: data.city,\n company: data?.company,\n countryCode: data.countryCode,\n customAttributes,\n fax: data.fax,\n firstName: data.firstName,\n lastName: data.lastName,\n middleName: data.middleName,\n postcode: data.postcode,\n prefix: data.prefix,\n region: data?.region?.regionCode,\n regionId: data?.region?.regionId,\n street: data.street,\n suffix: data.suffix,\n telephone: data.telephone,\n vatId: data.vatId,\n saveInAddressBook: data.saveAddressBook,\n },\n };\n};\n\nexport const transformCartAddressToFormValues = (\n address: CartAddress\n): Record<string, any> => {\n return {\n city: address.city,\n company: address?.company,\n countryCode: address.country?.code,\n customAttributes: address.customAttributes,\n fax: address.fax,\n firstName: address.firstName,\n lastName: address.lastName,\n middleName: address.middleName,\n postcode: address.postCode,\n prefix: address.prefix,\n region: {\n regionCode: address.region?.code,\n regionId: address.region?.id,\n },\n street: address.street,\n suffix: address.suffix,\n telephone: address.telephone,\n vatId: address.vatId,\n };\n};\n"],"names":["ongoingSetAddressCalls","setAddressOnCart","type","debounceMs","api","setShippingAddress","setBillingAddress","debouncedApi","debounce","address","isSetAddressRequestPending","data","isDataValid","transformAddressFormValuesToAddressInput","estimateShippingCost","prevEstimateShippingData","shouldCancelDebounce","estimateShippingInputCriteria","_a","_b","estimateShippingMethods","_c","_d","validateForm","form","autoScrollOnError","name","ref","formElement","validationResult","scrollToParentContainer","validateForms","forms","createFragment","html","createScopedSelector","fragment","selector","createMetaTag","property","content","meta","newMeta","setMetaTags","dropin","customAttributes","code","value","transformCartAddressToFormValues"],"mappings":"yuB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SAAUA,EAAQ,SAClB,OAAQA,EAAQ,OAChB,OAAQ,CACN,YAAYU,EAAAV,EAAQ,SAAR,YAAAU,EAAgB,KAC5B,UAAUE,EAAAZ,EAAQ,SAAR,YAAAY,EAAgB,EAC5B,EACA,OAAQZ,EAAQ,OAChB,OAAQA,EAAQ,OAChB,UAAWA,EAAQ,UACnB,MAAOA,EAAQ,KACjB,CACF"}
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-checkout", "version": "3.0.0-beta2", "@dropins/tools": "^1.6.0-beta3", "license": "SEE LICENSE IN LICENSE.md"}
1
+ {"name": "@dropins/storefront-checkout", "version": "3.0.0-beta4", "@dropins/tools": "^1.6.0-beta3", "license": "SEE LICENSE IN LICENSE.md"}
package/render.js CHANGED
@@ -6,5 +6,5 @@ All Rights Reserved. */
6
6
  .checkout-payment-on-account{margin-bottom:var(--spacing-medium)}.checkout-payment-on-account__form{width:100%}.checkout-payment-on-account__credit{display:flex;justify-content:space-between;align-items:center;padding:var(--spacing-small);margin-bottom:var(--spacing-medium);background-color:var(--color-neutral-100);border:1px solid var(--color-neutral-300);border-radius:4px;font-size:14px;line-height:1.4}.checkout-payment-on-account__credit-label{font-weight:500;color:var(--color-neutral-700)}.checkout-payment-on-account__credit-amount{font-weight:600;color:var(--color-success-600)}.checkout-payment-on-account__exceed-message{margin-top:var(--spacing-medium);margin-bottom:var(--spacing-medium)}.checkout-payment-on-account .dropin-field{margin-bottom:0}
7
7
  .checkout-bill-to-shipping-address label{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);gap:0}.checkout-bill-to-shipping-address__error{margin-top:var(--spacing-medium)}
8
8
  .checkout-address-validation{display:grid;gap:var(--spacing-medium)}.checkout-address-validation__options--busy{opacity:.4;pointer-events:none}.checkout-address-validation__title{margin-bottom:var(--spacing-small)}.checkout-address-validation__subtitle{color:var(--color-neutral-700);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.checkout-address-validation__options{display:grid;gap:var(--spacing-xbig);grid-template-columns:1fr 1fr}.checkout-address-validation__option{margin:0}.checkout-address-validation__option-title{margin-bottom:var(--spacing-xsmall)}.checkout-estimate-shipping{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-xxsmall);align-items:center;color:var(--color-neutral-800)}.checkout-estimate-shipping__label,.checkout-estimate-shipping__price{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.checkout-estimate-shipping__label--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.checkout-estimate-shipping__price--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.checkout-estimate-shipping__price{text-align:right}.checkout-estimate-shipping__label--bold,.checkout-estimate-shipping__price--bold{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.checkout-estimate-shipping__caption{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-neutral-700)}.cart-order-summary__shipping .dropin-skeleton{grid-template-columns:1fr}.checkout-login-form__heading{display:grid;grid-template-columns:1fr max-content;grid-auto-rows:max-content;margin:0 0 var(--spacing-medium) 0;align-items:center}.checkout-login-form__heading:empty{display:none}.checkout-login-form__content{grid-auto-rows:max-content}.checkout-login-form__content .dropin-field__hint a{font-weight:400}.checkout-login-form__customer-details{display:grid;grid-auto-flow:row;gap:var(--spacing-xxsmall)}.checkout-login-form__customer-name{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.checkout-login-form__customer-email{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.checkout-login-form__title,.checkout-login-form__title h2{grid-column-start:1;color:var(--color-neutral-800);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing);margin:0}.checkout-login-form__heading-label,.checkout-login-form__sign-in,.checkout-login-form__sign-out{grid-column-start:2;color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);justify-self:flex-end}.checkout-login-form__heading-label a,a.checkout-login-form__link{font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing);margin-left:var(--spacing-xxsmall)}@media only screen and (min-width: 320px) and (max-width: 768px){.checkout-login-form__heading{grid-template-columns:1fr;grid-template-rows:1fr}.checkout-login-form__heading-label{grid-column-start:1;align-self:flex-start;justify-self:flex-start;margin-top:var(--spacing-medium)}}.checkout-out-of-stock.dropin-card{border-color:var(--color-warning-500)}.checkout-out-of-stock .dropin-card__content{gap:var(--spacing-small);padding:var(--spacing-small)}.checkout-out-of-stock__title{color:var(--color-neutral-900);font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing);margin:0;display:flex;gap:var(--spacing-xxsmall);align-items:center;justify-content:left;text-align:center}.checkout-out-of-stock__message{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin:0}.checkout-out-of-stock__items{display:grid;grid-template-columns:repeat(5,100px);grid-gap:var(--spacing-small);list-style:none;padding:0;margin:0}.checkout-out-of-stock__item img{width:100%;height:auto}.checkout-out-of-stock__actions{display:flex;gap:var(--spacing-small);justify-content:flex-end}a.checkout-out-of-stock__action{color:var(--color-brand-500);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing)}.checkout-out-of-stock__action{color:var(--color-brand-500);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);background:none;border:none;padding:0;cursor:pointer}.checkout-out-of-stock__action:hover{--textColor: var(--color-brand-700);text-decoration:solid underline var(--textColor);text-underline-offset:6px}@media only screen and (width >= 320px) and (width <= 768px){.checkout-out-of-stock__items{grid-template-columns:repeat(3,100px)}}.checkout-payment-methods__title,.checkout-payment-methods__title h2{color:var(--color-neutral-800);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing);margin:0 0 var(--spacing-medium) 0}.checkout-payment-methods__wrapper{position:relative;display:grid}.checkout-payment-methods__wrapper--busy{opacity:.4;pointer-events:none}.checkout-payment-methods__methods{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-medium)}.checkout-payment-methods__content{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:var(--spacing-xbig)}.checkout-payment-methods__content>div[data-slot=PaymentMethodSlot]:not(:empty){margin-top:var(--spacing-medium)}.checkout-payment-methods--full-width{grid-template-columns:1fr}.checkout-payment-methods__spinner{margin:0 auto;position:absolute;z-index:999;left:0;right:0;top:calc(50% - (var(--size) / 2));bottom:0}.checkout__content [data-slot=PaymentMethods]:empty{display:none}.checkout-payment-methods__error{margin-top:var(--spacing-medium)}@media only screen and (min-width: 320px) and (max-width: 768px){.checkout-payment-methods__methods{grid-template-columns:1fr}}.checkout-purchase-order{margin-bottom:var(--spacing-medium)}.checkout-purchase-order__form{width:100%}.checkout-purchase-order .dropin-field{margin-bottom:0}.checkout-server-error{position:relative;text-align:center}.checkout-server-error__icon .error-icon{color:var(--color-alert-500)}.checkout-server-error a{font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing)}.checkout-terms-and-conditions{display:grid}.checkout-terms-and-conditions__error{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-alert-800);text-align:left;margin-top:var(--spacing-xsmall)}.checkout-terms-and-conditions__error:empty{display:none}`,{styleId:"checkout"});
9
- import{P as x,r as b}from"./chunks/render.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"./chunks/fetch-graphql.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/synchronizeCheckout.js";import"./fragments.js";import"./chunks/transform-shipping-methods.js";import"./chunks/classifiers.js";import"@dropins/tools/components.js";import"@dropins/tools/preact-hooks.js";export{x as Provider,b as render};
9
+ import{P as x,r as b}from"./chunks/render.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"./chunks/fetch-graphql.js";import"@dropins/tools/signals.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/synchronizeCheckout.js";import"./fragments.js";import"./chunks/transform-shipping-methods.js";import"./chunks/classifiers.js";import"@dropins/tools/components.js";import"@dropins/tools/preact-hooks.js";export{x as Provider,b as render};
10
10
  //# sourceMappingURL=render.js.map
package/store/ui.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ /********************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * __________________
4
+ *
5
+ * Copyright 2025 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+ *******************************************************************/
17
+ export declare const isSetAddressRequestPending: import('@preact/signals-core').Signal<boolean>;
18
+ //# sourceMappingURL=ui.d.ts.map