@dropins/storefront-auth 2.1.0 → 2.1.1-beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"SignUpForm.js","sources":["/@dropins/storefront-auth/src/hooks/api/useGetAttributesForm.tsx","/@dropins/storefront-auth/src/lib/mergeFormObjects.ts","/@dropins/storefront-auth/src/hooks/components/useSignUpForm.tsx","/@dropins/storefront-auth/src/components/SignUpForm/SignUpForm.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 { getAttributesForm } from '@/auth/api';\nimport { useEffect, useState } from 'preact/hooks';\nimport { inputsDefaultValueSetProps } from '@/auth/types';\nimport { DEFAULT_SIGN_UP_FIELDS } from '@/auth/configs/defaultCreateUserConfigs';\nimport { AttributesFormItemsProps } from '@/auth/data/models';\nimport { simplifyTransformAttributesForm } from '@/auth/lib/simplifyTransformAttributesForm';\n\ninterface UseGetAttributesFormProps {\n fieldsConfigForApiVersion1: {}[];\n apiVersion2: boolean;\n inputsDefaultValueSet?: inputsDefaultValueSetProps[];\n}\n\nconst applyDefaultValuesToFields = (\n fields: AttributesFormItemsProps[],\n defaultValues: inputsDefaultValueSetProps[] | any\n) => {\n if (!defaultValues?.length) return fields;\n\n return fields.map((el) => {\n const defaultValue = defaultValues.find(\n ({ code }: inputsDefaultValueSetProps) => code === el.code\n )?.defaultValue;\n\n return defaultValue ? { ...el, defaultValue } : el;\n });\n};\n\nexport const useGetAttributesForm = ({\n inputsDefaultValueSet,\n fieldsConfigForApiVersion1,\n apiVersion2,\n}: UseGetAttributesFormProps) => {\n const [fieldsListConfigs, setFieldsListConfigs] = useState<\n AttributesFormItemsProps[]\n >([]);\n\n useEffect(() => {\n const fetchFieldsConfig = async () => {\n if (apiVersion2) {\n const response = await getAttributesForm('customer_account_create');\n\n if (response?.length) {\n if (inputsDefaultValueSet?.length) {\n const fieldsWithDefaultValues: any = applyDefaultValuesToFields(\n response,\n inputsDefaultValueSet\n );\n\n setFieldsListConfigs(fieldsWithDefaultValues);\n } else {\n setFieldsListConfigs(response);\n }\n }\n } else {\n const transformAttributesFields = simplifyTransformAttributesForm(\n DEFAULT_SIGN_UP_FIELDS\n );\n const transformFieldsConfigForApiVersion1 =\n simplifyTransformAttributesForm(fieldsConfigForApiVersion1);\n\n const defaultFieldsWithDefaultValues: any = applyDefaultValuesToFields(\n transformAttributesFields as AttributesFormItemsProps[],\n inputsDefaultValueSet\n );\n\n setFieldsListConfigs(\n fieldsConfigForApiVersion1 && fieldsConfigForApiVersion1.length\n ? transformFieldsConfigForApiVersion1\n : defaultFieldsWithDefaultValues\n );\n }\n };\n\n fetchFieldsConfig();\n }, [apiVersion2, fieldsConfigForApiVersion1, inputsDefaultValueSet]);\n\n return {\n fieldsListConfigs: fieldsListConfigs.map((element) => ({\n ...element,\n ...(element.code === 'email' ? { autocomplete: 'username' } : {}),\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 { convertKeysCase } from './convertCase';\n\nexport const mergeFormObjects = (\n input: Record<string, any>,\n apiVersion2: boolean\n) => {\n const baseKeys = [\n 'dob',\n 'email',\n 'firstname',\n 'gender',\n 'lastname',\n 'middlename',\n 'password',\n 'prefix',\n 'suffix',\n 'taxvat',\n ];\n\n const newInputs = convertKeysCase(input, 'snakeCase', {\n firstName: 'firstname',\n lastName: 'lastname',\n });\n\n if (!apiVersion2)\n return {\n ...newInputs,\n ...(newInputs?.gender ? { gender: Number(newInputs?.gender) } : {}),\n };\n\n const result: Record<string, any> = {};\n const customAttributes: Record<string, any>[] = [];\n\n Object.keys(newInputs).forEach((key: string) => {\n if (baseKeys.includes(key)) {\n result[key] = key.includes('gender')\n ? Number(newInputs[key])\n : newInputs[key];\n } else {\n customAttributes.push({\n attribute_code: key,\n value: newInputs[key],\n });\n }\n });\n\n if (customAttributes.length > 0) {\n result.custom_attributes = customAttributes;\n }\n\n return result;\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 createCustomer,\n createCustomerAddress,\n getCustomerToken,\n} from '@/auth/api';\nimport { getFormValues } from '@/auth/lib/getFormValues';\nimport { mergeFormObjects } from '@/auth/lib/mergeFormObjects';\nimport { validationUniqueSymbolsPassword } from '@/auth/lib/validationUniqueSymbolsPassword';\nimport { useCallback, useState } from 'preact/hooks';\nimport { UseSingUpFormProps } from '@/auth/types';\nimport { EventsList, publishEvents } from '@/auth/lib/acdl';\nimport { checkIsFunction } from '@/auth/lib/checkIsFunction';\nimport { focusOnEmptyPasswordField } from '@/auth/lib/focusOnEmptyPasswordField';\n\nexport const useSignUpForm = ({\n requireRetypePassword,\n addressesData,\n translations,\n isEmailConfirmationRequired,\n apiVersion2 = true,\n passwordConfigs,\n isAutoSignInEnabled,\n routeRedirectOnSignIn,\n routeSignIn,\n onErrorCallback,\n onSuccessCallback,\n setActiveComponent,\n handleSetInLineAlertProps,\n routeRedirectOnEmailConfirmationClose,\n}: UseSingUpFormProps) => {\n const [showPasswordErrorMessage, setShowPasswordErrorMessage] =\n useState<boolean>(false);\n const [confirmPassword, setConfirmPassword] = useState('');\n const [confirmPasswordMessage, setConfirmPasswordMessage] = useState('');\n const [userEmail, setUserEmail] = useState('');\n const [showEmailConfirmationForm, setShowEmailConfirmationForm] =\n useState(false);\n const [isSuccessful, setIsSuccessful] = useState({\n userName: '',\n status: false,\n });\n const [signUpPasswordValue, setSignUpPasswordValue] = useState('');\n const [isClickSubmit, setIsClickSubmit] = useState(false);\n const [isLoading, setIsLoading] = useState(false);\n const [isKeepMeLogged, setIsKeepMeLogged] = useState(true);\n\n const onBlurPassword = useCallback(\n (event: Event) => {\n const value = (event.target as HTMLInputElement).value;\n\n setShowPasswordErrorMessage(!value.length);\n\n if (value.length && confirmPassword.length && value !== confirmPassword) {\n setConfirmPasswordMessage(translations.passwordMismatch);\n }\n },\n [confirmPassword, translations.passwordMismatch]\n );\n\n const onBlurConfirmPassword = useCallback(\n (event: Event) => {\n const value = (event.target as HTMLInputElement).value;\n\n setConfirmPasswordMessage(\n value.length ? '' : translations.requiredFieldError\n );\n\n if (\n value.length &&\n signUpPasswordValue.length &&\n value !== signUpPasswordValue\n ) {\n setConfirmPasswordMessage(translations.passwordMismatch);\n }\n },\n [\n signUpPasswordValue,\n translations.passwordMismatch,\n translations.requiredFieldError,\n ]\n );\n\n const handleConfirmPasswordChange = useCallback(\n (value: string) => {\n setConfirmPassword(value);\n\n if (value) {\n setConfirmPasswordMessage(\n signUpPasswordValue === value ? '' : translations.passwordMismatch\n );\n } else {\n setConfirmPasswordMessage(translations.requiredFieldError);\n }\n },\n [translations, signUpPasswordValue]\n );\n\n const onKeepMeLoggedChange = useCallback(({ target }: any) => {\n setIsKeepMeLogged(target.checked);\n }, []);\n\n const signInButton = useCallback(() => {\n if (checkIsFunction(setActiveComponent)) {\n setActiveComponent('signInForm');\n\n return;\n }\n\n if (checkIsFunction(routeSignIn)) {\n window.location.href = routeSignIn();\n }\n }, [setActiveComponent, routeSignIn]);\n\n const handleSetSignUpPasswordValue = useCallback(\n (value: string) => {\n setSignUpPasswordValue(value);\n setShowPasswordErrorMessage(!value.length);\n if (value === confirmPassword) {\n setConfirmPasswordMessage('');\n }\n },\n [confirmPassword]\n );\n\n const handleHideEmailConfirmationForm = useCallback(() => {\n handleSetInLineAlertProps();\n setSignUpPasswordValue('');\n\n if (checkIsFunction(routeRedirectOnEmailConfirmationClose)) {\n window.location.href = routeRedirectOnEmailConfirmationClose();\n } else {\n setShowEmailConfirmationForm(false);\n setActiveComponent?.('signInForm');\n }\n }, [\n handleSetInLineAlertProps,\n routeRedirectOnEmailConfirmationClose,\n setActiveComponent,\n ]);\n\n const calledLoadingAndClick = () => {\n setIsClickSubmit(true);\n setIsLoading(false);\n };\n\n const onInvalidFormSubmit = (event: SubmitEvent, isValid: boolean) => {\n const arePasswordsFilled =\n signUpPasswordValue.length && confirmPassword.length;\n const arePasswordsMismatched = signUpPasswordValue !== confirmPassword;\n\n const handleErrors = () => {\n setShowPasswordErrorMessage(!signUpPasswordValue.length);\n if (!confirmPassword) {\n setConfirmPasswordMessage(translations.requiredFieldError);\n }\n if (arePasswordsFilled && arePasswordsMismatched) {\n setConfirmPasswordMessage(translations.passwordMismatch);\n }\n };\n\n const handleRetypePasswordErrors = () => {\n setConfirmPasswordMessage(\n confirmPassword.length\n ? translations.passwordMismatch\n : translations.requiredFieldError\n );\n focusOnEmptyPasswordField(event, signUpPasswordValue, confirmPassword);\n };\n\n if (!isValid) {\n calledLoadingAndClick();\n handleErrors();\n return true;\n }\n\n if (\n requireRetypePassword &&\n (confirmPasswordMessage.length || arePasswordsMismatched)\n ) {\n calledLoadingAndClick();\n handleRetypePasswordErrors();\n return true;\n }\n\n focusOnEmptyPasswordField(event, signUpPasswordValue, '');\n handleErrors();\n return false;\n };\n\n const onSubmitSignUp = async (event: SubmitEvent, isValid: boolean) => {\n handleSetInLineAlertProps();\n setConfirmPasswordMessage('');\n\n setIsLoading(true);\n\n if (onInvalidFormSubmit(event, isValid)) return;\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { confirmPasswordField, ...formValues } = getFormValues(event.target);\n const { email, password } = formValues;\n\n const requiredCharacterClasses =\n passwordConfigs?.requiredCharacterClasses || 0;\n\n const requiredPasswordLength = passwordConfigs?.minLength || 1;\n\n // If password validation fails - stop execution, sign-up not possible\n if (\n !validationUniqueSymbolsPassword(password, requiredCharacterClasses) ||\n requiredPasswordLength > password?.length\n ) {\n calledLoadingAndClick();\n\n return;\n }\n\n const formData = mergeFormObjects(\n {\n ...formValues,\n },\n apiVersion2\n );\n\n const response = await createCustomer(formData, apiVersion2);\n\n if (response?.errors?.length) {\n const { errors } = response;\n\n handleSetInLineAlertProps?.({\n type: 'error',\n text: errors[0]?.message,\n });\n\n onErrorCallback?.(errors);\n\n setUserEmail(email);\n } else {\n const createCustomerUserName = response?.firstName;\n\n publishEvents(EventsList.CREATE_ACCOUNT_EVENT, {\n ...response,\n });\n\n // If email confirmation enabled or auto sign-in disabled - stop execution, auto sign-in not possible\n if (isEmailConfirmationRequired || !isAutoSignInEnabled) {\n // Sign-up succeed, execute onSuccess callback\n onSuccessCallback?.({\n userName: createCustomerUserName,\n userEmail: email,\n status: true,\n });\n\n // If email confirmation enabled - show email confirmation form and stop execution\n if (isEmailConfirmationRequired) {\n (event.target as HTMLFormElement)?.reset();\n\n setSignUpPasswordValue('');\n setShowEmailConfirmationForm(true);\n setUserEmail(email);\n setIsLoading(false);\n\n return;\n }\n\n // If auto sign-in disabled - render success notification and stop execution\n if (!isAutoSignInEnabled) {\n setIsLoading(false);\n\n setIsSuccessful({\n userName: createCustomerUserName,\n status: true,\n });\n\n return;\n }\n }\n\n // Auto sign-in after sign-up\n const loginResponse = await getCustomerToken({\n email,\n password,\n translations,\n handleSetInLineAlertProps,\n onErrorCallback,\n });\n\n if (loginResponse?.userName) {\n if (addressesData?.length) {\n for (const address of addressesData) {\n try {\n await createCustomerAddress(address);\n } catch (error) {\n console.error(\n translations.failedCreateCustomerAddress,\n address,\n error\n );\n }\n }\n }\n\n onSuccessCallback?.({\n userName: loginResponse?.userName,\n userEmail: loginResponse?.userEmail,\n status: true,\n });\n\n if (checkIsFunction(routeRedirectOnSignIn)) {\n window.location.href = routeRedirectOnSignIn();\n } else {\n setIsSuccessful({\n userName: loginResponse?.userName,\n status: true,\n });\n }\n } else {\n // This is a fallback block, executed when registration succeed but sign-in for some reason failed\n onSuccessCallback?.({\n userName: createCustomerUserName,\n userEmail: email,\n status: true,\n });\n\n setIsSuccessful({\n userName: createCustomerUserName,\n status: true,\n });\n }\n }\n\n setIsLoading(false);\n };\n\n return {\n showPasswordErrorMessage,\n confirmPassword,\n confirmPasswordMessage,\n isKeepMeLogged,\n userEmail,\n showEmailConfirmationForm,\n isSuccessful,\n isClickSubmit,\n signUpPasswordValue,\n isLoading,\n onSubmitSignUp,\n signInButton,\n handleSetSignUpPasswordValue,\n onKeepMeLoggedChange,\n handleHideEmailConfirmationForm,\n handleConfirmPasswordChange,\n onBlurPassword,\n onBlurConfirmPassword,\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { classes, Slot } from '@adobe-commerce/elsie/lib';\nimport { useGetAttributesForm } from '@/auth/hooks/api/useGetAttributesForm';\nimport { useGetStoreConfigs } from '@/auth/hooks/api/useGetStoreConfigs';\nimport { usePasswordValidationMessage } from '@/auth/hooks/components/usePasswordValidationMessage';\nimport { useSignUpForm } from '@/auth/hooks/components/useSignUpForm';\nimport { SignUpFormProps } from '@/auth/types';\nimport { useInLineAlert } from '@/auth/hooks/useInLineAlert';\nimport { Form, Button, EmailConfirmationForm } from '@/auth/components';\nimport {\n Field,\n Checkbox,\n InLineAlert,\n InputPassword,\n Header,\n} from '@adobe-commerce/elsie/components';\nimport SkeletonLoader from '../SkeletonLoader';\nimport '@/auth/components/SignUpForm/SignUpForm.css';\nimport { useMemo } from 'preact/hooks';\nimport { useCustomTranslations } from '@/auth/hooks/useCustomTranslations';\n\nexport const SignUpForm: FunctionComponent<SignUpFormProps> = ({\n requireRetypePassword = false,\n addressesData,\n formSize = 'default',\n inputsDefaultValueSet,\n fieldsConfigForApiVersion1,\n apiVersion2 = true,\n isAutoSignInEnabled = true,\n hideCloseBtnOnEmailConfirmation = false,\n routeRedirectOnEmailConfirmationClose,\n routeRedirectOnSignIn,\n routeSignIn,\n onErrorCallback,\n onSuccessCallback,\n setActiveComponent,\n slots,\n}) => {\n /**\n * useCustomTranslations is required to support extensibility of error messages.\n * Ensure all error-related translation paths include \".default\"\n * to allow future handling of dynamic or nested error messages.\n */\n const translations = useCustomTranslations({\n title: 'Auth.SignUpForm.title',\n buttonPrimary: 'Auth.SignUpForm.buttonPrimary',\n buttonSecondary: 'Auth.SignUpForm.buttonSecondary',\n keepMeLoggedText: 'Auth.SignUpForm.keepMeLoggedText',\n customerTokenErrorMessage: 'Auth.Api.customerTokenErrorMessage',\n failedCreateCustomerAddress: 'Auth.SignUpForm.failedCreateCustomerAddress',\n placeholder: 'Auth.InputPassword.placeholder',\n floatingLabel: 'Auth.InputPassword.floatingLabel',\n requiredFieldError: 'Auth.FormText.requiredFieldError.default',\n confirmPasswordPlaceholder: 'Auth.SignUpForm.confirmPassword.placeholder',\n confirmPasswordFloatingLabel:\n 'Auth.SignUpForm.confirmPassword.floatingLabel',\n passwordMismatch: 'Auth.SignUpForm.confirmPassword.passwordMismatch', //NOSONAR\n });\n\n const { passwordConfigs, isEmailConfirmationRequired } = useGetStoreConfigs();\n const { fieldsListConfigs } = useGetAttributesForm({\n fieldsConfigForApiVersion1,\n apiVersion2,\n inputsDefaultValueSet,\n });\n\n const { inLineAlertProps, handleSetInLineAlertProps } = useInLineAlert();\n\n const {\n showPasswordErrorMessage,\n confirmPassword,\n confirmPasswordMessage,\n isKeepMeLogged,\n userEmail,\n showEmailConfirmationForm,\n isSuccessful,\n isClickSubmit,\n signUpPasswordValue,\n isLoading,\n onSubmitSignUp,\n signInButton,\n handleSetSignUpPasswordValue,\n onKeepMeLoggedChange,\n handleHideEmailConfirmationForm,\n handleConfirmPasswordChange,\n onBlurPassword,\n onBlurConfirmPassword,\n } = useSignUpForm({\n requireRetypePassword,\n addressesData,\n translations,\n isEmailConfirmationRequired,\n apiVersion2,\n passwordConfigs,\n isAutoSignInEnabled,\n routeRedirectOnSignIn,\n routeSignIn,\n onErrorCallback,\n onSuccessCallback,\n setActiveComponent,\n handleSetInLineAlertProps,\n routeRedirectOnEmailConfirmationClose,\n });\n\n const { isValidUniqueSymbols, defaultLengthMessage } =\n usePasswordValidationMessage({\n password: signUpPasswordValue,\n isClickSubmit,\n passwordConfigs,\n });\n\n const validationPasswordMessage = useMemo(() => {\n if (showPasswordErrorMessage) {\n return translations.requiredFieldError;\n }\n\n const hasSubmitError =\n isValidUniqueSymbols === 'error' ||\n defaultLengthMessage?.status === 'error';\n\n if (hasSubmitError) {\n return ' ';\n }\n\n return '';\n }, [\n defaultLengthMessage?.status,\n isValidUniqueSymbols,\n showPasswordErrorMessage,\n translations.requiredFieldError,\n ]);\n\n const shouldShowPersistLoginCheckbox =\n !isEmailConfirmationRequired && addressesData?.length;\n\n if (!fieldsListConfigs.length && apiVersion2) {\n return (\n <div\n className={`auth-sign-up-form auth-sign-up-form--${formSize} skeleton-loader`}\n data-testid=\"SignUpForm\"\n >\n <SkeletonLoader activeSkeleton=\"signUpForm\" />\n </div>\n );\n }\n\n if (isSuccessful.status && slots?.SuccessNotification) {\n return (\n <Slot\n data-testid=\"successNotificationTestId\"\n name=\"SuccessNotification\"\n slot={slots?.SuccessNotification}\n context={{ isSuccessful }}\n />\n );\n }\n\n if (showEmailConfirmationForm) {\n return (\n <EmailConfirmationForm\n formSize={formSize}\n userEmail={userEmail}\n inLineAlertProps={inLineAlertProps}\n hideCloseBtnOnEmailConfirmation={hideCloseBtnOnEmailConfirmation}\n handleSetInLineAlertProps={handleSetInLineAlertProps}\n onPrimaryButtonClick={handleHideEmailConfirmationForm}\n />\n );\n }\n\n return (\n <div\n className={classes([\n 'auth-sign-up-form',\n `auth-sign-up-form--${formSize}`,\n ])}\n data-testid=\"SignUpForm\"\n >\n <Header\n title={translations.title}\n divider={false}\n className=\"auth-sign-up-form__title\"\n />\n {inLineAlertProps.text ? (\n <InLineAlert\n className=\"auth-sign-up-form__notification\"\n type={inLineAlertProps.type}\n variant=\"secondary\"\n heading={inLineAlertProps.text}\n icon={inLineAlertProps.icon}\n />\n ) : null}\n <Form\n onSubmit={onSubmitSignUp}\n className=\"auth-sign-up-form__form\"\n loading={isLoading}\n name=\"signUp_form\"\n fieldsConfig={fieldsListConfigs}\n slots={slots}\n >\n <InputPassword\n validateLengthConfig={defaultLengthMessage}\n className=\"auth-sign-up-form__form__field\"\n autoComplete={'current-password'}\n name={'password'}\n minLength={passwordConfigs?.minLength}\n errorMessage={validationPasswordMessage}\n defaultValue={signUpPasswordValue}\n uniqueSymbolsStatus={isValidUniqueSymbols}\n requiredCharacterClasses={passwordConfigs?.requiredCharacterClasses}\n onValue={handleSetSignUpPasswordValue}\n placeholder={translations.placeholder}\n floatingLabel={translations.floatingLabel}\n onBlur={onBlurPassword}\n >\n {requireRetypePassword ? (\n <div className=\"auth-sign-up-form__form__confirm-wrapper\">\n <InputPassword\n className=\"auth-sign-up-form__form__field auth-sign-up-form__form__field--confirm-password\"\n autoComplete=\"confirmPassword\"\n name=\"confirmPasswordField\"\n placeholder={translations.confirmPasswordPlaceholder}\n floatingLabel={translations.confirmPasswordFloatingLabel}\n errorMessage={confirmPasswordMessage}\n defaultValue={confirmPassword}\n onValue={handleConfirmPasswordChange}\n onBlur={onBlurConfirmPassword}\n />\n </div>\n ) : null}\n\n {shouldShowPersistLoginCheckbox ? (\n <div\n className={'auth-sign-up-form__automatic-login'}\n data-testid=\"automaticLogin\"\n >\n <Field>\n <Checkbox\n name=\"\"\n placeholder={translations.keepMeLoggedText}\n label={translations.keepMeLoggedText}\n checked={isKeepMeLogged}\n onChange={onKeepMeLoggedChange}\n />\n </Field>\n </div>\n ) : null}\n </InputPassword>\n\n <Slot\n name=\"PrivacyPolicyConsent\"\n data-testid={'privacyPolicyConsent'}\n slot={slots?.PrivacyPolicyConsent}\n key={'privacyPolicyConsent'}\n />\n\n <div className=\"auth-sign-up-form-buttons\">\n <Button\n className=\"auth-sign-up-form-buttons--signin\"\n type=\"button\"\n variant=\"tertiary\"\n style={{ padding: 0 }}\n buttonText={translations.buttonSecondary}\n enableLoader={false}\n onClick={signInButton}\n />\n <Button\n type=\"submit\"\n buttonText={translations.buttonPrimary}\n variant=\"primary\"\n enableLoader={isLoading}\n />\n </div>\n </Form>\n <div id=\"createCustomerV2\" />\n </div>\n );\n};\n"],"names":["applyDefaultValuesToFields","fields","defaultValues","el","defaultValue","_a","code","useGetAttributesForm","inputsDefaultValueSet","fieldsConfigForApiVersion1","apiVersion2","fieldsListConfigs","setFieldsListConfigs","useState","useEffect","response","getAttributesForm","fieldsWithDefaultValues","transformAttributesFields","simplifyTransformAttributesForm","DEFAULT_SIGN_UP_FIELDS","transformFieldsConfigForApiVersion1","defaultFieldsWithDefaultValues","element","mergeFormObjects","input","baseKeys","newInputs","convertKeysCase","result","customAttributes","key","useSignUpForm","requireRetypePassword","addressesData","translations","isEmailConfirmationRequired","passwordConfigs","isAutoSignInEnabled","routeRedirectOnSignIn","routeSignIn","onErrorCallback","onSuccessCallback","setActiveComponent","handleSetInLineAlertProps","routeRedirectOnEmailConfirmationClose","showPasswordErrorMessage","setShowPasswordErrorMessage","confirmPassword","setConfirmPassword","confirmPasswordMessage","setConfirmPasswordMessage","userEmail","setUserEmail","showEmailConfirmationForm","setShowEmailConfirmationForm","isSuccessful","setIsSuccessful","signUpPasswordValue","setSignUpPasswordValue","isClickSubmit","setIsClickSubmit","isLoading","setIsLoading","isKeepMeLogged","setIsKeepMeLogged","onBlurPassword","useCallback","event","value","onBlurConfirmPassword","handleConfirmPasswordChange","onKeepMeLoggedChange","target","signInButton","checkIsFunction","handleSetSignUpPasswordValue","handleHideEmailConfirmationForm","calledLoadingAndClick","onInvalidFormSubmit","isValid","arePasswordsFilled","arePasswordsMismatched","handleErrors","handleRetypePasswordErrors","focusOnEmptyPasswordField","confirmPasswordField","formValues","getFormValues","email","password","requiredCharacterClasses","requiredPasswordLength","validationUniqueSymbolsPassword","formData","createCustomer","errors","_b","createCustomerUserName","publishEvents","EventsList","_c","loginResponse","getCustomerToken","address","createCustomerAddress","error","SignUpForm","formSize","hideCloseBtnOnEmailConfirmation","slots","useCustomTranslations","useGetStoreConfigs","inLineAlertProps","useInLineAlert","onSubmitSignUp","isValidUniqueSymbols","defaultLengthMessage","usePasswordValidationMessage","validationPasswordMessage","useMemo","shouldShowPersistLoginCheckbox","jsx","SkeletonLoader","Slot","EmailConfirmationForm","jsxs","classes","Header","InLineAlert","Form","InputPassword","Field","Checkbox","Button"],"mappings":"g8BA8BA,MAAMA,GAA6B,CACjCC,EACAC,IAEKA,GAAA,MAAAA,EAAe,OAEbD,EAAO,IAAKE,GAAO,OACxB,MAAMC,GAAeC,EAAAH,EAAc,KACjC,CAAC,CAAE,KAAAI,CAAK,IAAkCA,IAASH,EAAG,IAAA,IADnC,YAAAE,EAElB,aAEH,OAAOD,EAAe,CAAE,GAAGD,EAAI,aAAAC,CAAiB,EAAAD,CAAA,CACjD,EARkCF,EAWxBM,GAAuB,CAAC,CACnC,sBAAAC,EACA,2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AmB,CAAA,CAAA,CAAA,CAC7B,CAEJ"}
1
+ {"version":3,"file":"SignUpForm.js","sources":["/@dropins/storefront-auth/src/hooks/api/useGetAttributesForm.tsx","/@dropins/storefront-auth/src/lib/mergeFormObjects.ts","/@dropins/storefront-auth/src/hooks/components/useSignUpForm.tsx","/@dropins/storefront-auth/src/components/SignUpForm/SignUpForm.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 { getAttributesForm } from '@/auth/api';\nimport { useEffect, useState } from 'preact/hooks';\nimport { inputsDefaultValueSetProps } from '@/auth/types';\nimport { DEFAULT_SIGN_UP_FIELDS } from '@/auth/configs/defaultCreateUserConfigs';\nimport { AttributesFormItemsProps } from '@/auth/data/models';\nimport { simplifyTransformAttributesForm } from '@/auth/lib/simplifyTransformAttributesForm';\n\ninterface UseGetAttributesFormProps {\n fieldsConfigForApiVersion1: {}[];\n apiVersion2: boolean;\n inputsDefaultValueSet?: inputsDefaultValueSetProps[];\n}\n\nconst applyDefaultValuesToFields = (\n fields: AttributesFormItemsProps[],\n defaultValues: inputsDefaultValueSetProps[] | any\n) => {\n if (!defaultValues?.length) return fields;\n\n return fields.map((el) => {\n const defaultValue = defaultValues.find(\n ({ code }: inputsDefaultValueSetProps) => code === el.code\n )?.defaultValue;\n\n return defaultValue ? { ...el, defaultValue } : el;\n });\n};\n\nexport const useGetAttributesForm = ({\n inputsDefaultValueSet,\n fieldsConfigForApiVersion1,\n apiVersion2,\n}: UseGetAttributesFormProps) => {\n const [fieldsListConfigs, setFieldsListConfigs] = useState<\n AttributesFormItemsProps[]\n >([]);\n\n useEffect(() => {\n const fetchFieldsConfig = async () => {\n if (apiVersion2) {\n const response = await getAttributesForm('customer_account_create');\n\n if (response?.length) {\n if (inputsDefaultValueSet?.length) {\n const fieldsWithDefaultValues: any = applyDefaultValuesToFields(\n response,\n inputsDefaultValueSet\n );\n\n setFieldsListConfigs(fieldsWithDefaultValues);\n } else {\n setFieldsListConfigs(response);\n }\n }\n } else {\n const transformAttributesFields = simplifyTransformAttributesForm(\n DEFAULT_SIGN_UP_FIELDS\n );\n const transformFieldsConfigForApiVersion1 =\n simplifyTransformAttributesForm(fieldsConfigForApiVersion1);\n\n const defaultFieldsWithDefaultValues: any = applyDefaultValuesToFields(\n transformAttributesFields as AttributesFormItemsProps[],\n inputsDefaultValueSet\n );\n\n setFieldsListConfigs(\n fieldsConfigForApiVersion1 && fieldsConfigForApiVersion1.length\n ? transformFieldsConfigForApiVersion1\n : defaultFieldsWithDefaultValues\n );\n }\n };\n\n fetchFieldsConfig();\n }, [apiVersion2, fieldsConfigForApiVersion1, inputsDefaultValueSet]);\n\n return {\n fieldsListConfigs: fieldsListConfigs.map((element) => ({\n ...element,\n ...(element.code === 'email' ? { autocomplete: 'username' } : {}),\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 { convertKeysCase } from './convertCase';\n\nexport const mergeFormObjects = (\n input: Record<string, any>,\n apiVersion2: boolean\n) => {\n const baseKeys = [\n 'dob',\n 'email',\n 'firstname',\n 'gender',\n 'lastname',\n 'middlename',\n 'password',\n 'prefix',\n 'suffix',\n 'taxvat',\n ];\n\n const newInputs = convertKeysCase(input, 'snakeCase', {\n firstName: 'firstname',\n lastName: 'lastname',\n });\n\n if (!apiVersion2)\n return {\n ...newInputs,\n ...(newInputs?.gender ? { gender: Number(newInputs?.gender) } : {}),\n };\n\n const result: Record<string, any> = {};\n const customAttributes: Record<string, any>[] = [];\n\n Object.keys(newInputs).forEach((key: string) => {\n if (baseKeys.includes(key)) {\n result[key] = key.includes('gender')\n ? Number(newInputs[key])\n : newInputs[key];\n } else {\n customAttributes.push({\n attribute_code: key,\n value: newInputs[key],\n });\n }\n });\n\n if (customAttributes.length > 0) {\n result.custom_attributes = customAttributes;\n }\n\n return result;\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 createCustomer,\n createCustomerAddress,\n getCustomerToken,\n} from '@/auth/api';\nimport { getFormValues } from '@/auth/lib/getFormValues';\nimport { mergeFormObjects } from '@/auth/lib/mergeFormObjects';\nimport { validationUniqueSymbolsPassword } from '@/auth/lib/validationUniqueSymbolsPassword';\nimport { useCallback, useState } from 'preact/hooks';\nimport { UseSingUpFormProps } from '@/auth/types';\nimport { EventsList, publishEvents } from '@/auth/lib/acdl';\nimport { checkIsFunction } from '@/auth/lib/checkIsFunction';\nimport { focusOnEmptyPasswordField } from '@/auth/lib/focusOnEmptyPasswordField';\n\nexport const useSignUpForm = ({\n requireRetypePassword,\n addressesData,\n translations,\n isEmailConfirmationRequired,\n apiVersion2 = true,\n passwordConfigs,\n isAutoSignInEnabled,\n routeRedirectOnSignIn,\n routeSignIn,\n onErrorCallback,\n onSuccessCallback,\n setActiveComponent,\n handleSetInLineAlertProps,\n routeRedirectOnEmailConfirmationClose,\n}: UseSingUpFormProps) => {\n const [showPasswordErrorMessage, setShowPasswordErrorMessage] =\n useState<boolean>(false);\n const [confirmPassword, setConfirmPassword] = useState('');\n const [confirmPasswordMessage, setConfirmPasswordMessage] = useState('');\n const [userEmail, setUserEmail] = useState('');\n const [showEmailConfirmationForm, setShowEmailConfirmationForm] =\n useState(false);\n const [isSuccessful, setIsSuccessful] = useState({\n userName: '',\n status: false,\n });\n const [signUpPasswordValue, setSignUpPasswordValue] = useState('');\n const [isClickSubmit, setIsClickSubmit] = useState(false);\n const [isLoading, setIsLoading] = useState(false);\n const [isKeepMeLogged, setIsKeepMeLogged] = useState(true);\n\n const onBlurPassword = useCallback(\n (event: Event) => {\n const value = (event.target as HTMLInputElement).value;\n\n setShowPasswordErrorMessage(!value.length);\n\n if (value.length && confirmPassword.length && value !== confirmPassword) {\n setConfirmPasswordMessage(translations.passwordMismatch);\n }\n },\n [confirmPassword, translations.passwordMismatch]\n );\n\n const onBlurConfirmPassword = useCallback(\n (event: Event) => {\n const value = (event.target as HTMLInputElement).value;\n\n setConfirmPasswordMessage(\n value.length ? '' : translations.requiredFieldError\n );\n\n if (\n value.length &&\n signUpPasswordValue.length &&\n value !== signUpPasswordValue\n ) {\n setConfirmPasswordMessage(translations.passwordMismatch);\n }\n },\n [\n signUpPasswordValue,\n translations.passwordMismatch,\n translations.requiredFieldError,\n ]\n );\n\n const handleConfirmPasswordChange = useCallback(\n (value: string) => {\n setConfirmPassword(value);\n\n if (value) {\n setConfirmPasswordMessage(\n signUpPasswordValue === value ? '' : translations.passwordMismatch\n );\n } else {\n setConfirmPasswordMessage(translations.requiredFieldError);\n }\n },\n [translations, signUpPasswordValue]\n );\n\n const onKeepMeLoggedChange = useCallback(({ target }: any) => {\n setIsKeepMeLogged(target.checked);\n }, []);\n\n const signInButton = useCallback(() => {\n if (checkIsFunction(setActiveComponent)) {\n setActiveComponent('signInForm');\n\n return;\n }\n\n if (checkIsFunction(routeSignIn)) {\n window.location.href = routeSignIn();\n }\n }, [setActiveComponent, routeSignIn]);\n\n const handleSetSignUpPasswordValue = useCallback(\n (value: string) => {\n setSignUpPasswordValue(value);\n setShowPasswordErrorMessage(!value.length);\n if (value === confirmPassword) {\n setConfirmPasswordMessage('');\n }\n },\n [confirmPassword]\n );\n\n const handleHideEmailConfirmationForm = useCallback(() => {\n handleSetInLineAlertProps();\n setSignUpPasswordValue('');\n\n if (checkIsFunction(routeRedirectOnEmailConfirmationClose)) {\n window.location.href = routeRedirectOnEmailConfirmationClose();\n } else {\n setShowEmailConfirmationForm(false);\n setActiveComponent?.('signInForm');\n }\n }, [\n handleSetInLineAlertProps,\n routeRedirectOnEmailConfirmationClose,\n setActiveComponent,\n ]);\n\n const calledLoadingAndClick = () => {\n setIsClickSubmit(true);\n setIsLoading(false);\n };\n\n const onInvalidFormSubmit = (event: SubmitEvent, isValid: boolean) => {\n const arePasswordsFilled =\n signUpPasswordValue.length && confirmPassword.length;\n const arePasswordsMismatched = signUpPasswordValue !== confirmPassword;\n\n const handleErrors = () => {\n setShowPasswordErrorMessage(!signUpPasswordValue.length);\n if (!confirmPassword) {\n setConfirmPasswordMessage(translations.requiredFieldError);\n }\n if (arePasswordsFilled && arePasswordsMismatched) {\n setConfirmPasswordMessage(translations.passwordMismatch);\n }\n };\n\n const handleRetypePasswordErrors = () => {\n setConfirmPasswordMessage(\n confirmPassword.length\n ? translations.passwordMismatch\n : translations.requiredFieldError\n );\n focusOnEmptyPasswordField(event, signUpPasswordValue, confirmPassword);\n };\n\n if (!isValid) {\n calledLoadingAndClick();\n handleErrors();\n return true;\n }\n\n if (\n requireRetypePassword &&\n (confirmPasswordMessage.length || arePasswordsMismatched)\n ) {\n calledLoadingAndClick();\n handleRetypePasswordErrors();\n return true;\n }\n\n focusOnEmptyPasswordField(event, signUpPasswordValue, '');\n handleErrors();\n return false;\n };\n\n const onSubmitSignUp = async (event: SubmitEvent, isValid: boolean) => {\n handleSetInLineAlertProps();\n setConfirmPasswordMessage('');\n\n setIsLoading(true);\n\n if (onInvalidFormSubmit(event, isValid)) return;\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { confirmPasswordField, ...formValues } = getFormValues(event.target);\n const { email, password } = formValues;\n\n const requiredCharacterClasses =\n passwordConfigs?.requiredCharacterClasses || 0;\n\n const requiredPasswordLength = passwordConfigs?.minLength || 1;\n\n // If password validation fails - stop execution, sign-up not possible\n if (\n !validationUniqueSymbolsPassword(password, requiredCharacterClasses) ||\n requiredPasswordLength > password?.length\n ) {\n calledLoadingAndClick();\n\n return;\n }\n\n const formData = mergeFormObjects(\n {\n ...formValues,\n },\n apiVersion2\n );\n\n const response = await createCustomer(formData, apiVersion2);\n\n if (response?.errors?.length) {\n const { errors } = response;\n\n handleSetInLineAlertProps?.({\n type: 'error',\n text: errors[0]?.message,\n });\n\n onErrorCallback?.(errors);\n\n setUserEmail(email);\n } else {\n const createCustomerUserName = response?.firstName;\n\n publishEvents(EventsList.CREATE_ACCOUNT_EVENT, {\n ...response,\n });\n\n // If email confirmation enabled or auto sign-in disabled - stop execution, auto sign-in not possible\n if (isEmailConfirmationRequired || !isAutoSignInEnabled) {\n // Sign-up succeed, execute onSuccess callback\n onSuccessCallback?.({\n userName: createCustomerUserName,\n userEmail: email,\n status: true,\n });\n\n // If email confirmation enabled - show email confirmation form and stop execution\n if (isEmailConfirmationRequired) {\n (event.target as HTMLFormElement)?.reset();\n\n setSignUpPasswordValue('');\n setShowEmailConfirmationForm(true);\n setUserEmail(email);\n setIsLoading(false);\n\n return;\n }\n\n // If auto sign-in disabled - render success notification and stop execution\n if (!isAutoSignInEnabled) {\n setIsLoading(false);\n\n setIsSuccessful({\n userName: createCustomerUserName,\n status: true,\n });\n\n return;\n }\n }\n\n // Auto sign-in after sign-up\n const loginResponse = await getCustomerToken({\n email,\n password,\n translations,\n handleSetInLineAlertProps,\n onErrorCallback,\n });\n\n if (loginResponse?.userName) {\n if (addressesData?.length) {\n for (const address of addressesData) {\n try {\n await createCustomerAddress(address);\n } catch (error) {\n console.error(\n translations.failedCreateCustomerAddress,\n address,\n error\n );\n }\n }\n }\n\n onSuccessCallback?.({\n userName: loginResponse?.userName,\n userEmail: loginResponse?.userEmail,\n status: true,\n });\n\n if (checkIsFunction(routeRedirectOnSignIn)) {\n window.location.href = routeRedirectOnSignIn();\n } else {\n setIsSuccessful({\n userName: loginResponse?.userName,\n status: true,\n });\n }\n } else {\n // This is a fallback block, executed when registration succeed but sign-in for some reason failed\n onSuccessCallback?.({\n userName: createCustomerUserName,\n userEmail: email,\n status: true,\n });\n\n setIsSuccessful({\n userName: createCustomerUserName,\n status: true,\n });\n }\n }\n\n setIsLoading(false);\n };\n\n return {\n showPasswordErrorMessage,\n confirmPassword,\n confirmPasswordMessage,\n isKeepMeLogged,\n userEmail,\n showEmailConfirmationForm,\n isSuccessful,\n isClickSubmit,\n signUpPasswordValue,\n isLoading,\n onSubmitSignUp,\n signInButton,\n handleSetSignUpPasswordValue,\n onKeepMeLoggedChange,\n handleHideEmailConfirmationForm,\n handleConfirmPasswordChange,\n onBlurPassword,\n onBlurConfirmPassword,\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { classes, Slot } from '@adobe-commerce/elsie/lib';\nimport { useGetAttributesForm } from '@/auth/hooks/api/useGetAttributesForm';\nimport { useGetStoreConfigs } from '@/auth/hooks/api/useGetStoreConfigs';\nimport { usePasswordValidationMessage } from '@/auth/hooks/components/usePasswordValidationMessage';\nimport { useSignUpForm } from '@/auth/hooks/components/useSignUpForm';\nimport { SignUpFormProps } from '@/auth/types';\nimport { useInLineAlert } from '@/auth/hooks/useInLineAlert';\nimport { Form, Button, EmailConfirmationForm } from '@/auth/components';\nimport {\n Field,\n Checkbox,\n InLineAlert,\n InputPassword,\n Header,\n} from '@adobe-commerce/elsie/components';\nimport SkeletonLoader from '../SkeletonLoader';\nimport '@/auth/components/SignUpForm/SignUpForm.css';\nimport { useMemo } from 'preact/hooks';\nimport { useCustomTranslations } from '@/auth/hooks/useCustomTranslations';\n\nexport const SignUpForm: FunctionComponent<SignUpFormProps> = ({\n requireRetypePassword = false,\n addressesData,\n formSize = 'default',\n inputsDefaultValueSet,\n fieldsConfigForApiVersion1,\n apiVersion2 = true,\n isAutoSignInEnabled = true,\n hideCloseBtnOnEmailConfirmation = false,\n routeRedirectOnEmailConfirmationClose,\n routeRedirectOnSignIn,\n routeSignIn,\n onErrorCallback,\n onSuccessCallback,\n setActiveComponent,\n slots,\n}) => {\n /**\n * useCustomTranslations is required to support extensibility of error messages.\n * Ensure all error-related translation paths include \".default\"\n * to allow future handling of dynamic or nested error messages.\n */\n const translations = useCustomTranslations({\n title: 'Auth.SignUpForm.title',\n buttonPrimary: 'Auth.SignUpForm.buttonPrimary',\n buttonSecondary: 'Auth.SignUpForm.buttonSecondary',\n keepMeLoggedText: 'Auth.SignUpForm.keepMeLoggedText',\n customerTokenErrorMessage: 'Auth.Api.customerTokenErrorMessage',\n failedCreateCustomerAddress: 'Auth.SignUpForm.failedCreateCustomerAddress',\n placeholder: 'Auth.InputPassword.placeholder',\n floatingLabel: 'Auth.InputPassword.floatingLabel',\n requiredFieldError: 'Auth.FormText.requiredFieldError.default',\n confirmPasswordPlaceholder: 'Auth.SignUpForm.confirmPassword.placeholder',\n confirmPasswordFloatingLabel:\n 'Auth.SignUpForm.confirmPassword.floatingLabel',\n passwordMismatch: 'Auth.SignUpForm.confirmPassword.passwordMismatch', //NOSONAR\n });\n\n const { passwordConfigs, isEmailConfirmationRequired } = useGetStoreConfigs();\n const { fieldsListConfigs } = useGetAttributesForm({\n fieldsConfigForApiVersion1,\n apiVersion2,\n inputsDefaultValueSet,\n });\n\n const { inLineAlertProps, handleSetInLineAlertProps } = useInLineAlert();\n\n const {\n showPasswordErrorMessage,\n confirmPassword,\n confirmPasswordMessage,\n isKeepMeLogged,\n userEmail,\n showEmailConfirmationForm,\n isSuccessful,\n isClickSubmit,\n signUpPasswordValue,\n isLoading,\n onSubmitSignUp,\n signInButton,\n handleSetSignUpPasswordValue,\n onKeepMeLoggedChange,\n handleHideEmailConfirmationForm,\n handleConfirmPasswordChange,\n onBlurPassword,\n onBlurConfirmPassword,\n } = useSignUpForm({\n requireRetypePassword,\n addressesData,\n translations,\n isEmailConfirmationRequired,\n apiVersion2,\n passwordConfigs,\n isAutoSignInEnabled,\n routeRedirectOnSignIn,\n routeSignIn,\n onErrorCallback,\n onSuccessCallback,\n setActiveComponent,\n handleSetInLineAlertProps,\n routeRedirectOnEmailConfirmationClose,\n });\n\n const { isValidUniqueSymbols, defaultLengthMessage } =\n usePasswordValidationMessage({\n password: signUpPasswordValue,\n isClickSubmit,\n passwordConfigs,\n });\n\n const validationPasswordMessage = useMemo(() => {\n if (showPasswordErrorMessage) {\n return translations.requiredFieldError;\n }\n\n const hasSubmitError =\n isValidUniqueSymbols === 'error' ||\n defaultLengthMessage?.status === 'error';\n\n if (hasSubmitError) {\n return ' ';\n }\n\n return '';\n }, [\n defaultLengthMessage?.status,\n isValidUniqueSymbols,\n showPasswordErrorMessage,\n translations.requiredFieldError,\n ]);\n\n const shouldShowPersistLoginCheckbox =\n !isEmailConfirmationRequired && addressesData?.length;\n\n if (!fieldsListConfigs.length && apiVersion2) {\n return (\n <div\n className={`auth-sign-up-form auth-sign-up-form--${formSize} skeleton-loader`}\n data-testid=\"SignUpForm\"\n >\n <SkeletonLoader activeSkeleton=\"signUpForm\" />\n </div>\n );\n }\n\n if (isSuccessful.status && slots?.SuccessNotification) {\n return (\n <Slot\n data-testid=\"successNotificationTestId\"\n name=\"SuccessNotification\"\n slot={slots?.SuccessNotification}\n context={{ isSuccessful }}\n />\n );\n }\n\n if (showEmailConfirmationForm) {\n return (\n <EmailConfirmationForm\n formSize={formSize}\n userEmail={userEmail}\n inLineAlertProps={inLineAlertProps}\n hideCloseBtnOnEmailConfirmation={hideCloseBtnOnEmailConfirmation}\n handleSetInLineAlertProps={handleSetInLineAlertProps}\n onPrimaryButtonClick={handleHideEmailConfirmationForm}\n />\n );\n }\n\n return (\n <div\n className={classes([\n 'auth-sign-up-form',\n `auth-sign-up-form--${formSize}`,\n ])}\n data-testid=\"SignUpForm\"\n >\n <Header\n title={translations.title}\n divider={false}\n className=\"auth-sign-up-form__title\"\n />\n {inLineAlertProps.text ? (\n <InLineAlert\n className=\"auth-sign-up-form__notification\"\n type={inLineAlertProps.type}\n variant=\"secondary\"\n heading={inLineAlertProps.text}\n icon={inLineAlertProps.icon}\n />\n ) : null}\n <Form\n onSubmit={onSubmitSignUp}\n className=\"auth-sign-up-form__form\"\n loading={isLoading}\n name=\"signUp_form\"\n fieldsConfig={fieldsListConfigs}\n slots={slots}\n >\n <InputPassword\n validateLengthConfig={defaultLengthMessage}\n className=\"auth-sign-up-form__form__field\"\n autoComplete={'current-password'}\n name={'password'}\n minLength={passwordConfigs?.minLength}\n errorMessage={validationPasswordMessage}\n defaultValue={signUpPasswordValue}\n uniqueSymbolsStatus={isValidUniqueSymbols}\n requiredCharacterClasses={passwordConfigs?.requiredCharacterClasses}\n onValue={handleSetSignUpPasswordValue}\n placeholder={translations.placeholder}\n floatingLabel={translations.floatingLabel}\n onBlur={onBlurPassword}\n >\n {requireRetypePassword ? (\n <div className=\"auth-sign-up-form__form__confirm-wrapper\">\n <InputPassword\n className=\"auth-sign-up-form__form__field auth-sign-up-form__form__field--confirm-password\"\n autoComplete=\"confirmPassword\"\n name=\"confirmPasswordField\"\n placeholder={translations.confirmPasswordPlaceholder}\n floatingLabel={translations.confirmPasswordFloatingLabel}\n errorMessage={confirmPasswordMessage}\n defaultValue={confirmPassword}\n onValue={handleConfirmPasswordChange}\n onBlur={onBlurConfirmPassword}\n />\n </div>\n ) : null}\n\n {shouldShowPersistLoginCheckbox ? (\n <div\n className={'auth-sign-up-form__automatic-login'}\n data-testid=\"automaticLogin\"\n >\n <Field>\n <Checkbox\n name=\"\"\n placeholder={translations.keepMeLoggedText}\n label={translations.keepMeLoggedText}\n checked={isKeepMeLogged}\n onChange={onKeepMeLoggedChange}\n />\n </Field>\n </div>\n ) : null}\n </InputPassword>\n\n <Slot\n name=\"PrivacyPolicyConsent\"\n data-testid={'privacyPolicyConsent'}\n slot={slots?.PrivacyPolicyConsent}\n key={'privacyPolicyConsent'}\n />\n\n <div className=\"auth-sign-up-form-buttons\">\n <Button\n className=\"auth-sign-up-form-buttons--signin\"\n type=\"button\"\n variant=\"tertiary\"\n style={{ padding: 0 }}\n buttonText={translations.buttonSecondary}\n enableLoader={false}\n onClick={signInButton}\n />\n <Button\n type=\"submit\"\n buttonText={translations.buttonPrimary}\n variant=\"primary\"\n enableLoader={isLoading}\n />\n </div>\n </Form>\n <div id=\"createCustomerV2\" />\n </div>\n );\n};\n"],"names":["applyDefaultValuesToFields","fields","defaultValues","el","defaultValue","_a","code","useGetAttributesForm","inputsDefaultValueSet","fieldsConfigForApiVersion1","apiVersion2","fieldsListConfigs","setFieldsListConfigs","useState","useEffect","response","getAttributesForm","fieldsWithDefaultValues","transformAttributesFields","simplifyTransformAttributesForm","DEFAULT_SIGN_UP_FIELDS","transformFieldsConfigForApiVersion1","defaultFieldsWithDefaultValues","element","mergeFormObjects","input","baseKeys","newInputs","convertKeysCase","result","customAttributes","key","useSignUpForm","requireRetypePassword","addressesData","translations","isEmailConfirmationRequired","passwordConfigs","isAutoSignInEnabled","routeRedirectOnSignIn","routeSignIn","onErrorCallback","onSuccessCallback","setActiveComponent","handleSetInLineAlertProps","routeRedirectOnEmailConfirmationClose","showPasswordErrorMessage","setShowPasswordErrorMessage","confirmPassword","setConfirmPassword","confirmPasswordMessage","setConfirmPasswordMessage","userEmail","setUserEmail","showEmailConfirmationForm","setShowEmailConfirmationForm","isSuccessful","setIsSuccessful","signUpPasswordValue","setSignUpPasswordValue","isClickSubmit","setIsClickSubmit","isLoading","setIsLoading","isKeepMeLogged","setIsKeepMeLogged","onBlurPassword","useCallback","event","value","onBlurConfirmPassword","handleConfirmPasswordChange","onKeepMeLoggedChange","target","signInButton","checkIsFunction","handleSetSignUpPasswordValue","handleHideEmailConfirmationForm","calledLoadingAndClick","onInvalidFormSubmit","isValid","arePasswordsFilled","arePasswordsMismatched","handleErrors","handleRetypePasswordErrors","focusOnEmptyPasswordField","confirmPasswordField","formValues","getFormValues","email","password","requiredCharacterClasses","requiredPasswordLength","validationUniqueSymbolsPassword","formData","createCustomer","errors","_b","createCustomerUserName","publishEvents","EventsList","_c","loginResponse","getCustomerToken","address","createCustomerAddress","error","SignUpForm","formSize","hideCloseBtnOnEmailConfirmation","slots","useCustomTranslations","useGetStoreConfigs","inLineAlertProps","useInLineAlert","onSubmitSignUp","isValidUniqueSymbols","defaultLengthMessage","usePasswordValidationMessage","validationPasswordMessage","useMemo","shouldShowPersistLoginCheckbox","jsx","SkeletonLoader","Slot","EmailConfirmationForm","jsxs","classes","Header","InLineAlert","Form","InputPassword","Field","Checkbox","Button"],"mappings":"g8BA8BA,MAAMA,GAA6B,CACjCC,EACAC,IAEKA,GAAA,MAAAA,EAAe,OAEbD,EAAO,IAAKE,GAAO,OACxB,MAAMC,GAAeC,EAAAH,EAAc,KACjC,CAAC,CAAE,KAAAI,CAAA,IAAuCA,IAASH,EAAG,IAAA,IADnC,YAAAE,EAElB,aAEH,OAAOD,EAAe,CAAE,GAAGD,EAAI,aAAAC,GAAiBD,CAClD,CAAC,EARkCF,EAWxBM,GAAuB,CAAC,CACnC,sBAAAC,EACA,2BAAAC,EACA,YAAAC,CACF,IAAiC,CAC/B,KAAM,CAACC,EAAmBC,CAAoB,EAAIC,EAEhD,CAAA,CAAE,EAEJ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1 @@
1
- {"version":3,"file":"SkeletonLoader.js","sources":["/@dropins/storefront-auth/src/components/SkeletonLoader/Skeletons/SignUpSkeleton.tsx","/@dropins/storefront-auth/src/components/SkeletonLoader/Skeletons/SignInSkeleton.tsx","/@dropins/storefront-auth/src/components/SkeletonLoader/Skeletons/ResetPasswordSkeleton.tsx","/@dropins/storefront-auth/src/components/SkeletonLoader/SkeletonLoader.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 { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\n\nexport const SignUpSkeleton = () => {\n return (\n <Skeleton>\n <SkeletonRow\n variant=\"heading\"\n size=\"xlarge\"\n fullWidth={false}\n lines={1}\n />\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n <SkeletonRow\n variant=\"heading\"\n size=\"medium\"\n fullWidth={false}\n lines={1}\n />\n <SkeletonRow\n variant=\"heading\"\n size=\"medium\"\n fullWidth={false}\n lines={1}\n />{' '}\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n <SkeletonRow variant=\"heading\" size=\"medium\" fullWidth={true} lines={1} />\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n <SkeletonRow\n variant=\"heading\"\n size=\"medium\"\n fullWidth={false}\n lines={1}\n />\n <SkeletonRow\n variant=\"heading\"\n size=\"medium\"\n fullWidth={false}\n lines={1}\n />\n </Skeleton>\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 { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\n\nexport const SignInSkeleton = () => {\n return (\n <Skeleton>\n <SkeletonRow\n variant=\"heading\"\n size=\"xlarge\"\n fullWidth={false}\n lines={1}\n />\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n <SkeletonRow\n variant=\"heading\"\n size=\"medium\"\n fullWidth={false}\n lines={1}\n />{' '}\n <SkeletonRow\n variant=\"heading\"\n size=\"medium\"\n fullWidth={false}\n lines={1}\n />\n </Skeleton>\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 { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\n\nexport const ResetPasswordSkeleton = () => {\n return (\n <Skeleton>\n <SkeletonRow\n variant=\"heading\"\n size=\"xlarge\"\n fullWidth={false}\n lines={1}\n />\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n <SkeletonRow\n variant=\"heading\"\n size=\"medium\"\n fullWidth={false}\n lines={1}\n />{' '}\n <SkeletonRow\n variant=\"heading\"\n size=\"medium\"\n fullWidth={false}\n lines={1}\n />\n </Skeleton>\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 { useMemo } from 'preact/hooks';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { SkeletonLoaderProps } from '@/auth/types';\nimport {\n SignUpSkeleton,\n SignInSkeleton,\n ResetPasswordSkeleton,\n} from './Skeletons';\n\nexport const SkeletonLoader: Container<SkeletonLoaderProps> = ({\n activeSkeleton,\n}) => {\n const renderSkeleton = useMemo(\n () => ({\n signInForm: <SignInSkeleton />,\n signUpForm: <SignUpSkeleton />,\n resetPasswordForm: <ResetPasswordSkeleton />,\n }),\n []\n );\n\n return <>{renderSkeleton[activeSkeleton]}</>;\n};\n"],"names":["SignUpSkeleton","Skeleton","jsx","SkeletonRow","SignInSkeleton","ResetPasswordSkeleton","SkeletonLoader","activeSkeleton","renderSkeleton","useMemo","Fragment"],"mappings":"qNAmBO,MAAMA,EAAiB,MAEzBC,EACC,CAAA,SAAA,CAAAC,EAACC,EAAA,CACC,QAAQ,UACR,KAAK,SACL,UAAW,GACX,MAAO,CAAA,CACT,EACAD,EAACC,GAAY,QAAQ,UAAU,KAAK,SAAS,UAAW,GAAM,MAAO,CAAG,CAAA,EACxED,EAACC,EAAA,CACC,QAAQ,UACR,KAAK,SACL,UAAW,GACX,MAAO,CAAA,CACT,EACAD,EAACC,EAA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AU,KAAK,SAAS,UAAW,GAAM,MAAO,CAAG,CAAA,EACxED,EAACC,EAAA,CACC,QAAQ,UACR,KAAK,SACL,UAAW,GACX,MAAO,CAAA,CACT,EAAG,IACHD,EAACC,EAAA,CACC,QAAQ,UACR,KAAK,SACL,UAAW,GACX,MAAO,CAAA,CAAA,CACT,EACF,EChBSG,EAAiD,CAAC,CAC7D,eAAAC,CACF,IAAM,CACJ,MAAMC,EAAiBC,EACrB,KAAO,CACL,aAAaL,EAAe,EAAA,EAC5B,aAAaJ,EAAe,EAAA,EAC5B,oBAAoBK,EAAsB,CAAA,CAAA,CAAA,GAE5C,CAAA,CACF,EAEO,OAAAH,EAAAQ,EAAA,CAAG,SAAeF,EAAAD,CAAc,EAAE,CAC3C"}
1
+ {"version":3,"file":"SkeletonLoader.js","sources":["/@dropins/storefront-auth/src/components/SkeletonLoader/Skeletons/SignUpSkeleton.tsx","/@dropins/storefront-auth/src/components/SkeletonLoader/Skeletons/SignInSkeleton.tsx","/@dropins/storefront-auth/src/components/SkeletonLoader/Skeletons/ResetPasswordSkeleton.tsx","/@dropins/storefront-auth/src/components/SkeletonLoader/SkeletonLoader.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 { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\n\nexport const SignUpSkeleton = () => {\n return (\n <Skeleton>\n <SkeletonRow\n variant=\"heading\"\n size=\"xlarge\"\n fullWidth={false}\n lines={1}\n />\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n <SkeletonRow\n variant=\"heading\"\n size=\"medium\"\n fullWidth={false}\n lines={1}\n />\n <SkeletonRow\n variant=\"heading\"\n size=\"medium\"\n fullWidth={false}\n lines={1}\n />{' '}\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n <SkeletonRow variant=\"heading\" size=\"medium\" fullWidth={true} lines={1} />\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n <SkeletonRow\n variant=\"heading\"\n size=\"medium\"\n fullWidth={false}\n lines={1}\n />\n <SkeletonRow\n variant=\"heading\"\n size=\"medium\"\n fullWidth={false}\n lines={1}\n />\n </Skeleton>\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 { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\n\nexport const SignInSkeleton = () => {\n return (\n <Skeleton>\n <SkeletonRow\n variant=\"heading\"\n size=\"xlarge\"\n fullWidth={false}\n lines={1}\n />\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n <SkeletonRow\n variant=\"heading\"\n size=\"medium\"\n fullWidth={false}\n lines={1}\n />{' '}\n <SkeletonRow\n variant=\"heading\"\n size=\"medium\"\n fullWidth={false}\n lines={1}\n />\n </Skeleton>\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 { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\n\nexport const ResetPasswordSkeleton = () => {\n return (\n <Skeleton>\n <SkeletonRow\n variant=\"heading\"\n size=\"xlarge\"\n fullWidth={false}\n lines={1}\n />\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n <SkeletonRow\n variant=\"heading\"\n size=\"medium\"\n fullWidth={false}\n lines={1}\n />{' '}\n <SkeletonRow\n variant=\"heading\"\n size=\"medium\"\n fullWidth={false}\n lines={1}\n />\n </Skeleton>\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 { useMemo } from 'preact/hooks';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { SkeletonLoaderProps } from '@/auth/types';\nimport {\n SignUpSkeleton,\n SignInSkeleton,\n ResetPasswordSkeleton,\n} from './Skeletons';\n\nexport const SkeletonLoader: Container<SkeletonLoaderProps> = ({\n activeSkeleton,\n}) => {\n const renderSkeleton = useMemo(\n () => ({\n signInForm: <SignInSkeleton />,\n signUpForm: <SignUpSkeleton />,\n resetPasswordForm: <ResetPasswordSkeleton />,\n }),\n []\n );\n\n return <>{renderSkeleton[activeSkeleton]}</>;\n};\n"],"names":["SignUpSkeleton","Skeleton","jsx","SkeletonRow","SignInSkeleton","ResetPasswordSkeleton","SkeletonLoader","activeSkeleton","renderSkeleton","useMemo","Fragment"],"mappings":"qNAmBO,MAAMA,EAAiB,MAEzBC,EAAA,CACC,SAAA,CAAAC,EAACC,EAAA,CACC,QAAQ,UACR,KAAK,SACL,UAAW,GACX,MAAO,CAAA,CAAA,EAETD,EAACC,GAAY,QAAQ,UAAU,KAAK,SAAS,UAAW,GAAM,MAAO,CAAA,CAAG,EACxED,EAACC,EAAA,CACC,QAAQ,UACR,KAAK,SACL,UAAW,GACX,MAAO,CAAA,CAAA,EAETD,EAACC,EAAA,CACC,QAAQ,UACR,KAAK,SACL,UAAW,GACX,MAAO,CAAA,CAAA,EACN,IACHD,EAACC,GAAY,QAAQ,UAAU,KAAK,SAAS,UAAW,GAAM,MAAO,CAAA,CAAG,EACxED,EAACC,GAAY,QAAQ,UAAU,KAAK,SAAS,UAAW,GAAM,MAAO,CAAA,CAAG,EACxED,EAACC,GAAY,QAAQ,UAAU,KAAK,SAAS,UAAW,GAAM,MAAO,CAAA,CAAG,EACxED,EAACC,GAAY,QAAQ,UAAU,KAAK,SAAS,UAAW,GAAM,MAAO,CAAA,CAAG,EACxED,EAACC,GAAY,QAAQ,UAAU,KAAK,SAAS,UAAW,GAAM,MAAO,CAAA,CAAG,EACxED,EAACC,EAAA,CACC,QAAQ,UACR,KAAK,SACL,UAAW,GACX,MAAO,CAAA,CAAA,EAETD,EAACC,EAAA,CACC,QAAQ,UACR,KAAK,SACL,UAAW,GACX,MAAO,CAAA,CAAA,CACT,EACF,ECvCSC,EAAiB,MAEzBH,EAAA,CACC,SAAA,CAAAC,EAACC,EAAA,CACC,QAAQ,UACR,KAAK,SACL,UAAW,GACX,MAAO,CAAA,CAAA,EAETD,EAACC,GAAY,QAAQ,UAAU,KAAK,SAAS,UAAW,GAAM,MAAO,CAAA,CAAG,EACxED,EAACC,GAAY,QAAQ,UAAU,KAAK,SAAS,UAAW,GAAM,MAAO,CAAA,CAAG,EACxED,EAACC,EAAA,CACC,QAAQ,UACR,KAAK,SACL,UAAW,GACX,MAAO,CAAA,CAAA,EACN,IACHD,EAACC,EAAA,CACC,QAAQ,UACR,KAAK,SACL,UAAW,GACX,MAAO,CAAA,CAAA,CACT,EACF,ECvBSE,EAAwB,MAEhCJ,EAAA,CACC,SAAA,CAAAC,EAACC,EAAA,CACC,QAAQ,UACR,KAAK,SACL,UAAW,GACX,MAAO,CAAA,CAAA,EAETD,EAACC,GAAY,QAAQ,UAAU,KAAK,SAAS,UAAW,GAAM,MAAO,CAAA,CAAG,EACxED,EAACC,GAAY,QAAQ,UAAU,KAAK,SAAS,UAAW,GAAM,MAAO,CAAA,CAAG,EACxED,EAACC,EAAA,CACC,QAAQ,UACR,KAAK,SACL,UAAW,GACX,MAAO,CAAA,CAAA,EACN,IACHD,EAACC,EAAA,CACC,QAAQ,UACR,KAAK,SACL,UAAW,GACX,MAAO,CAAA,CAAA,CACT,EACF,EChBSG,EAAiD,CAAC,CAC7D,eAAAC,CACF,IAAM,CACJ,MAAMC,EAAiBC,EACrB,KAAO,CACL,aAAaL,EAAA,EAAe,EAC5B,aAAaJ,EAAA,EAAe,EAC5B,oBAAoBK,EAAA,CAAA,CAAsB,CAAA,GAE5C,CAAA,CAAC,EAGH,OAAOH,EAAAQ,EAAA,CAAG,SAAAF,EAAeD,CAAc,EAAE,CAC3C"}
@@ -1 +1 @@
1
- {"version":3,"file":"acdl.js","sources":["/@dropins/storefront-auth/src/data/transforms/transform-auth.ts","/@dropins/storefront-auth/src/lib/acdl.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { AccountModel, CustomerModel } from '@/auth/data/models';\n\n/**\n * References:\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/signInAEP.ts\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/createAccountAEP.ts\n */\nexport const transformAccount = (data: CustomerModel): AccountModel => {\n return {\n firstName: data.firstName,\n lastName: data.lastName,\n emailAddress: data?.email || '',\n accountId: data?.email || '',\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { transformAccount } from '../data/transforms';\n\nconst ACCOUNT_CONTEXT = 'accountContext';\nconst CHANNEL_CONTEXT = 'channelContext';\n\nenum EventsList {\n CREATE_ACCOUNT_EVENT = 'create-account',\n SIGN_IN = 'sign-in',\n SIGN_OUT = 'sign-out',\n}\n\nconst events = {\n // Reference - https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/createAccountAEP.ts\n CREATE_ACCOUNT: EventsList.CREATE_ACCOUNT_EVENT,\n // Reference - https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/signInAEP.ts\n SIGN_IN: EventsList.SIGN_IN,\n // Reference - https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/signOutAEP.ts\n SIGN_OUT: EventsList.SIGN_OUT,\n};\n\nexport function getAdobeDataLayer() {\n // @ts-ignore\n window.adobeDataLayer = window.adobeDataLayer || [];\n // @ts-ignore\n return window.adobeDataLayer;\n}\n\n/**\n * Sets a context in the Adobe Client Data Layer (ACDL)\n * Logic based on: https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-sdk/src/Base.ts#L6\n */\nfunction setContext(name: string, data: any) {\n const adobeDataLayer = getAdobeDataLayer();\n\n // Clear existing context\n adobeDataLayer.push({\n [name]: null,\n });\n\n // Set new context\n adobeDataLayer.push({\n [name]: data,\n });\n}\n\n/**\n * Sets channel context for AEP events\n */\nfunction setChannelContext() {\n const channelData = {\n _id: 'https://ns.adobe.com/xdm/channels/web',\n _type: 'https://ns.adobe.com/xdm/channel-types/web',\n };\n\n setContext(CHANNEL_CONTEXT, channelData);\n}\n\n/**\n * Pushes an event to the Adobe Client Data Layer (ACDL)\n * Logic based on: https://github.com/adobe/commerce-events/blob/1973d0ce28471ef190fa06dad6359ffa0ab51db6/packages/storefront-events-sdk/src/Base.ts#L34\n */\nfunction pushEvent(event: string, additionalContext?: any) {\n const adobeDataLayer = getAdobeDataLayer();\n\n adobeDataLayer.push((acdl: any) => {\n const state = acdl.getState ? acdl.getState() : {};\n\n acdl.push({\n event,\n eventInfo: {\n ...state,\n ...additionalContext,\n },\n });\n });\n}\n\n/**\n * References:\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/createAccountAEP.ts\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/utils/aep/account.ts\n */\nfunction createAccountEvent(eventData: any) {\n const accountData = transformAccount(eventData);\n\n setContext(ACCOUNT_CONTEXT, accountData);\n\n pushEvent(events.CREATE_ACCOUNT);\n}\n\n/**\n * References:\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/signInAEP.ts\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/utils/aep/account.ts\n */\nfunction loginEvent(eventData: any) {\n const accountData = transformAccount(eventData);\n\n setContext(ACCOUNT_CONTEXT, accountData);\n\n pushEvent(events.SIGN_IN);\n}\n\n/**\n * Based on storefront-events-collector - sign out event should not contain accountContext\n * Reference - https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/signOutAEP.ts\n */\nfunction logoutEvent() {\n pushEvent(events.SIGN_OUT);\n}\n\nconst publishEvents = (eventType: string, eventParams: any) => {\n const storeConfigRaw = sessionStorage.getItem('storeConfig');\n const storeConfig = storeConfigRaw ? JSON.parse(storeConfigRaw) : {};\n\n const eventData = { ...storeConfig, ...eventParams };\n\n setChannelContext();\n\n switch (eventType) {\n case EventsList.CREATE_ACCOUNT_EVENT:\n createAccountEvent(eventData);\n break;\n\n case EventsList.SIGN_IN:\n loginEvent(eventData);\n break;\n\n case EventsList.SIGN_OUT:\n logoutEvent();\n break;\n\n default:\n return null;\n }\n};\n\nexport { EventsList, publishEvents, pushEvent };\n"],"names":["transformAccount","data","ACCOUNT_CONTEXT","CHANNEL_CONTEXT","EventsList","events","getAdobeDataLayer","setContext","name","adobeDataLayer","setChannelContext","pushEvent","event","additionalContext","acdl","state","createAccountEvent","eventData","accountData","loginEvent","logoutEvent","publishEvents","eventType","eventParams","storeConfigRaw"],"mappings":"AAwBa,MAAAA,EAAoBC,IACxB,CACL,UAAWA,EAAK,UAChB,SAAUA,EAAK,SACf,cAAcA,GAAA,YAAAA,EAAM,QAAS,GAC7B,WAAWA,GAAA,YAAAA,EAAM,QAAS,EAC5B,GCXIC,EAAkB,iBAClBC,EAAkB,iBAEnB,IAAAC,GAAAA,IACHA,EAAA,qBAAuB,iBACvBA,EAAA,QAAU,UACVA,EAAA,SAAW,WAHRA,IAAAA,GAAA,CAAA,CAAA,EAML,MAAMC,EAAS,CAEb,eAAgB,iBAEhB,QAAS,UAET,SAAU,UACZ,EAEO,SAASC,GAAoB,CAE3B,cAAA,eAAiB,OAAO,gBAAkB,CAAC,EAE3C,OAAO,cAChB,CAMA,SAASC,EAAWC,EAAcP,EAAW,CAC3C,MAAMQ,EAAiBH,EAAkB,EAGzCG,EAAe,KAAK,CAClB,CAACD,CAAI,EAAG,IAAA,CACT,EAGDC,EAAe,KAAK,CAClB,CAACD,CAAI,EAAGP,CAAA,CACT,CACH,CAKA,SAASS,GAAoB,CAM3BH,EAAWJ,EALS,CAClB,IAAK,wCACL,MAAO,4CACT,CAEuC,CACzC,CAMA,SAASQ,EAAUC,EAAeC,EAAyB,CAClCP,EAAkB,EAE1B,KAAMQ,GAAc,CACjC,MAAMC,EAAQD,EAAK,SAAWA,EAAK,WAAa,CAAC,EAEjDA,EAAK,KAAK,CACR,MAAAF,EACA,UAAW,CACT,GAAGG,EACH,GAAGF,CAAA,CACL,CACD,CAAA,CACF,CACH,CAOA,SAASG,EAAmBC,EAAgB,CACpC,MAAAC,EAAclB,EAAiBiB,CAAS,EAE9CV,EAAWL,EAAiBgB,CAAW,EAEvCP,EAAUN,EAAO,cAAc,CACjC,CAOA,SAASc,EAAWF,EAAgB,CAC5B,MAAAC,EAAclB,EAAiBiB,CAAS,EAE9CV,EAAWL,EAAiBgB,CAAW,EAEvCP,EAAUN,EAAO,OAAO,CAC1B,CAMA,SAASe,GAAc,CACrBT,EAAUN,EAAO,QAAQ,CAC3B,CAEM,MAAAgB,EAAgB,CAACC,EAAmBC,IAAqB,CACvD,MAAAC,EAAiB,eAAe,QAAQ,aAAa,EAGrDP,EAAY,CAAE,GAFAO,EAAiB,KAAK,MAAMA,CAAc,EAAI,CAAC,EAE/B,GAAGD,CAAY,EAInD,OAFkBb,EAAA,EAEVY,EAAW,CACjB,IAAK,iBACHN,EAAmBC,CAAS,EAC5B,MAEF,IAAK,UACHE,EAAWF,CAAS,EACpB,MAEF,IAAK,WACSG,EAAA,EACZ,MAEF,QACS,OAAA,IAAA,CAEb"}
1
+ {"version":3,"file":"acdl.js","sources":["/@dropins/storefront-auth/src/data/transforms/transform-auth.ts","/@dropins/storefront-auth/src/lib/acdl.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { AccountModel, CustomerModel } from '@/auth/data/models';\n\n/**\n * References:\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/signInAEP.ts\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/createAccountAEP.ts\n */\nexport const transformAccount = (data: CustomerModel): AccountModel => {\n return {\n firstName: data.firstName,\n lastName: data.lastName,\n emailAddress: data?.email || '',\n accountId: data?.email || '',\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { transformAccount } from '../data/transforms';\n\nconst ACCOUNT_CONTEXT = 'accountContext';\nconst CHANNEL_CONTEXT = 'channelContext';\n\nenum EventsList {\n CREATE_ACCOUNT_EVENT = 'create-account',\n SIGN_IN = 'sign-in',\n SIGN_OUT = 'sign-out',\n}\n\nconst events = {\n // Reference - https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/createAccountAEP.ts\n CREATE_ACCOUNT: EventsList.CREATE_ACCOUNT_EVENT,\n // Reference - https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/signInAEP.ts\n SIGN_IN: EventsList.SIGN_IN,\n // Reference - https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/signOutAEP.ts\n SIGN_OUT: EventsList.SIGN_OUT,\n};\n\nexport function getAdobeDataLayer() {\n // @ts-ignore\n window.adobeDataLayer = window.adobeDataLayer || [];\n // @ts-ignore\n return window.adobeDataLayer;\n}\n\n/**\n * Sets a context in the Adobe Client Data Layer (ACDL)\n * Logic based on: https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-sdk/src/Base.ts#L6\n */\nfunction setContext(name: string, data: any) {\n const adobeDataLayer = getAdobeDataLayer();\n\n // Clear existing context\n adobeDataLayer.push({\n [name]: null,\n });\n\n // Set new context\n adobeDataLayer.push({\n [name]: data,\n });\n}\n\n/**\n * Sets channel context for AEP events\n */\nfunction setChannelContext() {\n const channelData = {\n _id: 'https://ns.adobe.com/xdm/channels/web',\n _type: 'https://ns.adobe.com/xdm/channel-types/web',\n };\n\n setContext(CHANNEL_CONTEXT, channelData);\n}\n\n/**\n * Pushes an event to the Adobe Client Data Layer (ACDL)\n * Logic based on: https://github.com/adobe/commerce-events/blob/1973d0ce28471ef190fa06dad6359ffa0ab51db6/packages/storefront-events-sdk/src/Base.ts#L34\n */\nfunction pushEvent(event: string, additionalContext?: any) {\n const adobeDataLayer = getAdobeDataLayer();\n\n adobeDataLayer.push((acdl: any) => {\n const state = acdl.getState ? acdl.getState() : {};\n\n acdl.push({\n event,\n eventInfo: {\n ...state,\n ...additionalContext,\n },\n });\n });\n}\n\n/**\n * References:\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/createAccountAEP.ts\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/utils/aep/account.ts\n */\nfunction createAccountEvent(eventData: any) {\n const accountData = transformAccount(eventData);\n\n setContext(ACCOUNT_CONTEXT, accountData);\n\n pushEvent(events.CREATE_ACCOUNT);\n}\n\n/**\n * References:\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/signInAEP.ts\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/utils/aep/account.ts\n */\nfunction loginEvent(eventData: any) {\n const accountData = transformAccount(eventData);\n\n setContext(ACCOUNT_CONTEXT, accountData);\n\n pushEvent(events.SIGN_IN);\n}\n\n/**\n * Based on storefront-events-collector - sign out event should not contain accountContext\n * Reference - https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/signOutAEP.ts\n */\nfunction logoutEvent() {\n pushEvent(events.SIGN_OUT);\n}\n\nconst publishEvents = (eventType: string, eventParams: any) => {\n const storeConfigRaw = sessionStorage.getItem('storeConfig');\n const storeConfig = storeConfigRaw ? JSON.parse(storeConfigRaw) : {};\n\n const eventData = { ...storeConfig, ...eventParams };\n\n setChannelContext();\n\n switch (eventType) {\n case EventsList.CREATE_ACCOUNT_EVENT:\n createAccountEvent(eventData);\n break;\n\n case EventsList.SIGN_IN:\n loginEvent(eventData);\n break;\n\n case EventsList.SIGN_OUT:\n logoutEvent();\n break;\n\n default:\n return null;\n }\n};\n\nexport { EventsList, publishEvents, pushEvent };\n"],"names":["transformAccount","data","ACCOUNT_CONTEXT","CHANNEL_CONTEXT","EventsList","events","getAdobeDataLayer","setContext","name","adobeDataLayer","setChannelContext","pushEvent","event","additionalContext","acdl","state","createAccountEvent","eventData","accountData","loginEvent","logoutEvent","publishEvents","eventType","eventParams","storeConfigRaw"],"mappings":"AAwBO,MAAMA,EAAoBC,IACxB,CACL,UAAWA,EAAK,UAChB,SAAUA,EAAK,SACf,cAAcA,GAAA,YAAAA,EAAM,QAAS,GAC7B,WAAWA,GAAA,YAAAA,EAAM,QAAS,EAAA,GCVxBC,EAAkB,iBAClBC,EAAkB,iBAExB,IAAKC,GAAAA,IACHA,EAAA,qBAAuB,iBACvBA,EAAA,QAAU,UACVA,EAAA,SAAW,WAHRA,IAAAA,GAAA,CAAA,CAAA,EAML,MAAMC,EAAS,CAEb,eAAgB,iBAEhB,QAAS,UAET,SAAU,UACZ,EAEO,SAASC,GAAoB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irmEmail.js","sources":["/@dropins/storefront-auth/src/api/confirmEmail/graphql/confirmEmail.graphql.ts","/@dropins/storefront-auth/src/api/confirmEmail/confirmEmail.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const CONFIRM_EMAIL = /* GraphQL */ `\n mutation CONFIRM_EMAIL($email: String!, $confirmation_key: String!) {\n confirmEmail(\n input: { email: $email, confirmation_key: $confirmation_key }\n ) {\n customer {\n email\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { confirmEmailResponse, confirmEmailProps } from '@/auth/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { CONFIRM_EMAIL } from './graphql/confirmEmail.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\n\nexport const confirmEmail = async ({\n customerEmail,\n customerConfirmationKey,\n}: confirmEmailProps): Promise<confirmEmailResponse | undefined> => {\n return await fetchGraphQl(CONFIRM_EMAIL, {\n method: 'POST',\n variables: {\n email: customerEmail,\n confirmation_key: customerConfirmationKey,\n },\n }).catch(handleNetworkError);\n};\n"],"names":["CONFIRM_EMAIL","confirmEmail","customerEmail","customerConfirmationKey","fetchGraphQl","handleNetworkError"],"mappings":"8CAiBa,MAAAA,EAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECK9BC,EAAe,MAAO,CACjC,cAAAC,EACA,wBAAAC,CACF,IACS,MAAMC,EAAaJ,EAAe,CACvC,OAAQ,OACR,UAAW,CACT,MAAOE,EACP,iBAAkBC,CAAA,CACpB,CACD,EAAE,MAAME,CAAkB"}
1
+ {"version":3,"file":"confirmEmail.js","sources":["/@dropins/storefront-auth/src/api/confirmEmail/graphql/confirmEmail.graphql.ts","/@dropins/storefront-auth/src/api/confirmEmail/confirmEmail.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const CONFIRM_EMAIL = /* GraphQL */ `\n mutation CONFIRM_EMAIL($email: String!, $confirmation_key: String!) {\n confirmEmail(\n input: { email: $email, confirmation_key: $confirmation_key }\n ) {\n customer {\n email\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { confirmEmailResponse, confirmEmailProps } from '@/auth/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { CONFIRM_EMAIL } from './graphql/confirmEmail.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\n\nexport const confirmEmail = async ({\n customerEmail,\n customerConfirmationKey,\n}: confirmEmailProps): Promise<confirmEmailResponse | undefined> => {\n return await fetchGraphQl(CONFIRM_EMAIL, {\n method: 'POST',\n variables: {\n email: customerEmail,\n confirmation_key: customerConfirmationKey,\n },\n }).catch(handleNetworkError);\n};\n"],"names":["CONFIRM_EMAIL","confirmEmail","customerEmail","customerConfirmationKey","fetchGraphQl","handleNetworkError"],"mappings":"8CAiBO,MAAMA,EAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECK9BC,EAAe,MAAO,CACjC,cAAAC,EACA,wBAAAC,CACF,IACS,MAAMC,EAAaJ,EAAe,CACvC,OAAQ,OACR,UAAW,CACT,MAAOE,EACP,iBAAkBC,CAAA,CACpB,CACD,EAAE,MAAME,CAAkB"}
@@ -1 +1 @@
1
- {"version":3,"file":"createCustomerAddress.js","sources":["/@dropins/storefront-auth/src/api/createCustomer/graphql/createCustomer.graphql.ts","/@dropins/storefront-auth/src/api/createCustomer/graphql/createCustomerV2.graphql.ts","/@dropins/storefront-auth/src/data/transforms/transform-create-customer.tsx","/@dropins/storefront-auth/src/lib/transformDobForm.ts","/@dropins/storefront-auth/src/api/createCustomer/createCustomer.ts","/@dropins/storefront-auth/src/api/getAttributesForm/graphql/getAttributesForm.graphql.ts","/@dropins/storefront-auth/src/api/getAttributesForm/getAttributesForm.ts","/@dropins/storefront-auth/src/api/createCustomerAddress/graphql/createCustomerAddress.graphql.ts","/@dropins/storefront-auth/src/api/createCustomerAddress/createCustomerAddress.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CUSTOMER_INFORMATION_FRAGMENT } from '@/auth/api/fragments';\n\nexport const CREATE_CUSTOMER = /* GraphQL */ `\n mutation CREATE_CUSTOMER($input: CustomerInput!) {\n createCustomer(input: $input) {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n }\n ${CUSTOMER_INFORMATION_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CUSTOMER_INFORMATION_FRAGMENT } from '@/auth/api/fragments';\n\nexport const CREATE_CUSTOMER_V2 = /* GraphQL */ `\n mutation CREATE_CUSTOMER_V2($input: CustomerCreateInput!) {\n createCustomerV2(input: $input) {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n }\n ${CUSTOMER_INFORMATION_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { DataCreateCustomerV2, DataCreateCustomer } from '@/auth/types';\nimport { config } from '@/auth/api';\nimport { merge } from '@adobe-commerce/elsie/lib';\nimport { CustomerModel } from '../models';\n\ntype ApiResponse<T extends boolean> = T extends true\n ? DataCreateCustomerV2\n : DataCreateCustomer;\n\nexport const transformCreateCustomer = <T extends boolean>(\n response: ApiResponse<T>,\n apiVersion2: T\n): CustomerModel => {\n let model: CustomerModel;\n\n if (apiVersion2) {\n const { data } = response as DataCreateCustomerV2;\n\n model = {\n firstName: data?.createCustomerV2?.customer?.firstname ?? '',\n lastName: data?.createCustomerV2?.customer?.lastname ?? '',\n email: data?.createCustomerV2?.customer?.email ?? '',\n customAttributes: data?.createCustomerV2?.custom_attributes ?? [],\n errors: response?.errors ?? [],\n };\n } else {\n const { data } = response as DataCreateCustomer;\n\n model = {\n firstName: data?.createCustomer?.customer?.firstname ?? '',\n lastName: data?.createCustomer?.customer?.lastname ?? '',\n email: data?.createCustomer?.customer?.email ?? '',\n errors: response?.errors ?? [],\n };\n }\n\n return merge(\n model, // default transformer\n config.getConfig().models?.CustomerModel?.transformer?.(response) // custom transformer\n );\n};\n","export const transformDobForm = (\n form: Record<string, any>\n): Record<string, any> => {\n if (!form.dob) return form;\n\n const { dob, ...rest } = form;\n return { ...rest, date_of_birth: dob };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Customer } from '@/auth/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { CREATE_CUSTOMER } from './graphql/createCustomer.graphql';\nimport { CREATE_CUSTOMER_V2 } from './graphql/createCustomerV2.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { setReCaptchaToken } from '@/auth/lib/setReCaptchaToken';\nimport { transformCreateCustomer } from '@/auth/data/transforms';\nimport { CustomerModel } from '@/auth/data/models';\nimport { transformDobForm } from '@/auth/lib/transformDobForm';\n\nexport const createCustomer = async (\n forms: Customer,\n apiVersion2: boolean\n): Promise<CustomerModel> => {\n await setReCaptchaToken();\n\n const response = await fetchGraphQl(\n apiVersion2 ? CREATE_CUSTOMER_V2 : CREATE_CUSTOMER,\n {\n method: 'POST',\n variables: {\n input: {\n ...transformDobForm(forms),\n },\n },\n }\n ).catch(handleNetworkError);\n\n return transformCreateCustomer(response, apiVersion2);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_ATTRIBUTES_FORM = /* GraphQL */ `\n query GET_ATTRIBUTES_FORM($formCode: String!) {\n attributesForm(formCode: $formCode) {\n items {\n code\n default_value\n entity_type\n frontend_class\n frontend_input\n is_required\n is_unique\n label\n options {\n is_default\n label\n value\n }\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n validate_rules {\n name\n value\n }\n }\n }\n errors {\n type\n message\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { GET_ATTRIBUTES_FORM } from './graphql/getAttributesForm.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { transformAttributesForm } from '@/auth/data/transforms';\nimport { handleFetchError } from '@/auth/lib/fetch-error';\nimport { AttributesFormModel } from '@/auth/data/models';\nimport { GetAttributesFormResponse } from '@/auth/types';\n\nexport const getAttributesForm = async (\n formCode: string\n): Promise<AttributesFormModel[]> => {\n return await fetchGraphQl(GET_ATTRIBUTES_FORM, {\n method: 'GET',\n cache: 'force-cache',\n variables: { formCode },\n })\n .then((response: GetAttributesFormResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return transformAttributesForm(response);\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const CREATE_CUSTOMER_ADDRESS = /* GraphQL */ `\n mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {\n createCustomerAddress(input: $input) {\n firstname\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { AddressFormProps, CreateCustomerAddressResponse } from '@/auth/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { CREATE_CUSTOMER_ADDRESS } from './graphql/createCustomerAddress.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { handleFetchError } from '@/auth/lib/fetch-error';\n\nexport const createCustomerAddress = async (\n address: AddressFormProps\n): Promise<string> => {\n return await fetchGraphQl(CREATE_CUSTOMER_ADDRESS, {\n method: 'POST',\n variables: {\n input: address,\n },\n })\n .then((response: CreateCustomerAddressResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response.data.createCustomerAddress.firstname || '';\n })\n .catch(handleNetworkError);\n};\n"],"names":["CREATE_CUSTOMER","CUSTOMER_INFORMATION_FRAGMENT","CREATE_CUSTOMER_V2","transformCreateCustomer","response","apiVersion2","model","data","_b","_a","_d","_c","_f","_e","_g","_i","_h","_k","_j","_m","_l","merge","_p","_o","_n","config","transformDobForm","form","dob","rest","createCustomer","forms","setReCaptchaToken","fetchGraphQl","handleNetworkError","GET_ATTRIBUTES_FORM","getAttributesForm","formCode","handleFetchError","transformAttributesForm","CREATE_CUSTOMER_ADDRESS","createCustomerAddress","address"],"mappings":"2YAmBa,MAAAA,EAAgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQzCC,CAA6B;AAAA,ECRpBC,EAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQ5CD,CAA6B;AAAA,ECDpBE,EAA0B,CACrCC,EACAC,IACkB,qCACd,IAAAC,EAEJ,GAAID,EAAa,CACT,KAAA,CAAE,KAAAE,GAASH,EAETE,EAAA,CACN,YAAWE,GAAAC,EAAAF,GAAA,YAAAA,EAAM,mBAAN,YAAAE,EAAwB,WAAxB,YAAAD,EAAkC,YAAa,GAC1D,WAAUE,GAAAC,EAAAJ,GAAA,YAAAA,EAAM,mBAAN,YAAAI,EAAwB,WAAxB,YAAAD,EAAkC,WAAY,GACxD,QAAOE,GAAAC,EAAAN,GAAA,YAAAA,EAAM,mBAAN,YAAAM,EAAwB,WAAxB,YAAAD,EAAkC,QAAS,GAClD,mBAAkBE,EAAAP,GAAA,YAAAA,EAAM,mB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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECQpCC,EAAoB,MAC/BC,GAEO,MAAMJ,EAAaE,EAAqB,CAC7C,OAAQ,MACR,MAAO,cACP,UAAW,CAAE,SAAAE,CAAS,CAAA,CACvB,EACE,KAAMjC,GAAwC,OAC7C,OAAIK,EAAAL,EAAS,SAAT,MAAAK,EAAiB,OAAe6B,EAAiBlC,EAAS,MAAM,EAE7DmC,EAAwBnC,CAAQ,CAAA,CACxC,EACA,MAAM8B,CAAkB,ECrBhBM,EAAwC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECMxCC,EAAwB,MACnCC,GAEO,MAAMT,EAAaO,EAAyB,CACjD,OAAQ,OACR,UAAW,CACT,MAAOE,CAAA,CACT,CACD,EACE,KAAMtC,GAA4C,OACjD,OAAIK,EAAAL,EAAS,SAAT,MAAAK,EAAiB,OAAe6B,EAAiBlC,EAAS,MAAM,EAE7DA,EAAS,KAAK,sBAAsB,WAAa,EAAA,CACzD,EACA,MAAM8B,CAAkB"}
1
+ {"version":3,"file":"createCustomerAddress.js","sources":["/@dropins/storefront-auth/src/api/createCustomer/graphql/createCustomer.graphql.ts","/@dropins/storefront-auth/src/api/createCustomer/graphql/createCustomerV2.graphql.ts","/@dropins/storefront-auth/src/data/transforms/transform-create-customer.tsx","/@dropins/storefront-auth/src/lib/transformDobForm.ts","/@dropins/storefront-auth/src/api/createCustomer/createCustomer.ts","/@dropins/storefront-auth/src/api/getAttributesForm/graphql/getAttributesForm.graphql.ts","/@dropins/storefront-auth/src/api/getAttributesForm/getAttributesForm.ts","/@dropins/storefront-auth/src/api/createCustomerAddress/graphql/createCustomerAddress.graphql.ts","/@dropins/storefront-auth/src/api/createCustomerAddress/createCustomerAddress.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CUSTOMER_INFORMATION_FRAGMENT } from '@/auth/api/fragments';\n\nexport const CREATE_CUSTOMER = /* GraphQL */ `\n mutation CREATE_CUSTOMER($input: CustomerInput!) {\n createCustomer(input: $input) {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n }\n ${CUSTOMER_INFORMATION_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CUSTOMER_INFORMATION_FRAGMENT } from '@/auth/api/fragments';\n\nexport const CREATE_CUSTOMER_V2 = /* GraphQL */ `\n mutation CREATE_CUSTOMER_V2($input: CustomerCreateInput!) {\n createCustomerV2(input: $input) {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n }\n ${CUSTOMER_INFORMATION_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { DataCreateCustomerV2, DataCreateCustomer } from '@/auth/types';\nimport { config } from '@/auth/api';\nimport { merge } from '@adobe-commerce/elsie/lib';\nimport { CustomerModel } from '../models';\n\ntype ApiResponse<T extends boolean> = T extends true\n ? DataCreateCustomerV2\n : DataCreateCustomer;\n\nexport const transformCreateCustomer = <T extends boolean>(\n response: ApiResponse<T>,\n apiVersion2: T\n): CustomerModel => {\n let model: CustomerModel;\n\n if (apiVersion2) {\n const { data } = response as DataCreateCustomerV2;\n\n model = {\n firstName: data?.createCustomerV2?.customer?.firstname ?? '',\n lastName: data?.createCustomerV2?.customer?.lastname ?? '',\n email: data?.createCustomerV2?.customer?.email ?? '',\n customAttributes: data?.createCustomerV2?.custom_attributes ?? [],\n errors: response?.errors ?? [],\n };\n } else {\n const { data } = response as DataCreateCustomer;\n\n model = {\n firstName: data?.createCustomer?.customer?.firstname ?? '',\n lastName: data?.createCustomer?.customer?.lastname ?? '',\n email: data?.createCustomer?.customer?.email ?? '',\n errors: response?.errors ?? [],\n };\n }\n\n return merge(\n model, // default transformer\n config.getConfig().models?.CustomerModel?.transformer?.(response) // custom transformer\n );\n};\n","export const transformDobForm = (\n form: Record<string, any>\n): Record<string, any> => {\n if (!form.dob) return form;\n\n const { dob, ...rest } = form;\n return { ...rest, date_of_birth: dob };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Customer } from '@/auth/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { CREATE_CUSTOMER } from './graphql/createCustomer.graphql';\nimport { CREATE_CUSTOMER_V2 } from './graphql/createCustomerV2.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { setReCaptchaToken } from '@/auth/lib/setReCaptchaToken';\nimport { transformCreateCustomer } from '@/auth/data/transforms';\nimport { CustomerModel } from '@/auth/data/models';\nimport { transformDobForm } from '@/auth/lib/transformDobForm';\n\nexport const createCustomer = async (\n forms: Customer,\n apiVersion2: boolean\n): Promise<CustomerModel> => {\n await setReCaptchaToken();\n\n const response = await fetchGraphQl(\n apiVersion2 ? CREATE_CUSTOMER_V2 : CREATE_CUSTOMER,\n {\n method: 'POST',\n variables: {\n input: {\n ...transformDobForm(forms),\n },\n },\n }\n ).catch(handleNetworkError);\n\n return transformCreateCustomer(response, apiVersion2);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_ATTRIBUTES_FORM = /* GraphQL */ `\n query GET_ATTRIBUTES_FORM($formCode: String!) {\n attributesForm(formCode: $formCode) {\n items {\n code\n default_value\n entity_type\n frontend_class\n frontend_input\n is_required\n is_unique\n label\n options {\n is_default\n label\n value\n }\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n validate_rules {\n name\n value\n }\n }\n }\n errors {\n type\n message\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { GET_ATTRIBUTES_FORM } from './graphql/getAttributesForm.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { transformAttributesForm } from '@/auth/data/transforms';\nimport { handleFetchError } from '@/auth/lib/fetch-error';\nimport { AttributesFormModel } from '@/auth/data/models';\nimport { GetAttributesFormResponse } from '@/auth/types';\n\nexport const getAttributesForm = async (\n formCode: string\n): Promise<AttributesFormModel[]> => {\n return await fetchGraphQl(GET_ATTRIBUTES_FORM, {\n method: 'GET',\n cache: 'force-cache',\n variables: { formCode },\n })\n .then((response: GetAttributesFormResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return transformAttributesForm(response);\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const CREATE_CUSTOMER_ADDRESS = /* GraphQL */ `\n mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {\n createCustomerAddress(input: $input) {\n firstname\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { AddressFormProps, CreateCustomerAddressResponse } from '@/auth/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { CREATE_CUSTOMER_ADDRESS } from './graphql/createCustomerAddress.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { handleFetchError } from '@/auth/lib/fetch-error';\n\nexport const createCustomerAddress = async (\n address: AddressFormProps\n): Promise<string> => {\n return await fetchGraphQl(CREATE_CUSTOMER_ADDRESS, {\n method: 'POST',\n variables: {\n input: address,\n },\n })\n .then((response: CreateCustomerAddressResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response.data.createCustomerAddress.firstname || '';\n })\n .catch(handleNetworkError);\n};\n"],"names":["CREATE_CUSTOMER","CUSTOMER_INFORMATION_FRAGMENT","CREATE_CUSTOMER_V2","transformCreateCustomer","response","apiVersion2","model","data","_b","_a","_d","_c","_f","_e","_g","_i","_h","_k","_j","_m","_l","merge","_p","_o","_n","config","transformDobForm","form","dob","rest","createCustomer","forms","setReCaptchaToken","fetchGraphQl","handleNetworkError","GET_ATTRIBUTES_FORM","getAttributesForm","formCode","handleFetchError","transformAttributesForm","CREATE_CUSTOMER_ADDRESS","createCustomerAddress","address"],"mappings":"2YAmBO,MAAMA,EAAgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQzCC,CAA6B;AAAA,ECRpBC,EAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQ5CD,CAA6B;AAAA,ECDpBE,EAA0B,CACrCC,EACAC,IACkB,qCAClB,IAAIC,EAEJ,GAAID,EAAa,CACf,KAAM,CAAE,KAAAE,GAASH,EAEjBE,EAAQ,CACN,YAAWE,GAAAC,EAAAF,GAAA,YAAAA,EAAM,mBAAN,YAAAE,EAAwB,WAAxB,YAAAD,EAAkC,YAAa,GAC1D,WAAUE,GAAAC,EAAAJ,GAAA,YAAAA,EAAM,mBAAN,YAAAI,EAAwB,WAAxB,YAAAD,EAAkC,WAAY,GACxD,QAAOE,GAAAC,EAAAN,GAAA,YAAAA,EAAM,mBAAN,YAAAM,EAA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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECQpCC,EAAoB,MAC/BC,GAEO,MAAMJ,EAAaE,EAAqB,CAC7C,OAAQ,MACR,MAAO,cACP,UAAW,CAAE,SAAAE,CAAA,CAAS,CACvB,EACE,KAAMjC,GAAwC,OAC7C,OAAIK,EAAAL,EAAS,SAAT,MAAAK,EAAiB,OAAe6B,EAAiBlC,EAAS,MAAM,EAE7DmC,EAAwBnC,CAAQ,CACzC,CAAC,EACA,MAAM8B,CAAkB,ECrBhBM,EAAwC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECMxCC,EAAwB,MACnCC,GAEO,MAAMT,EAAaO,EAAyB,CACjD,OAAQ,OACR,UAAW,CACT,MAAOE,CAAA,CACT,CACD,EACE,KAAMtC,GAA4C,OACjD,OAAIK,EAAAL,EAAS,SAAT,MAAAK,EAAiB,OAAe6B,EAAiBlC,EAAS,MAAM,EAE7DA,EAAS,KAAK,sBAAsB,WAAa,EAC1D,CAAC,EACA,MAAM8B,CAAkB"}
@@ -1 +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,EA6BnD,MAAA,CAAE,wBA3BuBC,EAAY,SAAY,SAGtD,GAFAF,EAAkB,EAAI,EAElBL,EAAW,CACP,MAAAQ,EAAW,MAAMC,EAAwBT,CAAS,EAExD,GAAIQ,EAAU,CACN,MAAAE,GAASC,EAAAH,GAAA,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AE,QAAS,CAAE,EACpB,WAAYvB,EAAa,gBACzB,aAAc,GACd,QAASiB,EACT,SAAUf,CAAA,CACZ,EACCa,EAAkC,KACjCK,EAACG,EAAA,CACC,KAAK,SACL,WAAYvB,EAAa,cACzB,QAAQ,UACR,aAAc,GACd,SAAUE,EACV,QAASc,CAAA,CAAA,CACX,CAEJ,CAAA,CAAA,CAAA,CACF,CAEJ,ECnFaQ,EAA4B,CACvCC,EACAC,EACAC,IACG,CACG,MAAAC,EAAsBH,EAAM,OAA2B,cAC3D,wBACF,EACMI,EACJJ,EAAM,OACN,cAAc,oCAAoC,EAEhDG,GAAsB,CAACF,EAAoB,OAC5CE,EAAwC,MAAM,EACtCC,GAA6B,CAACF,EAAgB,QACtDE,EAA+C,MAAM,CAE1D"}
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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B,CACvCC,EACAC,EACAC,IACG,CACH,MAAMC,EAAsBH,EAAM,OAA2B,cAC3D,wBAAA,EAEII,EACJJ,EAAM,OACN,cAAc,oCAAoC,EAEhDG,GAAsB,CAACF,EAAoB,OAC5CE,EAAwC,MAAA,EAChCC,GAA6B,CAACF,EAAgB,QACtDE,EAA+C,MAAA,CAEpD"}
@@ -7,11 +7,11 @@ import{a as G,f as h,h as $}from"./network-error.js";import"@dropins/tools/recap
7
7
  }
8
8
  }
9
9
  ${C}
10
- `,K=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($)},H=`
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:f,onErrorCallback:o,handleSetInLineAlertProps:i})=>{var r,g,E,_,d;await F();const a=await h(H,{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=f.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 K(c),u=m==null?void 0:m.firstName,s=m==null?void 0:m.email;if(!u||!s){const M=f.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}; `,document.cookie=`${O.auth_dropin_user_token}=${c}; path=/; ${T}; `,w.emit("authenticated",!!c),x((d=y)==null?void 0:d.SIGN_IN,{...m}),{errorMessage:"",userName:u,userEmail:s}};export{V as a,K as g};
16
+ `,V=async({email:t,password:e,translations:f,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=f.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,s=m==null?void 0:m.email;if(!u||!s){const M=f.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:s}};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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AAM,QAAS,KAAMG,IAE5C,CAAE,aAAAA,EAAc,SAAU,GAAI,UAAW,EAAG,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","userName","userEmail","cookiesLifetime","getCookiesLifetime","COOKIE_NAMES","events","publishEvents","EventsList"],"mappings":"4ZAsBO,MAAMA,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,EAAA,EAIlD,OAAOE,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,KAAI,CAE3E,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,UAAA,EAEpCM,EACED,EAAiB,OACjBA,EAAiB,YACb,GAAGA,EAAiB,WAAW,IAAID,CAAU,GAC7CA,CAAA,CAER,CAEA,OAAO,MAAMG,EAAaN,EAAmB,CAC3C,OAAQ,MACR,MAAO,aAAA,CACR,EACE,KAAMf,GACED,EAAsBC,CAAQ,CACtC,EACA,MAAMsB,CAAkB,CAC7B,EC5BaC,EAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECmBnCC,EAAmB,MAAO,CACrC,MAAAC,EACA,SAAAC,EACA,aAAAC,EACA,gBAAAC,EACA,0BAAAC,CACF,IAIM,eAC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I,SAAAC,EAAU,UAAAC,CAAA,CACvC"}
@@ -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":"iKAiCa,MAAAA,EAAa,IAAIC,EAAyB,CACrD,KAAM,MAAOC,GAAW,CAQtB,MAAMC,EAAe,CAAE,GAPD,CACpB,iBAAkB,CAChB,OAAQ,gBACR,YAAa,QAAA,CAEjB,EAEyC,GAAGD,CAAO,EAExCF,EAAA,OAAO,UAAUG,CAAY,EAExCC,EACED,EAAa,iBAAiB,OAC9BA,EAAa,iBAAiB,WAChC,CACF,EAEA,UAAW,IAAM,CAAA,CACnB,CAAC,EAEYD,EAASF,EAAW"}
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"}
@@ -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":"oHAmBa,KAAA,CACX,YAAAA,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAC,EACA,UAAAC,CACF,EAAI,IAAIC,EAAa,EAAE,WAAW,ECHrBC,EAAsBC,GAAiB,CAIlD,MAFEA,aAAiB,cAAgBA,EAAM,OAAS,cAGhDC,EAAO,KAAK,aAAc,CACxB,OAAQ,OACR,KAAM,UACN,MAAAD,CAAA,CACD,EAEGA,CACR"}
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"}