@dropins/storefront-auth 4.0.0-alpha-20260601092829 → 4.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/CHANGELOG.md +22 -2
  2. package/api.js +173 -1
  3. package/api.js.map +1 -1
  4. package/chunks/components.js +4 -0
  5. package/chunks/components.js.map +1 -0
  6. package/containers/AuthCombine.js +1 -1
  7. package/containers/AuthCombine.js.map +1 -1
  8. package/containers/ResetPassword.js +1 -1
  9. package/containers/ResetPassword.js.map +1 -1
  10. package/containers/SignIn.js +1 -1
  11. package/containers/SignIn.js.map +1 -1
  12. package/containers/SignUp.js +1 -1
  13. package/containers/SignUp.js.map +1 -1
  14. package/containers/SuccessNotification.js +1 -1
  15. package/containers/SuccessNotification.js.map +1 -1
  16. package/containers/UpdatePassword.js +1 -1
  17. package/containers/UpdatePassword.js.map +1 -1
  18. package/package.json +1 -1
  19. package/render.js +1 -1
  20. package/render.js.map +1 -1
  21. package/chunks/Button.js +0 -4
  22. package/chunks/Button.js.map +0 -1
  23. package/chunks/RemoteShoppingAssistanceConsent.js +0 -4
  24. package/chunks/RemoteShoppingAssistanceConsent.js.map +0 -1
  25. package/chunks/RemoteShoppingAssistanceConsent2.js +0 -4
  26. package/chunks/RemoteShoppingAssistanceConsent2.js.map +0 -1
  27. package/chunks/ResetPasswordForm.js +0 -4
  28. package/chunks/ResetPasswordForm.js.map +0 -1
  29. package/chunks/SignInForm.js +0 -4
  30. package/chunks/SignInForm.js.map +0 -1
  31. package/chunks/SkeletonLoader.js +0 -4
  32. package/chunks/SkeletonLoader.js.map +0 -1
  33. package/chunks/acdl.js +0 -4
  34. package/chunks/acdl.js.map +0 -1
  35. package/chunks/confirmEmail.js +0 -14
  36. package/chunks/confirmEmail.js.map +0 -1
  37. package/chunks/createCustomerAddress.js +0 -60
  38. package/chunks/createCustomerAddress.js.map +0 -1
  39. package/chunks/focusOnEmptyPasswordField.js +0 -4
  40. package/chunks/focusOnEmptyPasswordField.js.map +0 -1
  41. package/chunks/getAdobeCommerceOptimizerData.js +0 -70
  42. package/chunks/getAdobeCommerceOptimizerData.js.map +0 -1
  43. package/chunks/getCustomerToken.js +0 -17
  44. package/chunks/getCustomerToken.js.map +0 -1
  45. package/chunks/index.js +0 -4
  46. package/chunks/index.js.map +0 -1
  47. package/chunks/index2.js +0 -4
  48. package/chunks/index2.js.map +0 -1
  49. package/chunks/index3.js +0 -4
  50. package/chunks/index3.js.map +0 -1
  51. package/chunks/network-error.js +0 -4
  52. package/chunks/network-error.js.map +0 -1
  53. package/chunks/requestPasswordResetEmail.js +0 -8
  54. package/chunks/requestPasswordResetEmail.js.map +0 -1
  55. package/chunks/resendConfirmationEmail.js +0 -8
  56. package/chunks/resendConfirmationEmail.js.map +0 -1
  57. package/chunks/resetPassword.js +0 -16
  58. package/chunks/resetPassword.js.map +0 -1
  59. package/chunks/revokeCustomerToken.js +0 -11
  60. package/chunks/revokeCustomerToken.js.map +0 -1
  61. package/chunks/setReCaptchaToken.js +0 -4
  62. package/chunks/setReCaptchaToken.js.map +0 -1
  63. package/chunks/simplifyTransformAttributesForm.js +0 -4
  64. package/chunks/simplifyTransformAttributesForm.js.map +0 -1
  65. package/chunks/transform-attributes-form.js +0 -4
  66. package/chunks/transform-attributes-form.js.map +0 -1
  67. package/chunks/usePasswordValidationMessage.js +0 -4
  68. package/chunks/usePasswordValidationMessage.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,10 +1,30 @@
1
1
  # @dropins/storefront-auth
2
2
 
3
- ## 4.0.0-alpha-20260601092829
3
+ ## 4.0.0-beta.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 1c0576b: Bump @adobe-commerce/elsie to v1.9.0-beta.3
8
+
9
+ ## 4.0.0-beta.3
4
10
 
5
11
  ### Major Changes
6
12
 
7
- - 1f7fdcd: Add support for Remote Shopping Assistance feature that enables store administrators to help customers with purchases. The implementation includes admin session management via JWT token validation, a consent UI component for customer approval, and enhanced cookie security with proper encoding and SameSite protection for all authentication cookies
13
+ - 515ce05: Add support for Remote Shopping Assistance feature that enables store administrators to help customers with purchases. The implementation includes admin session management via JWT token validation, a consent UI component for customer approval, and enhanced cookie security with proper encoding and SameSite protection for all authentication cookies
14
+
15
+ ## 3.3.0-beta.2
16
+
17
+ ### Minor Changes
18
+
19
+ - 572b81a: Removed the `engines.node` constraint from `package.json`. This package targets browser environments exclusively and does not depend on a specific Node.js runtime version. The package is now built and distributed using Node.js 22 LTS.
20
+
21
+ ## 3.3.0-beta.1
22
+
23
+ ### Minor Changes
24
+
25
+ - 1703268: Upgraded Elsie package to use the 1.9.0-beta.0 version
26
+
27
+ ## 3.3.0-beta.0
8
28
 
9
29
  ### Minor Changes
10
30
 
package/api.js CHANGED
@@ -1,4 +1,176 @@
1
1
  /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
- import{c as g,a as n,g as c}from"./chunks/createCustomerAddress.js";import{g as d,a as h}from"./chunks/getCustomerToken.js";import{_ as x,c as u,b,a as k,g as v,i as E,v as F}from"./chunks/getAdobeCommerceOptimizerData.js";import{r as Q}from"./chunks/requestPasswordResetEmail.js";import{r as H}from"./chunks/resetPassword.js";import{r as T}from"./chunks/revokeCustomerToken.js";import{c as z}from"./chunks/confirmEmail.js";import{r as R}from"./chunks/resendConfirmationEmail.js";import{f as q,g as y,r as O,s as S,a as j,b as B}from"./chunks/network-error.js";import"./fragments.js";import"./chunks/setReCaptchaToken.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import"./chunks/transform-attributes-form.js";import"./chunks/acdl.js";import"@dropins/tools/fetch-graphql.js";export{x as _resetCache,u as config,z as confirmEmail,g as createCustomer,n as createCustomerAddress,q as fetchGraphQl,b as getAdobeCommerceOptimizerData,c as getAttributesForm,y as getConfig,d as getCustomerData,k as getCustomerRolePermissions,h as getCustomerToken,v as getStoreConfig,E as initialize,O as removeFetchGraphQlHeader,Q as requestPasswordResetEmail,R as resendConfirmationEmail,H as resetPassword,T as revokeCustomerToken,S as setEndpoint,j as setFetchGraphQlHeader,B as setFetchGraphQlHeaders,F as verifyToken};
3
+ import{events as R}from"@dropins/tools/event-bus.js";import{verifyReCaptcha as et}from"@dropins/tools/recaptcha.js";import{CUSTOMER_INFORMATION_FRAGMENT as v}from"./fragments.js";import{FetchGraphQL as rt}from"@dropins/tools/fetch-graphql.js";import{Initializer as at,Config as ot,merge as K}from"@dropins/tools/lib.js";const l={auth_dropin_user_token:"auth_dropin_user_token",auth_dropin_firstname:"auth_dropin_firstname",auth_dropin_lastname:"auth_dropin_lastname",auth_dropin_admin_session:"auth_dropin_admin_session"},nt=["localhost","127.0.0.1","::1"],k=3600,V=t=>{const e=document.cookie.split(";");let r;return e.forEach(a=>{const[o,c]=a.trim().split("=");o===t&&(r=decodeURIComponent(c))}),r},w=t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`},it=async()=>{try{const t=sessionStorage.getItem("storeConfig");let e={};try{e=t?JSON.parse(t):{}}catch{e={}}let r=e.customerAccessTokenLifetime;if(!r){const a=await pt();sessionStorage.setItem("storeConfig",JSON.stringify(a)),r=(a==null?void 0:a.customerAccessTokenLifetime)||k}return`Max-Age=${r}`}catch(t){return console.error("getCookiesLifetime() Error:",t),`Max-Age=${k}`}},P=new ot(void 0),p=new at({init:async t=>{const r={...{authHeaderConfig:{header:"Authorization",tokenPrefix:"Bearer"},customerPermissionRoles:!1,adobeCommerceOptimizer:!1},...t};p.config.setConfig(r);const a=V(l.auth_dropin_user_token),[o]=await Promise.all([tt(r.authHeaderConfig.header,r.authHeaderConfig.tokenPrefix),r.customerPermissionRoles&&a?z():Promise.resolve(),r.adobeCommerceOptimizer?B():Promise.resolve()]);P.setConfig(o)},listeners:()=>[R.on("authenticated",t=>{const e=P.getConfig();if(e!==void 0&&t!==e){P.setConfig(t);const{customerPermissionRoles:r,adobeCommerceOptimizer:a}=p.config.getConfig();r&&z(),a&&B()}})]}),N=p.config,{setEndpoint:re,setFetchGraphQlHeader:D,removeFetchGraphQlHeader:J,setFetchGraphQlHeaders:ae,fetchGraphQl:h,getConfig:oe}=new rt().getMethods(),ct=`
4
+ mutation CREATE_CUSTOMER($input: CustomerInput!) {
5
+ createCustomer(input: $input) {
6
+ customer {
7
+ ...CUSTOMER_INFORMATION_FRAGMENT
8
+ }
9
+ }
10
+ }
11
+ ${v}
12
+ `,st=`
13
+ mutation CREATE_CUSTOMER_V2($input: CustomerCreateInput!) {
14
+ createCustomerV2(input: $input) {
15
+ customer {
16
+ ...CUSTOMER_INFORMATION_FRAGMENT
17
+ }
18
+ }
19
+ }
20
+ ${v}
21
+ `,S=t=>{throw t instanceof DOMException&&t.name==="AbortError"||R.emit("auth/error",{source:"auth",type:"network",error:t}),t},$=async()=>{const t=await et();t&&D("X-ReCaptcha",t)},j=t=>({firstName:t.firstName,lastName:t.lastName,emailAddress:(t==null?void 0:t.email)||"",accountId:(t==null?void 0:t.email)||""}),ut=t=>{var e,r,a,o,c,n,u,i,m,d,f,_,g,T,E,O,A,C;return{autocompleteOnStorefront:((r=(e=t==null?void 0:t.data)==null?void 0:e.storeConfig)==null?void 0:r.autocomplete_on_storefront)||!1,minLength:((o=(a=t==null?void 0:t.data)==null?void 0:a.storeConfig)==null?void 0:o.minimum_password_length)||3,requiredCharacterClasses:+((n=(c=t==null?void 0:t.data)==null?void 0:c.storeConfig)==null?void 0:n.required_character_classes_number)||0,createAccountConfirmation:((i=(u=t==null?void 0:t.data)==null?void 0:u.storeConfig)==null?void 0:i.create_account_confirmation)||!1,customerAccessTokenLifetime:((d=(m=t==null?void 0:t.data)==null?void 0:m.storeConfig)==null?void 0:d.customer_access_token_lifetime)*k||k,websiteName:((_=(f=t==null?void 0:t.data)==null?void 0:f.storeConfig)==null?void 0:_.website_name)||"",shoppingAssistanceEnabled:((T=(g=t==null?void 0:t.data)==null?void 0:g.storeConfig)==null?void 0:T.shopping_assistance_enabled)||!1,shoppingAssistanceCheckboxTitle:((O=(E=t==null?void 0:t.data)==null?void 0:E.storeConfig)==null?void 0:O.shopping_assistance_checkbox_title)||"",shoppingAssistanceCheckboxTooltip:((C=(A=t==null?void 0:t.data)==null?void 0:A.storeConfig)==null?void 0:C.shopping_assistance_checkbox_tooltip)||""}},mt=t=>{var r,a,o;let e="";return(r=t==null?void 0:t.errors)!=null&&r.length&&(e=(a=t==null?void 0:t.errors[0])==null?void 0:a.message),{message:e,success:!!((o=t==null?void 0:t.data)!=null&&o.requestPasswordResetEmail)}},dt=t=>{var r,a,o;let e="";return(r=t==null?void 0:t.errors)!=null&&r.length&&(e=((a=t==null?void 0:t.errors[0])==null?void 0:a.message)||"Unknown error"),{message:e,success:!!((o=t==null?void 0:t.data)!=null&&o.revokeCustomerToken)}},_t=t=>{var r,a,o,c,n,u,i,m,d,f,_,g,T,E,O;const e={email:((a=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:a.email)??"",firstName:((c=(o=t==null?void 0:t.data)==null?void 0:o.customer)==null?void 0:c.firstname)??"",lastName:((u=(n=t==null?void 0:t.data)==null?void 0:n.customer)==null?void 0:u.lastname)??"",groupUid:((d=(m=(i=t==null?void 0:t.data)==null?void 0:i.customer)==null?void 0:m.group)==null?void 0:d.uid)??"",allowRemoteShoppingAssistance:(_=(f=t==null?void 0:t.data)==null?void 0:f.customer)==null?void 0:_.allow_remote_shopping_assistance};return K(e,(O=(E=(T=(g=N==null?void 0:N.getConfig())==null?void 0:g.models)==null?void 0:T.CustomerModel)==null?void 0:E.transformer)==null?void 0:O.call(E,t.data))},Q=t=>t.replace(/_([a-z])/g,(e,r)=>r.toUpperCase()),lt=t=>t.replace(/([A-Z])/g,e=>`_${e.toLowerCase()}`),U=(t,e,r)=>{const a=["string","boolean","number"],o=e==="camelCase"?Q:lt;return Array.isArray(t)?t.map(c=>a.includes(typeof c)||c===null?c:typeof c=="object"?U(c,e,r):c):t!==null&&typeof t=="object"?Object.entries(t).reduce((c,[n,u])=>{const i=r&&r[n]?r[n]:o(n);return c[i]=a.includes(typeof u)||u===null?u:U(u,e,r),c},{}):t},ft=t=>{let e=[];for(const r of t)if(!(r.frontend_input!=="MULTILINE"||r.multiline_count<2))for(let a=2;a<=r.multiline_count;a++){const o={...r,is_required:!1,name:`${r.code}_multiline_${a}`,code:`${r.code}_multiline_${a}`,id:`${r.code}_multiline_${a}`};e.push(o)}return e},ht=t=>{var c,n,u;const e=((n=(c=t==null?void 0:t.data)==null?void 0:c.attributesForm)==null?void 0:n.items)||[];if(!e.length)return[];const r=(u=e.filter(i=>{var m;return!((m=i.frontend_input)!=null&&m.includes("HIDDEN"))}))==null?void 0:u.map(({code:i,...m})=>{const d=i!=="country_id"?i:"country_code";return{...m,name:d,id:d,code:d}}),a=ft(r);return r.concat(a).map(i=>{var f;const m=i.code==="firstname"?"firstName":i.code==="lastname"?"lastName":Q(i.code),d=(f=i.options)==null?void 0:f.map(_=>({isDefault:_.is_default,text:_.label,value:_.value}));return U({...i,options:d,customUpperCode:m},"camelCase",{frontend_input:"fieldType",frontend_class:"className",is_required:"required",sort_order:"orderNumber"})}).sort((i,m)=>i.orderNumber-m.orderNumber)},gt=(t,e)=>{var a,o,c,n,u,i,m,d,f,_,g,T,E,O,A,C;let r;if(e){const{data:s}=t;r={firstName:((o=(a=s==null?void 0:s.createCustomerV2)==null?void 0:a.customer)==null?void 0:o.firstname)??"",lastName:((n=(c=s==null?void 0:s.createCustomerV2)==null?void 0:c.customer)==null?void 0:n.lastname)??"",email:((i=(u=s==null?void 0:s.createCustomerV2)==null?void 0:u.customer)==null?void 0:i.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=(d=s==null?void 0:s.createCustomer)==null?void 0:d.customer)==null?void 0:f.firstname)??"",lastName:((g=(_=s==null?void 0:s.createCustomer)==null?void 0:_.customer)==null?void 0:g.lastname)??"",email:((E=(T=s==null?void 0:s.createCustomer)==null?void 0:T.customer)==null?void 0:E.email)??"",errors:(t==null?void 0:t.errors)??[]}}return K(r,(C=(A=(O=N.getConfig().models)==null?void 0:O.CustomerModel)==null?void 0:A.transformer)==null?void 0:C.call(A,t))},Et=t=>{var e,r;return{priceBookId:((r=(e=t==null?void 0:t.data)==null?void 0:e.commerceOptimizer)==null?void 0:r.priceBookId)||""}},Ct=t=>{if(!t.dob)return t;const{dob:e,...r}=t;return{...r,date_of_birth:e}},ne=async(t,e)=>{await $();const r=await h(e?st:ct,{method:"POST",variables:{input:{...Ct(t)}}}).catch(S);return gt(r,e)},Tt=`
22
+ query GET_ATTRIBUTES_FORM($formCode: String!) {
23
+ attributesForm(formCode: $formCode) {
24
+ items {
25
+ code
26
+ default_value
27
+ entity_type
28
+ frontend_class
29
+ frontend_input
30
+ is_required
31
+ is_unique
32
+ label
33
+ options {
34
+ is_default
35
+ label
36
+ value
37
+ }
38
+ ... on CustomerAttributeMetadata {
39
+ multiline_count
40
+ sort_order
41
+ validate_rules {
42
+ name
43
+ value
44
+ }
45
+ }
46
+ }
47
+ errors {
48
+ type
49
+ message
50
+ }
51
+ }
52
+ }
53
+ `,x=t=>{const e=t.map(r=>r.message).join(" ");throw Error(e)},ie=async t=>await h(Tt,{method:"GET",cache:"force-cache",variables:{formCode:t}}).then(e=>{var r;return(r=e.errors)!=null&&r.length?x(e.errors):ht(e)}).catch(S),Ot=`
54
+ query GET_CUSTOMER_DATA {
55
+ customer {
56
+ ...CUSTOMER_INFORMATION_FRAGMENT
57
+ }
58
+ }
59
+ ${v}
60
+ `,Rt=async t=>{if(t){const{authHeaderConfig:e}=N.getConfig();D(e.header,e.tokenPrefix?`${e.tokenPrefix} ${t}`:t)}return await h(Ot,{method:"GET",cache:"force-cache"}).then(e=>_t(e)).catch(S)},St=`
61
+ mutation GET_CUSTOMER_TOKEN($email: String!, $password: String!) {
62
+ generateCustomerToken(email: $email, password: $password) {
63
+ token
64
+ }
65
+ }
66
+ `,W="accountContext",At="channelContext";var M=(t=>(t.CREATE_ACCOUNT_EVENT="create-account",t.SIGN_IN="sign-in",t.SIGN_OUT="sign-out",t))(M||{});const G={CREATE_ACCOUNT:"create-account",SIGN_IN:"sign-in",SIGN_OUT:"sign-out"};function X(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function F(t,e){const r=X();r.push({[t]:null}),r.push({[t]:e})}function wt(){F(At,{_id:"https://ns.adobe.com/xdm/channels/web",_type:"https://ns.adobe.com/xdm/channel-types/web"})}function L(t,e){X().push(a=>{const o=a.getState?a.getState():{};a.push({event:t,eventInfo:{...o,...e}})})}function Nt(t){const e=j(t);F(W,e),L(G.CREATE_ACCOUNT)}function yt(t){const e=j(t);F(W,e),L(G.SIGN_IN)}function Mt(){L(G.SIGN_OUT)}const Z=(t,e)=>{const r=sessionStorage.getItem("storeConfig");let a={};try{a=r?JSON.parse(r):{}}catch{a={}}const o={...a,...e};switch(wt(),t){case"create-account":Nt(o);break;case"sign-in":yt(o);break;case"sign-out":Mt();break;default:return null}},bt=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 a=await crypto.subtle.digest("SHA-1",r);return Array.from(new Uint8Array(a)).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"}`),""}},It="b6589fc6ab0dc82cf12099d1c2d40ab994e8410c",b=async t=>{const e=t?await bt(t):It;R.emit("auth/group-uid",e)},Y=t=>{if(!t||typeof t!="string")return null;try{const e=t.split(".");if(e.length!==3)return console.error("[decodeJwtToken] Invalid JWT format: expected 3 parts"),null;const a=e[1].replace(/-/g,"+").replace(/_/g,"/"),o=a.padEnd(a.length+(4-a.length%4)%4,"="),c=atob(o);return JSON.parse(c)}catch(e){return console.error("[decodeJwtToken] Failed to decode JWT:",e),null}},kt=t=>{const e=Y(t);return e?typeof e.admin_id=="number"&&e.admin_id>0:!1},$t=(t,e)=>{const r=Y(t);if(r&&typeof r.exp=="number"&&r.exp>0){const a=Math.floor(Date.now()/1e3);return`Max-Age=${Math.max(0,r.exp-a)}`}return e},ce=async({email:t,password:e,translations:r,onErrorCallback:a,handleSetInLineAlertProps:o,apiErrorMessageOverride:c})=>{var T,E,O,A;await $();const n=await h(St,{method:"POST",variables:{email:t,password:e}}).catch(S);if(!((E=(T=n==null?void 0:n.data)==null?void 0:T.generateCustomerToken)!=null&&E.token)){const C=r.customerTokenErrorMessage,s=n!=null&&n.errors?n.errors[0].message:C,q=c??s;return a==null||a(s),o==null||o({type:"error",text:q}),{errorMessage:s,displayErrorMessage:q,userName:"",userEmail:""}}const u=(A=(O=n==null?void 0:n.data)==null?void 0:O.generateCustomerToken)==null?void 0:A.token,i=await Rt(u),m=i==null?void 0:i.firstName,d=(i==null?void 0:i.lastName)??"",f=i==null?void 0:i.email;if(!m||!f){const C=r.customerTokenErrorMessage,s=c??C;return a==null||a(C),o==null||o({type:"error",text:s}),{errorMessage:C,displayErrorMessage:s,userName:"",userEmail:""}}const _=await it(),g=nt.includes(window.location.hostname)?"":"Secure";if(document.cookie=`${l.auth_dropin_firstname}=${encodeURIComponent(m)}; path=/; ${_}; SameSite=Lax; ${g};`,document.cookie=`${l.auth_dropin_lastname}=${encodeURIComponent(d)}; path=/; ${_}; SameSite=Lax; ${g};`,document.cookie=`${l.auth_dropin_user_token}=${encodeURIComponent(u)}; path=/; ${_}; SameSite=Lax; ${g};`,kt(u)){const C=$t(u,_);document.cookie=`${l.auth_dropin_admin_session}=true; path=/; ${C}; SameSite=Lax; ${g};`}else w(l.auth_dropin_admin_session);return await b(u?i==null?void 0:i.groupUid:void 0),R.emit("authenticated",!!u),Z(M==null?void 0:M.SIGN_IN,{...i}),{errorMessage:"",displayErrorMessage:"",userName:m,userEmail:f}},Pt=`
67
+ query GET_STORE_CONFIG {
68
+ storeConfig {
69
+ autocomplete_on_storefront
70
+ minimum_password_length
71
+ required_character_classes_number
72
+ store_code
73
+ store_name
74
+ store_group_code
75
+ locale
76
+ create_account_confirmation
77
+ customer_access_token_lifetime
78
+ website_name
79
+ shopping_assistance_enabled
80
+ shopping_assistance_checkbox_title
81
+ shopping_assistance_checkbox_tooltip
82
+ }
83
+ }
84
+ `,pt=async()=>await h(Pt,{method:"GET",cache:"force-cache"}).then(t=>{var e;return(e=t.errors)!=null&&e.length?x(t.errors):ut(t)}).catch(S),Ut=`
85
+ mutation REQUEST_PASSWORD_RESET_EMAIL($email: String!) {
86
+ requestPasswordResetEmail(email: $email)
87
+ }
88
+ `,se=async t=>(await $(),await h(Ut,{method:"POST",variables:{email:t}}).then(e=>mt(e)).catch(S)),vt=`
89
+ mutation RESET_PASSWORD(
90
+ $email: String!
91
+ $resetPasswordToken: String!
92
+ $newPassword: String!
93
+ ) {
94
+ resetPassword(
95
+ email: $email
96
+ resetPasswordToken: $resetPasswordToken
97
+ newPassword: $newPassword
98
+ )
99
+ }
100
+ `,Dt=t=>{var r,a,o;let e="";return(r=t==null?void 0:t.errors)!=null&&r.length&&(e=(a=t==null?void 0:t.errors[0])==null?void 0:a.message),{message:e,success:!!((o=t==null?void 0:t.data)!=null&&o.resetPassword)}},ue=async(t,e,r)=>(await $(),await h(vt,{method:"POST",variables:{email:t,resetPasswordToken:e,newPassword:r}}).then(a=>Dt(a)).catch(S)),xt=`
101
+ mutation REVOKE_CUSTOMER_TOKEN {
102
+ revokeCustomerToken {
103
+ result
104
+ }
105
+ }
106
+ `,Gt=`
107
+ query VALIDATE_TOKEN {
108
+ customer {
109
+ group {
110
+ uid
111
+ }
112
+ }
113
+ }
114
+ `,tt=async(t="Authorization",e="Bearer")=>{const r=V(l.auth_dropin_user_token);return r?(D(t,`${e} ${r}`),h(Gt).then(async a=>{var c,n,u,i;return!((c=a.errors)!=null&&c.find(m=>{var d;return((d=m.extensions)==null?void 0:d.category)==="graphql-authentication"}))?(await b((i=(u=(n=a.data)==null?void 0:n.customer)==null?void 0:u.group)==null?void 0:i.uid),R.emit("authenticated",!0),!0):(w(l.auth_dropin_user_token),w(l.auth_dropin_firstname),w(l.auth_dropin_lastname),w(l.auth_dropin_admin_session),J(t),await b(),R.emit("authenticated",!1),!1)})):(await b(),R.emit("authenticated",!1),!1)},me=async()=>{const{authHeaderConfig:t}=N.getConfig();return await h(xt,{method:"POST"}).then(async e=>{const r=dt(e);if(r!=null&&r.success)[l.auth_dropin_user_token,l.auth_dropin_firstname,l.auth_dropin_lastname,l.auth_dropin_admin_session].forEach(a=>{w(a)}),J(t.header),await b(),R.emit("authenticated",!1),Z(M.SIGN_OUT,{});else{const a=`
115
+ ERROR revokeCustomerToken: ${r.message}`;console.error(a),tt()}return r}).catch(S)},Ft=`
116
+ mutation CONFIRM_EMAIL($email: String!, $confirmation_key: String!) {
117
+ confirmEmail(
118
+ input: { email: $email, confirmation_key: $confirmation_key }
119
+ ) {
120
+ customer {
121
+ email
122
+ }
123
+ }
124
+ }
125
+ `,de=async({customerEmail:t,customerConfirmationKey:e})=>await h(Ft,{method:"POST",variables:{email:t,confirmation_key:e}}).catch(S),Lt=`
126
+ mutation RESEND_CONFIRMATION_EMAIL($email: String!) {
127
+ resendConfirmationEmail(email: $email)
128
+ }
129
+ `,_e=async t=>await h(Lt,{method:"POST",variables:{email:t}}).catch(S),qt=`
130
+ mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {
131
+ createCustomerAddress(input: $input) {
132
+ firstname
133
+ }
134
+ }
135
+ `,le=async t=>await h(qt,{method:"POST",variables:{input:t}}).then(e=>{var r;return(r=e.errors)!=null&&r.length?x(e.errors):e.data.createCustomerAddress.firstname||""}).catch(S),Ht=`
136
+ query GET_CUSTOMER_ROLE_PERMISSIONS {
137
+ customer {
138
+ purchase_orders_enabled
139
+ role {
140
+ id
141
+ name
142
+ permissions {
143
+ id
144
+ text
145
+ children {
146
+ id
147
+ text
148
+ children {
149
+ id
150
+ text
151
+ children {
152
+ id
153
+ text
154
+ children {
155
+ id
156
+ text
157
+ children {
158
+ id
159
+ text
160
+ }
161
+ }
162
+ }
163
+ }
164
+ }
165
+ }
166
+ }
167
+ }
168
+ }
169
+ `;let I=null,y=null;const zt=t=>{const e={},r=a=>{a.forEach(o=>{var c;e[o.id]=!0,(c=o.children)!=null&&c.length&&r(o.children)})};return r(t),e},Bt=["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"],H="Magento_Sales::place_order",Kt=t=>(t==null?void 0:t.id)==="MA=="&&Array.isArray(t.permissions)&&t.permissions.length===0,Vt=t=>{var e;return(e=t==null?void 0:t.permissions)!=null&&e.length?zt(t.permissions):{}},Jt=(t,e)=>{if(e===!0)return t;const r={...t};return Bt.forEach(a=>{r[a]=!1}),r},jt=(t,e)=>{const r=Kt(t),a=Vt(t),o=Jt(a,e),n={...{all:!0,...r&&{admin:!0}},...o};return!r&&n[H]===void 0&&Object.keys(a).length===0&&(n[H]=!0),n},Qt=async()=>{var t,e,r,a;try{const o=await h(Ht,{method:"GET"}),c=jt((e=(t=o.data)==null?void 0:t.customer)==null?void 0:e.role,(a=(r=o.data)==null?void 0:r.customer)==null?void 0:a.purchase_orders_enabled);return I=c,y=null,c}catch(o){throw y=null,o}},z=()=>I?(R.emit("auth/permissions",I),Promise.resolve(I)):(y||(y=Qt().then(t=>(R.emit("auth/permissions",t),t))),y),fe=()=>{I=null,y=null},Wt=`
170
+ query GET_ADOBE_COMMERCE_OPTIMIZER_DATA {
171
+ commerceOptimizer {
172
+ priceBookId
173
+ }
174
+ }
175
+ `,B=async()=>{const t=await h(Wt,{method:"GET"}),e=Et(t);return R.emit("auth/adobe-commerce-optimizer",e),e};export{M as E,fe as _resetCache,U as c,N as config,de as confirmEmail,ne as createCustomer,le as createCustomerAddress,h as fetchGraphQl,B as getAdobeCommerceOptimizerData,ie as getAttributesForm,oe as getConfig,Rt as getCustomerData,z as getCustomerRolePermissions,ce as getCustomerToken,pt as getStoreConfig,p as initialize,Z as p,J as removeFetchGraphQlHeader,se as requestPasswordResetEmail,_e as resendConfirmationEmail,ue as resetPassword,me as revokeCustomerToken,re as setEndpoint,D as setFetchGraphQlHeader,ae as setFetchGraphQlHeaders,ht as t,tt as verifyToken};
4
176
  //# 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/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/lib/jwtUtils.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 2026 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 auth_dropin_lastname: 'auth_dropin_lastname',\n auth_dropin_admin_session: 'auth_dropin_admin_session',\n};\n\nconst LOCALHOST = ['localhost', '127.0.0.1', '::1'];\n\nconst COOKIE_LIFETIME = 3600;\n\nexport { COOKIE_NAMES, COOKIE_LIFETIME, LOCALHOST };\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2026 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 let cachedStoreConfig: { customerAccessTokenLifetime?: number } = {};\n\n try {\n cachedStoreConfig = storeConfigString\n ? (JSON.parse(storeConfigString) as {\n customerAccessTokenLifetime?: number;\n })\n : {};\n } catch {\n cachedStoreConfig = {};\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 2026 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 {\n verifyToken,\n getCustomerRolePermissions,\n getAdobeCommerceOptimizerData,\n} 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 } =\n 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\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 2026 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 websiteName: response?.data?.storeConfig?.website_name || '',\n shoppingAssistanceEnabled:\n response?.data?.storeConfig?.shopping_assistance_enabled || false,\n shoppingAssistanceCheckboxTitle:\n response?.data?.storeConfig?.shopping_assistance_checkbox_title || '',\n shoppingAssistanceCheckboxTooltip:\n response?.data?.storeConfig?.shopping_assistance_checkbox_tooltip || '',\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 2026 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 allowRemoteShoppingAssistance:\n response?.data?.customer?.allow_remote_shopping_assistance,\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 2026 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 2026 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 2026 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 2026 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 let storeConfig = {};\n\n try {\n storeConfig = storeConfigRaw ? JSON.parse(storeConfigRaw) : {};\n } catch {\n storeConfig = {};\n }\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 2026 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 2026 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 interface JwtPayload {\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n sub?: string;\n admin_id?: number; // Admin user indicator\n uid?: number; // User ID\n utypid?: number; // User type ID\n}\n\n/**\n * Decodes JWT token payload without verification\n * JWT format: header.payload.signature\n * Only decodes the payload part (base64url encoded)\n *\n * @param token - JWT token string\n * @returns Decoded payload object or null if invalid\n */\nexport const decodeJwtToken = (token: string): JwtPayload | null => {\n if (!token || typeof token !== 'string') {\n return null;\n }\n\n try {\n // Split JWT into parts\n const parts = token.split('.');\n\n if (parts.length !== 3) {\n console.error('[decodeJwtToken] Invalid JWT format: expected 3 parts');\n return null;\n }\n\n // Get payload (second part)\n const payload = parts[1];\n\n // Base64url decode: replace URL-safe chars and add padding if needed\n const base64 = payload.replace(/-/g, '+').replace(/_/g, '/');\n const paddedBase64 = base64.padEnd(\n base64.length + ((4 - (base64.length % 4)) % 4),\n '='\n );\n\n // Decode base64 to JSON string\n const jsonPayload = atob(paddedBase64);\n\n // Parse JSON\n return JSON.parse(jsonPayload) as JwtPayload;\n } catch (error) {\n console.error('[decodeJwtToken] Failed to decode JWT:', error);\n return null;\n }\n};\n\n/**\n * Checks if the JWT token belongs to an admin user\n *\n * @param token - JWT token string\n * @returns true if token indicates admin user, false otherwise\n */\nexport const isAdminToken = (token: string): boolean => {\n const payload = decodeJwtToken(token);\n\n if (!payload) {\n return false;\n }\n\n // Check for admin_id as a positive number\n if (typeof payload.admin_id === 'number' && payload.admin_id > 0) {\n return true;\n }\n\n return false;\n};\n\n/**\n * Gets JWT token expiration as Max-Age string for cookie\n *\n * @param token - JWT token string\n * @param defaultMaxAge - Default Max-Age string to return if token is invalid or missing exp claim (e.g., \"Max-Age=3600\")\n * @returns Max-Age string for cookie (e.g., \"Max-Age=3600\") based on token exp or defaultMaxAge\n */\nexport const getTokenExpiration = (\n token: string,\n defaultMaxAge: string\n): string => {\n const payload = decodeJwtToken(token);\n\n // Check if payload exists and exp is a valid positive number\n if (payload && typeof payload.exp === 'number' && payload.exp > 0) {\n const now = Math.floor(Date.now() / 1000); // Current time in seconds\n const secondsRemaining = Math.max(0, payload.exp - now);\n return `Max-Age=${secondsRemaining}`;\n }\n\n return defaultMaxAge;\n};","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2026 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, deleteCookie } from '@/auth/lib/cookieUtils';\nimport { publishEvents, EventsList } from '@/auth/lib/acdl';\nimport { setReCaptchaToken } from '@/auth/lib/setReCaptchaToken';\nimport { emitAuthGroupIdEvent } from '@/auth/lib/emitAuthGroupId';\nimport { getTokenExpiration, isAdminToken } from '@/auth/lib/jwtUtils';\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 userLastName = responseCustomer?.lastName ?? '';\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(\n window.location.hostname\n )\n ? ''\n : 'Secure';\n\n document.cookie = `${COOKIE_NAMES.auth_dropin_firstname}=${encodeURIComponent(userName)}; path=/; ${cookiesLifetime}; SameSite=Lax; ${cookieSecureFlag};`;\n document.cookie = `${COOKIE_NAMES.auth_dropin_lastname}=${encodeURIComponent(userLastName)}; path=/; ${cookiesLifetime}; SameSite=Lax; ${cookieSecureFlag};`;\n document.cookie = `${COOKIE_NAMES.auth_dropin_user_token}=${encodeURIComponent(userToken)}; path=/; ${cookiesLifetime}; SameSite=Lax; ${cookieSecureFlag};`;\n\n if (isAdminToken(userToken)) {\n const adminTokenLifetime = getTokenExpiration(userToken, cookiesLifetime);\n document.cookie = `${COOKIE_NAMES.auth_dropin_admin_session}=true; path=/; ${adminTokenLifetime}; SameSite=Lax; ${cookieSecureFlag};`;\n } else {\n deleteCookie(COOKIE_NAMES.auth_dropin_admin_session);\n }\n\n await emitAuthGroupIdEvent(\n userToken ? responseCustomer?.groupUid : undefined\n );\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 2026 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 website_name\n shopping_assistance_enabled\n shopping_assistance_checkbox_title\n shopping_assistance_checkbox_tooltip\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 2026 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 2026 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 2026 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 deleteCookie(COOKIE_NAMES.auth_dropin_firstname);\n deleteCookie(COOKIE_NAMES.auth_dropin_lastname);\n deleteCookie(COOKIE_NAMES.auth_dropin_admin_session);\n removeFetchGraphQlHeader(authType);\n await emitAuthGroupIdEvent();\n events.emit('authenticated', false);\n return false;\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2026 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 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 COOKIE_NAMES.auth_dropin_lastname,\n COOKIE_NAMES.auth_dropin_admin_session,\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","cachedStoreConfig","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","CREATE_CUSTOMER","CUSTOMER_INFORMATION_FRAGMENT","CREATE_CUSTOMER_V2","handleNetworkError","setReCaptchaToken","verifyReCaptcha","transformAccount","data","transformStoreConfig","response","_b","_a","_d","_c","_f","_e","_h","_g","_j","_i","_l","_k","_n","_m","_p","_o","_r","_q","transformPasswordResetEmail","message","transformRevokeCustomerToken","transformCustomerData","model","merge","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","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","decodeJwtToken","parts","base64","paddedBase64","jsonPayload","isAdminToken","payload","getTokenExpiration","defaultMaxAge","now","getCustomerToken","email","password","translations","onErrorCallback","handleSetInLineAlertProps","apiErrorMessageOverride","defaultErrorMessage","displayErrorMessage","userToken","responseCustomer","userName","userLastName","userEmail","cookiesLifetime","cookieSecureFlag","adminTokenLifetime","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":"gUAiBA,MAAMA,EAAe,CACnB,uBAAwB,yBACxB,sBAAuB,wBACvB,qBAAsB,uBACtB,0BAA2B,2BAC7B,EAEMC,GAAY,CAAC,YAAa,YAAa,KAAK,EAE5CC,EAAkB,KCLXC,EAAaC,GAAuB,CA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