@dropins/storefront-auth 2.2.0-alpha022 → 2.2.1-beta1

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/api/index.d.ts CHANGED
@@ -28,5 +28,4 @@ export * from './confirmEmail';
28
28
  export * from './resendConfirmationEmail';
29
29
  export * from './createCustomerAddress';
30
30
  export * from './verifyToken';
31
- export * from './getCustomerRolePermissions';
32
31
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import { Initializer, Model, Config } from '@dropins/tools/types/elsie/src/lib';
1
+ import { Initializer, Model } from '@dropins/tools/types/elsie/src/lib';
2
2
  import { Lang } from '@dropins/tools/types/elsie/src/i18n';
3
3
  import { CustomerModel } from '../../data/models';
4
4
 
@@ -12,8 +12,15 @@ type ConfigProps = {
12
12
  CustomerModel?: Model<CustomerModel>;
13
13
  };
14
14
  };
15
- export declare const DEFAULT_CUSTOMER_GROUP_ID = "b6589fc6ab0dc82cf12099d1c2d40ab994e8410c";
15
+ /**
16
+ * Default customer group ID for Not Logged In (NLI) users.
17
+ * This value is emitted via the 'auth/group-uid' event when:
18
+ * - A user is not authenticated
19
+ * - Token verification fails
20
+ * - User logs out
21
+ */
22
+ export declare const DEFAULT_NLI_CUSTOMER_GROUP_ID = "b6589fc6ab0dc82cf12099d1c2d40ab994e8410c";
16
23
  export declare const initialize: Initializer<ConfigProps>;
17
- export declare const config: Config<ConfigProps>;
24
+ export declare const config: import('@dropins/tools/types/elsie/src/lib').Config<ConfigProps>;
18
25
  export {};
19
26
  //# sourceMappingURL=initialize.d.ts.map
package/api.js CHANGED
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{c as n,a as g,g as c}from"./chunks/createCustomerAddress.js";import{g as d,a as h}from"./chunks/getCustomerToken.js";import{D as x,_ as u,c as E,a as F,g as G,i as T,v as _}from"./chunks/getCustomerRolePermissions.js";import{r as v}from"./chunks/requestPasswordResetEmail.js";import{r as P}from"./chunks/resetPassword.js";import{r as R}from"./chunks/revokeCustomerToken.js";import{c as H}from"./chunks/confirmEmail.js";import{r as b}from"./chunks/resendConfirmationEmail.js";import{f as O,g as S,r as q,s as y,a as z,b as I}from"./chunks/network-error.js";import"./fragments.js";import"./chunks/setReCaptchaToken.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import"./chunks/transform-attributes-form.js";import"./chunks/acdl.js";import"@dropins/tools/fetch-graphql.js";export{x as DEFAULT_CUSTOMER_GROUP_ID,u as _resetCache,E as config,H as confirmEmail,n as createCustomer,g as createCustomerAddress,O as fetchGraphQl,c as getAttributesForm,S as getConfig,d as getCustomerData,F as getCustomerRolePermissions,h as getCustomerToken,G as getStoreConfig,T as initialize,q as removeFetchGraphQlHeader,v as requestPasswordResetEmail,b as resendConfirmationEmail,P as resetPassword,R as revokeCustomerToken,y as setEndpoint,z as setFetchGraphQlHeader,I as setFetchGraphQlHeaders,_ as verifyToken};
3
+ import{c as n,a as g,g as c}from"./chunks/createCustomerAddress.js";import{g as x,a as C}from"./chunks/getCustomerToken.js";import{D as l,c as u,g as E,i as F,v as G}from"./chunks/verifyToken.js";import{r as k}from"./chunks/requestPasswordResetEmail.js";import{r as D}from"./chunks/resetPassword.js";import{r as _}from"./chunks/revokeCustomerToken.js";import{c as H}from"./chunks/confirmEmail.js";import{r as R}from"./chunks/resendConfirmationEmail.js";import{f as b,g as w,r as I,s as L,a as O,b as S}from"./chunks/network-error.js";import"./fragments.js";import"./chunks/setReCaptchaToken.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import"./chunks/transform-attributes-form.js";import"./chunks/acdl.js";import"@dropins/tools/fetch-graphql.js";export{l as DEFAULT_NLI_CUSTOMER_GROUP_ID,u as config,H as confirmEmail,n as createCustomer,g as createCustomerAddress,b as fetchGraphQl,c as getAttributesForm,w as getConfig,x as getCustomerData,C as getCustomerToken,E as getStoreConfig,F as initialize,I as removeFetchGraphQlHeader,k as requestPasswordResetEmail,R as resendConfirmationEmail,D as resetPassword,_ as revokeCustomerToken,L as setEndpoint,O as setFetchGraphQlHeader,S as setFetchGraphQlHeaders,G as verifyToken};
4
4
  //# sourceMappingURL=api.js.map
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{CUSTOMER_INFORMATION_FRAGMENT as O}from"../fragments.js";import{f as s,h as u}from"./network-error.js";import{s as b}from"./setReCaptchaToken.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{merge as N}from"@dropins/tools/lib.js";import{c as p,h as S}from"./getCustomerRolePermissions.js";import{t as F}from"./transform-attributes-form.js";const I=`
3
+ import{CUSTOMER_INFORMATION_FRAGMENT as O}from"../fragments.js";import{f as s,h as u}from"./network-error.js";import{s as b}from"./setReCaptchaToken.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{merge as N}from"@dropins/tools/lib.js";import{c as p,h as S}from"./verifyToken.js";import{t as F}from"./transform-attributes-form.js";const I=`
4
4
  mutation CREATE_CUSTOMER($input: CustomerInput!) {
5
5
  createCustomer(input: $input) {
6
6
  customer {
@@ -1 +1 @@
1
- {"version":3,"file":"createCustomerAddress.js","sources":["/@dropins/storefront-auth/src/api/createCustomer/graphql/createCustomer.graphql.ts","/@dropins/storefront-auth/src/api/createCustomer/graphql/createCustomerV2.graphql.ts","/@dropins/storefront-auth/src/data/transforms/transform-create-customer.tsx","/@dropins/storefront-auth/src/lib/transformDobForm.ts","/@dropins/storefront-auth/src/api/createCustomer/createCustomer.ts","/@dropins/storefront-auth/src/api/getAttributesForm/graphql/getAttributesForm.graphql.ts","/@dropins/storefront-auth/src/api/getAttributesForm/getAttributesForm.ts","/@dropins/storefront-auth/src/api/createCustomerAddress/graphql/createCustomerAddress.graphql.ts","/@dropins/storefront-auth/src/api/createCustomerAddress/createCustomerAddress.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CUSTOMER_INFORMATION_FRAGMENT } from '@/auth/api/fragments';\n\nexport const CREATE_CUSTOMER = /* GraphQL */ `\n mutation CREATE_CUSTOMER($input: CustomerInput!) {\n createCustomer(input: $input) {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n }\n ${CUSTOMER_INFORMATION_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CUSTOMER_INFORMATION_FRAGMENT } from '@/auth/api/fragments';\n\nexport const CREATE_CUSTOMER_V2 = /* GraphQL */ `\n mutation CREATE_CUSTOMER_V2($input: CustomerCreateInput!) {\n createCustomerV2(input: $input) {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n }\n ${CUSTOMER_INFORMATION_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { DataCreateCustomerV2, DataCreateCustomer } from '@/auth/types';\nimport { config } from '@/auth/api';\nimport { merge } from '@adobe-commerce/elsie/lib';\nimport { CustomerModel } from '../models';\n\ntype ApiResponse<T extends boolean> = T extends true\n ? DataCreateCustomerV2\n : DataCreateCustomer;\n\nexport const transformCreateCustomer = <T extends boolean>(\n response: ApiResponse<T>,\n apiVersion2: T\n): CustomerModel => {\n let model: CustomerModel;\n\n if (apiVersion2) {\n const { data } = response as DataCreateCustomerV2;\n\n model = {\n firstName: data?.createCustomerV2?.customer?.firstname ?? '',\n lastName: data?.createCustomerV2?.customer?.lastname ?? '',\n email: data?.createCustomerV2?.customer?.email ?? '',\n customAttributes: data?.createCustomerV2?.custom_attributes ?? [],\n errors: response?.errors ?? [],\n };\n } else {\n const { data } = response as DataCreateCustomer;\n\n model = {\n firstName: data?.createCustomer?.customer?.firstname ?? '',\n lastName: data?.createCustomer?.customer?.lastname ?? '',\n email: data?.createCustomer?.customer?.email ?? '',\n errors: response?.errors ?? [],\n };\n }\n\n return merge(\n model, // default transformer\n config.getConfig().models?.CustomerModel?.transformer?.(response) // custom transformer\n );\n};\n","export const transformDobForm = (\n form: Record<string, any>\n): Record<string, any> => {\n if (!form.dob) return form;\n\n const { dob, ...rest } = form;\n return { ...rest, date_of_birth: dob };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Customer } from '@/auth/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { CREATE_CUSTOMER } from './graphql/createCustomer.graphql';\nimport { CREATE_CUSTOMER_V2 } from './graphql/createCustomerV2.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { setReCaptchaToken } from '@/auth/lib/setReCaptchaToken';\nimport { transformCreateCustomer } from '@/auth/data/transforms';\nimport { CustomerModel } from '@/auth/data/models';\nimport { transformDobForm } from '@/auth/lib/transformDobForm';\n\nexport const createCustomer = async (\n forms: Customer,\n apiVersion2: boolean\n): Promise<CustomerModel> => {\n await setReCaptchaToken();\n\n const response = await fetchGraphQl(\n apiVersion2 ? CREATE_CUSTOMER_V2 : CREATE_CUSTOMER,\n {\n method: 'POST',\n variables: {\n input: {\n ...transformDobForm(forms),\n },\n },\n }\n ).catch(handleNetworkError);\n\n return transformCreateCustomer(response, apiVersion2);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_ATTRIBUTES_FORM = /* GraphQL */ `\n query GET_ATTRIBUTES_FORM($formCode: String!) {\n attributesForm(formCode: $formCode) {\n items {\n code\n default_value\n entity_type\n frontend_class\n frontend_input\n is_required\n is_unique\n label\n options {\n is_default\n label\n value\n }\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n validate_rules {\n name\n value\n }\n }\n }\n errors {\n type\n message\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { GET_ATTRIBUTES_FORM } from './graphql/getAttributesForm.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { transformAttributesForm } from '@/auth/data/transforms';\nimport { handleFetchError } from '@/auth/lib/fetch-error';\nimport { AttributesFormModel } from '@/auth/data/models';\nimport { GetAttributesFormResponse } from '@/auth/types';\n\nexport const getAttributesForm = async (\n formCode: string\n): Promise<AttributesFormModel[]> => {\n return await fetchGraphQl(GET_ATTRIBUTES_FORM, {\n method: 'GET',\n cache: 'force-cache',\n variables: { formCode },\n })\n .then((response: GetAttributesFormResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return transformAttributesForm(response);\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const CREATE_CUSTOMER_ADDRESS = /* GraphQL */ `\n mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {\n createCustomerAddress(input: $input) {\n firstname\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { AddressFormProps, CreateCustomerAddressResponse } from '@/auth/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { CREATE_CUSTOMER_ADDRESS } from './graphql/createCustomerAddress.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { handleFetchError } from '@/auth/lib/fetch-error';\n\nexport const createCustomerAddress = async (\n address: AddressFormProps\n): Promise<string> => {\n return await fetchGraphQl(CREATE_CUSTOMER_ADDRESS, {\n method: 'POST',\n variables: {\n input: address,\n },\n })\n .then((response: CreateCustomerAddressResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response.data.createCustomerAddress.firstname || '';\n })\n .catch(handleNetworkError);\n};\n"],"names":["CREATE_CUSTOMER","CUSTOMER_INFORMATION_FRAGMENT","CREATE_CUSTOMER_V2","transformCreateCustomer","response","apiVersion2","model","data","_b","_a","_d","_c","_f","_e","_g","_i","_h","_k","_j","_m","_l","merge","_p","_o","_n","config","transformDobForm","form","dob","rest","createCustomer","forms","setReCaptchaToken","fetchGraphQl","handleNetworkError","GET_ATTRIBUTES_FORM","getAttributesForm","formCode","handleFetchError","transformAttributesForm","CREATE_CUSTOMER_ADDRESS","createCustomerAddress","address"],"mappings":"6XAmBO,MAAMA,EAAgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQzCC,CAA6B;AAAA,ECRpBC,EAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQ5CD,CAA6B;AAAA,ECDpBE,EAA0B,CACrCC,EACAC,IACkB,qCAClB,IAAIC,EAEJ,GAAID,EAAa,CACf,KAAM,CAAE,KAAAE,GAASH,EAEjBE,EAAQ,CACN,YAAWE,GAAAC,EAAAF,GAAA,YAAAA,EAAM,mBAAN,YAAAE,EAAwB,WAAxB,YAAAD,EAAkC,YAAa,GAC1D,WAAUE,GAAAC,EAAAJ,GA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MG,CAAkB,EAE1B,OAAO/B,EAAwBC,EAAUC,CAAW,CACtD,EC7Ba8B,EAAoC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECQpCC,EAAoB,MAC/BC,GAEO,MAAMJ,EAAaE,EAAqB,CAC7C,OAAQ,MACR,MAAO,cACP,UAAW,CAAE,SAAAE,CAAA,CAAS,CACvB,EACE,KAAMjC,GAAwC,OAC7C,OAAIK,EAAAL,EAAS,SAAT,MAAAK,EAAiB,OAAe6B,EAAiBlC,EAAS,MAAM,EAE7DmC,EAAwBnC,CAAQ,CACzC,CAAC,EACA,MAAM8B,CAAkB,ECrBhBM,EAAwC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECMxCC,EAAwB,MACnCC,GAEO,MAAMT,EAAaO,EAAyB,CACjD,OAAQ,OACR,UAAW,CACT,MAAOE,CAAA,CACT,CACD,EACE,KAAMtC,GAA4C,OACjD,OAAIK,EAAAL,EAAS,SAAT,MAAAK,EAAiB,OAAe6B,EAAiBlC,EAAS,MAAM,EAE7DA,EAAS,KAAK,sBAAsB,WAAa,EAC1D,CAAC,EACA,MAAM8B,CAAkB"}
1
+ {"version":3,"file":"createCustomerAddress.js","sources":["/@dropins/storefront-auth/src/api/createCustomer/graphql/createCustomer.graphql.ts","/@dropins/storefront-auth/src/api/createCustomer/graphql/createCustomerV2.graphql.ts","/@dropins/storefront-auth/src/data/transforms/transform-create-customer.tsx","/@dropins/storefront-auth/src/lib/transformDobForm.ts","/@dropins/storefront-auth/src/api/createCustomer/createCustomer.ts","/@dropins/storefront-auth/src/api/getAttributesForm/graphql/getAttributesForm.graphql.ts","/@dropins/storefront-auth/src/api/getAttributesForm/getAttributesForm.ts","/@dropins/storefront-auth/src/api/createCustomerAddress/graphql/createCustomerAddress.graphql.ts","/@dropins/storefront-auth/src/api/createCustomerAddress/createCustomerAddress.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CUSTOMER_INFORMATION_FRAGMENT } from '@/auth/api/fragments';\n\nexport const CREATE_CUSTOMER = /* GraphQL */ `\n mutation CREATE_CUSTOMER($input: CustomerInput!) {\n createCustomer(input: $input) {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n }\n ${CUSTOMER_INFORMATION_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CUSTOMER_INFORMATION_FRAGMENT } from '@/auth/api/fragments';\n\nexport const CREATE_CUSTOMER_V2 = /* GraphQL */ `\n mutation CREATE_CUSTOMER_V2($input: CustomerCreateInput!) {\n createCustomerV2(input: $input) {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n }\n ${CUSTOMER_INFORMATION_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { DataCreateCustomerV2, DataCreateCustomer } from '@/auth/types';\nimport { config } from '@/auth/api';\nimport { merge } from '@adobe-commerce/elsie/lib';\nimport { CustomerModel } from '../models';\n\ntype ApiResponse<T extends boolean> = T extends true\n ? DataCreateCustomerV2\n : DataCreateCustomer;\n\nexport const transformCreateCustomer = <T extends boolean>(\n response: ApiResponse<T>,\n apiVersion2: T\n): CustomerModel => {\n let model: CustomerModel;\n\n if (apiVersion2) {\n const { data } = response as DataCreateCustomerV2;\n\n model = {\n firstName: data?.createCustomerV2?.customer?.firstname ?? '',\n lastName: data?.createCustomerV2?.customer?.lastname ?? '',\n email: data?.createCustomerV2?.customer?.email ?? '',\n customAttributes: data?.createCustomerV2?.custom_attributes ?? [],\n errors: response?.errors ?? [],\n };\n } else {\n const { data } = response as DataCreateCustomer;\n\n model = {\n firstName: data?.createCustomer?.customer?.firstname ?? '',\n lastName: data?.createCustomer?.customer?.lastname ?? '',\n email: data?.createCustomer?.customer?.email ?? '',\n errors: response?.errors ?? [],\n };\n }\n\n return merge(\n model, // default transformer\n config.getConfig().models?.CustomerModel?.transformer?.(response) // custom transformer\n );\n};\n","export const transformDobForm = (\n form: Record<string, any>\n): Record<string, any> => {\n if (!form.dob) return form;\n\n const { dob, ...rest } = form;\n return { ...rest, date_of_birth: dob };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Customer } from '@/auth/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { CREATE_CUSTOMER } from './graphql/createCustomer.graphql';\nimport { CREATE_CUSTOMER_V2 } from './graphql/createCustomerV2.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { setReCaptchaToken } from '@/auth/lib/setReCaptchaToken';\nimport { transformCreateCustomer } from '@/auth/data/transforms';\nimport { CustomerModel } from '@/auth/data/models';\nimport { transformDobForm } from '@/auth/lib/transformDobForm';\n\nexport const createCustomer = async (\n forms: Customer,\n apiVersion2: boolean\n): Promise<CustomerModel> => {\n await setReCaptchaToken();\n\n const response = await fetchGraphQl(\n apiVersion2 ? CREATE_CUSTOMER_V2 : CREATE_CUSTOMER,\n {\n method: 'POST',\n variables: {\n input: {\n ...transformDobForm(forms),\n },\n },\n }\n ).catch(handleNetworkError);\n\n return transformCreateCustomer(response, apiVersion2);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_ATTRIBUTES_FORM = /* GraphQL */ `\n query GET_ATTRIBUTES_FORM($formCode: String!) {\n attributesForm(formCode: $formCode) {\n items {\n code\n default_value\n entity_type\n frontend_class\n frontend_input\n is_required\n is_unique\n label\n options {\n is_default\n label\n value\n }\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n validate_rules {\n name\n value\n }\n }\n }\n errors {\n type\n message\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { GET_ATTRIBUTES_FORM } from './graphql/getAttributesForm.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { transformAttributesForm } from '@/auth/data/transforms';\nimport { handleFetchError } from '@/auth/lib/fetch-error';\nimport { AttributesFormModel } from '@/auth/data/models';\nimport { GetAttributesFormResponse } from '@/auth/types';\n\nexport const getAttributesForm = async (\n formCode: string\n): Promise<AttributesFormModel[]> => {\n return await fetchGraphQl(GET_ATTRIBUTES_FORM, {\n method: 'GET',\n cache: 'force-cache',\n variables: { formCode },\n })\n .then((response: GetAttributesFormResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return transformAttributesForm(response);\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const CREATE_CUSTOMER_ADDRESS = /* GraphQL */ `\n mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {\n createCustomerAddress(input: $input) {\n firstname\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { AddressFormProps, CreateCustomerAddressResponse } from '@/auth/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { CREATE_CUSTOMER_ADDRESS } from './graphql/createCustomerAddress.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { handleFetchError } from '@/auth/lib/fetch-error';\n\nexport const createCustomerAddress = async (\n address: AddressFormProps\n): Promise<string> => {\n return await fetchGraphQl(CREATE_CUSTOMER_ADDRESS, {\n method: 'POST',\n variables: {\n input: address,\n },\n })\n .then((response: CreateCustomerAddressResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response.data.createCustomerAddress.firstname || '';\n })\n .catch(handleNetworkError);\n};\n"],"names":["CREATE_CUSTOMER","CUSTOMER_INFORMATION_FRAGMENT","CREATE_CUSTOMER_V2","transformCreateCustomer","response","apiVersion2","model","data","_b","_a","_d","_c","_f","_e","_g","_i","_h","_k","_j","_m","_l","merge","_p","_o","_n","config","transformDobForm","form","dob","rest","createCustomer","forms","setReCaptchaToken","fetchGraphQl","handleNetworkError","GET_ATTRIBUTES_FORM","getAttributesForm","formCode","handleFetchError","transformAttributesForm","CREATE_CUSTOMER_ADDRESS","createCustomerAddress","address"],"mappings":"8WAmBO,MAAMA,EAAgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQzCC,CAA6B;AAAA,ECRpBC,EAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQ5CD,CAA6B;AAAA,ECDpBE,EAA0B,CACrCC,EACAC,IACkB,qCAClB,IAAIC,EAEJ,GAAID,EAAa,CACf,KAAM,CAAE,KAAAE,GAASH,EAEjBE,EAAQ,CACN,YAAWE,GAAAC,EAAAF,GAAA,YAAAA,EAA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Q,OACR,UAAW,CACT,MAAO,CACL,GAAG0B,EAAiBK,CAAK,CAAA,CAC3B,CACF,CACF,EACA,MAAMG,CAAkB,EAE1B,OAAO/B,EAAwBC,EAAUC,CAAW,CACtD,EC7Ba8B,EAAoC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECQpCC,EAAoB,MAC/BC,GAEO,MAAMJ,EAAaE,EAAqB,CAC7C,OAAQ,MACR,MAAO,cACP,UAAW,CAAE,SAAAE,CAAA,CAAS,CACvB,EACE,KAAMjC,GAAwC,OAC7C,OAAIK,EAAAL,EAAS,SAAT,MAAAK,EAAiB,OAAe6B,EAAiBlC,EAAS,MAAM,EAE7DmC,EAAwBnC,CAAQ,CACzC,CAAC,EACA,MAAM8B,CAAkB,ECrBhBM,EAAwC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECMxCC,EAAwB,MACnCC,GAEO,MAAMT,EAAaO,EAAyB,CACjD,OAAQ,OACR,UAAW,CACT,MAAOE,CAAA,CACT,CACD,EACE,KAAMtC,GAA4C,OACjD,OAAIK,EAAAL,EAAS,SAAT,MAAAK,EAAiB,OAAe6B,EAAiBlC,EAAS,MAAM,EAE7DA,EAAS,KAAK,sBAAsB,WAAa,EAC1D,CAAC,EACA,MAAM8B,CAAkB"}
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{a as U,f as R,h as $}from"./network-error.js";import"@dropins/tools/recaptcha.js";import{events as s}from"@dropins/tools/event-bus.js";import{merge as w}from"@dropins/tools/lib.js";import{c as G,b as k,C as h,D as C}from"./getCustomerRolePermissions.js";import{CUSTOMER_INFORMATION_FRAGMENT as D}from"../fragments.js";import{p as F,E as x}from"./acdl.js";import{s as y}from"./setReCaptchaToken.js";const S=t=>{var T,e,o,a,u,m,r,f,g,d,_,E,c,M;const i={email:((e=(T=t==null?void 0:t.data)==null?void 0:T.customer)==null?void 0:e.email)??"",firstName:((a=(o=t==null?void 0:t.data)==null?void 0:o.customer)==null?void 0:a.firstname)??"",lastName:((m=(u=t==null?void 0:t.data)==null?void 0:u.customer)==null?void 0:m.lastname)??"",groupUid:((g=(f=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:f.group)==null?void 0:g.uid)??""};return w(i,(M=(c=(E=(_=(d=G)==null?void 0:d.getConfig())==null?void 0:_.models)==null?void 0:E.CustomerModel)==null?void 0:c.transformer)==null?void 0:M.call(c,t.data))},v=`
3
+ import{a as U,f as R,h as $}from"./network-error.js";import"@dropins/tools/recaptcha.js";import{events as s}from"@dropins/tools/event-bus.js";import{merge as w}from"@dropins/tools/lib.js";import{c as G,a as k,C as h,D as C}from"./verifyToken.js";import{CUSTOMER_INFORMATION_FRAGMENT as D}from"../fragments.js";import{p as F,E as x}from"./acdl.js";import{s as y}from"./setReCaptchaToken.js";const S=t=>{var T,e,o,a,u,m,r,f,g,_,d,E,c,M;const i={email:((e=(T=t==null?void 0:t.data)==null?void 0:T.customer)==null?void 0:e.email)??"",firstName:((a=(o=t==null?void 0:t.data)==null?void 0:o.customer)==null?void 0:a.firstname)??"",lastName:((m=(u=t==null?void 0:t.data)==null?void 0:u.customer)==null?void 0:m.lastname)??"",groupUid:((g=(f=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:f.group)==null?void 0:g.uid)??""};return w(i,(M=(c=(E=(d=(_=G)==null?void 0:_.getConfig())==null?void 0:d.models)==null?void 0:E.CustomerModel)==null?void 0:c.transformer)==null?void 0:M.call(c,t.data))},v=`
4
4
  query GET_CUSTOMER_DATA {
5
5
  customer {
6
6
  ...CUSTOMER_INFORMATION_FRAGMENT
@@ -13,5 +13,5 @@ import{a as U,f as R,h as $}from"./network-error.js";import"@dropins/tools/recap
13
13
  token
14
14
  }
15
15
  }
16
- `,W=async({email:t,password:i,translations:T,onErrorCallback:e,handleSetInLineAlertProps:o})=>{var d,_,E,c,M;await y();const a=await R(H,{method:"POST",variables:{email:t,password:i}}).catch($);if(!((_=(d=a==null?void 0:a.data)==null?void 0:d.generateCustomerToken)!=null&&_.token)){const N=T.customerTokenErrorMessage,O=a!=null&&a.errors?a.errors[0].message:N;return e==null||e(O),o==null||o({type:"error",text:O}),{errorMessage:O,userName:""}}const u=(c=(E=a==null?void 0:a.data)==null?void 0:E.generateCustomerToken)==null?void 0:c.token,m=await K(u),r=m==null?void 0:m.firstName,f=m==null?void 0:m.email;if(!r||!f){const N=T.customerTokenErrorMessage;return e==null||e(N),o==null||o({type:"error",text:N}),{errorMessage:N,userName:"",userEmail:""}}const g=await k();return document.cookie=`${h.auth_dropin_firstname}=${r}; path=/; ${g}; Secure;`,document.cookie=`${h.auth_dropin_user_token}=${u}; path=/; ${g}; Secure;`,s.emit("auth/group-uid",u?m==null?void 0:m.groupUid:C),s.emit("authenticated",!!u),F((M=x)==null?void 0:M.SIGN_IN,{...m}),{errorMessage:"",userName:r,userEmail:f}};export{W as a,K as g};
16
+ `,V=async({email:t,password:i,translations:T,onErrorCallback:e,handleSetInLineAlertProps:o})=>{var _,d,E,c,M;await y();const a=await R(H,{method:"POST",variables:{email:t,password:i}}).catch($);if(!((d=(_=a==null?void 0:a.data)==null?void 0:_.generateCustomerToken)!=null&&d.token)){const N=T.customerTokenErrorMessage,O=a!=null&&a.errors?a.errors[0].message:N;return e==null||e(O),o==null||o({type:"error",text:O}),{errorMessage:O,userName:""}}const u=(c=(E=a==null?void 0:a.data)==null?void 0:E.generateCustomerToken)==null?void 0:c.token,m=await K(u),r=m==null?void 0:m.firstName,f=m==null?void 0:m.email;if(!r||!f){const N=T.customerTokenErrorMessage;return e==null||e(N),o==null||o({type:"error",text:N}),{errorMessage:N,userName:"",userEmail:""}}const g=await k();return document.cookie=`${h.auth_dropin_firstname}=${r}; path=/; ${g}; Secure;`,document.cookie=`${h.auth_dropin_user_token}=${u}; path=/; ${g}; Secure;`,s.emit("auth/group-uid",u?m==null?void 0:m.groupUid:C),s.emit("authenticated",!!u),F((M=x)==null?void 0:M.SIGN_IN,{...m}),{errorMessage:"",userName:r,userEmail:f}};export{V as a,K as g};
17
17
  //# sourceMappingURL=getCustomerToken.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getCustomerToken.js","sources":["/@dropins/storefront-auth/src/data/transforms/transform-customer-data.ts","/@dropins/storefront-auth/src/api/getCustomerData/graphql/getCustomerData.graphql.ts","/@dropins/storefront-auth/src/api/getCustomerData/getCustomerData.ts","/@dropins/storefront-auth/src/api/getCustomerToken/graphql/getCustomerToken.graphql.ts","/@dropins/storefront-auth/src/api/getCustomerToken/getCustomerToken.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { getCustomerDataResponse } from '@/auth/types';\nimport { CustomerModel } from '../models';\nimport { config } from '@/auth/api';\nimport { merge } from '@adobe-commerce/elsie/lib';\n\nexport const transformCustomerData = (\n response: getCustomerDataResponse\n): CustomerModel => {\n const model = {\n email: response?.data?.customer?.email ?? '',\n firstName: response?.data?.customer?.firstname ?? '',\n lastName: response?.data?.customer?.lastname ?? '',\n groupUid: response?.data?.customer?.group?.uid ?? '',\n };\n\n // Extend the model merging custom transformer, if provided\n return merge(\n model, // default transformer\n config?.getConfig()?.models?.CustomerModel?.transformer?.(response.data) // custom transformer\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CUSTOMER_INFORMATION_FRAGMENT } from '@/auth/api/fragments';\n\nexport const GET_CUSTOMER_DATA = /* GraphQL */ `\n query GET_CUSTOMER_DATA {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n ${CUSTOMER_INFORMATION_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl, setFetchGraphQlHeader, config } from '@/auth/api';\nimport { GET_CUSTOMER_DATA } from './graphql/getCustomerData.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { CustomerModel } from '@/auth/data/models';\nimport { transformCustomerData } from '@/auth/data/transforms';\n\nexport const getCustomerData = async (\n user_token: string\n): Promise<CustomerModel> => {\n if (user_token) {\n const { authHeaderConfig } = config.getConfig();\n\n setFetchGraphQlHeader(\n authHeaderConfig.header,\n authHeaderConfig.tokenPrefix\n ? `${authHeaderConfig.tokenPrefix} ${user_token}`\n : user_token\n );\n }\n\n return await fetchGraphQl(GET_CUSTOMER_DATA, {\n method: 'GET',\n cache: 'force-cache',\n })\n .then((response) => {\n return transformCustomerData(response);\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_CUSTOMER_TOKEN = /* GraphQL */ `\n mutation GET_CUSTOMER_TOKEN($email: String!, $password: String!) {\n generateCustomerToken(email: $email, password: $password) {\n token\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { GET_CUSTOMER_TOKEN } from './graphql/getCustomerToken.graphql';\nimport { getCustomerData } from '../getCustomerData';\nimport { InLineAlertInterface } from '@/auth/types';\nimport { events } from '@adobe-commerce/event-bus';\nimport { COOKIE_NAMES } from '@/auth/configs/cookieConfigs';\nimport { getCookiesLifetime } from '@/auth/lib/cookieUtils';\nimport { publishEvents, EventsList } from '@/auth/lib/acdl';\nimport { setReCaptchaToken } from '@/auth/lib/setReCaptchaToken';\nimport { DEFAULT_CUSTOMER_GROUP_ID } from '../initialize';\n\ninterface getCustomerTokenProps {\n email: string;\n password: string;\n handleSetInLineAlertProps: (value?: InLineAlertInterface) => void;\n translations: Record<string, string>;\n onErrorCallback?: (value?: unknown) => void;\n}\n\nexport const getCustomerToken = async ({\n email,\n password,\n translations,\n onErrorCallback,\n handleSetInLineAlertProps,\n}: getCustomerTokenProps): Promise<{\n errorMessage: string;\n userName: string;\n userEmail: string;\n}> => {\n await setReCaptchaToken();\n\n const response = await fetchGraphQl(GET_CUSTOMER_TOKEN, {\n method: 'POST',\n variables: { email, password },\n }).catch(handleNetworkError);\n\n if (!response?.data?.generateCustomerToken?.token) {\n // Fallback error message\n const defaultErrorMessage = translations.customerTokenErrorMessage;\n const errorMessage = response?.errors\n ? response.errors[0].message\n : defaultErrorMessage;\n\n onErrorCallback?.(errorMessage);\n handleSetInLineAlertProps?.({ type: 'error', text: errorMessage });\n\n return { errorMessage, userName: '' };\n }\n\n const userToken = response?.data?.generateCustomerToken?.token;\n\n const responseCustomer = await getCustomerData(userToken);\n const userName = responseCustomer?.firstName;\n const userEmail = responseCustomer?.email;\n\n if (!userName || !userEmail) {\n const errorMessage = translations.customerTokenErrorMessage;\n\n onErrorCallback?.(errorMessage);\n handleSetInLineAlertProps?.({ type: 'error', text: errorMessage });\n\n return { errorMessage, userName: '', userEmail: '' };\n }\n\n const cookiesLifetime = await getCookiesLifetime();\n\n document.cookie = `${COOKIE_NAMES.auth_dropin_firstname}=${userName}; path=/; ${cookiesLifetime}; Secure;`;\n document.cookie = `${COOKIE_NAMES.auth_dropin_user_token}=${userToken}; path=/; ${cookiesLifetime}; Secure;`;\n\n events.emit('auth/group-uid', userToken ? responseCustomer?.groupUid : DEFAULT_CUSTOMER_GROUP_ID);\n events.emit('authenticated', !!userToken);\n\n publishEvents(EventsList?.SIGN_IN, { ...responseCustomer });\n\n return { errorMessage: '', userName, userEmail };\n};\n"],"names":["transformCustomerData","response","model","_b","_a","_d","_c","_f","_e","_i","_h","_g","merge","_n","_m","_l","_k","_j","config","GET_CUSTOMER_DATA","CUSTOMER_INFORMATION_FRAGMENT","getCustomerData","user_token","authHeaderConfig","setFetchGraphQlHeader","fetchGraphQl","handleNetworkError","GET_CUSTOMER_TOKEN","getCustomerToken","email","password","translations","onErrorCallback","handleSetInLineAlertProps","setReCaptchaToken","defaultErrorMessage","errorMessage","userToken","responseCustomer","userName","userEmail","cookiesLifetime","getCookiesLifetime","COOKIE_NAMES","events","DEFAULT_CUSTOMER_GROUP_ID","publishEvents","EventsList"],"mappings":"qZAsBO,MAAMA,EACXC,GACkB,iCAClB,MAAMC,EAAQ,CACZ,QAAOC,GAAAC,EAAAH,GAAA,YAAAA,EAAU,OAAV,YAAAG,EAAgB,WAAhB,YAAAD,EAA0B,QAAS,GAC1C,YAAWE,GAAAC,EAAAL,GAAA,YAAAA,EAAU,OAAV,YAAAK,EAAgB,WAAhB,YAAAD,EAA0B,YAAa,GAClD,WAAUE,GAAAC,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,EAAA,EAIpD,OAAOG,EACLV,GACAW,GAAAC,GAAAC,GAAAC,GAAAC,EAAAC,IAAA,YAAAD,EAAQ,cAAR,YAAAD,EAAqB,SAArB,YAAAD,EAA6B,gBAA7B,YAAAD,EAA4C,cAA5C,YAAAD,EAAA,KAAAC,EAA0Db,EAAS,KAAI,CAE3E,EClBakB,EAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAM3CC,CAA6B;AAAA,ECFpBC,EAAkB,MAC7BC,GAC2B,CAC3B,GAAIA,EAAY,CACd,KAAM,CAAE,iBAAAC,CAAA,EAAqBL,EAAO,UAAA,EAEpCM,EACED,EAAiB,OACjBA,EAAiB,YACb,GAAGA,EAAiB,WAAW,IAAID,CAAU,GAC7CA,CAAA,CAER,CAEA,OAAO,MAAMG,EAAaN,EAAmB,CAC3C,OAAQ,MACR,MAAO,aAAA,CACR,EACE,KAAMlB,GACED,EAAsBC,CAAQ,CACtC,EACA,MAAMyB,CAAkB,CAC7B,EC5BaC,EAAmC;AAAA;AAAA;AAAA;AAAA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,EAAYC,GAAA,YAAAA,EAAkB,SAAWO,CAAyB,EAChGD,EAAO,KAAK,gBAAiB,CAAC,CAACP,CAAS,EAExCS,GAActC,EAAAuC,IAAA,YAAAvC,EAAY,QAAS,CAAE,GAAG8B,EAAkB,EAEnD,CAAE,aAAc,GAAI,SAAAC,EAAU,UAAAC,CAAA,CACvC"}
1
+ {"version":3,"file":"getCustomerToken.js","sources":["/@dropins/storefront-auth/src/data/transforms/transform-customer-data.ts","/@dropins/storefront-auth/src/api/getCustomerData/graphql/getCustomerData.graphql.ts","/@dropins/storefront-auth/src/api/getCustomerData/getCustomerData.ts","/@dropins/storefront-auth/src/api/getCustomerToken/graphql/getCustomerToken.graphql.ts","/@dropins/storefront-auth/src/api/getCustomerToken/getCustomerToken.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { getCustomerDataResponse } from '@/auth/types';\nimport { CustomerModel } from '../models';\nimport { config } from '@/auth/api';\nimport { merge } from '@adobe-commerce/elsie/lib';\n\nexport const transformCustomerData = (\n response: getCustomerDataResponse\n): CustomerModel => {\n const model = {\n email: response?.data?.customer?.email ?? '',\n firstName: response?.data?.customer?.firstname ?? '',\n lastName: response?.data?.customer?.lastname ?? '',\n groupUid: response?.data?.customer?.group?.uid ?? '',\n };\n\n // Extend the model merging custom transformer, if provided\n return merge(\n model, // default transformer\n config?.getConfig()?.models?.CustomerModel?.transformer?.(response.data) // custom transformer\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CUSTOMER_INFORMATION_FRAGMENT } from '@/auth/api/fragments';\n\nexport const GET_CUSTOMER_DATA = /* GraphQL */ `\n query GET_CUSTOMER_DATA {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n ${CUSTOMER_INFORMATION_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl, setFetchGraphQlHeader, config } from '@/auth/api';\nimport { GET_CUSTOMER_DATA } from './graphql/getCustomerData.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { CustomerModel } from '@/auth/data/models';\nimport { transformCustomerData } from '@/auth/data/transforms';\n\nexport const getCustomerData = async (\n user_token: string\n): Promise<CustomerModel> => {\n if (user_token) {\n const { authHeaderConfig } = config.getConfig();\n\n setFetchGraphQlHeader(\n authHeaderConfig.header,\n authHeaderConfig.tokenPrefix\n ? `${authHeaderConfig.tokenPrefix} ${user_token}`\n : user_token\n );\n }\n\n return await fetchGraphQl(GET_CUSTOMER_DATA, {\n method: 'GET',\n cache: 'force-cache',\n })\n .then((response) => {\n return transformCustomerData(response);\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_CUSTOMER_TOKEN = /* GraphQL */ `\n mutation GET_CUSTOMER_TOKEN($email: String!, $password: String!) {\n generateCustomerToken(email: $email, password: $password) {\n token\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { GET_CUSTOMER_TOKEN } from './graphql/getCustomerToken.graphql';\nimport { getCustomerData } from '../getCustomerData';\nimport { InLineAlertInterface } from '@/auth/types';\nimport { events } from '@adobe-commerce/event-bus';\nimport { COOKIE_NAMES } from '@/auth/configs/cookieConfigs';\nimport { getCookiesLifetime } from '@/auth/lib/cookieUtils';\nimport { publishEvents, EventsList } from '@/auth/lib/acdl';\nimport { setReCaptchaToken } from '@/auth/lib/setReCaptchaToken';\nimport { DEFAULT_NLI_CUSTOMER_GROUP_ID } from '../initialize';\n\ninterface getCustomerTokenProps {\n email: string;\n password: string;\n handleSetInLineAlertProps: (value?: InLineAlertInterface) => void;\n translations: Record<string, string>;\n onErrorCallback?: (value?: unknown) => void;\n}\n\nexport const getCustomerToken = async ({\n email,\n password,\n translations,\n onErrorCallback,\n handleSetInLineAlertProps,\n}: getCustomerTokenProps): Promise<{\n errorMessage: string;\n userName: string;\n userEmail: string;\n}> => {\n await setReCaptchaToken();\n\n const response = await fetchGraphQl(GET_CUSTOMER_TOKEN, {\n method: 'POST',\n variables: { email, password },\n }).catch(handleNetworkError);\n\n if (!response?.data?.generateCustomerToken?.token) {\n // Fallback error message\n const defaultErrorMessage = translations.customerTokenErrorMessage;\n const errorMessage = response?.errors\n ? response.errors[0].message\n : defaultErrorMessage;\n\n onErrorCallback?.(errorMessage);\n handleSetInLineAlertProps?.({ type: 'error', text: errorMessage });\n\n return { errorMessage, userName: '' };\n }\n\n const userToken = response?.data?.generateCustomerToken?.token;\n\n const responseCustomer = await getCustomerData(userToken);\n const userName = responseCustomer?.firstName;\n const userEmail = responseCustomer?.email;\n\n if (!userName || !userEmail) {\n const errorMessage = translations.customerTokenErrorMessage;\n\n onErrorCallback?.(errorMessage);\n handleSetInLineAlertProps?.({ type: 'error', text: errorMessage });\n\n return { errorMessage, userName: '', userEmail: '' };\n }\n\n const cookiesLifetime = await getCookiesLifetime();\n\n document.cookie = `${COOKIE_NAMES.auth_dropin_firstname}=${userName}; path=/; ${cookiesLifetime}; Secure;`;\n document.cookie = `${COOKIE_NAMES.auth_dropin_user_token}=${userToken}; path=/; ${cookiesLifetime}; Secure;`;\n\n events.emit('auth/group-uid', userToken ? responseCustomer?.groupUid : DEFAULT_NLI_CUSTOMER_GROUP_ID);\n events.emit('authenticated', !!userToken);\n\n publishEvents(EventsList?.SIGN_IN, { ...responseCustomer });\n\n return { errorMessage: '', userName, userEmail };\n};\n"],"names":["transformCustomerData","response","model","_b","_a","_d","_c","_f","_e","_i","_h","_g","merge","_n","_m","_l","_k","_j","config","GET_CUSTOMER_DATA","CUSTOMER_INFORMATION_FRAGMENT","getCustomerData","user_token","authHeaderConfig","setFetchGraphQlHeader","fetchGraphQl","handleNetworkError","GET_CUSTOMER_TOKEN","getCustomerToken","email","password","translations","onErrorCallback","handleSetInLineAlertProps","setReCaptchaToken","defaultErrorMessage","errorMessage","userToken","responseCustomer","userName","userEmail","cookiesLifetime","getCookiesLifetime","COOKIE_NAMES","events","DEFAULT_NLI_CUSTOMER_GROUP_ID","publishEvents","EventsList"],"mappings":"sYAsBO,MAAMA,EACXC,GACkB,iCAClB,MAAMC,EAAQ,CACZ,QAAOC,GAAAC,EAAAH,GAAA,YAAAA,EAAU,OAAV,YAAAG,EAAgB,WAAhB,YAAAD,EAA0B,QAAS,GAC1C,YAAWE,GAAAC,EAAAL,GAAA,YAAAA,EAAU,OAAV,YAAAK,EAAgB,WAAhB,YAAAD,EAA0B,YAAa,GAClD,WAAUE,GAAAC,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,EAAA,EAIpD,OAAOG,EACLV,GACAW,GAAAC,GAAAC,GAAAC,GAAAC,EAAAC,IAAA,YAAAD,EAAQ,cAAR,YAAAD,EAAqB,SAArB,YAAAD,EAA6B,gBAA7B,YAAAD,EAA4C,cAA5C,YAAAD,EAAA,KAAAC,EAA0Db,EAAS,KAAI,CAE3E,EClBakB,EAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAM3CC,CAA6B;AAAA,ECFpBC,EAAkB,MAC7BC,GAC2B,CAC3B,GAAIA,EAAY,CACd,KAAM,CAAE,iBAAAC,CAAA,EAAqBL,EAAO,UAAA,EAEpCM,EACED,EAAiB,OACjBA,EAAiB,YACb,GAAGA,EAAiB,WAAW,IAAID,CAAU,GAC7CA,CAAA,CAER,CAEA,OAAO,MAAMG,EAAaN,EAAmB,CAC3C,OAAQ,MACR,MAAO,aAAA,CACR,EACE,KAAMlB,GACED,EAAsBC,CAAQ,CACtC,EACA,MAAMyB,CAAkB,CAC7B,EC5BaC,EAAmC;AAAA;AAAA;AAAA;AAAA;AAA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YC,GAAA,YAAAA,EAAkB,SAAWO,CAA6B,EACpGD,EAAO,KAAK,gBAAiB,CAAC,CAACP,CAAS,EAExCS,GAActC,EAAAuC,IAAA,YAAAvC,EAAY,QAAS,CAAE,GAAG8B,EAAkB,EAEnD,CAAE,aAAc,GAAI,SAAAC,EAAU,UAAAC,CAAA,CACvC"}
package/chunks/index2.js CHANGED
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
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"./Button2.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import"./Button.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"./getCustomerRolePermissions.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};
3
+ import{S as q,S as v}from"./SignInForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"./Button2.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import"./Button.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"./verifyToken.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
4
  //# sourceMappingURL=index2.js.map
package/chunks/index3.js CHANGED
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{S as w,S as y}from"./SignUpForm.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"./getCustomerRolePermissions.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"./Button2.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import"./Button.js";import"./focusOnEmptyPasswordField.js";import"./resendConfirmationEmail.js";import"./SkeletonLoader.js";export{w as SignUpForm,y as default};
3
+ import{S as w,S as y}from"./SignUpForm.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"./verifyToken.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"./Button2.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import"./Button.js";import"./focusOnEmptyPasswordField.js";import"./resendConfirmationEmail.js";import"./SkeletonLoader.js";export{w as SignUpForm,y as default};
4
4
  //# sourceMappingURL=index3.js.map
@@ -1,11 +1,11 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{f as i,h as s}from"./network-error.js";import{C as m,d as n,D as E,v as c}from"./getCustomerRolePermissions.js";import{events as u}from"@dropins/tools/event-bus.js";import{p as k,E as h}from"./acdl.js";const T=t=>{var r,o,a;let e="";return(r=t==null?void 0:t.errors)!=null&&r.length&&(e=((o=t==null?void 0:t.errors[0])==null?void 0:o.message)||"Unknown error"),{message:e,success:!!((a=t==null?void 0:t.data)!=null&&a.revokeCustomerToken)}},_=`
3
+ import{f as i,h as s}from"./network-error.js";import{C as m,d as n,D as E,v as c}from"./verifyToken.js";import{events as u}from"@dropins/tools/event-bus.js";import{p as k,E as _}from"./acdl.js";const h=t=>{var r,o,a;let e="";return(r=t==null?void 0:t.errors)!=null&&r.length&&(e=((o=t==null?void 0:t.errors[0])==null?void 0:o.message)||"Unknown error"),{message:e,success:!!((a=t==null?void 0:t.data)!=null&&a.revokeCustomerToken)}},T=`
4
4
  mutation REVOKE_CUSTOMER_TOKEN {
5
5
  revokeCustomerToken {
6
6
  result
7
7
  }
8
8
  }
9
- `,v=async()=>await i(_,{method:"POST"}).then(t=>{const e=T(t);if(e!=null&&e.success)[m.auth_dropin_user_token,m.auth_dropin_firstname].forEach(r=>{n(r)}),u.emit("auth/group-uid",E),u.emit("authenticated",!1),k(h.SIGN_OUT,{});else{const r=`
9
+ `,v=async()=>await i(T,{method:"POST"}).then(t=>{const e=h(t);if(e!=null&&e.success)[m.auth_dropin_user_token,m.auth_dropin_firstname].forEach(r=>{n(r)}),u.emit("auth/group-uid",E),u.emit("authenticated",!1),k(_.SIGN_OUT,{});else{const r=`
10
10
  ERROR revokeCustomerToken: ${e.message}`;console.error(r),c()}return e}).catch(s);export{v as r};
11
11
  //# sourceMappingURL=revokeCustomerToken.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"revokeCustomerToken.js","sources":["/@dropins/storefront-auth/src/data/transforms/transform-revoke-customer-token.ts","/@dropins/storefront-auth/src/api/revokeCustomerToken/graphql/revokeCustomerToken.graphql.ts","/@dropins/storefront-auth/src/api/revokeCustomerToken/revokeCustomerToken.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 { RevokeCustomerTokenResponse } from '@/auth/types/api/revokeCustomerToken.types';\nimport { RevokeCustomerTokenModel } from '../models';\n\nexport const transformRevokeCustomerToken = (\n response: RevokeCustomerTokenResponse\n): RevokeCustomerTokenModel => {\n let message: string = '';\n\n if (response?.errors?.length)\n message =\n (response?.errors[0]?.message as unknown as string) || 'Unknown error';\n\n return {\n message,\n success: Boolean(response?.data?.revokeCustomerToken),\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REVOKE_CUSTOMER_TOKEN = /* GraphQL */ `\n mutation REVOKE_CUSTOMER_TOKEN {\n revokeCustomerToken {\n result\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { RevokeCustomerTokenModel } from '@/auth/data/models';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { REVOKE_CUSTOMER_TOKEN } from './graphql/revokeCustomerToken.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { transformRevokeCustomerToken } from '@/auth/data/transforms';\nimport { RevokeCustomerTokenResponse } from '@/auth/types/api/revokeCustomerToken.types';\nimport { deleteCookie } from '@/auth/lib/cookieUtils';\nimport { events } from '@adobe-commerce/event-bus';\nimport { COOKIE_NAMES } from '@/auth/configs/cookieConfigs';\nimport { EventsList, publishEvents } from '@/auth/lib/acdl';\nimport { verifyToken } from '@/auth/api/verifyToken';\nimport { DEFAULT_CUSTOMER_GROUP_ID } from '../initialize';\n\nexport const revokeCustomerToken =\n async (): Promise<RevokeCustomerTokenModel> => {\n\n return await fetchGraphQl(REVOKE_CUSTOMER_TOKEN, {\n method: 'POST',\n })\n .then((response: RevokeCustomerTokenResponse) => {\n const transformData = transformRevokeCustomerToken(response);\n\n if (transformData?.success) {\n [\n COOKIE_NAMES.auth_dropin_user_token,\n COOKIE_NAMES.auth_dropin_firstname,\n ].forEach((name) => {\n deleteCookie(name);\n });\n\n events.emit('auth/group-uid', DEFAULT_CUSTOMER_GROUP_ID);\n events.emit('authenticated', false);\n\n publishEvents(EventsList.SIGN_OUT, {});\n } else {\n const errorMessage = `\n ERROR revokeCustomerToken: ${transformData.message}`;\n console.error(errorMessage);\n\n // Verify if the token is still valid after failed revocation attempt\n // This ensures the authentication state is consistent with the actual token status even if the revocation fails\n verifyToken();\n }\n\n return transformData;\n })\n .catch(handleNetworkError);\n };\n"],"names":["transformRevokeCustomerToken","response","message","_a","_b","_c","REVOKE_CUSTOMER_TOKEN","revokeCustomerToken","fetchGraphQl","transformData","COOKIE_NAMES","name","deleteCookie","events","DEFAULT_CUSTOMER_GROUP_ID","publishEvents","EventsList","errorMessage","verifyToken","handleNetworkError"],"mappings":"iNAoBO,MAAMA,EACXC,GAC6B,WAC7B,IAAIC,EAAkB,GAEtB,OAAIC,EAAAF,GAAA,YAAAA,EAAU,SAAV,MAAAE,EAAkB,SACpBD,IACGE,EAAAH,GAAA,YAAAA,EAAU,OAAO,KAAjB,YAAAG,EAAqB,UAAiC,iBAEpD,CACL,QAAAF,EACA,QAAS,IAAQG,EAAAJ,GAAA,YAAAA,EAAU,OAAV,MAAAI,EAAgB,oBAAmB,CAExD,EChBaC,EAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECatCC,EACX,SAES,MAAMC,EAAaF,EAAuB,CAC/C,OAAQ,MAAA,CACT,EACE,KAAML,GAA0C,CAC/C,MAAMQ,EAAgBT,EAA6BC,CAAQ,EAE3D,GAAIQ,GAAA,MAAAA,EAAe,QACjB,CACEC,EAAa,uBACbA,EAAa,qBAAA,EACb,QAASC,GAAS,CAClBC,EAAaD,CAAI,CACnB,CAAC,EAEDE,EAAO,KAAK,iBAAkBC,CAAyB,EACvDD,EAAO,KAAK,gBAAiB,EAAK,EAElCE,EAAcC,EAAW,SAAU,EAAE,MAChC,CACL,MAAMC,EAAe;AAAA,uCACQR,EAAc,OAAO,GAClD,QAAQ,MAAMQ,CAAY,EAI1BC,EAAA,CACF,CAEA,OAAOT,CACT,CAAC,EACA,MAAMU,CAAkB"}
1
+ {"version":3,"file":"revokeCustomerToken.js","sources":["/@dropins/storefront-auth/src/data/transforms/transform-revoke-customer-token.ts","/@dropins/storefront-auth/src/api/revokeCustomerToken/graphql/revokeCustomerToken.graphql.ts","/@dropins/storefront-auth/src/api/revokeCustomerToken/revokeCustomerToken.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 { RevokeCustomerTokenResponse } from '@/auth/types/api/revokeCustomerToken.types';\nimport { RevokeCustomerTokenModel } from '../models';\n\nexport const transformRevokeCustomerToken = (\n response: RevokeCustomerTokenResponse\n): RevokeCustomerTokenModel => {\n let message: string = '';\n\n if (response?.errors?.length)\n message =\n (response?.errors[0]?.message as unknown as string) || 'Unknown error';\n\n return {\n message,\n success: Boolean(response?.data?.revokeCustomerToken),\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REVOKE_CUSTOMER_TOKEN = /* GraphQL */ `\n mutation REVOKE_CUSTOMER_TOKEN {\n revokeCustomerToken {\n result\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { RevokeCustomerTokenModel } from '@/auth/data/models';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { REVOKE_CUSTOMER_TOKEN } from './graphql/revokeCustomerToken.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { transformRevokeCustomerToken } from '@/auth/data/transforms';\nimport { RevokeCustomerTokenResponse } from '@/auth/types/api/revokeCustomerToken.types';\nimport { deleteCookie } from '@/auth/lib/cookieUtils';\nimport { events } from '@adobe-commerce/event-bus';\nimport { COOKIE_NAMES } from '@/auth/configs/cookieConfigs';\nimport { EventsList, publishEvents } from '@/auth/lib/acdl';\nimport { verifyToken } from '@/auth/api/verifyToken';\nimport { DEFAULT_NLI_CUSTOMER_GROUP_ID } from '../initialize';\n\nexport const revokeCustomerToken =\n async (): Promise<RevokeCustomerTokenModel> => {\n return await fetchGraphQl(REVOKE_CUSTOMER_TOKEN, {\n method: 'POST',\n })\n .then((response: RevokeCustomerTokenResponse) => {\n const transformData = transformRevokeCustomerToken(response);\n\n if (transformData?.success) {\n [\n COOKIE_NAMES.auth_dropin_user_token,\n COOKIE_NAMES.auth_dropin_firstname,\n ].forEach((name) => {\n deleteCookie(name);\n });\n\n events.emit('auth/group-uid', DEFAULT_NLI_CUSTOMER_GROUP_ID);\n events.emit('authenticated', false);\n\n publishEvents(EventsList.SIGN_OUT, {});\n } else {\n const errorMessage = `\n ERROR revokeCustomerToken: ${transformData.message}`;\n console.error(errorMessage);\n\n // Verify if the token is still valid after failed revocation attempt\n // This ensures the authentication state is consistent with the actual token status even if the revocation fails\n verifyToken();\n }\n\n return transformData;\n })\n .catch(handleNetworkError);\n };\n"],"names":["transformRevokeCustomerToken","response","message","_a","_b","_c","REVOKE_CUSTOMER_TOKEN","revokeCustomerToken","fetchGraphQl","transformData","COOKIE_NAMES","name","deleteCookie","events","DEFAULT_NLI_CUSTOMER_GROUP_ID","publishEvents","EventsList","errorMessage","verifyToken","handleNetworkError"],"mappings":"kMAoBO,MAAMA,EACXC,GAC6B,WAC7B,IAAIC,EAAkB,GAEtB,OAAIC,EAAAF,GAAA,YAAAA,EAAU,SAAV,MAAAE,EAAkB,SACpBD,IACGE,EAAAH,GAAA,YAAAA,EAAU,OAAO,KAAjB,YAAAG,EAAqB,UAAiC,iBAEpD,CACL,QAAAF,EACA,QAAS,IAAQG,EAAAJ,GAAA,YAAAA,EAAU,OAAV,MAAAI,EAAgB,oBAAmB,CAExD,EChBaC,EAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECatCC,EACX,SACS,MAAMC,EAAaF,EAAuB,CAC/C,OAAQ,MAAA,CACT,EACE,KAAML,GAA0C,CAC/C,MAAMQ,EAAgBT,EAA6BC,CAAQ,EAE3D,GAAIQ,GAAA,MAAAA,EAAe,QACjB,CACEC,EAAa,uBACbA,EAAa,qBAAA,EACb,QAASC,GAAS,CAClBC,EAAaD,CAAI,CACnB,CAAC,EAEDE,EAAO,KAAK,iBAAkBC,CAA6B,EAC3DD,EAAO,KAAK,gBAAiB,EAAK,EAElCE,EAAcC,EAAW,SAAU,EAAE,MAChC,CACL,MAAMC,EAAe;AAAA,uCACQR,EAAc,OAAO,GAClD,QAAQ,MAAMQ,CAAY,EAI1BC,EAAA,CACF,CAEA,OAAOT,CACT,CAAC,EACA,MAAMU,CAAkB"}
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{g as m}from"./getCustomerRolePermissions.js";import{useState as c,useEffect as u,useMemo as h}from"@dropins/tools/preact-hooks.js";import{useText as f}from"@dropins/tools/i18n.js";const A=()=>{const[e,n]=c(!1),[t,i]=c(null);return u(()=>{const a=sessionStorage.getItem("storeConfig"),r=a?JSON.parse(a):null;if(r){const{minLength:o,requiredCharacterClasses:s,createAccountConfirmation:g}=r;i({minLength:o,requiredCharacterClasses:s}),n(g)}else m().then(o=>{if(o){const{minLength:s,requiredCharacterClasses:g,createAccountConfirmation:l}=o;sessionStorage.setItem("storeConfig",JSON.stringify(o)),i({minLength:s,requiredCharacterClasses:g}),n(l)}})},[]),{passwordConfigs:t,isEmailConfirmationRequired:e}},L=(e,n)=>{if(n<=1)return!0;const t=/[0-9]/.test(e)?1:0,i=/[a-z]/.test(e)?1:0,a=/[A-Z]/.test(e)?1:0,r=/[^a-zA-Z0-9\s]/.test(e)?1:0;return t+i+a+r>=n},M=({passwordConfigs:e,isClickSubmit:n,password:t})=>{const i=f({messageLengthPassword:"Auth.PasswordValidationMessage.messageLengthPassword"}),[a,r]=c("pending");u(()=>{if(!e)return;const s=L(t,e.requiredCharacterClasses);n&&t.length>0?r(s?"success":"error"):n&&t.length===0?r("pending"):r(s?"success":"pending")},[n,e,t]);const o=h(()=>{var g;if(!e)return;const s={status:"pending",icon:"pending",message:(g=i.messageLengthPassword)==null?void 0:g.replace("{minLength}",`${e.minLength}`)};return t.length&&t.length>=e.minLength?{...s,icon:"success",status:"success"}:t.length&&t.length<e.minLength?n?{...s,icon:"error",status:"error"}:{...s,icon:"pending",status:"pending"}:s},[e,i.messageLengthPassword,t==null?void 0:t.length,n]);return{isValidUniqueSymbols:a,defaultLengthMessage:o}};export{M as a,A as u,L as v};
3
+ import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{g as m}from"./verifyToken.js";import{useState as c,useEffect as u,useMemo as h}from"@dropins/tools/preact-hooks.js";import{useText as f}from"@dropins/tools/i18n.js";const A=()=>{const[e,n]=c(!1),[t,i]=c(null);return u(()=>{const a=sessionStorage.getItem("storeConfig"),r=a?JSON.parse(a):null;if(r){const{minLength:o,requiredCharacterClasses:s,createAccountConfirmation:g}=r;i({minLength:o,requiredCharacterClasses:s}),n(g)}else m().then(o=>{if(o){const{minLength:s,requiredCharacterClasses:g,createAccountConfirmation:l}=o;sessionStorage.setItem("storeConfig",JSON.stringify(o)),i({minLength:s,requiredCharacterClasses:g}),n(l)}})},[]),{passwordConfigs:t,isEmailConfirmationRequired:e}},L=(e,n)=>{if(n<=1)return!0;const t=/[0-9]/.test(e)?1:0,i=/[a-z]/.test(e)?1:0,a=/[A-Z]/.test(e)?1:0,r=/[^a-zA-Z0-9\s]/.test(e)?1:0;return t+i+a+r>=n},M=({passwordConfigs:e,isClickSubmit:n,password:t})=>{const i=f({messageLengthPassword:"Auth.PasswordValidationMessage.messageLengthPassword"}),[a,r]=c("pending");u(()=>{if(!e)return;const s=L(t,e.requiredCharacterClasses);n&&t.length>0?r(s?"success":"error"):n&&t.length===0?r("pending"):r(s?"success":"pending")},[n,e,t]);const o=h(()=>{var g;if(!e)return;const s={status:"pending",icon:"pending",message:(g=i.messageLengthPassword)==null?void 0:g.replace("{minLength}",`${e.minLength}`)};return t.length&&t.length>=e.minLength?{...s,icon:"success",status:"success"}:t.length&&t.length<e.minLength?n?{...s,icon:"error",status:"error"}:{...s,icon:"pending",status:"pending"}:s},[e,i.messageLengthPassword,t==null?void 0:t.length,n]);return{isValidUniqueSymbols:a,defaultLengthMessage:o}};export{M as a,A as u,L as v};
4
4
  //# sourceMappingURL=usePasswordValidationMessage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePasswordValidationMessage.js","sources":["/@dropins/storefront-auth/src/hooks/api/useGetStoreConfigs.tsx","/@dropins/storefront-auth/src/lib/validationUniqueSymbolsPassword.ts","/@dropins/storefront-auth/src/hooks/components/usePasswordValidationMessage.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { getStoreConfig } from '@/auth/api';\nimport { useEffect, useState } from 'preact/hooks';\nimport { StoreConfigModel } from '../../data/models';\n\nexport const useGetStoreConfigs = () => {\n const [isEmailConfirmationRequired, setIsEmailConfirmationRequired] =\n useState(false);\n const [passwordConfigs, setPasswordConfigs] = useState<{\n minLength: number;\n requiredCharacterClasses: number;\n } | null>(null);\n\n useEffect(() => {\n const storeConfigString = sessionStorage.getItem('storeConfig');\n\n const cachedStoreConfig: StoreConfigModel = storeConfigString\n ? JSON.parse(storeConfigString)\n : null;\n\n if (cachedStoreConfig) {\n const { minLength, requiredCharacterClasses, createAccountConfirmation } =\n cachedStoreConfig;\n\n setPasswordConfigs({\n minLength,\n requiredCharacterClasses,\n });\n\n setIsEmailConfirmationRequired(createAccountConfirmation);\n } else {\n getStoreConfig().then((response) => {\n if (response) {\n const {\n minLength,\n requiredCharacterClasses,\n createAccountConfirmation,\n } = response;\n\n sessionStorage.setItem('storeConfig', JSON.stringify(response));\n\n setPasswordConfigs({\n minLength,\n requiredCharacterClasses,\n });\n\n setIsEmailConfirmationRequired(createAccountConfirmation);\n }\n });\n }\n }, []);\n\n return { passwordConfigs, isEmailConfirmationRequired };\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 validationUniqueSymbolsPassword = (\n password: string,\n uniqueSymbolsCount: number\n) => {\n if (uniqueSymbolsCount <= 1) return true;\n\n const numbers = /[0-9]/.test(password) ? 1 : 0;\n const lowerCaseLetter = /[a-z]/.test(password) ? 1 : 0;\n const upperCaseLetter = /[A-Z]/.test(password) ? 1 : 0;\n const specialSymbols = /[^a-zA-Z0-9\\s]/.test(password) ? 1 : 0;\n\n return (\n numbers + lowerCaseLetter + upperCaseLetter + specialSymbols >=\n uniqueSymbolsCount\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 { validationUniqueSymbolsPassword } from '@/auth/lib/validationUniqueSymbolsPassword';\nimport { useEffect, useMemo, useState } from 'preact/hooks';\nimport { ValidateLengthConfigProps, statusTypes } from '@/auth/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\ninterface UsePasswordValidationMessageProps {\n passwordConfigs: {\n minLength: number;\n requiredCharacterClasses: number;\n } | null;\n isClickSubmit: boolean;\n password: string;\n}\n\nexport const usePasswordValidationMessage = ({\n passwordConfigs,\n isClickSubmit,\n password,\n}: UsePasswordValidationMessageProps) => {\n const translations = useText({\n messageLengthPassword:\n 'Auth.PasswordValidationMessage.messageLengthPassword',\n });\n\n const [isValidUniqueSymbols, setIsValidUniqueSymbols] =\n useState<statusTypes>('pending');\n\n useEffect(() => {\n if (!passwordConfigs) return;\n\n const result = validationUniqueSymbolsPassword(\n password,\n passwordConfigs.requiredCharacterClasses\n );\n\n if (isClickSubmit && password.length > 0) {\n result\n ? setIsValidUniqueSymbols('success')\n : setIsValidUniqueSymbols('error');\n } else if (isClickSubmit && password.length === 0) {\n setIsValidUniqueSymbols('pending');\n } else {\n result\n ? setIsValidUniqueSymbols('success')\n : setIsValidUniqueSymbols('pending');\n }\n }, [isClickSubmit, passwordConfigs, password]);\n\n const defaultLengthMessage: ValidateLengthConfigProps | undefined =\n useMemo(() => {\n if (!passwordConfigs) return;\n\n const defaultMessage: ValidateLengthConfigProps = {\n status: 'pending',\n icon: 'pending',\n message: translations.messageLengthPassword?.replace(\n '{minLength}',\n `${passwordConfigs.minLength}`\n ),\n };\n\n if (password.length && password.length >= passwordConfigs.minLength) {\n return { ...defaultMessage, icon: 'success', status: 'success' };\n }\n\n if (password.length && password.length < passwordConfigs.minLength) {\n return isClickSubmit\n ? { ...defaultMessage, icon: 'error', status: 'error' }\n : { ...defaultMessage, icon: 'pending', status: 'pending' };\n }\n\n return defaultMessage;\n }, [\n passwordConfigs,\n translations.messageLengthPassword,\n password?.length,\n isClickSubmit,\n ]);\n\n return { isValidUniqueSymbols, defaultLengthMessage };\n};\n"],"names":["useGetStoreConfigs","isEmailConfirmationRequired","setIsEmailConfirmationRequired","useState","passwordConfigs","setPasswordConfigs","useEffect","storeConfigString","cachedStoreConfig","minLength","requiredCharacterClasses","createAccountConfirmation","getStoreConfig","response","validationUniqueSymbolsPassword","password","uniqueSymbolsCount","numbers","lowerCaseLetter","upperCaseLetter","specialSymbols","usePasswordValidationMessage","isClickSubmit","translations","useText","isValidUniqueSymbols","setIsValidUniqueSymbols","result","defaultLengthMessage","useMemo","defaultMessage","_a"],"mappings":"mQAqBO,MAAMA,EAAqB,IAAM,CACtC,KAAM,CAACC,EAA6BC,CAA8B,EAChEC,EAAS,EAAK,EACV,CAACC,EAAiBC,CAAkB,EAAIF,EAGpC,IAAI,EAEd,OAAAG,EAAU,IAAM,CACd,MAAMC,EAAoB,eAAe,QAAQ,aAAa,EAExDC,EAAsCD,EACxC,KAAK,MAAMA,CAAiB,EAC5B,KAEJ,GAAIC,EAAmB,CACrB,KAAM,CAAE,UAAAC,EAAW,yBAAAC,EAA0B,0BAAAC,CAAA,EAC3CH,EAEFH,EAAmB,CACjB,UAAAI,EACA,yBAAAC,CAAA,CACD,EAEDR,EAA+BS,CAAyB,CAC1D,MACEC,EAAA,EAAiB,KAAMC,GAAa,CAClC,GAAIA,EAAU,CACZ,KAAM,CACJ,UAAAJ,EACA,yBAAAC,EACA,0BAAAC,CAAA,EACEE,EAEJ,eAAe,QAAQ,cAAe,KAAK,UAAUA,CAAQ,CAAC,EAE9DR,EAAmB,CACjB,UAAAI,EACA,yBAAAC,CAAA,CACD,EAEDR,EAA+BS,CAAyB,CAC1D,CACF,CAAC,CAEL,EAAG,CAAA,CAAE,EAEE,CAAE,gBAAAP,EAAiB,4BAAAH,CAAA,CAC5B,ECpDaa,EAAkC,CAC7CC,EACAC,IACG,CACH,GAAIA,GAAsB,EAAG,MAAO,GAEpC,MAAMC,EAAU,QAAQ,KAAKF,CAAQ,EAAI,EAAI,EACvCG,EAAkB,QAAQ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1
+ {"version":3,"file":"usePasswordValidationMessage.js","sources":["/@dropins/storefront-auth/src/hooks/api/useGetStoreConfigs.tsx","/@dropins/storefront-auth/src/lib/validationUniqueSymbolsPassword.ts","/@dropins/storefront-auth/src/hooks/components/usePasswordValidationMessage.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { getStoreConfig } from '@/auth/api';\nimport { useEffect, useState } from 'preact/hooks';\nimport { StoreConfigModel } from '../../data/models';\n\nexport const useGetStoreConfigs = () => {\n const [isEmailConfirmationRequired, setIsEmailConfirmationRequired] =\n useState(false);\n const [passwordConfigs, setPasswordConfigs] = useState<{\n minLength: number;\n requiredCharacterClasses: number;\n } | null>(null);\n\n useEffect(() => {\n const storeConfigString = sessionStorage.getItem('storeConfig');\n\n const cachedStoreConfig: StoreConfigModel = storeConfigString\n ? JSON.parse(storeConfigString)\n : null;\n\n if (cachedStoreConfig) {\n const { minLength, requiredCharacterClasses, createAccountConfirmation } =\n cachedStoreConfig;\n\n setPasswordConfigs({\n minLength,\n requiredCharacterClasses,\n });\n\n setIsEmailConfirmationRequired(createAccountConfirmation);\n } else {\n getStoreConfig().then((response) => {\n if (response) {\n const {\n minLength,\n requiredCharacterClasses,\n createAccountConfirmation,\n } = response;\n\n sessionStorage.setItem('storeConfig', JSON.stringify(response));\n\n setPasswordConfigs({\n minLength,\n requiredCharacterClasses,\n });\n\n setIsEmailConfirmationRequired(createAccountConfirmation);\n }\n });\n }\n }, []);\n\n return { passwordConfigs, isEmailConfirmationRequired };\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 validationUniqueSymbolsPassword = (\n password: string,\n uniqueSymbolsCount: number\n) => {\n if (uniqueSymbolsCount <= 1) return true;\n\n const numbers = /[0-9]/.test(password) ? 1 : 0;\n const lowerCaseLetter = /[a-z]/.test(password) ? 1 : 0;\n const upperCaseLetter = /[A-Z]/.test(password) ? 1 : 0;\n const specialSymbols = /[^a-zA-Z0-9\\s]/.test(password) ? 1 : 0;\n\n return (\n numbers + lowerCaseLetter + upperCaseLetter + specialSymbols >=\n uniqueSymbolsCount\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 { validationUniqueSymbolsPassword } from '@/auth/lib/validationUniqueSymbolsPassword';\nimport { useEffect, useMemo, useState } from 'preact/hooks';\nimport { ValidateLengthConfigProps, statusTypes } from '@/auth/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\ninterface UsePasswordValidationMessageProps {\n passwordConfigs: {\n minLength: number;\n requiredCharacterClasses: number;\n } | null;\n isClickSubmit: boolean;\n password: string;\n}\n\nexport const usePasswordValidationMessage = ({\n passwordConfigs,\n isClickSubmit,\n password,\n}: UsePasswordValidationMessageProps) => {\n const translations = useText({\n messageLengthPassword:\n 'Auth.PasswordValidationMessage.messageLengthPassword',\n });\n\n const [isValidUniqueSymbols, setIsValidUniqueSymbols] =\n useState<statusTypes>('pending');\n\n useEffect(() => {\n if (!passwordConfigs) return;\n\n const result = validationUniqueSymbolsPassword(\n password,\n passwordConfigs.requiredCharacterClasses\n );\n\n if (isClickSubmit && password.length > 0) {\n result\n ? setIsValidUniqueSymbols('success')\n : setIsValidUniqueSymbols('error');\n } else if (isClickSubmit && password.length === 0) {\n setIsValidUniqueSymbols('pending');\n } else {\n result\n ? setIsValidUniqueSymbols('success')\n : setIsValidUniqueSymbols('pending');\n }\n }, [isClickSubmit, passwordConfigs, password]);\n\n const defaultLengthMessage: ValidateLengthConfigProps | undefined =\n useMemo(() => {\n if (!passwordConfigs) return;\n\n const defaultMessage: ValidateLengthConfigProps = {\n status: 'pending',\n icon: 'pending',\n message: translations.messageLengthPassword?.replace(\n '{minLength}',\n `${passwordConfigs.minLength}`\n ),\n };\n\n if (password.length && password.length >= passwordConfigs.minLength) {\n return { ...defaultMessage, icon: 'success', status: 'success' };\n }\n\n if (password.length && password.length < passwordConfigs.minLength) {\n return isClickSubmit\n ? { ...defaultMessage, icon: 'error', status: 'error' }\n : { ...defaultMessage, icon: 'pending', status: 'pending' };\n }\n\n return defaultMessage;\n }, [\n passwordConfigs,\n translations.messageLengthPassword,\n password?.length,\n isClickSubmit,\n ]);\n\n return { isValidUniqueSymbols, defaultLengthMessage };\n};\n"],"names":["useGetStoreConfigs","isEmailConfirmationRequired","setIsEmailConfirmationRequired","useState","passwordConfigs","setPasswordConfigs","useEffect","storeConfigString","cachedStoreConfig","minLength","requiredCharacterClasses","createAccountConfirmation","getStoreConfig","response","validationUniqueSymbolsPassword","password","uniqueSymbolsCount","numbers","lowerCaseLetter","upperCaseLetter","specialSymbols","usePasswordValidationMessage","isClickSubmit","translations","useText","isValidUniqueSymbols","setIsValidUniqueSymbols","result","defaultLengthMessage","useMemo","defaultMessage","_a"],"mappings":"oPAqBO,MAAMA,EAA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S,EAEjCG,EAAU,IAAM,CACd,GAAI,CAACF,EAAiB,OAEtB,MAAMuB,EAASb,EACbC,EACAX,EAAgB,wBAAA,EAGdkB,GAAiBP,EAAS,OAAS,EAEjCW,EADJC,EAC4B,UACA,OADS,EAE5BL,GAAiBP,EAAS,SAAW,EAC9CW,EAAwB,SAAS,EAG7BA,EADJC,EAC4B,UACA,SADS,CAGzC,EAAG,CAACL,EAAelB,EAAiBW,CAAQ,CAAC,EAE7C,MAAMa,EACJC,EAAQ,IAAM,OACZ,GAAI,CAACzB,EAAiB,OAEtB,MAAM0B,EAA4C,CAChD,OAAQ,UACR,KAAM,UACN,SAASC,EAAAR,EAAa,wBAAb,YAAAQ,EAAoC,QAC3C,cACA,GAAG3B,EAAgB,SAAS,GAC9B,EAGF,OAAIW,EAAS,QAAUA,EAAS,QAAUX,EAAgB,UACjD,CAAE,GAAG0B,EAAgB,KAAM,UAAW,OAAQ,SAAA,EAGnDf,EAAS,QAAUA,EAAS,OAASX,EAAgB,UAChDkB,EACH,CAAE,GAAGQ,EAAgB,KAAM,QAAS,OAAQ,OAAA,EAC5C,CAAE,GAAGA,EAAgB,KAAM,UAAW,OAAQ,SAAA,EAG7CA,CACT,EAAG,CACD1B,EACAmB,EAAa,sBACbR,GAAA,YAAAA,EAAU,OACVO,CAAA,CACD,EAEH,MAAO,CAAE,qBAAAG,EAAsB,qBAAAG,CAAA,CACjC"}
@@ -0,0 +1,26 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import{events as i}from"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{f as g,h as C,a as k,r as E}from"./network-error.js";import{Initializer as T}from"@dropins/tools/lib.js";const d="b6589fc6ab0dc82cf12099d1c2d40ab994e8410c",l=new T({init:async t=>{const e={...{authHeaderConfig:{header:"Authorization",tokenPrefix:"Bearer"}},...t};l.config.setConfig(e),N(e.authHeaderConfig.header,e.authHeaderConfig.tokenPrefix)},listeners:()=>[]}),p=l.config,h={auth_dropin_user_token:"auth_dropin_user_token",auth_dropin_firstname:"auth_dropin_firstname"},_=3600,O=t=>{var o,e,r,n,a,c,u,s,m,f;return{autocompleteOnStorefront:((e=(o=t==null?void 0:t.data)==null?void 0:o.storeConfig)==null?void 0:e.autocomplete_on_storefront)||!1,minLength:((n=(r=t==null?void 0:t.data)==null?void 0:r.storeConfig)==null?void 0:n.minimum_password_length)||3,requiredCharacterClasses:+((c=(a=t==null?void 0:t.data)==null?void 0:a.storeConfig)==null?void 0:c.required_character_classes_number)||0,createAccountConfirmation:((s=(u=t==null?void 0:t.data)==null?void 0:u.storeConfig)==null?void 0:s.create_account_confirmation)||!1,customerAccessTokenLifetime:((f=(m=t==null?void 0:t.data)==null?void 0:m.storeConfig)==null?void 0:f.customer_access_token_lifetime)*_||_}},S=t=>{const o=t.map(e=>e.message).join(" ");throw Error(o)},A=t=>{const o=document.cookie.split(";");let e;return o.forEach(r=>{const[n,a]=r.trim().split("=");n===t&&(e=decodeURIComponent(a))}),e},I=t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`},q=async()=>{try{const t=sessionStorage.getItem("storeConfig");let e=(t?JSON.parse(t):{}).customerAccessTokenLifetime;if(!e){const r=await y();sessionStorage.setItem("storeConfig",JSON.stringify(r)),e=(r==null?void 0:r.customerAccessTokenLifetime)||_}return`Max-Age=${e}`}catch(t){return console.error("getCookiesLifetime() Error:",t),`Max-Age=${_}`}},L=`
4
+ query GET_STORE_CONFIG {
5
+ storeConfig {
6
+ autocomplete_on_storefront
7
+ minimum_password_length
8
+ required_character_classes_number
9
+ store_code
10
+ store_name
11
+ store_group_code
12
+ locale
13
+ create_account_confirmation
14
+ customer_access_token_lifetime
15
+ }
16
+ }
17
+ `,y=async()=>await g(L,{method:"GET",cache:"force-cache"}).then(t=>{var o;return(o=t.errors)!=null&&o.length?S(t.errors):O(t)}).catch(C),G=`
18
+ query VALIDATE_TOKEN {
19
+ customer {
20
+ group {
21
+ uid
22
+ }
23
+ }
24
+ }
25
+ `,N=async(t="Authorization",o="Bearer")=>{const e=A(h.auth_dropin_user_token);return e?(k(t,`${o} ${e}`),g(G).then(r=>{var a,c,u,s;return!((a=r.errors)!=null&&a.find(m=>{var f;return((f=m.extensions)==null?void 0:f.category)==="graphql-authentication"}))?(i.emit("auth/group-uid",(s=(u=(c=r.data)==null?void 0:c.customer)==null?void 0:u.group)==null?void 0:s.uid),i.emit("authenticated",!0),!0):(I(h.auth_dropin_user_token),E(t),i.emit("auth/group-uid",d),i.emit("authenticated",!1),!1)})):(i.emit("auth/group-uid",d),i.emit("authenticated",!1),!1)};export{h as C,d as D,q as a,p as c,I as d,y as g,S as h,l as i,N as v};
26
+ //# sourceMappingURL=verifyToken.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifyToken.js","sources":["/@dropins/storefront-auth/src/api/initialize/initialize.ts","/@dropins/storefront-auth/src/configs/cookieConfigs.ts","/@dropins/storefront-auth/src/data/transforms/transform-store-config.ts","/@dropins/storefront-auth/src/lib/fetch-error.ts","/@dropins/storefront-auth/src/lib/cookieUtils.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"],"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 { Initializer, Model } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { CustomerModel } from '@/auth/data/models';\nimport { verifyToken } from '@/auth/api';\n\ntype ConfigProps = {\n langDefinitions?: Lang;\n authHeaderConfig: {\n header: string;\n tokenPrefix: string;\n };\n models?: {\n CustomerModel?: Model<CustomerModel>;\n };\n};\n\n/**\n * Default customer group ID for Not Logged In (NLI) users.\n * This value is emitted via the 'auth/group-uid' event when:\n * - A user is not authenticated\n * - Token verification fails\n * - User logs out\n */\nexport const DEFAULT_NLI_CUSTOMER_GROUP_ID = 'b6589fc6ab0dc82cf12099d1c2d40ab994e8410c';\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (config) => {\n const defaultConfig = {\n authHeaderConfig: {\n header: 'Authorization',\n tokenPrefix: 'Bearer',\n },\n };\n\n const mergedConfig = { ...defaultConfig, ...config };\n\n initialize.config.setConfig(mergedConfig);\n\n verifyToken(\n mergedConfig.authHeaderConfig.header,\n mergedConfig.authHeaderConfig.tokenPrefix\n );\n },\n\n listeners: () => [],\n});\n\nexport const config = initialize.config;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nconst COOKIE_NAMES = {\n auth_dropin_user_token: 'auth_dropin_user_token',\n auth_dropin_firstname: 'auth_dropin_firstname',\n};\n\nconst COOKIE_LIFETIME = 3600;\n\nexport { COOKIE_NAMES, COOKIE_LIFETIME };\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { getStoreConfigResponse } from '@/auth/types';\nimport { COOKIE_LIFETIME } from '@/auth/configs/cookieConfigs';\nimport { StoreConfigModel } from '../models';\n\nexport const transformStoreConfig = (\n response: getStoreConfigResponse\n): StoreConfigModel => {\n return {\n autocompleteOnStorefront:\n response?.data?.storeConfig?.autocomplete_on_storefront || false,\n // Need information about min length in response undefined\n minLength: response?.data?.storeConfig?.minimum_password_length || 3,\n requiredCharacterClasses:\n +response?.data?.storeConfig?.required_character_classes_number || 0,\n createAccountConfirmation:\n response?.data?.storeConfig?.create_account_confirmation || false,\n customerAccessTokenLifetime:\n response?.data?.storeConfig?.customer_access_token_lifetime *\n COOKIE_LIFETIME || COOKIE_LIFETIME,\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\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/* eslint-disable no-useless-escape */\nimport { getStoreConfig } from '@/auth/api';\nimport { COOKIE_LIFETIME } from '@/auth/configs/cookieConfigs';\n\nexport const getCookie = (cookieName: string) => {\n const cookies = document.cookie.split(';');\n let foundValue;\n\n cookies.forEach((cookie) => {\n const [name, value] = cookie.trim().split('=');\n if (name === cookieName) {\n foundValue = decodeURIComponent(value);\n }\n });\n\n return foundValue;\n};\n\nexport const deleteCookie = (cookieName: string) => {\n document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;\n};\n\nexport const getCookiesLifetime = async () => {\n try {\n const storeConfigString = sessionStorage.getItem('storeConfig');\n const cachedStoreConfig = storeConfigString\n ? JSON.parse(storeConfigString)\n : {};\n\n let accessTokenLifeTime = cachedStoreConfig.customerAccessTokenLifetime;\n\n if (!accessTokenLifeTime) {\n const storeConfig = await getStoreConfig();\n\n sessionStorage.setItem('storeConfig', JSON.stringify(storeConfig));\n\n accessTokenLifeTime =\n storeConfig?.customerAccessTokenLifetime || COOKIE_LIFETIME;\n }\n\n return `Max-Age=${accessTokenLifeTime}`;\n } catch (error) {\n console.error('getCookiesLifetime() Error:', error);\n return `Max-Age=${COOKIE_LIFETIME}`;\n }\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_STORE_CONFIG = /* GraphQL */ `\n query GET_STORE_CONFIG {\n storeConfig {\n autocomplete_on_storefront\n minimum_password_length\n required_character_classes_number\n store_code\n store_name\n store_group_code\n locale\n create_account_confirmation\n customer_access_token_lifetime\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { getStoreConfigResponse } from '@/auth/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { GET_STORE_CONFIG } from './graphql/getStoreConfig.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { transformStoreConfig } from '@/auth/data/transforms';\nimport { StoreConfigModel } from '@/auth/data/models';\nimport { handleFetchError } from '@/auth/lib/fetch-error';\n\nexport const getStoreConfig = async (): Promise<StoreConfigModel> => {\n return await fetchGraphQl(GET_STORE_CONFIG, {\n method: 'GET',\n cache: 'force-cache',\n })\n .then((response: getStoreConfigResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return transformStoreConfig(response);\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const VALIDATE_CUSTOMER_TOKEN = /* GraphQL */ `\n query VALIDATE_TOKEN {\n customer {\n group {\n uid\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { events } from '@adobe-commerce/event-bus';\nimport {\n fetchGraphQl,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeader,\n} from '../fetch-graphql';\nimport { deleteCookie, getCookie } from '@/auth/lib/cookieUtils';\nimport { COOKIE_NAMES } from '@/auth/configs/cookieConfigs';\nimport { VALIDATE_CUSTOMER_TOKEN } from './graphql/verifyToken.graphql';\nimport { DEFAULT_NLI_CUSTOMER_GROUP_ID } from '../initialize';\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 events.emit('auth/group-uid', DEFAULT_NLI_CUSTOMER_GROUP_ID);\n events.emit('authenticated', false);\n return false;\n }\n\n setFetchGraphQlHeader(authType, `${type} ${token}`);\n\n return fetchGraphQl(VALIDATE_CUSTOMER_TOKEN).then((res) => {\n const unauthenticated = !!res.errors?.find(\n (error) => error.extensions?.category === 'graphql-authentication'\n );\n\n if (!unauthenticated) {\n events.emit('auth/group-uid', res.data?.customer?.group?.uid);\n events.emit('authenticated', true);\n return true;\n };\n\n deleteCookie(COOKIE_NAMES.auth_dropin_user_token);\n removeFetchGraphQlHeader(authType);\n events.emit('auth/group-uid', DEFAULT_NLI_CUSTOMER_GROUP_ID);\n events.emit('authenticated', false);\n return false;\n });\n};\n"],"names":["DEFAULT_NLI_CUSTOMER_GROUP_ID","initialize","Initializer","config","mergedConfig","verifyToken","COOKIE_NAMES","COOKIE_LIFETIME","transformStoreConfig","response","_b","_a","_d","_c","_f","_e","_h","_g","_j","_i","handleFetchError","errors","errorMessage","getCookie","cookieName","cookies","foundValue","cookie","name","value","deleteCookie","getCookiesLifetime","storeConfigString","accessTokenLifeTime","storeConfig","getStoreConfig","error","GET_STORE_CONFIG","fetchGraphQl","handleNetworkError","VALIDATE_CUSTOMER_TOKEN","authType","type","token","setFetchGraphQlHeader","res","events","removeFetchGraphQlHeader"],"mappings":"yMAwCO,MAAMA,EAAgC,2CAEhCC,EAAa,IAAIC,EAAyB,CACrD,KAAM,MAAOC,GAAW,CAQtB,MAAMC,EAAe,CAAE,GAPD,CACpB,iBAAkB,CAChB,OAAQ,gBACR,YAAa,QAAA,CACf,EAGuC,GAAGD,CAAAA,EAE5CF,EAAW,OAAO,UAAUG,CAAY,EAExCC,EACED,EAAa,iBAAiB,OAC9BA,EAAa,iBAAiB,WAAA,CAElC,EAEA,UAAW,IAAM,CAAA,CACnB,CAAC,EAEYD,EAASF,EAAW,OC/C3BK,EAAe,CACnB,uBAAwB,yBACxB,sBAAuB,uBACzB,EAEMC,EAAkB,KCDXC,EACXC,GACqB,yBACrB,MAAO,CACL,2BACEC,GAAAC,EAAAF,GAAA,YAAAA,EAAU,OAAV,YAAAE,EAAgB,cAAhB,YAAAD,EAA6B,6BAA8B,GAE7D,YAAWE,GAAAC,EAAAJ,GAAA,YAAAA,EAAU,OAAV,YAAAI,EAAgB,cAAhB,YAAAD,EAA6B,0BAA2B,EACnE,yBACE,GAACE,GAAAC,EAAAN,GAAA,YAAAA,EAAU,OAAV,YAAAM,EAAgB,cAAhB,YAAAD,EAA6B,oCAAqC,EACrE,4BACEE,GAAAC,EAAAR,GAAA,YAAAA,EAAU,OAAV,YAAAQ,EAAgB,cAAhB,YAAAD,EAA6B,8BAA+B,GAC9D,8BACEE,GAAAC,EAAAV,GAAA,YAAAA,EAAU,OAAV,YAAAU,EAAgB,cAAhB,YAAAD,EAA6B,gCAC3BX,GAAmBA,CAAA,CAE3B,ECnBaa,EAAoBC,GAAuC,CACtE,MAAMC,EAAeD,EAAO,IAAK,GAAW,EAAE,OAAO,EAAE,KAAK,GAAG,EAE/D,MAAM,MAAMC,CAAY,CAC1B,ECDaC,EAAaC,GAAuB,CAC/C,MAAMC,EAAU,S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CAAK,EAAE,EAE3CL,EAAaE,CAAuB,EAAE,KAAMK,GAAQ,aAKzD,MAJyB,GAAClC,EAAAkC,EAAI,SAAJ,MAAAlC,EAAY,KACnCyB,GAAA,OAAU,QAAAzB,EAAAyB,EAAM,aAAN,YAAAzB,EAAkB,YAAa,6BAI1CmC,EAAO,KAAK,kBAAkBlC,GAAAC,GAAAH,EAAAmC,EAAI,OAAJ,YAAAnC,EAAU,WAAV,YAAAG,EAAoB,QAApB,YAAAD,EAA2B,GAAG,EAC5DkC,EAAO,KAAK,gBAAiB,EAAI,EAC1B,KAGThB,EAAaxB,EAAa,sBAAsB,EAChDyC,EAAyBN,CAAQ,EACjCK,EAAO,KAAK,iBAAkB9C,CAA6B,EAC3D8C,EAAO,KAAK,gBAAiB,EAAK,EAC3B,GACT,CAAC,IAvBCA,EAAO,KAAK,iBAAkB9C,CAA6B,EAC3D8C,EAAO,KAAK,gBAAiB,EAAK,EAC3B,GAsBX"}
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/preact-hooks.js";import"../chunks/Button.js";import"@dropins/tools/i18n.js";import{S as u}from"../chunks/SignInForm.js";import"@dropins/tools/preact-compat.js";import"../chunks/Button2.js";import"../chunks/getCustomerToken.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getCustomerRolePermissions.js";import"../fragments.js";import"../chunks/acdl.js";import"../chunks/setReCaptchaToken.js";import"../chunks/resendConfirmationEmail.js";import"../chunks/simplifyTransformAttributesForm.js";import"../chunks/transform-attributes-form.js";import"../chunks/focusOnEmptyPasswordField.js";import"../chunks/confirmEmail.js";const L=({slots:i,labels:o,enableEmailConfirmation:t,initialEmailValue:m,formSize:p,renderSignUpLink:n,hideCloseBtnOnEmailConfirmation:s,routeRedirectOnEmailConfirmationClose:a,routeRedirectOnSignIn:e,routeForgotPassword:c,routeSignUp:d,onSuccessCallback:f,onErrorCallback:g,onSignUpLinkClick:l})=>r("div",{className:"auth-sign-in",children:r(u,{slots:i,labels:o,formSize:p,renderSignUpLink:n,initialEmailValue:m,enableEmailConfirmation:t,hideCloseBtnOnEmailConfirmation:s,routeRedirectOnEmailConfirmationClose:a,routeSignUp:d,onErrorCallback:g,onSuccessCallback:f,onSignUpLinkClick:l,routeForgotPassword:c,routeRedirectOnSignIn:e})});export{L as SignIn,L as default};
3
+ import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/preact-hooks.js";import"../chunks/Button.js";import"@dropins/tools/i18n.js";import{S as u}from"../chunks/SignInForm.js";import"@dropins/tools/preact-compat.js";import"../chunks/Button2.js";import"../chunks/getCustomerToken.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/verifyToken.js";import"../fragments.js";import"../chunks/acdl.js";import"../chunks/setReCaptchaToken.js";import"../chunks/resendConfirmationEmail.js";import"../chunks/simplifyTransformAttributesForm.js";import"../chunks/transform-attributes-form.js";import"../chunks/focusOnEmptyPasswordField.js";import"../chunks/confirmEmail.js";const L=({slots:i,labels:o,enableEmailConfirmation:t,initialEmailValue:m,formSize:p,renderSignUpLink:n,hideCloseBtnOnEmailConfirmation:s,routeRedirectOnEmailConfirmationClose:a,routeRedirectOnSignIn:e,routeForgotPassword:c,routeSignUp:d,onSuccessCallback:f,onErrorCallback:g,onSignUpLinkClick:l})=>r("div",{className:"auth-sign-in",children:r(u,{slots:i,labels:o,formSize:p,renderSignUpLink:n,initialEmailValue:m,enableEmailConfirmation:t,hideCloseBtnOnEmailConfirmation:s,routeRedirectOnEmailConfirmationClose:a,routeSignUp:d,onErrorCallback:g,onSuccessCallback:f,onSignUpLinkClick:l,routeForgotPassword:c,routeRedirectOnSignIn:e})});export{L as SignIn,L as default};
4
4
  //# sourceMappingURL=SignIn.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SignIn.js","sources":["/@dropins/storefront-auth/src/containers/SignIn/SignIn.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { SignInForm } from '@/auth/components';\nimport { SignInProps } from '@/auth/types';\n\nexport const SignIn: Container<SignInProps> = ({\n slots,\n labels,\n enableEmailConfirmation,\n initialEmailValue,\n formSize,\n renderSignUpLink,\n hideCloseBtnOnEmailConfirmation,\n routeRedirectOnEmailConfirmationClose,\n routeRedirectOnSignIn,\n routeForgotPassword,\n routeSignUp,\n onSuccessCallback,\n onErrorCallback,\n onSignUpLinkClick,\n}) => {\n return (\n <div className=\"auth-sign-in\">\n <SignInForm\n slots={slots}\n labels={labels}\n formSize={formSize}\n renderSignUpLink={renderSignUpLink}\n initialEmailValue={initialEmailValue}\n enableEmailConfirmation={enableEmailConfirmation}\n hideCloseBtnOnEmailConfirmation={hideCloseBtnOnEmailConfirmation}\n routeRedirectOnEmailConfirmationClose={\n routeRedirectOnEmailConfirmationClose\n }\n routeSignUp={routeSignUp}\n onErrorCallback={onErrorCallback}\n onSuccessCallback={onSuccessCallback}\n onSignUpLinkClick={onSignUpLinkClick}\n routeForgotPassword={routeForgotPassword}\n routeRedirectOnSignIn={routeRedirectOnSignIn}\n />\n </div>\n );\n};\n"],"names":["SignIn","slots","labels","enableEmailConfirmation","initialEmailValue","formSize","renderSignUpLink","hideCloseBtnOnEmailConfirmation","routeRedirectOnEmailConfirmationClose","routeRedirectOnSignIn","routeForgotPassword","routeSignUp","onSuccessCallback","onErrorCallback","onSignUpLinkClick","jsx","SignInForm"],"mappings":"q3BAqBO,MAAMA,EAAiC,CAAC,CAC7C,MAAAC,EACA,OAAAC,EACA,wBAAAC,EACA,kBAAAC,EACA,SAAAC,EACA,iBAAAC,EACA,gCAAAC,EACA,sCAAAC,EACA,sBAAAC,EACA,oBAAAC,EACA,YAAAC,EACA,kBAAAC,EACA,gBAAAC,EACA,kBAAAC,CACF,IAEIC,EAAC,MAAA,CAAI,UAAU,eACb,SAAAA,EAACC,EAAA,CACC,MAAAf,EACA,OAAAC,EACA,SAAAG,EACA,iBAAAC,EACA,kBAAAF,EACA,wBAAAD,EACA,gCAAAI,EACA,sCAAAC,EAGA,YAAAG,EACA,gBAAAE,EACA,kBAAAD,EACA,kBAAAE,EACA,oBAAAJ,EACA,sBAAAD,CAAA,CAAA,EAEJ"}
1
+ {"version":3,"file":"SignIn.js","sources":["/@dropins/storefront-auth/src/containers/SignIn/SignIn.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { SignInForm } from '@/auth/components';\nimport { SignInProps } from '@/auth/types';\n\nexport const SignIn: Container<SignInProps> = ({\n slots,\n labels,\n enableEmailConfirmation,\n initialEmailValue,\n formSize,\n renderSignUpLink,\n hideCloseBtnOnEmailConfirmation,\n routeRedirectOnEmailConfirmationClose,\n routeRedirectOnSignIn,\n routeForgotPassword,\n routeSignUp,\n onSuccessCallback,\n onErrorCallback,\n onSignUpLinkClick,\n}) => {\n return (\n <div className=\"auth-sign-in\">\n <SignInForm\n slots={slots}\n labels={labels}\n formSize={formSize}\n renderSignUpLink={renderSignUpLink}\n initialEmailValue={initialEmailValue}\n enableEmailConfirmation={enableEmailConfirmation}\n hideCloseBtnOnEmailConfirmation={hideCloseBtnOnEmailConfirmation}\n routeRedirectOnEmailConfirmationClose={\n routeRedirectOnEmailConfirmationClose\n }\n routeSignUp={routeSignUp}\n onErrorCallback={onErrorCallback}\n onSuccessCallback={onSuccessCallback}\n onSignUpLinkClick={onSignUpLinkClick}\n routeForgotPassword={routeForgotPassword}\n routeRedirectOnSignIn={routeRedirectOnSignIn}\n />\n </div>\n );\n};\n"],"names":["SignIn","slots","labels","enableEmailConfirmation","initialEmailValue","formSize","renderSignUpLink","hideCloseBtnOnEmailConfirmation","routeRedirectOnEmailConfirmationClose","routeRedirectOnSignIn","routeForgotPassword","routeSignUp","onSuccessCallback","onErrorCallback","onSignUpLinkClick","jsx","SignInForm"],"mappings":"s2BAqBO,MAAMA,EAAiC,CAAC,CAC7C,MAAAC,EACA,OAAAC,EACA,wBAAAC,EACA,kBAAAC,EACA,SAAAC,EACA,iBAAAC,EACA,gCAAAC,EACA,sCAAAC,EACA,sBAAAC,EACA,oBAAAC,EACA,YAAAC,EACA,kBAAAC,EACA,gBAAAC,EACA,kBAAAC,CACF,IAEIC,EAAC,MAAA,CAAI,UAAU,eACb,SAAAA,EAACC,EAAA,CACC,MAAAf,EACA,OAAAC,EACA,SAAAG,EACA,iBAAAC,EACA,kBAAAF,EACA,wBAAAD,EACA,gCAAAI,EACA,sCAAAC,EAGA,YAAAG,EACA,gBAAAE,EACA,kBAAAD,EACA,kBAAAE,EACA,oBAAAJ,EACA,sBAAAD,CAAA,CAAA,EAEJ"}
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/preact-hooks.js";import"../chunks/Button.js";import"@dropins/tools/i18n.js";import{S as l}from"../chunks/SignUpForm.js";import"@dropins/tools/preact-compat.js";import"../chunks/createCustomerAddress.js";import"../fragments.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/setReCaptchaToken.js";import"../chunks/getCustomerRolePermissions.js";import"../chunks/transform-attributes-form.js";import"../chunks/simplifyTransformAttributesForm.js";import"../chunks/usePasswordValidationMessage.js";import"../chunks/getCustomerToken.js";import"../chunks/acdl.js";import"../chunks/Button2.js";import"../chunks/focusOnEmptyPasswordField.js";import"../chunks/resendConfirmationEmail.js";import"../chunks/SkeletonLoader.js";const M=({slots:i,formSize:o,apiVersion2:t,addressesData:m,isAutoSignInEnabled:p,requireRetypePassword:s,inputsDefaultValueSet:a,fieldsConfigForApiVersion1:n,hideCloseBtnOnEmailConfirmation:e,routeRedirectOnEmailConfirmationClose:u,routeRedirectOnSignIn:c,onSuccessCallback:d,onErrorCallback:f,routeSignIn:g})=>r("div",{className:"auth-sign-up",children:r(l,{requireRetypePassword:s,formSize:o,apiVersion2:t,addressesData:m,isAutoSignInEnabled:p,inputsDefaultValueSet:a,fieldsConfigForApiVersion1:n,hideCloseBtnOnEmailConfirmation:e,routeRedirectOnEmailConfirmationClose:u,routeRedirectOnSignIn:c,routeSignIn:g,slots:i,onErrorCallback:f,onSuccessCallback:d})});export{M as SignUp,M as default};
3
+ import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/preact-hooks.js";import"../chunks/Button.js";import"@dropins/tools/i18n.js";import{S as l}from"../chunks/SignUpForm.js";import"@dropins/tools/preact-compat.js";import"../chunks/createCustomerAddress.js";import"../fragments.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/setReCaptchaToken.js";import"../chunks/verifyToken.js";import"../chunks/transform-attributes-form.js";import"../chunks/simplifyTransformAttributesForm.js";import"../chunks/usePasswordValidationMessage.js";import"../chunks/getCustomerToken.js";import"../chunks/acdl.js";import"../chunks/Button2.js";import"../chunks/focusOnEmptyPasswordField.js";import"../chunks/resendConfirmationEmail.js";import"../chunks/SkeletonLoader.js";const M=({slots:i,formSize:o,apiVersion2:t,addressesData:m,isAutoSignInEnabled:p,requireRetypePassword:s,inputsDefaultValueSet:a,fieldsConfigForApiVersion1:n,hideCloseBtnOnEmailConfirmation:e,routeRedirectOnEmailConfirmationClose:u,routeRedirectOnSignIn:c,onSuccessCallback:d,onErrorCallback:f,routeSignIn:g})=>r("div",{className:"auth-sign-up",children:r(l,{requireRetypePassword:s,formSize:o,apiVersion2:t,addressesData:m,isAutoSignInEnabled:p,inputsDefaultValueSet:a,fieldsConfigForApiVersion1:n,hideCloseBtnOnEmailConfirmation:e,routeRedirectOnEmailConfirmationClose:u,routeRedirectOnSignIn:c,routeSignIn:g,slots:i,onErrorCallback:f,onSuccessCallback:d})});export{M as SignUp,M as default};
4
4
  //# sourceMappingURL=SignUp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SignUp.js","sources":["/@dropins/storefront-auth/src/containers/SignUp/SignUp.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { SignUpForm } from '@/auth/components';\nimport { SignUpProps } from '@/auth/types';\n\nexport const SignUp: Container<SignUpProps> = ({\n slots,\n formSize,\n apiVersion2,\n addressesData,\n isAutoSignInEnabled,\n requireRetypePassword,\n inputsDefaultValueSet,\n fieldsConfigForApiVersion1,\n hideCloseBtnOnEmailConfirmation,\n routeRedirectOnEmailConfirmationClose,\n routeRedirectOnSignIn,\n onSuccessCallback,\n onErrorCallback,\n routeSignIn,\n}) => {\n return (\n <div className=\"auth-sign-up\">\n <SignUpForm\n requireRetypePassword={requireRetypePassword}\n formSize={formSize}\n apiVersion2={apiVersion2}\n addressesData={addressesData}\n isAutoSignInEnabled={isAutoSignInEnabled}\n inputsDefaultValueSet={inputsDefaultValueSet}\n fieldsConfigForApiVersion1={fieldsConfigForApiVersion1}\n hideCloseBtnOnEmailConfirmation={hideCloseBtnOnEmailConfirmation}\n routeRedirectOnEmailConfirmationClose={\n routeRedirectOnEmailConfirmationClose\n }\n routeRedirectOnSignIn={routeRedirectOnSignIn}\n routeSignIn={routeSignIn}\n slots={slots}\n onErrorCallback={onErrorCallback}\n onSuccessCallback={onSuccessCallback}\n />\n </div>\n );\n};\n"],"names":["SignUp","slots","formSize","apiVersion2","addressesData","isAutoSignInEnabled","requireRetypePassword","inputsDefaultValueSet","fieldsConfigForApiVersion1","hideCloseBtnOnEmailConfirmation","routeRedirectOnEmailConfirmationClose","routeRedirectOnSignIn","onSuccessCallback","onErrorCallback","routeSignIn","jsx","SignUpForm"],"mappings":"o9BAqBO,MAAMA,EAAiC,CAAC,CAC7C,MAAAC,EACA,SAAAC,EACA,YAAAC,EACA,cAAAC,EACA,oBAAAC,EACA,sBAAAC,EACA,sBAAAC,EACA,2BAAAC,EACA,gCAAAC,EACA,sCAAAC,EACA,sBAAAC,EACA,kBAAAC,EACA,gBAAAC,EACA,YAAAC,CACF,IAEIC,EAAC,MAAA,CAAI,UAAU,eACb,SAAAA,EAACC,EAAA,CACC,sBAAAV,EACA,SAAAJ,EACA,YAAAC,EACA,cAAAC,EACA,oBAAAC,EACA,sBAAAE,EACA,2BAAAC,EACA,gCAAAC,EACA,sCAAAC,EAGA,sBAAAC,EACA,YAAAG,EACA,MAAAb,EACA,gBAAAY,EACA,kBAAAD,CAAA,CAAA,EAEJ"}
1
+ {"version":3,"file":"SignUp.js","sources":["/@dropins/storefront-auth/src/containers/SignUp/SignUp.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { SignUpForm } from '@/auth/components';\nimport { SignUpProps } from '@/auth/types';\n\nexport const SignUp: Container<SignUpProps> = ({\n slots,\n formSize,\n apiVersion2,\n addressesData,\n isAutoSignInEnabled,\n requireRetypePassword,\n inputsDefaultValueSet,\n fieldsConfigForApiVersion1,\n hideCloseBtnOnEmailConfirmation,\n routeRedirectOnEmailConfirmationClose,\n routeRedirectOnSignIn,\n onSuccessCallback,\n onErrorCallback,\n routeSignIn,\n}) => {\n return (\n <div className=\"auth-sign-up\">\n <SignUpForm\n requireRetypePassword={requireRetypePassword}\n formSize={formSize}\n apiVersion2={apiVersion2}\n addressesData={addressesData}\n isAutoSignInEnabled={isAutoSignInEnabled}\n inputsDefaultValueSet={inputsDefaultValueSet}\n fieldsConfigForApiVersion1={fieldsConfigForApiVersion1}\n hideCloseBtnOnEmailConfirmation={hideCloseBtnOnEmailConfirmation}\n routeRedirectOnEmailConfirmationClose={\n routeRedirectOnEmailConfirmationClose\n }\n routeRedirectOnSignIn={routeRedirectOnSignIn}\n routeSignIn={routeSignIn}\n slots={slots}\n onErrorCallback={onErrorCallback}\n onSuccessCallback={onSuccessCallback}\n />\n </div>\n );\n};\n"],"names":["SignUp","slots","formSize","apiVersion2","addressesData","isAutoSignInEnabled","requireRetypePassword","inputsDefaultValueSet","fieldsConfigForApiVersion1","hideCloseBtnOnEmailConfirmation","routeRedirectOnEmailConfirmationClose","routeRedirectOnSignIn","onSuccessCallback","onErrorCallback","routeSignIn","jsx","SignUpForm"],"mappings":"q8BAqBO,MAAMA,EAAiC,CAAC,CAC7C,MAAAC,EACA,SAAAC,EACA,YAAAC,EACA,cAAAC,EACA,oBAAAC,EACA,sBAAAC,EACA,sBAAAC,EACA,2BAAAC,EACA,gCAAAC,EACA,sCAAAC,EACA,sBAAAC,EACA,kBAAAC,EACA,gBAAAC,EACA,YAAAC,CACF,IAEIC,EAAC,MAAA,CAAI,UAAU,eACb,SAAAA,EAACC,EAAA,CACC,sBAAAV,EACA,SAAAJ,EACA,YAAAC,EACA,cAAAC,EACA,oBAAAC,EACA,sBAAAE,EACA,2BAAAC,EACA,gCAAAC,EACA,sCAAAC,EAGA,sBAAAC,EACA,YAAAG,EACA,MAAAb,EACA,gBAAAY,EACA,kBAAAD,CAAA,CAAA,EAEJ"}
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsxs as a,jsx as o,Fragment as s}from"@dropins/tools/preact-jsx-runtime.js";import{classes as m,Slot as u}from"@dropins/tools/lib.js";import{Button as r}from"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/preact-hooks.js";import"../chunks/Button.js";import{useText as d}from"@dropins/tools/i18n.js";import{r as f}from"../chunks/revokeCustomerToken.js";import"@dropins/tools/preact-compat.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getCustomerRolePermissions.js";import"../chunks/acdl.js";const h=({formSize:c="default",className:n="",slots:i,labels:t})=>{const e=d({headingText:"Auth.SuccessNotification.headingText",messageText:"Auth.SuccessNotification.messageText",primaryButtonText:"Auth.SuccessNotification.primaryButtonText",secondaryButtonText:"Auth.SuccessNotification.secondaryButtonText"});return a("div",{className:m(["auth-success-notification-form",`auth-success-notification-form--${c}`,n]),id:"welcome-message",role:"alert","aria-live":"assertive","aria-labelledby":(t==null?void 0:t.headingText)??e.headingText,"aria-describedby":(t==null?void 0:t.messageText)??e.messageText,"tab-index":"-1",children:[o("p",{id:"welcome-heading",className:"auth-success-notification-form__title","data-testid":"notification-title",children:(t==null?void 0:t.headingText)??e.headingText}),o("p",{id:"welcome-details",className:"auth-success-notification-form__content-text","data-testid":"notification-content",children:(t==null?void 0:t.messageText)??e.messageText}),i!=null&&i.SuccessNotificationActions?o(u,{"data-testid":"successNotificationActions",name:"SuccessNotificationActions",slot:i==null?void 0:i.SuccessNotificationActions,context:{}}):a(s,{children:[o(r,{"data-testid":"primaryButton",type:"button",className:"auth-success-notification-form__button auth-success-notification-form__button--top",onClick:()=>window.location.href="/",children:e.primaryButtonText}),o(r,{"data-testid":"secondaryButton",type:"button",variant:"tertiary",onClick:async()=>{await f(),window.location.href="/"},children:e.secondaryButtonText})]})]})},j=({formSize:c="default",slots:n,className:i,labels:t})=>o("div",{className:"auth-success-notification",children:o(h,{formSize:c,className:i,slots:n,labels:t})});export{j as SuccessNotification,j as default};
3
+ import{jsxs as a,jsx as o,Fragment as s}from"@dropins/tools/preact-jsx-runtime.js";import{classes as m,Slot as u}from"@dropins/tools/lib.js";import{Button as r}from"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/preact-hooks.js";import"../chunks/Button.js";import{useText as d}from"@dropins/tools/i18n.js";import{r as f}from"../chunks/revokeCustomerToken.js";import"@dropins/tools/preact-compat.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/verifyToken.js";import"../chunks/acdl.js";const h=({formSize:c="default",className:n="",slots:i,labels:t})=>{const e=d({headingText:"Auth.SuccessNotification.headingText",messageText:"Auth.SuccessNotification.messageText",primaryButtonText:"Auth.SuccessNotification.primaryButtonText",secondaryButtonText:"Auth.SuccessNotification.secondaryButtonText"});return a("div",{className:m(["auth-success-notification-form",`auth-success-notification-form--${c}`,n]),id:"welcome-message",role:"alert","aria-live":"assertive","aria-labelledby":(t==null?void 0:t.headingText)??e.headingText,"aria-describedby":(t==null?void 0:t.messageText)??e.messageText,"tab-index":"-1",children:[o("p",{id:"welcome-heading",className:"auth-success-notification-form__title","data-testid":"notification-title",children:(t==null?void 0:t.headingText)??e.headingText}),o("p",{id:"welcome-details",className:"auth-success-notification-form__content-text","data-testid":"notification-content",children:(t==null?void 0:t.messageText)??e.messageText}),i!=null&&i.SuccessNotificationActions?o(u,{"data-testid":"successNotificationActions",name:"SuccessNotificationActions",slot:i==null?void 0:i.SuccessNotificationActions,context:{}}):a(s,{children:[o(r,{"data-testid":"primaryButton",type:"button",className:"auth-success-notification-form__button auth-success-notification-form__button--top",onClick:()=>window.location.href="/",children:e.primaryButtonText}),o(r,{"data-testid":"secondaryButton",type:"button",variant:"tertiary",onClick:async()=>{await f(),window.location.href="/"},children:e.secondaryButtonText})]})]})},j=({formSize:c="default",slots:n,className:i,labels:t})=>o("div",{className:"auth-success-notification",children:o(h,{formSize:c,className:i,slots:n,labels:t})});export{j as SuccessNotification,j as default};
4
4
  //# sourceMappingURL=SuccessNotification.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SuccessNotification.js","sources":["/@dropins/storefront-auth/src/components/SuccessNotificationForm/SuccessNotificationForm.tsx","/@dropins/storefront-auth/src/containers/SuccessNotification/SuccessNotification.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, Slot } from '@adobe-commerce/elsie/lib';\nimport '@/auth/components/SuccessNotificationForm/SuccessNotificationForm.css';\nimport { Button } from '@adobe-commerce/elsie/components';\nimport { SuccessNotificationFormProps } from '@/auth/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { revokeCustomerToken } from '@/auth/api';\n\nexport const SuccessNotificationForm: FunctionComponent<\n SuccessNotificationFormProps & HTMLAttributes<HTMLDivElement>\n> = ({ formSize = 'default', className = '', slots, labels }) => {\n const translations = useText({\n headingText: 'Auth.SuccessNotification.headingText',\n messageText: 'Auth.SuccessNotification.messageText',\n primaryButtonText: 'Auth.SuccessNotification.primaryButtonText',\n secondaryButtonText: 'Auth.SuccessNotification.secondaryButtonText',\n });\n\n return (\n <div\n className={classes([\n 'auth-success-notification-form',\n `auth-success-notification-form--${formSize}`,\n className,\n ])}\n id=\"welcome-message\"\n role=\"alert\"\n aria-live=\"assertive\"\n aria-labelledby={labels?.headingText ?? translations.headingText}\n aria-describedby={labels?.messageText ?? translations.messageText}\n tab-index=\"-1\"\n >\n <p\n id=\"welcome-heading\"\n className=\"auth-success-notification-form__title\"\n data-testid=\"notification-title\"\n >\n {labels?.headingText ?? translations.headingText}\n </p>\n <p\n id=\"welcome-details\"\n className=\"auth-success-notification-form__content-text\"\n data-testid=\"notification-content\"\n >\n {labels?.messageText ?? translations.messageText}\n </p>\n {slots?.SuccessNotificationActions ? (\n <Slot\n data-testid=\"successNotificationActions\"\n name=\"SuccessNotificationActions\"\n slot={slots?.SuccessNotificationActions}\n context={{}}\n />\n ) : (\n <>\n <Button\n data-testid=\"primaryButton\"\n type=\"button\"\n className=\"auth-success-notification-form__button auth-success-notification-form__button--top\"\n onClick={() => (window.location.href = '/')}\n >\n {translations.primaryButtonText}\n </Button>\n <Button\n data-testid=\"secondaryButton\"\n type=\"button\"\n variant=\"tertiary\"\n onClick={async () => {\n await revokeCustomerToken();\n window.location.href = '/';\n }}\n >\n {translations.secondaryButtonText}\n </Button>\n </>\n )}\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\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { SuccessNotificationForm } from '@/auth/components';\nimport { SuccessNotificationProps } from '@/auth/types';\n\nexport const SuccessNotification: Container<SuccessNotificationProps> = ({\n formSize = 'default',\n slots,\n className,\n labels,\n}) => {\n return (\n <div className=\"auth-success-notification\">\n <SuccessNotificationForm\n formSize={formSize}\n className={className}\n slots={slots}\n labels={labels}\n />\n </div>\n );\n};\n"],"names":["SuccessNotificationForm","formSize","className","slots","labels","translations","useText","jsxs","classes","jsx","Slot","Fragment","Button","revokeCustomerToken","SuccessNotification"],"mappings":"inBA0BO,MAAMA,EAET,CAAC,CAAE,SAAAC,EAAW,UAAW,UAAAC,EAAY,GAAI,MAAAC,EAAO,OAAAC,KAAa,CAC/D,MAAMC,EAAeC,EAAQ,CAC3B,YAAa,uCACb,YAAa,uCACb,kBAAmB,6CACnB,oBAAqB,8CAAA,CACtB,EAED,OACEC,EAAC,MAAA,CACC,UAAWC,EAAQ,CACjB,iCACA,mCAAmCP,CAAQ,GAC3CC,CAAA,CACD,EACD,GAAG,kBACH,KAAK,QACL,YAAU,YACV,mBAAiBE,GAAA,YAAAA,EAAQ,cAAeC,EAAa,YACrD,oBAAkBD,GAAA,YAAAA,EAAQ,cAAeC,EAAa,YACtD,YAAU,KAEV,SAAA,CAAAI,EAAC,IAAA,CACC,GAAG,kBACH,UAAU,wCACV,cAAY,qBAEX,UAAAL,GAAA,YAAAA,EAAQ,cAAeC,EAAa,WAAA,CAAA,EAEvCI,EAAC,IAAA,CACC,GAAG,kBACH,UAAU,+CACV,cAAY,uBAEX,UAAAL,GAAA,YAAAA,EAAQ,cAAeC,EAAa,WAAA,CAAA,EAEtCF,GAAA,MAAAA,EAAO,2BACNM,EAACC,EAAA,CACC,cAAY,6BACZ,KAAK,6BACL,KAAMP,GAAA,YAAAA,EAAO,2BACb,QAAS,CAAA,CAAC,CAAA,EAGZI,EAAAI,EAAA,CACE,SAAA,CAAAF,EAACG,EAAA,CACC,cAAY,gBACZ,KAAK,SACL,UAAU,qFACV,QAAS,IAAO,OAAO,SAAS,KAAO,IAEtC,SAAAP,EAAa,iBAAA,CAAA,EAEhBI,EAACG,EAAA,CACC,cAAY,kBACZ,KAAK,SACL,QAAQ,WACR,QAAS,SAAY,CACnB,MAAMC,EAAA,EACN,OAAO,SAAS,KAAO,GACzB,EAEC,SAAAR,EAAa,mBAAA,CAAA,CAChB,CAAA,CACF,CAAA,CAAA,CAAA,CAIR,EC3EaS,EAA2D,CAAC,CACvE,SAAAb,EAAW,UACX,MAAAE,EACA,UAAAD,EACA,OAAAE,CACF,IAEIK,EAAC,MAAA,CAAI,UAAU,4BACb,SAAAA,EAACT,EAAA,CACC,SAAAC,EACA,UAAAC,EACA,MAAAC,EACA,OAAAC,CAAA,CAAA,EAEJ"}
1
+ {"version":3,"file":"SuccessNotification.js","sources":["/@dropins/storefront-auth/src/components/SuccessNotificationForm/SuccessNotificationForm.tsx","/@dropins/storefront-auth/src/containers/SuccessNotification/SuccessNotification.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, Slot } from '@adobe-commerce/elsie/lib';\nimport '@/auth/components/SuccessNotificationForm/SuccessNotificationForm.css';\nimport { Button } from '@adobe-commerce/elsie/components';\nimport { SuccessNotificationFormProps } from '@/auth/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { revokeCustomerToken } from '@/auth/api';\n\nexport const SuccessNotificationForm: FunctionComponent<\n SuccessNotificationFormProps & HTMLAttributes<HTMLDivElement>\n> = ({ formSize = 'default', className = '', slots, labels }) => {\n const translations = useText({\n headingText: 'Auth.SuccessNotification.headingText',\n messageText: 'Auth.SuccessNotification.messageText',\n primaryButtonText: 'Auth.SuccessNotification.primaryButtonText',\n secondaryButtonText: 'Auth.SuccessNotification.secondaryButtonText',\n });\n\n return (\n <div\n className={classes([\n 'auth-success-notification-form',\n `auth-success-notification-form--${formSize}`,\n className,\n ])}\n id=\"welcome-message\"\n role=\"alert\"\n aria-live=\"assertive\"\n aria-labelledby={labels?.headingText ?? translations.headingText}\n aria-describedby={labels?.messageText ?? translations.messageText}\n tab-index=\"-1\"\n >\n <p\n id=\"welcome-heading\"\n className=\"auth-success-notification-form__title\"\n data-testid=\"notification-title\"\n >\n {labels?.headingText ?? translations.headingText}\n </p>\n <p\n id=\"welcome-details\"\n className=\"auth-success-notification-form__content-text\"\n data-testid=\"notification-content\"\n >\n {labels?.messageText ?? translations.messageText}\n </p>\n {slots?.SuccessNotificationActions ? (\n <Slot\n data-testid=\"successNotificationActions\"\n name=\"SuccessNotificationActions\"\n slot={slots?.SuccessNotificationActions}\n context={{}}\n />\n ) : (\n <>\n <Button\n data-testid=\"primaryButton\"\n type=\"button\"\n className=\"auth-success-notification-form__button auth-success-notification-form__button--top\"\n onClick={() => (window.location.href = '/')}\n >\n {translations.primaryButtonText}\n </Button>\n <Button\n data-testid=\"secondaryButton\"\n type=\"button\"\n variant=\"tertiary\"\n onClick={async () => {\n await revokeCustomerToken();\n window.location.href = '/';\n }}\n >\n {translations.secondaryButtonText}\n </Button>\n </>\n )}\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\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { SuccessNotificationForm } from '@/auth/components';\nimport { SuccessNotificationProps } from '@/auth/types';\n\nexport const SuccessNotification: Container<SuccessNotificationProps> = ({\n formSize = 'default',\n slots,\n className,\n labels,\n}) => {\n return (\n <div className=\"auth-success-notification\">\n <SuccessNotificationForm\n formSize={formSize}\n className={className}\n slots={slots}\n labels={labels}\n />\n </div>\n );\n};\n"],"names":["SuccessNotificationForm","formSize","className","slots","labels","translations","useText","jsxs","classes","jsx","Slot","Fragment","Button","revokeCustomerToken","SuccessNotification"],"mappings":"kmBA0BO,MAAMA,EAET,CAAC,CAAE,SAAAC,EAAW,UAAW,UAAAC,EAAY,GAAI,MAAAC,EAAO,OAAAC,KAAa,CAC/D,MAAMC,EAAeC,EAAQ,CAC3B,YAAa,uCACb,YAAa,uCACb,kBAAmB,6CACnB,oBAAqB,8CAAA,CACtB,EAED,OACEC,EAAC,MAAA,CACC,UAAWC,EAAQ,CACjB,iCACA,mCAAmCP,CAAQ,GAC3CC,CAAA,CACD,EACD,GAAG,kBACH,KAAK,QACL,YAAU,YACV,mBAAiBE,GAAA,YAAAA,EAAQ,cAAeC,EAAa,YACrD,oBAAkBD,GAAA,YAAAA,EAAQ,cAAeC,EAAa,YACtD,YAAU,KAEV,SAAA,CAAAI,EAAC,IAAA,CACC,GAAG,kBACH,UAAU,wCACV,cAAY,qBAEX,UAAAL,GAAA,YAAAA,EAAQ,cAAeC,EAAa,WAAA,CAAA,EAEvCI,EAAC,IAAA,CACC,GAAG,kBACH,UAAU,+CACV,cAAY,uBAEX,UAAAL,GAAA,YAAAA,EAAQ,cAAeC,EAAa,WAAA,CAAA,EAEtCF,GAAA,MAAAA,EAAO,2BACNM,EAACC,EAAA,CACC,cAAY,6BACZ,KAAK,6BACL,KAAMP,GAAA,YAAAA,EAAO,2BACb,QAAS,CAAA,CAAC,CAAA,EAGZI,EAAAI,EAAA,CACE,SAAA,CAAAF,EAACG,EAAA,CACC,cAAY,gBACZ,KAAK,SACL,UAAU,qFACV,QAAS,IAAO,OAAO,SAAS,KAAO,IAEtC,SAAAP,EAAa,iBAAA,CAAA,EAEhBI,EAACG,EAAA,CACC,cAAY,kBACZ,KAAK,SACL,QAAQ,WACR,QAAS,SAAY,CACnB,MAAMC,EAAA,EACN,OAAO,SAAS,KAAO,GACzB,EAEC,SAAAR,EAAa,mBAAA,CAAA,CAChB,CAAA,CACF,CAAA,CAAA,CAAA,CAIR,EC3EaS,EAA2D,CAAC,CACvE,SAAAb,EAAW,UACX,MAAAE,EACA,UAAAD,EACA,OAAAE,CACF,IAEIK,EAAC,MAAA,CAAI,UAAU,4BACb,SAAAA,EAACT,EAAA,CACC,SAAAC,EACA,UAAAC,EACA,MAAAC,EACA,OAAAC,CAAA,CAAA,EAEJ"}
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as u,jsxs as H}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as Y,classes as $}from"@dropins/tools/lib.js";import{Header as Z,InLineAlert as k,InputPassword as S}from"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{useState as h,useEffect as z,useCallback as I}from"@dropins/tools/preact-hooks.js";import{u as W,F as O}from"../chunks/Button.js";import{v as g,u as R,a as C}from"../chunks/usePasswordValidationMessage.js";import{a as tt}from"../chunks/getCustomerToken.js";import{r as et}from"../chunks/resetPassword.js";import{c as j,g as at,u as st,B as rt}from"../chunks/Button2.js";import{useText as it}from"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"../chunks/getCustomerRolePermissions.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/acdl.js";import"../chunks/setReCaptchaToken.js";const J=(d,p)=>d.split("&").filter(r=>r.includes(p)).map(r=>r.split("=")[1])[0],ot=({isEmailConfirmationRequired:d,signInOnSuccess:p,passwordConfigs:t,routeRedirectOnSignIn:r,routeWrongUrlRedirect:w,onErrorCallback:a,onSuccessCallback:i,handleSetInLineAlertProps:m,routeRedirectOnPasswordUpdate:N,routeSignInPage:o})=>{const s=it({errorNotification:"Auth.Notification.errorNotification",updatePasswordMessage:"Auth.Notification.updatePasswordMessage",updatePasswordActionMessage:"Auth.Notification.updatePasswordActionMessage",customerTokenErrorMessage:"Auth.Api.customerTokenErrorMessage"}),[U,n]=h({userName:"",status:!1}),[x,F]=h(""),[v,A]=h(!1),[P,L]=h(""),[y,M]=h(""),[T,c]=h(!1),[_,q]=h(!1),[b,B]=h([]);z(()=>{v&&!b.length&&(x.length?q(!1):q(!0))},[v,x,b]),z(()=>{const{search:f}=window.location;!f.includes("token=")&&!f.includes("email=")&&j(w)&&(window.location.href=w());const e=decodeURIComponent(f),V=J(e,"token"),E=J(e,"email");L(E),M(V)},[w]);const K=I(async f=>{f.preventDefault(),c(!0),B([]);const e=at(f.target),V=(e==null?void 0:e.password)&&P&&y;e!=null&&e.password||(q(!0),c(!1));const E=(t==null?void 0:t.requiredCharacterClasses)??0,X=(t==null?void 0:t.minLength)??0;if(!g(e==null?void 0:e.password,E)||e.password.length<+X){A(!0),c(!1);return}if(!V){m({type:"error",text:s.errorNotification}),c(!1);return}const{message:D,success:G}=await et(P,y,e.password);if(G){if(d||!d&&!p){i==null||i(),j(N)&&(window.location.href=N()),A(!0),c(!1),q(!1),F(""),B([{label:s.updatePasswordActionMessage,onClick:()=>{window.location.href=o==null?void 0:o()}}]),m({type:"success",text:s.updatePasswordMessage});return}const l=await tt({email:P,password:e.password,handleSetInLineAlertProps:m,onErrorCallback:a,translations:s});l!=null&&l.userName&&(i==null||i(l==null?void 0:l.userName),j(r)?window.location.href=r():n({userName:l==null?void 0:l.userName,status:!0}))}else m({type:"error",text:D}),a==null||a({message:D,success:G});c(!1)},[P,y,t==null?void 0:t.requiredCharacterClasses,t==null?void 0:t.minLength,s,d,p,o,a,i,r,m,N]),Q=I(f=>{F(f)},[]);return{additionalActionsAlert:b,passwordError:_,isSuccessful:U,updatePasswordValue:x,isClickSubmit:v,isLoading:T,submitUpdatePassword:K,handleSetUpdatePasswordValue:Q,setIsClickSubmit:A}},ut=({signInOnSuccess:d=!0,formSize:p="default",routeRedirectOnSignIn:t,routeWrongUrlRedirect:r,routeSignInPage:w,slots:a,onErrorCallback:i,onSuccessCallback:m,routeRedirectOnPasswordUpdate:N})=>{const o=W({title:"Auth.UpdatePasswordForm.title",buttonPrimary:"Auth.UpdatePasswordForm.buttonPrimary",placeholder:"Auth.InputPassword.placeholder",floatingLabel:"Auth.InputPassword.floatingLabel",requiredFieldError:"Auth.FormText.requiredFieldError.default"}),{passwordConfigs:s,isEmailConfirmationRequired:U}=R(),{inLineAlertProps:n,handleSetInLineAlertProps:x}=st(),{additionalActionsAlert:F,passwordError:v,isSuccessful:A,updatePasswordValue:P,isClickSubmit:L,isLoading:y,submitUpdatePassword:M,handleSetUpdatePasswordValue:T}=ot({isEmailConfirmationRequired:U,signInOnSuccess:d,passwordConfigs:s,routeRedirectOnSignIn:t,routeWrongUrlRedirect:r,onErrorCallback:i,onSuccessCallback:m,handleSetInLineAlertProps:x,routeRedirectOnPasswordUpdate:N,routeSignInPage:w}),{isValidUniqueSymbols:c,defaultLengthMessage:_}=C({password:P,isClickSubmit:L,passwordConfigs:s});return A.status&&(a!=null&&a.SuccessNotification)?u(Y,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:a==null?void 0:a.SuccessNotification,context:{isSuccessful:A}}):H("div",{className:$(["auth-update-password-form",`auth-update-password-form--${p}`]),children:[u(Z,{title:o.title,divider:!1,className:"auth-update-password-form__title"}),u(k,{className:$(["auth-update-password-form__notification",["auth-update-password-form__notification--show",!!(n!=null&&n.text)]]),variant:"secondary",heading:n==null?void 0:n.text,icon:n.icon,additionalActions:F}),H(O,{name:"updatePassword_form",className:"auth-update-password-form__form",onSubmit:M,loading:y,fieldsConfig:[],children:[u("div",{style:"display: none;",children:u("input",{type:"text",id:"username",name:"username",autoComplete:"username"})}),u(S,{defaultValue:P,onValue:T,className:"auth-update-password-form__form__item",autoComplete:"new-password",name:"password",errorMessage:v||c==="error"||(_==null?void 0:_.status)==="error"?o.requiredFieldError:void 0,minLength:s==null?void 0:s.minLength,uniqueSymbolsStatus:c,validateLengthConfig:_,requiredCharacterClasses:s==null?void 0:s.requiredCharacterClasses,placeholder:o.placeholder,floatingLabel:o.floatingLabel}),u("div",{className:"auth-update-password-form__button",children:u(rt,{type:"submit",buttonText:o.buttonPrimary,variant:"primary",enableLoader:y})})]})]})},Lt=({slots:d,formSize:p,signInOnSuccess:t,routeRedirectOnPasswordUpdate:r,routeRedirectOnSignIn:w,routeSignInPage:a,routeWrongUrlRedirect:i,onErrorCallback:m,onSuccessCallback:N})=>u("div",{className:"auth-update-password",children:u(ut,{formSize:p,signInOnSuccess:t,routeSignInPage:a,routeRedirectOnSignIn:w,routeWrongUrlRedirect:i,onErrorCallback:m,onSuccessCallback:N,slots:d,routeRedirectOnPasswordUpdate:r})});export{Lt as UpdatePassword,Lt as default};
3
+ import{jsx as u,jsxs as H}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as Y,classes as $}from"@dropins/tools/lib.js";import{Header as Z,InLineAlert as k,InputPassword as S}from"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{useState as h,useEffect as z,useCallback as I}from"@dropins/tools/preact-hooks.js";import{u as W,F as O}from"../chunks/Button.js";import{v as g,u as R,a as C}from"../chunks/usePasswordValidationMessage.js";import{a as tt}from"../chunks/getCustomerToken.js";import{r as et}from"../chunks/resetPassword.js";import{c as j,g as at,u as st,B as rt}from"../chunks/Button2.js";import{useText as it}from"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"../chunks/verifyToken.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/acdl.js";import"../chunks/setReCaptchaToken.js";const J=(d,p)=>d.split("&").filter(r=>r.includes(p)).map(r=>r.split("=")[1])[0],ot=({isEmailConfirmationRequired:d,signInOnSuccess:p,passwordConfigs:t,routeRedirectOnSignIn:r,routeWrongUrlRedirect:w,onErrorCallback:a,onSuccessCallback:i,handleSetInLineAlertProps:m,routeRedirectOnPasswordUpdate:N,routeSignInPage:o})=>{const s=it({errorNotification:"Auth.Notification.errorNotification",updatePasswordMessage:"Auth.Notification.updatePasswordMessage",updatePasswordActionMessage:"Auth.Notification.updatePasswordActionMessage",customerTokenErrorMessage:"Auth.Api.customerTokenErrorMessage"}),[U,n]=h({userName:"",status:!1}),[x,F]=h(""),[v,A]=h(!1),[P,L]=h(""),[y,M]=h(""),[T,c]=h(!1),[_,q]=h(!1),[b,B]=h([]);z(()=>{v&&!b.length&&(x.length?q(!1):q(!0))},[v,x,b]),z(()=>{const{search:f}=window.location;!f.includes("token=")&&!f.includes("email=")&&j(w)&&(window.location.href=w());const e=decodeURIComponent(f),V=J(e,"token"),E=J(e,"email");L(E),M(V)},[w]);const K=I(async f=>{f.preventDefault(),c(!0),B([]);const e=at(f.target),V=(e==null?void 0:e.password)&&P&&y;e!=null&&e.password||(q(!0),c(!1));const E=(t==null?void 0:t.requiredCharacterClasses)??0,X=(t==null?void 0:t.minLength)??0;if(!g(e==null?void 0:e.password,E)||e.password.length<+X){A(!0),c(!1);return}if(!V){m({type:"error",text:s.errorNotification}),c(!1);return}const{message:D,success:G}=await et(P,y,e.password);if(G){if(d||!d&&!p){i==null||i(),j(N)&&(window.location.href=N()),A(!0),c(!1),q(!1),F(""),B([{label:s.updatePasswordActionMessage,onClick:()=>{window.location.href=o==null?void 0:o()}}]),m({type:"success",text:s.updatePasswordMessage});return}const l=await tt({email:P,password:e.password,handleSetInLineAlertProps:m,onErrorCallback:a,translations:s});l!=null&&l.userName&&(i==null||i(l==null?void 0:l.userName),j(r)?window.location.href=r():n({userName:l==null?void 0:l.userName,status:!0}))}else m({type:"error",text:D}),a==null||a({message:D,success:G});c(!1)},[P,y,t==null?void 0:t.requiredCharacterClasses,t==null?void 0:t.minLength,s,d,p,o,a,i,r,m,N]),Q=I(f=>{F(f)},[]);return{additionalActionsAlert:b,passwordError:_,isSuccessful:U,updatePasswordValue:x,isClickSubmit:v,isLoading:T,submitUpdatePassword:K,handleSetUpdatePasswordValue:Q,setIsClickSubmit:A}},ut=({signInOnSuccess:d=!0,formSize:p="default",routeRedirectOnSignIn:t,routeWrongUrlRedirect:r,routeSignInPage:w,slots:a,onErrorCallback:i,onSuccessCallback:m,routeRedirectOnPasswordUpdate:N})=>{const o=W({title:"Auth.UpdatePasswordForm.title",buttonPrimary:"Auth.UpdatePasswordForm.buttonPrimary",placeholder:"Auth.InputPassword.placeholder",floatingLabel:"Auth.InputPassword.floatingLabel",requiredFieldError:"Auth.FormText.requiredFieldError.default"}),{passwordConfigs:s,isEmailConfirmationRequired:U}=R(),{inLineAlertProps:n,handleSetInLineAlertProps:x}=st(),{additionalActionsAlert:F,passwordError:v,isSuccessful:A,updatePasswordValue:P,isClickSubmit:L,isLoading:y,submitUpdatePassword:M,handleSetUpdatePasswordValue:T}=ot({isEmailConfirmationRequired:U,signInOnSuccess:d,passwordConfigs:s,routeRedirectOnSignIn:t,routeWrongUrlRedirect:r,onErrorCallback:i,onSuccessCallback:m,handleSetInLineAlertProps:x,routeRedirectOnPasswordUpdate:N,routeSignInPage:w}),{isValidUniqueSymbols:c,defaultLengthMessage:_}=C({password:P,isClickSubmit:L,passwordConfigs:s});return A.status&&(a!=null&&a.SuccessNotification)?u(Y,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:a==null?void 0:a.SuccessNotification,context:{isSuccessful:A}}):H("div",{className:$(["auth-update-password-form",`auth-update-password-form--${p}`]),children:[u(Z,{title:o.title,divider:!1,className:"auth-update-password-form__title"}),u(k,{className:$(["auth-update-password-form__notification",["auth-update-password-form__notification--show",!!(n!=null&&n.text)]]),variant:"secondary",heading:n==null?void 0:n.text,icon:n.icon,additionalActions:F}),H(O,{name:"updatePassword_form",className:"auth-update-password-form__form",onSubmit:M,loading:y,fieldsConfig:[],children:[u("div",{style:"display: none;",children:u("input",{type:"text",id:"username",name:"username",autoComplete:"username"})}),u(S,{defaultValue:P,onValue:T,className:"auth-update-password-form__form__item",autoComplete:"new-password",name:"password",errorMessage:v||c==="error"||(_==null?void 0:_.status)==="error"?o.requiredFieldError:void 0,minLength:s==null?void 0:s.minLength,uniqueSymbolsStatus:c,validateLengthConfig:_,requiredCharacterClasses:s==null?void 0:s.requiredCharacterClasses,placeholder:o.placeholder,floatingLabel:o.floatingLabel}),u("div",{className:"auth-update-password-form__button",children:u(rt,{type:"submit",buttonText:o.buttonPrimary,variant:"primary",enableLoader:y})})]})]})},Lt=({slots:d,formSize:p,signInOnSuccess:t,routeRedirectOnPasswordUpdate:r,routeRedirectOnSignIn:w,routeSignInPage:a,routeWrongUrlRedirect:i,onErrorCallback:m,onSuccessCallback:N})=>u("div",{className:"auth-update-password",children:u(ut,{formSize:p,signInOnSuccess:t,routeSignInPage:a,routeRedirectOnSignIn:w,routeWrongUrlRedirect:i,onErrorCallback:m,onSuccessCallback:N,slots:d,routeRedirectOnPasswordUpdate:r})});export{Lt as UpdatePassword,Lt as default};
4
4
  //# sourceMappingURL=UpdatePassword.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UpdatePassword.js","sources":["/@dropins/storefront-auth/src/lib/getUrlParam.ts","/@dropins/storefront-auth/src/hooks/components/useUpdatePasswordForm.tsx","/@dropins/storefront-auth/src/components/UpdatePasswordForm/UpdatePasswordForm.tsx","/@dropins/storefront-auth/src/containers/UpdatePassword/UpdatePassword.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const getUrlParam = (url: string, param: string): string => {\n const result = url\n .split('&')\n .filter((el) => el.includes(param))\n .map((item) => {\n return item.split('=')[1];\n });\n\n return result[0];\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 { resetPassword, getCustomerToken } from '@/auth/api';\nimport { getFormValues } from '@/auth/lib/getFormValues';\nimport { getUrlParam } from '@/auth/lib/getUrlParam';\nimport { validationUniqueSymbolsPassword } from '@/auth/lib/validationUniqueSymbolsPassword';\nimport { useCallback, useEffect, useState } from 'preact/hooks';\nimport {\n AdditionalActionsAlertProps,\n UseUpdatePasswordFormProps,\n} from '@/auth/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { checkIsFunction } from '@/auth/lib/checkIsFunction';\n\nexport const useUpdatePasswordForm = ({\n isEmailConfirmationRequired,\n signInOnSuccess,\n passwordConfigs,\n routeRedirectOnSignIn,\n routeWrongUrlRedirect,\n onErrorCallback,\n onSuccessCallback,\n handleSetInLineAlertProps,\n routeRedirectOnPasswordUpdate,\n routeSignInPage,\n}: UseUpdatePasswordFormProps) => {\n const translations = useText({\n errorNotification: 'Auth.Notification.errorNotification',\n updatePasswordMessage: 'Auth.Notification.updatePasswordMessage',\n updatePasswordActionMessage:\n 'Auth.Notification.updatePasswordActionMessage',\n customerTokenErrorMessage: 'Auth.Api.customerTokenErrorMessage',\n });\n\n const [isSuccessful, setIsSuccessful] = useState({\n userName: '',\n status: false,\n });\n const [updatePasswordValue, setUpdatePasswordValue] = useState('');\n const [isClickSubmit, setIsClickSubmit] = useState(false);\n const [email, setEmail] = useState('');\n const [token, setToken] = useState('');\n const [isLoading, setIsLoading] = useState(false);\n const [passwordError, setPasswordError] = useState(false);\n const [additionalActionsAlert, setAdditionalActionsAlert] =\n useState<AdditionalActionsAlertProps>([]);\n\n useEffect(() => {\n if (isClickSubmit && !additionalActionsAlert.length) {\n if (updatePasswordValue.length) {\n setPasswordError(false);\n } else {\n setPasswordError(true);\n }\n }\n }, [isClickSubmit, updatePasswordValue, additionalActionsAlert]);\n\n useEffect(() => {\n const { search } = window.location;\n\n if (\n !search.includes('token=') &&\n !search.includes('email=') &&\n checkIsFunction(routeWrongUrlRedirect)\n ) {\n window.location.href = routeWrongUrlRedirect();\n }\n\n const url = decodeURIComponent(search);\n const tokenParam = getUrlParam(url, 'token');\n const emailParam = getUrlParam(url, 'email');\n\n setEmail(emailParam);\n setToken(tokenParam);\n }, [routeWrongUrlRedirect]);\n\n const submitUpdatePassword = useCallback(\n async (event: Event): Promise<void> => {\n event.preventDefault();\n\n setIsLoading(true);\n setAdditionalActionsAlert([]);\n\n const formValues = getFormValues(event.target);\n const validationData = formValues?.password && email && token;\n\n if (!formValues?.password) {\n setPasswordError(true);\n setIsLoading(false);\n }\n\n const requiredCharacterClasses =\n passwordConfigs?.requiredCharacterClasses ?? 0;\n const minLength = passwordConfigs?.minLength ?? 0;\n\n if (\n !validationUniqueSymbolsPassword(\n formValues?.password,\n requiredCharacterClasses\n ) ||\n formValues.password.length < +minLength\n ) {\n setIsClickSubmit(true);\n setIsLoading(false);\n\n return;\n }\n\n if (!validationData) {\n handleSetInLineAlertProps({\n type: 'error',\n text: translations.errorNotification,\n });\n\n setIsLoading(false);\n\n return;\n }\n\n const { message, success } = await resetPassword(\n email,\n token,\n formValues.password\n );\n\n if (success) {\n if (\n isEmailConfirmationRequired ||\n (!isEmailConfirmationRequired && !signInOnSuccess)\n ) {\n onSuccessCallback?.();\n\n if (checkIsFunction(routeRedirectOnPasswordUpdate)) {\n window.location.href = routeRedirectOnPasswordUpdate();\n }\n\n setIsClickSubmit(true);\n setIsLoading(false);\n setPasswordError(false);\n setUpdatePasswordValue('');\n setAdditionalActionsAlert([\n {\n label: translations.updatePasswordActionMessage,\n onClick: () => {\n window.location.href = routeSignInPage?.() as string;\n },\n },\n ]);\n handleSetInLineAlertProps({\n type: 'success',\n text: translations.updatePasswordMessage,\n });\n\n return;\n }\n\n const loginResponse = await getCustomerToken({\n email,\n password: formValues.password,\n handleSetInLineAlertProps,\n onErrorCallback,\n translations,\n });\n\n if (loginResponse?.userName) {\n onSuccessCallback?.(loginResponse?.userName);\n\n if (checkIsFunction(routeRedirectOnSignIn)) {\n window.location.href = routeRedirectOnSignIn();\n } else {\n setIsSuccessful({\n userName: loginResponse?.userName,\n status: true,\n });\n }\n }\n } else {\n handleSetInLineAlertProps({ type: 'error', text: message });\n onErrorCallback?.({ message, success });\n }\n\n setIsLoading(false);\n },\n [\n email,\n token,\n passwordConfigs?.requiredCharacterClasses,\n passwordConfigs?.minLength,\n translations,\n isEmailConfirmationRequired,\n signInOnSuccess,\n routeSignInPage,\n onErrorCallback,\n onSuccessCallback,\n routeRedirectOnSignIn,\n handleSetInLineAlertProps,\n routeRedirectOnPasswordUpdate,\n ]\n );\n\n const handleSetUpdatePasswordValue = useCallback((value: string) => {\n setUpdatePasswordValue(value);\n }, []);\n\n return {\n additionalActionsAlert,\n passwordError,\n isSuccessful,\n updatePasswordValue,\n isClickSubmit,\n isLoading,\n submitUpdatePassword,\n handleSetUpdatePasswordValue,\n setIsClickSubmit,\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 { FunctionComponent } from 'preact';\nimport { classes, Slot } from '@adobe-commerce/elsie/lib';\nimport { useGetStoreConfigs } from '@/auth/hooks/api/useGetStoreConfigs';\nimport { usePasswordValidationMessage } from '@/auth/hooks/components/usePasswordValidationMessage';\nimport { useUpdatePasswordForm } from '@/auth/hooks/components/useUpdatePasswordForm';\nimport { UpdatePasswordFormProps } from '@/auth/types';\nimport { Form, Button } from '@/auth/components';\nimport { useInLineAlert } from '@/auth/hooks/useInLineAlert';\nimport { Header, InLineAlert, InputPassword } from '@adobe-commerce/elsie/components';\nimport '@/auth/components/UpdatePasswordForm/UpdatePasswordForm.css';\nimport { useCustomTranslations } from '@/auth/hooks/useCustomTranslations';\n\nexport const UpdatePasswordForm: FunctionComponent<UpdatePasswordFormProps> = ({\n signInOnSuccess = true,\n formSize = 'default',\n routeRedirectOnSignIn,\n routeWrongUrlRedirect,\n routeSignInPage,\n slots,\n onErrorCallback,\n onSuccessCallback,\n routeRedirectOnPasswordUpdate,\n}) => {\n /**\n * useCustomTranslations is required to support extensibility of error messages.\n * Ensure all error-related translation paths include \".default\"\n * to allow future handling of dynamic or nested error messages.\n */\n const translations = useCustomTranslations({\n title: 'Auth.UpdatePasswordForm.title',\n buttonPrimary: 'Auth.UpdatePasswordForm.buttonPrimary',\n placeholder: 'Auth.InputPassword.placeholder',\n floatingLabel: 'Auth.InputPassword.floatingLabel',\n requiredFieldError: 'Auth.FormText.requiredFieldError.default',\n });\n\n const { passwordConfigs, isEmailConfirmationRequired } = useGetStoreConfigs();\n\n const { inLineAlertProps, handleSetInLineAlertProps } = useInLineAlert();\n\n const {\n additionalActionsAlert,\n passwordError,\n isSuccessful,\n updatePasswordValue,\n isClickSubmit,\n isLoading,\n submitUpdatePassword,\n handleSetUpdatePasswordValue,\n } = useUpdatePasswordForm({\n isEmailConfirmationRequired,\n signInOnSuccess,\n passwordConfigs,\n routeRedirectOnSignIn,\n routeWrongUrlRedirect,\n onErrorCallback,\n onSuccessCallback,\n handleSetInLineAlertProps,\n routeRedirectOnPasswordUpdate,\n routeSignInPage,\n });\n\n const { isValidUniqueSymbols, defaultLengthMessage } =\n usePasswordValidationMessage({\n password: updatePasswordValue,\n isClickSubmit,\n passwordConfigs,\n });\n\n if (isSuccessful.status && slots?.SuccessNotification) {\n return (\n <Slot\n data-testid=\"successNotificationTestId\"\n name=\"SuccessNotification\"\n slot={slots?.SuccessNotification}\n context={{ isSuccessful }}\n />\n );\n }\n\n return (\n <div\n className={classes([\n 'auth-update-password-form',\n `auth-update-password-form--${formSize}`,\n ])}\n >\n <Header\n title={translations.title}\n divider={false}\n className=\"auth-update-password-form__title\"\n />\n <InLineAlert\n className={classes([\n 'auth-update-password-form__notification',\n [\n 'auth-update-password-form__notification--show',\n !!inLineAlertProps?.text,\n ],\n ])}\n variant=\"secondary\"\n heading={inLineAlertProps?.text as string}\n icon={inLineAlertProps.icon}\n additionalActions={additionalActionsAlert}\n />\n <Form\n name=\"updatePassword_form\"\n className=\"auth-update-password-form__form\"\n onSubmit={submitUpdatePassword}\n loading={isLoading}\n fieldsConfig={[]}\n >\n <div style=\"display: none;\">\n <input\n type=\"text\"\n id=\"username\"\n name=\"username\"\n autoComplete=\"username\"\n />\n </div>\n <InputPassword\n defaultValue={updatePasswordValue}\n onValue={handleSetUpdatePasswordValue}\n className=\"auth-update-password-form__form__item\"\n autoComplete={'new-password'}\n name={'password'}\n errorMessage={\n passwordError ||\n isValidUniqueSymbols === 'error' ||\n defaultLengthMessage?.status === 'error'\n ? translations.requiredFieldError\n : undefined\n }\n minLength={passwordConfigs?.minLength}\n uniqueSymbolsStatus={isValidUniqueSymbols}\n validateLengthConfig={defaultLengthMessage}\n requiredCharacterClasses={passwordConfigs?.requiredCharacterClasses}\n placeholder={translations.placeholder}\n floatingLabel={translations.floatingLabel}\n />\n\n <div className=\"auth-update-password-form__button\">\n <Button\n type=\"submit\"\n buttonText={translations.buttonPrimary}\n variant=\"primary\"\n enableLoader={isLoading}\n />\n </div>\n </Form>\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\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { UpdatePasswordForm } from '@/auth/components';\nimport { UpdatePasswordProps } from '@/auth/types';\n\nexport const UpdatePassword: Container<UpdatePasswordProps> = ({\n slots,\n formSize,\n signInOnSuccess,\n routeRedirectOnPasswordUpdate,\n routeRedirectOnSignIn,\n routeSignInPage,\n routeWrongUrlRedirect,\n onErrorCallback,\n onSuccessCallback,\n}) => {\n return (\n <div className=\"auth-update-password\">\n <UpdatePasswordForm\n formSize={formSize}\n signInOnSuccess={signInOnSuccess}\n routeSignInPage={routeSignInPage}\n routeRedirectOnSignIn={routeRedirectOnSignIn}\n routeWrongUrlRedirect={routeWrongUrlRedirect}\n onErrorCallback={onErrorCallback}\n onSuccessCallback={onSuccessCallback}\n slots={slots}\n routeRedirectOnPasswordUpdate={routeRedirectOnPasswordUpdate}\n />\n </div>\n );\n};\n"],"names":["getUrlParam","url","param","el","item","useUpdatePasswordForm","isEmailConfirmationRequired","signInOnSuccess","passwordConfigs","routeRedirectOnSignIn","routeWrongUrlRedirect","onErrorCallback","onSuccessCallback","handleSetInLineAlertProps","routeRedirectOnPasswordUpdate","routeSignInPage","translations","useText","isSuccessful","setIsSuccessful","useState","updatePasswordValue","setUpdatePasswordValue","isClickSubmit","setIsClickSubmit","email","setEmail","token","setToken","isLoading","setIsLoading","passwordError","setPasswordError","additionalActionsAlert","setAdditionalActionsAlert","useEffect","search","checkIsFunction","tokenParam","emailParam","submitUpdatePassword","useCallback","event","formValues","getFormValues","validationData","requiredCharacterClasses","minLength","validationUniqueSymbolsPassword","message","success","resetPassword","loginResponse","getCustomerToken","handleSetUpdatePasswordValue","value","UpdatePasswordForm","formSize","slots","useCustomTranslations","useGetStoreConfigs","inLineAlertProps","useInLineAlert","isValidUniqueSymbols","defaultLengthMessage","usePasswordValidationMessage","jsx","Slot","jsxs","classes","Header","InLineAlert","Form","InputPassword","Button","UpdatePassword"],"mappings":"w8BAiBO,MAAMA,EAAc,CAACC,EAAaC,IACxBD,EACZ,MAAM,GAAG,EACT,OAAQE,GAAOA,EAAG,SAASD,CAAK,CAAC,EACjC,IAAKE,GACGA,EAAK,MAAM,GAAG,EAAE,CAAC,CACzB,EAEW,CAAC,ECIJC,GAAwB,CAAC,CACpC,4BAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,sBAAAC,EACA,sBAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,0BAAAC,EACA,8BAAAC,EACA,gBAAAC,CACF,IAAkC,CAChC,MAAMC,EAAeC,GAAQ,CAC3B,kBAAmB,sCACnB,sBAAuB,0CACvB,4BACE,gDACF,0BAA2B,oCAAA,CAC5B,EAEK,CAACC,EAAcC,CAAe,EAAIC,EAAS,CAC/C,SAAU,GACV,OAAQ,EAAA,CACT,EACK,CAACC,EAAqBC,CAAs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sBAAAL,EACA,gBAAAC,EACA,kBAAAC,CACF,IAEIsD,EAAC,MAAA,CAAI,UAAU,uBACb,SAAAA,EAACV,GAAA,CACC,SAAAC,EACA,gBAAAlD,EACA,gBAAAQ,EACA,sBAAAN,EACA,sBAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,MAAA8C,EACA,8BAAA5C,CAAA,CAAA,EAEJ"}
1
+ {"version":3,"file":"UpdatePassword.js","sources":["/@dropins/storefront-auth/src/lib/getUrlParam.ts","/@dropins/storefront-auth/src/hooks/components/useUpdatePasswordForm.tsx","/@dropins/storefront-auth/src/components/UpdatePasswordForm/UpdatePasswordForm.tsx","/@dropins/storefront-auth/src/containers/UpdatePassword/UpdatePassword.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const getUrlParam = (url: string, param: string): string => {\n const result = url\n .split('&')\n .filter((el) => el.includes(param))\n .map((item) => {\n return item.split('=')[1];\n });\n\n return result[0];\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 { resetPassword, getCustomerToken } from '@/auth/api';\nimport { getFormValues } from '@/auth/lib/getFormValues';\nimport { getUrlParam } from '@/auth/lib/getUrlParam';\nimport { validationUniqueSymbolsPassword } from '@/auth/lib/validationUniqueSymbolsPassword';\nimport { useCallback, useEffect, useState } from 'preact/hooks';\nimport {\n AdditionalActionsAlertProps,\n UseUpdatePasswordFormProps,\n} from '@/auth/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { checkIsFunction } from '@/auth/lib/checkIsFunction';\n\nexport const useUpdatePasswordForm = ({\n isEmailConfirmationRequired,\n signInOnSuccess,\n passwordConfigs,\n routeRedirectOnSignIn,\n routeWrongUrlRedirect,\n onErrorCallback,\n onSuccessCallback,\n handleSetInLineAlertProps,\n routeRedirectOnPasswordUpdate,\n routeSignInPage,\n}: UseUpdatePasswordFormProps) => {\n const translations = useText({\n errorNotification: 'Auth.Notification.errorNotification',\n updatePasswordMessage: 'Auth.Notification.updatePasswordMessage',\n updatePasswordActionMessage:\n 'Auth.Notification.updatePasswordActionMessage',\n customerTokenErrorMessage: 'Auth.Api.customerTokenErrorMessage',\n });\n\n const [isSuccessful, setIsSuccessful] = useState({\n userName: '',\n status: false,\n });\n const [updatePasswordValue, setUpdatePasswordValue] = useState('');\n const [isClickSubmit, setIsClickSubmit] = useState(false);\n const [email, setEmail] = useState('');\n const [token, setToken] = useState('');\n const [isLoading, setIsLoading] = useState(false);\n const [passwordError, setPasswordError] = useState(false);\n const [additionalActionsAlert, setAdditionalActionsAlert] =\n useState<AdditionalActionsAlertProps>([]);\n\n useEffect(() => {\n if (isClickSubmit && !additionalActionsAlert.length) {\n if (updatePasswordValue.length) {\n setPasswordError(false);\n } else {\n setPasswordError(true);\n }\n }\n }, [isClickSubmit, updatePasswordValue, additionalActionsAlert]);\n\n useEffect(() => {\n const { search } = window.location;\n\n if (\n !search.includes('token=') &&\n !search.includes('email=') &&\n checkIsFunction(routeWrongUrlRedirect)\n ) {\n window.location.href = routeWrongUrlRedirect();\n }\n\n const url = decodeURIComponent(search);\n const tokenParam = getUrlParam(url, 'token');\n const emailParam = getUrlParam(url, 'email');\n\n setEmail(emailParam);\n setToken(tokenParam);\n }, [routeWrongUrlRedirect]);\n\n const submitUpdatePassword = useCallback(\n async (event: Event): Promise<void> => {\n event.preventDefault();\n\n setIsLoading(true);\n setAdditionalActionsAlert([]);\n\n const formValues = getFormValues(event.target);\n const validationData = formValues?.password && email && token;\n\n if (!formValues?.password) {\n setPasswordError(true);\n setIsLoading(false);\n }\n\n const requiredCharacterClasses =\n passwordConfigs?.requiredCharacterClasses ?? 0;\n const minLength = passwordConfigs?.minLength ?? 0;\n\n if (\n !validationUniqueSymbolsPassword(\n formValues?.password,\n requiredCharacterClasses\n ) ||\n formValues.password.length < +minLength\n ) {\n setIsClickSubmit(true);\n setIsLoading(false);\n\n return;\n }\n\n if (!validationData) {\n handleSetInLineAlertProps({\n type: 'error',\n text: translations.errorNotification,\n });\n\n setIsLoading(false);\n\n return;\n }\n\n const { message, success } = await resetPassword(\n email,\n token,\n formValues.password\n );\n\n if (success) {\n if (\n isEmailConfirmationRequired ||\n (!isEmailConfirmationRequired && !signInOnSuccess)\n ) {\n onSuccessCallback?.();\n\n if (checkIsFunction(routeRedirectOnPasswordUpdate)) {\n window.location.href = routeRedirectOnPasswordUpdate();\n }\n\n setIsClickSubmit(true);\n setIsLoading(false);\n setPasswordError(false);\n setUpdatePasswordValue('');\n setAdditionalActionsAlert([\n {\n label: translations.updatePasswordActionMessage,\n onClick: () => {\n window.location.href = routeSignInPage?.() as string;\n },\n },\n ]);\n handleSetInLineAlertProps({\n type: 'success',\n text: translations.updatePasswordMessage,\n });\n\n return;\n }\n\n const loginResponse = await getCustomerToken({\n email,\n password: formValues.password,\n handleSetInLineAlertProps,\n onErrorCallback,\n translations,\n });\n\n if (loginResponse?.userName) {\n onSuccessCallback?.(loginResponse?.userName);\n\n if (checkIsFunction(routeRedirectOnSignIn)) {\n window.location.href = routeRedirectOnSignIn();\n } else {\n setIsSuccessful({\n userName: loginResponse?.userName,\n status: true,\n });\n }\n }\n } else {\n handleSetInLineAlertProps({ type: 'error', text: message });\n onErrorCallback?.({ message, success });\n }\n\n setIsLoading(false);\n },\n [\n email,\n token,\n passwordConfigs?.requiredCharacterClasses,\n passwordConfigs?.minLength,\n translations,\n isEmailConfirmationRequired,\n signInOnSuccess,\n routeSignInPage,\n onErrorCallback,\n onSuccessCallback,\n routeRedirectOnSignIn,\n handleSetInLineAlertProps,\n routeRedirectOnPasswordUpdate,\n ]\n );\n\n const handleSetUpdatePasswordValue = useCallback((value: string) => {\n setUpdatePasswordValue(value);\n }, []);\n\n return {\n additionalActionsAlert,\n passwordError,\n isSuccessful,\n updatePasswordValue,\n isClickSubmit,\n isLoading,\n submitUpdatePassword,\n handleSetUpdatePasswordValue,\n setIsClickSubmit,\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 { FunctionComponent } from 'preact';\nimport { classes, Slot } from '@adobe-commerce/elsie/lib';\nimport { useGetStoreConfigs } from '@/auth/hooks/api/useGetStoreConfigs';\nimport { usePasswordValidationMessage } from '@/auth/hooks/components/usePasswordValidationMessage';\nimport { useUpdatePasswordForm } from '@/auth/hooks/components/useUpdatePasswordForm';\nimport { UpdatePasswordFormProps } from '@/auth/types';\nimport { Form, Button } from '@/auth/components';\nimport { useInLineAlert } from '@/auth/hooks/useInLineAlert';\nimport { Header, InLineAlert, InputPassword } from '@adobe-commerce/elsie/components';\nimport '@/auth/components/UpdatePasswordForm/UpdatePasswordForm.css';\nimport { useCustomTranslations } from '@/auth/hooks/useCustomTranslations';\n\nexport const UpdatePasswordForm: FunctionComponent<UpdatePasswordFormProps> = ({\n signInOnSuccess = true,\n formSize = 'default',\n routeRedirectOnSignIn,\n routeWrongUrlRedirect,\n routeSignInPage,\n slots,\n onErrorCallback,\n onSuccessCallback,\n routeRedirectOnPasswordUpdate,\n}) => {\n /**\n * useCustomTranslations is required to support extensibility of error messages.\n * Ensure all error-related translation paths include \".default\"\n * to allow future handling of dynamic or nested error messages.\n */\n const translations = useCustomTranslations({\n title: 'Auth.UpdatePasswordForm.title',\n buttonPrimary: 'Auth.UpdatePasswordForm.buttonPrimary',\n placeholder: 'Auth.InputPassword.placeholder',\n floatingLabel: 'Auth.InputPassword.floatingLabel',\n requiredFieldError: 'Auth.FormText.requiredFieldError.default',\n });\n\n const { passwordConfigs, isEmailConfirmationRequired } = useGetStoreConfigs();\n\n const { inLineAlertProps, handleSetInLineAlertProps } = useInLineAlert();\n\n const {\n additionalActionsAlert,\n passwordError,\n isSuccessful,\n updatePasswordValue,\n isClickSubmit,\n isLoading,\n submitUpdatePassword,\n handleSetUpdatePasswordValue,\n } = useUpdatePasswordForm({\n isEmailConfirmationRequired,\n signInOnSuccess,\n passwordConfigs,\n routeRedirectOnSignIn,\n routeWrongUrlRedirect,\n onErrorCallback,\n onSuccessCallback,\n handleSetInLineAlertProps,\n routeRedirectOnPasswordUpdate,\n routeSignInPage,\n });\n\n const { isValidUniqueSymbols, defaultLengthMessage } =\n usePasswordValidationMessage({\n password: updatePasswordValue,\n isClickSubmit,\n passwordConfigs,\n });\n\n if (isSuccessful.status && slots?.SuccessNotification) {\n return (\n <Slot\n data-testid=\"successNotificationTestId\"\n name=\"SuccessNotification\"\n slot={slots?.SuccessNotification}\n context={{ isSuccessful }}\n />\n );\n }\n\n return (\n <div\n className={classes([\n 'auth-update-password-form',\n `auth-update-password-form--${formSize}`,\n ])}\n >\n <Header\n title={translations.title}\n divider={false}\n className=\"auth-update-password-form__title\"\n />\n <InLineAlert\n className={classes([\n 'auth-update-password-form__notification',\n [\n 'auth-update-password-form__notification--show',\n !!inLineAlertProps?.text,\n ],\n ])}\n variant=\"secondary\"\n heading={inLineAlertProps?.text as string}\n icon={inLineAlertProps.icon}\n additionalActions={additionalActionsAlert}\n />\n <Form\n name=\"updatePassword_form\"\n className=\"auth-update-password-form__form\"\n onSubmit={submitUpdatePassword}\n loading={isLoading}\n fieldsConfig={[]}\n >\n <div style=\"display: none;\">\n <input\n type=\"text\"\n id=\"username\"\n name=\"username\"\n autoComplete=\"username\"\n />\n </div>\n <InputPassword\n defaultValue={updatePasswordValue}\n onValue={handleSetUpdatePasswordValue}\n className=\"auth-update-password-form__form__item\"\n autoComplete={'new-password'}\n name={'password'}\n errorMessage={\n passwordError ||\n isValidUniqueSymbols === 'error' ||\n defaultLengthMessage?.status === 'error'\n ? translations.requiredFieldError\n : undefined\n }\n minLength={passwordConfigs?.minLength}\n uniqueSymbolsStatus={isValidUniqueSymbols}\n validateLengthConfig={defaultLengthMessage}\n requiredCharacterClasses={passwordConfigs?.requiredCharacterClasses}\n placeholder={translations.placeholder}\n floatingLabel={translations.floatingLabel}\n />\n\n <div className=\"auth-update-password-form__button\">\n <Button\n type=\"submit\"\n buttonText={translations.buttonPrimary}\n variant=\"primary\"\n enableLoader={isLoading}\n />\n </div>\n </Form>\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\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { UpdatePasswordForm } from '@/auth/components';\nimport { UpdatePasswordProps } from '@/auth/types';\n\nexport const UpdatePassword: Container<UpdatePasswordProps> = ({\n slots,\n formSize,\n signInOnSuccess,\n routeRedirectOnPasswordUpdate,\n routeRedirectOnSignIn,\n routeSignInPage,\n routeWrongUrlRedirect,\n onErrorCallback,\n onSuccessCallback,\n}) => {\n return (\n <div className=\"auth-update-password\">\n <UpdatePasswordForm\n formSize={formSize}\n signInOnSuccess={signInOnSuccess}\n routeSignInPage={routeSignInPage}\n routeRedirectOnSignIn={routeRedirectOnSignIn}\n routeWrongUrlRedirect={routeWrongUrlRedirect}\n onErrorCallback={onErrorCallback}\n onSuccessCallback={onSuccessCallback}\n slots={slots}\n routeRedirectOnPasswordUpdate={routeRedirectOnPasswordUpdate}\n />\n </div>\n );\n};\n"],"names":["getUrlParam","url","param","el","item","useUpdatePasswordForm","isEmailConfirmationRequired","signInOnSuccess","passwordConfigs","routeRedirectOnSignIn","routeWrongUrlRedirect","onErrorCallback","onSuccessCallback","handleSetInLineAlertProps","routeRedirectOnPasswordUpdate","routeSignInPage","translations","useText","isSuccessful","setIsSuccessful","useState","updatePasswordValue","setUpdatePasswordValue","isClickSubmit","setIsClickSubmit","email","setEmail","token","setToken","isLoading","setIsLoading","passwordError","setPasswordError","additionalActionsAlert","setAdditionalActionsAlert","useEffect","search","checkIsFunction","tokenParam","emailParam","submitUpdatePassword","useCallback","event","formValues","getFormValues","validationData","requiredCharacterClasses","minLength","validationUniqueSymbolsPassword","message","success","resetPassword","loginResponse","getCustomerToken","handleSetUpdatePasswordValue","value","UpdatePasswordForm","formSize","slots","useCustomTranslations","useGetStoreConfigs","inLineAlertProps","useInLineAlert","isValidUniqueSymbols","defaultLengthMessage","usePasswordValidationMessage","jsx","Slot","jsxs","classes","Header","InLineAlert","Form","InputPassword","Button","UpdatePassword"],"mappings":"y7BAiBO,MAAMA,EAAc,CAACC,EAAaC,IACxBD,EACZ,MAAM,GAAG,EACT,OAAQE,GAAOA,EAAG,SAASD,CAAK,CAAC,EACjC,IAAKE,GACGA,EAAK,MAAM,GAAG,EAAE,CAAC,CACzB,EAEW,CAAC,ECIJC,GAAwB,CAAC,CACpC,4BAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,sBAAAC,EACA,sBAA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kD,EAAC,MAAA,CAAI,UAAU,oCACb,SAAAA,EAACQ,GAAA,CACC,KAAK,SACL,WAAY1D,EAAa,cACzB,QAAQ,UACR,aAAca,CAAA,CAAA,CAChB,CACF,CAAA,CAAA,CAAA,CACF,CAAA,CAAA,CAGN,ECpJa8C,GAAiD,CAAC,CAC7D,MAAAjB,EACA,SAAAD,EACA,gBAAAlD,EACA,8BAAAO,EACA,sBAAAL,EACA,gBAAAM,EACA,sBAAAL,EACA,gBAAAC,EACA,kBAAAC,CACF,IAEIsD,EAAC,MAAA,CAAI,UAAU,uBACb,SAAAA,EAACV,GAAA,CACC,SAAAC,EACA,gBAAAlD,EACA,gBAAAQ,EACA,sBAAAN,EACA,sBAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,MAAA8C,EACA,8BAAA5C,CAAA,CAAA,EAEJ"}
@@ -20,5 +20,4 @@ export * from './password-reset-email';
20
20
  export * from './revoke-customer-token';
21
21
  export * from './customer-data';
22
22
  export * from './attributes-form';
23
- export * from './permissions';
24
23
  //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-auth", "version": "2.2.0-alpha022", "@dropins/tools": "~1.5.0", "license": "SEE LICENSE IN LICENSE.md"}
1
+ {"name": "@dropins/storefront-auth", "version": "2.2.1-beta1", "@dropins/tools": "~1.5.0", "license": "SEE LICENSE IN LICENSE.md"}
package/render.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
3
  (function(o,t){try{if(typeof document<"u"){const a=document.createElement("style"),n=t.styleId;for(const i in t.attributes)a.setAttribute(i,t.attributes[i]);a.setAttribute("data-dropin",n),a.appendChild(document.createTextNode(o));const r=document.querySelector('style[data-dropin="sdk"]');if(r)r.after(a);else{const i=document.querySelector('link[rel="stylesheet"], style');i?i.before(a):document.head.append(a)}}}catch(a){console.error("dropin-styles (injectCodeFunction)",a)}})('.auth-email-confirmation-form{border-radius:8px;background-color:var(--color-neutral-50, #fff);padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small);text-align:start}@media (min-width: 768px){.auth-email-confirmation-form{padding:var(--spacing-big) var(--spacing-xbig) var(--spacing-xxbig) var(--spacing-xbig)}}.auth-email-confirmation-form__title{font:var(--type-headline-2-default-font);letter-spacing:var(--type-display-1-letter-spacing);color:var(--color-neutral-800, #3d3d3d)}.auth-email-confirmation-form__subtitle{display:block;font:var(--type-details-caption-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-neutral-700, #666666)}.auth-email-confirmation-form__notification{margin-bottom:var(--spacing-medium)}.auth-email-confirmation-form.auth-email-confirmation-form--small{padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}.auth-email-confirmation-form.auth-email-confirmation-form--small .auth-email-confirmation-form__buttons{grid-template-columns:1fr;gap:20px 0}.auth-email-confirmation-form__buttons{display:grid;grid-template-columns:auto auto;justify-content:space-between}@media (max-width: 768px){.auth-email-confirmation-form__buttons{gap:20px 0;grid-template-columns:1fr}}.auth-email-confirmation-form__text{display:block;font-family:var(--type-body-1-default-font);letter-spacing:var(--type-display-1-letter-spacing);color:var(--neutrals-neutral-800);padding:var(--spacing-big) 0}.auth-email-confirmation-form.auth-email-confirmation-form--small .auth-email-confirmation-form__buttons{justify-content:center;flex-wrap:wrap}.auth-email-confirmation-form.auth-email-confirmation-form--small .auth-email-confirmation-form__buttons{flex-basis:100%;margin-top:var(--spacing-medium)}.auth-email-confirmation-form.auth-email-confirmation-form--small .auth-email-confirmation-form__buttons>span{display:none}.auth-email-confirmation-form__buttons>span{border:1px solid var(--color-brand-500);margin:var(--spacing-small) var(--spacing-xsmall);font:var(--type-button-2-font)}@media (max-width: 768px){.auth-email-confirmation-form__buttons{justify-content:center;flex-wrap:wrap}.auth-email-confirmation-form__buttons{flex-basis:100%;margin-top:var(--spacing-medium)}.auth-email-confirmation-form__buttons>span{display:none}}.auth-update-password-form{border-radius:var(--shape-border-radius-2);background-color:var(--color-neutral-50, #fff);padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}@media (min-width: 768px){.auth-update-password-form{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}}.auth-update-password-form.auth-update-password-form--small{padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}.auth-update-password-form.auth-update-password-form--small .auth-update-password-form__form__item{margin-bottom:var(--spacing-big)}.auth-update-password-form.auth-update-password-form--small .auth-update-password-form__title{margin-bottom:var(--spacing-small)}.auth-update-password-form__title{margin-bottom:var(--spacing-big)}@media (min-width: 768px){.auth-update-password-form__title{margin-bottom:var(--spacing-xxbig)}}.auth-update-password-form__form .auth-update-password-form__form__item{margin-bottom:var(--spacing-big)}@media (min-width: 768px){.auth-update-password-form__form .auth-update-password-form__form__item{margin-bottom:var(--spacing-xxbig)}}.auth-update-password-form__notification{display:none}.auth-update-password-form__notification--show{display:grid;margin-bottom:var(--spacing-medium)}.auth-success-notification-form{display:flex;justify-content:center;align-items:center;flex-direction:column;border-radius:var(--shape-border-radius-2);background:var(--color-neutral-50, #fff);padding:var(--spacing-xbig) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}@media (min-width: 768px){.auth-success-notification-form{padding:var(--spacing-big) var(--spacing-xbig) var(--spacing-xxbig) var(--spacing-xbig)}}.auth-success-notification-form.auth-success-notification-form--small{padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}.auth-success-notification-form__title{color:var(--color-neutral-800, #2b2b2b);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-details-caption-1-letter-spacing);margin-bottom:var(--spacing-medium)}.auth-success-notification-form__content-text{color:var(--color-neutral-800, #2b2b2b);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);text-align:center;margin-bottom:var(--spacing-xxbig)}.auth-success-notification-form__button--top{margin-bottom:var(--spacing-xsmall)}.auth-sign-up-form{border-radius:var(--shape-border-radius-2);background-color:var(--color-neutral-50, #fff);padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}@media (min-width: 768px){.auth-sign-up-form{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}}.auth-sign-up-form.auth-sign-up-form--small{padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}.auth-sign-up-form.auth-sign-up-form--small .auth-sign-up-form__title{margin-bottom:var(--spacing-small)}.auth-sign-up-form.auth-sign-up-form--small .auth-sign-up-form__form__field .auth-sign-up-form__form__field:nth-child(2),.auth-sign-up-form.auth-sign-up-form--small .auth-sign-up-form__form__field .auth-sign-up-form__form__field:nth-child(3){flex-basis:100%}.auth-sign-up-form.auth-sign-up-form--small .auth-sign-up-form__form{grid-template-columns:1fr}.auth-sign-up-form__form__confirm-wrapper>.auth-sign-up-form__form__field--confirm-password{margin:var(--spacing-medium) 0}.auth-sign-up-form__title{margin-bottom:var(--spacing-big)}@media (min-width: 768px){.auth-sign-up-form__title{margin-bottom:var(--spacing-xxbig)}}.auth-sign-up-form__notification{margin-bottom:var(--spacing-medium)}.auth-sign-up-form__form{display:flex;flex-wrap:wrap;flex-direction:row;gap:0 13px}.auth-sign-up-form__form__field{margin-bottom:var(--spacing-medium);flex-basis:100%;flex-grow:1;flex-shrink:0}.auth-sign-up-form__automatic-login{margin-top:12px}.auth-sign-up-form__form__field:nth-child(2),.auth-sign-up-form__form__field:nth-child(3){flex-shrink:1;flex-grow:1;flex-basis:100%}.auth-sign-up-form-buttons{flex-basis:100%;display:grid;grid-template-columns:1fr;gap:var(--spacing-medium) 0;justify-content:center;grid-area:buttons}@media (min-width: 768px){.auth-sign-up-form-buttons{display:grid;grid-template-columns:auto auto;justify-content:space-between}.auth-sign-up-form__form__field:nth-child(2),.auth-sign-up-form__form__field:nth-child(3){flex-shrink:1;flex-grow:.5;flex-basis:48%}}.auth-sign-in-form{border-radius:var(--shape-border-radius-2);background-color:var(--color-neutral-50, #fff);padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}@media (min-width: 768px){.auth-sign-in-form{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}}.auth-sign-in-form__notification{margin-bottom:var(--spacing-medium)}.auth-sign-in-form.auth-sign-in-form--small{padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}.auth-sign-in-form.auth-sign-in-form--small .auth-sign-in-form__form__email,.auth-sign-in-form.auth-sign-in-form--small .auth-sign-in-form__form__password,.auth-sign-in-form.auth-sign-in-form--small .auth-sign-in-form__title{margin-bottom:var(--spacing-medium)}.auth-sign-in-form.auth-sign-in-form--small .auth-sign-in-form__form__buttons{grid-template-columns:1fr;gap:20px 0}.auth-sign-in-form__title{margin-bottom:var(--spacing-big)}@media (min-width: 768px){.auth-sign-in-form__title{margin-bottom:var(--spacing-xxbig)}}.auth-sign-in-form__form{display:grid;grid-template-columns:1fr}.auth-sign-in-form__form__email{margin-bottom:var(--spacing-medium)}.auth-sign-in-form__form__password{margin-bottom:var(--spacing-big)}.auth-sign-in-form__form__buttons{display:grid;grid-template-columns:auto auto;justify-content:space-between}@media (max-width: 768px){.auth-sign-in-form__form__buttons{gap:20px 0;grid-template-columns:1fr}}.auth-sign-in-form.auth-sign-in-form--small .auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine{justify-content:center;flex-wrap:wrap}.auth-sign-in-form.auth-sign-in-form--small .auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine .auth-sign-in-form__button--signup{flex-basis:100%;margin-top:20px}.auth-sign-in-form.auth-sign-in-form--small .auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine>span{display:none}.auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine{display:flex}.auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine>span{border:var(--shape-border-width-1) solid var(--color-brand-500);margin:13px 10px;font:var(--type-button-2-font)}.auth-sign-in-form__resend-email-notification button{font:var(--type-button-3-font);color:var(--textColor);display:inline;background-color:transparent;border:none;cursor:pointer;padding:0;margin:0}.auth-sign-in-form__resend-email-notification button:hover{color:var(--color-brand-700);text-decoration:solid underline var(--color-brand-700);text-underline-offset:6px;color:var(--color-informational-500)}@media (max-width: 768px){.auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine{justify-content:center;flex-wrap:wrap}.auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine .auth-sign-in-form__button--signup{flex-basis:100%;margin-top:20px}.auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine>span{display:none}}.auth-reset-password-form{border-radius:var(--shape-border-radius-2);background-color:var(--color-neutral-50, #fff);padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}@media (min-width: 768px){.auth-reset-password-form{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}}.auth-reset-password-form.auth-reset-password-form--small{padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}.auth-reset-password-form.auth-reset-password-form--small .auth-reset-password-form__form__item,.auth-reset-password-form.auth-reset-password-form--small .auth-reset-password-form__title{margin-bottom:var(--spacing-medium)}.auth-reset-password-form__form{display:grid;grid-template-columns:1fr}.auth-reset-password-form__form__item{margin-bottom:var(--spacing-medium)}.auth-reset-password-form__buttons{display:grid;grid-template-columns:1fr;gap:20px 0}.auth-reset-password-form.auth-reset-password-form--small{grid-template-columns:1fr;gap:20px 0}.auth-reset-password-form__notification{margin-bottom:var(--spacing-medium)}.auth-reset-password-form__title{margin-bottom:var(--spacing-big)}@media (min-width: 768px){.auth-reset-password-form__title{margin-bottom:var(--spacing-xxbig)}}@media (min-width: 600px){.auth-reset-password-form__buttons{grid-template-columns:auto auto;justify-content:space-between}}.auth-button{position:relative}.auth-button__wrapper{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);opacity:0;display:none}.auth-custom-button__loader{width:20px;height:20px;border:5px solid #fff;border-radius:50%;display:inline-block;box-sizing:border-box;position:relative;animation:pulse 1s linear infinite}.auth-button__loader:after{content:"";position:absolute;width:20px;height:20px;border:5px solid #fff;border-radius:50%;display:inline-block;box-sizing:border-box;left:50%;top:50%;transform:translate(-50%,-50%);animation:scaleUp 1s linear infinite}@keyframes scaleUp{0%{transform:translate(-50%,-50%) scale(0)}60%,to{transform:translate(-50%,-50%) scale(1)}}@keyframes pulse{0%,60%,to{transform:scale(1)}80%{transform:scale(1.2)}}.auth-button.enableLoader .auth-button__text{opacity:0}.auth-button.enableLoader .auth-button__wrapper{opacity:1;display:inline-flex}',{styleId:"Auth"});
4
- import{jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{deepmerge as d,Render as m}from"@dropins/tools/lib.js";import{useState as u,useEffect as p}from"@dropins/tools/preact-hooks.js";import{UIProvider as h}from"@dropins/tools/components.js";import{events as g}from"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{c as f}from"./chunks/getCustomerRolePermissions.js";import"./chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";const w={PasswordValidationMessage:{chartTwoSymbols:"Use characters and numbers or symbols",chartThreeSymbols:"Use characters, numbers and symbols",chartFourSymbols:"Use uppercase characters, lowercase characters, numbers and symbols",messageLengthPassword:"At least {minLength} characters long"},ResetPasswordForm:{title:"Reset your password",buttonPrimary:"Reset password",buttonSecondary:"Back to sign in",formAriaLabel:"Reset your password form"},SignInForm:{title:"Sign in",buttonPrimary:"Sign in",buttonSecondary:"Sign up",buttonTertiary:"Forgot password?"},SignUpForm:{title:"Sign up",buttonPrimary:"Create account",buttonSecondary:"Already a member? Sign in",keepMeLoggedText:"Keep me logged in after account creation",failedCreateCustomerAddress:"Failed to create customer addresses:",confirmPassword:{placeholder:"Confirm password",floatingLabel:"Confirm password *",passwordMismatch:"Passwords do not match. Please make sure both password fields are identical."}},UpdatePasswordForm:{title:"Update password",buttonPrimary:"Update password"},FormText:{requiredFieldError:"This is a required field.",numericError:"Only numeric values are allowed.",alphaNumWithSpacesError:"Only alphanumeric characters and spaces are allowed.",alphaNumericError:"Only alphanumeric characters are allowed.",alphaError:"Only alphabetic characters are allowed.",emailError:"Please enter a valid email address.",dateError:"Please enter a valid date.",dateLengthError:"Date must be between {min} and {max}.",dateMaxError:"Date must be less than or equal to {max}.",dateMinError:"Date must be greater than or equal to {min}.",urlError:"Please enter a valid URL, e.g., https://www.website.com.",lengthTextError:"Text length must be between {min} and {max} characters."},EmailConfirmationForm:{title:"Verify your email address",subtitle:"We`ve sent an email to",mainText:"Check your inbox and click on the link we just send you to confirm your email address and activate your account.",buttonSecondary:"Resend email",buttonPrimary:"Close",accountConfirmMessage:"Account confirmed",accountConfirmationEmailSuccessMessage:"Congratulations! Your account at {email} email has been successfully confirmed."},Notification:{errorNotification:"Your password update failed due to validation errors. Please check your information and try again.",updatePasswordMessage:"The password has been updated.",updatePasswordActionMessage:"Sign in",successPasswordResetEmailNotification:"If there is an account associated with {email} you will receive an email with a link to reset your password.",resendEmailNotification:{informationText:"This account is not confirmed.",buttonText:"Resend confirmation email"},emailConfirmationMessage:"Please check your email for confirmation link.",technicalErrors:{technicalErrorSendEmail:"A technical error occurred while trying to send the email. Please try again later."}},SuccessNotification:{headingText:"Welcome!",messageText:"We are glad to see you!",primaryButtonText:"Continue shopping",secondaryButtonText:"Logout"},Api:{customerTokenErrorMessage:"Unable to log in. Please try again later or contact support if the issue persists."},InputPassword:{placeholder:"Password",floatingLabel:"Password *"}},y={Auth:w},b={default:y},P=({children:n})=>{var a,t;const[e,i]=u("en_US"),c=(t=(a=f)==null?void 0:a.getConfig())==null?void 0:t.langDefinitions;p(()=>{const r=g.on("locale",o=>{o!==e&&i(o)},{eager:!0});return()=>{r==null||r.off()}},[e]);const l=d(b,c??{});return s(h,{lang:e,langDefinitions:l,children:n})},v=new m(s(P,{}));export{v as render};
4
+ import{jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{deepmerge as d,Render as m}from"@dropins/tools/lib.js";import{useState as u,useEffect as p}from"@dropins/tools/preact-hooks.js";import{UIProvider as h}from"@dropins/tools/components.js";import{events as g}from"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{c as f}from"./chunks/verifyToken.js";import"./chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";const w={PasswordValidationMessage:{chartTwoSymbols:"Use characters and numbers or symbols",chartThreeSymbols:"Use characters, numbers and symbols",chartFourSymbols:"Use uppercase characters, lowercase characters, numbers and symbols",messageLengthPassword:"At least {minLength} characters long"},ResetPasswordForm:{title:"Reset your password",buttonPrimary:"Reset password",buttonSecondary:"Back to sign in",formAriaLabel:"Reset your password form"},SignInForm:{title:"Sign in",buttonPrimary:"Sign in",buttonSecondary:"Sign up",buttonTertiary:"Forgot password?"},SignUpForm:{title:"Sign up",buttonPrimary:"Create account",buttonSecondary:"Already a member? Sign in",keepMeLoggedText:"Keep me logged in after account creation",failedCreateCustomerAddress:"Failed to create customer addresses:",confirmPassword:{placeholder:"Confirm password",floatingLabel:"Confirm password *",passwordMismatch:"Passwords do not match. Please make sure both password fields are identical."}},UpdatePasswordForm:{title:"Update password",buttonPrimary:"Update password"},FormText:{requiredFieldError:"This is a required field.",numericError:"Only numeric values are allowed.",alphaNumWithSpacesError:"Only alphanumeric characters and spaces are allowed.",alphaNumericError:"Only alphanumeric characters are allowed.",alphaError:"Only alphabetic characters are allowed.",emailError:"Please enter a valid email address.",dateError:"Please enter a valid date.",dateLengthError:"Date must be between {min} and {max}.",dateMaxError:"Date must be less than or equal to {max}.",dateMinError:"Date must be greater than or equal to {min}.",urlError:"Please enter a valid URL, e.g., https://www.website.com.",lengthTextError:"Text length must be between {min} and {max} characters."},EmailConfirmationForm:{title:"Verify your email address",subtitle:"We`ve sent an email to",mainText:"Check your inbox and click on the link we just send you to confirm your email address and activate your account.",buttonSecondary:"Resend email",buttonPrimary:"Close",accountConfirmMessage:"Account confirmed",accountConfirmationEmailSuccessMessage:"Congratulations! Your account at {email} email has been successfully confirmed."},Notification:{errorNotification:"Your password update failed due to validation errors. Please check your information and try again.",updatePasswordMessage:"The password has been updated.",updatePasswordActionMessage:"Sign in",successPasswordResetEmailNotification:"If there is an account associated with {email} you will receive an email with a link to reset your password.",resendEmailNotification:{informationText:"This account is not confirmed.",buttonText:"Resend confirmation email"},emailConfirmationMessage:"Please check your email for confirmation link.",technicalErrors:{technicalErrorSendEmail:"A technical error occurred while trying to send the email. Please try again later."}},SuccessNotification:{headingText:"Welcome!",messageText:"We are glad to see you!",primaryButtonText:"Continue shopping",secondaryButtonText:"Logout"},Api:{customerTokenErrorMessage:"Unable to log in. Please try again later or contact support if the issue persists."},InputPassword:{placeholder:"Password",floatingLabel:"Password *"}},y={Auth:w},b={default:y},P=({children:n})=>{var a,t;const[e,i]=u("en_US"),c=(t=(a=f)==null?void 0:a.getConfig())==null?void 0:t.langDefinitions;p(()=>{const r=g.on("locale",o=>{o!==e&&i(o)},{eager:!0});return()=>{r==null||r.off()}},[e]);const l=d(b,c??{});return s(h,{lang:e,langDefinitions:l,children:n})},v=new m(s(P,{}));export{v as render};
5
5
  //# sourceMappingURL=render.js.map
package/render.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"render.js","sources":["/@dropins/storefront-auth/src/render/Provider.tsx","/@dropins/storefront-auth/src/render/render.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { useState, useEffect } from 'preact/hooks';\nimport { UIProvider } from '@adobe-commerce/elsie/components';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { config } from '@/auth/api';\nimport { deepmerge } from '@adobe-commerce/elsie/lib';\n\nimport en_US from '../i18n/en_US.json';\n\n// Langs\nconst langDefinitions = {\n default: en_US,\n};\n\ninterface CartProviderProps {\n children?: any;\n}\n\nexport const Provider: FunctionComponent<CartProviderProps> = ({\n children,\n}) => {\n const [locale, setLang] = useState<Lang>('en_US');\n\n const userLangDefinitions = config?.getConfig()?.langDefinitions;\n\n // Events\n useEffect(() => {\n const localeEvent = events.on(\n 'locale',\n (payload) => {\n if (payload !== locale) setLang(payload as Lang);\n },\n { eager: true }\n );\n return () => {\n localeEvent?.off();\n };\n }, [locale]);\n\n // Merge language definitions with user language definitions\n const definitions = deepmerge(langDefinitions, userLangDefinitions ?? {});\n\n return (\n <UIProvider lang={locale} langDefinitions={definitions}>\n {children}\n </UIProvider>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Render } from '@adobe-commerce/elsie/lib';\nimport { Provider } from './Provider';\n\nexport const render = new Render(<Provider />);\n"],"names":["langDefinitions","en_US","Provider","children","locale","setLang","useState","userLangDefinitions","_b","_a","config","useEffect","localeEvent","events","payload","definitions","deepmerge","UIProvider","render","Render","jsx"],"mappings":"inHA4BMA,EAAkB,CACtB,QAASC,CACX,EAMaC,EAAiD,CAAC,CAC7D,SAAAC,CACF,IAAM,SACJ,KAAM,CAACC,EAAQC,CAAO,EAAIC,EAAe,OAAO,EAE1CC,GAAsBC,GAAAC,EAAAC,IAAA,YAAAD,EAAQ,cAAR,YAAAD,EAAqB,gBAGjDG,EAAU,IAAM,CACd,MAAMC,EAAcC,EAAO,GACzB,SACCC,GAAY,CACPA,IAAYV,GAAQC,EAAQS,CAAe,CACjD,EACA,CAAE,MAAO,EAAA,CAAK,EAEhB,MAAO,IAAM,CACXF,GAAA,MAAAA,EAAa,KACf,CACF,EAAG,CAACR,CAAM,CAAC,EAGX,MAAMW,EAAcC,EAAUhB,EAAiBO,GAAuB,CAAA,CAAE,EAExE,SACGU,EAAA,CAAW,KAAMb,EAAQ,gBAAiBW,EACxC,SAAAZ,EACH,CAEJ,EC7Cae,EAAS,IAAIC,EAAOC,EAAClB,IAAS,CAAE"}
1
+ {"version":3,"file":"render.js","sources":["/@dropins/storefront-auth/src/render/Provider.tsx","/@dropins/storefront-auth/src/render/render.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { useState, useEffect } from 'preact/hooks';\nimport { UIProvider } from '@adobe-commerce/elsie/components';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { config } from '@/auth/api';\nimport { deepmerge } from '@adobe-commerce/elsie/lib';\n\nimport en_US from '../i18n/en_US.json';\n\n// Langs\nconst langDefinitions = {\n default: en_US,\n};\n\ninterface CartProviderProps {\n children?: any;\n}\n\nexport const Provider: FunctionComponent<CartProviderProps> = ({\n children,\n}) => {\n const [locale, setLang] = useState<Lang>('en_US');\n\n const userLangDefinitions = config?.getConfig()?.langDefinitions;\n\n // Events\n useEffect(() => {\n const localeEvent = events.on(\n 'locale',\n (payload) => {\n if (payload !== locale) setLang(payload as Lang);\n },\n { eager: true }\n );\n return () => {\n localeEvent?.off();\n };\n }, [locale]);\n\n // Merge language definitions with user language definitions\n const definitions = deepmerge(langDefinitions, userLangDefinitions ?? {});\n\n return (\n <UIProvider lang={locale} langDefinitions={definitions}>\n {children}\n </UIProvider>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Render } from '@adobe-commerce/elsie/lib';\nimport { Provider } from './Provider';\n\nexport const render = new Render(<Provider />);\n"],"names":["langDefinitions","en_US","Provider","children","locale","setLang","useState","userLangDefinitions","_b","_a","config","useEffect","localeEvent","events","payload","definitions","deepmerge","UIProvider","render","Render","jsx"],"mappings":"kmHA4BMA,EAAkB,CACtB,QAASC,CACX,EAMaC,EAAiD,CAAC,CAC7D,SAAAC,CACF,IAAM,SACJ,KAAM,CAACC,EAAQC,CAAO,EAAIC,EAAe,OAAO,EAE1CC,GAAsBC,GAAAC,EAAAC,IAAA,YAAAD,EAAQ,cAAR,YAAAD,EAAqB,gBAGjDG,EAAU,IAAM,CACd,MAAMC,EAAcC,EAAO,GACzB,SACCC,GAAY,CACPA,IAAYV,GAAQC,EAAQS,CAAe,CACjD,EACA,CAAE,MAAO,EAAA,CAAK,EAEhB,MAAO,IAAM,CACXF,GAAA,MAAAA,EAAa,KACf,CACF,EAAG,CAACR,CAAM,CAAC,EAGX,MAAMW,EAAcC,EAAUhB,EAAiBO,GAAuB,CAAA,CAAE,EAExE,SACGU,EAAA,CAAW,KAAMb,EAAQ,gBAAiBW,EACxC,SAAAZ,EACH,CAEJ,EC7Cae,EAAS,IAAIC,EAAOC,EAAClB,IAAS,CAAE"}
@@ -1,12 +0,0 @@
1
- import { PermissionsModel } from '../../data/models';
2
-
3
- /**
4
- * Gets user role permissions with caching
5
- */
6
- export declare const getCustomerRolePermissions: () => Promise<PermissionsModel>;
7
- /**
8
- * Resets the permissions cache
9
- * @internal
10
- */
11
- export declare const _resetCache: () => void;
12
- //# sourceMappingURL=getCustomerRolePermissions.d.ts.map
@@ -1,2 +0,0 @@
1
- export declare 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";
2
- //# sourceMappingURL=getCustomerRolePermissions.graphql.d.ts.map
@@ -1,10 +0,0 @@
1
- /********************************************************************
2
- * Copyright 2025 Adobe
3
- * All Rights Reserved.
4
- *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this
6
- * file in accordance with the terms of the Adobe license agreement
7
- * accompanying it.
8
- *******************************************************************/
9
- export * from './getCustomerRolePermissions';
10
- //# sourceMappingURL=index.d.ts.map
@@ -1,60 +0,0 @@
1
- /*! Copyright 2025 Adobe
2
- All Rights Reserved. */
3
- import{events as i}from"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{f as E,h as S,a as T,r as k}from"./network-error.js";import{Initializer as A,Config as M}from"@dropins/tools/lib.js";const C={auth_dropin_user_token:"auth_dropin_user_token",auth_dropin_firstname:"auth_dropin_firstname"},f=3600,O=e=>{const t=document.cookie.split(";");let r;return t.forEach(o=>{const[n,a]=o.trim().split("=");n===e&&(r=decodeURIComponent(a))}),r},R=e=>{document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`},Q=async()=>{try{const e=sessionStorage.getItem("storeConfig");let r=(e?JSON.parse(e):{}).customerAccessTokenLifetime;if(!r){const o=await y();sessionStorage.setItem("storeConfig",JSON.stringify(o)),r=(o==null?void 0:o.customerAccessTokenLifetime)||f}return`Max-Age=${r}`}catch(e){return console.error("getCookiesLifetime() Error:",e),`Max-Age=${f}`}},l="b6589fc6ab0dc82cf12099d1c2d40ab994e8410c",g=new M(void 0),P=new A({init:async e=>{const r={...{authHeaderConfig:{header:"Authorization",tokenPrefix:"Bearer"}},...e};P.config.setConfig(r);const o=O(C.auth_dropin_user_token),[n]=await Promise.all([x(r.authHeaderConfig.header,r.authHeaderConfig.tokenPrefix),o?p():Promise.resolve()]);g.setConfig(n)},listeners:()=>[i.on("authenticated",e=>{const t=g.getConfig();t!==void 0&&e!==t&&(g.setConfig(e),p())})]}),V=P.config,v=e=>{var t,r,o,n,a,c,u,d,m,_;return{autocompleteOnStorefront:((r=(t=e==null?void 0:e.data)==null?void 0:t.storeConfig)==null?void 0:r.autocomplete_on_storefront)||!1,minLength:((n=(o=e==null?void 0:e.data)==null?void 0:o.storeConfig)==null?void 0:n.minimum_password_length)||3,requiredCharacterClasses:+((c=(a=e==null?void 0:e.data)==null?void 0:a.storeConfig)==null?void 0:c.required_character_classes_number)||0,createAccountConfirmation:((d=(u=e==null?void 0:e.data)==null?void 0:u.storeConfig)==null?void 0:d.create_account_confirmation)||!1,customerAccessTokenLifetime:((_=(m=e==null?void 0:e.data)==null?void 0:m.storeConfig)==null?void 0:_.customer_access_token_lifetime)*f||f}},I=e=>{const t=e.map(r=>r.message).join(" ");throw Error(t)},w=`
4
- query GET_STORE_CONFIG {
5
- storeConfig {
6
- autocomplete_on_storefront
7
- minimum_password_length
8
- required_character_classes_number
9
- store_code
10
- store_name
11
- store_group_code
12
- locale
13
- create_account_confirmation
14
- customer_access_token_lifetime
15
- }
16
- }
17
- `,y=async()=>await E(w,{method:"GET",cache:"force-cache"}).then(e=>{var t;return(t=e.errors)!=null&&t.length?I(e.errors):v(e)}).catch(S),L=`
18
- query VALIDATE_TOKEN {
19
- customer {
20
- group {
21
- uid
22
- }
23
- }
24
- }
25
- `,x=async(e="Authorization",t="Bearer")=>{const r=O(C.auth_dropin_user_token);return r?(T(e,`${t} ${r}`),E(L).then(o=>{var a,c,u,d;return!((a=o.errors)!=null&&a.find(m=>{var _;return((_=m.extensions)==null?void 0:_.category)==="graphql-authentication"}))?(i.emit("auth/group-uid",((d=(u=(c=o.data)==null?void 0:c.customer)==null?void 0:u.group)==null?void 0:d.uid)||l),i.emit("authenticated",!0),!0):(R(C.auth_dropin_user_token),k(e),i.emit("auth/group-uid",l),i.emit("authenticated",!1),!1)})):(i.emit("auth/group-uid",l),i.emit("authenticated",!1),!1)},G=`
26
- query GET_CUSTOMER_ROLE_PERMISSIONS {
27
- customer {
28
- purchase_orders_enabled
29
- role {
30
- id
31
- name
32
- permissions {
33
- id
34
- text
35
- children {
36
- id
37
- text
38
- children {
39
- id
40
- text
41
- children {
42
- id
43
- text
44
- children {
45
- id
46
- text
47
- children {
48
- id
49
- text
50
- }
51
- }
52
- }
53
- }
54
- }
55
- }
56
- }
57
- }
58
- }
59
- `;let h=null,s=null;const U=e=>{const t={},r=o=>{o.forEach(n=>{var a;t[n.id]=!0,(a=n.children)!=null&&a.length&&r(n.children)})};return r(e),t},b=["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"],N=e=>(e==null?void 0:e.id)==="MA=="&&Array.isArray(e.permissions)&&e.permissions.length===0,q=e=>{var t;return(t=e==null?void 0:e.permissions)!=null&&t.length?U(e.permissions):{}},F=(e,t)=>{if(t===!0)return e;const r={...e};return b.forEach(o=>{r[o]=!1}),r},D=(e,t)=>{const r=N(e),o=q(e),n=F(o,t);return{...{all:!0,...r&&{admin:!0}},...n}},H=async()=>{var e,t,r,o;try{const n=await E(G,{method:"GET"}),a=D((t=(e=n.data)==null?void 0:e.customer)==null?void 0:t.role,(o=(r=n.data)==null?void 0:r.customer)==null?void 0:o.purchase_orders_enabled);return h=a,s=null,a}catch(n){throw s=null,n}},p=()=>h?(i.emit("auth/permissions",h),Promise.resolve(h)):(s||(s=H().then(e=>(i.emit("auth/permissions",e),e))),s),B=()=>{h=null,s=null};export{C,l as D,B as _,p as a,Q as b,V as c,R as d,y as g,I as h,P as i,x as v};
60
- //# sourceMappingURL=getCustomerRolePermissions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getCustomerRolePermissions.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/lib/fetch-error.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"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nconst COOKIE_NAMES = {\n auth_dropin_user_token: 'auth_dropin_user_token',\n auth_dropin_firstname: 'auth_dropin_firstname',\n};\n\nconst COOKIE_LIFETIME = 3600;\n\nexport { COOKIE_NAMES, COOKIE_LIFETIME };\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/* eslint-disable no-useless-escape */\nimport { getStoreConfig } from '@/auth/api';\nimport { COOKIE_LIFETIME } from '@/auth/configs/cookieConfigs';\n\nexport const getCookie = (cookieName: string) => {\n const cookies = document.cookie.split(';');\n let foundValue;\n\n cookies.forEach((cookie) => {\n const [name, value] = cookie.trim().split('=');\n if (name === cookieName) {\n foundValue = decodeURIComponent(value);\n }\n });\n\n return foundValue;\n};\n\nexport const deleteCookie = (cookieName: string) => {\n document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;\n};\n\nexport const getCookiesLifetime = async () => {\n try {\n const storeConfigString = sessionStorage.getItem('storeConfig');\n const cachedStoreConfig = storeConfigString\n ? JSON.parse(storeConfigString)\n : {};\n\n let accessTokenLifeTime = cachedStoreConfig.customerAccessTokenLifetime;\n\n if (!accessTokenLifeTime) {\n const storeConfig = await getStoreConfig();\n\n sessionStorage.setItem('storeConfig', JSON.stringify(storeConfig));\n\n accessTokenLifeTime =\n storeConfig?.customerAccessTokenLifetime || COOKIE_LIFETIME;\n }\n\n return `Max-Age=${accessTokenLifeTime}`;\n } catch (error) {\n console.error('getCookiesLifetime() Error:', error);\n return `Max-Age=${COOKIE_LIFETIME}`;\n }\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Initializer, Model, Config } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { getCookie } from '@/auth/lib/cookieUtils';\nimport { CustomerModel } from '@/auth/data/models';\nimport { getCustomerRolePermissions, verifyToken } 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 models?: {\n CustomerModel?: Model<CustomerModel>;\n };\n};\n\nexport const DEFAULT_CUSTOMER_GROUP_ID = 'b6589fc6ab0dc82cf12099d1c2d40ab994e8410c';\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 };\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 token ? getCustomerRolePermissions() : 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 getCustomerRolePermissions();\n }\n }),\n ],\n});\n\nexport const config = initialize.config;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { getStoreConfigResponse } from '@/auth/types';\nimport { COOKIE_LIFETIME } from '@/auth/configs/cookieConfigs';\nimport { StoreConfigModel } from '../models';\n\nexport const transformStoreConfig = (\n response: getStoreConfigResponse\n): StoreConfigModel => {\n return {\n autocompleteOnStorefront:\n response?.data?.storeConfig?.autocomplete_on_storefront || false,\n // Need information about min length in response undefined\n minLength: response?.data?.storeConfig?.minimum_password_length || 3,\n requiredCharacterClasses:\n +response?.data?.storeConfig?.required_character_classes_number || 0,\n createAccountConfirmation:\n response?.data?.storeConfig?.create_account_confirmation || false,\n customerAccessTokenLifetime:\n response?.data?.storeConfig?.customer_access_token_lifetime *\n COOKIE_LIFETIME || COOKIE_LIFETIME,\n };\n};\n","/********************************************************************\n * 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\nexport const GET_STORE_CONFIG = /* GraphQL */ `\n query GET_STORE_CONFIG {\n storeConfig {\n autocomplete_on_storefront\n minimum_password_length\n required_character_classes_number\n store_code\n store_name\n store_group_code\n locale\n create_account_confirmation\n customer_access_token_lifetime\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { getStoreConfigResponse } from '@/auth/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { GET_STORE_CONFIG } from './graphql/getStoreConfig.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { transformStoreConfig } from '@/auth/data/transforms';\nimport { StoreConfigModel } from '@/auth/data/models';\nimport { handleFetchError } from '@/auth/lib/fetch-error';\n\nexport const getStoreConfig = async (): Promise<StoreConfigModel> => {\n return await fetchGraphQl(GET_STORE_CONFIG, {\n method: 'GET',\n cache: 'force-cache',\n })\n .then((response: getStoreConfigResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return transformStoreConfig(response);\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const VALIDATE_CUSTOMER_TOKEN = /* GraphQL */ `\n query VALIDATE_TOKEN {\n customer {\n group {\n uid\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { events } from '@adobe-commerce/event-bus';\nimport {\n fetchGraphQl,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeader,\n} from '../fetch-graphql';\nimport { deleteCookie, getCookie } from '@/auth/lib/cookieUtils';\nimport { COOKIE_NAMES } from '@/auth/configs/cookieConfigs';\nimport { VALIDATE_CUSTOMER_TOKEN } from './graphql/verifyToken.graphql';\nimport { DEFAULT_CUSTOMER_GROUP_ID } from '../initialize';\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 events.emit('auth/group-uid', DEFAULT_CUSTOMER_GROUP_ID);\n events.emit('authenticated', false);\n return false;\n }\n\n setFetchGraphQlHeader(authType, `${type} ${token}`);\n\n return fetchGraphQl(VALIDATE_CUSTOMER_TOKEN).then((res) => {\n const unauthenticated = !!res.errors?.find(\n (error) => error.extensions?.category === 'graphql-authentication'\n );\n\n if (!unauthenticated) {\n events.emit('auth/group-uid', res.data?.customer?.group?.uid || DEFAULT_CUSTOMER_GROUP_ID);\n events.emit('authenticated', true);\n return true;\n };\n\n deleteCookie(COOKIE_NAMES.auth_dropin_user_token);\n removeFetchGraphQlHeader(authType);\n events.emit('auth/group-uid', DEFAULT_CUSTOMER_GROUP_ID);\n events.emit('authenticated', false);\n return false;\n });\n};\n","export const GET_CUSTOMER_ROLE_PERMISSIONS = `\n query GET_CUSTOMER_ROLE_PERMISSIONS {\n customer {\n purchase_orders_enabled\n role {\n id\n name\n permissions {\n id\n text\n children {\n id\n text\n children {\n id\n text\n children {\n id\n text\n children {\n id\n text\n children {\n id\n text\n }\n }\n }\n }\n }\n }\n }\n }\n }\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { events } from '@adobe-commerce/event-bus';\nimport { fetchGraphQl } from '@/auth/api/fetch-graphql';\nimport { PermissionsModel } from '@/auth/data/models';\nimport { GET_CUSTOMER_ROLE_PERMISSIONS } from './graphql/getCustomerRolePermissions.graphql';\n\n// TypeScript interfaces\ninterface Permission {\n id: string;\n text: string;\n children?: Permission[];\n}\n\ninterface Role {\n id: string;\n name: string;\n permissions?: Permission[];\n}\n\ninterface GetCustomerRolePermissionsResponse {\n data?: {\n customer?: {\n purchase_orders_enabled?: boolean;\n role?: Role;\n };\n };\n errors?: {\n message: string;\n }[];\n}\n\n// Module-level cache\nlet permissionsCache: PermissionsModel | null = null;\nlet fetchPromise: Promise<PermissionsModel> | null = null;\n\n/**\n * Recursively flattens permission tree into a flat object\n */\nconst flattenPermissionTree = (\n permissions: Permission[]\n): Record<string, boolean> => {\n const flattened: Record<string, boolean> = {};\n\n const processPermissions = (perms: Permission[]): void => {\n perms.forEach((permission) => {\n flattened[permission.id] = true;\n if (permission.children?.length) {\n processPermissions(permission.children);\n }\n });\n };\n\n processPermissions(permissions);\n return flattened;\n};\n\n/**\n * Purchase Order related permissions that should be set to false\n * when purchase orders are disabled\n */\nconst PURCHASE_ORDER_PERMISSIONS = [\n 'Magento_PurchaseOrder::all',\n 'Magento_PurchaseOrder::view_purchase_orders',\n 'Magento_PurchaseOrder::view_purchase_orders_for_subordinates',\n 'Magento_PurchaseOrder::view_purchase_orders_for_company',\n 'Magento_PurchaseOrder::autoapprove_purchase_order',\n 'Magento_PurchaseOrderRule::super_approve_purchase_order',\n 'Magento_PurchaseOrderRule::view_approval_rules',\n 'Magento_PurchaseOrderRule::manage_approval_rules',\n];\n\n/**\n * Determines if user has admin privileges\n * Admin is only when user has role ID 'MA==' AND has an empty permissions array\n */\nconst isAdminUser = (role?: Role): boolean => {\n return (\n role?.id === 'MA==' &&\n Array.isArray(role.permissions) &&\n role.permissions.length === 0\n );\n};\n\n/**\n * Gets all available permissions from the GraphQL response\n * Returns an empty object if no permissions (e.g., admin users have empty array)\n */\nconst getAllPermissions = (role?: Role): Record<string, boolean> => {\n if (role?.permissions?.length) {\n return flattenPermissionTree(role.permissions);\n }\n return {};\n};\n\n/**\n * Handles purchase order permissions based on PO enabled status\n * When PO is disabled, explicitly sets all PO permissions to false\n * This ensures consumers can distinguish between \"no data\" and \"explicitly disabled\"\n */\nconst overridePurchaseOrderPermissions = (\n permissions: Record<string, boolean>,\n purchaseOrdersEnabled?: boolean\n): Record<string, boolean> => {\n // If PO is enabled, return permissions as-is from backend\n if (purchaseOrdersEnabled === true) {\n return permissions;\n }\n\n // When PO is disabled, explicitly set all PO permissions to false\n const result = { ...permissions };\n PURCHASE_ORDER_PERMISSIONS.forEach((permission) => {\n result[permission] = false;\n });\n\n return result;\n};\n\n/**\n * Processes role data into flattened permissions\n */\nconst processUserPermissions = (\n role?: Role,\n purchaseOrdersEnabled?: boolean\n): PermissionsModel => {\n const isAdmin = isAdminUser(role);\n\n // Get all permissions (for both admin and non-admin users)\n const allPermissions = getAllPermissions(role);\n\n // Override PO permissions to false if PO is disabled\n const processedPermissions = overridePurchaseOrderPermissions(\n allPermissions,\n purchaseOrdersEnabled\n );\n\n const basePermissions: PermissionsModel = {\n all: true,\n ...(isAdmin && { admin: true }),\n };\n\n return { ...basePermissions, ...processedPermissions };\n};\n\n/**\n * Fetches user role permissions from GraphQL API\n */\nconst fetchUserRolePermissions = async (): Promise<PermissionsModel> => {\n try {\n const response = (await fetchGraphQl(GET_CUSTOMER_ROLE_PERMISSIONS, {\n method: 'GET',\n })) as GetCustomerRolePermissionsResponse;\n\n const permissions = processUserPermissions(\n response.data?.customer?.role,\n response.data?.customer?.purchase_orders_enabled\n );\n\n // Update cache\n permissionsCache = permissions;\n fetchPromise = null;\n\n return permissions;\n } catch (error) {\n fetchPromise = null;\n throw error;\n }\n};\n\n/**\n * Gets user role permissions with caching\n */\nexport const getCustomerRolePermissions = (): Promise<PermissionsModel> => {\n // Return cached data as resolved promise if available\n if (permissionsCache) {\n events.emit('auth/permissions', permissionsCache);\n return Promise.resolve(permissionsCache);\n }\n\n // No cache available - create and return fetch promise if not already fetching\n if (!fetchPromise) {\n fetchPromise = fetchUserRolePermissions().then((permissions) => {\n events.emit('auth/permissions', permissions);\n return permissions;\n });\n }\n\n return fetchPromise;\n};\n\n/**\n * Resets the permissions cache\n * @internal\n */\nexport const _resetCache = (): void => {\n permissionsCache = null;\n fetchPromise = null;\n};\n"],"names":["COOKIE_NAMES","COOKIE_LIFETIME","getCookie","cookieName","cookies","foundValue","cookie","name","value","deleteCookie","getCookiesLifetime","storeConfigString","accessTokenLifeTime","storeConfig","getStoreConfig","error","DEFAULT_CUSTOMER_GROUP_ID","_authenticated","Config","initialize","Initializer","config","mergedConfig","token","authenticated","verifyToken","getCustomerRolePermissions","events","next","prev","transformStoreConfig","response","_b","_a","_d","_c","_f","_e","_h","_g","_j","_i","handleFetchError","errors","errorMessage","e","GET_STORE_CONFIG","fetchGraphQl","handleNetworkError","VALIDATE_CUSTOMER_TOKEN","authType","type","setFetchGraphQlHeader","res","removeFetchGraphQlHeader","GET_CUSTOMER_ROLE_PERMISSIONS","permissionsCache","fetchPromise","flattenPermissionTree","permissions","flattened","processPermissions","perms","permission","PURCHASE_ORDER_PERMISSIONS","isAdminUser","role","getAllPermissions","overridePurchaseOrderPermissions","purchaseOrdersEnabled","result","processUserPermissions","isAdmin","allPermissions","processedPermissions","fetchUserRolePermissions","_resetCache"],"mappings":"qNAiBA,MAAMA,EAAe,CACnB,uBAAwB,yBACxB,sBAAuB,uBACzB,EAEMC,EAAkB,KCDXC,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,EAAqB,SAAY,CAC5C,GAAI,CACF,MAAMC,EAAoB,eAAe,QAAQ,aAAa,EAK9D,IAAIC,GAJsBD,EACtB,KAAK,MAAMA,CAAiB,EAC5B,CAAA,GAEwC,4BAE5C,GAAI,CAACC,EAAqB,CACxB,MAAMC,EAAc,MAAMC,EAAA,EAE1B,eAAe,QAAQ,cAAe,KAAK,UAAUD,CAAW,CAAC,EAEjED,GACEC,GAAA,YAAAA,EAAa,8BAA+BZ,CAChD,CAEA,MAAO,WAAWW,CAAmB,EACvC,OAASG,EAAO,CACd,eAAQ,MAAM,8BAA+BA,CAAK,EAC3C,WAAWd,CAAe,EACnC,CACF,EC1Bae,EAA4B,2CAEnCC,EAAiB,IAAIC,EAA4B,MAAS,EAEnDC,EAAa,IAAIC,EAAyB,CACrD,KAAM,MAAOC,GAAW,CAQtB,MAAMC,EAAe,CAAE,GAPD,CACpB,iBAAkB,CAChB,OAAQ,gBACR,YAAa,QAAA,CACf,EAGuC,GAAGD,CAAAA,EAE5CF,EAAW,OAAO,UAAUG,CAAY,EAExC,MAAMC,EAAQrB,EAAUF,EAAa,sBAAsB,EAErD,CAACwB,CAAa,EAAI,MAAM,QAAQ,IAAI,CACxCC,EACEH,EAAa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BG,EACnBF,EAAe,KAERE,CACT,OAAS5C,EAAO,CACd,MAAA0C,EAAe,KACT1C,CACR,CACF,EAKaW,EAA6B,IAEpC8B,GACF7B,EAAO,KAAK,mBAAoB6B,CAAgB,EACzC,QAAQ,QAAQA,CAAgB,IAIpCC,IACHA,EAAekB,EAAA,EAA2B,KAAMhB,IAC9ChC,EAAO,KAAK,mBAAoBgC,CAAW,EACpCA,EACR,GAGIF,GAOImB,EAAc,IAAY,CACrCpB,EAAmB,KACnBC,EAAe,IACjB"}
@@ -1,6 +0,0 @@
1
- export interface PermissionsModel {
2
- all?: boolean;
3
- admin?: boolean;
4
- [key: string]: boolean;
5
- }
6
- //# sourceMappingURL=permissions.d.ts.map