@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
package/dist/components/auth.js
DELETED
|
@@ -1,572 +0,0 @@
|
|
|
1
|
-
import { a as authStore, s as state } from './auth-store.js';
|
|
2
|
-
import { s as state$1 } from './profile-store.js';
|
|
3
|
-
import { F as Flash } from './flash-store.js';
|
|
4
|
-
import { c as clearUrlParam } from './component-utils.js';
|
|
5
|
-
import { t } from './i18n.js';
|
|
6
|
-
import { c as createLogger } from './logger.js';
|
|
7
|
-
import { w as waitForConfig } from './unidy-store.js';
|
|
8
|
-
import { g as getUnidyClient } from './index2.js';
|
|
9
|
-
import { Y as captureException } from './exports.js';
|
|
10
|
-
|
|
11
|
-
class InvalidTokenError extends Error {
|
|
12
|
-
}
|
|
13
|
-
InvalidTokenError.prototype.name = "InvalidTokenError";
|
|
14
|
-
function b64DecodeUnicode(str) {
|
|
15
|
-
return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {
|
|
16
|
-
let code = p.charCodeAt(0).toString(16).toUpperCase();
|
|
17
|
-
if (code.length < 2) {
|
|
18
|
-
code = "0" + code;
|
|
19
|
-
}
|
|
20
|
-
return "%" + code;
|
|
21
|
-
}));
|
|
22
|
-
}
|
|
23
|
-
function base64UrlDecode(str) {
|
|
24
|
-
let output = str.replace(/-/g, "+").replace(/_/g, "/");
|
|
25
|
-
switch (output.length % 4) {
|
|
26
|
-
case 0:
|
|
27
|
-
break;
|
|
28
|
-
case 2:
|
|
29
|
-
output += "==";
|
|
30
|
-
break;
|
|
31
|
-
case 3:
|
|
32
|
-
output += "=";
|
|
33
|
-
break;
|
|
34
|
-
default:
|
|
35
|
-
throw new Error("base64 string is not of the correct length");
|
|
36
|
-
}
|
|
37
|
-
try {
|
|
38
|
-
return b64DecodeUnicode(output);
|
|
39
|
-
}
|
|
40
|
-
catch (err) {
|
|
41
|
-
return atob(output);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
function jwtDecode(token, options) {
|
|
45
|
-
if (typeof token !== "string") {
|
|
46
|
-
throw new InvalidTokenError("Invalid token specified: must be a string");
|
|
47
|
-
}
|
|
48
|
-
options || (options = {});
|
|
49
|
-
const pos = options.header === true ? 0 : 1;
|
|
50
|
-
const part = token.split(".")[pos];
|
|
51
|
-
if (typeof part !== "string") {
|
|
52
|
-
throw new InvalidTokenError(`Invalid token specified: missing part #${pos + 1}`);
|
|
53
|
-
}
|
|
54
|
-
let decoded;
|
|
55
|
-
try {
|
|
56
|
-
decoded = base64UrlDecode(part);
|
|
57
|
-
}
|
|
58
|
-
catch (e) {
|
|
59
|
-
throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${pos + 1} (${e.message})`);
|
|
60
|
-
}
|
|
61
|
-
try {
|
|
62
|
-
return JSON.parse(decoded);
|
|
63
|
-
}
|
|
64
|
-
catch (e) {
|
|
65
|
-
throw new InvalidTokenError(`Invalid token specified: invalid json for part #${pos + 1} (${e.message})`);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const logger = createLogger("PasskeyAuth");
|
|
70
|
-
const PASSKEY_ERRORS = {
|
|
71
|
-
NotSupportedError: "passkey_not_supported",
|
|
72
|
-
NotAllowedError: "passkey_cancelled",
|
|
73
|
-
SecurityError: "passkey_security_error",
|
|
74
|
-
InvalidStateError: "passkey_invalid_state",
|
|
75
|
-
};
|
|
76
|
-
function decodeBase64Url(base64url) {
|
|
77
|
-
const base64 = base64url.replace(/-/g, "+").replace(/_/g, "/");
|
|
78
|
-
const padded = base64 + "=".repeat((4 - (base64.length % 4)) % 4);
|
|
79
|
-
return Uint8Array.from(atob(padded), (c) => c.charCodeAt(0));
|
|
80
|
-
}
|
|
81
|
-
function buildPublicKeyOptions(options) {
|
|
82
|
-
return {
|
|
83
|
-
challenge: Uint8Array.from(atob(options.challenge), (c) => c.charCodeAt(0)),
|
|
84
|
-
timeout: options.timeout || 60000,
|
|
85
|
-
rpId: options.rpId,
|
|
86
|
-
userVerification: options.userVerification || "required",
|
|
87
|
-
allowCredentials: options.allowCredentials?.map((cred) => ({
|
|
88
|
-
...cred,
|
|
89
|
-
id: decodeBase64Url(cred.id),
|
|
90
|
-
})),
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
function formatCredentialForServer(credential) {
|
|
94
|
-
const response = credential.response;
|
|
95
|
-
return {
|
|
96
|
-
id: credential.id,
|
|
97
|
-
rawId: btoa(String.fromCharCode(...new Uint8Array(credential.rawId))),
|
|
98
|
-
response: {
|
|
99
|
-
authenticatorData: btoa(String.fromCharCode(...new Uint8Array(response.authenticatorData))),
|
|
100
|
-
clientDataJSON: btoa(String.fromCharCode(...new Uint8Array(response.clientDataJSON))),
|
|
101
|
-
signature: btoa(String.fromCharCode(...new Uint8Array(response.signature))),
|
|
102
|
-
},
|
|
103
|
-
type: credential.type,
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
function extractAndSetSignInId(tokenResponse) {
|
|
107
|
-
if (tokenResponse.sid) {
|
|
108
|
-
authStore.setSignInId(tokenResponse.sid);
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
// Fallback: extract sid from JWT token payload
|
|
112
|
-
try {
|
|
113
|
-
const decoded = jwtDecode(tokenResponse.jwt);
|
|
114
|
-
if (decoded.sid) {
|
|
115
|
-
authStore.setSignInId(decoded.sid);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
catch {
|
|
119
|
-
// Failed to decode JWT token to extract sid, continue without it
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
function handlePasskeyError(error) {
|
|
123
|
-
logger.error("Passkey error:", error);
|
|
124
|
-
let errorMessage = "passkey_error";
|
|
125
|
-
if (error instanceof DOMException) {
|
|
126
|
-
errorMessage = PASSKEY_ERRORS[error.name] || "passkey_error";
|
|
127
|
-
}
|
|
128
|
-
authStore.setGlobalError("auth", errorMessage);
|
|
129
|
-
authStore.setLoading(false);
|
|
130
|
-
}
|
|
131
|
-
async function authenticateWithPasskey(client, onSuccess) {
|
|
132
|
-
authStore.setLoading(true);
|
|
133
|
-
authStore.clearErrors();
|
|
134
|
-
if (!window.PublicKeyCredential) {
|
|
135
|
-
authStore.setGlobalError("auth", "passkey_not_supported");
|
|
136
|
-
authStore.setLoading(false);
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
try {
|
|
140
|
-
const [optionsError, options] = await client.auth.getPasskeyOptions(state.sid || undefined);
|
|
141
|
-
if (optionsError || !options) {
|
|
142
|
-
authStore.setGlobalError("auth", optionsError || "bad_request");
|
|
143
|
-
authStore.setLoading(false);
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
const publicKeyOptions = buildPublicKeyOptions(options);
|
|
147
|
-
const credential = (await navigator.credentials.get({
|
|
148
|
-
publicKey: publicKeyOptions,
|
|
149
|
-
}));
|
|
150
|
-
if (!credential) {
|
|
151
|
-
authStore.setGlobalError("auth", "passkey_cancelled");
|
|
152
|
-
authStore.setLoading(false);
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
const formattedCredential = formatCredentialForServer(credential);
|
|
156
|
-
const [verifyError, tkResponse] = await client.auth.authenticateWithPasskey(formattedCredential);
|
|
157
|
-
const tokenResponse = tkResponse;
|
|
158
|
-
if (verifyError || !tokenResponse) {
|
|
159
|
-
authStore.setGlobalError("auth", verifyError || "authentication_failed");
|
|
160
|
-
authStore.setLoading(false);
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
authStore.setToken(tokenResponse.jwt);
|
|
164
|
-
extractAndSetSignInId(tokenResponse);
|
|
165
|
-
onSuccess(tokenResponse);
|
|
166
|
-
}
|
|
167
|
-
catch (error) {
|
|
168
|
-
handlePasskeyError(error);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
class AuthHelpers {
|
|
173
|
-
client;
|
|
174
|
-
logger = createLogger("AuthHelpers");
|
|
175
|
-
constructor(client) {
|
|
176
|
-
this.client = client;
|
|
177
|
-
}
|
|
178
|
-
async createSignIn(email, password, sendMagicCode) {
|
|
179
|
-
if (!email) {
|
|
180
|
-
throw new Error(t("errors.required_field", { field: "Email" }));
|
|
181
|
-
}
|
|
182
|
-
authStore.setLoading(true);
|
|
183
|
-
authStore.clearErrors();
|
|
184
|
-
const [error, response] = await this.client.auth.createSignIn(email, password, sendMagicCode);
|
|
185
|
-
if (error) {
|
|
186
|
-
this.handleAuthError(error, response);
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
if (password) {
|
|
190
|
-
const token = jwtDecode(response.jwt);
|
|
191
|
-
authStore.setSignInId(token.sid);
|
|
192
|
-
authStore.setToken(response.jwt);
|
|
193
|
-
authStore.setLoading(false);
|
|
194
|
-
authStore.getRootComponentRef()?.onAuth(response);
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
if (sendMagicCode) {
|
|
198
|
-
authStore.setSignInId(response.sid);
|
|
199
|
-
authStore.setMagicCodeStep("sent");
|
|
200
|
-
authStore.setStep("magic-code");
|
|
201
|
-
authStore.setLoading(false);
|
|
202
|
-
return [error, response];
|
|
203
|
-
}
|
|
204
|
-
const signInResponse = response;
|
|
205
|
-
authStore.setStep("verification");
|
|
206
|
-
authStore.setEmail(email);
|
|
207
|
-
authStore.setSignInId(signInResponse.sid);
|
|
208
|
-
authStore.setLoginOptions(signInResponse.login_options);
|
|
209
|
-
authStore.setLoading(false);
|
|
210
|
-
}
|
|
211
|
-
async authenticateWithPassword(password) {
|
|
212
|
-
if (!state.sid) {
|
|
213
|
-
throw new Error(t("errors.no_sign_in_id"));
|
|
214
|
-
}
|
|
215
|
-
if (!password) {
|
|
216
|
-
throw new Error(t("errors.required_field", { field: "Password" }));
|
|
217
|
-
}
|
|
218
|
-
authStore.setLoading(true);
|
|
219
|
-
authStore.clearErrors();
|
|
220
|
-
const [error, response] = await this.client.auth.authenticateWithPassword(state.sid, password);
|
|
221
|
-
if (error) {
|
|
222
|
-
this.handleAuthError(error, response);
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
authStore.setLoading(false);
|
|
226
|
-
this.handleAuthSuccess(response);
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
handleAuthError(error, response) {
|
|
231
|
-
if (error === "account_not_found") {
|
|
232
|
-
authStore.setFieldError("email", error);
|
|
233
|
-
authStore.setLoading(false);
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
if (error === "missing_required_fields") {
|
|
237
|
-
authStore.setMissingFields(response.fields);
|
|
238
|
-
state$1.data = response.fields;
|
|
239
|
-
if (response.sid) {
|
|
240
|
-
authStore.setSignInId(response.sid);
|
|
241
|
-
}
|
|
242
|
-
authStore.setStep("missing-fields");
|
|
243
|
-
authStore.setLoading(false);
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
if (error === "account_locked") {
|
|
247
|
-
authStore.setGlobalError("auth", error);
|
|
248
|
-
}
|
|
249
|
-
else {
|
|
250
|
-
authStore.setFieldError("password", error);
|
|
251
|
-
}
|
|
252
|
-
authStore.setLoading(false);
|
|
253
|
-
}
|
|
254
|
-
async logout() {
|
|
255
|
-
const [error, _] = await this.client.auth.signOut(state.sid);
|
|
256
|
-
if (error) {
|
|
257
|
-
authStore.setGlobalError("auth", error);
|
|
258
|
-
}
|
|
259
|
-
return [error, _];
|
|
260
|
-
}
|
|
261
|
-
async refreshToken() {
|
|
262
|
-
if (state.step === "missing-fields") {
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
this.extractSignInIdFromQuery();
|
|
266
|
-
if (!state.sid) {
|
|
267
|
-
this.logger.warn("No sign-in ID in the session");
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
const [error, response] = await this.client.auth.refreshToken(state.sid);
|
|
271
|
-
if (error) {
|
|
272
|
-
authStore.reset();
|
|
273
|
-
authStore.setGlobalError("auth", error);
|
|
274
|
-
}
|
|
275
|
-
else {
|
|
276
|
-
authStore.setToken(response.jwt);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
handleSocialAuthRedirect() {
|
|
280
|
-
// missing required fields flow
|
|
281
|
-
const url = new URL(window.location.href);
|
|
282
|
-
const params = url.searchParams;
|
|
283
|
-
const error = params.get("error");
|
|
284
|
-
if (error !== "missing_required_fields") {
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
const fieldsFromUrl = params.get("fields");
|
|
288
|
-
if (!fieldsFromUrl) {
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
const signInId = params.get("sid");
|
|
292
|
-
if (signInId) {
|
|
293
|
-
authStore.setSignInId(signInId);
|
|
294
|
-
}
|
|
295
|
-
else {
|
|
296
|
-
return;
|
|
297
|
-
}
|
|
298
|
-
try {
|
|
299
|
-
const fields = JSON.parse(fieldsFromUrl);
|
|
300
|
-
authStore.setMissingFields(fields);
|
|
301
|
-
state$1.data = fields;
|
|
302
|
-
authStore.setStep("missing-fields");
|
|
303
|
-
params.delete("error");
|
|
304
|
-
params.delete("fields");
|
|
305
|
-
const cleanUrl = `${url.origin}${url.pathname}${url.hash}`;
|
|
306
|
-
window.history.replaceState(null, "", cleanUrl);
|
|
307
|
-
}
|
|
308
|
-
catch (e) {
|
|
309
|
-
this.logger.error("Failed to parse missing fields payload:", e);
|
|
310
|
-
authStore.setGlobalError("auth", "invalid_required_fields_payload");
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
async sendMagicCode() {
|
|
314
|
-
if (!state.sid && state.step !== "single-login") {
|
|
315
|
-
throw new Error(t("errors.no_sign_in_id"));
|
|
316
|
-
}
|
|
317
|
-
authStore.setMagicCodeStep("requested");
|
|
318
|
-
authStore.setLoading(true);
|
|
319
|
-
authStore.clearErrors();
|
|
320
|
-
if (state.step === "single-login") {
|
|
321
|
-
const [error, response] = await this.createSignIn(state.email, undefined, true);
|
|
322
|
-
authStore.setLoading(false);
|
|
323
|
-
return [error, response];
|
|
324
|
-
}
|
|
325
|
-
const [error, response] = await this.client.auth.sendMagicCode(state.sid);
|
|
326
|
-
authStore.setLoading(false);
|
|
327
|
-
authStore.setStep("magic-code");
|
|
328
|
-
if (!error) {
|
|
329
|
-
authStore.setMagicCodeStep("sent");
|
|
330
|
-
return [null, response];
|
|
331
|
-
}
|
|
332
|
-
authStore.setFieldError("magicCode", error);
|
|
333
|
-
if (error === "magic_code_recently_created") {
|
|
334
|
-
authStore.setMagicCodeStep("sent");
|
|
335
|
-
}
|
|
336
|
-
return [error, response];
|
|
337
|
-
}
|
|
338
|
-
async authenticateWithMagicCode(code) {
|
|
339
|
-
if (!state.sid) {
|
|
340
|
-
throw new Error(t("errors.no_sign_in_id"));
|
|
341
|
-
}
|
|
342
|
-
if (!code) {
|
|
343
|
-
throw new Error(t("errors.magic_code_is_missing"));
|
|
344
|
-
}
|
|
345
|
-
authStore.setLoading(true);
|
|
346
|
-
authStore.clearErrors();
|
|
347
|
-
const [error, response] = await this.client.auth.authenticateWithMagicCode(state.sid, code);
|
|
348
|
-
if (!error) {
|
|
349
|
-
this.handleAuthSuccess(response);
|
|
350
|
-
return;
|
|
351
|
-
}
|
|
352
|
-
if (error === "missing_required_fields") {
|
|
353
|
-
this.handleMissingFields(response);
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
authStore.setLoading(false);
|
|
357
|
-
authStore.setFieldError("magicCode", error);
|
|
358
|
-
}
|
|
359
|
-
async sendResetPasswordEmail() {
|
|
360
|
-
if (!state.sid) {
|
|
361
|
-
throw new Error(t("errors.no_sign_in_id"));
|
|
362
|
-
}
|
|
363
|
-
authStore.setLoading(true);
|
|
364
|
-
authStore.setResetPasswordStep("requested");
|
|
365
|
-
const [error, _] = await this.client.auth.sendResetPasswordEmail(state.sid, window.location.href);
|
|
366
|
-
if (error) {
|
|
367
|
-
authStore.setFieldError("resetPassword", error);
|
|
368
|
-
}
|
|
369
|
-
else {
|
|
370
|
-
authStore.setResetPasswordStep("sent");
|
|
371
|
-
authStore.clearErrors();
|
|
372
|
-
}
|
|
373
|
-
authStore.setLoading(false);
|
|
374
|
-
}
|
|
375
|
-
async handleResetPasswordRedirect() {
|
|
376
|
-
const url = new URL(window.location.href);
|
|
377
|
-
const params = url.searchParams;
|
|
378
|
-
const resetToken = params.get("reset_password_token");
|
|
379
|
-
if (!resetToken) {
|
|
380
|
-
return false;
|
|
381
|
-
}
|
|
382
|
-
if (state.sid) {
|
|
383
|
-
authStore.setLoading(true);
|
|
384
|
-
const [error] = await this.client.auth.validateResetPasswordToken(state.sid, resetToken);
|
|
385
|
-
if (error) {
|
|
386
|
-
authStore.setFieldError("resetPassword", error);
|
|
387
|
-
authStore.setStep("reset-password");
|
|
388
|
-
authStore.setLoading(false);
|
|
389
|
-
return false;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
authStore.setResetToken(resetToken);
|
|
393
|
-
authStore.setStep("reset-password");
|
|
394
|
-
authStore.setLoading(false);
|
|
395
|
-
return true;
|
|
396
|
-
}
|
|
397
|
-
async resetPassword() {
|
|
398
|
-
if (!state.resetPassword.token) {
|
|
399
|
-
throw new Error("No reset token available");
|
|
400
|
-
}
|
|
401
|
-
if (!state.resetPassword.newPassword) {
|
|
402
|
-
authStore.setFieldError("resetPassword", "password_required");
|
|
403
|
-
return;
|
|
404
|
-
}
|
|
405
|
-
if (state.resetPassword.passwordConfirmation &&
|
|
406
|
-
state.resetPassword.newPassword !== state.resetPassword.passwordConfirmation) {
|
|
407
|
-
authStore.setFieldError("resetPassword", "passwords_do_not_match");
|
|
408
|
-
return;
|
|
409
|
-
}
|
|
410
|
-
authStore.setLoading(true);
|
|
411
|
-
authStore.clearErrors();
|
|
412
|
-
const [error, response] = await this.client.auth.resetPassword(state.sid, state.resetPassword.token, state.resetPassword.newPassword, state.resetPassword.passwordConfirmation);
|
|
413
|
-
if (error) {
|
|
414
|
-
authStore.setFieldError("resetPassword", error);
|
|
415
|
-
// TODO: add proper password requirements handling --> for now this is fine
|
|
416
|
-
if (error === "invalid_password") {
|
|
417
|
-
authStore.setFieldError("password", response.error_details?.password.map((p) => t(`errors.password_requirements.${p}`)).join("\n"));
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
else {
|
|
421
|
-
authStore.setStep("email");
|
|
422
|
-
authStore.updateResetPassword({
|
|
423
|
-
step: "completed",
|
|
424
|
-
token: null,
|
|
425
|
-
newPassword: "",
|
|
426
|
-
passwordConfirmation: "",
|
|
427
|
-
});
|
|
428
|
-
clearUrlParam("reset_password_token");
|
|
429
|
-
Flash.success.addMessage("Password reset successfully");
|
|
430
|
-
}
|
|
431
|
-
authStore.setLoading(false);
|
|
432
|
-
}
|
|
433
|
-
authenticateWithPasskey() {
|
|
434
|
-
return authenticateWithPasskey(this.client, (response) => this.handleAuthSuccess(response));
|
|
435
|
-
}
|
|
436
|
-
extractSignInIdFromQuery() {
|
|
437
|
-
const sid = clearUrlParam("sid");
|
|
438
|
-
if (sid) {
|
|
439
|
-
authStore.setSignInId(sid);
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
handleMissingFields(response) {
|
|
443
|
-
authStore.setMissingFields(response.fields);
|
|
444
|
-
state$1.data = response.fields;
|
|
445
|
-
authStore.setStep("missing-fields");
|
|
446
|
-
authStore.setLoading(false);
|
|
447
|
-
}
|
|
448
|
-
handleAuthSuccess(response) {
|
|
449
|
-
authStore.setToken(response.jwt);
|
|
450
|
-
authStore.setLoading(false);
|
|
451
|
-
authStore.getRootComponentRef()?.onAuth(response);
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
class Auth {
|
|
456
|
-
static instance;
|
|
457
|
-
helpers;
|
|
458
|
-
constructor(client) {
|
|
459
|
-
this.helpers = new AuthHelpers(client);
|
|
460
|
-
this.helpers.handleSocialAuthRedirect();
|
|
461
|
-
this.helpers.handleResetPasswordRedirect();
|
|
462
|
-
}
|
|
463
|
-
static Errors = {
|
|
464
|
-
email: {
|
|
465
|
-
NOT_FOUND: "account_not_found",
|
|
466
|
-
},
|
|
467
|
-
magicCode: {
|
|
468
|
-
RECENTLY_CREATED: "magic_code_recently_created",
|
|
469
|
-
NOT_VALID: "magic_code_not_valid",
|
|
470
|
-
EXPIRED: "magic_code_expired",
|
|
471
|
-
USED: "magic_code_used",
|
|
472
|
-
},
|
|
473
|
-
password: {
|
|
474
|
-
INVALID: "invalid_password",
|
|
475
|
-
NOT_SET: "password_not_set",
|
|
476
|
-
RESET_PASSWORD_ALREADY_SENT: "reset_password_already_sent",
|
|
477
|
-
},
|
|
478
|
-
general: {
|
|
479
|
-
ACCOUNT_LOCKED: "account_locked",
|
|
480
|
-
SIGN_IN_EXPIRED: "sign_in_expired",
|
|
481
|
-
},
|
|
482
|
-
};
|
|
483
|
-
static async getInstance() {
|
|
484
|
-
if (!Auth.isInitialized()) {
|
|
485
|
-
await waitForConfig();
|
|
486
|
-
return Auth.initialize(getUnidyClient());
|
|
487
|
-
}
|
|
488
|
-
return Auth.instance;
|
|
489
|
-
}
|
|
490
|
-
static initialize(client) {
|
|
491
|
-
Auth.instance = new Auth(client);
|
|
492
|
-
if (Auth.instance.isTokenValid(state.token)) {
|
|
493
|
-
authStore.setAuthenticated(true);
|
|
494
|
-
}
|
|
495
|
-
return Auth.instance;
|
|
496
|
-
}
|
|
497
|
-
static isInitialized() {
|
|
498
|
-
return !!Auth.instance;
|
|
499
|
-
}
|
|
500
|
-
isTokenValid(token) {
|
|
501
|
-
try {
|
|
502
|
-
let decoded;
|
|
503
|
-
if (typeof token === "string") {
|
|
504
|
-
decoded = jwtDecode(token);
|
|
505
|
-
}
|
|
506
|
-
else {
|
|
507
|
-
decoded = token;
|
|
508
|
-
}
|
|
509
|
-
if (!decoded)
|
|
510
|
-
return false;
|
|
511
|
-
const currentTime = Date.now() / 1000;
|
|
512
|
-
return decoded.exp > currentTime;
|
|
513
|
-
}
|
|
514
|
-
catch (error) {
|
|
515
|
-
captureException(error);
|
|
516
|
-
return false;
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
async isAuthenticated() {
|
|
520
|
-
const token = await this.getToken();
|
|
521
|
-
return typeof token === "string";
|
|
522
|
-
}
|
|
523
|
-
async getToken() {
|
|
524
|
-
const currentToken = state.token;
|
|
525
|
-
if (currentToken && this.isTokenValid(currentToken)) {
|
|
526
|
-
return currentToken;
|
|
527
|
-
}
|
|
528
|
-
await this.helpers.refreshToken();
|
|
529
|
-
if (state.globalErrors.auth || !state.token) {
|
|
530
|
-
return this.createAuthError(t("errors.refresh_failed"), "REFRESH_FAILED", true);
|
|
531
|
-
}
|
|
532
|
-
return state.token;
|
|
533
|
-
}
|
|
534
|
-
async userData() {
|
|
535
|
-
const token = await this.getToken();
|
|
536
|
-
if (typeof token !== "string") {
|
|
537
|
-
return null;
|
|
538
|
-
}
|
|
539
|
-
if (!token) {
|
|
540
|
-
return null;
|
|
541
|
-
}
|
|
542
|
-
try {
|
|
543
|
-
return jwtDecode(token);
|
|
544
|
-
}
|
|
545
|
-
catch (error) {
|
|
546
|
-
captureException(error);
|
|
547
|
-
return null;
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
async logout() {
|
|
551
|
-
const [error, _] = await this.helpers.logout();
|
|
552
|
-
if (error) {
|
|
553
|
-
return this.createAuthError(t("errors.sign_out_failed", { reason: error }), "SIGN_OUT_FAILED", false);
|
|
554
|
-
}
|
|
555
|
-
authStore.reset();
|
|
556
|
-
return true;
|
|
557
|
-
}
|
|
558
|
-
getEmail() {
|
|
559
|
-
return state.email;
|
|
560
|
-
}
|
|
561
|
-
createAuthError(message, code, requiresReauth = false) {
|
|
562
|
-
const error = new Error(message);
|
|
563
|
-
error.code = code;
|
|
564
|
-
error.requiresReauth = requiresReauth;
|
|
565
|
-
return error;
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
export { Auth as A };
|
|
570
|
-
//# sourceMappingURL=auth.js.map
|
|
571
|
-
|
|
572
|
-
//# sourceMappingURL=auth.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"auth.js","mappings":";;;;;;;;;;AAAO,MAAM,iBAAiB,SAAS,KAAK,CAAC;AAC7C;AACA,iBAAiB,CAAC,SAAS,CAAC,IAAI,GAAG,mBAAmB;AACtD,SAAS,gBAAgB,CAAC,GAAG,EAAE;AAC/B,IAAI,OAAO,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK;AAClE,QAAQ,IAAI,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE;AAC7D,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;AAC7B,YAAY,IAAI,GAAG,GAAG,GAAG,IAAI;AAC7B;AACA,QAAQ,OAAO,GAAG,GAAG,IAAI;AACzB,KAAK,CAAC,CAAC;AACP;AACA,SAAS,eAAe,CAAC,GAAG,EAAE;AAC9B,IAAI,IAAI,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;AAC1D,IAAI,QAAQ,MAAM,CAAC,MAAM,GAAG,CAAC;AAC7B,QAAQ,KAAK,CAAC;AACd,YAAY;AACZ,QAAQ,KAAK,CAAC;AACd,YAAY,MAAM,IAAI,IAAI;AAC1B,YAAY;AACZ,QAAQ,KAAK,C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,GAAG,IAAI,KAAK,CAAC,OAAO,CAAc;AAC7C,QAAA,KAAK,CAAC,IAAI,GAAG,IAAI;AACjB,QAAA,KAAK,CAAC,cAAc,GAAG,cAAc;AAErC,QAAA,OAAO,KAAK;;;;;;","names":["authState","profileState","Sentry.captureException"],"sources":["../../node_modules/jwt-decode/build/esm/index.js","src/auth/passkey-auth.ts","src/auth/auth-helpers.ts","src/auth/auth.ts"],"sourcesContent":["export class InvalidTokenError extends Error {\n}\nInvalidTokenError.prototype.name = \"InvalidTokenError\";\nfunction b64DecodeUnicode(str) {\n return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {\n let code = p.charCodeAt(0).toString(16).toUpperCase();\n if (code.length < 2) {\n code = \"0\" + code;\n }\n return \"%\" + code;\n }));\n}\nfunction base64UrlDecode(str) {\n let output = str.replace(/-/g, \"+\").replace(/_/g, \"/\");\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += \"==\";\n break;\n case 3:\n output += \"=\";\n break;\n default:\n throw new Error(\"base64 string is not of the correct length\");\n }\n try {\n return b64DecodeUnicode(output);\n }\n catch (err) {\n return atob(output);\n }\n}\nexport function jwtDecode(token, options) {\n if (typeof token !== \"string\") {\n throw new InvalidTokenError(\"Invalid token specified: must be a string\");\n }\n options || (options = {});\n const pos = options.header === true ? 0 : 1;\n const part = token.split(\".\")[pos];\n if (typeof part !== \"string\") {\n throw new InvalidTokenError(`Invalid token specified: missing part #${pos + 1}`);\n }\n let decoded;\n try {\n decoded = base64UrlDecode(part);\n }\n catch (e) {\n throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${pos + 1} (${e.message})`);\n }\n try {\n return JSON.parse(decoded);\n }\n catch (e) {\n throw new InvalidTokenError(`Invalid token specified: invalid json for part #${pos + 1} (${e.message})`);\n }\n}\n","import { jwtDecode } from \"jwt-decode\";\nimport type { PasskeyOptionsResponse, TokenResponse, UnidyClient } from \"../api\";\nimport { createLogger } from \"../logger\";\nimport type { TokenPayload } from \"./auth\";\nimport { authState, authStore } from \"./store/auth-store\";\n\nconst logger = createLogger(\"PasskeyAuth\");\n\nconst PASSKEY_ERRORS: Record<string, string> = {\n NotSupportedError: \"passkey_not_supported\",\n NotAllowedError: \"passkey_cancelled\",\n SecurityError: \"passkey_security_error\",\n InvalidStateError: \"passkey_invalid_state\",\n};\n\nfunction decodeBase64Url(base64url: string): Uint8Array {\n const base64 = base64url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const padded = base64 + \"=\".repeat((4 - (base64.length % 4)) % 4);\n return Uint8Array.from(atob(padded), (c) => c.charCodeAt(0));\n}\n\nfunction buildPublicKeyOptions(options: PasskeyOptionsResponse): PublicKeyCredentialRequestOptions {\n return {\n challenge: Uint8Array.from(atob(options.challenge), (c) => c.charCodeAt(0)),\n timeout: options.timeout || 60000,\n rpId: options.rpId,\n userVerification: (options.userVerification as UserVerificationRequirement) || \"required\",\n allowCredentials: options.allowCredentials?.map((cred) => ({\n ...cred,\n id: decodeBase64Url(cred.id),\n })),\n };\n}\n\nfunction formatCredentialForServer(credential: PublicKeyCredential) {\n const response = credential.response as AuthenticatorAssertionResponse;\n return {\n id: credential.id,\n rawId: btoa(String.fromCharCode(...new Uint8Array(credential.rawId))),\n response: {\n authenticatorData: btoa(String.fromCharCode(...new Uint8Array(response.authenticatorData))),\n clientDataJSON: btoa(String.fromCharCode(...new Uint8Array(response.clientDataJSON))),\n signature: btoa(String.fromCharCode(...new Uint8Array(response.signature))),\n },\n type: credential.type,\n };\n}\n\nfunction extractAndSetSignInId(tokenResponse: TokenResponse) {\n if (tokenResponse.sid) {\n authStore.setSignInId(tokenResponse.sid);\n return;\n }\n\n // Fallback: extract sid from JWT token payload\n try {\n const decoded = jwtDecode<TokenPayload>(tokenResponse.jwt);\n if (decoded.sid) {\n authStore.setSignInId(decoded.sid);\n }\n } catch {\n // Failed to decode JWT token to extract sid, continue without it\n }\n}\n\nfunction handlePasskeyError(error: unknown) {\n logger.error(\"Passkey error:\", error);\n\n let errorMessage = \"passkey_error\";\n if (error instanceof DOMException) {\n errorMessage = PASSKEY_ERRORS[error.name] || \"passkey_error\";\n }\n\n authStore.setGlobalError(\"auth\", errorMessage);\n authStore.setLoading(false);\n}\n\nexport async function authenticateWithPasskey(client: UnidyClient, onSuccess: (response: TokenResponse) => void) {\n authStore.setLoading(true);\n authStore.clearErrors();\n\n if (!window.PublicKeyCredential) {\n authStore.setGlobalError(\"auth\", \"passkey_not_supported\");\n authStore.setLoading(false);\n return;\n }\n\n try {\n const [optionsError, options] = await client.auth.getPasskeyOptions(authState.sid || undefined);\n\n if (optionsError || !options) {\n authStore.setGlobalError(\"auth\", optionsError || \"bad_request\");\n authStore.setLoading(false);\n return;\n }\n\n const publicKeyOptions = buildPublicKeyOptions(options as PasskeyOptionsResponse);\n\n const credential = (await navigator.credentials.get({\n publicKey: publicKeyOptions,\n })) as PublicKeyCredential | null;\n\n if (!credential) {\n authStore.setGlobalError(\"auth\", \"passkey_cancelled\");\n authStore.setLoading(false);\n return;\n }\n\n const formattedCredential = formatCredentialForServer(credential);\n\n const [verifyError, tkResponse] = await client.auth.authenticateWithPasskey(formattedCredential);\n\n const tokenResponse = tkResponse as TokenResponse;\n if (verifyError || !tokenResponse) {\n authStore.setGlobalError(\"auth\", verifyError || \"authentication_failed\");\n authStore.setLoading(false);\n return;\n }\n\n authStore.setToken(tokenResponse.jwt);\n extractAndSetSignInId(tokenResponse);\n onSuccess(tokenResponse);\n } catch (error) {\n handlePasskeyError(error);\n }\n}\n","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","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"],"version":3}
|