@unidy.io/sdk 1.1.1-alpha2 → 1.1.2
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/{esm/auth-DLKPv5Zm.js → sdk/auth-Che07PeV.js} +9 -9
- package/dist/{esm/auth-DLKPv5Zm.js.map → sdk/auth-Che07PeV.js.map} +1 -1
- package/dist/{components/auth-store.js → sdk/auth-store-CapiC8gJ.js} +4 -4
- package/dist/{esm/auth-store-BMqUdTpC.js.map → sdk/auth-store-CapiC8gJ.js.map} +1 -1
- package/dist/{components/flash-store.js → sdk/flash-store-DNcSEn2p.js} +4 -3
- package/dist/{esm/flash-store-CEvWSG0c.js.map → sdk/flash-store-DNcSEn2p.js.map} +1 -1
- package/dist/{components/i18n.js → sdk/i18n-BCI_ARJL.js} +25 -5
- package/dist/sdk/i18n-BCI_ARJL.js.map +1 -0
- package/dist/{esm/index-Bjp1XO-f.js → sdk/index-BnBstyfp.js} +3 -3
- package/dist/{esm/index-Bjp1XO-f.js.map → sdk/index-BnBstyfp.js.map} +1 -1
- package/dist/sdk/index-BqL27K_R.js +49640 -0
- package/dist/sdk/index-BqL27K_R.js.map +1 -0
- package/dist/{collection/auth/error-definitions.js → sdk/index-Cz3idqu9.js} +19 -2
- package/dist/sdk/index-Cz3idqu9.js.map +1 -0
- package/dist/sdk/index-gEcJztft.js +15349 -0
- package/dist/sdk/index-gEcJztft.js.map +1 -0
- package/dist/sdk/index.esm.js +22 -2
- 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/{esm/newsletter-helpers-Dh9k-4Ph.js → sdk/newsletter-helpers-DEXEBD0F.js} +16 -9
- package/dist/sdk/newsletter-helpers-DEXEBD0F.js.map +1 -0
- package/dist/sdk/newsletter-store-CvULKmsu.js +39 -0
- package/dist/sdk/newsletter-store-CvULKmsu.js.map +1 -0
- package/dist/{components/profile-helpers.js → sdk/profile-helpers-Bs3aj0CO.js} +4 -4
- package/dist/{esm/profile-helpers-7onubaoR.js.map → sdk/profile-helpers-Bs3aj0CO.js.map} +1 -1
- package/dist/{components/profile-store.js → sdk/profile-store-DD6sq42i.js} +3 -3
- package/dist/{esm/profile-store-RmZB2PTc.js.map → sdk/profile-store-DD6sq42i.js.map} +1 -1
- package/dist/sdk/sdk.esm.js +48 -2
- package/dist/sdk/sdk.esm.js.map +1 -1
- package/dist/sdk/u-conditional-render.entry.esm.js.map +1 -1
- package/dist/{esm → sdk}/u-conditional-render.entry.js +13 -12
- package/dist/sdk/u-config.entry.esm.js.map +1 -1
- package/dist/{esm → sdk}/u-config.entry.js +13 -12
- package/dist/sdk/u-email-field.entry.esm.js.map +1 -1
- package/dist/sdk/u-email-field.entry.js +75 -0
- package/dist/{esm → sdk}/u-error-message.entry.js +7 -7
- package/dist/sdk/u-field.entry.esm.js.map +1 -0
- package/dist/sdk/u-field.entry.js +101 -0
- package/dist/sdk/u-flash-message.entry.esm.js.map +1 -1
- package/dist/sdk/u-flash-message.entry.js +35 -0
- package/dist/sdk/u-full-profile.entry.esm.js.map +1 -1
- package/dist/sdk/u-full-profile.entry.js +35 -0
- package/dist/{esm → sdk}/u-logout-button.entry.js +11 -11
- package/dist/sdk/u-magic-code-field.entry.esm.js.map +1 -1
- package/dist/{esm → sdk}/u-magic-code-field.entry.js +10 -10
- package/dist/{esm → sdk}/u-missing-field.entry.js +5 -5
- package/dist/{esm → sdk}/u-missing-fields-submit-button.entry.js +9 -9
- package/dist/sdk/u-newsletter-checkbox.entry.esm.js.map +1 -1
- package/dist/{esm → sdk}/u-newsletter-checkbox.entry.js +25 -37
- package/dist/{esm → sdk}/u-newsletter-logout-button.entry.js +12 -12
- package/dist/sdk/u-newsletter-preference-checkbox.entry.esm.js.map +1 -1
- package/dist/{esm → sdk}/u-newsletter-preference-checkbox.entry.js +22 -33
- package/dist/sdk/u-newsletter-resend-doi-button.entry.esm.js.map +1 -1
- package/dist/sdk/u-newsletter-resend-doi-button.entry.js +47 -0
- package/dist/sdk/u-newsletter-root.entry.esm.js.map +1 -1
- package/dist/{esm → sdk}/u-newsletter-root.entry.js +19 -33
- package/dist/sdk/u-newsletter-toggle-subscription-button.entry.esm.js.map +1 -1
- package/dist/sdk/u-newsletter-toggle-subscription-button.entry.js +71 -0
- package/dist/{esm → sdk}/u-pagination-button.entry.js +2 -2
- package/dist/{esm → sdk}/u-pagination-page.entry.js +2 -2
- package/dist/{esm → sdk}/u-passkey.entry.js +10 -10
- package/dist/{esm → sdk}/u-password-field.entry.js +6 -6
- package/dist/sdk/u-profile.entry.esm.js.map +1 -0
- package/dist/{components/profile.js → sdk/u-profile.entry.js} +18 -38
- package/dist/sdk/u-raw-field.entry.esm.js.map +1 -0
- package/dist/{components/raw-field.js → sdk/u-raw-field.entry.js} +10 -51
- package/dist/{esm → sdk}/u-registration-button.entry.js +6 -6
- package/dist/{esm → sdk}/u-reset-password-button.entry.js +10 -10
- package/dist/{esm → sdk}/u-send-magic-code-button.entry.js +10 -10
- package/dist/{esm → sdk}/u-signed-in.entry.js +5 -5
- package/dist/{esm → sdk}/u-signin-root.entry.js +7 -7
- package/dist/sdk/u-signin-step.entry.esm.js.map +1 -1
- package/dist/{esm → sdk}/u-signin-step.entry.js +11 -10
- package/dist/{esm → sdk}/u-signin-strategy.entry.js +5 -5
- package/dist/{esm → sdk}/u-social-login-button.entry.js +6 -6
- package/dist/sdk/u-spinner.entry.esm.js.map +1 -1
- package/dist/{esm → sdk}/u-spinner.entry.js +3 -3
- package/dist/sdk/u-submit-button.entry.esm.js.map +1 -0
- package/dist/sdk/u-submit-button.entry.js +204 -0
- package/dist/sdk/u-ticketable-list.entry.esm.js.map +1 -1
- package/dist/{esm → sdk}/u-ticketable-list.entry.js +141 -73
- package/dist/{components/unidy-store.js → sdk/unidy-store-BwZym11Y.js} +4 -3
- package/dist/{esm/unidy-store-BldTAtO0.js.map → sdk/unidy-store-BwZym11Y.js.map} +1 -1
- package/dist/types/components.d.ts +0 -36
- package/dist/types/newsletter/components/newsletter-checkbox/newsletter-checkbox.d.ts +0 -5
- package/dist/types/newsletter/components/newsletter-root/newsletter-root.d.ts +0 -9
- package/dist/types/newsletter/components/preference-checkbox/preference-checkbox.d.ts +0 -5
- package/dist/types/newsletter/newsletter-helpers.d.ts +1 -1
- package/dist/types/newsletter/store/newsletter-store.d.ts +3 -0
- package/dist/types/shared/components/email-field/email-field.d.ts +0 -2
- package/package.json +1 -1
- package/dist/cjs/app-globals-DSKjcXX_.js +0 -10
- package/dist/cjs/app-globals-DSKjcXX_.js.map +0 -1
- package/dist/cjs/auth-BVKZHhXz.js +0 -573
- package/dist/cjs/auth-BVKZHhXz.js.map +0 -1
- package/dist/cjs/auth-store-DC9EVec8.js +0 -184
- package/dist/cjs/auth-store-DC9EVec8.js.map +0 -1
- package/dist/cjs/component-utils-BpMyeVQo.js +0 -35
- package/dist/cjs/component-utils-BpMyeVQo.js.map +0 -1
- package/dist/cjs/flash-store-BuIBuQDx.js +0 -50
- package/dist/cjs/flash-store-BuIBuQDx.js.map +0 -1
- package/dist/cjs/helpers-BcPlKlBG.js +0 -11
- package/dist/cjs/helpers-BcPlKlBG.js.map +0 -1
- package/dist/cjs/helpers-DJyRa0Qo.js +0 -11
- package/dist/cjs/helpers-DJyRa0Qo.js.map +0 -1
- package/dist/cjs/i18n-Xy1So-ba.js +0 -3224
- package/dist/cjs/i18n-Xy1So-ba.js.map +0 -1
- package/dist/cjs/index-B_N5xKgH.js +0 -12025
- package/dist/cjs/index-B_N5xKgH.js.map +0 -1
- package/dist/cjs/index-DLz3FT7T.js +0 -214
- package/dist/cjs/index-DLz3FT7T.js.map +0 -1
- package/dist/cjs/index-DiUlebpf.js +0 -5256
- package/dist/cjs/index-DiUlebpf.js.map +0 -1
- package/dist/cjs/index.cjs.js +0 -64
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/cjs/loader.cjs.js +0 -14
- package/dist/cjs/loader.cjs.js.map +0 -1
- package/dist/cjs/newsletter-helpers-D34j8zxr.js +0 -280
- package/dist/cjs/newsletter-helpers-D34j8zxr.js.map +0 -1
- package/dist/cjs/newsletter-store-dhtu8ywO.js +0 -27
- package/dist/cjs/newsletter-store-dhtu8ywO.js.map +0 -1
- package/dist/cjs/pagination-store-BEiW3MQd.js +0 -16
- package/dist/cjs/pagination-store-BEiW3MQd.js.map +0 -1
- package/dist/cjs/profile-helpers-DrcTgN5n.js +0 -39
- package/dist/cjs/profile-helpers-DrcTgN5n.js.map +0 -1
- package/dist/cjs/profile-store-P_BcYkef.js +0 -22
- package/dist/cjs/profile-store-P_BcYkef.js.map +0 -1
- package/dist/cjs/sdk.cjs.js +0 -26
- package/dist/cjs/sdk.cjs.js.map +0 -1
- package/dist/cjs/u-conditional-render.cjs.entry.js +0 -102
- package/dist/cjs/u-conditional-render.entry.cjs.js.map +0 -1
- package/dist/cjs/u-config.cjs.entry.js +0 -87
- package/dist/cjs/u-config.entry.cjs.js.map +0 -1
- package/dist/cjs/u-email-field.cjs.entry.js +0 -75
- package/dist/cjs/u-email-field.entry.cjs.js.map +0 -1
- package/dist/cjs/u-error-message.cjs.entry.js +0 -82
- package/dist/cjs/u-error-message.entry.cjs.js.map +0 -1
- package/dist/cjs/u-field.u-raw-field.entry.cjs.js.map +0 -1
- package/dist/cjs/u-field_2.cjs.entry.js +0 -375
- package/dist/cjs/u-flash-message.cjs.entry.js +0 -34
- package/dist/cjs/u-flash-message.entry.cjs.js.map +0 -1
- package/dist/cjs/u-full-profile.cjs.entry.js +0 -36
- package/dist/cjs/u-full-profile.entry.cjs.js.map +0 -1
- package/dist/cjs/u-logout-button.cjs.entry.js +0 -38
- package/dist/cjs/u-logout-button.entry.cjs.js.map +0 -1
- package/dist/cjs/u-magic-code-field.cjs.entry.js +0 -91
- package/dist/cjs/u-magic-code-field.entry.cjs.js.map +0 -1
- package/dist/cjs/u-missing-field.cjs.entry.js +0 -22
- package/dist/cjs/u-missing-field.entry.cjs.js.map +0 -1
- package/dist/cjs/u-missing-fields-submit-button.cjs.entry.js +0 -46
- package/dist/cjs/u-missing-fields-submit-button.entry.cjs.js.map +0 -1
- package/dist/cjs/u-newsletter-checkbox.cjs.entry.js +0 -75
- package/dist/cjs/u-newsletter-checkbox.entry.cjs.js.map +0 -1
- package/dist/cjs/u-newsletter-logout-button.cjs.entry.js +0 -36
- package/dist/cjs/u-newsletter-logout-button.entry.cjs.js.map +0 -1
- package/dist/cjs/u-newsletter-preference-checkbox.cjs.entry.js +0 -117
- package/dist/cjs/u-newsletter-preference-checkbox.entry.cjs.js.map +0 -1
- package/dist/cjs/u-newsletter-resend-doi-button.cjs.entry.js +0 -46
- package/dist/cjs/u-newsletter-resend-doi-button.entry.cjs.js.map +0 -1
- package/dist/cjs/u-newsletter-root.cjs.entry.js +0 -86
- package/dist/cjs/u-newsletter-root.entry.cjs.js.map +0 -1
- package/dist/cjs/u-newsletter-toggle-subscription-button.cjs.entry.js +0 -70
- package/dist/cjs/u-newsletter-toggle-subscription-button.entry.cjs.js.map +0 -1
- package/dist/cjs/u-pagination-button.cjs.entry.js +0 -63
- package/dist/cjs/u-pagination-button.entry.cjs.js.map +0 -1
- package/dist/cjs/u-pagination-page.cjs.entry.js +0 -44
- package/dist/cjs/u-pagination-page.entry.cjs.js.map +0 -1
- package/dist/cjs/u-passkey.cjs.entry.js +0 -47
- package/dist/cjs/u-passkey.entry.cjs.js.map +0 -1
- package/dist/cjs/u-password-field.cjs.entry.js +0 -104
- package/dist/cjs/u-password-field.entry.cjs.js.map +0 -1
- package/dist/cjs/u-profile.u-submit-button.entry.cjs.js.map +0 -1
- package/dist/cjs/u-profile_2.cjs.entry.js +0 -311
- package/dist/cjs/u-registration-button.cjs.entry.js +0 -48
- package/dist/cjs/u-registration-button.entry.cjs.js.map +0 -1
- package/dist/cjs/u-reset-password-button.cjs.entry.js +0 -47
- package/dist/cjs/u-reset-password-button.entry.cjs.js.map +0 -1
- package/dist/cjs/u-send-magic-code-button.cjs.entry.js +0 -68
- package/dist/cjs/u-send-magic-code-button.entry.cjs.js.map +0 -1
- package/dist/cjs/u-signed-in.cjs.entry.js +0 -25
- package/dist/cjs/u-signed-in.entry.cjs.js.map +0 -1
- package/dist/cjs/u-signin-root.cjs.entry.js +0 -43
- package/dist/cjs/u-signin-root.entry.cjs.js.map +0 -1
- package/dist/cjs/u-signin-step.cjs.entry.js +0 -66
- package/dist/cjs/u-signin-step.entry.cjs.js.map +0 -1
- package/dist/cjs/u-signin-strategy.cjs.entry.js +0 -30
- package/dist/cjs/u-signin-strategy.entry.cjs.js.map +0 -1
- package/dist/cjs/u-social-login-button.cjs.entry.js +0 -100
- package/dist/cjs/u-social-login-button.entry.cjs.js.map +0 -1
- package/dist/cjs/u-spinner.cjs.entry.js +0 -18
- package/dist/cjs/u-spinner.entry.cjs.js.map +0 -1
- package/dist/cjs/u-ticketable-list.cjs.entry.js +0 -6078
- package/dist/cjs/u-ticketable-list.entry.cjs.js.map +0 -1
- package/dist/cjs/unidy-store-7AbWnZ6g.js +0 -41
- package/dist/cjs/unidy-store-7AbWnZ6g.js.map +0 -1
- package/dist/collection/api/client.js +0 -144
- package/dist/collection/api/client.js.map +0 -1
- package/dist/collection/api/index.js +0 -42
- package/dist/collection/api/index.js.map +0 -1
- package/dist/collection/api/shared.js +0 -18
- package/dist/collection/api/shared.js.map +0 -1
- package/dist/collection/auth/api/auth.js +0 -264
- package/dist/collection/auth/api/auth.js.map +0 -1
- package/dist/collection/auth/auth-helpers.js +0 -291
- package/dist/collection/auth/auth-helpers.js.map +0 -1
- package/dist/collection/auth/auth.js +0 -121
- package/dist/collection/auth/auth.js.map +0 -1
- package/dist/collection/auth/components/helpers.js +0 -5
- package/dist/collection/auth/components/helpers.js.map +0 -1
- package/dist/collection/auth/components/logout-button/logout-button.js +0 -85
- package/dist/collection/auth/components/logout-button/logout-button.js.map +0 -1
- package/dist/collection/auth/components/magic-code-field/magic-code-field.css +0 -1
- package/dist/collection/auth/components/magic-code-field/magic-code-field.js +0 -113
- package/dist/collection/auth/components/magic-code-field/magic-code-field.js.map +0 -1
- package/dist/collection/auth/components/missing-field/missing-field.js +0 -14
- package/dist/collection/auth/components/missing-field/missing-field.js.map +0 -1
- package/dist/collection/auth/components/missing-fields-submit-button/missing-fields-submit-button.js +0 -39
- package/dist/collection/auth/components/missing-fields-submit-button/missing-fields-submit-button.js.map +0 -1
- package/dist/collection/auth/components/passkey/passkey.js +0 -103
- package/dist/collection/auth/components/passkey/passkey.js.map +0 -1
- package/dist/collection/auth/components/password-field/password-field.js +0 -166
- package/dist/collection/auth/components/password-field/password-field.js.map +0 -1
- package/dist/collection/auth/components/registration/registration-button.js +0 -104
- package/dist/collection/auth/components/registration/registration-button.js.map +0 -1
- package/dist/collection/auth/components/reset-pass-button/reset-pass-button.js +0 -59
- package/dist/collection/auth/components/reset-pass-button/reset-pass-button.js.map +0 -1
- package/dist/collection/auth/components/send-magic-code-button/send-magic-code-button.js +0 -104
- package/dist/collection/auth/components/send-magic-code-button/send-magic-code-button.js.map +0 -1
- package/dist/collection/auth/components/signed-in/signed-in.js +0 -59
- package/dist/collection/auth/components/signed-in/signed-in.js.map +0 -1
- package/dist/collection/auth/components/signin-root/signin-root.js +0 -97
- package/dist/collection/auth/components/signin-root/signin-root.js.map +0 -1
- package/dist/collection/auth/components/signin-step/signin-step.js +0 -135
- package/dist/collection/auth/components/signin-step/signin-step.js.map +0 -1
- package/dist/collection/auth/components/signin-strategy/signin-strategy.js +0 -64
- package/dist/collection/auth/components/signin-strategy/signin-strategy.js.map +0 -1
- package/dist/collection/auth/components/social-logins/logos/apple.js +0 -3
- package/dist/collection/auth/components/social-logins/logos/apple.js.map +0 -1
- package/dist/collection/auth/components/social-logins/logos/discord.js +0 -3
- package/dist/collection/auth/components/social-logins/logos/discord.js.map +0 -1
- package/dist/collection/auth/components/social-logins/logos/facebook.js +0 -3
- package/dist/collection/auth/components/social-logins/logos/facebook.js.map +0 -1
- package/dist/collection/auth/components/social-logins/logos/google.js +0 -3
- package/dist/collection/auth/components/social-logins/logos/google.js.map +0 -1
- package/dist/collection/auth/components/social-logins/logos/linkedin.js +0 -3
- package/dist/collection/auth/components/social-logins/logos/linkedin.js.map +0 -1
- package/dist/collection/auth/components/social-logins/social-login-button.css +0 -1
- package/dist/collection/auth/components/social-logins/social-login-button.js +0 -188
- package/dist/collection/auth/components/social-logins/social-login-button.js.map +0 -1
- package/dist/collection/auth/components/submit-button/auth-submit-button.js +0 -62
- package/dist/collection/auth/components/submit-button/auth-submit-button.js.map +0 -1
- package/dist/collection/auth/error-definitions.js.map +0 -1
- package/dist/collection/auth/index.js +0 -14
- package/dist/collection/auth/index.js.map +0 -1
- package/dist/collection/auth/passkey-auth.js +0 -106
- package/dist/collection/auth/passkey-auth.js.map +0 -1
- package/dist/collection/auth/store/auth-store.js +0 -175
- package/dist/collection/auth/store/auth-store.js.map +0 -1
- package/dist/collection/collection-manifest.json +0 -46
- package/dist/collection/globalScript.js +0 -18
- package/dist/collection/globalScript.js.map +0 -1
- package/dist/collection/i18n.js +0 -31
- package/dist/collection/i18n.js.map +0 -1
- package/dist/collection/index.js +0 -16
- package/dist/collection/index.js.map +0 -1
- package/dist/collection/locales/de.json +0 -131
- package/dist/collection/locales/en.json +0 -131
- package/dist/collection/locales/fr.json +0 -131
- package/dist/collection/locales/it.json +0 -131
- package/dist/collection/locales/nl_be.json +0 -131
- package/dist/collection/locales/ro.json +0 -131
- package/dist/collection/logger.js +0 -106
- package/dist/collection/logger.js.map +0 -1
- package/dist/collection/newsletter/api/newsletters.js +0 -189
- package/dist/collection/newsletter/api/newsletters.js.map +0 -1
- package/dist/collection/newsletter/components/helpers.js +0 -5
- package/dist/collection/newsletter/components/helpers.js.map +0 -1
- package/dist/collection/newsletter/components/logout-button/logout-button.js +0 -48
- package/dist/collection/newsletter/components/logout-button/logout-button.js.map +0 -1
- package/dist/collection/newsletter/components/newsletter-checkbox/newsletter-checkbox.js +0 -163
- package/dist/collection/newsletter/components/newsletter-checkbox/newsletter-checkbox.js.map +0 -1
- package/dist/collection/newsletter/components/newsletter-root/newsletter-root.js +0 -164
- package/dist/collection/newsletter/components/newsletter-root/newsletter-root.js.map +0 -1
- package/dist/collection/newsletter/components/preference-checkbox/preference-checkbox.js +0 -231
- package/dist/collection/newsletter/components/preference-checkbox/preference-checkbox.js.map +0 -1
- package/dist/collection/newsletter/components/resend-doi-button/resend-doi-button.js +0 -79
- package/dist/collection/newsletter/components/resend-doi-button/resend-doi-button.js.map +0 -1
- package/dist/collection/newsletter/components/submit-button/newsletter-submit-button.js +0 -19
- package/dist/collection/newsletter/components/submit-button/newsletter-submit-button.js.map +0 -1
- package/dist/collection/newsletter/components/toggle-subscription-button/toggle-subscription-button.js +0 -144
- package/dist/collection/newsletter/components/toggle-subscription-button/toggle-subscription-button.js.map +0 -1
- package/dist/collection/newsletter/index.js +0 -11
- package/dist/collection/newsletter/index.js.map +0 -1
- package/dist/collection/newsletter/newsletter-helpers.js +0 -268
- package/dist/collection/newsletter/newsletter-helpers.js.map +0 -1
- package/dist/collection/newsletter/store/newsletter-store.js +0 -24
- package/dist/collection/newsletter/store/newsletter-store.js.map +0 -1
- package/dist/collection/profile/api/profile.js +0 -156
- package/dist/collection/profile/api/profile.js.map +0 -1
- package/dist/collection/profile/components/field/field.css +0 -1
- package/dist/collection/profile/components/field/field.js +0 -359
- package/dist/collection/profile/components/field/field.js.map +0 -1
- package/dist/collection/profile/components/full-profile/full-profile.css +0 -1
- package/dist/collection/profile/components/full-profile/full-profile.js +0 -77
- package/dist/collection/profile/components/full-profile/full-profile.js.map +0 -1
- package/dist/collection/profile/components/profile/profile.js +0 -189
- package/dist/collection/profile/components/profile/profile.js.map +0 -1
- package/dist/collection/profile/components/raw-field/raw-field.js +0 -697
- package/dist/collection/profile/components/raw-field/raw-field.js.map +0 -1
- package/dist/collection/profile/components/raw-input-fields/Input.js +0 -3
- package/dist/collection/profile/components/raw-input-fields/Input.js.map +0 -1
- package/dist/collection/profile/components/raw-input-fields/MultiSelect.js +0 -8
- package/dist/collection/profile/components/raw-input-fields/MultiSelect.js.map +0 -1
- package/dist/collection/profile/components/raw-input-fields/RadioGroup.js +0 -8
- package/dist/collection/profile/components/raw-input-fields/RadioGroup.js.map +0 -1
- package/dist/collection/profile/components/raw-input-fields/Select.js +0 -11
- package/dist/collection/profile/components/raw-input-fields/Select.js.map +0 -1
- package/dist/collection/profile/components/raw-input-fields/Textarea.js +0 -3
- package/dist/collection/profile/components/raw-input-fields/Textarea.js.map +0 -1
- package/dist/collection/profile/components/submit-button/profile-submit-button.js +0 -17
- package/dist/collection/profile/components/submit-button/profile-submit-button.js.map +0 -1
- package/dist/collection/profile/index.js +0 -13
- package/dist/collection/profile/index.js.map +0 -1
- package/dist/collection/profile/profile-helpers.js +0 -31
- package/dist/collection/profile/profile-helpers.js.map +0 -1
- package/dist/collection/profile/store/profile-store.js +0 -15
- package/dist/collection/profile/store/profile-store.js.map +0 -1
- package/dist/collection/sdk.css +0 -39
- package/dist/collection/shared/component-utils.js +0 -28
- package/dist/collection/shared/component-utils.js.map +0 -1
- package/dist/collection/shared/components/conditional-render/conditional-render.js +0 -177
- package/dist/collection/shared/components/conditional-render/conditional-render.js.map +0 -1
- package/dist/collection/shared/components/config/config.js +0 -260
- package/dist/collection/shared/components/config/config.js.map +0 -1
- package/dist/collection/shared/components/email-field/email-field.js +0 -161
- package/dist/collection/shared/components/email-field/email-field.js.map +0 -1
- package/dist/collection/shared/components/error-message/error-message.js +0 -141
- package/dist/collection/shared/components/error-message/error-message.js.map +0 -1
- package/dist/collection/shared/components/flash-message/close-icon.js +0 -3
- package/dist/collection/shared/components/flash-message/close-icon.js.map +0 -1
- package/dist/collection/shared/components/flash-message/flash-message.js +0 -69
- package/dist/collection/shared/components/flash-message/flash-message.js.map +0 -1
- package/dist/collection/shared/components/spinner/spinner.css +0 -1
- package/dist/collection/shared/components/spinner/spinner.js +0 -19
- package/dist/collection/shared/components/spinner/spinner.js.map +0 -1
- package/dist/collection/shared/components/submit-button/context.js +0 -10
- package/dist/collection/shared/components/submit-button/context.js.map +0 -1
- package/dist/collection/shared/components/submit-button/submit-button.js +0 -186
- package/dist/collection/shared/components/submit-button/submit-button.js.map +0 -1
- package/dist/collection/shared/store/flash-store.js +0 -43
- package/dist/collection/shared/store/flash-store.js.map +0 -1
- package/dist/collection/shared/store/unidy-store.js +0 -33
- package/dist/collection/shared/store/unidy-store.js.map +0 -1
- package/dist/collection/ticketable/api/get-with-schema.js +0 -35
- package/dist/collection/ticketable/api/get-with-schema.js.map +0 -1
- package/dist/collection/ticketable/api/schemas.js +0 -12
- package/dist/collection/ticketable/api/schemas.js.map +0 -1
- package/dist/collection/ticketable/api/subscriptions.js +0 -47
- package/dist/collection/ticketable/api/subscriptions.js.map +0 -1
- package/dist/collection/ticketable/api/tickets.js +0 -48
- package/dist/collection/ticketable/api/tickets.js.map +0 -1
- package/dist/collection/ticketable/components/pagination/pagination-button.js +0 -108
- package/dist/collection/ticketable/components/pagination/pagination-button.js.map +0 -1
- package/dist/collection/ticketable/components/pagination/pagination-page.js +0 -69
- package/dist/collection/ticketable/components/pagination/pagination-page.js.map +0 -1
- package/dist/collection/ticketable/components/ticketable-list/skeleton-helpers.js +0 -54
- package/dist/collection/ticketable/components/ticketable-list/skeleton-helpers.js.map +0 -1
- package/dist/collection/ticketable/components/ticketable-list/ticketable-list.js +0 -442
- package/dist/collection/ticketable/components/ticketable-list/ticketable-list.js.map +0 -1
- package/dist/collection/ticketable/index.js +0 -13
- package/dist/collection/ticketable/index.js.map +0 -1
- package/dist/collection/ticketable/store/pagination-store.js +0 -9
- package/dist/collection/ticketable/store/pagination-store.js.map +0 -1
- package/dist/components/auth-store.js.map +0 -1
- package/dist/components/auth.js +0 -572
- package/dist/components/auth.js.map +0 -1
- package/dist/components/component-utils.js +0 -32
- package/dist/components/component-utils.js.map +0 -1
- package/dist/components/exports.js +0 -4106
- package/dist/components/exports.js.map +0 -1
- package/dist/components/field.js +0 -144
- package/dist/components/field.js.map +0 -1
- package/dist/components/flash-store.js.map +0 -1
- package/dist/components/helpers.js +0 -9
- package/dist/components/helpers.js.map +0 -1
- package/dist/components/helpers2.js +0 -9
- package/dist/components/helpers2.js.map +0 -1
- package/dist/components/i18n.js.map +0 -1
- package/dist/components/index.js +0 -5902
- package/dist/components/index.js.map +0 -1
- package/dist/components/index2.js +0 -5245
- package/dist/components/index2.js.map +0 -1
- package/dist/components/index3.js +0 -212
- package/dist/components/index3.js.map +0 -1
- package/dist/components/logger.js +0 -111
- package/dist/components/logger.js.map +0 -1
- package/dist/components/newsletter-helpers.js +0 -269
- package/dist/components/newsletter-helpers.js.map +0 -1
- package/dist/components/newsletter-store.js +0 -24
- package/dist/components/newsletter-store.js.map +0 -1
- package/dist/components/pagination-store.js +0 -14
- package/dist/components/pagination-store.js.map +0 -1
- package/dist/components/profile-helpers.js.map +0 -1
- package/dist/components/profile-store.js.map +0 -1
- package/dist/components/profile.js.map +0 -1
- package/dist/components/raw-field.js.map +0 -1
- package/dist/components/spinner.js +0 -35
- package/dist/components/spinner.js.map +0 -1
- package/dist/components/submit-button.js +0 -229
- package/dist/components/submit-button.js.map +0 -1
- package/dist/components/u-conditional-render.js +0 -120
- package/dist/components/u-conditional-render.js.map +0 -1
- package/dist/components/u-config.js +0 -113
- package/dist/components/u-config.js.map +0 -1
- package/dist/components/u-email-field.js +0 -98
- package/dist/components/u-email-field.js.map +0 -1
- package/dist/components/u-error-message.js +0 -105
- package/dist/components/u-error-message.js.map +0 -1
- package/dist/components/u-field.js +0 -9
- package/dist/components/u-field.js.map +0 -1
- package/dist/components/u-flash-message.js +0 -55
- package/dist/components/u-flash-message.js.map +0 -1
- package/dist/components/u-full-profile.js +0 -86
- package/dist/components/u-full-profile.js.map +0 -1
- package/dist/components/u-logout-button.js +0 -53
- package/dist/components/u-logout-button.js.map +0 -1
- package/dist/components/u-magic-code-field.js +0 -106
- package/dist/components/u-magic-code-field.js.map +0 -1
- package/dist/components/u-missing-field.js +0 -57
- package/dist/components/u-missing-field.js.map +0 -1
- package/dist/components/u-missing-fields-submit-button.js +0 -70
- package/dist/components/u-missing-fields-submit-button.js.map +0 -1
- package/dist/components/u-newsletter-checkbox.js +0 -91
- package/dist/components/u-newsletter-checkbox.js.map +0 -1
- package/dist/components/u-newsletter-logout-button.js +0 -51
- package/dist/components/u-newsletter-logout-button.js.map +0 -1
- package/dist/components/u-newsletter-preference-checkbox.js +0 -137
- package/dist/components/u-newsletter-preference-checkbox.js.map +0 -1
- package/dist/components/u-newsletter-resend-doi-button.js +0 -67
- package/dist/components/u-newsletter-resend-doi-button.js.map +0 -1
- package/dist/components/u-newsletter-root.js +0 -104
- package/dist/components/u-newsletter-root.js.map +0 -1
- package/dist/components/u-newsletter-toggle-subscription-button.js +0 -94
- package/dist/components/u-newsletter-toggle-subscription-button.js.map +0 -1
- package/dist/components/u-pagination-button.js +0 -86
- package/dist/components/u-pagination-button.js.map +0 -1
- package/dist/components/u-pagination-page.js +0 -66
- package/dist/components/u-pagination-page.js.map +0 -1
- package/dist/components/u-passkey.js +0 -65
- package/dist/components/u-passkey.js.map +0 -1
- package/dist/components/u-password-field.js +0 -125
- package/dist/components/u-password-field.js.map +0 -1
- package/dist/components/u-profile.js +0 -9
- package/dist/components/u-profile.js.map +0 -1
- package/dist/components/u-raw-field.js +0 -9
- package/dist/components/u-raw-field.js.map +0 -1
- package/dist/components/u-registration-button.js +0 -70
- package/dist/components/u-registration-button.js.map +0 -1
- package/dist/components/u-reset-password-button.js +0 -63
- package/dist/components/u-reset-password-button.js.map +0 -1
- package/dist/components/u-send-magic-code-button.js +0 -85
- package/dist/components/u-send-magic-code-button.js.map +0 -1
- package/dist/components/u-signed-in.js +0 -44
- package/dist/components/u-signed-in.js.map +0 -1
- package/dist/components/u-signin-root.js +0 -63
- package/dist/components/u-signin-root.js.map +0 -1
- package/dist/components/u-signin-step.js +0 -84
- package/dist/components/u-signin-step.js.map +0 -1
- package/dist/components/u-signin-strategy.js +0 -50
- package/dist/components/u-signin-strategy.js.map +0 -1
- package/dist/components/u-social-login-button.js +0 -125
- package/dist/components/u-social-login-button.js.map +0 -1
- package/dist/components/u-spinner.js +0 -9
- package/dist/components/u-spinner.js.map +0 -1
- package/dist/components/u-submit-button.js +0 -9
- package/dist/components/u-submit-button.js.map +0 -1
- package/dist/components/u-ticketable-list.js +0 -6113
- package/dist/components/u-ticketable-list.js.map +0 -1
- package/dist/components/unidy-store.js.map +0 -1
- package/dist/esm/app-globals-CPU9ZcqZ.js +0 -8
- package/dist/esm/app-globals-CPU9ZcqZ.js.map +0 -1
- package/dist/esm/auth-store-BMqUdTpC.js +0 -179
- package/dist/esm/flash-store-CEvWSG0c.js +0 -47
- package/dist/esm/i18n-BR-AGAnn.js +0 -3221
- package/dist/esm/i18n-BR-AGAnn.js.map +0 -1
- package/dist/esm/index-Ci3aTmzp.js +0 -12007
- package/dist/esm/index-Ci3aTmzp.js.map +0 -1
- package/dist/esm/index-DKaIwo59.js +0 -5243
- package/dist/esm/index-DKaIwo59.js.map +0 -1
- package/dist/esm/index.js +0 -40
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/loader.js +0 -12
- package/dist/esm/loader.js.map +0 -1
- package/dist/esm/newsletter-helpers-Dh9k-4Ph.js.map +0 -1
- package/dist/esm/newsletter-store-BYmuLQg8.js +0 -24
- package/dist/esm/newsletter-store-BYmuLQg8.js.map +0 -1
- package/dist/esm/pagination-store-DzdJOp-n.js +0 -14
- package/dist/esm/pagination-store-DzdJOp-n.js.map +0 -1
- package/dist/esm/profile-helpers-7onubaoR.js +0 -36
- package/dist/esm/profile-store-RmZB2PTc.js +0 -18
- package/dist/esm/sdk.js +0 -22
- package/dist/esm/sdk.js.map +0 -1
- package/dist/esm/u-conditional-render.entry.js.map +0 -1
- package/dist/esm/u-config.entry.js.map +0 -1
- package/dist/esm/u-email-field.entry.js +0 -73
- package/dist/esm/u-email-field.entry.js.map +0 -1
- package/dist/esm/u-error-message.entry.js.map +0 -1
- package/dist/esm/u-field.u-raw-field.entry.js.map +0 -1
- package/dist/esm/u-field_2.entry.js +0 -372
- package/dist/esm/u-flash-message.entry.js +0 -32
- package/dist/esm/u-flash-message.entry.js.map +0 -1
- package/dist/esm/u-full-profile.entry.js +0 -34
- package/dist/esm/u-full-profile.entry.js.map +0 -1
- package/dist/esm/u-logout-button.entry.js.map +0 -1
- package/dist/esm/u-magic-code-field.entry.js.map +0 -1
- package/dist/esm/u-missing-field.entry.js.map +0 -1
- package/dist/esm/u-missing-fields-submit-button.entry.js.map +0 -1
- package/dist/esm/u-newsletter-checkbox.entry.js.map +0 -1
- package/dist/esm/u-newsletter-logout-button.entry.js.map +0 -1
- package/dist/esm/u-newsletter-preference-checkbox.entry.js.map +0 -1
- package/dist/esm/u-newsletter-resend-doi-button.entry.js +0 -44
- package/dist/esm/u-newsletter-resend-doi-button.entry.js.map +0 -1
- package/dist/esm/u-newsletter-root.entry.js.map +0 -1
- package/dist/esm/u-newsletter-toggle-subscription-button.entry.js +0 -68
- package/dist/esm/u-newsletter-toggle-subscription-button.entry.js.map +0 -1
- package/dist/esm/u-pagination-button.entry.js.map +0 -1
- package/dist/esm/u-pagination-page.entry.js.map +0 -1
- package/dist/esm/u-passkey.entry.js.map +0 -1
- package/dist/esm/u-password-field.entry.js.map +0 -1
- package/dist/esm/u-profile.u-submit-button.entry.js.map +0 -1
- package/dist/esm/u-profile_2.entry.js +0 -308
- package/dist/esm/u-registration-button.entry.js.map +0 -1
- package/dist/esm/u-reset-password-button.entry.js.map +0 -1
- package/dist/esm/u-send-magic-code-button.entry.js.map +0 -1
- package/dist/esm/u-signed-in.entry.js.map +0 -1
- package/dist/esm/u-signin-root.entry.js.map +0 -1
- package/dist/esm/u-signin-step.entry.js.map +0 -1
- package/dist/esm/u-signin-strategy.entry.js.map +0 -1
- package/dist/esm/u-social-login-button.entry.js.map +0 -1
- package/dist/esm/u-spinner.entry.js.map +0 -1
- package/dist/esm/u-ticketable-list.entry.js.map +0 -1
- package/dist/esm/unidy-store-BldTAtO0.js +0 -37
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/sdk/p-10e06612.entry.js +0 -2
- package/dist/sdk/p-10e06612.entry.js.map +0 -1
- package/dist/sdk/p-16f86a4d.entry.js +0 -2
- package/dist/sdk/p-16f86a4d.entry.js.map +0 -1
- package/dist/sdk/p-20240b02.entry.js +0 -2
- package/dist/sdk/p-20240b02.entry.js.map +0 -1
- package/dist/sdk/p-26f3d8db.entry.js +0 -2
- package/dist/sdk/p-26f3d8db.entry.js.map +0 -1
- package/dist/sdk/p-2da4497a.entry.js +0 -2
- package/dist/sdk/p-2da4497a.entry.js.map +0 -1
- package/dist/sdk/p-3f4c947d.entry.js +0 -2
- package/dist/sdk/p-3f4c947d.entry.js.map +0 -1
- package/dist/sdk/p-431ec460.entry.js +0 -2
- package/dist/sdk/p-431ec460.entry.js.map +0 -1
- package/dist/sdk/p-4f54194a.entry.js +0 -2
- package/dist/sdk/p-4f54194a.entry.js.map +0 -1
- package/dist/sdk/p-552056e7.entry.js +0 -2
- package/dist/sdk/p-552056e7.entry.js.map +0 -1
- package/dist/sdk/p-5da49d00.entry.js +0 -2
- package/dist/sdk/p-5da49d00.entry.js.map +0 -1
- package/dist/sdk/p-67096601.entry.js +0 -2
- package/dist/sdk/p-67096601.entry.js.map +0 -1
- package/dist/sdk/p-6893d167.entry.js +0 -2
- package/dist/sdk/p-6893d167.entry.js.map +0 -1
- package/dist/sdk/p-6e3c210c.entry.js +0 -2
- package/dist/sdk/p-6e3c210c.entry.js.map +0 -1
- package/dist/sdk/p-6febeead.entry.js +0 -2
- package/dist/sdk/p-6febeead.entry.js.map +0 -1
- package/dist/sdk/p-73c2ec89.entry.js +0 -2
- package/dist/sdk/p-73c2ec89.entry.js.map +0 -1
- package/dist/sdk/p-745742f1.entry.js +0 -2
- package/dist/sdk/p-745742f1.entry.js.map +0 -1
- package/dist/sdk/p-7a7c0db2.entry.js +0 -2
- package/dist/sdk/p-7a7c0db2.entry.js.map +0 -1
- package/dist/sdk/p-8d787494.entry.js +0 -2
- package/dist/sdk/p-8d787494.entry.js.map +0 -1
- package/dist/sdk/p-94dde7e5.entry.js +0 -2
- package/dist/sdk/p-94dde7e5.entry.js.map +0 -1
- package/dist/sdk/p-97d8ae02.entry.js +0 -2
- package/dist/sdk/p-97d8ae02.entry.js.map +0 -1
- package/dist/sdk/p-9da4dd6d.entry.js +0 -2
- package/dist/sdk/p-9da4dd6d.entry.js.map +0 -1
- package/dist/sdk/p-BZ1kW_eK.js +0 -2
- package/dist/sdk/p-BZ1kW_eK.js.map +0 -1
- package/dist/sdk/p-BlOjABPD.js +0 -2
- package/dist/sdk/p-BlOjABPD.js.map +0 -1
- package/dist/sdk/p-BqFCd65h.js +0 -2
- package/dist/sdk/p-BqFCd65h.js.map +0 -1
- package/dist/sdk/p-C0feI0p8.js +0 -2
- package/dist/sdk/p-C0feI0p8.js.map +0 -1
- package/dist/sdk/p-CDtLILSR.js +0 -2
- package/dist/sdk/p-CDtLILSR.js.map +0 -1
- package/dist/sdk/p-CFiZLMAA.js +0 -2
- package/dist/sdk/p-CFiZLMAA.js.map +0 -1
- package/dist/sdk/p-CR1oWC4S.js +0 -2
- package/dist/sdk/p-CR1oWC4S.js.map +0 -1
- package/dist/sdk/p-Ce8zGAi1.js +0 -2
- package/dist/sdk/p-Ce8zGAi1.js.map +0 -1
- package/dist/sdk/p-Ci3aTmzp.js +0 -3
- package/dist/sdk/p-Ci3aTmzp.js.map +0 -1
- package/dist/sdk/p-D1lzXl_Z.js +0 -2
- package/dist/sdk/p-D1lzXl_Z.js.map +0 -1
- package/dist/sdk/p-D4B6Zkq_.js +0 -2
- package/dist/sdk/p-D4B6Zkq_.js.map +0 -1
- package/dist/sdk/p-D8RGdjD3.js +0 -2
- package/dist/sdk/p-D8RGdjD3.js.map +0 -1
- package/dist/sdk/p-DGqadgLO.js +0 -2
- package/dist/sdk/p-DGqadgLO.js.map +0 -1
- package/dist/sdk/p-DSwwVdp1.js +0 -2
- package/dist/sdk/p-DSwwVdp1.js.map +0 -1
- package/dist/sdk/p-DUHc_Cx7.js +0 -2
- package/dist/sdk/p-DUHc_Cx7.js.map +0 -1
- package/dist/sdk/p-DYtgart8.js +0 -2
- package/dist/sdk/p-DYtgart8.js.map +0 -1
- package/dist/sdk/p-DsSffQBc.js +0 -2
- package/dist/sdk/p-DsSffQBc.js.map +0 -1
- package/dist/sdk/p-b79abe80.entry.js +0 -2
- package/dist/sdk/p-b79abe80.entry.js.map +0 -1
- package/dist/sdk/p-bb5ae222.entry.js +0 -2
- package/dist/sdk/p-bb5ae222.entry.js.map +0 -1
- package/dist/sdk/p-bbbec3d4.entry.js +0 -2
- package/dist/sdk/p-bbbec3d4.entry.js.map +0 -1
- package/dist/sdk/p-c2b6c674.entry.js +0 -2
- package/dist/sdk/p-c2b6c674.entry.js.map +0 -1
- package/dist/sdk/p-c2fba7c8.entry.js +0 -2
- package/dist/sdk/p-c2fba7c8.entry.js.map +0 -1
- package/dist/sdk/p-cba5d81e.entry.js +0 -2
- package/dist/sdk/p-cba5d81e.entry.js.map +0 -1
- package/dist/sdk/p-d2c6179a.entry.js +0 -2
- package/dist/sdk/p-d2c6179a.entry.js.map +0 -1
- package/dist/sdk/p-dcd4e8f0.entry.js +0 -2
- package/dist/sdk/p-dcd4e8f0.entry.js.map +0 -1
- package/dist/sdk/p-eaedb08e.entry.js +0 -2
- package/dist/sdk/p-eaedb08e.entry.js.map +0 -1
- package/dist/sdk/p-f0aecd55.entry.js +0 -2
- package/dist/sdk/p-f0aecd55.entry.js.map +0 -1
- package/dist/sdk/p-fc51c88d.entry.js +0 -2
- package/dist/sdk/p-fc51c88d.entry.js.map +0 -1
- package/dist/sdk/u-field.u-raw-field.entry.esm.js.map +0 -1
- package/dist/sdk/u-profile.u-submit-button.entry.esm.js.map +0 -1
- package/loader/cdn.js +0 -1
- package/loader/index.cjs.js +0 -1
- package/loader/index.d.ts +0 -24
- package/loader/index.es2017.js +0 -1
- package/loader/index.js +0 -2
- /package/dist/{esm → sdk}/component-utils-D1lzXl_Z.js +0 -0
- /package/dist/{esm → sdk}/component-utils-D1lzXl_Z.js.map +0 -0
- /package/dist/{esm → sdk}/helpers-BqFCd65h.js +0 -0
- /package/dist/{esm → sdk}/helpers-BqFCd65h.js.map +0 -0
- /package/dist/{esm → sdk}/helpers-DUHc_Cx7.js +0 -0
- /package/dist/{esm → sdk}/helpers-DUHc_Cx7.js.map +0 -0
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
import { authStore, authState } from "../auth/store/auth-store";
|
|
2
|
-
import { state as profileState } from "../profile/store/profile-store";
|
|
3
|
-
import { Flash } from "../shared/store/flash-store";
|
|
4
|
-
import { clearUrlParam } from "../shared/component-utils";
|
|
5
|
-
import { t } from "../i18n";
|
|
6
|
-
import { authenticateWithPasskey } from "./passkey-auth";
|
|
7
|
-
import { jwtDecode } from "jwt-decode";
|
|
8
|
-
import { createLogger } from "../logger";
|
|
9
|
-
export class AuthHelpers {
|
|
10
|
-
client;
|
|
11
|
-
logger = createLogger("AuthHelpers");
|
|
12
|
-
constructor(client) {
|
|
13
|
-
this.client = client;
|
|
14
|
-
}
|
|
15
|
-
async createSignIn(email, password, sendMagicCode) {
|
|
16
|
-
if (!email) {
|
|
17
|
-
throw new Error(t("errors.required_field", { field: "Email" }));
|
|
18
|
-
}
|
|
19
|
-
authStore.setLoading(true);
|
|
20
|
-
authStore.clearErrors();
|
|
21
|
-
const [error, response] = await this.client.auth.createSignIn(email, password, sendMagicCode);
|
|
22
|
-
if (error) {
|
|
23
|
-
this.handleAuthError(error, response);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (password) {
|
|
27
|
-
const token = jwtDecode(response.jwt);
|
|
28
|
-
authStore.setSignInId(token.sid);
|
|
29
|
-
authStore.setToken(response.jwt);
|
|
30
|
-
authStore.setLoading(false);
|
|
31
|
-
authStore.getRootComponentRef()?.onAuth(response);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (sendMagicCode) {
|
|
35
|
-
authStore.setSignInId(response.sid);
|
|
36
|
-
authStore.setMagicCodeStep("sent");
|
|
37
|
-
authStore.setStep("magic-code");
|
|
38
|
-
authStore.setLoading(false);
|
|
39
|
-
return [error, response];
|
|
40
|
-
}
|
|
41
|
-
const signInResponse = response;
|
|
42
|
-
authStore.setStep("verification");
|
|
43
|
-
authStore.setEmail(email);
|
|
44
|
-
authStore.setSignInId(signInResponse.sid);
|
|
45
|
-
authStore.setLoginOptions(signInResponse.login_options);
|
|
46
|
-
authStore.setLoading(false);
|
|
47
|
-
}
|
|
48
|
-
async authenticateWithPassword(password) {
|
|
49
|
-
if (!authState.sid) {
|
|
50
|
-
throw new Error(t("errors.no_sign_in_id"));
|
|
51
|
-
}
|
|
52
|
-
if (!password) {
|
|
53
|
-
throw new Error(t("errors.required_field", { field: "Password" }));
|
|
54
|
-
}
|
|
55
|
-
authStore.setLoading(true);
|
|
56
|
-
authStore.clearErrors();
|
|
57
|
-
const [error, response] = await this.client.auth.authenticateWithPassword(authState.sid, password);
|
|
58
|
-
if (error) {
|
|
59
|
-
this.handleAuthError(error, response);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
authStore.setLoading(false);
|
|
63
|
-
this.handleAuthSuccess(response);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
handleAuthError(error, response) {
|
|
68
|
-
if (error === "account_not_found") {
|
|
69
|
-
authStore.setFieldError("email", error);
|
|
70
|
-
authStore.setLoading(false);
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
if (error === "missing_required_fields") {
|
|
74
|
-
authStore.setMissingFields(response.fields);
|
|
75
|
-
profileState.data = response.fields;
|
|
76
|
-
if (response.sid) {
|
|
77
|
-
authStore.setSignInId(response.sid);
|
|
78
|
-
}
|
|
79
|
-
authStore.setStep("missing-fields");
|
|
80
|
-
authStore.setLoading(false);
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
if (error === "account_locked") {
|
|
84
|
-
authStore.setGlobalError("auth", error);
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
authStore.setFieldError("password", error);
|
|
88
|
-
}
|
|
89
|
-
authStore.setLoading(false);
|
|
90
|
-
}
|
|
91
|
-
async logout() {
|
|
92
|
-
const [error, _] = await this.client.auth.signOut(authState.sid);
|
|
93
|
-
if (error) {
|
|
94
|
-
authStore.setGlobalError("auth", error);
|
|
95
|
-
}
|
|
96
|
-
return [error, _];
|
|
97
|
-
}
|
|
98
|
-
async refreshToken() {
|
|
99
|
-
if (authState.step === "missing-fields") {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
this.extractSignInIdFromQuery();
|
|
103
|
-
if (!authState.sid) {
|
|
104
|
-
this.logger.warn("No sign-in ID in the session");
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
const [error, response] = await this.client.auth.refreshToken(authState.sid);
|
|
108
|
-
if (error) {
|
|
109
|
-
authStore.reset();
|
|
110
|
-
authStore.setGlobalError("auth", error);
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
authStore.setToken(response.jwt);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
handleSocialAuthRedirect() {
|
|
117
|
-
// missing required fields flow
|
|
118
|
-
const url = new URL(window.location.href);
|
|
119
|
-
const params = url.searchParams;
|
|
120
|
-
const error = params.get("error");
|
|
121
|
-
if (error !== "missing_required_fields") {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
const fieldsFromUrl = params.get("fields");
|
|
125
|
-
if (!fieldsFromUrl) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
const signInId = params.get("sid");
|
|
129
|
-
if (signInId) {
|
|
130
|
-
authStore.setSignInId(signInId);
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
try {
|
|
136
|
-
const fields = JSON.parse(fieldsFromUrl);
|
|
137
|
-
authStore.setMissingFields(fields);
|
|
138
|
-
profileState.data = fields;
|
|
139
|
-
authStore.setStep("missing-fields");
|
|
140
|
-
params.delete("error");
|
|
141
|
-
params.delete("fields");
|
|
142
|
-
const cleanUrl = `${url.origin}${url.pathname}${url.hash}`;
|
|
143
|
-
window.history.replaceState(null, "", cleanUrl);
|
|
144
|
-
}
|
|
145
|
-
catch (e) {
|
|
146
|
-
this.logger.error("Failed to parse missing fields payload:", e);
|
|
147
|
-
authStore.setGlobalError("auth", "invalid_required_fields_payload");
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
async sendMagicCode() {
|
|
151
|
-
if (!authState.sid && authState.step !== "single-login") {
|
|
152
|
-
throw new Error(t("errors.no_sign_in_id"));
|
|
153
|
-
}
|
|
154
|
-
authStore.setMagicCodeStep("requested");
|
|
155
|
-
authStore.setLoading(true);
|
|
156
|
-
authStore.clearErrors();
|
|
157
|
-
if (authState.step === "single-login") {
|
|
158
|
-
const [error, response] = await this.createSignIn(authState.email, undefined, true);
|
|
159
|
-
authStore.setLoading(false);
|
|
160
|
-
return [error, response];
|
|
161
|
-
}
|
|
162
|
-
const [error, response] = await this.client.auth.sendMagicCode(authState.sid);
|
|
163
|
-
authStore.setLoading(false);
|
|
164
|
-
authStore.setStep("magic-code");
|
|
165
|
-
if (!error) {
|
|
166
|
-
authStore.setMagicCodeStep("sent");
|
|
167
|
-
return [null, response];
|
|
168
|
-
}
|
|
169
|
-
authStore.setFieldError("magicCode", error);
|
|
170
|
-
if (error === "magic_code_recently_created") {
|
|
171
|
-
authStore.setMagicCodeStep("sent");
|
|
172
|
-
}
|
|
173
|
-
return [error, response];
|
|
174
|
-
}
|
|
175
|
-
async authenticateWithMagicCode(code) {
|
|
176
|
-
if (!authState.sid) {
|
|
177
|
-
throw new Error(t("errors.no_sign_in_id"));
|
|
178
|
-
}
|
|
179
|
-
if (!code) {
|
|
180
|
-
throw new Error(t("errors.magic_code_is_missing"));
|
|
181
|
-
}
|
|
182
|
-
authStore.setLoading(true);
|
|
183
|
-
authStore.clearErrors();
|
|
184
|
-
const [error, response] = await this.client.auth.authenticateWithMagicCode(authState.sid, code);
|
|
185
|
-
if (!error) {
|
|
186
|
-
this.handleAuthSuccess(response);
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
if (error === "missing_required_fields") {
|
|
190
|
-
this.handleMissingFields(response);
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
authStore.setLoading(false);
|
|
194
|
-
authStore.setFieldError("magicCode", error);
|
|
195
|
-
}
|
|
196
|
-
async sendResetPasswordEmail() {
|
|
197
|
-
if (!authState.sid) {
|
|
198
|
-
throw new Error(t("errors.no_sign_in_id"));
|
|
199
|
-
}
|
|
200
|
-
authStore.setLoading(true);
|
|
201
|
-
authStore.setResetPasswordStep("requested");
|
|
202
|
-
const [error, _] = await this.client.auth.sendResetPasswordEmail(authState.sid, window.location.href);
|
|
203
|
-
if (error) {
|
|
204
|
-
authStore.setFieldError("resetPassword", error);
|
|
205
|
-
}
|
|
206
|
-
else {
|
|
207
|
-
authStore.setResetPasswordStep("sent");
|
|
208
|
-
authStore.clearErrors();
|
|
209
|
-
}
|
|
210
|
-
authStore.setLoading(false);
|
|
211
|
-
}
|
|
212
|
-
async handleResetPasswordRedirect() {
|
|
213
|
-
const url = new URL(window.location.href);
|
|
214
|
-
const params = url.searchParams;
|
|
215
|
-
const resetToken = params.get("reset_password_token");
|
|
216
|
-
if (!resetToken) {
|
|
217
|
-
return false;
|
|
218
|
-
}
|
|
219
|
-
if (authState.sid) {
|
|
220
|
-
authStore.setLoading(true);
|
|
221
|
-
const [error] = await this.client.auth.validateResetPasswordToken(authState.sid, resetToken);
|
|
222
|
-
if (error) {
|
|
223
|
-
authStore.setFieldError("resetPassword", error);
|
|
224
|
-
authStore.setStep("reset-password");
|
|
225
|
-
authStore.setLoading(false);
|
|
226
|
-
return false;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
authStore.setResetToken(resetToken);
|
|
230
|
-
authStore.setStep("reset-password");
|
|
231
|
-
authStore.setLoading(false);
|
|
232
|
-
return true;
|
|
233
|
-
}
|
|
234
|
-
async resetPassword() {
|
|
235
|
-
if (!authState.resetPassword.token) {
|
|
236
|
-
throw new Error("No reset token available");
|
|
237
|
-
}
|
|
238
|
-
if (!authState.resetPassword.newPassword) {
|
|
239
|
-
authStore.setFieldError("resetPassword", "password_required");
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
if (authState.resetPassword.passwordConfirmation &&
|
|
243
|
-
authState.resetPassword.newPassword !== authState.resetPassword.passwordConfirmation) {
|
|
244
|
-
authStore.setFieldError("resetPassword", "passwords_do_not_match");
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
authStore.setLoading(true);
|
|
248
|
-
authStore.clearErrors();
|
|
249
|
-
const [error, response] = await this.client.auth.resetPassword(authState.sid, authState.resetPassword.token, authState.resetPassword.newPassword, authState.resetPassword.passwordConfirmation);
|
|
250
|
-
if (error) {
|
|
251
|
-
authStore.setFieldError("resetPassword", error);
|
|
252
|
-
// TODO: add proper password requirements handling --> for now this is fine
|
|
253
|
-
if (error === "invalid_password") {
|
|
254
|
-
authStore.setFieldError("password", response.error_details?.password.map((p) => t(`errors.password_requirements.${p}`)).join("\n"));
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
else {
|
|
258
|
-
authStore.setStep("email");
|
|
259
|
-
authStore.updateResetPassword({
|
|
260
|
-
step: "completed",
|
|
261
|
-
token: null,
|
|
262
|
-
newPassword: "",
|
|
263
|
-
passwordConfirmation: "",
|
|
264
|
-
});
|
|
265
|
-
clearUrlParam("reset_password_token");
|
|
266
|
-
Flash.success.addMessage("Password reset successfully");
|
|
267
|
-
}
|
|
268
|
-
authStore.setLoading(false);
|
|
269
|
-
}
|
|
270
|
-
authenticateWithPasskey() {
|
|
271
|
-
return authenticateWithPasskey(this.client, (response) => this.handleAuthSuccess(response));
|
|
272
|
-
}
|
|
273
|
-
extractSignInIdFromQuery() {
|
|
274
|
-
const sid = clearUrlParam("sid");
|
|
275
|
-
if (sid) {
|
|
276
|
-
authStore.setSignInId(sid);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
handleMissingFields(response) {
|
|
280
|
-
authStore.setMissingFields(response.fields);
|
|
281
|
-
profileState.data = response.fields;
|
|
282
|
-
authStore.setStep("missing-fields");
|
|
283
|
-
authStore.setLoading(false);
|
|
284
|
-
}
|
|
285
|
-
handleAuthSuccess(response) {
|
|
286
|
-
authStore.setToken(response.jwt);
|
|
287
|
-
authStore.setLoading(false);
|
|
288
|
-
authStore.getRootComponentRef()?.onAuth(response);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
//# sourceMappingURL=auth-helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-helpers.js","sourceRoot":"","sources":["../../src/auth/auth-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAGhE,OAAO,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,SAAS,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,OAAO,WAAW;IACd,MAAM,CAAc;IACpB,MAAM,GAAG,YAAY,CAAC,aAAa,CAAC,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AAQ,CAAC,CAAC,CAAC;IAC9F,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;CACF","sourcesContent":["import { authStore, authState } from \"../auth/store/auth-store\";\nimport type { CreateSignInResponse, RequiredFieldsResponse, TokenResponse, UnidyClient } from \"../api\";\nimport type { ProfileRaw } from \"../profile\";\nimport { state as profileState } from \"../profile/store/profile-store\";\nimport { Flash } from \"../shared/store/flash-store\";\nimport { clearUrlParam } from \"../shared/component-utils\";\nimport { t } from \"../i18n\";\nimport { authenticateWithPasskey } from \"./passkey-auth\";\nimport { jwtDecode } from \"jwt-decode\";\nimport type { TokenPayload } from \"./auth\";\nimport { createLogger } from \"../logger\";\n\nexport class AuthHelpers {\n private client: UnidyClient;\n private logger = createLogger(\"AuthHelpers\");\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 if (error === \"account_not_found\") {\n authStore.setFieldError(\"email\", error);\n authStore.setLoading(false);\n return;\n }\n if (error === \"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 authStore.setLoading(false);\n return;\n }\n if (error === \"account_locked\") {\n authStore.setGlobalError(\"auth\", error);\n } else {\n authStore.setFieldError(\"password\", error);\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"]}
|
|
@@ -1,121 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAE,sBAAsB;YACjC,OAAO,EAAE,oBAAoB;YAC7B,IAAI,EAAE,iBAAiB;SACxB;QACD,QAAQ,EAAE;YACR,OAAO,EAAE,kBAAkB;YA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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"]}
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
|
@@ -1,85 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
|
@@ -1 +0,0 @@
|
|
|
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}
|