@unidy.io/sdk 1.1.2 → 1.1.4
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/app-globals-DSKjcXX_.js +10 -0
- package/dist/cjs/app-globals-DSKjcXX_.js.map +1 -0
- package/dist/cjs/auth-NU3DBc-6.js +581 -0
- package/dist/cjs/auth-NU3DBc-6.js.map +1 -0
- package/dist/cjs/auth-store-BaxuIp4z.js +185 -0
- package/dist/cjs/auth-store-BaxuIp4z.js.map +1 -0
- package/dist/cjs/component-utils-BpMyeVQo.js +35 -0
- package/dist/cjs/component-utils-BpMyeVQo.js.map +1 -0
- package/dist/cjs/flash-store-BuIBuQDx.js +50 -0
- package/dist/cjs/flash-store-BuIBuQDx.js.map +1 -0
- package/dist/cjs/helpers-BcPlKlBG.js +11 -0
- package/dist/cjs/helpers-BcPlKlBG.js.map +1 -0
- package/dist/cjs/helpers-DJyRa0Qo.js +11 -0
- package/dist/cjs/helpers-DJyRa0Qo.js.map +1 -0
- package/dist/cjs/i18n-BoDZ8kd2.js +3236 -0
- package/dist/cjs/i18n-BoDZ8kd2.js.map +1 -0
- package/dist/cjs/index-B_N5xKgH.js +12025 -0
- package/dist/cjs/index-B_N5xKgH.js.map +1 -0
- package/dist/cjs/index-DLz3FT7T.js +214 -0
- package/dist/cjs/index-DLz3FT7T.js.map +1 -0
- package/dist/cjs/index-R2MKLaem.js +5267 -0
- package/dist/cjs/index-R2MKLaem.js.map +1 -0
- package/dist/cjs/index.cjs.js +64 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +14 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/newsletter-helpers-DR0vsegt.js +289 -0
- package/dist/cjs/newsletter-helpers-DR0vsegt.js.map +1 -0
- package/dist/cjs/newsletter-store-BzytX7Qh.js +38 -0
- package/dist/cjs/newsletter-store-BzytX7Qh.js.map +1 -0
- package/dist/cjs/pagination-store-BEiW3MQd.js +16 -0
- package/dist/cjs/pagination-store-BEiW3MQd.js.map +1 -0
- package/dist/cjs/profile-helpers-B2h2III_.js +39 -0
- package/dist/cjs/profile-helpers-B2h2III_.js.map +1 -0
- package/dist/cjs/profile-store-P_BcYkef.js +22 -0
- package/dist/cjs/profile-store-P_BcYkef.js.map +1 -0
- package/dist/cjs/sdk.cjs.js +26 -0
- package/dist/cjs/sdk.cjs.js.map +1 -0
- package/dist/cjs/u-conditional-render.cjs.entry.js +103 -0
- package/dist/cjs/u-conditional-render.entry.cjs.js.map +1 -0
- package/dist/cjs/u-config.cjs.entry.js +87 -0
- package/dist/cjs/u-config.entry.cjs.js.map +1 -0
- package/dist/cjs/u-email-field.cjs.entry.js +77 -0
- package/dist/cjs/u-email-field.entry.cjs.js.map +1 -0
- package/dist/cjs/u-error-message.cjs.entry.js +82 -0
- package/dist/cjs/u-error-message.entry.cjs.js.map +1 -0
- package/dist/cjs/u-field.u-raw-field.entry.cjs.js.map +1 -0
- package/dist/cjs/u-field_2.cjs.entry.js +375 -0
- package/dist/cjs/u-flash-message.cjs.entry.js +37 -0
- package/dist/cjs/u-flash-message.entry.cjs.js.map +1 -0
- package/dist/cjs/u-full-profile.cjs.entry.js +37 -0
- package/dist/cjs/u-full-profile.entry.cjs.js.map +1 -0
- package/dist/cjs/u-logout-button.cjs.entry.js +38 -0
- package/dist/cjs/u-logout-button.entry.cjs.js.map +1 -0
- package/dist/cjs/u-magic-code-field.cjs.entry.js +91 -0
- package/dist/cjs/u-magic-code-field.entry.cjs.js.map +1 -0
- package/dist/cjs/u-missing-field.cjs.entry.js +22 -0
- package/dist/cjs/u-missing-field.entry.cjs.js.map +1 -0
- package/dist/cjs/u-missing-fields-submit-button.cjs.entry.js +46 -0
- package/dist/cjs/u-missing-fields-submit-button.entry.cjs.js.map +1 -0
- package/dist/cjs/u-newsletter-checkbox.cjs.entry.js +63 -0
- package/dist/cjs/u-newsletter-checkbox.entry.cjs.js.map +1 -0
- package/dist/cjs/u-newsletter-logout-button.cjs.entry.js +36 -0
- package/dist/cjs/u-newsletter-logout-button.entry.cjs.js.map +1 -0
- package/dist/cjs/u-newsletter-preference-checkbox.cjs.entry.js +106 -0
- package/dist/cjs/u-newsletter-preference-checkbox.entry.cjs.js.map +1 -0
- package/dist/cjs/u-newsletter-resend-doi-button.cjs.entry.js +49 -0
- package/dist/cjs/u-newsletter-resend-doi-button.entry.cjs.js.map +1 -0
- package/dist/cjs/u-newsletter-root.cjs.entry.js +72 -0
- package/dist/cjs/u-newsletter-root.entry.cjs.js.map +1 -0
- package/dist/cjs/u-newsletter-toggle-subscription-button.cjs.entry.js +73 -0
- package/dist/cjs/u-newsletter-toggle-subscription-button.entry.cjs.js.map +1 -0
- package/dist/cjs/u-pagination-button.cjs.entry.js +63 -0
- package/dist/cjs/u-pagination-button.entry.cjs.js.map +1 -0
- package/dist/cjs/u-pagination-page.cjs.entry.js +44 -0
- package/dist/cjs/u-pagination-page.entry.cjs.js.map +1 -0
- package/dist/cjs/u-passkey.cjs.entry.js +47 -0
- package/dist/cjs/u-passkey.entry.cjs.js.map +1 -0
- package/dist/cjs/u-password-field.cjs.entry.js +104 -0
- package/dist/cjs/u-password-field.entry.cjs.js.map +1 -0
- package/dist/cjs/u-profile.u-submit-button.entry.cjs.js.map +1 -0
- package/dist/cjs/u-profile_2.cjs.entry.js +327 -0
- package/dist/cjs/u-registration-button.cjs.entry.js +48 -0
- package/dist/cjs/u-registration-button.entry.cjs.js.map +1 -0
- package/dist/cjs/u-reset-password-button.cjs.entry.js +47 -0
- package/dist/cjs/u-reset-password-button.entry.cjs.js.map +1 -0
- package/dist/cjs/u-send-magic-code-button.cjs.entry.js +68 -0
- package/dist/cjs/u-send-magic-code-button.entry.cjs.js.map +1 -0
- package/dist/cjs/u-signed-in.cjs.entry.js +25 -0
- package/dist/cjs/u-signed-in.entry.cjs.js.map +1 -0
- package/dist/cjs/u-signin-root.cjs.entry.js +43 -0
- package/dist/cjs/u-signin-root.entry.cjs.js.map +1 -0
- package/dist/cjs/u-signin-step.cjs.entry.js +66 -0
- package/dist/cjs/u-signin-step.entry.cjs.js.map +1 -0
- package/dist/cjs/u-signin-strategy.cjs.entry.js +30 -0
- package/dist/cjs/u-signin-strategy.entry.cjs.js.map +1 -0
- package/dist/cjs/u-social-login-button.cjs.entry.js +100 -0
- package/dist/cjs/u-social-login-button.entry.cjs.js.map +1 -0
- package/dist/cjs/u-spinner.cjs.entry.js +18 -0
- package/dist/cjs/u-spinner.entry.cjs.js.map +1 -0
- package/dist/cjs/u-ticketable-list.cjs.entry.js +6087 -0
- package/dist/cjs/u-ticketable-list.entry.cjs.js.map +1 -0
- package/dist/cjs/unidy-store-7AbWnZ6g.js +41 -0
- package/dist/cjs/unidy-store-7AbWnZ6g.js.map +1 -0
- package/dist/collection/api/client.js +144 -0
- package/dist/collection/api/client.js.map +1 -0
- package/dist/collection/api/index.js +42 -0
- package/dist/collection/api/index.js.map +1 -0
- package/dist/collection/api/shared.js +18 -0
- package/dist/collection/api/shared.js.map +1 -0
- package/dist/collection/auth/api/auth.js +264 -0
- package/dist/collection/auth/api/auth.js.map +1 -0
- package/dist/collection/auth/auth-helpers.js +299 -0
- package/dist/collection/auth/auth-helpers.js.map +1 -0
- package/dist/collection/auth/auth.js +121 -0
- package/dist/collection/auth/auth.js.map +1 -0
- package/dist/collection/auth/components/helpers.js +5 -0
- package/dist/collection/auth/components/helpers.js.map +1 -0
- package/dist/collection/auth/components/logout-button/logout-button.js +85 -0
- package/dist/collection/auth/components/logout-button/logout-button.js.map +1 -0
- package/dist/collection/auth/components/magic-code-field/magic-code-field.css +1 -0
- package/dist/collection/auth/components/magic-code-field/magic-code-field.js +113 -0
- package/dist/collection/auth/components/magic-code-field/magic-code-field.js.map +1 -0
- package/dist/collection/auth/components/missing-field/missing-field.js +14 -0
- package/dist/collection/auth/components/missing-field/missing-field.js.map +1 -0
- package/dist/collection/auth/components/missing-fields-submit-button/missing-fields-submit-button.js +39 -0
- package/dist/collection/auth/components/missing-fields-submit-button/missing-fields-submit-button.js.map +1 -0
- package/dist/collection/auth/components/passkey/passkey.js +103 -0
- package/dist/collection/auth/components/passkey/passkey.js.map +1 -0
- package/dist/collection/auth/components/password-field/password-field.js +166 -0
- package/dist/collection/auth/components/password-field/password-field.js.map +1 -0
- package/dist/collection/auth/components/registration/registration-button.js +104 -0
- package/dist/collection/auth/components/registration/registration-button.js.map +1 -0
- package/dist/collection/auth/components/reset-pass-button/reset-pass-button.js +59 -0
- package/dist/collection/auth/components/reset-pass-button/reset-pass-button.js.map +1 -0
- package/dist/collection/auth/components/send-magic-code-button/send-magic-code-button.js +104 -0
- package/dist/collection/auth/components/send-magic-code-button/send-magic-code-button.js.map +1 -0
- package/dist/collection/auth/components/signed-in/signed-in.js +59 -0
- package/dist/collection/auth/components/signed-in/signed-in.js.map +1 -0
- package/dist/collection/auth/components/signin-root/signin-root.js +97 -0
- package/dist/collection/auth/components/signin-root/signin-root.js.map +1 -0
- package/dist/collection/auth/components/signin-step/signin-step.js +135 -0
- package/dist/collection/auth/components/signin-step/signin-step.js.map +1 -0
- package/dist/collection/auth/components/signin-strategy/signin-strategy.js +64 -0
- package/dist/collection/auth/components/signin-strategy/signin-strategy.js.map +1 -0
- package/dist/collection/auth/components/social-logins/logos/apple.js +3 -0
- package/dist/collection/auth/components/social-logins/logos/apple.js.map +1 -0
- package/dist/collection/auth/components/social-logins/logos/discord.js +3 -0
- package/dist/collection/auth/components/social-logins/logos/discord.js.map +1 -0
- package/dist/collection/auth/components/social-logins/logos/facebook.js +3 -0
- package/dist/collection/auth/components/social-logins/logos/facebook.js.map +1 -0
- package/dist/collection/auth/components/social-logins/logos/google.js +3 -0
- package/dist/collection/auth/components/social-logins/logos/google.js.map +1 -0
- package/dist/collection/auth/components/social-logins/logos/linkedin.js +3 -0
- package/dist/collection/auth/components/social-logins/logos/linkedin.js.map +1 -0
- package/dist/collection/auth/components/social-logins/social-login-button.css +1 -0
- package/dist/collection/auth/components/social-logins/social-login-button.js +188 -0
- package/dist/collection/auth/components/social-logins/social-login-button.js.map +1 -0
- package/dist/collection/auth/components/submit-button/auth-submit-button.js +62 -0
- package/dist/collection/auth/components/submit-button/auth-submit-button.js.map +1 -0
- package/dist/{sdk/index-Cz3idqu9.js → collection/auth/error-definitions.js} +2 -19
- package/dist/collection/auth/error-definitions.js.map +1 -0
- package/dist/collection/auth/index.js +14 -0
- package/dist/collection/auth/index.js.map +1 -0
- package/dist/collection/auth/passkey-auth.js +106 -0
- package/dist/collection/auth/passkey-auth.js.map +1 -0
- package/dist/collection/auth/store/auth-store.js +176 -0
- package/dist/collection/auth/store/auth-store.js.map +1 -0
- package/dist/collection/collection-manifest.json +46 -0
- package/dist/collection/globalScript.js +18 -0
- package/dist/collection/globalScript.js.map +1 -0
- package/dist/collection/i18n.js +31 -0
- package/dist/collection/i18n.js.map +1 -0
- package/dist/collection/index.js +16 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/locales/de.json +133 -0
- package/dist/collection/locales/en.json +133 -0
- package/dist/collection/locales/fr.json +133 -0
- package/dist/collection/locales/it.json +133 -0
- package/dist/collection/locales/nl_be.json +133 -0
- package/dist/collection/locales/ro.json +133 -0
- package/dist/collection/logger.js +106 -0
- package/dist/collection/logger.js.map +1 -0
- package/dist/collection/newsletter/api/newsletters.js +189 -0
- package/dist/collection/newsletter/api/newsletters.js.map +1 -0
- package/dist/collection/newsletter/components/helpers.js +5 -0
- package/dist/collection/newsletter/components/helpers.js.map +1 -0
- package/dist/collection/newsletter/components/logout-button/logout-button.js +48 -0
- package/dist/collection/newsletter/components/logout-button/logout-button.js.map +1 -0
- package/dist/collection/newsletter/components/newsletter-checkbox/newsletter-checkbox.js +109 -0
- package/dist/collection/newsletter/components/newsletter-checkbox/newsletter-checkbox.js.map +1 -0
- package/dist/collection/newsletter/components/newsletter-root/newsletter-root.js +119 -0
- package/dist/collection/newsletter/components/newsletter-root/newsletter-root.js.map +1 -0
- package/dist/collection/newsletter/components/preference-checkbox/preference-checkbox.js +178 -0
- package/dist/collection/newsletter/components/preference-checkbox/preference-checkbox.js.map +1 -0
- package/dist/collection/newsletter/components/resend-doi-button/resend-doi-button.css +1 -0
- package/dist/collection/newsletter/components/resend-doi-button/resend-doi-button.js +89 -0
- package/dist/collection/newsletter/components/resend-doi-button/resend-doi-button.js.map +1 -0
- package/dist/collection/newsletter/components/submit-button/newsletter-submit-button.js +18 -0
- package/dist/collection/newsletter/components/submit-button/newsletter-submit-button.js.map +1 -0
- package/dist/collection/newsletter/components/toggle-subscription-button/toggle-subscription-button.css +1 -0
- package/dist/collection/newsletter/components/toggle-subscription-button/toggle-subscription-button.js +154 -0
- package/dist/collection/newsletter/components/toggle-subscription-button/toggle-subscription-button.js.map +1 -0
- package/dist/collection/newsletter/index.js +11 -0
- package/dist/collection/newsletter/index.js.map +1 -0
- package/dist/collection/newsletter/newsletter-helpers.js +277 -0
- package/dist/collection/newsletter/newsletter-helpers.js.map +1 -0
- package/dist/collection/newsletter/store/newsletter-store.js +34 -0
- package/dist/collection/newsletter/store/newsletter-store.js.map +1 -0
- package/dist/collection/profile/api/profile.js +168 -0
- package/dist/collection/profile/api/profile.js.map +1 -0
- package/dist/collection/profile/components/field/field.css +1 -0
- package/dist/collection/profile/components/field/field.js +359 -0
- package/dist/collection/profile/components/field/field.js.map +1 -0
- package/dist/collection/profile/components/full-profile/full-profile.css +1 -0
- package/dist/collection/profile/components/full-profile/full-profile.js +78 -0
- package/dist/collection/profile/components/full-profile/full-profile.js.map +1 -0
- package/dist/collection/profile/components/profile/profile.js +250 -0
- package/dist/collection/profile/components/profile/profile.js.map +1 -0
- package/dist/collection/profile/components/raw-field/raw-field.js +697 -0
- package/dist/collection/profile/components/raw-field/raw-field.js.map +1 -0
- package/dist/collection/profile/components/raw-input-fields/Input.js +3 -0
- package/dist/collection/profile/components/raw-input-fields/Input.js.map +1 -0
- package/dist/collection/profile/components/raw-input-fields/MultiSelect.js +8 -0
- package/dist/collection/profile/components/raw-input-fields/MultiSelect.js.map +1 -0
- package/dist/collection/profile/components/raw-input-fields/RadioGroup.js +8 -0
- package/dist/collection/profile/components/raw-input-fields/RadioGroup.js.map +1 -0
- package/dist/collection/profile/components/raw-input-fields/Select.js +11 -0
- package/dist/collection/profile/components/raw-input-fields/Select.js.map +1 -0
- package/dist/collection/profile/components/raw-input-fields/Textarea.js +3 -0
- package/dist/collection/profile/components/raw-input-fields/Textarea.js.map +1 -0
- package/dist/collection/profile/components/submit-button/profile-submit-button.js +17 -0
- package/dist/collection/profile/components/submit-button/profile-submit-button.js.map +1 -0
- package/dist/collection/profile/index.js +13 -0
- package/dist/collection/profile/index.js.map +1 -0
- package/dist/collection/profile/profile-helpers.js +31 -0
- package/dist/collection/profile/profile-helpers.js.map +1 -0
- package/dist/collection/profile/store/profile-store.js +15 -0
- package/dist/collection/profile/store/profile-store.js.map +1 -0
- package/dist/collection/sdk.css +39 -0
- package/dist/collection/shared/component-utils.js +28 -0
- package/dist/collection/shared/component-utils.js.map +1 -0
- package/dist/collection/shared/components/conditional-render/conditional-render.js +178 -0
- package/dist/collection/shared/components/conditional-render/conditional-render.js.map +1 -0
- package/dist/collection/shared/components/config/config.js +260 -0
- package/dist/collection/shared/components/config/config.js.map +1 -0
- package/dist/collection/shared/components/email-field/email-field.css +1 -0
- package/dist/collection/shared/components/email-field/email-field.js +145 -0
- package/dist/collection/shared/components/email-field/email-field.js.map +1 -0
- package/dist/collection/shared/components/error-message/error-message.js +141 -0
- package/dist/collection/shared/components/error-message/error-message.js.map +1 -0
- package/dist/collection/shared/components/flash-message/close-icon.js +3 -0
- package/dist/collection/shared/components/flash-message/close-icon.js.map +1 -0
- package/dist/collection/shared/components/flash-message/flash-message.css +1 -0
- package/dist/collection/shared/components/flash-message/flash-message.js +79 -0
- package/dist/collection/shared/components/flash-message/flash-message.js.map +1 -0
- package/dist/collection/shared/components/spinner/spinner.css +1 -0
- package/dist/collection/shared/components/spinner/spinner.js +19 -0
- package/dist/collection/shared/components/spinner/spinner.js.map +1 -0
- package/dist/collection/shared/components/submit-button/context.js +10 -0
- package/dist/collection/shared/components/submit-button/context.js.map +1 -0
- package/dist/collection/shared/components/submit-button/submit-button.css +1 -0
- package/dist/collection/shared/components/submit-button/submit-button.js +196 -0
- package/dist/collection/shared/components/submit-button/submit-button.js.map +1 -0
- package/dist/collection/shared/store/flash-store.js +43 -0
- package/dist/collection/shared/store/flash-store.js.map +1 -0
- package/dist/collection/shared/store/unidy-store.js +33 -0
- package/dist/collection/shared/store/unidy-store.js.map +1 -0
- package/dist/collection/ticketable/api/get-with-schema.js +35 -0
- package/dist/collection/ticketable/api/get-with-schema.js.map +1 -0
- package/dist/collection/ticketable/api/schemas.js +12 -0
- package/dist/collection/ticketable/api/schemas.js.map +1 -0
- package/dist/collection/ticketable/api/subscriptions.js +47 -0
- package/dist/collection/ticketable/api/subscriptions.js.map +1 -0
- package/dist/collection/ticketable/api/tickets.js +48 -0
- package/dist/collection/ticketable/api/tickets.js.map +1 -0
- package/dist/collection/ticketable/components/pagination/pagination-button.js +108 -0
- package/dist/collection/ticketable/components/pagination/pagination-button.js.map +1 -0
- package/dist/collection/ticketable/components/pagination/pagination-page.js +69 -0
- package/dist/collection/ticketable/components/pagination/pagination-page.js.map +1 -0
- package/dist/collection/ticketable/components/ticketable-list/skeleton-helpers.js +54 -0
- package/dist/collection/ticketable/components/ticketable-list/skeleton-helpers.js.map +1 -0
- package/dist/collection/ticketable/components/ticketable-list/ticketable-list.js +498 -0
- package/dist/collection/ticketable/components/ticketable-list/ticketable-list.js.map +1 -0
- package/dist/collection/ticketable/index.js +13 -0
- package/dist/collection/ticketable/index.js.map +1 -0
- package/dist/collection/ticketable/store/pagination-store.js +9 -0
- package/dist/collection/ticketable/store/pagination-store.js.map +1 -0
- package/dist/{sdk/auth-store-CapiC8gJ.js → components/auth-store.js} +5 -4
- package/dist/components/auth-store.js.map +1 -0
- package/dist/components/auth.js +580 -0
- package/dist/components/auth.js.map +1 -0
- package/dist/components/component-utils.js +32 -0
- package/dist/components/component-utils.js.map +1 -0
- package/dist/components/exports.js +4106 -0
- package/dist/components/exports.js.map +1 -0
- package/dist/{sdk/u-field.entry.js → components/field.js} +57 -14
- package/dist/components/field.js.map +1 -0
- package/dist/{sdk/flash-store-DNcSEn2p.js → components/flash-store.js} +3 -4
- package/dist/components/flash-store.js.map +1 -0
- package/dist/components/helpers.js +9 -0
- package/dist/components/helpers.js.map +1 -0
- package/dist/components/helpers2.js +9 -0
- package/dist/components/helpers2.js.map +1 -0
- package/dist/{sdk/i18n-BCI_ARJL.js → components/i18n.js} +11 -19
- package/dist/components/i18n.js.map +1 -0
- package/dist/components/index.js +5902 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index2.js +5256 -0
- package/dist/components/index2.js.map +1 -0
- package/dist/{sdk/index-BnBstyfp.js → components/index3.js} +3 -3
- package/dist/components/index3.js.map +1 -0
- package/dist/components/logger.js +111 -0
- package/dist/components/logger.js.map +1 -0
- package/dist/{sdk/newsletter-helpers-DEXEBD0F.js → components/newsletter-helpers.js} +14 -12
- package/dist/components/newsletter-helpers.js.map +1 -0
- package/dist/{sdk/newsletter-store-CvULKmsu.js → components/newsletter-store.js} +3 -8
- package/dist/components/newsletter-store.js.map +1 -0
- package/dist/components/pagination-store.js +14 -0
- package/dist/components/pagination-store.js.map +1 -0
- package/dist/{sdk/profile-helpers-Bs3aj0CO.js → components/profile-helpers.js} +4 -4
- package/dist/components/profile-helpers.js.map +1 -0
- package/dist/{sdk/profile-store-DD6sq42i.js → components/profile-store.js} +3 -3
- package/dist/components/profile-store.js.map +1 -0
- package/dist/{sdk/u-profile.entry.js → components/profile.js} +54 -20
- package/dist/components/profile.js.map +1 -0
- package/dist/{sdk/u-raw-field.entry.js → components/raw-field.js} +51 -10
- package/dist/components/raw-field.js.map +1 -0
- package/dist/components/spinner.js +35 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/{sdk/u-submit-button.entry.js → components/submit-button.js} +46 -19
- package/dist/components/submit-button.js.map +1 -0
- package/dist/components/u-conditional-render.js +121 -0
- package/dist/components/u-conditional-render.js.map +1 -0
- package/dist/components/u-config.js +113 -0
- package/dist/components/u-config.js.map +1 -0
- package/dist/components/u-email-field.js +99 -0
- package/dist/components/u-email-field.js.map +1 -0
- package/dist/components/u-error-message.js +105 -0
- package/dist/components/u-error-message.js.map +1 -0
- package/dist/components/u-field.js +9 -0
- package/dist/components/u-field.js.map +1 -0
- package/dist/components/u-flash-message.js +58 -0
- package/dist/components/u-flash-message.js.map +1 -0
- package/dist/components/u-full-profile.js +87 -0
- package/dist/components/u-full-profile.js.map +1 -0
- package/dist/components/u-logout-button.js +53 -0
- package/dist/components/u-logout-button.js.map +1 -0
- package/dist/components/u-magic-code-field.js +106 -0
- package/dist/components/u-magic-code-field.js.map +1 -0
- package/dist/components/u-missing-field.js +57 -0
- package/dist/components/u-missing-field.js.map +1 -0
- package/dist/components/u-missing-fields-submit-button.js +70 -0
- package/dist/components/u-missing-fields-submit-button.js.map +1 -0
- package/dist/components/u-newsletter-checkbox.js +77 -0
- package/dist/components/u-newsletter-checkbox.js.map +1 -0
- package/dist/components/u-newsletter-logout-button.js +51 -0
- package/dist/components/u-newsletter-logout-button.js.map +1 -0
- package/dist/components/u-newsletter-preference-checkbox.js +124 -0
- package/dist/components/u-newsletter-preference-checkbox.js.map +1 -0
- package/dist/components/u-newsletter-resend-doi-button.js +70 -0
- package/dist/components/u-newsletter-resend-doi-button.js.map +1 -0
- package/dist/components/u-newsletter-root.js +90 -0
- package/dist/components/u-newsletter-root.js.map +1 -0
- package/dist/components/u-newsletter-toggle-subscription-button.js +97 -0
- package/dist/components/u-newsletter-toggle-subscription-button.js.map +1 -0
- package/dist/components/u-pagination-button.js +86 -0
- package/dist/components/u-pagination-button.js.map +1 -0
- package/dist/components/u-pagination-page.js +66 -0
- package/dist/components/u-pagination-page.js.map +1 -0
- package/dist/components/u-passkey.js +65 -0
- package/dist/components/u-passkey.js.map +1 -0
- package/dist/components/u-password-field.js +125 -0
- package/dist/components/u-password-field.js.map +1 -0
- package/dist/components/u-profile.js +9 -0
- package/dist/components/u-profile.js.map +1 -0
- package/dist/components/u-raw-field.js +9 -0
- package/dist/components/u-raw-field.js.map +1 -0
- package/dist/components/u-registration-button.js +70 -0
- package/dist/components/u-registration-button.js.map +1 -0
- package/dist/components/u-reset-password-button.js +63 -0
- package/dist/components/u-reset-password-button.js.map +1 -0
- package/dist/components/u-send-magic-code-button.js +85 -0
- package/dist/components/u-send-magic-code-button.js.map +1 -0
- package/dist/components/u-signed-in.js +44 -0
- package/dist/components/u-signed-in.js.map +1 -0
- package/dist/components/u-signin-root.js +63 -0
- package/dist/components/u-signin-root.js.map +1 -0
- package/dist/components/u-signin-step.js +84 -0
- package/dist/components/u-signin-step.js.map +1 -0
- package/dist/components/u-signin-strategy.js +50 -0
- package/dist/components/u-signin-strategy.js.map +1 -0
- package/dist/components/u-social-login-button.js +125 -0
- package/dist/components/u-social-login-button.js.map +1 -0
- package/dist/components/u-spinner.js +9 -0
- package/dist/components/u-spinner.js.map +1 -0
- package/dist/components/u-submit-button.js +9 -0
- package/dist/components/u-submit-button.js.map +1 -0
- package/dist/components/u-ticketable-list.js +6122 -0
- package/dist/components/u-ticketable-list.js.map +1 -0
- package/dist/{sdk/unidy-store-BwZym11Y.js → components/unidy-store.js} +3 -4
- package/dist/components/unidy-store.js.map +1 -0
- package/dist/esm/app-globals-CPU9ZcqZ.js +8 -0
- package/dist/esm/app-globals-CPU9ZcqZ.js.map +1 -0
- package/dist/{sdk/auth-Che07PeV.js → esm/auth-nsjRdpvS.js} +40 -32
- package/dist/esm/auth-nsjRdpvS.js.map +1 -0
- package/dist/esm/auth-store-CVvBlKGv.js +180 -0
- package/dist/esm/auth-store-CVvBlKGv.js.map +1 -0
- package/dist/esm/flash-store-CEvWSG0c.js +47 -0
- package/dist/{sdk/flash-store-DNcSEn2p.js.map → esm/flash-store-CEvWSG0c.js.map} +1 -1
- package/dist/esm/i18n-CLdWzy5J.js +3233 -0
- package/dist/esm/i18n-CLdWzy5J.js.map +1 -0
- package/dist/esm/index-Bjp1XO-f.js +212 -0
- package/dist/{sdk/index-BnBstyfp.js.map → esm/index-Bjp1XO-f.js.map} +1 -1
- package/dist/esm/index-Ci3aTmzp.js +12007 -0
- package/dist/esm/index-Ci3aTmzp.js.map +1 -0
- package/dist/esm/index-DSDkaHWI.js +5254 -0
- package/dist/esm/index-DSDkaHWI.js.map +1 -0
- package/dist/esm/index.js +40 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +12 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/newsletter-helpers-Dc_24im3.js +278 -0
- package/dist/esm/newsletter-helpers-Dc_24im3.js.map +1 -0
- package/dist/esm/newsletter-store-DBL1A203.js +34 -0
- package/dist/{sdk/newsletter-store-CvULKmsu.js.map → esm/newsletter-store-DBL1A203.js.map} +1 -1
- package/dist/esm/pagination-store-DzdJOp-n.js +14 -0
- package/dist/esm/pagination-store-DzdJOp-n.js.map +1 -0
- package/dist/esm/profile-helpers-CglNd6Nw.js +36 -0
- package/dist/{sdk/profile-helpers-Bs3aj0CO.js.map → esm/profile-helpers-CglNd6Nw.js.map} +1 -1
- package/dist/esm/profile-store-RmZB2PTc.js +18 -0
- package/dist/{sdk/profile-store-DD6sq42i.js.map → esm/profile-store-RmZB2PTc.js.map} +1 -1
- package/dist/esm/sdk.js +22 -0
- package/dist/esm/sdk.js.map +1 -0
- package/dist/{sdk → esm}/u-conditional-render.entry.js +12 -12
- package/dist/esm/u-conditional-render.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-config.entry.js +12 -13
- package/dist/esm/u-config.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-email-field.entry.js +7 -7
- package/dist/esm/u-email-field.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-error-message.entry.js +7 -7
- package/dist/esm/u-error-message.entry.js.map +1 -0
- package/dist/esm/u-field.u-raw-field.entry.js.map +1 -0
- package/dist/esm/u-field_2.entry.js +372 -0
- package/dist/{sdk → esm}/u-flash-message.entry.js +4 -4
- package/dist/esm/u-flash-message.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-full-profile.entry.js +7 -7
- package/dist/esm/u-full-profile.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-logout-button.entry.js +11 -11
- package/dist/esm/u-logout-button.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-magic-code-field.entry.js +10 -10
- package/dist/esm/u-magic-code-field.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-missing-field.entry.js +5 -5
- package/dist/esm/u-missing-field.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-missing-fields-submit-button.entry.js +9 -9
- package/dist/esm/u-missing-fields-submit-button.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-newsletter-checkbox.entry.js +12 -12
- package/dist/esm/u-newsletter-checkbox.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-newsletter-logout-button.entry.js +12 -12
- package/dist/esm/u-newsletter-logout-button.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-newsletter-preference-checkbox.entry.js +12 -12
- package/dist/esm/u-newsletter-preference-checkbox.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-newsletter-resend-doi-button.entry.js +12 -12
- package/dist/esm/u-newsletter-resend-doi-button.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-newsletter-root.entry.js +12 -12
- package/dist/esm/u-newsletter-root.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-newsletter-toggle-subscription-button.entry.js +12 -12
- package/dist/esm/u-newsletter-toggle-subscription-button.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-pagination-button.entry.js +2 -2
- package/dist/esm/u-pagination-button.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-pagination-page.entry.js +2 -2
- package/dist/esm/u-pagination-page.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-passkey.entry.js +10 -10
- package/dist/esm/u-passkey.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-password-field.entry.js +6 -6
- package/dist/esm/u-password-field.entry.js.map +1 -0
- package/dist/esm/u-profile.u-submit-button.entry.js.map +1 -0
- package/dist/esm/u-profile_2.entry.js +324 -0
- package/dist/{sdk → esm}/u-registration-button.entry.js +6 -6
- package/dist/esm/u-registration-button.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-reset-password-button.entry.js +10 -10
- package/dist/esm/u-reset-password-button.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-send-magic-code-button.entry.js +10 -10
- package/dist/esm/u-send-magic-code-button.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-signed-in.entry.js +5 -5
- package/dist/esm/u-signed-in.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-signin-root.entry.js +7 -7
- package/dist/esm/u-signin-root.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-signin-step.entry.js +10 -11
- package/dist/esm/u-signin-step.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-signin-strategy.entry.js +5 -5
- package/dist/esm/u-signin-strategy.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-social-login-button.entry.js +6 -6
- package/dist/esm/u-social-login-button.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-spinner.entry.js +3 -3
- package/dist/esm/u-spinner.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-ticketable-list.entry.js +84 -143
- package/dist/esm/u-ticketable-list.entry.js.map +1 -0
- package/dist/esm/unidy-store-BldTAtO0.js +37 -0
- package/dist/{sdk/unidy-store-BwZym11Y.js.map → esm/unidy-store-BldTAtO0.js.map} +1 -1
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/sdk/index.esm.js +2 -22
- package/dist/sdk/index.esm.js.map +1 -1
- package/dist/sdk/loader.esm.js.map +1 -1
- package/dist/sdk/locales/de.json +1 -0
- package/dist/sdk/locales/en.json +1 -0
- package/dist/sdk/locales/fr.json +1 -0
- package/dist/sdk/locales/it.json +1 -0
- package/dist/sdk/locales/nl_be.json +1 -0
- package/dist/sdk/locales/ro.json +1 -0
- package/dist/sdk/p-0ab98e7a.entry.js +2 -0
- package/dist/sdk/p-0ab98e7a.entry.js.map +1 -0
- package/dist/sdk/p-0d324822.entry.js +2 -0
- package/dist/sdk/p-0d324822.entry.js.map +1 -0
- package/dist/sdk/p-0fb37ee9.entry.js +2 -0
- package/dist/sdk/p-0fb37ee9.entry.js.map +1 -0
- package/dist/sdk/p-2cb6a2d0.entry.js +2 -0
- package/dist/sdk/p-2cb6a2d0.entry.js.map +1 -0
- package/dist/sdk/p-3049e73f.entry.js +2 -0
- package/dist/sdk/p-3049e73f.entry.js.map +1 -0
- package/dist/sdk/p-312b919e.entry.js +2 -0
- package/dist/sdk/p-312b919e.entry.js.map +1 -0
- package/dist/sdk/p-319c5d3b.entry.js +2 -0
- package/dist/sdk/p-319c5d3b.entry.js.map +1 -0
- package/dist/sdk/p-34b98f55.entry.js +2 -0
- package/dist/sdk/p-34b98f55.entry.js.map +1 -0
- package/dist/sdk/p-39b61f33.entry.js +2 -0
- package/dist/sdk/p-39b61f33.entry.js.map +1 -0
- package/dist/sdk/p-4ec3302d.entry.js +2 -0
- package/dist/sdk/p-4ec3302d.entry.js.map +1 -0
- package/dist/sdk/p-568eabbc.entry.js +2 -0
- package/dist/sdk/p-568eabbc.entry.js.map +1 -0
- package/dist/sdk/p-5b40a68b.entry.js +2 -0
- package/dist/sdk/p-5b40a68b.entry.js.map +1 -0
- package/dist/sdk/p-5babee6b.entry.js +2 -0
- package/dist/sdk/p-5babee6b.entry.js.map +1 -0
- package/dist/sdk/p-66587fdd.entry.js +2 -0
- package/dist/sdk/p-66587fdd.entry.js.map +1 -0
- package/dist/sdk/p-6893d167.entry.js +2 -0
- package/dist/sdk/p-6893d167.entry.js.map +1 -0
- package/dist/sdk/p-73c2ec89.entry.js +2 -0
- package/dist/sdk/p-73c2ec89.entry.js.map +1 -0
- package/dist/sdk/p-80034205.entry.js +2 -0
- package/dist/sdk/p-80034205.entry.js.map +1 -0
- package/dist/sdk/p-88d93d64.entry.js +2 -0
- package/dist/sdk/p-88d93d64.entry.js.map +1 -0
- package/dist/sdk/p-90e2253e.entry.js +2 -0
- package/dist/sdk/p-90e2253e.entry.js.map +1 -0
- package/dist/sdk/p-9e71a36c.entry.js +2 -0
- package/dist/sdk/p-9e71a36c.entry.js.map +1 -0
- package/dist/sdk/p-BZ1kW_eK.js +2 -0
- package/dist/sdk/p-BZ1kW_eK.js.map +1 -0
- package/dist/sdk/p-BiILQPdb.js +2 -0
- package/dist/sdk/p-BiILQPdb.js.map +1 -0
- package/dist/sdk/p-BlOjABPD.js +2 -0
- package/dist/sdk/p-BlOjABPD.js.map +1 -0
- package/dist/sdk/p-BqFCd65h.js +2 -0
- package/dist/sdk/p-BqFCd65h.js.map +1 -0
- package/dist/sdk/p-C0feI0p8.js +2 -0
- package/dist/sdk/p-C0feI0p8.js.map +1 -0
- package/dist/sdk/p-CFiZLMAA.js +2 -0
- package/dist/sdk/p-CFiZLMAA.js.map +1 -0
- package/dist/sdk/p-CPPYdoIv.js +2 -0
- package/dist/sdk/p-CPPYdoIv.js.map +1 -0
- package/dist/sdk/p-CbRhHGU5.js +2 -0
- package/dist/sdk/p-CbRhHGU5.js.map +1 -0
- package/dist/sdk/p-Ce8zGAi1.js +2 -0
- package/dist/sdk/p-Ce8zGAi1.js.map +1 -0
- package/dist/sdk/p-Ci3aTmzp.js +3 -0
- package/dist/sdk/p-Ci3aTmzp.js.map +1 -0
- package/dist/sdk/p-D1lzXl_Z.js +2 -0
- package/dist/sdk/p-D1lzXl_Z.js.map +1 -0
- package/dist/sdk/p-DA84OuuU.js +2 -0
- package/dist/sdk/p-DA84OuuU.js.map +1 -0
- package/dist/sdk/p-DUHc_Cx7.js +2 -0
- package/dist/sdk/p-DUHc_Cx7.js.map +1 -0
- package/dist/sdk/p-DYtgart8.js +2 -0
- package/dist/sdk/p-DYtgart8.js.map +1 -0
- package/dist/sdk/p-DdUvQelg.js +2 -0
- package/dist/sdk/p-DdUvQelg.js.map +1 -0
- package/dist/sdk/p-PKvQIsOt.js +2 -0
- package/dist/sdk/p-PKvQIsOt.js.map +1 -0
- package/dist/sdk/p-a4f5940f.entry.js +2 -0
- package/dist/sdk/p-a4f5940f.entry.js.map +1 -0
- package/dist/sdk/p-a69b83ec.entry.js +2 -0
- package/dist/sdk/p-a69b83ec.entry.js.map +1 -0
- package/dist/sdk/p-aMrLKr2m.js +2 -0
- package/dist/sdk/p-aMrLKr2m.js.map +1 -0
- package/dist/sdk/p-bfb04b17.entry.js +2 -0
- package/dist/sdk/p-bfb04b17.entry.js.map +1 -0
- package/dist/sdk/p-c6816542.entry.js +2 -0
- package/dist/sdk/p-c6816542.entry.js.map +1 -0
- package/dist/sdk/p-da363474.entry.js +2 -0
- package/dist/sdk/p-da363474.entry.js.map +1 -0
- package/dist/sdk/p-e2e7061b.entry.js +2 -0
- package/dist/sdk/p-e2e7061b.entry.js.map +1 -0
- package/dist/sdk/p-e3f28800.entry.js +2 -0
- package/dist/sdk/p-e3f28800.entry.js.map +1 -0
- package/dist/sdk/p-e54d5d38.entry.js +2 -0
- package/dist/sdk/p-e54d5d38.entry.js.map +1 -0
- package/dist/sdk/p-e81bbd62.entry.js +2 -0
- package/dist/sdk/p-e81bbd62.entry.js.map +1 -0
- package/dist/sdk/p-effaf86b.entry.js +2 -0
- package/dist/sdk/p-effaf86b.entry.js.map +1 -0
- package/dist/sdk/p-f232929b.entry.js +2 -0
- package/dist/sdk/p-f232929b.entry.js.map +1 -0
- package/dist/sdk/p-f961fbea.entry.js +2 -0
- package/dist/sdk/p-f961fbea.entry.js.map +1 -0
- package/dist/sdk/sdk.esm.js +2 -48
- package/dist/sdk/sdk.esm.js.map +1 -1
- package/dist/sdk/u-config.entry.esm.js.map +1 -1
- package/dist/sdk/u-error-message.entry.esm.js.map +1 -1
- package/dist/sdk/u-field.u-raw-field.entry.esm.js.map +1 -0
- package/dist/sdk/u-full-profile.entry.esm.js.map +1 -1
- package/dist/sdk/u-magic-code-field.entry.esm.js.map +1 -1
- package/dist/sdk/u-profile.u-submit-button.entry.esm.js.map +1 -0
- package/dist/sdk/u-signin-step.entry.esm.js.map +1 -1
- package/dist/sdk/u-spinner.entry.esm.js.map +1 -1
- package/dist/sdk/u-ticketable-list.entry.esm.js.map +1 -1
- package/dist/types/auth/api/auth.d.ts +27 -27
- package/dist/types/auth/auth-helpers.d.ts +55 -54
- package/dist/types/auth/store/auth-store.d.ts +3 -3
- package/dist/types/components.d.ts +72 -0
- package/dist/types/profile/api/profile.d.ts +3 -3
- package/dist/types/profile/components/profile/profile.d.ts +15 -0
- package/dist/types/shared/components/error-message/error-message.d.ts +1 -1
- package/dist/types/ticketable/components/ticketable-list/ticketable-list.d.ts +12 -2
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +1 -1
- package/dist/sdk/auth-Che07PeV.js.map +0 -1
- package/dist/sdk/auth-store-CapiC8gJ.js.map +0 -1
- package/dist/sdk/i18n-BCI_ARJL.js.map +0 -1
- package/dist/sdk/index-BqL27K_R.js +0 -49640
- package/dist/sdk/index-BqL27K_R.js.map +0 -1
- package/dist/sdk/index-Cz3idqu9.js.map +0 -1
- package/dist/sdk/index-gEcJztft.js +0 -15349
- package/dist/sdk/index-gEcJztft.js.map +0 -1
- package/dist/sdk/newsletter-helpers-DEXEBD0F.js.map +0 -1
- package/dist/sdk/u-field.entry.esm.js.map +0 -1
- package/dist/sdk/u-profile.entry.esm.js.map +0 -1
- package/dist/sdk/u-raw-field.entry.esm.js.map +0 -1
- package/dist/sdk/u-submit-button.entry.esm.js.map +0 -1
- /package/dist/{sdk → esm}/component-utils-D1lzXl_Z.js +0 -0
- /package/dist/{sdk → esm}/component-utils-D1lzXl_Z.js.map +0 -0
- /package/dist/{sdk → esm}/helpers-BqFCd65h.js +0 -0
- /package/dist/{sdk → esm}/helpers-BqFCd65h.js.map +0 -0
- /package/dist/{sdk → esm}/helpers-DUHc_Cx7.js +0 -0
- /package/dist/{sdk → esm}/helpers-DUHc_Cx7.js.map +0 -0
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { jwtDecode } from "jwt-decode";
|
|
2
|
+
import { authState, authStore } from "../auth/store/auth-store";
|
|
3
|
+
import { t } from "../i18n";
|
|
4
|
+
import { createLogger } from "../logger";
|
|
5
|
+
import { state as profileState } from "../profile/store/profile-store";
|
|
6
|
+
import { clearUrlParam } from "../shared/component-utils";
|
|
7
|
+
import { Flash } from "../shared/store/flash-store";
|
|
8
|
+
import { authenticateWithPasskey } from "./passkey-auth";
|
|
9
|
+
export class AuthHelpers {
|
|
10
|
+
client;
|
|
11
|
+
logger = createLogger("AuthHelpers");
|
|
12
|
+
static PASSWORD_ERROR_IDENTIFIERS = [
|
|
13
|
+
"invalid_password",
|
|
14
|
+
"password_required",
|
|
15
|
+
"password_not_set",
|
|
16
|
+
"passwords_do_not_match",
|
|
17
|
+
];
|
|
18
|
+
constructor(client) {
|
|
19
|
+
this.client = client;
|
|
20
|
+
}
|
|
21
|
+
async createSignIn(email, password, sendMagicCode) {
|
|
22
|
+
if (!email) {
|
|
23
|
+
throw new Error(t("errors.required_field", { field: "Email" }));
|
|
24
|
+
}
|
|
25
|
+
authStore.setLoading(true);
|
|
26
|
+
authStore.clearErrors();
|
|
27
|
+
const [error, response] = await this.client.auth.createSignIn(email, password, sendMagicCode);
|
|
28
|
+
if (error) {
|
|
29
|
+
this.handleAuthError(error, response);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (password) {
|
|
33
|
+
const token = jwtDecode(response.jwt);
|
|
34
|
+
authStore.setSignInId(token.sid);
|
|
35
|
+
authStore.setToken(response.jwt);
|
|
36
|
+
authStore.setLoading(false);
|
|
37
|
+
authStore.getRootComponentRef()?.onAuth(response);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (sendMagicCode) {
|
|
41
|
+
authStore.setSignInId(response.sid);
|
|
42
|
+
authStore.setMagicCodeStep("sent");
|
|
43
|
+
authStore.setStep("magic-code");
|
|
44
|
+
authStore.setLoading(false);
|
|
45
|
+
return [error, response];
|
|
46
|
+
}
|
|
47
|
+
const signInResponse = response;
|
|
48
|
+
authStore.setStep("verification");
|
|
49
|
+
authStore.setEmail(email);
|
|
50
|
+
authStore.setSignInId(signInResponse.sid);
|
|
51
|
+
authStore.setLoginOptions(signInResponse.login_options);
|
|
52
|
+
authStore.setLoading(false);
|
|
53
|
+
}
|
|
54
|
+
async authenticateWithPassword(password) {
|
|
55
|
+
if (!authState.sid) {
|
|
56
|
+
throw new Error(t("errors.no_sign_in_id"));
|
|
57
|
+
}
|
|
58
|
+
if (!password) {
|
|
59
|
+
throw new Error(t("errors.required_field", { field: "Password" }));
|
|
60
|
+
}
|
|
61
|
+
authStore.setLoading(true);
|
|
62
|
+
authStore.clearErrors();
|
|
63
|
+
const [error, response] = await this.client.auth.authenticateWithPassword(authState.sid, password);
|
|
64
|
+
if (error) {
|
|
65
|
+
this.handleAuthError(error, response);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
authStore.setLoading(false);
|
|
69
|
+
this.handleAuthSuccess(response);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
handleAuthError(error, response) {
|
|
74
|
+
switch (error) {
|
|
75
|
+
case "account_not_found":
|
|
76
|
+
authStore.setFieldError("email", error);
|
|
77
|
+
break;
|
|
78
|
+
case "missing_required_fields": {
|
|
79
|
+
authStore.setMissingFields(response.fields);
|
|
80
|
+
profileState.data = response.fields;
|
|
81
|
+
if (response.sid) {
|
|
82
|
+
authStore.setSignInId(response.sid);
|
|
83
|
+
}
|
|
84
|
+
authStore.setStep("missing-fields");
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
default:
|
|
88
|
+
if (AuthHelpers.PASSWORD_ERROR_IDENTIFIERS.includes(error)) {
|
|
89
|
+
authStore.setFieldError("password", error);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
// e.g. "account_locked", "internal_server_error"
|
|
93
|
+
authStore.setGlobalError("auth", error);
|
|
94
|
+
}
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
authStore.setLoading(false);
|
|
98
|
+
}
|
|
99
|
+
async logout() {
|
|
100
|
+
const [error, _] = await this.client.auth.signOut(authState.sid);
|
|
101
|
+
if (error) {
|
|
102
|
+
authStore.setGlobalError("auth", error);
|
|
103
|
+
}
|
|
104
|
+
return [error, _];
|
|
105
|
+
}
|
|
106
|
+
async refreshToken() {
|
|
107
|
+
if (authState.step === "missing-fields") {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
this.extractSignInIdFromQuery();
|
|
111
|
+
if (!authState.sid) {
|
|
112
|
+
this.logger.warn("No sign-in ID in the session");
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const [error, response] = await this.client.auth.refreshToken(authState.sid);
|
|
116
|
+
if (error) {
|
|
117
|
+
authStore.reset();
|
|
118
|
+
authStore.setGlobalError("auth", error);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
authStore.setToken(response.jwt);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
handleSocialAuthRedirect() {
|
|
125
|
+
// missing required fields flow
|
|
126
|
+
const url = new URL(window.location.href);
|
|
127
|
+
const params = url.searchParams;
|
|
128
|
+
const error = params.get("error");
|
|
129
|
+
if (error !== "missing_required_fields") {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const fieldsFromUrl = params.get("fields");
|
|
133
|
+
if (!fieldsFromUrl) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const signInId = params.get("sid");
|
|
137
|
+
if (signInId) {
|
|
138
|
+
authStore.setSignInId(signInId);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
try {
|
|
144
|
+
const fields = JSON.parse(fieldsFromUrl);
|
|
145
|
+
authStore.setMissingFields(fields);
|
|
146
|
+
profileState.data = fields;
|
|
147
|
+
authStore.setStep("missing-fields");
|
|
148
|
+
params.delete("error");
|
|
149
|
+
params.delete("fields");
|
|
150
|
+
const cleanUrl = `${url.origin}${url.pathname}${url.hash}`;
|
|
151
|
+
window.history.replaceState(null, "", cleanUrl);
|
|
152
|
+
}
|
|
153
|
+
catch (e) {
|
|
154
|
+
this.logger.error("Failed to parse missing fields payload:", e);
|
|
155
|
+
authStore.setGlobalError("auth", "invalid_required_fields_payload");
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
async sendMagicCode() {
|
|
159
|
+
if (!authState.sid && authState.step !== "single-login") {
|
|
160
|
+
throw new Error(t("errors.no_sign_in_id"));
|
|
161
|
+
}
|
|
162
|
+
authStore.setMagicCodeStep("requested");
|
|
163
|
+
authStore.setLoading(true);
|
|
164
|
+
authStore.clearErrors();
|
|
165
|
+
if (authState.step === "single-login") {
|
|
166
|
+
const [error, response] = await this.createSignIn(authState.email, undefined, true);
|
|
167
|
+
authStore.setLoading(false);
|
|
168
|
+
return [error, response];
|
|
169
|
+
}
|
|
170
|
+
const [error, response] = await this.client.auth.sendMagicCode(authState.sid);
|
|
171
|
+
authStore.setLoading(false);
|
|
172
|
+
authStore.setStep("magic-code");
|
|
173
|
+
if (!error) {
|
|
174
|
+
authStore.setMagicCodeStep("sent");
|
|
175
|
+
return [null, response];
|
|
176
|
+
}
|
|
177
|
+
authStore.setFieldError("magicCode", error);
|
|
178
|
+
if (error === "magic_code_recently_created") {
|
|
179
|
+
authStore.setMagicCodeStep("sent");
|
|
180
|
+
}
|
|
181
|
+
return [error, response];
|
|
182
|
+
}
|
|
183
|
+
async authenticateWithMagicCode(code) {
|
|
184
|
+
if (!authState.sid) {
|
|
185
|
+
throw new Error(t("errors.no_sign_in_id"));
|
|
186
|
+
}
|
|
187
|
+
if (!code) {
|
|
188
|
+
throw new Error(t("errors.magic_code_is_missing"));
|
|
189
|
+
}
|
|
190
|
+
authStore.setLoading(true);
|
|
191
|
+
authStore.clearErrors();
|
|
192
|
+
const [error, response] = await this.client.auth.authenticateWithMagicCode(authState.sid, code);
|
|
193
|
+
if (!error) {
|
|
194
|
+
this.handleAuthSuccess(response);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (error === "missing_required_fields") {
|
|
198
|
+
this.handleMissingFields(response);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
authStore.setLoading(false);
|
|
202
|
+
authStore.setFieldError("magicCode", error);
|
|
203
|
+
}
|
|
204
|
+
async sendResetPasswordEmail() {
|
|
205
|
+
if (!authState.sid) {
|
|
206
|
+
throw new Error(t("errors.no_sign_in_id"));
|
|
207
|
+
}
|
|
208
|
+
authStore.setLoading(true);
|
|
209
|
+
authStore.setResetPasswordStep("requested");
|
|
210
|
+
const [error, _] = await this.client.auth.sendResetPasswordEmail(authState.sid, window.location.href);
|
|
211
|
+
if (error) {
|
|
212
|
+
authStore.setFieldError("resetPassword", error);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
authStore.setResetPasswordStep("sent");
|
|
216
|
+
authStore.clearErrors();
|
|
217
|
+
}
|
|
218
|
+
authStore.setLoading(false);
|
|
219
|
+
}
|
|
220
|
+
async handleResetPasswordRedirect() {
|
|
221
|
+
const url = new URL(window.location.href);
|
|
222
|
+
const params = url.searchParams;
|
|
223
|
+
const resetToken = params.get("reset_password_token");
|
|
224
|
+
if (!resetToken) {
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
if (authState.sid) {
|
|
228
|
+
authStore.setLoading(true);
|
|
229
|
+
const [error] = await this.client.auth.validateResetPasswordToken(authState.sid, resetToken);
|
|
230
|
+
if (error) {
|
|
231
|
+
authStore.setFieldError("resetPassword", error);
|
|
232
|
+
authStore.setStep("reset-password");
|
|
233
|
+
authStore.setLoading(false);
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
authStore.setResetToken(resetToken);
|
|
238
|
+
authStore.setStep("reset-password");
|
|
239
|
+
authStore.setLoading(false);
|
|
240
|
+
return true;
|
|
241
|
+
}
|
|
242
|
+
async resetPassword() {
|
|
243
|
+
if (!authState.resetPassword.token) {
|
|
244
|
+
throw new Error("No reset token available");
|
|
245
|
+
}
|
|
246
|
+
if (!authState.resetPassword.newPassword) {
|
|
247
|
+
authStore.setFieldError("resetPassword", "password_required");
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
if (authState.resetPassword.passwordConfirmation &&
|
|
251
|
+
authState.resetPassword.newPassword !== authState.resetPassword.passwordConfirmation) {
|
|
252
|
+
authStore.setFieldError("resetPassword", "passwords_do_not_match");
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
authStore.setLoading(true);
|
|
256
|
+
authStore.clearErrors();
|
|
257
|
+
const [error, response] = await this.client.auth.resetPassword(authState.sid, authState.resetPassword.token, authState.resetPassword.newPassword, authState.resetPassword.passwordConfirmation);
|
|
258
|
+
if (error) {
|
|
259
|
+
authStore.setFieldError("resetPassword", error);
|
|
260
|
+
// TODO: add proper password requirements handling --> for now this is fine
|
|
261
|
+
if (error === "invalid_password") {
|
|
262
|
+
authStore.setFieldError("password", response.error_details?.password.map((p) => t(`errors.password_requirements.${p}`)).join("\n"));
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
authStore.setStep("email");
|
|
267
|
+
authStore.updateResetPassword({
|
|
268
|
+
step: "completed",
|
|
269
|
+
token: null,
|
|
270
|
+
newPassword: "",
|
|
271
|
+
passwordConfirmation: "",
|
|
272
|
+
});
|
|
273
|
+
clearUrlParam("reset_password_token");
|
|
274
|
+
Flash.success.addMessage("Password reset successfully");
|
|
275
|
+
}
|
|
276
|
+
authStore.setLoading(false);
|
|
277
|
+
}
|
|
278
|
+
authenticateWithPasskey() {
|
|
279
|
+
return authenticateWithPasskey(this.client, (response) => this.handleAuthSuccess(response));
|
|
280
|
+
}
|
|
281
|
+
extractSignInIdFromQuery() {
|
|
282
|
+
const sid = clearUrlParam("sid");
|
|
283
|
+
if (sid) {
|
|
284
|
+
authStore.setSignInId(sid);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
handleMissingFields(response) {
|
|
288
|
+
authStore.setMissingFields(response.fields);
|
|
289
|
+
profileState.data = response.fields;
|
|
290
|
+
authStore.setStep("missing-fields");
|
|
291
|
+
authStore.setLoading(false);
|
|
292
|
+
}
|
|
293
|
+
handleAuthSuccess(response) {
|
|
294
|
+
authStore.setToken(response.jwt);
|
|
295
|
+
authStore.setLoading(false);
|
|
296
|
+
authStore.getRootComponentRef()?.onAuth(response);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
//# sourceMappingURL=auth-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-helpers.js","sourceRoot":"","sources":["../../src/auth/auth-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,CAAC,EAAE,MAAM,SAAS,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,MAAM,OAAO,WAAW;IACd,MAAM,CAAc;IACpB,MAAM,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC;IAErC,MAAM,CAAU,0BAA0B,GAAG;QACnD,kBAAkB;QAClB,mBAAmB;QACnB,kBAAkB;QAClB,wBAAwB;KACzB,CAAC;I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AC9F,CAAC;IAEO,wBAAwB;QAC9B,MAAM,GAAG,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;QAEjC,IAAI,GAAG,EAAE,CAAC;YACR,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAEO,mBAAmB,CAAC,QAAgC;QAC1D,SAAS,CAAC,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC5C,YAAY,CAAC,IAAI,GAAG,QAAQ,CAAC,MAAoB,CAAC;QAClD,SAAS,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QACpC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAEO,iBAAiB,CAAC,QAAuB;QAC/C,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACjC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAC5B,SAAS,CAAC,mBAAmB,EAAE,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IACpD,CAAC","sourcesContent":["import { jwtDecode } from \"jwt-decode\";\nimport type { CreateSignInResponse, RequiredFieldsResponse, TokenResponse, UnidyClient } from \"../api\";\nimport { authState, authStore } from \"../auth/store/auth-store\";\nimport { t } from \"../i18n\";\nimport { createLogger } from \"../logger\";\nimport type { ProfileRaw } from \"../profile\";\nimport { state as profileState } from \"../profile/store/profile-store\";\nimport { clearUrlParam } from \"../shared/component-utils\";\nimport { Flash } from \"../shared/store/flash-store\";\nimport type { TokenPayload } from \"./auth\";\nimport { authenticateWithPasskey } from \"./passkey-auth\";\n\nexport class AuthHelpers {\n private client: UnidyClient;\n private logger = createLogger(\"AuthHelpers\");\n\n private static readonly PASSWORD_ERROR_IDENTIFIERS = [\n \"invalid_password\",\n \"password_required\",\n \"password_not_set\",\n \"passwords_do_not_match\",\n ];\n\n constructor(client: UnidyClient) {\n this.client = client;\n }\n\n async createSignIn(email: string, password?: string, sendMagicCode?: boolean) {\n if (!email) {\n throw new Error(t(\"errors.required_field\", { field: \"Email\" }));\n }\n\n authStore.setLoading(true);\n authStore.clearErrors();\n\n const [error, response] = await this.client.auth.createSignIn(email, password, sendMagicCode);\n\n if (error) {\n this.handleAuthError(error, response);\n return;\n }\n\n if (password) {\n const token = jwtDecode<TokenPayload>((response as TokenResponse).jwt);\n authStore.setSignInId(token.sid);\n authStore.setToken((response as TokenResponse).jwt);\n authStore.setLoading(false);\n authStore.getRootComponentRef()?.onAuth(response as TokenResponse);\n return;\n }\n\n if (sendMagicCode) {\n authStore.setSignInId((response as CreateSignInResponse).sid);\n authStore.setMagicCodeStep(\"sent\");\n authStore.setStep(\"magic-code\");\n authStore.setLoading(false);\n return [error, response] as const;\n }\n const signInResponse = response as CreateSignInResponse;\n authStore.setStep(\"verification\");\n authStore.setEmail(email);\n authStore.setSignInId(signInResponse.sid);\n authStore.setLoginOptions(signInResponse.login_options);\n authStore.setLoading(false);\n }\n\n async authenticateWithPassword(password: string) {\n if (!authState.sid) {\n throw new Error(t(\"errors.no_sign_in_id\"));\n }\n\n if (!password) {\n throw new Error(t(\"errors.required_field\", { field: \"Password\" }));\n }\n\n authStore.setLoading(true);\n authStore.clearErrors();\n\n const [error, response] = await this.client.auth.authenticateWithPassword(authState.sid, password);\n\n if (error) {\n this.handleAuthError(error, response);\n } else {\n authStore.setLoading(false);\n this.handleAuthSuccess(response as TokenResponse);\n return;\n }\n }\n\n private handleAuthError(error: string, response: unknown) {\n switch (error) {\n case \"account_not_found\":\n authStore.setFieldError(\"email\", error);\n break;\n\n case \"missing_required_fields\": {\n authStore.setMissingFields((response as RequiredFieldsResponse).fields);\n profileState.data = (response as RequiredFieldsResponse).fields as ProfileRaw;\n\n if ((response as RequiredFieldsResponse).sid) {\n authStore.setSignInId((response as RequiredFieldsResponse).sid as string);\n }\n\n authStore.setStep(\"missing-fields\");\n break;\n }\n\n default:\n if (AuthHelpers.PASSWORD_ERROR_IDENTIFIERS.includes(error)) {\n authStore.setFieldError(\"password\", error);\n } else {\n // e.g. \"account_locked\", \"internal_server_error\"\n authStore.setGlobalError(\"auth\", error);\n }\n break;\n }\n\n authStore.setLoading(false);\n }\n\n async logout() {\n const [error, _] = await this.client.auth.signOut(authState.sid as string);\n\n if (error) {\n authStore.setGlobalError(\"auth\", error);\n }\n\n return [error, _] as const;\n }\n\n async refreshToken() {\n if (authState.step === \"missing-fields\") {\n return;\n }\n this.extractSignInIdFromQuery();\n\n if (!authState.sid) {\n this.logger.warn(\"No sign-in ID in the session\");\n return;\n }\n\n const [error, response] = await this.client.auth.refreshToken(authState.sid);\n\n if (error) {\n authStore.reset();\n authStore.setGlobalError(\"auth\", error);\n } else {\n authStore.setToken((response as TokenResponse).jwt);\n }\n }\n\n handleSocialAuthRedirect(): void {\n // missing required fields flow\n const url = new URL(window.location.href);\n const params = url.searchParams;\n const error = params.get(\"error\");\n\n if (error !== \"missing_required_fields\") {\n return;\n }\n\n const fieldsFromUrl = params.get(\"fields\");\n if (!fieldsFromUrl) {\n return;\n }\n\n const signInId = params.get(\"sid\");\n if (signInId) {\n authStore.setSignInId(signInId);\n } else {\n return;\n }\n\n try {\n const fields = JSON.parse(fieldsFromUrl);\n\n authStore.setMissingFields(fields);\n profileState.data = fields as ProfileRaw;\n authStore.setStep(\"missing-fields\");\n\n params.delete(\"error\");\n params.delete(\"fields\");\n const cleanUrl = `${url.origin}${url.pathname}${url.hash}`;\n window.history.replaceState(null, \"\", cleanUrl);\n } catch (e) {\n this.logger.error(\"Failed to parse missing fields payload:\", e);\n authStore.setGlobalError(\"auth\", \"invalid_required_fields_payload\");\n }\n }\n\n async sendMagicCode() {\n if (!authState.sid && authState.step !== \"single-login\") {\n throw new Error(t(\"errors.no_sign_in_id\"));\n }\n\n authStore.setMagicCodeStep(\"requested\");\n authStore.setLoading(true);\n authStore.clearErrors();\n\n if (authState.step === \"single-login\") {\n const [error, response] = await this.createSignIn(authState.email, undefined, true);\n authStore.setLoading(false);\n return [error, response] as const;\n }\n\n const [error, response] = await this.client.auth.sendMagicCode(authState.sid);\n\n authStore.setLoading(false);\n\n authStore.setStep(\"magic-code\");\n\n if (!error) {\n authStore.setMagicCodeStep(\"sent\");\n\n return [null, response] as const;\n }\n\n authStore.setFieldError(\"magicCode\", error);\n\n if (error === \"magic_code_recently_created\") {\n authStore.setMagicCodeStep(\"sent\");\n }\n\n return [error, response] as const;\n }\n\n async authenticateWithMagicCode(code: string) {\n if (!authState.sid) {\n throw new Error(t(\"errors.no_sign_in_id\"));\n }\n\n if (!code) {\n throw new Error(t(\"errors.magic_code_is_missing\"));\n }\n\n authStore.setLoading(true);\n authStore.clearErrors();\n\n const [error, response] = await this.client.auth.authenticateWithMagicCode(authState.sid, code);\n\n if (!error) {\n this.handleAuthSuccess(response as TokenResponse);\n return;\n }\n\n if (error === \"missing_required_fields\") {\n this.handleMissingFields(response as RequiredFieldsResponse);\n return;\n }\n\n authStore.setLoading(false);\n authStore.setFieldError(\"magicCode\", error);\n }\n\n async sendResetPasswordEmail() {\n if (!authState.sid) {\n throw new Error(t(\"errors.no_sign_in_id\"));\n }\n\n authStore.setLoading(true);\n authStore.setResetPasswordStep(\"requested\");\n\n const [error, _] = await this.client.auth.sendResetPasswordEmail(authState.sid, window.location.href);\n\n if (error) {\n authStore.setFieldError(\"resetPassword\", error);\n } else {\n authStore.setResetPasswordStep(\"sent\");\n authStore.clearErrors();\n }\n\n authStore.setLoading(false);\n }\n\n async handleResetPasswordRedirect(): Promise<boolean> {\n const url = new URL(window.location.href);\n const params = url.searchParams;\n const resetToken = params.get(\"reset_password_token\");\n\n if (!resetToken) {\n return false;\n }\n\n if (authState.sid) {\n authStore.setLoading(true);\n\n const [error] = await this.client.auth.validateResetPasswordToken(authState.sid, resetToken);\n\n if (error) {\n authStore.setFieldError(\"resetPassword\", error);\n authStore.setStep(\"reset-password\");\n authStore.setLoading(false);\n return false;\n }\n }\n\n authStore.setResetToken(resetToken);\n authStore.setStep(\"reset-password\");\n authStore.setLoading(false);\n\n return true;\n }\n\n async resetPassword() {\n if (!authState.resetPassword.token) {\n throw new Error(\"No reset token available\");\n }\n\n if (!authState.resetPassword.newPassword) {\n authStore.setFieldError(\"resetPassword\", \"password_required\");\n return;\n }\n\n if (\n authState.resetPassword.passwordConfirmation &&\n authState.resetPassword.newPassword !== authState.resetPassword.passwordConfirmation\n ) {\n authStore.setFieldError(\"resetPassword\", \"passwords_do_not_match\");\n return;\n }\n\n authStore.setLoading(true);\n authStore.clearErrors();\n\n const [error, response] = await this.client.auth.resetPassword(\n authState.sid as string,\n authState.resetPassword.token,\n authState.resetPassword.newPassword,\n authState.resetPassword.passwordConfirmation,\n );\n\n if (error) {\n authStore.setFieldError(\"resetPassword\", error);\n\n // TODO: add proper password requirements handling --> for now this is fine\n if (error === \"invalid_password\") {\n authStore.setFieldError(\"password\", response.error_details?.password.map((p) => t(`errors.password_requirements.${p}`)).join(\"\\n\"));\n }\n } else {\n authStore.setStep(\"email\");\n authStore.updateResetPassword({\n step: \"completed\",\n token: null,\n newPassword: \"\",\n passwordConfirmation: \"\",\n });\n\n clearUrlParam(\"reset_password_token\");\n Flash.success.addMessage(\"Password reset successfully\");\n }\n\n authStore.setLoading(false);\n }\n\n authenticateWithPasskey() {\n return authenticateWithPasskey(this.client, (response) => this.handleAuthSuccess(response));\n }\n\n private extractSignInIdFromQuery() {\n const sid = clearUrlParam(\"sid\");\n\n if (sid) {\n authStore.setSignInId(sid);\n }\n }\n\n private handleMissingFields(response: RequiredFieldsResponse) {\n authStore.setMissingFields(response.fields);\n profileState.data = response.fields as ProfileRaw;\n authStore.setStep(\"missing-fields\");\n authStore.setLoading(false);\n }\n\n private handleAuthSuccess(response: TokenResponse) {\n authStore.setToken(response.jwt);\n authStore.setLoading(false);\n authStore.getRootComponentRef()?.onAuth(response);\n }\n}\n"]}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import * as Sentry from "@sentry/browser";
|
|
2
|
+
import { authStore, authState } from "./store/auth-store";
|
|
3
|
+
import { jwtDecode } from "jwt-decode";
|
|
4
|
+
import { AuthHelpers } from "./auth-helpers";
|
|
5
|
+
import { waitForConfig } from "../shared/store/unidy-store";
|
|
6
|
+
import { getUnidyClient } from "../api";
|
|
7
|
+
import { t } from "../i18n";
|
|
8
|
+
export class Auth {
|
|
9
|
+
static instance;
|
|
10
|
+
helpers;
|
|
11
|
+
constructor(client) {
|
|
12
|
+
this.helpers = new AuthHelpers(client);
|
|
13
|
+
this.helpers.handleSocialAuthRedirect();
|
|
14
|
+
this.helpers.handleResetPasswordRedirect();
|
|
15
|
+
}
|
|
16
|
+
static Errors = {
|
|
17
|
+
email: {
|
|
18
|
+
NOT_FOUND: "account_not_found",
|
|
19
|
+
},
|
|
20
|
+
magicCode: {
|
|
21
|
+
RECENTLY_CREATED: "magic_code_recently_created",
|
|
22
|
+
NOT_VALID: "magic_code_not_valid",
|
|
23
|
+
EXPIRED: "magic_code_expired",
|
|
24
|
+
USED: "magic_code_used",
|
|
25
|
+
},
|
|
26
|
+
password: {
|
|
27
|
+
INVALID: "invalid_password",
|
|
28
|
+
NOT_SET: "password_not_set",
|
|
29
|
+
RESET_PASSWORD_ALREADY_SENT: "reset_password_already_sent",
|
|
30
|
+
},
|
|
31
|
+
general: {
|
|
32
|
+
ACCOUNT_LOCKED: "account_locked",
|
|
33
|
+
SIGN_IN_EXPIRED: "sign_in_expired",
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
static async getInstance() {
|
|
37
|
+
if (!Auth.isInitialized()) {
|
|
38
|
+
await waitForConfig();
|
|
39
|
+
return Auth.initialize(getUnidyClient());
|
|
40
|
+
}
|
|
41
|
+
return Auth.instance;
|
|
42
|
+
}
|
|
43
|
+
static initialize(client) {
|
|
44
|
+
Auth.instance = new Auth(client);
|
|
45
|
+
if (Auth.instance.isTokenValid(authState.token)) {
|
|
46
|
+
authStore.setAuthenticated(true);
|
|
47
|
+
}
|
|
48
|
+
return Auth.instance;
|
|
49
|
+
}
|
|
50
|
+
static isInitialized() {
|
|
51
|
+
return !!Auth.instance;
|
|
52
|
+
}
|
|
53
|
+
isTokenValid(token) {
|
|
54
|
+
try {
|
|
55
|
+
let decoded;
|
|
56
|
+
if (typeof token === "string") {
|
|
57
|
+
decoded = jwtDecode(token);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
decoded = token;
|
|
61
|
+
}
|
|
62
|
+
if (!decoded)
|
|
63
|
+
return false;
|
|
64
|
+
const currentTime = Date.now() / 1000;
|
|
65
|
+
return decoded.exp > currentTime;
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
Sentry.captureException(error);
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async isAuthenticated() {
|
|
73
|
+
const token = await this.getToken();
|
|
74
|
+
return typeof token === "string";
|
|
75
|
+
}
|
|
76
|
+
async getToken() {
|
|
77
|
+
const currentToken = authState.token;
|
|
78
|
+
if (currentToken && this.isTokenValid(currentToken)) {
|
|
79
|
+
return currentToken;
|
|
80
|
+
}
|
|
81
|
+
await this.helpers.refreshToken();
|
|
82
|
+
if (authState.globalErrors.auth || !authState.token) {
|
|
83
|
+
return this.createAuthError(t("errors.refresh_failed"), "REFRESH_FAILED", true);
|
|
84
|
+
}
|
|
85
|
+
return authState.token;
|
|
86
|
+
}
|
|
87
|
+
async userData() {
|
|
88
|
+
const token = await this.getToken();
|
|
89
|
+
if (typeof token !== "string") {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
if (!token) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
return jwtDecode(token);
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
Sentry.captureException(error);
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async logout() {
|
|
104
|
+
const [error, _] = await this.helpers.logout();
|
|
105
|
+
if (error) {
|
|
106
|
+
return this.createAuthError(t("errors.sign_out_failed", { reason: error }), "SIGN_OUT_FAILED", false);
|
|
107
|
+
}
|
|
108
|
+
authStore.reset();
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
getEmail() {
|
|
112
|
+
return authState.email;
|
|
113
|
+
}
|
|
114
|
+
createAuthError(message, code, requiresReauth = false) {
|
|
115
|
+
const error = new Error(message);
|
|
116
|
+
error.code = code;
|
|
117
|
+
error.requiresReauth = requiresReauth;
|
|
118
|
+
return error;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,CAAC,EAAE,MAAM,SAAS,CAAC;AAqB5B,MAAM,OAAO,IAAI;IACP,MAAM,CAAC,QAAQ,CAAO;IAErB,OAAO,CAAc;IAE9B,YAAoB,MAAmB;QACrC,IAAI,CAAC,OAAO,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,CAAC;QACxC,IAAI,CAAC,OAAO,CAAC,2BAA2B,EAAE,CAAC;IAC7C,CAAC;IAED,MAAM,CAAC,MAAM,GAAG;QACd,KAAK,EAAE;YACL,SAAS,EAAE,mBAAmB;SAC/B;QACD,SAAS,EAAE;YACT,gBAAgB,EAAE,6BAA6B;YAC/C,SAAS,EAA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;QACd,CAAC;IACH,CAAC;IAED,KAAK,CAAC,MAAM;QACV,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QAE/C,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,wBAAwB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,iBAAiB,EAAE,KAAK,CAAC,CAAC;QACxG,CAAC;QAED,SAAS,CAAC,KAAK,EAAE,CAAC;QAElB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ;QACN,OAAO,SAAS,CAAC,KAAK,CAAC;IACzB,CAAC;IAEO,eAAe,CAAC,OAAe,EAAE,IAAuB,EAAE,cAAc,GAAG,KAAK;QACtF,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAc,CAAC;QAC9C,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAClB,KAAK,CAAC,cAAc,GAAG,cAAc,CAAC;QAEtC,OAAO,KAAK,CAAC;IACf,CAAC","sourcesContent":["import * as Sentry from \"@sentry/browser\";\nimport type { UnidyClient } from \"../api\";\nimport { authStore, authState } from \"./store/auth-store\";\nimport { jwtDecode } from \"jwt-decode\";\nimport { AuthHelpers } from \"./auth-helpers\";\nimport { waitForConfig } from \"../shared/store/unidy-store\";\nimport { getUnidyClient } from \"../api\";\nimport { t } from \"../i18n\";\n\nexport interface TokenPayload {\n sub: string; // unidy id\n sid: string; // sign-in id\n exp: number;\n iat: number;\n iss: string;\n aud: string;\n nonce: string;\n auth_time: number;\n email: string;\n email_verified: boolean;\n [key: string]: unknown;\n}\n\nexport type AuthError = Error & {\n code: \"TOKEN_EXPIRED\" | \"REFRESH_FAILED\" | \"NO_TOKEN\" | \"INVALID_TOKEN\" | \"SIGN_IN_NOT_FOUND\" | \"SIGN_OUT_FAILED\";\n requiresReauth: boolean;\n};\n\nexport class Auth {\n private static instance: Auth;\n\n readonly helpers: AuthHelpers;\n\n private constructor(client: UnidyClient) {\n this.helpers = new AuthHelpers(client);\n this.helpers.handleSocialAuthRedirect();\n this.helpers.handleResetPasswordRedirect();\n }\n\n static Errors = {\n email: {\n NOT_FOUND: \"account_not_found\",\n },\n magicCode: {\n RECENTLY_CREATED: \"magic_code_recently_created\",\n NOT_VALID: \"magic_code_not_valid\",\n EXPIRED: \"magic_code_expired\",\n USED: \"magic_code_used\",\n },\n password: {\n INVALID: \"invalid_password\",\n NOT_SET: \"password_not_set\",\n RESET_PASSWORD_ALREADY_SENT: \"reset_password_already_sent\",\n },\n general: {\n ACCOUNT_LOCKED: \"account_locked\",\n SIGN_IN_EXPIRED: \"sign_in_expired\",\n },\n } as const;\n\n static async getInstance(): Promise<Auth> {\n if (!Auth.isInitialized()) {\n await waitForConfig();\n\n return Auth.initialize(getUnidyClient());\n }\n\n return Auth.instance;\n }\n\n static initialize(client: UnidyClient): Auth {\n Auth.instance = new Auth(client);\n\n if (Auth.instance.isTokenValid(authState.token)) {\n authStore.setAuthenticated(true);\n }\n\n return Auth.instance;\n }\n\n static isInitialized(): boolean {\n return !!Auth.instance;\n }\n\n isTokenValid(token: string | TokenPayload | null): boolean {\n try {\n let decoded: TokenPayload | null;\n\n if (typeof token === \"string\") {\n decoded = jwtDecode<TokenPayload>(token);\n } else {\n decoded = token;\n }\n\n if (!decoded) return false;\n\n const currentTime = Date.now() / 1000;\n return decoded.exp > currentTime;\n } catch (error) {\n Sentry.captureException(error);\n return false;\n }\n }\n\n async isAuthenticated(): Promise<boolean> {\n const token = await this.getToken();\n return typeof token === \"string\";\n }\n\n async getToken(): Promise<string | AuthError> {\n const currentToken = authState.token;\n\n if (currentToken && this.isTokenValid(currentToken)) {\n return currentToken;\n }\n\n await this.helpers.refreshToken();\n\n if (authState.globalErrors.auth || !authState.token) {\n return this.createAuthError(t(\"errors.refresh_failed\"), \"REFRESH_FAILED\", true);\n }\n\n return authState.token as string;\n }\n\n async userData(): Promise<TokenPayload | null> {\n const token = await this.getToken();\n\n if (typeof token !== \"string\") {\n return null;\n }\n\n if (!token) {\n return null;\n }\n\n try {\n return jwtDecode<TokenPayload>(token);\n } catch (error) {\n Sentry.captureException(error);\n return null;\n }\n }\n\n async logout(): Promise<boolean | AuthError> {\n const [error, _] = await this.helpers.logout();\n\n if (error) {\n return this.createAuthError(t(\"errors.sign_out_failed\", { reason: error }), \"SIGN_OUT_FAILED\", false);\n }\n\n authStore.reset();\n\n return true;\n }\n\n getEmail(): string | null {\n return authState.email;\n }\n\n private createAuthError(message: string, code: AuthError[\"code\"], requiresReauth = false): AuthError {\n const error = new Error(message) as AuthError;\n error.code = code;\n error.requiresReauth = requiresReauth;\n\n return error;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/auth/components/helpers.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,mBAAmB,CAAC,OAAoB;IACtD,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,eAAe,CAA2B,CAAC;IAC9E,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["export function getParentSigninStep(element: HTMLElement): HTMLUSigninStepElement | null {\n const signinStep = element.closest(\"u-signin-step\") as HTMLUSigninStepElement;\n return signinStep;\n}\n"]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { Auth } from "../../auth";
|
|
3
|
+
import { t } from "../../../i18n";
|
|
4
|
+
export class LogoutButton {
|
|
5
|
+
componentClassName = "";
|
|
6
|
+
reloadOnSuccess = true;
|
|
7
|
+
logout;
|
|
8
|
+
handleLogout = async () => {
|
|
9
|
+
const authInstance = await Auth.getInstance();
|
|
10
|
+
const result = await authInstance.logout();
|
|
11
|
+
if (result === true) {
|
|
12
|
+
this.logout.emit();
|
|
13
|
+
if (this.reloadOnSuccess) {
|
|
14
|
+
window.location.reload();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
render() {
|
|
19
|
+
return (h("button", { key: '88a2362402a6194c9dc685adbae55a9ac601e7d5', type: "button", class: this.componentClassName, onClick: this.handleLogout, "aria-live": "polite" }, t("buttons.logout")));
|
|
20
|
+
}
|
|
21
|
+
static get is() { return "u-logout-button"; }
|
|
22
|
+
static get properties() {
|
|
23
|
+
return {
|
|
24
|
+
"componentClassName": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"mutable": false,
|
|
27
|
+
"complexType": {
|
|
28
|
+
"original": "string",
|
|
29
|
+
"resolved": "string",
|
|
30
|
+
"references": {}
|
|
31
|
+
},
|
|
32
|
+
"required": false,
|
|
33
|
+
"optional": false,
|
|
34
|
+
"docs": {
|
|
35
|
+
"tags": [],
|
|
36
|
+
"text": ""
|
|
37
|
+
},
|
|
38
|
+
"getter": false,
|
|
39
|
+
"setter": false,
|
|
40
|
+
"reflect": false,
|
|
41
|
+
"attribute": "class-name",
|
|
42
|
+
"defaultValue": "\"\""
|
|
43
|
+
},
|
|
44
|
+
"reloadOnSuccess": {
|
|
45
|
+
"type": "boolean",
|
|
46
|
+
"mutable": false,
|
|
47
|
+
"complexType": {
|
|
48
|
+
"original": "boolean",
|
|
49
|
+
"resolved": "boolean",
|
|
50
|
+
"references": {}
|
|
51
|
+
},
|
|
52
|
+
"required": false,
|
|
53
|
+
"optional": false,
|
|
54
|
+
"docs": {
|
|
55
|
+
"tags": [],
|
|
56
|
+
"text": ""
|
|
57
|
+
},
|
|
58
|
+
"getter": false,
|
|
59
|
+
"setter": false,
|
|
60
|
+
"reflect": false,
|
|
61
|
+
"attribute": "reload-on-success",
|
|
62
|
+
"defaultValue": "true"
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
static get events() {
|
|
67
|
+
return [{
|
|
68
|
+
"method": "logout",
|
|
69
|
+
"name": "logout",
|
|
70
|
+
"bubbles": true,
|
|
71
|
+
"cancelable": true,
|
|
72
|
+
"composed": true,
|
|
73
|
+
"docs": {
|
|
74
|
+
"tags": [],
|
|
75
|
+
"text": ""
|
|
76
|
+
},
|
|
77
|
+
"complexType": {
|
|
78
|
+
"original": "void",
|
|
79
|
+
"resolved": "void",
|
|
80
|
+
"references": {}
|
|
81
|
+
}
|
|
82
|
+
}];
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=logout-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout-button.js","sourceRoot":"","sources":["../../../../src/auth/components/logout-button/logout-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAqB,KAAK,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAMlC,MAAM,OAAO,YAAY;IACY,kBAAkB,GAAG,EAAE,CAAC;IACnD,eAAe,GAAG,IAAI,CAAC;IAEtB,MAAM,CAAsB;IAE7B,YAAY,GAAG,KAAK,IAAI,EAAE;QAChC,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAE9C,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,MAAM,EAAE,CAAC;QAE3C,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YACpB,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YAEnB,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;gBACzB,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IAEF,MAAM;QACJ,OAAO,CACL,+DAAQ,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAE,IAAI,CAAC,kBAAkB,EAAE,OAAO,EAAE,IAAI,CAAC,YAAY,eAAY,QAAQ,IACjG,CAAC,CAAC,gBAAgB,CAAC,CACb,CACV,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, type EventEmitter, Event } from \"@stencil/core\";\nimport { Auth } from \"../../auth\";\nimport { t } from \"../../../i18n\";\n\n@Component({\n tag: \"u-logout-button\",\n shadow: false,\n})\nexport class LogoutButton {\n @Prop({ attribute: \"class-name\" }) componentClassName = \"\";\n @Prop() reloadOnSuccess = true;\n\n @Event() logout!: EventEmitter<void>;\n\n private handleLogout = async () => {\n const authInstance = await Auth.getInstance();\n\n const result = await authInstance.logout();\n\n if (result === true) {\n this.logout.emit();\n\n if (this.reloadOnSuccess) {\n window.location.reload();\n }\n }\n };\n\n render() {\n return (\n <button type=\"button\" class={this.componentClassName} onClick={this.handleLogout} aria-live=\"polite\">\n {t(\"buttons.logout\")}\n </button>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! 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-border-style:solid;--tw-duration:initial;--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:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@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-color-slate-200:oklch(92.9% .013 255.508);--u-spacing:.25rem;--u-text-lg:1.125rem;--u-text-lg--line-height:1.55556;--u-radius-lg:.5rem;--u-default-transition-duration:.15s;--u-default-transition-timing-function:cubic-bezier(.4,0,.2,1);--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);line-height:1.5;tab-size:4;-webkit-tap-highlight-color:transparent}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: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\:h-\[50px\]{height:50px}.u\:w-\[50px\]{width:50px}.u\:w-full{width:100%}.u\:justify-center{justify-content:center}.u\:gap-0\.5{gap:calc(var(--u-spacing)*.5)}.u\:rounded-lg{border-radius:var(--u-radius-lg)}.u\:border-2{border-style:var(--tw-border-style);border-width:2px}.u\:border-solid{--tw-border-style:solid;border-style:solid}.u\:border-slate-200{border-color:var(--u-color-slate-200)}.u\:text-center{text-align:center}.u\:text-lg{font-size:var(--u-text-lg);line-height:var(--tw-leading,var(--u-text-lg--line-height))}.u\:transition-colors{transition-duration:var(--tw-duration,var(--u-default-transition-duration));transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--u-default-transition-timing-function))}.u\:duration-200{--tw-duration:.2s;transition-duration:.2s}.u\:outline-none{--tw-outline-style:none;outline-style:none}.fixed{position:fixed}.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-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-duration{syntax:"*";inherits:false} /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer properties{}@layer base{}@layer components;@layer utilities{}@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}
|