@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,41 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var index = require('./index-DLz3FT7T.js');
|
|
4
|
-
|
|
5
|
-
const initialState = {
|
|
6
|
-
mode: "production",
|
|
7
|
-
apiKey: "",
|
|
8
|
-
baseUrl: "",
|
|
9
|
-
locale: "en",
|
|
10
|
-
isConfigured: false,
|
|
11
|
-
backendConnected: true,
|
|
12
|
-
};
|
|
13
|
-
const store = index.createStore(initialState);
|
|
14
|
-
const unidyState = store.state;
|
|
15
|
-
const onChange = store.onChange;
|
|
16
|
-
const CONFIG_TIMEOUT_MS = 1000;
|
|
17
|
-
function waitForConfig() {
|
|
18
|
-
if (unidyState.isConfigured) {
|
|
19
|
-
return Promise.resolve();
|
|
20
|
-
}
|
|
21
|
-
return new Promise((resolve, reject) => {
|
|
22
|
-
const timeout = setTimeout(() => {
|
|
23
|
-
unsubscribe();
|
|
24
|
-
reject(new Error(`Unidy SDK: <u-config> not found or not loaded within ${CONFIG_TIMEOUT_MS}ms`));
|
|
25
|
-
}, CONFIG_TIMEOUT_MS);
|
|
26
|
-
const unsubscribe = onChange("isConfigured", (value) => {
|
|
27
|
-
if (value) {
|
|
28
|
-
clearTimeout(timeout);
|
|
29
|
-
unsubscribe();
|
|
30
|
-
resolve();
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
exports.onChange = onChange;
|
|
37
|
-
exports.unidyState = unidyState;
|
|
38
|
-
exports.waitForConfig = waitForConfig;
|
|
39
|
-
//# sourceMappingURL=unidy-store-7AbWnZ6g.js.map
|
|
40
|
-
|
|
41
|
-
//# sourceMappingURL=unidy-store-7AbWnZ6g.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unidy-store-7AbWnZ6g.js","sources":["src/shared/store/unidy-store.ts"],"sourcesContent":["import { createStore } from \"@stencil/store\";\n\nexport interface UnidyState {\n mode: \"production\" | \"development\";\n apiKey: string;\n baseUrl: string;\n locale: string;\n\n isConfigured: boolean;\n backendConnected: boolean;\n}\n\nconst initialState: UnidyState = {\n mode: \"production\",\n apiKey: \"\",\n baseUrl: \"\",\n locale: \"en\",\n\n isConfigured: false,\n backendConnected: true,\n};\n\nconst store = createStore<UnidyState>(initialState);\n\nexport const unidyState = store.state;\nexport const reset = store.reset;\nexport const onChange: <K extends keyof UnidyState>(prop: K, cb: (value: UnidyState[K]) => void) => () => void = store.onChange;\n\nconst CONFIG_TIMEOUT_MS = 1000;\n\nexport function waitForConfig(): Promise<void> {\n if (unidyState.isConfigured) {\n return Promise.resolve();\n }\n\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n unsubscribe();\n reject(new Error(`Unidy SDK: <u-config> not found or not loaded within ${CONFIG_TIMEOUT_MS}ms`));\n }, CONFIG_TIMEOUT_MS);\n\n const unsubscribe = onChange(\"isConfigured\", (value) => {\n if (value) {\n clearTimeout(timeout);\n unsubscribe();\n resolve();\n }\n });\n });\n}\n"],"names":["createStore"],"mappings":";;;;AAYA,MAAM,YAAY,GAAe;AAC/B,IAAA,IAAI,EAAE,YAAY;AAClB,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,OAAO,EAAE,EAAE;AACX,IAAA,MAAM,EAAE,IAAI;AAEZ,IAAA,YAAY,EAAE,KAAK;AACnB,IAAA,gBAAgB,EAAE,IAAI;CACvB;AAED,MAAM,KAAK,GAAGA,iBAAW,CAAa,YAAY,CAAC;AAEtC,MAAA,UAAU,GAAG,KAAK,CAAC;AAEnB,MAAA,QAAQ,GAA4F,KAAK,CAAC;AAEvH,MAAM,iBAAiB,GAAG,IAAI;SAEd,aAAa,GAAA;AAC3B,IAAA,IAAI,UAAU,CAAC,YAAY,EAAE;AAC3B,QAAA,OAAO,OAAO,CAAC,OAAO,EAAE;;IAG1B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;AACrC,QAAA,MAAM,OAAO,GAAG,UAAU,CAAC,MAAK;AAC9B,YAAA,WAAW,EAAE;YACb,MAAM,CAAC,IAAI,KAAK,CAAC,wDAAwD,iBAAiB,CAAA,EAAA,CAAI,CAAC,CAAC;SACjG,EAAE,iBAAiB,CAAC;QAErB,MAAM,WAAW,GAAG,QAAQ,CAAC,cAAc,EAAE,CAAC,KAAK,KAAI;YACrD,IAAI,KAAK,EAAE;gBACT,YAAY,CAAC,OAAO,CAAC;AACrB,gBAAA,WAAW,EAAE;AACb,gBAAA,OAAO,EAAE;;AAEb,SAAC,CAAC;AACJ,KAAC,CAAC;AACJ;;;;;;"}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import * as Sentry from "@sentry/browser";
|
|
2
|
-
import { t } from "../i18n";
|
|
3
|
-
import { createLogger } from "../logger";
|
|
4
|
-
export class ApiClient {
|
|
5
|
-
baseUrl;
|
|
6
|
-
api_key;
|
|
7
|
-
static CONNECTION_ERROR_MESSAGES = [
|
|
8
|
-
"Failed to fetch",
|
|
9
|
-
"NetworkError",
|
|
10
|
-
"ERR_CONNECTION_REFUSED",
|
|
11
|
-
"ERR_NETWORK",
|
|
12
|
-
"ERR_INTERNET_DISCONNECTED",
|
|
13
|
-
];
|
|
14
|
-
onConnectionChange;
|
|
15
|
-
logger = createLogger("ApiClient");
|
|
16
|
-
constructor(baseUrl, api_key, onConnectionChange) {
|
|
17
|
-
this.baseUrl = baseUrl;
|
|
18
|
-
this.api_key = api_key;
|
|
19
|
-
this.api_key = api_key;
|
|
20
|
-
this.onConnectionChange = onConnectionChange;
|
|
21
|
-
}
|
|
22
|
-
isConnectionError(error) {
|
|
23
|
-
if (error instanceof Error) {
|
|
24
|
-
return ApiClient.CONNECTION_ERROR_MESSAGES.some((msg) => error.message.includes(msg));
|
|
25
|
-
}
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
setConnectionStatus(isConnected) {
|
|
29
|
-
if (this.onConnectionChange) {
|
|
30
|
-
this.onConnectionChange(isConnected);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
baseHeaders() {
|
|
34
|
-
const h = new Headers();
|
|
35
|
-
h.set("Content-Type", "application/json");
|
|
36
|
-
h.set("Accept", "application/json");
|
|
37
|
-
h.set("Authorization", `Bearer ${this.api_key}`);
|
|
38
|
-
return h;
|
|
39
|
-
}
|
|
40
|
-
mergeHeaders(base, extra) {
|
|
41
|
-
const out = new Headers(base);
|
|
42
|
-
if (extra) {
|
|
43
|
-
new Headers(extra).forEach((v, k) => {
|
|
44
|
-
out.set(k, v);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
return out;
|
|
48
|
-
}
|
|
49
|
-
async request(method, endpoint, body, headers) {
|
|
50
|
-
let res = null;
|
|
51
|
-
try {
|
|
52
|
-
res = await fetch(`${this.baseUrl}${endpoint}`, {
|
|
53
|
-
method,
|
|
54
|
-
mode: "cors",
|
|
55
|
-
credentials: "include",
|
|
56
|
-
headers: this.mergeHeaders(this.baseHeaders(), headers),
|
|
57
|
-
body: JSON.stringify(body) || undefined,
|
|
58
|
-
});
|
|
59
|
-
let data;
|
|
60
|
-
try {
|
|
61
|
-
data = await res.json();
|
|
62
|
-
}
|
|
63
|
-
catch {
|
|
64
|
-
data = undefined;
|
|
65
|
-
}
|
|
66
|
-
this.setConnectionStatus(true);
|
|
67
|
-
const response = {
|
|
68
|
-
data,
|
|
69
|
-
status: res.status,
|
|
70
|
-
headers: res.headers,
|
|
71
|
-
success: res.ok,
|
|
72
|
-
connectionError: false,
|
|
73
|
-
};
|
|
74
|
-
return response;
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
const connectionFailed = this.isConnectionError(error);
|
|
78
|
-
if (connectionFailed) {
|
|
79
|
-
this.setConnectionStatus(false);
|
|
80
|
-
Sentry.captureException(error, {
|
|
81
|
-
tags: { error_type: "connection_error" },
|
|
82
|
-
extra: { endpoint, method },
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
const response = {
|
|
86
|
-
status: res ? res.status : connectionFailed ? 0 : 500,
|
|
87
|
-
error: error instanceof Error ? error.message : String(error),
|
|
88
|
-
headers: res ? res.headers : new Headers(),
|
|
89
|
-
success: false,
|
|
90
|
-
data: undefined,
|
|
91
|
-
connectionError: connectionFailed,
|
|
92
|
-
};
|
|
93
|
-
return response;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
async get(endpoint, headers) {
|
|
97
|
-
return this.request("GET", endpoint, undefined, headers);
|
|
98
|
-
}
|
|
99
|
-
async post(endpoint, body, headers) {
|
|
100
|
-
return this.request("POST", endpoint, body, headers);
|
|
101
|
-
}
|
|
102
|
-
async patch(endpoint, body, headers) {
|
|
103
|
-
return this.request("PATCH", endpoint, body, headers);
|
|
104
|
-
}
|
|
105
|
-
async delete(endpoint, headers) {
|
|
106
|
-
return this.request("DELETE", endpoint, undefined, headers);
|
|
107
|
-
}
|
|
108
|
-
getWithSchema(returnSchema, urlBuilder, paramSchema) {
|
|
109
|
-
const fn = async (args, params) => {
|
|
110
|
-
// Build URL
|
|
111
|
-
const baseUrl = urlBuilder(args);
|
|
112
|
-
// Validate and parse params with Zod if provided
|
|
113
|
-
let queryString = "";
|
|
114
|
-
if (paramSchema && params) {
|
|
115
|
-
const validatedParams = paramSchema.parse(params);
|
|
116
|
-
queryString = `?${new URLSearchParams(validatedParams).toString()}`;
|
|
117
|
-
}
|
|
118
|
-
const fullUrl = `${baseUrl}${queryString}`;
|
|
119
|
-
const response = await this.get(fullUrl);
|
|
120
|
-
if (!response.success || !response.data) {
|
|
121
|
-
return response;
|
|
122
|
-
}
|
|
123
|
-
const parsed = returnSchema.safeParse(response.data);
|
|
124
|
-
if (!parsed.success) {
|
|
125
|
-
this.logger.error("Invalid response format", parsed.error);
|
|
126
|
-
return {
|
|
127
|
-
...response,
|
|
128
|
-
success: false,
|
|
129
|
-
error: t("errors.invalid_response_format", {
|
|
130
|
-
defaultValue: "Invalid response format",
|
|
131
|
-
}),
|
|
132
|
-
data: undefined,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
return {
|
|
136
|
-
...response,
|
|
137
|
-
data: parsed.data,
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
// biome-ignore lint/suspicious/noExplicitAny: fn can literally be any function
|
|
141
|
-
return fn;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
//# sourceMappingURL=client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,CAAC,EAAE,MAAM,SAAS,CAAC;AAE5B,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAiBzC,MAAM,OAAO,SAAS;IAaX;IACA;IAbD,MAAM,CAAU,yBAAyB,GAAG;QAClD,iBAAiB;QACjB,cAAc;QACd,wBAAwB;QACxB,aAAa;QACb,2BAA2B;KAC5B,CAAC;IAEM,kBAAkB,CAAkC;IACpD,MAAM,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;IAE3C,YACS,OAAe,EACf,OAAe,EACtB,kBAAmD;QAF5C,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAAQ;QAGtB,IAAI,CAAC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Z,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;YAEjC,iDAAiD;YACjD,IAAI,WAAW,GAAG,EAAE,CAAC;YACrB,IAAI,WAAW,IAAI,MAAM,EAAE,CAAC;gBAC1B,MAAM,eAAe,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;gBAClD,WAAW,GAAG,IAAI,IAAI,eAAe,CAAC,eAAyC,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;YAChG,CAAC;YAED,MAAM,OAAO,GAAG,GAAG,OAAO,GAAG,WAAW,EAAE,CAAC;YAC3C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAU,OAAO,CAAC,CAAC;YAElD,IAAI,CAAC,QAAQ,CAAC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACxC,OAAO,QAAgC,CAAC;YAC1C,CAAC;YAED,MAAM,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAErD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACpB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,yBAAyB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;gBAC3D,OAAO;oBACL,GAAG,QAAQ;oBACX,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,CAAC,CAAC,gCAAgC,EAAE;wBACzC,YAAY,EAAE,yBAAyB;qBACxC,CAAC;oBACF,IAAI,EAAE,SAAS;iBAChB,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,GAAG,QAAQ;gBACX,IAAI,EAAE,MAAM,CAAC,IAAI;aAClB,CAAC;QACJ,CAAC,CAAC;QACF,+EAA+E;QAC/E,OAAO,EAAS,CAAC;IACnB,CAAC","sourcesContent":["import * as Sentry from \"@sentry/browser\";\nimport { t } from \"../i18n\";\nimport type * as z from \"zod\";\nimport { createLogger } from \"../logger\";\n\nexport interface ApiResponse<T> {\n data?: T;\n success: boolean;\n status: number;\n headers: Headers;\n error?: Error | string;\n connectionError?: boolean; // when backend is unreachable (network error, connection refused, etc.)\n}\n\nexport type ApiConfig = {\n baseUrl: string;\n apiKey: string;\n onConnectionChange?: (isConnected: boolean) => void;\n};\n\nexport class ApiClient {\n private static readonly CONNECTION_ERROR_MESSAGES = [\n \"Failed to fetch\",\n \"NetworkError\",\n \"ERR_CONNECTION_REFUSED\",\n \"ERR_NETWORK\",\n \"ERR_INTERNET_DISCONNECTED\",\n ];\n\n private onConnectionChange?: (isConnected: boolean) => void;\n private logger = createLogger(\"ApiClient\");\n\n constructor(\n public baseUrl: string,\n public api_key: string,\n onConnectionChange?: (isConnected: boolean) => void,\n ) {\n this.api_key = api_key;\n this.onConnectionChange = onConnectionChange;\n }\n\n private isConnectionError(error: unknown): boolean {\n if (error instanceof Error) {\n return ApiClient.CONNECTION_ERROR_MESSAGES.some((msg) => error.message.includes(msg));\n }\n\n return false;\n }\n\n private setConnectionStatus(isConnected: boolean) {\n if (this.onConnectionChange) {\n this.onConnectionChange(isConnected);\n }\n }\n\n private baseHeaders(): Headers {\n const h = new Headers();\n h.set(\"Content-Type\", \"application/json\");\n h.set(\"Accept\", \"application/json\");\n h.set(\"Authorization\", `Bearer ${this.api_key}`);\n return h;\n }\n\n private mergeHeaders(base: Headers, extra?: HeadersInit): Headers {\n const out = new Headers(base);\n if (extra) {\n new Headers(extra).forEach((v, k) => {\n out.set(k, v);\n });\n }\n return out;\n }\n\n private async request<T>(method: string, endpoint: string, body?: object, headers?: HeadersInit): Promise<ApiResponse<T>> {\n let res: Response | null = null;\n try {\n res = await fetch(`${this.baseUrl}${endpoint}`, {\n method,\n mode: \"cors\",\n credentials: \"include\",\n headers: this.mergeHeaders(this.baseHeaders(), headers),\n body: JSON.stringify(body) || undefined,\n });\n\n let data: T | undefined;\n try {\n data = await res.json();\n } catch {\n data = undefined;\n }\n\n this.setConnectionStatus(true);\n\n const response: ApiResponse<T> = {\n data,\n status: res.status,\n headers: res.headers,\n success: res.ok,\n connectionError: false,\n };\n\n return response;\n } catch (error) {\n const connectionFailed = this.isConnectionError(error);\n\n if (connectionFailed) {\n this.setConnectionStatus(false);\n\n Sentry.captureException(error, {\n tags: { error_type: \"connection_error\" },\n extra: { endpoint, method },\n });\n }\n\n const response: ApiResponse<T> = {\n status: res ? res.status : connectionFailed ? 0 : 500,\n error: error instanceof Error ? error.message : String(error),\n headers: res ? res.headers : new Headers(),\n success: false,\n data: undefined,\n connectionError: connectionFailed,\n };\n\n return response;\n }\n }\n\n async get<T>(endpoint: string, headers?: HeadersInit): Promise<ApiResponse<T>> {\n return this.request<T>(\"GET\", endpoint, undefined, headers);\n }\n\n async post<T>(endpoint: string, body: object, headers?: HeadersInit): Promise<ApiResponse<T>> {\n return this.request<T>(\"POST\", endpoint, body, headers);\n }\n\n async patch<T>(endpoint: string, body: object, headers?: HeadersInit): Promise<ApiResponse<T>> {\n return this.request<T>(\"PATCH\", endpoint, body, headers);\n }\n\n async delete<T>(endpoint: string, headers?: HeadersInit): Promise<ApiResponse<T>> {\n return this.request<T>(\"DELETE\", endpoint, undefined, headers);\n }\n\n getWithSchema<TReturn, TArgs extends object, TParams = undefined>(\n returnSchema: z.ZodSchema<TReturn>,\n urlBuilder: (args: TArgs) => string,\n paramSchema?: z.ZodSchema<TParams>,\n ): TParams extends undefined\n ? (args: TArgs) => Promise<ApiResponse<TReturn>>\n : (args: TArgs, params?: TParams) => Promise<ApiResponse<TReturn>> {\n const fn = async (args: TArgs, params?: TParams) => {\n // Build URL\n const baseUrl = urlBuilder(args);\n\n // Validate and parse params with Zod if provided\n let queryString = \"\";\n if (paramSchema && params) {\n const validatedParams = paramSchema.parse(params);\n queryString = `?${new URLSearchParams(validatedParams as Record<string, string>).toString()}`;\n }\n\n const fullUrl = `${baseUrl}${queryString}`;\n const response = await this.get<unknown>(fullUrl);\n\n if (!response.success || !response.data) {\n return response as ApiResponse<TReturn>;\n }\n\n const parsed = returnSchema.safeParse(response.data);\n\n if (!parsed.success) {\n this.logger.error(\"Invalid response format\", parsed.error);\n return {\n ...response,\n success: false,\n error: t(\"errors.invalid_response_format\", {\n defaultValue: \"Invalid response format\",\n }),\n data: undefined,\n };\n }\n\n return {\n ...response,\n data: parsed.data,\n };\n };\n // biome-ignore lint/suspicious/noExplicitAny: fn can literally be any function\n return fn as any;\n }\n}\n"]}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { ApiClient } from "./client";
|
|
2
|
-
import { AuthService } from "../auth/api/auth";
|
|
3
|
-
import { NewsletterService } from "../newsletter";
|
|
4
|
-
import { ProfileService } from "../profile";
|
|
5
|
-
import { unidyState } from "../shared/store/unidy-store";
|
|
6
|
-
import { SubscriptionsService, TicketsService } from "../ticketable";
|
|
7
|
-
export * from "../auth/api/auth";
|
|
8
|
-
export * from "../newsletter/api/newsletters";
|
|
9
|
-
export * from "../profile/api/profile";
|
|
10
|
-
export * from "./shared";
|
|
11
|
-
export * from "../ticketable/api/subscriptions";
|
|
12
|
-
export * from "../ticketable/api/tickets";
|
|
13
|
-
export class UnidyClient {
|
|
14
|
-
apiClient;
|
|
15
|
-
newsletters;
|
|
16
|
-
profile;
|
|
17
|
-
auth;
|
|
18
|
-
tickets;
|
|
19
|
-
subscriptions;
|
|
20
|
-
constructor(baseUrl, apiKey) {
|
|
21
|
-
this.apiClient = new ApiClient(baseUrl, apiKey, (isConnected) => {
|
|
22
|
-
unidyState.backendConnected = isConnected;
|
|
23
|
-
});
|
|
24
|
-
this.newsletters = new NewsletterService(this.apiClient);
|
|
25
|
-
this.profile = new ProfileService(this.apiClient);
|
|
26
|
-
this.auth = new AuthService(this.apiClient);
|
|
27
|
-
this.tickets = new TicketsService(this.apiClient);
|
|
28
|
-
this.subscriptions = new SubscriptionsService(this.apiClient);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
let instance = null;
|
|
32
|
-
function getUnidyClient() {
|
|
33
|
-
if (!unidyState.isConfigured) {
|
|
34
|
-
throw new Error("Config not initialized. Ensure <u-config> is loaded before making API calls by using waitForConfig() to wait for initialization.");
|
|
35
|
-
}
|
|
36
|
-
if (!instance) {
|
|
37
|
-
instance = new UnidyClient(unidyState.baseUrl, unidyState.apiKey);
|
|
38
|
-
}
|
|
39
|
-
return instance;
|
|
40
|
-
}
|
|
41
|
-
export { getUnidyClient, ApiClient };
|
|
42
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAe,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAErE,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,UAAU,CAAC;AACzB,cAAc,iCAAiC,CAAC;AAChD,cAAc,2BAA2B,CAAC;AAE1C,MAAM,OAAO,WAAW;IACd,SAAS,CAAY;IAE7B,WAAW,CAAoB;IAC/B,OAAO,CAAiB;IACxB,IAAI,CAAc;IAClB,OAAO,CAAiB;IACxB,aAAa,CAAuB;IAEpC,YAAY,OAAe,EAAE,MAAc;QACzC,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,WAAW,EAAE,EAAE;YAC9D,UAAU,CAAC,gBAAgB,GAAG,WAAW,CAAC;QAC5C,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,WAAW,GAAG,IAAI,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzD,IAAI,CAAC,OAAO,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAClD,IAAI,CAAC,IAAI,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC5C,IAAI,CAAC,OAAO,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAClD,IAAI,CAAC,aAAa,GAAG,IAAI,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAChE,CAAC;CACF;AAED,IAAI,QAAQ,GAAuB,IAAI,CAAC;AAExC,SAAS,cAAc;IACrB,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CACb,kIAAkI,CACnI,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,QAAQ,GAAG,IAAI,WAAW,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,SAAS,EAAe,CAAC","sourcesContent":["import { ApiClient, ApiResponse } from \"./client\";\nimport { AuthService } from \"../auth/api/auth\";\nimport { NewsletterService } from \"../newsletter\";\nimport { ProfileService } from \"../profile\";\nimport { unidyState } from \"../shared/store/unidy-store\";\nimport { SubscriptionsService, TicketsService } from \"../ticketable\";\n\nexport * from \"../auth/api/auth\";\nexport * from \"../newsletter/api/newsletters\";\nexport * from \"../profile/api/profile\";\nexport * from \"./shared\";\nexport * from \"../ticketable/api/subscriptions\";\nexport * from \"../ticketable/api/tickets\";\n\nexport class UnidyClient {\n private apiClient: ApiClient;\n\n newsletters: NewsletterService;\n profile: ProfileService;\n auth: AuthService;\n tickets: TicketsService;\n subscriptions: SubscriptionsService;\n\n constructor(baseUrl: string, apiKey: string) {\n this.apiClient = new ApiClient(baseUrl, apiKey, (isConnected) => {\n unidyState.backendConnected = isConnected;\n });\n\n this.newsletters = new NewsletterService(this.apiClient);\n this.profile = new ProfileService(this.apiClient);\n this.auth = new AuthService(this.apiClient);\n this.tickets = new TicketsService(this.apiClient);\n this.subscriptions = new SubscriptionsService(this.apiClient);\n }\n}\n\nlet instance: UnidyClient | null = null;\n\nfunction getUnidyClient(): UnidyClient {\n if (!unidyState.isConfigured) {\n throw new Error(\n \"Config not initialized. Ensure <u-config> is loaded before making API calls by using waitForConfig() to wait for initialization.\",\n );\n }\n\n if (!instance) {\n instance = new UnidyClient(unidyState.baseUrl, unidyState.apiKey);\n }\n\n return instance;\n}\n\nexport { getUnidyClient, ApiClient, ApiResponse };\n"]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as z from "zod";
|
|
2
|
-
export const SchemaValidationErrorSchema = z.object({
|
|
3
|
-
error_identifier: z.string(), // unprocessable entity etc. TODO we can define enum later
|
|
4
|
-
errors: z.array(z.string()),
|
|
5
|
-
});
|
|
6
|
-
export const PaginationMetaSchema = z.object({
|
|
7
|
-
count: z.number(),
|
|
8
|
-
page: z.number(),
|
|
9
|
-
limit: z.number(),
|
|
10
|
-
last: z.number(),
|
|
11
|
-
prev: z.number().nullable(),
|
|
12
|
-
next: z.number().nullable(),
|
|
13
|
-
});
|
|
14
|
-
export const PaginationParamsSchema = z.object({
|
|
15
|
-
page: z.number().int().min(1),
|
|
16
|
-
limit: z.number().int().min(0).max(250),
|
|
17
|
-
});
|
|
18
|
-
//# sourceMappingURL=shared.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/api/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,0DAA0D;IACxF,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC5B,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;CACxC,CAAC,CAAC","sourcesContent":["import * as z from \"zod\";\n\nexport const SchemaValidationErrorSchema = z.object({\n error_identifier: z.string(), // unprocessable entity etc. TODO we can define enum later\n errors: z.array(z.string()),\n});\n\nexport type SchemaValidationError = z.infer<typeof SchemaValidationErrorSchema>;\n\nexport const PaginationMetaSchema = z.object({\n count: z.number(),\n page: z.number(),\n limit: z.number(),\n last: z.number(),\n prev: z.number().nullable(),\n next: z.number().nullable(),\n});\n\nexport type PaginationMeta = z.infer<typeof PaginationMetaSchema>;\n\nexport const PaginationParamsSchema = z.object({\n page: z.number().int().min(1),\n limit: z.number().int().min(0).max(250),\n});\n\nexport type PaginationParams = z.infer<typeof PaginationParamsSchema>;\n"]}
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
import * as Sentry from "@sentry/browser";
|
|
2
|
-
import * as z from "zod";
|
|
3
|
-
import { SchemaValidationErrorSchema } from "../../api";
|
|
4
|
-
import { UserProfileSchema } from "../../profile";
|
|
5
|
-
import { unidyState } from "../../shared/store/unidy-store";
|
|
6
|
-
const LoginOptionsSchema = z.object({
|
|
7
|
-
magic_link: z.boolean(),
|
|
8
|
-
password: z.boolean(),
|
|
9
|
-
social_logins: z.array(z.string()),
|
|
10
|
-
passkey: z.boolean(),
|
|
11
|
-
});
|
|
12
|
-
const CreateSignInResponseSchema = z.object({
|
|
13
|
-
sid: z.string(),
|
|
14
|
-
status: z.enum(["pending_verification", "authenticated", "completed"]),
|
|
15
|
-
email: z.string(),
|
|
16
|
-
expired: z.boolean(),
|
|
17
|
-
login_options: LoginOptionsSchema,
|
|
18
|
-
});
|
|
19
|
-
const ErrorSchema = z.object({
|
|
20
|
-
error_identifier: z.string(),
|
|
21
|
-
});
|
|
22
|
-
const SendMagicCodeResponseSchema = z.object({
|
|
23
|
-
enable_resend_after: z.number(),
|
|
24
|
-
sid: z.string().optional(),
|
|
25
|
-
});
|
|
26
|
-
const SendMagicCodeErrorSchema = z.object({
|
|
27
|
-
error_identifier: z.string(),
|
|
28
|
-
enable_resend_after: z.number(),
|
|
29
|
-
});
|
|
30
|
-
const TokenResponseSchema = z.object({
|
|
31
|
-
jwt: z.string(),
|
|
32
|
-
sid: z.string().optional(),
|
|
33
|
-
});
|
|
34
|
-
const RequiredFieldsResponseSchema = z.object({
|
|
35
|
-
error_identifier: z.literal("missing_required_fields"),
|
|
36
|
-
fields: UserProfileSchema.omit({ custom_attributes: true }).partial().extend({
|
|
37
|
-
custom_attributes: UserProfileSchema.shape.custom_attributes?.optional(),
|
|
38
|
-
}),
|
|
39
|
-
sid: z.string().optional(),
|
|
40
|
-
});
|
|
41
|
-
const InvalidPasswordResponseSchema = z.object({
|
|
42
|
-
error_details: z.object({
|
|
43
|
-
password: z.array(z.string()),
|
|
44
|
-
}),
|
|
45
|
-
});
|
|
46
|
-
const PasskeyOptionsResponseSchema = z.object({
|
|
47
|
-
challenge: z.string(),
|
|
48
|
-
timeout: z.number(),
|
|
49
|
-
rpId: z.string(),
|
|
50
|
-
userVerification: z.string(),
|
|
51
|
-
allowCredentials: z.array(z.any()),
|
|
52
|
-
});
|
|
53
|
-
const PasskeyCredentialSchema = z.object({
|
|
54
|
-
id: z.string(),
|
|
55
|
-
rawId: z.string(),
|
|
56
|
-
response: z.object({
|
|
57
|
-
authenticatorData: z.string(),
|
|
58
|
-
clientDataJSON: z.string(),
|
|
59
|
-
signature: z.string(),
|
|
60
|
-
}),
|
|
61
|
-
type: z.string(),
|
|
62
|
-
});
|
|
63
|
-
export class AuthService {
|
|
64
|
-
client;
|
|
65
|
-
constructor(client) {
|
|
66
|
-
this.client = client;
|
|
67
|
-
}
|
|
68
|
-
async createSignIn(email, password, sendMagicCode) {
|
|
69
|
-
const response = await this.client.post("/api/sdk/v1/sign_ins", { email, password, sendMagicCode });
|
|
70
|
-
return this.handleResponse(response, () => {
|
|
71
|
-
if (!response.success) {
|
|
72
|
-
const missing_fields_check = RequiredFieldsResponseSchema.safeParse(response.data);
|
|
73
|
-
if (missing_fields_check.success) {
|
|
74
|
-
return ["missing_required_fields", missing_fields_check.data];
|
|
75
|
-
}
|
|
76
|
-
const error_response = ErrorSchema.parse(response.data);
|
|
77
|
-
return [
|
|
78
|
-
error_response.error_identifier,
|
|
79
|
-
error_response,
|
|
80
|
-
];
|
|
81
|
-
}
|
|
82
|
-
if (password) {
|
|
83
|
-
return [null, TokenResponseSchema.parse(response.data)];
|
|
84
|
-
}
|
|
85
|
-
if (sendMagicCode) {
|
|
86
|
-
return [null, SendMagicCodeResponseSchema.parse(response.data)];
|
|
87
|
-
}
|
|
88
|
-
return [null, CreateSignInResponseSchema.parse(response.data)];
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
async sendMagicCode(signInId) {
|
|
92
|
-
const response = await this.client.post(`/api/sdk/v1/sign_ins/${signInId}/send_magic_code`, {});
|
|
93
|
-
return this.handleResponse(response, () => {
|
|
94
|
-
if (!response.success) {
|
|
95
|
-
try {
|
|
96
|
-
const error_response = SendMagicCodeErrorSchema.parse(response.data);
|
|
97
|
-
return ["magic_code_recently_created", error_response];
|
|
98
|
-
}
|
|
99
|
-
catch {
|
|
100
|
-
const error_response = ErrorSchema.parse(response.data);
|
|
101
|
-
return [error_response.error_identifier, error_response];
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return [null, SendMagicCodeResponseSchema.parse(response.data)];
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
async authenticateWithPassword(signInId, password) {
|
|
108
|
-
const response = await this.client.post(`/api/sdk/v1/sign_ins/${signInId}/authenticate`, {
|
|
109
|
-
password,
|
|
110
|
-
});
|
|
111
|
-
return this.handleResponse(response, () => {
|
|
112
|
-
if (!response.success) {
|
|
113
|
-
const missing_fields_check = RequiredFieldsResponseSchema.safeParse(response.data);
|
|
114
|
-
if (missing_fields_check.success) {
|
|
115
|
-
return ["missing_required_fields", missing_fields_check.data];
|
|
116
|
-
}
|
|
117
|
-
const error_response = ErrorSchema.parse(response.data);
|
|
118
|
-
return [
|
|
119
|
-
error_response.error_identifier,
|
|
120
|
-
error_response,
|
|
121
|
-
];
|
|
122
|
-
}
|
|
123
|
-
return [null, TokenResponseSchema.parse(response.data)];
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
// biome-ignore lint/suspicious/noExplicitAny: user fields are dynamic
|
|
127
|
-
async updateMissingFields(signInId, user) {
|
|
128
|
-
const response = await this.client.patch(`/api/sdk/v1/sign_ins/${signInId}/update_required_fields`, {
|
|
129
|
-
user,
|
|
130
|
-
});
|
|
131
|
-
return this.handleResponse(response, () => {
|
|
132
|
-
if (!response.success) {
|
|
133
|
-
const missing_fields_check = RequiredFieldsResponseSchema.safeParse(response.data);
|
|
134
|
-
if (missing_fields_check.success) {
|
|
135
|
-
return ["missing_required_fields", missing_fields_check.data];
|
|
136
|
-
}
|
|
137
|
-
const error_response = ErrorSchema.parse(response.data);
|
|
138
|
-
return [error_response.error_identifier, error_response];
|
|
139
|
-
}
|
|
140
|
-
return [null, TokenResponseSchema.parse(response.data)];
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
async authenticateWithMagicCode(signInId, code) {
|
|
144
|
-
const response = await this.client.post(`/api/sdk/v1/sign_ins/${signInId}/authenticate`, {
|
|
145
|
-
code,
|
|
146
|
-
});
|
|
147
|
-
return this.handleResponse(response, () => {
|
|
148
|
-
if (!response.success) {
|
|
149
|
-
const missing_fields_check = RequiredFieldsResponseSchema.safeParse(response.data);
|
|
150
|
-
if (missing_fields_check.success) {
|
|
151
|
-
return ["missing_required_fields", missing_fields_check.data];
|
|
152
|
-
}
|
|
153
|
-
const error_response = ErrorSchema.parse(response.data);
|
|
154
|
-
return [
|
|
155
|
-
error_response.error_identifier,
|
|
156
|
-
error_response,
|
|
157
|
-
];
|
|
158
|
-
}
|
|
159
|
-
return [null, TokenResponseSchema.parse(response.data)];
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
async refreshToken(signInId) {
|
|
163
|
-
const response = await this.client.post(`/api/sdk/v1/sign_ins/${signInId}/refresh_token`, {});
|
|
164
|
-
return this.handleResponse(response, () => {
|
|
165
|
-
if (!response.success) {
|
|
166
|
-
const error_response = ErrorSchema.parse(response.data);
|
|
167
|
-
return [error_response.error_identifier, error_response];
|
|
168
|
-
}
|
|
169
|
-
return [null, TokenResponseSchema.parse(response.data)];
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
async sendResetPasswordEmail(signInId, returnTo) {
|
|
173
|
-
const response = await this.client.post(`/api/sdk/v1/sign_ins/${signInId}/password_reset/send`, { return_to: returnTo });
|
|
174
|
-
return this.handleResponse(response, () => {
|
|
175
|
-
if (!response.success) {
|
|
176
|
-
const error_response = ErrorSchema.parse(response.data);
|
|
177
|
-
return [
|
|
178
|
-
error_response.error_identifier,
|
|
179
|
-
error_response,
|
|
180
|
-
];
|
|
181
|
-
}
|
|
182
|
-
return [null, null];
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
async resetPassword(signInId, token, password, passwordConfirmation) {
|
|
186
|
-
const response = await this.client.patch(`/api/sdk/v1/sign_ins/${signInId}/password_reset`, {
|
|
187
|
-
token,
|
|
188
|
-
password,
|
|
189
|
-
password_confirmation: passwordConfirmation,
|
|
190
|
-
});
|
|
191
|
-
return this.handleResponse(response, () => {
|
|
192
|
-
if (!response.success) {
|
|
193
|
-
const error_response = ErrorSchema.parse(response.data);
|
|
194
|
-
return [
|
|
195
|
-
error_response.error_identifier,
|
|
196
|
-
response.data,
|
|
197
|
-
];
|
|
198
|
-
}
|
|
199
|
-
return [null, null];
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
async validateResetPasswordToken(signInId, token) {
|
|
203
|
-
const response = await this.client.get(`/api/sdk/v1/sign_ins/${signInId}/password_reset?token=${encodeURIComponent(token)}`);
|
|
204
|
-
return this.handleResponse(response, () => {
|
|
205
|
-
if (!response.success) {
|
|
206
|
-
const error_response = ErrorSchema.parse(response.data);
|
|
207
|
-
return [error_response.error_identifier, error_response];
|
|
208
|
-
}
|
|
209
|
-
return [null, null];
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
async signOut(signInId) {
|
|
213
|
-
const response = await this.client.post(`/api/sdk/v1/sign_ins/${signInId}/sign_out`, {});
|
|
214
|
-
return this.handleResponse(response, () => {
|
|
215
|
-
if (!response.success) {
|
|
216
|
-
const error_response = ErrorSchema.parse(response.data);
|
|
217
|
-
return [error_response.error_identifier, error_response];
|
|
218
|
-
}
|
|
219
|
-
return [null, null];
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
async getPasskeyOptions(sid) {
|
|
223
|
-
const endpoint = sid ? `/api/sdk/v1/passkeys/new?sid=${encodeURIComponent(sid)}` : "/api/sdk/v1/passkeys/new";
|
|
224
|
-
const response = await this.client.get(endpoint);
|
|
225
|
-
return this.handleResponse(response, () => {
|
|
226
|
-
if (!response.success) {
|
|
227
|
-
const error_response = ErrorSchema.parse(response.data);
|
|
228
|
-
return ["bad_request", error_response];
|
|
229
|
-
}
|
|
230
|
-
return [null, PasskeyOptionsResponseSchema.parse(response.data)];
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
async authenticateWithPasskey(credential) {
|
|
234
|
-
const response = await this.client.post("/api/sdk/v1/passkeys", {
|
|
235
|
-
publicKeyCredential: credential,
|
|
236
|
-
});
|
|
237
|
-
return this.handleResponse(response, () => {
|
|
238
|
-
if (!response.success) {
|
|
239
|
-
const error_response = ErrorSchema.parse(response.data);
|
|
240
|
-
return [
|
|
241
|
-
error_response.error_identifier,
|
|
242
|
-
error_response,
|
|
243
|
-
];
|
|
244
|
-
}
|
|
245
|
-
return [null, TokenResponseSchema.parse(response.data)];
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
handleResponse(
|
|
249
|
-
// biome-ignore lint/suspicious/noExplicitAny: generic handler for all responses
|
|
250
|
-
response, handler) {
|
|
251
|
-
if (response.connectionError) {
|
|
252
|
-
unidyState.backendConnected = false;
|
|
253
|
-
return ["connection_failed", null];
|
|
254
|
-
}
|
|
255
|
-
try {
|
|
256
|
-
return handler();
|
|
257
|
-
}
|
|
258
|
-
catch (error) {
|
|
259
|
-
Sentry.captureException(error);
|
|
260
|
-
return ["schema_validation_error", SchemaValidationErrorSchema.parse(response.data)];
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
//# sourceMappingURL=auth.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/auth/api/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAA8C,2BAA2B,EAAE,MAAM,WAAW,CAAC;AACpG,OAAO,EAAE,iBAAiB,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AAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;YAC/B,OAAO,CAAC,yBAAyB,EAAE,2BAA2B,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;QACvF,CAAC;IACH,CAAC;CACF","sourcesContent":["import * as Sentry from \"@sentry/browser\";\nimport * as z from \"zod\";\n\nimport { type ApiClient, type SchemaValidationError, SchemaValidationErrorSchema } from \"../../api\";\nimport { UserProfileSchema } from \"../../profile\";\nimport { unidyState } from \"../../shared/store/unidy-store\";\n\nconst LoginOptionsSchema = z.object({\n magic_link: z.boolean(),\n password: z.boolean(),\n social_logins: z.array(z.string()),\n passkey: z.boolean(),\n});\n\nconst CreateSignInResponseSchema = z.object({\n sid: z.string(),\n status: z.enum([\"pending_verification\", \"authenticated\", \"completed\"]),\n email: z.string(),\n expired: z.boolean(),\n login_options: LoginOptionsSchema,\n});\n\nconst ErrorSchema = z.object({\n error_identifier: z.string(),\n});\n\nconst SendMagicCodeResponseSchema = z.object({\n enable_resend_after: z.number(),\n sid: z.string().optional(),\n});\n\nconst SendMagicCodeErrorSchema = z.object({\n error_identifier: z.string(),\n enable_resend_after: z.number(),\n});\n\nconst TokenResponseSchema = z.object({\n jwt: z.string(),\n sid: z.string().optional(),\n});\n\nconst RequiredFieldsResponseSchema = z.object({\n error_identifier: z.literal(\"missing_required_fields\"),\n fields: UserProfileSchema.omit({ custom_attributes: true }).partial().extend({\n custom_attributes: UserProfileSchema.shape.custom_attributes?.optional(),\n }),\n sid: z.string().optional(),\n});\n\nconst InvalidPasswordResponseSchema = z.object({\n error_details: z.object({\n password: z.array(z.string()),\n }),\n});\n\nexport type ErrorResponse = z.infer<typeof ErrorSchema>;\nexport type LoginOptions = z.infer<typeof LoginOptionsSchema>;\nexport type CreateSignInResponse = z.infer<typeof CreateSignInResponseSchema>;\nexport type TokenResponse = z.infer<typeof TokenResponseSchema>;\nexport type SendMagicCodeResponse = z.infer<typeof SendMagicCodeResponseSchema>;\nexport type RequiredFieldsResponse = z.infer<typeof RequiredFieldsResponseSchema>;\nexport type SendMagicCodeError = z.infer<typeof SendMagicCodeErrorSchema>;\n\ntype CommonErrors = [\"connection_failed\", null] | [\"schema_validation_error\", SchemaValidationError];\n\nexport type CreateSignInResult =\n | CommonErrors\n | [\"account_not_found\", ErrorResponse]\n | [null, CreateSignInResponse]\n | AuthenticateWithPasswordResult\n | SendMagicCodeResult;\n\nexport type AuthenticateResultShared =\n | CommonErrors\n | [\"sign_in_not_found\", ErrorResponse]\n | [\"sign_in_expired\", ErrorResponse]\n | [\"account_locked\", ErrorResponse]\n | [\"missing_required_fields\", RequiredFieldsResponse]\n | [null, TokenResponse];\n\nexport type SendMagicCodeResult =\n | CommonErrors\n | [\"magic_code_recently_created\", SendMagicCodeError]\n | [\"sign_in_not_found\", ErrorResponse]\n | [\"sign_in_expired\", ErrorResponse]\n | [\"account_locked\", ErrorResponse]\n | [null, SendMagicCodeResponse];\n\nexport type AuthenticateWithPasswordResult = [\"invalid_password\", ErrorResponse] | AuthenticateResultShared;\n\nexport type AuthenticateWithMagicCodeResult =\n | [\"not_valid\", ErrorResponse]\n | [\"used\", ErrorResponse]\n | [\"expired\", ErrorResponse]\n | AuthenticateResultShared;\n\nexport type RefreshTokenResult =\n | CommonErrors\n | [\"invalid_refresh_token\", ErrorResponse]\n | [\"refresh_token_revoked\", ErrorResponse]\n | [\"sign_in_not_found\", ErrorResponse]\n | [null, TokenResponse];\n\nexport type SendResetPasswordEmailResult =\n | CommonErrors\n | [\"password_not_set\", ErrorResponse]\n | [\"reset_password_already_sent\", ErrorResponse]\n | [\"sign_in_not_found\", ErrorResponse]\n | [\"invalid_return_to\", ErrorResponse]\n | [\"return_to_required\", ErrorResponse]\n | [null, null];\n\nexport type InvalidPasswordResponse = z.infer<typeof InvalidPasswordResponseSchema>;\n\nexport type ResetPasswordResult =\n | CommonErrors\n | [\"reset_token_missing\", ErrorResponse]\n | [\"invalid_reset_token\", ErrorResponse]\n | [\"reset_token_expired\", ErrorResponse]\n | [\"invalid_password\", InvalidPasswordResponse]\n | [null, null];\n\nexport type ValidateResetPasswordTokenResult =\n | CommonErrors\n | [\"reset_token_missing\", ErrorResponse]\n | [\"invalid_reset_token\", ErrorResponse]\n | [\"reset_token_expired\", ErrorResponse]\n | [null, null];\n\nexport type SignOutResult =\n | CommonErrors\n | [\"sign_in_not_found\", ErrorResponse]\n | [\"missing_id_token\", ErrorResponse]\n | [\"invalid_id_token\", ErrorResponse]\n | [null, null];\n\nconst PasskeyOptionsResponseSchema = z.object({\n challenge: z.string(),\n timeout: z.number(),\n rpId: z.string(),\n userVerification: z.string(),\n allowCredentials: z.array(z.any()),\n});\n\nconst PasskeyCredentialSchema = z.object({\n id: z.string(),\n rawId: z.string(),\n response: z.object({\n authenticatorData: z.string(),\n clientDataJSON: z.string(),\n signature: z.string(),\n }),\n type: z.string(),\n});\n\nexport type PasskeyOptionsResponse = z.infer<typeof PasskeyOptionsResponseSchema>;\nexport type PasskeyCredential = z.infer<typeof PasskeyCredentialSchema>;\n\nexport type GetPasskeyOptionsResult = CommonErrors | [\"bad_request\", ErrorResponse] | [null, PasskeyOptionsResponse];\n\nexport type AuthenticateWithPasskeyResult =\n | CommonErrors\n | [\"invalid_passkey\", ErrorResponse]\n | [\"verification_failed\", ErrorResponse]\n | [\"authentication_failed\", ErrorResponse]\n | [\"bad_request\", ErrorResponse]\n | [null, TokenResponse];\n\nexport class AuthService {\n private client: ApiClient;\n\n constructor(client: ApiClient) {\n this.client = client;\n }\n\n async createSignIn(email: string, password?: string, sendMagicCode?: boolean): Promise<CreateSignInResult> {\n const response = await this.client.post<CreateSignInResponse>(\"/api/sdk/v1/sign_ins\", { email, password, sendMagicCode });\n\n return this.handleResponse(response, () => {\n if (!response.success) {\n const missing_fields_check = RequiredFieldsResponseSchema.safeParse(response.data);\n\n if (missing_fields_check.success) {\n return [\"missing_required_fields\", missing_fields_check.data];\n }\n const error_response = ErrorSchema.parse(response.data);\n return [\n error_response.error_identifier as\n | \"account_not_found\"\n | \"sign_in_not_found\"\n | \"sign_in_expired\"\n | \"account_locked\"\n | \"invalid_password\",\n error_response,\n ];\n }\n\n if (password) {\n return [null, TokenResponseSchema.parse(response.data)];\n }\n\n if (sendMagicCode) {\n return [null, SendMagicCodeResponseSchema.parse(response.data)];\n }\n\n return [null, CreateSignInResponseSchema.parse(response.data)];\n });\n }\n\n async sendMagicCode(signInId: string): Promise<SendMagicCodeResult> {\n const response = await this.client.post<SendMagicCodeResponse>(`/api/sdk/v1/sign_ins/${signInId}/send_magic_code`, {});\n\n return this.handleResponse(response, () => {\n if (!response.success) {\n try {\n const error_response = SendMagicCodeErrorSchema.parse(response.data);\n return [\"magic_code_recently_created\", error_response];\n } catch {\n const error_response = ErrorSchema.parse(response.data);\n return [error_response.error_identifier as \"sign_in_not_found\" | \"sign_in_expired\" | \"account_locked\", error_response];\n }\n }\n\n return [null, SendMagicCodeResponseSchema.parse(response.data)];\n });\n }\n\n async authenticateWithPassword(signInId: string, password: string): Promise<AuthenticateWithPasswordResult> {\n const response = await this.client.post<{ password: string }>(`/api/sdk/v1/sign_ins/${signInId}/authenticate`, {\n password,\n });\n\n return this.handleResponse(response, () => {\n if (!response.success) {\n const missing_fields_check = RequiredFieldsResponseSchema.safeParse(response.data);\n\n if (missing_fields_check.success) {\n return [\"missing_required_fields\", missing_fields_check.data];\n }\n const error_response = ErrorSchema.parse(response.data);\n\n return [\n error_response.error_identifier as \"sign_in_not_found\" | \"sign_in_expired\" | \"account_locked\" | \"invalid_password\",\n error_response,\n ];\n }\n\n return [null, TokenResponseSchema.parse(response.data)];\n });\n }\n\n // biome-ignore lint/suspicious/noExplicitAny: user fields are dynamic\n async updateMissingFields(signInId: string, user: Record<string, any>): Promise<AuthenticateResultShared> {\n const response = await this.client.patch<unknown>(`/api/sdk/v1/sign_ins/${signInId}/update_required_fields`, {\n user,\n });\n\n return this.handleResponse(response, () => {\n if (!response.success) {\n const missing_fields_check = RequiredFieldsResponseSchema.safeParse(response.data);\n if (missing_fields_check.success) {\n return [\"missing_required_fields\", missing_fields_check.data];\n }\n\n const error_response = ErrorSchema.parse(response.data);\n\n return [error_response.error_identifier as \"sign_in_not_found\" | \"sign_in_expired\" | \"account_locked\", error_response];\n }\n\n return [null, TokenResponseSchema.parse(response.data)];\n });\n }\n\n async authenticateWithMagicCode(signInId: string, code: string): Promise<AuthenticateWithMagicCodeResult> {\n const response = await this.client.post<{ code: string }>(`/api/sdk/v1/sign_ins/${signInId}/authenticate`, {\n code,\n });\n\n return this.handleResponse(response, () => {\n if (!response.success) {\n const missing_fields_check = RequiredFieldsResponseSchema.safeParse(response.data);\n\n if (missing_fields_check.success) {\n return [\"missing_required_fields\", missing_fields_check.data];\n }\n\n const error_response = ErrorSchema.parse(response.data);\n\n return [\n error_response.error_identifier as \"sign_in_not_found\" | \"sign_in_expired\" | \"account_locked\" | \"not_valid\" | \"used\" | \"expired\",\n error_response,\n ];\n }\n return [null, TokenResponseSchema.parse(response.data)];\n });\n }\n\n async refreshToken(signInId: string): Promise<RefreshTokenResult> {\n const response = await this.client.post<Record<string, never>>(`/api/sdk/v1/sign_ins/${signInId}/refresh_token`, {});\n\n return this.handleResponse(response, () => {\n if (!response.success) {\n const error_response = ErrorSchema.parse(response.data);\n\n return [error_response.error_identifier as \"invalid_refresh_token\" | \"refresh_token_revoked\" | \"sign_in_not_found\", error_response];\n }\n\n return [null, TokenResponseSchema.parse(response.data)];\n });\n }\n\n async sendResetPasswordEmail(signInId: string, returnTo: string): Promise<SendResetPasswordEmailResult> {\n const response = await this.client.post<null>(`/api/sdk/v1/sign_ins/${signInId}/password_reset/send`, { return_to: returnTo });\n\n return this.handleResponse(response, () => {\n if (!response.success) {\n const error_response = ErrorSchema.parse(response.data);\n\n return [\n error_response.error_identifier as\n | \"password_not_set\"\n | \"reset_password_already_sent\"\n | \"sign_in_not_found\"\n | \"invalid_return_to\"\n | \"return_to_required\",\n error_response,\n ];\n }\n\n return [null, null];\n });\n }\n\n async resetPassword(signInId: string, token: string, password: string, passwordConfirmation: string): Promise<ResetPasswordResult> {\n const response = await this.client.patch<null>(`/api/sdk/v1/sign_ins/${signInId}/password_reset`, {\n token,\n password,\n password_confirmation: passwordConfirmation,\n });\n\n return this.handleResponse(response, () => {\n if (!response.success) {\n const error_response = ErrorSchema.parse(response.data);\n\n return [\n error_response.error_identifier as \"reset_token_missing\" | \"invalid_reset_token\" | \"reset_token_expired\" | \"invalid_password\",\n response.data,\n ];\n }\n\n return [null, null];\n });\n }\n\n async validateResetPasswordToken(signInId: string, token: string): Promise<ValidateResetPasswordTokenResult> {\n const response = await this.client.get<{ valid: boolean }>(\n `/api/sdk/v1/sign_ins/${signInId}/password_reset?token=${encodeURIComponent(token)}`,\n );\n\n return this.handleResponse(response, () => {\n if (!response.success) {\n const error_response = ErrorSchema.parse(response.data);\n return [error_response.error_identifier as \"reset_token_missing\" | \"invalid_reset_token\" | \"reset_token_expired\", error_response];\n }\n\n return [null, null];\n });\n }\n\n async signOut(signInId: string): Promise<SignOutResult> {\n const response = await this.client.post<null>(`/api/sdk/v1/sign_ins/${signInId}/sign_out`, {});\n\n return this.handleResponse(response, () => {\n if (!response.success) {\n const error_response = ErrorSchema.parse(response.data);\n\n return [error_response.error_identifier as \"sign_in_not_found\" | \"missing_id_token\" | \"invalid_id_token\", error_response];\n }\n\n return [null, null];\n });\n }\n\n async getPasskeyOptions(sid?: string): Promise<GetPasskeyOptionsResult> {\n const endpoint = sid ? `/api/sdk/v1/passkeys/new?sid=${encodeURIComponent(sid)}` : \"/api/sdk/v1/passkeys/new\";\n const response = await this.client.get<PasskeyOptionsResponse>(endpoint);\n\n return this.handleResponse(response, () => {\n if (!response.success) {\n const error_response = ErrorSchema.parse(response.data);\n return [\"bad_request\", error_response];\n }\n\n return [null, PasskeyOptionsResponseSchema.parse(response.data)];\n });\n }\n\n async authenticateWithPasskey(credential: PasskeyCredential): Promise<AuthenticateWithPasskeyResult> {\n const response = await this.client.post<{ publicKeyCredential: PasskeyCredential }>(\"/api/sdk/v1/passkeys\", {\n publicKeyCredential: credential,\n });\n\n return this.handleResponse(response, () => {\n if (!response.success) {\n const error_response = ErrorSchema.parse(response.data);\n return [\n error_response.error_identifier as \"invalid_passkey\" | \"verification_failed\" | \"authentication_failed\" | \"bad_request\",\n error_response,\n ];\n }\n\n return [null, TokenResponseSchema.parse(response.data)];\n });\n }\n\n private handleResponse<T>(\n // biome-ignore lint/suspicious/noExplicitAny: generic handler for all responses\n response: any,\n handler: () => T,\n ): T | [\"connection_failed\", null] | [\"schema_validation_error\", SchemaValidationError] {\n if (response.connectionError) {\n unidyState.backendConnected = false;\n\n return [\"connection_failed\", null];\n }\n\n try {\n return handler();\n } catch (error) {\n Sentry.captureException(error);\n return [\"schema_validation_error\", SchemaValidationErrorSchema.parse(response.data)];\n }\n }\n}\n"]}
|