@dropins/storefront-auth 3.3.0-alpha-20260519102316 → 3.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -5
- package/api/createCustomer/graphql/createCustomer.graphql.d.ts +1 -1
- package/api/createCustomer/graphql/createCustomerV2.graphql.d.ts +1 -1
- package/api/getCustomerData/graphql/getCustomerData.graphql.d.ts +1 -1
- package/api/getStoreConfig/graphql/getStoreConfig.graphql.d.ts +1 -1
- package/api/graphql/CustomerFragment.graphql.d.ts +1 -1
- package/api.js +179 -1
- package/api.js.map +1 -1
- package/chunks/components.js +4 -0
- package/chunks/components.js.map +1 -0
- package/components/index.d.ts +0 -1
- package/configs/cookieConfigs.d.ts +0 -2
- package/containers/AuthCombine.js +1 -1
- package/containers/AuthCombine.js.map +1 -1
- package/containers/ResetPassword.js +1 -1
- package/containers/ResetPassword.js.map +1 -1
- package/containers/SignIn.js +1 -1
- package/containers/SignIn.js.map +1 -1
- package/containers/SignUp.js +1 -1
- package/containers/SignUp.js.map +1 -1
- package/containers/SuccessNotification.js +1 -1
- package/containers/SuccessNotification.js.map +1 -1
- package/containers/UpdatePassword.js +1 -1
- package/containers/UpdatePassword.js.map +1 -1
- package/data/models/customer-data.d.ts +0 -1
- package/data/models/store-config.d.ts +0 -4
- package/fragments.js +1 -12
- package/fragments.js.map +1 -1
- package/hooks/api/useGetStoreConfigs.d.ts +0 -5
- package/i18n/en_US.json.d.ts +0 -2
- package/package.json +1 -1
- package/render.js +2 -2
- package/render.js.map +1 -1
- package/types/api/getCustomerData.types.d.ts +0 -1
- package/types/api/storeConfig.types.d.ts +0 -4
- package/types/signUp.types.d.ts +2 -4
- package/chunks/Button.js +0 -4
- package/chunks/Button.js.map +0 -1
- package/chunks/RemoteShoppingAssistanceConsent.js +0 -4
- package/chunks/RemoteShoppingAssistanceConsent.js.map +0 -1
- package/chunks/RemoteShoppingAssistanceConsent2.js +0 -4
- package/chunks/RemoteShoppingAssistanceConsent2.js.map +0 -1
- package/chunks/ResetPasswordForm.js +0 -4
- package/chunks/ResetPasswordForm.js.map +0 -1
- package/chunks/SignInForm.js +0 -4
- package/chunks/SignInForm.js.map +0 -1
- package/chunks/SkeletonLoader.js +0 -4
- package/chunks/SkeletonLoader.js.map +0 -1
- package/chunks/acdl.js +0 -4
- package/chunks/acdl.js.map +0 -1
- package/chunks/confirmEmail.js +0 -14
- package/chunks/confirmEmail.js.map +0 -1
- package/chunks/createCustomerAddress.js +0 -60
- package/chunks/createCustomerAddress.js.map +0 -1
- package/chunks/focusOnEmptyPasswordField.js +0 -4
- package/chunks/focusOnEmptyPasswordField.js.map +0 -1
- package/chunks/getAdobeCommerceOptimizerData.js +0 -70
- package/chunks/getAdobeCommerceOptimizerData.js.map +0 -1
- package/chunks/getCustomerToken.js +0 -17
- package/chunks/getCustomerToken.js.map +0 -1
- package/chunks/index.js +0 -4
- package/chunks/index.js.map +0 -1
- package/chunks/index2.js +0 -4
- package/chunks/index2.js.map +0 -1
- package/chunks/index3.js +0 -4
- package/chunks/index3.js.map +0 -1
- package/chunks/network-error.js +0 -4
- package/chunks/network-error.js.map +0 -1
- package/chunks/requestPasswordResetEmail.js +0 -8
- package/chunks/requestPasswordResetEmail.js.map +0 -1
- package/chunks/resendConfirmationEmail.js +0 -8
- package/chunks/resendConfirmationEmail.js.map +0 -1
- package/chunks/resetPassword.js +0 -16
- package/chunks/resetPassword.js.map +0 -1
- package/chunks/revokeCustomerToken.js +0 -11
- package/chunks/revokeCustomerToken.js.map +0 -1
- package/chunks/setReCaptchaToken.js +0 -4
- package/chunks/setReCaptchaToken.js.map +0 -1
- package/chunks/simplifyTransformAttributesForm.js +0 -4
- package/chunks/simplifyTransformAttributesForm.js.map +0 -1
- package/chunks/transform-attributes-form.js +0 -4
- package/chunks/transform-attributes-form.js.map +0 -1
- package/chunks/usePasswordValidationMessage.js +0 -4
- package/chunks/usePasswordValidationMessage.js.map +0 -1
- package/components/RemoteShoppingAssistanceConsent/RemoteShoppingAssistanceConsent.d.ts +0 -12
- package/components/RemoteShoppingAssistanceConsent/index.d.ts +0 -19
- package/lib/jwtUtils.d.ts +0 -50
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
# @dropins/storefront-auth
|
|
2
2
|
|
|
3
|
-
## 3.3.0-
|
|
3
|
+
## 3.3.0-beta.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 1703268: Upgraded Elsie package to use the 1.9.0-beta.0 version
|
|
8
|
+
|
|
9
|
+
## 3.3.0-beta.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
6
12
|
|
|
7
|
-
- 7b147c7: Cypress coverage for Seller Assisted Buying functionality
|
|
8
13
|
- 85883d0: Migrate to Node.js 24 LTS
|
|
9
14
|
|
|
10
15
|
Minimum required Node.js version is now 24. Updated engines.node from >=20 to >=24.
|
|
11
16
|
|
|
12
|
-
- b0a2eba: Introduce Seller Assisted Buying authentication flow.
|
|
13
|
-
- 366ba28: Add seller-assisted buying consent to a sign-up form
|
|
14
|
-
|
|
15
17
|
### Patch Changes
|
|
16
18
|
|
|
17
19
|
- 3cadf48: Ensure `getCustomerRolePermissions` always emits `auth/permissions` so consumers (e.g. account navigation) keep working. For non-admin customers with no granular ACL tree from GraphQL, set `Magento_Sales::place_order` so storefront checkout does not treat B2C users as denied.
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
export declare const CREATE_CUSTOMER = "\n mutation CREATE_CUSTOMER($input: CustomerInput!) {\n createCustomer(input: $input) {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n }\n \n fragment CUSTOMER_INFORMATION_FRAGMENT on Customer {\n __typename\n firstname\n lastname\n email\n
|
|
17
|
+
export declare const CREATE_CUSTOMER = "\n mutation CREATE_CUSTOMER($input: CustomerInput!) {\n createCustomer(input: $input) {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n }\n \n fragment CUSTOMER_INFORMATION_FRAGMENT on Customer {\n __typename\n firstname\n lastname\n email\n group {\n uid\n }\n }\n\n";
|
|
18
18
|
//# sourceMappingURL=createCustomer.graphql.d.ts.map
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
export declare const CREATE_CUSTOMER_V2 = "\n mutation CREATE_CUSTOMER_V2($input: CustomerCreateInput!) {\n createCustomerV2(input: $input) {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n }\n \n fragment CUSTOMER_INFORMATION_FRAGMENT on Customer {\n __typename\n firstname\n lastname\n email\n
|
|
17
|
+
export declare const CREATE_CUSTOMER_V2 = "\n mutation CREATE_CUSTOMER_V2($input: CustomerCreateInput!) {\n createCustomerV2(input: $input) {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n }\n \n fragment CUSTOMER_INFORMATION_FRAGMENT on Customer {\n __typename\n firstname\n lastname\n email\n group {\n uid\n }\n }\n\n";
|
|
18
18
|
//# sourceMappingURL=createCustomerV2.graphql.d.ts.map
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
export declare const GET_CUSTOMER_DATA = "\n query GET_CUSTOMER_DATA {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n \n fragment CUSTOMER_INFORMATION_FRAGMENT on Customer {\n __typename\n firstname\n lastname\n email\n
|
|
17
|
+
export declare const GET_CUSTOMER_DATA = "\n query GET_CUSTOMER_DATA {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n \n fragment CUSTOMER_INFORMATION_FRAGMENT on Customer {\n __typename\n firstname\n lastname\n email\n group {\n uid\n }\n }\n\n";
|
|
18
18
|
//# sourceMappingURL=getCustomerData.graphql.d.ts.map
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
export declare const GET_STORE_CONFIG = "\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
|
|
17
|
+
export declare const GET_STORE_CONFIG = "\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";
|
|
18
18
|
//# sourceMappingURL=getStoreConfig.graphql.d.ts.map
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
export declare const CUSTOMER_INFORMATION_FRAGMENT = "\n fragment CUSTOMER_INFORMATION_FRAGMENT on Customer {\n __typename\n firstname\n lastname\n email\n
|
|
17
|
+
export declare const CUSTOMER_INFORMATION_FRAGMENT = "\n fragment CUSTOMER_INFORMATION_FRAGMENT on Customer {\n __typename\n firstname\n lastname\n email\n group {\n uid\n }\n }\n";
|
|
18
18
|
//# sourceMappingURL=CustomerFragment.graphql.d.ts.map
|
package/api.js
CHANGED
|
@@ -1,4 +1,182 @@
|
|
|
1
1
|
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{
|
|
3
|
+
import{events as h}from"@dropins/tools/event-bus.js";import{verifyReCaptcha as Y}from"@dropins/tools/recaptcha.js";import{FetchGraphQL as tt}from"@dropins/tools/fetch-graphql.js";import{Initializer as et,Config as rt,merge as z}from"@dropins/tools/lib.js";const R={auth_dropin_user_token:"auth_dropin_user_token",auth_dropin_firstname:"auth_dropin_firstname"},ot=["localhost","127.0.0.1","::1"],b=3600,B=t=>{const e=document.cookie.split(";");let r;return e.forEach(o=>{const[a,i]=o.trim().split("=");a===t&&(r=decodeURIComponent(i))}),r},K=t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`},at=async()=>{try{const t=sessionStorage.getItem("storeConfig");let r=(t?JSON.parse(t):{}).customerAccessTokenLifetime;if(!r){const o=await bt();sessionStorage.setItem("storeConfig",JSON.stringify(o)),r=(o==null?void 0:o.customerAccessTokenLifetime)||b}return`Max-Age=${r}`}catch(t){return console.error("getCookiesLifetime() Error:",t),`Max-Age=${b}`}},P=new rt(void 0),$=new et({init:async t=>{const r={...{authHeaderConfig:{header:"Authorization",tokenPrefix:"Bearer"},customerPermissionRoles:!1,adobeCommerceOptimizer:!1},...t};$.config.setConfig(r);const o=B(R.auth_dropin_user_token),[a]=await Promise.all([Z(r.authHeaderConfig.header,r.authHeaderConfig.tokenPrefix),r.customerPermissionRoles&&o?q():Promise.resolve(),r.adobeCommerceOptimizer?H():Promise.resolve()]);P.setConfig(a)},listeners:()=>[h.on("authenticated",t=>{const e=P.getConfig();if(e!==void 0&&t!==e){P.setConfig(t);const{customerPermissionRoles:r,adobeCommerceOptimizer:o}=$.config.getConfig();r&&q(),o&&H()}})]}),S=$.config,{setEndpoint:Xt,setFetchGraphQlHeader:v,removeFetchGraphQlHeader:V,setFetchGraphQlHeaders:Zt,fetchGraphQl:d,getConfig:Yt}=new tt().getMethods(),D=`
|
|
4
|
+
fragment CUSTOMER_INFORMATION_FRAGMENT on Customer {
|
|
5
|
+
__typename
|
|
6
|
+
firstname
|
|
7
|
+
lastname
|
|
8
|
+
email
|
|
9
|
+
group {
|
|
10
|
+
uid
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`,nt=`
|
|
14
|
+
mutation CREATE_CUSTOMER($input: CustomerInput!) {
|
|
15
|
+
createCustomer(input: $input) {
|
|
16
|
+
customer {
|
|
17
|
+
...CUSTOMER_INFORMATION_FRAGMENT
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
${D}
|
|
22
|
+
`,it=`
|
|
23
|
+
mutation CREATE_CUSTOMER_V2($input: CustomerCreateInput!) {
|
|
24
|
+
createCustomerV2(input: $input) {
|
|
25
|
+
customer {
|
|
26
|
+
...CUSTOMER_INFORMATION_FRAGMENT
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
${D}
|
|
31
|
+
`,E=t=>{throw t instanceof DOMException&&t.name==="AbortError"||h.emit("auth/error",{source:"auth",type:"network",error:t}),t},k=async()=>{const t=await Y();t&&v("X-ReCaptcha",t)},Q=t=>({firstName:t.firstName,lastName:t.lastName,emailAddress:(t==null?void 0:t.email)||"",accountId:(t==null?void 0:t.email)||""}),ct=t=>{var e,r,o,a,i,n,u,c,m,_;return{autocompleteOnStorefront:((r=(e=t==null?void 0:t.data)==null?void 0:e.storeConfig)==null?void 0:r.autocomplete_on_storefront)||!1,minLength:((a=(o=t==null?void 0:t.data)==null?void 0:o.storeConfig)==null?void 0:a.minimum_password_length)||3,requiredCharacterClasses:+((n=(i=t==null?void 0:t.data)==null?void 0:i.storeConfig)==null?void 0:n.required_character_classes_number)||0,createAccountConfirmation:((c=(u=t==null?void 0:t.data)==null?void 0:u.storeConfig)==null?void 0:c.create_account_confirmation)||!1,customerAccessTokenLifetime:((_=(m=t==null?void 0:t.data)==null?void 0:m.storeConfig)==null?void 0:_.customer_access_token_lifetime)*b||b}},st=t=>{var r,o,a;let e="";return(r=t==null?void 0:t.errors)!=null&&r.length&&(e=(o=t==null?void 0:t.errors[0])==null?void 0:o.message),{message:e,success:!!((a=t==null?void 0:t.data)!=null&&a.requestPasswordResetEmail)}},ut=t=>{var r,o,a;let e="";return(r=t==null?void 0:t.errors)!=null&&r.length&&(e=((o=t==null?void 0:t.errors[0])==null?void 0:o.message)||"Unknown error"),{message:e,success:!!((a=t==null?void 0:t.data)!=null&&a.revokeCustomerToken)}},mt=t=>{var r,o,a,i,n,u,c,m,_,f,l,g,O;const e={email:((o=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:o.email)??"",firstName:((i=(a=t==null?void 0:t.data)==null?void 0:a.customer)==null?void 0:i.firstname)??"",lastName:((u=(n=t==null?void 0:t.data)==null?void 0:n.customer)==null?void 0:u.lastname)??"",groupUid:((_=(m=(c=t==null?void 0:t.data)==null?void 0:c.customer)==null?void 0:m.group)==null?void 0:_.uid)??""};return z(e,(O=(g=(l=(f=S==null?void 0:S.getConfig())==null?void 0:f.models)==null?void 0:l.CustomerModel)==null?void 0:g.transformer)==null?void 0:O.call(g,t.data))},j=t=>t.replace(/_([a-z])/g,(e,r)=>r.toUpperCase()),_t=t=>t.replace(/([A-Z])/g,e=>`_${e.toLowerCase()}`),U=(t,e,r)=>{const o=["string","boolean","number"],a=e==="camelCase"?j:_t;return Array.isArray(t)?t.map(i=>o.includes(typeof i)||i===null?i:typeof i=="object"?U(i,e,r):i):t!==null&&typeof t=="object"?Object.entries(t).reduce((i,[n,u])=>{const c=r&&r[n]?r[n]:a(n);return i[c]=o.includes(typeof u)||u===null?u:U(u,e,r),i},{}):t},dt=t=>{let e=[];for(const r of t)if(!(r.frontend_input!=="MULTILINE"||r.multiline_count<2))for(let o=2;o<=r.multiline_count;o++){const a={...r,is_required:!1,name:`${r.code}_multiline_${o}`,code:`${r.code}_multiline_${o}`,id:`${r.code}_multiline_${o}`};e.push(a)}return e},lt=t=>{var i,n,u;const e=((n=(i=t==null?void 0:t.data)==null?void 0:i.attributesForm)==null?void 0:n.items)||[];if(!e.length)return[];const r=(u=e.filter(c=>{var m;return!((m=c.frontend_input)!=null&&m.includes("HIDDEN"))}))==null?void 0:u.map(({code:c,...m})=>{const _=c!=="country_id"?c:"country_code";return{...m,name:_,id:_,code:_}}),o=dt(r);return r.concat(o).map(c=>{var f;const m=c.code==="firstname"?"firstName":c.code==="lastname"?"lastName":j(c.code),_=(f=c.options)==null?void 0:f.map(l=>({isDefault:l.is_default,text:l.label,value:l.value}));return U({...c,options:_,customUpperCode:m},"camelCase",{frontend_input:"fieldType",frontend_class:"className",is_required:"required",sort_order:"orderNumber"})}).sort((c,m)=>c.orderNumber-m.orderNumber)},ft=(t,e)=>{var o,a,i,n,u,c,m,_,f,l,g,O,N,M,C,T;let r;if(e){const{data:s}=t;r={firstName:((a=(o=s==null?void 0:s.createCustomerV2)==null?void 0:o.customer)==null?void 0:a.firstname)??"",lastName:((n=(i=s==null?void 0:s.createCustomerV2)==null?void 0:i.customer)==null?void 0:n.lastname)??"",email:((c=(u=s==null?void 0:s.createCustomerV2)==null?void 0:u.customer)==null?void 0:c.email)??"",customAttributes:((m=s==null?void 0:s.createCustomerV2)==null?void 0:m.custom_attributes)??[],errors:(t==null?void 0:t.errors)??[]}}else{const{data:s}=t;r={firstName:((f=(_=s==null?void 0:s.createCustomer)==null?void 0:_.customer)==null?void 0:f.firstname)??"",lastName:((g=(l=s==null?void 0:s.createCustomer)==null?void 0:l.customer)==null?void 0:g.lastname)??"",email:((N=(O=s==null?void 0:s.createCustomer)==null?void 0:O.customer)==null?void 0:N.email)??"",errors:(t==null?void 0:t.errors)??[]}}return z(r,(T=(C=(M=S.getConfig().models)==null?void 0:M.CustomerModel)==null?void 0:C.transformer)==null?void 0:T.call(C,t))},ht=t=>{var e,r;return{priceBookId:((r=(e=t==null?void 0:t.data)==null?void 0:e.commerceOptimizer)==null?void 0:r.priceBookId)||""}},Et=t=>{if(!t.dob)return t;const{dob:e,...r}=t;return{...r,date_of_birth:e}},te=async(t,e)=>{await k();const r=await d(e?it:nt,{method:"POST",variables:{input:{...Et(t)}}}).catch(E);return ft(r,e)},gt=`
|
|
32
|
+
query GET_ATTRIBUTES_FORM($formCode: String!) {
|
|
33
|
+
attributesForm(formCode: $formCode) {
|
|
34
|
+
items {
|
|
35
|
+
code
|
|
36
|
+
default_value
|
|
37
|
+
entity_type
|
|
38
|
+
frontend_class
|
|
39
|
+
frontend_input
|
|
40
|
+
is_required
|
|
41
|
+
is_unique
|
|
42
|
+
label
|
|
43
|
+
options {
|
|
44
|
+
is_default
|
|
45
|
+
label
|
|
46
|
+
value
|
|
47
|
+
}
|
|
48
|
+
... on CustomerAttributeMetadata {
|
|
49
|
+
multiline_count
|
|
50
|
+
sort_order
|
|
51
|
+
validate_rules {
|
|
52
|
+
name
|
|
53
|
+
value
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
errors {
|
|
58
|
+
type
|
|
59
|
+
message
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
`,G=t=>{const e=t.map(r=>r.message).join(" ");throw Error(e)},ee=async t=>await d(gt,{method:"GET",cache:"force-cache",variables:{formCode:t}}).then(e=>{var r;return(r=e.errors)!=null&&r.length?G(e.errors):lt(e)}).catch(E),Ct=`
|
|
64
|
+
query GET_CUSTOMER_DATA {
|
|
65
|
+
customer {
|
|
66
|
+
...CUSTOMER_INFORMATION_FRAGMENT
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
${D}
|
|
70
|
+
`,Tt=async t=>{if(t){const{authHeaderConfig:e}=S.getConfig();v(e.header,e.tokenPrefix?`${e.tokenPrefix} ${t}`:t)}return await d(Ct,{method:"GET",cache:"force-cache"}).then(e=>mt(e)).catch(E)},Ot=`
|
|
71
|
+
mutation GET_CUSTOMER_TOKEN($email: String!, $password: String!) {
|
|
72
|
+
generateCustomerToken(email: $email, password: $password) {
|
|
73
|
+
token
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
`,J="accountContext",Rt="channelContext";var w=(t=>(t.CREATE_ACCOUNT_EVENT="create-account",t.SIGN_IN="sign-in",t.SIGN_OUT="sign-out",t))(w||{});const F={CREATE_ACCOUNT:"create-account",SIGN_IN:"sign-in",SIGN_OUT:"sign-out"};function W(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function x(t,e){const r=W();r.push({[t]:null}),r.push({[t]:e})}function St(){x(Rt,{_id:"https://ns.adobe.com/xdm/channels/web",_type:"https://ns.adobe.com/xdm/channel-types/web"})}function L(t,e){W().push(o=>{const a=o.getState?o.getState():{};o.push({event:t,eventInfo:{...a,...e}})})}function At(t){const e=Q(t);x(J,e),L(F.CREATE_ACCOUNT)}function Nt(t){const e=Q(t);x(J,e),L(F.SIGN_IN)}function Mt(){L(F.SIGN_OUT)}const X=(t,e)=>{const r=sessionStorage.getItem("storeConfig"),a={...r?JSON.parse(r):{},...e};switch(St(),t){case"create-account":At(a);break;case"sign-in":Nt(a);break;case"sign-out":Mt();break;default:return null}},wt=async t=>{if(!t||t.trim()==="")return"";try{const e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);const o=await crypto.subtle.digest("SHA-1",r);return Array.from(new Uint8Array(o)).map(n=>n.toString(16).padStart(2,"0")).join("")}catch(e){return console.error(`Failed to convert base64 to SHA1: ${e instanceof Error?e.message:"Unknown error"}`),""}},yt="b6589fc6ab0dc82cf12099d1c2d40ab994e8410c",y=async t=>{const e=t?await wt(t):yt;h.emit("auth/group-uid",e)},re=async({email:t,password:e,translations:r,onErrorCallback:o,handleSetInLineAlertProps:a,apiErrorMessageOverride:i})=>{var g,O,N,M;await k();const n=await d(Ot,{method:"POST",variables:{email:t,password:e}}).catch(E);if(!((O=(g=n==null?void 0:n.data)==null?void 0:g.generateCustomerToken)!=null&&O.token)){const C=r.customerTokenErrorMessage,T=n!=null&&n.errors?n.errors[0].message:C,s=i??T;return o==null||o(T),a==null||a({type:"error",text:s}),{errorMessage:T,displayErrorMessage:s,userName:"",userEmail:""}}const u=(M=(N=n==null?void 0:n.data)==null?void 0:N.generateCustomerToken)==null?void 0:M.token,c=await Tt(u),m=c==null?void 0:c.firstName,_=c==null?void 0:c.email;if(!m||!_){const C=r.customerTokenErrorMessage,T=i??C;return o==null||o(C),a==null||a({type:"error",text:T}),{errorMessage:C,displayErrorMessage:T,userName:"",userEmail:""}}const f=await at(),l=ot.includes(window.location.hostname)?"":"Secure";return document.cookie=`${R.auth_dropin_firstname}=${m}; path=/; ${f}; ${l};`,document.cookie=`${R.auth_dropin_user_token}=${u}; path=/; ${f}; ${l};`,await y(u?c==null?void 0:c.groupUid:void 0),h.emit("authenticated",!!u),X(w==null?void 0:w.SIGN_IN,{...c}),{errorMessage:"",displayErrorMessage:"",userName:m,userEmail:_}},It=`
|
|
77
|
+
query GET_STORE_CONFIG {
|
|
78
|
+
storeConfig {
|
|
79
|
+
autocomplete_on_storefront
|
|
80
|
+
minimum_password_length
|
|
81
|
+
required_character_classes_number
|
|
82
|
+
store_code
|
|
83
|
+
store_name
|
|
84
|
+
store_group_code
|
|
85
|
+
locale
|
|
86
|
+
create_account_confirmation
|
|
87
|
+
customer_access_token_lifetime
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
`,bt=async()=>await d(It,{method:"GET",cache:"force-cache"}).then(t=>{var e;return(e=t.errors)!=null&&e.length?G(t.errors):ct(t)}).catch(E),kt=`
|
|
91
|
+
mutation REQUEST_PASSWORD_RESET_EMAIL($email: String!) {
|
|
92
|
+
requestPasswordResetEmail(email: $email)
|
|
93
|
+
}
|
|
94
|
+
`,oe=async t=>(await k(),await d(kt,{method:"POST",variables:{email:t}}).then(e=>st(e)).catch(E)),Pt=`
|
|
95
|
+
mutation RESET_PASSWORD(
|
|
96
|
+
$email: String!
|
|
97
|
+
$resetPasswordToken: String!
|
|
98
|
+
$newPassword: String!
|
|
99
|
+
) {
|
|
100
|
+
resetPassword(
|
|
101
|
+
email: $email
|
|
102
|
+
resetPasswordToken: $resetPasswordToken
|
|
103
|
+
newPassword: $newPassword
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
`,$t=t=>{var r,o,a;let e="";return(r=t==null?void 0:t.errors)!=null&&r.length&&(e=(o=t==null?void 0:t.errors[0])==null?void 0:o.message),{message:e,success:!!((a=t==null?void 0:t.data)!=null&&a.resetPassword)}},ae=async(t,e,r)=>(await k(),await d(Pt,{method:"POST",variables:{email:t,resetPasswordToken:e,newPassword:r}}).then(o=>$t(o)).catch(E)),Ut=`
|
|
107
|
+
mutation REVOKE_CUSTOMER_TOKEN {
|
|
108
|
+
revokeCustomerToken {
|
|
109
|
+
result
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
`,vt=`
|
|
113
|
+
query VALIDATE_TOKEN {
|
|
114
|
+
customer {
|
|
115
|
+
group {
|
|
116
|
+
uid
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
`,Z=async(t="Authorization",e="Bearer")=>{const r=B(R.auth_dropin_user_token);return r?(v(t,`${e} ${r}`),d(vt).then(async o=>{var i,n,u,c;return!((i=o.errors)!=null&&i.find(m=>{var _;return((_=m.extensions)==null?void 0:_.category)==="graphql-authentication"}))?(await y((c=(u=(n=o.data)==null?void 0:n.customer)==null?void 0:u.group)==null?void 0:c.uid),h.emit("authenticated",!0),!0):(K(R.auth_dropin_user_token),V(t),await y(),h.emit("authenticated",!1),!1)})):(await y(),h.emit("authenticated",!1),!1)},ne=async()=>{const{authHeaderConfig:t}=S.getConfig();return await d(Ut,{method:"POST"}).then(async e=>{const r=ut(e);if(r!=null&&r.success)[R.auth_dropin_user_token,R.auth_dropin_firstname].forEach(o=>{K(o)}),V(t.header),await y(),h.emit("authenticated",!1),X(w.SIGN_OUT,{});else{const o=`
|
|
121
|
+
ERROR revokeCustomerToken: ${r.message}`;console.error(o),Z()}return r}).catch(E)},Dt=`
|
|
122
|
+
mutation CONFIRM_EMAIL($email: String!, $confirmation_key: String!) {
|
|
123
|
+
confirmEmail(
|
|
124
|
+
input: { email: $email, confirmation_key: $confirmation_key }
|
|
125
|
+
) {
|
|
126
|
+
customer {
|
|
127
|
+
email
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
`,ie=async({customerEmail:t,customerConfirmationKey:e})=>await d(Dt,{method:"POST",variables:{email:t,confirmation_key:e}}).catch(E),Gt=`
|
|
132
|
+
mutation RESEND_CONFIRMATION_EMAIL($email: String!) {
|
|
133
|
+
resendConfirmationEmail(email: $email)
|
|
134
|
+
}
|
|
135
|
+
`,ce=async t=>await d(Gt,{method:"POST",variables:{email:t}}).catch(E),Ft=`
|
|
136
|
+
mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {
|
|
137
|
+
createCustomerAddress(input: $input) {
|
|
138
|
+
firstname
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
`,se=async t=>await d(Ft,{method:"POST",variables:{input:t}}).then(e=>{var r;return(r=e.errors)!=null&&r.length?G(e.errors):e.data.createCustomerAddress.firstname||""}).catch(E),xt=`
|
|
142
|
+
query GET_CUSTOMER_ROLE_PERMISSIONS {
|
|
143
|
+
customer {
|
|
144
|
+
purchase_orders_enabled
|
|
145
|
+
role {
|
|
146
|
+
id
|
|
147
|
+
name
|
|
148
|
+
permissions {
|
|
149
|
+
id
|
|
150
|
+
text
|
|
151
|
+
children {
|
|
152
|
+
id
|
|
153
|
+
text
|
|
154
|
+
children {
|
|
155
|
+
id
|
|
156
|
+
text
|
|
157
|
+
children {
|
|
158
|
+
id
|
|
159
|
+
text
|
|
160
|
+
children {
|
|
161
|
+
id
|
|
162
|
+
text
|
|
163
|
+
children {
|
|
164
|
+
id
|
|
165
|
+
text
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
`;let I=null,A=null;const Lt=t=>{const e={},r=o=>{o.forEach(a=>{var i;e[a.id]=!0,(i=a.children)!=null&&i.length&&r(a.children)})};return r(t),e},pt=["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"],p="Magento_Sales::place_order",qt=t=>(t==null?void 0:t.id)==="MA=="&&Array.isArray(t.permissions)&&t.permissions.length===0,Ht=t=>{var e;return(e=t==null?void 0:t.permissions)!=null&&e.length?Lt(t.permissions):{}},zt=(t,e)=>{if(e===!0)return t;const r={...t};return pt.forEach(o=>{r[o]=!1}),r},Bt=(t,e)=>{const r=qt(t),o=Ht(t),a=zt(o,e),n={...{all:!0,...r&&{admin:!0}},...a};return!r&&n[p]===void 0&&Object.keys(o).length===0&&(n[p]=!0),n},Kt=async()=>{var t,e,r,o;try{const a=await d(xt,{method:"GET"}),i=Bt((e=(t=a.data)==null?void 0:t.customer)==null?void 0:e.role,(o=(r=a.data)==null?void 0:r.customer)==null?void 0:o.purchase_orders_enabled);return I=i,A=null,i}catch(a){throw A=null,a}},q=()=>I?(h.emit("auth/permissions",I),Promise.resolve(I)):(A||(A=Kt().then(t=>(h.emit("auth/permissions",t),t))),A),ue=()=>{I=null,A=null},Vt=`
|
|
176
|
+
query GET_ADOBE_COMMERCE_OPTIMIZER_DATA {
|
|
177
|
+
commerceOptimizer {
|
|
178
|
+
priceBookId
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
`,H=async()=>{const t=await d(Vt,{method:"GET"}),e=ht(t);return h.emit("auth/adobe-commerce-optimizer",e),e};export{D as C,w as E,ue as _resetCache,U as c,S as config,ie as confirmEmail,te as createCustomer,se as createCustomerAddress,d as fetchGraphQl,H as getAdobeCommerceOptimizerData,ee as getAttributesForm,Yt as getConfig,Tt as getCustomerData,q as getCustomerRolePermissions,re as getCustomerToken,bt as getStoreConfig,$ as initialize,X as p,V as removeFetchGraphQlHeader,oe as requestPasswordResetEmail,ce as resendConfirmationEmail,ae as resetPassword,ne as revokeCustomerToken,Xt as setEndpoint,v as setFetchGraphQlHeader,Zt as setFetchGraphQlHeaders,lt as t,Z as verifyToken};
|
|
4
182
|
//# sourceMappingURL=api.js.map
|
package/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"api.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/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-auth/src/api/graphql/CustomerFragment.graphql.ts","/@dropins/storefront-auth/src/api/createCustomer/graphql/createCustomer.graphql.ts","/@dropins/storefront-auth/src/api/createCustomer/graphql/createCustomerV2.graphql.ts","/@dropins/storefront-auth/src/lib/network-error.ts","/@dropins/storefront-auth/src/lib/setReCaptchaToken.ts","/@dropins/storefront-auth/src/data/transforms/transform-auth.ts","/@dropins/storefront-auth/src/data/transforms/transform-store-config.ts","/@dropins/storefront-auth/src/data/transforms/transform-password-reset-email.ts","/@dropins/storefront-auth/src/data/transforms/transform-revoke-customer-token.ts","/@dropins/storefront-auth/src/data/transforms/transform-customer-data.ts","/@dropins/storefront-auth/src/lib/convertCase.ts","/@dropins/storefront-auth/src/data/transforms/transform-attributes-form.ts","/@dropins/storefront-auth/src/data/transforms/transform-create-customer.tsx","/@dropins/storefront-auth/src/data/transforms/transform-adobe-commerce-optimizer.ts","/@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/lib/fetch-error.ts","/@dropins/storefront-auth/src/api/getAttributesForm/getAttributesForm.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/lib/acdl.ts","/@dropins/storefront-auth/src/lib/base64ToSha1.ts","/@dropins/storefront-auth/src/lib/emitAuthGroupId.ts","/@dropins/storefront-auth/src/api/getCustomerToken/getCustomerToken.ts","/@dropins/storefront-auth/src/api/getStoreConfig/graphql/getStoreConfig.graphql.ts","/@dropins/storefront-auth/src/api/getStoreConfig/getStoreConfig.ts","/@dropins/storefront-auth/src/api/requestPasswordResetEmail/graphql/requestPasswordResetEmail.graphql.ts","/@dropins/storefront-auth/src/api/requestPasswordResetEmail/requestPasswordResetEmail.ts","/@dropins/storefront-auth/src/api/resetPassword/graphql/resetPassword.graphql.ts","/@dropins/storefront-auth/src/data/transforms/transform-reset-password.ts","/@dropins/storefront-auth/src/api/resetPassword/resetPassword.ts","/@dropins/storefront-auth/src/api/revokeCustomerToken/graphql/revokeCustomerToken.graphql.ts","/@dropins/storefront-auth/src/api/verifyToken/graphql/verifyToken.graphql.ts","/@dropins/storefront-auth/src/api/verifyToken/verifyToken.ts","/@dropins/storefront-auth/src/api/revokeCustomerToken/revokeCustomerToken.ts","/@dropins/storefront-auth/src/api/confirmEmail/graphql/confirmEmail.graphql.ts","/@dropins/storefront-auth/src/api/confirmEmail/confirmEmail.ts","/@dropins/storefront-auth/src/api/resendConfirmationEmail/graphql/resendConfirmationEmail.graphql.ts","/@dropins/storefront-auth/src/api/resendConfirmationEmail/resendConfirmationEmail.ts","/@dropins/storefront-auth/src/api/createCustomerAddress/graphql/createCustomerAddress.graphql.ts","/@dropins/storefront-auth/src/api/createCustomerAddress/createCustomerAddress.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 { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n","/********************************************************************\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 CUSTOMER_INFORMATION_FRAGMENT = /* GraphQL */ `\n fragment CUSTOMER_INFORMATION_FRAGMENT on Customer {\n __typename\n firstname\n lastname\n email\n group {\n uid\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 { 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 { events } from '@adobe-commerce/event-bus';\n\n/**\n * A function which can be attached to fetchGraphQL to handle thrown errors in\n * a generic way.\n */\nexport const handleNetworkError = (error: Error) => {\n const isAbortError =\n error instanceof DOMException && error.name === 'AbortError';\n\n if (!isAbortError) {\n events.emit('auth/error', {\n source: 'auth',\n type: 'network',\n error,\n });\n }\n throw error;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { verifyReCaptcha } from '@adobe-commerce/recaptcha';\nimport { setFetchGraphQlHeader } from '../api';\n\nexport const setReCaptchaToken = async () => {\n const token = await verifyReCaptcha();\n\n if (token) {\n setFetchGraphQlHeader('X-ReCaptcha', token);\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 { AccountModel, CustomerModel } from '@/auth/data/models';\n\n/**\n * References:\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/signInAEP.ts\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/createAccountAEP.ts\n */\nexport const transformAccount = (data: CustomerModel): AccountModel => {\n return {\n firstName: data.firstName,\n lastName: data.lastName,\n emailAddress: data?.email || '',\n accountId: data?.email || '',\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 { 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 * 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 { PasswordResetEmailResponse } from '@/auth/types';\nimport { PasswordResetEmailModel } from '../models';\n\nexport const transformPasswordResetEmail = (\n response: PasswordResetEmailResponse\n): PasswordResetEmailModel => {\n let message: string = '';\n\n if (response?.errors?.length)\n message = response?.errors[0]?.message as unknown as string;\n\n return {\n message,\n success: Boolean(response?.data?.requestPasswordResetEmail),\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 { RevokeCustomerTokenResponse } from '@/auth/types/api/revokeCustomerToken.types';\nimport { RevokeCustomerTokenModel } from '../models';\n\nexport const transformRevokeCustomerToken = (\n response: RevokeCustomerTokenResponse\n): RevokeCustomerTokenModel => {\n let message: string = '';\n\n if (response?.errors?.length)\n message =\n (response?.errors[0]?.message as unknown as string) || 'Unknown error';\n\n return {\n message,\n success: Boolean(response?.data?.revokeCustomerToken),\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 { 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\nexport const convertToCamelCase = (key: string): string => {\n return key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());\n};\n\nexport const convertToSnakeCase = (key: string): string => {\n return key.replace(/([A-Z])/g, (letter) => `_${letter.toLowerCase()}`);\n};\n\nexport const convertKeysCase = (\n data: any,\n type: 'snakeCase' | 'camelCase',\n dictionary?: Record<string, string>\n): any => {\n const typeList = ['string', 'boolean', 'number'];\n const callback =\n type === 'camelCase' ? convertToCamelCase : convertToSnakeCase;\n\n if (Array.isArray(data)) {\n return data.map((element) => {\n if (typeList.includes(typeof element) || element === null) return element;\n\n if (typeof element === 'object') {\n return convertKeysCase(element, type, dictionary);\n }\n return element;\n });\n }\n\n if (data !== null && typeof data === 'object') {\n return Object.entries(data).reduce((acc, [key, value]) => {\n const newKey =\n dictionary && dictionary[key] ? dictionary[key] : callback(key);\n acc[newKey] =\n typeList.includes(typeof value) || value === null\n ? value\n : convertKeysCase(value, type, dictionary);\n return acc;\n }, {} as Record<string, unknown>);\n }\n\n return data;\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 {\n GetAttributesFormResponse,\n ResponseAttributesFormItemsProps,\n} from '@/auth/types';\nimport { AttributesFormModel } from '../models';\nimport { convertKeysCase, convertToCamelCase } from '@/auth/lib/convertCase';\n\nexport const cloneArrayIfExists = (\n fields: ResponseAttributesFormItemsProps[]\n) => {\n let multilineItems: any = [];\n\n for (const element of fields) {\n if (element.frontend_input !== 'MULTILINE' || element.multiline_count < 2) {\n continue;\n }\n\n for (let i = 2; i <= element.multiline_count; i++) {\n const newItem = {\n ...element,\n is_required: false,\n name: `${element.code}_multiline_${i}`,\n code: `${element.code}_multiline_${i}`,\n id: `${element.code}_multiline_${i}`,\n };\n\n multilineItems.push(newItem);\n }\n }\n\n return multilineItems;\n};\n\nexport const transformAttributesForm = (\n response: GetAttributesFormResponse\n): AttributesFormModel[] => {\n const items = response?.data?.attributesForm?.items || [];\n\n if (!items.length) return [];\n\n const fields = items\n .filter((el) => !el.frontend_input?.includes('HIDDEN'))\n ?.map(({ code, ...other }) => {\n const isDefaultCode = code !== 'country_id' ? code : 'country_code';\n\n return {\n ...other,\n name: isDefaultCode,\n id: isDefaultCode,\n code: isDefaultCode,\n };\n });\n\n const multilineItems = cloneArrayIfExists(fields as any);\n\n const attributesConfig = fields\n .concat(multilineItems)\n .map((item) => {\n const customUpperCode =\n item.code === 'firstname'\n ? 'firstName'\n : item.code === 'lastname'\n ? 'lastName'\n : convertToCamelCase(item.code);\n\n const options = item.options?.map((el) => {\n return {\n isDefault: el.is_default,\n text: el.label,\n value: el.value,\n };\n });\n\n return convertKeysCase(\n { ...item, options, customUpperCode },\n 'camelCase',\n {\n frontend_input: 'fieldType',\n frontend_class: 'className',\n is_required: 'required',\n sort_order: 'orderNumber',\n }\n );\n })\n .sort(\n (a: AttributesFormModel, b: AttributesFormModel) =>\n a.orderNumber - b.orderNumber\n );\n\n return attributesConfig;\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","/********************************************************************\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","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\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\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\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 { transformAccount } from '../data/transforms';\n\nconst ACCOUNT_CONTEXT = 'accountContext';\nconst CHANNEL_CONTEXT = 'channelContext';\n\nenum EventsList {\n CREATE_ACCOUNT_EVENT = 'create-account',\n SIGN_IN = 'sign-in',\n SIGN_OUT = 'sign-out',\n}\n\nconst events = {\n // Reference - https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/createAccountAEP.ts\n CREATE_ACCOUNT: EventsList.CREATE_ACCOUNT_EVENT,\n // Reference - https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/signInAEP.ts\n SIGN_IN: EventsList.SIGN_IN,\n // Reference - https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/signOutAEP.ts\n SIGN_OUT: EventsList.SIGN_OUT,\n};\n\nexport function getAdobeDataLayer() {\n // @ts-ignore\n window.adobeDataLayer = window.adobeDataLayer || [];\n // @ts-ignore\n return window.adobeDataLayer;\n}\n\n/**\n * Sets a context in the Adobe Client Data Layer (ACDL)\n * Logic based on: https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-sdk/src/Base.ts#L6\n */\nfunction setContext(name: string, data: any) {\n const adobeDataLayer = getAdobeDataLayer();\n\n // Clear existing context\n adobeDataLayer.push({\n [name]: null,\n });\n\n // Set new context\n adobeDataLayer.push({\n [name]: data,\n });\n}\n\n/**\n * Sets channel context for AEP events\n */\nfunction setChannelContext() {\n const channelData = {\n _id: 'https://ns.adobe.com/xdm/channels/web',\n _type: 'https://ns.adobe.com/xdm/channel-types/web',\n };\n\n setContext(CHANNEL_CONTEXT, channelData);\n}\n\n/**\n * Pushes an event to the Adobe Client Data Layer (ACDL)\n * Logic based on: https://github.com/adobe/commerce-events/blob/1973d0ce28471ef190fa06dad6359ffa0ab51db6/packages/storefront-events-sdk/src/Base.ts#L34\n */\nfunction pushEvent(event: string, additionalContext?: any) {\n const adobeDataLayer = getAdobeDataLayer();\n\n adobeDataLayer.push((acdl: any) => {\n const state = acdl.getState ? acdl.getState() : {};\n\n acdl.push({\n event,\n eventInfo: {\n ...state,\n ...additionalContext,\n },\n });\n });\n}\n\n/**\n * References:\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/createAccountAEP.ts\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/utils/aep/account.ts\n */\nfunction createAccountEvent(eventData: any) {\n const accountData = transformAccount(eventData);\n\n setContext(ACCOUNT_CONTEXT, accountData);\n\n pushEvent(events.CREATE_ACCOUNT);\n}\n\n/**\n * References:\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/signInAEP.ts\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/utils/aep/account.ts\n */\nfunction loginEvent(eventData: any) {\n const accountData = transformAccount(eventData);\n\n setContext(ACCOUNT_CONTEXT, accountData);\n\n pushEvent(events.SIGN_IN);\n}\n\n/**\n * Based on storefront-events-collector - sign out event should not contain accountContext\n * Reference - https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/signOutAEP.ts\n */\nfunction logoutEvent() {\n pushEvent(events.SIGN_OUT);\n}\n\nconst publishEvents = (eventType: string, eventParams: any) => {\n const storeConfigRaw = sessionStorage.getItem('storeConfig');\n const storeConfig = storeConfigRaw ? JSON.parse(storeConfigRaw) : {};\n\n const eventData = { ...storeConfig, ...eventParams };\n\n setChannelContext();\n\n switch (eventType) {\n case EventsList.CREATE_ACCOUNT_EVENT:\n createAccountEvent(eventData);\n break;\n\n case EventsList.SIGN_IN:\n loginEvent(eventData);\n break;\n\n case EventsList.SIGN_OUT:\n logoutEvent();\n break;\n\n default:\n return null;\n }\n};\n\nexport { EventsList, publishEvents, pushEvent };\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\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 apiErrorMessageOverride?: string;\n}\n\nexport const getCustomerToken = async ({\n email,\n password,\n translations,\n onErrorCallback,\n handleSetInLineAlertProps,\n apiErrorMessageOverride,\n}: getCustomerTokenProps): Promise<{\n errorMessage: string;\n displayErrorMessage: 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 // Original error message from API or default (used for error detection logic)\n const errorMessage = response?.errors\n ? response.errors[0].message\n : defaultErrorMessage;\n // Display error message (override if provided, otherwise original)\n const displayErrorMessage = apiErrorMessageOverride ?? errorMessage;\n\n onErrorCallback?.(errorMessage);\n handleSetInLineAlertProps?.({ type: 'error', text: displayErrorMessage });\n\n return { errorMessage, displayErrorMessage, 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 const displayErrorMessage = apiErrorMessageOverride ?? errorMessage;\n\n onErrorCallback?.(errorMessage);\n handleSetInLineAlertProps?.({ type: 'error', text: displayErrorMessage });\n\n return { errorMessage, displayErrorMessage, 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: '', displayErrorMessage: '', userName, userEmail };\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 REQUEST_PASSWORD_RESET_EMAIL = /* GraphQL */ `\n mutation REQUEST_PASSWORD_RESET_EMAIL($email: String!) {\n requestPasswordResetEmail(email: $email)\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 { REQUEST_PASSWORD_RESET_EMAIL } from './graphql/requestPasswordResetEmail.graphql';\nimport { transformPasswordResetEmail } from '@/auth/data/transforms';\nimport { PasswordResetEmailModel } from '@/auth/data/models';\nimport { setReCaptchaToken } from '@/auth/lib/setReCaptchaToken';\n\nexport const requestPasswordResetEmail = async (\n email: string\n): Promise<PasswordResetEmailModel> => {\n await setReCaptchaToken();\n\n return await fetchGraphQl(REQUEST_PASSWORD_RESET_EMAIL, {\n method: 'POST',\n variables: { email },\n })\n .then((response) => {\n return transformPasswordResetEmail(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 RESET_PASSWORD = /* GraphQL */ `\n mutation RESET_PASSWORD(\n $email: String!\n $resetPasswordToken: String!\n $newPassword: String!\n ) {\n resetPassword(\n email: $email\n resetPasswordToken: $resetPasswordToken\n newPassword: $newPassword\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 { ResetPasswordResponse } from '@/auth/types';\nimport { ResetPasswordModel } from '../models';\n\nexport const transformResetPassword = (\n response: ResetPasswordResponse\n): ResetPasswordModel => {\n let message: string = '';\n\n if (response?.errors?.length)\n message = response?.errors[0]?.message as unknown as string;\n\n return {\n message,\n success: Boolean(response?.data?.resetPassword),\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 { RESET_PASSWORD } from './graphql/resetPassword.graphql';\nimport { transformResetPassword } from '@/auth/data/transforms/transform-reset-password';\nimport { ResetPasswordModel } from '@/auth/data/models';\nimport { ResetPasswordResponse } from '@/auth/types';\nimport { setReCaptchaToken } from '@/auth/lib/setReCaptchaToken';\n\nexport const resetPassword = async (\n email: string,\n resetPasswordToken: string,\n newPassword: string\n): Promise<ResetPasswordModel> => {\n await setReCaptchaToken();\n\n return await fetchGraphQl(RESET_PASSWORD, {\n method: 'POST',\n variables: { email, resetPasswordToken, newPassword },\n })\n .then((response: ResetPasswordResponse) => {\n return transformResetPassword(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 REVOKE_CUSTOMER_TOKEN = /* GraphQL */ `\n mutation REVOKE_CUSTOMER_TOKEN {\n revokeCustomerToken {\n result\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\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","/********************************************************************\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 { RevokeCustomerTokenModel } from '@/auth/data/models';\nimport { fetchGraphQl, removeFetchGraphQlHeader } from '../fetch-graphql';\nimport { REVOKE_CUSTOMER_TOKEN } from './graphql/revokeCustomerToken.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { transformRevokeCustomerToken } from '@/auth/data/transforms';\nimport { RevokeCustomerTokenResponse } from '@/auth/types/api/revokeCustomerToken.types';\nimport { deleteCookie } from '@/auth/lib/cookieUtils';\nimport { events } from '@adobe-commerce/event-bus';\nimport { COOKIE_NAMES } from '@/auth/configs/cookieConfigs';\nimport { EventsList, publishEvents } from '@/auth/lib/acdl';\nimport { verifyToken } from '@/auth/api/verifyToken';\nimport { config } from '../initialize';\nimport { emitAuthGroupIdEvent } from '@/auth/lib/emitAuthGroupId';\n\nexport const revokeCustomerToken =\n async (): Promise<RevokeCustomerTokenModel> => {\n const { authHeaderConfig } = config.getConfig();\n\n\n return await fetchGraphQl(REVOKE_CUSTOMER_TOKEN, {\n method: 'POST',\n })\n .then(async (response: RevokeCustomerTokenResponse) => {\n const transformData = transformRevokeCustomerToken(response);\n\n if (transformData?.success) {\n [\n COOKIE_NAMES.auth_dropin_user_token,\n COOKIE_NAMES.auth_dropin_firstname,\n ].forEach((name) => {\n deleteCookie(name);\n });\n\n removeFetchGraphQlHeader(authHeaderConfig.header);\n await emitAuthGroupIdEvent();\n events.emit('authenticated', false);\n\n publishEvents(EventsList.SIGN_OUT, {});\n } else {\n const errorMessage = `\n ERROR revokeCustomerToken: ${transformData.message}`;\n console.error(errorMessage);\n\n // Verify if the token is still valid after failed revocation attempt\n // This ensures the authentication state is consistent with the actual token status even if the revocation fails\n verifyToken();\n }\n\n return transformData;\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 CONFIRM_EMAIL = /* GraphQL */ `\n mutation CONFIRM_EMAIL($email: String!, $confirmation_key: String!) {\n confirmEmail(\n input: { email: $email, confirmation_key: $confirmation_key }\n ) {\n customer {\n email\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 { confirmEmailResponse, confirmEmailProps } from '@/auth/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { CONFIRM_EMAIL } from './graphql/confirmEmail.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\n\nexport const confirmEmail = async ({\n customerEmail,\n customerConfirmationKey,\n}: confirmEmailProps): Promise<confirmEmailResponse | undefined> => {\n return await fetchGraphQl(CONFIRM_EMAIL, {\n method: 'POST',\n variables: {\n email: customerEmail,\n confirmation_key: customerConfirmationKey,\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 RESEND_CONFIRMATION_EMAIL = /* GraphQL */ `\n mutation RESEND_CONFIRMATION_EMAIL($email: String!) {\n resendConfirmationEmail(email: $email)\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 { handleNetworkError } from '@/auth/lib/network-error';\nimport { RESEND_CONFIRMATION_EMAIL } from './graphql/resendConfirmationEmail.graphql';\nimport { resendConfirmationEmailResponse } from '@/auth/types';\n\nexport const resendConfirmationEmail = async (\n customerEmail: string\n): Promise<resendConfirmationEmailResponse> => {\n return await fetchGraphQl(RESEND_CONFIRMATION_EMAIL, {\n method: 'POST',\n variables: {\n email: customerEmail,\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","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/** Checkout and other dropins key off this ACL; B2C responses often omit it from the role tree. */\nconst PLACE_ORDER_PERMISSION = 'Magento_Sales::place_order';\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 const merged: PermissionsModel = { ...basePermissions, ...processedPermissions };\n\n // storefront-checkout treats missing Magento_Sales::place_order as no checkout permission.\n // Account nav and other blocks rely on auth/permissions always firing with a consistent payload.\n if (\n !isAdmin &&\n merged[PLACE_ORDER_PERMISSION] === undefined &&\n Object.keys(allPermissions).length === 0\n ) {\n merged[PLACE_ORDER_PERMISSION] = true;\n }\n\n return merged;\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","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","CUSTOMER_INFORMATION_FRAGMENT","CREATE_CUSTOMER","CREATE_CUSTOMER_V2","handleNetworkError","setReCaptchaToken","verifyReCaptcha","transformAccount","data","transformStoreConfig","response","_b","_a","_d","_c","_f","_e","_h","_g","_j","_i","transformPasswordResetEmail","message","transformRevokeCustomerToken","transformCustomerData","model","merge","_m","_l","_k","convertToCamelCase","key","_","letter","convertToSnakeCase","convertKeysCase","type","dictionary","typeList","callback","element","acc","newKey","cloneArrayIfExists","fields","multilineItems","i","newItem","transformAttributesForm","items","el","code","other","isDefaultCode","item","customUpperCode","options","a","b","transformCreateCustomer","apiVersion2","_p","_o","_n","transformAdobeCommerceOptimizerData","transformDobForm","form","dob","rest","createCustomer","forms","GET_ATTRIBUTES_FORM","handleFetchError","errors","errorMessage","e","getAttributesForm","formCode","GET_CUSTOMER_DATA","getCustomerData","user_token","authHeaderConfig","GET_CUSTOMER_TOKEN","ACCOUNT_CONTEXT","CHANNEL_CONTEXT","EventsList","getAdobeDataLayer","setContext","adobeDataLayer","setChannelContext","pushEvent","event","additionalContext","acdl","state","createAccountEvent","eventData","accountData","loginEvent","logoutEvent","publishEvents","eventType","eventParams","storeConfigRaw","base64ToSha1","base64String","binaryString","bytes","hashBuffer","byte","DEFAULT_NLI_CUSTOMER_GROUP_ID","emitAuthGroupIdEvent","groupUid","groupIdHash","getCustomerToken","email","password","translations","onErrorCallback","handleSetInLineAlertProps","apiErrorMessageOverride","defaultErrorMessage","displayErrorMessage","userToken","responseCustomer","userName","userEmail","cookiesLifetime","cookieSecureFlag","GET_STORE_CONFIG","REQUEST_PASSWORD_RESET_EMAIL","requestPasswordResetEmail","RESET_PASSWORD","transformResetPassword","resetPassword","resetPasswordToken","newPassword","REVOKE_CUSTOMER_TOKEN","VALIDATE_CUSTOMER_TOKEN","authType","res","revokeCustomerToken","transformData","CONFIRM_EMAIL","confirmEmail","customerEmail","customerConfirmationKey","RESEND_CONFIRMATION_EMAIL","resendConfirmationEmail","CREATE_CUSTOMER_ADDRESS","createCustomerAddress","address","GET_CUSTOMER_ROLE_PERMISSIONS","permissionsCache","fetchPromise","flattenPermissionTree","permissions","flattened","processPermissions","perms","permission","PURCHASE_ORDER_PERMISSIONS","PLACE_ORDER_PERMISSION","isAdminUser","role","getAllPermissions","overridePurchaseOrderPermissions","purchaseOrdersEnabled","result","processUserPermissions","isAdmin","allPermissions","processedPermissions","merged","fetchUserRolePermissions","_resetCache","GET_ADOBE_COMMERCE_OPTIMIZER_DATA","adobeCommerceOptimizerData"],"mappings":"gQAiBA,MAAMA,EAAe,CACnB,uBAAwB,yBACxB,sBAAuB,uBACzB,EAEMC,GAAY,CAChB,YACA,YACA,KACF,EAEMC,EAAkB,KCPXC,EAAaC,GAAuB,CAC/C,MAAMC,EAAU,SAAS,OAAO,MAAM,GAAG,EACzC,IAAIC,EAEJ,OAAAD,EAAQ,QAASE,GAAW,CAC1B,KAAM,CAACC,EAAMC,CAAK,EAAIF,EAAO,KAAA,EAAO,MAAM,GAAG,EACzCC,IAASJ,IACXE,EAAa,mBAAmBG,CAAK,EAEzC,CAAC,EAEMH,CACT,EAEaI,EAAgBN,GAAuB,CAClD,SAAS,OAAS,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