@dropins/storefront-auth 2.1.0 → 2.2.0-alpha001
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/getCustomerRolePermissions/getCustomerRolePermissions.d.ts +24 -0
- package/api/getCustomerRolePermissions/graphql/getCustomerRolePermissions.graphql.d.ts +2 -0
- package/api/getCustomerRolePermissions/index.d.ts +10 -0
- package/api/index.d.ts +1 -0
- package/api.js +34 -1
- package/api.js.map +1 -1
- package/chunks/Button.js.map +1 -1
- package/chunks/Button2.js.map +1 -1
- package/chunks/ResetPasswordForm.js.map +1 -1
- package/chunks/SignInForm.js.map +1 -1
- package/chunks/SignUpForm.js.map +1 -1
- package/chunks/SkeletonLoader.js.map +1 -1
- package/chunks/acdl.js.map +1 -1
- package/chunks/confirmEmail.js.map +1 -1
- package/chunks/createCustomerAddress.js.map +1 -1
- package/chunks/focusOnEmptyPasswordField.js.map +1 -1
- package/chunks/getCustomerToken.js +3 -3
- package/chunks/getCustomerToken.js.map +1 -1
- package/chunks/initialize.js.map +1 -1
- package/chunks/network-error.js +1 -1
- package/chunks/network-error.js.map +1 -1
- package/chunks/requestPasswordResetEmail.js.map +1 -1
- package/chunks/resendConfirmationEmail.js.map +1 -1
- package/chunks/resetPassword.js.map +1 -1
- package/chunks/revokeCustomerToken.js.map +1 -1
- package/chunks/setReCaptchaToken.js +1 -1
- package/chunks/setReCaptchaToken.js.map +1 -1
- package/chunks/simplifyTransformAttributesForm.js.map +1 -1
- package/chunks/transform-attributes-form.js.map +1 -1
- package/chunks/usePasswordValidationMessage.js.map +1 -1
- package/chunks/verifyToken.js +1 -1
- package/chunks/verifyToken.js.map +1 -1
- package/containers/AuthCombine.js.map +1 -1
- package/containers/ResetPassword.js.map +1 -1
- package/containers/SignIn.js.map +1 -1
- package/containers/SignUp.js.map +1 -1
- package/containers/SuccessNotification.js.map +1 -1
- package/containers/UpdatePassword.js.map +1 -1
- package/fragments.js.map +1 -1
- package/package.json +1 -1
- package/render.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focusOnEmptyPasswordField.js","sources":["/@dropins/storefront-auth/src/hooks/components/useEmailConfirmationForm.tsx","/@dropins/storefront-auth/src/components/EmailConfirmationForm/EmailConfirmationForm.tsx","/@dropins/storefront-auth/src/lib/focusOnEmptyPasswordField.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { resendConfirmationEmail } from '@/auth/api';\nimport { useEmailConfirmationFormProps } from '@/auth/types';\nimport { useCallback, useState } from 'preact/hooks';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nexport const useEmailConfirmationForm = ({\n userEmail,\n handleSetInLineAlertProps,\n}: useEmailConfirmationFormProps) => {\n const translations = useText({\n emailConfirmationMessage: 'Auth.Notification.emailConfirmationMessage',\n technicalErrorSendEmail:\n 'Auth.Notification.technicalErrors.technicalErrorSendEmail',\n });\n\n const [disabledButton, setDisabledButton] = useState(false);\n\n const handleEmailConfirmation = useCallback(async () => {\n setDisabledButton(true);\n\n if (userEmail) {\n const response = await resendConfirmationEmail(userEmail);\n\n if (response) {\n const errors = response?.errors?.length;\n const isEmailResend = response?.data?.resendConfirmationEmail;\n\n if (errors) {\n handleSetInLineAlertProps({\n type: 'error',\n text: translations.technicalErrorSendEmail,\n });\n } else {\n handleSetInLineAlertProps({\n type: isEmailResend ? 'success' : 'error',\n text: translations.emailConfirmationMessage,\n });\n }\n }\n }\n\n setDisabledButton(false);\n }, [handleSetInLineAlertProps, translations, userEmail]);\n\n return { handleEmailConfirmation, disabledButton };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Button } from '@/auth/components';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { FunctionComponent } from 'preact';\nimport { Header, InLineAlert } from '@adobe-commerce/elsie/components';\nimport { useEmailConfirmationForm } from '@/auth/hooks/components/useEmailConfirmationForm';\nimport { EmailConfirmationFormProps } from '@/auth/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/auth/components/EmailConfirmationForm/EmailConfirmationForm.css';\n\nexport const EmailConfirmationForm: FunctionComponent<\n EmailConfirmationFormProps\n> = ({\n formSize,\n userEmail,\n inLineAlertProps,\n hideCloseBtnOnEmailConfirmation,\n handleSetInLineAlertProps,\n onPrimaryButtonClick,\n}) => {\n const translations = useText({\n title: 'Auth.EmailConfirmationForm.title',\n subtitle: 'Auth.EmailConfirmationForm.subtitle',\n mainText: 'Auth.EmailConfirmationForm.mainText',\n buttonPrimary: 'Auth.EmailConfirmationForm.buttonPrimary',\n buttonSecondary: 'Auth.EmailConfirmationForm.buttonSecondary',\n });\n\n const { handleEmailConfirmation, disabledButton } = useEmailConfirmationForm({\n userEmail,\n handleSetInLineAlertProps,\n });\n\n return (\n <div\n className={classes([\n 'auth-email-confirmation-form',\n `auth-email-confirmation-form--${formSize}`,\n ])}\n >\n {inLineAlertProps.text ? (\n <InLineAlert\n className=\"auth-signInForm__notification\"\n type={inLineAlertProps.type}\n variant=\"secondary\"\n heading={inLineAlertProps.text}\n icon={inLineAlertProps.icon}\n data-testid=\"authInLineAlert\"\n />\n ) : null}\n <Header\n title={translations.title}\n divider={false}\n className=\"auth-email-confirmation-form__title\"\n />\n {userEmail?.length ? (\n <span className=\"auth-email-confirmation-form__subtitle\">{`${translations.subtitle} ${userEmail}`}</span>\n ) : null}\n <span className=\"auth-email-confirmation-form__text\">\n {translations.mainText}\n </span>\n <div className=\"auth-email-confirmation-form__buttons\">\n <Button\n type=\"button\"\n variant=\"tertiary\"\n style={{ padding: 0 }}\n buttonText={translations.buttonSecondary}\n enableLoader={false}\n onClick={handleEmailConfirmation}\n disabled={disabledButton}\n />\n {hideCloseBtnOnEmailConfirmation ? null : (\n <Button\n type=\"submit\"\n buttonText={translations.buttonPrimary}\n variant=\"primary\"\n enableLoader={false}\n disabled={disabledButton}\n onClick={onPrimaryButtonClick}\n />\n )}\n </div>\n </div>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const focusOnEmptyPasswordField = (\n event: Event,\n signUpPasswordValue: string,\n confirmPassword: string\n) => {\n const emptyInputPassword = (event.target as HTMLFormElement).querySelector(\n 'input[name=\"password\"]'\n );\n const emptyInputConfirmPassword = (\n event.target as HTMLFormElement\n ).querySelector('input[name=\"confirmPasswordField\"]');\n\n if (emptyInputPassword && !signUpPasswordValue.length) {\n (emptyInputPassword as HTMLInputElement).focus();\n } else if (emptyInputConfirmPassword && !confirmPassword.length) {\n (emptyInputConfirmPassword as HTMLInputElement).focus();\n }\n};\n"],"names":["useEmailConfirmationForm","userEmail","handleSetInLineAlertProps","translations","useText","disabledButton","setDisabledButton","useState","useCallback","response","resendConfirmationEmail","errors","_a","isEmailResend","_b","EmailConfirmationForm","formSize","inLineAlertProps","hideCloseBtnOnEmailConfirmation","onPrimaryButtonClick","handleEmailConfirmation","jsxs","classes","jsx","InLineAlert","Header","Button","focusOnEmptyPasswordField","event","signUpPasswordValue","confirmPassword","emptyInputPassword","emptyInputConfirmPassword"],"mappings":"seAsBO,MAAMA,EAA2B,CAAC,CACvC,UAAAC,EACA,0BAAAC,CACF,IAAqC,CACnC,MAAMC,EAAeC,EAAQ,CAC3B,yBAA0B,6CAC1B,wBACE,2DAAA,CACH,EAEK,CAACC,EAAgBC,CAAiB,EAAIC,EAAS,EAAK,
|
|
1
|
+
{"version":3,"file":"focusOnEmptyPasswordField.js","sources":["/@dropins/storefront-auth/src/hooks/components/useEmailConfirmationForm.tsx","/@dropins/storefront-auth/src/components/EmailConfirmationForm/EmailConfirmationForm.tsx","/@dropins/storefront-auth/src/lib/focusOnEmptyPasswordField.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { resendConfirmationEmail } from '@/auth/api';\nimport { useEmailConfirmationFormProps } from '@/auth/types';\nimport { useCallback, useState } from 'preact/hooks';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nexport const useEmailConfirmationForm = ({\n userEmail,\n handleSetInLineAlertProps,\n}: useEmailConfirmationFormProps) => {\n const translations = useText({\n emailConfirmationMessage: 'Auth.Notification.emailConfirmationMessage',\n technicalErrorSendEmail:\n 'Auth.Notification.technicalErrors.technicalErrorSendEmail',\n });\n\n const [disabledButton, setDisabledButton] = useState(false);\n\n const handleEmailConfirmation = useCallback(async () => {\n setDisabledButton(true);\n\n if (userEmail) {\n const response = await resendConfirmationEmail(userEmail);\n\n if (response) {\n const errors = response?.errors?.length;\n const isEmailResend = response?.data?.resendConfirmationEmail;\n\n if (errors) {\n handleSetInLineAlertProps({\n type: 'error',\n text: translations.technicalErrorSendEmail,\n });\n } else {\n handleSetInLineAlertProps({\n type: isEmailResend ? 'success' : 'error',\n text: translations.emailConfirmationMessage,\n });\n }\n }\n }\n\n setDisabledButton(false);\n }, [handleSetInLineAlertProps, translations, userEmail]);\n\n return { handleEmailConfirmation, disabledButton };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Button } from '@/auth/components';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { FunctionComponent } from 'preact';\nimport { Header, InLineAlert } from '@adobe-commerce/elsie/components';\nimport { useEmailConfirmationForm } from '@/auth/hooks/components/useEmailConfirmationForm';\nimport { EmailConfirmationFormProps } from '@/auth/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/auth/components/EmailConfirmationForm/EmailConfirmationForm.css';\n\nexport const EmailConfirmationForm: FunctionComponent<\n EmailConfirmationFormProps\n> = ({\n formSize,\n userEmail,\n inLineAlertProps,\n hideCloseBtnOnEmailConfirmation,\n handleSetInLineAlertProps,\n onPrimaryButtonClick,\n}) => {\n const translations = useText({\n title: 'Auth.EmailConfirmationForm.title',\n subtitle: 'Auth.EmailConfirmationForm.subtitle',\n mainText: 'Auth.EmailConfirmationForm.mainText',\n buttonPrimary: 'Auth.EmailConfirmationForm.buttonPrimary',\n buttonSecondary: 'Auth.EmailConfirmationForm.buttonSecondary',\n });\n\n const { handleEmailConfirmation, disabledButton } = useEmailConfirmationForm({\n userEmail,\n handleSetInLineAlertProps,\n });\n\n return (\n <div\n className={classes([\n 'auth-email-confirmation-form',\n `auth-email-confirmation-form--${formSize}`,\n ])}\n >\n {inLineAlertProps.text ? (\n <InLineAlert\n className=\"auth-signInForm__notification\"\n type={inLineAlertProps.type}\n variant=\"secondary\"\n heading={inLineAlertProps.text}\n icon={inLineAlertProps.icon}\n data-testid=\"authInLineAlert\"\n />\n ) : null}\n <Header\n title={translations.title}\n divider={false}\n className=\"auth-email-confirmation-form__title\"\n />\n {userEmail?.length ? (\n <span className=\"auth-email-confirmation-form__subtitle\">{`${translations.subtitle} ${userEmail}`}</span>\n ) : null}\n <span className=\"auth-email-confirmation-form__text\">\n {translations.mainText}\n </span>\n <div className=\"auth-email-confirmation-form__buttons\">\n <Button\n type=\"button\"\n variant=\"tertiary\"\n style={{ padding: 0 }}\n buttonText={translations.buttonSecondary}\n enableLoader={false}\n onClick={handleEmailConfirmation}\n disabled={disabledButton}\n />\n {hideCloseBtnOnEmailConfirmation ? null : (\n <Button\n type=\"submit\"\n buttonText={translations.buttonPrimary}\n variant=\"primary\"\n enableLoader={false}\n disabled={disabledButton}\n onClick={onPrimaryButtonClick}\n />\n )}\n </div>\n </div>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const focusOnEmptyPasswordField = (\n event: Event,\n signUpPasswordValue: string,\n confirmPassword: string\n) => {\n const emptyInputPassword = (event.target as HTMLFormElement).querySelector(\n 'input[name=\"password\"]'\n );\n const emptyInputConfirmPassword = (\n event.target as HTMLFormElement\n ).querySelector('input[name=\"confirmPasswordField\"]');\n\n if (emptyInputPassword && !signUpPasswordValue.length) {\n (emptyInputPassword as HTMLInputElement).focus();\n } else if (emptyInputConfirmPassword && !confirmPassword.length) {\n (emptyInputConfirmPassword as HTMLInputElement).focus();\n }\n};\n"],"names":["useEmailConfirmationForm","userEmail","handleSetInLineAlertProps","translations","useText","disabledButton","setDisabledButton","useState","useCallback","response","resendConfirmationEmail","errors","_a","isEmailResend","_b","EmailConfirmationForm","formSize","inLineAlertProps","hideCloseBtnOnEmailConfirmation","onPrimaryButtonClick","handleEmailConfirmation","jsxs","classes","jsx","InLineAlert","Header","Button","focusOnEmptyPasswordField","event","signUpPasswordValue","confirmPassword","emptyInputPassword","emptyInputConfirmPassword"],"mappings":"seAsBO,MAAMA,EAA2B,CAAC,CACvC,UAAAC,EACA,0BAAAC,CACF,IAAqC,CACnC,MAAMC,EAAeC,EAAQ,CAC3B,yBAA0B,6CAC1B,wBACE,2DAAA,CACH,EAEK,CAACC,EAAgBC,CAAiB,EAAIC,EAAS,EAAK,EA6B1D,MAAO,CAAE,wBA3BuBC,EAAY,SAAY,SAGtD,GAFAF,EAAkB,EAAI,EAElBL,EAAW,CACb,MAAMQ,EAAW,MAAMC,EAAwBT,CAAS,EAExD,GAAIQ,EAAU,CACZ,MAAME,GAASC,EAAAH,GAAA,YAAAA,EAAU,SAAV,YAAAG,EAAkB,OAC3BC,GAAgBC,EAAAL,GAAA,YAAAA,EAAU,OAAV,YAAAK,EAAgB,wBAGpCZ,EADES,EACwB,CACxB,KAAM,QACN,KAAMR,EAAa,uBAAA,EAGK,CACxB,KAAMU,EAAgB,UAAY,QAClC,KAAMV,EAAa,wBAAA,CAJpB,CAOL,CACF,CAEAG,EAAkB,EAAK,CACzB,EAAG,CAACJ,EAA2BC,EAAcF,CAAS,CAAC,EAErB,eAAAI,CAAA,CACpC,ECpCaU,EAET,CAAC,CACH,SAAAC,EACA,UAAAf,EACA,iBAAAg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hDG,GAAsB,CAACF,EAAoB,OAC5CE,EAAwC,MAAA,EAChCC,GAA6B,CAACF,EAAgB,QACtDE,EAA+C,MAAA,CAEpD"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{
|
|
3
|
+
import{s as G,f as h,h as $}from"./network-error.js";import"@dropins/tools/recaptcha.js";import{events as w}from"@dropins/tools/event-bus.js";import{merge as k}from"@dropins/tools/lib.js";import{c as R}from"./initialize.js";import{CUSTOMER_INFORMATION_FRAGMENT as C}from"../fragments.js";import{a as U,C as O}from"./verifyToken.js";import{p as x,E as y}from"./acdl.js";import{s as F}from"./setReCaptchaToken.js";const v=t=>{var s,o,i,a,c,m,u,f,T,r,g;const e={email:((o=(s=t==null?void 0:t.data)==null?void 0:s.customer)==null?void 0:o.email)??"",firstName:((a=(i=t==null?void 0:t.data)==null?void 0:i.customer)==null?void 0:a.firstname)??"",lastName:((m=(c=t==null?void 0:t.data)==null?void 0:c.customer)==null?void 0:m.lastname)??""};return k(e,(g=(r=(T=(f=(u=R)==null?void 0:u.getConfig())==null?void 0:f.models)==null?void 0:T.CustomerModel)==null?void 0:r.transformer)==null?void 0:g.call(r,t.data))},D=`
|
|
4
4
|
query GET_CUSTOMER_DATA {
|
|
5
5
|
customer {
|
|
6
6
|
...CUSTOMER_INFORMATION_FRAGMENT
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
${C}
|
|
10
|
-
`,
|
|
10
|
+
`,S=async t=>{if(t){const{authHeaderConfig:e}=R.getConfig();G(e.header,e.tokenPrefix?`${e.tokenPrefix} ${t}`:t)}return await h(D,{method:"GET",cache:"force-cache"}).then(e=>v(e)).catch($)},K=`
|
|
11
11
|
mutation GET_CUSTOMER_TOKEN($email: String!, $password: String!) {
|
|
12
12
|
generateCustomerToken(email: $email, password: $password) {
|
|
13
13
|
token
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
`,V=async({email:t,password:e,translations:
|
|
16
|
+
`,V=async({email:t,password:e,translations:s,onErrorCallback:o,handleSetInLineAlertProps:i})=>{var r,g,E,_,d;await F();const a=await h(K,{method:"POST",variables:{email:t,password:e}}).catch($);if(!((g=(r=a==null?void 0:a.data)==null?void 0:r.generateCustomerToken)!=null&&g.token)){const M=s.customerTokenErrorMessage,N=a!=null&&a.errors?a.errors[0].message:M;return o==null||o(N),i==null||i({type:"error",text:N}),{errorMessage:N,userName:""}}const c=(_=(E=a==null?void 0:a.data)==null?void 0:E.generateCustomerToken)==null?void 0:_.token,m=await S(c),u=m==null?void 0:m.firstName,f=m==null?void 0:m.email;if(!u||!f){const M=s.customerTokenErrorMessage;return o==null||o(M),i==null||i({type:"error",text:M}),{errorMessage:M,userName:"",userEmail:""}}const T=await U();return document.cookie=`${O.auth_dropin_firstname}=${u}; path=/; ${T}; Secure;`,document.cookie=`${O.auth_dropin_user_token}=${c}; path=/; ${T}; Secure;`,w.emit("authenticated",!!c),x((d=y)==null?void 0:d.SIGN_IN,{...m}),{errorMessage:"",userName:u,userEmail:f}};export{V as a,S 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 };\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';\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}; `;\n document.cookie = `${COOKIE_NAMES.auth_dropin_user_token}=${userToken}; path=/; ${cookiesLifetime}; `;\n\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","merge","_k","_j","_i","_h","_g","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","publishEvents","EventsList"],"mappings":"4ZAsBa,MAAAA,EACXC,GACkB,2BAClB,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,EAClD,EAGO,OAAAE,EACLP,GACAQ,GAAAC,GAAAC,GAAAC,GAAAC,EAAAC,IAAA,YAAAD,EAAQ,cAAR,YAAAD,EAAqB,SAArB,YAAAD,EAA6B,gBAA7B,YAAAD,EAA4C,cAA5C,YAAAD,EAAA,KAAAC,EAA0DV,EAAS,KACrE,CACF,ECjBae,EAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAM3CC,CAA6B;AAAA,ECFpBC,EAAkB,MAC7BC,GAC2B,CAC3B,GAAIA,EAAY,CACd,KAAM,CAAE,iBAAAC,CAAA,EAAqBL,EAAO,UAAU,EAE9CM,EACED,EAAiB,OACjBA,EAAiB,YACb,GAAGA,EAAiB,WAAW,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,CAAA,CAG/C,MAAAK,EAAkB,MAAMC,EAAmB,EAEjD,gBAAS,OAAS,GAAGC,EAAa,qBAAqB,IAAIJ,CAAQ,aAAaE,CAAe,KAC/F,SAAS,OAAS,GAAGE,EAAa,sBAAsB,IAAIN,CAAS,aAAaI,CAAe,KAEjGG,EAAO,KAAK,gBAAiB,CAAC,CAACP,CAAS,EAExCQ,GAAclC,EAAAmC,IAAA,YAAAnC,EAAY,QAAS,CAAE,GAAG2B,EAAkB,EAEnD,CAAE,aAAc,GAAI,SAAAC,EAAU,UAAAC,CAAU,CACjD"}
|
|
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 };\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';\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('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","merge","_k","_j","_i","_h","_g","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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GED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sources":["/@dropins/storefront-auth/src/api/initialize/initialize.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\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"],"names":["initialize","Initializer","config","mergedConfig","verifyToken"],"mappings":"
|
|
1
|
+
{"version":3,"file":"initialize.js","sources":["/@dropins/storefront-auth/src/api/initialize/initialize.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\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"],"names":["initialize","Initializer","config","mergedConfig","verifyToken"],"mappings":"iKAiCO,MAAMA,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"}
|
package/chunks/network-error.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{FetchGraphQL as e}from"@dropins/tools/fetch-graphql.js";import{events as r}from"@dropins/tools/event-bus.js";const{setEndpoint:h,setFetchGraphQlHeader:n,removeFetchGraphQlHeader:c,setFetchGraphQlHeaders:p,fetchGraphQl:i,getConfig:f}=new e().getMethods(),m=t=>{throw t instanceof DOMException&&t.name==="AbortError"||r.emit("auth/error",{source:"auth",type:"network",error:t}),t};export{
|
|
3
|
+
import{FetchGraphQL as e}from"@dropins/tools/fetch-graphql.js";import{events as r}from"@dropins/tools/event-bus.js";const{setEndpoint:h,setFetchGraphQlHeader:n,removeFetchGraphQlHeader:c,setFetchGraphQlHeaders:p,fetchGraphQl:i,getConfig:f}=new e().getMethods(),m=t=>{throw t instanceof DOMException&&t.name==="AbortError"||r.emit("auth/error",{source:"auth",type:"network",error:t}),t};export{h as a,p as b,i as f,f as g,m as h,c as r,n as s};
|
|
4
4
|
//# sourceMappingURL=network-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network-error.js","sources":["/@dropins/storefront-auth/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-auth/src/lib/network-error.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { events } from '@adobe-commerce/event-bus';\n\n/**\n * A function which can be attached to fetchGraphQL to handle thrown errors in\n * a generic way.\n */\nexport const handleNetworkError = (error: Error) => {\n const isAbortError =\n error instanceof DOMException && error.name === 'AbortError';\n\n if (!isAbortError) {\n events.emit('auth/error', {\n source: 'auth',\n type: 'network',\n error,\n });\n }\n throw error;\n};\n"],"names":["setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","handleNetworkError","error","events"],"mappings":"
|
|
1
|
+
{"version":3,"file":"network-error.js","sources":["/@dropins/storefront-auth/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-auth/src/lib/network-error.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { events } from '@adobe-commerce/event-bus';\n\n/**\n * A function which can be attached to fetchGraphQL to handle thrown errors in\n * a generic way.\n */\nexport const handleNetworkError = (error: Error) => {\n const isAbortError =\n error instanceof DOMException && error.name === 'AbortError';\n\n if (!isAbortError) {\n events.emit('auth/error', {\n source: 'auth',\n type: 'network',\n error,\n });\n }\n throw error;\n};\n"],"names":["setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","handleNetworkError","error","events"],"mappings":"oHAmBO,KAAM,CACX,YAAAA,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAC,EACA,UAAAC,CACF,EAAI,IAAIC,EAAA,EAAe,WAAA,ECHVC,EAAsBC,GAAiB,CAIlD,MAFEA,aAAiB,cAAgBA,EAAM,OAAS,cAGhDC,EAAO,KAAK,aAAc,CACxB,OAAQ,OACR,KAAM,UACN,MAAAD,CAAA,CACD,EAEGA,CACR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestPasswordResetEmail.js","sources":["/@dropins/storefront-auth/src/data/transforms/transform-password-reset-email.ts","/@dropins/storefront-auth/src/api/requestPasswordResetEmail/graphql/requestPasswordResetEmail.graphql.ts","/@dropins/storefront-auth/src/api/requestPasswordResetEmail/requestPasswordResetEmail.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { PasswordResetEmailResponse } from '@/auth/types';\nimport { PasswordResetEmailModel } from '../models';\n\nexport const transformPasswordResetEmail = (\n response: PasswordResetEmailResponse\n): PasswordResetEmailModel => {\n let message: string = '';\n\n if (response?.errors?.length)\n message = response?.errors[0]?.message as unknown as string;\n\n return {\n message,\n success: Boolean(response?.data?.requestPasswordResetEmail),\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REQUEST_PASSWORD_RESET_EMAIL = /* GraphQL */ `\n mutation REQUEST_PASSWORD_RESET_EMAIL($email: String!) {\n requestPasswordResetEmail(email: $email)\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { REQUEST_PASSWORD_RESET_EMAIL } from './graphql/requestPasswordResetEmail.graphql';\nimport { transformPasswordResetEmail } from '@/auth/data/transforms';\nimport { PasswordResetEmailModel } from '@/auth/data/models';\nimport { setReCaptchaToken } from '@/auth/lib/setReCaptchaToken';\n\nexport const requestPasswordResetEmail = async (\n email: string\n): Promise<PasswordResetEmailModel> => {\n await setReCaptchaToken();\n\n return await fetchGraphQl(REQUEST_PASSWORD_RESET_EMAIL, {\n method: 'POST',\n variables: { email },\n })\n .then((response) => {\n return transformPasswordResetEmail(response);\n })\n .catch(handleNetworkError);\n};\n"],"names":["transformPasswordResetEmail","response","message","_a","_b","_c","REQUEST_PASSWORD_RESET_EMAIL","requestPasswordResetEmail","email","setReCaptchaToken","fetchGraphQl","handleNetworkError"],"mappings":"
|
|
1
|
+
{"version":3,"file":"requestPasswordResetEmail.js","sources":["/@dropins/storefront-auth/src/data/transforms/transform-password-reset-email.ts","/@dropins/storefront-auth/src/api/requestPasswordResetEmail/graphql/requestPasswordResetEmail.graphql.ts","/@dropins/storefront-auth/src/api/requestPasswordResetEmail/requestPasswordResetEmail.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { PasswordResetEmailResponse } from '@/auth/types';\nimport { PasswordResetEmailModel } from '../models';\n\nexport const transformPasswordResetEmail = (\n response: PasswordResetEmailResponse\n): PasswordResetEmailModel => {\n let message: string = '';\n\n if (response?.errors?.length)\n message = response?.errors[0]?.message as unknown as string;\n\n return {\n message,\n success: Boolean(response?.data?.requestPasswordResetEmail),\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REQUEST_PASSWORD_RESET_EMAIL = /* GraphQL */ `\n mutation REQUEST_PASSWORD_RESET_EMAIL($email: String!) {\n requestPasswordResetEmail(email: $email)\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { REQUEST_PASSWORD_RESET_EMAIL } from './graphql/requestPasswordResetEmail.graphql';\nimport { transformPasswordResetEmail } from '@/auth/data/transforms';\nimport { PasswordResetEmailModel } from '@/auth/data/models';\nimport { setReCaptchaToken } from '@/auth/lib/setReCaptchaToken';\n\nexport const requestPasswordResetEmail = async (\n email: string\n): Promise<PasswordResetEmailModel> => {\n await setReCaptchaToken();\n\n return await fetchGraphQl(REQUEST_PASSWORD_RESET_EMAIL, {\n method: 'POST',\n variables: { email },\n })\n .then((response) => {\n return transformPasswordResetEmail(response);\n })\n .catch(handleNetworkError);\n};\n"],"names":["transformPasswordResetEmail","response","message","_a","_b","_c","REQUEST_PASSWORD_RESET_EMAIL","requestPasswordResetEmail","email","setReCaptchaToken","fetchGraphQl","handleNetworkError"],"mappings":"yFAoBO,MAAMA,EACXC,GAC4B,WAC5B,IAAIC,EAAkB,GAEtB,OAAIC,EAAAF,GAAA,YAAAA,EAAU,SAAV,MAAAE,EAAkB,SACpBD,GAAUE,EAAAH,GAAA,YAAAA,EAAU,OAAO,KAAjB,YAAAG,EAAqB,SAE1B,CACL,QAAAF,EACA,QAAS,IAAQG,EAAAJ,GAAA,YAAAA,EAAU,OAAV,MAAAI,EAAgB,0BAAyB,CAE9D,ECfaC,EAA6C;AAAA;AAAA;AAAA;AAAA,ECO7CC,EAA4B,MACvCC,IAEA,MAAMC,EAAA,EAEC,MAAMC,EAAaJ,EAA8B,CACtD,OAAQ,OACR,UAAW,CAAE,MAAAE,CAAA,CAAM,CACpB,EACE,KAAMP,GACED,EAA4BC,CAAQ,CAC5C,EACA,MAAMU,CAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resendConfirmationEmail.js","sources":["/@dropins/storefront-auth/src/api/resendConfirmationEmail/graphql/resendConfirmationEmail.graphql.ts","/@dropins/storefront-auth/src/api/resendConfirmationEmail/resendConfirmationEmail.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const RESEND_CONFIRMATION_EMAIL = /* GraphQL */ `\n mutation RESEND_CONFIRMATION_EMAIL($email: String!) {\n resendConfirmationEmail(email: $email)\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { RESEND_CONFIRMATION_EMAIL } from './graphql/resendConfirmationEmail.graphql';\nimport { resendConfirmationEmailResponse } from '@/auth/types';\n\nexport const resendConfirmationEmail = async (\n customerEmail: string\n): Promise<resendConfirmationEmailResponse> => {\n return await fetchGraphQl(RESEND_CONFIRMATION_EMAIL, {\n method: 'POST',\n variables: {\n email: customerEmail,\n },\n }).catch(handleNetworkError);\n};\n"],"names":["RESEND_CONFIRMATION_EMAIL","resendConfirmationEmail","customerEmail","fetchGraphQl","handleNetworkError"],"mappings":"
|
|
1
|
+
{"version":3,"file":"resendConfirmationEmail.js","sources":["/@dropins/storefront-auth/src/api/resendConfirmationEmail/graphql/resendConfirmationEmail.graphql.ts","/@dropins/storefront-auth/src/api/resendConfirmationEmail/resendConfirmationEmail.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const RESEND_CONFIRMATION_EMAIL = /* GraphQL */ `\n mutation RESEND_CONFIRMATION_EMAIL($email: String!) {\n resendConfirmationEmail(email: $email)\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { RESEND_CONFIRMATION_EMAIL } from './graphql/resendConfirmationEmail.graphql';\nimport { resendConfirmationEmailResponse } from '@/auth/types';\n\nexport const resendConfirmationEmail = async (\n customerEmail: string\n): Promise<resendConfirmationEmailResponse> => {\n return await fetchGraphQl(RESEND_CONFIRMATION_EMAIL, {\n method: 'POST',\n variables: {\n email: customerEmail,\n },\n }).catch(handleNetworkError);\n};\n"],"names":["RESEND_CONFIRMATION_EMAIL","resendConfirmationEmail","customerEmail","fetchGraphQl","handleNetworkError"],"mappings":"8CAiBO,MAAMA,EAA0C;AAAA;AAAA;AAAA;AAAA,ECK1CC,EAA0B,MACrCC,GAEO,MAAMC,EAAaH,EAA2B,CACnD,OAAQ,OACR,UAAW,CACT,MAAOE,CAAA,CACT,CACD,EAAE,MAAME,CAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resetPassword.js","sources":["/@dropins/storefront-auth/src/api/resetPassword/graphql/resetPassword.graphql.ts","/@dropins/storefront-auth/src/data/transforms/transform-reset-password.ts","/@dropins/storefront-auth/src/api/resetPassword/resetPassword.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const RESET_PASSWORD = /* GraphQL */ `\n mutation RESET_PASSWORD(\n $email: String!\n $resetPasswordToken: String!\n $newPassword: String!\n ) {\n resetPassword(\n email: $email\n resetPasswordToken: $resetPasswordToken\n newPassword: $newPassword\n )\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { ResetPasswordResponse } from '@/auth/types';\nimport { ResetPasswordModel } from '../models';\n\nexport const transformResetPassword = (\n response: ResetPasswordResponse\n): ResetPasswordModel => {\n let message: string = '';\n\n if (response?.errors?.length)\n message = response?.errors[0]?.message as unknown as string;\n\n return {\n message,\n success: Boolean(response?.data?.resetPassword),\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { RESET_PASSWORD } from './graphql/resetPassword.graphql';\nimport { transformResetPassword } from '@/auth/data/transforms/transform-reset-password';\nimport { ResetPasswordModel } from '@/auth/data/models';\nimport { ResetPasswordResponse } from '@/auth/types';\nimport { setReCaptchaToken } from '@/auth/lib/setReCaptchaToken';\n\nexport const resetPassword = async (\n email: string,\n resetPasswordToken: string,\n newPassword: string\n): Promise<ResetPasswordModel> => {\n await setReCaptchaToken();\n\n return await fetchGraphQl(RESET_PASSWORD, {\n method: 'POST',\n variables: { email, resetPasswordToken, newPassword },\n })\n .then((response: ResetPasswordResponse) => {\n return transformResetPassword(response);\n })\n .catch(handleNetworkError);\n};\n"],"names":["RESET_PASSWORD","transformResetPassword","response","message","_a","_b","_c","resetPassword","email","resetPasswordToken","newPassword","setReCaptchaToken","fetchGraphQl","handleNetworkError"],"mappings":"
|
|
1
|
+
{"version":3,"file":"resetPassword.js","sources":["/@dropins/storefront-auth/src/api/resetPassword/graphql/resetPassword.graphql.ts","/@dropins/storefront-auth/src/data/transforms/transform-reset-password.ts","/@dropins/storefront-auth/src/api/resetPassword/resetPassword.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const RESET_PASSWORD = /* GraphQL */ `\n mutation RESET_PASSWORD(\n $email: String!\n $resetPasswordToken: String!\n $newPassword: String!\n ) {\n resetPassword(\n email: $email\n resetPasswordToken: $resetPasswordToken\n newPassword: $newPassword\n )\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { ResetPasswordResponse } from '@/auth/types';\nimport { ResetPasswordModel } from '../models';\n\nexport const transformResetPassword = (\n response: ResetPasswordResponse\n): ResetPasswordModel => {\n let message: string = '';\n\n if (response?.errors?.length)\n message = response?.errors[0]?.message as unknown as string;\n\n return {\n message,\n success: Boolean(response?.data?.resetPassword),\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { RESET_PASSWORD } from './graphql/resetPassword.graphql';\nimport { transformResetPassword } from '@/auth/data/transforms/transform-reset-password';\nimport { ResetPasswordModel } from '@/auth/data/models';\nimport { ResetPasswordResponse } from '@/auth/types';\nimport { setReCaptchaToken } from '@/auth/lib/setReCaptchaToken';\n\nexport const resetPassword = async (\n email: string,\n resetPasswordToken: string,\n newPassword: string\n): Promise<ResetPasswordModel> => {\n await setReCaptchaToken();\n\n return await fetchGraphQl(RESET_PASSWORD, {\n method: 'POST',\n variables: { email, resetPasswordToken, newPassword },\n })\n .then((response: ResetPasswordResponse) => {\n return transformResetPassword(response);\n })\n .catch(handleNetworkError);\n};\n"],"names":["RESET_PASSWORD","transformResetPassword","response","message","_a","_b","_c","resetPassword","email","resetPasswordToken","newPassword","setReCaptchaToken","fetchGraphQl","handleNetworkError"],"mappings":"yFAiBO,MAAMA,EAA+B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECG/BC,EACXC,GACuB,WACvB,IAAIC,EAAkB,GAEtB,OAAIC,EAAAF,GAAA,YAAAA,EAAU,SAAV,MAAAE,EAAkB,SACpBD,GAAUE,EAAAH,GAAA,YAAAA,EAAU,OAAO,KAAjB,YAAAG,EAAqB,SAE1B,CACL,QAAAF,EACA,QAAS,IAAQG,EAAAJ,GAAA,YAAAA,EAAU,OAAV,MAAAI,EAAgB,cAAa,CAElD,ECPaC,EAAgB,MAC3BC,EACAC,EACAC,KAEA,MAAMC,EAAA,EAEC,MAAMC,EAAaZ,EAAgB,CACxC,OAAQ,OACR,UAAW,CAAE,MAAAQ,EAAO,mBAAAC,EAAoB,YAAAC,CAAA,CAAY,CACrD,EACE,KAAMR,GACED,EAAuBC,CAAQ,CACvC,EACA,MAAMW,CAAkB"}
|
|
@@ -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';\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('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","publishEvents","EventsList","errorMessage","verifyToken","handleNetworkError"],"mappings":"
|
|
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';\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('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","publishEvents","EventsList","errorMessage","verifyToken","handleNetworkError"],"mappings":"2LAoBO,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,ECYtCC,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,gBAAiB,EAAK,EAElCC,EAAcC,EAAW,SAAU,EAAE,MAChC,CACL,MAAMC,EAAe;AAAA,uCACQP,EAAc,OAAO,GAClD,QAAQ,MAAMO,CAAY,EAI1BC,EAAA,CACF,CAEA,OAAOR,CACT,CAAC,EACA,MAAMS,CAAkB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{verifyReCaptcha as
|
|
3
|
+
import{verifyReCaptcha as a}from"@dropins/tools/recaptcha.js";import"@dropins/tools/event-bus.js";import{s as e}from"./network-error.js";const p=async()=>{const t=await a();t&&e("X-ReCaptcha",t)};export{p as s};
|
|
4
4
|
//# sourceMappingURL=setReCaptchaToken.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setReCaptchaToken.js","sources":["/@dropins/storefront-auth/src/lib/setReCaptchaToken.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 { verifyReCaptcha } from '@adobe-commerce/recaptcha';\nimport { setFetchGraphQlHeader } from '../api';\n\nexport const setReCaptchaToken = async () => {\n const token = await verifyReCaptcha();\n\n if (token) {\n setFetchGraphQlHeader('X-ReCaptcha', token);\n }\n};\n"],"names":["setReCaptchaToken","token","verifyReCaptcha","setFetchGraphQlHeader"],"mappings":"yIAoBO,MAAMA,EAAoB,SAAY,
|
|
1
|
+
{"version":3,"file":"setReCaptchaToken.js","sources":["/@dropins/storefront-auth/src/lib/setReCaptchaToken.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 { verifyReCaptcha } from '@adobe-commerce/recaptcha';\nimport { setFetchGraphQlHeader } from '../api';\n\nexport const setReCaptchaToken = async () => {\n const token = await verifyReCaptcha();\n\n if (token) {\n setFetchGraphQlHeader('X-ReCaptcha', token);\n }\n};\n"],"names":["setReCaptchaToken","token","verifyReCaptcha","setFetchGraphQlHeader"],"mappings":"yIAoBO,MAAMA,EAAoB,SAAY,CAC3C,MAAMC,EAAQ,MAAMC,EAAA,EAEhBD,GACFE,EAAsB,cAAeF,CAAK,CAE9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simplifyTransformAttributesForm.js","sources":["/@dropins/storefront-auth/src/configs/defaultCreateUserConfigs.ts","/@dropins/storefront-auth/src/lib/simplifyTransformAttributesForm.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const DEFAULT__SIGN_IN_EMAIL_FIELD = [\n {\n customUpperCode: 'email',\n code: 'email',\n default_value: '',\n entity_type: 'CUSTOMER',\n frontend_class: 'auth-sign-in-form__form__email',\n frontend_input: 'TEXT',\n is_required: true,\n multiline_count: 1,\n sort_order: 1,\n is_unique: false,\n label: 'Email',\n options: [],\n validateRules: [\n {\n name: 'INPUT_VALIDATION',\n value: 'email',\n },\n ],\n autocomplete: 'username',\n },\n];\n\nexport const DEFAULT__RESET_PASSWORD_EMAIL_FIELD: Record<\n string,\n string | boolean | unknown\n>[] = [\n {\n customUpperCode: 'email',\n code: 'email',\n default_value: '',\n entity_type: 'CUSTOMER',\n frontend_class: 'auth-reset-password-form__form__item',\n frontend_input: 'TEXT',\n is_required: true,\n is_unique: false,\n label: 'Email',\n options: [],\n validateRules: [\n {\n name: 'INPUT_VALIDATION',\n value: 'email',\n },\n ],\n autocomplete: 'username',\n },\n];\n\nexport const DEFAULT_SIGN_UP_FIELDS = [\n {\n customUpperCode: 'email',\n code: 'email',\n default_value: '',\n entity_type: 'CUSTOMER',\n frontend_class: '',\n frontend_input: 'TEXT',\n is_required: true,\n is_unique: false,\n label: 'Email',\n multiline_count: 1,\n sort_order: 1,\n options: [],\n validateRules: [\n {\n name: 'INPUT_VALIDATION',\n value: 'email',\n },\n ],\n autocomplete: 'username',\n },\n {\n customUpperCode: 'firstname',\n code: 'firstname',\n default_value: '',\n entity_type: 'CUSTOMER',\n frontend_class: '',\n frontend_input: 'TEXT',\n is_required: true,\n is_unique: false,\n label: 'First name',\n multiline_count: 1,\n sort_order: 2,\n options: [],\n },\n {\n customUpperCode: 'lastname',\n code: 'lastname',\n default_value: '',\n entity_type: 'CUSTOMER',\n frontend_class: '',\n frontend_input: 'TEXT',\n is_required: false,\n is_unique: false,\n label: 'Last name',\n multiline_count: 1,\n sort_order: 3,\n options: [],\n },\n];\n\nexport const DEFAULT_INPUTS_PROPS: Record<string, string | ''> = {\n dob: '',\n email: '',\n firstname: '',\n gender: '',\n lastname: '',\n middlename: '',\n password: '',\n prefix: '',\n suffix: '',\n taxvat: '',\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 { transformAttributesForm } from '../data/transforms';\n\nexport const simplifyTransformAttributesForm = (defaultSignUpFields: any) => {\n if (!defaultSignUpFields?.length) return [];\n\n const params = {\n data: {\n attributesForm: { items: defaultSignUpFields },\n },\n };\n\n return transformAttributesForm(params);\n};\n"],"names":["DEFAULT__SIGN_IN_EMAIL_FIELD","DEFAULT__RESET_PASSWORD_EMAIL_FIELD","DEFAULT_SIGN_UP_FIELDS","simplifyTransformAttributesForm","defaultSignUpFields","transformAttributesForm"],"mappings":"8CAiBO,MAAMA,EAA+B,CAC1C,CACE,gBAAiB,QACjB,KAAM,QACN,cAAe,GACf,YAAa,WACb,eAAgB,iCAChB,eAAgB,OAChB,YAAa,GACb,gBAAiB,EACjB,WAAY,EACZ,UAAW,GACX,MAAO,QACP,QAAS,
|
|
1
|
+
{"version":3,"file":"simplifyTransformAttributesForm.js","sources":["/@dropins/storefront-auth/src/configs/defaultCreateUserConfigs.ts","/@dropins/storefront-auth/src/lib/simplifyTransformAttributesForm.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const DEFAULT__SIGN_IN_EMAIL_FIELD = [\n {\n customUpperCode: 'email',\n code: 'email',\n default_value: '',\n entity_type: 'CUSTOMER',\n frontend_class: 'auth-sign-in-form__form__email',\n frontend_input: 'TEXT',\n is_required: true,\n multiline_count: 1,\n sort_order: 1,\n is_unique: false,\n label: 'Email',\n options: [],\n validateRules: [\n {\n name: 'INPUT_VALIDATION',\n value: 'email',\n },\n ],\n autocomplete: 'username',\n },\n];\n\nexport const DEFAULT__RESET_PASSWORD_EMAIL_FIELD: Record<\n string,\n string | boolean | unknown\n>[] = [\n {\n customUpperCode: 'email',\n code: 'email',\n default_value: '',\n entity_type: 'CUSTOMER',\n frontend_class: 'auth-reset-password-form__form__item',\n frontend_input: 'TEXT',\n is_required: true,\n is_unique: false,\n label: 'Email',\n options: [],\n validateRules: [\n {\n name: 'INPUT_VALIDATION',\n value: 'email',\n },\n ],\n autocomplete: 'username',\n },\n];\n\nexport const DEFAULT_SIGN_UP_FIELDS = [\n {\n customUpperCode: 'email',\n code: 'email',\n default_value: '',\n entity_type: 'CUSTOMER',\n frontend_class: '',\n frontend_input: 'TEXT',\n is_required: true,\n is_unique: false,\n label: 'Email',\n multiline_count: 1,\n sort_order: 1,\n options: [],\n validateRules: [\n {\n name: 'INPUT_VALIDATION',\n value: 'email',\n },\n ],\n autocomplete: 'username',\n },\n {\n customUpperCode: 'firstname',\n code: 'firstname',\n default_value: '',\n entity_type: 'CUSTOMER',\n frontend_class: '',\n frontend_input: 'TEXT',\n is_required: true,\n is_unique: false,\n label: 'First name',\n multiline_count: 1,\n sort_order: 2,\n options: [],\n },\n {\n customUpperCode: 'lastname',\n code: 'lastname',\n default_value: '',\n entity_type: 'CUSTOMER',\n frontend_class: '',\n frontend_input: 'TEXT',\n is_required: false,\n is_unique: false,\n label: 'Last name',\n multiline_count: 1,\n sort_order: 3,\n options: [],\n },\n];\n\nexport const DEFAULT_INPUTS_PROPS: Record<string, string | ''> = {\n dob: '',\n email: '',\n firstname: '',\n gender: '',\n lastname: '',\n middlename: '',\n password: '',\n prefix: '',\n suffix: '',\n taxvat: '',\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 { transformAttributesForm } from '../data/transforms';\n\nexport const simplifyTransformAttributesForm = (defaultSignUpFields: any) => {\n if (!defaultSignUpFields?.length) return [];\n\n const params = {\n data: {\n attributesForm: { items: defaultSignUpFields },\n },\n };\n\n return transformAttributesForm(params);\n};\n"],"names":["DEFAULT__SIGN_IN_EMAIL_FIELD","DEFAULT__RESET_PASSWORD_EMAIL_FIELD","DEFAULT_SIGN_UP_FIELDS","simplifyTransformAttributesForm","defaultSignUpFields","transformAttributesForm"],"mappings":"8CAiBO,MAAMA,EAA+B,CAC1C,CACE,gBAAiB,QACjB,KAAM,QACN,cAAe,GACf,YAAa,WACb,eAAgB,iCAChB,eAAgB,OAChB,YAAa,GACb,gBAAiB,EACjB,WAAY,EACZ,UAAW,GACX,MAAO,QACP,QAAS,CAAA,EACT,cAAe,CACb,CACE,KAAM,mBACN,MAAO,OAAA,CACT,EAEF,aAAc,UAAA,CAElB,EAEaC,EAGP,CACJ,CACE,gBAAiB,QACjB,KAAM,QACN,cAAe,GACf,YAAa,WACb,eAAgB,uCAChB,eAAgB,OAChB,YAAa,GACb,UAAW,GACX,MAAO,QACP,QAAS,CAAA,EACT,cAAe,CACb,CACE,KAAM,mBACN,MAAO,OAAA,CACT,EAEF,aAAc,UAAA,CAElB,EAEaC,EAAyB,CACpC,CACE,gBAAiB,QACjB,KAAM,QACN,cAAe,GACf,YAAa,WACb,eAAgB,GAChB,eAAgB,OAChB,YAAa,GACb,UAAW,GACX,MAAO,QACP,gBAAiB,EACjB,WAAY,EACZ,QAAS,CAAA,EACT,cAAe,CACb,CACE,KAAM,mBACN,MAAO,OAAA,CACT,EAEF,aAAc,UAAA,EAEhB,CACE,gBAAiB,YACjB,KAAM,YACN,cAAe,GACf,YAAa,WACb,eAAgB,GAChB,eAAgB,OAChB,YAAa,GACb,UAAW,GACX,MAAO,aACP,gBAAiB,EACjB,WAAY,EACZ,QAAS,CAAA,CAAC,EAEZ,CACE,gBAAiB,WACjB,KAAM,WACN,cAAe,GACf,YAAa,WACb,eAAgB,GAChB,eAAgB,OAChB,YAAa,GACb,UAAW,GACX,MAAO,YACP,gBAAiB,EACjB,WAAY,EACZ,QAAS,CAAA,CAAC,CAEd,ECjGaC,EAAmCC,GACzCA,GAAA,MAAAA,EAAqB,OAQnBC,EANQ,CACb,KAAM,CACJ,eAAgB,CAAE,MAAOD,CAAA,CAAoB,CAC/C,CAGmC,EARI,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-attributes-form.js","sources":["/@dropins/storefront-auth/src/lib/convertCase.ts","/@dropins/storefront-auth/src/data/transforms/transform-attributes-form.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const convertToCamelCase = (key: string): string => {\n return key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());\n};\n\nexport const convertToSnakeCase = (key: string): string => {\n return key.replace(/([A-Z])/g, (letter) => `_${letter.toLowerCase()}`);\n};\n\nexport const convertKeysCase = (\n data: any,\n type: 'snakeCase' | 'camelCase',\n dictionary?: Record<string, string>\n): any => {\n const typeList = ['string', 'boolean', 'number'];\n const callback =\n type === 'camelCase' ? convertToCamelCase : convertToSnakeCase;\n\n if (Array.isArray(data)) {\n return data.map((element) => {\n if (typeList.includes(typeof element) || element === null) return element;\n\n if (typeof element === 'object') {\n return convertKeysCase(element, type, dictionary);\n }\n return element;\n });\n }\n\n if (data !== null && typeof data === 'object') {\n return Object.entries(data).reduce((acc, [key, value]) => {\n const newKey =\n dictionary && dictionary[key] ? dictionary[key] : callback(key);\n acc[newKey] =\n typeList.includes(typeof value) || value === null\n ? value\n : convertKeysCase(value, type, dictionary);\n return acc;\n }, {} as Record<string, unknown>);\n }\n\n return data;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n GetAttributesFormResponse,\n ResponseAttributesFormItemsProps,\n} from '@/auth/types';\nimport { AttributesFormModel } from '../models';\nimport { convertKeysCase, convertToCamelCase } from '@/auth/lib/convertCase';\n\nexport const cloneArrayIfExists = (\n fields: ResponseAttributesFormItemsProps[]\n) => {\n let multilineItems: any = [];\n\n for (const element of fields) {\n if (element.frontend_input !== 'MULTILINE' || element.multiline_count < 2) {\n continue;\n }\n\n for (let i = 2; i <= element.multiline_count; i++) {\n const newItem = {\n ...element,\n is_required: false,\n name: `${element.code}_multiline_${i}`,\n code: `${element.code}_multiline_${i}`,\n id: `${element.code}_multiline_${i}`,\n };\n\n multilineItems.push(newItem);\n }\n }\n\n return multilineItems;\n};\n\nexport const transformAttributesForm = (\n response: GetAttributesFormResponse\n): AttributesFormModel[] => {\n const items = response?.data?.attributesForm?.items || [];\n\n if (!items.length) return [];\n\n const fields = items\n .filter((el) => !el.frontend_input?.includes('HIDDEN'))\n ?.map(({ code, ...other }) => {\n const isDefaultCode = code !== 'country_id' ? code : 'country_code';\n\n return {\n ...other,\n name: isDefaultCode,\n id: isDefaultCode,\n code: isDefaultCode,\n };\n });\n\n const multilineItems = cloneArrayIfExists(fields as any);\n\n const attributesConfig = fields\n .concat(multilineItems)\n .map((item) => {\n const customUpperCode =\n item.code === 'firstname'\n ? 'firstName'\n : item.code === 'lastname'\n ? 'lastName'\n : convertToCamelCase(item.code);\n\n const options = item.options?.map((el) => {\n return {\n isDefault: el.is_default,\n text: el.label,\n value: el.value,\n };\n });\n\n return convertKeysCase(\n { ...item, options, customUpperCode },\n 'camelCase',\n {\n frontend_input: 'fieldType',\n frontend_class: 'className',\n is_required: 'required',\n sort_order: 'orderNumber',\n }\n );\n })\n .sort(\n (a: AttributesFormModel, b: AttributesFormModel) =>\n a.orderNumber - b.orderNumber\n );\n\n return attributesConfig;\n};\n"],"names":["convertToCamelCase","key","_","letter","convertToSnakeCase","convertKeysCase","data","type","dictionary","typeList","callback","element","acc","value","newKey","cloneArrayIfExists","fields","multilineItems","i","newItem","transformAttributesForm","response","_a","_b","_c","items","el","code","other","isDefaultCode","item","customUpperCode","options","a","b"],"mappings":"
|
|
1
|
+
{"version":3,"file":"transform-attributes-form.js","sources":["/@dropins/storefront-auth/src/lib/convertCase.ts","/@dropins/storefront-auth/src/data/transforms/transform-attributes-form.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const convertToCamelCase = (key: string): string => {\n return key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());\n};\n\nexport const convertToSnakeCase = (key: string): string => {\n return key.replace(/([A-Z])/g, (letter) => `_${letter.toLowerCase()}`);\n};\n\nexport const convertKeysCase = (\n data: any,\n type: 'snakeCase' | 'camelCase',\n dictionary?: Record<string, string>\n): any => {\n const typeList = ['string', 'boolean', 'number'];\n const callback =\n type === 'camelCase' ? convertToCamelCase : convertToSnakeCase;\n\n if (Array.isArray(data)) {\n return data.map((element) => {\n if (typeList.includes(typeof element) || element === null) return element;\n\n if (typeof element === 'object') {\n return convertKeysCase(element, type, dictionary);\n }\n return element;\n });\n }\n\n if (data !== null && typeof data === 'object') {\n return Object.entries(data).reduce((acc, [key, value]) => {\n const newKey =\n dictionary && dictionary[key] ? dictionary[key] : callback(key);\n acc[newKey] =\n typeList.includes(typeof value) || value === null\n ? value\n : convertKeysCase(value, type, dictionary);\n return acc;\n }, {} as Record<string, unknown>);\n }\n\n return data;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n GetAttributesFormResponse,\n ResponseAttributesFormItemsProps,\n} from '@/auth/types';\nimport { AttributesFormModel } from '../models';\nimport { convertKeysCase, convertToCamelCase } from '@/auth/lib/convertCase';\n\nexport const cloneArrayIfExists = (\n fields: ResponseAttributesFormItemsProps[]\n) => {\n let multilineItems: any = [];\n\n for (const element of fields) {\n if (element.frontend_input !== 'MULTILINE' || element.multiline_count < 2) {\n continue;\n }\n\n for (let i = 2; i <= element.multiline_count; i++) {\n const newItem = {\n ...element,\n is_required: false,\n name: `${element.code}_multiline_${i}`,\n code: `${element.code}_multiline_${i}`,\n id: `${element.code}_multiline_${i}`,\n };\n\n multilineItems.push(newItem);\n }\n }\n\n return multilineItems;\n};\n\nexport const transformAttributesForm = (\n response: GetAttributesFormResponse\n): AttributesFormModel[] => {\n const items = response?.data?.attributesForm?.items || [];\n\n if (!items.length) return [];\n\n const fields = items\n .filter((el) => !el.frontend_input?.includes('HIDDEN'))\n ?.map(({ code, ...other }) => {\n const isDefaultCode = code !== 'country_id' ? code : 'country_code';\n\n return {\n ...other,\n name: isDefaultCode,\n id: isDefaultCode,\n code: isDefaultCode,\n };\n });\n\n const multilineItems = cloneArrayIfExists(fields as any);\n\n const attributesConfig = fields\n .concat(multilineItems)\n .map((item) => {\n const customUpperCode =\n item.code === 'firstname'\n ? 'firstName'\n : item.code === 'lastname'\n ? 'lastName'\n : convertToCamelCase(item.code);\n\n const options = item.options?.map((el) => {\n return {\n isDefault: el.is_default,\n text: el.label,\n value: el.value,\n };\n });\n\n return convertKeysCase(\n { ...item, options, customUpperCode },\n 'camelCase',\n {\n frontend_input: 'fieldType',\n frontend_class: 'className',\n is_required: 'required',\n sort_order: 'orderNumber',\n }\n );\n })\n .sort(\n (a: AttributesFormModel, b: AttributesFormModel) =>\n a.orderNumber - b.orderNumber\n );\n\n return attributesConfig;\n};\n"],"names":["convertToCamelCase","key","_","letter","convertToSnakeCase","convertKeysCase","data","type","dictionary","typeList","callback","element","acc","value","newKey","cloneArrayIfExists","fields","multilineItems","i","newItem","transformAttributesForm","response","_a","_b","_c","items","el","code","other","isDefaultCode","item","customUpperCode","options","a","b"],"mappings":"AAiBO,MAAMA,EAAsBC,GAC1BA,EAAI,QAAQ,YAAa,CAACC,EAAGC,IAAWA,EAAO,aAAa,EAGxDC,EAAsBH,GAC1BA,EAAI,QAAQ,WAAaE,GAAW,IAAIA,EAAO,YAAA,CAAa,EAAE,EAG1DE,EAAkB,CAC7BC,EACAC,EACAC,IACQ,CACR,MAAMC,EAAW,CAAC,SAAU,UAAW,QAAQ,EACzCC,EACJH,IAAS,YAAcP,EAAqBI,EAE9C,OAAI,MAAM,QAAQE,CAAI,EACbA,EAAK,IAAKK,GACXF,EAAS,SAAS,OAAOE,CAAO,GAAKA,IAAY,KAAaA,EAE9D,OAAOA,GAAY,SACdN,EAAgBM,EAASJ,EAAMC,CAAU,EAE3CG,CACR,EAGCL,IAAS,MAAQ,OAAOA,GAAS,SAC5B,OAAO,QAAQA,CAAI,EAAE,OAAO,CAACM,EAAK,CAACX,EAAKY,CAAK,IAAM,CACxD,MAAMC,EACJN,GAAcA,EAAWP,CAAG,EAAIO,EAAWP,CAAG,EAAIS,EAAST,CAAG,EAChE,OAAAW,EAAIE,CAAM,EACRL,EAAS,SAAS,OAAOI,CAAK,GAAKA,IAAU,KACzCA,EACAR,EAAgBQ,EAAON,EAAMC,CAAU,EACtCI,CACT,EAAG,CAAA,CAA6B,EAG3BN,CACT,EClCaS,EACXC,GACG,CACH,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,EACL,CAAE,GAAGyB,EAAM,QAAAE,EAAS,gBAAAD,CAAA,EACpB,YACA,CACE,eAAgB,YAChB,eAAgB,YAChB,YAAa,WACb,WAAY,aAAA,CACd,CAEJ,CAAC,EACA,KACC,CAACE,EAAwBC,IACvBD,EAAE,YAAcC,EAAE,WAAA,CAI1B"}
|
|
@@ -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":"oPAqBO,MAAMA,EAAqB,IAAM,CACtC,KAAM,CAACC,EAA6BC,CAA8B,EAChEC,EAAS,EAAK,EACV,CAACC,EAAiBC,CAAkB,EAAIF,EAGpC,IAAI,EAEd,OAAAG,EAAU,IAAM,
|
|
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,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,EACv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G,CAAA,CACjC"}
|
package/chunks/verifyToken.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{events as f}from"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{f as d,h as g,
|
|
3
|
+
import{events as f}from"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{f as d,h as g,s as l,r as C}from"./network-error.js";const h={auth_dropin_user_token:"auth_dropin_user_token",auth_dropin_firstname:"auth_dropin_firstname"},s=3600,k=t=>{var o,e,r,c,a,i,n,u,_,m;return{autocompleteOnStorefront:((e=(o=t==null?void 0:t.data)==null?void 0:o.storeConfig)==null?void 0:e.autocomplete_on_storefront)||!1,minLength:((c=(r=t==null?void 0:t.data)==null?void 0:r.storeConfig)==null?void 0:c.minimum_password_length)||3,requiredCharacterClasses:+((i=(a=t==null?void 0:t.data)==null?void 0:a.storeConfig)==null?void 0:i.required_character_classes_number)||0,createAccountConfirmation:((u=(n=t==null?void 0:t.data)==null?void 0:n.storeConfig)==null?void 0:u.create_account_confirmation)||!1,customerAccessTokenLifetime:((m=(_=t==null?void 0:t.data)==null?void 0:_.storeConfig)==null?void 0:m.customer_access_token_lifetime)*s||s}},E=t=>{const o=t.map(e=>e.message).join(" ");throw Error(o)},T=t=>{const o=document.cookie.split(";");let e;return o.forEach(r=>{const[c,a]=r.trim().split("=");c===t&&(e=decodeURIComponent(a))}),e},O=t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`},N=async()=>{try{const t=sessionStorage.getItem("storeConfig");let e=(t?JSON.parse(t):{}).customerAccessTokenLifetime;if(!e){const r=await A();sessionStorage.setItem("storeConfig",JSON.stringify(r)),e=(r==null?void 0:r.customerAccessTokenLifetime)||s}return`Max-Age=${e}`}catch(t){return console.error("getCookiesLifetime() Error:",t),`Max-Age=${s}`}},S=`
|
|
4
4
|
query GET_STORE_CONFIG {
|
|
5
5
|
storeConfig {
|
|
6
6
|
autocomplete_on_storefront
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyToken.js","sources":["/@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\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 customerCart {\n id\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';\n\nexport const verifyToken = async (\n authType = 'Authorization',\n type = 'Bearer'\n) => {\n const token = getCookie(COOKIE_NAMES.auth_dropin_user_token);\n\n events.emit('authenticated', !!token);\n\n if (!token) return;\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) return;\n\n deleteCookie(COOKIE_NAMES.auth_dropin_user_token);\n removeFetchGraphQlHeader(authType);\n events.emit('authenticated', false);\n });\n};\n"],"names":["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","verifyToken","authType","type","token","events","setFetchGraphQlHeader","res","removeFetchGraphQlHeader"],"mappings":"qJAiBA,MAAMA,EAAe,CACnB,uBAAwB,yBACxB,sBAAuB,uBACzB,EAEMC,EAAkB,KCDXC,EACXC,GACqB,yBACd,MAAA,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,YA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G,EAAaD,EAAkB,CAC1C,OAAQ,MACR,MAAO,aAAA,CACR,EACE,KAAM5B,GAAqC,OAC1C,OAAIE,EAAAF,EAAS,SAAT,MAAAE,EAAiB,OAAeS,EAAiBX,EAAS,MAAM,EAE7DD,EAAqBC,CAAQ,CAAA,CACrC,EACA,MAAM8B,CAAkB,EClBhBC,EAAwC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECUxCC,EAAc,MACzBC,EAAW,gBACXC,EAAO,WACJ,CACG,MAAAC,EAAQrB,EAAUjB,EAAa,sBAAsB,EAI3D,GAFAuC,EAAO,KAAK,gBAAiB,CAAC,CAACD,CAAK,EAEhC,EAACA,EAEL,OAAAE,EAAsBJ,EAAU,GAAGC,CAAI,IAAIC,CAAK,EAAE,EAE3CN,EAAaE,CAAuB,EAAE,KAAMO,GAAQ,QAC/BpC,EAAAoC,EAAI,SAAJ,MAAApC,EAAY,KACnCyB,GAAU,OAAA,QAAAzB,EAAAyB,EAAM,aAAN,YAAAzB,EAAkB,YAAa,6BAK5CmB,EAAaxB,EAAa,sBAAsB,EAChD0C,EAAyBN,CAAQ,EAC1BG,EAAA,KAAK,gBAAiB,EAAK,EAAA,CACnC,CACH"}
|
|
1
|
+
{"version":3,"file":"verifyToken.js","sources":["/@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\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 customerCart {\n id\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';\n\nexport const verifyToken = async (\n authType = 'Authorization',\n type = 'Bearer'\n) => {\n const token = getCookie(COOKIE_NAMES.auth_dropin_user_token);\n\n events.emit('authenticated', !!token);\n\n if (!token) return;\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) return;\n\n deleteCookie(COOKIE_NAMES.auth_dropin_user_token);\n removeFetchGraphQlHeader(authType);\n events.emit('authenticated', false);\n });\n};\n"],"names":["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","verifyToken","authType","type","token","events","setFetchGraphQlHeader","res","removeFetchGraphQlHeader"],"mappings":"qJAiBA,MAAMA,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,SAAS,OAAO,MAAM,GAAG,EACzC,IAAIC,EAEJ,OAAAD,EAAQ,QAASE,GAAW,CAC1B,KAAM,CAACC,EAAMC,CAAK,EAAIF,EAAO,KAA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AAI,SAAJ,MAAApC,EAAY,KACnCyB,GAAA,OAAU,QAAAzB,EAAAyB,EAAM,aAAN,YAAAzB,EAAkB,YAAa,6BAK5CmB,EAAaxB,EAAa,sBAAsB,EAChD0C,EAAyBN,CAAQ,EACjCG,EAAO,KAAK,gBAAiB,EAAK,EACpC,CAAC,CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"m5CAuBMA,EAAoBC,EACxB,UAAM,OAAO,oBAAqC,KACpD,EACMC,EAAaD,EAAK,
|
|
1
|
+
{"version":3,"mappings":"m5CAuBMA,EAAoBC,EACxB,UAAM,OAAO,oBAAqC,KACpD,EACMC,EAAaD,EAAK,IAAAE,EAAA,IAAM,OAAO,qBAA8B,KAAC,EAC9DC,EAAaH,EAAK,IAAAE,EAAA,IAAM,OAAO,qBAA8B,KAAC,EAEvDE,EAA2C,CAAC,CACvD,YAAAC,EAAc,aACd,iBAAAC,EACA,iBAAAC,EACA,wBAAAC,CACF,IAAM,CACJ,KAAM,CAACC,EAAiBC,CAAkB,EACxCC,EAA8BN,CAAW,EAErCO,EAAkBC,EACtB,KAAO,CACL,WACEC,EAACb,EAAA,CACC,mBAAAS,EACC,GAAGJ,CAAA,GAGR,WACEQ,EAACX,EAAA,CACC,mBAAAO,EACC,GAAGH,CAAA,GAGR,kBACEO,EAACf,EAAA,CACC,mBAAAW,EACC,GAAGF,CAAA,EACN,GAGJ,CACEA,EACAF,EACAC,EACAG,CAAA,CACF,EAGF,SACG,OACC,SAAAI,EAACC,GAAS,SAAUD,EAACE,GAAe,eAAgBP,CAAA,CAAiB,EACnE,SAAAK,EAAC,OAAI,UAAU,eAAgB,WAAgBL,CAAe,EAAE,EAClE,EACF,CAEJ","names":["ResetPasswordForm","lazy","SignInForm","__vitePreload","SignUpForm","AuthCombine","defaultView","signInFormConfig","signUpFormConfig","resetPasswordFormConfig","activeComponent","setActiveComponent","useState","renderComponent","useMemo","jsx","Suspense","SkeletonLoader"],"ignoreList":[],"sources":["/@dropins/storefront-auth/src/containers/AuthCombine/AuthCombine.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 { Suspense, lazy } from 'preact/compat';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { useMemo, useState } from 'preact/hooks';\nimport { AuthCombineProps, activeComponentType } from '@/auth/types';\nimport SkeletonLoader from '@/auth/components/SkeletonLoader';\n\nconst ResetPasswordForm = lazy(\n () => import('@/auth/components/ResetPasswordForm')\n);\nconst SignInForm = lazy(() => import('@/auth/components/SignInForm'));\nconst SignUpForm = lazy(() => import('@/auth/components/SignUpForm'));\n\nexport const AuthCombine: Container<AuthCombineProps> = ({\n defaultView = 'signInForm',\n signInFormConfig,\n signUpFormConfig,\n resetPasswordFormConfig,\n}) => {\n const [activeComponent, setActiveComponent] =\n useState<activeComponentType>(defaultView);\n\n const renderComponent = useMemo(\n () => ({\n signInForm: (\n <SignInForm\n setActiveComponent={setActiveComponent}\n {...signInFormConfig}\n />\n ),\n signUpForm: (\n <SignUpForm\n setActiveComponent={setActiveComponent}\n {...signUpFormConfig}\n />\n ),\n resetPasswordForm: (\n <ResetPasswordForm\n setActiveComponent={setActiveComponent}\n {...resetPasswordFormConfig}\n />\n ),\n }),\n [\n resetPasswordFormConfig,\n signInFormConfig,\n signUpFormConfig,\n setActiveComponent,\n ]\n );\n\n return (\n <div>\n <Suspense fallback={<SkeletonLoader activeSkeleton={activeComponent} />}>\n <div className=\"auth-combine\">{renderComponent[activeComponent]}</div>\n </Suspense>\n </div>\n );\n};\n"],"file":"containers/AuthCombine.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResetPassword.js","sources":["/@dropins/storefront-auth/src/containers/ResetPassword/ResetPassword.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 { ResetPasswordForm } from '@/auth/components';\nimport { ResetPasswordProps } from '@/auth/types';\n\nexport const ResetPassword: Container<ResetPasswordProps> = ({\n formSize,\n routeSignIn,\n onErrorCallback,\n onSuccessCallback,\n}) => {\n return (\n <div className=\"auth-reset-password\">\n <ResetPasswordForm\n formSize={formSize}\n routeSignIn={routeSignIn}\n onErrorCallback={onErrorCallback}\n onSuccessCallback={onSuccessCallback}\n />\n </div>\n );\n};\n"],"names":["ResetPassword","formSize","routeSignIn","onErrorCallback","onSuccessCallback","jsx","ResetPasswordForm"],"mappings":"qqBAqBO,MAAMA,EAA+C,CAAC,CAC3D,SAAAC,EACA,YAAAC,EACA,gBAAAC,EACA,kBAAAC,CACF,IAEIC,EAAC,
|
|
1
|
+
{"version":3,"file":"ResetPassword.js","sources":["/@dropins/storefront-auth/src/containers/ResetPassword/ResetPassword.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 { ResetPasswordForm } from '@/auth/components';\nimport { ResetPasswordProps } from '@/auth/types';\n\nexport const ResetPassword: Container<ResetPasswordProps> = ({\n formSize,\n routeSignIn,\n onErrorCallback,\n onSuccessCallback,\n}) => {\n return (\n <div className=\"auth-reset-password\">\n <ResetPasswordForm\n formSize={formSize}\n routeSignIn={routeSignIn}\n onErrorCallback={onErrorCallback}\n onSuccessCallback={onSuccessCallback}\n />\n </div>\n );\n};\n"],"names":["ResetPassword","formSize","routeSignIn","onErrorCallback","onSuccessCallback","jsx","ResetPasswordForm"],"mappings":"qqBAqBO,MAAMA,EAA+C,CAAC,CAC3D,SAAAC,EACA,YAAAC,EACA,gBAAAC,EACA,kBAAAC,CACF,IAEIC,EAAC,MAAA,CAAI,UAAU,sBACb,SAAAA,EAACC,EAAA,CACC,SAAAL,EACA,YAAAC,EACA,gBAAAC,EACA,kBAAAC,CAAA,CAAA,EAEJ"}
|