@dropins/storefront-auth 0.0.1-alpha2 → 0.0.1-alpha21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/confirmEmail/confirmEmail.d.ts +4 -0
- package/api/confirmEmail/graphql/confirmEmail.graphql.d.ts +2 -0
- package/api/confirmEmail/index.d.ts +2 -0
- package/api/createCustomer/createCustomer.d.ts +4 -0
- package/api/createCustomer/graphql/createCustomer.graphql.d.ts +2 -0
- package/api/createCustomer/graphql/createCustomerV2.graphql.d.ts +2 -0
- package/api/createCustomer/index.d.ts +2 -0
- package/api/createCustomerAddress/createCustomerAddress.d.ts +4 -0
- package/api/createCustomerAddress/graphql/createCustomerAddress.graphql.d.ts +2 -0
- package/api/createCustomerAddress/index.d.ts +2 -0
- package/api/fetch-graphql/fetch-graphql.d.ts +8 -0
- package/api/fetch-graphql/index.d.ts +2 -0
- package/api/getAttributesForm/getAttributesForm.d.ts +4 -0
- package/api/getAttributesForm/graphql/getAttributesForm.graphql.d.ts +2 -0
- package/api/getAttributesForm/index.d.ts +2 -0
- package/api/getCustomerData/getCustomerData.d.ts +4 -0
- package/api/getCustomerData/graphql/getCustomerData.graphql.d.ts +2 -0
- package/api/getCustomerData/index.d.ts +2 -0
- package/api/getCustomerToken/getCustomerToken.d.ts +15 -0
- package/api/getCustomerToken/graphql/getCustomerToken.graphql.d.ts +2 -0
- package/api/getCustomerToken/index.d.ts +2 -0
- package/api/getStoreConfig/getStoreConfig.d.ts +4 -0
- package/api/getStoreConfig/graphql/getStoreConfig.graphql.d.ts +2 -0
- package/api/getStoreConfig/index.d.ts +2 -0
- package/api/index.d.ts +14 -0
- package/api/initialize/index.d.ts +2 -0
- package/api/initialize/initialize.d.ts +14 -0
- package/api/requestPasswordResetEmail/graphql/requestPasswordResetEmail.graphql.d.ts +2 -0
- package/api/requestPasswordResetEmail/index.d.ts +2 -0
- package/api/requestPasswordResetEmail/requestPasswordResetEmail.d.ts +4 -0
- package/api/resendConfirmationEmail/graphql/resendConfirmationEmail.graphql.d.ts +2 -0
- package/api/resendConfirmationEmail/index.d.ts +2 -0
- package/api/resendConfirmationEmail/resendConfirmationEmail.d.ts +4 -0
- package/api/resetPassword/graphql/resetPassword.graphql.d.ts +2 -0
- package/api/resetPassword/index.d.ts +2 -0
- package/api/resetPassword/resetPassword.d.ts +4 -0
- package/api/revokeCustomerToken/graphql/revokeCustomerToken.graphql.d.ts +2 -0
- package/api/revokeCustomerToken/index.d.ts +2 -0
- package/api/revokeCustomerToken/revokeCustomerToken.d.ts +4 -0
- package/api.d.ts +1 -0
- package/api.js +1 -1
- package/chunks/EmailConfirmationForm.js +1 -0
- package/chunks/ResetPasswordForm.js +1 -0
- package/chunks/SignInForm.js +1 -0
- package/chunks/SignUpForm.js +1 -0
- package/chunks/SkeletonLoader.js +1 -0
- package/chunks/confirmEmail.js +12 -0
- package/chunks/createCustomerAddress.js +61 -0
- package/chunks/getCustomerToken.js +15 -0
- package/chunks/getStoreConfig.js +15 -0
- package/chunks/index.js +1 -0
- package/chunks/index2.js +1 -0
- package/chunks/index3.js +1 -0
- package/chunks/initialize.js +1 -0
- package/chunks/network-error.js +1 -0
- package/chunks/requestPasswordResetEmail.js +5 -0
- package/chunks/resendConfirmationEmail.js +4 -0
- package/chunks/resetPassword.js +5 -0
- package/chunks/revokeCustomerToken.js +8 -0
- package/chunks/setReCaptchaToken.js +1 -0
- package/chunks/simplifyTransformAttributesForm.js +1 -0
- package/chunks/transform-attributes-form.js +1 -0
- package/chunks/useInLineAlert.js +1 -0
- package/chunks/usePasswordValidationMessage.js +1 -0
- package/components/EmailConfirmationForm/EmailConfirmationForm.d.ts +5 -0
- package/components/EmailConfirmationForm/index.d.ts +3 -0
- package/components/ResetPasswordForm/ResetPasswordForm.d.ts +6 -0
- package/components/ResetPasswordForm/index.d.ts +3 -0
- package/components/SignInForm/SignInForm.d.ts +5 -0
- package/components/SignInForm/index.d.ts +3 -0
- package/components/SignUpForm/SignUpForm.d.ts +5 -0
- package/components/SignUpForm/index.d.ts +3 -0
- package/components/SkeletonLoader/SkeletonLoader.d.ts +5 -0
- package/components/SkeletonLoader/Skeletons/ResetPasswordSkeleton.d.ts +2 -0
- package/components/SkeletonLoader/Skeletons/SignInSkeleton.d.ts +2 -0
- package/components/SkeletonLoader/Skeletons/SignUpSkeleton.d.ts +2 -0
- package/components/SkeletonLoader/Skeletons/index.d.ts +4 -0
- package/components/SkeletonLoader/index.d.ts +3 -0
- package/components/SuccessNotificationForm/SuccessNotificationForm.d.ts +6 -0
- package/components/SuccessNotificationForm/index.d.ts +3 -0
- package/components/UI/Button/Button.d.ts +16 -0
- package/components/UI/Button/index.d.ts +3 -0
- package/components/UI/Form/Form.d.ts +4 -0
- package/components/UI/Form/index.d.ts +3 -0
- package/components/UI/FormInputs/FormInputs.d.ts +5 -0
- package/components/UI/FormInputs/index.d.ts +3 -0
- package/components/UI/index.d.ts +4 -0
- package/components/UpdatePasswordForm/UpdatePasswordForm.d.ts +5 -0
- package/components/UpdatePasswordForm/index.d.ts +3 -0
- package/components/index.d.ts +10 -0
- package/configs/cookieConfigs.d.ts +7 -0
- package/configs/defaultCreateUserConfigs.d.ts +9 -0
- package/configs/patternConfigs.d.ts +3 -0
- package/containers/AuthCombine/AuthCombine.d.ts +5 -0
- package/containers/AuthCombine/index.d.ts +3 -0
- package/containers/AuthCombine.d.ts +3 -0
- package/containers/AuthCombine.js +1 -1
- package/containers/ResetPassword/ResetPassword.d.ts +5 -0
- package/containers/ResetPassword/index.d.ts +3 -0
- package/containers/ResetPassword.d.ts +3 -0
- package/containers/ResetPassword.js +1 -1
- package/containers/SignIn/SignIn.d.ts +5 -0
- package/containers/SignIn/index.d.ts +3 -0
- package/containers/SignIn.d.ts +3 -0
- package/containers/SignIn.js +1 -1
- package/containers/SignUp/SignUp.d.ts +5 -0
- package/containers/SignUp/index.d.ts +3 -0
- package/containers/SignUp.d.ts +3 -0
- package/containers/SignUp.js +1 -1
- package/containers/SuccessNotification/SuccessNotification.d.ts +5 -0
- package/containers/SuccessNotification/index.d.ts +3 -0
- package/containers/SuccessNotification.d.ts +3 -0
- package/containers/SuccessNotification.js +1 -1
- package/containers/UpdatePassword/UpdatePassword.d.ts +5 -0
- package/containers/UpdatePassword/index.d.ts +3 -0
- package/containers/UpdatePassword.d.ts +3 -0
- package/containers/UpdatePassword.js +1 -1
- package/containers/index.d.ts +7 -0
- package/data/models/attributes-form.d.ts +44 -0
- package/data/models/customer-data.d.ts +6 -0
- package/data/models/index.d.ts +7 -0
- package/data/models/password-reset-email.d.ts +5 -0
- package/data/models/reset-password.d.ts +5 -0
- package/data/models/revoke-customer-token.d.ts +5 -0
- package/data/models/store-config.d.ts +8 -0
- package/data/transforms/index.d.ts +7 -0
- package/data/transforms/transform-attributes-form.d.ts +6 -0
- package/data/transforms/transform-auth.d.ts +37 -0
- package/data/transforms/transform-customer-data.d.ts +5 -0
- package/data/transforms/transform-password-reset-email.d.ts +5 -0
- package/data/transforms/transform-reset-password.d.ts +5 -0
- package/data/transforms/transform-revoke-customer-token.d.ts +5 -0
- package/data/transforms/transform-store-config.d.ts +5 -0
- package/hooks/api/useGetAttributesForm.d.ts +14 -0
- package/hooks/api/useGetStoreConfigs.d.ts +8 -0
- package/hooks/components/useEmailConfirmationForm.d.ts +7 -0
- package/hooks/components/usePasswordValidationMessage.d.ts +16 -0
- package/hooks/components/useResetPasswordForm.d.ts +8 -0
- package/hooks/components/useSignInForm.d.ts +23 -0
- package/hooks/components/useSignUpForm.d.ts +20 -0
- package/hooks/components/useUpdatePasswordForm.d.ts +16 -0
- package/hooks/ui/useForm.d.ts +12 -0
- package/hooks/useEmailConfirmation.d.ts +11 -0
- package/hooks/useInLineAlert.d.ts +7 -0
- package/i18n/en_US.json.d.ts +76 -0
- package/lib/acdl.d.ts +9 -0
- package/lib/checkIsFunction.d.ts +2 -0
- package/lib/clearUrlAndReplace.d.ts +2 -0
- package/lib/convertToInputDateFormat.d.ts +2 -0
- package/lib/cookieUtils.d.ts +3 -0
- package/lib/fetch-error.d.ts +5 -0
- package/lib/generateRandomDigits.d.ts +2 -0
- package/lib/getFormValues.d.ts +2 -0
- package/lib/getUrlParam.d.ts +2 -0
- package/lib/mergeFormObjects.d.ts +3 -0
- package/lib/network-error.d.ts +6 -0
- package/lib/setReCaptchaToken.d.ts +2 -0
- package/lib/simplifyTransformAttributesForm.d.ts +2 -0
- package/lib/validationUniqueSymbolsPassword.d.ts +2 -0
- package/package.json +1 -1
- package/render/Provider.d.ts +8 -0
- package/render/index.d.ts +2 -0
- package/render/render.d.ts +4 -0
- package/render.d.ts +1 -0
- package/render.js +8 -1
- package/types/api/confirmEmail.types.d.ts +17 -0
- package/types/api/createCustomer.types.d.ts +24 -0
- package/types/api/createCustomerAddress.types.d.ts +47 -0
- package/types/api/getAttributesForm.types.d.ts +31 -0
- package/types/api/getCustomerData.types.d.ts +13 -0
- package/types/api/getCustomerToken.types.d.ts +11 -0
- package/types/api/passwordResetEmail.types.d.ts +9 -0
- package/types/api/resendConfirmationEmail.types.d.ts +9 -0
- package/types/api/resetPassword.types.d.ts +9 -0
- package/types/api/revokeCustomerToken.types.d.ts +9 -0
- package/types/api/storeConfig.types.d.ts +16 -0
- package/types/authCombine.types.d.ts +12 -0
- package/types/emailConfirmationForm.types.d.ts +14 -0
- package/types/form.types.d.ts +31 -0
- package/types/index.d.ts +22 -0
- package/types/notification.types.d.ts +19 -0
- package/types/resetPassword.types.d.ts +15 -0
- package/types/signIn.types.d.ts +44 -0
- package/types/signUp.types.d.ts +51 -0
- package/types/skeletonLoader.types.d.ts +6 -0
- package/types/successNotification.types.d.ts +16 -0
- package/types/updatePassword.types.d.ts +34 -0
- package/101.js +0 -1
- package/15.js +0 -1
- package/243.js +0 -1
- package/260.js +0 -1
- package/280.js +0 -1
- package/304.js +0 -1
- package/378.js +0 -1
- package/38.js +0 -1
- package/407.js +0 -1
- package/408.js +0 -1
- package/412.js +0 -1
- package/436.js +0 -1
- package/442.js +0 -1
- package/474.js +0 -1
- package/498.js +0 -1
- package/508.js +0 -1
- package/55.js +0 -1
- package/591.js +0 -1
- package/592.js +0 -1
- package/595.js +0 -1
- package/604.js +0 -1
- package/606.js +0 -1
- package/634.js +0 -1
- package/636.js +0 -1
- package/708.js +0 -1
- package/728.js +0 -1
- package/739.js +0 -1
- package/761.js +0 -1
- package/77.js +0 -1
- package/835.js +0 -1
- package/868.js +0 -1
- package/884.js +0 -1
- package/902.js +0 -1
- package/906.js +0 -1
- package/912.js +0 -1
- package/93.js +0 -1
- package/940.js +0 -1
- package/952.js +0 -1
- package/960.js +0 -1
- package/964.js +0 -1
- package/993.js +0 -1
- package/runtime.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const CONFIRM_EMAIL = "\n mutation CONFIRM_EMAIL($email: String!, $confirmation_key: String!) {\n confirmEmail(input: {\n email: $email,\n confirmation_key: $confirmation_key\n }) {\n customer {\n email\n }\n }\n }\n";
|
|
2
|
+
//# sourceMappingURL=confirmEmail.graphql.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const setEndpoint: (endpoint: string) => void, setFetchGraphQlHeader: (key: string, value: string | null) => void, removeFetchGraphQlHeader: (key: string) => void, setFetchGraphQlHeaders: (header: import('@adobe/fetch-graphql').Header) => void, fetchGraphQl: <T = any>(query: string, options?: import('@adobe/fetch-graphql').FetchOptions | undefined) => Promise<{
|
|
2
|
+
errors?: import('@adobe/fetch-graphql').FetchQueryError | undefined;
|
|
3
|
+
data: T;
|
|
4
|
+
}>, getConfig: () => {
|
|
5
|
+
endpoint: string | undefined;
|
|
6
|
+
fetchGraphQlHeaders: import('@adobe/fetch-graphql').Header | undefined;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=fetch-graphql.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const GET_ATTRIBUTES_FORM = "\n query GET_ATTRIBUTES_FORM($formCode: String!) {\n attributesForm(formCode: $formCode) {\n items {\n code\n default_value\n entity_type\n frontend_class\n frontend_input\n is_required\n is_unique\n label\n options {\n is_default\n label\n value\n }\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n validate_rules {\n name\n value\n }\n }\n }\n errors {\n type\n message\n }\n }\n }\n";
|
|
2
|
+
//# sourceMappingURL=getAttributesForm.graphql.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { InLineAlertInterface } from '../../types';
|
|
2
|
+
|
|
3
|
+
interface getCustomerTokenProps {
|
|
4
|
+
email: string;
|
|
5
|
+
password: string;
|
|
6
|
+
handleSetInLineAlertProps: (value?: InLineAlertInterface) => void;
|
|
7
|
+
translations: Record<string, string>;
|
|
8
|
+
onErrorCallback?: (value?: unknown) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const getCustomerToken: ({ email, password, translations, onErrorCallback, handleSetInLineAlertProps, }: getCustomerTokenProps) => Promise<{
|
|
11
|
+
errorMessage: string;
|
|
12
|
+
userName: string;
|
|
13
|
+
}>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=getCustomerToken.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const GET_STORE_CONFIG = "\n query GET_STORE_CONFIG {\n storeConfig {\n autocomplete_on_storefront\n minimum_password_length\n required_character_classes_number\n store_code\n store_name\n store_group_code\n locale\n create_account_confirmation\n customer_access_token_lifetime\n }\n }\n";
|
|
2
|
+
//# sourceMappingURL=getStoreConfig.graphql.d.ts.map
|
package/api/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './initialize';
|
|
2
|
+
export * from './fetch-graphql';
|
|
3
|
+
export * from './createCustomer';
|
|
4
|
+
export * from './getAttributesForm';
|
|
5
|
+
export * from './getCustomerData';
|
|
6
|
+
export * from './getCustomerToken';
|
|
7
|
+
export * from './getStoreConfig';
|
|
8
|
+
export * from './requestPasswordResetEmail';
|
|
9
|
+
export * from './resetPassword';
|
|
10
|
+
export * from './revokeCustomerToken';
|
|
11
|
+
export * from './confirmEmail';
|
|
12
|
+
export * from './resendConfirmationEmail';
|
|
13
|
+
export * from './createCustomerAddress';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Initializer } from '@dropins/tools/types/elsie/src/lib';
|
|
2
|
+
import { Lang } from '@dropins/tools/types/elsie/src/i18n';
|
|
3
|
+
|
|
4
|
+
type ConfigProps = {
|
|
5
|
+
langDefinitions?: Lang;
|
|
6
|
+
authHeaderConfig: {
|
|
7
|
+
header: string;
|
|
8
|
+
tokenPrefix: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare const initialize: Initializer<ConfigProps>;
|
|
12
|
+
export declare const config: import('@dropins/tools/types/elsie/src/lib').Config<ConfigProps>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=initialize.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const RESET_PASSWORD = "\n mutation RESET_PASSWORD($email: String!, $resetPasswordToken: String!, $newPassword: String!){\n resetPassword(email: $email,resetPasswordToken: $resetPasswordToken,newPassword: $newPassword)\n }\n";
|
|
2
|
+
//# sourceMappingURL=resetPassword.graphql.d.ts.map
|
package/api.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './api/index'
|
package/api.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"@dropins/tools/event-bus.js";import*as r from"@dropins/tools/fetch-graphql.js";export const id=381;export const ids=[381];export const modules={6866:(e,r,t)=>{t.d(r,{H:()=>m});class n{constructor(e){this.config=e}getConfig(){return this.config}setConfig(e){this.config=e}}var o=new class{get map(){return this._map}set map(e){this._map=e}getMethods(){return{setMap:e=>{this.map=e},getMap:()=>this.map}}},{setMap:i,getMap:a}=o.getMethods(),s=["imageParamsKeyMap"];function u(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function l(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?u(Object(t),!0).forEach((function(r){f(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):u(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function c(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(r.indexOf(n)>=0)continue;t[n]=e[n]}return t}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function f(e,r,t){var n;return(r="symbol"==typeof(n=function(e,r){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(r,"string"))?n:n+"")in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}class m{constructor(e){var{init:r,listeners:t}=e;f(this,"_listeners",[]),f(this,"config",new n({})),this.listeners=e=>(this._listeners.forEach((e=>e.off())),this._listeners=t(e)),this.init=e=>{var t=e,{imageParamsKeyMap:n}=t,o=c(t,s);return this.config.setConfig(l(l({},this.config.getConfig()),o)),i(n),r(e)}}}class v{static register(e,r){var t,n;v._mounted&&(null===(t=e.listeners)||void 0===t||t.call(e,r),null===(n=e.init)||void 0===n||n.call(e,r));v._initializers.push([e,r])}static mount(){var e,r;v._mounted=!0,null===(e=v._initializers)||void 0===e||e.forEach((e=>{var r,[t,n]=e;null===(r=t.listeners)||void 0===r||r.call(t,n)})),null===(r=v._initializers)||void 0===r||r.forEach((e=>{var r,[t,n]=e;null===(r=t.init)||void 0===r||r.call(t,l({imageParamsKeyMap:v._imageParamsKeyMap},n))}))}static setImageParamKeys(e){v._imageParamsKeyMap=e}}f(v,"_initializers",[]),f(v,"_mounted",!1),f(v,"_imageParamsKeyMap",void 0)},4141:(e,r,t)=>{t.d(r,{j:()=>a});var n=t(294),o=t(5883);function i(e,r,t,n,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void t(e)}s.done?r(u):Promise.resolve(u).then(n,o)}var a=function(){var e,r=(e=function*(e){var{customerEmail:r,customerConfirmationKey:t}=e;return yield(0,n.AZ)("\n mutation CONFIRM_EMAIL($email: String!, $confirmation_key: String!) {\n confirmEmail(input: {\n email: $email,\n confirmation_key: $confirmation_key\n }) {\n customer {\n email\n }\n }\n }\n",{method:"POST",variables:{email:r,confirmation_key:t}}).catch(o.n)},function(){var r=this,t=arguments;return new Promise((function(n,o){var a=e.apply(r,t);function s(e){i(a,n,o,s,u,"next",e)}function u(e){i(a,n,o,s,u,"throw",e)}s(void 0)}))});return function(e){return r.apply(this,arguments)}}()},4137:(e,r,t)=>{t.d(r,{f:()=>l});var n=t(294),o=t(5883);function i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function a(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?i(Object(t),!0).forEach((function(r){s(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function s(e,r,t){var n;return(r="symbol"==typeof(n=function(e,r){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(r,"string"))?n:n+"")in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function u(e,r,t,n,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void t(e)}s.done?r(u):Promise.resolve(u).then(n,o)}var l=function(){var e,r=(e=function*(e,r){return yield(0,n.AZ)(r?"\n mutation CREATE_CUSTOMER_V2($input: CustomerCreateInput!) {\n createCustomerV2(input: $input) {\n customer {\n firstname\n lastname\n email\n is_subscribed\n }\n }\n }\n":"\n mutation CREATE_CUSTOMER($input: CustomerInput!) {\n createCustomer(input: $input) {\n customer {\n firstname\n lastname\n email\n is_subscribed\n }\n }\n }\n",{method:"POST",variables:{input:a({},e)}}).catch(o.n)},function(){var r=this,t=arguments;return new Promise((function(n,o){var i=e.apply(r,t);function a(e){u(i,n,o,a,s,"next",e)}function s(e){u(i,n,o,a,s,"throw",e)}a(void 0)}))});return function(e,t){return r.apply(this,arguments)}}()},294:(e,r,t)=>{t.d(r,{AZ:()=>u,Cz:()=>o,MR:()=>s,Np:()=>i,Xx:()=>a,zj:()=>l});var n=t(5867),{setEndpoint:o,setFetchGraphQlHeader:i,removeFetchGraphQlHeader:a,setFetchGraphQlHeaders:s,fetchGraphQl:u,getConfig:l}=(new n.FetchGraphQL).getMethods()},2928:(e,r,t)=>{t.d(r,{_:()=>u});var n=t(294),o=t(5883),i=t(1874),a=t(6129);function s(e,r,t,n,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void t(e)}s.done?r(u):Promise.resolve(u).then(n,o)}var u=function(){var e,r=(e=function*(e){return yield(0,n.AZ)("\n query GET_ATTRIBUTES_FORM($formCode: String!) {\n attributesForm(formCode: $formCode) {\n items {\n code\n default_value\n entity_type\n frontend_class\n frontend_input\n is_required\n is_unique\n label\n options {\n is_default\n label\n value\n }\n }\n errors {\n type\n message\n }\n }\n }\n".replace(/\s+/g," ").trim(),{method:"GET",cache:"force-cache",variables:{formCode:e}}).then((e=>{var r;return null!==(r=e.errors)&&void 0!==r&&r.length?(0,a.T)(e.errors):(0,i.K)(e)})).catch(o.n)},function(){var r=this,t=arguments;return new Promise((function(n,o){var i=e.apply(r,t);function a(e){s(i,n,o,a,u,"next",e)}function u(e){s(i,n,o,a,u,"throw",e)}a(void 0)}))});return function(e){return r.apply(this,arguments)}}()},4249:(e,r,t)=>{t.d(r,{$W:()=>n.$,jf:()=>g.j,ff:()=>i.f,AZ:()=>o.AZ,_q:()=>a._,zj:()=>o.zj,$Q:()=>s.$,o7:()=>u.o,G$:()=>l.G,n_:()=>n.n,Xx:()=>o.Xx,Uy:()=>c.U,vl:()=>O.v,xw:()=>f.x,qM:()=>b,Cz:()=>o.Cz,Np:()=>o.Np,MR:()=>o.MR});var n=t(696),o=t(294),i=t(4137),a=t(2928),s=t(3211),u=t(2739),l=t(1764),c=t(425),f=t(5678),m=t(5883),v=t(4173),p=t(1178),d=t(5087),h=t(1084);function y(e,r,t,n,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void t(e)}s.done?r(u):Promise.resolve(u).then(n,o)}var b=function(){var e,r=(e=function*(){return yield(0,o.AZ)("\n mutation REVOKE_CUSTOMER_TOKEN {\n revokeCustomerToken {\n result\n }\n }\n",{method:"POST"}).then((e=>{var r=(e=>{var r,t,n,o="";return null!=e&&null!==(r=e.errors)&&void 0!==r&&r.length&&(o=(null==e||null===(t=e.errors[0])||void 0===t?void 0:t.message)||"Unknown error"),{message:o,success:Boolean(null==e||null===(n=e.data)||void 0===n?void 0:n.revokeCustomerToken)}})(e);if(r.success){var{success:t,message:n}=r;t?([d.y.auth_dropin_user_token,d.y.auth_dropin_firstname].forEach((e=>{(0,v.Y)(e)})),p.events.emit("authenticated",!1)):(console.group("ERROR revokeCustomerToken"),console.error("success =>",t),console.error("message =>",n),console.groupEnd()),(0,h.r)(h.I.SIGN_OUT,{logoutAttempt:!0})}return r})).catch(m.n)},function(){var r=this,t=arguments;return new Promise((function(n,o){var i=e.apply(r,t);function a(e){y(i,n,o,a,s,"next",e)}function s(e){y(i,n,o,a,s,"throw",e)}a(void 0)}))});return function(){return r.apply(this,arguments)}}(),g=t(4141),O=t(7042)},425:(e,r,t)=>{t.d(r,{U:()=>a});var n=t(5883),o=t(294);function i(e,r,t,n,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void t(e)}s.done?r(u):Promise.resolve(u).then(n,o)}var a=function(){var e,r=(e=function*(e){return yield(0,o.AZ)("\n mutation REQUEST_PASSWORD_RESET_EMAIL($email: String!) {\n requestPasswordResetEmail(email: $email)\n }\n",{method:"POST",variables:{email:e}}).then((e=>(e=>{var r,t,n,o="";return null!=e&&null!==(r=e.errors)&&void 0!==r&&r.length&&(o=null==e||null===(t=e.errors[0])||void 0===t?void 0:t.message),{message:o,success:Boolean(null==e||null===(n=e.data)||void 0===n?void 0:n.requestPasswordResetEmail)}})(e))).catch(n.n)},function(){var r=this,t=arguments;return new Promise((function(n,o){var a=e.apply(r,t);function s(e){i(a,n,o,s,u,"next",e)}function u(e){i(a,n,o,s,u,"throw",e)}s(void 0)}))});return function(e){return r.apply(this,arguments)}}()},7042:(e,r,t)=>{t.d(r,{v:()=>a});var n=t(294),o=t(5883);function i(e,r,t,n,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void t(e)}s.done?r(u):Promise.resolve(u).then(n,o)}var a=function(){var e,r=(e=function*(e){return yield(0,n.AZ)("\nmutation RESEND_CONFIRMATION_EMAIL($email: String!) {\n resendConfirmationEmail(email: $email)\n}",{method:"POST",variables:{email:e}}).catch(o.n)},function(){var r=this,t=arguments;return new Promise((function(n,o){var a=e.apply(r,t);function s(e){i(a,n,o,s,u,"next",e)}function u(e){i(a,n,o,s,u,"throw",e)}s(void 0)}))});return function(e){return r.apply(this,arguments)}}()},5678:(e,r,t)=>{t.d(r,{x:()=>a});var n=t(5883),o=t(294);function i(e,r,t,n,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void t(e)}s.done?r(u):Promise.resolve(u).then(n,o)}var a=function(){var e,r=(e=function*(e,r,t){return yield(0,o.AZ)("\n mutation RESET_PASSWORD($email: String!, $resetPasswordToken: String!, $newPassword: String!){\n resetPassword(email: $email,resetPasswordToken: $resetPasswordToken,newPassword: $newPassword)\n }\n",{method:"POST",variables:{email:e,resetPasswordToken:r,newPassword:t}}).then((e=>(e=>{var r,t,n,o="";return null!=e&&null!==(r=e.errors)&&void 0!==r&&r.length&&(o=null==e||null===(t=e.errors[0])||void 0===t?void 0:t.message),{message:o,success:Boolean(null==e||null===(n=e.data)||void 0===n?void 0:n.resetPassword)}})(e))).catch(n.n)},function(){var r=this,t=arguments;return new Promise((function(n,o){var a=e.apply(r,t);function s(e){i(a,n,o,s,u,"next",e)}function u(e){i(a,n,o,s,u,"throw",e)}s(void 0)}))});return function(e,t,n){return r.apply(this,arguments)}}()},1874:(e,r,t)=>{t.d(r,{K:()=>u});var n=["default_value","frontend_input","frontend_class","is_required","code"];function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?o(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function a(e,r,t){var n;return(r="symbol"==typeof(n=function(e,r){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(r,"string"))?n:n+"")in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function s(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(r.indexOf(n)>=0)continue;t[n]=e[n]}return t}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var u=e=>{var r,t,o=null==e||null===(r=e.data)||void 0===r?void 0:r.attributesForm;if(null!=o&&null!==(t=o.errors)&&void 0!==t&&t.length)return{errors:o.errors};var a=(null==o?void 0:o.items)||[];return{fields:null==a?void 0:a.map((e=>{var{default_value:r,frontend_input:t,frontend_class:o,is_required:a,code:u}=e,l=s(e,n),c=["email","firstname","lastname"].findIndex((e=>e===u))+1||5;return i(i({},l),{},{defaultValue:r||"",fieldType:t||"",className:o||"",required:a||!1,orderNumber:c,name:u,id:u,code:u})})).sort(((e,r)=>e.orderNumber-r.orderNumber))}}},5883:(e,r,t)=>{t.d(r,{n:()=>o});var n=t(1178),o=e=>{throw e instanceof DOMException&&"AbortError"===e.name||n.events.emit("error",{source:"auth",type:"network",error:e}),e}},1178:(r,t,n)=>{r.exports=(e=>{var r={};return n.d(r,e),r})({events:()=>e.events})},5867:(e,t,n)=>{e.exports=(e=>{var r={};return n.d(r,e),r})({FetchGraphQL:()=>r.FetchGraphQL})}};import t from"./runtime.js";import*as n from"./739.js";t.C(n);import*as o from"./api.js";t.C(o);var i,a=(i=4249,t(t.s=i)),s=a.$W,u=a.jf,l=a.ff,c=a.AZ,f=a._q,m=a.zj,v=a.$Q,p=a.o7,d=a.G$,h=a.n_,y=a.Xx,b=a.Uy,g=a.vl,O=a.xw,P=a.qM,w=a.Cz,j=a.Np,_=a.MR;export{s as config,u as confirmEmail,l as createCustomer,c as fetchGraphQl,f as getAttributesForm,m as getConfig,v as getCustomerData,p as getCustomerToken,d as getStoreConfig,h as initialize,y as removeFetchGraphQlHeader,b as requestPasswordResetEmail,g as resendConfirmationEmail,O as resetPassword,P as revokeCustomerToken,w as setEndpoint,j as setFetchGraphQlHeader,_ as setFetchGraphQlHeaders};
|
|
1
|
+
import{c as p,a as f,g}from"./chunks/createCustomerAddress.js";import{g as c,a as x}from"./chunks/getCustomerToken.js";import{g as h}from"./chunks/getStoreConfig.js";import{r as C}from"./chunks/requestPasswordResetEmail.js";import{r as E}from"./chunks/resetPassword.js";import{r as G}from"./chunks/revokeCustomerToken.js";import{c as k}from"./chunks/confirmEmail.js";import{r as b}from"./chunks/resendConfirmationEmail.js";import{c as w,i as A}from"./chunks/initialize.js";import{f as T,g as q,r as z,s as D,a as R,b as S}from"./chunks/network-error.js";import"./chunks/setReCaptchaToken.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/event-bus.js";import"./chunks/transform-attributes-form.js";import"@dropins/tools/lib.js";import"@dropins/tools/fetch-graphql.js";export{w as config,k as confirmEmail,p as createCustomer,f as createCustomerAddress,T as fetchGraphQl,g as getAttributesForm,q as getConfig,c as getCustomerData,x as getCustomerToken,h as getStoreConfig,A as initialize,z as removeFetchGraphQlHeader,C as requestPasswordResetEmail,b as resendConfirmationEmail,E as resetPassword,G as revokeCustomerToken,D as setEndpoint,R as setFetchGraphQlHeader,S as setFetchGraphQlHeaders};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as c,jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{classes as b}from"@dropins/tools/lib.js";import{InLineAlert as C,Header as y}from"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{r as x}from"./resendConfirmationEmail.js";import{useState as E,useCallback as F}from"@dropins/tools/preact-hooks.js";import{useText as d}from"@dropins/tools/i18n.js";import{B as f}from"./useInLineAlert.js";const p=({userEmail:r,handleSetInLineAlertProps:a})=>{const i=d({emailConfirmationMessage:"Auth.Notification.emailConfirmationMessage",technicalErrorSendEmail:"Auth.Notification.technicalErrors.technicalErrorSendEmail"}),[l,e]=E(!1);return{handleEmailConfirmation:F(async()=>{var o,m;if(e(!0),r){const t=await x(r);if(t){const u=(o=t==null?void 0:t.errors)==null?void 0:o.length,h=(m=t==null?void 0:t.data)==null?void 0:m.resendConfirmationEmail;a(u?{type:"error",text:i.technicalErrorSendEmail}:{type:h?"success":"error",text:i.emailConfirmationMessage})}}e(!1)},[a,i,r]),disabledButton:l}},M=({formSize:r,userEmail:a,inLineAlertProps:i,hideCloseBtnOnEmailConfirmation:l,handleSetInLineAlertProps:e,onPrimaryButtonClick:s})=>{const o=d({title:"Auth.EmailConfirmationForm.title",subtitle:"Auth.EmailConfirmationForm.subtitle",mainText:"Auth.EmailConfirmationForm.mainText",buttonPrimary:"Auth.EmailConfirmationForm.buttonPrimary",buttonSecondary:"Auth.EmailConfirmationForm.buttonSecondary"}),{handleEmailConfirmation:m,disabledButton:t}=p({userEmail:a,handleSetInLineAlertProps:e});return c("div",{className:b(["auth-emailConfirmationForm",r]),children:[i.text?n(C,{className:"auth-signInForm__notification",type:i.type,variant:"secondary",heading:i.text,icon:i.icon,"data-testid":"authInLineAlert"}):null,n(y,{title:o.title,divider:!1,className:"auth-emailConfirmationForm__title"}),a!=null&&a.length?n("span",{className:"auth-emailConfirmationForm__subtitle",children:`${o.subtitle} ${a}`}):null,n("span",{className:"auth-emailConfirmationForm__text",children:o.mainText}),c("div",{className:"auth-emailConfirmationForm-buttons",children:[n(f,{type:"button",variant:"tertiary",style:{padding:0},buttonText:o.buttonSecondary,enableLoader:!1,onClick:m,disabled:t}),l?null:n(f,{type:"submit",buttonText:o.buttonPrimary,variant:"primary",enableLoader:!1,disabled:t,onClick:s})]})]})};export{M as E};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as l,jsx as o}from"@dropins/tools/preact-jsx-runtime.js";import{classes as R}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{r as p}from"./requestPasswordResetEmail.js";import{g as b,c as w,u as _,F as h,B as g}from"./useInLineAlert.js";import{useState as x,useCallback as y}from"@dropins/tools/preact-hooks.js";import{useText as P}from"@dropins/tools/i18n.js";import{Header as v,InLineAlert as N}from"@dropins/tools/components.js";import{s as E,D as T}from"./simplifyTransformAttributesForm.js";import*as F from"@dropins/tools/preact-compat.js";const D=t=>F.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},F.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),L=({routeSignIn:t,onErrorCallback:a,setActiveComponent:i,handleSetInLineAlertProps:s})=>{const c=P({successPasswordResetEmailNotification:"Auth.Notification.successPasswordResetEmailNotification"}),[m,e]=x(!1),d=y(async u=>{u.preventDefault(),e(!0);const r=b(u.target);if(r&&r.email){const f=await p(r.email);f.success?s==null||s({type:"success",text:c.successPasswordResetEmailNotification.replace("{email}",r.email)}):(a==null||a(f),s==null||s({type:"error",text:f.message}))}e(!1)},[s,a,c.successPasswordResetEmailNotification]),n=y(()=>{if(w(i)){i("signInForm");return}w(t)&&(window.location.href=t())},[i,t]);return{isLoading:m,submitResetPassword:d,redirectToSignInPage:n}},z=({formSize:t="default",routeSignIn:a,setActiveComponent:i,onErrorCallback:s,...c})=>{const m=P({title:"Auth.ResetPasswordForm.title",buttonPrimary:"Auth.ResetPasswordForm.buttonPrimary",buttonSecondary:"Auth.ResetPasswordForm.buttonSecondary"}),{inLineAlertProps:e,handleSetInLineAlertProps:d}=_(),{isLoading:n,submitResetPassword:u,redirectToSignInPage:r}=L({routeSignIn:a,setActiveComponent:i,onErrorCallback:s,handleSetInLineAlertProps:d});return l("div",{...c,className:R(["auth-resetPasswordForm",t]),"data-testid":"resetPasswordForm",children:[o(v,{title:m.title,divider:!1,className:"auth-resetPasswordForm__title"}),e.text?o(N,{className:"auth-resetPasswordForm__notification",type:e.type,variant:"secondary",heading:e.text,icon:e.icon}):null,o(h,{name:"resetPassword_form",className:"auth-resetPasswordForm__form",submitCallback:u,isLoading:n,fieldsConfig:E(T),children:l("div",{className:"auth-resetPasswordForm__buttons",children:[o(g,{type:"button",variant:"tertiary",style:{padding:"0"},icon:o(D,{style:{transform:"rotate(90deg)"}}),buttonText:m.buttonSecondary,enableLoader:!1,onClick:r}),o(g,{type:"submit",buttonText:m.buttonPrimary,variant:"primary",enableLoader:n})]})}),o("div",{id:"requestPasswordResetEmail"})]})};export{z as R};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as u,jsxs as k}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as $,classes as z}from"@dropins/tools/lib.js";import{g as V,c as F,u as O,F as R,B as K}from"./useInLineAlert.js";import{useState as g,useCallback as E,useEffect as Q,useMemo as tt}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{a as at}from"./getCustomerToken.js";import{r as rt}from"./resendConfirmationEmail.js";import{s as st,a as ot}from"./simplifyTransformAttributesForm.js";import{c as et}from"./confirmEmail.js";import{useText as W}from"@dropins/tools/i18n.js";import{Header as it,InLineAlert as nt,InputPassword as ct}from"@dropins/tools/components.js";import{E as mt}from"./EmailConfirmationForm.js";const ut=({emailConfirmationStatusMessage:t,translations:r,initialEmailValue:e,routeSignUp:l,routeForgotPassword:c,routeRedirectOnSignIn:_,onErrorCallback:w,setActiveComponent:a,onSuccessCallback:f,onSignUpLinkClick:h,handleSetInLineAlertProps:s,routeRedirectOnEmailConfirmationClose:b})=>{const[A,P]=g(""),[L,n]=g(!1),[C,d]=g(""),[x,y]=g(!1),[M,S]=g({userName:"",status:!1}),[B,I]=g(!1),[T,N]=g([]),p=E(async i=>{s(),n(!0),y(!1),N([]),await rt(i)},[s]),U=E(i=>{i.length?y(!1):y(!0),d(i)},[]);Q(()=>{t!=null&&t.text&&s({text:t.text,type:t.status?t.status:void 0})},[t,s]);const v=E(async i=>{var q;s(),I(!0);const m=V(i.target);if(m.password||(y(!0),I(!1)),m!=null&&m.email&&(m!=null&&m.password)){const{email:H,password:Y}=m,o=await at({email:H,password:Y,handleSetInLineAlertProps:s,onErrorCallback:w,translations:r});if((q=o==null?void 0:o.errorMessage)!=null&&q.length){P(H);const J=o.errorMessage.includes("This account isn't confirmed. Verify and try again."),Z=J?r.resendEmailInformationText:o.errorMessage;N(J?[{label:r.resendEmailButtonText,onClick:()=>{p(H)}}]:[]),s({text:Z,type:"error"}),d("")}o!=null&&o.userName&&(i.target.reset(),F(_)?window.location.href=_():(f==null||f({userName:o==null?void 0:o.userName,status:!0}),S({userName:o==null?void 0:o.userName,status:!0}))),y(!1)}I(!1)},[s,w,r,p,_,f]),j=E(()=>{if(F(a)){a("resetPasswordForm");return}F(c)&&(window.location.href=c())},[c,a]),D=E(()=>{if(F(h)&&h(),F(a)){a("signUpForm");return}F(l)&&(window.location.href=l())},[h,l,a]),G=tt(()=>{const i=st(ot);return e!=null&&e.length?i==null?void 0:i.map(m=>({...m,defaultValue:e})):i},[e]),X=E(()=>{s(),F(b)?window.location.href=b():n(!1)},[s,b]);return{additionalActionsAlert:T,userEmail:A,defaultEnhancedEmailFields:G,passwordError:x,isSuccessful:M,isLoading:B,signInPasswordValue:C,showEmailConfirmationForm:L,setShowEmailConfirmationForm:n,setSignInPasswordValue:d,submitLogInUser:v,forgotPasswordCallback:j,onSignUpLinkClickCallback:D,handledOnPrimaryButtonClick:X,handleSetPassword:U}},ft=()=>{let t=new URL(window.location.href),r=t.searchParams.get("email"),e=t.searchParams.get("key");r&&e&&(t.searchParams.delete("email"),t.searchParams.delete("key"),window.history.replaceState({},document.title,t.toString()))},dt=({enableEmailConfirmation:t})=>{const r=W({accountConfirmMessage:"Auth.EmailConfirmationForm.accountConfirmMessage",accountConfirmationEmailSuccessMessage:"Auth.EmailConfirmationForm.accountConfirmationEmailSuccessMessage"}),[e,l]=g({text:"",status:""});return Q(()=>{if(t){const{search:c}=window.location;c.includes("email=")&&c.includes("key=")&&(async()=>{var f,h,s;const w=new URLSearchParams(c),a=await et({customerEmail:w.get("email"),customerConfirmationKey:w.get("key")});if(!a)return null;(f=a==null?void 0:a.errors)!=null&&f.length?l({text:a==null?void 0:a.errors[0].message,status:"error"}):(l({text:a.data.confirmEmail.customer.email?r.accountConfirmationEmailSuccessMessage.replace("{email}",(s=(h=a==null?void 0:a.data)==null?void 0:h.confirmEmail.customer)==null?void 0:s.email):r.accountConfirmMessage,status:"success"}),ft())})()}},[t,r]),{emailConfirmationStatusMessage:e}},pt=({slots:t,labels:r,formSize:e="default",initialEmailValue:l="",renderSignUpLink:c=!1,enableEmailConfirmation:_=!1,hideCloseBtnOnEmailConfirmation:w=!1,routeRedirectOnEmailConfirmationClose:a,routeRedirectOnSignIn:f,routeForgotPassword:h,routeSignUp:s,onSuccessCallback:b,setActiveComponent:A,onErrorCallback:P,onSignUpLinkClick:L})=>{const n=W({title:"Auth.SignInForm.title",buttonPrimary:"Auth.SignInForm.buttonPrimary",buttonSecondary:"Auth.SignInForm.buttonSecondary",buttonTertiary:"Auth.SignInForm.buttonTertiary",resendEmailInformationText:"Auth.Notification.resendEmailNotification.informationText",resendEmailButtonText:"Auth.Notification.resendEmailNotification.buttonText",customerTokenErrorMessage:"Auth.Api.customerTokenErrorMessage",placeholder:"Auth.InputPassword.placeholder",floatingLabel:"Auth.InputPassword.floatingLabel"}),{emailConfirmationStatusMessage:C}=dt({enableEmailConfirmation:_}),{inLineAlertProps:d,handleSetInLineAlertProps:x}=O(),{userEmail:y,additionalActionsAlert:M,defaultEnhancedEmailFields:S,passwordError:B,isSuccessful:I,isLoading:T,signInPasswordValue:N,showEmailConfirmationForm:p,submitLogInUser:U,forgotPasswordCallback:v,onSignUpLinkClickCallback:j,handledOnPrimaryButtonClick:D,handleSetPassword:G}=ut({translations:n,emailConfirmationStatusMessage:C,initialEmailValue:l,routeSignUp:s,routeForgotPassword:h,routeRedirectOnSignIn:f,setActiveComponent:A,onErrorCallback:P,onSuccessCallback:b,onSignUpLinkClick:L,handleSetInLineAlertProps:x,routeRedirectOnEmailConfirmationClose:a});return I.status&&(t!=null&&t.SuccessNotification)?u($,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:t==null?void 0:t.SuccessNotification,context:{isSuccessful:I}}):p?u(mt,{formSize:e,userEmail:y,inLineAlertProps:d,hideCloseBtnOnEmailConfirmation:w,handleSetInLineAlertProps:x,onPrimaryButtonClick:D}):k("div",{className:z(["auth-signInForm",e]),"data-testid":"signInForm",children:[u(it,{title:(r==null?void 0:r.formTitleText)??n.title,divider:!1,className:"auth-signInForm__title"}),d.text?u(nt,{"data-testid":"authInLineAlert",className:"auth-signInForm__notification",type:d.type,variant:"secondary",heading:d.text,icon:d.icon,additionalActions:M}):null,k(R,{name:"signIn_form",className:"auth-signInForm__form",submitCallback:U,isLoading:T,fieldsConfig:S,children:[u(ct,{hideStatusIndicator:!0,className:"auth-signInForm__form__password",autoComplete:"current-password",error:B,defaultValue:N,onValue:G,placeholder:n.placeholder,floatingLabel:n.floatingLabel}),k("div",{className:"auth-signInForm__form__buttons",children:[k("div",{className:"auth-signInForm__form__buttons--combine",children:[u(K,{type:"button",variant:"tertiary",style:{padding:0},buttonText:n.buttonTertiary,className:"auth-signInForm__button auth-signInForm__button--forgot",enableLoader:!1,onClick:v,"data-testid":"switchToSignUp"}),c?u("span",{}):null,c?u(K,{type:"button",variant:"tertiary",style:{padding:0},buttonText:n.buttonSecondary,className:"auth-signInForm__button auth-signInForm__button--signup",enableLoader:!1,onClick:j}):null]}),u(K,{type:"submit",buttonText:(r==null?void 0:r.primaryButtonText)??n.buttonPrimary,variant:"primary",className:"auth-signInForm__button auth-signInForm__button--submit",enableLoader:T})]})]}),u("div",{id:"generateCustomerToken"})]})};export{pt as S};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as i,jsxs as k}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as ce,classes as le}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{g as fe,c as de,a as ge}from"./createCustomerAddress.js";import{useState as y,useEffect as he,useCallback as G}from"@dropins/tools/preact-hooks.js";import{s as ee,b as pe,c as Fe}from"./simplifyTransformAttributesForm.js";import{v as Ue,u as ye,a as be}from"./usePasswordValidationMessage.js";import{a as _e}from"./getCustomerToken.js";import{p as te,E as re}from"./getStoreConfig.js";import{c as H,g as Ne,u as Te,F as Le,B as ie}from"./useInLineAlert.js";import{Header as xe,InLineAlert as Pe,InputPassword as Ee,Field as Q,Checkbox as X}from"@dropins/tools/components.js";import{S as Se}from"./SkeletonLoader.js";import{E as we}from"./EmailConfirmationForm.js";import{useText as ve}from"@dropins/tools/i18n.js";const se=(e,t)=>t!=null&&t.length?e.map(s=>{var r;const a=(r=t.find(({code:b})=>b===s.code))==null?void 0:r.defaultValue;return a?{...s,defaultValue:a}:s}):e,Me=({inputsDefaultValueSet:e,fieldsConfigForApiVersion1:t,apiVersion2:s})=>{const[a,r]=y([]);return he(()=>{(async()=>{if(s){const u=await fe("customer_account_create");if(u!=null&&u.length)if(e!=null&&e.length){const m=se(u,e);r(m)}else r(u)}else{const u=ee(pe),m=ee(t),h=se(u,e);r(t&&t.length?m:h)}})()},[s,t,e]),{fieldsListConfigs:a}},Ae=e=>{switch(e){case"true":case"on":return!0;case"false":case"off":return!1;default:return e}},qe=(e,t)=>{if(!t)return e;const s={};s.custom_attributes=[];for(const a in e)Object.prototype.hasOwnProperty.call(Fe,a)?s[a]=e[a]:s.custom_attributes.push({attribute_code:a,value:Ae(e[a])});return s},Ce=({addressesData:e,translations:t,isEmailConfirmationRequired:s,apiVersion2:a=!0,passwordConfigs:r,isAutoSignInEnabled:b,routeRedirectOnSignIn:u,routeSignIn:m,onErrorCallback:h,onSuccessCallback:n,setActiveComponent:l,handleSetInLineAlertProps:f,routeRedirectOnEmailConfirmationClose:x})=>{const[O,w]=y(""),[p,o]=y(!1),[c,N]=y({userName:"",status:!1}),[v,d]=y(""),[M,A]=y(!1),[V,F]=y(!1),[q,C]=y(!0),P=G(({target:U})=>{C(U.checked)},[]),I=G(()=>{if(H(l)){l("signInForm");return}H(m)&&(window.location.href=m())},[l,m]),W=G(U=>{d(U)},[]),j=G(()=>{f(),d(""),H(x)?window.location.href=x():(o(!1),l==null||l("signInForm"))},[f,x,l]);return{isKeepMeLogged:q,userEmail:O,showEmailConfirmationForm:p,isSuccessful:c,isClickSubmit:M,signUpPasswordValue:v,isLoading:V,onSubmitSignUp:async(U,$)=>{var Z,z,D;if(f(),F(!0),!$){A(!0),F(!1);return}const B=a?"createCustomerV2":"createCustomer",_=Ne(U.target),{email:E,password:S,is_subscribed:ae}=_,oe=(r==null?void 0:r.requiredCharacterClasses)||0,ue=(r==null?void 0:r.minLength)||1;if(!Ue(S,oe)||ue>(S==null?void 0:S.length)){A(!0),F(!1);return}const ne=qe({..._,is_subscribed:!!ae||!1},a),{data:T,errors:L}=await de(ne,a),K=((z=(Z=T==null?void 0:T.createCustomer)==null?void 0:Z.customer)==null?void 0:z.firstname)||"";if(L&&(L!=null&&L.length))f==null||f({type:"error",text:L[0].message}),h==null||h(L),te(re.CREATE_ACCOUNT_EVENT,{updateProfile:!1}),w(E);else{const J={email:"",...T==null?void 0:T[B]};if(te(re.CREATE_ACCOUNT_EVENT,{email:J==null?void 0:J.email,updateProfile:!0}),s||!b){if(n==null||n({userName:K,status:!0}),s){(D=U.target)==null||D.reset(),d(""),o(!0),w(E),F(!1);return}if(!b){F(!1),N({userName:K,status:!0});return}}const g=await _e({email:E,password:S,translations:t,handleSetInLineAlertProps:f,onErrorCallback:h});if(g!=null&&g.userName){if(e!=null&&e.length)for(const R of e)try{await ge(R)}catch(me){console.error(t.failedCreateCustomerAddress,R,me)}H(u)?window.location.href=u():(n==null||n({userName:g==null?void 0:g.userName,status:!0}),N({userName:g==null?void 0:g.userName,status:!0}))}else n==null||n({userName:K,status:!0}),N({userName:K,status:!0})}F(!1)},signInButton:I,handleSetSignUpPasswordValue:W,onKeepMeLoggedChange:P,handleHideEmailConfirmationForm:j}},Ze=({addressesData:e,formSize:t="default",inputsDefaultValueSet:s,fieldsConfigForApiVersion1:a,apiVersion2:r=!0,isAutoSignInEnabled:b=!0,displayTermsOfUseCheckbox:u=!1,displayNewsletterCheckbox:m=!1,hideCloseBtnOnEmailConfirmation:h=!1,routeRedirectOnEmailConfirmationClose:n,routeRedirectOnSignIn:l,routeSignIn:f,onErrorCallback:x,onSuccessCallback:O,setActiveComponent:w,slots:p})=>{const o=ve({title:"Auth.SignUpForm.title",buttonPrimary:"Auth.SignUpForm.buttonPrimary",buttonSecondary:"Auth.SignUpForm.buttonSecondary",privacyPolicyDefaultText:"Auth.SignUpForm.privacyPolicyDefaultText",subscribedDefaultText:"Auth.SignUpForm.subscribedDefaultText",keepMeLoggedText:"Auth.SignUpForm.keepMeLoggedText",customerTokenErrorMessage:"Auth.Api.customerTokenErrorMessage",failedCreateCustomerAddress:"Auth.SignUpForm.failedCreateCustomerAddress",placeholder:"Auth.InputPassword.placeholder",floatingLabel:"Auth.InputPassword.floatingLabel"}),{passwordConfigs:c,isEmailConfirmationRequired:N}=ye(),{fieldsListConfigs:v}=Me({fieldsConfigForApiVersion1:a,apiVersion2:r,inputsDefaultValueSet:s}),{inLineAlertProps:d,handleSetInLineAlertProps:M}=Te(),{isKeepMeLogged:A,userEmail:V,showEmailConfirmationForm:F,isSuccessful:q,isClickSubmit:C,signUpPasswordValue:P,isLoading:I,onSubmitSignUp:W,signInButton:j,handleSetSignUpPasswordValue:Y,onKeepMeLoggedChange:U,handleHideEmailConfirmationForm:$}=Ce({addressesData:e,translations:o,isEmailConfirmationRequired:N,apiVersion2:r,passwordConfigs:c,isAutoSignInEnabled:b,routeRedirectOnSignIn:l,routeSignIn:f,onErrorCallback:x,onSuccessCallback:O,setActiveComponent:w,handleSetInLineAlertProps:M,routeRedirectOnEmailConfirmationClose:n}),{isValidUniqueSymbols:B,defaultLengthMessage:_}=be({password:P,isClickSubmit:C,passwordConfigs:c}),E=!N&&(e==null?void 0:e.length);return!v.length&&r?i("div",{className:`auth-signUpForm ${t} skeleton-loader`,"data-testid":"SignUpForm",children:i(Se,{activeSkeleton:"signUpForm"})}):q.status&&(p!=null&&p.SuccessNotification)?i(ce,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:p==null?void 0:p.SuccessNotification,context:{isSuccessful:q}}):F?i(we,{formSize:t,userEmail:V,inLineAlertProps:d,hideCloseBtnOnEmailConfirmation:h,handleSetInLineAlertProps:M,onPrimaryButtonClick:$}):k("div",{className:le(["auth-signUpForm",t]),"data-testid":"SignUpForm",children:[i(xe,{title:o.title,divider:!1,className:"auth-signUpForm__title"}),d.text?i(Pe,{className:"auth-signUpForm__notification",type:d.type,variant:"secondary",heading:d.text,icon:d.icon}):null,k(Le,{submitCallback:W,className:"auth-signUpForm__form",isLoading:I,name:"signUp_form",fieldsConfig:v,children:[i(Ee,{validateLengthConfig:_,className:"auth-signUpForm__form__field",autoComplete:"current-password",name:"password",minLength:c==null?void 0:c.minLength,error:B==="error"||(_==null?void 0:_.status)==="error"||C&&P.length<=0,defaultValue:P,uniqueSymbolsStatus:B,requiredCharacterClasses:c==null?void 0:c.requiredCharacterClasses,onValue:Y,placeholder:o.placeholder,floatingLabel:o.floatingLabel,children:E?i("div",{className:"auth-signUpForm__automatic-login",children:i(Q,{children:i(X,{name:"",placeholder:o.keepMeLoggedText,label:o.keepMeLoggedText,checked:A,onChange:U})})}):null}),m||u?k("div",{className:"auth-signUpForm__item auth-signUpForm__checkbox",children:[m?i(Q,{children:i(X,{"data-testid":"isSubscribed",name:"is_subscribed",placeholder:o.subscribedDefaultText,label:o.subscribedDefaultText})}):null,u?i(Q,{children:i(X,{"data-testid":"privacyPolicy",name:"privacyPolicy",placeholder:o.privacyPolicyDefaultText,label:o.privacyPolicyDefaultText})}):null]}):null,k("div",{className:"auth-signUpForm-buttons",children:[i(ie,{type:"button",variant:"tertiary",style:{padding:0},buttonText:o.buttonSecondary,enableLoader:!1,onClick:j}),i(ie,{type:"submit",buttonText:o.buttonPrimary,variant:"primary",enableLoader:I})]})]}),i("div",{id:"createCustomerV2"})]})};export{Ze as S};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as l,jsx as e,Fragment as r}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as s}from"@dropins/tools/preact-hooks.js";import{Skeleton as a,SkeletonRow as i}from"@dropins/tools/components.js";const d=()=>l(a,{children:[e(i,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})," ",e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})]}),h=()=>l(a,{children:[e(i,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})," ",e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})]}),u=()=>l(a,{children:[e(i,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})," ",e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})]}),o=({activeSkeleton:n})=>{const t=s(()=>({signInForm:e(h,{}),signUpForm:e(d,{}),resetPasswordForm:e(u,{})}),[]);return e(r,{children:t[n]})};export{o as S};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{f as o,h as r}from"./network-error.js";const t=`
|
|
2
|
+
mutation CONFIRM_EMAIL($email: String!, $confirmation_key: String!) {
|
|
3
|
+
confirmEmail(input: {
|
|
4
|
+
email: $email,
|
|
5
|
+
confirmation_key: $confirmation_key
|
|
6
|
+
}) {
|
|
7
|
+
customer {
|
|
8
|
+
email
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
`,m=async({customerEmail:i,customerConfirmationKey:a})=>await o(t,{method:"POST",variables:{email:i,confirmation_key:a}}).catch(r);export{m as c};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import{f as a,h as s}from"./network-error.js";import{s as n}from"./setReCaptchaToken.js";import{t as i}from"./transform-attributes-form.js";import{h as o}from"./getStoreConfig.js";const u=`
|
|
2
|
+
mutation CREATE_CUSTOMER($input: CustomerInput!) {
|
|
3
|
+
createCustomer(input: $input) {
|
|
4
|
+
customer {
|
|
5
|
+
firstname
|
|
6
|
+
lastname
|
|
7
|
+
email
|
|
8
|
+
is_subscribed
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
`,m=`
|
|
13
|
+
mutation CREATE_CUSTOMER_V2($input: CustomerCreateInput!) {
|
|
14
|
+
createCustomerV2(input: $input) {
|
|
15
|
+
customer {
|
|
16
|
+
firstname
|
|
17
|
+
lastname
|
|
18
|
+
email
|
|
19
|
+
is_subscribed
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`,p=async(r,t)=>(await n(),await a(t?m:u,{method:"POST",variables:{input:{...r}}}).catch(s)),c=`
|
|
24
|
+
query GET_ATTRIBUTES_FORM($formCode: String!) {
|
|
25
|
+
attributesForm(formCode: $formCode) {
|
|
26
|
+
items {
|
|
27
|
+
code
|
|
28
|
+
default_value
|
|
29
|
+
entity_type
|
|
30
|
+
frontend_class
|
|
31
|
+
frontend_input
|
|
32
|
+
is_required
|
|
33
|
+
is_unique
|
|
34
|
+
label
|
|
35
|
+
options {
|
|
36
|
+
is_default
|
|
37
|
+
label
|
|
38
|
+
value
|
|
39
|
+
}
|
|
40
|
+
... on CustomerAttributeMetadata {
|
|
41
|
+
multiline_count
|
|
42
|
+
sort_order
|
|
43
|
+
validate_rules {
|
|
44
|
+
name
|
|
45
|
+
value
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
errors {
|
|
50
|
+
type
|
|
51
|
+
message
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
`,T=async r=>await a(c.replace(/\s+/g," ").trim(),{method:"GET",cache:"force-cache",variables:{formCode:r}}).then(t=>{var e;return(e=t.errors)!=null&&e.length?o(t.errors):i(t)}).catch(s),d=`
|
|
56
|
+
mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {
|
|
57
|
+
createCustomerAddress(input:$input) {
|
|
58
|
+
firstname
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
`,f=async r=>await a(d,{method:"POST",variables:{input:r}}).then(t=>{var e;return(e=t.errors)!=null&&e.length?o(t.errors):t.data.createCustomerAddress.firstname||""}).catch(s);export{f as a,p as c,T as g};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{a as y,f as k,h as x}from"./network-error.js";import"@dropins/tools/recaptcha.js";import{h as R,p as T,E as g,a as v,C as O}from"./getStoreConfig.js";import{events as D}from"@dropins/tools/event-bus.js";import{c as U}from"./initialize.js";import{s as K}from"./setReCaptchaToken.js";const F=t=>{var m,r,e,c,a,f;return{email:((r=(m=t==null?void 0:t.data)==null?void 0:m.customer)==null?void 0:r.email)||"",firstname:((c=(e=t==null?void 0:t.data)==null?void 0:e.customer)==null?void 0:c.firstname)||"",lastname:((f=(a=t==null?void 0:t.data)==null?void 0:a.customer)==null?void 0:f.lastname)||""}},H=`
|
|
2
|
+
query GET_CUSTOMER_DATA {
|
|
3
|
+
customer {
|
|
4
|
+
firstname
|
|
5
|
+
lastname
|
|
6
|
+
email
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
`,Q=async t=>{if(t){const{authHeaderConfig:m}=U.getConfig();y(m.header,m.tokenPrefix?`${m.tokenPrefix} ${t}`:t)}return await k(H,{method:"GET",cache:"force-cache"}).then(m=>{var r;return(r=m.errors)!=null&&r.length?R(m.errors):F(m)}).catch(x)},S=`
|
|
10
|
+
mutation GET_CUSTOMER_TOKEN($email: String!, $password: String!) {
|
|
11
|
+
generateCustomerToken(email: $email, password: $password) {
|
|
12
|
+
token
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
`,J=async({email:t,password:m,translations:r,onErrorCallback:e,handleSetInLineAlertProps:c})=>{var E,N,d,$,M,G,w;await K();const a=await k(S,{method:"POST",variables:{email:t,password:m}}).catch(x);if(!((N=(E=a==null?void 0:a.data)==null?void 0:E.generateCustomerToken)!=null&&N.token)){const o=r.customerTokenErrorMessage,u=a!=null&&a.errors?a.errors[0].message:o;return e==null||e(u),c==null||c({type:"error",text:u}),T((d=g)==null?void 0:d.SIGN_IN,{}),{errorMessage:u,userName:""}}const f=(M=($=a==null?void 0:a.data)==null?void 0:$.generateCustomerToken)==null?void 0:M.token,i=await Q(f);if(!(i!=null&&i.firstname)||!(i!=null&&i.email)){const o=r.customerTokenErrorMessage;return e==null||e(o),c==null||c({type:"error",text:o}),T((G=g)==null?void 0:G.SIGN_IN,{}),{errorMessage:o,userName:""}}const h=i==null?void 0:i.firstname,s=i==null?void 0:i.email,_=await v();return document.cookie=`${O.auth_dropin_firstname}=${h}; path=/; ${_}; `,document.cookie=`${O.auth_dropin_user_token}=${f}; path=/; ${_}; `,D.emit("authenticated",!!f),T((w=g)==null?void 0:w.SIGN_IN,s?{email:s}:{}),{errorMessage:"",userName:h}};export{J as a,Q as g};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{f as l,h}from"./network-error.js";const E=e=>({personalEmail:{address:(e==null?void 0:e.email)||""},userAccount:{login:!0},commerce:{commerceScope:{storeCode:(e==null?void 0:e.store_code)||""}}}),S=e=>({userAccount:{logout:!0},commerce:{commerceScope:{storeCode:(e==null?void 0:e.store_code)||""}}}),T=e=>({personalEmail:{address:(e==null?void 0:e.email)||""},userAccount:{updateProfile:e==null?void 0:e.updateProfile},commerce:{commerceScope:{storeCode:(e==null?void 0:e.store_code)||""}}}),D={auth_dropin_user_token:"auth_dropin_user_token",auth_dropin_firstname:"auth_dropin_firstname"},n=3600,N=e=>{var t,o,r,a,m,_,f,g,C,d;return{autocompleteOnStorefront:((o=(t=e==null?void 0:e.data)==null?void 0:t.storeConfig)==null?void 0:o.autocomplete_on_storefront)||!1,minLength:((a=(r=e==null?void 0:e.data)==null?void 0:r.storeConfig)==null?void 0:a.minimum_password_length)||3,requiredCharacterClasses:+((_=(m=e==null?void 0:e.data)==null?void 0:m.storeConfig)==null?void 0:_.required_character_classes_number)||0,createAccountConfirmation:((g=(f=e==null?void 0:e.data)==null?void 0:f.storeConfig)==null?void 0:g.create_account_confirmation)||!1,customerAccessTokenLifetime:((d=(C=e==null?void 0:e.data)==null?void 0:C.storeConfig)==null?void 0:d.customer_access_token_lifetime)*n||n}},A=e=>{const t=e.map(o=>o.message).join(" ");throw Error(t)},p=e=>{document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`},U=async()=>{try{const e=sessionStorage.getItem("storeConfig");let o=(e?JSON.parse(e):{}).customerAccessTokenLifetime;if(!o){const r=await b();sessionStorage.setItem("storeConfig",JSON.stringify(r)),o=(r==null?void 0:r.customerAccessTokenLifetime)||n}return`Max-Age=${o}`}catch(e){return console.error("getCookiesLifetime() Error:",e),`Max-Age=${n}`}};var I=(e=>(e.CREATE_ACCOUNT_EVENT="create-account",e.SIGN_IN="sign-in",e.SIGN_OUT="sign-out",e))(I||{});const c="authContext",s={CREATE_ACCOUNT:"create-account",SIGN_IN:"sign-in",SIGN_OUT:"sign-out"};function i(e,t){const o=window.adobeDataLayer||[];o.push({[e]:null}),o.push({[e]:t})}function u(e){(window.adobeDataLayer||[]).push(o=>{const r=o.getState?o.getState():{};o.push({event:e,eventInfo:{...r}})})}function O(e){const t=T(e);i(c,t),u(s.CREATE_ACCOUNT)}function k(e){const t=E(e);i(c,t),u(s.SIGN_IN)}function w(e){const t=S(e);i(c,t),u(s.SIGN_OUT)}const R=(e,t)=>{const o=sessionStorage.getItem("storeConfig"),a={...o?JSON.parse(o):{},...t};switch(e){case"create-account":O(a);break;case"sign-in":k(a);break;case"sign-out":w(a);break;default:return null}},G=`
|
|
2
|
+
query GET_STORE_CONFIG {
|
|
3
|
+
storeConfig {
|
|
4
|
+
autocomplete_on_storefront
|
|
5
|
+
minimum_password_length
|
|
6
|
+
required_character_classes_number
|
|
7
|
+
store_code
|
|
8
|
+
store_name
|
|
9
|
+
store_group_code
|
|
10
|
+
locale
|
|
11
|
+
create_account_confirmation
|
|
12
|
+
customer_access_token_lifetime
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
`,b=async()=>await l(G,{method:"GET",cache:"force-cache"}).then(e=>{var t;return(t=e.errors)!=null&&t.length?A(e.errors):N(e)}).catch(h);export{D as C,I as E,U as a,p as d,b as g,A as h,R as p};
|
package/chunks/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{R as P,R as b}from"./ResetPasswordForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"./requestPasswordResetEmail.js";import"./network-error.js";import"@dropins/tools/fetch-graphql.js";import"./setReCaptchaToken.js";import"./useInLineAlert.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"./simplifyTransformAttributesForm.js";import"./transform-attributes-form.js";export{P as ResetPasswordForm,b as default};
|
package/chunks/index2.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S as j,S as k}from"./SignInForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"./useInLineAlert.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/components.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/event-bus.js";import"./getCustomerToken.js";import"./network-error.js";import"@dropins/tools/fetch-graphql.js";import"./getStoreConfig.js";import"./initialize.js";import"./setReCaptchaToken.js";import"./resendConfirmationEmail.js";import"./simplifyTransformAttributesForm.js";import"./transform-attributes-form.js";import"./confirmEmail.js";import"./EmailConfirmationForm.js";export{j as SignInForm,k as default};
|
package/chunks/index3.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S as q,S as v}from"./SignUpForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"./createCustomerAddress.js";import"./network-error.js";import"@dropins/tools/fetch-graphql.js";import"./setReCaptchaToken.js";import"./transform-attributes-form.js";import"./getStoreConfig.js";import"@dropins/tools/preact-hooks.js";import"./simplifyTransformAttributesForm.js";import"./usePasswordValidationMessage.js";import"@dropins/tools/i18n.js";import"./getCustomerToken.js";import"./initialize.js";import"./useInLineAlert.js";import"@dropins/tools/components.js";import"@dropins/tools/preact-compat.js";import"./SkeletonLoader.js";import"./EmailConfirmationForm.js";import"./resendConfirmationEmail.js";export{q as SignUpForm,v as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Initializer as o}from"@dropins/tools/lib.js";const i=new o({init:async n=>{const e={authHeaderConfig:{header:"Authorization",tokenPrefix:"Bearer"}};i.config.setConfig({...e,...n})},listeners:()=>[]}),a=i.config;export{a as c,i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{FetchGraphQL as e}from"@dropins/tools/fetch-graphql.js";import{events as r}from"@dropins/tools/event-bus.js";const{setEndpoint:h,setFetchGraphQlHeader:n,removeFetchGraphQlHeader:c,setFetchGraphQlHeaders:p,fetchGraphQl:i,getConfig:f}=new e().getMethods(),m=t=>{throw t instanceof DOMException&&t.name==="AbortError"||r.emit("auth/error",{source:"auth",type:"network",error:t}),t};export{n as a,p as b,i as f,f as g,m as h,c as r,h as s};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{f as E,h as l}from"./network-error.js";import{s as e}from"./setReCaptchaToken.js";const R=a=>{var r,m,i;let t="";return(r=a==null?void 0:a.errors)!=null&&r.length&&(t=(m=a==null?void 0:a.errors[0])==null?void 0:m.message),{message:t,success:!!((i=a==null?void 0:a.data)!=null&&i.requestPasswordResetEmail)}},c=`
|
|
2
|
+
mutation REQUEST_PASSWORD_RESET_EMAIL($email: String!) {
|
|
3
|
+
requestPasswordResetEmail(email: $email)
|
|
4
|
+
}
|
|
5
|
+
`,o=async a=>(await e(),await E(c,{method:"POST",variables:{email:a}}).then(t=>R(t)).catch(l));export{o as r};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{f as o,h as w}from"./network-error.js";import{s as d}from"./setReCaptchaToken.js";const i=`
|
|
2
|
+
mutation RESET_PASSWORD($email: String!, $resetPasswordToken: String!, $newPassword: String!){
|
|
3
|
+
resetPassword(email: $email,resetPasswordToken: $resetPasswordToken,newPassword: $newPassword)
|
|
4
|
+
}
|
|
5
|
+
`,P=a=>{var r,s,e;let t="";return(r=a==null?void 0:a.errors)!=null&&r.length&&(t=(s=a==null?void 0:a.errors[0])==null?void 0:s.message),{message:t,success:!!((e=a==null?void 0:a.data)!=null&&e.resetPassword)}},S=async(a,t,r)=>(await d(),await o(i,{method:"POST",variables:{email:a,resetPasswordToken:t,newPassword:r}}).then(s=>P(s)).catch(w));export{S as r};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{f as u,h as n}from"./network-error.js";import{C as m,d as s,p as c,E}from"./getStoreConfig.js";import{events as i}from"@dropins/tools/event-bus.js";const k=t=>{var r,o,a;let e="";return(r=t==null?void 0:t.errors)!=null&&r.length&&(e=((o=t==null?void 0:t.errors[0])==null?void 0:o.message)||"Unknown error"),{message:e,success:!!((a=t==null?void 0:t.data)!=null&&a.revokeCustomerToken)}},h=`
|
|
2
|
+
mutation REVOKE_CUSTOMER_TOKEN {
|
|
3
|
+
revokeCustomerToken {
|
|
4
|
+
result
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
`,_=async()=>await u(h,{method:"POST"}).then(t=>{const e=k(t);if(e!=null&&e.success)[m.auth_dropin_user_token,m.auth_dropin_firstname].forEach(r=>{s(r)}),i.emit("authenticated",!1),c(E.SIGN_OUT,{logoutAttempt:!0});else{const r=`
|
|
8
|
+
ERROR revokeCustomerToken: ${e.message}`;console.error(r)}return e}).catch(n);export{_ as r};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{verifyReCaptcha as t}from"@dropins/tools/recaptcha.js";import"@dropins/tools/event-bus.js";import{a as e}from"./network-error.js";const s=async()=>{const a=await t();a&&e("X-ReCaptcha",a)};export{s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t}from"./transform-attributes-form.js";const n=[{code:"email",default_value:"",entity_type:"CUSTOMER",frontend_class:"auth-signInForm__form__email",frontend_input:"TEXT",is_required:!0,multiline_count:1,sort_order:1,is_unique:!1,label:"Email",options:[]}],_=[{code:"email",default_value:"",entity_type:"CUSTOMER",frontend_class:"auth-resetPasswordForm__form__item",frontend_input:"TEXT",is_required:!0,is_unique:!1,label:"Email",options:[]}],a=[{code:"email",default_value:"",entity_type:"CUSTOMER",frontend_class:"",frontend_input:"TEXT",is_required:!0,is_unique:!1,label:"Email",multiline_count:1,sort_order:1,options:[]},{code:"firstname",default_value:"",entity_type:"CUSTOMER",frontend_class:"",frontend_input:"TEXT",is_required:!0,is_unique:!1,label:"First name",multiline_count:1,sort_order:2,options:[]},{code:"lastname",default_value:"",entity_type:"CUSTOMER",frontend_class:"",frontend_input:"TEXT",is_required:!1,is_unique:!1,label:"Last name",multiline_count:1,sort_order:3,options:[]}],i={date_of_birth:"",dob:"",email:"",firstname:"",gender:"",is_subscribed:"",lastname:"",middlename:"",password:"",prefix:"",suffix:"",taxvat:""},o=e=>e!=null&&e.length?t({data:{attributesForm:{items:e}}}):[];export{_ as D,n as a,a as b,i as c,o as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const $=u=>{let i=[];return u.forEach(t=>{if(t.fieldType!=="MULTILINE"&&t.multilineCount<2)return null;for(let r=2;r<=t.multilineCount;r++){const e={...t,name:`${t.code}_${r}`,code:`${t.code}_${r}`,id:`${t.code}_${r}`};i.push(e)}}),i},b=u=>{var e,l,a;const i=((l=(e=u==null?void 0:u.data)==null?void 0:e.attributesForm)==null?void 0:l.items)||[];if(!i.length)return[];const t=(a=i.filter(n=>{var o;return!((o=n.frontend_input)!=null&&o.includes("HIDDEN"))}))==null?void 0:a.map(({default_value:n,frontend_input:o,frontend_class:s,is_required:m,multiline_count:f,sort_order:y,code:c,is_unique:_,entity_type:I,...N})=>{const d=c==="country_id";return{...N,entityType:I,unique:_,defaultValue:n??"",fieldType:o,className:s??"",required:!!m,orderNumber:+y,multilineCount:f??0,name:d?"country_code":c,id:d?"country_code":c,code:d?"country_code":c}}),r=$(t);return t.concat(r).sort((n,o)=>n.orderNumber-o.orderNumber)};export{b as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as S,jsx as d,Fragment as V}from"@dropins/tools/preact-jsx-runtime.js";import{useCallback as D,useRef as v,useState as N,useEffect as R}from"@dropins/tools/preact-hooks.js";import{classes as b}from"@dropins/tools/lib.js";import{Button as _,Field as k,Picker as O,Input as y,InputDate as H,Checkbox as P,TextArea as q}from"@dropins/tools/components.js";import{initReCaptcha as U}from"@dropins/tools/recaptcha.js";import{useText as W}from"@dropins/tools/i18n.js";import*as p from"@dropins/tools/preact-compat.js";import{memo as G,useCallback as g}from"@dropins/tools/preact-compat.js";const te=r=>{if(!r)return null;const c=new FormData(r);if(c&&typeof c.entries=="function"){const u=c.entries();if(u&&typeof u[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(u)))||{}}return{}},ne=r=>typeof r=="function",ae=({type:r,buttonText:c,variant:u,className:s="",enableLoader:o=!1,onClick:l,style:h,icon:a,...i})=>{const T=D(A=>{l==null||l(A)},[l]);return S(_,{icon:a,style:h,type:r,variant:u,className:b(["auth-button",s,o?"enableLoader":""]),onClick:T,...i,children:[d("span",{className:"auth-button__text",children:c}),o?d("div",{className:"auth-button__loader-wrapper",children:d("span",{className:"auth-button__loader"})}):null]})},C=r=>r.reduce((c,{code:u,required:s,defaultValue:o})=>(s&&(c[u]=o),c),{}),F=({fieldsConfig:r,submitCallback:c})=>{const{requiredFieldError:u}=W({requiredFieldError:"Auth.FormText.requiredFieldError"}),s=v(null),o=v(!1),[l,h]=N({}),[a,i]=N({}),T=D(async()=>{o.current||(await U(0),o.current=!0)},[]);R(()=>{if(!r.length)return;const t=C(r);h(t)},[r==null?void 0:r.length]);const $=D((t,n)=>{const E=r.find(f=>f.code===t);return E!=null&&E.required&&!n?u:""},[r,u]),A=D(t=>{const{name:n,value:E,type:I,checked:f}=t==null?void 0:t.target,x=I==="checkbox"?f:E;h(L=>({...L,[n]:x}))},[]),M=D(t=>{const{name:n,value:E,type:I,checked:f}=t==null?void 0:t.target,x=I==="checkbox"?f:E;i(L=>({...L,[n]:$(n,x)}))},[$]),e=D(t=>{t.preventDefault();let n=!0,E={},I=null;for(const[f,x]of Object.entries(l)){const L=$(f,x);L&&(E[f]=L,n=!1,I||(I=f))}if(i(E),I&&s.current){const f=s.current.elements.namedItem(I);f==null||f.focus()}c==null||c(t,n)},[l,$,c]);return{formData:l,errors:a,formRef:s,handleChange:A,handleBlur:M,handleSubmit:e,handleFocus:T}};var w=(r=>(r.BOOLEAN="BOOLEAN",r.DATE="DATE",r.DATETIME="DATETIME",r.DROPDOWN="DROPDOWN",r.FILE="FILE",r.GALLERY="GALLERY",r.HIDDEN="HIDDEN",r.IMAGE="IMAGE",r.MEDIA_IMAGE="MEDIA_IMAGE",r.MULTILINE="MULTILINE",r.MULTISELECT="MULTISELECT",r.PRICE="PRICE",r.SELECT="SELECT",r.TEXT="TEXT",r.TEXTAREA="TEXTAREA",r.UNDEFINED="UNDEFINED",r.VISUAL="VISUAL",r.WEIGHT="WEIGHT",r.EMPTY="",r))(w||{});const Z=G(({loading:r,values:c,fields:u=[],errors:s,className:o="",onChange:l,onBlur:h})=>{const a=`${o}__field`,i=g((e,t,n)=>d(k,{error:n,className:b([a,`${a}--${e.id}`,[`${a}--${e.id}-hidden`,e.hidden],e.className]),"data-testid":`${o}--${e.id}`,disabled:r,children:d(O,{name:e.id,floatingLabel:`${e.label} ${e.required?"*":""}`,placeholder:e.label,"aria-label":e.label,options:e.options.map(E=>({...E,text:E.label})),onBlur:h,handleSelect:l,value:t||e.defaultValue})},e.id),[o,r,a,h,l]),T=g((e,t,n)=>d(k,{error:n,className:b([a,`${a}--${e.id}`,[`${a}--${e.id}-hidden`,e.hidden],e.className]),"data-testid":`${o}--${e.id}`,disabled:r,children:d(y,{autocomplete:e.code==="email"?"username":"",type:"text",name:e.id,value:t===void 0?e.defaultValue:t,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:h,onChange:l})},e.id),[o,r,a,h,l]),$=g((e,t,n)=>d(k,{error:n,className:b([a,`${a}--${e.id}`,[`${a}--${e.id}-hidden`,e.hidden],e.className]),"data-testid":`${o}--${e.id}`,disabled:r,children:d(H,{type:"text",name:e.id,value:t||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:h,onChange:l})},e.id),[o,r,a,h,l]),A=g((e,t,n)=>d(k,{error:n,className:b([a,`${a}--${e.id}`,[`${a}--${e.id}-hidden`,e.hidden],e.className]),"data-testid":`${o}--${e.id}`,disabled:r,children:d(P,{name:e.id,checked:t||e.defaultValue,placeholder:e.label,label:`${e.label} ${e.required?"*":""}`,onBlur:h,onChange:l})},e.id),[o,r,a,h,l]),M=g((e,t,n)=>d(k,{error:n,className:b([a,`${a}--${e.id}`,[`${a}--${e.id}-hidden`,e.hidden],e.className]),"data-testid":`${o}--${e.id}`,disabled:r,children:d(q,{type:"text",name:e.id,value:t===void 0?e.defaultValue:t,label:`${e.label} ${e.required?"*":""}`,onBlur:h,onChange:l})},e.id),[o,r,a,h,l]);return u.length?d(V,{children:u.map(e=>{const t=(s==null?void 0:s[e.id])??void 0,n=(c==null?void 0:c[e.id])??void 0;switch(e.fieldType){case w.TEXT:return e.options.length?i(e,n,t):T(e,n,t);case w.MULTILINE:return T(e,n,t);case w.SELECT:return i(e,n,t);case w.DATE:return $(e,n,t);case w.BOOLEAN:return A(e,n,t);case"TEXTAREA":return M(e,n,t);default:return null}})}):null}),oe=({name:r,isLoading:c,children:u,className:s="defaultForm",fieldsConfig:o=[],submitCallback:l})=>{const{formData:h,errors:a,formRef:i,handleChange:T,handleBlur:$,handleSubmit:A,handleFocus:M}=F({submitCallback:l,fieldsConfig:o});return S("form",{onSubmit:A,className:s,name:r,ref:i,onFocus:M,children:[d(Z,{fields:o,onChange:T,onBlur:$,errors:a,values:h,className:s,loading:c}),u]})},B=r=>p.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},p.createElement("g",{clipPath:"url(#clip0_841_1324)"},p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),p.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"})),p.createElement("defs",null,p.createElement("clipPath",{id:"clip0_841_1324"},p.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),X=r=>p.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},p.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"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),j=r=>p.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},p.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"}),p.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"})),Y={success:d(X,{}),warning:d(B,{}),error:d(j,{})},ce=()=>{const[r,c]=N({}),u=D(s=>{if(!s||!s.type){c({});return}const o=Y[s.type];c({...s,icon:o})},[]);return{inLineAlertProps:r,handleSetInLineAlertProps:u}};export{ae as B,oe as F,ne as c,te as g,ce as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{g as m}from"./getStoreConfig.js";import{useState as c,useEffect as u,useMemo as h}from"@dropins/tools/preact-hooks.js";import{useText as f}from"@dropins/tools/i18n.js";const A=()=>{const[e,n]=c(!1),[t,i]=c(null);return u(()=>{const a=sessionStorage.getItem("storeConfig"),r=a?JSON.parse(a):null;if(r){const{minLength:o,requiredCharacterClasses:s,createAccountConfirmation:g}=r;i({minLength:o,requiredCharacterClasses:s}),n(g)}else m().then(o=>{if(o){const{minLength:s,requiredCharacterClasses:g,createAccountConfirmation:l}=o;sessionStorage.setItem("storeConfig",JSON.stringify(o)),i({minLength:s,requiredCharacterClasses:g}),n(l)}})},[]),{passwordConfigs:t,isEmailConfirmationRequired:e}},L=(e,n)=>{if(n<=1)return!0;const t=/[0-9]/.test(e)?1:0,i=/[a-z]/.test(e)?1:0,a=/[A-Z]/.test(e)?1:0,r=/[^a-zA-Z0-9\s]/.test(e)?1:0;return t+i+a+r>=n},M=({passwordConfigs:e,isClickSubmit:n,password:t})=>{const i=f({messageLengthPassword:"Auth.PasswordValidationMessage.messageLengthPassword"}),[a,r]=c("pending");u(()=>{if(!e)return;const s=L(t,e.requiredCharacterClasses);n&&t.length>0?r(s?"success":"error"):n&&t.length===0?r("pending"):r(s?"success":"pending")},[n,e,t]);const o=h(()=>{var g;if(!e)return;const s={status:"pending",icon:"pending",message:(g=i.messageLengthPassword)==null?void 0:g.replace("{minLength}",`${e.minLength}`)};return t.length&&t.length>=e.minLength?{...s,icon:"success",status:"success"}:t.length&&t.length<e.minLength?n?{...s,icon:"error",status:"error"}:{...s,icon:"pending",status:"pending"}:s},[e,i.messageLengthPassword,t==null?void 0:t.length,n]);return{isValidUniqueSymbols:a,defaultLengthMessage:o}};export{M as a,A as u,L as v};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
import { ResetPasswordFormProps } from '../../types';
|
|
4
|
+
|
|
5
|
+
export declare const ResetPasswordForm: FunctionComponent<ResetPasswordFormProps & HTMLAttributes<HTMLDivElement>>;
|
|
6
|
+
//# sourceMappingURL=ResetPasswordForm.d.ts.map
|