@unidy.io/sdk 1.1.9 → 1.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/app-globals-Pb3mNuRv.js +10 -0
- package/dist/cjs/app-globals-Pb3mNuRv.js.map +1 -0
- package/dist/cjs/{auth-B83pzi0f.js → auth-ChsE2RD7.js} +45 -13
- package/dist/cjs/auth-ChsE2RD7.js.map +1 -0
- package/dist/cjs/{auth-store-DPHWWmXf.js → auth-store-BO38Txmj.js} +8 -4
- package/dist/cjs/auth-store-BO38Txmj.js.map +1 -0
- package/dist/cjs/{component-utils-BpMyeVQo.js → component-utils-bu3SY4dE.js} +9 -2
- package/dist/cjs/component-utils-bu3SY4dE.js.map +1 -0
- package/dist/cjs/{flash-store-BuIBuQDx.js → flash-store-D5vGuIFc.js} +3 -3
- package/dist/cjs/{flash-store-BuIBuQDx.js.map → flash-store-D5vGuIFc.js.map} +1 -1
- package/dist/cjs/{i18n-BoDZ8kd2.js → i18n-B2T1e9Mf.js} +432 -596
- package/dist/cjs/i18n-B2T1e9Mf.js.map +1 -0
- package/dist/cjs/{index-B_N5xKgH.js → index-BzhKFIXk.js} +3416 -735
- package/dist/cjs/index-BzhKFIXk.js.map +1 -0
- package/dist/cjs/{index-R2MKLaem.js → index-DmDGhWTM.js} +1621 -550
- package/dist/cjs/index-DmDGhWTM.js.map +1 -0
- package/dist/cjs/{index-DLz3FT7T.js → index-DxENvy7x.js} +92 -23
- package/dist/cjs/index-DxENvy7x.js.map +1 -0
- package/dist/cjs/index.cjs.js +13 -13
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{newsletter-helpers-D-V_8kiN.js → newsletter-helpers-B5P7q8Xk.js} +8 -8
- package/dist/cjs/{newsletter-helpers-D-V_8kiN.js.map → newsletter-helpers-B5P7q8Xk.js.map} +1 -1
- package/dist/cjs/{newsletter-store-BzytX7Qh.js → newsletter-store-f5zhJljn.js} +3 -3
- package/dist/cjs/{newsletter-store-BzytX7Qh.js.map → newsletter-store-f5zhJljn.js.map} +1 -1
- package/dist/cjs/{pagination-store-BEiW3MQd.js → pagination-store-DjGYEIqm.js} +3 -3
- package/dist/cjs/{pagination-store-BEiW3MQd.js.map → pagination-store-DjGYEIqm.js.map} +1 -1
- package/dist/cjs/{profile-helpers-B2h2III_.js → profile-helpers-BcLjojeG.js} +4 -4
- package/dist/cjs/{profile-helpers-B2h2III_.js.map → profile-helpers-BcLjojeG.js.map} +1 -1
- package/dist/cjs/{profile-store-P_BcYkef.js → profile-store-BWJ9qAcg.js} +3 -3
- package/dist/cjs/{profile-store-P_BcYkef.js.map → profile-store-BWJ9qAcg.js.map} +1 -1
- package/dist/cjs/sdk.cjs.js +31 -4
- package/dist/cjs/sdk.cjs.js.map +1 -1
- package/dist/cjs/u-conditional-render.cjs.entry.js +12 -12
- package/dist/cjs/u-config.cjs.entry.js +18 -14
- package/dist/cjs/u-config.entry.cjs.js.map +1 -1
- package/dist/cjs/u-email-field.cjs.entry.js +7 -7
- package/dist/cjs/u-error-message.cjs.entry.js +7 -7
- package/dist/cjs/u-error-message.entry.cjs.js.map +1 -1
- package/dist/cjs/u-field.u-raw-field.entry.cjs.js.map +1 -1
- package/dist/cjs/u-field_2.cjs.entry.js +17 -21
- package/dist/cjs/u-flash-message.cjs.entry.js +4 -4
- package/dist/cjs/u-full-profile.cjs.entry.js +6 -6
- package/dist/cjs/u-full-profile.entry.cjs.js.map +1 -1
- package/dist/cjs/u-logout-button.u-signed-in.entry.cjs.js.map +1 -1
- package/dist/cjs/u-logout-button_2.cjs.entry.js +16 -14
- package/dist/cjs/u-magic-code-field.cjs.entry.js +11 -11
- package/dist/cjs/u-magic-code-field.entry.cjs.js.map +1 -1
- package/dist/cjs/u-missing-field.cjs.entry.js +4 -4
- package/dist/cjs/u-missing-field.entry.cjs.js.map +1 -1
- package/dist/cjs/u-missing-fields-submit-button.cjs.entry.js +9 -9
- package/dist/cjs/u-missing-fields-submit-button.entry.cjs.js.map +1 -1
- package/dist/cjs/u-newsletter-checkbox.cjs.entry.js +12 -12
- package/dist/cjs/u-newsletter-logout-button.cjs.entry.js +19 -14
- package/dist/cjs/u-newsletter-logout-button.entry.cjs.js.map +1 -1
- package/dist/cjs/u-newsletter-preference-checkbox.cjs.entry.js +13 -13
- package/dist/cjs/u-newsletter-preference-checkbox.entry.cjs.js.map +1 -1
- package/dist/cjs/u-newsletter-resend-doi-button.cjs.entry.js +13 -13
- package/dist/cjs/u-newsletter-root.cjs.entry.js +12 -12
- package/dist/cjs/u-newsletter-toggle-subscription-button.cjs.entry.js +13 -13
- package/dist/cjs/u-pagination-button.cjs.entry.js +1 -1
- package/dist/cjs/u-pagination-button.entry.cjs.js.map +1 -1
- package/dist/cjs/u-pagination-page.cjs.entry.js +1 -1
- package/dist/cjs/u-pagination-page.entry.cjs.js.map +1 -1
- package/dist/cjs/u-passkey.cjs.entry.js +10 -10
- package/dist/cjs/u-passkey.entry.cjs.js.map +1 -1
- package/dist/cjs/u-password-field.cjs.entry.js +5 -5
- package/dist/cjs/u-profile.u-submit-button.entry.cjs.js.map +1 -1
- package/dist/cjs/u-profile_2.cjs.entry.js +17 -15
- package/dist/cjs/u-registration-button.cjs.entry.js +5 -5
- package/dist/cjs/u-registration-button.entry.cjs.js.map +1 -1
- package/dist/cjs/u-reset-password-button.cjs.entry.js +10 -10
- package/dist/cjs/u-send-magic-code-button.cjs.entry.js +10 -10
- package/dist/cjs/u-send-magic-code-button.entry.cjs.js.map +1 -1
- package/dist/cjs/u-signin-root.cjs.entry.js +6 -6
- package/dist/cjs/u-signin-step.cjs.entry.js +10 -10
- package/dist/cjs/u-signin-step.entry.cjs.js.map +1 -1
- package/dist/cjs/u-signin-strategy.cjs.entry.js +4 -4
- package/dist/cjs/u-social-login-button.cjs.entry.js +11 -11
- package/dist/cjs/u-social-login-button.entry.cjs.js.map +1 -1
- package/dist/cjs/u-spinner.cjs.entry.js +2 -2
- package/dist/cjs/u-spinner.entry.cjs.js.map +1 -1
- package/dist/cjs/u-ticketable-list.cjs.entry.js +13 -13
- package/dist/cjs/{unidy-store-7AbWnZ6g.js → unidy-store-zhdhlK0a.js} +3 -3
- package/dist/cjs/{unidy-store-7AbWnZ6g.js.map → unidy-store-zhdhlK0a.js.map} +1 -1
- package/dist/collection/api/client.js.map +1 -1
- package/dist/collection/api/index.js +2 -2
- package/dist/collection/api/index.js.map +1 -1
- package/dist/collection/auth/api/auth.js +12 -2
- package/dist/collection/auth/api/auth.js.map +1 -1
- package/dist/collection/auth/auth-helpers.js +18 -1
- package/dist/collection/auth/auth-helpers.js.map +1 -1
- package/dist/collection/auth/auth.js +17 -2
- package/dist/collection/auth/auth.js.map +1 -1
- package/dist/collection/auth/components/logout-button/logout-button.js +5 -3
- package/dist/collection/auth/components/logout-button/logout-button.js.map +1 -1
- package/dist/collection/auth/components/magic-code-field/magic-code-field.css +1 -1
- package/dist/collection/auth/components/magic-code-field/magic-code-field.js +1 -1
- package/dist/collection/auth/components/magic-code-field/magic-code-field.js.map +1 -1
- package/dist/collection/auth/components/missing-field/missing-field.js.map +1 -1
- package/dist/collection/auth/components/missing-fields-submit-button/missing-fields-submit-button.js +3 -3
- package/dist/collection/auth/components/missing-fields-submit-button/missing-fields-submit-button.js.map +1 -1
- package/dist/collection/auth/components/passkey/passkey.js +2 -2
- package/dist/collection/auth/components/passkey/passkey.js.map +1 -1
- package/dist/collection/auth/components/password-field/password-field.js +1 -1
- package/dist/collection/auth/components/registration/registration-button.js +2 -2
- package/dist/collection/auth/components/registration/registration-button.js.map +1 -1
- package/dist/collection/auth/components/send-magic-code-button/send-magic-code-button.js +1 -1
- package/dist/collection/auth/components/send-magic-code-button/send-magic-code-button.js.map +1 -1
- package/dist/collection/auth/components/signed-in/signed-in.js.map +1 -1
- package/dist/collection/auth/components/signin-step/signin-step.js +1 -1
- package/dist/collection/auth/components/signin-step/signin-step.js.map +1 -1
- package/dist/collection/auth/components/social-logins/social-login-button.css +1 -1
- package/dist/collection/auth/components/social-logins/social-login-button.js +4 -4
- package/dist/collection/auth/components/social-logins/social-login-button.js.map +1 -1
- package/dist/collection/auth/index.js +1 -2
- package/dist/collection/auth/index.js.map +1 -1
- package/dist/collection/auth/store/auth-store.js +4 -0
- package/dist/collection/auth/store/auth-store.js.map +1 -1
- package/dist/collection/globalScript.js +1 -1
- package/dist/collection/globalScript.js.map +1 -1
- package/dist/collection/i18n.js +1 -1
- package/dist/collection/i18n.js.map +1 -1
- package/dist/collection/index.js +1 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/logger.js.map +1 -1
- package/dist/collection/newsletter/api/newsletters.js +1 -1
- package/dist/collection/newsletter/api/newsletters.js.map +1 -1
- package/dist/collection/newsletter/components/logout-button/logout-button.js +10 -5
- package/dist/collection/newsletter/components/logout-button/logout-button.js.map +1 -1
- package/dist/collection/newsletter/components/preference-checkbox/preference-checkbox.js +2 -3
- package/dist/collection/newsletter/components/preference-checkbox/preference-checkbox.js.map +1 -1
- package/dist/collection/newsletter/components/resend-doi-button/resend-doi-button.css +1 -1
- package/dist/collection/newsletter/components/toggle-subscription-button/toggle-subscription-button.css +1 -1
- package/dist/collection/profile/components/field/field.css +1 -1
- package/dist/collection/profile/components/field/field.js +1 -5
- package/dist/collection/profile/components/field/field.js.map +1 -1
- package/dist/collection/profile/components/full-profile/full-profile.css +1 -1
- package/dist/collection/profile/components/raw-field/raw-field.js +5 -5
- package/dist/collection/profile/components/raw-field/raw-field.js.map +1 -1
- package/dist/collection/profile/index.js +1 -2
- package/dist/collection/profile/index.js.map +1 -1
- package/dist/collection/profile/profile-helpers.js +1 -1
- package/dist/collection/profile/profile-helpers.js.map +1 -1
- package/dist/collection/shared/component-utils.js +7 -0
- package/dist/collection/shared/component-utils.js.map +1 -1
- package/dist/collection/shared/components/config/config.js +28 -4
- package/dist/collection/shared/components/config/config.js.map +1 -1
- package/dist/collection/shared/components/email-field/email-field.css +1 -1
- package/dist/collection/shared/components/error-message/error-message.js.map +1 -1
- package/dist/collection/shared/components/flash-message/flash-message.css +1 -1
- package/dist/collection/shared/components/spinner/spinner.css +1 -1
- package/dist/collection/shared/components/spinner/spinner.js +1 -1
- package/dist/collection/shared/components/spinner/spinner.js.map +1 -1
- package/dist/collection/shared/components/submit-button/submit-button.css +1 -1
- package/dist/collection/shared/components/submit-button/submit-button.js +2 -0
- package/dist/collection/shared/components/submit-button/submit-button.js.map +1 -1
- package/dist/collection/ticketable/api/get-with-schema.js.map +1 -1
- package/dist/collection/ticketable/api/schemas.js +1 -1
- package/dist/collection/ticketable/api/schemas.js.map +1 -1
- package/dist/collection/ticketable/api/subscriptions.js +2 -2
- package/dist/collection/ticketable/api/subscriptions.js.map +1 -1
- package/dist/collection/ticketable/api/tickets.js +2 -2
- package/dist/collection/ticketable/api/tickets.js.map +1 -1
- package/dist/collection/ticketable/components/pagination/pagination-button.js +1 -1
- package/dist/collection/ticketable/components/pagination/pagination-button.js.map +1 -1
- package/dist/collection/ticketable/components/pagination/pagination-page.js +1 -1
- package/dist/collection/ticketable/components/pagination/pagination-page.js.map +1 -1
- package/dist/collection/ticketable/index.js +1 -1
- package/dist/collection/ticketable/index.js.map +1 -1
- package/dist/components/auth-store.js +4 -0
- package/dist/components/auth-store.js.map +1 -1
- package/dist/components/auth.js +36 -4
- package/dist/components/auth.js.map +1 -1
- package/dist/components/component-utils.js +7 -0
- package/dist/components/component-utils.js.map +1 -1
- package/dist/components/exports.js +260 -104
- package/dist/components/exports.js.map +1 -1
- package/dist/components/field.js +4 -14
- package/dist/components/field.js.map +1 -1
- package/dist/components/i18n.js +429 -593
- package/dist/components/i18n.js.map +1 -1
- package/dist/components/index.js +424 -397
- package/dist/components/index.js.map +1 -1
- package/dist/components/index2.js +1562 -491
- package/dist/components/index2.js.map +1 -1
- package/dist/components/index3.js +90 -21
- package/dist/components/index3.js.map +1 -1
- package/dist/components/logger.js.map +1 -1
- package/dist/components/profile-helpers.js +1 -1
- package/dist/components/profile-helpers.js.map +1 -1
- package/dist/components/profile-store.js +1 -1
- package/dist/components/profile.js +3 -3
- package/dist/components/raw-field.js +11 -11
- package/dist/components/raw-field.js.map +1 -1
- package/dist/components/spinner.js +1 -1
- package/dist/components/spinner.js.map +1 -1
- package/dist/components/submit-button.js +3 -1
- package/dist/components/submit-button.js.map +1 -1
- package/dist/components/u-conditional-render.js +1 -1
- package/dist/components/u-config.js +10 -5
- package/dist/components/u-config.js.map +1 -1
- package/dist/components/u-email-field.js +1 -1
- package/dist/components/u-error-message.js.map +1 -1
- package/dist/components/u-flash-message.js +1 -1
- package/dist/components/u-full-profile.js +1 -1
- package/dist/components/u-full-profile.js.map +1 -1
- package/dist/components/u-logout-button.js +5 -3
- package/dist/components/u-logout-button.js.map +1 -1
- package/dist/components/u-magic-code-field.js +2 -2
- package/dist/components/u-magic-code-field.js.map +1 -1
- package/dist/components/u-missing-field.js +4 -10
- package/dist/components/u-missing-field.js.map +1 -1
- package/dist/components/u-missing-fields-submit-button.js +3 -3
- package/dist/components/u-missing-fields-submit-button.js.map +1 -1
- package/dist/components/u-newsletter-logout-button.js +9 -4
- package/dist/components/u-newsletter-logout-button.js.map +1 -1
- package/dist/components/u-newsletter-preference-checkbox.js +1 -1
- package/dist/components/u-newsletter-preference-checkbox.js.map +1 -1
- package/dist/components/u-newsletter-resend-doi-button.js +1 -1
- package/dist/components/u-newsletter-toggle-subscription-button.js +1 -1
- package/dist/components/u-pagination-button.js.map +1 -1
- package/dist/components/u-pagination-page.js.map +1 -1
- package/dist/components/u-passkey.js +1 -1
- package/dist/components/u-passkey.js.map +1 -1
- package/dist/components/u-registration-button.js +2 -2
- package/dist/components/u-registration-button.js.map +1 -1
- package/dist/components/u-send-magic-code-button.js +1 -1
- package/dist/components/u-send-magic-code-button.js.map +1 -1
- package/dist/components/u-signed-in.js.map +1 -1
- package/dist/components/u-signin-step.js +1 -1
- package/dist/components/u-signin-step.js.map +1 -1
- package/dist/components/u-social-login-button.js +8 -8
- package/dist/components/u-social-login-button.js.map +1 -1
- package/dist/components/u-ticketable-list.js +1 -1
- package/dist/esm/app-globals-BHWOrMsm.js +8 -0
- package/dist/esm/app-globals-BHWOrMsm.js.map +1 -0
- package/dist/esm/{auth-B0RIcDM-.js → auth-CAHM6e4m.js} +45 -13
- package/dist/esm/auth-CAHM6e4m.js.map +1 -0
- package/dist/esm/{auth-store-BGMYm_jK.js → auth-store-ItTnEMlF.js} +8 -4
- package/dist/esm/auth-store-ItTnEMlF.js.map +1 -0
- package/dist/esm/{component-utils-D1lzXl_Z.js → component-utils-BGq0leDV.js} +9 -2
- package/dist/esm/component-utils-BGq0leDV.js.map +1 -0
- package/dist/esm/{flash-store-CEvWSG0c.js → flash-store-CMXH65i_.js} +3 -3
- package/dist/esm/{flash-store-CEvWSG0c.js.map → flash-store-CMXH65i_.js.map} +1 -1
- package/dist/esm/{i18n-CLdWzy5J.js → i18n-OKf8uE5j.js} +432 -596
- package/dist/esm/i18n-OKf8uE5j.js.map +1 -0
- package/dist/esm/{index-Ci3aTmzp.js → index-COQ27Nb6.js} +3411 -734
- package/dist/esm/index-COQ27Nb6.js.map +1 -0
- package/dist/esm/{index-Bjp1XO-f.js → index-DVkRTYPC.js} +92 -23
- package/dist/esm/index-DVkRTYPC.js.map +1 -0
- package/dist/esm/{index-DSDkaHWI.js → index-Du3hUdhU.js} +1622 -551
- package/dist/esm/index-Du3hUdhU.js.map +1 -0
- package/dist/esm/index.js +11 -11
- package/dist/esm/loader.js +4 -4
- package/dist/esm/{newsletter-helpers-CONtbKYi.js → newsletter-helpers-ChXON0f4.js} +8 -8
- package/dist/esm/{newsletter-helpers-CONtbKYi.js.map → newsletter-helpers-ChXON0f4.js.map} +1 -1
- package/dist/esm/{newsletter-store-DBL1A203.js → newsletter-store-CIsyE51r.js} +3 -3
- package/dist/esm/{newsletter-store-DBL1A203.js.map → newsletter-store-CIsyE51r.js.map} +1 -1
- package/dist/esm/{pagination-store-DzdJOp-n.js → pagination-store-B9lk_lqK.js} +3 -3
- package/dist/esm/{pagination-store-DzdJOp-n.js.map → pagination-store-B9lk_lqK.js.map} +1 -1
- package/dist/esm/{profile-helpers-CglNd6Nw.js → profile-helpers-Beduxnin.js} +4 -4
- package/dist/esm/{profile-helpers-CglNd6Nw.js.map → profile-helpers-Beduxnin.js.map} +1 -1
- package/dist/esm/{profile-store-RmZB2PTc.js → profile-store-CsSDT9Tb.js} +4 -4
- package/dist/esm/{profile-store-RmZB2PTc.js.map → profile-store-CsSDT9Tb.js.map} +1 -1
- package/dist/esm/sdk.js +32 -5
- package/dist/esm/sdk.js.map +1 -1
- package/dist/esm/u-conditional-render.entry.js +12 -12
- package/dist/esm/u-config.entry.js +18 -14
- package/dist/esm/u-config.entry.js.map +1 -1
- package/dist/esm/u-email-field.entry.js +7 -7
- package/dist/esm/u-error-message.entry.js +7 -7
- package/dist/esm/u-error-message.entry.js.map +1 -1
- package/dist/esm/u-field.u-raw-field.entry.js.map +1 -1
- package/dist/esm/u-field_2.entry.js +17 -21
- package/dist/esm/u-flash-message.entry.js +4 -4
- package/dist/esm/u-full-profile.entry.js +6 -6
- package/dist/esm/u-full-profile.entry.js.map +1 -1
- package/dist/esm/u-logout-button.u-signed-in.entry.js.map +1 -1
- package/dist/esm/u-logout-button_2.entry.js +16 -14
- package/dist/esm/u-magic-code-field.entry.js +11 -11
- package/dist/esm/u-magic-code-field.entry.js.map +1 -1
- package/dist/esm/u-missing-field.entry.js +4 -4
- package/dist/esm/u-missing-field.entry.js.map +1 -1
- package/dist/esm/u-missing-fields-submit-button.entry.js +9 -9
- package/dist/esm/u-missing-fields-submit-button.entry.js.map +1 -1
- package/dist/esm/u-newsletter-checkbox.entry.js +12 -12
- package/dist/esm/u-newsletter-logout-button.entry.js +19 -14
- package/dist/esm/u-newsletter-logout-button.entry.js.map +1 -1
- package/dist/esm/u-newsletter-preference-checkbox.entry.js +13 -13
- package/dist/esm/u-newsletter-preference-checkbox.entry.js.map +1 -1
- package/dist/esm/u-newsletter-resend-doi-button.entry.js +13 -13
- package/dist/esm/u-newsletter-root.entry.js +12 -12
- package/dist/esm/u-newsletter-toggle-subscription-button.entry.js +13 -13
- package/dist/esm/u-pagination-button.entry.js +1 -1
- package/dist/esm/u-pagination-button.entry.js.map +1 -1
- package/dist/esm/u-pagination-page.entry.js +1 -1
- package/dist/esm/u-pagination-page.entry.js.map +1 -1
- package/dist/esm/u-passkey.entry.js +10 -10
- package/dist/esm/u-passkey.entry.js.map +1 -1
- package/dist/esm/u-password-field.entry.js +5 -5
- package/dist/esm/u-profile.u-submit-button.entry.js.map +1 -1
- package/dist/esm/u-profile_2.entry.js +17 -15
- package/dist/esm/u-registration-button.entry.js +5 -5
- package/dist/esm/u-registration-button.entry.js.map +1 -1
- package/dist/esm/u-reset-password-button.entry.js +10 -10
- package/dist/esm/u-send-magic-code-button.entry.js +10 -10
- package/dist/esm/u-send-magic-code-button.entry.js.map +1 -1
- package/dist/esm/u-signin-root.entry.js +6 -6
- package/dist/esm/u-signin-step.entry.js +10 -10
- package/dist/esm/u-signin-step.entry.js.map +1 -1
- package/dist/esm/u-signin-strategy.entry.js +4 -4
- package/dist/esm/u-social-login-button.entry.js +11 -11
- package/dist/esm/u-social-login-button.entry.js.map +1 -1
- package/dist/esm/u-spinner.entry.js +2 -2
- package/dist/esm/u-spinner.entry.js.map +1 -1
- package/dist/esm/u-ticketable-list.entry.js +13 -13
- package/dist/esm/{unidy-store-BldTAtO0.js → unidy-store-CAcMVdD8.js} +3 -3
- package/dist/esm/{unidy-store-BldTAtO0.js.map → unidy-store-CAcMVdD8.js.map} +1 -1
- package/dist/sdk/index.esm.js +1 -1
- package/dist/sdk/{p-93200fb4.entry.js → p-1bad3fd0.entry.js} +2 -2
- package/dist/sdk/{p-22e4d08b.entry.js → p-1d6982cd.entry.js} +2 -2
- package/dist/sdk/p-23d8e922.entry.js +2 -0
- package/dist/sdk/p-2855d3bb.entry.js +2 -0
- package/dist/sdk/p-2855d3bb.entry.js.map +1 -0
- package/dist/sdk/{p-339f32c1.entry.js → p-288f37c3.entry.js} +2 -2
- package/dist/sdk/{p-339f32c1.entry.js.map → p-288f37c3.entry.js.map} +1 -1
- package/dist/sdk/p-32842e98.entry.js +2 -0
- package/dist/sdk/p-32842e98.entry.js.map +1 -0
- package/dist/sdk/p-34af7470.entry.js +2 -0
- package/dist/sdk/p-39126514.entry.js +2 -0
- package/dist/sdk/{p-2af8b45f.entry.js.map → p-39126514.entry.js.map} +1 -1
- package/dist/sdk/{p-ad796888.entry.js → p-438f62e5.entry.js} +2 -2
- package/dist/sdk/{p-ad796888.entry.js.map → p-438f62e5.entry.js.map} +1 -1
- package/dist/sdk/{p-bb603b00.entry.js → p-46013b2f.entry.js} +2 -2
- package/dist/sdk/{p-08ff2de2.entry.js → p-46cdb255.entry.js} +2 -2
- package/dist/sdk/{p-a5db968f.entry.js → p-4d9bde6e.entry.js} +2 -2
- package/dist/sdk/{p-b0917777.entry.js → p-5c40c6ea.entry.js} +2 -2
- package/dist/sdk/p-5c8b31bd.entry.js +2 -0
- package/dist/sdk/p-5c8b31bd.entry.js.map +1 -0
- package/dist/sdk/{p-c31dbbb4.entry.js → p-69172b22.entry.js} +2 -2
- package/dist/sdk/p-69172b22.entry.js.map +1 -0
- package/dist/sdk/p-7381aca7.entry.js +2 -0
- package/dist/sdk/{p-6893d167.entry.js.map → p-7381aca7.entry.js.map} +1 -1
- package/dist/sdk/{p-D1lzXl_Z.js → p-BGq0leDV.js} +1 -1
- package/dist/sdk/p-BGq0leDV.js.map +1 -0
- package/dist/sdk/p-BR6L248H.js +2 -0
- package/dist/sdk/p-BR6L248H.js.map +1 -0
- package/dist/sdk/p-BhrvnKAS.js +2 -0
- package/dist/sdk/{p-Ce8zGAi1.js.map → p-BhrvnKAS.js.map} +1 -1
- package/dist/sdk/p-CMw6v6sC.js +2 -0
- package/dist/sdk/p-CMw6v6sC.js.map +1 -0
- package/dist/sdk/p-COQ27Nb6.js +14 -0
- package/dist/sdk/p-COQ27Nb6.js.map +1 -0
- package/dist/sdk/p-CSLU6kes.js +2 -0
- package/dist/sdk/{p-CPPYdoIv.js.map → p-CSLU6kes.js.map} +1 -1
- package/dist/sdk/p-Cai8JwlG.js +2 -0
- package/dist/sdk/p-Cai8JwlG.js.map +1 -0
- package/dist/sdk/{p-DYtgart8.js → p-CpJghKnM.js} +2 -2
- package/dist/sdk/{p-DYtgart8.js.map → p-CpJghKnM.js.map} +1 -1
- package/dist/sdk/p-DAn4FkxC.js +2 -0
- package/dist/sdk/{p-C0feI0p8.js.map → p-DAn4FkxC.js.map} +1 -1
- package/dist/sdk/p-FFRhPCmc.js +2 -0
- package/dist/sdk/{p-DA84OuuU.js.map → p-FFRhPCmc.js.map} +1 -1
- package/dist/sdk/p-Jrp0G45B.js +2 -0
- package/dist/sdk/{p-BlOjABPD.js.map → p-Jrp0G45B.js.map} +1 -1
- package/dist/sdk/p-MA26cw6g.js +2 -0
- package/dist/sdk/p-MA26cw6g.js.map +1 -0
- package/dist/sdk/p-P0eZf5rH.js +2 -0
- package/dist/sdk/p-P0eZf5rH.js.map +1 -0
- package/dist/sdk/{p-S3-2d2Qd.js → p-PSIHL0wP.js} +2 -2
- package/dist/sdk/{p-S3-2d2Qd.js.map → p-PSIHL0wP.js.map} +1 -1
- package/dist/sdk/p-a341c7f6.entry.js +2 -0
- package/dist/sdk/p-a341c7f6.entry.js.map +1 -0
- package/dist/sdk/p-a38cd448.entry.js +2 -0
- package/dist/sdk/{p-593c6dde.entry.js.map → p-a38cd448.entry.js.map} +1 -1
- package/dist/sdk/{p-87d10077.entry.js → p-a45ef398.entry.js} +2 -2
- package/dist/sdk/{p-87d10077.entry.js.map → p-a45ef398.entry.js.map} +1 -1
- package/dist/sdk/p-b5a6ad01.entry.js +2 -0
- package/dist/sdk/p-b5a6ad01.entry.js.map +1 -0
- package/dist/sdk/{p-9f59909b.entry.js → p-b93bf91d.entry.js} +2 -2
- package/dist/sdk/{p-9f59909b.entry.js.map → p-b93bf91d.entry.js.map} +1 -1
- package/dist/sdk/{p-09cd77e6.entry.js → p-baf5dcb7.entry.js} +2 -2
- package/dist/sdk/p-c07a43e2.entry.js +2 -0
- package/dist/sdk/p-c07a43e2.entry.js.map +1 -0
- package/dist/sdk/p-c98ad60d.entry.js +2 -0
- package/dist/sdk/p-c98ad60d.entry.js.map +1 -0
- package/dist/sdk/{p-f5615938.entry.js → p-d0c0fb6b.entry.js} +2 -2
- package/dist/sdk/p-d47aaf26.entry.js +2 -0
- package/dist/sdk/p-d47aaf26.entry.js.map +1 -0
- package/dist/sdk/p-e5ef30ef.entry.js +2 -0
- package/dist/sdk/p-eb348798.entry.js +2 -0
- package/dist/sdk/{p-73c2ec89.entry.js.map → p-eb348798.entry.js.map} +1 -1
- package/dist/sdk/p-f82f500d.entry.js +2 -0
- package/dist/sdk/p-f82f500d.entry.js.map +1 -0
- package/dist/sdk/p-f88ed6e8.entry.js +2 -0
- package/dist/sdk/p-f88ed6e8.entry.js.map +1 -0
- package/dist/sdk/{p-afc65acd.entry.js → p-f9affafe.entry.js} +2 -2
- package/dist/sdk/p-jyF1XwDG.js +2 -0
- package/dist/sdk/p-jyF1XwDG.js.map +1 -0
- package/dist/sdk/sdk.esm.js +1 -1
- package/dist/sdk/sdk.esm.js.map +1 -1
- package/dist/sdk/u-config.entry.esm.js.map +1 -1
- package/dist/sdk/u-error-message.entry.esm.js.map +1 -1
- package/dist/sdk/u-field.u-raw-field.entry.esm.js.map +1 -1
- package/dist/sdk/u-full-profile.entry.esm.js.map +1 -1
- package/dist/sdk/u-logout-button.u-signed-in.entry.esm.js.map +1 -1
- package/dist/sdk/u-magic-code-field.entry.esm.js.map +1 -1
- package/dist/sdk/u-missing-field.entry.esm.js.map +1 -1
- package/dist/sdk/u-missing-fields-submit-button.entry.esm.js.map +1 -1
- package/dist/sdk/u-newsletter-logout-button.entry.esm.js.map +1 -1
- package/dist/sdk/u-newsletter-preference-checkbox.entry.esm.js.map +1 -1
- package/dist/sdk/u-pagination-button.entry.esm.js.map +1 -1
- package/dist/sdk/u-pagination-page.entry.esm.js.map +1 -1
- package/dist/sdk/u-passkey.entry.esm.js.map +1 -1
- package/dist/sdk/u-profile.u-submit-button.entry.esm.js.map +1 -1
- package/dist/sdk/u-registration-button.entry.esm.js.map +1 -1
- package/dist/sdk/u-send-magic-code-button.entry.esm.js.map +1 -1
- package/dist/sdk/u-signin-step.entry.esm.js.map +1 -1
- package/dist/sdk/u-social-login-button.entry.esm.js.map +1 -1
- package/dist/sdk/u-spinner.entry.esm.js.map +1 -1
- package/dist/types/api/index.d.ts +2 -2
- package/dist/types/auth/api/auth.d.ts +3 -1
- package/dist/types/auth/auth-helpers.d.ts +1 -0
- package/dist/types/auth/auth.d.ts +9 -1
- package/dist/types/auth/components/logout-button/logout-button.d.ts +1 -1
- package/dist/types/auth/index.d.ts +3 -4
- package/dist/types/auth/store/auth-store.d.ts +2 -0
- package/dist/types/components.d.ts +8 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/logger.d.ts +1 -1
- package/dist/types/newsletter/api/newsletters.d.ts +1 -1
- package/dist/types/newsletter/components/logout-button/logout-button.d.ts +2 -0
- package/dist/types/profile/components/field/field.d.ts +0 -1
- package/dist/types/profile/components/raw-field/raw-field.d.ts +2 -2
- package/dist/types/profile/index.d.ts +2 -3
- package/dist/types/shared/component-utils.d.ts +7 -0
- package/dist/types/shared/components/config/config.d.ts +1 -0
- package/dist/types/ticketable/api/get-with-schema.d.ts +1 -1
- package/dist/types/ticketable/index.d.ts +1 -1
- package/package.json +23 -18
- package/dist/cjs/app-globals-DSKjcXX_.js +0 -10
- package/dist/cjs/app-globals-DSKjcXX_.js.map +0 -1
- package/dist/cjs/auth-B83pzi0f.js.map +0 -1
- package/dist/cjs/auth-store-DPHWWmXf.js.map +0 -1
- package/dist/cjs/component-utils-BpMyeVQo.js.map +0 -1
- package/dist/cjs/i18n-BoDZ8kd2.js.map +0 -1
- package/dist/cjs/index-B_N5xKgH.js.map +0 -1
- package/dist/cjs/index-DLz3FT7T.js.map +0 -1
- package/dist/cjs/index-R2MKLaem.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-B0RIcDM-.js.map +0 -1
- package/dist/esm/auth-store-BGMYm_jK.js.map +0 -1
- package/dist/esm/component-utils-D1lzXl_Z.js.map +0 -1
- package/dist/esm/i18n-CLdWzy5J.js.map +0 -1
- package/dist/esm/index-Bjp1XO-f.js.map +0 -1
- package/dist/esm/index-Ci3aTmzp.js.map +0 -1
- package/dist/esm/index-DSDkaHWI.js.map +0 -1
- package/dist/sdk/p-1176c407.entry.js +0 -2
- package/dist/sdk/p-1176c407.entry.js.map +0 -1
- package/dist/sdk/p-2a65bcbb.entry.js +0 -2
- package/dist/sdk/p-2a65bcbb.entry.js.map +0 -1
- package/dist/sdk/p-2af8b45f.entry.js +0 -2
- package/dist/sdk/p-56abb377.entry.js +0 -2
- package/dist/sdk/p-56abb377.entry.js.map +0 -1
- package/dist/sdk/p-593c6dde.entry.js +0 -2
- package/dist/sdk/p-5b627aea.entry.js +0 -2
- package/dist/sdk/p-5b627aea.entry.js.map +0 -1
- package/dist/sdk/p-628ccd68.entry.js +0 -2
- package/dist/sdk/p-675eb13d.entry.js +0 -2
- package/dist/sdk/p-675eb13d.entry.js.map +0 -1
- package/dist/sdk/p-6893d167.entry.js +0 -2
- package/dist/sdk/p-6a642433.entry.js +0 -2
- package/dist/sdk/p-73c2ec89.entry.js +0 -2
- package/dist/sdk/p-91bb8b59.entry.js +0 -2
- package/dist/sdk/p-91bb8b59.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-BlAULXyw.js +0 -2
- package/dist/sdk/p-BlAULXyw.js.map +0 -1
- package/dist/sdk/p-BlOjABPD.js +0 -2
- package/dist/sdk/p-C0feI0p8.js +0 -2
- package/dist/sdk/p-C3fhudPT.js +0 -2
- package/dist/sdk/p-C3fhudPT.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-CPPYdoIv.js +0 -2
- package/dist/sdk/p-CbRhHGU5.js +0 -2
- package/dist/sdk/p-CbRhHGU5.js.map +0 -1
- package/dist/sdk/p-Ce8zGAi1.js +0 -2
- package/dist/sdk/p-Ci3aTmzp.js +0 -3
- package/dist/sdk/p-Ci3aTmzp.js.map +0 -1
- package/dist/sdk/p-D1lzXl_Z.js.map +0 -1
- package/dist/sdk/p-DA84OuuU.js +0 -2
- package/dist/sdk/p-DdUvQelg.js +0 -2
- package/dist/sdk/p-DdUvQelg.js.map +0 -1
- package/dist/sdk/p-b0728464.entry.js +0 -2
- package/dist/sdk/p-b0728464.entry.js.map +0 -1
- package/dist/sdk/p-c197fdb3.entry.js +0 -2
- package/dist/sdk/p-c197fdb3.entry.js.map +0 -1
- package/dist/sdk/p-c31dbbb4.entry.js.map +0 -1
- package/dist/sdk/p-c5bffd90.entry.js +0 -2
- package/dist/sdk/p-f0598e42.entry.js +0 -2
- package/dist/sdk/p-f0598e42.entry.js.map +0 -1
- package/dist/sdk/p-ffac964c.entry.js +0 -2
- package/dist/sdk/p-ffac964c.entry.js.map +0 -1
- /package/dist/sdk/{p-93200fb4.entry.js.map → p-1bad3fd0.entry.js.map} +0 -0
- /package/dist/sdk/{p-22e4d08b.entry.js.map → p-1d6982cd.entry.js.map} +0 -0
- /package/dist/sdk/{p-6a642433.entry.js.map → p-23d8e922.entry.js.map} +0 -0
- /package/dist/sdk/{p-c5bffd90.entry.js.map → p-34af7470.entry.js.map} +0 -0
- /package/dist/sdk/{p-bb603b00.entry.js.map → p-46013b2f.entry.js.map} +0 -0
- /package/dist/sdk/{p-08ff2de2.entry.js.map → p-46cdb255.entry.js.map} +0 -0
- /package/dist/sdk/{p-a5db968f.entry.js.map → p-4d9bde6e.entry.js.map} +0 -0
- /package/dist/sdk/{p-b0917777.entry.js.map → p-5c40c6ea.entry.js.map} +0 -0
- /package/dist/sdk/{p-09cd77e6.entry.js.map → p-baf5dcb7.entry.js.map} +0 -0
- /package/dist/sdk/{p-f5615938.entry.js.map → p-d0c0fb6b.entry.js.map} +0 -0
- /package/dist/sdk/{p-628ccd68.entry.js.map → p-e5ef30ef.entry.js.map} +0 -0
- /package/dist/sdk/{p-afc65acd.entry.js.map → p-f9affafe.entry.js.map} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{S as t}from"./p-COQ27Nb6.js";const e=(t,e,n)=>{let o=t.get(e);if(!o){o=[];t.set(e,o)}if(!o.some((t=>t.deref()===n))){o.push(new WeakRef(n))}};const n=(t,e)=>{let n;return(...o)=>{if(n){clearTimeout(n)}n=setTimeout((()=>{n=0;t(...o)}),e)}};const o=t=>!("isConnected"in t)||t.isConnected;const s=n((t=>{for(let e of t.keys()){const n=t.get(e).filter((t=>{const e=t.deref();return e&&o(e)}));t.set(e,n)}}),2e3);const r=t;const c=r.forceUpdate;const f=r.getRenderingRef;const u=()=>{if(typeof f!=="function"||typeof c!=="function"){return{}}const t=c;const n=f;const o=new Map;return{dispose:()=>o.clear(),get:t=>{const s=n();if(s){e(o,t,s)}},set:e=>{const n=o.get(e);if(n){const s=n.filter((e=>{const n=e.deref();if(!n)return false;return t(n)}));o.set(e,s)}s(o)},reset:()=>{o.forEach((e=>{e.forEach((e=>{const n=e.deref();if(n)t(n)}))}));s(o)}}};const i=t=>typeof t==="function"?t():t;const a=(t,e=(t,e)=>t!==e)=>{const n=()=>i(t)??{};const o=n();let s=new Map(Object.entries(o));const r=typeof Proxy!=="undefined";const c=r?null:{};const f={dispose:[],get:[],set:[],reset:[]};const u=new Map;const a=()=>{s=new Map(Object.entries(n()));if(!r){x()}f.reset.forEach((t=>t()))};const l=()=>{f.dispose.forEach((t=>t()));a()};const d=t=>{f.get.forEach((e=>e(t)));return s.get(t)};const b=(t,n)=>{const o=s.get(t);if(e(n,o,t)){s.set(t,n);if(!r){M(t)}f.set.forEach((e=>e(t,n,o)))}};const g=r?new Proxy(o,{get(t,e){return d(e)},ownKeys(t){return Array.from(s.keys())},getOwnPropertyDescriptor(){return{enumerable:true,configurable:true}},has(t,e){return s.has(e)},set(t,e,n){b(e,n);return true}}):(()=>{x();return c})();const w=(t,e)=>{f[t].push(e);return()=>{p(f[t],e)}};const y=(t,e)=>{const o=(n,o)=>{if(n===t){e(o)}};const s=()=>{const o=n();e(o[t])};const r=w("set",o);const c=w("reset",s);u.set(e,{setHandler:o,resetHandler:s,propName:t});return()=>{r();c();u.delete(e)}};const m=(...t)=>{const e=t.reduce(((t,e)=>{if(e.set){t.push(w("set",e.set))}if(e.get){t.push(w("get",e.get))}if(e.reset){t.push(w("reset",e.reset))}if(e.dispose){t.push(w("dispose",e.dispose))}return t}),[]);return()=>e.forEach((t=>t()))};const O=t=>{const e=s.get(t);f.set.forEach((n=>n(t,e,e)))};const j=(t,e)=>{const n=u.get(e);if(n&&n.propName===t){p(f.set,n.setHandler);p(f.reset,n.resetHandler);u.delete(e)}};function M(t){if(r||!c){return}if(Object.prototype.hasOwnProperty.call(c,t)){return}Object.defineProperty(c,t,{configurable:true,enumerable:true,get(){return d(t)},set(e){b(t,e)}})}function x(){if(r||!c){return}const t=new Set(s.keys());for(const e of Object.keys(c)){if(!t.has(e)){delete c[e]}}for(const e of t){M(e)}}return{state:g,get:d,set:b,on:w,onChange:y,use:m,dispose:l,reset:a,forceUpdate:O,removeListener:j}};const p=(t,e)=>{const n=t.indexOf(e);if(n>=0){t[n]=t[t.length-1];t.length--}};const l=(t,e)=>{const n=a(t,e);n.use(u());return n};export{l as c};
|
|
2
|
+
//# sourceMappingURL=p-P0eZf5rH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"p-P0eZf5rH.js","sources":["../../node_modules/@stencil/store/dist/index.js"],"sourcesContent":["import * as StencilCore from '@stencil/core';\n\nconst appendToMap = (map, propName, value) => {\n let refs = map.get(propName);\n if (!refs) {\n refs = [];\n map.set(propName, refs);\n }\n if (!refs.some((ref) => ref.deref() === value)) {\n refs.push(new WeakRef(value));\n }\n};\nconst debounce = (fn, ms) => {\n let timeoutId;\n return (...args) => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(() => {\n timeoutId = 0;\n fn(...args);\n }, ms);\n };\n};\n\n/**\n * Check if a possible element isConnected.\n * The property might not be there, so we check for it.\n *\n * We want it to return true if isConnected is not a property,\n * otherwise we would remove these elements and would not update.\n *\n * Better leak in Edge than to be useless.\n */\nconst isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;\nconst cleanupElements = debounce((map) => {\n for (let key of map.keys()) {\n const refs = map.get(key).filter((ref) => {\n const elm = ref.deref();\n return elm && isConnected(elm);\n });\n map.set(key, refs);\n }\n}, 2_000);\nconst core = StencilCore;\nconst forceUpdate = core.forceUpdate;\nconst getRenderingRef = core.getRenderingRef;\nconst stencilSubscription = () => {\n if (typeof getRenderingRef !== 'function' || typeof forceUpdate !== 'function') {\n // If we are not in a stencil project, we do nothing.\n // This function is not really exported by @stencil/core.\n return {};\n }\n const ensureForceUpdate = forceUpdate;\n const ensureGetRenderingRef = getRenderingRef;\n const elmsToUpdate = new Map();\n return {\n dispose: () => elmsToUpdate.clear(),\n get: (propName) => {\n const elm = ensureGetRenderingRef();\n if (elm) {\n appendToMap(elmsToUpdate, propName, elm);\n }\n },\n set: (propName) => {\n const refs = elmsToUpdate.get(propName);\n if (refs) {\n const nextRefs = refs.filter((ref) => {\n const elm = ref.deref();\n if (!elm)\n return false;\n return ensureForceUpdate(elm);\n });\n elmsToUpdate.set(propName, nextRefs);\n }\n cleanupElements(elmsToUpdate);\n },\n reset: () => {\n elmsToUpdate.forEach((refs) => {\n refs.forEach((ref) => {\n const elm = ref.deref();\n if (elm)\n ensureForceUpdate(elm);\n });\n });\n cleanupElements(elmsToUpdate);\n },\n };\n};\n\nconst unwrap = (val) => (typeof val === 'function' ? val() : val);\nconst createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {\n const resolveDefaultState = () => (unwrap(defaultState) ?? {});\n const initialState = resolveDefaultState();\n let states = new Map(Object.entries(initialState));\n const proxyAvailable = typeof Proxy !== 'undefined';\n const plainState = proxyAvailable ? null : {};\n const handlers = {\n dispose: [],\n get: [],\n set: [],\n reset: [],\n };\n // Track onChange listeners to enable removeListener functionality\n const changeListeners = new Map();\n const reset = () => {\n // When resetting the state, the default state may be a function - unwrap it to invoke it.\n // otherwise, the state won't be properly reset\n states = new Map(Object.entries(resolveDefaultState()));\n if (!proxyAvailable) {\n syncPlainStateKeys();\n }\n handlers.reset.forEach((cb) => cb());\n };\n const dispose = () => {\n // Call first dispose as resetting the state would\n // cause less updates ;)\n handlers.dispose.forEach((cb) => cb());\n reset();\n };\n const get = (propName) => {\n handlers.get.forEach((cb) => cb(propName));\n return states.get(propName);\n };\n const set = (propName, value) => {\n const oldValue = states.get(propName);\n if (shouldUpdate(value, oldValue, propName)) {\n states.set(propName, value);\n if (!proxyAvailable) {\n ensurePlainProperty(propName);\n }\n handlers.set.forEach((cb) => cb(propName, value, oldValue));\n }\n };\n const state = (proxyAvailable\n ? new Proxy(initialState, {\n get(_, propName) {\n return get(propName);\n },\n ownKeys(_) {\n return Array.from(states.keys());\n },\n getOwnPropertyDescriptor() {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n has(_, propName) {\n return states.has(propName);\n },\n set(_, propName, value) {\n set(propName, value);\n return true;\n },\n })\n : (() => {\n syncPlainStateKeys();\n return plainState;\n })());\n const on = (eventName, callback) => {\n handlers[eventName].push(callback);\n return () => {\n removeFromArray(handlers[eventName], callback);\n };\n };\n const onChange = (propName, cb) => {\n const setHandler = (key, newValue) => {\n if (key === propName) {\n cb(newValue);\n }\n };\n const resetHandler = () => {\n const snapshot = resolveDefaultState();\n cb(snapshot[propName]);\n };\n // Register the handlers\n const unSet = on('set', setHandler);\n const unReset = on('reset', resetHandler);\n // Track the relationship between the user callback and internal handlers\n changeListeners.set(cb, { setHandler, resetHandler, propName });\n return () => {\n unSet();\n unReset();\n changeListeners.delete(cb);\n };\n };\n const use = (...subscriptions) => {\n const unsubs = subscriptions.reduce((unsubs, subscription) => {\n if (subscription.set) {\n unsubs.push(on('set', subscription.set));\n }\n if (subscription.get) {\n unsubs.push(on('get', subscription.get));\n }\n if (subscription.reset) {\n unsubs.push(on('reset', subscription.reset));\n }\n if (subscription.dispose) {\n unsubs.push(on('dispose', subscription.dispose));\n }\n return unsubs;\n }, []);\n return () => unsubs.forEach((unsub) => unsub());\n };\n const forceUpdate = (key) => {\n const oldValue = states.get(key);\n handlers.set.forEach((cb) => cb(key, oldValue, oldValue));\n };\n const removeListener = (propName, listener) => {\n const listenerInfo = changeListeners.get(listener);\n if (listenerInfo && listenerInfo.propName === propName) {\n // Remove the specific handlers that were created for this listener\n removeFromArray(handlers.set, listenerInfo.setHandler);\n removeFromArray(handlers.reset, listenerInfo.resetHandler);\n changeListeners.delete(listener);\n }\n };\n function ensurePlainProperty(key) {\n if (proxyAvailable || !plainState) {\n return;\n }\n if (Object.prototype.hasOwnProperty.call(plainState, key)) {\n return;\n }\n Object.defineProperty(plainState, key, {\n configurable: true,\n enumerable: true,\n get() {\n return get(key);\n },\n set(value) {\n set(key, value);\n },\n });\n }\n function syncPlainStateKeys() {\n if (proxyAvailable || !plainState) {\n return;\n }\n const knownKeys = new Set(states.keys());\n for (const key of Object.keys(plainState)) {\n if (!knownKeys.has(key)) {\n delete plainState[key];\n }\n }\n for (const key of knownKeys) {\n ensurePlainProperty(key);\n }\n }\n return {\n state,\n get,\n set,\n on,\n onChange,\n use,\n dispose,\n reset,\n forceUpdate,\n removeListener,\n };\n};\nconst removeFromArray = (array, item) => {\n const index = array.indexOf(item);\n if (index >= 0) {\n array[index] = array[array.length - 1];\n array.length--;\n }\n};\n\nconst createStore = (defaultState, shouldUpdate) => {\n const map = createObservableMap(defaultState, shouldUpdate);\n map.use(stencilSubscription());\n return map;\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,KAAK,CAAC,MAAM,EAAE;AACtB;AACA,CAAC;;AAEI,MAAC,WAAW,GAAG,CAAC,YAAY,EAAE,YAAY,KAAK;AACpD,IAAI,MAAM,GAAG,GAAG,mBAAmB,CAAC,YAAY,EAAE,YAAY,CAAC;AAC/D,IAAI,GAAG,CAAC,GAAG,CAAC,mBAAmB,EAAE,CAAC;AAClC,IAAI,OAAO,GAAG;AACd;;;;","x_google_ignoreList":[0]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{g as e}from"./p-
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{g as e}from"./p-MA26cw6g.js";import{A as n}from"./p-jyF1XwDG.js";import{t as r}from"./p-BR6L248H.js";import{i as t}from"./p-COQ27Nb6.js";import{F as s}from"./p-CpJghKnM.js";import{n as o,p as i}from"./p-CSLU6kes.js";const a=t("NewsletterHelpers");const c="unidy_newsletter_";function f(){o.state.preferenceToken="";o.state.existingSubscriptions=[];sessionStorage.removeItem(`${c}preferenceToken`);sessionStorage.removeItem(`${c}email`)}async function u(t){const{preferenceToken:i}=o.state;const a=await n.getInstance();const c=await a.getToken();const u=await e().newsletters.resendDoi(t,{redirect_to_after_confirmation:g()},{preferenceToken:typeof i==="string"?i:"",idToken:typeof c==="string"?c:""});if(u.status===204){return true}if(u.status===401){s.error.addMessage(r("newsletter.errors.unauthorized"));f();return false}return false}async function l(n){const t=await e().newsletters.sendLoginEmail({email:n,redirect_uri:g()});if(t.status===204){s.info.addMessage(r("newsletter.success.login_email_sent"))}else if(t.status===404){s.error.addMessage(r("newsletter.errors.login_email_not_found"))}else{s.error.addMessage(r("errors.unknown",{defaultValue:"An unknown error occurred"}))}}async function w(){const{preferenceToken:t}=o.state;if(!t&&!o.state.isAuthenticated){a.error("Preference token or authentication is required to fetch subscriptions");return}const i=await n.getInstance();const c=await i.getToken();o.state.fetchingSubscriptions=true;const u=await e().newsletters.listSubscriptions({preferenceToken:t,idToken:typeof c==="string"?c:""});o.state.fetchingSubscriptions=false;if(u.status===401){f();s.error.addMessage(r("newsletter.errors.unauthorized"));return}if(u.success&&u.data){o.state.existingSubscriptions=u.data.map((e=>({newsletter_internal_name:e.newsletter_internal_name,confirmed:e.confirmed_at!==null,preference_identifiers:e.preference_identifiers||[]})));const e={...o.state.checkedNewsletters};for(const n of u.data){e[n.newsletter_internal_name]=[...n.preference_identifiers||[]]}o.state.checkedNewsletters=e}}async function d(e,n){if(o.state.isAuthenticated||o.state.preferenceToken){const e=new Set(o.state.existingSubscriptions.map((e=>e.newsletter_internal_name)));const r=n.filter((n=>n.error_identifier==="already_subscribed"&&!e.has(n.meta.newsletter_internal_name))).map((e=>({newsletter_internal_name:e.meta.newsletter_internal_name,confirmed:null,preference_identifiers:[]})));if(r.length>0){o.state.existingSubscriptions=[...o.state.existingSubscriptions,...r]}}else{await l(e)}}async function p(t,i,a=true){const c=await n.getInstance();const u=await c.getToken();const{checkedNewsletters:l}=o.state;const[w,p]=await e().newsletters.createSubscriptions({email:t,newsletter_subscriptions:i.map((e=>({newsletter_internal_name:e,preference_identifiers:l[e]||[]}))),redirect_to_after_confirmation:g()},{idToken:typeof u==="string"?u:""});if(w===null){if(p.data?.results&&p.data.results.length>0){const e=p.data.results.map((e=>({newsletter_internal_name:e.newsletter_internal_name,confirmed:e.confirmed_at!==null,preference_identifiers:e.preference_identifiers||[]})));o.state.existingSubscriptions=[...o.state.existingSubscriptions,...e]}if(a){s.success.addMessage(r("newsletter.success.subscribe"))}return true}if(w==="unauthorized"){s.error.addMessage(r("newsletter.errors.unauthorized"));f();return false}if(w==="newsletter_error"){const e=p.data?.errors||[];const n={};const r=e.some((e=>e.error_identifier==="already_subscribed"));if(r){await d(t,e)}const s=e.some((e=>e.error_identifier==="newsletter_not_found"));if(s){n.general="newsletter_not_found"}const i=e.some((e=>e.error_identifier==="validation_error"&&e.error_details&&"email"in e.error_details));if(i){n.email="invalid_email"}else{for(const r of e){n[r.meta.newsletter_internal_name]=r.error_identifier}}o.state.errors=n}else{s.error.addMessage(r("errors.unknown",{defaultValue:"An unknown error occurred"}))}return false}async function _(e,n){return p(n,[e],false)}async function m({email:e}){const n=Object.keys(o.state.checkedNewsletters);await p(e,n,true)}async function k(t){const{preferenceToken:c}=o.state;if(!c&&!o.state.isAuthenticated){a.error("Preference token or authentication is required to delete a subscription");return false}const u=await n.getInstance();const l=await u.getToken();const w=await e().newsletters.deleteSubscription(t,{preferenceToken:c,idToken:typeof l==="string"?l:""});if(w.status===200&&w.data?.new_preference_token){if(!o.state.isAuthenticated){o.state.preferenceToken=w.data.new_preference_token;i("preferenceToken")}o.state.existingSubscriptions=o.state.existingSubscriptions.filter((e=>e.newsletter_internal_name!==t));const e=o.state.defaultPreferences[t];o.state.checkedNewsletters={...o.state.checkedNewsletters,[t]:e?[...e]:[]};return true}if(w.status===204){f();o.state.checkedNewsletters={};return true}if(w.status===401){s.error.addMessage(r("newsletter.errors.unauthorized"));f();return false}if(w.status===422){return false}s.error.addMessage(r("errors.unknown",{defaultValue:"An unknown error occurred"}));return false}function y(e){return o.state.existingSubscriptions.find((n=>n.newsletter_internal_name===e))}function b(e){return o.state.existingSubscriptions.some((n=>n.newsletter_internal_name===e))}function T(e){const n=y(e);return n?.confirmed??false}function g(){const e=`${location.origin}${location.pathname}`;const n=new URLSearchParams(location.search);for(const e of["email","newsletter_error"]){n.delete(e)}const r=n.toString();return r?`${e}?${r}`:e}async function h(t){const{preferenceToken:i}=o.state;if(!i&&!o.state.isAuthenticated){a.error("Preference token or authentication is required to update subscription preferences");return false}if(!b(t)){a.error(`Cannot update preferences: not subscribed to newsletter '${t}'`);return false}const c=await n.getInstance();const u=await c.getToken();const l=o.state.checkedNewsletters[t]||[];const w=await e().newsletters.updateSubscription(t,{preference_identifiers:l},{preferenceToken:i,idToken:typeof u==="string"?u:""});if(w.status===401){s.error.addMessage(r("newsletter.errors.unauthorized"));f();return false}if(w.success&&w.data){const e=o.state.existingSubscriptions.findIndex((e=>e.newsletter_internal_name===t));if(e!==-1){const n=[...o.state.existingSubscriptions];n[e]={...n[e],preference_identifiers:w.data.preference_identifiers||[]};o.state.existingSubscriptions=n}s.success.addMessage(r("newsletter.success.preferences_updated"));return true}s.error.addMessage(r("errors.unknown",{defaultValue:"An unknown error occurred"}));return false}export{b as a,_ as b,m as c,k as d,w as f,T as i,f as n,u as r,l as s,h as u};
|
|
2
|
+
//# sourceMappingURL=p-PSIHL0wP.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"p-S3-2d2Qd.js","sources":["src/newsletter/newsletter-helpers.ts"],"sourcesContent":["import { getUnidyClient } from \"../api\";\nimport { Auth } from \"../auth/auth\";\nimport { t } from \"../i18n\";\nimport { createLogger } from \"../logger\";\nimport { Flash } from \"../shared/store/flash-store\";\nimport {\n type CheckedNewsletters,\n type ExistingSubscription,\n type NewsletterErrorIdentifier,\n newsletterStore,\n persist,\n} from \"./store/newsletter-store\";\n\nconst logger = createLogger(\"NewsletterHelpers\");\n\nconst PERSIST_KEY_PREFIX = \"unidy_newsletter_\";\n\nexport function newsletterLogout(): void {\n newsletterStore.state.preferenceToken = \"\";\n newsletterStore.state.existingSubscriptions = [];\n sessionStorage.removeItem(`${PERSIST_KEY_PREFIX}preferenceToken`);\n sessionStorage.removeItem(`${PERSIST_KEY_PREFIX}email`);\n}\n\nexport async function resendDoi(internalName: string): Promise<boolean> {\n const { preferenceToken } = newsletterStore.state;\n\n const authInstance = await Auth.getInstance();\n const idToken = await authInstance.getToken();\n\n const response = await getUnidyClient().newsletters.resendDoi(\n internalName,\n { redirect_to_after_confirmation: redirectToAfterConfirmationUrl() },\n {\n preferenceToken: typeof preferenceToken === \"string\" ? preferenceToken : \"\",\n idToken: typeof idToken === \"string\" ? idToken : \"\",\n },\n );\n\n if (response.status === 204) {\n return true;\n }\n\n if (response.status === 401) {\n Flash.error.addMessage(t(\"newsletter.errors.unauthorized\"));\n newsletterLogout();\n return false;\n }\n\n return false;\n}\n\nexport async function sendLoginEmail(email: string): Promise<void> {\n const response = await getUnidyClient().newsletters.sendLoginEmail({\n email,\n redirect_uri: redirectToAfterConfirmationUrl(),\n });\n\n if (response.status === 204) {\n Flash.info.addMessage(t(\"newsletter.success.login_email_sent\"));\n } else if (response.status === 404) {\n Flash.error.addMessage(t(\"newsletter.errors.login_email_not_found\"));\n } else {\n Flash.error.addMessage(t(\"errors.unknown\", { defaultValue: \"An unknown error occurred\" }));\n }\n}\n\nexport async function fetchSubscriptions(): Promise<void> {\n const { preferenceToken } = newsletterStore.state;\n\n // either preference token is needed or the user must be authenticated\n if (!preferenceToken && !newsletterStore.state.isAuthenticated) {\n logger.error(\"Preference token or authentication is required to fetch subscriptions\");\n return;\n }\n\n const authInstance = await Auth.getInstance();\n const idToken = await authInstance.getToken();\n\n newsletterStore.state.fetchingSubscriptions = true;\n\n const response = await getUnidyClient().newsletters.listSubscriptions({\n preferenceToken,\n idToken: typeof idToken === \"string\" ? idToken : \"\",\n });\n\n newsletterStore.state.fetchingSubscriptions = false;\n\n if (response.status === 401) {\n newsletterLogout();\n Flash.error.addMessage(t(\"newsletter.errors.unauthorized\"));\n return;\n }\n\n if (response.success && response.data) {\n newsletterStore.state.existingSubscriptions = response.data.map(\n (sub): ExistingSubscription => ({\n newsletter_internal_name: sub.newsletter_internal_name,\n confirmed: sub.confirmed_at !== null,\n preference_identifiers: sub.preference_identifiers || [],\n }),\n );\n\n // init checked newsletters and preferences\n const checkedNewsletters: CheckedNewsletters = { ...newsletterStore.state.checkedNewsletters };\n for (const sub of response.data) {\n checkedNewsletters[sub.newsletter_internal_name] = [...(sub.preference_identifiers || [])];\n }\n newsletterStore.state.checkedNewsletters = checkedNewsletters;\n }\n}\n\nasync function handleAlreadySubscribedError(\n email: string,\n errors: Array<{ error_identifier: string; meta: { newsletter_internal_name: string } }>,\n): Promise<void> {\n if (newsletterStore.state.isAuthenticated || newsletterStore.state.preferenceToken) {\n const existingNames = new Set(newsletterStore.state.existingSubscriptions.map((s) => s.newsletter_internal_name));\n\n const newSubscriptions: ExistingSubscription[] = errors\n .filter((err) => err.error_identifier === \"already_subscribed\" && !existingNames.has(err.meta.newsletter_internal_name))\n .map((err) => ({\n newsletter_internal_name: err.meta.newsletter_internal_name,\n confirmed: null,\n preference_identifiers: [],\n }));\n\n if (newSubscriptions.length > 0) {\n newsletterStore.state.existingSubscriptions = [...newsletterStore.state.existingSubscriptions, ...newSubscriptions];\n }\n } else {\n await sendLoginEmail(email);\n }\n}\n\nasync function handleCreateSubscriptionRequest(email: string, internalNames: string[], showSuccessMessage = true): Promise<boolean> {\n const authInstance = await Auth.getInstance();\n const idToken = await authInstance.getToken();\n const { checkedNewsletters } = newsletterStore.state;\n\n const [error, response] = await getUnidyClient().newsletters.createSubscriptions(\n {\n email,\n newsletter_subscriptions: internalNames.map((newsletter) => ({\n newsletter_internal_name: newsletter,\n preference_identifiers: checkedNewsletters[newsletter] || [],\n })),\n redirect_to_after_confirmation: redirectToAfterConfirmationUrl(),\n },\n {\n idToken: typeof idToken === \"string\" ? idToken : \"\",\n },\n );\n\n if (error === null) {\n if (response.data?.results && response.data.results.length > 0) {\n const newSubscriptions: ExistingSubscription[] = response.data.results.map((result) => ({\n newsletter_internal_name: result.newsletter_internal_name,\n confirmed: result.confirmed_at !== null,\n preference_identifiers: result.preference_identifiers || [],\n }));\n\n newsletterStore.state.existingSubscriptions = [...newsletterStore.state.existingSubscriptions, ...newSubscriptions];\n }\n\n if (showSuccessMessage) {\n Flash.success.addMessage(t(\"newsletter.success.subscribe\"));\n }\n\n return true;\n }\n\n if (error === \"unauthorized\") {\n Flash.error.addMessage(t(\"newsletter.errors.unauthorized\"));\n newsletterLogout();\n return false;\n }\n\n if (error === \"newsletter_error\") {\n const errors = response.data?.errors || [];\n const errorMap: Record<string, NewsletterErrorIdentifier> = {};\n\n // special error case which is handled differently: if user is not authenticated, we send a login email, otherwise we add the\n // already_subscribed subscriptions to the existing subscriptions\n const hasAlreadySubscribedError = errors.some((err) => err.error_identifier === \"already_subscribed\");\n if (hasAlreadySubscribedError) {\n await handleAlreadySubscribedError(email, errors);\n }\n\n const newsletterNotFoundError = errors.some((err) => err.error_identifier === \"newsletter_not_found\");\n if (newsletterNotFoundError) {\n errorMap.general = \"newsletter_not_found\";\n }\n\n const hasInvalidEmailError = errors.some(\n (err) => err.error_identifier === \"validation_error\" && err.error_details && \"email\" in err.error_details,\n );\n\n if (hasInvalidEmailError) {\n errorMap.email = \"invalid_email\";\n } else {\n for (const err of errors) {\n errorMap[err.meta.newsletter_internal_name] = err.error_identifier as NewsletterErrorIdentifier;\n }\n }\n\n newsletterStore.state.errors = errorMap;\n } else {\n Flash.error.addMessage(t(\"errors.unknown\", { defaultValue: \"An unknown error occurred\" }));\n }\n\n return false;\n}\n\nexport async function subscribeToNewsletter(internalName: string, email: string): Promise<boolean> {\n return handleCreateSubscriptionRequest(email, [internalName], false);\n}\n\nexport async function createSubscriptions({ email }: { email: string }): Promise<void> {\n const internalNames = Object.keys(newsletterStore.state.checkedNewsletters);\n await handleCreateSubscriptionRequest(email, internalNames, true);\n}\n\nexport async function deleteSubscription(internalName: string): Promise<boolean> {\n const { preferenceToken } = newsletterStore.state;\n\n // either preference token is needed or the user must be authenticated to delete a subscription\n if (!preferenceToken && !newsletterStore.state.isAuthenticated) {\n logger.error(\"Preference token or authentication is required to delete a subscription\");\n return false;\n }\n\n const authInstance = await Auth.getInstance();\n const idToken = await authInstance.getToken();\n\n const response = await getUnidyClient().newsletters.deleteSubscription(internalName, {\n preferenceToken,\n idToken: typeof idToken === \"string\" ? idToken : \"\",\n });\n\n if (response.status === 200 && response.data?.new_preference_token) {\n // if user is not authenticated, we need to store the new preference token which is used for the next request\n if (!newsletterStore.state.isAuthenticated) {\n newsletterStore.state.preferenceToken = response.data.new_preference_token;\n persist(\"preferenceToken\");\n }\n\n newsletterStore.state.existingSubscriptions = newsletterStore.state.existingSubscriptions.filter(\n (sub) => sub.newsletter_internal_name !== internalName,\n );\n\n // Reset checked preferences to defaults (preferences marked with checked='true')\n const defaultPrefs = newsletterStore.state.defaultPreferences[internalName];\n newsletterStore.state.checkedNewsletters = {\n ...newsletterStore.state.checkedNewsletters,\n [internalName]: defaultPrefs ? [...defaultPrefs] : [],\n };\n\n return true;\n }\n\n if (response.status === 204) {\n newsletterLogout();\n\n newsletterStore.state.checkedNewsletters = {};\n return true;\n }\n\n if (response.status === 401) {\n Flash.error.addMessage(t(\"newsletter.errors.unauthorized\"));\n newsletterLogout();\n return false;\n }\n\n if (response.status === 422) {\n return false;\n }\n\n Flash.error.addMessage(t(\"errors.unknown\", { defaultValue: \"An unknown error occurred\" }));\n return false;\n}\n\nexport function getSubscription(internalName: string): ExistingSubscription | undefined {\n return newsletterStore.state.existingSubscriptions.find((sub) => sub.newsletter_internal_name === internalName);\n}\n\nexport function isSubscribed(internalName: string): boolean {\n return newsletterStore.state.existingSubscriptions.some((sub) => sub.newsletter_internal_name === internalName);\n}\n\nexport function isConfirmed(internalName: string): boolean {\n const sub = getSubscription(internalName);\n return sub?.confirmed ?? false;\n}\n\nfunction redirectToAfterConfirmationUrl(): string {\n const baseUrl = `${location.origin}${location.pathname}`;\n const params = new URLSearchParams(location.search);\n for (const key of [\"email\", \"newsletter_error\"]) {\n params.delete(key);\n }\n const queryString = params.toString();\n return queryString ? `${baseUrl}?${queryString}` : baseUrl;\n}\n\nexport function getSubscriptionPreferences(internalName: string): string[] {\n const subscription = getSubscription(internalName);\n return subscription?.preference_identifiers || [];\n}\n\nexport async function updateSubscriptionPreferences(internalName: string): Promise<boolean> {\n const { preferenceToken } = newsletterStore.state;\n\n // Either preference token is needed or the user must be authenticated\n if (!preferenceToken && !newsletterStore.state.isAuthenticated) {\n logger.error(\"Preference token or authentication is required to update subscription preferences\");\n return false;\n }\n\n // Check if the subscription exists\n if (!isSubscribed(internalName)) {\n logger.error(`Cannot update preferences: not subscribed to newsletter '${internalName}'`);\n return false;\n }\n\n const authInstance = await Auth.getInstance();\n const idToken = await authInstance.getToken();\n\n const preferenceIdentifiers = newsletterStore.state.checkedNewsletters[internalName] || [];\n\n const response = await getUnidyClient().newsletters.updateSubscription(\n internalName,\n { preference_identifiers: preferenceIdentifiers },\n {\n preferenceToken,\n idToken: typeof idToken === \"string\" ? idToken : \"\",\n },\n );\n\n if (response.status === 401) {\n Flash.error.addMessage(t(\"newsletter.errors.unauthorized\"));\n newsletterLogout();\n return false;\n }\n\n if (response.success && response.data) {\n // Update the local subscription with the new preferences\n const subscriptionIndex = newsletterStore.state.existingSubscriptions.findIndex((sub) => sub.newsletter_internal_name === internalName);\n\n if (subscriptionIndex !== -1) {\n const updatedSubscriptions = [...newsletterStore.state.existingSubscriptions];\n updatedSubscriptions[subscriptionIndex] = {\n ...updatedSubscriptions[subscriptionIndex],\n preference_identifiers: response.data.preference_identifiers || [],\n };\n newsletterStore.state.existingSubscriptions = updatedSubscriptions;\n }\n\n Flash.success.addMessage(t(\"newsletter.success.preferences_updated\"));\n return true;\n }\n\n Flash.error.addMessage(t(\"errors.unknown\", { defaultValue: \"An unknown error occurred\" }));\n return false;\n}\n"],"names":[],"mappings":";;;;;;;AAaA,MAAM,MAAM,GAAG,YAAY,CAAC,mBAAmB,CAAC;AAEhD,MAAM,kBAAkB,GAAG,mBAAmB;SAE9B,gBAAgB,GAAA;AAC9B,IAAA,eAAe,CAAC,KAAK,CAAC,eAAe,GAAG,EAAE;AAC1C,IAAA,eAAe,CAAC,KAAK,CAAC,qBAAqB,GAAG,EAAE;AAChD,IAAA,cAAc,CAAC,UAAU,CAAC,GAAG,kBAAkB,CAAA,eAAA,CAAiB,CAAC;AACjE,IAAA,cAAc,CAAC,UAAU,CAAC,GAAG,kBAAkB,CAAA,KAAA,CAAO,CAAC;AACzD;AAEO,eAAe,SAAS,CAAC,YAAoB,EAAA;AAClD,IAAA,MAAM,EAAE,eAAe,EAAE,GAAG,eAAe,CAAC,KAAK;AAEjD,IAAA,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE;AAC7C,IAAA,MAAM,OAAO,GAAG,M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CAAC,CAAC;AACrE,QAAA,OAAO,IAAI;;AAGb,IAAA,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,gBAAgB,EAAE,EAAE,YAAY,EAAE,2BAA2B,EAAE,CAAC,CAAC;AAC1F,IAAA,OAAO,KAAK;AACd;;;;"}
|
|
1
|
+
{"version":3,"file":"p-PSIHL0wP.js","sources":["src/newsletter/newsletter-helpers.ts"],"sourcesContent":["import { getUnidyClient } from \"../api\";\nimport { Auth } from \"../auth/auth\";\nimport { t } from \"../i18n\";\nimport { createLogger } from \"../logger\";\nimport { Flash } from \"../shared/store/flash-store\";\nimport {\n type CheckedNewsletters,\n type ExistingSubscription,\n type NewsletterErrorIdentifier,\n newsletterStore,\n persist,\n} from \"./store/newsletter-store\";\n\nconst logger = createLogger(\"NewsletterHelpers\");\n\nconst PERSIST_KEY_PREFIX = \"unidy_newsletter_\";\n\nexport function newsletterLogout(): void {\n newsletterStore.state.preferenceToken = \"\";\n newsletterStore.state.existingSubscriptions = [];\n sessionStorage.removeItem(`${PERSIST_KEY_PREFIX}preferenceToken`);\n sessionStorage.removeItem(`${PERSIST_KEY_PREFIX}email`);\n}\n\nexport async function resendDoi(internalName: string): Promise<boolean> {\n const { preferenceToken } = newsletterStore.state;\n\n const authInstance = await Auth.getInstance();\n const idToken = await authInstance.getToken();\n\n const response = await getUnidyClient().newsletters.resendDoi(\n internalName,\n { redirect_to_after_confirmation: redirectToAfterConfirmationUrl() },\n {\n preferenceToken: typeof preferenceToken === \"string\" ? preferenceToken : \"\",\n idToken: typeof idToken === \"string\" ? idToken : \"\",\n },\n );\n\n if (response.status === 204) {\n return true;\n }\n\n if (response.status === 401) {\n Flash.error.addMessage(t(\"newsletter.errors.unauthorized\"));\n newsletterLogout();\n return false;\n }\n\n return false;\n}\n\nexport async function sendLoginEmail(email: string): Promise<void> {\n const response = await getUnidyClient().newsletters.sendLoginEmail({\n email,\n redirect_uri: redirectToAfterConfirmationUrl(),\n });\n\n if (response.status === 204) {\n Flash.info.addMessage(t(\"newsletter.success.login_email_sent\"));\n } else if (response.status === 404) {\n Flash.error.addMessage(t(\"newsletter.errors.login_email_not_found\"));\n } else {\n Flash.error.addMessage(t(\"errors.unknown\", { defaultValue: \"An unknown error occurred\" }));\n }\n}\n\nexport async function fetchSubscriptions(): Promise<void> {\n const { preferenceToken } = newsletterStore.state;\n\n // either preference token is needed or the user must be authenticated\n if (!preferenceToken && !newsletterStore.state.isAuthenticated) {\n logger.error(\"Preference token or authentication is required to fetch subscriptions\");\n return;\n }\n\n const authInstance = await Auth.getInstance();\n const idToken = await authInstance.getToken();\n\n newsletterStore.state.fetchingSubscriptions = true;\n\n const response = await getUnidyClient().newsletters.listSubscriptions({\n preferenceToken,\n idToken: typeof idToken === \"string\" ? idToken : \"\",\n });\n\n newsletterStore.state.fetchingSubscriptions = false;\n\n if (response.status === 401) {\n newsletterLogout();\n Flash.error.addMessage(t(\"newsletter.errors.unauthorized\"));\n return;\n }\n\n if (response.success && response.data) {\n newsletterStore.state.existingSubscriptions = response.data.map(\n (sub): ExistingSubscription => ({\n newsletter_internal_name: sub.newsletter_internal_name,\n confirmed: sub.confirmed_at !== null,\n preference_identifiers: sub.preference_identifiers || [],\n }),\n );\n\n // init checked newsletters and preferences\n const checkedNewsletters: CheckedNewsletters = { ...newsletterStore.state.checkedNewsletters };\n for (const sub of response.data) {\n checkedNewsletters[sub.newsletter_internal_name] = [...(sub.preference_identifiers || [])];\n }\n newsletterStore.state.checkedNewsletters = checkedNewsletters;\n }\n}\n\nasync function handleAlreadySubscribedError(\n email: string,\n errors: Array<{ error_identifier: string; meta: { newsletter_internal_name: string } }>,\n): Promise<void> {\n if (newsletterStore.state.isAuthenticated || newsletterStore.state.preferenceToken) {\n const existingNames = new Set(newsletterStore.state.existingSubscriptions.map((s) => s.newsletter_internal_name));\n\n const newSubscriptions: ExistingSubscription[] = errors\n .filter((err) => err.error_identifier === \"already_subscribed\" && !existingNames.has(err.meta.newsletter_internal_name))\n .map((err) => ({\n newsletter_internal_name: err.meta.newsletter_internal_name,\n confirmed: null,\n preference_identifiers: [],\n }));\n\n if (newSubscriptions.length > 0) {\n newsletterStore.state.existingSubscriptions = [...newsletterStore.state.existingSubscriptions, ...newSubscriptions];\n }\n } else {\n await sendLoginEmail(email);\n }\n}\n\nasync function handleCreateSubscriptionRequest(email: string, internalNames: string[], showSuccessMessage = true): Promise<boolean> {\n const authInstance = await Auth.getInstance();\n const idToken = await authInstance.getToken();\n const { checkedNewsletters } = newsletterStore.state;\n\n const [error, response] = await getUnidyClient().newsletters.createSubscriptions(\n {\n email,\n newsletter_subscriptions: internalNames.map((newsletter) => ({\n newsletter_internal_name: newsletter,\n preference_identifiers: checkedNewsletters[newsletter] || [],\n })),\n redirect_to_after_confirmation: redirectToAfterConfirmationUrl(),\n },\n {\n idToken: typeof idToken === \"string\" ? idToken : \"\",\n },\n );\n\n if (error === null) {\n if (response.data?.results && response.data.results.length > 0) {\n const newSubscriptions: ExistingSubscription[] = response.data.results.map((result) => ({\n newsletter_internal_name: result.newsletter_internal_name,\n confirmed: result.confirmed_at !== null,\n preference_identifiers: result.preference_identifiers || [],\n }));\n\n newsletterStore.state.existingSubscriptions = [...newsletterStore.state.existingSubscriptions, ...newSubscriptions];\n }\n\n if (showSuccessMessage) {\n Flash.success.addMessage(t(\"newsletter.success.subscribe\"));\n }\n\n return true;\n }\n\n if (error === \"unauthorized\") {\n Flash.error.addMessage(t(\"newsletter.errors.unauthorized\"));\n newsletterLogout();\n return false;\n }\n\n if (error === \"newsletter_error\") {\n const errors = response.data?.errors || [];\n const errorMap: Record<string, NewsletterErrorIdentifier> = {};\n\n // special error case which is handled differently: if user is not authenticated, we send a login email, otherwise we add the\n // already_subscribed subscriptions to the existing subscriptions\n const hasAlreadySubscribedError = errors.some((err) => err.error_identifier === \"already_subscribed\");\n if (hasAlreadySubscribedError) {\n await handleAlreadySubscribedError(email, errors);\n }\n\n const newsletterNotFoundError = errors.some((err) => err.error_identifier === \"newsletter_not_found\");\n if (newsletterNotFoundError) {\n errorMap.general = \"newsletter_not_found\";\n }\n\n const hasInvalidEmailError = errors.some(\n (err) => err.error_identifier === \"validation_error\" && err.error_details && \"email\" in err.error_details,\n );\n\n if (hasInvalidEmailError) {\n errorMap.email = \"invalid_email\";\n } else {\n for (const err of errors) {\n errorMap[err.meta.newsletter_internal_name] = err.error_identifier as NewsletterErrorIdentifier;\n }\n }\n\n newsletterStore.state.errors = errorMap;\n } else {\n Flash.error.addMessage(t(\"errors.unknown\", { defaultValue: \"An unknown error occurred\" }));\n }\n\n return false;\n}\n\nexport async function subscribeToNewsletter(internalName: string, email: string): Promise<boolean> {\n return handleCreateSubscriptionRequest(email, [internalName], false);\n}\n\nexport async function createSubscriptions({ email }: { email: string }): Promise<void> {\n const internalNames = Object.keys(newsletterStore.state.checkedNewsletters);\n await handleCreateSubscriptionRequest(email, internalNames, true);\n}\n\nexport async function deleteSubscription(internalName: string): Promise<boolean> {\n const { preferenceToken } = newsletterStore.state;\n\n // either preference token is needed or the user must be authenticated to delete a subscription\n if (!preferenceToken && !newsletterStore.state.isAuthenticated) {\n logger.error(\"Preference token or authentication is required to delete a subscription\");\n return false;\n }\n\n const authInstance = await Auth.getInstance();\n const idToken = await authInstance.getToken();\n\n const response = await getUnidyClient().newsletters.deleteSubscription(internalName, {\n preferenceToken,\n idToken: typeof idToken === \"string\" ? idToken : \"\",\n });\n\n if (response.status === 200 && response.data?.new_preference_token) {\n // if user is not authenticated, we need to store the new preference token which is used for the next request\n if (!newsletterStore.state.isAuthenticated) {\n newsletterStore.state.preferenceToken = response.data.new_preference_token;\n persist(\"preferenceToken\");\n }\n\n newsletterStore.state.existingSubscriptions = newsletterStore.state.existingSubscriptions.filter(\n (sub) => sub.newsletter_internal_name !== internalName,\n );\n\n // Reset checked preferences to defaults (preferences marked with checked='true')\n const defaultPrefs = newsletterStore.state.defaultPreferences[internalName];\n newsletterStore.state.checkedNewsletters = {\n ...newsletterStore.state.checkedNewsletters,\n [internalName]: defaultPrefs ? [...defaultPrefs] : [],\n };\n\n return true;\n }\n\n if (response.status === 204) {\n newsletterLogout();\n\n newsletterStore.state.checkedNewsletters = {};\n return true;\n }\n\n if (response.status === 401) {\n Flash.error.addMessage(t(\"newsletter.errors.unauthorized\"));\n newsletterLogout();\n return false;\n }\n\n if (response.status === 422) {\n return false;\n }\n\n Flash.error.addMessage(t(\"errors.unknown\", { defaultValue: \"An unknown error occurred\" }));\n return false;\n}\n\nexport function getSubscription(internalName: string): ExistingSubscription | undefined {\n return newsletterStore.state.existingSubscriptions.find((sub) => sub.newsletter_internal_name === internalName);\n}\n\nexport function isSubscribed(internalName: string): boolean {\n return newsletterStore.state.existingSubscriptions.some((sub) => sub.newsletter_internal_name === internalName);\n}\n\nexport function isConfirmed(internalName: string): boolean {\n const sub = getSubscription(internalName);\n return sub?.confirmed ?? false;\n}\n\nfunction redirectToAfterConfirmationUrl(): string {\n const baseUrl = `${location.origin}${location.pathname}`;\n const params = new URLSearchParams(location.search);\n for (const key of [\"email\", \"newsletter_error\"]) {\n params.delete(key);\n }\n const queryString = params.toString();\n return queryString ? `${baseUrl}?${queryString}` : baseUrl;\n}\n\nexport function getSubscriptionPreferences(internalName: string): string[] {\n const subscription = getSubscription(internalName);\n return subscription?.preference_identifiers || [];\n}\n\nexport async function updateSubscriptionPreferences(internalName: string): Promise<boolean> {\n const { preferenceToken } = newsletterStore.state;\n\n // Either preference token is needed or the user must be authenticated\n if (!preferenceToken && !newsletterStore.state.isAuthenticated) {\n logger.error(\"Preference token or authentication is required to update subscription preferences\");\n return false;\n }\n\n // Check if the subscription exists\n if (!isSubscribed(internalName)) {\n logger.error(`Cannot update preferences: not subscribed to newsletter '${internalName}'`);\n return false;\n }\n\n const authInstance = await Auth.getInstance();\n const idToken = await authInstance.getToken();\n\n const preferenceIdentifiers = newsletterStore.state.checkedNewsletters[internalName] || [];\n\n const response = await getUnidyClient().newsletters.updateSubscription(\n internalName,\n { preference_identifiers: preferenceIdentifiers },\n {\n preferenceToken,\n idToken: typeof idToken === \"string\" ? idToken : \"\",\n },\n );\n\n if (response.status === 401) {\n Flash.error.addMessage(t(\"newsletter.errors.unauthorized\"));\n newsletterLogout();\n return false;\n }\n\n if (response.success && response.data) {\n // Update the local subscription with the new preferences\n const subscriptionIndex = newsletterStore.state.existingSubscriptions.findIndex((sub) => sub.newsletter_internal_name === internalName);\n\n if (subscriptionIndex !== -1) {\n const updatedSubscriptions = [...newsletterStore.state.existingSubscriptions];\n updatedSubscriptions[subscriptionIndex] = {\n ...updatedSubscriptions[subscriptionIndex],\n preference_identifiers: response.data.preference_identifiers || [],\n };\n newsletterStore.state.existingSubscriptions = updatedSubscriptions;\n }\n\n Flash.success.addMessage(t(\"newsletter.success.preferences_updated\"));\n return true;\n }\n\n Flash.error.addMessage(t(\"errors.unknown\", { defaultValue: \"An unknown error occurred\" }));\n return false;\n}\n"],"names":[],"mappings":";;;;;;;AAaA,MAAM,MAAM,GAAG,YAAY,CAAC,mBAAmB,CAAC;AAEhD,MAAM,kBAAkB,GAAG,mBAAmB;SAE9B,gBAAgB,GAAA;AAC9B,IAAA,eAAe,CAAC,KAAK,CAAC,eAAe,GAAG,EAAE;AAC1C,IAAA,eAAe,CAAC,KAAK,CAAC,qBAAqB,GAAG,EAAE;AAChD,IAAA,cAAc,CAAC,UAAU,CAAC,GAAG,kBAAkB,CAAA,eAAA,CAAiB,CAAC;AACjE,IAAA,cAAc,CAAC,UAAU,CAAC,GAAG,kBAAkB,CAAA,KAAA,CAAO,CAAC;AACzD;AAEO,eAAe,SAAS,CAAC,YAAoB,EAAA;AAClD,IAAA,MAAM,EAAE,eAAe,EAAE,GAAG,eAAe,CAAC,KAAK;AAEjD,IAAA,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE;AAC7C,IAAA,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,QAAQ,EAAE;AAE7C,IAAA,MAAM,QAAQ,GAAG,MAAM,cAAc,EAAE,CAAC,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AAC,CAAC,gBAAgB,EAAE,EAAE,YAAY,EAAE,2BAA2B,EAAE,CAAC,CAAC;AAC1F,IAAA,OAAO,KAAK;AACd;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as t,h as e}from"./p-COQ27Nb6.js";import{t as i}from"./p-BR6L248H.js";import{A as s}from"./p-jyF1XwDG.js";import{s as n,a as o}from"./p-Cai8JwlG.js";import"./p-Jrp0G45B.js";import"./p-P0eZf5rH.js";import"./p-MA26cw6g.js";import"./p-DAn4FkxC.js";import"./p-BGq0leDV.js";import"./p-CpJghKnM.js";const a=class{constructor(e){t(this,e)}disabled=false;componentClassName="";countdown=0;countdownInterval=null;handleClick=async()=>{if(this.disabled||n.loading||this.countdown>0)return;const t=await s.getInstance();const[e,i]=await t.helpers.sendMagicCode();if(i&&"enable_resend_after"in i){this.startCountdown(i.enable_resend_after)}};startCountdown=t=>{this.countdown=Math.ceil(t/1e3);this.countdownInterval=window.setInterval((()=>{this.countdown--;if(this.countdown<=0){this.clearCountdown();o.clearFieldError("magicCode")}}),1e3)};clearCountdown=()=>{if(this.countdownInterval){clearInterval(this.countdownInterval);this.countdownInterval=null}this.countdown=0};disconnectedCallback(){this.clearCountdown()}render(){if(!n.availableLoginOptions?.magic_link&&n.step!=="single-login"){return null}if(n.step!=="magic-code"&&n.step!=="verification"&&n.step!=="single-login"){return null}const t=this.disabled||n.magicCodeStep==="requested"||this.countdown>0||n.email==="";const s=n.step!=="magic-code"?"auth.magicCode.button_text":"auth.magicCode.resend.button_text";const o=i(s,{defaultValue:"Send Magic Code"});const a=i("auth.magicCode.already_sent_text",{defaultValue:"Magic code already sent to your email"});const r=i("auth.magicCode.sending_text",{defaultValue:"Sending..."});return e("button",{type:"button",disabled:t,onClick:this.handleClick,class:this.componentClassName,"aria-live":"polite"},this.countdown>0?a:n.loading&&n.magicCodeStep==="requested"?r:o)}};export{a as u_send_magic_code_button};
|
|
2
|
+
//# sourceMappingURL=p-a341c7f6.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["registerInstance","h","t","Auth","state","authStore","SendMagicCodeButton","constructor","hostRef","this","disabled","componentClassName","countdown","countdownInterval","handleClick","async","loading","authInstance","getInstance","_error","response","helpers","sendMagicCode","startCountdown","enable_resend_after","enableResendAfter","Math","ceil","window","setInterval","clearCountdown","clearFieldError","clearInterval","disconnectedCallback","render","availableLoginOptions","magic_link","step","isDisabled","magicCodeStep","email","buttonTextKey","text","defaultValue","alreadySentText","sendingText","type","onClick","class"],"sources":["0"],"mappings":"YAAcA,OAAkBC,MAAS,8BAChCC,MAAS,8BACJC,MAAY,8BACZC,OAAYC,MAAiB,wBACpC,wBACA,wBACA,wBACA,wBACA,wBACA,kBAEP,MAAMC,EAAsB,MACxB,WAAAC,CAAYC,GACRR,EAAiBS,KAAMD,EAC3B,CACAE,SAAW,MACXC,mBAAqB,GACrBC,UAAY,EACZC,kBAAoB,KACpBC,YAAcC,UACV,GAAIN,KAAKC,UAAYN,EAAMY,SAAWP,KAAKG,UAAY,EACnD,OACJ,MAAMK,QAAqBd,EAAKe,cAChC,MAAOC,EAAQC,SAAkBH,EAAaI,QAAQC,gBACtD,GAAIF,GAAY,wBAAyBA,EAAU,CAC/CX,KAAKc,eAAeH,EAASI,oBACjC,GAEJD,eAAkBE,IACdhB,KAAKG,UAAYc,KAAKC,KAAKF,EAAoB,KAC/ChB,KAAKI,kBAAoBe,OAAOC,aAAY,KACxCpB,KAAKG,YACL,GAAIH,KAAKG,WAAa,EAAG,CACrBH,KAAKqB,iBACLzB,EAAU0B,gBAAgB,YAC9B,IACD,IAAK,EAEZD,eAAiB,KACb,GAAIrB,KAAKI,kBAAmB,CACxBmB,cAAcvB,KAAKI,mBACnBJ,KAAKI,kBAAoB,IAC7B,CACAJ,KAAKG,UAAY,CAAC,EAEtB,oBAAAqB,GACIxB,KAAKqB,gBACT,CACA,MAAAI,GACI,IAAK9B,EAAM+B,uBAAuBC,YAAchC,EAAMiC,OAAS,eAAgB,CAC3E,OAAO,IACX,CACA,GAAIjC,EAAMiC,OAAS,cAAgBjC,EAAMiC,OAAS,gBAAkBjC,EAAMiC,OAAS,eAAgB,CAC/F,OAAO,IACX,CACA,MAAMC,EAAa7B,KAAKC,UAAYN,EAAMmC,gBAAkB,aAAe9B,KAAKG,UAAY,GAAKR,EAAMoC,QAAU,GACjH,MAAMC,EAAgBrC,EAAMiC,OAAS,aAAe,6BAA+B,oCACnF,MAAMK,EAAOxC,EAAEuC,EAAe,CAAEE,aAAc,oBAC9C,MAAMC,EAAkB1C,EAAE,mCAAoC,CAAEyC,aAAc,0CAC9E,MAAME,EAAc3C,EAAE,8BAA+B,CAAEyC,aAAc,eACrE,OAAQ1C,EAAE,SAAU,CAAE6C,KAAM,SAAUpC,SAAU4B,EAAYS,QAAStC,KAAKK,YAAakC,MAAOvC,KAAKE,mBAAoB,YAAa,UAAYF,KAAKG,UAAY,EAAIgC,EAAkBxC,EAAMY,SAAWZ,EAAMmC,gBAAkB,YAAcM,EAAcH,EAChQ,UAGKpC","ignoreList":[]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r,g as e,h as t,e as s}from"./p-COQ27Nb6.js";import{s as n}from"./p-Cai8JwlG.js";import{t as o}from"./p-BR6L248H.js";import{n as i}from"./p-CSLU6kes.js";import{h as u}from"./p-BGq0leDV.js";import{u as l}from"./p-Jrp0G45B.js";import"./p-P0eZf5rH.js";const a=class{constructor(e){r(this,e)}componentClassName="";for;errorMessages;get el(){return e(this)}detectContext(){if(this.el.closest("u-signin-root")||this.el.closest("u-signin-step"))return"auth";if(this.el.closest("u-profile"))return"profile";if(this.el.closest("u-newsletter-root"))return"newsletter";if(this.for==="general"||this.for==="connection")return"other";throw new Error("No context found for error message. Make sure you are using the component within a u-signin-root, u-profile, or u-newsletter-root.")}get context(){return this.detectContext()}getAuthErrorMessage(r){if(this.errorMessages?.[r]){return this.errorMessages[r]}const e=o(`errors.${r}`);if(e!==`errors.${r}`){return e}return r||o("errors.unknown",{defaultValue:"An error occurred"})}getNewsletterErrorMessage(r){return o(`newsletter.errors.${r}`)||o("errors.unknown",{defaultValue:"An unknown error occurred"})}getErrorMessage(r){if(this.context==="auth"){return this.getAuthErrorMessage(r)}return this.getNewsletterErrorMessage(r)}getAuthErrorCode(){const r=this.for;if(r==="connection"){return l.backendConnected?null:"connection_failed"}if(r==="general"){return n.globalErrors.auth}return n.errors[r]}getNewsletterErrorCode(){const r=i.state.errors[this.for];return r??null}render(){const r=this.context==="newsletter"?this.getNewsletterErrorCode():this.getAuthErrorCode();if(!r){return null}if(r==="connection_failed"&&this.for!=="general"&&this.for!=="connection"){return null}const e=this.getErrorMessage(r);const n=e?.includes("\n")?t("div",{style:{whiteSpace:"pre-line"}},e):e;return t(s,{class:this.componentClassName},u(this.el)?t("slot",null):n)}};export{a as u_error_message};
|
|
2
|
+
//# sourceMappingURL=p-a38cd448.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["registerInstance","getElement","h","Host","state","t","newsletterStore","hasSlotContent","unidyState","ErrorMessage","constructor","hostRef","this","componentClassName","for","errorMessages","el","detectContext","closest","Error","context","getAuthErrorMessage","errorCode","translatedError","defaultValue","getNewsletterErrorMessage","errorIdentifier","getErrorMessage","getAuthErrorCode","forValue","backendConnected","globalErrors","auth","errors","getNewsletterErrorCode","error","render","errorMessage","formattedMessage","includes","style","whiteSpace","class"],"sources":["0"],"mappings":"OAAcA,OAAuBC,OAAYC,OAAQC,MAAY,
|
|
1
|
+
{"version":3,"names":["registerInstance","getElement","h","Host","state","t","newsletterStore","hasSlotContent","unidyState","ErrorMessage","constructor","hostRef","this","componentClassName","for","errorMessages","el","detectContext","closest","Error","context","getAuthErrorMessage","errorCode","translatedError","defaultValue","getNewsletterErrorMessage","errorIdentifier","getErrorMessage","getAuthErrorCode","forValue","backendConnected","globalErrors","auth","errors","getNewsletterErrorCode","error","render","errorMessage","formattedMessage","includes","style","whiteSpace","class"],"sources":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