@dropins/storefront-auth 3.3.0-beta.2 → 4.0.0-alpha-20260601092829
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -11
- package/api/createCustomer/graphql/createCustomer.graphql.d.ts +1 -1
- package/api/createCustomer/graphql/createCustomerV2.graphql.d.ts +1 -1
- package/api/getCustomerData/graphql/getCustomerData.graphql.d.ts +2 -2
- package/api/getCustomerToken/graphql/getCustomerToken.graphql.d.ts +1 -1
- package/api/getStoreConfig/graphql/getStoreConfig.graphql.d.ts +2 -2
- package/api/graphql/CustomerFragment.graphql.d.ts +2 -2
- package/api/revokeCustomerToken/graphql/revokeCustomerToken.graphql.d.ts +1 -1
- package/api/verifyToken/graphql/verifyToken.graphql.d.ts +1 -1
- package/api/verifyToken/verifyToken.d.ts +1 -1
- package/api.js +1 -179
- package/api.js.map +1 -1
- package/chunks/Button.js +4 -0
- package/chunks/Button.js.map +1 -0
- package/chunks/RemoteShoppingAssistanceConsent.js +4 -0
- package/chunks/RemoteShoppingAssistanceConsent.js.map +1 -0
- package/chunks/RemoteShoppingAssistanceConsent2.js +4 -0
- package/chunks/RemoteShoppingAssistanceConsent2.js.map +1 -0
- package/chunks/ResetPasswordForm.js +4 -0
- package/chunks/ResetPasswordForm.js.map +1 -0
- package/chunks/SignInForm.js +4 -0
- package/chunks/SignInForm.js.map +1 -0
- package/chunks/SkeletonLoader.js +4 -0
- package/chunks/SkeletonLoader.js.map +1 -0
- package/chunks/acdl.js +4 -0
- package/chunks/acdl.js.map +1 -0
- package/chunks/confirmEmail.js +14 -0
- package/chunks/confirmEmail.js.map +1 -0
- package/chunks/createCustomerAddress.js +60 -0
- package/chunks/createCustomerAddress.js.map +1 -0
- package/chunks/focusOnEmptyPasswordField.js +4 -0
- package/chunks/focusOnEmptyPasswordField.js.map +1 -0
- package/chunks/getAdobeCommerceOptimizerData.js +70 -0
- package/chunks/getAdobeCommerceOptimizerData.js.map +1 -0
- package/chunks/getCustomerToken.js +17 -0
- package/chunks/getCustomerToken.js.map +1 -0
- package/chunks/index.js +4 -0
- package/chunks/index.js.map +1 -0
- package/chunks/index2.js +4 -0
- package/chunks/index2.js.map +1 -0
- package/chunks/index3.js +4 -0
- package/chunks/index3.js.map +1 -0
- package/chunks/network-error.js +4 -0
- package/chunks/network-error.js.map +1 -0
- package/chunks/requestPasswordResetEmail.js +8 -0
- package/chunks/requestPasswordResetEmail.js.map +1 -0
- package/chunks/resendConfirmationEmail.js +8 -0
- package/chunks/resendConfirmationEmail.js.map +1 -0
- package/chunks/resetPassword.js +16 -0
- package/chunks/resetPassword.js.map +1 -0
- package/chunks/revokeCustomerToken.js +11 -0
- package/chunks/revokeCustomerToken.js.map +1 -0
- package/chunks/setReCaptchaToken.js +4 -0
- package/chunks/setReCaptchaToken.js.map +1 -0
- package/chunks/simplifyTransformAttributesForm.js +4 -0
- package/chunks/simplifyTransformAttributesForm.js.map +1 -0
- package/chunks/transform-attributes-form.js +4 -0
- package/chunks/transform-attributes-form.js.map +1 -0
- package/chunks/usePasswordValidationMessage.js +4 -0
- package/chunks/usePasswordValidationMessage.js.map +1 -0
- package/components/RemoteShoppingAssistanceConsent/RemoteShoppingAssistanceConsent.d.ts +12 -0
- package/components/RemoteShoppingAssistanceConsent/index.d.ts +19 -0
- package/components/index.d.ts +2 -1
- package/configs/cookieConfigs.d.ts +3 -1
- package/containers/AuthCombine.js +1 -1
- package/containers/AuthCombine.js.map +1 -1
- package/containers/ResetPassword.js +1 -1
- package/containers/ResetPassword.js.map +1 -1
- package/containers/SignIn.js +1 -1
- package/containers/SignIn.js.map +1 -1
- package/containers/SignUp.js +1 -1
- package/containers/SignUp.js.map +1 -1
- package/containers/SuccessNotification.js +1 -1
- package/containers/SuccessNotification.js.map +1 -1
- package/containers/UpdatePassword.js +1 -1
- package/containers/UpdatePassword.js.map +1 -1
- package/data/models/customer-data.d.ts +2 -1
- package/data/models/store-config.d.ts +5 -1
- package/fragments.js +12 -1
- package/fragments.js.map +1 -1
- package/hooks/api/useGetStoreConfigs.d.ts +6 -1
- package/i18n/en_US.json.d.ts +2 -0
- package/lib/acdl.d.ts +1 -1
- package/lib/cookieUtils.d.ts +1 -1
- package/lib/emitAuthGroupId.d.ts +1 -1
- package/lib/jwtUtils.d.ts +50 -0
- package/lib/mergeFormObjects.d.ts +1 -1
- package/package.json +1 -1
- package/render.js +2 -2
- package/render.js.map +1 -1
- package/types/api/getCustomerData.types.d.ts +2 -1
- package/types/api/storeConfig.types.d.ts +5 -1
- package/types/signUp.types.d.ts +4 -2
- package/chunks/components.js +0 -4
- package/chunks/components.js.map +0 -1
package/chunks/acdl.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
const u=t=>({firstName:t.firstName,lastName:t.lastName,emailAddress:(t==null?void 0:t.email)||"",accountId:(t==null?void 0:t.email)||""}),i="accountContext",C="channelContext";var l=(t=>(t.CREATE_ACCOUNT_EVENT="create-account",t.SIGN_IN="sign-in",t.SIGN_OUT="sign-out",t))(l||{});const c={CREATE_ACCOUNT:"create-account",SIGN_IN:"sign-in",SIGN_OUT:"sign-out"};function N(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function s(t,n){const o=N();o.push({[t]:null}),o.push({[t]:n})}function g(){s(C,{_id:"https://ns.adobe.com/xdm/channels/web",_type:"https://ns.adobe.com/xdm/channel-types/web"})}function r(t,n){N().push(e=>{const a=e.getState?e.getState():{};e.push({event:t,eventInfo:{...a,...n}})})}function h(t){const n=u(t);s(i,n),r(c.CREATE_ACCOUNT)}function b(t){const n=u(t);s(i,n),r(c.SIGN_IN)}function f(){r(c.SIGN_OUT)}const E=(t,n)=>{const o=sessionStorage.getItem("storeConfig");let e={};try{e=o?JSON.parse(o):{}}catch{e={}}const a={...e,...n};switch(g(),t){case"create-account":h(a);break;case"sign-in":b(a);break;case"sign-out":f();break;default:return null}};export{l as E,E as p};
|
|
4
|
+
//# sourceMappingURL=acdl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acdl.js","sources":["/@dropins/storefront-auth/src/data/transforms/transform-auth.ts","/@dropins/storefront-auth/src/lib/acdl.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { 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 { 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"],"names":["transformAccount","data","ACCOUNT_CONTEXT","CHANNEL_CONTEXT","EventsList","events","getAdobeDataLayer","setContext","name","adobeDataLayer","setChannelContext","pushEvent","event","additionalContext","acdl","state","createAccountEvent","eventData","accountData","loginEvent","logoutEvent","publishEvents","eventType","eventParams","storeConfigRaw","storeConfig"],"mappings":"AAwBO,MAAMA,EAAoBC,IACxB,CACL,UAAWA,EAAK,UAChB,SAAUA,EAAK,SACf,cAAcA,GA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AAa,EAC3D,IAAIC,EAAc,CAAA,EAElB,GAAI,CACFA,EAAcD,EAAiB,KAAK,MAAMA,CAAc,EAAI,CAAA,CAC9D,MAAQ,CACNC,EAAc,CAAA,CAChB,CAEA,MAAMR,EAAY,CAAE,GAAGQ,EAAa,GAAGF,CAAA,EAIvC,OAFAb,EAAA,EAEQY,EAAA,CACN,IAAK,iBACHN,EAAmBC,CAAS,EAC5B,MAEF,IAAK,UACHE,EAAWF,CAAS,EACpB,MAEF,IAAK,WACHG,EAAA,EACA,MAEF,QACE,OAAO,IAAA,CAEb"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{f as o,h as r}from"./network-error.js";const t=`
|
|
4
|
+
mutation CONFIRM_EMAIL($email: String!, $confirmation_key: String!) {
|
|
5
|
+
confirmEmail(
|
|
6
|
+
input: { email: $email, confirmation_key: $confirmation_key }
|
|
7
|
+
) {
|
|
8
|
+
customer {
|
|
9
|
+
email
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`,m=async({customerEmail:i,customerConfirmationKey:a})=>await o(t,{method:"POST",variables:{email:i,confirmation_key:a}}).catch(r);export{m as c};
|
|
14
|
+
//# sourceMappingURL=confirmEmail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirmEmail.js","sources":["/@dropins/storefront-auth/src/api/confirmEmail/graphql/confirmEmail.graphql.ts","/@dropins/storefront-auth/src/api/confirmEmail/confirmEmail.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\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"],"names":["CONFIRM_EMAIL","confirmEmail","customerEmail","customerConfirmationKey","fetchGraphQl","handleNetworkError"],"mappings":"8CAiBO,MAAMA,EAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECK9BC,EAAe,MAAO,CACjC,cAAAC,EACA,wBAAAC,CACF,IACS,MAAMC,EAAaJ,EAAe,CACvC,OAAQ,OACR,UAAW,CACT,MAAOE,EACP,iBAAkBC,CAAA,CACpB,CACD,EAAE,MAAME,CAAkB"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{CUSTOMER_INFORMATION_FRAGMENT as O}from"../fragments.js";import{f as s,h as u}from"./network-error.js";import{s as b}from"./setReCaptchaToken.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{merge as N}from"@dropins/tools/lib.js";import{c as p,h as S}from"./getAdobeCommerceOptimizerData.js";import{t as F}from"./transform-attributes-form.js";const I=`
|
|
4
|
+
mutation CREATE_CUSTOMER($input: CustomerInput!) {
|
|
5
|
+
createCustomer(input: $input) {
|
|
6
|
+
customer {
|
|
7
|
+
...CUSTOMER_INFORMATION_FRAGMENT
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
${O}
|
|
12
|
+
`,U=`
|
|
13
|
+
mutation CREATE_CUSTOMER_V2($input: CustomerCreateInput!) {
|
|
14
|
+
createCustomerV2(input: $input) {
|
|
15
|
+
customer {
|
|
16
|
+
...CUSTOMER_INFORMATION_FRAGMENT
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
${O}
|
|
21
|
+
`,g=(r,e)=>{var a,i,c,n,C,l,E,T,_,f,R,A,h,d,m,M;let o;if(e){const{data:t}=r;o={firstName:((i=(a=t==null?void 0:t.createCustomerV2)==null?void 0:a.customer)==null?void 0:i.firstname)??"",lastName:((n=(c=t==null?void 0:t.createCustomerV2)==null?void 0:c.customer)==null?void 0:n.lastname)??"",email:((l=(C=t==null?void 0:t.createCustomerV2)==null?void 0:C.customer)==null?void 0:l.email)??"",customAttributes:((E=t==null?void 0:t.createCustomerV2)==null?void 0:E.custom_attributes)??[],errors:(r==null?void 0:r.errors)??[]}}else{const{data:t}=r;o={firstName:((_=(T=t==null?void 0:t.createCustomer)==null?void 0:T.customer)==null?void 0:_.firstname)??"",lastName:((R=(f=t==null?void 0:t.createCustomer)==null?void 0:f.customer)==null?void 0:R.lastname)??"",email:((h=(A=t==null?void 0:t.createCustomer)==null?void 0:A.customer)==null?void 0:h.email)??"",errors:(r==null?void 0:r.errors)??[]}}return N(o,(M=(m=(d=p.getConfig().models)==null?void 0:d.CustomerModel)==null?void 0:m.transformer)==null?void 0:M.call(m,r))},$=r=>{if(!r.dob)return r;const{dob:e,...o}=r;return{...o,date_of_birth:e}},x=async(r,e)=>{await b();const o=await s(e?U:I,{method:"POST",variables:{input:{...$(r)}}}).catch(u);return g(o,e)},v=`
|
|
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
|
+
`,Q=async r=>await s(v,{method:"GET",cache:"force-cache",variables:{formCode:r}}).then(e=>{var o;return(o=e.errors)!=null&&o.length?S(e.errors):F(e)}).catch(u),y=`
|
|
54
|
+
mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {
|
|
55
|
+
createCustomerAddress(input: $input) {
|
|
56
|
+
firstname
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
`,j=async r=>await s(y,{method:"POST",variables:{input:r}}).then(e=>{var o;return(o=e.errors)!=null&&o.length?S(e.errors):e.data.createCustomerAddress.firstname||""}).catch(u);export{j as a,x as c,Q as g};
|
|
60
|
+
//# sourceMappingURL=createCustomerAddress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createCustomerAddress.js","sources":["/@dropins/storefront-auth/src/api/createCustomer/graphql/createCustomer.graphql.ts","/@dropins/storefront-auth/src/api/createCustomer/graphql/createCustomerV2.graphql.ts","/@dropins/storefront-auth/src/data/transforms/transform-create-customer.tsx","/@dropins/storefront-auth/src/lib/transformDobForm.ts","/@dropins/storefront-auth/src/api/createCustomer/createCustomer.ts","/@dropins/storefront-auth/src/api/getAttributesForm/graphql/getAttributesForm.graphql.ts","/@dropins/storefront-auth/src/api/getAttributesForm/getAttributesForm.ts","/@dropins/storefront-auth/src/api/createCustomerAddress/graphql/createCustomerAddress.graphql.ts","/@dropins/storefront-auth/src/api/createCustomerAddress/createCustomerAddress.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CUSTOMER_INFORMATION_FRAGMENT } from '@/auth/api/fragments';\n\nexport const CREATE_CUSTOMER = /* GraphQL */ `\n mutation CREATE_CUSTOMER($input: CustomerInput!) {\n createCustomer(input: $input) {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n }\n ${CUSTOMER_INFORMATION_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CUSTOMER_INFORMATION_FRAGMENT } from '@/auth/api/fragments';\n\nexport const CREATE_CUSTOMER_V2 = /* GraphQL */ `\n mutation CREATE_CUSTOMER_V2($input: CustomerCreateInput!) {\n createCustomerV2(input: $input) {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n }\n ${CUSTOMER_INFORMATION_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { DataCreateCustomerV2, DataCreateCustomer } from '@/auth/types';\nimport { config } from '@/auth/api';\nimport { merge } from '@adobe-commerce/elsie/lib';\nimport { CustomerModel } from '../models';\n\ntype ApiResponse<T extends boolean> = T extends true\n ? DataCreateCustomerV2\n : DataCreateCustomer;\n\nexport const transformCreateCustomer = <T extends boolean>(\n response: ApiResponse<T>,\n apiVersion2: T\n): CustomerModel => {\n let model: CustomerModel;\n\n if (apiVersion2) {\n const { data } = response as DataCreateCustomerV2;\n\n model = {\n firstName: data?.createCustomerV2?.customer?.firstname ?? '',\n lastName: data?.createCustomerV2?.customer?.lastname ?? '',\n email: data?.createCustomerV2?.customer?.email ?? '',\n customAttributes: data?.createCustomerV2?.custom_attributes ?? [],\n errors: response?.errors ?? [],\n };\n } else {\n const { data } = response as DataCreateCustomer;\n\n model = {\n firstName: data?.createCustomer?.customer?.firstname ?? '',\n lastName: data?.createCustomer?.customer?.lastname ?? '',\n email: data?.createCustomer?.customer?.email ?? '',\n errors: response?.errors ?? [],\n };\n }\n\n return merge(\n model, // default transformer\n config.getConfig().models?.CustomerModel?.transformer?.(response) // custom transformer\n );\n};\n","export const transformDobForm = (\n form: Record<string, any>\n): Record<string, any> => {\n if (!form.dob) return form;\n\n const { dob, ...rest } = form;\n return { ...rest, date_of_birth: dob };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Customer } from '@/auth/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { CREATE_CUSTOMER } from './graphql/createCustomer.graphql';\nimport { CREATE_CUSTOMER_V2 } from './graphql/createCustomerV2.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { setReCaptchaToken } from '@/auth/lib/setReCaptchaToken';\nimport { transformCreateCustomer } from '@/auth/data/transforms';\nimport { CustomerModel } from '@/auth/data/models';\nimport { transformDobForm } from '@/auth/lib/transformDobForm';\n\nexport const createCustomer = async (\n forms: Customer,\n apiVersion2: boolean\n): Promise<CustomerModel> => {\n await setReCaptchaToken();\n\n const response = await fetchGraphQl(\n apiVersion2 ? CREATE_CUSTOMER_V2 : CREATE_CUSTOMER,\n {\n method: 'POST',\n variables: {\n input: {\n ...transformDobForm(forms),\n },\n },\n }\n ).catch(handleNetworkError);\n\n return transformCreateCustomer(response, apiVersion2);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_ATTRIBUTES_FORM = /* GraphQL */ `\n query GET_ATTRIBUTES_FORM($formCode: String!) {\n attributesForm(formCode: $formCode) {\n items {\n code\n default_value\n entity_type\n frontend_class\n frontend_input\n is_required\n is_unique\n label\n options {\n is_default\n label\n value\n }\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n validate_rules {\n name\n value\n }\n }\n }\n errors {\n type\n message\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { GET_ATTRIBUTES_FORM } from './graphql/getAttributesForm.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { transformAttributesForm } from '@/auth/data/transforms';\nimport { handleFetchError } from '@/auth/lib/fetch-error';\nimport { AttributesFormModel } from '@/auth/data/models';\nimport { GetAttributesFormResponse } from '@/auth/types';\n\nexport const getAttributesForm = async (\n formCode: string\n): Promise<AttributesFormModel[]> => {\n return await fetchGraphQl(GET_ATTRIBUTES_FORM, {\n method: 'GET',\n cache: 'force-cache',\n variables: { formCode },\n })\n .then((response: GetAttributesFormResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return transformAttributesForm(response);\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const CREATE_CUSTOMER_ADDRESS = /* GraphQL */ `\n mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {\n createCustomerAddress(input: $input) {\n firstname\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { AddressFormProps, CreateCustomerAddressResponse } from '@/auth/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { CREATE_CUSTOMER_ADDRESS } from './graphql/createCustomerAddress.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { handleFetchError } from '@/auth/lib/fetch-error';\n\nexport const createCustomerAddress = async (\n address: AddressFormProps\n): Promise<string> => {\n return await fetchGraphQl(CREATE_CUSTOMER_ADDRESS, {\n method: 'POST',\n variables: {\n input: address,\n },\n })\n .then((response: CreateCustomerAddressResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response.data.createCustomerAddress.firstname || '';\n })\n .catch(handleNetworkError);\n};\n"],"names":["CREATE_CUSTOMER","CUSTOMER_INFORMATION_FRAGMENT","CREATE_CUSTOMER_V2","transformCreateCustomer","response","apiVersion2","model","data","_b","_a","_d","_c","_f","_e","_g","_i","_h","_k","_j","_m","_l","merge","_p","_o","_n","config","transformDobForm","form","dob","rest","createCustomer","forms","setReCaptchaToken","fetchGraphQl","handleNetworkError","GET_ATTRIBUTES_FORM","getAttributesForm","formCode","handleFetchError","transformAttribut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AiB,OAAe6B,EAAiBlC,EAAS,MAAM,EAE7DA,EAAS,KAAK,sBAAsB,WAAa,EAC1D,CAAC,EACA,MAAM8B,CAAkB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsxs as c,jsx as m}from"@dropins/tools/preact-jsx-runtime.js";import{classes as b}from"@dropins/tools/lib.js";import{InLineAlert as y,Header as p}from"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{r as C}from"./resendConfirmationEmail.js";import{useState as x,useCallback as E}from"@dropins/tools/preact-hooks.js";import{useText as u}from"@dropins/tools/i18n.js";import"./RemoteShoppingAssistanceConsent.js";import{B as f}from"./Button.js";const g=({userEmail:o,handleSetInLineAlertProps:t})=>{const a=u({emailConfirmationMessage:"Auth.Notification.emailConfirmationMessage",technicalErrorSendEmail:"Auth.Notification.technicalErrors.technicalErrorSendEmail"}),[r,e]=x(!1);return{handleEmailConfirmation:E(async()=>{var n,s;if(e(!0),o){const i=await C(o);if(i){const d=(n=i==null?void 0:i.errors)==null?void 0:n.length,h=(s=i==null?void 0:i.data)==null?void 0:s.resendConfirmationEmail;t(d?{type:"error",text:a.technicalErrorSendEmail}:{type:h?"success":"error",text:a.emailConfirmationMessage})}}e(!1)},[t,a,o]),disabledButton:r}},I=({formSize:o,userEmail:t,inLineAlertProps:a,hideCloseBtnOnEmailConfirmation:r,handleSetInLineAlertProps:e,onPrimaryButtonClick:l})=>{const n=u({title:"Auth.EmailConfirmationForm.title",subtitle:"Auth.EmailConfirmationForm.subtitle",mainText:"Auth.EmailConfirmationForm.mainText",buttonPrimary:"Auth.EmailConfirmationForm.buttonPrimary",buttonSecondary:"Auth.EmailConfirmationForm.buttonSecondary"}),{handleEmailConfirmation:s,disabledButton:i}=g({userEmail:t,handleSetInLineAlertProps:e});return c("div",{className:b(["auth-email-confirmation-form",`auth-email-confirmation-form--${o}`]),children:[a.text?m(y,{className:"auth-signInForm__notification",type:a.type,variant:"secondary",heading:a.text,icon:a.icon,"data-testid":"authInLineAlert"}):null,m(p,{title:n.title,divider:!1,className:"auth-email-confirmation-form__title"}),t!=null&&t.length?m("span",{className:"auth-email-confirmation-form__subtitle",children:`${n.subtitle} ${t}`}):null,m("span",{className:"auth-email-confirmation-form__text",children:n.mainText}),c("div",{className:"auth-email-confirmation-form__buttons",children:[m(f,{type:"button",variant:"tertiary",style:{padding:0},buttonText:n.buttonSecondary,enableLoader:!1,onClick:s,disabled:i}),r?null:m(f,{type:"submit",buttonText:n.buttonPrimary,variant:"primary",enableLoader:!1,disabled:i,onClick:l})]})]})},M=(o,t,a)=>{const r=o.target.querySelector('input[name="password"]'),e=o.target.querySelector('input[name="confirmPasswordField"]');r&&!t.length?r.focus():e&&!a.length&&e.focus()};export{I as E,M as f};
|
|
4
|
+
//# sourceMappingURL=focusOnEmptyPasswordField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focusOnEmptyPasswordField.js","sources":["/@dropins/storefront-auth/src/hooks/components/useEmailConfirmationForm.tsx","/@dropins/storefront-auth/src/components/EmailConfirmationForm/EmailConfirmationForm.tsx","/@dropins/storefront-auth/src/lib/focusOnEmptyPasswordField.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { resendConfirmationEmail } from '@/auth/api';\nimport { useEmailConfirmationFormProps } from '@/auth/types';\nimport { useCallback, useState } from 'preact/hooks';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nexport const useEmailConfirmationForm = ({\n userEmail,\n handleSetInLineAlertProps,\n}: useEmailConfirmationFormProps) => {\n const translations = useText({\n emailConfirmationMessage: 'Auth.Notification.emailConfirmationMessage',\n technicalErrorSendEmail:\n 'Auth.Notification.technicalErrors.technicalErrorSendEmail',\n });\n\n const [disabledButton, setDisabledButton] = useState(false);\n\n const handleEmailConfirmation = useCallback(async () => {\n setDisabledButton(true);\n\n if (userEmail) {\n const response = await resendConfirmationEmail(userEmail);\n\n if (response) {\n const errors = response?.errors?.length;\n const isEmailResend = response?.data?.resendConfirmationEmail;\n\n if (errors) {\n handleSetInLineAlertProps({\n type: 'error',\n text: translations.technicalErrorSendEmail,\n });\n } else {\n handleSetInLineAlertProps({\n type: isEmailResend ? 'success' : 'error',\n text: translations.emailConfirmationMessage,\n });\n }\n }\n }\n\n setDisabledButton(false);\n }, [handleSetInLineAlertProps, translations, userEmail]);\n\n return { handleEmailConfirmation, disabledButton };\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 { Button } from '@/auth/components';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { FunctionComponent } from 'preact';\nimport { Header, InLineAlert } from '@adobe-commerce/elsie/components';\nimport { useEmailConfirmationForm } from '@/auth/hooks/components/useEmailConfirmationForm';\nimport { EmailConfirmationFormProps } from '@/auth/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/auth/components/EmailConfirmationForm/EmailConfirmationForm.css';\n\nexport const EmailConfirmationForm: FunctionComponent<\n EmailConfirmationFormProps\n> = ({\n formSize,\n userEmail,\n inLineAlertProps,\n hideCloseBtnOnEmailConfirmation,\n handleSetInLineAlertProps,\n onPrimaryButtonClick,\n}) => {\n const translations = useText({\n title: 'Auth.EmailConfirmationForm.title',\n subtitle: 'Auth.EmailConfirmationForm.subtitle',\n mainText: 'Auth.EmailConfirmationForm.mainText',\n buttonPrimary: 'Auth.EmailConfirmationForm.buttonPrimary',\n buttonSecondary: 'Auth.EmailConfirmationForm.buttonSecondary',\n });\n\n const { handleEmailConfirmation, disabledButton } = useEmailConfirmationForm({\n userEmail,\n handleSetInLineAlertProps,\n });\n\n return (\n <div\n className={classes([\n 'auth-email-confirmation-form',\n `auth-email-confirmation-form--${formSize}`,\n ])}\n >\n {inLineAlertProps.text ? (\n <InLineAlert\n className=\"auth-signInForm__notification\"\n type={inLineAlertProps.type}\n variant=\"secondary\"\n heading={inLineAlertProps.text}\n icon={inLineAlertProps.icon}\n data-testid=\"authInLineAlert\"\n />\n ) : null}\n <Header\n title={translations.title}\n divider={false}\n className=\"auth-email-confirmation-form__title\"\n />\n {userEmail?.length ? (\n <span className=\"auth-email-confirmation-form__subtitle\">{`${translations.subtitle} ${userEmail}`}</span>\n ) : null}\n <span className=\"auth-email-confirmation-form__text\">\n {translations.mainText}\n </span>\n <div className=\"auth-email-confirmation-form__buttons\">\n <Button\n type=\"button\"\n variant=\"tertiary\"\n style={{ padding: 0 }}\n buttonText={translations.buttonSecondary}\n enableLoader={false}\n onClick={handleEmailConfirmation}\n disabled={disabledButton}\n />\n {hideCloseBtnOnEmailConfirmation ? null : (\n <Button\n type=\"submit\"\n buttonText={translations.buttonPrimary}\n variant=\"primary\"\n enableLoader={false}\n disabled={disabledButton}\n onClick={onPrimaryButtonClick}\n />\n )}\n </div>\n </div>\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 focusOnEmptyPasswordField = (\n event: Event,\n signUpPasswordValue: string,\n confirmPassword: string\n) => {\n const emptyInputPassword = (event.target as HTMLFormElement).querySelector(\n 'input[name=\"password\"]'\n );\n const emptyInputConfirmPassword = (\n event.target as HTMLFormElement\n ).querySelector('input[name=\"confirmPasswordField\"]');\n\n if (emptyInputPassword && !signUpPasswordValue.length) {\n (emptyInputPassword as HTMLInputElement).focus();\n } else if (emptyInputConfirmPassword && !confirmPassword.length) {\n (emptyInputConfirmPassword as HTMLInputElement).focus();\n }\n};\n"],"names":["useEmailConfirmationForm","userEmail","handleSetInLineAlertProps","translations","useText","disabledButton","setDisabledButton","useState","useCallback","response","resendConfirmationEmail","errors","_a","isEmailResend","_b","EmailConfirmationForm","formSize","inLineAlertProps","hideCloseBtnOnEmailConfirmation","onPrimaryButtonClick","handleEmailConfirmation","jsxs","classes","jsx","InLineAlert","Header","Button","focusOnEmptyPasswordField","event","signUpPasswordValue","confirmPassword","emptyInputPassword","emptyInputConfirmPassword"],"mappings":"8fAsBO,MAAMA,EAA2B,CAAC,CACvC,UAAAC,EACA,0BAAAC,CACF,IAAqC,CACnC,MAAMC,EAAeC,EAAQ,CAC3B,yBAA0B,6CAC1B,wBACE,2DAAA,CACH,EAEK,CAACC,EAAgBC,CAAiB,EAAIC,EAAS,EAAK,EA6B1D,MAAO,CAAE,wBA3BuBC,EAAY,SAAY,SAGtD,GAFAF,EAAkB,EAAI,EAElBL,EAAW,CACb,MAAMQ,EAAW,MAAMC,EAAwBT,CAAS,EAExD,GAAIQ,EAAU,CACZ,MAAME,GAASC,EAAAH,GAAA,YAAAA,EAAU,SAAV,YAAAG,EAAkB,OAC3BC,GAAgBC,EAAAL,GAAA,YAAAA,EAAU,OAAV,YAAAK,EAAgB,wBAGpCZ,EADES,EACwB,CACxB,KAA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,SACL,WAAYvB,EAAa,cACzB,QAAQ,UACR,aAAc,GACd,SAAUE,EACV,QAASc,CAAA,CAAA,CACX,CAAA,CAEJ,CAAA,CAAA,CAAA,CAGN,ECnFaQ,EAA4B,CACvCC,EACAC,EACAC,IACG,CACH,MAAMC,EAAsBH,EAAM,OAA2B,cAC3D,wBAAA,EAEII,EACJJ,EAAM,OACN,cAAc,oCAAoC,EAEhDG,GAAsB,CAACF,EAAoB,OAC5CE,EAAwC,MAAA,EAChCC,GAA6B,CAACF,EAAgB,QACtDE,EAA+C,MAAA,CAEpD"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{Initializer as x,Config as L}from"@dropins/tools/lib.js";import{events as s}from"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{f as C,h as G,a as N,r as U}from"./network-error.js";const c={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"},ne=["localhost","127.0.0.1","::1"],g=3600,v=e=>{const t=document.cookie.split(";");let r;return t.forEach(o=>{const[a,n]=o.trim().split("=");a===e&&(r=decodeURIComponent(n))}),r},f=e=>{document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`},se=async()=>{try{const e=sessionStorage.getItem("storeConfig");let t={};try{t=e?JSON.parse(e):{}}catch{t={}}let r=t.customerAccessTokenLifetime;if(!r){const o=await $();sessionStorage.setItem("storeConfig",JSON.stringify(o)),r=(o==null?void 0:o.customerAccessTokenLifetime)||g}return`Max-Age=${r}`}catch(e){return console.error("getCookiesLifetime() Error:",e),`Max-Age=${g}`}},p=new L(void 0),O=new x({init:async e=>{const r={...{authHeaderConfig:{header:"Authorization",tokenPrefix:"Bearer"},customerPermissionRoles:!1,adobeCommerceOptimizer:!1},...e};O.config.setConfig(r);const o=v(c.auth_dropin_user_token),[a]=await Promise.all([j(r.authHeaderConfig.header,r.authHeaderConfig.tokenPrefix),r.customerPermissionRoles&&o?M():Promise.resolve(),r.adobeCommerceOptimizer?w():Promise.resolve()]);p.setConfig(a)},listeners:()=>[s.on("authenticated",e=>{const t=p.getConfig();if(t!==void 0&&e!==t){p.setConfig(e);const{customerPermissionRoles:r,adobeCommerceOptimizer:o}=O.config.getConfig();r&&M(),o&&w()}})]}),ce=O.config,z=e=>{var t,r,o,a,n,i,_,m,l,d,A,P,T,b,k,S,y,I;return{autocompleteOnStorefront:((r=(t=e==null?void 0:e.data)==null?void 0:t.storeConfig)==null?void 0:r.autocomplete_on_storefront)||!1,minLength:((a=(o=e==null?void 0:e.data)==null?void 0:o.storeConfig)==null?void 0:a.minimum_password_length)||3,requiredCharacterClasses:+((i=(n=e==null?void 0:e.data)==null?void 0:n.storeConfig)==null?void 0:i.required_character_classes_number)||0,createAccountConfirmation:((m=(_=e==null?void 0:e.data)==null?void 0:_.storeConfig)==null?void 0:m.create_account_confirmation)||!1,customerAccessTokenLifetime:((d=(l=e==null?void 0:e.data)==null?void 0:l.storeConfig)==null?void 0:d.customer_access_token_lifetime)*g||g,websiteName:((P=(A=e==null?void 0:e.data)==null?void 0:A.storeConfig)==null?void 0:P.website_name)||"",shoppingAssistanceEnabled:((b=(T=e==null?void 0:e.data)==null?void 0:T.storeConfig)==null?void 0:b.shopping_assistance_enabled)||!1,shoppingAssistanceCheckboxTitle:((S=(k=e==null?void 0:e.data)==null?void 0:k.storeConfig)==null?void 0:S.shopping_assistance_checkbox_title)||"",shoppingAssistanceCheckboxTooltip:((I=(y=e==null?void 0:e.data)==null?void 0:y.storeConfig)==null?void 0:I.shopping_assistance_checkbox_tooltip)||""}},D=e=>{var t,r;return{priceBookId:((r=(t=e==null?void 0:e.data)==null?void 0:t.commerceOptimizer)==null?void 0:r.priceBookId)||""}},H=e=>{const t=e.map(r=>r.message).join(" ");throw Error(t)},q=async e=>{if(!e||e.trim()==="")return"";try{const t=atob(e),r=new Uint8Array(t.length);for(let i=0;i<t.length;i++)r[i]=t.charCodeAt(i);const o=await crypto.subtle.digest("SHA-1",r);return Array.from(new Uint8Array(o)).map(i=>i.toString(16).padStart(2,"0")).join("")}catch(t){return console.error(`Failed to convert base64 to SHA1: ${t instanceof Error?t.message:"Unknown error"}`),""}},B="b6589fc6ab0dc82cf12099d1c2d40ab994e8410c",E=async e=>{const t=e?await q(e):B;s.emit("auth/group-uid",t)},F=`
|
|
4
|
+
query GET_STORE_CONFIG {
|
|
5
|
+
storeConfig {
|
|
6
|
+
autocomplete_on_storefront
|
|
7
|
+
minimum_password_length
|
|
8
|
+
required_character_classes_number
|
|
9
|
+
store_code
|
|
10
|
+
store_name
|
|
11
|
+
store_group_code
|
|
12
|
+
locale
|
|
13
|
+
create_account_confirmation
|
|
14
|
+
customer_access_token_lifetime
|
|
15
|
+
website_name
|
|
16
|
+
shopping_assistance_enabled
|
|
17
|
+
shopping_assistance_checkbox_title
|
|
18
|
+
shopping_assistance_checkbox_tooltip
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`,$=async()=>await C(F,{method:"GET",cache:"force-cache"}).then(e=>{var t;return(t=e.errors)!=null&&t.length?H(e.errors):z(e)}).catch(G),K=`
|
|
22
|
+
query VALIDATE_TOKEN {
|
|
23
|
+
customer {
|
|
24
|
+
group {
|
|
25
|
+
uid
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
`,j=async(e="Authorization",t="Bearer")=>{const r=v(c.auth_dropin_user_token);return r?(N(e,`${t} ${r}`),C(K).then(async o=>{var n,i,_,m;return!((n=o.errors)!=null&&n.find(l=>{var d;return((d=l.extensions)==null?void 0:d.category)==="graphql-authentication"}))?(await E((m=(_=(i=o.data)==null?void 0:i.customer)==null?void 0:_.group)==null?void 0:m.uid),s.emit("authenticated",!0),!0):(f(c.auth_dropin_user_token),f(c.auth_dropin_firstname),f(c.auth_dropin_lastname),f(c.auth_dropin_admin_session),U(e),await E(),s.emit("authenticated",!1),!1)})):(await E(),s.emit("authenticated",!1),!1)},J=`
|
|
30
|
+
query GET_CUSTOMER_ROLE_PERMISSIONS {
|
|
31
|
+
customer {
|
|
32
|
+
purchase_orders_enabled
|
|
33
|
+
role {
|
|
34
|
+
id
|
|
35
|
+
name
|
|
36
|
+
permissions {
|
|
37
|
+
id
|
|
38
|
+
text
|
|
39
|
+
children {
|
|
40
|
+
id
|
|
41
|
+
text
|
|
42
|
+
children {
|
|
43
|
+
id
|
|
44
|
+
text
|
|
45
|
+
children {
|
|
46
|
+
id
|
|
47
|
+
text
|
|
48
|
+
children {
|
|
49
|
+
id
|
|
50
|
+
text
|
|
51
|
+
children {
|
|
52
|
+
id
|
|
53
|
+
text
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
`;let h=null,u=null;const Q=e=>{const t={},r=o=>{o.forEach(a=>{var n;t[a.id]=!0,(n=a.children)!=null&&n.length&&r(a.children)})};return r(e),t},V=["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"],R="Magento_Sales::place_order",Z=e=>(e==null?void 0:e.id)==="MA=="&&Array.isArray(e.permissions)&&e.permissions.length===0,W=e=>{var t;return(t=e==null?void 0:e.permissions)!=null&&t.length?Q(e.permissions):{}},X=(e,t)=>{if(t===!0)return e;const r={...e};return V.forEach(o=>{r[o]=!1}),r},Y=(e,t)=>{const r=Z(e),o=W(e),a=X(o,t),i={...{all:!0,...r&&{admin:!0}},...a};return!r&&i[R]===void 0&&Object.keys(o).length===0&&(i[R]=!0),i},ee=async()=>{var e,t,r,o;try{const a=await C(J,{method:"GET"}),n=Y((t=(e=a.data)==null?void 0:e.customer)==null?void 0:t.role,(o=(r=a.data)==null?void 0:r.customer)==null?void 0:o.purchase_orders_enabled);return h=n,u=null,n}catch(a){throw u=null,a}},M=()=>h?(s.emit("auth/permissions",h),Promise.resolve(h)):(u||(u=ee().then(e=>(s.emit("auth/permissions",e),e))),u),ue=()=>{h=null,u=null},te=`
|
|
64
|
+
query GET_ADOBE_COMMERCE_OPTIMIZER_DATA {
|
|
65
|
+
commerceOptimizer {
|
|
66
|
+
priceBookId
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
`,w=async()=>{const e=await C(te,{method:"GET"}),t=D(e);return s.emit("auth/adobe-commerce-optimizer",t),t};export{c as C,ne as L,ue as _,M as a,w as b,ce as c,f as d,E as e,se as f,$ as g,H as h,O as i,j as v};
|
|
70
|
+
//# sourceMappingURL=getAdobeCommerceOptimizerData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAdobeCommerceOptimizerData.js","sources":["/@dropins/storefront-auth/src/configs/cookieConfigs.ts","/@dropins/storefront-auth/src/lib/cookieUtils.ts","/@dropins/storefront-auth/src/api/initialize/initialize.ts","/@dropins/storefront-auth/src/data/transforms/transform-store-config.ts","/@dropins/storefront-auth/src/data/transforms/transform-adobe-commerce-optimizer.ts","/@dropins/storefront-auth/src/lib/fetch-error.ts","/@dropins/storefront-auth/src/lib/base64ToSha1.ts","/@dropins/storefront-auth/src/lib/emitAuthGroupId.ts","/@dropins/storefront-auth/src/api/getStoreConfig/graphql/getStoreConfig.graphql.ts","/@dropins/storefront-auth/src/api/getStoreConfig/getStoreConfig.ts","/@dropins/storefront-auth/src/api/verifyToken/graphql/verifyToken.graphql.ts","/@dropins/storefront-auth/src/api/verifyToken/verifyToken.ts","/@dropins/storefront-auth/src/api/getCustomerRolePermissions/graphql/getCustomerRolePermissions.graphql.ts","/@dropins/storefront-auth/src/api/getCustomerRolePermissions/getCustomerRolePermissions.ts","/@dropins/storefront-auth/src/api/getAdobeCommerceOptimizerData/graphql/getAdobeCommerceOptimizerData.graphql.ts","/@dropins/storefront-auth/src/api/getAdobeCommerceOptimizerData/getAdobeCommerceOptimizerData.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 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 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 * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { AdobeCommerceOptimizerModel } from '../models';\n\nexport interface AdobeCommerceOptimizerData {\n priceBookId: string;\n}\n\nexport interface AdobeCommerceOptimizerResponse {\n data?: {\n commerceOptimizer?: AdobeCommerceOptimizerData;\n };\n}\n\nexport const transformAdobeCommerceOptimizerData = (\n response: AdobeCommerceOptimizerResponse\n): AdobeCommerceOptimizerModel => {\n return {\n priceBookId: response?.data?.commerceOptimizer?.priceBookId || '',\n };\n};\n\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/** Actions */\nexport const handleFetchError = (errors: Array<{ message: string }>) => {\n const errorMessage = errors.map((e: any) => e.message).join(' ');\n\n throw Error(errorMessage);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/**\n * Converts a base64 encoded string to a SHA1 hash string\n * @param base64String - The base64 encoded string to convert\n * @returns A promise that resolves to the SHA1 hash as a hexadecimal string, or empty string if input is undefined/null/empty or if conversion fails\n */\nexport const base64ToSha1 = async (\n base64String?: string | null\n): Promise<string> => {\n // Handle edge cases: undefined, null, or empty string\n if (!base64String || base64String.trim() === '') {\n return '';\n }\n\n try {\n // Decode base64 string to binary data\n const binaryString = atob(base64String);\n const bytes = new Uint8Array(binaryString.length);\n for (let i = 0; i < binaryString.length; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n\n // Compute SHA1 hash using Web Crypto API\n const hashBuffer = await crypto.subtle.digest('SHA-1', bytes);\n\n // Convert hash to hexadecimal string\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n const hashHex = hashArray\n .map((byte) => byte.toString(16).padStart(2, '0'))\n .join('');\n\n return hashHex;\n } catch (error) {\n console.error(\n `Failed to convert base64 to SHA1: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n return '';\n }\n};\n\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 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 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 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","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","transformStoreConfig","response","_b","_a","_d","_c","_f","_e","_h","_g","_j","_i","_l","_k","_n","_m","_p","_o","_r","_q","transformAdobeCommerceOptimizerData","handleFetchError","errors","errorMessage","e","base64ToSha1","base64String","binaryString","bytes","hashBuffer","byte","DEFAULT_NLI_CUSTOMER_GROUP_ID","emitAuthGroupIdEvent","groupUid","groupIdHash","GET_STORE_CONFIG","fetchGraphQl","handleNetworkError","VALIDATE_CUSTOMER_TOKEN","authType","type","setFetchGraphQlHeader","res","removeFetchGraphQlHeader","GET_CUSTOMER_ROLE_PERMISSIONS","permissionsCache","fetchPromise","flattenPermissionTree","permissions","flattened","processPermissions","perms","permission","PURCHASE_ORDER_PERMISSIONS","PLACE_ORDER_PERMISSION","isAdminUser","role","getAllPermissions","overridePurchaseOrderPermissions","purchaseOrdersEnabled","result","processUserPermissions","isAdmin","allPermissions","processedPermissions","merged","fetchUserRolePermissions","_resetCache","GET_ADOBE_COMMERCE_OPTIMIZER_DATA","adobeCommerceOptimizerData"],"mappings":"qNAiBA,MAAMA,EAAe,CACnB,uBAAwB,yBACxB,sBAAuB,wBACvB,qBAAsB,uBACtB,0BAA2B,2BAC7B,EAEMC,GAAY,CAAC,YAAa,YAAa,KAAK,EAE5CC,EAAkB,KCLXC,EAAaC,GAAuB,CAC/C,MAAMC,EAAU,SAAS,OAAO,MAAM,GAAG,EACzC,IAAIC,EAEJ,OAAAD,EAAQ,QAASE,GAAW,CAC1B,KAAM,CAACC,EAAMC,CAAK,EAAIF,EAAO,KAAA,EAAO,MAAM,GAAG,EACzCC,IAASJ,IACXE,EAAa,mBAAmBG,CAAK,EAEzC,CAAC,EAEMH,CACT,EAEaI,EAAgBN,GAAuB,CAClD,SAAS,OAAS,GAAGA,CAAU,mDACjC,EAEaO,GAAqB,SAAY,CAC5C,GAAI,CACF,MAAMC,EAAoB,eAAe,QAAQ,aAAa,EAC9D,IAAIC,EAA8D,CAAA,EAElE,GAAI,CACFA,EAAoBD,EACf,KAAK,MAAMA,CAAiB,EAG7B,CAAA,CACN,MAAQ,CACNC,EAAoB,CAAA,CACtB,CAEA,IAAIC,EAAsBD,EAAkB,4BAE5C,GAAI,CAACC,EAAqB,CACxB,MAAMC,EAAc,MAAMC,EAAA,EAE1B,eAAe,QAAQ,cAAe,KAAK,UAAUD,CAAW,CAAC,EAEjED,GACEC,GAAA,YAAAA,EAAa,8BAA+Bb,CAChD,CAEA,MAAO,WAAWY,CAAmB,EACvC,OAASG,EAAO,CACd,eAAQ,MAAM,8BAA+BA,CAAK,EAC3C,WAAWf,CAAe,EACnC,CACF,EC5BMgB,EAAiB,IAAIC,EAA4B,MAAS,EAEnDC,EAAa,IAAIC,EAAyB,CACrD,KAAM,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EhEA,CACT"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{a as x,f as y,h as O}from"./network-error.js";import"@dropins/tools/recaptcha.js";import{events as p}from"@dropins/tools/event-bus.js";import{merge as S}from"@dropins/tools/lib.js";import{c as R,f as G,C as $,d as U,e as C,L as F}from"./getAdobeCommerceOptimizerData.js";import{CUSTOMER_INFORMATION_FRAGMENT as v}from"../fragments.js";import{p as J,E as A}from"./acdl.js";import{s as D}from"./setReCaptchaToken.js";const H=t=>{var c,o,m,n,i,r,e,g,l,_,d,s,h,E,u,M;const a={email:((o=(c=t==null?void 0:t.data)==null?void 0:c.customer)==null?void 0:o.email)??"",firstName:((n=(m=t==null?void 0:t.data)==null?void 0:m.customer)==null?void 0:n.firstname)??"",lastName:((r=(i=t==null?void 0:t.data)==null?void 0:i.customer)==null?void 0:r.lastname)??"",groupUid:((l=(g=(e=t==null?void 0:t.data)==null?void 0:e.customer)==null?void 0:g.group)==null?void 0:l.uid)??"",allowRemoteShoppingAssistance:(d=(_=t==null?void 0:t.data)==null?void 0:_.customer)==null?void 0:d.allow_remote_shopping_assistance};return S(a,(M=(u=(E=(h=(s=R)==null?void 0:s.getConfig())==null?void 0:h.models)==null?void 0:E.CustomerModel)==null?void 0:u.transformer)==null?void 0:M.call(u,t.data))},I=`
|
|
4
|
+
query GET_CUSTOMER_DATA {
|
|
5
|
+
customer {
|
|
6
|
+
...CUSTOMER_INFORMATION_FRAGMENT
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
${v}
|
|
10
|
+
`,K=async t=>{if(t){const{authHeaderConfig:a}=R.getConfig();x(a.header,a.tokenPrefix?`${a.tokenPrefix} ${t}`:t)}return await y(I,{method:"GET",cache:"force-cache"}).then(a=>H(a)).catch(O)},L=`
|
|
11
|
+
mutation GET_CUSTOMER_TOKEN($email: String!, $password: String!) {
|
|
12
|
+
generateCustomerToken(email: $email, password: $password) {
|
|
13
|
+
token
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
`,k=t=>{if(!t||typeof t!="string")return null;try{const a=t.split(".");if(a.length!==3)return console.error("[decodeJwtToken] Invalid JWT format: expected 3 parts"),null;const o=a[1].replace(/-/g,"+").replace(/_/g,"/"),m=o.padEnd(o.length+(4-o.length%4)%4,"="),n=atob(m);return JSON.parse(n)}catch(a){return console.error("[decodeJwtToken] Failed to decode JWT:",a),null}},Q=t=>{const a=k(t);return a?typeof a.admin_id=="number"&&a.admin_id>0:!1},W=(t,a)=>{const c=k(t);if(c&&typeof c.exp=="number"&&c.exp>0){const o=Math.floor(Date.now()/1e3);return`Max-Age=${Math.max(0,c.exp-o)}`}return a},b=async({email:t,password:a,translations:c,onErrorCallback:o,handleSetInLineAlertProps:m,apiErrorMessageOverride:n})=>{var h,E,u,M,N;await D();const i=await y(L,{method:"POST",variables:{email:t,password:a}}).catch(O);if(!((E=(h=i==null?void 0:i.data)==null?void 0:h.generateCustomerToken)!=null&&E.token)){const f=c.customerTokenErrorMessage,T=i!=null&&i.errors?i.errors[0].message:f,w=n??T;return o==null||o(T),m==null||m({type:"error",text:w}),{errorMessage:T,displayErrorMessage:w,userName:"",userEmail:""}}const r=(M=(u=i==null?void 0:i.data)==null?void 0:u.generateCustomerToken)==null?void 0:M.token,e=await K(r),g=e==null?void 0:e.firstName,l=(e==null?void 0:e.lastName)??"",_=e==null?void 0:e.email;if(!g||!_){const f=c.customerTokenErrorMessage,T=n??f;return o==null||o(f),m==null||m({type:"error",text:T}),{errorMessage:f,displayErrorMessage:T,userName:"",userEmail:""}}const d=await G(),s=F.includes(window.location.hostname)?"":"Secure";if(document.cookie=`${$.auth_dropin_firstname}=${encodeURIComponent(g)}; path=/; ${d}; SameSite=Lax; ${s};`,document.cookie=`${$.auth_dropin_lastname}=${encodeURIComponent(l)}; path=/; ${d}; SameSite=Lax; ${s};`,document.cookie=`${$.auth_dropin_user_token}=${encodeURIComponent(r)}; path=/; ${d}; SameSite=Lax; ${s};`,Q(r)){const f=W(r,d);document.cookie=`${$.auth_dropin_admin_session}=true; path=/; ${f}; SameSite=Lax; ${s};`}else U($.auth_dropin_admin_session);return await C(r?e==null?void 0:e.groupUid:void 0),p.emit("authenticated",!!r),J((N=A)==null?void 0:N.SIGN_IN,{...e}),{errorMessage:"",displayErrorMessage:"",userName:g,userEmail:_}};export{b as a,K as g};
|
|
17
|
+
//# sourceMappingURL=getCustomerToken.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCustomerToken.js","sources":["/@dropins/storefront-auth/src/data/transforms/transform-customer-data.ts","/@dropins/storefront-auth/src/api/getCustomerData/graphql/getCustomerData.graphql.ts","/@dropins/storefront-auth/src/api/getCustomerData/getCustomerData.ts","/@dropins/storefront-auth/src/api/getCustomerToken/graphql/getCustomerToken.graphql.ts","/@dropins/storefront-auth/src/lib/jwtUtils.ts","/@dropins/storefront-auth/src/api/getCustomerToken/getCustomerToken.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\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 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\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"],"names":["transformCustomerData","response","model","_b","_a","_d","_c","_f","_e","_i","_h","_g","_k","_j","merge","_p","_o","_n","_m","_l","config","GET_CUSTOMER_DATA","CUSTOMER_INFORMATION_FRAGMENT","getCustomerData","user_token","authHeaderConfig","setFetchGraphQlHeader","fetchGraphQl","handleNetworkError","GET_CUSTOMER_TOKEN","decodeJwtToken","token","parts","base64","paddedBase64","jsonPayload","error","isAdminToken","payload","getTokenExpiration","defaultMaxAge","now","getCustomerToken","email","password","translations","onErrorCallback","handleSetInLineAlertProps","apiErrorMessageOverride","setReCaptchaToken","defaultErrorMessage","errorMessage","displayErrorMessage","userToken","responseCustomer","userName","userLastName","userEmail","cookiesLifetime","getCookiesLifetime","cookieSecureFlag","LOCALHOST","COOKIE_NAMES","adminTokenLifetime","deleteCookie","emitAuthGroupIdEvent","events","publishEvents","EventsList"],"mappings":"saAsBO,MAAMA,EACXC,GACkB,qCAClB,MAAMC,EAAQ,CACZ,QAAOC,GAAAC,EAAAH,GAAA,YAAAA,EAAU,OAAV,YAAAG,EAAgB,WAAhB,YAAAD,EAA0B,QAAS,GAC1C,YAAWE,GAAAC,EAAAL,GAAA,YAAAA,EAAU,OAAV,YAAAK,EAAgB,WAAhB,YAAAD,EAA0B,YAAa,GAClD,WAAUE,GAAAC,EAAAP,GAAA,YAAAA,EAAU,OAAV,YAAAO,EAAgB,WAAhB,YAAAD,EAA0B,WAAY,GAChD,WAAUE,GAAAC,GAAAC,EAAAV,GAAA,YAAAA,EAAU,OAAV,YAAAU,EAAgB,WAAhB,YAAAD,EAA0B,QAA1B,YAAAD,EAAiC,MAAO,GAClD,+BACEG,GAAAC,EAAAZ,GAAA,YAAAA,EAAU,OAAV,YAAAY,EAAgB,WAAhB,YAAAD,EAA0B,gCAAA,EAI9B,OAAOE,EACLZ,GACAa,GAAAC,GAAAC,GAAAC,GAAAC,EAAAC,IAAA,YAAAD,EAAQ,cAAR,YAAAD,EAAqB,SAArB,YAAAD,EAA6B,gBAA7B,YAAAD,EAA4C,cAA5C,YAAAD,EAAA,KAAAC,EAA0Df,EAAS,KAAI,CAE3E,ECpBaoB,EAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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EA,MAAMM,EAAkB,MAAMC,EAAA,EAGxBC,EAAkCC,EAAU,SAChD,OAAO,SAAS,QAAA,EAEd,GACA,SAMJ,GAJA,SAAS,OAAS,GAAGC,EAAa,qBAAqB,IAAI,mBAAmBP,CAAQ,CAAC,aAAaG,CAAe,mBAAmBE,CAAgB,IACtJ,SAAS,OAAS,GAAGE,EAAa,oBAAoB,IAAI,mBAAmBN,CAAY,CAAC,aAAaE,CAAe,mBAAmBE,CAAgB,IACzJ,SAAS,OAAS,GAAGE,EAAa,sBAAsB,IAAI,mBAAmBT,CAAS,CAAC,aAAaK,CAAe,mBAAmBE,CAAgB,IAEpJvB,EAAagB,CAAS,EAAG,CAC3B,MAAMU,EAAqBxB,EAAmBc,EAAWK,CAAe,EACxE,SAAS,OAAS,GAAGI,EAAa,yBAAyB,kBAAkBC,CAAkB,mBAAmBH,CAAgB,GACpI,MACEI,EAAaF,EAAa,yBAAyB,EAGrD,aAAMG,EACJZ,EAAYC,GAAA,YAAAA,EAAkB,SAAW,MAAA,EAE3CY,EAAO,KAAK,gBAAiB,CAAC,CAACb,CAAS,EAExCc,GAAc3D,EAAA4D,IAAA,YAAA5D,EAAY,QAAS,CAAE,GAAG8C,EAAkB,EAEnD,CAAE,aAAc,GAAI,oBAAqB,GAAI,SAAAC,EAAU,UAAAE,CAAA,CAChE"}
|
package/chunks/index.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{R as b,R as c}from"./ResetPasswordForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"./RemoteShoppingAssistanceConsent.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"./requestPasswordResetEmail.js";import"./network-error.js";import"@dropins/tools/fetch-graphql.js";import"./setReCaptchaToken.js";import"./Button.js";import"./simplifyTransformAttributesForm.js";import"./transform-attributes-form.js";export{b as ResetPasswordForm,c as default};
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/chunks/index2.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{S as q,S as v}from"./SignInForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"./Button.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import"./RemoteShoppingAssistanceConsent.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/i18n.js";import"@dropins/tools/event-bus.js";import"./getCustomerToken.js";import"./network-error.js";import"@dropins/tools/fetch-graphql.js";import"./getAdobeCommerceOptimizerData.js";import"../fragments.js";import"./acdl.js";import"./setReCaptchaToken.js";import"./resendConfirmationEmail.js";import"./simplifyTransformAttributesForm.js";import"./transform-attributes-form.js";import"./focusOnEmptyPasswordField.js";import"./confirmEmail.js";export{q as SignInForm,v as default};
|
|
4
|
+
//# sourceMappingURL=index2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index2.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/chunks/index3.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{S as w,S as y}from"./RemoteShoppingAssistanceConsent2.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"./createCustomerAddress.js";import"../fragments.js";import"./network-error.js";import"@dropins/tools/fetch-graphql.js";import"./setReCaptchaToken.js";import"./getAdobeCommerceOptimizerData.js";import"./transform-attributes-form.js";import"@dropins/tools/preact-hooks.js";import"./simplifyTransformAttributesForm.js";import"./usePasswordValidationMessage.js";import"@dropins/tools/i18n.js";import"./getCustomerToken.js";import"./acdl.js";import"./Button.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import"./RemoteShoppingAssistanceConsent.js";import"./focusOnEmptyPasswordField.js";import"./resendConfirmationEmail.js";import"./SkeletonLoader.js";export{w as SignUpForm,y as default};
|
|
4
|
+
//# sourceMappingURL=index3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index3.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{FetchGraphQL as e}from"@dropins/tools/fetch-graphql.js";import{events as r}from"@dropins/tools/event-bus.js";const{setEndpoint:h,setFetchGraphQlHeader:n,removeFetchGraphQlHeader:c,setFetchGraphQlHeaders:p,fetchGraphQl:i,getConfig:f}=new e().getMethods(),m=t=>{throw t instanceof DOMException&&t.name==="AbortError"||r.emit("auth/error",{source:"auth",type:"network",error:t}),t};export{n as a,p as b,i as f,f as g,m as h,c as r,h as s};
|
|
4
|
+
//# sourceMappingURL=network-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network-error.js","sources":["/@dropins/storefront-auth/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-auth/src/lib/network-error.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { 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 { 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"],"names":["setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","handleNetworkError","error","events"],"mappings":"oHAmBO,KAAM,CACX,YAAAA,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAC,EACA,UAAAC,CACF,EAAI,IAAIC,EAAA,EAAe,WAAA,ECHVC,EAAsBC,GAAiB,CAIlD,MAFEA,aAAiB,cAAgBA,EAAM,OAAS,cAGhDC,EAAO,KAAK,aAAc,CACxB,OAAQ,OACR,KAAM,UACN,MAAAD,CAAA,CACD,EAEGA,CACR"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{f as E,h as l}from"./network-error.js";import{s as e}from"./setReCaptchaToken.js";const R=a=>{var r,m,i;let t="";return(r=a==null?void 0:a.errors)!=null&&r.length&&(t=(m=a==null?void 0:a.errors[0])==null?void 0:m.message),{message:t,success:!!((i=a==null?void 0:a.data)!=null&&i.requestPasswordResetEmail)}},c=`
|
|
4
|
+
mutation REQUEST_PASSWORD_RESET_EMAIL($email: String!) {
|
|
5
|
+
requestPasswordResetEmail(email: $email)
|
|
6
|
+
}
|
|
7
|
+
`,o=async a=>(await e(),await E(c,{method:"POST",variables:{email:a}}).then(t=>R(t)).catch(l));export{o as r};
|
|
8
|
+
//# sourceMappingURL=requestPasswordResetEmail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestPasswordResetEmail.js","sources":["/@dropins/storefront-auth/src/data/transforms/transform-password-reset-email.ts","/@dropins/storefront-auth/src/api/requestPasswordResetEmail/graphql/requestPasswordResetEmail.graphql.ts","/@dropins/storefront-auth/src/api/requestPasswordResetEmail/requestPasswordResetEmail.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { 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\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"],"names":["transformPasswordResetEmail","response","message","_a","_b","_c","REQUEST_PASSWORD_RESET_EMAIL","requestPasswordResetEmail","email","setReCaptchaToken","fetchGraphQl","handleNetworkError"],"mappings":"yFAoBO,MAAMA,EACXC,GAC4B,WAC5B,IAAIC,EAAkB,GAEtB,OAAIC,EAAAF,GAAA,YAAAA,EAAU,SAAV,MAAAE,EAAkB,SACpBD,GAAUE,EAAAH,GAAA,YAAAA,EAAU,OAAO,KAAjB,YAAAG,EAAqB,SAE1B,CACL,QAAAF,EACA,QAAS,IAAQG,EAAAJ,GAAA,YAAAA,EAAU,OAAV,MAAAI,EAAgB,0BAAyB,CAE9D,ECfaC,EAA6C;AAAA;AAAA;AAAA;AAAA,ECO7CC,EAA4B,MACvCC,IAEA,MAAMC,EAAA,EAEC,MAAMC,EAAaJ,EAA8B,CACtD,OAAQ,OACR,UAAW,CAAE,MAAAE,CAAA,CAAM,CACpB,EACE,KAAMP,GACED,EAA4BC,CAAQ,CAC5C,EACA,MAAMU,CAAkB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{f as r,h as e}from"./network-error.js";const i=`
|
|
4
|
+
mutation RESEND_CONFIRMATION_EMAIL($email: String!) {
|
|
5
|
+
resendConfirmationEmail(email: $email)
|
|
6
|
+
}
|
|
7
|
+
`,n=async a=>await r(i,{method:"POST",variables:{email:a}}).catch(e);export{n as r};
|
|
8
|
+
//# sourceMappingURL=resendConfirmationEmail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resendConfirmationEmail.js","sources":["/@dropins/storefront-auth/src/api/resendConfirmationEmail/graphql/resendConfirmationEmail.graphql.ts","/@dropins/storefront-auth/src/api/resendConfirmationEmail/resendConfirmationEmail.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\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"],"names":["RESEND_CONFIRMATION_EMAIL","resendConfirmationEmail","customerEmail","fetchGraphQl","handleNetworkError"],"mappings":"8CAiBO,MAAMA,EAA0C;AAAA;AAAA;AAAA;AAAA,ECK1CC,EAA0B,MACrCC,GAEO,MAAMC,EAAaH,EAA2B,CACnD,OAAQ,OACR,UAAW,CACT,MAAOE,CAAA,CACT,CACD,EAAE,MAAME,CAAkB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{f as o,h as w}from"./network-error.js";import{s as d}from"./setReCaptchaToken.js";const i=`
|
|
4
|
+
mutation RESET_PASSWORD(
|
|
5
|
+
$email: String!
|
|
6
|
+
$resetPasswordToken: String!
|
|
7
|
+
$newPassword: String!
|
|
8
|
+
) {
|
|
9
|
+
resetPassword(
|
|
10
|
+
email: $email
|
|
11
|
+
resetPasswordToken: $resetPasswordToken
|
|
12
|
+
newPassword: $newPassword
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
`,P=a=>{var r,s,e;let t="";return(r=a==null?void 0:a.errors)!=null&&r.length&&(t=(s=a==null?void 0:a.errors[0])==null?void 0:s.message),{message:t,success:!!((e=a==null?void 0:a.data)!=null&&e.resetPassword)}},S=async(a,t,r)=>(await d(),await o(i,{method:"POST",variables:{email:a,resetPasswordToken:t,newPassword:r}}).then(s=>P(s)).catch(w));export{S as r};
|
|
16
|
+
//# sourceMappingURL=resetPassword.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resetPassword.js","sources":["/@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"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\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"],"names":["RESET_PASSWORD","transformResetPassword","response","message","_a","_b","_c","resetPassword","email","resetPasswordToken","newPassword","setReCaptchaToken","fetchGraphQl","handleNetworkError"],"mappings":"yFAiBO,MAAMA,EAA+B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECG/BC,EACXC,GACuB,WACvB,IAAIC,EAAkB,GAEtB,OAAIC,EAAAF,GAAA,YAAAA,EAAU,SAAV,MAAAE,EAAkB,SACpBD,GAAUE,EAAAH,GAAA,YAAAA,EAAU,OAAO,KAAjB,YAAAG,EAAqB,SAE1B,CACL,QAAAF,EACA,QAAS,IAAQG,EAAAJ,GAAA,YAAAA,EAAU,OAAV,MAAAI,EAAgB,cAAa,CAElD,ECPaC,EAAgB,MAC3BC,EACAC,EACAC,KAEA,MAAMC,EAAA,EAEC,MAAMC,EAAaZ,EAAgB,CACxC,OAAQ,OACR,UAAW,CAAE,MAAAQ,EAAO,mBAAAC,EAAoB,YAAAC,CAAA,CAAY,CACrD,EACE,KAAMR,GACED,EAAuBC,CAAQ,CACvC,EACA,MAAMW,CAAkB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{f as s,r as i,h as m}from"./network-error.js";import{c as u,C as a,d as c,e as h,v as E}from"./getAdobeCommerceOptimizerData.js";import{events as _}from"@dropins/tools/event-bus.js";import{p as d,E as f}from"./acdl.js";const k=e=>{var t,r,n;let o="";return(t=e==null?void 0:e.errors)!=null&&t.length&&(o=((r=e==null?void 0:e.errors[0])==null?void 0:r.message)||"Unknown error"),{message:o,success:!!((n=e==null?void 0:e.data)!=null&&n.revokeCustomerToken)}},l=`
|
|
4
|
+
mutation REVOKE_CUSTOMER_TOKEN {
|
|
5
|
+
revokeCustomerToken {
|
|
6
|
+
result
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
`,g=async()=>{const{authHeaderConfig:e}=u.getConfig();return await s(l,{method:"POST"}).then(async o=>{const t=k(o);if(t!=null&&t.success)[a.auth_dropin_user_token,a.auth_dropin_firstname,a.auth_dropin_lastname,a.auth_dropin_admin_session].forEach(r=>{c(r)}),i(e.header),await h(),_.emit("authenticated",!1),d(f.SIGN_OUT,{});else{const r=`
|
|
10
|
+
ERROR revokeCustomerToken: ${t.message}`;console.error(r),E()}return t}).catch(m)};export{g as r};
|
|
11
|
+
//# sourceMappingURL=revokeCustomerToken.js.map
|