@unidy.io/sdk 1.1.6 → 1.1.7
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/dist/cjs/u-field.u-raw-field.entry.cjs.js.map +1 -1
- package/dist/cjs/u-field_2.cjs.entry.js +1 -1
- package/dist/cjs/u-flash-message.cjs.entry.js +2 -2
- package/dist/cjs/u-flash-message.entry.cjs.js.map +1 -1
- package/dist/cjs/u-password-field.cjs.entry.js +6 -4
- package/dist/cjs/u-password-field.entry.cjs.js.map +1 -1
- package/dist/cjs/u-profile.u-submit-button.entry.cjs.js.map +1 -1
- package/dist/cjs/u-profile_2.cjs.entry.js +1 -1
- package/dist/cjs/u-reset-password-button.cjs.entry.js +12 -3
- package/dist/cjs/u-reset-password-button.entry.cjs.js.map +1 -1
- package/dist/cjs/u-signin-root.entry.cjs.js.map +1 -1
- package/dist/cjs/u-social-login-button.cjs.entry.js +1 -1
- package/dist/cjs/u-spinner.cjs.entry.js +1 -1
- package/dist/cjs/u-spinner.entry.cjs.js.map +1 -1
- package/dist/collection/auth/components/password-field/password-field.js +6 -4
- package/dist/collection/auth/components/password-field/password-field.js.map +1 -1
- package/dist/collection/auth/components/reset-pass-button/reset-pass-button.js +12 -3
- package/dist/collection/auth/components/reset-pass-button/reset-pass-button.js.map +1 -1
- package/dist/collection/auth/components/signin-root/signin-root.js.map +1 -1
- package/dist/collection/profile/components/field/field.css +1 -1
- package/dist/collection/shared/components/flash-message/flash-message.css +1 -1
- package/dist/collection/shared/components/flash-message/flash-message.js +2 -2
- package/dist/collection/shared/components/flash-message/flash-message.js.map +1 -1
- package/dist/collection/shared/components/spinner/spinner.css +1 -1
- package/dist/collection/shared/components/submit-button/submit-button.css +1 -1
- package/dist/components/field.js +1 -1
- package/dist/components/field.js.map +1 -1
- package/dist/components/spinner.js +1 -1
- package/dist/components/spinner.js.map +1 -1
- package/dist/components/submit-button.js +1 -1
- package/dist/components/submit-button.js.map +1 -1
- package/dist/components/u-flash-message.js +2 -2
- package/dist/components/u-flash-message.js.map +1 -1
- package/dist/components/u-password-field.js +6 -4
- package/dist/components/u-password-field.js.map +1 -1
- package/dist/components/u-reset-password-button.js +12 -3
- package/dist/components/u-reset-password-button.js.map +1 -1
- package/dist/components/u-signin-root.js.map +1 -1
- package/dist/esm/u-field.u-raw-field.entry.js.map +1 -1
- package/dist/esm/u-field_2.entry.js +1 -1
- package/dist/esm/u-flash-message.entry.js +2 -2
- package/dist/esm/u-flash-message.entry.js.map +1 -1
- package/dist/esm/u-password-field.entry.js +6 -4
- package/dist/esm/u-password-field.entry.js.map +1 -1
- package/dist/esm/u-profile.u-submit-button.entry.js.map +1 -1
- package/dist/esm/u-profile_2.entry.js +1 -1
- package/dist/esm/u-reset-password-button.entry.js +12 -3
- package/dist/esm/u-reset-password-button.entry.js.map +1 -1
- package/dist/esm/u-signin-root.entry.js.map +1 -1
- package/dist/esm/u-social-login-button.entry.js +1 -1
- package/dist/esm/u-spinner.entry.js +1 -1
- package/dist/esm/u-spinner.entry.js.map +1 -1
- package/dist/sdk/{p-5cc20a8b.entry.js → p-09cd77e6.entry.js} +2 -2
- package/dist/sdk/{p-5cc20a8b.entry.js.map → p-09cd77e6.entry.js.map} +1 -1
- package/dist/sdk/{p-e3611b71.entry.js → p-5557b4d9.entry.js} +2 -2
- package/dist/sdk/{p-e3611b71.entry.js.map → p-5557b4d9.entry.js.map} +1 -1
- package/dist/sdk/p-6086d248.entry.js +2 -0
- package/dist/sdk/{p-effaf86b.entry.js.map → p-6086d248.entry.js.map} +1 -1
- package/dist/sdk/p-7a34f391.entry.js +2 -0
- package/dist/sdk/{p-7a0cefff.entry.js.map → p-7a34f391.entry.js.map} +1 -1
- package/dist/sdk/p-afc65acd.entry.js +2 -0
- package/dist/sdk/p-afc65acd.entry.js.map +1 -0
- package/dist/sdk/{p-c31dbbb4.entry.js → p-b3980341.entry.js} +2 -2
- package/dist/sdk/{p-e3f28800.entry.js → p-f5615938.entry.js} +2 -2
- package/dist/sdk/{p-e3f28800.entry.js.map → p-f5615938.entry.js.map} +1 -1
- package/dist/sdk/sdk.esm.js +1 -1
- package/dist/sdk/u-field.u-raw-field.entry.esm.js.map +1 -1
- package/dist/sdk/u-flash-message.entry.esm.js.map +1 -1
- package/dist/sdk/u-profile.u-submit-button.entry.esm.js.map +1 -1
- package/dist/sdk/u-signin-root.entry.esm.js.map +1 -1
- package/dist/sdk/u-spinner.entry.esm.js.map +1 -1
- package/package.json +1 -1
- package/dist/sdk/p-7a0cefff.entry.js +0 -2
- package/dist/sdk/p-a6393d19.entry.js +0 -2
- package/dist/sdk/p-a6393d19.entry.js.map +0 -1
- package/dist/sdk/p-effaf86b.entry.js +0 -2
- package/dist/sdk/u-password-field.entry.js +0 -104
- package/dist/sdk/u-reset-password-button.entry.js +0 -54
- /package/dist/sdk/{p-c31dbbb4.entry.js.map → p-b3980341.entry.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"u-profile.u-submit-button.entry.esm.js","sources":["src/profile/components/profile/profile.tsx","src/auth/components/submit-button/auth-submit-button.ts","src/newsletter/components/submit-button/newsletter-submit-button.ts","src/profile/components/submit-button/profile-submit-button.ts","src/shared/components/submit-button/context.ts","src/shared/components/submit-button/submit-button.css?tag=u-submit-button","src/shared/components/submit-button/submit-button.tsx"],"sourcesContent":["import * as Sentry from \"@sentry/browser\";\nimport { Component, Event, type EventEmitter, Host, h, Method, Prop, State } from \"@stencil/core\";\nimport { getUnidyClient } from \"../../../api\";\nimport { Auth } from \"../../../auth\";\nimport { onChange as authOnChange, authStore } from \"../../../auth/store/auth-store\";\nimport { t } from \"../../../i18n\";\nimport { onChange as unidyOnChange, unidyState } from \"../../../shared/store/unidy-store\";\nimport { buildPayload, validateRequiredFieldsUnchanged } from \"../../profile-helpers\";\nimport type { ProfileRaw } from \"../../store/profile-store\";\nimport { onChange as profileOnChange, state as profileState } from \"../../store/profile-store\";\n\n@Component({\n tag: \"u-profile\",\n shadow: false,\n})\nexport class Profile {\n @Prop() profileId?: string;\n @Prop() initialData: string | Record<string, string> = \"\";\n\n @Event() uProfileSuccess!: EventEmitter<{ message: string; payload: ProfileRaw }>;\n @Event() uProfileError!: EventEmitter<{\n error: string;\n details: {\n fieldErrors?: Record<string, string>;\n flashErrors?: Record<string, string>;\n httpStatus?: number;\n responseData?: unknown;\n };\n }>;\n\n @State() fetchingProfileData = false;\n\n constructor() {\n unidyOnChange(\"locale\", async (_locale) => {\n if (authStore.state.authenticated) await this.getTokenAndFetchProfile();\n });\n }\n\n async componentWillLoad() {\n if (this.initialData !== \"\") {\n profileState.data = typeof this.initialData === \"string\" ? JSON.parse(this.initialData) : this.initialData;\n } else if (authStore.state.authenticated) {\n await this.getTokenAndFetchProfile();\n }\n\n profileState.loading = false;\n }\n\n async getTokenAndFetchProfile() {\n const authInstance = await Auth.getInstance();\n\n const idToken = await authInstance.getToken();\n\n if (idToken && typeof idToken === \"string\") {\n await this.fetchProfileData(idToken as string);\n }\n }\n\n async fetchProfileData(idToken: string) {\n // avoid multiple requests\n if (this.fetchingProfileData) return;\n\n this.fetchingProfileData = true;\n try {\n const resp = await getUnidyClient().profile.fetchProfile({ idToken, lang: unidyState.locale });\n\n if (resp.success) {\n profileState.configuration = JSON.parse(JSON.stringify(resp.data)) as ProfileRaw;\n profileState.configUpdateSource = \"fetch\";\n profileState.errors = {};\n profileState.flashErrors = {};\n\n profileState.data = JSON.parse(JSON.stringify(resp.data)) as ProfileRaw;\n } else {\n profileState.flashErrors = { [String(resp?.status)]: String(resp?.error) };\n }\n } catch (error) {\n Sentry.captureException(\"Failed to fetch profile data:\", error);\n profileState.flashErrors = { error: t(\"errors.failed_to_load_profile\") };\n }\n this.fetchingProfileData = false;\n }\n\n @Method()\n async submitProfile() {\n const authInstance = await Auth.getInstance();\n\n profileState.loading = true;\n\n const { configuration, ...stateWithoutConfig } = profileState;\n\n if (!validateRequiredFieldsUnchanged(stateWithoutConfig.data)) {\n profileState.loading = false;\n return;\n }\n\n const updatedProfileData = buildPayload(stateWithoutConfig.data);\n\n const resp = await getUnidyClient().profile.updateProfile({\n idToken: (await authInstance.getToken()) as string,\n data: updatedProfileData,\n lang: unidyState.locale,\n });\n\n if (resp?.success) {\n profileState.loading = false;\n profileState.configuration = JSON.parse(JSON.stringify(resp.data));\n profileState.configUpdateSource = \"submit\";\n profileState.errors = {};\n this.uProfileSuccess.emit({ message: \"profile_updated_successfully\", payload: resp.data as ProfileRaw });\n } else {\n if (resp?.data && \"flatErrors\" in resp.data) {\n profileState.errors = resp.data.flatErrors as Record<string, string>;\n this.uProfileError.emit({\n error: \"profile_update_field_errors\",\n details: { fieldErrors: profileState.errors, httpStatus: resp?.status, responseData: resp?.data },\n });\n } else {\n profileState.flashErrors = { [String(resp?.status)]: String(resp?.error) };\n this.uProfileError.emit({\n error: \"profile_update_failed\",\n details: { flashErrors: profileState.flashErrors, httpStatus: resp?.status, responseData: resp?.data },\n });\n }\n profileState.loading = false;\n }\n }\n\n componentDidLoad() {\n profileOnChange(\"configuration\", (cfg) => {\n profileState.data = cfg as ProfileRaw;\n });\n\n authOnChange(\"token\", (newToken: string | null) => {\n const token = newToken ?? \"\";\n\n if (token) {\n this.fetchProfileData(token);\n }\n });\n }\n\n render() {\n const hasFieldErrors = Object.values(profileState.errors).some(Boolean);\n const errorMsg = Object.values(profileState.flashErrors).filter(Boolean).join(\", \");\n const wasSubmit = profileState.configUpdateSource === \"submit\";\n\n if (authStore.state.authenticated) {\n return this.fetchingProfileData ? (\n <div>{t(\"loading\")}</div>\n ) : (\n <Host>\n <slot />\n {!hasFieldErrors && errorMsg && <flash-message variant=\"error\" message={errorMsg} />}\n {wasSubmit && !errorMsg && !hasFieldErrors && <flash-message variant=\"success\" message={t(\"profile.updated\")} />}\n </Host>\n );\n }\n\n return <h2>{t(\"profile.signInToView\")}</h2>;\n }\n}\n","import { t } from \"../../../i18n\";\nimport type { SubmitButtonContext } from \"../../../shared/components/submit-button/context\";\nimport { authState } from \"../../store/auth-store\";\nimport { getParentSigninStep } from \"../helpers\";\n\nexport type AuthButtonFor = \"email\" | \"password\" | \"resetPassword\";\n\nexport const authContext: SubmitButtonContext<AuthButtonFor> = {\n handleClick: async (event: MouseEvent, el: HTMLElement, _forProp?: AuthButtonFor) => {\n event.preventDefault();\n await getParentSigninStep(el)?.submit();\n },\n\n isDisabled(forProp?: AuthButtonFor, disabled?: boolean): boolean {\n if (disabled || authState.loading) return true;\n\n if (authState.step === \"email\" && forProp === \"email\") {\n return authState.email === \"\";\n }\n\n if (authState.step === \"verification\" && forProp === \"password\") {\n return authState.password === \"\";\n }\n\n if (authState.step === \"reset-password\" && forProp === \"resetPassword\") {\n return !authState.resetPassword.newPassword || !authState.resetPassword.passwordConfirmation;\n }\n\n return false;\n },\n\n isLoading(): boolean {\n return authState.loading;\n },\n\n getButtonText(forProp?: AuthButtonFor, text?: string): string {\n if (text) return text;\n\n switch (authState.step) {\n case \"email\":\n return t(\"buttons.continue\");\n case \"verification\":\n if (forProp === \"password\") {\n return t(\"auth.password.button_text\", { defaultValue: \"Sign In with Password\" });\n }\n return t(\"buttons.submit\");\n case \"reset-password\":\n if (forProp === \"resetPassword\") {\n return t(\"auth.resetPassword.button_text_set\", { defaultValue: \"Set Password\" });\n }\n return t(\"buttons.submit\");\n default:\n return t(\"buttons.submit\");\n }\n },\n\n shouldRender(forProp?: AuthButtonFor): boolean {\n if (!authState.availableLoginOptions?.password && forProp === \"password\") {\n return false;\n }\n\n if (authState.step === \"email\") {\n return forProp === \"email\";\n }\n\n if (authState.step === \"verification\") {\n return forProp === \"password\" && authState.magicCodeStep !== \"sent\";\n }\n\n if (authState.step === \"reset-password\") {\n return forProp === \"resetPassword\";\n }\n\n return false;\n },\n};\n","import type { SubmitButtonContext } from \"../../../shared/components/submit-button/context\";\nimport { newsletterStore } from \"../../store/newsletter-store\";\nimport { getParentNewsletterRoot } from \"../helpers\";\n\nexport type NewsletterButtonFor = \"login\" | \"create\";\n\nexport const newsletterContext: SubmitButtonContext<NewsletterButtonFor> = {\n handleClick: async (event: MouseEvent, el: HTMLElement, forProp?: NewsletterButtonFor) => {\n event.preventDefault();\n return await getParentNewsletterRoot(el)?.submit(forProp);\n },\n\n isDisabled(forProp, disabled?: boolean): boolean {\n if (forProp === \"login\") {\n return disabled || !newsletterStore.state.email;\n }\n\n return disabled || !newsletterStore.state.email || Object.keys(newsletterStore.state.checkedNewsletters).length === 0;\n },\n\n isLoading(): boolean {\n return false;\n },\n};\n","import type { SubmitButtonContext } from \"../../../shared/components/submit-button/context\";\nimport { state as profileState } from \"../../store/profile-store\";\n\nfunction getParentProfile(el: HTMLElement) {\n return el.closest(\"u-profile\") as HTMLUProfileElement | null;\n}\n\nexport const profileContext: SubmitButtonContext = {\n async handleClick(event: MouseEvent, el: HTMLElement, _forProp?: string) {\n event.preventDefault();\n await getParentProfile(el)?.submitProfile();\n },\n\n isDisabled(_forProp, disabled?: boolean): boolean {\n return disabled || (profileState.errors && Object.keys(profileState.errors).length > 0) || profileState.phoneValid === false;\n },\n\n isLoading(): boolean {\n return profileState.loading;\n },\n};\n","export interface SubmitButtonContext<ForContext = string> {\n init?(): Promise<void>;\n handleClick(event: MouseEvent, el: HTMLElement, forProp?: ForContext): Promise<void>;\n isDisabled(forProp?: ForContext, disabled?: boolean): boolean;\n isLoading(): boolean;\n getButtonText?(forProp?: ForContext, text?: string): string;\n shouldRender?(forProp?: ForContext): boolean;\n}\n\nexport const defaultContext: SubmitButtonContext = {\n async handleClick() {},\n\n isDisabled(_forProp, disabled = false): boolean {\n return disabled || false;\n },\n\n isLoading(): boolean {\n return false;\n },\n};\n","","import { Component, Element, h, Prop } from \"@stencil/core\";\nimport { type AuthButtonFor, authContext } from \"../../../auth/components/submit-button/auth-submit-button\";\nimport { t } from \"../../../i18n\";\nimport { type NewsletterButtonFor, newsletterContext } from \"../../../newsletter/components/submit-button/newsletter-submit-button\";\nimport { profileContext } from \"../../../profile/components/submit-button/profile-submit-button\";\nimport { hasSlotContent } from \"../../component-utils\";\nimport { defaultContext, type SubmitButtonContext } from \"./context\";\n\n@Component({\n tag: \"u-submit-button\",\n styleUrl: \"submit-button.css\",\n shadow: false,\n})\nexport class SubmitButton {\n @Element() el!: HTMLElement;\n @Prop() for?: AuthButtonFor | NewsletterButtonFor;\n @Prop() text?: string;\n @Prop() disabled = false;\n @Prop({ attribute: \"class-name\" }) componentClassName = \"\";\n\n private context: \"auth\" | \"profile\" | \"newsletter\" = \"auth\";\n private contextModule: SubmitButtonContext = defaultContext;\n private hasSlot = false;\n\n async componentWillLoad() {\n this.hasSlot = hasSlotContent(this.el);\n this.context = this.detectContext();\n\n switch (this.context) {\n case \"auth\":\n this.contextModule = authContext;\n break;\n case \"profile\":\n this.contextModule = profileContext;\n break;\n case \"newsletter\":\n this.contextModule = newsletterContext;\n break;\n default:\n this.contextModule = defaultContext;\n }\n }\n\n private detectContext(): \"auth\" | \"profile\" | \"newsletter\" {\n if (this.el.closest(\"u-signin-root\") || this.el.closest(\"u-signin-step\")) return \"auth\";\n\n if (this.el.closest(\"u-profile\")) return \"profile\";\n\n if (this.el.closest(\"u-newsletter-root\")) return \"newsletter\";\n\n throw new Error(\n \"No context found for submit button. Make sure you are using the component within a u-signin-root, u-profile, or u-newsletter-root.\",\n );\n }\n\n private handleClick = async (event: MouseEvent) => {\n await this.contextModule.handleClick(event, this.el, this.for);\n };\n\n private isDisabled(): boolean {\n return this.contextModule.isDisabled(this.for, this.disabled);\n }\n\n private isLoading(): boolean {\n return this.contextModule.isLoading();\n }\n\n private getButtonText(): string {\n if (this.contextModule.getButtonText) {\n return this.contextModule.getButtonText(this.for, this.text);\n }\n if (this.text) {\n return this.text;\n }\n\n return t(\"buttons.submit\");\n }\n\n private getButtonContent() {\n const loading = this.isLoading();\n\n if (loading) {\n return <u-spinner />;\n }\n\n if (this.hasSlot) {\n return <slot />;\n }\n\n return this.getButtonText();\n }\n\n render() {\n if (this.contextModule.shouldRender && !this.contextModule.shouldRender(this.for)) {\n return null;\n }\n\n const buttonClasses = [\n this.componentClassName,\n this.context === \"auth\" ? \"u:flex u:justify-center\" : \"\",\n \"u:disabled:opacity-50 u:disabled:cursor-not-allowed\",\n ].join(\" \");\n\n const buttonProps: Record<string, unknown> = {\n type: \"submit\",\n part: `${this.context}-submit-button`,\n disabled: this.isDisabled() || this.isLoading(),\n class: buttonClasses,\n onClick: this.handleClick,\n \"aria-live\": \"polite\",\n };\n\n return <button {...buttonProps}>{this.getButtonContent()}</button>;\n }\n}\n"],"names":["unidyOnChange","profileState","Sentry.captureException","profileOnChange","authOnChange","authState"],"mappings":";;;;;;;;;;;;;;;MAea,OAAO,GAAA,MAAA;AACV,IAAA,SAAS;IACT,WAAW,GAAoC,EAAE;AAEhD,IAAA,eAAe;AACf,IAAA,aAAa;IAUb,mBAAmB,GAAG,KAAK;AAEpC,IAAA,WAAA,CAAA,OAAA,EAAA;;;;AACE,QAAAA,QAAa,CAAC,QAAQ,EAAE,OAAO,OAAO,KAAI;AACxC,YAAA,IAAI,SAAS,CAAC,KAAK,CAAC,aAAa;AAAE,gBAAA,MAAM,IAAI,CAAC,uBAAuB,EAAE;AACzE,SAAC,CAAC;AACH;AAED,IAAA,MAAM,iBAAiB,GAAA;AACrB,QAAA,IAAI,IAAI,CAAC,WAAW,KAAK,EAAE,EAAE;YAC3BC,KAAY,CAAC,IAAI,GAAG,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,WAAW;;AACrG,aAAA,IAAI,SAAS,CAAC,KAAK,CAAC,aAAa,EAAE;AACxC,YAAA,MAAM,IAAI,CAAC,uBAAuB,EAAE;;AAGtC,QAAAA,KAAY,CAAC,OAAO,GAAG,KAAK;;AAG9B,IAAA,MAAM,uBAAuB,GAAA;AAC3B,QAAA,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE;AAE7C,QAAA,MAAM,OAAO,GAAG,MA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G,EAAE;YACxD,qDAAqD;AACtD,SAAA,CAAC,IAAI,CAAC,GAAG,CAAC;AAEX,QAAA,MAAM,WAAW,GAA4B;AAC3C,YAAA,IAAI,EAAE,QAAQ;AACd,YAAA,IAAI,EAAE,CAAA,EAAG,IAAI,CAAC,OAAO,CAAgB,cAAA,CAAA;YACrC,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,IAAI,CAAC,SAAS,EAAE;AAC/C,YAAA,KAAK,EAAE,aAAa;YACpB,OAAO,EAAE,IAAI,CAAC,WAAW;AACzB,YAAA,WAAW,EAAE,QAAQ;SACtB;AAED,QAAA,OAAO,CAAA,CAAA,QAAA,EAAA,EAAA,GAAY,WAAW,EAAG,EAAA,IAAI,CAAC,gBAAgB,EAAE,CAAU;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"u-profile.u-submit-button.entry.esm.js","sources":["src/profile/components/profile/profile.tsx","src/auth/components/submit-button/auth-submit-button.ts","src/newsletter/components/submit-button/newsletter-submit-button.ts","src/profile/components/submit-button/profile-submit-button.ts","src/shared/components/submit-button/context.ts","src/shared/components/submit-button/submit-button.css?tag=u-submit-button","src/shared/components/submit-button/submit-button.tsx"],"sourcesContent":["import * as Sentry from \"@sentry/browser\";\nimport { Component, Event, type EventEmitter, Host, h, Method, Prop, State } from \"@stencil/core\";\nimport { getUnidyClient } from \"../../../api\";\nimport { Auth } from \"../../../auth\";\nimport { onChange as authOnChange, authStore } from \"../../../auth/store/auth-store\";\nimport { t } from \"../../../i18n\";\nimport { onChange as unidyOnChange, unidyState } from \"../../../shared/store/unidy-store\";\nimport { buildPayload, validateRequiredFieldsUnchanged } from \"../../profile-helpers\";\nimport type { ProfileRaw } from \"../../store/profile-store\";\nimport { onChange as profileOnChange, state as profileState } from \"../../store/profile-store\";\n\n@Component({\n tag: \"u-profile\",\n shadow: false,\n})\nexport class Profile {\n @Prop() profileId?: string;\n @Prop() initialData: string | Record<string, string> = \"\";\n\n @Event() uProfileSuccess!: EventEmitter<{ message: string; payload: ProfileRaw }>;\n @Event() uProfileError!: EventEmitter<{\n error: string;\n details: {\n fieldErrors?: Record<string, string>;\n flashErrors?: Record<string, string>;\n httpStatus?: number;\n responseData?: unknown;\n };\n }>;\n\n @State() fetchingProfileData = false;\n\n constructor() {\n unidyOnChange(\"locale\", async (_locale) => {\n if (authStore.state.authenticated) await this.getTokenAndFetchProfile();\n });\n }\n\n async componentWillLoad() {\n if (this.initialData !== \"\") {\n profileState.data = typeof this.initialData === \"string\" ? JSON.parse(this.initialData) : this.initialData;\n } else if (authStore.state.authenticated) {\n await this.getTokenAndFetchProfile();\n }\n\n profileState.loading = false;\n }\n\n async getTokenAndFetchProfile() {\n const authInstance = await Auth.getInstance();\n\n const idToken = await authInstance.getToken();\n\n if (idToken && typeof idToken === \"string\") {\n await this.fetchProfileData(idToken as string);\n }\n }\n\n async fetchProfileData(idToken: string) {\n // avoid multiple requests\n if (this.fetchingProfileData) return;\n\n this.fetchingProfileData = true;\n try {\n const resp = await getUnidyClient().profile.fetchProfile({ idToken, lang: unidyState.locale });\n\n if (resp.success) {\n profileState.configuration = JSON.parse(JSON.stringify(resp.data)) as ProfileRaw;\n profileState.configUpdateSource = \"fetch\";\n profileState.errors = {};\n profileState.flashErrors = {};\n\n profileState.data = JSON.parse(JSON.stringify(resp.data)) as ProfileRaw;\n } else {\n profileState.flashErrors = { [String(resp?.status)]: String(resp?.error) };\n }\n } catch (error) {\n Sentry.captureException(\"Failed to fetch profile data:\", error);\n profileState.flashErrors = { error: t(\"errors.failed_to_load_profile\") };\n }\n this.fetchingProfileData = false;\n }\n\n @Method()\n async submitProfile() {\n const authInstance = await Auth.getInstance();\n\n profileState.loading = true;\n\n const { configuration, ...stateWithoutConfig } = profileState;\n\n if (!validateRequiredFieldsUnchanged(stateWithoutConfig.data)) {\n profileState.loading = false;\n return;\n }\n\n const updatedProfileData = buildPayload(stateWithoutConfig.data);\n\n const resp = await getUnidyClient().profile.updateProfile({\n idToken: (await authInstance.getToken()) as string,\n data: updatedProfileData,\n lang: unidyState.locale,\n });\n\n if (resp?.success) {\n profileState.loading = false;\n profileState.configuration = JSON.parse(JSON.stringify(resp.data));\n profileState.configUpdateSource = \"submit\";\n profileState.errors = {};\n this.uProfileSuccess.emit({ message: \"profile_updated_successfully\", payload: resp.data as ProfileRaw });\n } else {\n if (resp?.data && \"flatErrors\" in resp.data) {\n profileState.errors = resp.data.flatErrors as Record<string, string>;\n this.uProfileError.emit({\n error: \"profile_update_field_errors\",\n details: { fieldErrors: profileState.errors, httpStatus: resp?.status, responseData: resp?.data },\n });\n } else {\n profileState.flashErrors = { [String(resp?.status)]: String(resp?.error) };\n this.uProfileError.emit({\n error: \"profile_update_failed\",\n details: { flashErrors: profileState.flashErrors, httpStatus: resp?.status, responseData: resp?.data },\n });\n }\n profileState.loading = false;\n }\n }\n\n componentDidLoad() {\n profileOnChange(\"configuration\", (cfg) => {\n profileState.data = cfg as ProfileRaw;\n });\n\n authOnChange(\"token\", (newToken: string | null) => {\n const token = newToken ?? \"\";\n\n if (token) {\n this.fetchProfileData(token);\n }\n });\n }\n\n render() {\n const hasFieldErrors = Object.values(profileState.errors).some(Boolean);\n const errorMsg = Object.values(profileState.flashErrors).filter(Boolean).join(\", \");\n const wasSubmit = profileState.configUpdateSource === \"submit\";\n\n if (authStore.state.authenticated) {\n return this.fetchingProfileData ? (\n <div>{t(\"loading\")}</div>\n ) : (\n <Host>\n <slot />\n {!hasFieldErrors && errorMsg && <flash-message variant=\"error\" message={errorMsg} />}\n {wasSubmit && !errorMsg && !hasFieldErrors && <flash-message variant=\"success\" message={t(\"profile.updated\")} />}\n </Host>\n );\n }\n\n return <h2>{t(\"profile.signInToView\")}</h2>;\n }\n}\n","import { t } from \"../../../i18n\";\nimport type { SubmitButtonContext } from \"../../../shared/components/submit-button/context\";\nimport { authState } from \"../../store/auth-store\";\nimport { getParentSigninStep } from \"../helpers\";\n\nexport type AuthButtonFor = \"email\" | \"password\" | \"resetPassword\";\n\nexport const authContext: SubmitButtonContext<AuthButtonFor> = {\n handleClick: async (event: MouseEvent, el: HTMLElement, _forProp?: AuthButtonFor) => {\n event.preventDefault();\n await getParentSigninStep(el)?.submit();\n },\n\n isDisabled(forProp?: AuthButtonFor, disabled?: boolean): boolean {\n if (disabled || authState.loading) return true;\n\n if (authState.step === \"email\" && forProp === \"email\") {\n return authState.email === \"\";\n }\n\n if (authState.step === \"verification\" && forProp === \"password\") {\n return authState.password === \"\";\n }\n\n if (authState.step === \"reset-password\" && forProp === \"resetPassword\") {\n return !authState.resetPassword.newPassword || !authState.resetPassword.passwordConfirmation;\n }\n\n return false;\n },\n\n isLoading(): boolean {\n return authState.loading;\n },\n\n getButtonText(forProp?: AuthButtonFor, text?: string): string {\n if (text) return text;\n\n switch (authState.step) {\n case \"email\":\n return t(\"buttons.continue\");\n case \"verification\":\n if (forProp === \"password\") {\n return t(\"auth.password.button_text\", { defaultValue: \"Sign In with Password\" });\n }\n return t(\"buttons.submit\");\n case \"reset-password\":\n if (forProp === \"resetPassword\") {\n return t(\"auth.resetPassword.button_text_set\", { defaultValue: \"Set Password\" });\n }\n return t(\"buttons.submit\");\n default:\n return t(\"buttons.submit\");\n }\n },\n\n shouldRender(forProp?: AuthButtonFor): boolean {\n if (!authState.availableLoginOptions?.password && forProp === \"password\") {\n return false;\n }\n\n if (authState.step === \"email\") {\n return forProp === \"email\";\n }\n\n if (authState.step === \"verification\") {\n return forProp === \"password\" && authState.magicCodeStep !== \"sent\";\n }\n\n if (authState.step === \"reset-password\") {\n return forProp === \"resetPassword\";\n }\n\n return false;\n },\n};\n","import type { SubmitButtonContext } from \"../../../shared/components/submit-button/context\";\nimport { newsletterStore } from \"../../store/newsletter-store\";\nimport { getParentNewsletterRoot } from \"../helpers\";\n\nexport type NewsletterButtonFor = \"login\" | \"create\";\n\nexport const newsletterContext: SubmitButtonContext<NewsletterButtonFor> = {\n handleClick: async (event: MouseEvent, el: HTMLElement, forProp?: NewsletterButtonFor) => {\n event.preventDefault();\n return await getParentNewsletterRoot(el)?.submit(forProp);\n },\n\n isDisabled(forProp, disabled?: boolean): boolean {\n if (forProp === \"login\") {\n return disabled || !newsletterStore.state.email;\n }\n\n return disabled || !newsletterStore.state.email || Object.keys(newsletterStore.state.checkedNewsletters).length === 0;\n },\n\n isLoading(): boolean {\n return false;\n },\n};\n","import type { SubmitButtonContext } from \"../../../shared/components/submit-button/context\";\nimport { state as profileState } from \"../../store/profile-store\";\n\nfunction getParentProfile(el: HTMLElement) {\n return el.closest(\"u-profile\") as HTMLUProfileElement | null;\n}\n\nexport const profileContext: SubmitButtonContext = {\n async handleClick(event: MouseEvent, el: HTMLElement, _forProp?: string) {\n event.preventDefault();\n await getParentProfile(el)?.submitProfile();\n },\n\n isDisabled(_forProp, disabled?: boolean): boolean {\n return disabled || (profileState.errors && Object.keys(profileState.errors).length > 0) || profileState.phoneValid === false;\n },\n\n isLoading(): boolean {\n return profileState.loading;\n },\n};\n","export interface SubmitButtonContext<ForContext = string> {\n init?(): Promise<void>;\n handleClick(event: MouseEvent, el: HTMLElement, forProp?: ForContext): Promise<void>;\n isDisabled(forProp?: ForContext, disabled?: boolean): boolean;\n isLoading(): boolean;\n getButtonText?(forProp?: ForContext, text?: string): string;\n shouldRender?(forProp?: ForContext): boolean;\n}\n\nexport const defaultContext: SubmitButtonContext = {\n async handleClick() {},\n\n isDisabled(_forProp, disabled = false): boolean {\n return disabled || false;\n },\n\n isLoading(): boolean {\n return false;\n },\n};\n","","import { Component, Element, h, Prop } from \"@stencil/core\";\nimport { type AuthButtonFor, authContext } from \"../../../auth/components/submit-button/auth-submit-button\";\nimport { t } from \"../../../i18n\";\nimport { type NewsletterButtonFor, newsletterContext } from \"../../../newsletter/components/submit-button/newsletter-submit-button\";\nimport { profileContext } from \"../../../profile/components/submit-button/profile-submit-button\";\nimport { hasSlotContent } from \"../../component-utils\";\nimport { defaultContext, type SubmitButtonContext } from \"./context\";\n\n@Component({\n tag: \"u-submit-button\",\n styleUrl: \"submit-button.css\",\n shadow: false,\n})\nexport class SubmitButton {\n @Element() el!: HTMLElement;\n @Prop() for?: AuthButtonFor | NewsletterButtonFor;\n @Prop() text?: string;\n @Prop() disabled = false;\n @Prop({ attribute: \"class-name\" }) componentClassName = \"\";\n\n private context: \"auth\" | \"profile\" | \"newsletter\" = \"auth\";\n private contextModule: SubmitButtonContext = defaultContext;\n private hasSlot = false;\n\n async componentWillLoad() {\n this.hasSlot = hasSlotContent(this.el);\n this.context = this.detectContext();\n\n switch (this.context) {\n case \"auth\":\n this.contextModule = authContext;\n break;\n case \"profile\":\n this.contextModule = profileContext;\n break;\n case \"newsletter\":\n this.contextModule = newsletterContext;\n break;\n default:\n this.contextModule = defaultContext;\n }\n }\n\n private detectContext(): \"auth\" | \"profile\" | \"newsletter\" {\n if (this.el.closest(\"u-signin-root\") || this.el.closest(\"u-signin-step\")) return \"auth\";\n\n if (this.el.closest(\"u-profile\")) return \"profile\";\n\n if (this.el.closest(\"u-newsletter-root\")) return \"newsletter\";\n\n throw new Error(\n \"No context found for submit button. Make sure you are using the component within a u-signin-root, u-profile, or u-newsletter-root.\",\n );\n }\n\n private handleClick = async (event: MouseEvent) => {\n await this.contextModule.handleClick(event, this.el, this.for);\n };\n\n private isDisabled(): boolean {\n return this.contextModule.isDisabled(this.for, this.disabled);\n }\n\n private isLoading(): boolean {\n return this.contextModule.isLoading();\n }\n\n private getButtonText(): string {\n if (this.contextModule.getButtonText) {\n return this.contextModule.getButtonText(this.for, this.text);\n }\n if (this.text) {\n return this.text;\n }\n\n return t(\"buttons.submit\");\n }\n\n private getButtonContent() {\n const loading = this.isLoading();\n\n if (loading) {\n return <u-spinner />;\n }\n\n if (this.hasSlot) {\n return <slot />;\n }\n\n return this.getButtonText();\n }\n\n render() {\n if (this.contextModule.shouldRender && !this.contextModule.shouldRender(this.for)) {\n return null;\n }\n\n const buttonClasses = [\n this.componentClassName,\n this.context === \"auth\" ? \"u:flex u:justify-center\" : \"\",\n \"u:disabled:opacity-50 u:disabled:cursor-not-allowed\",\n ].join(\" \");\n\n const buttonProps: Record<string, unknown> = {\n type: \"submit\",\n part: `${this.context}-submit-button`,\n disabled: this.isDisabled() || this.isLoading(),\n class: buttonClasses,\n onClick: this.handleClick,\n \"aria-live\": \"polite\",\n };\n\n return <button {...buttonProps}>{this.getButtonContent()}</button>;\n }\n}\n"],"names":["unidyOnChange","profileState","Sentry.captureException","profileOnChange","authOnChange","authState"],"mappings":";;;;;;;;;;;;;;;MAea,OAAO,GAAA,MAAA;AACV,IAAA,SAAS;IACT,WAAW,GAAoC,EAAE;AAEhD,IAAA,eAAe;AACf,IAAA,aAAa;IAUb,mBAAmB,GAAG,KAAK;AAEpC,IAAA,WAAA,CAAA,OAAA,EAAA;;;;AACE,QAAAA,QAAa,CAAC,QAAQ,EAAE,OAAO,OAAO,KAAI;AACxC,YAAA,IAAI,SAAS,CAAC,KAAK,CAAC,aAAa;AAAE,gBAAA,MAAM,IAAI,CAAC,uBAAuB,EAAE;AACzE,SAAC,CAAC;AACH;AAED,IAAA,MAAM,iBAAiB,GAAA;AACrB,QAAA,IAAI,IAAI,CAAC,WAAW,KAAK,EAAE,EAAE;YAC3BC,KAAY,CAAC,IAAI,GAAG,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,WAAW;;AACrG,aAAA,IAAI,SAAS,CAAC,KAAK,CAAC,aAAa,EAAE;AACxC,YAAA,MAAM,IAAI,CAAC,uBAAuB,EAAE;;AAGtC,QAAAA,KAAY,CAAC,OAAO,GAAG,KAAK;;AAG9B,IAAA,MAAM,uBAAuB,GAAA;AAC3B,QAAA,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE;AAE7C,QAAA,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,QAAQ,EAAE;AAE7C,QAAA,IAAI,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;A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B;AAC3C,YAAA,IAAI,EAAE,QAAQ;AACd,YAAA,IAAI,EAAE,CAAA,EAAG,IAAI,CAAC,OAAO,CAAgB,cAAA,CAAA;YACrC,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,IAAI,CAAC,SAAS,EAAE;AAC/C,YAAA,KAAK,EAAE,aAAa;YACpB,OAAO,EAAE,IAAI,CAAC,WAAW;AACzB,YAAA,WAAW,EAAE,QAAQ;SACtB;AAED,QAAA,OAAO,CAAA,CAAA,QAAA,EAAA,EAAA,GAAY,WAAW,EAAG,EAAA,IAAI,CAAC,gBAAgB,EAAE,CAAU;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"u-signin-root.entry.esm.js","sources":["src/auth/components/signin-root/signin-root.tsx"],"sourcesContent":["import { Component,
|
|
1
|
+
{"version":3,"file":"u-signin-root.entry.esm.js","sources":["src/auth/components/signin-root/signin-root.tsx"],"sourcesContent":["import { Component, Element, Event, type EventEmitter, Host, h, Prop } from \"@stencil/core\";\nimport type { TokenResponse } from \"../../api/auth\";\nimport { authStore } from \"../../store/auth-store\";\n\n@Component({\n tag: \"u-signin-root\",\n shadow: true,\n})\nexport class SigninRoot {\n @Element() el!: HTMLElement;\n\n @Prop({ attribute: \"class-name\" }) componentClassName = \"\";\n\n @Event() authEvent!: EventEmitter<TokenResponse>;\n @Event() errorEvent!: EventEmitter<{ error: string }>;\n\n componentDidLoad() {\n authStore.setRootComponentRef(this);\n const signInSteps = this.el.querySelectorAll(\"u-signin-step\").values();\n if ([...signInSteps].some((step: HTMLUSigninStepElement) => step.name === \"single-login\")) {\n authStore.setInitialStep(\"single-login\");\n } else {\n authStore.setInitialStep(\"email\");\n }\n }\n\n onAuth(response: TokenResponse) {\n this.authEvent.emit(response);\n }\n\n onError(error: string) {\n this.errorEvent.emit({ error: error });\n }\n\n render() {\n if (authStore.state.authenticated) {\n return null;\n }\n\n return (\n <Host class={this.componentClassName}>\n <slot />\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;;;;MAQa,UAAU,GAAA,MAAA;;;;;;;IAGc,kBAAkB,GAAG,EAAE;AAEjD,IAAA,SAAS;AACT,IAAA,UAAU;IAEnB,gBAAgB,GAAA;AACd,QAAA,SAAS,CAAC,mBAAmB,CAAC,IAAI,CAAC;AACnC,QAAA,MAAM,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,MAAM,EAAE;AACtE,QAAA,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,IAA4B,KAAK,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,EAAE;AACzF,YAAA,SAAS,CAAC,cAAc,CAAC,cAAc,CAAC;;aACnC;AACL,YAAA,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC;;;AAIrC,IAAA,MAAM,CAAC,QAAuB,EAAA;AAC5B,QAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC;;AAG/B,IAAA,OAAO,CAAC,KAAa,EAAA;QACnB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;;IAGxC,MAAM,GAAA;AACJ,QAAA,IAAI,SAAS,CAAC,KAAK,CAAC,aAAa,EAAE;AACjC,YAAA,OAAO,IAAI;;QAGb,QACE,EAAC,IAAI,EAAA,EAAC,KAAK,EAAE,IAAI,CAAC,kBAAkB,EAAA,EAClC,CAAQ,CAAA,MAAA,EAAA,IAAA,CAAA,CACH;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"u-spinner.entry.esm.js","sources":["src/shared/components/spinner/spinner.css?tag=u-spinner&encapsulation=shadow","src/shared/components/spinner/spinner.tsx"],"sourcesContent":[":host {\n font-size: var(--spinner-font-size, 20px);\n}\n\n.spinner-inner {\n border: 0.1em solid var(--spinner-color-secondary, #ccc);\n border-top: 0.1em solid var(--spinner-color-primary, #333);\n}\n","import { Component, h, Host } from \"@stencil/core\";\n\n@Component({\n tag: \"u-spinner\",\n styleUrl: \"spinner.css\",\n shadow: true,\n})\nexport class Spinner {\n render() {\n return (\n <Host class=\"u:inline-flex u:items-center u:justify-center\">\n {/* biome-ignore lint/a11y/useSemanticElements: spinner is a visual element, output tag not appropriate */}\n <div class=\"spinner-inner u:w-[1em] u:h-[1em] u:rounded-[50%] u:animate-spin\" part=\"spinner\" role=\"status\" aria-label=\"Loading\" />\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;AAAA,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"u-spinner.entry.esm.js","sources":["src/shared/components/spinner/spinner.css?tag=u-spinner&encapsulation=shadow","src/shared/components/spinner/spinner.tsx"],"sourcesContent":[":host {\n font-size: var(--spinner-font-size, 20px);\n}\n\n.spinner-inner {\n border: 0.1em solid var(--spinner-color-secondary, #ccc);\n border-top: 0.1em solid var(--spinner-color-primary, #333);\n}\n","import { Component, h, Host } from \"@stencil/core\";\n\n@Component({\n tag: \"u-spinner\",\n styleUrl: \"spinner.css\",\n shadow: true,\n})\nexport class Spinner {\n render() {\n return (\n <Host class=\"u:inline-flex u:items-center u:justify-center\">\n {/* biome-ignore lint/a11y/useSemanticElements: spinner is a visual element, output tag not appropriate */}\n <div class=\"spinner-inner u:w-[1em] u:h-[1em] u:rounded-[50%] u:animate-spin\" part=\"spinner\" role=\"status\" aria-label=\"Loading\" />\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;AAAA,MAAM,UAAU,GAAG,2+RAA2+R;;MCOj/R,OAAO,GAAA,MAAA;;;;IAClB,MAAM,GAAA;AACJ,QAAA,QACE,CAAC,CAAA,IAAI,EAAC,EAAA,GAAA,EAAA,0CAAA,EAAA,KAAK,EAAC,+CAA+C,EAAA,EAEzD,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,KAAK,EAAC,kEAAkE,EAAC,IAAI,EAAC,SAAS,EAAC,IAAI,EAAC,QAAQ,EAAY,YAAA,EAAA,SAAS,EAAG,CAAA,CAC7H;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as t,c as e,d as i,h as o,H as s,g as n}from"./p-Ci3aTmzp.js";import{g as a}from"./p-DdUvQelg.js";import{a as r,b as l,s as u}from"./p-C3fhudPT.js";import{A as d}from"./p-BlAULXyw.js";import{t as f}from"./p-CbRhHGU5.js";import{o as p,u as c}from"./p-BlOjABPD.js";import{v as h,b as m}from"./p-DA84OuuU.js";import{s as w,a as g}from"./p-C0feI0p8.js";import{g as b}from"./p-DUHc_Cx7.js";import{n as y}from"./p-CPPYdoIv.js";import{g as v}from"./p-BqFCd65h.js";import{h as x}from"./p-D1lzXl_Z.js";import"./p-BZ1kW_eK.js";import"./p-DYtgart8.js";const k=class{profileId;initialData="";uProfileSuccess;uProfileError;fetchingProfileData=false;constructor(i){t(this,i);this.uProfileSuccess=e(this,"uProfileSuccess");this.uProfileError=e(this,"uProfileError");p("locale",(async t=>{if(r.state.authenticated)await this.getTokenAndFetchProfile()}))}async componentWillLoad(){if(this.initialData!==""){w.data=typeof this.initialData==="string"?JSON.parse(this.initialData):this.initialData}else if(r.state.authenticated){await this.getTokenAndFetchProfile()}w.loading=false}async getTokenAndFetchProfile(){const t=await d.getInstance();const e=await t.getToken();if(e&&typeof e==="string"){await this.fetchProfileData(e)}}async fetchProfileData(t){if(this.fetchingProfileData)return;this.fetchingProfileData=true;try{const e=await a().profile.fetchProfile({idToken:t,lang:c.locale});if(e.success){w.configuration=JSON.parse(JSON.stringify(e.data));w.configUpdateSource="fetch";w.errors={};w.flashErrors={};w.data=JSON.parse(JSON.stringify(e.data))}else{w.flashErrors={[String(e?.status)]:String(e?.error)}}}catch(t){i("Failed to fetch profile data:",t);w.flashErrors={error:f("errors.failed_to_load_profile")}}this.fetchingProfileData=false}async submitProfile(){const t=await d.getInstance();w.loading=true;const{configuration:e,...i}=w;if(!h(i.data)){w.loading=false;return}const o=m(i.data);const s=await a().profile.updateProfile({idToken:await t.getToken(),data:o,lang:c.locale});if(s?.success){w.loading=false;w.configuration=JSON.parse(JSON.stringify(s.data));w.configUpdateSource="submit";w.errors={};this.uProfileSuccess.emit({message:"profile_updated_successfully",payload:s.data})}else{if(s?.data&&"flatErrors"in s.data){w.errors=s.data.flatErrors;this.uProfileError.emit({error:"profile_update_field_errors",details:{fieldErrors:w.errors,httpStatus:s?.status,responseData:s?.data}})}else{w.flashErrors={[String(s?.status)]:String(s?.error)};this.uProfileError.emit({error:"profile_update_failed",details:{flashErrors:w.flashErrors,httpStatus:s?.status,responseData:s?.data}})}w.loading=false}}componentDidLoad(){g("configuration",(t=>{w.data=t}));l("token",(t=>{const e=t??"";if(e){this.fetchProfileData(e)}}))}render(){const t=Object.values(w.errors).some(Boolean);const e=Object.values(w.flashErrors).filter(Boolean).join(", ");const i=w.configUpdateSource==="submit";if(r.state.authenticated){return this.fetchingProfileData?o("div",null,f("loading")):o(s,null,o("slot",null),!t&&e&&o("flash-message",{variant:"error",message:e}),i&&!e&&!t&&o("flash-message",{variant:"success",message:f("profile.updated")}))}return o("h2",null,f("profile.signInToView"))}};const j={handleClick:async(t,e,i)=>{t.preventDefault();await(b(e)?.submit())},isDisabled(t,e){if(e||u.loading)return true;if(u.step==="email"&&t==="email"){return u.email===""}if(u.step==="verification"&&t==="password"){return u.password===""}if(u.step==="reset-password"&&t==="resetPassword"){return!u.resetPassword.newPassword||!u.resetPassword.passwordConfirmation}return false},isLoading(){return u.loading},getButtonText(t,e){if(e)return e;switch(u.step){case"email":return f("buttons.continue");case"verification":if(t==="password"){return f("auth.password.button_text",{defaultValue:"Sign In with Password"})}return f("buttons.submit");case"reset-password":if(t==="resetPassword"){return f("auth.resetPassword.button_text_set",{defaultValue:"Set Password"})}return f("buttons.submit");default:return f("buttons.submit")}},shouldRender(t){if(!u.availableLoginOptions?.password&&t==="password"){return false}if(u.step==="email"){return t==="email"}if(u.step==="verification"){return t==="password"&&u.magicCodeStep!=="sent"}if(u.step==="reset-password"){return t==="resetPassword"}return false}};const C={handleClick:async(t,e,i)=>{t.preventDefault();return await(v(e)?.submit(i))},isDisabled(t,e){if(t==="login"){return e||!y.state.email}return e||!y.state.email||Object.keys(y.state.checkedNewsletters).length===0},isLoading(){return false}};function S(t){return t.closest("u-profile")}const M={async handleClick(t,e,i){t.preventDefault();await(S(e)?.submitProfile())},isDisabled(t,e){return e||w.errors&&Object.keys(w.errors).length>0||w.phoneValid===false},isLoading(){return w.loading}};const I={async handleClick(){},isDisabled(t,e=false){return e||false},isLoading(){return false}};const L='/*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer theme{:host,:root{--u-animate-spin:spin 1s linear infinite;--u-font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--u-font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--u-default-font-family:var(--u-font-sans);--u-default-mono-font-family:var(--u-font-mono);--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,::backdrop,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}::file-selector-button{appearance:button;background-color:#0000;border:0 solid;border-radius:0;box-sizing:border-box;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;margin:0;margin-inline-end:4px;opacity:1;padding:0}:host,html{font-family:var(--u-default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--u-default-font-feature-settings,normal);font-variation-settings:var(--u-default-font-variation-settings,normal);-webkit-text-size-adjust:100%;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);tab-size:4;-webkit-tap-highlight-color:transparent;line-height:1.5}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--u-default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--u-default-mono-font-feature-settings,normal);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--u-default-mono-font-variation-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}button,input,optgroup,select,textarea{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:currentColor;color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex;padding-block:0}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.u\\:flex{display:flex}.u\\:justify-center{justify-content:center}.u\\:disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.u\\:disabled\\:opacity-50:disabled{opacity:.5}.u\\:inline-flex{display:inline-flex}.u\\:h-\\[1em\\]{height:1em}.u\\:w-\\[1em\\]{width:1em}.u\\:animate-spin{animation:var(--u-animate-spin)}.u\\:items-center{align-items:center}.u\\:rounded-\\[50\\%\\]{border-radius:50%}} /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components;@layer utilities{}@keyframes spin{to{transform:rotate(1turn)}} /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components;@layer utilities{.u\\:justify-end{justify-content:flex-end}} /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-ring-offset-width:0px;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer base{}@layer components;@layer utilities{.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}';const _=class{constructor(e){t(this,e)}get el(){return n(this)}for;text;disabled=false;componentClassName="";context="auth";contextModule=I;hasSlot=false;async componentWillLoad(){this.hasSlot=x(this.el);this.context=this.detectContext();switch(this.context){case"auth":this.contextModule=j;break;case"profile":this.contextModule=M;break;case"newsletter":this.contextModule=C;break;default:this.contextModule=I}}detectContext(){if(this.el.closest("u-signin-root")||this.el.closest("u-signin-step"))return"auth";if(this.el.closest("u-profile"))return"profile";if(this.el.closest("u-newsletter-root"))return"newsletter";throw new Error("No context found for submit button. Make sure you are using the component within a u-signin-root, u-profile, or u-newsletter-root.")}handleClick=async t=>{await this.contextModule.handleClick(t,this.el,this.for)};isDisabled(){return this.contextModule.isDisabled(this.for,this.disabled)}isLoading(){return this.contextModule.isLoading()}getButtonText(){if(this.contextModule.getButtonText){return this.contextModule.getButtonText(this.for,this.text)}if(this.text){return this.text}return f("buttons.submit")}getButtonContent(){const t=this.isLoading();if(t){return o("u-spinner",null)}if(this.hasSlot){return o("slot",null)}return this.getButtonText()}render(){if(this.contextModule.shouldRender&&!this.contextModule.shouldRender(this.for)){return null}const t=[this.componentClassName,this.context==="auth"?"u:flex u:justify-center":"","u:disabled:opacity-50 u:disabled:cursor-not-allowed"].join(" ");const e={type:"submit",part:`${this.context}-submit-button`,disabled:this.isDisabled()||this.isLoading(),class:t,onClick:this.handleClick,"aria-live":"polite"};return o("button",{...e},this.getButtonContent())}};_.style=L;export{k as u_profile,_ as u_submit_button};
|
|
2
|
-
//# sourceMappingURL=p-7a0cefff.entry.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as t,h as s}from"./p-Ci3aTmzp.js";import{t as e}from"./p-CbRhHGU5.js";import{A as r}from"./p-BlAULXyw.js";import{s as a}from"./p-C3fhudPT.js";import{F as o}from"./p-DYtgart8.js";import"./p-BlOjABPD.js";import"./p-BZ1kW_eK.js";import"./p-DdUvQelg.js";import"./p-C0feI0p8.js";import"./p-D1lzXl_Z.js";const i=class{constructor(s){t(this,s)}componentClassName="";handleClick=async()=>{const t=await r.getInstance();await t.helpers.sendResetPasswordEmail();if(a.resetPassword.step==="sent"){const t=e("auth.resetPassword.success_message",{defaultValue:"Password reset email sent. Please check your inbox."});o.success.addMessage(t)}};getButtonText(){if(a.step==="verification"&&a.availableLoginOptions&&!a.availableLoginOptions.password){return e("auth.resetPassword.button_text_set",{defaultValue:"Set Password"})}if(a.step==="reset-password"){return e("auth.resetPassword.button_text_resend",{defaultValue:"Resend Password Reset Email"})}return e("auth.resetPassword.button_text_reset",{defaultValue:"Reset Password"})}render(){if(!["verification","reset-password"].includes(a.step)){return null}return s("button",{type:"button",onClick:this.handleClick,class:this.componentClassName},this.getButtonText())}};export{i as u_reset_password_button};
|
|
2
|
-
//# sourceMappingURL=p-a6393d19.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["registerInstance","h","t","Auth","state","Flash","ResetPasswordButton","constructor","hostRef","this","componentClassName","handleClick","async","authInstance","getInstance","helpers","sendResetPasswordEmail","resetPassword","step","successMessage","defaultValue","success","addMessage","getButtonText","availableLoginOptions","password","render","includes","type","onClick","class"],"sources":["0"],"mappings":"YAAcA,OAAkBC,MAAS,8BAChCC,MAAS,8BACJC,MAAY,8BACZC,MAAa,8BACbC,MAAa,wBACpB,wBACA,wBACA,wBACA,wBACA,kBAEP,MAAMC,EAAsB,MACxB,WAAAC,CAAYC,GACRR,EAAiBS,KAAMD,EAC3B,CACAE,mBAAqB,GACrBC,YAAcC,UACV,MAAMC,QAAqBV,EAAKW,oBAC1BD,EAAaE,QAAQC,yBAC3B,GAAIZ,EAAMa,cAAcC,OAAS,OAAQ,CACrC,MAAMC,EAAiBjB,EAAE,qCAAsC,CAC3DkB,aAAc,wDAElBf,EAAMgB,QAAQC,WAAWH,EAC7B,GAEJ,aAAAI,GACI,GAAInB,EAAMc,OAAS,gBAAkBd,EAAMoB,wBAA0BpB,EAAMoB,sBAAsBC,SAAU,CACvG,OAAOvB,EAAE,qCAAsC,CAAEkB,aAAc,gBACnE,CACA,GAAIhB,EAAMc,OAAS,iBAAkB,CACjC,OAAOhB,EAAE,wCAAyC,CAAEkB,aAAc,+BACtE,CACA,OAAOlB,EAAE,uCAAwC,CAAEkB,aAAc,kBACrE,CACA,MAAAM,GACI,IAAK,CAAC,eAAgB,kBAAkBC,SAASvB,EAAMc,MAAO,CAC1D,OAAO,IACX,CACA,OAAQjB,EAAE,SAAU,CAAE2B,KAAM,SAAUC,QAASpB,KAAKE,YAAamB,MAAOrB,KAAKC,oBAAsBD,KAAKc,gBAC5G,UAGKjB","ignoreList":[]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as t,g as e,h as i,U as s}from"./p-Ci3aTmzp.js";import{t as o}from"./p-CbRhHGU5.js";import{s as n}from"./p-C0feI0p8.js";import"./p-BlOjABPD.js";import"./p-BZ1kW_eK.js";const a='/*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer theme{:host,:root{--u-font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--u-font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--u-default-font-family:var(--u-font-sans);--u-default-mono-font-family:var(--u-font-mono);--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,::backdrop,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}::file-selector-button{appearance:button;background-color:#0000;border:0 solid;border-radius:0;box-sizing:border-box;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;margin:0;margin-inline-end:4px;opacity:1;padding:0}:host,html{font-family:var(--u-default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--u-default-font-feature-settings,normal);font-variation-settings:var(--u-default-font-variation-settings,normal);-webkit-text-size-adjust:100%;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);tab-size:4;-webkit-tap-highlight-color:transparent;line-height:1.5}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--u-default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--u-default-mono-font-feature-settings,normal);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--u-default-mono-font-variation-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}button,input,optgroup,select,textarea{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:currentColor;color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex;padding-block:0}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.u\\:flex{display:flex}.u\\:justify-end{justify-content:flex-end}} /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-ring-offset-width:0px;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer base{}@layer components;@layer utilities{.block{display:block}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}:host{display:block}.field-error:focus{border-color:red;outline-color:red}.multi-select-readonly-container{list-style:none}.multi-select-readonly-container li{display:inline-block}[part=input]:disabled,[part=select]:disabled{cursor:not-allowed}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}';const r=class{constructor(e){t(this,e)}field;required=false;readonlyPlaceholder="No information";countryCodeDisplayOption="label";invalidPhoneMessage="Please enter a valid phone number.";componentClassName;emptyOption=true;placeholder;renderDefaultLabel=true;pattern;patternErrorMessage;validationFunc;get el(){return e(this)}selected;getFieldData(){return this.field.startsWith("custom_attributes.")?n.data.custom_attributes?.[this.field.replace("custom_attributes.","")]:n.data[this.field]}componentWillLoad(){}componentDidRender(){const t=n.errors;if(Object.keys(t)[0]===this.field){this.el.shadowRoot?.getElementById(this.field)?.scrollIntoView({behavior:"smooth",block:"center"});this.el.shadowRoot?.getElementById(this.field)?.querySelector("input, select, textarea")?.focus()}}createSpecificPartKey(t){if(t.startsWith("custom_attributes.")){return t.replace(/[^\w-]/g,"-")}return t}multiSelectLabel=t=>{const e=[];if(Array.isArray(t.value)){for(const i of t.value){const s=t.options?.find((t=>t.value===i));const n=`fields.${this.field}.options.${i}`;const a=o(n);const r=a!==n?a:s?.label;e.push(r??i)}}return e};render(){if(n.loading){return i("u-spinner",null)}const t=this.getFieldData();if(!t){return null}const e=`fields.${this.field}.label`;const s=o(e,{defaultValue:t?.label});const a=`fields.${this.field}.placeholder`;const r=o(a,{defaultValue:this.placeholder?this.placeholder:""});const l=`fields.${this.field}.readonlyPlaceholder`;const d=o(l,{defaultValue:this.readonlyPlaceholder?this.readonlyPlaceholder:""});const c=(t.options||[]).map((t=>{const e=`fields.${this.field}.options.${t.value}`;const i=o(e,{defaultValue:t.label});return{...t,label:i}}));const h=(t.radio_options||[]).map((t=>{const e=`fields.${this.field}.options.${t.value}`;const i=o(e,{defaultValue:t.label});return{...t,label:i}}));const u=o("errors.prefix",{defaultValue:"ERROR: "});const p=!!t?.locked;const f=t?.locked_text?t.locked_text:"";const m=t?.readonly===true;const b=this.multiSelectLabel(t);return i("div",{part:`field-container field-container--${this.createSpecificPartKey(this.field)}`},i("slot",{name:"label"}),this.renderDefaultLabel&&i("label",{htmlFor:this.field,part:`field_label field_label--${this.createSpecificPartKey(this.field)}`},s,t?.required||this.required?i("span",{part:"required-indicator"}," *"):null),m&&t?.type!=="checkbox"?i("span",{id:this.field,part:"readonly-indicator"},t?.value||d):null,m&&t?.type==="checkbox"&&i("ul",{id:this.field,class:"multi-select-readonly-container",part:"multi-select-readonly-container"},b.map((t=>i("li",{key:t,part:"multi-select-readonly-field"},t)))),!m&&i("u-raw-field",{id:this.field,field:this.field,type:t.type,value:t.value,options:t.type==="select"?c:undefined,radioOptions:t.type==="radio"?h:undefined,multiSelectOptions:t.type==="checkbox"?c:undefined,required:t.required||this.required,disabled:p,tooltip:p?f:undefined,placeholder:r,componentClassName:this.componentClassName,emptyOption:this.emptyOption,countryCodeDisplayOption:this.countryCodeDisplayOption,attrName:t.attr_name,specificPartKey:this.createSpecificPartKey(this.field),ariaDescribedBy:n.errors[this.field]?`${this.field}-error`:undefined,pattern:this.pattern,patternErrorMessage:this.patternErrorMessage,validationFunc:this.validationFunc}),n.errors[this.field]&&i("span",{id:`${this.field}-error`,part:"field-error-message","aria-live":"assertive"},u," ",n.errors[this.field]))}};r.style=a;const l=t=>{if(!("options"in t)){return i("input",{type:t.type,name:t.name,required:t.required,value:String(t.value),checked:t.checked,disabled:t.disabled,title:t.title,class:t.componentClassName,onChange:()=>t.onChange(String(t.value)),"aria-describedby":t.ariaDescribedBy||undefined})}return i("div",{part:`radio-group_field ${t.specificPartKey?`radio-group_field--${t.specificPartKey}`:""}`,title:t.title,"aria-describedby":t.ariaDescribedBy||undefined},t.options.map((e=>i("label",{htmlFor:`${t.name}-${e.value}`,key:String(e.value),part:`radio-group-item_label ${t.specificPartKey?`radio-group-item_label--${t.specificPartKey}`:""} ${e.checked?"radio_checked":""}`,"data-checked":e.checked?"true":"false"},i("input",{id:`${t.name}-${e.value}`,type:t.type,name:t.name,required:t.required,value:String(e.value),checked:e.checked,disabled:t.disabled,onChange:()=>t.onChange(String(e.value)),part:`radio-group-item_radio ${t.specificPartKey?`radio-group-item_radio--${t.specificPartKey}`:""}`}),e.label))))};const d=t=>i("textarea",{id:t.id,value:t.value,name:t.name,class:t.componentClassName,required:t.required,part:`textarea_field ${t.specificPartKey?`textarea_field--${t.specificPartKey}`:""}`,disabled:t.disabled,title:t.title,onChange:e=>t.onChange(e.target.value),onBlur:t.onBlur,"aria-describedby":t.ariaDescribedBy||undefined});const c=t=>i("input",{id:t.id,type:t.type,value:t.value,class:t.componentClassName,disabled:t.disabled,required:t.required,part:`input_field ${t.specificPartKey?`input_field--${t.specificPartKey}`:""}`,title:t.title,placeholder:t.placeholder,onChange:e=>t.onChange(e.target.value),onBlur:e=>t.onBlur?.(e),"aria-describedby":t.ariaDescribedBy||undefined});const h=t=>{const e=e=>{if(t.attr_name==="country_code"&&t.countryCodeDisplayOption==="icon"&&t.countryIcon){return t.countryIcon(e.value)}return e.label};return i("select",{id:t.id,name:t.name,class:t.componentClassName,"data-value":t.value,part:`select_field ${t.specificPartKey?`select_field--${t.specificPartKey}`:""}`,disabled:t.disabled,title:t.title,onChange:e=>t.onChange(e.target.value),"aria-describedby":t.ariaDescribedBy||undefined},t.emptyOption?i("option",{value:"",selected:t.value===null||t.value===""}):null,t.options.map((s=>i("option",{key:s.value,value:s.value,"data-selected":s.value===t.value?"true":"false",selected:s.value===t.value,disabled:s.value==="--"},e(s)))))};const u=t=>{if(!("options"in t)){return i("input",{id:t.id,type:t.type,name:t.name,value:t.value,checked:t.checked,disabled:t.disabled,title:t.title,class:t.componentClassName,onChange:e=>t.onToggle(t.value,e.target.checked),"aria-describedby":t.ariaDescribedBy||undefined})}return i("div",{part:`multi-select-group_field ${t.specificPartKey?`multi-select-group_field--${t.specificPartKey}`:""}`,title:t.title,"aria-describedby":t.ariaDescribedBy||undefined},t.options.map((e=>i("label",{key:e.value,htmlFor:`${t.specificPartKey}-${e.value}`,part:`multi-select-item_label ${t.specificPartKey?`multi-select-item_label--${t.specificPartKey}`:""}`},i("input",{id:`${t.specificPartKey}-${e.value}`,type:t.type,checked:Array.isArray(t.value)&&t.value.includes(e.value),disabled:t.disabled,title:t.title,onChange:i=>t.onToggle(e.value,i.target.checked),part:`multi-select-item_checkbox ${t.specificPartKey?`multi-select-item_checkbox--${t.specificPartKey}`:""}`}),e.label))))};const p=class extends s{constructor(e){super();t(this,e)}required=false;readonlyPlaceholder="";countryCodeDisplayOption="label";invalidPhoneMessage="Please enter a valid phone number.";componentClassName;field;value;checked;disabled;tooltip;type;placeholder;options;emptyOption=false;attrName;radioOptions;multiSelectOptions;specificPartKey;ariaDescribedBy="";pattern;patternErrorMessage;validationFunc;get el(){return e(this)}selected;readStore(t){if(!t)return;const e=n.data;if(!e)return;let i;if(t.startsWith("custom_attributes.")){const s=t.replace("custom_attributes.","");i=e.custom_attributes?.[s]}else{i=e[t]}if(!i)return;if(i.radio_options){const t=i.radio_options.find((t=>t.checked));const e=t?.value??i.value??"";return String(e)}if(i.type==="checkbox"){return Array.isArray(i.value)?i.value:[]}return i.value}writeStore(t,e){if(!t)return;const i=n.data;if(!i)return;const s=t.startsWith("custom_attributes.");const o=s?t.replace("custom_attributes.",""):t;if(s){const t=i.custom_attributes?.[o];n.data={...i,custom_attributes:{...i.custom_attributes,[o]:{...t,value:e}}}}else{const t=i[o];n.data={...i,[o]:{...t,value:e}}}}runExternalValidator(t){if(this.validationFunc){try{return this.validationFunc(t)}catch(t){this.logger.error("External validator (validationFunc) threw an error:",t);return null}}}validateValue(t){if(this.required){const e=t===undefined||t===null||t==="";if(e){return{valid:false,message:"This field is required."}}}if(this.pattern&&typeof t==="string"){const e=new RegExp(this.pattern);if(!e.test(t)){return{valid:false,message:this.patternErrorMessage||"Invalid format."}}}const e=this.runExternalValidator(t);if(e&&!e.valid){return{valid:false,message:e.message||"Invalid input."}}if(this.type==="tel"){const e=/^(?=.{4,13}$)(\+\d+|\d+)$/;if(typeof t==="string"&&t!==""&&!e.test(t)){return{valid:false,message:this.invalidPhoneMessage}}}return{valid:true,message:""}}getNormalizedOptions(){if(Array.isArray(this.options))return this.options;if(typeof this.options==="string")return JSON.parse(this.options);return[]}countryIcon(t,e="➖"){if(!/^[A-Z]{2}$/.test(t)){return e}return Array.from(t).map((t=>String.fromCodePoint(127462+(t.charCodeAt(0)-"A".charCodeAt(0))))).join("")}onMultiToggle=(t,e)=>{const i=Array.isArray(this.selected)?this.selected:[];let s;if(e){s=i.includes(t)?i:[...i,t]}else{s=i.filter((e=>e!==t))}this.selected=s;this.writeStore(this.field,s)};onBlurFieldValidation=t=>{const e=t.target;const i=e.value;const s=this.validateValue(i);const o={...n.errors};if(s.valid){delete o[this.field]}else{o[this.field]=s.message}n.errors=o};onChangeFieldValidation=t=>{this.selected=t;const e=this.validateValue(t);const i={...n.errors};if(e.valid){delete i[this.field];this.writeStore(this.field,t)}else{i[this.field]=e.message}n.errors=i};componentWillLoad(){if(!this.field)throw new Error('u-raw-field: "field" is required.');if(!this.type)throw new Error('u-raw-field: "type" is required.');const t=new Set(["text","email","tel","password","number","date","radio","textarea","select","checkbox"]);if(!t.has(this.type)){this.type="text"}const e=this.readStore(this.field);const i=this.type==="text"||this.type==="email"||this.type==="tel"||this.type==="password"||this.type==="number"||this.type==="date"||this.type==="textarea"||this.type==="select";if(i&&(e===undefined||e===null)&&typeof this.value==="string"){this.writeStore(this.field,this.value)}this.selected=e}componentDidRender(){const t=n.errors;if(t?.[this.field]){this.el.querySelector(`#${CSS.escape(this.field)}`)?.focus()}}render(){if(this.type==="radio"){if(Array.isArray(this.radioOptions)&&this.radioOptions.length){const t=this.radioOptions.map((t=>({...t,checked:String(t.value)===this.selected})));return i(l,{name:this.field,disabled:this.disabled,title:this.tooltip,type:"radio",onChange:this.onChangeFieldValidation,options:t,specificPartKey:this.specificPartKey,"aria-describedby":this.ariaDescribedBy,required:this.required})}if(typeof this.value==="string"){const t=this.readStore(this.field);const e=t!=null&&String(t)===this.value;return i(l,{name:this.field,value:this.value,checked:e,disabled:this.disabled,title:this.tooltip,componentClassName:this.componentClassName,type:"radio",specificPartKey:this.specificPartKey,onChange:this.onChangeFieldValidation,"aria-describedby":this.ariaDescribedBy,required:this.required})}}if(this.type==="checkbox"){if(Array.isArray(this.multiSelectOptions)&&this.multiSelectOptions.length){const t=Array.isArray(this.selected)?this.selected:[];return i(u,{value:t,options:this.multiSelectOptions,disabled:this.disabled,title:this.tooltip,type:"checkbox",specificPartKey:this.specificPartKey,onToggle:this.onMultiToggle,"aria-describedby":this.ariaDescribedBy})}if(this.value){const t=this.readStore(this.field)??[];const e=t?.includes(this.value);return i(u,{id:`${this.field}-${this.value}`,name:this.field,value:this.value,checked:e,disabled:this.disabled,title:this.tooltip,componentClassName:this.componentClassName,type:"checkbox",onToggle:(t,e)=>{const i=this.readStore(this.field);const s=e?[...i,t]:i.filter((e=>e!==t));this.writeStore(this.field,s)},"aria-describedby":this.ariaDescribedBy})}}if(this.type==="select"){const t=this.readStore(this.field)??"";const e=this.getNormalizedOptions();return i(h,{id:this.field,name:this.field,value:t,options:e,disabled:this.disabled,title:this.tooltip,emptyOption:this.emptyOption,onChange:this.onChangeFieldValidation,componentClassName:this.componentClassName,countryCodeDisplayOption:this.countryCodeDisplayOption,countryIcon:this.countryIcon,attr_name:this.attrName,specificPartKey:this.specificPartKey,"aria-describedby":this.ariaDescribedBy})}if(this.type==="textarea"){const t=this.readStore(this.field)||"";return i(d,{id:this.field,value:t,required:this.required,disabled:this.disabled,title:this.tooltip,componentClassName:this.componentClassName,specificPartKey:this.specificPartKey,onChange:this.onChangeFieldValidation,onBlur:this.onBlurFieldValidation,"aria-describedby":this.ariaDescribedBy})}const t=this.readStore(this.field)||"";return i(c,{id:this.field,value:t,required:this.required,disabled:this.disabled,title:this.tooltip,type:this.type,componentClassName:this.componentClassName,placeholder:this.placeholder,specificPartKey:this.specificPartKey,onChange:this.onChangeFieldValidation,onBlur:this.onBlurFieldValidation,"aria-describedby":this.ariaDescribedBy})}};export{r as u_field,p as u_raw_field};
|
|
2
|
-
//# sourceMappingURL=p-effaf86b.entry.js.map
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, f as getElement, h } from './index-C5jZjlU8.js';
|
|
2
|
-
import { t } from './i18n-CZii1E-s.js';
|
|
3
|
-
import { s as state, a as authStore } from './auth-store-DQaam_Qh.js';
|
|
4
|
-
import { g as getParentSigninStep } from './helpers-DUHc_Cx7.js';
|
|
5
|
-
import './unidy-store-CtifvCkV.js';
|
|
6
|
-
import './index-O6h7SI7-.js';
|
|
7
|
-
|
|
8
|
-
const PasswordField = class {
|
|
9
|
-
constructor(hostRef) {
|
|
10
|
-
registerInstance(this, hostRef);
|
|
11
|
-
}
|
|
12
|
-
get el() { return getElement(this); }
|
|
13
|
-
for = "login";
|
|
14
|
-
componentClassName = "";
|
|
15
|
-
ariaLabel = "";
|
|
16
|
-
getAriaLabel() {
|
|
17
|
-
if (this.ariaLabel)
|
|
18
|
-
return this.ariaLabel;
|
|
19
|
-
switch (this.for) {
|
|
20
|
-
case "login":
|
|
21
|
-
return "Password";
|
|
22
|
-
case "new-password":
|
|
23
|
-
return "New Password";
|
|
24
|
-
case "password-confirmation":
|
|
25
|
-
return "Password Confirmation";
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
getValue() {
|
|
29
|
-
switch (this.for) {
|
|
30
|
-
case "login":
|
|
31
|
-
return state.password;
|
|
32
|
-
case "new-password":
|
|
33
|
-
return state.resetPassword.newPassword;
|
|
34
|
-
case "password-confirmation":
|
|
35
|
-
return state.resetPassword.passwordConfirmation;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
getAutocomplete() {
|
|
39
|
-
switch (this.for) {
|
|
40
|
-
case "login":
|
|
41
|
-
return "current-password";
|
|
42
|
-
case "new-password":
|
|
43
|
-
case "password-confirmation":
|
|
44
|
-
return "new-password";
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
getInputName() {
|
|
48
|
-
switch (this.for) {
|
|
49
|
-
case "login":
|
|
50
|
-
return "password";
|
|
51
|
-
case "new-password":
|
|
52
|
-
return "new-password";
|
|
53
|
-
case "password-confirmation":
|
|
54
|
-
return "confirm-password";
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
handleInput = (event) => {
|
|
58
|
-
const target = event.target;
|
|
59
|
-
switch (this.for) {
|
|
60
|
-
case "login":
|
|
61
|
-
authStore.setPassword(target.value);
|
|
62
|
-
break;
|
|
63
|
-
case "new-password":
|
|
64
|
-
authStore.setNewPassword(target.value);
|
|
65
|
-
authStore.clearFieldError("resetPassword");
|
|
66
|
-
authStore.clearFieldError("password");
|
|
67
|
-
break;
|
|
68
|
-
case "password-confirmation":
|
|
69
|
-
authStore.setConfirmPassword(target.value);
|
|
70
|
-
authStore.clearFieldError("resetPassword");
|
|
71
|
-
authStore.clearFieldError("password");
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
handleSubmit = async (event) => {
|
|
76
|
-
event.preventDefault();
|
|
77
|
-
(await getParentSigninStep(this.el))?.submit();
|
|
78
|
-
};
|
|
79
|
-
shouldRender() {
|
|
80
|
-
switch (this.for) {
|
|
81
|
-
case "login":
|
|
82
|
-
if (state.step === "single-login")
|
|
83
|
-
return true;
|
|
84
|
-
if (state.step === "verification" && state.availableLoginOptions?.password) {
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
return false;
|
|
88
|
-
case "new-password":
|
|
89
|
-
case "password-confirmation":
|
|
90
|
-
return state.step === "reset-password";
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
render() {
|
|
94
|
-
if (!this.shouldRender()) {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
const key = this.for === "password-confirmation" ? "auth.password.confirmation.placeholder" : "auth.password.placeholder";
|
|
98
|
-
const placeholder = t(key, { defaultValue: "Enter your password" });
|
|
99
|
-
return (h("form", { onSubmit: this.handleSubmit }, h("input", { name: this.getInputName(), type: "password", value: this.getValue(), autocomplete: this.getAutocomplete(), placeholder: placeholder, disabled: state.loading, class: this.componentClassName, onInput: this.handleInput, "aria-label": this.getAriaLabel() })));
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
export { PasswordField as u_password_field };
|
|
104
|
-
//# sourceMappingURL=u-password-field.entry.esm.js.map
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, h } from './index-C5jZjlU8.js';
|
|
2
|
-
import { t } from './i18n-CZii1E-s.js';
|
|
3
|
-
import { F as Flash } from './flash-store-Cgu7WoSN.js';
|
|
4
|
-
import { A as Auth } from './auth-C0vldOq6.js';
|
|
5
|
-
import { s as state } from './auth-store-DQaam_Qh.js';
|
|
6
|
-
import './unidy-store-CtifvCkV.js';
|
|
7
|
-
import './index-O6h7SI7-.js';
|
|
8
|
-
import './index-Df-7P3r0.js';
|
|
9
|
-
import './profile-store-BZKApsQm.js';
|
|
10
|
-
import './component-utils-D1lzXl_Z.js';
|
|
11
|
-
|
|
12
|
-
const ResetPasswordButton = class {
|
|
13
|
-
constructor(hostRef) {
|
|
14
|
-
registerInstance(this, hostRef);
|
|
15
|
-
}
|
|
16
|
-
componentClassName = "";
|
|
17
|
-
handleClick = async () => {
|
|
18
|
-
const authInstance = await Auth.getInstance();
|
|
19
|
-
await authInstance.helpers.sendResetPasswordEmail();
|
|
20
|
-
if (state.resetPassword.step === "sent") {
|
|
21
|
-
const successMessage = t("auth.resetPassword.success_message", {
|
|
22
|
-
defaultValue: "Password reset email sent. Please check your inbox.",
|
|
23
|
-
});
|
|
24
|
-
Flash.success.addMessage(successMessage);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
shouldRender() {
|
|
28
|
-
if (["verification", "reset-password"].includes(state.step))
|
|
29
|
-
return true;
|
|
30
|
-
if (state.step === "single-login" && state.sid !== null)
|
|
31
|
-
return true;
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
getButtonText() {
|
|
35
|
-
if (["verification", "single-login"].includes(state.step) &&
|
|
36
|
-
state.availableLoginOptions &&
|
|
37
|
-
!state.availableLoginOptions.password) {
|
|
38
|
-
return t("auth.resetPassword.button_text_set", { defaultValue: "Set Password" });
|
|
39
|
-
}
|
|
40
|
-
if (state.step === "reset-password") {
|
|
41
|
-
return t("auth.resetPassword.button_text_resend", { defaultValue: "Resend Password Reset Email" });
|
|
42
|
-
}
|
|
43
|
-
return t("auth.resetPassword.button_text_reset", { defaultValue: "Reset Password" });
|
|
44
|
-
}
|
|
45
|
-
render() {
|
|
46
|
-
if (!this.shouldRender()) {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
return (h("button", { type: "button", onClick: this.handleClick, class: this.componentClassName }, this.getButtonText()));
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export { ResetPasswordButton as u_reset_password_button };
|
|
54
|
-
//# sourceMappingURL=u-reset-password-button.entry.esm.js.map
|
|
File without changes
|