@dropins/storefront-auth 3.0.0-beta1 → 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.
Files changed (36) hide show
  1. package/LICENSE.md +25 -25
  2. package/api/getAdobeCommerceOptimizerData/getAdobeCommerceOptimizerData.d.ts +8 -0
  3. package/api/getAdobeCommerceOptimizerData/graphql/getAdobeCommerceOptimizerData.graphql.d.ts +10 -0
  4. package/api/getAdobeCommerceOptimizerData/index.d.ts +10 -0
  5. package/api/index.d.ts +1 -0
  6. package/api/initialize/initialize.d.ts +1 -0
  7. package/api.js +1 -1
  8. package/chunks/createCustomerAddress.js +1 -1
  9. package/chunks/createCustomerAddress.js.map +1 -1
  10. package/chunks/getAdobeCommerceOptimizerData.js +66 -0
  11. package/chunks/getAdobeCommerceOptimizerData.js.map +1 -0
  12. package/chunks/getCustomerToken.js +2 -2
  13. package/chunks/getCustomerToken.js.map +1 -1
  14. package/chunks/index2.js +1 -1
  15. package/chunks/index3.js +1 -1
  16. package/chunks/revokeCustomerToken.js +1 -1
  17. package/chunks/revokeCustomerToken.js.map +1 -1
  18. package/chunks/usePasswordValidationMessage.js +1 -1
  19. package/chunks/usePasswordValidationMessage.js.map +1 -1
  20. package/containers/SignIn.js +1 -1
  21. package/containers/SignIn.js.map +1 -1
  22. package/containers/SignUp.js +1 -1
  23. package/containers/SignUp.js.map +1 -1
  24. package/containers/SuccessNotification.js +1 -1
  25. package/containers/SuccessNotification.js.map +1 -1
  26. package/containers/UpdatePassword.js +1 -1
  27. package/containers/UpdatePassword.js.map +1 -1
  28. package/data/models/adobe-commerce-optimizer.d.ts +12 -0
  29. package/data/models/index.d.ts +1 -0
  30. package/data/transforms/index.d.ts +1 -0
  31. package/data/transforms/transform-adobe-commerce-optimizer.d.ts +12 -0
  32. package/package.json +1 -1
  33. package/render.js +1 -1
  34. package/render.js.map +1 -1
  35. package/chunks/getCustomerRolePermissions.js +0 -60
  36. package/chunks/getCustomerRolePermissions.js.map +0 -1
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
@@ -0,0 +1,8 @@
1
+ import { AdobeCommerceOptimizerModel } from '../../data/models';
2
+
3
+ /**
4
+ * Fetches Adobe Commerce Optimizer data from GraphQL API
5
+ * This function works for both authenticated and non-authenticated users
6
+ */
7
+ export declare const getAdobeCommerceOptimizerData: () => Promise<AdobeCommerceOptimizerModel>;
8
+ //# sourceMappingURL=getAdobeCommerceOptimizerData.d.ts.map
@@ -0,0 +1,10 @@
1
+ /********************************************************************
2
+ * Copyright 2025 Adobe
3
+ * All Rights Reserved.
4
+ *
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
+ *******************************************************************/
9
+ export declare const GET_ADOBE_COMMERCE_OPTIMIZER_DATA = "\n query GET_ADOBE_COMMERCE_OPTIMIZER_DATA {\n commerceOptimizer {\n priceBookId\n }\n }\n";
10
+ //# sourceMappingURL=getAdobeCommerceOptimizerData.graphql.d.ts.map
@@ -0,0 +1,10 @@
1
+ /********************************************************************
2
+ * Copyright 2025 Adobe
3
+ * All Rights Reserved.
4
+ *
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
+ *******************************************************************/
9
+ export * from './getAdobeCommerceOptimizerData';
10
+ //# sourceMappingURL=index.d.ts.map
package/api/index.d.ts CHANGED
@@ -29,4 +29,5 @@ export * from './resendConfirmationEmail';
29
29
  export * from './createCustomerAddress';
30
30
  export * from './verifyToken';
31
31
  export * from './getCustomerRolePermissions';
32
+ export * from './getAdobeCommerceOptimizerData';
32
33
  //# sourceMappingURL=index.d.ts.map
@@ -9,6 +9,7 @@ type ConfigProps = {
9
9
  tokenPrefix: string;
10
10
  };
11
11
  customerPermissionRoles?: boolean;
12
+ adobeCommerceOptimizer?: boolean;
12
13
  models?: {
13
14
  CustomerModel?: Model<CustomerModel>;
14
15
  };
package/api.js CHANGED
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{c as n,a as g,g as c}from"./chunks/createCustomerAddress.js";import{g as d,a as h}from"./chunks/getCustomerToken.js";import{_ as x,c as u,a as k,g as v,i as E,v as F}from"./chunks/getCustomerRolePermissions.js";import{r as Q}from"./chunks/requestPasswordResetEmail.js";import{r as P}from"./chunks/resetPassword.js";import{r as b}from"./chunks/revokeCustomerToken.js";import{c as A}from"./chunks/confirmEmail.js";import{r as _}from"./chunks/resendConfirmationEmail.js";import{f as y,g as z,r as D,s as S,a as j,b as B}from"./chunks/network-error.js";import"./fragments.js";import"./chunks/setReCaptchaToken.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import"./chunks/transform-attributes-form.js";import"./chunks/acdl.js";import"@dropins/tools/fetch-graphql.js";export{x as _resetCache,u as config,A as confirmEmail,n as createCustomer,g as createCustomerAddress,y as fetchGraphQl,c as getAttributesForm,z as getConfig,d as getCustomerData,k as getCustomerRolePermissions,h as getCustomerToken,v as getStoreConfig,E as initialize,D as removeFetchGraphQlHeader,Q as requestPasswordResetEmail,_ as resendConfirmationEmail,P as resetPassword,b as revokeCustomerToken,S as setEndpoint,j as setFetchGraphQlHeader,B as setFetchGraphQlHeaders,F as verifyToken};
3
+ import{c as g,a as n,g as c}from"./chunks/createCustomerAddress.js";import{g as d,a as h}from"./chunks/getCustomerToken.js";import{_ as x,c as u,b,a as k,g as v,i as E,v as F}from"./chunks/getAdobeCommerceOptimizerData.js";import{r as Q}from"./chunks/requestPasswordResetEmail.js";import{r as H}from"./chunks/resetPassword.js";import{r as T}from"./chunks/revokeCustomerToken.js";import{c as z}from"./chunks/confirmEmail.js";import{r as R}from"./chunks/resendConfirmationEmail.js";import{f as q,g as y,r as O,s as S,a as j,b as B}from"./chunks/network-error.js";import"./fragments.js";import"./chunks/setReCaptchaToken.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import"./chunks/transform-attributes-form.js";import"./chunks/acdl.js";import"@dropins/tools/fetch-graphql.js";export{x as _resetCache,u as config,z as confirmEmail,g as createCustomer,n as createCustomerAddress,q as fetchGraphQl,b as getAdobeCommerceOptimizerData,c as getAttributesForm,y as getConfig,d as getCustomerData,k as getCustomerRolePermissions,h as getCustomerToken,v as getStoreConfig,E as initialize,O as removeFetchGraphQlHeader,Q as requestPasswordResetEmail,R as resendConfirmationEmail,H as resetPassword,T as revokeCustomerToken,S as setEndpoint,j as setFetchGraphQlHeader,B as setFetchGraphQlHeaders,F as verifyToken};
4
4
  //# sourceMappingURL=api.js.map
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{CUSTOMER_INFORMATION_FRAGMENT as O}from"../fragments.js";import{f as s,h as u}from"./network-error.js";import{s as b}from"./setReCaptchaToken.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{merge as N}from"@dropins/tools/lib.js";import{c as p,h as S}from"./getCustomerRolePermissions.js";import{t as F}from"./transform-attributes-form.js";const I=`
3
+ import{CUSTOMER_INFORMATION_FRAGMENT as O}from"../fragments.js";import{f as s,h as u}from"./network-error.js";import{s as b}from"./setReCaptchaToken.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{merge as N}from"@dropins/tools/lib.js";import{c as p,h as S}from"./getAdobeCommerceOptimizerData.js";import{t as F}from"./transform-attributes-form.js";const I=`
4
4
  mutation CREATE_CUSTOMER($input: CustomerInput!) {
5
5
  createCustomer(input: $input) {
6
6
  customer {
@@ -1 +1 @@
1
- {"version":3,"file":"createCustomerAddress.js","sources":["/@dropins/storefront-auth/src/api/createCustomer/graphql/createCustomer.graphql.ts","/@dropins/storefront-auth/src/api/createCustomer/graphql/createCustomerV2.graphql.ts","/@dropins/storefront-auth/src/data/transforms/transform-create-customer.tsx","/@dropins/storefront-auth/src/lib/transformDobForm.ts","/@dropins/storefront-auth/src/api/createCustomer/createCustomer.ts","/@dropins/storefront-auth/src/api/getAttributesForm/graphql/getAttributesForm.graphql.ts","/@dropins/storefront-auth/src/api/getAttributesForm/getAttributesForm.ts","/@dropins/storefront-auth/src/api/createCustomerAddress/graphql/createCustomerAddress.graphql.ts","/@dropins/storefront-auth/src/api/createCustomerAddress/createCustomerAddress.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 { CUSTOMER_INFORMATION_FRAGMENT } from '@/auth/api/fragments';\n\nexport const CREATE_CUSTOMER = /* GraphQL */ `\n mutation CREATE_CUSTOMER($input: CustomerInput!) {\n createCustomer(input: $input) {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n }\n ${CUSTOMER_INFORMATION_FRAGMENT}\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 { CUSTOMER_INFORMATION_FRAGMENT } from '@/auth/api/fragments';\n\nexport const CREATE_CUSTOMER_V2 = /* GraphQL */ `\n mutation CREATE_CUSTOMER_V2($input: CustomerCreateInput!) {\n createCustomerV2(input: $input) {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n }\n ${CUSTOMER_INFORMATION_FRAGMENT}\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 { DataCreateCustomerV2, DataCreateCustomer } from '@/auth/types';\nimport { config } from '@/auth/api';\nimport { merge } from '@adobe-commerce/elsie/lib';\nimport { CustomerModel } from '../models';\n\ntype ApiResponse<T extends boolean> = T extends true\n ? DataCreateCustomerV2\n : DataCreateCustomer;\n\nexport const transformCreateCustomer = <T extends boolean>(\n response: ApiResponse<T>,\n apiVersion2: T\n): CustomerModel => {\n let model: CustomerModel;\n\n if (apiVersion2) {\n const { data } = response as DataCreateCustomerV2;\n\n model = {\n firstName: data?.createCustomerV2?.customer?.firstname ?? '',\n lastName: data?.createCustomerV2?.customer?.lastname ?? '',\n email: data?.createCustomerV2?.customer?.email ?? '',\n customAttributes: data?.createCustomerV2?.custom_attributes ?? [],\n errors: response?.errors ?? [],\n };\n } else {\n const { data } = response as DataCreateCustomer;\n\n model = {\n firstName: data?.createCustomer?.customer?.firstname ?? '',\n lastName: data?.createCustomer?.customer?.lastname ?? '',\n email: data?.createCustomer?.customer?.email ?? '',\n errors: response?.errors ?? [],\n };\n }\n\n return merge(\n model, // default transformer\n config.getConfig().models?.CustomerModel?.transformer?.(response) // custom transformer\n );\n};\n","export const transformDobForm = (\n form: Record<string, any>\n): Record<string, any> => {\n if (!form.dob) return form;\n\n const { dob, ...rest } = form;\n return { ...rest, date_of_birth: dob };\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 { Customer } from '@/auth/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { CREATE_CUSTOMER } from './graphql/createCustomer.graphql';\nimport { CREATE_CUSTOMER_V2 } from './graphql/createCustomerV2.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { setReCaptchaToken } from '@/auth/lib/setReCaptchaToken';\nimport { transformCreateCustomer } from '@/auth/data/transforms';\nimport { CustomerModel } from '@/auth/data/models';\nimport { transformDobForm } from '@/auth/lib/transformDobForm';\n\nexport const createCustomer = async (\n forms: Customer,\n apiVersion2: boolean\n): Promise<CustomerModel> => {\n await setReCaptchaToken();\n\n const response = await fetchGraphQl(\n apiVersion2 ? CREATE_CUSTOMER_V2 : CREATE_CUSTOMER,\n {\n method: 'POST',\n variables: {\n input: {\n ...transformDobForm(forms),\n },\n },\n }\n ).catch(handleNetworkError);\n\n return transformCreateCustomer(response, apiVersion2);\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 const GET_ATTRIBUTES_FORM = /* GraphQL */ `\n query GET_ATTRIBUTES_FORM($formCode: String!) {\n attributesForm(formCode: $formCode) {\n items {\n code\n default_value\n entity_type\n frontend_class\n frontend_input\n is_required\n is_unique\n label\n options {\n is_default\n label\n value\n }\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n validate_rules {\n name\n value\n }\n }\n }\n errors {\n type\n message\n }\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 '../fetch-graphql';\nimport { GET_ATTRIBUTES_FORM } from './graphql/getAttributesForm.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { transformAttributesForm } from '@/auth/data/transforms';\nimport { handleFetchError } from '@/auth/lib/fetch-error';\nimport { AttributesFormModel } from '@/auth/data/models';\nimport { GetAttributesFormResponse } from '@/auth/types';\n\nexport const getAttributesForm = async (\n formCode: string\n): Promise<AttributesFormModel[]> => {\n return await fetchGraphQl(GET_ATTRIBUTES_FORM, {\n method: 'GET',\n cache: 'force-cache',\n variables: { formCode },\n })\n .then((response: GetAttributesFormResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return transformAttributesForm(response);\n })\n .catch(handleNetworkError);\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 const CREATE_CUSTOMER_ADDRESS = /* GraphQL */ `\n mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {\n createCustomerAddress(input: $input) {\n firstname\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 { AddressFormProps, CreateCustomerAddressResponse } from '@/auth/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { CREATE_CUSTOMER_ADDRESS } from './graphql/createCustomerAddress.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { handleFetchError } from '@/auth/lib/fetch-error';\n\nexport const createCustomerAddress = async (\n address: AddressFormProps\n): Promise<string> => {\n return await fetchGraphQl(CREATE_CUSTOMER_ADDRESS, {\n method: 'POST',\n variables: {\n input: address,\n },\n })\n .then((response: CreateCustomerAddressResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response.data.createCustomerAddress.firstname || '';\n })\n .catch(handleNetworkError);\n};\n"],"names":["CREATE_CUSTOMER","CUSTOMER_INFORMATION_FRAGMENT","CREATE_CUSTOMER_V2","transformCreateCustomer","response","apiVersion2","model","data","_b","_a","_d","_c","_f","_e","_g","_i","_h","_k","_j","_m","_l","merge","_p","_o","_n","config","transformDobForm","form","dob","rest","createCustomer","forms","setReCaptchaToken","fetchGraphQl","handleNetworkError","GET_ATTRIBUTES_FORM","getAttributesForm","formCode","handleFetchError","transformAttributesForm","CREATE_CUSTOMER_ADDRESS","createCustomerAddress","address"],"mappings":"6XAmBO,MAAMA,EAAgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQzCC,CAA6B;AAAA,ECRpBC,EAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQ5CD,CAA6B;AAAA,ECDpBE,EAA0B,CACrCC,EACAC,IACkB,qCAClB,IAAIC,EAEJ,GAAID,EAAa,CACf,KAAM,CAA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,EAAA,EAEN,MAAM5B,EAAW,MAAM6B,EACrB5B,EAAcH,EAAqBF,EACnC,CACE,OAAQ,OACR,UAAW,CACT,MAAO,CACL,GAAG0B,EAAiBK,CAAK,CAAA,CAC3B,CACF,CACF,EACA,MAAMG,CAAkB,EAE1B,OAAO/B,EAAwBC,EAAUC,CAAW,CACtD,EC7Ba8B,EAAoC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECQpCC,EAAoB,MAC/BC,GAEO,MAAMJ,EAAaE,EAAqB,CAC7C,OAAQ,MACR,MAAO,cACP,UAAW,CAAE,SAAAE,CAAA,CAAS,CACvB,EACE,KAAMjC,GAAwC,OAC7C,OAAIK,EAAAL,EAAS,SAAT,MAAAK,EAAiB,OAAe6B,EAAiBlC,EAAS,MAAM,EAE7DmC,EAAwBnC,CAAQ,CACzC,CAAC,EACA,MAAM8B,CAAkB,ECrBhBM,EAAwC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECMxCC,EAAwB,MACnCC,GAEO,MAAMT,EAAaO,EAAyB,CACjD,OAAQ,OACR,UAAW,CACT,MAAOE,CAAA,CACT,CACD,EACE,KAAMtC,GAA4C,OACjD,OAAIK,EAAAL,EAAS,SAAT,MAAAK,EAAiB,OAAe6B,EAAiBlC,EAAS,MAAM,EAE7DA,EAAS,KAAK,sBAAsB,WAAa,EAC1D,CAAC,EACA,MAAM8B,CAAkB"}
1
+ {"version":3,"file":"createCustomerAddress.js","sources":["/@dropins/storefront-auth/src/api/createCustomer/graphql/createCustomer.graphql.ts","/@dropins/storefront-auth/src/api/createCustomer/graphql/createCustomerV2.graphql.ts","/@dropins/storefront-auth/src/data/transforms/transform-create-customer.tsx","/@dropins/storefront-auth/src/lib/transformDobForm.ts","/@dropins/storefront-auth/src/api/createCustomer/createCustomer.ts","/@dropins/storefront-auth/src/api/getAttributesForm/graphql/getAttributesForm.graphql.ts","/@dropins/storefront-auth/src/api/getAttributesForm/getAttributesForm.ts","/@dropins/storefront-auth/src/api/createCustomerAddress/graphql/createCustomerAddress.graphql.ts","/@dropins/storefront-auth/src/api/createCustomerAddress/createCustomerAddress.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 { CUSTOMER_INFORMATION_FRAGMENT } from '@/auth/api/fragments';\n\nexport const CREATE_CUSTOMER = /* GraphQL */ `\n mutation CREATE_CUSTOMER($input: CustomerInput!) {\n createCustomer(input: $input) {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n }\n ${CUSTOMER_INFORMATION_FRAGMENT}\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 { CUSTOMER_INFORMATION_FRAGMENT } from '@/auth/api/fragments';\n\nexport const CREATE_CUSTOMER_V2 = /* GraphQL */ `\n mutation CREATE_CUSTOMER_V2($input: CustomerCreateInput!) {\n createCustomerV2(input: $input) {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n }\n ${CUSTOMER_INFORMATION_FRAGMENT}\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 { DataCreateCustomerV2, DataCreateCustomer } from '@/auth/types';\nimport { config } from '@/auth/api';\nimport { merge } from '@adobe-commerce/elsie/lib';\nimport { CustomerModel } from '../models';\n\ntype ApiResponse<T extends boolean> = T extends true\n ? DataCreateCustomerV2\n : DataCreateCustomer;\n\nexport const transformCreateCustomer = <T extends boolean>(\n response: ApiResponse<T>,\n apiVersion2: T\n): CustomerModel => {\n let model: CustomerModel;\n\n if (apiVersion2) {\n const { data } = response as DataCreateCustomerV2;\n\n model = {\n firstName: data?.createCustomerV2?.customer?.firstname ?? '',\n lastName: data?.createCustomerV2?.customer?.lastname ?? '',\n email: data?.createCustomerV2?.customer?.email ?? '',\n customAttributes: data?.createCustomerV2?.custom_attributes ?? [],\n errors: response?.errors ?? [],\n };\n } else {\n const { data } = response as DataCreateCustomer;\n\n model = {\n firstName: data?.createCustomer?.customer?.firstname ?? '',\n lastName: data?.createCustomer?.customer?.lastname ?? '',\n email: data?.createCustomer?.customer?.email ?? '',\n errors: response?.errors ?? [],\n };\n }\n\n return merge(\n model, // default transformer\n config.getConfig().models?.CustomerModel?.transformer?.(response) // custom transformer\n );\n};\n","export const transformDobForm = (\n form: Record<string, any>\n): Record<string, any> => {\n if (!form.dob) return form;\n\n const { dob, ...rest } = form;\n return { ...rest, date_of_birth: dob };\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 { Customer } from '@/auth/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { CREATE_CUSTOMER } from './graphql/createCustomer.graphql';\nimport { CREATE_CUSTOMER_V2 } from './graphql/createCustomerV2.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { setReCaptchaToken } from '@/auth/lib/setReCaptchaToken';\nimport { transformCreateCustomer } from '@/auth/data/transforms';\nimport { CustomerModel } from '@/auth/data/models';\nimport { transformDobForm } from '@/auth/lib/transformDobForm';\n\nexport const createCustomer = async (\n forms: Customer,\n apiVersion2: boolean\n): Promise<CustomerModel> => {\n await setReCaptchaToken();\n\n const response = await fetchGraphQl(\n apiVersion2 ? CREATE_CUSTOMER_V2 : CREATE_CUSTOMER,\n {\n method: 'POST',\n variables: {\n input: {\n ...transformDobForm(forms),\n },\n },\n }\n ).catch(handleNetworkError);\n\n return transformCreateCustomer(response, apiVersion2);\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 const GET_ATTRIBUTES_FORM = /* GraphQL */ `\n query GET_ATTRIBUTES_FORM($formCode: String!) {\n attributesForm(formCode: $formCode) {\n items {\n code\n default_value\n entity_type\n frontend_class\n frontend_input\n is_required\n is_unique\n label\n options {\n is_default\n label\n value\n }\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n validate_rules {\n name\n value\n }\n }\n }\n errors {\n type\n message\n }\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 '../fetch-graphql';\nimport { GET_ATTRIBUTES_FORM } from './graphql/getAttributesForm.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { transformAttributesForm } from '@/auth/data/transforms';\nimport { handleFetchError } from '@/auth/lib/fetch-error';\nimport { AttributesFormModel } from '@/auth/data/models';\nimport { GetAttributesFormResponse } from '@/auth/types';\n\nexport const getAttributesForm = async (\n formCode: string\n): Promise<AttributesFormModel[]> => {\n return await fetchGraphQl(GET_ATTRIBUTES_FORM, {\n method: 'GET',\n cache: 'force-cache',\n variables: { formCode },\n })\n .then((response: GetAttributesFormResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return transformAttributesForm(response);\n })\n .catch(handleNetworkError);\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 const CREATE_CUSTOMER_ADDRESS = /* GraphQL */ `\n mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {\n createCustomerAddress(input: $input) {\n firstname\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 { AddressFormProps, CreateCustomerAddressResponse } from '@/auth/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { CREATE_CUSTOMER_ADDRESS } from './graphql/createCustomerAddress.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { handleFetchError } from '@/auth/lib/fetch-error';\n\nexport const createCustomerAddress = async (\n address: AddressFormProps\n): Promise<string> => {\n return await fetchGraphQl(CREATE_CUSTOMER_ADDRESS, {\n method: 'POST',\n variables: {\n input: address,\n },\n })\n .then((response: CreateCustomerAddressResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response.data.createCustomerAddress.firstname || '';\n })\n .catch(handleNetworkError);\n};\n"],"names":["CREATE_CUSTOMER","CUSTOMER_INFORMATION_FRAGMENT","CREATE_CUSTOMER_V2","transformCreateCustomer","response","apiVersion2","model","data","_b","_a","_d","_c","_f","_e","_g","_i","_h","_k","_j","_m","_l","merge","_p","_o","_n","config","transformDobForm","form","dob","rest","createCustomer","forms","setReCaptchaToken","fetchGraphQl","handleNetworkError","GET_ATTRIBUTES_FORM","getAttributesForm","formCode","handleFetchError","transformAttributesForm","CREATE_CUSTOMER_ADDRESS","createCustomerAddress","address"],"mappings":"gYAmBO,MAAMA,EAAgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQzCC,CAA6B;AAAA,ECRpBC,EAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQ5CD,CAA6B;AAAA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AAGE,EAAM,cAAeD,CAAA,CACnC,ECoBaE,EAAiB,MAC5BC,EACA1B,IAC2B,CAC3B,MAAM2B,EAAA,EAEN,MAAM5B,EAAW,MAAM6B,EACrB5B,EAAcH,EAAqBF,EACnC,CACE,OAAQ,OACR,UAAW,CACT,MAAO,CACL,GAAG0B,EAAiBK,CAAK,CAAA,CAC3B,CACF,CACF,EACA,MAAMG,CAAkB,EAE1B,OAAO/B,EAAwBC,EAAUC,CAAW,CACtD,EC7Ba8B,EAAoC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECQpCC,EAAoB,MAC/BC,GAEO,MAAMJ,EAAaE,EAAqB,CAC7C,OAAQ,MACR,MAAO,cACP,UAAW,CAAE,SAAAE,CAAA,CAAS,CACvB,EACE,KAAMjC,GAAwC,OAC7C,OAAIK,EAAAL,EAAS,SAAT,MAAAK,EAAiB,OAAe6B,EAAiBlC,EAAS,MAAM,EAE7DmC,EAAwBnC,CAAQ,CACzC,CAAC,EACA,MAAM8B,CAAkB,ECrBhBM,EAAwC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECMxCC,EAAwB,MACnCC,GAEO,MAAMT,EAAaO,EAAyB,CACjD,OAAQ,OACR,UAAW,CACT,MAAOE,CAAA,CACT,CACD,EACE,KAAMtC,GAA4C,OACjD,OAAIK,EAAAL,EAAS,SAAT,MAAAK,EAAiB,OAAe6B,EAAiBlC,EAAS,MAAM,EAE7DA,EAAS,KAAK,sBAAsB,WAAa,EAC1D,CAAC,EACA,MAAM8B,CAAkB"}
@@ -0,0 +1,66 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import{Initializer as T,Config as S}from"@dropins/tools/lib.js";import{events as s}from"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{f as l,h as y,a as I,r as k}from"./network-error.js";const E={auth_dropin_user_token:"auth_dropin_user_token",auth_dropin_firstname:"auth_dropin_firstname"},W=["localhost","127.0.0.1","::1"],f=3600,P=e=>{const t=document.cookie.split(";");let r;return t.forEach(o=>{const[a,n]=o.trim().split("=");a===e&&(r=decodeURIComponent(n))}),r},R=e=>{document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`},X=async()=>{try{const e=sessionStorage.getItem("storeConfig");let r=(e?JSON.parse(e):{}).customerAccessTokenLifetime;if(!r){const o=await x();sessionStorage.setItem("storeConfig",JSON.stringify(o)),r=(o==null?void 0:o.customerAccessTokenLifetime)||f}return`Max-Age=${r}`}catch(e){return console.error("getCookiesLifetime() Error:",e),`Max-Age=${f}`}},g=new S(void 0),O=new T({init:async e=>{const r={...{authHeaderConfig:{header:"Authorization",tokenPrefix:"Bearer"},customerPermissionRoles:!1,adobeCommerceOptimizer:!1},...e};O.config.setConfig(r);const o=P(E.auth_dropin_user_token),[a]=await Promise.all([z(r.authHeaderConfig.header,r.authHeaderConfig.tokenPrefix),r.customerPermissionRoles&&o?p():Promise.resolve(),r.adobeCommerceOptimizer?A():Promise.resolve()]);g.setConfig(a)},listeners:()=>[s.on("authenticated",e=>{const t=g.getConfig();if(t!==void 0&&e!==t){g.setConfig(e);const{customerPermissionRoles:r,adobeCommerceOptimizer:o}=O.config.getConfig();r&&p(),o&&A()}})]}),Y=O.config,M=e=>{var t,r,o,a,n,i,u,m,_,d;return{autocompleteOnStorefront:((r=(t=e==null?void 0:e.data)==null?void 0:t.storeConfig)==null?void 0:r.autocomplete_on_storefront)||!1,minLength:((a=(o=e==null?void 0:e.data)==null?void 0:o.storeConfig)==null?void 0:a.minimum_password_length)||3,requiredCharacterClasses:+((i=(n=e==null?void 0:e.data)==null?void 0:n.storeConfig)==null?void 0:i.required_character_classes_number)||0,createAccountConfirmation:((m=(u=e==null?void 0:e.data)==null?void 0:u.storeConfig)==null?void 0:m.create_account_confirmation)||!1,customerAccessTokenLifetime:((d=(_=e==null?void 0:e.data)==null?void 0:_.storeConfig)==null?void 0:d.customer_access_token_lifetime)*f||f}},w=e=>{var t,r;return{priceBookId:((r=(t=e==null?void 0:e.data)==null?void 0:t.commerceOptimizer)==null?void 0:r.priceBookId)||""}},b=e=>{const t=e.map(r=>r.message).join(" ");throw Error(t)},v=async e=>{if(!e||e.trim()==="")return"";try{const t=atob(e),r=new Uint8Array(t.length);for(let i=0;i<t.length;i++)r[i]=t.charCodeAt(i);const o=await crypto.subtle.digest("SHA-1",r);return Array.from(new Uint8Array(o)).map(i=>i.toString(16).padStart(2,"0")).join("")}catch(t){return console.error(`Failed to convert base64 to SHA1: ${t instanceof Error?t.message:"Unknown error"}`),""}},L="b6589fc6ab0dc82cf12099d1c2d40ab994e8410c",C=async e=>{const t=e?await v(e):L;s.emit("auth/group-uid",t)},G=`
4
+ query GET_STORE_CONFIG {
5
+ storeConfig {
6
+ autocomplete_on_storefront
7
+ minimum_password_length
8
+ required_character_classes_number
9
+ store_code
10
+ store_name
11
+ store_group_code
12
+ locale
13
+ create_account_confirmation
14
+ customer_access_token_lifetime
15
+ }
16
+ }
17
+ `,x=async()=>await l(G,{method:"GET",cache:"force-cache"}).then(e=>{var t;return(t=e.errors)!=null&&t.length?b(e.errors):M(e)}).catch(y),U=`
18
+ query VALIDATE_TOKEN {
19
+ customer {
20
+ group {
21
+ uid
22
+ }
23
+ }
24
+ }
25
+ `,z=async(e="Authorization",t="Bearer")=>{const r=P(E.auth_dropin_user_token);return r?(I(e,`${t} ${r}`),l(U).then(async o=>{var n,i,u,m;return!((n=o.errors)!=null&&n.find(_=>{var d;return((d=_.extensions)==null?void 0:d.category)==="graphql-authentication"}))?(await C((m=(u=(i=o.data)==null?void 0:i.customer)==null?void 0:u.group)==null?void 0:m.uid),s.emit("authenticated",!0),!0):(R(E.auth_dropin_user_token),k(e),await C(),s.emit("authenticated",!1),!1)})):(await C(),s.emit("authenticated",!1),!1)},D=`
26
+ query GET_CUSTOMER_ROLE_PERMISSIONS {
27
+ customer {
28
+ purchase_orders_enabled
29
+ role {
30
+ id
31
+ name
32
+ permissions {
33
+ id
34
+ text
35
+ children {
36
+ id
37
+ text
38
+ children {
39
+ id
40
+ text
41
+ children {
42
+ id
43
+ text
44
+ children {
45
+ id
46
+ text
47
+ children {
48
+ id
49
+ text
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
58
+ }
59
+ `;let h=null,c=null;const H=e=>{const t={},r=o=>{o.forEach(a=>{var n;t[a.id]=!0,(n=a.children)!=null&&n.length&&r(a.children)})};return r(e),t},N=["Magento_PurchaseOrder::all","Magento_PurchaseOrder::view_purchase_orders","Magento_PurchaseOrder::view_purchase_orders_for_subordinates","Magento_PurchaseOrder::view_purchase_orders_for_company","Magento_PurchaseOrder::autoapprove_purchase_order","Magento_PurchaseOrderRule::super_approve_purchase_order","Magento_PurchaseOrderRule::view_approval_rules","Magento_PurchaseOrderRule::manage_approval_rules"],q=e=>(e==null?void 0:e.id)==="MA=="&&Array.isArray(e.permissions)&&e.permissions.length===0,B=e=>{var t;return(t=e==null?void 0:e.permissions)!=null&&t.length?H(e.permissions):{}},F=(e,t)=>{if(t===!0)return e;const r={...e};return N.forEach(o=>{r[o]=!1}),r},$=(e,t)=>{const r=q(e),o=B(e),a=F(o,t);return{...{all:!0,...r&&{admin:!0}},...a}},K=async()=>{var e,t,r,o;try{const a=await l(D,{method:"GET"}),n=$((t=(e=a.data)==null?void 0:e.customer)==null?void 0:t.role,(o=(r=a.data)==null?void 0:r.customer)==null?void 0:o.purchase_orders_enabled);return h=n,c=null,n}catch(a){throw c=null,a}},p=()=>h?(s.emit("auth/permissions",h),Promise.resolve(h)):(c||(c=K().then(e=>(s.emit("auth/permissions",e),e))),c),ee=()=>{h=null,c=null},J=`
60
+ query GET_ADOBE_COMMERCE_OPTIMIZER_DATA {
61
+ commerceOptimizer {
62
+ priceBookId
63
+ }
64
+ }
65
+ `,A=async()=>{const e=await l(J,{method:"GET"}),t=w(e);return s.emit("auth/adobe-commerce-optimizer",t),t};export{E as C,W as L,ee as _,p as a,A as b,Y as c,R as d,C as e,X as f,x as g,b as h,O as i,z as v};
66
+ //# sourceMappingURL=getAdobeCommerceOptimizerData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAdobeCommerceOptimizerData.js","sources":["/@dropins/storefront-auth/src/configs/cookieConfigs.ts","/@dropins/storefront-auth/src/lib/cookieUtils.ts","/@dropins/storefront-auth/src/api/initialize/initialize.ts","/@dropins/storefront-auth/src/data/transforms/transform-store-config.ts","/@dropins/storefront-auth/src/data/transforms/transform-adobe-commerce-optimizer.ts","/@dropins/storefront-auth/src/lib/fetch-error.ts","/@dropins/storefront-auth/src/lib/base64ToSha1.ts","/@dropins/storefront-auth/src/lib/emitAuthGroupId.ts","/@dropins/storefront-auth/src/api/getStoreConfig/graphql/getStoreConfig.graphql.ts","/@dropins/storefront-auth/src/api/getStoreConfig/getStoreConfig.ts","/@dropins/storefront-auth/src/api/verifyToken/graphql/verifyToken.graphql.ts","/@dropins/storefront-auth/src/api/verifyToken/verifyToken.ts","/@dropins/storefront-auth/src/api/getCustomerRolePermissions/graphql/getCustomerRolePermissions.graphql.ts","/@dropins/storefront-auth/src/api/getCustomerRolePermissions/getCustomerRolePermissions.ts","/@dropins/storefront-auth/src/api/getAdobeCommerceOptimizerData/graphql/getAdobeCommerceOptimizerData.graphql.ts","/@dropins/storefront-auth/src/api/getAdobeCommerceOptimizerData/getAdobeCommerceOptimizerData.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\nconst COOKIE_NAMES = {\n auth_dropin_user_token: 'auth_dropin_user_token',\n auth_dropin_firstname: 'auth_dropin_firstname',\n};\n\nconst LOCALHOST = [\n 'localhost',\n '127.0.0.1',\n '::1'\n];\n\nconst COOKIE_LIFETIME = 3600;\n\nexport { COOKIE_NAMES, COOKIE_LIFETIME, LOCALHOST };\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\n/* eslint-disable no-useless-escape */\nimport { getStoreConfig } from '@/auth/api';\nimport { COOKIE_LIFETIME } from '@/auth/configs/cookieConfigs';\n\nexport const getCookie = (cookieName: string) => {\n const cookies = document.cookie.split(';');\n let foundValue;\n\n cookies.forEach((cookie) => {\n const [name, value] = cookie.trim().split('=');\n if (name === cookieName) {\n foundValue = decodeURIComponent(value);\n }\n });\n\n return foundValue;\n};\n\nexport const deleteCookie = (cookieName: string) => {\n document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;\n};\n\nexport const getCookiesLifetime = async () => {\n try {\n const storeConfigString = sessionStorage.getItem('storeConfig');\n const cachedStoreConfig = storeConfigString\n ? JSON.parse(storeConfigString)\n : {};\n\n let accessTokenLifeTime = cachedStoreConfig.customerAccessTokenLifetime;\n\n if (!accessTokenLifeTime) {\n const storeConfig = await getStoreConfig();\n\n sessionStorage.setItem('storeConfig', JSON.stringify(storeConfig));\n\n accessTokenLifeTime =\n storeConfig?.customerAccessTokenLifetime || COOKIE_LIFETIME;\n }\n\n return `Max-Age=${accessTokenLifeTime}`;\n } catch (error) {\n console.error('getCookiesLifetime() Error:', error);\n return `Max-Age=${COOKIE_LIFETIME}`;\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 { Initializer, Model, Config } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { getCookie } from '@/auth/lib/cookieUtils';\nimport { CustomerModel } from '@/auth/data/models';\nimport { verifyToken, getCustomerRolePermissions, getAdobeCommerceOptimizerData } from '@/auth/api';\nimport { events } from '@adobe-commerce/event-bus';\nimport { COOKIE_NAMES } from '@/auth/configs/cookieConfigs';\n\ntype ConfigProps = {\n langDefinitions?: Lang;\n authHeaderConfig: {\n header: string;\n tokenPrefix: string;\n };\n customerPermissionRoles?: boolean;\n adobeCommerceOptimizer?: boolean;\n models?: {\n CustomerModel?: Model<CustomerModel>;\n };\n};\n\nconst _authenticated = new Config<boolean | undefined>(undefined);\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (config) => {\n const defaultConfig = {\n authHeaderConfig: {\n header: 'Authorization',\n tokenPrefix: 'Bearer',\n },\n customerPermissionRoles: false,\n adobeCommerceOptimizer: false,\n };\n\n const mergedConfig = { ...defaultConfig, ...config };\n\n initialize.config.setConfig(mergedConfig);\n\n const token = getCookie(COOKIE_NAMES.auth_dropin_user_token);\n\n const [authenticated] = await Promise.all([\n verifyToken(\n mergedConfig.authHeaderConfig.header,\n mergedConfig.authHeaderConfig.tokenPrefix\n ),\n mergedConfig.customerPermissionRoles && token\n ? getCustomerRolePermissions()\n : Promise.resolve(),\n mergedConfig.adobeCommerceOptimizer\n ? getAdobeCommerceOptimizerData()\n : Promise.resolve(),\n ]);\n\n _authenticated.setConfig(authenticated);\n },\n\n listeners: () => [\n events.on('authenticated', (next) => {\n const prev = _authenticated.getConfig();\n\n if (prev !== undefined && next !== prev) {\n _authenticated.setConfig(next);\n const { customerPermissionRoles, adobeCommerceOptimizer } = initialize.config.getConfig();\n if (customerPermissionRoles) {\n getCustomerRolePermissions();\n }\n if (adobeCommerceOptimizer) {\n getAdobeCommerceOptimizerData();\n }\n }\n }),\n ],\n});\n\nexport const config = initialize.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 { getStoreConfigResponse } from '@/auth/types';\nimport { COOKIE_LIFETIME } from '@/auth/configs/cookieConfigs';\nimport { StoreConfigModel } from '../models';\n\nexport const transformStoreConfig = (\n response: getStoreConfigResponse\n): StoreConfigModel => {\n return {\n autocompleteOnStorefront:\n response?.data?.storeConfig?.autocomplete_on_storefront || false,\n // Need information about min length in response undefined\n minLength: response?.data?.storeConfig?.minimum_password_length || 3,\n requiredCharacterClasses:\n +response?.data?.storeConfig?.required_character_classes_number || 0,\n createAccountConfirmation:\n response?.data?.storeConfig?.create_account_confirmation || false,\n customerAccessTokenLifetime:\n response?.data?.storeConfig?.customer_access_token_lifetime *\n COOKIE_LIFETIME || COOKIE_LIFETIME,\n };\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { AdobeCommerceOptimizerModel } from '../models';\n\nexport interface AdobeCommerceOptimizerData {\n priceBookId: string;\n}\n\nexport interface AdobeCommerceOptimizerResponse {\n data?: {\n commerceOptimizer?: AdobeCommerceOptimizerData;\n };\n}\n\nexport const transformAdobeCommerceOptimizerData = (\n response: AdobeCommerceOptimizerResponse\n): AdobeCommerceOptimizerModel => {\n return {\n priceBookId: response?.data?.commerceOptimizer?.priceBookId || '',\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\n/** Actions */\nexport const handleFetchError = (errors: Array<{ message: string }>) => {\n const errorMessage = errors.map((e: any) => e.message).join(' ');\n\n throw Error(errorMessage);\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\n/**\n * Converts a base64 encoded string to a SHA1 hash string\n * @param base64String - The base64 encoded string to convert\n * @returns A promise that resolves to the SHA1 hash as a hexadecimal string, or empty string if input is undefined/null/empty or if conversion fails\n */\nexport const base64ToSha1 = async (\n base64String?: string | null\n): Promise<string> => {\n // Handle edge cases: undefined, null, or empty string\n if (!base64String || base64String.trim() === '') {\n return '';\n }\n\n try {\n // Decode base64 string to binary data\n const binaryString = atob(base64String);\n const bytes = new Uint8Array(binaryString.length);\n for (let i = 0; i < binaryString.length; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n\n // Compute SHA1 hash using Web Crypto API\n const hashBuffer = await crypto.subtle.digest('SHA-1', bytes);\n\n // Convert hash to hexadecimal string\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n const hashHex = hashArray\n .map((byte) => byte.toString(16).padStart(2, '0'))\n .join('');\n\n return hashHex;\n } catch (error) {\n console.error(\n `Failed to convert base64 to SHA1: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n return '';\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 { events } from '@adobe-commerce/event-bus';\nimport { base64ToSha1 } from './base64ToSha1';\n\n/**\n * Default customer group ID for non-logged-in (NLI) customers.\n * This value is emitted via the 'auth/group-uid' event when:\n * - A customer is not authenticated\n * - Token validation fails\n * - Customer logs out\n */\nexport const DEFAULT_NLI_CUSTOMER_GROUP_ID = 'b6589fc6ab0dc82cf12099d1c2d40ab994e8410c';\n\n/**\n * Emits the auth/group-uid event with the provided group UID.\n * If a value is provided, it will be converted from base64 to SHA1 hash.\n * If no value is provided, the default NLI customer group ID will be emitted.\n * \n * @param groupUid - The base64 encoded group UID, or undefined/null for default\n */\nexport const emitAuthGroupIdEvent = async (\n groupUid?: string | null\n): Promise<void> => {\n const groupIdHash = groupUid \n ? await base64ToSha1(groupUid) \n : DEFAULT_NLI_CUSTOMER_GROUP_ID;\n \n events.emit('auth/group-uid', groupIdHash);\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\nexport const GET_STORE_CONFIG = /* GraphQL */ `\n query GET_STORE_CONFIG {\n storeConfig {\n autocomplete_on_storefront\n minimum_password_length\n required_character_classes_number\n store_code\n store_name\n store_group_code\n locale\n create_account_confirmation\n customer_access_token_lifetime\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 { getStoreConfigResponse } from '@/auth/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { GET_STORE_CONFIG } from './graphql/getStoreConfig.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { transformStoreConfig } from '@/auth/data/transforms';\nimport { StoreConfigModel } from '@/auth/data/models';\nimport { handleFetchError } from '@/auth/lib/fetch-error';\n\nexport const getStoreConfig = async (): Promise<StoreConfigModel> => {\n return await fetchGraphQl(GET_STORE_CONFIG, {\n method: 'GET',\n cache: 'force-cache',\n })\n .then((response: getStoreConfigResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return transformStoreConfig(response);\n })\n .catch(handleNetworkError);\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 const VALIDATE_CUSTOMER_TOKEN = /* GraphQL */ `\n query VALIDATE_TOKEN {\n customer {\n group {\n uid\n }\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 { events } from '@adobe-commerce/event-bus';\nimport {\n fetchGraphQl,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeader,\n} from '../fetch-graphql';\nimport { deleteCookie, getCookie } from '@/auth/lib/cookieUtils';\nimport { COOKIE_NAMES } from '@/auth/configs/cookieConfigs';\nimport { VALIDATE_CUSTOMER_TOKEN } from './graphql/verifyToken.graphql';\nimport { emitAuthGroupIdEvent } from '@/auth/lib/emitAuthGroupId';\n\nexport const verifyToken = async (\n authType = 'Authorization',\n type = 'Bearer'\n) => {\n const token = getCookie(COOKIE_NAMES.auth_dropin_user_token);\n\n if (!token) {\n await emitAuthGroupIdEvent();\n events.emit('authenticated', false);\n return false;\n }\n\n setFetchGraphQlHeader(authType, `${type} ${token}`);\n\n return fetchGraphQl(VALIDATE_CUSTOMER_TOKEN).then(async (res) => {\n const unauthenticated = !!res.errors?.find(\n (error) => error.extensions?.category === 'graphql-authentication'\n );\n\n if (!unauthenticated) {\n await emitAuthGroupIdEvent(res.data?.customer?.group?.uid);\n events.emit('authenticated', true);\n return true;\n };\n\n deleteCookie(COOKIE_NAMES.auth_dropin_user_token);\n removeFetchGraphQlHeader(authType);\n await emitAuthGroupIdEvent();\n events.emit('authenticated', false);\n return false;\n });\n};\n","export const GET_CUSTOMER_ROLE_PERMISSIONS = `\n query GET_CUSTOMER_ROLE_PERMISSIONS {\n customer {\n purchase_orders_enabled\n role {\n id\n name\n permissions {\n id\n text\n children {\n id\n text\n children {\n id\n text\n children {\n id\n text\n children {\n id\n text\n children {\n id\n text\n }\n }\n }\n }\n }\n }\n }\n }\n }\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { events } from '@adobe-commerce/event-bus';\nimport { fetchGraphQl } from '@/auth/api/fetch-graphql';\nimport { PermissionsModel } from '@/auth/data/models';\nimport { GET_CUSTOMER_ROLE_PERMISSIONS } from './graphql/getCustomerRolePermissions.graphql';\n\n// TypeScript interfaces\ninterface Permission {\n id: string;\n text: string;\n children?: Permission[];\n}\n\ninterface Role {\n id: string;\n name: string;\n permissions?: Permission[];\n}\n\ninterface GetCustomerRolePermissionsResponse {\n data?: {\n customer?: {\n purchase_orders_enabled?: boolean;\n role?: Role;\n };\n };\n errors?: {\n message: string;\n }[];\n}\n\n// Module-level cache\nlet permissionsCache: PermissionsModel | null = null;\nlet fetchPromise: Promise<PermissionsModel> | null = null;\n\n/**\n * Recursively flattens permission tree into a flat object\n */\nconst flattenPermissionTree = (\n permissions: Permission[]\n): Record<string, boolean> => {\n const flattened: Record<string, boolean> = {};\n\n const processPermissions = (perms: Permission[]): void => {\n perms.forEach((permission) => {\n flattened[permission.id] = true;\n if (permission.children?.length) {\n processPermissions(permission.children);\n }\n });\n };\n\n processPermissions(permissions);\n return flattened;\n};\n\n/**\n * Purchase Order related permissions that should be set to false\n * when purchase orders are disabled\n */\nconst PURCHASE_ORDER_PERMISSIONS = [\n 'Magento_PurchaseOrder::all',\n 'Magento_PurchaseOrder::view_purchase_orders',\n 'Magento_PurchaseOrder::view_purchase_orders_for_subordinates',\n 'Magento_PurchaseOrder::view_purchase_orders_for_company',\n 'Magento_PurchaseOrder::autoapprove_purchase_order',\n 'Magento_PurchaseOrderRule::super_approve_purchase_order',\n 'Magento_PurchaseOrderRule::view_approval_rules',\n 'Magento_PurchaseOrderRule::manage_approval_rules',\n];\n\n/**\n * Determines if user has admin privileges\n * Admin is only when user has role ID 'MA==' AND has an empty permissions array\n */\nconst isAdminUser = (role?: Role): boolean => {\n return (\n role?.id === 'MA==' &&\n Array.isArray(role.permissions) &&\n role.permissions.length === 0\n );\n};\n\n/**\n * Gets all available permissions from the GraphQL response\n * Returns an empty object if no permissions (e.g., admin users have empty array)\n */\nconst getAllPermissions = (role?: Role): Record<string, boolean> => {\n if (role?.permissions?.length) {\n return flattenPermissionTree(role.permissions);\n }\n return {};\n};\n\n/**\n * Handles purchase order permissions based on PO enabled status\n * When PO is disabled, explicitly sets all PO permissions to false\n * This ensures consumers can distinguish between \"no data\" and \"explicitly disabled\"\n */\nconst overridePurchaseOrderPermissions = (\n permissions: Record<string, boolean>,\n purchaseOrdersEnabled?: boolean\n): Record<string, boolean> => {\n // If PO is enabled, return permissions as-is from backend\n if (purchaseOrdersEnabled === true) {\n return permissions;\n }\n\n // When PO is disabled, explicitly set all PO permissions to false\n const result = { ...permissions };\n PURCHASE_ORDER_PERMISSIONS.forEach((permission) => {\n result[permission] = false;\n });\n\n return result;\n};\n\n/**\n * Processes role data into flattened permissions\n */\nconst processUserPermissions = (\n role?: Role,\n purchaseOrdersEnabled?: boolean\n): PermissionsModel => {\n const isAdmin = isAdminUser(role);\n\n // Get all permissions (for both admin and non-admin users)\n const allPermissions = getAllPermissions(role);\n\n // Override PO permissions to false if PO is disabled\n const processedPermissions = overridePurchaseOrderPermissions(\n allPermissions,\n purchaseOrdersEnabled\n );\n\n const basePermissions: PermissionsModel = {\n all: true,\n ...(isAdmin && { admin: true }),\n };\n\n return { ...basePermissions, ...processedPermissions };\n};\n\n/**\n * Fetches user role permissions from GraphQL API\n */\nconst fetchUserRolePermissions = async (): Promise<PermissionsModel> => {\n try {\n const response = (await fetchGraphQl(GET_CUSTOMER_ROLE_PERMISSIONS, {\n method: 'GET',\n })) as GetCustomerRolePermissionsResponse;\n\n const permissions = processUserPermissions(\n response.data?.customer?.role,\n response.data?.customer?.purchase_orders_enabled\n );\n\n // Update cache\n permissionsCache = permissions;\n fetchPromise = null;\n\n return permissions;\n } catch (error) {\n fetchPromise = null;\n throw error;\n }\n};\n\n/**\n * Gets user role permissions with caching\n */\nexport const getCustomerRolePermissions = (): Promise<PermissionsModel> => {\n // Return cached data as resolved promise if available\n if (permissionsCache) {\n events.emit('auth/permissions', permissionsCache);\n return Promise.resolve(permissionsCache);\n }\n\n // No cache available - create and return fetch promise if not already fetching\n if (!fetchPromise) {\n fetchPromise = fetchUserRolePermissions().then((permissions) => {\n events.emit('auth/permissions', permissions);\n return permissions;\n });\n }\n\n return fetchPromise;\n};\n\n/**\n * Resets the permissions cache\n * @internal\n */\nexport const _resetCache = (): void => {\n permissionsCache = null;\n fetchPromise = null;\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nexport const GET_ADOBE_COMMERCE_OPTIMIZER_DATA = /* GraphQL */`\n query GET_ADOBE_COMMERCE_OPTIMIZER_DATA {\n commerceOptimizer {\n priceBookId\n }\n }\n`;\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { events } from '@adobe-commerce/event-bus';\nimport { fetchGraphQl } from '@/auth/api/fetch-graphql';\nimport { AdobeCommerceOptimizerModel } from '@/auth/data/models';\nimport {\n transformAdobeCommerceOptimizerData,\n AdobeCommerceOptimizerResponse,\n} from '@/auth/data/transforms';\nimport { GET_ADOBE_COMMERCE_OPTIMIZER_DATA } from './graphql/getAdobeCommerceOptimizerData.graphql';\n\n/**\n * Fetches Adobe Commerce Optimizer data from GraphQL API\n * This function works for both authenticated and non-authenticated users\n */\nexport const getAdobeCommerceOptimizerData =\n async (): Promise<AdobeCommerceOptimizerModel> => {\n const response = (await fetchGraphQl(GET_ADOBE_COMMERCE_OPTIMIZER_DATA, {\n method: 'GET',\n })) as AdobeCommerceOptimizerResponse;\n\n const adobeCommerceOptimizerData = transformAdobeCommerceOptimizerData(response);\n\n // Emit event with the adobe commerce optimizer data\n events.emit('auth/adobe-commerce-optimizer', adobeCommerceOptimizerData);\n\n return adobeCommerceOptimizerData;\n };\n"],"names":["COOKIE_NAMES","LOCALHOST","COOKIE_LIFETIME","getCookie","cookieName","cookies","foundValue","cookie","name","value","deleteCookie","getCookiesLifetime","storeConfigString","accessTokenLifeTime","storeConfig","getStoreConfig","error","_authenticated","Config","initialize","Initializer","config","mergedConfig","token","authenticated","verifyToken","getCustomerRolePermissions","getAdobeCommerceOptimizerData","events","next","prev","customerPermissionRoles","adobeCommerceOptimizer","transformStoreConfig","response","_b","_a","_d","_c","_f","_e","_h","_g","_j","_i","transformAdobeCommerceOptimizerData","handleFetchError","errors","errorMessage","e","base64ToSha1","base64String","binaryString","bytes","hashBuffer","byte","DEFAULT_NLI_CUSTOMER_GROUP_ID","emitAuthGroupIdEvent","groupUid","groupIdHash","GET_STORE_CONFIG","fetchGraphQl","handleNetworkError","VALIDATE_CUSTOMER_TOKEN","authType","type","setFetchGraphQlHeader","res","removeFetchGraphQlHeader","GET_CUSTOMER_ROLE_PERMISSIONS","permissionsCache","fetchPromise","flattenPermissionTree","permissions","flattened","processPermissions","perms","permission","PURCHASE_ORDER_PERMISSIONS","isAdminUser","role","getAllPermissions","overridePurchaseOrderPermissions","purchaseOrdersEnabled","result","processUserPermissions","isAdmin","allPermissions","processedPermissions","fetchUserRol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IAC9C7C,EAAO,KAAK,mBAAoB6C,CAAW,EACpCA,EACR,GAGIF,GAOImB,GAAc,IAAY,CACrCpB,EAAmB,KACnBC,EAAe,IACjB,ECnMaoB,EAAiD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECajDhE,EACX,SAAkD,CAChD,MAAMO,EAAY,MAAM2B,EAAa8B,EAAmC,CACtE,OAAQ,KAAA,CACT,EAEKC,EAA6B/C,EAAoCX,CAAQ,EAG/E,OAAAN,EAAO,KAAK,gCAAiCgE,CAA0B,EAEhEA,CACT"}
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{a as R,f as $,h as w}from"./network-error.js";import"@dropins/tools/recaptcha.js";import{events as k}from"@dropins/tools/event-bus.js";import{merge as U}from"@dropins/tools/lib.js";import{c as G,b as C,C as h,e as v,L as F}from"./getCustomerRolePermissions.js";import{CUSTOMER_INFORMATION_FRAGMENT as x}from"../fragments.js";import{p as y,E as S}from"./acdl.js";import{s as D}from"./setReCaptchaToken.js";const H=t=>{var T,e,o,a,c,m,r,f,g,d,s,E,u,M;const i={email:((e=(T=t==null?void 0:t.data)==null?void 0:T.customer)==null?void 0:e.email)??"",firstName:((a=(o=t==null?void 0:t.data)==null?void 0:o.customer)==null?void 0:a.firstname)??"",lastName:((m=(c=t==null?void 0:t.data)==null?void 0:c.customer)==null?void 0:m.lastname)??"",groupUid:((g=(f=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:f.group)==null?void 0:g.uid)??""};return U(i,(M=(u=(E=(s=(d=G)==null?void 0:d.getConfig())==null?void 0:s.models)==null?void 0:E.CustomerModel)==null?void 0:u.transformer)==null?void 0:M.call(u,t.data))},K=`
3
+ import{a as R,f as $,h as w}from"./network-error.js";import"@dropins/tools/recaptcha.js";import{events as k}from"@dropins/tools/event-bus.js";import{merge as U}from"@dropins/tools/lib.js";import{c as G,f as C,C as h,e as v,L as F}from"./getAdobeCommerceOptimizerData.js";import{CUSTOMER_INFORMATION_FRAGMENT as x}from"../fragments.js";import{p as y,E as S}from"./acdl.js";import{s as D}from"./setReCaptchaToken.js";const H=t=>{var f,e,o,a,c,m,r,T,g,d,s,E,u,M;const i={email:((e=(f=t==null?void 0:t.data)==null?void 0:f.customer)==null?void 0:e.email)??"",firstName:((a=(o=t==null?void 0:t.data)==null?void 0:o.customer)==null?void 0:a.firstname)??"",lastName:((m=(c=t==null?void 0:t.data)==null?void 0:c.customer)==null?void 0:m.lastname)??"",groupUid:((g=(T=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:T.group)==null?void 0:g.uid)??""};return U(i,(M=(u=(E=(s=(d=G)==null?void 0:d.getConfig())==null?void 0:s.models)==null?void 0:E.CustomerModel)==null?void 0:u.transformer)==null?void 0:M.call(u,t.data))},K=`
4
4
  query GET_CUSTOMER_DATA {
5
5
  customer {
6
6
  ...CUSTOMER_INFORMATION_FRAGMENT
@@ -13,5 +13,5 @@ import{a as R,f as $,h as w}from"./network-error.js";import"@dropins/tools/recap
13
13
  token
14
14
  }
15
15
  }
16
- `,Y=async({email:t,password:i,translations:T,onErrorCallback:e,handleSetInLineAlertProps:o})=>{var s,E,u,M,_;await D();const a=await $(Q,{method:"POST",variables:{email:t,password:i}}).catch(w);if(!((E=(s=a==null?void 0:a.data)==null?void 0:s.generateCustomerToken)!=null&&E.token)){const N=T.customerTokenErrorMessage,O=a!=null&&a.errors?a.errors[0].message:N;return e==null||e(O),o==null||o({type:"error",text:O}),{errorMessage:O,userName:"",userEmail:""}}const c=(M=(u=a==null?void 0:a.data)==null?void 0:u.generateCustomerToken)==null?void 0:M.token,m=await A(c),r=m==null?void 0:m.firstName,f=m==null?void 0:m.email;if(!r||!f){const N=T.customerTokenErrorMessage;return e==null||e(N),o==null||o({type:"error",text:N}),{errorMessage:N,userName:"",userEmail:""}}const g=await C(),d=F.includes(window.location.hostname)?"":"Secure";return document.cookie=`${h.auth_dropin_firstname}=${r}; path=/; ${g}; ${d};`,document.cookie=`${h.auth_dropin_user_token}=${c}; path=/; ${g}; ${d};`,await v(c?m==null?void 0:m.groupUid:void 0),k.emit("authenticated",!!c),y((_=S)==null?void 0:_.SIGN_IN,{...m}),{errorMessage:"",userName:r,userEmail:f}};export{Y as a,A as g};
16
+ `,Y=async({email:t,password:i,translations:f,onErrorCallback:e,handleSetInLineAlertProps:o})=>{var s,E,u,M,_;await D();const a=await $(Q,{method:"POST",variables:{email:t,password:i}}).catch(w);if(!((E=(s=a==null?void 0:a.data)==null?void 0:s.generateCustomerToken)!=null&&E.token)){const N=f.customerTokenErrorMessage,O=a!=null&&a.errors?a.errors[0].message:N;return e==null||e(O),o==null||o({type:"error",text:O}),{errorMessage:O,userName:"",userEmail:""}}const c=(M=(u=a==null?void 0:a.data)==null?void 0:u.generateCustomerToken)==null?void 0:M.token,m=await A(c),r=m==null?void 0:m.firstName,T=m==null?void 0:m.email;if(!r||!T){const N=f.customerTokenErrorMessage;return e==null||e(N),o==null||o({type:"error",text:N}),{errorMessage:N,userName:"",userEmail:""}}const g=await C(),d=F.includes(window.location.hostname)?"":"Secure";return document.cookie=`${h.auth_dropin_firstname}=${r}; path=/; ${g}; ${d};`,document.cookie=`${h.auth_dropin_user_token}=${c}; path=/; ${g}; ${d};`,await v(c?m==null?void 0:m.groupUid:void 0),k.emit("authenticated",!!c),y((_=S)==null?void 0:_.SIGN_IN,{...m}),{errorMessage:"",userName:r,userEmail:T}};export{Y as a,A as g};
17
17
  //# sourceMappingURL=getCustomerToken.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getCustomerToken.js","sources":["/@dropins/storefront-auth/src/data/transforms/transform-customer-data.ts","/@dropins/storefront-auth/src/api/getCustomerData/graphql/getCustomerData.graphql.ts","/@dropins/storefront-auth/src/api/getCustomerData/getCustomerData.ts","/@dropins/storefront-auth/src/api/getCustomerToken/graphql/getCustomerToken.graphql.ts","/@dropins/storefront-auth/src/api/getCustomerToken/getCustomerToken.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 { getCustomerDataResponse } from '@/auth/types';\nimport { CustomerModel } from '../models';\nimport { config } from '@/auth/api';\nimport { merge } from '@adobe-commerce/elsie/lib';\n\nexport const transformCustomerData = (\n response: getCustomerDataResponse\n): CustomerModel => {\n const model = {\n email: response?.data?.customer?.email ?? '',\n firstName: response?.data?.customer?.firstname ?? '',\n lastName: response?.data?.customer?.lastname ?? '',\n groupUid: response?.data?.customer?.group?.uid ?? '',\n };\n\n // Extend the model merging custom transformer, if provided\n return merge(\n model, // default transformer\n config?.getConfig()?.models?.CustomerModel?.transformer?.(response.data) // custom transformer\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 { CUSTOMER_INFORMATION_FRAGMENT } from '@/auth/api/fragments';\n\nexport const GET_CUSTOMER_DATA = /* GraphQL */ `\n query GET_CUSTOMER_DATA {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n ${CUSTOMER_INFORMATION_FRAGMENT}\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, setFetchGraphQlHeader, config } from '@/auth/api';\nimport { GET_CUSTOMER_DATA } from './graphql/getCustomerData.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { CustomerModel } from '@/auth/data/models';\nimport { transformCustomerData } from '@/auth/data/transforms';\n\nexport const getCustomerData = async (\n user_token: string\n): Promise<CustomerModel> => {\n if (user_token) {\n const { authHeaderConfig } = config.getConfig();\n\n setFetchGraphQlHeader(\n authHeaderConfig.header,\n authHeaderConfig.tokenPrefix\n ? `${authHeaderConfig.tokenPrefix} ${user_token}`\n : user_token\n );\n }\n\n return await fetchGraphQl(GET_CUSTOMER_DATA, {\n method: 'GET',\n cache: 'force-cache',\n })\n .then((response) => {\n return transformCustomerData(response);\n })\n .catch(handleNetworkError);\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 const GET_CUSTOMER_TOKEN = /* GraphQL */ `\n mutation GET_CUSTOMER_TOKEN($email: String!, $password: String!) {\n generateCustomerToken(email: $email, password: $password) {\n token\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 { handleNetworkError } from '@/auth/lib/network-error';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { GET_CUSTOMER_TOKEN } from './graphql/getCustomerToken.graphql';\nimport { getCustomerData } from '../getCustomerData';\nimport { InLineAlertInterface } from '@/auth/types';\nimport { events } from '@adobe-commerce/event-bus';\nimport { COOKIE_NAMES, LOCALHOST } from '@/auth/configs/cookieConfigs';\nimport { getCookiesLifetime } from '@/auth/lib/cookieUtils';\nimport { publishEvents, EventsList } from '@/auth/lib/acdl';\nimport { setReCaptchaToken } from '@/auth/lib/setReCaptchaToken';\nimport { emitAuthGroupIdEvent } from '@/auth/lib/emitAuthGroupId';\n\ninterface getCustomerTokenProps {\n email: string;\n password: string;\n handleSetInLineAlertProps: (value?: InLineAlertInterface) => void;\n translations: Record<string, string>;\n onErrorCallback?: (value?: unknown) => void;\n}\n\nexport const getCustomerToken = async ({\n email,\n password,\n translations,\n onErrorCallback,\n handleSetInLineAlertProps,\n}: getCustomerTokenProps): Promise<{\n errorMessage: string;\n userName: string;\n userEmail: string;\n}> => {\n await setReCaptchaToken();\n\n const response = await fetchGraphQl(GET_CUSTOMER_TOKEN, {\n method: 'POST',\n variables: { email, password },\n }).catch(handleNetworkError);\n\n if (!response?.data?.generateCustomerToken?.token) {\n // Fallback error message\n const defaultErrorMessage = translations.customerTokenErrorMessage;\n const errorMessage = response?.errors\n ? response.errors[0].message\n : defaultErrorMessage;\n\n onErrorCallback?.(errorMessage);\n handleSetInLineAlertProps?.({ type: 'error', text: errorMessage });\n\n return { errorMessage, userName: '', userEmail: '' };\n }\n\n const userToken = response?.data?.generateCustomerToken?.token;\n\n const responseCustomer = await getCustomerData(userToken);\n const userName = responseCustomer?.firstName;\n const userEmail = responseCustomer?.email;\n\n if (!userName || !userEmail) {\n const errorMessage = translations.customerTokenErrorMessage;\n\n onErrorCallback?.(errorMessage);\n handleSetInLineAlertProps?.({ type: 'error', text: errorMessage });\n\n return { errorMessage, userName: '', userEmail: '' };\n }\n\n const cookiesLifetime = await getCookiesLifetime();\n\n // Do not set 'Secure' flag on auth cookies when running on localhost (fix for Safari browser)\n const cookieSecureFlag: string | null = LOCALHOST.includes(window.location.hostname) ? '' : 'Secure';\n\n document.cookie = `${COOKIE_NAMES.auth_dropin_firstname}=${userName}; path=/; ${cookiesLifetime}; ${cookieSecureFlag};`;\n document.cookie = `${COOKIE_NAMES.auth_dropin_user_token}=${userToken}; path=/; ${cookiesLifetime}; ${cookieSecureFlag};`;\n\n await emitAuthGroupIdEvent(userToken ? responseCustomer?.groupUid : undefined);\n events.emit('authenticated', !!userToken);\n\n publishEvents(EventsList?.SIGN_IN, { ...responseCustomer });\n\n return { errorMessage: '', userName, userEmail };\n};\n"],"names":["transformCustomerData","response","model","_b","_a","_d","_c","_f","_e","_i","_h","_g","merge","_n","_m","_l","_k","_j","config","GET_CUSTOMER_DATA","CUSTOMER_INFORMATION_FRAGMENT","getCustomerData","user_token","authHeaderConfig","setFetchGraphQlHeader","fetchGraphQl","handleNetworkError","GET_CUSTOMER_TOKEN","getCustomerToken","email","password","translations","onErrorCallback","handleSetInLineAlertProps","setReCaptchaToken","defaultErrorMessage","errorMessage","userToken","responseCustomer","userName","userEmail","cookiesLifetime","getCookiesLifetime","cookieSecureFlag","LOCALHOST","COOKIE_NAMES","emitAuthGroupIdEvent","events","publishEvents","EventsList"],"mappings":"4ZAsBO,MAAMA,EACXC,GACkB,iCAClB,MAAMC,EAAQ,CACZ,QAAOC,GAAAC,EAAAH,GAAA,YAAAA,EAAU,OAAV,YAAAG,EAAgB,WAAhB,YAAAD,EAA0B,QAAS,GAC1C,YAAWE,GAAAC,EAAAL,GAAA,YAAAA,EAAU,OAAV,YAAAK,EAAgB,WAAhB,YAAAD,EAA0B,YAAa,GAClD,WAAUE,GAAAC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ts","/@dropins/storefront-auth/src/api/getCustomerData/graphql/getCustomerData.graphql.ts","/@dropins/storefront-auth/src/api/getCustomerData/getCustomerData.ts","/@dropins/storefront-auth/src/api/getCustomerToken/graphql/getCustomerToken.graphql.ts","/@dropins/storefront-auth/src/api/getCustomerToken/getCustomerToken.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 { getCustomerDataResponse } from '@/auth/types';\nimport { CustomerModel } from '../models';\nimport { config } from '@/auth/api';\nimport { merge } from '@adobe-commerce/elsie/lib';\n\nexport const transformCustomerData = (\n response: getCustomerDataResponse\n): CustomerModel => {\n const model = {\n email: response?.data?.customer?.email ?? '',\n firstName: response?.data?.customer?.firstname ?? '',\n lastName: response?.data?.customer?.lastname ?? '',\n groupUid: response?.data?.customer?.group?.uid ?? '',\n };\n\n // Extend the model merging custom transformer, if provided\n return merge(\n model, // default transformer\n config?.getConfig()?.models?.CustomerModel?.transformer?.(response.data) // custom transformer\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 { CUSTOMER_INFORMATION_FRAGMENT } from '@/auth/api/fragments';\n\nexport const GET_CUSTOMER_DATA = /* GraphQL */ `\n query GET_CUSTOMER_DATA {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n ${CUSTOMER_INFORMATION_FRAGMENT}\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, setFetchGraphQlHeader, config } from '@/auth/api';\nimport { GET_CUSTOMER_DATA } from './graphql/getCustomerData.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { CustomerModel } from '@/auth/data/models';\nimport { transformCustomerData } from '@/auth/data/transforms';\n\nexport const getCustomerData = async (\n user_token: string\n): Promise<CustomerModel> => {\n if (user_token) {\n const { authHeaderConfig } = config.getConfig();\n\n setFetchGraphQlHeader(\n authHeaderConfig.header,\n authHeaderConfig.tokenPrefix\n ? `${authHeaderConfig.tokenPrefix} ${user_token}`\n : user_token\n );\n }\n\n return await fetchGraphQl(GET_CUSTOMER_DATA, {\n method: 'GET',\n cache: 'force-cache',\n })\n .then((response) => {\n return transformCustomerData(response);\n })\n .catch(handleNetworkError);\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 const GET_CUSTOMER_TOKEN = /* GraphQL */ `\n mutation GET_CUSTOMER_TOKEN($email: String!, $password: String!) {\n generateCustomerToken(email: $email, password: $password) {\n token\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 { handleNetworkError } from '@/auth/lib/network-error';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { GET_CUSTOMER_TOKEN } from './graphql/getCustomerToken.graphql';\nimport { getCustomerData } from '../getCustomerData';\nimport { InLineAlertInterface } from '@/auth/types';\nimport { events } from '@adobe-commerce/event-bus';\nimport { COOKIE_NAMES, LOCALHOST } from '@/auth/configs/cookieConfigs';\nimport { getCookiesLifetime } from '@/auth/lib/cookieUtils';\nimport { publishEvents, EventsList } from '@/auth/lib/acdl';\nimport { setReCaptchaToken } from '@/auth/lib/setReCaptchaToken';\nimport { emitAuthGroupIdEvent } from '@/auth/lib/emitAuthGroupId';\n\ninterface getCustomerTokenProps {\n email: string;\n password: string;\n handleSetInLineAlertProps: (value?: InLineAlertInterface) => void;\n translations: Record<string, string>;\n onErrorCallback?: (value?: unknown) => void;\n}\n\nexport const getCustomerToken = async ({\n email,\n password,\n translations,\n onErrorCallback,\n handleSetInLineAlertProps,\n}: getCustomerTokenProps): Promise<{\n errorMessage: string;\n userName: string;\n userEmail: string;\n}> => {\n await setReCaptchaToken();\n\n const response = await fetchGraphQl(GET_CUSTOMER_TOKEN, {\n method: 'POST',\n variables: { email, password },\n }).catch(handleNetworkError);\n\n if (!response?.data?.generateCustomerToken?.token) {\n // Fallback error message\n const defaultErrorMessage = translations.customerTokenErrorMessage;\n const errorMessage = response?.errors\n ? response.errors[0].message\n : defaultErrorMessage;\n\n onErrorCallback?.(errorMessage);\n handleSetInLineAlertProps?.({ type: 'error', text: errorMessage });\n\n return { errorMessage, userName: '', userEmail: '' };\n }\n\n const userToken = response?.data?.generateCustomerToken?.token;\n\n const responseCustomer = await getCustomerData(userToken);\n const userName = responseCustomer?.firstName;\n const userEmail = responseCustomer?.email;\n\n if (!userName || !userEmail) {\n const errorMessage = translations.customerTokenErrorMessage;\n\n onErrorCallback?.(errorMessage);\n handleSetInLineAlertProps?.({ type: 'error', text: errorMessage });\n\n return { errorMessage, userName: '', userEmail: '' };\n }\n\n const cookiesLifetime = await getCookiesLifetime();\n\n // Do not set 'Secure' flag on auth cookies when running on localhost (fix for Safari browser)\n const cookieSecureFlag: string | null = LOCALHOST.includes(window.location.hostname) ? '' : 'Secure';\n\n document.cookie = `${COOKIE_NAMES.auth_dropin_firstname}=${userName}; path=/; ${cookiesLifetime}; ${cookieSecureFlag};`;\n document.cookie = `${COOKIE_NAMES.auth_dropin_user_token}=${userToken}; path=/; ${cookiesLifetime}; ${cookieSecureFlag};`;\n\n await emitAuthGroupIdEvent(userToken ? responseCustomer?.groupUid : undefined);\n events.emit('authenticated', !!userToken);\n\n publishEvents(EventsList?.SIGN_IN, { ...responseCustomer });\n\n return { errorMessage: '', userName, userEmail };\n};\n"],"names":["transformCustomerData","response","model","_b","_a","_d","_c","_f","_e","_i","_h","_g","merge","_n","_m","_l","_k","_j","config","GET_CUSTOMER_DATA","CUSTOMER_INFORMATION_FRAGMENT","getCustomerData","user_token","authHeaderConfig","setFetchGraphQlHeader","fetchGraphQl","handleNetworkError","GET_CUSTOMER_TOKEN","getCustomerToken","email","password","translations","onErrorCallback","handleSetInLineAlertProps","setReCaptchaToken","defaultErrorMessage","errorMessage","userToken","responseCustomer","userName","userEmail","cookiesLifetime","getCookiesLifetime","cookieSecureFlag","LOCALHOST","COOKIE_NAMES","emitAuthGroupIdEvent","events","publishEvents","EventsList"],"mappings":"+ZAsBO,MAAMA,EACXC,GACkB,iCAClB,MAAMC,EAAQ,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