@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,189 +0,0 @@
|
|
|
1
|
-
import * as Sentry from "@sentry/browser";
|
|
2
|
-
import * as z from "zod/mini";
|
|
3
|
-
import EventEmitter from "eventemitter3";
|
|
4
|
-
import { createLogger } from "../../logger";
|
|
5
|
-
const NewsletterSubscriptionSchema = z.object({
|
|
6
|
-
id: z.number(),
|
|
7
|
-
email: z.string(),
|
|
8
|
-
newsletter_internal_name: z.string(),
|
|
9
|
-
preference_identifiers: z.array(z.string()),
|
|
10
|
-
preference_token: z.string(),
|
|
11
|
-
confirmed_at: z.union([z.string(), z.null()]),
|
|
12
|
-
});
|
|
13
|
-
const NewsletterSubscriptionErrorSchema = z.object({
|
|
14
|
-
error_identifier: z.string(),
|
|
15
|
-
error_details: z.optional(z.record(z.string(), z.array(z.string()))),
|
|
16
|
-
meta: z.object({
|
|
17
|
-
newsletter_internal_name: z.string(),
|
|
18
|
-
}),
|
|
19
|
-
});
|
|
20
|
-
const CreateSubscriptionsResponseSchema = z.object({
|
|
21
|
-
results: z.array(NewsletterSubscriptionSchema),
|
|
22
|
-
errors: z.array(NewsletterSubscriptionErrorSchema),
|
|
23
|
-
});
|
|
24
|
-
const AdditionalFieldsSchema = z.object({
|
|
25
|
-
first_name: z.optional(z.union([z.string(), z.null()])),
|
|
26
|
-
last_name: z.optional(z.union([z.string(), z.null()])),
|
|
27
|
-
salutation: z.optional(z.union([z.literal("mr"), z.literal("mrs"), z.literal("mx"), z.null()])),
|
|
28
|
-
phone_number: z.optional(z.union([z.string(), z.null()])),
|
|
29
|
-
date_of_birth: z.optional(z.union([z.string(), z.null()])),
|
|
30
|
-
company_name: z.optional(z.union([z.string(), z.null()])),
|
|
31
|
-
address_line_1: z.optional(z.union([z.string(), z.null()])),
|
|
32
|
-
address_line_2: z.optional(z.union([z.string(), z.null()])),
|
|
33
|
-
city: z.optional(z.union([z.string(), z.null()])),
|
|
34
|
-
postal_code: z.optional(z.union([z.string(), z.null()])),
|
|
35
|
-
country_code: z.optional(z.union([z.string(), z.null()])),
|
|
36
|
-
preferred_language: z.optional(z.union([z.string(), z.null()])),
|
|
37
|
-
custom_attributes: z.optional(z.union([z.record(z.string(), z.unknown()), z.null()])),
|
|
38
|
-
});
|
|
39
|
-
const CreateSubscriptionsPayloadSchema = z.object({
|
|
40
|
-
email: z.string(),
|
|
41
|
-
additional_fields: z.optional(AdditionalFieldsSchema),
|
|
42
|
-
newsletter_subscriptions: z.array(z.object({
|
|
43
|
-
newsletter_internal_name: z.string(),
|
|
44
|
-
preference_identifiers: z.optional(z.array(z.string())),
|
|
45
|
-
})),
|
|
46
|
-
redirect_to_after_confirmation: z.optional(z.string()),
|
|
47
|
-
});
|
|
48
|
-
const UpdateSubscriptionPayloadSchema = z.object({
|
|
49
|
-
preference_identifiers: z.array(z.string()),
|
|
50
|
-
});
|
|
51
|
-
const LoginEmailPayloadSchema = z.object({
|
|
52
|
-
email: z.string(),
|
|
53
|
-
redirect_uri: z.string(),
|
|
54
|
-
});
|
|
55
|
-
const ResendDoiPayloadSchema = z.object({
|
|
56
|
-
redirect_to_after_confirmation: z.optional(z.string()),
|
|
57
|
-
});
|
|
58
|
-
const PreferenceSchema = z.object({
|
|
59
|
-
id: z.number(),
|
|
60
|
-
name: z.string(),
|
|
61
|
-
description: z.union([z.string(), z.null()]),
|
|
62
|
-
plugin_identifier: z.union([z.string(), z.null()]),
|
|
63
|
-
position: z.number(),
|
|
64
|
-
default: z.boolean(),
|
|
65
|
-
hidden: z.boolean(),
|
|
66
|
-
});
|
|
67
|
-
const PreferenceGroupSchema = z.object({
|
|
68
|
-
id: z.number(),
|
|
69
|
-
name: z.string(),
|
|
70
|
-
position: z.number(),
|
|
71
|
-
flat: z.boolean(),
|
|
72
|
-
preferences: z.array(PreferenceSchema),
|
|
73
|
-
});
|
|
74
|
-
const NewsletterSchema = z.object({
|
|
75
|
-
id: z.number(),
|
|
76
|
-
internal_name: z.string(),
|
|
77
|
-
default: z.boolean(),
|
|
78
|
-
position: z.number(),
|
|
79
|
-
opt_in_type: z.string(),
|
|
80
|
-
title: z.string(),
|
|
81
|
-
description: z.union([z.string(), z.null()]),
|
|
82
|
-
created_at: z.string(),
|
|
83
|
-
updated_at: z.string(),
|
|
84
|
-
preference_groups: z.array(PreferenceGroupSchema),
|
|
85
|
-
});
|
|
86
|
-
const NewslettersResponseSchema = z.object({
|
|
87
|
-
newsletters: z.array(NewsletterSchema),
|
|
88
|
-
});
|
|
89
|
-
export class NewsletterService extends EventEmitter {
|
|
90
|
-
client;
|
|
91
|
-
logger = createLogger("NewsletterService");
|
|
92
|
-
constructor(client) {
|
|
93
|
-
super();
|
|
94
|
-
this.client = client;
|
|
95
|
-
}
|
|
96
|
-
buildAuthHeaders(auth) {
|
|
97
|
-
if (!auth)
|
|
98
|
-
return undefined;
|
|
99
|
-
const headers = {};
|
|
100
|
-
if (auth.idToken) {
|
|
101
|
-
headers["X-ID-Token"] = auth.idToken;
|
|
102
|
-
}
|
|
103
|
-
if (auth.preferenceToken) {
|
|
104
|
-
headers["X-Preference-Token"] = auth.preferenceToken;
|
|
105
|
-
}
|
|
106
|
-
return Object.keys(headers).length > 0 ? headers : undefined;
|
|
107
|
-
}
|
|
108
|
-
async createSubscriptions(payload, auth) {
|
|
109
|
-
CreateSubscriptionsPayloadSchema.parse(payload);
|
|
110
|
-
const response = await this.client.post("/api/sdk/v1/newsletters/newsletter_subscription", payload, this.buildAuthHeaders(auth));
|
|
111
|
-
switch (response.status) {
|
|
112
|
-
case 401:
|
|
113
|
-
this.emit("unauthorized", response);
|
|
114
|
-
return ["unauthorized", response];
|
|
115
|
-
case 429:
|
|
116
|
-
this.logger.warn("Rate limit exceeded");
|
|
117
|
-
this.emit("rate_limit_exceeded", response);
|
|
118
|
-
return ["rate_limit_exceeded", response];
|
|
119
|
-
case 500:
|
|
120
|
-
Sentry.captureException(response);
|
|
121
|
-
return ["server_error", response];
|
|
122
|
-
case 0:
|
|
123
|
-
return ["network_error", response];
|
|
124
|
-
default:
|
|
125
|
-
if (response.data) {
|
|
126
|
-
try {
|
|
127
|
-
const validatedData = CreateSubscriptionsResponseSchema.parse(response.data);
|
|
128
|
-
if (validatedData.errors.length > 0) {
|
|
129
|
-
this.emit("newsletter_error", response);
|
|
130
|
-
return ["newsletter_error", response];
|
|
131
|
-
}
|
|
132
|
-
return [null, response];
|
|
133
|
-
}
|
|
134
|
-
catch (_validationError) {
|
|
135
|
-
return ["schema_validation_error", response];
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return ["error", response];
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
async listSubscriptions(auth) {
|
|
142
|
-
return this.client.get("/api/sdk/v1/newsletters/newsletter_subscription", this.buildAuthHeaders(auth));
|
|
143
|
-
}
|
|
144
|
-
async getSubscription(internalName, auth) {
|
|
145
|
-
return this.client.get(`/api/sdk/v1/newsletters/${internalName}/newsletter_subscription`, this.buildAuthHeaders(auth));
|
|
146
|
-
}
|
|
147
|
-
async updateSubscription(internalName, payload, auth) {
|
|
148
|
-
UpdateSubscriptionPayloadSchema.parse(payload);
|
|
149
|
-
return this.client.patch(`/api/sdk/v1/newsletters/${internalName}/newsletter_subscription`, payload, this.buildAuthHeaders(auth));
|
|
150
|
-
}
|
|
151
|
-
async deleteSubscription(internalName, auth) {
|
|
152
|
-
return this.client.delete(`/api/sdk/v1/newsletters/${internalName}/newsletter_subscription`, this.buildAuthHeaders(auth));
|
|
153
|
-
}
|
|
154
|
-
async resendDoi(internalName, payload, auth) {
|
|
155
|
-
ResendDoiPayloadSchema.parse(payload);
|
|
156
|
-
return this.client.post(`/api/sdk/v1/newsletters/${internalName}/newsletter_subscription/resend_doi`, payload, this.buildAuthHeaders(auth));
|
|
157
|
-
}
|
|
158
|
-
async sendLoginEmail(payload) {
|
|
159
|
-
LoginEmailPayloadSchema.parse(payload);
|
|
160
|
-
return this.client.post("/api/sdk/v1/newsletters/newsletter_subscription/login_email", payload);
|
|
161
|
-
}
|
|
162
|
-
async listNewsletters() {
|
|
163
|
-
return this.client.get("/api/sdk/v1/newsletters");
|
|
164
|
-
}
|
|
165
|
-
async getNewsletter(internalName) {
|
|
166
|
-
return this.client.get(`/api/sdk/v1/newsletters/${internalName}`);
|
|
167
|
-
}
|
|
168
|
-
onError(callback, errorIdentifier) {
|
|
169
|
-
this.on("newsletter_error", (response) => {
|
|
170
|
-
if (!response.data?.errors) {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
const errors = errorIdentifier
|
|
174
|
-
? response.data.errors.filter((error) => error.error_identifier === errorIdentifier)
|
|
175
|
-
: response.data.errors;
|
|
176
|
-
if (errors.length > 0) {
|
|
177
|
-
callback(errors);
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
onRateLimitError(callback) {
|
|
182
|
-
this.on("rate_limit_exceeded", (response) => {
|
|
183
|
-
if (response.status === 429) {
|
|
184
|
-
callback();
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
//# sourceMappingURL=newsletters.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"newsletters.js","sourceRoot":"","sources":["../../../src/newsletter/api/newsletters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,KAAK,C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QACnC,IAAI,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC,QAAkD,EAAE,EAAE;YACpF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,QAAQ,EAAE,CAAC;YACb,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import * as Sentry from \"@sentry/browser\";\nimport * as z from \"zod/mini\";\nimport type { ApiClient, ApiResponse } from \"../../api\";\nimport EventEmitter from \"eventemitter3\";\nimport { createLogger } from \"../../logger\";\n\nconst NewsletterSubscriptionSchema = z.object({\n id: z.number(),\n email: z.string(),\n newsletter_internal_name: z.string(),\n preference_identifiers: z.array(z.string()),\n preference_token: z.string(),\n confirmed_at: z.union([z.string(), z.null()]),\n});\n\nconst NewsletterSubscriptionErrorSchema = z.object({\n error_identifier: z.string(),\n error_details: z.optional(z.record(z.string(), z.array(z.string()))),\n meta: z.object({\n newsletter_internal_name: z.string(),\n }),\n});\n\nconst CreateSubscriptionsResponseSchema = z.object({\n results: z.array(NewsletterSubscriptionSchema),\n errors: z.array(NewsletterSubscriptionErrorSchema),\n});\n\nconst AdditionalFieldsSchema = z.object({\n first_name: z.optional(z.union([z.string(), z.null()])),\n last_name: z.optional(z.union([z.string(), z.null()])),\n salutation: z.optional(z.union([z.literal(\"mr\"), z.literal(\"mrs\"), z.literal(\"mx\"), z.null()])),\n phone_number: z.optional(z.union([z.string(), z.null()])),\n date_of_birth: z.optional(z.union([z.string(), z.null()])),\n company_name: z.optional(z.union([z.string(), z.null()])),\n address_line_1: z.optional(z.union([z.string(), z.null()])),\n address_line_2: z.optional(z.union([z.string(), z.null()])),\n city: z.optional(z.union([z.string(), z.null()])),\n postal_code: z.optional(z.union([z.string(), z.null()])),\n country_code: z.optional(z.union([z.string(), z.null()])),\n preferred_language: z.optional(z.union([z.string(), z.null()])),\n custom_attributes: z.optional(z.union([z.record(z.string(), z.unknown()), z.null()])),\n});\n\nconst CreateSubscriptionsPayloadSchema = z.object({\n email: z.string(),\n additional_fields: z.optional(AdditionalFieldsSchema),\n newsletter_subscriptions: z.array(\n z.object({\n newsletter_internal_name: z.string(),\n preference_identifiers: z.optional(z.array(z.string())),\n }),\n ),\n redirect_to_after_confirmation: z.optional(z.string()),\n});\n\nconst UpdateSubscriptionPayloadSchema = z.object({\n preference_identifiers: z.array(z.string()),\n});\n\nconst LoginEmailPayloadSchema = z.object({\n email: z.string(),\n redirect_uri: z.string(),\n});\n\nconst ResendDoiPayloadSchema = z.object({\n redirect_to_after_confirmation: z.optional(z.string()),\n});\n\nconst PreferenceSchema = z.object({\n id: z.number(),\n name: z.string(),\n description: z.union([z.string(), z.null()]),\n plugin_identifier: z.union([z.string(), z.null()]),\n position: z.number(),\n default: z.boolean(),\n hidden: z.boolean(),\n});\n\nconst PreferenceGroupSchema = z.object({\n id: z.number(),\n name: z.string(),\n position: z.number(),\n flat: z.boolean(),\n preferences: z.array(PreferenceSchema),\n});\n\nconst NewsletterSchema = z.object({\n id: z.number(),\n internal_name: z.string(),\n default: z.boolean(),\n position: z.number(),\n opt_in_type: z.string(),\n title: z.string(),\n description: z.union([z.string(), z.null()]),\n created_at: z.string(),\n updated_at: z.string(),\n preference_groups: z.array(PreferenceGroupSchema),\n});\n\nconst NewslettersResponseSchema = z.object({\n newsletters: z.array(NewsletterSchema),\n});\n\nexport type NewsletterSubscription = z.infer<typeof NewsletterSubscriptionSchema>;\nexport type NewsletterSubscriptionError = z.infer<typeof NewsletterSubscriptionErrorSchema>;\nexport type CreateSubscriptionsResponse = z.infer<typeof CreateSubscriptionsResponseSchema>;\nexport type CreateSubscriptionsPayload = z.infer<typeof CreateSubscriptionsPayloadSchema>;\nexport type AdditionalFields = z.infer<typeof AdditionalFieldsSchema>;\nexport type UpdateSubscriptionPayload = z.infer<typeof UpdateSubscriptionPayloadSchema>;\nexport type LoginEmailPayload = z.infer<typeof LoginEmailPayloadSchema>;\nexport type ResendDoiPayload = z.infer<typeof ResendDoiPayloadSchema>;\nexport type Newsletter = z.infer<typeof NewsletterSchema>;\nexport type NewslettersResponse = z.infer<typeof NewslettersResponseSchema>;\nexport type Preference = z.infer<typeof PreferenceSchema>;\nexport type PreferenceGroup = z.infer<typeof PreferenceGroupSchema>;\n\nexport type SubscriptionAuthOptions = {\n idToken?: string;\n preferenceToken?: string;\n};\n\nexport type CreateSubscriptionsResult =\n | [\"schema_validation_error\", ApiResponse<CreateSubscriptionsResponse>]\n | [\"rate_limit_exceeded\", ApiResponse<CreateSubscriptionsResponse>]\n | [\"unauthorized\", ApiResponse<CreateSubscriptionsResponse>]\n | [\"newsletter_error\", ApiResponse<CreateSubscriptionsResponse>]\n | [\"network_error\", ApiResponse<CreateSubscriptionsResponse>]\n | [\"server_error\", ApiResponse<CreateSubscriptionsResponse>]\n | [\"error\", ApiResponse<CreateSubscriptionsResponse>]\n | [null, ApiResponse<CreateSubscriptionsResponse>];\n\nexport class NewsletterService extends EventEmitter {\n private client: ApiClient;\n private logger = createLogger(\"NewsletterService\");\n\n constructor(client: ApiClient) {\n super();\n this.client = client;\n }\n\n private buildAuthHeaders(auth?: SubscriptionAuthOptions): HeadersInit | undefined {\n if (!auth) return undefined;\n\n const headers: Record<string, string> = {};\n if (auth.idToken) {\n headers[\"X-ID-Token\"] = auth.idToken;\n }\n if (auth.preferenceToken) {\n headers[\"X-Preference-Token\"] = auth.preferenceToken;\n }\n return Object.keys(headers).length > 0 ? headers : undefined;\n }\n\n async createSubscriptions(payload: CreateSubscriptionsPayload, auth?: SubscriptionAuthOptions): Promise<CreateSubscriptionsResult> {\n CreateSubscriptionsPayloadSchema.parse(payload);\n\n const response = await this.client.post<CreateSubscriptionsResponse>(\n \"/api/sdk/v1/newsletters/newsletter_subscription\",\n payload,\n this.buildAuthHeaders(auth),\n );\n\n switch (response.status) {\n case 401:\n this.emit(\"unauthorized\", response);\n return [\"unauthorized\", response];\n case 429:\n this.logger.warn(\"Rate limit exceeded\");\n this.emit(\"rate_limit_exceeded\", response);\n return [\"rate_limit_exceeded\", response];\n case 500:\n Sentry.captureException(response);\n return [\"server_error\", response];\n case 0:\n return [\"network_error\", response];\n default:\n if (response.data) {\n try {\n const validatedData = CreateSubscriptionsResponseSchema.parse(response.data);\n\n if (validatedData.errors.length > 0) {\n this.emit(\"newsletter_error\", response);\n return [\"newsletter_error\", response];\n }\n\n return [null, response];\n } catch (_validationError) {\n return [\"schema_validation_error\", response];\n }\n }\n\n return [\"error\", response];\n }\n }\n\n async listSubscriptions(auth: SubscriptionAuthOptions): Promise<ApiResponse<NewsletterSubscription[]>> {\n return this.client.get<NewsletterSubscription[]>(\"/api/sdk/v1/newsletters/newsletter_subscription\", this.buildAuthHeaders(auth));\n }\n\n async getSubscription(internalName: string, auth: SubscriptionAuthOptions): Promise<ApiResponse<NewsletterSubscription>> {\n return this.client.get<NewsletterSubscription>(\n `/api/sdk/v1/newsletters/${internalName}/newsletter_subscription`,\n this.buildAuthHeaders(auth),\n );\n }\n\n async updateSubscription(\n internalName: string,\n payload: UpdateSubscriptionPayload,\n auth: SubscriptionAuthOptions,\n ): Promise<ApiResponse<NewsletterSubscription>> {\n UpdateSubscriptionPayloadSchema.parse(payload);\n\n return this.client.patch<NewsletterSubscription>(\n `/api/sdk/v1/newsletters/${internalName}/newsletter_subscription`,\n payload,\n this.buildAuthHeaders(auth),\n );\n }\n\n async deleteSubscription(\n internalName: string,\n auth: SubscriptionAuthOptions,\n ): Promise<ApiResponse<{ new_preference_token: string } | null>> {\n return this.client.delete<{ new_preference_token: string } | null>(\n `/api/sdk/v1/newsletters/${internalName}/newsletter_subscription`,\n this.buildAuthHeaders(auth),\n );\n }\n\n async resendDoi(internalName: string, payload: ResendDoiPayload, auth: SubscriptionAuthOptions): Promise<ApiResponse<null>> {\n ResendDoiPayloadSchema.parse(payload);\n\n return this.client.post<null>(\n `/api/sdk/v1/newsletters/${internalName}/newsletter_subscription/resend_doi`,\n payload,\n this.buildAuthHeaders(auth),\n );\n }\n\n async sendLoginEmail(payload: LoginEmailPayload): Promise<ApiResponse<null>> {\n LoginEmailPayloadSchema.parse(payload);\n\n return this.client.post<null>(\"/api/sdk/v1/newsletters/newsletter_subscription/login_email\", payload);\n }\n\n async listNewsletters(): Promise<ApiResponse<NewslettersResponse>> {\n return this.client.get<NewslettersResponse>(\"/api/sdk/v1/newsletters\");\n }\n\n async getNewsletter(internalName: string): Promise<ApiResponse<Newsletter>> {\n return this.client.get<Newsletter>(`/api/sdk/v1/newsletters/${internalName}`);\n }\n\n onError(\n callback: (errors: z.infer<typeof NewsletterSubscriptionErrorSchema>[]) => void,\n errorIdentifier?: \"unconfirmed\" | \"already_subscribed\" | \"invalid_email\",\n ): void {\n this.on(\"newsletter_error\", (response: ApiResponse<CreateSubscriptionsResponse>) => {\n if (!response.data?.errors) {\n return;\n }\n\n const errors = errorIdentifier\n ? response.data.errors.filter((error: { error_identifier: string }) => error.error_identifier === errorIdentifier)\n : response.data.errors;\n\n if (errors.length > 0) {\n callback(errors);\n }\n });\n }\n\n onRateLimitError(callback: () => void): void {\n this.on(\"rate_limit_exceeded\", (response: ApiResponse<CreateSubscriptionsResponse>) => {\n if (response.status === 429) {\n callback();\n }\n });\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/newsletter/components/helpers.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,uBAAuB,CAAC,OAAoB;IAC1D,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAA+B,CAAC;IAC1F,OAAO,cAAc,IAAI,IAAI,CAAC;AAChC,CAAC","sourcesContent":["export function getParentNewsletterRoot(element: HTMLElement): HTMLUNewsletterRootElement | null {\n const newsletterRoot = element.closest(\"u-newsletter-root\") as HTMLUNewsletterRootElement;\n return newsletterRoot || null;\n}\n"]}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { h, Host } from "@stencil/core";
|
|
2
|
-
import { newsletterLogout } from "../../newsletter-helpers";
|
|
3
|
-
import { t } from "../../../i18n";
|
|
4
|
-
import { Flash } from "../../../shared/store/flash-store";
|
|
5
|
-
import { newsletterStore } from "../../store/newsletter-store";
|
|
6
|
-
import { hasSlotContent } from "../../../shared/component-utils";
|
|
7
|
-
export class LogoutButton {
|
|
8
|
-
el;
|
|
9
|
-
componentClassName = "";
|
|
10
|
-
handleLogout = () => {
|
|
11
|
-
newsletterLogout();
|
|
12
|
-
Flash.success.addMessage(t("newsletter.success.logout"));
|
|
13
|
-
};
|
|
14
|
-
render() {
|
|
15
|
-
if (newsletterStore.state.preferenceToken === "" || newsletterStore.state.isAuthenticated) {
|
|
16
|
-
return h(Host, { style: { display: "none" } });
|
|
17
|
-
}
|
|
18
|
-
const hasContent = hasSlotContent(this.el);
|
|
19
|
-
return (h(Host, null, h("button", { type: "button", part: "button", class: this.componentClassName, onClick: this.handleLogout, "aria-label": "Logout", "aria-live": "polite" }, hasContent ? h("slot", null) : t("newsletter.buttons.logout"))));
|
|
20
|
-
}
|
|
21
|
-
static get is() { return "u-newsletter-logout-button"; }
|
|
22
|
-
static get properties() {
|
|
23
|
-
return {
|
|
24
|
-
"componentClassName": {
|
|
25
|
-
"type": "string",
|
|
26
|
-
"mutable": false,
|
|
27
|
-
"complexType": {
|
|
28
|
-
"original": "string",
|
|
29
|
-
"resolved": "string",
|
|
30
|
-
"references": {}
|
|
31
|
-
},
|
|
32
|
-
"required": false,
|
|
33
|
-
"optional": false,
|
|
34
|
-
"docs": {
|
|
35
|
-
"tags": [],
|
|
36
|
-
"text": ""
|
|
37
|
-
},
|
|
38
|
-
"getter": false,
|
|
39
|
-
"setter": false,
|
|
40
|
-
"reflect": false,
|
|
41
|
-
"attribute": "class-name",
|
|
42
|
-
"defaultValue": "\"\""
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
static get elementRef() { return "el"; }
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=logout-button.js.map
|
|
@@ -1 +0,0 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CAChD,CACJ,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, Element, Host } from \"@stencil/core\";\nimport { newsletterLogout } from \"../../newsletter-helpers\";\nimport { t } from \"../../../i18n\";\nimport { Flash } from \"../../../shared/store/flash-store\";\nimport { newsletterStore } from \"../../store/newsletter-store\";\nimport { hasSlotContent } from \"../../../shared/component-utils\";\n\n@Component({\n tag: \"u-newsletter-logout-button\",\n shadow: false,\n})\nexport class LogoutButton {\n @Element() el!: HTMLElement;\n\n @Prop({ attribute: \"class-name\" }) componentClassName = \"\";\n\n private handleLogout = () => {\n newsletterLogout();\n Flash.success.addMessage(t(\"newsletter.success.logout\"));\n };\n\n render() {\n if (newsletterStore.state.preferenceToken === \"\" || newsletterStore.state.isAuthenticated) {\n return <Host style={{ display: \"none\" }} />;\n }\n\n const hasContent = hasSlotContent(this.el);\n\n return (\n <Host>\n <button\n type=\"button\"\n part=\"button\"\n class={this.componentClassName}\n onClick={this.handleLogout}\n aria-label=\"Logout\"\n aria-live=\"polite\"\n >\n {hasContent ? <slot /> : t(\"newsletter.buttons.logout\")}\n </button>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { h } from "@stencil/core";
|
|
2
|
-
import * as NewsletterHelpers from "../../newsletter-helpers";
|
|
3
|
-
import { newsletterStore } from "../../store/newsletter-store";
|
|
4
|
-
export class NewsletterCheckbox {
|
|
5
|
-
internalName;
|
|
6
|
-
checked = false;
|
|
7
|
-
componentClassName;
|
|
8
|
-
componentWillLoad() {
|
|
9
|
-
if (this.checked && !this.isSubscribed) {
|
|
10
|
-
const checkedNewsletters = newsletterStore.state.checkedNewsletters;
|
|
11
|
-
if (!(this.internalName in checkedNewsletters)) {
|
|
12
|
-
newsletterStore.set("checkedNewsletters", {
|
|
13
|
-
...checkedNewsletters,
|
|
14
|
-
[this.internalName]: [],
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
get isSubscribed() {
|
|
20
|
-
return NewsletterHelpers.isSubscribed(this.internalName);
|
|
21
|
-
}
|
|
22
|
-
get isChecked() {
|
|
23
|
-
return this.isSubscribed || this.internalName in newsletterStore.state.checkedNewsletters;
|
|
24
|
-
}
|
|
25
|
-
syncToStore(checked) {
|
|
26
|
-
if (checked) {
|
|
27
|
-
newsletterStore.set("checkedNewsletters", {
|
|
28
|
-
...newsletterStore.state.checkedNewsletters,
|
|
29
|
-
[this.internalName]: [],
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
const { [this.internalName]: _, ...rest } = newsletterStore.state.checkedNewsletters;
|
|
34
|
-
newsletterStore.set("checkedNewsletters", rest);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
handleChange = () => {
|
|
38
|
-
if (this.isSubscribed)
|
|
39
|
-
return;
|
|
40
|
-
this.syncToStore(!this.isChecked);
|
|
41
|
-
};
|
|
42
|
-
/** Public method to toggle the checkbox programmatically */
|
|
43
|
-
async toggle() {
|
|
44
|
-
this.handleChange();
|
|
45
|
-
}
|
|
46
|
-
/** Public method to set the checkbox state programmatically */
|
|
47
|
-
async setChecked(checked) {
|
|
48
|
-
if (this.isSubscribed)
|
|
49
|
-
return;
|
|
50
|
-
if (checked !== this.isChecked) {
|
|
51
|
-
this.syncToStore(checked);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
render() {
|
|
55
|
-
return (h("input", { key: 'f628c5c8586ffd1c2b4b8acc31f5a7a17c2e37b0', type: "checkbox", checked: this.isChecked, disabled: this.isSubscribed, onChange: this.handleChange, class: this.componentClassName, "aria-checked": this.isChecked }));
|
|
56
|
-
}
|
|
57
|
-
static get is() { return "u-newsletter-checkbox"; }
|
|
58
|
-
static get properties() {
|
|
59
|
-
return {
|
|
60
|
-
"internalName": {
|
|
61
|
-
"type": "string",
|
|
62
|
-
"mutable": false,
|
|
63
|
-
"complexType": {
|
|
64
|
-
"original": "string",
|
|
65
|
-
"resolved": "string",
|
|
66
|
-
"references": {}
|
|
67
|
-
},
|
|
68
|
-
"required": true,
|
|
69
|
-
"optional": false,
|
|
70
|
-
"docs": {
|
|
71
|
-
"tags": [],
|
|
72
|
-
"text": ""
|
|
73
|
-
},
|
|
74
|
-
"getter": false,
|
|
75
|
-
"setter": false,
|
|
76
|
-
"reflect": false,
|
|
77
|
-
"attribute": "internal-name"
|
|
78
|
-
},
|
|
79
|
-
"checked": {
|
|
80
|
-
"type": "boolean",
|
|
81
|
-
"mutable": false,
|
|
82
|
-
"complexType": {
|
|
83
|
-
"original": "boolean",
|
|
84
|
-
"resolved": "boolean",
|
|
85
|
-
"references": {}
|
|
86
|
-
},
|
|
87
|
-
"required": false,
|
|
88
|
-
"optional": false,
|
|
89
|
-
"docs": {
|
|
90
|
-
"tags": [],
|
|
91
|
-
"text": ""
|
|
92
|
-
},
|
|
93
|
-
"getter": false,
|
|
94
|
-
"setter": false,
|
|
95
|
-
"reflect": false,
|
|
96
|
-
"attribute": "checked",
|
|
97
|
-
"defaultValue": "false"
|
|
98
|
-
},
|
|
99
|
-
"componentClassName": {
|
|
100
|
-
"type": "string",
|
|
101
|
-
"mutable": false,
|
|
102
|
-
"complexType": {
|
|
103
|
-
"original": "string",
|
|
104
|
-
"resolved": "string",
|
|
105
|
-
"references": {}
|
|
106
|
-
},
|
|
107
|
-
"required": false,
|
|
108
|
-
"optional": true,
|
|
109
|
-
"docs": {
|
|
110
|
-
"tags": [],
|
|
111
|
-
"text": ""
|
|
112
|
-
},
|
|
113
|
-
"getter": false,
|
|
114
|
-
"setter": false,
|
|
115
|
-
"reflect": false,
|
|
116
|
-
"attribute": "class-name"
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
static get methods() {
|
|
121
|
-
return {
|
|
122
|
-
"toggle": {
|
|
123
|
-
"complexType": {
|
|
124
|
-
"signature": "() => Promise<void>",
|
|
125
|
-
"parameters": [],
|
|
126
|
-
"references": {
|
|
127
|
-
"Promise": {
|
|
128
|
-
"location": "global",
|
|
129
|
-
"id": "global::Promise"
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
"return": "Promise<void>"
|
|
133
|
-
},
|
|
134
|
-
"docs": {
|
|
135
|
-
"text": "Public method to toggle the checkbox programmatically",
|
|
136
|
-
"tags": []
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
"setChecked": {
|
|
140
|
-
"complexType": {
|
|
141
|
-
"signature": "(checked: boolean) => Promise<void>",
|
|
142
|
-
"parameters": [{
|
|
143
|
-
"name": "checked",
|
|
144
|
-
"type": "boolean",
|
|
145
|
-
"docs": ""
|
|
146
|
-
}],
|
|
147
|
-
"references": {
|
|
148
|
-
"Promise": {
|
|
149
|
-
"location": "global",
|
|
150
|
-
"id": "global::Promise"
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
"return": "Promise<void>"
|
|
154
|
-
},
|
|
155
|
-
"docs": {
|
|
156
|
-
"text": "Public method to set the checkbox state programmatically",
|
|
157
|
-
"tags": []
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
//# sourceMappingURL=newsletter-checkbox.js.map
|
package/dist/collection/newsletter/components/newsletter-checkbox/newsletter-checkbox.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"newsletter-checkbox.js","sourceRoot":"","sources":["../../../../src/newsletter/components/newsletter-checkbox/newsletter-checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAM/D,MAAM,OAAO,kBAAkB;IACrB,YAAY,CAAU;IACtB,OAAO,GAA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AS,CAAC,CAAC;IACpC,CAAC,CAAC;IAEF,4DAA4D;IAE5D,KAAK,CAAC,MAAM;QACV,IAAI,CAAC,YAAY,EAAE,CAAC;IACtB,CAAC;IAED,+DAA+D;IAE/D,KAAK,CAAC,UAAU,CAAC,OAAgB;QAC/B,IAAI,IAAI,CAAC,YAAY;YAAE,OAAO;QAC9B,IAAI,OAAO,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC;YAC/B,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAED,MAAM;QACJ,OAAO,CACL,8DACE,IAAI,EAAC,UAAU,EACf,OAAO,EAAE,IAAI,CAAC,SAAS,EACvB,QAAQ,EAAE,IAAI,CAAC,YAAY,EAC3B,QAAQ,EAAE,IAAI,CAAC,YAAY,EAC3B,KAAK,EAAE,IAAI,CAAC,kBAAkB,kBAChB,IAAI,CAAC,SAAS,GAC5B,CACH,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Method, Prop } from \"@stencil/core\";\nimport * as NewsletterHelpers from \"../../newsletter-helpers\";\nimport { newsletterStore } from \"../../store/newsletter-store\";\n\n@Component({\n tag: \"u-newsletter-checkbox\",\n shadow: false,\n})\nexport class NewsletterCheckbox {\n @Prop() internalName!: string;\n @Prop() checked = false;\n @Prop({ attribute: \"class-name\" }) componentClassName?: string;\n\n componentWillLoad() {\n if (this.checked && !this.isSubscribed) {\n const checkedNewsletters = newsletterStore.state.checkedNewsletters;\n if (!(this.internalName in checkedNewsletters)) {\n newsletterStore.set(\"checkedNewsletters\", {\n ...checkedNewsletters,\n [this.internalName]: [],\n });\n }\n }\n }\n\n private get isSubscribed(): boolean {\n return NewsletterHelpers.isSubscribed(this.internalName);\n }\n\n private get isChecked(): boolean {\n return this.isSubscribed || this.internalName in newsletterStore.state.checkedNewsletters;\n }\n\n private syncToStore(checked: boolean) {\n if (checked) {\n newsletterStore.set(\"checkedNewsletters\", {\n ...newsletterStore.state.checkedNewsletters,\n [this.internalName]: [],\n });\n } else {\n const { [this.internalName]: _, ...rest } = newsletterStore.state.checkedNewsletters;\n newsletterStore.set(\"checkedNewsletters\", rest);\n }\n }\n\n private handleChange = () => {\n if (this.isSubscribed) return;\n this.syncToStore(!this.isChecked);\n };\n\n /** Public method to toggle the checkbox programmatically */\n @Method()\n async toggle() {\n this.handleChange();\n }\n\n /** Public method to set the checkbox state programmatically */\n @Method()\n async setChecked(checked: boolean) {\n if (this.isSubscribed) return;\n if (checked !== this.isChecked) {\n this.syncToStore(checked);\n }\n }\n\n render() {\n return (\n <input\n type=\"checkbox\"\n checked={this.isChecked}\n disabled={this.isSubscribed}\n onChange={this.handleChange}\n class={this.componentClassName}\n aria-checked={this.isChecked}\n />\n );\n }\n}\n"]}
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { Host, h } from "@stencil/core";
|
|
2
|
-
import { Auth } from "../../../auth/auth";
|
|
3
|
-
import { t } from "../../../i18n";
|
|
4
|
-
import { logger, UnidyComponent } from "../../../logger";
|
|
5
|
-
import { clearUrlParam } from "../../../shared/component-utils";
|
|
6
|
-
import { Flash } from "../../../shared/store/flash-store";
|
|
7
|
-
import { waitForConfig } from "../../../shared/store/unidy-store";
|
|
8
|
-
import * as NewsletterHelpers from "../../newsletter-helpers";
|
|
9
|
-
import { newsletterStore, persist } from "../../store/newsletter-store";
|
|
10
|
-
export class NewsletterRoot extends UnidyComponent {
|
|
11
|
-
constructor() {
|
|
12
|
-
super();
|
|
13
|
-
}
|
|
14
|
-
el;
|
|
15
|
-
componentClassName = "";
|
|
16
|
-
uNewsletterSuccess;
|
|
17
|
-
uNewsletterError;
|
|
18
|
-
getErrorText(errorIdentifier) {
|
|
19
|
-
return t(`newsletter.errors.${errorIdentifier}`) || t("errors.unknown", { defaultValue: "An unknown error occurred" });
|
|
20
|
-
}
|
|
21
|
-
async componentWillLoad() {
|
|
22
|
-
const newsletterError = clearUrlParam("newsletter_error");
|
|
23
|
-
const preferenceToken = clearUrlParam("preference_token");
|
|
24
|
-
const email = clearUrlParam("email");
|
|
25
|
-
if (newsletterError) {
|
|
26
|
-
Flash.error.addMessage(this.getErrorText(newsletterError));
|
|
27
|
-
}
|
|
28
|
-
if (preferenceToken && email) {
|
|
29
|
-
newsletterStore.state.preferenceToken = preferenceToken;
|
|
30
|
-
newsletterStore.state.email = email;
|
|
31
|
-
persist("preferenceToken");
|
|
32
|
-
persist("email");
|
|
33
|
-
}
|
|
34
|
-
const authInstance = await Auth.getInstance();
|
|
35
|
-
const isAuthenticated = await authInstance.isAuthenticated();
|
|
36
|
-
newsletterStore.state.isAuthenticated = isAuthenticated;
|
|
37
|
-
if (isAuthenticated) {
|
|
38
|
-
const userData = await authInstance.userData();
|
|
39
|
-
if (userData) {
|
|
40
|
-
newsletterStore.state.email = userData.email;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
await waitForConfig();
|
|
44
|
-
await NewsletterHelpers.fetchSubscriptions();
|
|
45
|
-
}
|
|
46
|
-
async submit(forType) {
|
|
47
|
-
const { email, checkedNewsletters } = newsletterStore.state;
|
|
48
|
-
if (!email) {
|
|
49
|
-
// TODO: Mark this as an error (or probably by forcing the email field to be native required)
|
|
50
|
-
logger.error("Email is required for login");
|
|
51
|
-
this.uNewsletterError.emit({ email: "", error: "email_required" });
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
if (forType === "login") {
|
|
55
|
-
return await NewsletterHelpers.sendLoginEmail(email);
|
|
56
|
-
}
|
|
57
|
-
const newsletters = Object.keys(checkedNewsletters);
|
|
58
|
-
if (newsletters.length === 0) {
|
|
59
|
-
logger.error("No newsletters selected: please select at least one newsletter");
|
|
60
|
-
this.uNewsletterError.emit({ email, error: "no_newsletters_selected" });
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
const success = await NewsletterHelpers.createSubscriptions({ email });
|
|
64
|
-
if (success) {
|
|
65
|
-
this.uNewsletterSuccess.emit({ email, newsletters });
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
this.uNewsletterError.emit({ email, error: "subscription_failed" });
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
render() {
|
|
72
|
-
return (h(Host, { key: '6e03b34d1bd9dc630885d57c9efc92f7ea8b03f6', class: this.componentClassName }, h("slot", { key: '17681aed6f26a2afcbd21a1546ef31b82bf3ee31' })));
|
|
73
|
-
}
|
|
74
|
-
static get is() { return "u-newsletter-root"; }
|
|
75
|
-
static get properties() {
|
|
76
|
-
return {
|
|
77
|
-
"componentClassName": {
|
|
78
|
-
"type": "string",
|
|
79
|
-
"mutable": false,
|
|
80
|
-
"complexType": {
|
|
81
|
-
"original": "string",
|
|
82
|
-
"resolved": "string",
|
|
83
|
-
"references": {}
|
|
84
|
-
},
|
|
85
|
-
"required": false,
|
|
86
|
-
"optional": false,
|
|
87
|
-
"docs": {
|
|
88
|
-
"tags": [],
|
|
89
|
-
"text": ""
|
|
90
|
-
},
|
|
91
|
-
"getter": false,
|
|
92
|
-
"setter": false,
|
|
93
|
-
"reflect": false,
|
|
94
|
-
"attribute": "class-name",
|
|
95
|
-
"defaultValue": "\"\""
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
static get events() {
|
|
100
|
-
return [{
|
|
101
|
-
"method": "uNewsletterSuccess",
|
|
102
|
-
"name": "uNewsletterSuccess",
|
|
103
|
-
"bubbles": true,
|
|
104
|
-
"cancelable": true,
|
|
105
|
-
"composed": true,
|
|
106
|
-
"docs": {
|
|
107
|
-
"tags": [],
|
|
108
|
-
"text": ""
|
|
109
|
-
},
|
|
110
|
-
"complexType": {
|
|
111
|
-
"original": "{ email: string; newsletters: string[] }",
|
|
112
|
-
"resolved": "{ email: string; newsletters: string[]; }",
|
|
113
|
-
"references": {}
|
|
114
|
-
}
|
|
115
|
-
}, {
|
|
116
|
-
"method": "uNewsletterError",
|
|
117
|
-
"name": "uNewsletterError",
|
|
118
|
-
"bubbles": true,
|
|
119
|
-
"cancelable": true,
|
|
120
|
-
"composed": true,
|
|
121
|
-
"docs": {
|
|
122
|
-
"tags": [],
|
|
123
|
-
"text": ""
|
|
124
|
-
},
|
|
125
|
-
"complexType": {
|
|
126
|
-
"original": "{ email: string; error: string }",
|
|
127
|
-
"resolved": "{ email: string; error: string; }",
|
|
128
|
-
"references": {}
|
|
129
|
-
}
|
|
130
|
-
}];
|
|
131
|
-
}
|
|
132
|
-
static get methods() {
|
|
133
|
-
return {
|
|
134
|
-
"submit": {
|
|
135
|
-
"complexType": {
|
|
136
|
-
"signature": "(forType?: NewsletterButtonFor) => Promise<void>",
|
|
137
|
-
"parameters": [{
|
|
138
|
-
"name": "forType",
|
|
139
|
-
"type": "\"login\" | \"create\"",
|
|
140
|
-
"docs": ""
|
|
141
|
-
}],
|
|
142
|
-
"references": {
|
|
143
|
-
"Promise": {
|
|
144
|
-
"location": "global",
|
|
145
|
-
"id": "global::Promise"
|
|
146
|
-
},
|
|
147
|
-
"NewsletterButtonFor": {
|
|
148
|
-
"location": "import",
|
|
149
|
-
"path": "../submit-button/newsletter-submit-button",
|
|
150
|
-
"id": "src/newsletter/components/submit-button/newsletter-submit-button.ts::NewsletterButtonFor"
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
"return": "Promise<void>"
|
|
154
|
-
},
|
|
155
|
-
"docs": {
|
|
156
|
-
"text": "",
|
|
157
|
-
"tags": []
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
static get elementRef() { return "el"; }
|
|
163
|
-
}
|
|
164
|
-
//# sourceMappingURL=newsletter-root.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"newsletter-root.js","sourceRoot":"","sources":["../../../../src/newsletter/components/newsletter-root/newsletter-root.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AI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,MAAM,CAAC,KAAK,CAAC,gEAAgE,CAAC,CAAC;YAC/E,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,yBAAyB,EAAE,CAAC,CAAC;YACxE,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,mBAAmB,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAEvE,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;QACvD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;IAED,MAAM;QACJ,OAAO,CACL,EAAC,IAAI,qDAAC,KAAK,EAAE,IAAI,CAAC,kBAAkB;YAClC,8DAAQ,CACH,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, type EventEmitter, Host, h, Method, Prop } from \"@stencil/core\";\nimport { Auth } from \"../../../auth/auth\";\nimport { t } from \"../../../i18n\";\nimport { logger, UnidyComponent } from \"../../../logger\";\nimport { clearUrlParam } from \"../../../shared/component-utils\";\nimport { Flash } from \"../../../shared/store/flash-store\";\nimport { waitForConfig } from \"../../../shared/store/unidy-store\";\nimport * as NewsletterHelpers from \"../../newsletter-helpers\";\nimport { type NewsletterErrorIdentifier, newsletterStore, persist } from \"../../store/newsletter-store\";\nimport type { NewsletterButtonFor } from \"../submit-button/newsletter-submit-button\";\n\n@Component({\n tag: \"u-newsletter-root\",\n shadow: false,\n})\nexport class NewsletterRoot extends UnidyComponent {\n @Element() el!: HTMLElement;\n @Prop({ attribute: \"class-name\" }) componentClassName = \"\";\n\n @Event() uNewsletterSuccess!: EventEmitter<{ email: string; newsletters: string[] }>;\n @Event() uNewsletterError!: EventEmitter<{ email: string; error: string }>;\n\n getErrorText(errorIdentifier: NewsletterErrorIdentifier): string {\n return t(`newsletter.errors.${errorIdentifier}`) || t(\"errors.unknown\", { defaultValue: \"An unknown error occurred\" });\n }\n\n async componentWillLoad() {\n const newsletterError = clearUrlParam(\"newsletter_error\");\n const preferenceToken = clearUrlParam(\"preference_token\");\n const email = clearUrlParam(\"email\");\n\n if (newsletterError) {\n Flash.error.addMessage(this.getErrorText(newsletterError as NewsletterErrorIdentifier));\n }\n\n if (preferenceToken && email) {\n newsletterStore.state.preferenceToken = preferenceToken;\n newsletterStore.state.email = email;\n\n persist(\"preferenceToken\");\n persist(\"email\");\n }\n\n const authInstance = await Auth.getInstance();\n const isAuthenticated = await authInstance.isAuthenticated();\n newsletterStore.state.isAuthenticated = isAuthenticated;\n\n if (isAuthenticated) {\n const userData = await authInstance.userData();\n\n if (userData) {\n newsletterStore.state.email = userData.email;\n }\n }\n\n await waitForConfig();\n await NewsletterHelpers.fetchSubscriptions();\n }\n\n @Method()\n async submit(forType?: NewsletterButtonFor) {\n const { email, checkedNewsletters } = newsletterStore.state;\n\n if (!email) {\n // TODO: Mark this as an error (or probably by forcing the email field to be native required)\n logger.error(\"Email is required for login\");\n this.uNewsletterError.emit({ email: \"\", error: \"email_required\" });\n return;\n }\n\n if (forType === \"login\") {\n return await NewsletterHelpers.sendLoginEmail(email);\n }\n\n const newsletters = Object.keys(checkedNewsletters);\n\n if (newsletters.length === 0) {\n logger.error(\"No newsletters selected: please select at least one newsletter\");\n this.uNewsletterError.emit({ email, error: \"no_newsletters_selected\" });\n return;\n }\n\n const success = await NewsletterHelpers.createSubscriptions({ email });\n\n if (success) {\n this.uNewsletterSuccess.emit({ email, newsletters });\n } else {\n this.uNewsletterError.emit({ email, error: \"subscription_failed\" });\n }\n }\n\n render() {\n return (\n <Host class={this.componentClassName}>\n <slot />\n </Host>\n );\n }\n}\n"]}
|