@dropins/storefront-auth 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chunks/Button.js.map +1 -1
- package/chunks/Button2.js.map +1 -1
- package/chunks/ResetPasswordForm.js.map +1 -1
- package/chunks/SignInForm.js.map +1 -1
- package/chunks/SignUpForm.js.map +1 -1
- package/chunks/SkeletonLoader.js.map +1 -1
- package/chunks/acdl.js.map +1 -1
- package/chunks/confirmEmail.js.map +1 -1
- package/chunks/createCustomerAddress.js.map +1 -1
- package/chunks/focusOnEmptyPasswordField.js.map +1 -1
- package/chunks/getCustomerToken.js +2 -2
- package/chunks/getCustomerToken.js.map +1 -1
- package/chunks/initialize.js.map +1 -1
- package/chunks/network-error.js.map +1 -1
- package/chunks/requestPasswordResetEmail.js.map +1 -1
- package/chunks/resendConfirmationEmail.js.map +1 -1
- package/chunks/resetPassword.js.map +1 -1
- package/chunks/revokeCustomerToken.js.map +1 -1
- package/chunks/setReCaptchaToken.js.map +1 -1
- package/chunks/simplifyTransformAttributesForm.js.map +1 -1
- package/chunks/transform-attributes-form.js.map +1 -1
- package/chunks/usePasswordValidationMessage.js.map +1 -1
- package/chunks/verifyToken.js.map +1 -1
- package/containers/AuthCombine.js.map +1 -1
- package/containers/ResetPassword.js.map +1 -1
- package/containers/SignIn.js.map +1 -1
- package/containers/SignUp.js.map +1 -1
- package/containers/SuccessNotification.js.map +1 -1
- package/containers/UpdatePassword.js.map +1 -1
- package/fragments.js.map +1 -1
- package/package.json +1 -1
- package/render.js.map +1 -1
package/chunks/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["/@dropins/storefront-auth/src/types/validationErrors.types.ts","/@dropins/storefront-auth/src/hooks/useCustomTranslations.tsx","/@dropins/storefront-auth/src/lib/validationFields.ts","/@dropins/storefront-auth/src/lib/initializeFormDataAndErrors.ts","/@dropins/storefront-auth/src/configs/excludedFocusClasses.ts","/@dropins/storefront-auth/src/hooks/components/useForm.tsx","/@dropins/storefront-auth/src/data/models/attributes-form.ts","/@dropins/storefront-auth/src/lib/extractErrorKeyAndMessage.tsx","/@dropins/storefront-auth/src/components/Form/Elements/FieldElement.tsx","/@dropins/storefront-auth/src/components/Form/Elements/InputElement.tsx","/@dropins/storefront-auth/src/components/Form/Elements/SelectElement.tsx","/@dropins/storefront-auth/src/components/Form/Elements/InputDateElement.tsx","/@dropins/storefront-auth/src/components/Form/Elements/InputCheckBoxElement.tsx","/@dropins/storefront-auth/src/components/Form/Elements/TextAreaElement.tsx","/@dropins/storefront-auth/src/components/Form/Elements/FormSlot.tsx","/@dropins/storefront-auth/src/components/Form/Form.tsx"],"sourcesContent":["/**\n * Error types in this enum are used to provide custom i18n translations for specific validation errors.\n * Each key corresponds to an error type that maps to the `Auth.FormText` i18n values in `src/i18n/en_US.json`.\n */\nexport enum ValidationErrorTypes {\n REQUIRED_FIELD_ERROR = 'requiredFieldError',\n NUMERIC_ERROR = 'numericError',\n ALPHA_NUM_WITH_SPACES_ERROR = 'alphaNumWithSpacesError',\n ALPHA_NUMERIC_ERROR = 'alphaNumericError',\n ALPHA_ERROR = 'alphaError',\n EMAIL_ERROR = 'emailError',\n DATE_ERROR = 'dateError',\n DATE_RANGE_ERROR = 'dateRangeError',\n DATE_MAX_ERROR = 'dateMaxError',\n DATE_MIN_ERROR = 'dateMinError',\n URL_ERROR = 'urlError',\n LENGTH_TEXT_ERROR = 'lengthTextError',\n}\n\n/**\n * `ERROR_CONFIG_SEPARATOR` uses the ASCII 31 (Unit Separator) character,\n * a rarely used control character, to avoid conflicts with custom i18n error messages.\n *\n * Learn more: https://theasciicode.com.ar/ascii-control-characters/unit-separator-ascii-code-31.html\n */\nexport const ERROR_CONFIG_SEPARATOR = `${String.fromCharCode(\n 31\n)}/${String.fromCharCode(31)}`;\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 { useText } from 'preact-i18n';\nimport { ValidationErrorTypes } from '@/auth/types';\n\n/**\n * A custom hook for handling translations with support for extensible error messages.\n *\n * @param defaultKeys - A mapping of keys to their translation paths.\n * @returns A complete set of translations, including dynamically updated values for null error keys.\n */\nexport const useCustomTranslations = (\n defaultKeys: Record<string, string>\n): Record<string, string> => {\n /**\n * Step 1: Fetch initial translations using the provided keys\n * Translations are fetched from the i18n system based on the provided defaultKeys.\n */\n const translations = useText(defaultKeys);\n\n /**\n * Step 2: Identify keys that require updates\n * - These keys correspond to validation errors (defined in ValidationErrorTypes).\n * - A key needs an update if:\n * 1. Its value in the initial translations is `null`.\n * 2. The key exists in ValidationErrorTypes (indicating it’s a known error type).\n *\n * Null values typically occur when translations for the given error key are not overridden\n * and instead rely on a plain structure, e.g., \"requiredFieldError\": \"This is a required field.\"\n */\n const keysToUpdate = Object.entries(translations)\n .filter(\n ([key, value]) =>\n value === null &&\n (Object.values(ValidationErrorTypes) as string[]).includes(key)\n )\n .map(([key]) => key);\n\n /**\n * Step 3: Prepare paths for fetching updated translations\n * - For each key needing an update, create a path to its extended translation.\n * - Example: For the key \"requiredFieldError\", the updated path would be \"Auth.FormText.requiredFieldError\".\n */\n const translationKeys = keysToUpdate.reduce((acc, key) => {\n acc[key] = `Auth.FormText.${key}`; // Build the updated translation path\n return acc;\n }, {} as Record<string, string>);\n\n // Step 4: Fetch updated translations for the keys identified in Step 2\n const updatedTranslations = useText(translationKeys);\n\n /**\n * Step 5: Merge updated translations back into the initial translations\n * - Replace `null` values with the fetched updated translations.\n * - Preserve all other original translations.\n */\n return {\n ...translations, // Include original translations\n ...keysToUpdate.reduce<Record<string, string>>((acc, key) => {\n acc[key] = updatedTranslations[key]; // Overwrite `null` values with updated translations\n return acc;\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 { ValidationErrorTypes, ERROR_CONFIG_SEPARATOR } from '@/auth/types';\n\n/* eslint-disable no-useless-escape */\ntype ValidationConfig = Record<string, string>;\ntype TranslationList = Record<string, string>;\ntype ErrorsList = Record<string, string>;\nexport type ValidationFieldsConfig = {\n validateRules: Record<string, string>[];\n code?: string;\n customUpperCode: string;\n required: boolean;\n};\n\nenum ConfigEnumLength {\n MIN_TEXT_LENGTH = 'MIN_TEXT_LENGTH',\n MAX_TEXT_LENGTH = 'MAX_TEXT_LENGTH',\n DATE_RANGE_MIN = 'DATE_RANGE_MIN',\n DATE_RANGE_MAX = 'DATE_RANGE_MAX',\n}\n\nexport enum InputValidation {\n Numeric = 'numeric',\n AlphanumWithSpaces = 'alphanum-with-spaces',\n Alphanumeric = 'alphanumeric',\n Alpha = 'alpha',\n Email = 'email',\n Length = 'length',\n Date = 'date',\n Url = 'url',\n}\n\nconst flattenObjectsArray = (arr: ValidationConfig[]): ValidationConfig => {\n return arr.reduce((acc, obj) => {\n return { ...acc, [obj.name]: obj.value };\n }, {});\n};\n\n//The basic material for the functions responsible for validation was taken from https://github.com/magento/magento2/blob/2.4/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js\nexport const validateNumeric = (value: string): boolean => /^\\d+$/.test(value);\n\nexport const validateAlphanumWithSpaces = (value: string): boolean =>\n /^[a-zA-Z0-9\\s]+$/.test(value);\n\nexport const validateAlphanumeric = (value: string): boolean =>\n /^[a-zA-Z0-9]+$/.test(value);\n\nexport const validateAlpha = (value: string): boolean =>\n /^[a-zA-Z]+$/.test(value);\n\nexport const validateEmail = (value: string): boolean =>\n /^[a-z0-9,!\\#\\$%&'\\*\\+\\/=\\?\\^_`\\{\\|\\}~-]+(\\.[a-z0-9,!\\#\\$%&'\\*\\+\\/=\\?\\^_`\\{\\|\\}~-]+)*@([a-z0-9-]+\\.)+[a-z]{2,}$/i.test(\n value\n );\n\nexport const validateDate = (value: string): boolean =>\n /^\\d{4}-\\d{2}-\\d{2}$/.test(value) && !isNaN(Date.parse(value));\n\nexport const isDateWithinRange = (\n date: string,\n minTimestamp?: number,\n maxTimestamp?: number\n): boolean => {\n const dateTimestamp = new Date(date).getTime() / 1000;\n\n if (isNaN(dateTimestamp) || dateTimestamp < 0) {\n return false;\n }\n\n if (typeof minTimestamp !== 'undefined' && dateTimestamp < minTimestamp) {\n return false;\n }\n\n if (typeof maxTimestamp !== 'undefined' && dateTimestamp > maxTimestamp) {\n return false;\n }\n\n return true;\n};\n\nexport const convertTimestampToDate = (\n timestamp: string | undefined | null\n): string => {\n if (!timestamp || timestamp.trim() === '') return '';\n\n const parsedTimestamp = parseInt(timestamp, 10);\n\n if (!isNaN(parsedTimestamp)) {\n const date = new Date(parsedTimestamp * 1000);\n\n if (isNaN(date.getTime())) return '';\n\n return date.toISOString().split('T')[0];\n }\n\n const isoDate = new Date(timestamp);\n\n if (isNaN(isoDate.getTime())) return '';\n\n const month = parseInt(timestamp.split('-')[1], 10);\n\n if (month > 12 || month < 1) return '';\n\n return isoDate.toISOString().split('T')[0];\n};\n\nexport const validateUrl = (url: string) => {\n const urlPattern =\n /^(https?|ftp):\\/\\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\\d+))?(\\/[A-Z0-9~](([A-Z0-9_~-]|\\.)*[A-Z0-9~]|))*\\/?(.*)?$/i;\n return urlPattern.test(url);\n};\n\nexport const validateLength = (\n value: string,\n minLength: number,\n maxLength: number\n): boolean => {\n const length = value.length;\n return length >= minLength && length <= maxLength;\n};\n\nexport const validationFields = (\n value: string,\n configs: ValidationFieldsConfig,\n translations: TranslationList,\n errorsList: ErrorsList\n) => {\n const {\n requiredFieldError,\n lengthTextError,\n numericError,\n alphaNumWithSpacesError,\n alphaNumericError,\n alphaError,\n emailError,\n dateError,\n urlError,\n dateRangeError,\n dateMaxError,\n dateMinError,\n } = translations;\n\n const fieldName = configs?.customUpperCode as string;\n\n const defaultFields = { [fieldName]: '' };\n\n if (errorsList[fieldName]) {\n delete errorsList[fieldName];\n }\n\n if (configs?.required && (!value || value === 'false')) {\n return {\n [fieldName]: `${ValidationErrorTypes.REQUIRED_FIELD_ERROR}${ERROR_CONFIG_SEPARATOR}${requiredFieldError}`,\n };\n }\n\n if (!configs?.required && !value) {\n return defaultFields;\n }\n\n if (!configs?.validateRules?.length) return defaultFields;\n\n const validateRulesConfig = flattenObjectsArray(configs?.validateRules);\n\n const min = validateRulesConfig[ConfigEnumLength.MIN_TEXT_LENGTH] ?? 1;\n const max = validateRulesConfig[ConfigEnumLength.MAX_TEXT_LENGTH] ?? 255;\n const dateMin = validateRulesConfig[ConfigEnumLength.DATE_RANGE_MIN];\n const dateMax = validateRulesConfig[ConfigEnumLength.DATE_RANGE_MAX];\n\n if (!validateLength(value, +min, +max) && !(dateMin || dateMax)) {\n const parsedErrorMessage = lengthTextError\n .replace('{min}', min)\n .replace('{max}', max);\n\n return {\n [fieldName]: `${ValidationErrorTypes.LENGTH_TEXT_ERROR}${ERROR_CONFIG_SEPARATOR}${parsedErrorMessage}`,\n };\n }\n\n if (!isDateWithinRange(value, +dateMin, +dateMax) && (dateMin || dateMax)) {\n if (dateMin && dateMin) {\n const parsedErrorMessage = dateRangeError\n .replace('{min}', convertTimestampToDate(dateMin))\n .replace('{max}', convertTimestampToDate(dateMax));\n\n return {\n [fieldName]: `${ValidationErrorTypes.DATE_RANGE_ERROR}${ERROR_CONFIG_SEPARATOR}${parsedErrorMessage}`,\n };\n }\n\n if (typeof dateMin === 'undefined' && typeof dateMax !== 'undefined') {\n const parsedErrorMessage = dateMaxError.replace(\n '{max}',\n convertTimestampToDate(dateMax)\n );\n\n return {\n [fieldName]: `${ValidationErrorTypes.DATE_MAX_ERROR}${ERROR_CONFIG_SEPARATOR}${parsedErrorMessage}`,\n };\n }\n\n if (typeof dateMax === 'undefined' && typeof dateMin !== 'undefined') {\n const parsedErrorMessage = dateMinError.replace(\n '{min}',\n convertTimestampToDate(dateMin)\n );\n\n return {\n [fieldName]: `${ValidationErrorTypes.DATE_MIN_ERROR}${ERROR_CONFIG_SEPARATOR}${parsedErrorMessage}`,\n };\n }\n }\n\n const validationMap = {\n [InputValidation.Numeric]: {\n validate: validateNumeric,\n error: `${ValidationErrorTypes.NUMERIC_ERROR}${ERROR_CONFIG_SEPARATOR}${numericError}`,\n },\n [InputValidation.AlphanumWithSpaces]: {\n validate: validateAlphanumWithSpaces,\n error: `${ValidationErrorTypes.ALPHA_NUM_WITH_SPACES_ERROR}${ERROR_CONFIG_SEPARATOR}${alphaNumWithSpacesError}`,\n },\n [InputValidation.Alphanumeric]: {\n validate: validateAlphanumeric,\n error: `${ValidationErrorTypes.ALPHA_NUMERIC_ERROR}${ERROR_CONFIG_SEPARATOR}${alphaNumericError}`,\n },\n [InputValidation.Alpha]: {\n validate: validateAlpha,\n error: `${ValidationErrorTypes.ALPHA_ERROR}${ERROR_CONFIG_SEPARATOR}${alphaError}`,\n },\n [InputValidation.Email]: {\n validate: validateEmail,\n error: `${ValidationErrorTypes.EMAIL_ERROR}${ERROR_CONFIG_SEPARATOR}${emailError}`,\n },\n [InputValidation.Date]: {\n validate: validateDate,\n error: `${ValidationErrorTypes.DATE_ERROR}${ERROR_CONFIG_SEPARATOR}${dateError}`,\n },\n [InputValidation.Url]: {\n validate: validateUrl,\n error: `${ValidationErrorTypes.URL_ERROR}${ERROR_CONFIG_SEPARATOR}${urlError}`,\n },\n };\n\n const validation =\n validationMap[\n validateRulesConfig['INPUT_VALIDATION'] as keyof typeof validationMap\n ];\n\n if (\n validation &&\n !validation.validate(value) &&\n !errorsList[fieldName]?.length\n ) {\n return { [fieldName]: validation.error };\n }\n\n return defaultFields;\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 default (\n fieldsConfig: Array<{\n customUpperCode?: string;\n required?: boolean;\n defaultValue?: unknown;\n }>\n): {\n initialData: Record<string, unknown>;\n errorList: Record<string, string>;\n} => {\n return fieldsConfig.reduce(\n (\n acc: {\n initialData: Record<string, unknown>;\n errorList: Record<string, string>;\n },\n { customUpperCode, required, defaultValue }\n ) => {\n if (required && customUpperCode) {\n acc.initialData[customUpperCode] = defaultValue || '';\n acc.errorList[customUpperCode] = '';\n }\n\n return acc;\n },\n {\n initialData: {},\n errorList: {},\n }\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/**\n * This file defines an array of class names that should be excluded\n * from specific init Recaptcha logic.\n *\n * The array contains class names representing elements that should be\n * ignored when certain operations, such as focusing or applying event\n * handlers, are executed.\n *\n * By checking if an element's class matches any class in this array,\n * you can easily bypass unwanted logic for those elements, ensuring\n * precise and predictable behavior in your application.\n *\n */\n\nexport const excludedFocusClasses = [\n 'auth-reset-password-form__buttons--signin',\n 'auth-sign-up-form-buttons--signin',\n 'auth-sign-in-form__button--forgot',\n 'auth-sign-in-form__button--signup',\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 { useCallback, useRef, useState, useEffect } from 'preact/hooks';\nimport { FieldsProps, useFormProps } from '@/auth/types';\nimport { initReCaptcha } from '@adobe-commerce/recaptcha';\nimport initializeFormDataAndErrors from '@/auth/lib/initializeFormDataAndErrors';\nimport {\n validationFields,\n ValidationFieldsConfig,\n} from '@/auth/lib/validationFields';\nimport { excludedFocusClasses } from '@/auth/configs/excludedFocusClasses';\nimport { useCustomTranslations } from '@/auth/hooks/useCustomTranslations';\n\nexport const useForm = ({ fieldsConfig, onSubmit }: useFormProps) => {\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 requiredFieldError: 'Auth.FormText.requiredFieldError.default',\n lengthTextError: 'Auth.FormText.lengthTextError.default',\n numericError: 'Auth.FormText.numericError.default',\n alphaNumWithSpacesError: 'Account.FormText.alphaNumWithSpacesError.default',\n alphaNumericError: 'Auth.FormText.alphaNumericError.default',\n alphaError: 'Auth.FormText.alphaError.default',\n emailError: 'Auth.FormText.emailError.default',\n dateError: 'Auth.FormText.dateError.default',\n dateRangeError: 'Auth.FormText.dateRangeError.default',\n dateMaxError: 'Auth.FormText.dateMaxError.default',\n dateMinError: 'Auth.FormText.dateMinError.default',\n urlError: 'Auth.FormText.urlError.default',\n });\n\n const formRef = useRef<HTMLFormElement>(null);\n const focusExecutedRef = useRef<boolean>(false);\n const [formData, setFormData] = useState<\n Record<string, string | boolean | number>\n >({});\n const [errors, setErrors] = useState<Record<string, string>>({});\n\n const handleValidationSubmit = useCallback(() => {\n let formValid = true;\n const errorsList = { ...errors };\n let firstErrorField: string | null = null;\n\n for (const [name, value] of Object.entries(formData)) {\n const fieldConfig = fieldsConfig?.find((config: FieldsProps) =>\n config?.customUpperCode?.includes(name)\n );\n\n const validationResult = validationFields(\n value.toString(),\n fieldConfig as ValidationFieldsConfig,\n translations,\n errorsList\n );\n\n if (validationResult[name]) {\n Object.assign(errorsList, validationResult);\n formValid = false;\n }\n\n if (!firstErrorField) {\n firstErrorField =\n Object.keys(errorsList).find((key) => errorsList[key]) ?? null;\n }\n }\n\n setErrors(errorsList);\n\n if (firstErrorField && formRef.current) {\n const input = formRef.current.elements.namedItem(\n firstErrorField\n ) as HTMLElement;\n input?.focus();\n }\n\n return formValid;\n }, [errors, fieldsConfig, formData, translations]);\n\n useEffect(() => {\n if (fieldsConfig?.length) {\n const { initialData, errorList } =\n initializeFormDataAndErrors(fieldsConfig);\n\n setFormData((prev) => ({\n ...(initialData as Record<string, string | number>),\n ...prev,\n }));\n\n setErrors(errorList);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [JSON.stringify(fieldsConfig)]);\n\n const handleFocus = useCallback(async (event: FocusEvent) => {\n const target = event.target as HTMLInputElement;\n const isFocusable = !excludedFocusClasses.some((className) =>\n target.classList.contains(className)\n );\n\n if (!focusExecutedRef.current && isFocusable) {\n await initReCaptcha(0);\n focusExecutedRef.current = true;\n }\n }, []);\n\n const handleChange = useCallback(\n (event: Event) => {\n const { name, value, type, checked } = event?.target as HTMLInputElement;\n const fieldValue = type === 'checkbox' ? checked : value;\n\n setFormData((prev) => {\n const updatedFormData = {\n ...prev,\n [name]: fieldValue,\n };\n\n return updatedFormData as Record<string, string | number>;\n });\n\n const fieldConfig = fieldsConfig?.find((config: FieldsProps) =>\n config?.customUpperCode?.includes(name)\n );\n\n let errorsList = { ...errors };\n\n if (fieldConfig) {\n const validationResult = validationFields(\n fieldValue.toString(),\n fieldConfig as ValidationFieldsConfig,\n translations,\n errorsList\n );\n\n if (validationResult) {\n Object.assign(errorsList, validationResult);\n }\n\n setErrors(errorsList);\n }\n },\n [fieldsConfig, errors, translations]\n );\n\n const handleBlur = useCallback(\n (event: Event) => {\n const { name, value, type, checked } = event?.target as HTMLInputElement;\n const fieldValue = type === 'checkbox' ? checked : value;\n\n const fieldConfig = fieldsConfig?.find(\n (config: FieldsProps) => config.customUpperCode === name\n );\n\n if (fieldConfig) {\n const errorsList = { ...errors };\n\n const validationResult = validationFields(\n fieldValue.toString(),\n fieldConfig as ValidationFieldsConfig,\n translations,\n errorsList\n );\n\n if (validationResult) {\n Object.assign(errorsList, validationResult);\n }\n\n setErrors(errorsList);\n }\n },\n [errors, fieldsConfig, translations]\n );\n\n const handleSubmit = useCallback(\n (event: SubmitEvent) => {\n event.preventDefault();\n\n const formValid = handleValidationSubmit();\n\n onSubmit?.(event, formValid);\n },\n [handleValidationSubmit, onSubmit]\n );\n\n return {\n formData,\n errors,\n formRef,\n handleChange,\n handleBlur,\n handleSubmit,\n handleFocus,\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 enum FieldEnumList {\n BOOLEAN = 'BOOLEAN',\n DATE = 'DATE',\n DATETIME = 'DATETIME',\n DROPDOWN = 'DROPDOWN',\n FILE = 'FILE',\n GALLERY = 'GALLERY',\n HIDDEN = 'HIDDEN',\n IMAGE = 'IMAGE',\n MEDIA_IMAGE = 'MEDIA_IMAGE',\n MULTILINE = 'MULTILINE',\n MULTISELECT = 'MULTISELECT',\n PRICE = 'PRICE',\n SELECT = 'SELECT',\n TEXT = 'TEXT',\n TEXTAREA = 'TEXTAREA',\n UNDEFINED = 'UNDEFINED',\n VISUAL = 'VISUAL',\n WEIGHT = 'WEIGHT',\n EMPTY = '',\n}\n\nexport interface AttributesFormItemsProps {\n code?: string;\n name?: string;\n id?: string;\n defaultValue?: string | boolean | number;\n entityType?: string;\n className?: string;\n fieldType?: FieldEnumList;\n multilineCount: number;\n required?: boolean;\n unique?: boolean;\n label?: string;\n orderNumber: number;\n options?: { is_default: boolean; label: string; value: string }[];\n hidden?: boolean;\n customUpperCode: string;\n}\n\nexport interface AttributesFormModel extends AttributesFormItemsProps {}\n","import { ERROR_CONFIG_SEPARATOR } from '@/auth/types';\n\ntype ExtractErrorKeyAndMessage = {\n errorKey: string;\n defaultErrorMessage: string;\n};\n\nexport const extractErrorKeyAndMessage = (\n errorConfig: string\n): ExtractErrorKeyAndMessage => {\n const fallbackData = { errorKey: '', defaultErrorMessage: '' };\n\n if (!errorConfig) return fallbackData;\n\n const index = errorConfig.indexOf(ERROR_CONFIG_SEPARATOR);\n\n if (index === -1) return fallbackData;\n\n return {\n errorKey: errorConfig.substring(0, index).trim(),\n defaultErrorMessage: errorConfig\n .substring(index + ERROR_CONFIG_SEPARATOR.length)\n .trim(),\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 { FieldElementProps } from '@/auth/types';\nimport { Field } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { memo } from 'preact/compat';\nimport { extractErrorKeyAndMessage } from '@/auth/lib/extractErrorKeyAndMessage';\nimport { VNode } from 'preact';\n\nexport const FieldElement = memo(\n ({\n item,\n errorConfig,\n className,\n itemClassName,\n loading,\n children,\n }: FieldElementProps) => {\n const { errorKey, defaultErrorMessage } =\n extractErrorKeyAndMessage(errorConfig);\n const customErrorMessage = useText(\n `Auth.FormText.${errorKey}.${item.code}`\n )[item.code];\n\n let errorMessage = '';\n\n // This check indicates that validation identified an error\n if (defaultErrorMessage.length) {\n errorMessage = customErrorMessage || defaultErrorMessage;\n }\n\n return (\n <Field\n key={item.id}\n error={errorMessage}\n className={classes([\n itemClassName,\n `${itemClassName}--${item.id}`,\n [`${itemClassName}--${item.id}-hidden`, item.isHidden],\n item.className,\n ])}\n data-testid={`${className}--${item.id}`}\n disabled={loading || item.disabled}\n >\n {children as VNode<{}>}\n </Field>\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 { FormElementProps } from '@/auth/types';\nimport { Input } from '@adobe-commerce/elsie/components';\nimport { memo } from 'preact/compat';\nimport { FieldElement } from './FieldElement';\n\nexport const InputElement = memo(\n ({\n item,\n valueMessage,\n errorConfig,\n onBlur,\n onChange,\n onFocus,\n className,\n itemClassName,\n loading,\n }: FormElementProps) => {\n return (\n <FieldElement\n item={item}\n errorConfig={errorConfig}\n className={className}\n itemClassName={itemClassName}\n loading={loading}\n >\n <Input\n type=\"text\"\n name={item.customUpperCode}\n value={valueMessage ?? item.defaultValue}\n placeholder={item.label}\n floatingLabel={`${item.label} ${item.required ? '*' : ''}`}\n autocomplete={item.autocomplete}\n onBlur={onBlur}\n onChange={onChange}\n onFocus={onFocus}\n />\n </FieldElement>\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 { FormElementProps } from '@/auth/types';\nimport { Picker } from '@adobe-commerce/elsie/components';\nimport { memo } from 'preact/compat';\nimport { FieldElement } from './FieldElement';\n\nexport const SelectElement = memo(\n ({\n item,\n valueMessage,\n errorConfig,\n onBlur,\n onChange,\n className,\n itemClassName,\n loading,\n }: FormElementProps) => {\n const defaultSelectValue = item.options.find(\n (option: { isDefault: boolean; value: string; text: string }) =>\n option.isDefault\n )?.value;\n\n return (\n <FieldElement\n item={item}\n errorConfig={errorConfig}\n className={className}\n itemClassName={itemClassName}\n loading={loading}\n >\n <Picker\n name={item.customUpperCode}\n floatingLabel={`${item.label} ${item.required ? '*' : ''}`}\n placeholder={item.label}\n aria-label={item.label}\n options={item.options}\n onBlur={onBlur}\n handleSelect={onChange}\n defaultValue={defaultSelectValue ?? valueMessage ?? item.defaultValue}\n value={defaultSelectValue ?? valueMessage ?? item.defaultValue}\n />\n </FieldElement>\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 { FormElementProps } from '@/auth/types';\nimport { InputDate } from '@adobe-commerce/elsie/components';\nimport { memo } from 'preact/compat';\nimport { FieldElement } from './FieldElement';\n\nexport const InputDateElement = memo(\n ({\n item,\n valueMessage,\n errorConfig,\n onBlur,\n onChange,\n className,\n itemClassName,\n loading,\n }: FormElementProps) => {\n return (\n <FieldElement\n item={item}\n errorConfig={errorConfig}\n className={className}\n itemClassName={itemClassName}\n loading={loading}\n >\n <InputDate\n // @ts-ignore\n type=\"text\"\n name={item.customUpperCode}\n value={valueMessage || item.defaultValue}\n placeholder={item.label}\n floatingLabel={`${item.label} ${item.required ? '*' : ''}`}\n onBlur={onBlur}\n onChange={onChange}\n disabled={loading || item.disabled}\n />\n </FieldElement>\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 { FormElementProps } from '@/auth/types';\nimport { Checkbox } from '@adobe-commerce/elsie/components';\nimport { memo } from 'preact/compat';\nimport { FieldElement } from './FieldElement';\n\nexport const InputCheckBoxElement = memo(\n ({\n item,\n valueMessage,\n errorConfig,\n onBlur,\n onChange,\n className,\n itemClassName,\n loading,\n }: FormElementProps) => {\n return (\n <FieldElement\n item={item}\n errorConfig={errorConfig}\n className={className}\n itemClassName={itemClassName}\n loading={loading}\n >\n <Checkbox\n name={item.customUpperCode}\n checked={valueMessage || item.defaultValue}\n placeholder={item.label}\n label={`${item.label} ${item.required ? '*' : ''}`}\n onBlur={onBlur}\n onChange={onChange}\n />\n </FieldElement>\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 { FormElementProps } from '@/auth/types';\nimport { TextArea } from '@adobe-commerce/elsie/components';\nimport { memo } from 'preact/compat';\nimport { FieldElement } from './FieldElement';\n\nexport const TextAreaElement = memo(\n ({\n item,\n valueMessage,\n errorConfig,\n onBlur,\n onChange,\n className,\n itemClassName,\n loading,\n }: FormElementProps) => {\n return (\n <FieldElement\n item={item}\n errorConfig={errorConfig}\n className={className}\n itemClassName={itemClassName}\n loading={loading}\n >\n <TextArea\n name={item.customUpperCode}\n value={valueMessage ?? item.defaultValue}\n label={`${item.label} ${item.required ? '*' : ''}`}\n onBlur={onBlur}\n onChange={onChange}\n />\n </FieldElement>\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 { extractErrorKeyAndMessage } from '@/auth/lib/extractErrorKeyAndMessage';\nimport { FormSlotProps } from '@/auth/types';\nimport { useText } from 'preact-i18n';\nimport { Slot } from '@adobe-commerce/elsie/lib';\n\nexport const FormSlot = ({\n slots,\n item,\n handleOnChange,\n handleOnBlur,\n handleOnFocus,\n errorConfig,\n errors,\n}: FormSlotProps) => {\n const { errorKey, defaultErrorMessage } =\n extractErrorKeyAndMessage(errorConfig);\n const customErrorMessage = useText(`Auth.FormText.${errorKey}.${item.code}`)[\n item.code\n ];\n\n let errorMessage = '';\n\n // This check indicates that validation identified an error\n if (defaultErrorMessage.length) {\n errorMessage = customErrorMessage || defaultErrorMessage;\n }\n\n const contextValue = {\n inputName: item.customUpperCode,\n handleOnChange,\n handleOnBlur,\n handleOnFocus,\n errorMessage,\n errors,\n config: item,\n };\n\n return (\n <Slot\n data-testid={`signUpFormInput_${item.code}`}\n name={`SignUpFormInput_${item.code}`}\n slot={slots?.[`SignUpFormInput_${item.code}`]}\n context={contextValue}\n key={item.id}\n />\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FieldsProps, FormProps } from '@/auth/types';\nimport { useForm } from '@/auth/hooks/components/useForm';\nimport { FieldEnumList } from '@/auth/data/models';\nimport {\n SelectElement,\n InputElement,\n InputDateElement,\n InputCheckBoxElement,\n TextAreaElement,\n FormSlot,\n} from './Elements';\nimport { memo } from 'preact/compat';\n\nexport const Form = memo(\n ({\n slots,\n name,\n loading,\n children,\n className = 'defaultForm',\n fieldsConfig = [],\n onSubmit,\n ...props\n }: FormProps) => {\n const {\n formData,\n errors,\n formRef,\n handleChange,\n handleBlur,\n handleSubmit,\n handleFocus,\n } = useForm({\n onSubmit,\n fieldsConfig,\n });\n\n const itemClassName = `${className}__field`;\n\n return (\n <form\n className={className}\n onSubmit={handleSubmit}\n name={name}\n ref={formRef}\n onFocus={handleFocus}\n {...props}\n >\n {fieldsConfig.map((item: FieldsProps) => {\n const errorConfig = errors?.[item.customUpperCode];\n const valueMessage = formData?.[item.customUpperCode] as string;\n const isSlot = !!slots?.[`SignUpFormInput_${item.code}`];\n\n const renderSlot = (\n <FormSlot\n slots={slots}\n item={item}\n handleOnChange={handleChange}\n handleOnBlur={handleBlur}\n handleOnFocus={handleFocus}\n errorConfig={errorConfig}\n errors={errors}\n />\n );\n\n switch (item.fieldType) {\n case FieldEnumList.TEXT: {\n if (isSlot) return renderSlot;\n\n if (item.options.length) {\n return (\n <SelectElement\n item={item}\n valueMessage={valueMessage}\n errorConfig={errorConfig}\n onBlur={handleBlur}\n onChange={handleChange}\n onFocus={handleFocus}\n itemClassName={itemClassName}\n className={className}\n loading={loading}\n />\n );\n }\n\n return (\n <InputElement\n item={item}\n valueMessage={valueMessage}\n errorConfig={errorConfig}\n onBlur={handleBlur}\n onChange={handleChange}\n onFocus={handleFocus}\n itemClassName={itemClassName}\n className={className}\n loading={loading}\n />\n );\n }\n\n case FieldEnumList.MULTILINE: {\n if (isSlot) return renderSlot;\n\n return (\n <InputElement\n item={item}\n valueMessage={valueMessage}\n errorConfig={errorConfig}\n onBlur={handleBlur}\n onChange={handleChange}\n onFocus={handleFocus}\n itemClassName={itemClassName}\n className={className}\n loading={loading}\n />\n );\n }\n\n case FieldEnumList.SELECT: {\n if (isSlot) return renderSlot;\n\n return (\n <SelectElement\n item={item}\n valueMessage={valueMessage}\n errorConfig={errorConfig}\n onBlur={handleBlur}\n onChange={handleChange}\n itemClassName={itemClassName}\n className={className}\n loading={loading}\n />\n );\n }\n\n case FieldEnumList.DATE: {\n if (isSlot) return renderSlot;\n\n return (\n <InputDateElement\n item={item}\n valueMessage={valueMessage}\n errorConfig={errorConfig}\n onBlur={handleBlur}\n onChange={handleChange}\n itemClassName={itemClassName}\n className={className}\n loading={loading}\n />\n );\n }\n\n case FieldEnumList.BOOLEAN: {\n if (isSlot) return renderSlot;\n\n return (\n <InputCheckBoxElement\n item={item}\n valueMessage={valueMessage}\n errorConfig={errorConfig}\n onBlur={handleBlur}\n onChange={handleChange}\n itemClassName={itemClassName}\n className={className}\n loading={loading}\n />\n );\n }\n\n case FieldEnumList.TEXTAREA: {\n if (isSlot) return renderSlot;\n\n return (\n <TextAreaElement\n item={item}\n valueMessage={valueMessage}\n errorConfig={errorConfig}\n onBlur={handleBlur}\n onChange={handleChange}\n itemClassName={itemClassName}\n className={className}\n loading={loading}\n />\n );\n }\n\n default:\n return null;\n }\n })}\n\n {children}\n </form>\n );\n }\n);\n"],"names":["ValidationErrorTypes","ERROR_CONFIG_SEPARATOR","useCustomTranslations","defaultKeys","translations","useText","keysToUpdate","key","value","translationKeys","acc","updatedTranslations","flattenObjectsArray","arr","obj","validateNumeric","validateAlphanumWithSpaces","validateAlphanumeric","validateAlpha","validateEmail","validateDate","isDateWithinRange","date","minTimestamp","maxTimestamp","dateTimestamp","convertTimestampToDate","timestamp","parsedTimestamp","isoDate","month","validateUrl","url","validateLength","minLength","maxLength","length","validationFields","configs","errorsList","requiredFieldError","lengthTextError","numericError","alphaNumWithSpacesError","alphaNumericError","alphaError","emailError","dateError","urlError","dateRangeError","dateMaxError","dateMinError","fieldName","defaultFields","_a","validateRulesConfig","min","max","dateMin","dateMax","parsedErrorMessage","validation","_b","initializeFormDataAndErrors","fieldsConfig","customUpperCode","required","defaultValue","excludedFocusClasses","useForm","onSubmit","formRef","useRef","focusExecutedRef","formData","setFormData","useState","errors","setErrors","handleValidationSubmit","useCallback","formValid","firstErrorField","name","fieldConfig","config","validationResult","input","useEffect","initialData","errorList","prev","handleFocus","event","target","isFocusable","className","initReCaptcha","handleChange","type","checked","fieldValue","handleBlur","handleSubmit","FieldEnumList","extractErrorKeyAndMessage","errorConfig","fallbackData","index","FieldElement","memo","item","itemClassName","loading","children","errorKey","defaultErrorMessage","customErrorMessage","errorMessage","jsx","Field","classes","InputElement","valueMessage","onBlur","onChange","onFocus","Input","SelectElement","defaultSelectValue","option","Picker","InputDateElement","InputDate","InputCheckBoxElement","Checkbox","TextAreaElement","TextArea","FormSlot","slots","handleOnChange","handleOnBlur","handleOnFocus","contextValue","Slot","Form","props","jsxs","isSlot","renderSlot"],"mappings":"ggBAIY,IAAAA,GAAAA,IACVA,EAAA,qBAAuB,qBACvBA,EAAA,cAAgB,eAChBA,EAAA,4BAA8B,0BAC9BA,EAAA,oBAAsB,oBACtBA,EAAA,YAAc,aACdA,EAAA,YAAc,aACdA,EAAA,WAAa,YACbA,EAAA,iBAAmB,iBACnBA,EAAA,eAAiB,eACjBA,EAAA,eAAiB,eACjBA,EAAA,UAAY,WACZA,EAAA,kBAAoB,kBAZVA,IAAAA,GAAA,CAAA,CAAA,EAqBC,MAAAC,EAAyB,MCCzBC,GACXC,GAC2B,CAKrB,MAAAC,EAAeC,EAAQF,CAAW,EAYlCG,EAAe,OAAO,QAAQF,CAAY,EAC7C,OACC,CAAC,CAACG,EAAKC,CAAK,IACVA,IAAU,MACT,OAAO,OAAOR,CAAoB,EAAe,SAASO,CAAG,GAEjE,IAAI,CAAC,CAACA,CAAG,IAAMA,CAAG,EAOfE,EAAkBH,EAAa,OAAO,CAACI,EAAKH,KAC5CG,EAAAH,CAAG,EAAI,iBAAiBA,CAAG,GACxBG,GACN,EAA4B,EAGzBC,EAAsBN,EAAQI,CAAe,EAO5C,MAAA,CACL,GAAGL,EACH,GAAGE,EAAa,OAA+B,CAACI,EAAKH,KAC/CG,EAAAH,CAAG,EAAII,EAAoBJ,CAAG,EAC3BG,GACN,CAAE,CAAA,CACP,CACF,EC9BME,GAAuBC,GACpBA,EAAI,OAAO,CAACH,EAAKI,KACf,CAAE,GAAGJ,EAAK,CAACI,EAAI,IAAI,EAAGA,EAAI,KAAM,GACtC,EAAE,EAIMC,GAAmBP,GAA2B,QAAQ,KAAKA,CAAK,EAEhEQ,GAA8BR,GACzC,mBAAmB,KAAKA,CA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A,YAAAjB,EACA,OAAQJ,EACR,SAAUJ,EACV,cAAAc,EACA,UAAAhB,EACA,QAAAiB,CAAA,CACF,EAIJ,QACS,OAAA,IAAA,CACX,CACD,EAEAC,CAAA,CAAA,CACH,CAAA,CAGN"}
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["/@dropins/storefront-auth/src/types/validationErrors.types.ts","/@dropins/storefront-auth/src/hooks/useCustomTranslations.tsx","/@dropins/storefront-auth/src/lib/validationFields.ts","/@dropins/storefront-auth/src/lib/initializeFormDataAndErrors.ts","/@dropins/storefront-auth/src/configs/excludedFocusClasses.ts","/@dropins/storefront-auth/src/hooks/components/useForm.tsx","/@dropins/storefront-auth/src/data/models/attributes-form.ts","/@dropins/storefront-auth/src/lib/extractErrorKeyAndMessage.tsx","/@dropins/storefront-auth/src/components/Form/Elements/FieldElement.tsx","/@dropins/storefront-auth/src/components/Form/Elements/InputElement.tsx","/@dropins/storefront-auth/src/components/Form/Elements/SelectElement.tsx","/@dropins/storefront-auth/src/components/Form/Elements/InputDateElement.tsx","/@dropins/storefront-auth/src/components/Form/Elements/InputCheckBoxElement.tsx","/@dropins/storefront-auth/src/components/Form/Elements/TextAreaElement.tsx","/@dropins/storefront-auth/src/components/Form/Elements/FormSlot.tsx","/@dropins/storefront-auth/src/components/Form/Form.tsx"],"sourcesContent":["/**\n * Error types in this enum are used to provide custom i18n translations for specific validation errors.\n * Each key corresponds to an error type that maps to the `Auth.FormText` i18n values in `src/i18n/en_US.json`.\n */\nexport enum ValidationErrorTypes {\n REQUIRED_FIELD_ERROR = 'requiredFieldError',\n NUMERIC_ERROR = 'numericError',\n ALPHA_NUM_WITH_SPACES_ERROR = 'alphaNumWithSpacesError',\n ALPHA_NUMERIC_ERROR = 'alphaNumericError',\n ALPHA_ERROR = 'alphaError',\n EMAIL_ERROR = 'emailError',\n DATE_ERROR = 'dateError',\n DATE_RANGE_ERROR = 'dateRangeError',\n DATE_MAX_ERROR = 'dateMaxError',\n DATE_MIN_ERROR = 'dateMinError',\n URL_ERROR = 'urlError',\n LENGTH_TEXT_ERROR = 'lengthTextError',\n}\n\n/**\n * `ERROR_CONFIG_SEPARATOR` uses the ASCII 31 (Unit Separator) character,\n * a rarely used control character, to avoid conflicts with custom i18n error messages.\n *\n * Learn more: https://theasciicode.com.ar/ascii-control-characters/unit-separator-ascii-code-31.html\n */\nexport const ERROR_CONFIG_SEPARATOR = `${String.fromCharCode(\n 31\n)}/${String.fromCharCode(31)}`;\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 { useText } from 'preact-i18n';\nimport { ValidationErrorTypes } from '@/auth/types';\n\n/**\n * A custom hook for handling translations with support for extensible error messages.\n *\n * @param defaultKeys - A mapping of keys to their translation paths.\n * @returns A complete set of translations, including dynamically updated values for null error keys.\n */\nexport const useCustomTranslations = (\n defaultKeys: Record<string, string>\n): Record<string, string> => {\n /**\n * Step 1: Fetch initial translations using the provided keys\n * Translations are fetched from the i18n system based on the provided defaultKeys.\n */\n const translations = useText(defaultKeys);\n\n /**\n * Step 2: Identify keys that require updates\n * - These keys correspond to validation errors (defined in ValidationErrorTypes).\n * - A key needs an update if:\n * 1. Its value in the initial translations is `null`.\n * 2. The key exists in ValidationErrorTypes (indicating it’s a known error type).\n *\n * Null values typically occur when translations for the given error key are not overridden\n * and instead rely on a plain structure, e.g., \"requiredFieldError\": \"This is a required field.\"\n */\n const keysToUpdate = Object.entries(translations)\n .filter(\n ([key, value]) =>\n value === null &&\n (Object.values(ValidationErrorTypes) as string[]).includes(key)\n )\n .map(([key]) => key);\n\n /**\n * Step 3: Prepare paths for fetching updated translations\n * - For each key needing an update, create a path to its extended translation.\n * - Example: For the key \"requiredFieldError\", the updated path would be \"Auth.FormText.requiredFieldError\".\n */\n const translationKeys = keysToUpdate.reduce((acc, key) => {\n acc[key] = `Auth.FormText.${key}`; // Build the updated translation path\n return acc;\n }, {} as Record<string, string>);\n\n // Step 4: Fetch updated translations for the keys identified in Step 2\n const updatedTranslations = useText(translationKeys);\n\n /**\n * Step 5: Merge updated translations back into the initial translations\n * - Replace `null` values with the fetched updated translations.\n * - Preserve all other original translations.\n */\n return {\n ...translations, // Include original translations\n ...keysToUpdate.reduce<Record<string, string>>((acc, key) => {\n acc[key] = updatedTranslations[key]; // Overwrite `null` values with updated translations\n return acc;\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 { ValidationErrorTypes, ERROR_CONFIG_SEPARATOR } from '@/auth/types';\n\n/* eslint-disable no-useless-escape */\ntype ValidationConfig = Record<string, string>;\ntype TranslationList = Record<string, string>;\ntype ErrorsList = Record<string, string>;\nexport type ValidationFieldsConfig = {\n validateRules: Record<string, string>[];\n code?: string;\n customUpperCode: string;\n required: boolean;\n};\n\nenum ConfigEnumLength {\n MIN_TEXT_LENGTH = 'MIN_TEXT_LENGTH',\n MAX_TEXT_LENGTH = 'MAX_TEXT_LENGTH',\n DATE_RANGE_MIN = 'DATE_RANGE_MIN',\n DATE_RANGE_MAX = 'DATE_RANGE_MAX',\n}\n\nexport enum InputValidation {\n Numeric = 'numeric',\n AlphanumWithSpaces = 'alphanum-with-spaces',\n Alphanumeric = 'alphanumeric',\n Alpha = 'alpha',\n Email = 'email',\n Length = 'length',\n Date = 'date',\n Url = 'url',\n}\n\nconst flattenObjectsArray = (arr: ValidationConfig[]): ValidationConfig => {\n return arr.reduce((acc, obj) => {\n return { ...acc, [obj.name]: obj.value };\n }, {});\n};\n\n//The basic material for the functions responsible for validation was taken from https://github.com/magento/magento2/blob/2.4/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js\nexport const validateNumeric = (value: string): boolean => /^\\d+$/.test(value);\n\nexport const validateAlphanumWithSpaces = (value: string): boolean =>\n /^[a-zA-Z0-9\\s]+$/.test(value);\n\nexport const validateAlphanumeric = (value: string): boolean =>\n /^[a-zA-Z0-9]+$/.test(value);\n\nexport const validateAlpha = (value: string): boolean =>\n /^[a-zA-Z]+$/.test(value);\n\nexport const validateEmail = (value: string): boolean =>\n /^[a-z0-9,!\\#\\$%&'\\*\\+\\/=\\?\\^_`\\{\\|\\}~-]+(\\.[a-z0-9,!\\#\\$%&'\\*\\+\\/=\\?\\^_`\\{\\|\\}~-]+)*@([a-z0-9-]+\\.)+[a-z]{2,}$/i.test(\n value\n );\n\nexport const validateDate = (value: string): boolean =>\n /^\\d{4}-\\d{2}-\\d{2}$/.test(value) && !isNaN(Date.parse(value));\n\nexport const isDateWithinRange = (\n date: string,\n minTimestamp?: number,\n maxTimestamp?: number\n): boolean => {\n const dateTimestamp = new Date(date).getTime() / 1000;\n\n if (isNaN(dateTimestamp) || dateTimestamp < 0) {\n return false;\n }\n\n if (typeof minTimestamp !== 'undefined' && dateTimestamp < minTimestamp) {\n return false;\n }\n\n if (typeof maxTimestamp !== 'undefined' && dateTimestamp > maxTimestamp) {\n return false;\n }\n\n return true;\n};\n\nexport const convertTimestampToDate = (\n timestamp: string | undefined | null\n): string => {\n if (!timestamp || timestamp.trim() === '') return '';\n\n const parsedTimestamp = parseInt(timestamp, 10);\n\n if (!isNaN(parsedTimestamp)) {\n const date = new Date(parsedTimestamp * 1000);\n\n if (isNaN(date.getTime())) return '';\n\n return date.toISOString().split('T')[0];\n }\n\n const isoDate = new Date(timestamp);\n\n if (isNaN(isoDate.getTime())) return '';\n\n const month = parseInt(timestamp.split('-')[1], 10);\n\n if (month > 12 || month < 1) return '';\n\n return isoDate.toISOString().split('T')[0];\n};\n\nexport const validateUrl = (url: string) => {\n const urlPattern =\n /^(https?|ftp):\\/\\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\\d+))?(\\/[A-Z0-9~](([A-Z0-9_~-]|\\.)*[A-Z0-9~]|))*\\/?(.*)?$/i;\n return urlPattern.test(url);\n};\n\nexport const validateLength = (\n value: string,\n minLength: number,\n maxLength: number\n): boolean => {\n const length = value.length;\n return length >= minLength && length <= maxLength;\n};\n\nexport const validationFields = (\n value: string,\n configs: ValidationFieldsConfig,\n translations: TranslationList,\n errorsList: ErrorsList\n) => {\n const {\n requiredFieldError,\n lengthTextError,\n numericError,\n alphaNumWithSpacesError,\n alphaNumericError,\n alphaError,\n emailError,\n dateError,\n urlError,\n dateRangeError,\n dateMaxError,\n dateMinError,\n } = translations;\n\n const fieldName = configs?.customUpperCode as string;\n\n const defaultFields = { [fieldName]: '' };\n\n if (errorsList[fieldName]) {\n delete errorsList[fieldName];\n }\n\n if (configs?.required && (!value || value === 'false')) {\n return {\n [fieldName]: `${ValidationErrorTypes.REQUIRED_FIELD_ERROR}${ERROR_CONFIG_SEPARATOR}${requiredFieldError}`,\n };\n }\n\n if (!configs?.required && !value) {\n return defaultFields;\n }\n\n if (!configs?.validateRules?.length) return defaultFields;\n\n const validateRulesConfig = flattenObjectsArray(configs?.validateRules);\n\n const min = validateRulesConfig[ConfigEnumLength.MIN_TEXT_LENGTH] ?? 1;\n const max = validateRulesConfig[ConfigEnumLength.MAX_TEXT_LENGTH] ?? 255;\n const dateMin = validateRulesConfig[ConfigEnumLength.DATE_RANGE_MIN];\n const dateMax = validateRulesConfig[ConfigEnumLength.DATE_RANGE_MAX];\n\n if (!validateLength(value, +min, +max) && !(dateMin || dateMax)) {\n const parsedErrorMessage = lengthTextError\n .replace('{min}', min)\n .replace('{max}', max);\n\n return {\n [fieldName]: `${ValidationErrorTypes.LENGTH_TEXT_ERROR}${ERROR_CONFIG_SEPARATOR}${parsedErrorMessage}`,\n };\n }\n\n if (!isDateWithinRange(value, +dateMin, +dateMax) && (dateMin || dateMax)) {\n if (dateMin && dateMin) {\n const parsedErrorMessage = dateRangeError\n .replace('{min}', convertTimestampToDate(dateMin))\n .replace('{max}', convertTimestampToDate(dateMax));\n\n return {\n [fieldName]: `${ValidationErrorTypes.DATE_RANGE_ERROR}${ERROR_CONFIG_SEPARATOR}${parsedErrorMessage}`,\n };\n }\n\n if (typeof dateMin === 'undefined' && typeof dateMax !== 'undefined') {\n const parsedErrorMessage = dateMaxError.replace(\n '{max}',\n convertTimestampToDate(dateMax)\n );\n\n return {\n [fieldName]: `${ValidationErrorTypes.DATE_MAX_ERROR}${ERROR_CONFIG_SEPARATOR}${parsedErrorMessage}`,\n };\n }\n\n if (typeof dateMax === 'undefined' && typeof dateMin !== 'undefined') {\n const parsedErrorMessage = dateMinError.replace(\n '{min}',\n convertTimestampToDate(dateMin)\n );\n\n return {\n [fieldName]: `${ValidationErrorTypes.DATE_MIN_ERROR}${ERROR_CONFIG_SEPARATOR}${parsedErrorMessage}`,\n };\n }\n }\n\n const validationMap = {\n [InputValidation.Numeric]: {\n validate: validateNumeric,\n error: `${ValidationErrorTypes.NUMERIC_ERROR}${ERROR_CONFIG_SEPARATOR}${numericError}`,\n },\n [InputValidation.AlphanumWithSpaces]: {\n validate: validateAlphanumWithSpaces,\n error: `${ValidationErrorTypes.ALPHA_NUM_WITH_SPACES_ERROR}${ERROR_CONFIG_SEPARATOR}${alphaNumWithSpacesError}`,\n },\n [InputValidation.Alphanumeric]: {\n validate: validateAlphanumeric,\n error: `${ValidationErrorTypes.ALPHA_NUMERIC_ERROR}${ERROR_CONFIG_SEPARATOR}${alphaNumericError}`,\n },\n [InputValidation.Alpha]: {\n validate: validateAlpha,\n error: `${ValidationErrorTypes.ALPHA_ERROR}${ERROR_CONFIG_SEPARATOR}${alphaError}`,\n },\n [InputValidation.Email]: {\n validate: validateEmail,\n error: `${ValidationErrorTypes.EMAIL_ERROR}${ERROR_CONFIG_SEPARATOR}${emailError}`,\n },\n [InputValidation.Date]: {\n validate: validateDate,\n error: `${ValidationErrorTypes.DATE_ERROR}${ERROR_CONFIG_SEPARATOR}${dateError}`,\n },\n [InputValidation.Url]: {\n validate: validateUrl,\n error: `${ValidationErrorTypes.URL_ERROR}${ERROR_CONFIG_SEPARATOR}${urlError}`,\n },\n };\n\n const validation =\n validationMap[\n validateRulesConfig['INPUT_VALIDATION'] as keyof typeof validationMap\n ];\n\n if (\n validation &&\n !validation.validate(value) &&\n !errorsList[fieldName]?.length\n ) {\n return { [fieldName]: validation.error };\n }\n\n return defaultFields;\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 default (\n fieldsConfig: Array<{\n customUpperCode?: string;\n required?: boolean;\n defaultValue?: unknown;\n }>\n): {\n initialData: Record<string, unknown>;\n errorList: Record<string, string>;\n} => {\n return fieldsConfig.reduce(\n (\n acc: {\n initialData: Record<string, unknown>;\n errorList: Record<string, string>;\n },\n { customUpperCode, required, defaultValue }\n ) => {\n if (required && customUpperCode) {\n acc.initialData[customUpperCode] = defaultValue || '';\n acc.errorList[customUpperCode] = '';\n }\n\n return acc;\n },\n {\n initialData: {},\n errorList: {},\n }\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/**\n * This file defines an array of class names that should be excluded\n * from specific init Recaptcha logic.\n *\n * The array contains class names representing elements that should be\n * ignored when certain operations, such as focusing or applying event\n * handlers, are executed.\n *\n * By checking if an element's class matches any class in this array,\n * you can easily bypass unwanted logic for those elements, ensuring\n * precise and predictable behavior in your application.\n *\n */\n\nexport const excludedFocusClasses = [\n 'auth-reset-password-form__buttons--signin',\n 'auth-sign-up-form-buttons--signin',\n 'auth-sign-in-form__button--forgot',\n 'auth-sign-in-form__button--signup',\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 { useCallback, useRef, useState, useEffect } from 'preact/hooks';\nimport { FieldsProps, useFormProps } from '@/auth/types';\nimport { initReCaptcha } from '@adobe-commerce/recaptcha';\nimport initializeFormDataAndErrors from '@/auth/lib/initializeFormDataAndErrors';\nimport {\n validationFields,\n ValidationFieldsConfig,\n} from '@/auth/lib/validationFields';\nimport { excludedFocusClasses } from '@/auth/configs/excludedFocusClasses';\nimport { useCustomTranslations } from '@/auth/hooks/useCustomTranslations';\n\nexport const useForm = ({ fieldsConfig, onSubmit }: useFormProps) => {\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 requiredFieldError: 'Auth.FormText.requiredFieldError.default',\n lengthTextError: 'Auth.FormText.lengthTextError.default',\n numericError: 'Auth.FormText.numericError.default',\n alphaNumWithSpacesError: 'Account.FormText.alphaNumWithSpacesError.default',\n alphaNumericError: 'Auth.FormText.alphaNumericError.default',\n alphaError: 'Auth.FormText.alphaError.default',\n emailError: 'Auth.FormText.emailError.default',\n dateError: 'Auth.FormText.dateError.default',\n dateRangeError: 'Auth.FormText.dateRangeError.default',\n dateMaxError: 'Auth.FormText.dateMaxError.default',\n dateMinError: 'Auth.FormText.dateMinError.default',\n urlError: 'Auth.FormText.urlError.default',\n });\n\n const formRef = useRef<HTMLFormElement>(null);\n const focusExecutedRef = useRef<boolean>(false);\n const [formData, setFormData] = useState<\n Record<string, string | boolean | number>\n >({});\n const [errors, setErrors] = useState<Record<string, string>>({});\n\n const handleValidationSubmit = useCallback(() => {\n let formValid = true;\n const errorsList = { ...errors };\n let firstErrorField: string | null = null;\n\n for (const [name, value] of Object.entries(formData)) {\n const fieldConfig = fieldsConfig?.find((config: FieldsProps) =>\n config?.customUpperCode?.includes(name)\n );\n\n const validationResult = validationFields(\n value.toString(),\n fieldConfig as ValidationFieldsConfig,\n translations,\n errorsList\n );\n\n if (validationResult[name]) {\n Object.assign(errorsList, validationResult);\n formValid = false;\n }\n\n if (!firstErrorField) {\n firstErrorField =\n Object.keys(errorsList).find((key) => errorsList[key]) ?? null;\n }\n }\n\n setErrors(errorsList);\n\n if (firstErrorField && formRef.current) {\n const input = formRef.current.elements.namedItem(\n firstErrorField\n ) as HTMLElement;\n input?.focus();\n }\n\n return formValid;\n }, [errors, fieldsConfig, formData, translations]);\n\n useEffect(() => {\n if (fieldsConfig?.length) {\n const { initialData, errorList } =\n initializeFormDataAndErrors(fieldsConfig);\n\n setFormData((prev) => ({\n ...(initialData as Record<string, string | number>),\n ...prev,\n }));\n\n setErrors(errorList);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [JSON.stringify(fieldsConfig)]);\n\n const handleFocus = useCallback(async (event: FocusEvent) => {\n const target = event.target as HTMLInputElement;\n const isFocusable = !excludedFocusClasses.some((className) =>\n target.classList.contains(className)\n );\n\n if (!focusExecutedRef.current && isFocusable) {\n await initReCaptcha(0);\n focusExecutedRef.current = true;\n }\n }, []);\n\n const handleChange = useCallback(\n (event: Event) => {\n const { name, value, type, checked } = event?.target as HTMLInputElement;\n const fieldValue = type === 'checkbox' ? checked : value;\n\n setFormData((prev) => {\n const updatedFormData = {\n ...prev,\n [name]: fieldValue,\n };\n\n return updatedFormData as Record<string, string | number>;\n });\n\n const fieldConfig = fieldsConfig?.find((config: FieldsProps) =>\n config?.customUpperCode?.includes(name)\n );\n\n let errorsList = { ...errors };\n\n if (fieldConfig) {\n const validationResult = validationFields(\n fieldValue.toString(),\n fieldConfig as ValidationFieldsConfig,\n translations,\n errorsList\n );\n\n if (validationResult) {\n Object.assign(errorsList, validationResult);\n }\n\n setErrors(errorsList);\n }\n },\n [fieldsConfig, errors, translations]\n );\n\n const handleBlur = useCallback(\n (event: Event) => {\n const { name, value, type, checked } = event?.target as HTMLInputElement;\n const fieldValue = type === 'checkbox' ? checked : value;\n\n const fieldConfig = fieldsConfig?.find(\n (config: FieldsProps) => config.customUpperCode === name\n );\n\n if (fieldConfig) {\n const errorsList = { ...errors };\n\n const validationResult = validationFields(\n fieldValue.toString(),\n fieldConfig as ValidationFieldsConfig,\n translations,\n errorsList\n );\n\n if (validationResult) {\n Object.assign(errorsList, validationResult);\n }\n\n setErrors(errorsList);\n }\n },\n [errors, fieldsConfig, translations]\n );\n\n const handleSubmit = useCallback(\n (event: SubmitEvent) => {\n event.preventDefault();\n\n const formValid = handleValidationSubmit();\n\n onSubmit?.(event, formValid);\n },\n [handleValidationSubmit, onSubmit]\n );\n\n return {\n formData,\n errors,\n formRef,\n handleChange,\n handleBlur,\n handleSubmit,\n handleFocus,\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 enum FieldEnumList {\n BOOLEAN = 'BOOLEAN',\n DATE = 'DATE',\n DATETIME = 'DATETIME',\n DROPDOWN = 'DROPDOWN',\n FILE = 'FILE',\n GALLERY = 'GALLERY',\n HIDDEN = 'HIDDEN',\n IMAGE = 'IMAGE',\n MEDIA_IMAGE = 'MEDIA_IMAGE',\n MULTILINE = 'MULTILINE',\n MULTISELECT = 'MULTISELECT',\n PRICE = 'PRICE',\n SELECT = 'SELECT',\n TEXT = 'TEXT',\n TEXTAREA = 'TEXTAREA',\n UNDEFINED = 'UNDEFINED',\n VISUAL = 'VISUAL',\n WEIGHT = 'WEIGHT',\n EMPTY = '',\n}\n\nexport interface AttributesFormItemsProps {\n code?: string;\n name?: string;\n id?: string;\n defaultValue?: string | boolean | number;\n entityType?: string;\n className?: string;\n fieldType?: FieldEnumList;\n multilineCount: number;\n required?: boolean;\n unique?: boolean;\n label?: string;\n orderNumber: number;\n options?: { is_default: boolean; label: string; value: string }[];\n hidden?: boolean;\n customUpperCode: string;\n}\n\nexport interface AttributesFormModel extends AttributesFormItemsProps {}\n","import { ERROR_CONFIG_SEPARATOR } from '@/auth/types';\n\ntype ExtractErrorKeyAndMessage = {\n errorKey: string;\n defaultErrorMessage: string;\n};\n\nexport const extractErrorKeyAndMessage = (\n errorConfig: string\n): ExtractErrorKeyAndMessage => {\n const fallbackData = { errorKey: '', defaultErrorMessage: '' };\n\n if (!errorConfig) return fallbackData;\n\n const index = errorConfig.indexOf(ERROR_CONFIG_SEPARATOR);\n\n if (index === -1) return fallbackData;\n\n return {\n errorKey: errorConfig.substring(0, index).trim(),\n defaultErrorMessage: errorConfig\n .substring(index + ERROR_CONFIG_SEPARATOR.length)\n .trim(),\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 { FieldElementProps } from '@/auth/types';\nimport { Field } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { memo } from 'preact/compat';\nimport { extractErrorKeyAndMessage } from '@/auth/lib/extractErrorKeyAndMessage';\nimport { VNode } from 'preact';\n\nexport const FieldElement = memo(\n ({\n item,\n errorConfig,\n className,\n itemClassName,\n loading,\n children,\n }: FieldElementProps) => {\n const { errorKey, defaultErrorMessage } =\n extractErrorKeyAndMessage(errorConfig);\n const customErrorMessage = useText(\n `Auth.FormText.${errorKey}.${item.code}`\n )[item.code];\n\n let errorMessage = '';\n\n // This check indicates that validation identified an error\n if (defaultErrorMessage.length) {\n errorMessage = customErrorMessage || defaultErrorMessage;\n }\n\n return (\n <Field\n key={item.id}\n error={errorMessage}\n className={classes([\n itemClassName,\n `${itemClassName}--${item.id}`,\n [`${itemClassName}--${item.id}-hidden`, item.isHidden],\n item.className,\n ])}\n data-testid={`${className}--${item.id}`}\n disabled={loading || item.disabled}\n >\n {children as VNode<{}>}\n </Field>\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 { FormElementProps } from '@/auth/types';\nimport { Input } from '@adobe-commerce/elsie/components';\nimport { memo } from 'preact/compat';\nimport { FieldElement } from './FieldElement';\n\nexport const InputElement = memo(\n ({\n item,\n valueMessage,\n errorConfig,\n onBlur,\n onChange,\n onFocus,\n className,\n itemClassName,\n loading,\n }: FormElementProps) => {\n return (\n <FieldElement\n item={item}\n errorConfig={errorConfig}\n className={className}\n itemClassName={itemClassName}\n loading={loading}\n >\n <Input\n type=\"text\"\n name={item.customUpperCode}\n value={valueMessage ?? item.defaultValue}\n placeholder={item.label}\n floatingLabel={`${item.label} ${item.required ? '*' : ''}`}\n autocomplete={item.autocomplete}\n onBlur={onBlur}\n onChange={onChange}\n onFocus={onFocus}\n />\n </FieldElement>\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 { FormElementProps } from '@/auth/types';\nimport { Picker } from '@adobe-commerce/elsie/components';\nimport { memo } from 'preact/compat';\nimport { FieldElement } from './FieldElement';\n\nexport const SelectElement = memo(\n ({\n item,\n valueMessage,\n errorConfig,\n onBlur,\n onChange,\n className,\n itemClassName,\n loading,\n }: FormElementProps) => {\n const defaultSelectValue = item.options.find(\n (option: { isDefault: boolean; value: string; text: string }) =>\n option.isDefault\n )?.value;\n\n return (\n <FieldElement\n item={item}\n errorConfig={errorConfig}\n className={className}\n itemClassName={itemClassName}\n loading={loading}\n >\n <Picker\n name={item.customUpperCode}\n floatingLabel={`${item.label} ${item.required ? '*' : ''}`}\n placeholder={item.label}\n aria-label={item.label}\n options={item.options}\n onBlur={onBlur}\n handleSelect={onChange}\n defaultValue={defaultSelectValue ?? valueMessage ?? item.defaultValue}\n value={defaultSelectValue ?? valueMessage ?? item.defaultValue}\n />\n </FieldElement>\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 { FormElementProps } from '@/auth/types';\nimport { InputDate } from '@adobe-commerce/elsie/components';\nimport { memo } from 'preact/compat';\nimport { FieldElement } from './FieldElement';\n\nexport const InputDateElement = memo(\n ({\n item,\n valueMessage,\n errorConfig,\n onBlur,\n onChange,\n className,\n itemClassName,\n loading,\n }: FormElementProps) => {\n return (\n <FieldElement\n item={item}\n errorConfig={errorConfig}\n className={className}\n itemClassName={itemClassName}\n loading={loading}\n >\n <InputDate\n // @ts-ignore\n type=\"text\"\n name={item.customUpperCode}\n value={valueMessage || item.defaultValue}\n placeholder={item.label}\n floatingLabel={`${item.label} ${item.required ? '*' : ''}`}\n onBlur={onBlur}\n onChange={onChange}\n disabled={loading || item.disabled}\n />\n </FieldElement>\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 { FormElementProps } from '@/auth/types';\nimport { Checkbox } from '@adobe-commerce/elsie/components';\nimport { memo } from 'preact/compat';\nimport { FieldElement } from './FieldElement';\n\nexport const InputCheckBoxElement = memo(\n ({\n item,\n valueMessage,\n errorConfig,\n onBlur,\n onChange,\n className,\n itemClassName,\n loading,\n }: FormElementProps) => {\n return (\n <FieldElement\n item={item}\n errorConfig={errorConfig}\n className={className}\n itemClassName={itemClassName}\n loading={loading}\n >\n <Checkbox\n name={item.customUpperCode}\n checked={valueMessage || item.defaultValue}\n placeholder={item.label}\n label={`${item.label} ${item.required ? '*' : ''}`}\n onBlur={onBlur}\n onChange={onChange}\n />\n </FieldElement>\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 { FormElementProps } from '@/auth/types';\nimport { TextArea } from '@adobe-commerce/elsie/components';\nimport { memo } from 'preact/compat';\nimport { FieldElement } from './FieldElement';\n\nexport const TextAreaElement = memo(\n ({\n item,\n valueMessage,\n errorConfig,\n onBlur,\n onChange,\n className,\n itemClassName,\n loading,\n }: FormElementProps) => {\n return (\n <FieldElement\n item={item}\n errorConfig={errorConfig}\n className={className}\n itemClassName={itemClassName}\n loading={loading}\n >\n <TextArea\n name={item.customUpperCode}\n value={valueMessage ?? item.defaultValue}\n label={`${item.label} ${item.required ? '*' : ''}`}\n onBlur={onBlur}\n onChange={onChange}\n />\n </FieldElement>\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 { extractErrorKeyAndMessage } from '@/auth/lib/extractErrorKeyAndMessage';\nimport { FormSlotProps } from '@/auth/types';\nimport { useText } from 'preact-i18n';\nimport { Slot } from '@adobe-commerce/elsie/lib';\n\nexport const FormSlot = ({\n slots,\n item,\n handleOnChange,\n handleOnBlur,\n handleOnFocus,\n errorConfig,\n errors,\n}: FormSlotProps) => {\n const { errorKey, defaultErrorMessage } =\n extractErrorKeyAndMessage(errorConfig);\n const customErrorMessage = useText(`Auth.FormText.${errorKey}.${item.code}`)[\n item.code\n ];\n\n let errorMessage = '';\n\n // This check indicates that validation identified an error\n if (defaultErrorMessage.length) {\n errorMessage = customErrorMessage || defaultErrorMessage;\n }\n\n const contextValue = {\n inputName: item.customUpperCode,\n handleOnChange,\n handleOnBlur,\n handleOnFocus,\n errorMessage,\n errors,\n config: item,\n };\n\n return (\n <Slot\n data-testid={`signUpFormInput_${item.code}`}\n name={`SignUpFormInput_${item.code}`}\n slot={slots?.[`SignUpFormInput_${item.code}`]}\n context={contextValue}\n key={item.id}\n />\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FieldsProps, FormProps } from '@/auth/types';\nimport { useForm } from '@/auth/hooks/components/useForm';\nimport { FieldEnumList } from '@/auth/data/models';\nimport {\n SelectElement,\n InputElement,\n InputDateElement,\n InputCheckBoxElement,\n TextAreaElement,\n FormSlot,\n} from './Elements';\nimport { memo } from 'preact/compat';\n\nexport const Form = memo(\n ({\n slots,\n name,\n loading,\n children,\n className = 'defaultForm',\n fieldsConfig = [],\n onSubmit,\n ...props\n }: FormProps) => {\n const {\n formData,\n errors,\n formRef,\n handleChange,\n handleBlur,\n handleSubmit,\n handleFocus,\n } = useForm({\n onSubmit,\n fieldsConfig,\n });\n\n const itemClassName = `${className}__field`;\n\n return (\n <form\n className={className}\n onSubmit={handleSubmit}\n name={name}\n ref={formRef}\n onFocus={handleFocus}\n {...props}\n >\n {fieldsConfig.map((item: FieldsProps) => {\n const errorConfig = errors?.[item.customUpperCode];\n const valueMessage = formData?.[item.customUpperCode] as string;\n const isSlot = !!slots?.[`SignUpFormInput_${item.code}`];\n\n const renderSlot = (\n <FormSlot\n slots={slots}\n item={item}\n handleOnChange={handleChange}\n handleOnBlur={handleBlur}\n handleOnFocus={handleFocus}\n errorConfig={errorConfig}\n errors={errors}\n />\n );\n\n switch (item.fieldType) {\n case FieldEnumList.TEXT: {\n if (isSlot) return renderSlot;\n\n if (item.options.length) {\n return (\n <SelectElement\n item={item}\n valueMessage={valueMessage}\n errorConfig={errorConfig}\n onBlur={handleBlur}\n onChange={handleChange}\n onFocus={handleFocus}\n itemClassName={itemClassName}\n className={className}\n loading={loading}\n />\n );\n }\n\n return (\n <InputElement\n item={item}\n valueMessage={valueMessage}\n errorConfig={errorConfig}\n onBlur={handleBlur}\n onChange={handleChange}\n onFocus={handleFocus}\n itemClassName={itemClassName}\n className={className}\n loading={loading}\n />\n );\n }\n\n case FieldEnumList.MULTILINE: {\n if (isSlot) return renderSlot;\n\n return (\n <InputElement\n item={item}\n valueMessage={valueMessage}\n errorConfig={errorConfig}\n onBlur={handleBlur}\n onChange={handleChange}\n onFocus={handleFocus}\n itemClassName={itemClassName}\n className={className}\n loading={loading}\n />\n );\n }\n\n case FieldEnumList.SELECT: {\n if (isSlot) return renderSlot;\n\n return (\n <SelectElement\n item={item}\n valueMessage={valueMessage}\n errorConfig={errorConfig}\n onBlur={handleBlur}\n onChange={handleChange}\n itemClassName={itemClassName}\n className={className}\n loading={loading}\n />\n );\n }\n\n case FieldEnumList.DATE: {\n if (isSlot) return renderSlot;\n\n return (\n <InputDateElement\n item={item}\n valueMessage={valueMessage}\n errorConfig={errorConfig}\n onBlur={handleBlur}\n onChange={handleChange}\n itemClassName={itemClassName}\n className={className}\n loading={loading}\n />\n );\n }\n\n case FieldEnumList.BOOLEAN: {\n if (isSlot) return renderSlot;\n\n return (\n <InputCheckBoxElement\n item={item}\n valueMessage={valueMessage}\n errorConfig={errorConfig}\n onBlur={handleBlur}\n onChange={handleChange}\n itemClassName={itemClassName}\n className={className}\n loading={loading}\n />\n );\n }\n\n case FieldEnumList.TEXTAREA: {\n if (isSlot) return renderSlot;\n\n return (\n <TextAreaElement\n item={item}\n valueMessage={valueMessage}\n errorConfig={errorConfig}\n onBlur={handleBlur}\n onChange={handleChange}\n itemClassName={itemClassName}\n className={className}\n loading={loading}\n />\n );\n }\n\n default:\n return null;\n }\n })}\n\n {children}\n </form>\n );\n }\n);\n"],"names":["ValidationErrorTypes","ERROR_CONFIG_SEPARATOR","useCustomTranslations","defaultKeys","translations","useText","keysToUpdate","key","value","translationKeys","acc","updatedTranslations","flattenObjectsArray","arr","obj","validateNumeric","validateAlphanumWithSpaces","validateAlphanumeric","validateAlpha","validateEmail","validateDate","isDateWithinRange","date","minTimestamp","maxTimestamp","dateTimestamp","convertTimestampToDate","timestamp","parsedTimestamp","isoDate","month","validateUrl","url","validateLength","minLength","maxLength","length","validationFields","configs","errorsList","requiredFieldError","lengthTextError","numericError","alphaNumWithSpacesError","alphaNumericError","alphaError","emailError","dateError","urlError","dateRangeError","dateMaxError","dateMinError","fieldName","defaultFields","_a","validateRulesConfig","min","max","dateMin","dateMax","parsedErrorMessage","validation","_b","initializeFormDataAndErrors","fieldsConfig","customUpperCode","required","defaultValue","excludedFocusClasses","useForm","onSubmit","formRef","useRef","focusExecutedRef","formData","setFormData","useState","errors","setErrors","handleValidationSubmit","useCallback","formValid","firstErrorField","name","fieldConfig","config","validationResult","input","useEffect","initialData","errorList","prev","handleFocus","event","target","isFocusable","className","initReCaptcha","handleChange","type","checked","fieldValue","handleBlur","handleSubmit","FieldEnumList","extractErrorKeyAndMessage","errorConfig","fallbackData","index","FieldElement","memo","item","itemClassName","loading","children","errorKey","defaultErrorMessage","customErrorMessage","errorMessage","jsx","Field","classes","InputElement","valueMessage","onBlur","onChange","onFocus","Input","SelectElement","defaultSelectValue","option","Picker","InputDateElement","InputDate","InputCheckBoxElement","Checkbox","TextAreaElement","TextArea","FormSlot","slots","handleOnChange","handleOnBlur","handleOnFocus","contextValue","Slot","Form","props","jsxs","isSlot","renderSlot"],"mappings":"ggBAIO,IAAKA,GAAAA,IACVA,EAAA,qBAAuB,qBACvBA,EAAA,cAAgB,eAChBA,EAAA,4BAA8B,0BAC9BA,EAAA,oBAAsB,oBACtBA,EAAA,YAAc,aACdA,EAAA,YAAc,aACdA,EAAA,WAAa,YACbA,EAAA,iBAAmB,iBACnBA,EAAA,eAAiB,eACjBA,EAAA,eAAiB,eACjBA,EAAA,UAAY,WACZA,EAAA,kBAAoB,kBAZVA,IAAAA,GAAA,CAAA,CAAA,EAqBL,MAAMC,EAAyB,MCCzBC,GACXC,GAC2B,CAK3B,MAAMC,EAAeC,EAAQF,CAAW,EAYlCG,EAAe,OAAO,QAAQF,CAAY,EAC7C,OACC,CAAC,CAACG,EAAKC,CAAK,IACVA,IAAU,MACT,OAAO,OAAOR,CAAoB,EAAe,SAASO,CAAG,CAAA,EAEjE,IAAI,CAAC,CAACA,CAAG,IAAMA,CAAG,EAOfE,EAAkBH,EAAa,OAAO,CAACI,EAAKH,KAChDG,EAAIH,CAAG,EAAI,iBAAiBA,CAAG,GACxBG,GACN,CAAA,CAA4B,EAGzBC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EAAeC,EAGjB9B,EAACa,GAAA,CACC,KAAArB,EACA,aAAAY,EACA,YAAAjB,EACA,OAAQJ,EACR,SAAUJ,EACV,cAAAc,EACA,UAAAhB,EACA,QAAAiB,CAAA,CAAA,EAKN,KAAKT,EAAc,QACjB,OAAI4C,EAAeC,EAGjB9B,EAACe,GAAA,CACC,KAAAvB,EACA,aAAAY,EACA,YAAAjB,EACA,OAAQJ,EACR,SAAUJ,EACV,cAAAc,EACA,UAAAhB,EACA,QAAAiB,CAAA,CAAA,EAKN,KAAKT,EAAc,SACjB,OAAI4C,EAAeC,EAGjB9B,EAACiB,GAAA,CACC,KAAAzB,EACA,aAAAY,EACA,YAAAjB,EACA,OAAQJ,EACR,SAAUJ,EACV,cAAAc,EACA,UAAAhB,EACA,QAAAiB,CAAA,CAAA,EAKN,QACE,OAAO,IAAA,CAEb,CAAC,EAEAC,CAAA,CAAA,CAAA,CAGP,CACF"}
|
package/chunks/Button2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button2.js","sources":["/@dropins/storefront-auth/src/lib/getFormValues.ts","/@dropins/storefront-auth/src/lib/checkIsFunction.ts","../../node_modules/@adobe-commerce/elsie/src/icons/Warning.svg","../../node_modules/@adobe-commerce/elsie/src/icons/CheckWithCircle.svg","../../node_modules/@adobe-commerce/elsie/src/icons/WarningWithCircle.svg","/@dropins/storefront-auth/src/hooks/useInLineAlert.tsx","/@dropins/storefront-auth/src/components/Button/Button.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const getFormValues = (form: any) => {\n if (!form) return null;\n\n const formData = new FormData(form);\n\n if (formData && typeof formData.entries === 'function') {\n const entries = formData.entries();\n if (entries && typeof entries[Symbol.iterator] === 'function') {\n return JSON.parse(JSON.stringify(Object.fromEntries(entries))) || {};\n }\n }\n return {};\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 checkIsFunction = (value: any): value is Function => {\n return typeof value === 'function';\n};\n","import * as React from \"react\";\nconst SvgWarning = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Warning_Base\", width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { clipPath: \"url(#clip0_841_1324)\" }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z\", stroke: \"currentColor\", strokeLinecap: \"round\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z\", stroke: \"currentColor\", strokeLinecap: \"round\", strokeLinejoin: \"round\" })), /* @__PURE__ */ React.createElement(\"defs\", null, /* @__PURE__ */ React.createElement(\"clipPath\", { id: \"clip0_841_1324\" }, /* @__PURE__ */ React.createElement(\"rect\", { width: 24, height: 21, fill: \"white\", transform: \"translate(0 1.5)\" }))));\nexport default SvgWarning;\n","import * as React from \"react\";\nconst SvgCheckWithCircle = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M6.75 12.762L10.2385 15.75L17.25 9\", stroke: \"currentColor\" }));\nexport default SvgCheckWithCircle;\n","import * as React from \"react\";\nconst SvgWarningWithCircle = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z\", stroke: \"currentColor\" }));\nexport default SvgWarningWithCircle;\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 { useState, useCallback } from 'preact/hooks';\nimport { InLineAlertInterface } from '../types';\nimport {\n CheckWithCircle as Success,\n Warning,\n WarningWithCircle as Error,\n} from '@adobe-commerce/elsie/icons';\n\nconst iconsList = {\n success: <Success />,\n warning: <Warning />,\n error: <Error />,\n};\n\nexport const useInLineAlert = () => {\n const [inLineAlertProps, setInLineAlertProps] =\n useState<InLineAlertInterface>({});\n\n const handleSetInLineAlertProps = useCallback(\n (notification: InLineAlertInterface | undefined) => {\n if (!notification || !notification.type) {\n setInLineAlertProps({});\n return;\n }\n\n const icon = iconsList[notification.type];\n\n setInLineAlertProps({\n ...notification,\n icon,\n });\n },\n []\n );\n\n return { inLineAlertProps, handleSetInLineAlertProps };\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, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { useCallback } from 'preact/hooks';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { Button as ElsieButton } from '@adobe-commerce/elsie/components';\nimport '@/auth/components/Button/Button.css';\n\nexport interface ButtonProps {\n type: 'submit' | 'button';\n variant?: 'primary' | 'secondary' | 'tertiary';\n className?: string;\n buttonText: string;\n enableLoader?: boolean;\n onClick?: (event: MouseEvent) => void;\n style?: Record<string, string | number>;\n icon?: VNode<HTMLAttributes<SVGSVGElement>>;\n disabled?: boolean;\n}\n\nexport const Button: FunctionComponent<ButtonProps> = ({\n type,\n buttonText,\n variant,\n className = '',\n enableLoader = false,\n onClick,\n style,\n icon,\n ...props\n}) => {\n const handleOnclick = useCallback(\n (event: MouseEvent) => {\n onClick?.(event);\n },\n [onClick]\n );\n\n const isLoader = enableLoader ? 'enableLoader' : '';\n\n return (\n <ElsieButton\n icon={icon}\n style={style}\n type={type}\n variant={variant}\n className={classes(['auth-button', className, isLoader])}\n onClick={handleOnclick}\n {...props}\n >\n <span className=\"auth-button__text\">{buttonText}</span>\n {enableLoader ? (\n <div className=\"auth-button__wrapper\">\n <span className=\"auth-button__loader\" />\n </div>\n ) : null}\n </ElsieButton>\n );\n};\n"],"names":["getFormValues","form","formData","entries","checkIsFunction","value","SvgWarning","props","React","SvgCheckWithCircle","SvgWarningWithCircle","iconsList","Success","Warning","Error","useInLineAlert","inLineAlertProps","setInLineAlertProps","useState","handleSetInLineAlertProps","useCallback","notification","icon","Button","type","buttonText","variant","className","enableLoader","onClick","style","handleOnclick","event","jsxs","ElsieButton","classes","jsx"],"mappings":"4TAiBa,MAAAA,EAAiBC,GAAc,CACtC,GAAA,CAACA,EAAa,OAAA,KAEZ,MAAAC,EAAW,IAAI,SAASD,CAAI,EAElC,GAAIC,GAAY,OAAOA,EAAS,SAAY,WAAY,CAChD,MAAAC,EAAUD,EAAS,QAAQ,EACjC,GAAIC,GAAW,OAAOA,EAAQ,OAAO,QAAQ,GAAM,WAC1C,OAAA,KAAK,MAAM,KAAK,UAAU,OAAO,YAAYA,CAAO,CAAC,CAAC,GAAK,CAAC,CACrE,CAEF,MAAO,CAAC,CACV,ECZaC,EAAmBC,GACvB,OAAOA,GAAU,WCjBpBC,EAAcC,GAA0BC,EAAM,cAAc,MAAO,CAAE,GAAI,oBAAqB,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GAAGD,CAAO,EAAkBC,EAAM,cAAc,IAAK,CAAE,SAAU,wBAA0CA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,6DAA8D,OAAQ,eA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GI,MAAAK,EAAOX,EAAUU,EAAa,IAAI,EAEpBJ,EAAA,CAClB,GAAGI,EACH,KAAAC,CAAA,CACD,CACH,EACA,CAAA,CACF,EAEO,MAAA,CAAE,iBAAAN,EAAkB,0BAAAG,CAA0B,CACvD,ECjBaI,EAAyC,CAAC,CACrD,KAAAC,EACA,WAAAC,EACA,QAAAC,EACA,UAAAC,EAAY,GACZ,aAAAC,EAAe,GACf,QAAAC,EACA,MAAAC,EACA,KAAAR,EACA,GAAGf,CACL,IAAM,CACJ,MAAMwB,EAAgBX,EACnBY,GAAsB,CACrBH,GAAA,MAAAA,EAAUG,EACZ,EACA,CAACH,CAAO,CACV,EAKE,OAAAI,EAACC,EAAA,CACC,KAAAZ,EACA,MAAAQ,EACA,KAAAN,EACA,QAAAE,EACA,UAAWS,EAAQ,CAAC,cAAeR,EARtBC,EAAe,eAAiB,EAQS,CAAC,EACvD,QAASG,EACR,GAAGxB,EAEJ,SAAA,CAAC6B,EAAA,OAAA,CAAK,UAAU,oBAAqB,SAAWX,EAAA,EAC/CG,EACEQ,EAAA,MAAA,CAAI,UAAU,uBACb,WAAC,OAAK,CAAA,UAAU,qBAAsB,CAAA,CACxC,CAAA,EACE,IAAA,CAAA,CACN,CAEJ","x_google_ignoreList":[2,3,4]}
|
|
1
|
+
{"version":3,"file":"Button2.js","sources":["/@dropins/storefront-auth/src/lib/getFormValues.ts","/@dropins/storefront-auth/src/lib/checkIsFunction.ts","../../node_modules/@adobe-commerce/elsie/src/icons/Warning.svg","../../node_modules/@adobe-commerce/elsie/src/icons/CheckWithCircle.svg","../../node_modules/@adobe-commerce/elsie/src/icons/WarningWithCircle.svg","/@dropins/storefront-auth/src/hooks/useInLineAlert.tsx","/@dropins/storefront-auth/src/components/Button/Button.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const getFormValues = (form: any) => {\n if (!form) return null;\n\n const formData = new FormData(form);\n\n if (formData && typeof formData.entries === 'function') {\n const entries = formData.entries();\n if (entries && typeof entries[Symbol.iterator] === 'function') {\n return JSON.parse(JSON.stringify(Object.fromEntries(entries))) || {};\n }\n }\n return {};\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 checkIsFunction = (value: any): value is Function => {\n return typeof value === 'function';\n};\n","import * as React from \"react\";\nconst SvgWarning = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Warning_Base\", width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { clipPath: \"url(#clip0_841_1324)\" }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z\", stroke: \"currentColor\", strokeLinecap: \"round\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z\", stroke: \"currentColor\", strokeLinecap: \"round\", strokeLinejoin: \"round\" })), /* @__PURE__ */ React.createElement(\"defs\", null, /* @__PURE__ */ React.createElement(\"clipPath\", { id: \"clip0_841_1324\" }, /* @__PURE__ */ React.createElement(\"rect\", { width: 24, height: 21, fill: \"white\", transform: \"translate(0 1.5)\" }))));\nexport default SvgWarning;\n","import * as React from \"react\";\nconst SvgCheckWithCircle = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M6.75 12.762L10.2385 15.75L17.25 9\", stroke: \"currentColor\" }));\nexport default SvgCheckWithCircle;\n","import * as React from \"react\";\nconst SvgWarningWithCircle = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z\", stroke: \"currentColor\" }));\nexport default SvgWarningWithCircle;\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 { useState, useCallback } from 'preact/hooks';\nimport { InLineAlertInterface } from '../types';\nimport {\n CheckWithCircle as Success,\n Warning,\n WarningWithCircle as Error,\n} from '@adobe-commerce/elsie/icons';\n\nconst iconsList = {\n success: <Success />,\n warning: <Warning />,\n error: <Error />,\n};\n\nexport const useInLineAlert = () => {\n const [inLineAlertProps, setInLineAlertProps] =\n useState<InLineAlertInterface>({});\n\n const handleSetInLineAlertProps = useCallback(\n (notification: InLineAlertInterface | undefined) => {\n if (!notification || !notification.type) {\n setInLineAlertProps({});\n return;\n }\n\n const icon = iconsList[notification.type];\n\n setInLineAlertProps({\n ...notification,\n icon,\n });\n },\n []\n );\n\n return { inLineAlertProps, handleSetInLineAlertProps };\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, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { useCallback } from 'preact/hooks';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { Button as ElsieButton } from '@adobe-commerce/elsie/components';\nimport '@/auth/components/Button/Button.css';\n\nexport interface ButtonProps {\n type: 'submit' | 'button';\n variant?: 'primary' | 'secondary' | 'tertiary';\n className?: string;\n buttonText: string;\n enableLoader?: boolean;\n onClick?: (event: MouseEvent) => void;\n style?: Record<string, string | number>;\n icon?: VNode<HTMLAttributes<SVGSVGElement>>;\n disabled?: boolean;\n}\n\nexport const Button: FunctionComponent<ButtonProps> = ({\n type,\n buttonText,\n variant,\n className = '',\n enableLoader = false,\n onClick,\n style,\n icon,\n ...props\n}) => {\n const handleOnclick = useCallback(\n (event: MouseEvent) => {\n onClick?.(event);\n },\n [onClick]\n );\n\n const isLoader = enableLoader ? 'enableLoader' : '';\n\n return (\n <ElsieButton\n icon={icon}\n style={style}\n type={type}\n variant={variant}\n className={classes(['auth-button', className, isLoader])}\n onClick={handleOnclick}\n {...props}\n >\n <span className=\"auth-button__text\">{buttonText}</span>\n {enableLoader ? (\n <div className=\"auth-button__wrapper\">\n <span className=\"auth-button__loader\" />\n </div>\n ) : null}\n </ElsieButton>\n );\n};\n"],"names":["getFormValues","form","formData","entries","checkIsFunction","value","SvgWarning","props","React","SvgCheckWithCircle","SvgWarningWithCircle","iconsList","Success","Warning","Error","useInLineAlert","inLineAlertProps","setInLineAlertProps","useState","handleSetInLineAlertProps","useCallback","notification","icon","Button","type","buttonText","variant","className","enableLoader","onClick","style","handleOnclick","event","jsxs","ElsieButton","classes","jsx"],"mappings":"4TAiBO,MAAMA,EAAiBC,GAAc,CAC1C,GAAI,CAACA,EAAM,OAAO,KAElB,MAAMC,EAAW,IAAI,SAASD,CAAI,EAElC,GAAIC,GAAY,OAAOA,EAAS,SAAY,WAAY,CACtD,MAAMC,EAAUD,EAAS,QAAA,EACzB,GAAIC,GAAW,OAAOA,EAAQ,OAAO,QAAQ,GAAM,WACjD,OAAO,KAAK,MAAM,KAAK,UAAU,OAAO,YAAYA,CAAO,CAAC,CAAC,GAAK,CAAA,CAEtE,CACA,MAAO,CAAA,CACT,ECZaC,EAAmBC,GACvB,OAAOA,GAAU,WCjBpBC,EAAcC,GAA0BC,EAAM,cAAc,MAAO,CAAE,GAAI,oBAAqB,MAAO,GAAI,OAAQ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AAM,CAACC,EAAkBC,CAAmB,EAC1CC,EAA+B,CAAA,CAAE,EAE7BC,EAA4BC,EAC/BC,GAAmD,CAClD,GAAI,CAACA,GAAgB,CAACA,EAAa,KAAM,CACvCJ,EAAoB,CAAA,CAAE,EACtB,MACF,CAEA,MAAMK,EAAOX,EAAUU,EAAa,IAAI,EAExCJ,EAAoB,CAClB,GAAGI,EACH,KAAAC,CAAA,CACD,CACH,EACA,CAAA,CAAC,EAGH,MAAO,CAAE,iBAAAN,EAAkB,0BAAAG,CAAA,CAC7B,ECjBaI,EAAyC,CAAC,CACrD,KAAAC,EACA,WAAAC,EACA,QAAAC,EACA,UAAAC,EAAY,GACZ,aAAAC,EAAe,GACf,QAAAC,EACA,MAAAC,EACA,KAAAR,EACA,GAAGf,CACL,IAAM,CACJ,MAAMwB,EAAgBX,EACnBY,GAAsB,CACrBH,GAAA,MAAAA,EAAUG,EACZ,EACA,CAACH,CAAO,CAAA,EAKV,OACEI,EAACC,EAAA,CACC,KAAAZ,EACA,MAAAQ,EACA,KAAAN,EACA,QAAAE,EACA,UAAWS,EAAQ,CAAC,cAAeR,EARtBC,EAAe,eAAiB,EAQS,CAAC,EACvD,QAASG,EACR,GAAGxB,EAEJ,SAAA,CAAA6B,EAAC,OAAA,CAAK,UAAU,oBAAqB,SAAAX,EAAW,EAC/CG,EACCQ,EAAC,MAAA,CAAI,UAAU,uBACb,WAAC,OAAA,CAAK,UAAU,qBAAA,CAAsB,CAAA,CACxC,EACE,IAAA,CAAA,CAAA,CAGV","x_google_ignoreList":[2,3,4]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResetPasswordForm.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/ChevronDown.svg","/@dropins/storefront-auth/src/hooks/components/useResetPasswordForm.tsx","/@dropins/storefront-auth/src/components/ResetPasswordForm/ResetPasswordForm.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgChevronDown = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { d: \"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701\", stroke: \"currentColor\", strokeWidth: 1.5, strokeLinecap: \"square\", strokeLinejoin: \"round\" }));\nexport default SvgChevronDown;\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 { requestPasswordResetEmail } from '@/auth/api';\nimport { checkIsFunction } from '@/auth/lib/checkIsFunction';\nimport { getFormValues } from '@/auth/lib/getFormValues';\nimport { UseResetPasswordFormProps } from '@/auth/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { useCallback, useState } from 'preact/hooks';\nimport { validateEmail } from '@/auth/lib/validationFields';\n\nexport const useResetPasswordForm = ({\n routeSignIn,\n onErrorCallback,\n onSuccessCallback,\n setActiveComponent,\n handleSetInLineAlertProps,\n}: UseResetPasswordFormProps) => {\n const translations = useText({\n successPasswordResetEmailNotification:\n 'Auth.Notification.successPasswordResetEmailNotification',\n });\n const [isLoading, setIsLoading] = useState(false);\n\n const submitResetPassword = useCallback(\n async (event: any): Promise<void> => {\n event.preventDefault();\n\n const formValues = getFormValues(event.target);\n\n if (!validateEmail(formValues?.email)) {\n return;\n }\n\n setIsLoading(true);\n\n const response = await requestPasswordResetEmail(formValues.email);\n\n setIsLoading(false);\n\n if (!response.success) {\n onErrorCallback?.(response);\n handleSetInLineAlertProps?.({\n type: 'error',\n text: response.message,\n });\n return;\n }\n\n if (onSuccessCallback) {\n await onSuccessCallback();\n return;\n }\n\n handleSetInLineAlertProps?.({\n type: 'success',\n text: translations.successPasswordResetEmailNotification.replace(\n '{email}',\n formValues.email\n ),\n });\n },\n [\n handleSetInLineAlertProps,\n onErrorCallback,\n onSuccessCallback,\n translations.successPasswordResetEmailNotification,\n ]\n );\n\n const redirectToSignInPage = useCallback(() => {\n if (checkIsFunction(setActiveComponent)) {\n setActiveComponent('signInForm');\n return;\n }\n\n if (checkIsFunction(routeSignIn)) {\n window.location.href = routeSignIn();\n }\n }, [setActiveComponent, routeSignIn]);\n\n return {\n isLoading,\n submitResetPassword,\n redirectToSignInPage,\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 { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport '@/auth/components/ResetPasswordForm/ResetPasswordForm.css';\nimport { useResetPasswordForm } from '@/auth/hooks/components/useResetPasswordForm';\nimport { ResetPasswordFormProps } from '@/auth/types';\nimport { ChevronDown as ChevronLeft } from '@adobe-commerce/elsie/icons';\nimport { Form, Button } from '@/auth/components';\nimport { useInLineAlert } from '@/auth/hooks/useInLineAlert';\nimport { Header, InLineAlert } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { simplifyTransformAttributesForm } from '@/auth/lib/simplifyTransformAttributesForm';\nimport { DEFAULT__RESET_PASSWORD_EMAIL_FIELD } from '@/auth/configs/defaultCreateUserConfigs';\n\nexport const ResetPasswordForm: FunctionComponent<\n ResetPasswordFormProps & HTMLAttributes<HTMLDivElement>\n> = ({\n formSize = 'default',\n routeSignIn,\n setActiveComponent,\n onErrorCallback,\n onSuccessCallback,\n ...props\n}) => {\n const translations = useText({\n title: 'Auth.ResetPasswordForm.title',\n buttonPrimary: 'Auth.ResetPasswordForm.buttonPrimary',\n buttonSecondary: 'Auth.ResetPasswordForm.buttonSecondary',\n formAriaLabel: 'Auth.ResetPasswordForm.formAriaLabel',\n });\n\n const { inLineAlertProps, handleSetInLineAlertProps } = useInLineAlert();\n\n const { isLoading, submitResetPassword, redirectToSignInPage } =\n useResetPasswordForm({\n routeSignIn,\n setActiveComponent,\n onErrorCallback,\n onSuccessCallback,\n handleSetInLineAlertProps,\n });\n\n return (\n <div\n {...props}\n className={classes([\n 'auth-reset-password-form',\n `auth-reset-password-form--${formSize}`,\n ])}\n data-testid=\"resetPasswordForm\"\n >\n <Header\n title={translations.title}\n divider={false}\n className=\"auth-reset-password-form__title\"\n />\n {inLineAlertProps.text ? (\n <InLineAlert\n className=\"auth-reset-password-form__notification\"\n type={inLineAlertProps.type}\n variant=\"secondary\"\n heading={inLineAlertProps.text}\n icon={inLineAlertProps.icon}\n />\n ) : null}\n <Form\n aria-labelledby={translations.formAriaLabel}\n name=\"resetPassword_form\"\n className=\"auth-reset-password-form__form\"\n onSubmit={submitResetPassword}\n loading={isLoading}\n fieldsConfig={simplifyTransformAttributesForm(\n DEFAULT__RESET_PASSWORD_EMAIL_FIELD\n )}\n >\n <div className=\"auth-reset-password-form__buttons\">\n <Button\n className=\"auth-reset-password-form__buttons--signin\"\n type=\"button\"\n variant=\"tertiary\"\n style={{ padding: '0' }}\n icon={<ChevronLeft style={{ transform: 'rotate(90deg)' }} />}\n buttonText={translations.buttonSecondary}\n enableLoader={false}\n onClick={redirectToSignInPage}\n />\n <Button\n type=\"submit\"\n buttonText={translations.buttonPrimary}\n variant=\"primary\"\n enableLoader={isLoading}\n />\n </div>\n </Form>\n <div id=\"requestPasswordResetEmail\" />\n </div>\n );\n};\n"],"names":["SvgChevronDown","props","React","useResetPasswordForm","routeSignIn","onErrorCallback","onSuccessCallback","setActiveComponent","handleSetInLineAlertProps","translations","useText","isLoading","setIsLoading","useState","submitResetPassword","useCallback","event","formValues","getFormValues","validateEmail","response","requestPasswordResetEmail","redirectToSignInPage","checkIsFunction","ResetPasswordForm","formSize","inLineAlertProps","useInLineAlert","jsxs","classes","jsx","Header","InLineAlert","Form","simplifyTransformAttributesForm","DEFAULT__RESET_PASSWORD_EMAIL_FIELD","Button","ChevronLeft"],"mappings":"wnBACA,MAAMA,EAAkBC,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GAAGD,CAAO,EAAkBC,EAAM,cAAc,OAAQ,CAAE,EAAG,kDAAmD,OAAQ,eAAgB,YAAa,IAAK,cAAe,SAAU,eAAgB,OAAO,CAAE,CAAC,ECwB/WC,EAAuB,CAAC,CACnC,YAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,mBAAAC,EACA,0BAAAC,CACF,IAAiC,CAC/B,MAAMC,EAAeC,EAAQ,CAC3B,sCACE,yDAAA,CACH,EACK,CAACC,EAAWC,CAAY,EAAIC,EAAS,EAAK,EAE1CC,EAAsBC,EAC1B,MAAOC,GAA8B,CACnCA,EAAM,eAAe,EAEf,MAAAC,EAAaC,EAAcF,EAAM,MAAM,EAE7C,GAAI,CAACG,EAAcF,GAAA,YAAAA,EAAY,KAAK,EAClC,OAGFL,EAAa,EAAI,EAEjB,MAAMQ,EAAW,MAAMC,EAA0BJ,EAAW,KAAK,EAI7D,GAFJL,EAAa,EAAK,EAEd,CAACQ,EAAS,QAAS,CACrBf,GAAA,MAAAA,EAAkBe,GACUZ,GAAA,MAAAA,EAAA,CAC1B,KAAM,QACN,KAAMY,EAAS,OAAA,GAEjB,MAAA,CAGF,GAAId,EAAmB,CACrB,MAAMA,EAAkB,EACxB,MAAA,CAG0BE,GAAA,MAAAA,EAAA,CAC1B,KAA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C,CACF,EAEA,SAAAP,EAAC,MAAI,CAAA,UAAU,oCACb,SAAA,CAAAE,EAACM,EAAA,CACC,UAAU,4CACV,KAAK,SACL,QAAQ,WACR,MAAO,CAAE,QAAS,GAAI,EACtB,KAAON,EAAAO,EAAA,CAAY,MAAO,CAAE,UAAW,iBAAmB,EAC1D,WAAY5B,EAAa,gBACzB,aAAc,GACd,QAASa,CAAA,CACX,EACAQ,EAACM,EAAA,CACC,KAAK,SACL,WAAY3B,EAAa,cACzB,QAAQ,UACR,aAAcE,CAAA,CAAA,CAChB,CACF,CAAA,CAAA,CACF,EACAmB,EAAC,MAAI,CAAA,GAAG,2BAA4B,CAAA,CAAA,CAAA,CACtC,CAEJ","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"ResetPasswordForm.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/ChevronDown.svg","/@dropins/storefront-auth/src/hooks/components/useResetPasswordForm.tsx","/@dropins/storefront-auth/src/components/ResetPasswordForm/ResetPasswordForm.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgChevronDown = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { d: \"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701\", stroke: \"currentColor\", strokeWidth: 1.5, strokeLinecap: \"square\", strokeLinejoin: \"round\" }));\nexport default SvgChevronDown;\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 { requestPasswordResetEmail } from '@/auth/api';\nimport { checkIsFunction } from '@/auth/lib/checkIsFunction';\nimport { getFormValues } from '@/auth/lib/getFormValues';\nimport { UseResetPasswordFormProps } from '@/auth/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { useCallback, useState } from 'preact/hooks';\nimport { validateEmail } from '@/auth/lib/validationFields';\n\nexport const useResetPasswordForm = ({\n routeSignIn,\n onErrorCallback,\n onSuccessCallback,\n setActiveComponent,\n handleSetInLineAlertProps,\n}: UseResetPasswordFormProps) => {\n const translations = useText({\n successPasswordResetEmailNotification:\n 'Auth.Notification.successPasswordResetEmailNotification',\n });\n const [isLoading, setIsLoading] = useState(false);\n\n const submitResetPassword = useCallback(\n async (event: any): Promise<void> => {\n event.preventDefault();\n\n const formValues = getFormValues(event.target);\n\n if (!validateEmail(formValues?.email)) {\n return;\n }\n\n setIsLoading(true);\n\n const response = await requestPasswordResetEmail(formValues.email);\n\n setIsLoading(false);\n\n if (!response.success) {\n onErrorCallback?.(response);\n handleSetInLineAlertProps?.({\n type: 'error',\n text: response.message,\n });\n return;\n }\n\n if (onSuccessCallback) {\n await onSuccessCallback();\n return;\n }\n\n handleSetInLineAlertProps?.({\n type: 'success',\n text: translations.successPasswordResetEmailNotification.replace(\n '{email}',\n formValues.email\n ),\n });\n },\n [\n handleSetInLineAlertProps,\n onErrorCallback,\n onSuccessCallback,\n translations.successPasswordResetEmailNotification,\n ]\n );\n\n const redirectToSignInPage = useCallback(() => {\n if (checkIsFunction(setActiveComponent)) {\n setActiveComponent('signInForm');\n return;\n }\n\n if (checkIsFunction(routeSignIn)) {\n window.location.href = routeSignIn();\n }\n }, [setActiveComponent, routeSignIn]);\n\n return {\n isLoading,\n submitResetPassword,\n redirectToSignInPage,\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 { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport '@/auth/components/ResetPasswordForm/ResetPasswordForm.css';\nimport { useResetPasswordForm } from '@/auth/hooks/components/useResetPasswordForm';\nimport { ResetPasswordFormProps } from '@/auth/types';\nimport { ChevronDown as ChevronLeft } from '@adobe-commerce/elsie/icons';\nimport { Form, Button } from '@/auth/components';\nimport { useInLineAlert } from '@/auth/hooks/useInLineAlert';\nimport { Header, InLineAlert } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { simplifyTransformAttributesForm } from '@/auth/lib/simplifyTransformAttributesForm';\nimport { DEFAULT__RESET_PASSWORD_EMAIL_FIELD } from '@/auth/configs/defaultCreateUserConfigs';\n\nexport const ResetPasswordForm: FunctionComponent<\n ResetPasswordFormProps & HTMLAttributes<HTMLDivElement>\n> = ({\n formSize = 'default',\n routeSignIn,\n setActiveComponent,\n onErrorCallback,\n onSuccessCallback,\n ...props\n}) => {\n const translations = useText({\n title: 'Auth.ResetPasswordForm.title',\n buttonPrimary: 'Auth.ResetPasswordForm.buttonPrimary',\n buttonSecondary: 'Auth.ResetPasswordForm.buttonSecondary',\n formAriaLabel: 'Auth.ResetPasswordForm.formAriaLabel',\n });\n\n const { inLineAlertProps, handleSetInLineAlertProps } = useInLineAlert();\n\n const { isLoading, submitResetPassword, redirectToSignInPage } =\n useResetPasswordForm({\n routeSignIn,\n setActiveComponent,\n onErrorCallback,\n onSuccessCallback,\n handleSetInLineAlertProps,\n });\n\n return (\n <div\n {...props}\n className={classes([\n 'auth-reset-password-form',\n `auth-reset-password-form--${formSize}`,\n ])}\n data-testid=\"resetPasswordForm\"\n >\n <Header\n title={translations.title}\n divider={false}\n className=\"auth-reset-password-form__title\"\n />\n {inLineAlertProps.text ? (\n <InLineAlert\n className=\"auth-reset-password-form__notification\"\n type={inLineAlertProps.type}\n variant=\"secondary\"\n heading={inLineAlertProps.text}\n icon={inLineAlertProps.icon}\n />\n ) : null}\n <Form\n aria-labelledby={translations.formAriaLabel}\n name=\"resetPassword_form\"\n className=\"auth-reset-password-form__form\"\n onSubmit={submitResetPassword}\n loading={isLoading}\n fieldsConfig={simplifyTransformAttributesForm(\n DEFAULT__RESET_PASSWORD_EMAIL_FIELD\n )}\n >\n <div className=\"auth-reset-password-form__buttons\">\n <Button\n className=\"auth-reset-password-form__buttons--signin\"\n type=\"button\"\n variant=\"tertiary\"\n style={{ padding: '0' }}\n icon={<ChevronLeft style={{ transform: 'rotate(90deg)' }} />}\n buttonText={translations.buttonSecondary}\n enableLoader={false}\n onClick={redirectToSignInPage}\n />\n <Button\n type=\"submit\"\n buttonText={translations.buttonPrimary}\n variant=\"primary\"\n enableLoader={isLoading}\n />\n </div>\n </Form>\n <div id=\"requestPasswordResetEmail\" />\n </div>\n );\n};\n"],"names":["SvgChevronDown","props","React","useResetPasswordForm","routeSignIn","onErrorCallback","onSuccessCallback","setActiveComponent","handleSetInLineAlertProps","translations","useText","isLoading","setIsLoading","useState","submitResetPassword","useCallback","event","formValues","getFormValues","validateEmail","response","requestPasswordResetEmail","redirectToSignInPage","checkIsFunction","ResetPasswordForm","formSize","inLineAlertProps","useInLineAlert","jsxs","classes","jsx","Header","InLineAlert","Form","simplifyTransformAttributesForm","DEFAULT__RESET_PASSWORD_EMAIL_FIELD","Button","ChevronLeft"],"mappings":"wnBACA,MAAMA,EAAkBC,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GAAGD,CAAK,EAAoBC,EAAM,cAAc,OAAQ,CAAE,EAAG,kDAAmD,OAAQ,eAAgB,YAAa,IAAK,cAAe,S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3,"file":"SignInForm.js","sources":["/@dropins/storefront-auth/src/hooks/components/useSignInForm.tsx","/@dropins/storefront-auth/src/lib/clearUrlAndReplace.ts","/@dropins/storefront-auth/src/hooks/useEmailConfirmation.tsx","/@dropins/storefront-auth/src/components/SignInForm/SignInForm.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 { getFormValues } from '@/auth/lib/getFormValues';\nimport { useCallback, useState, useMemo, useEffect } from 'preact/hooks';\nimport { getCustomerToken, resendConfirmationEmail } from '@/auth/api';\nimport { AdditionalActionsAlertProps, useSignInFormProps } from '@/auth/types';\nimport { DEFAULT__SIGN_IN_EMAIL_FIELD } from '@/auth/configs/defaultCreateUserConfigs';\nimport { simplifyTransformAttributesForm } from '@/auth/lib/simplifyTransformAttributesForm';\nimport { checkIsFunction } from '@/auth/lib/checkIsFunction';\nimport { focusOnEmptyPasswordField } from '@/auth/lib/focusOnEmptyPasswordField';\n\nexport const useSignInForm = ({\n emailConfirmationStatusMessage,\n translations,\n initialEmailValue,\n routeSignUp,\n routeForgotPassword,\n routeRedirectOnSignIn,\n onErrorCallback,\n setActiveComponent,\n onSuccessCallback,\n onSignUpLinkClick,\n handleSetInLineAlertProps,\n routeRedirectOnEmailConfirmationClose,\n}: useSignInFormProps) => {\n const [userEmail, setUserEmail] = useState('');\n const [showEmailConfirmationForm, setShowEmailConfirmationForm] =\n useState(false);\n const [signInPasswordValue, setSignInPasswordValue] = useState('');\n const [passwordError, setPasswordError] = useState(false);\n const [isSuccessful, setIsSuccessful] = useState({\n userName: '',\n status: false,\n });\n const [isLoading, setIsLoading] = useState(false);\n const [additionalActionsAlert, setAdditionalActionsAlert] =\n useState<AdditionalActionsAlertProps>([]);\n\n const actionsShowNotificationForm = useCallback(\n async (email: string) => {\n handleSetInLineAlertProps();\n setShowEmailConfirmationForm(true);\n setPasswordError(false);\n setAdditionalActionsAlert([]);\n\n await resendConfirmationEmail(email);\n },\n [handleSetInLineAlertProps]\n );\n\n const handleSetPassword = useCallback((value: string) => {\n if (value.length) {\n setPasswordError(false);\n } else {\n setPasswordError(true);\n }\n setSignInPasswordValue(value);\n }, []);\n\n useEffect(() => {\n if (emailConfirmationStatusMessage?.text) {\n handleSetInLineAlertProps({\n text: emailConfirmationStatusMessage.text,\n type: emailConfirmationStatusMessage.status\n ? emailConfirmationStatusMessage.status\n : undefined,\n });\n }\n }, [emailConfirmationStatusMessage, handleSetInLineAlertProps]);\n\n const onBlurPassword = useCallback(() => {\n if (!signInPasswordValue.length) {\n setPasswordError(true);\n }\n }, [signInPasswordValue]);\n\n const checkPasswordAndFocus = useCallback(\n (event: SubmitEvent, isValid: boolean): boolean => {\n if (!signInPasswordValue.length) {\n setPasswordError(true);\n\n if (!isValid) return true;\n\n focusOnEmptyPasswordField(event, signInPasswordValue, '');\n return true;\n }\n\n return false;\n },\n [signInPasswordValue]\n );\n\n const onAuthenticationSuccess = useCallback(\n (event: SubmitEvent, loginResponse: Record<string, string>) => {\n if (loginResponse?.userName) {\n (event.target as HTMLFormElement).reset();\n\n if (checkIsFunction(routeRedirectOnSignIn)) {\n window.location.href = routeRedirectOnSignIn();\n } else {\n onSuccessCallback?.({\n userName: loginResponse?.userName,\n status: true,\n });\n\n setIsSuccessful({\n userName: loginResponse?.userName,\n status: true,\n });\n }\n }\n },\n [onSuccessCallback, routeRedirectOnSignIn]\n );\n\n const onAuthenticationFailed = useCallback(\n (loginResponse: { errorMessage: string }, email: string) => {\n if (loginResponse?.errorMessage?.length) {\n setUserEmail(email);\n\n /**\n * TODO: Use error code when available, instead of comparing to response text\n *\n * This implementation is a temporary solution.\n * The backend functionality is planned to be improved to obtain accurate data that will help correctly identify error types and handle them.\n */\n const isIncludesMessage = loginResponse.errorMessage.includes(\n \"This account isn't confirmed. Verify and try again.\"\n );\n\n const errorMessage: string = isIncludesMessage\n ? translations.resendEmailInformationText\n : loginResponse.errorMessage;\n\n if (isIncludesMessage) {\n setAdditionalActionsAlert([\n {\n label: translations.resendEmailButtonText,\n onClick: () => {\n actionsShowNotificationForm(email);\n },\n },\n ]);\n } else {\n setAdditionalActionsAlert([]);\n }\n\n handleSetInLineAlertProps({\n text: errorMessage,\n type: 'error',\n });\n\n setSignInPasswordValue('');\n }\n },\n [\n actionsShowNotificationForm,\n handleSetInLineAlertProps,\n translations.resendEmailButtonText,\n translations.resendEmailInformationText,\n ]\n );\n\n const submitLogInUser = useCallback(\n async (event: SubmitEvent, isValid: boolean): Promise<void> => {\n handleSetInLineAlertProps();\n\n if (checkPasswordAndFocus(event, isValid)) return;\n\n setIsLoading(true);\n\n const formValues = getFormValues(event.target);\n const isFormComplete = Object.values(formValues).every((value) => value);\n\n if (isFormComplete) {\n const { email, password } = formValues;\n\n const loginResponse = await getCustomerToken({\n email,\n password,\n handleSetInLineAlertProps,\n onErrorCallback,\n translations,\n });\n\n onAuthenticationFailed(loginResponse, email);\n onAuthenticationSuccess(event, loginResponse);\n\n setPasswordError(false);\n }\n\n setIsLoading(false);\n },\n [\n translations,\n onErrorCallback,\n checkPasswordAndFocus,\n onAuthenticationFailed,\n onAuthenticationSuccess,\n handleSetInLineAlertProps,\n ]\n );\n\n const forgotPasswordCallback = useCallback(() => {\n if (checkIsFunction(setActiveComponent)) {\n setActiveComponent('resetPasswordForm');\n\n return;\n }\n\n if (checkIsFunction(routeForgotPassword)) {\n window.location.href = routeForgotPassword();\n }\n }, [routeForgotPassword, setActiveComponent]);\n\n const onSignUpLinkClickCallback = useCallback(() => {\n if (checkIsFunction(onSignUpLinkClick)) {\n onSignUpLinkClick();\n }\n\n if (checkIsFunction(setActiveComponent)) {\n setActiveComponent('signUpForm');\n\n return;\n }\n\n if (checkIsFunction(routeSignUp)) {\n window.location.href = routeSignUp();\n }\n }, [onSignUpLinkClick, routeSignUp, setActiveComponent]);\n\n const defaultEnhancedEmailFields: any = useMemo(() => {\n const fieldsList = simplifyTransformAttributesForm(\n DEFAULT__SIGN_IN_EMAIL_FIELD\n );\n\n if (!initialEmailValue?.length) return fieldsList;\n\n return fieldsList?.map((el: any) => ({\n ...el,\n defaultValue: initialEmailValue,\n }));\n }, [initialEmailValue]);\n\n const handledOnPrimaryButtonClick = useCallback(() => {\n handleSetInLineAlertProps();\n\n if (checkIsFunction(routeRedirectOnEmailConfirmationClose)) {\n window.location.href = routeRedirectOnEmailConfirmationClose();\n } else {\n setShowEmailConfirmationForm(false);\n }\n }, [handleSetInLineAlertProps, routeRedirectOnEmailConfirmationClose]);\n\n return {\n additionalActionsAlert,\n userEmail,\n defaultEnhancedEmailFields,\n passwordError,\n isSuccessful,\n isLoading,\n signInPasswordValue,\n showEmailConfirmationForm,\n setShowEmailConfirmationForm,\n setSignInPasswordValue,\n submitLogInUser,\n forgotPasswordCallback,\n onSignUpLinkClickCallback,\n handledOnPrimaryButtonClick,\n handleSetPassword,\n onBlurPassword,\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 clearUrlAndReplace = () => {\n let url = new URL(window.location.href);\n\n let email = url.searchParams.get('email');\n let token = url.searchParams.get('key');\n\n if (email && token) {\n url.searchParams.delete('email');\n url.searchParams.delete('key');\n\n window.history.replaceState({}, document.title, url.toString());\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 { useEffect, useState } from 'preact/hooks';\nimport { clearUrlAndReplace } from '../lib/clearUrlAndReplace';\nimport { confirmEmail } from '../api';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\ninterface useEmailConfirmationProps {\n enableEmailConfirmation: boolean;\n}\n\n// The client receives a confirmation of the validation via email. When the client follows the provided link, they are directed to the login page with three query parameters. If these parameters are present, we make a request to validate the status. This request returns a response that we display to the user.\nexport const useEmailConfirmation = ({\n enableEmailConfirmation,\n}: useEmailConfirmationProps) => {\n const translations = useText({\n accountConfirmMessage: 'Auth.EmailConfirmationForm.accountConfirmMessage',\n accountConfirmationEmailSuccessMessage:\n 'Auth.EmailConfirmationForm.accountConfirmationEmailSuccessMessage',\n });\n const [emailConfirmationStatusMessage, setEmailConfirmationStatusMessage] =\n useState<{\n text: string;\n status: '' | 'success' | 'error';\n }>({\n text: '',\n status: '',\n });\n\n useEffect(() => {\n if (enableEmailConfirmation) {\n const { search } = window.location;\n\n if (search.includes('email=') && search.includes('key=')) {\n const validateEmailStatus = async () => {\n const params = new URLSearchParams(search);\n\n const response = await confirmEmail({\n customerEmail: params.get('email') as string,\n customerConfirmationKey: params.get('key') as string,\n });\n\n if (!response) return null;\n\n if (response?.errors?.length) {\n setEmailConfirmationStatusMessage({\n text: response?.errors[0].message,\n status: 'error',\n });\n } else {\n setEmailConfirmationStatusMessage({\n text: response.data.confirmEmail.customer.email\n ? translations.accountConfirmationEmailSuccessMessage.replace(\n '{email}',\n response?.data?.confirmEmail.customer?.email\n )\n : translations.accountConfirmMessage,\n status: 'success',\n });\n\n clearUrlAndReplace();\n }\n };\n\n validateEmailStatus();\n }\n }\n }, [enableEmailConfirmation, translations]);\n\n return { emailConfirmationStatusMessage };\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 { useSignInForm } from '@/auth/hooks/components/useSignInForm';\nimport { SignInFormProps } from '@/auth/types';\nimport { useEmailConfirmation } from '@/auth/hooks/useEmailConfirmation';\nimport { Form, Button, EmailConfirmationForm } from '@/auth/components';\nimport { useInLineAlert } from '@/auth/hooks/useInLineAlert';\nimport { Header, InLineAlert, InputPassword } from '@adobe-commerce/elsie/components';\nimport '@/auth/components/SignInForm/SignInForm.css';\nimport { useCustomTranslations } from '@/auth/hooks/useCustomTranslations';\n\nexport const SignInForm: FunctionComponent<SignInFormProps> = ({\n slots,\n labels,\n formSize = 'default',\n initialEmailValue = '',\n renderSignUpLink = false,\n enableEmailConfirmation = false,\n hideCloseBtnOnEmailConfirmation = false,\n routeRedirectOnEmailConfirmationClose,\n routeRedirectOnSignIn,\n routeForgotPassword,\n routeSignUp,\n onSuccessCallback,\n setActiveComponent,\n onErrorCallback,\n onSignUpLinkClick,\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.SignInForm.title',\n buttonPrimary: 'Auth.SignInForm.buttonPrimary',\n buttonSecondary: 'Auth.SignInForm.buttonSecondary',\n buttonTertiary: 'Auth.SignInForm.buttonTertiary',\n resendEmailInformationText:\n 'Auth.Notification.resendEmailNotification.informationText',\n resendEmailButtonText:\n 'Auth.Notification.resendEmailNotification.buttonText',\n customerTokenErrorMessage: 'Auth.Api.customerTokenErrorMessage',\n placeholder: 'Auth.InputPassword.placeholder',\n floatingLabel: 'Auth.InputPassword.floatingLabel',\n requiredFieldError: 'Auth.FormText.requiredFieldError.default',\n });\n\n const { emailConfirmationStatusMessage } = useEmailConfirmation({\n enableEmailConfirmation,\n });\n\n const { inLineAlertProps, handleSetInLineAlertProps } = useInLineAlert();\n\n const {\n userEmail,\n additionalActionsAlert,\n defaultEnhancedEmailFields,\n passwordError,\n isSuccessful,\n isLoading,\n signInPasswordValue,\n showEmailConfirmationForm,\n submitLogInUser,\n forgotPasswordCallback,\n onSignUpLinkClickCallback,\n handledOnPrimaryButtonClick,\n handleSetPassword,\n onBlurPassword,\n } = useSignInForm({\n translations,\n emailConfirmationStatusMessage,\n initialEmailValue,\n routeSignUp,\n routeForgotPassword,\n routeRedirectOnSignIn,\n setActiveComponent,\n onErrorCallback,\n onSuccessCallback,\n onSignUpLinkClick,\n handleSetInLineAlertProps,\n routeRedirectOnEmailConfirmationClose,\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={handledOnPrimaryButtonClick}\n />\n );\n }\n\n return (\n <div\n className={classes([\n 'auth-sign-in-form',\n `auth-sign-in-form--${formSize}`,\n ])}\n data-testid=\"signInForm\"\n >\n <Header\n title={labels?.formTitleText ?? translations.title}\n divider={false}\n className=\"auth-sign-in-form__title\"\n />\n {inLineAlertProps.text ? (\n <InLineAlert\n data-testid=\"authInLineAlert\"\n className=\"auth-sign-in-form__notification\"\n type={inLineAlertProps.type}\n variant=\"secondary\"\n heading={inLineAlertProps.text}\n icon={inLineAlertProps.icon}\n additionalActions={additionalActionsAlert}\n />\n ) : null}\n <Form\n name=\"signIn_form\"\n className=\"auth-sign-in-form__form\"\n onSubmit={submitLogInUser}\n loading={isLoading}\n fieldsConfig={defaultEnhancedEmailFields}\n >\n <InputPassword\n hideStatusIndicator\n className=\"auth-sign-in-form__form__password\"\n autoComplete={'current-password'}\n errorMessage={\n passwordError ? translations.requiredFieldError : undefined\n }\n defaultValue={signInPasswordValue}\n onValue={handleSetPassword}\n onBlur={onBlurPassword}\n placeholder={translations.placeholder}\n floatingLabel={translations.floatingLabel}\n />\n <div className=\"auth-sign-in-form__form__buttons\">\n <div className=\"auth-sign-in-form__form__buttons__combine\">\n <Button\n type=\"button\"\n variant=\"tertiary\"\n style={{ padding: 0 }}\n buttonText={translations.buttonTertiary}\n className=\"auth-sign-in-form__button auth-sign-in-form__button--forgot\"\n enableLoader={false}\n onClick={forgotPasswordCallback}\n data-testid=\"switchToSignUp\"\n />\n {renderSignUpLink ? <span /> : null}\n {renderSignUpLink ? (\n <Button\n type=\"button\"\n variant=\"tertiary\"\n style={{ padding: 0 }}\n buttonText={translations.buttonSecondary}\n className=\"auth-sign-in-form__button auth-sign-in-form__button--signup\"\n enableLoader={false}\n onClick={onSignUpLinkClickCallback}\n />\n ) : null}\n </div>\n <Button\n type=\"submit\"\n buttonText={labels?.primaryButtonText ?? translations.buttonPrimary}\n variant=\"primary\"\n className=\"auth-sign-in-form__button auth-sign-in-form__button--submit\"\n enableLoader={isLoading}\n />\n </div>\n </Form>\n <div id=\"generateCustomerToken\" />\n </div>\n );\n};\n"],"names":["useSignInForm","emailConfirmationStatusMessage","translations","initialEmailValue","routeSignUp","routeForgotPassword","routeRedirectOnSignIn","onErrorCallback","setActiveComponent","onSuccessCallback","onSignUpLinkClick","handleSetInLineAlertProps","routeRedirectOnEmailConfirmationClose","userEmail","setUserEmail","useState","showEmailConfirmationForm","setShowEmailConfirmationForm","signInPasswordValue","setSignInPasswordValue","passwordError","setPasswordError","isSuccessful","setIsSuccessful","isLoading","setIsLoading","additionalActionsAlert","setAdditionalActionsAlert","actionsShowNotificationForm","useCallback","email","resendConfirmationEmail","handleSetPassword","value","useEffect","onBlurPassword","checkPasswordAndFocus","event","isValid","focusOnEmptyPasswordField","onAuthenticationSuccess","loginResponse","checkIsFunction","onAuthenticationFailed","_a","isIncludesMessage","errorMessage","submitLogInUser","formValues","getFormValues","password","getCustomerToken","forgotPasswordCallback","onSignUpLinkClickCallback","defaultEnhancedEmailFields","useMemo","fieldsList","simplifyTransformAttributesForm","DEFAULT__SIGN_IN_EMAIL_FIELD","el","handledOnPrimaryButtonClick","clearUrlAndReplace","url","token","useEmailConfirmation","enableEmailConfirmation","useText","setEmailConfirmationStatusMessage","search","params","response","confirmEmail","_c","_b","SignInForm","slots","labels","formSize","renderSignUpLink","hideCloseBtnOnEmailConfirmation","useCustomTranslations","inLineAlertProps","useInLineAlert","jsx","Slot","EmailConfirmationForm","jsxs","classes","Header","InLineAlert","Form","InputPassword","Button"],"mappings":"gyBA0BO,MAAMA,GAAgB,CAAC,CAC5B,+BAAAC,EACA,aAAAC,EACA,kBAAAC,EACA,YAAAC,EACA,oBAAAC,EACA,sBAAAC,EACA,gBAAAC,EACA,mBAAAC,EACA,kBAAAC,EACA,kBAAAC,EACA,0BAAAC,EACA,sCAAAC,CACF,IAA0B,CACxB,KAAM,CAACC,EAAWC,CAAY,EAAIC,EAAS,EAAE,EACvC,CAACC,EAA2BC,CAA4B,EAC5DF,EAAS,EAAK,EACV,CAACG,EAAqBC,CAAsB,EAAIJ,EAAS,EAAE,EAC3D,CAACK,EAAeC,CAAgB,EAAIN,EAAS,EAAK,EAClD,CAACO,EAAcC,CAAe,EAAIR,EAAS,C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R,EAAiB,KACvB,QAAQ,YACR,QAASA,EAAiB,KAC1B,KAAMA,EAAiB,KACvB,kBAAmBvD,CAAA,CAAA,EAEnB,KACJ4D,EAACI,GAAA,CACC,KAAK,cACL,UAAU,0BACV,SAAU3C,EACV,QAASvB,EACT,aAAc8B,EAEd,SAAA,CAAA6B,EAACQ,GAAA,CACC,oBAAmB,GACnB,UAAU,oCACV,aAAc,mBACd,aACEvE,EAAgBlB,EAAa,mBAAqB,OAEpD,aAAcgB,EACd,QAASc,EACT,OAAQG,EACR,YAAajC,EAAa,YAC1B,cAAeA,EAAa,aAAA,CAC9B,EACAoF,EAAC,MAAI,CAAA,UAAU,mCACb,SAAA,CAACA,EAAA,MAAA,CAAI,UAAU,4CACb,SAAA,CAAAH,EAACS,EAAA,CACC,KAAK,SACL,QAAQ,WACR,MAAO,CAAE,QAAS,CAAE,EACpB,WAAY1F,EAAa,eACzB,UAAU,8DACV,aAAc,GACd,QAASkD,EACT,cAAY,gBAAA,CACd,EACC0B,EAAoBK,EAAA,OAAA,CAAA,CAAK,EAAK,KAC9BL,EACCK,EAACS,EAAA,CACC,KAAK,SACL,QAAQ,WACR,MAAO,CAAE,QAAS,CAAE,EACpB,WAAY1F,EAAa,gBACzB,UAAU,8DACV,aAAc,GACd,QAASmD,CAAA,CAAA,EAET,IAAA,EACN,EACA8B,EAACS,EAAA,CACC,KAAK,SACL,YAAYhB,GAAA,YAAAA,EAAQ,oBAAqB1E,EAAa,cACtD,QAAQ,UACR,UAAU,8DACV,aAAcsB,CAAA,CAAA,CAChB,CACF,CAAA,CAAA,CAAA,CACF,EACA2D,EAAC,MAAI,CAAA,GAAG,uBAAwB,CAAA,CAAA,CAAA,CAClC,CAEJ"}
|
|
1
|
+
{"version":3,"file":"SignInForm.js","sources":["/@dropins/storefront-auth/src/hooks/components/useSignInForm.tsx","/@dropins/storefront-auth/src/lib/clearUrlAndReplace.ts","/@dropins/storefront-auth/src/hooks/useEmailConfirmation.tsx","/@dropins/storefront-auth/src/components/SignInForm/SignInForm.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 { getFormValues } from '@/auth/lib/getFormValues';\nimport { useCallback, useState, useMemo, useEffect } from 'preact/hooks';\nimport { getCustomerToken, resendConfirmationEmail } from '@/auth/api';\nimport { AdditionalActionsAlertProps, useSignInFormProps } from '@/auth/types';\nimport { DEFAULT__SIGN_IN_EMAIL_FIELD } from '@/auth/configs/defaultCreateUserConfigs';\nimport { simplifyTransformAttributesForm } from '@/auth/lib/simplifyTransformAttributesForm';\nimport { checkIsFunction } from '@/auth/lib/checkIsFunction';\nimport { focusOnEmptyPasswordField } from '@/auth/lib/focusOnEmptyPasswordField';\n\nexport const useSignInForm = ({\n emailConfirmationStatusMessage,\n translations,\n initialEmailValue,\n routeSignUp,\n routeForgotPassword,\n routeRedirectOnSignIn,\n onErrorCallback,\n setActiveComponent,\n onSuccessCallback,\n onSignUpLinkClick,\n handleSetInLineAlertProps,\n routeRedirectOnEmailConfirmationClose,\n}: useSignInFormProps) => {\n const [userEmail, setUserEmail] = useState('');\n const [showEmailConfirmationForm, setShowEmailConfirmationForm] =\n useState(false);\n const [signInPasswordValue, setSignInPasswordValue] = useState('');\n const [passwordError, setPasswordError] = useState(false);\n const [isSuccessful, setIsSuccessful] = useState({\n userName: '',\n status: false,\n });\n const [isLoading, setIsLoading] = useState(false);\n const [additionalActionsAlert, setAdditionalActionsAlert] =\n useState<AdditionalActionsAlertProps>([]);\n\n const actionsShowNotificationForm = useCallback(\n async (email: string) => {\n handleSetInLineAlertProps();\n setShowEmailConfirmationForm(true);\n setPasswordError(false);\n setAdditionalActionsAlert([]);\n\n await resendConfirmationEmail(email);\n },\n [handleSetInLineAlertProps]\n );\n\n const handleSetPassword = useCallback((value: string) => {\n if (value.length) {\n setPasswordError(false);\n } else {\n setPasswordError(true);\n }\n setSignInPasswordValue(value);\n }, []);\n\n useEffect(() => {\n if (emailConfirmationStatusMessage?.text) {\n handleSetInLineAlertProps({\n text: emailConfirmationStatusMessage.text,\n type: emailConfirmationStatusMessage.status\n ? emailConfirmationStatusMessage.status\n : undefined,\n });\n }\n }, [emailConfirmationStatusMessage, handleSetInLineAlertProps]);\n\n const onBlurPassword = useCallback(() => {\n if (!signInPasswordValue.length) {\n setPasswordError(true);\n }\n }, [signInPasswordValue]);\n\n const checkPasswordAndFocus = useCallback(\n (event: SubmitEvent, isValid: boolean): boolean => {\n if (!signInPasswordValue.length) {\n setPasswordError(true);\n\n if (!isValid) return true;\n\n focusOnEmptyPasswordField(event, signInPasswordValue, '');\n return true;\n }\n\n return false;\n },\n [signInPasswordValue]\n );\n\n const onAuthenticationSuccess = useCallback(\n (event: SubmitEvent, loginResponse: Record<string, string>) => {\n if (loginResponse?.userName) {\n (event.target as HTMLFormElement).reset();\n\n if (checkIsFunction(routeRedirectOnSignIn)) {\n window.location.href = routeRedirectOnSignIn();\n } else {\n onSuccessCallback?.({\n userName: loginResponse?.userName,\n status: true,\n });\n\n setIsSuccessful({\n userName: loginResponse?.userName,\n status: true,\n });\n }\n }\n },\n [onSuccessCallback, routeRedirectOnSignIn]\n );\n\n const onAuthenticationFailed = useCallback(\n (loginResponse: { errorMessage: string }, email: string) => {\n if (loginResponse?.errorMessage?.length) {\n setUserEmail(email);\n\n /**\n * TODO: Use error code when available, instead of comparing to response text\n *\n * This implementation is a temporary solution.\n * The backend functionality is planned to be improved to obtain accurate data that will help correctly identify error types and handle them.\n */\n const isIncludesMessage = loginResponse.errorMessage.includes(\n \"This account isn't confirmed. Verify and try again.\"\n );\n\n const errorMessage: string = isIncludesMessage\n ? translations.resendEmailInformationText\n : loginResponse.errorMessage;\n\n if (isIncludesMessage) {\n setAdditionalActionsAlert([\n {\n label: translations.resendEmailButtonText,\n onClick: () => {\n actionsShowNotificationForm(email);\n },\n },\n ]);\n } else {\n setAdditionalActionsAlert([]);\n }\n\n handleSetInLineAlertProps({\n text: errorMessage,\n type: 'error',\n });\n\n setSignInPasswordValue('');\n }\n },\n [\n actionsShowNotificationForm,\n handleSetInLineAlertProps,\n translations.resendEmailButtonText,\n translations.resendEmailInformationText,\n ]\n );\n\n const submitLogInUser = useCallback(\n async (event: SubmitEvent, isValid: boolean): Promise<void> => {\n handleSetInLineAlertProps();\n\n if (checkPasswordAndFocus(event, isValid)) return;\n\n setIsLoading(true);\n\n const formValues = getFormValues(event.target);\n const isFormComplete = Object.values(formValues).every((value) => value);\n\n if (isFormComplete) {\n const { email, password } = formValues;\n\n const loginResponse = await getCustomerToken({\n email,\n password,\n handleSetInLineAlertProps,\n onErrorCallback,\n translations,\n });\n\n onAuthenticationFailed(loginResponse, email);\n onAuthenticationSuccess(event, loginResponse);\n\n setPasswordError(false);\n }\n\n setIsLoading(false);\n },\n [\n translations,\n onErrorCallback,\n checkPasswordAndFocus,\n onAuthenticationFailed,\n onAuthenticationSuccess,\n handleSetInLineAlertProps,\n ]\n );\n\n const forgotPasswordCallback = useCallback(() => {\n if (checkIsFunction(setActiveComponent)) {\n setActiveComponent('resetPasswordForm');\n\n return;\n }\n\n if (checkIsFunction(routeForgotPassword)) {\n window.location.href = routeForgotPassword();\n }\n }, [routeForgotPassword, setActiveComponent]);\n\n const onSignUpLinkClickCallback = useCallback(() => {\n if (checkIsFunction(onSignUpLinkClick)) {\n onSignUpLinkClick();\n }\n\n if (checkIsFunction(setActiveComponent)) {\n setActiveComponent('signUpForm');\n\n return;\n }\n\n if (checkIsFunction(routeSignUp)) {\n window.location.href = routeSignUp();\n }\n }, [onSignUpLinkClick, routeSignUp, setActiveComponent]);\n\n const defaultEnhancedEmailFields: any = useMemo(() => {\n const fieldsList = simplifyTransformAttributesForm(\n DEFAULT__SIGN_IN_EMAIL_FIELD\n );\n\n if (!initialEmailValue?.length) return fieldsList;\n\n return fieldsList?.map((el: any) => ({\n ...el,\n defaultValue: initialEmailValue,\n }));\n }, [initialEmailValue]);\n\n const handledOnPrimaryButtonClick = useCallback(() => {\n handleSetInLineAlertProps();\n\n if (checkIsFunction(routeRedirectOnEmailConfirmationClose)) {\n window.location.href = routeRedirectOnEmailConfirmationClose();\n } else {\n setShowEmailConfirmationForm(false);\n }\n }, [handleSetInLineAlertProps, routeRedirectOnEmailConfirmationClose]);\n\n return {\n additionalActionsAlert,\n userEmail,\n defaultEnhancedEmailFields,\n passwordError,\n isSuccessful,\n isLoading,\n signInPasswordValue,\n showEmailConfirmationForm,\n setShowEmailConfirmationForm,\n setSignInPasswordValue,\n submitLogInUser,\n forgotPasswordCallback,\n onSignUpLinkClickCallback,\n handledOnPrimaryButtonClick,\n handleSetPassword,\n onBlurPassword,\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 clearUrlAndReplace = () => {\n let url = new URL(window.location.href);\n\n let email = url.searchParams.get('email');\n let token = url.searchParams.get('key');\n\n if (email && token) {\n url.searchParams.delete('email');\n url.searchParams.delete('key');\n\n window.history.replaceState({}, document.title, url.toString());\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 { useEffect, useState } from 'preact/hooks';\nimport { clearUrlAndReplace } from '../lib/clearUrlAndReplace';\nimport { confirmEmail } from '../api';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\ninterface useEmailConfirmationProps {\n enableEmailConfirmation: boolean;\n}\n\n// The client receives a confirmation of the validation via email. When the client follows the provided link, they are directed to the login page with three query parameters. If these parameters are present, we make a request to validate the status. This request returns a response that we display to the user.\nexport const useEmailConfirmation = ({\n enableEmailConfirmation,\n}: useEmailConfirmationProps) => {\n const translations = useText({\n accountConfirmMessage: 'Auth.EmailConfirmationForm.accountConfirmMessage',\n accountConfirmationEmailSuccessMessage:\n 'Auth.EmailConfirmationForm.accountConfirmationEmailSuccessMessage',\n });\n const [emailConfirmationStatusMessage, setEmailConfirmationStatusMessage] =\n useState<{\n text: string;\n status: '' | 'success' | 'error';\n }>({\n text: '',\n status: '',\n });\n\n useEffect(() => {\n if (enableEmailConfirmation) {\n const { search } = window.location;\n\n if (search.includes('email=') && search.includes('key=')) {\n const validateEmailStatus = async () => {\n const params = new URLSearchParams(search);\n\n const response = await confirmEmail({\n customerEmail: params.get('email') as string,\n customerConfirmationKey: params.get('key') as string,\n });\n\n if (!response) return null;\n\n if (response?.errors?.length) {\n setEmailConfirmationStatusMessage({\n text: response?.errors[0].message,\n status: 'error',\n });\n } else {\n setEmailConfirmationStatusMessage({\n text: response.data.confirmEmail.customer.email\n ? translations.accountConfirmationEmailSuccessMessage.replace(\n '{email}',\n response?.data?.confirmEmail.customer?.email\n )\n : translations.accountConfirmMessage,\n status: 'success',\n });\n\n clearUrlAndReplace();\n }\n };\n\n validateEmailStatus();\n }\n }\n }, [enableEmailConfirmation, translations]);\n\n return { emailConfirmationStatusMessage };\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 { useSignInForm } from '@/auth/hooks/components/useSignInForm';\nimport { SignInFormProps } from '@/auth/types';\nimport { useEmailConfirmation } from '@/auth/hooks/useEmailConfirmation';\nimport { Form, Button, EmailConfirmationForm } from '@/auth/components';\nimport { useInLineAlert } from '@/auth/hooks/useInLineAlert';\nimport { Header, InLineAlert, InputPassword } from '@adobe-commerce/elsie/components';\nimport '@/auth/components/SignInForm/SignInForm.css';\nimport { useCustomTranslations } from '@/auth/hooks/useCustomTranslations';\n\nexport const SignInForm: FunctionComponent<SignInFormProps> = ({\n slots,\n labels,\n formSize = 'default',\n initialEmailValue = '',\n renderSignUpLink = false,\n enableEmailConfirmation = false,\n hideCloseBtnOnEmailConfirmation = false,\n routeRedirectOnEmailConfirmationClose,\n routeRedirectOnSignIn,\n routeForgotPassword,\n routeSignUp,\n onSuccessCallback,\n setActiveComponent,\n onErrorCallback,\n onSignUpLinkClick,\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.SignInForm.title',\n buttonPrimary: 'Auth.SignInForm.buttonPrimary',\n buttonSecondary: 'Auth.SignInForm.buttonSecondary',\n buttonTertiary: 'Auth.SignInForm.buttonTertiary',\n resendEmailInformationText:\n 'Auth.Notification.resendEmailNotification.informationText',\n resendEmailButtonText:\n 'Auth.Notification.resendEmailNotification.buttonText',\n customerTokenErrorMessage: 'Auth.Api.customerTokenErrorMessage',\n placeholder: 'Auth.InputPassword.placeholder',\n floatingLabel: 'Auth.InputPassword.floatingLabel',\n requiredFieldError: 'Auth.FormText.requiredFieldError.default',\n });\n\n const { emailConfirmationStatusMessage } = useEmailConfirmation({\n enableEmailConfirmation,\n });\n\n const { inLineAlertProps, handleSetInLineAlertProps } = useInLineAlert();\n\n const {\n userEmail,\n additionalActionsAlert,\n defaultEnhancedEmailFields,\n passwordError,\n isSuccessful,\n isLoading,\n signInPasswordValue,\n showEmailConfirmationForm,\n submitLogInUser,\n forgotPasswordCallback,\n onSignUpLinkClickCallback,\n handledOnPrimaryButtonClick,\n handleSetPassword,\n onBlurPassword,\n } = useSignInForm({\n translations,\n emailConfirmationStatusMessage,\n initialEmailValue,\n routeSignUp,\n routeForgotPassword,\n routeRedirectOnSignIn,\n setActiveComponent,\n onErrorCallback,\n onSuccessCallback,\n onSignUpLinkClick,\n handleSetInLineAlertProps,\n routeRedirectOnEmailConfirmationClose,\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={handledOnPrimaryButtonClick}\n />\n );\n }\n\n return (\n <div\n className={classes([\n 'auth-sign-in-form',\n `auth-sign-in-form--${formSize}`,\n ])}\n data-testid=\"signInForm\"\n >\n <Header\n title={labels?.formTitleText ?? translations.title}\n divider={false}\n className=\"auth-sign-in-form__title\"\n />\n {inLineAlertProps.text ? (\n <InLineAlert\n data-testid=\"authInLineAlert\"\n className=\"auth-sign-in-form__notification\"\n type={inLineAlertProps.type}\n variant=\"secondary\"\n heading={inLineAlertProps.text}\n icon={inLineAlertProps.icon}\n additionalActions={additionalActionsAlert}\n />\n ) : null}\n <Form\n name=\"signIn_form\"\n className=\"auth-sign-in-form__form\"\n onSubmit={submitLogInUser}\n loading={isLoading}\n fieldsConfig={defaultEnhancedEmailFields}\n >\n <InputPassword\n hideStatusIndicator\n className=\"auth-sign-in-form__form__password\"\n autoComplete={'current-password'}\n errorMessage={\n passwordError ? translations.requiredFieldError : undefined\n }\n defaultValue={signInPasswordValue}\n onValue={handleSetPassword}\n onBlur={onBlurPassword}\n placeholder={translations.placeholder}\n floatingLabel={translations.floatingLabel}\n />\n <div className=\"auth-sign-in-form__form__buttons\">\n <div className=\"auth-sign-in-form__form__buttons__combine\">\n <Button\n type=\"button\"\n variant=\"tertiary\"\n style={{ padding: 0 }}\n buttonText={translations.buttonTertiary}\n className=\"auth-sign-in-form__button auth-sign-in-form__button--forgot\"\n enableLoader={false}\n onClick={forgotPasswordCallback}\n data-testid=\"switchToSignUp\"\n />\n {renderSignUpLink ? <span /> : null}\n {renderSignUpLink ? (\n <Button\n type=\"button\"\n variant=\"tertiary\"\n style={{ padding: 0 }}\n buttonText={translations.buttonSecondary}\n className=\"auth-sign-in-form__button auth-sign-in-form__button--signup\"\n enableLoader={false}\n onClick={onSignUpLinkClickCallback}\n />\n ) : null}\n </div>\n <Button\n type=\"submit\"\n buttonText={labels?.primaryButtonText ?? translations.buttonPrimary}\n variant=\"primary\"\n className=\"auth-sign-in-form__button auth-sign-in-form__button--submit\"\n enableLoader={isLoading}\n />\n </div>\n </Form>\n <div id=\"generateCustomerToken\" />\n </div>\n );\n};\n"],"names":["useSignInForm","emailConfirmationStatusMessage","translations","initialEmailValue","routeSignUp","routeForgotPassword","routeRedirectOnSignIn","onErrorCallback","setActiveComponent","onSuccessCallback","onSignUpLinkClick","handleSetInLineAlertProps","routeRedirectOnEmailConfirmationClose","userEmail","setUserEmail","useState","showEmailConfirmationForm","setShowEmailConfirmationForm","signInPasswordValue","setSignInPasswordValue","passwordError","setPasswordError","isSuccessful","setIsSuccessful","isLoading","setIsLoading","additionalActionsAlert","setAdditionalActionsAlert","actionsShowNotificationForm","useCallback","email","resendConfirmationEmail","handleSetPassword","value","useEffect","onBlurPassword","checkPasswordAndFocus","event","isValid","focusOnEmptyPasswordField","onAuthenticationSuccess","loginResponse","checkIsFunction","onAuthenticationFailed","_a","isIncludesMessage","errorMessage","submitLogInUser","formValues","getFormValues","password","getCustomerToken","forgotPasswordCallback","onSignUpLinkClickCallback","defaultEnhancedEmailFields","useMemo","fieldsList","simplifyTransformAttributesForm","DEFAULT__SIGN_IN_EMAIL_FIELD","el","handledOnPrimaryButtonClick","clearUrlAndReplace","url","token","useEmailConfirmation","enableEmailConfirmation","useText","setEmailConfirmationStatusMessage","search","params","response","confirmEmail","_c","_b","SignInForm","slots","labels","formSize","renderSignUpLink","hideCloseBtnOnEmailConfirmation","useCustomTranslations","inLineAlertProps","useInLineAlert","jsx","Slot","EmailConfirmationForm","jsxs","classes","Header","InLineAlert","Form","InputPassword","Button"],"mappings":"gyBA0BO,MAAMA,GAAgB,CAAC,CAC5B,+BAAAC,EACA,aAAAC,EACA,kBAAAC,EACA,YAAAC,EACA,oBAAAC,EACA,sBAAAC,EACA,gBAAAC,EACA,mBAAAC,EACA,kBAAAC,EACA,kBAAAC,EACA,0BAAAC,EACA,sCAAAC,CACF,IAA0B,CACxB,KAAM,CAACC,EAAWC,CAAY,EAAIC,EAAS,EAAE,EACvC,CAACC,EAA2BC,CAA4B,EAC5DF,EAAS,EAAK,EACV,CAACG,EAAqBC,CAAsB,EAAIJ,EAAS,EAAE,EAC3D,CAACK,EAAeC,CAAgB,EAAIN,EAAS,EAAK,EAClD,CAACO,EAAcC,CAAe,EAAIR,EAAS,CAC/C,SAAU,GACV,OAAQ,EAAA,CACT,EACK,CAACS,EAAWC,CAAY,EAAIV,EAAS,EAAK,EAC1C,CAACW,EAAwBC,CAAyB,EACtDZ,EAAsC,CAAA,CAAE,EAEpCa,EAA8BC,E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