@unidy.io/sdk 1.1.3 → 1.1.5
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-DSKjcXX_.js +10 -0
- package/dist/cjs/app-globals-DSKjcXX_.js.map +1 -0
- package/dist/cjs/auth-B83pzi0f.js +582 -0
- package/dist/cjs/auth-B83pzi0f.js.map +1 -0
- package/dist/cjs/auth-store-DPHWWmXf.js +183 -0
- package/dist/cjs/auth-store-DPHWWmXf.js.map +1 -0
- package/dist/cjs/component-utils-BpMyeVQo.js +35 -0
- package/dist/cjs/component-utils-BpMyeVQo.js.map +1 -0
- package/dist/{sdk/flash-store-DXuduRA_.js → cjs/flash-store-BuIBuQDx.js} +8 -6
- package/dist/cjs/flash-store-BuIBuQDx.js.map +1 -0
- package/dist/cjs/helpers-BcPlKlBG.js +11 -0
- package/dist/cjs/helpers-BcPlKlBG.js.map +1 -0
- package/dist/cjs/helpers-DJyRa0Qo.js +11 -0
- package/dist/cjs/helpers-DJyRa0Qo.js.map +1 -0
- package/dist/{sdk/i18n-CacW7WuC.js → cjs/i18n-BoDZ8kd2.js} +18 -24
- package/dist/cjs/i18n-BoDZ8kd2.js.map +1 -0
- package/dist/cjs/index-B_N5xKgH.js +12025 -0
- package/dist/cjs/index-B_N5xKgH.js.map +1 -0
- package/dist/{sdk/index-O6h7SI7-.js → cjs/index-DLz3FT7T.js} +10 -8
- package/dist/cjs/index-DLz3FT7T.js.map +1 -0
- package/dist/cjs/index-R2MKLaem.js +5267 -0
- package/dist/cjs/index-R2MKLaem.js.map +1 -0
- package/dist/cjs/index.cjs.js +64 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +14 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/{sdk/newsletter-helpers-CLSTOCvO.js → cjs/newsletter-helpers-D-V_8kiN.js} +83 -70
- package/dist/cjs/newsletter-helpers-D-V_8kiN.js.map +1 -0
- package/dist/cjs/newsletter-store-BzytX7Qh.js +38 -0
- package/dist/cjs/newsletter-store-BzytX7Qh.js.map +1 -0
- package/dist/cjs/pagination-store-BEiW3MQd.js +16 -0
- package/dist/cjs/pagination-store-BEiW3MQd.js.map +1 -0
- package/dist/{sdk/profile-helpers-mfEp18Tq.js → cjs/profile-helpers-B2h2III_.js} +10 -7
- package/dist/cjs/profile-helpers-B2h2III_.js.map +1 -0
- package/dist/cjs/profile-store-P_BcYkef.js +22 -0
- package/dist/cjs/profile-store-P_BcYkef.js.map +1 -0
- package/dist/cjs/sdk.cjs.js +26 -0
- package/dist/cjs/sdk.cjs.js.map +1 -0
- package/dist/cjs/u-conditional-render.cjs.entry.js +103 -0
- package/dist/cjs/u-conditional-render.entry.cjs.js.map +1 -0
- package/dist/cjs/u-config.cjs.entry.js +87 -0
- package/dist/cjs/u-config.entry.cjs.js.map +1 -0
- package/dist/cjs/u-email-field.cjs.entry.js +77 -0
- package/dist/cjs/u-email-field.entry.cjs.js.map +1 -0
- package/dist/cjs/u-error-message.cjs.entry.js +82 -0
- package/dist/cjs/u-error-message.entry.cjs.js.map +1 -0
- package/dist/cjs/u-field.u-raw-field.entry.cjs.js.map +1 -0
- package/dist/cjs/u-field_2.cjs.entry.js +375 -0
- package/dist/cjs/u-flash-message.cjs.entry.js +37 -0
- package/dist/cjs/u-flash-message.entry.cjs.js.map +1 -0
- package/dist/cjs/u-full-profile.cjs.entry.js +37 -0
- package/dist/cjs/u-full-profile.entry.cjs.js.map +1 -0
- package/dist/cjs/u-logout-button.cjs.entry.js +38 -0
- package/dist/cjs/u-logout-button.entry.cjs.js.map +1 -0
- package/dist/cjs/u-magic-code-field.cjs.entry.js +91 -0
- package/dist/cjs/u-magic-code-field.entry.cjs.js.map +1 -0
- package/dist/cjs/u-missing-field.cjs.entry.js +22 -0
- package/dist/cjs/u-missing-field.entry.cjs.js.map +1 -0
- package/dist/cjs/u-missing-fields-submit-button.cjs.entry.js +46 -0
- package/dist/cjs/u-missing-fields-submit-button.entry.cjs.js.map +1 -0
- package/dist/cjs/u-newsletter-checkbox.cjs.entry.js +63 -0
- package/dist/cjs/u-newsletter-checkbox.entry.cjs.js.map +1 -0
- package/dist/cjs/u-newsletter-logout-button.cjs.entry.js +36 -0
- package/dist/cjs/u-newsletter-logout-button.entry.cjs.js.map +1 -0
- package/dist/cjs/u-newsletter-preference-checkbox.cjs.entry.js +106 -0
- package/dist/cjs/u-newsletter-preference-checkbox.entry.cjs.js.map +1 -0
- package/dist/cjs/u-newsletter-resend-doi-button.cjs.entry.js +49 -0
- package/dist/cjs/u-newsletter-resend-doi-button.entry.cjs.js.map +1 -0
- package/dist/cjs/u-newsletter-root.cjs.entry.js +72 -0
- package/dist/cjs/u-newsletter-root.entry.cjs.js.map +1 -0
- package/dist/cjs/u-newsletter-toggle-subscription-button.cjs.entry.js +73 -0
- package/dist/cjs/u-newsletter-toggle-subscription-button.entry.cjs.js.map +1 -0
- package/dist/cjs/u-pagination-button.cjs.entry.js +63 -0
- package/dist/cjs/u-pagination-button.entry.cjs.js.map +1 -0
- package/dist/cjs/u-pagination-page.cjs.entry.js +44 -0
- package/dist/cjs/u-pagination-page.entry.cjs.js.map +1 -0
- package/dist/cjs/u-passkey.cjs.entry.js +47 -0
- package/dist/cjs/u-passkey.entry.cjs.js.map +1 -0
- package/dist/cjs/u-password-field.cjs.entry.js +104 -0
- package/dist/cjs/u-password-field.entry.cjs.js.map +1 -0
- package/dist/cjs/u-profile.u-submit-button.entry.cjs.js.map +1 -0
- package/dist/cjs/u-profile_2.cjs.entry.js +327 -0
- package/dist/cjs/u-registration-button.cjs.entry.js +48 -0
- package/dist/cjs/u-registration-button.entry.cjs.js.map +1 -0
- package/dist/cjs/u-reset-password-button.cjs.entry.js +47 -0
- package/dist/cjs/u-reset-password-button.entry.cjs.js.map +1 -0
- package/dist/cjs/u-send-magic-code-button.cjs.entry.js +68 -0
- package/dist/cjs/u-send-magic-code-button.entry.cjs.js.map +1 -0
- package/dist/cjs/u-signed-in.cjs.entry.js +25 -0
- package/dist/cjs/u-signed-in.entry.cjs.js.map +1 -0
- package/dist/cjs/u-signin-root.cjs.entry.js +43 -0
- package/dist/cjs/u-signin-root.entry.cjs.js.map +1 -0
- package/dist/cjs/u-signin-step.cjs.entry.js +66 -0
- package/dist/cjs/u-signin-step.entry.cjs.js.map +1 -0
- package/dist/cjs/u-signin-strategy.cjs.entry.js +30 -0
- package/dist/cjs/u-signin-strategy.entry.cjs.js.map +1 -0
- package/dist/cjs/u-social-login-button.cjs.entry.js +100 -0
- package/dist/cjs/u-social-login-button.entry.cjs.js.map +1 -0
- package/dist/cjs/u-spinner.cjs.entry.js +18 -0
- package/dist/cjs/u-spinner.entry.cjs.js.map +1 -0
- package/dist/cjs/u-ticketable-list.cjs.entry.js +6087 -0
- package/dist/cjs/u-ticketable-list.entry.cjs.js.map +1 -0
- package/dist/{sdk/unidy-store-DPcuwuXf.js → cjs/unidy-store-7AbWnZ6g.js} +9 -6
- package/dist/cjs/unidy-store-7AbWnZ6g.js.map +1 -0
- package/dist/collection/api/client.js +144 -0
- package/dist/collection/api/client.js.map +1 -0
- package/dist/collection/api/index.js +42 -0
- package/dist/collection/api/index.js.map +1 -0
- package/dist/collection/api/shared.js +18 -0
- package/dist/collection/api/shared.js.map +1 -0
- package/dist/collection/auth/api/auth.js +264 -0
- package/dist/collection/auth/api/auth.js.map +1 -0
- package/dist/collection/auth/auth-helpers.js +297 -0
- package/dist/collection/auth/auth-helpers.js.map +1 -0
- package/dist/collection/auth/auth.js +124 -0
- package/dist/collection/auth/auth.js.map +1 -0
- package/dist/collection/auth/components/helpers.js +5 -0
- package/dist/collection/auth/components/helpers.js.map +1 -0
- package/dist/collection/auth/components/logout-button/logout-button.js +85 -0
- package/dist/collection/auth/components/logout-button/logout-button.js.map +1 -0
- package/dist/collection/auth/components/magic-code-field/magic-code-field.css +1 -0
- package/dist/collection/auth/components/magic-code-field/magic-code-field.js +113 -0
- package/dist/collection/auth/components/magic-code-field/magic-code-field.js.map +1 -0
- package/dist/collection/auth/components/missing-field/missing-field.js +14 -0
- package/dist/collection/auth/components/missing-field/missing-field.js.map +1 -0
- package/dist/collection/auth/components/missing-fields-submit-button/missing-fields-submit-button.js +39 -0
- package/dist/collection/auth/components/missing-fields-submit-button/missing-fields-submit-button.js.map +1 -0
- package/dist/collection/auth/components/passkey/passkey.js +103 -0
- package/dist/collection/auth/components/passkey/passkey.js.map +1 -0
- package/dist/collection/auth/components/password-field/password-field.js +166 -0
- package/dist/collection/auth/components/password-field/password-field.js.map +1 -0
- package/dist/collection/auth/components/registration/registration-button.js +104 -0
- package/dist/collection/auth/components/registration/registration-button.js.map +1 -0
- package/dist/collection/auth/components/reset-pass-button/reset-pass-button.js +59 -0
- package/dist/collection/auth/components/reset-pass-button/reset-pass-button.js.map +1 -0
- package/dist/collection/auth/components/send-magic-code-button/send-magic-code-button.js +104 -0
- package/dist/collection/auth/components/send-magic-code-button/send-magic-code-button.js.map +1 -0
- package/dist/collection/auth/components/signed-in/signed-in.js +59 -0
- package/dist/collection/auth/components/signed-in/signed-in.js.map +1 -0
- package/dist/collection/auth/components/signin-root/signin-root.js +97 -0
- package/dist/collection/auth/components/signin-root/signin-root.js.map +1 -0
- package/dist/collection/auth/components/signin-step/signin-step.js +135 -0
- package/dist/collection/auth/components/signin-step/signin-step.js.map +1 -0
- package/dist/collection/auth/components/signin-strategy/signin-strategy.js +64 -0
- package/dist/collection/auth/components/signin-strategy/signin-strategy.js.map +1 -0
- package/dist/collection/auth/components/social-logins/logos/apple.js +3 -0
- package/dist/collection/auth/components/social-logins/logos/apple.js.map +1 -0
- package/dist/collection/auth/components/social-logins/logos/discord.js +3 -0
- package/dist/collection/auth/components/social-logins/logos/discord.js.map +1 -0
- package/dist/collection/auth/components/social-logins/logos/facebook.js +3 -0
- package/dist/collection/auth/components/social-logins/logos/facebook.js.map +1 -0
- package/dist/collection/auth/components/social-logins/logos/google.js +3 -0
- package/dist/collection/auth/components/social-logins/logos/google.js.map +1 -0
- package/dist/collection/auth/components/social-logins/logos/linkedin.js +3 -0
- package/dist/collection/auth/components/social-logins/logos/linkedin.js.map +1 -0
- package/dist/collection/auth/components/social-logins/social-login-button.css +1 -0
- package/dist/collection/auth/components/social-logins/social-login-button.js +188 -0
- package/dist/collection/auth/components/social-logins/social-login-button.js.map +1 -0
- package/dist/collection/auth/components/submit-button/auth-submit-button.js +62 -0
- package/dist/collection/auth/components/submit-button/auth-submit-button.js.map +1 -0
- package/dist/{sdk/index-CYip1Wgu.js → collection/auth/error-definitions.js} +2 -19
- package/dist/collection/auth/error-definitions.js.map +1 -0
- package/dist/collection/auth/index.js +14 -0
- package/dist/collection/auth/index.js.map +1 -0
- package/dist/collection/auth/passkey-auth.js +106 -0
- package/dist/collection/auth/passkey-auth.js.map +1 -0
- package/dist/{sdk/auth-store-Mjo3PyJP.js → collection/auth/store/auth-store.js} +7 -12
- package/dist/collection/auth/store/auth-store.js.map +1 -0
- package/dist/collection/collection-manifest.json +46 -0
- package/dist/collection/globalScript.js +18 -0
- package/dist/collection/globalScript.js.map +1 -0
- package/dist/collection/i18n.js +31 -0
- package/dist/collection/i18n.js.map +1 -0
- package/dist/collection/index.js +16 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/locales/de.json +133 -0
- package/dist/collection/locales/en.json +133 -0
- package/dist/collection/locales/fr.json +133 -0
- package/dist/collection/locales/it.json +133 -0
- package/dist/collection/locales/nl_be.json +133 -0
- package/dist/collection/locales/ro.json +133 -0
- package/dist/collection/logger.js +106 -0
- package/dist/collection/logger.js.map +1 -0
- package/dist/collection/newsletter/api/newsletters.js +189 -0
- package/dist/collection/newsletter/api/newsletters.js.map +1 -0
- package/dist/collection/newsletter/components/helpers.js +5 -0
- package/dist/collection/newsletter/components/helpers.js.map +1 -0
- package/dist/collection/newsletter/components/logout-button/logout-button.js +48 -0
- package/dist/collection/newsletter/components/logout-button/logout-button.js.map +1 -0
- package/dist/collection/newsletter/components/newsletter-checkbox/newsletter-checkbox.js +109 -0
- package/dist/collection/newsletter/components/newsletter-checkbox/newsletter-checkbox.js.map +1 -0
- package/dist/collection/newsletter/components/newsletter-root/newsletter-root.js +119 -0
- package/dist/collection/newsletter/components/newsletter-root/newsletter-root.js.map +1 -0
- package/dist/collection/newsletter/components/preference-checkbox/preference-checkbox.js +178 -0
- package/dist/collection/newsletter/components/preference-checkbox/preference-checkbox.js.map +1 -0
- package/dist/collection/newsletter/components/resend-doi-button/resend-doi-button.css +1 -0
- package/dist/collection/newsletter/components/resend-doi-button/resend-doi-button.js +89 -0
- package/dist/collection/newsletter/components/resend-doi-button/resend-doi-button.js.map +1 -0
- package/dist/collection/newsletter/components/submit-button/newsletter-submit-button.js +18 -0
- package/dist/collection/newsletter/components/submit-button/newsletter-submit-button.js.map +1 -0
- package/dist/collection/newsletter/components/toggle-subscription-button/toggle-subscription-button.css +1 -0
- package/dist/collection/newsletter/components/toggle-subscription-button/toggle-subscription-button.js +154 -0
- package/dist/collection/newsletter/components/toggle-subscription-button/toggle-subscription-button.js.map +1 -0
- package/dist/collection/newsletter/index.js +11 -0
- package/dist/collection/newsletter/index.js.map +1 -0
- package/dist/{sdk/newsletter-helpers-C3t2fsCe.js → collection/newsletter/newsletter-helpers.js} +25 -24
- package/dist/collection/newsletter/newsletter-helpers.js.map +1 -0
- package/dist/{sdk/newsletter-store-CvULKmsu.js → collection/newsletter/store/newsletter-store.js} +6 -11
- package/dist/collection/newsletter/store/newsletter-store.js.map +1 -0
- package/dist/collection/profile/api/profile.js +168 -0
- package/dist/collection/profile/api/profile.js.map +1 -0
- package/dist/collection/profile/components/field/field.css +1 -0
- package/dist/collection/profile/components/field/field.js +359 -0
- package/dist/collection/profile/components/field/field.js.map +1 -0
- package/dist/collection/profile/components/full-profile/full-profile.css +1 -0
- package/dist/collection/profile/components/full-profile/full-profile.js +78 -0
- package/dist/collection/profile/components/full-profile/full-profile.js.map +1 -0
- package/dist/collection/profile/components/profile/profile.js +250 -0
- package/dist/collection/profile/components/profile/profile.js.map +1 -0
- package/dist/collection/profile/components/raw-field/raw-field.js +697 -0
- package/dist/collection/profile/components/raw-field/raw-field.js.map +1 -0
- package/dist/collection/profile/components/raw-input-fields/Input.js +3 -0
- package/dist/collection/profile/components/raw-input-fields/Input.js.map +1 -0
- package/dist/collection/profile/components/raw-input-fields/MultiSelect.js +8 -0
- package/dist/collection/profile/components/raw-input-fields/MultiSelect.js.map +1 -0
- package/dist/collection/profile/components/raw-input-fields/RadioGroup.js +8 -0
- package/dist/collection/profile/components/raw-input-fields/RadioGroup.js.map +1 -0
- package/dist/collection/profile/components/raw-input-fields/Select.js +11 -0
- package/dist/collection/profile/components/raw-input-fields/Select.js.map +1 -0
- package/dist/collection/profile/components/raw-input-fields/Textarea.js +3 -0
- package/dist/collection/profile/components/raw-input-fields/Textarea.js.map +1 -0
- package/dist/collection/profile/components/submit-button/profile-submit-button.js +17 -0
- package/dist/collection/profile/components/submit-button/profile-submit-button.js.map +1 -0
- package/dist/collection/profile/index.js +13 -0
- package/dist/collection/profile/index.js.map +1 -0
- package/dist/collection/profile/profile-helpers.js +31 -0
- package/dist/collection/profile/profile-helpers.js.map +1 -0
- package/dist/collection/profile/store/profile-store.js +15 -0
- package/dist/collection/profile/store/profile-store.js.map +1 -0
- package/dist/collection/sdk.css +39 -0
- package/dist/collection/shared/component-utils.js +28 -0
- package/dist/collection/shared/component-utils.js.map +1 -0
- package/dist/collection/shared/components/conditional-render/conditional-render.js +178 -0
- package/dist/collection/shared/components/conditional-render/conditional-render.js.map +1 -0
- package/dist/collection/shared/components/config/config.js +260 -0
- package/dist/collection/shared/components/config/config.js.map +1 -0
- package/dist/collection/shared/components/email-field/email-field.css +1 -0
- package/dist/collection/shared/components/email-field/email-field.js +145 -0
- package/dist/collection/shared/components/email-field/email-field.js.map +1 -0
- package/dist/collection/shared/components/error-message/error-message.js +141 -0
- package/dist/collection/shared/components/error-message/error-message.js.map +1 -0
- package/dist/collection/shared/components/flash-message/close-icon.js +3 -0
- package/dist/collection/shared/components/flash-message/close-icon.js.map +1 -0
- package/dist/collection/shared/components/flash-message/flash-message.css +1 -0
- package/dist/collection/shared/components/flash-message/flash-message.js +79 -0
- package/dist/collection/shared/components/flash-message/flash-message.js.map +1 -0
- package/dist/collection/shared/components/spinner/spinner.css +1 -0
- package/dist/collection/shared/components/spinner/spinner.js +19 -0
- package/dist/collection/shared/components/spinner/spinner.js.map +1 -0
- package/dist/collection/shared/components/submit-button/context.js +10 -0
- package/dist/collection/shared/components/submit-button/context.js.map +1 -0
- package/dist/collection/shared/components/submit-button/submit-button.css +1 -0
- package/dist/collection/shared/components/submit-button/submit-button.js +196 -0
- package/dist/collection/shared/components/submit-button/submit-button.js.map +1 -0
- package/dist/collection/shared/store/flash-store.js +43 -0
- package/dist/collection/shared/store/flash-store.js.map +1 -0
- package/dist/collection/shared/store/unidy-store.js +33 -0
- package/dist/collection/shared/store/unidy-store.js.map +1 -0
- package/dist/collection/ticketable/api/get-with-schema.js +35 -0
- package/dist/collection/ticketable/api/get-with-schema.js.map +1 -0
- package/dist/collection/ticketable/api/schemas.js +12 -0
- package/dist/collection/ticketable/api/schemas.js.map +1 -0
- package/dist/collection/ticketable/api/subscriptions.js +47 -0
- package/dist/collection/ticketable/api/subscriptions.js.map +1 -0
- package/dist/collection/ticketable/api/tickets.js +48 -0
- package/dist/collection/ticketable/api/tickets.js.map +1 -0
- package/dist/collection/ticketable/components/pagination/pagination-button.js +108 -0
- package/dist/collection/ticketable/components/pagination/pagination-button.js.map +1 -0
- package/dist/collection/ticketable/components/pagination/pagination-page.js +69 -0
- package/dist/collection/ticketable/components/pagination/pagination-page.js.map +1 -0
- package/dist/collection/ticketable/components/ticketable-list/skeleton-helpers.js +54 -0
- package/dist/collection/ticketable/components/ticketable-list/skeleton-helpers.js.map +1 -0
- package/dist/collection/ticketable/components/ticketable-list/ticketable-list.js +498 -0
- package/dist/collection/ticketable/components/ticketable-list/ticketable-list.js.map +1 -0
- package/dist/collection/ticketable/index.js +13 -0
- package/dist/collection/ticketable/index.js.map +1 -0
- package/dist/collection/ticketable/store/pagination-store.js +9 -0
- package/dist/collection/ticketable/store/pagination-store.js.map +1 -0
- package/dist/{sdk/auth-store-BzXDlgNb.js → components/auth-store.js} +5 -6
- package/dist/components/auth-store.js.map +1 -0
- package/dist/{sdk/auth-Che07PeV.js → components/auth.js} +134 -124
- package/dist/components/auth.js.map +1 -0
- package/dist/components/component-utils.js +32 -0
- package/dist/components/component-utils.js.map +1 -0
- package/dist/components/exports.js +4106 -0
- package/dist/components/exports.js.map +1 -0
- package/dist/{sdk/u-field.entry.js → components/field.js} +57 -14
- package/dist/components/field.js.map +1 -0
- package/dist/{sdk/flash-store-Cgu7WoSN.js → components/flash-store.js} +3 -4
- package/dist/components/flash-store.js.map +1 -0
- package/dist/components/helpers.js +9 -0
- package/dist/components/helpers.js.map +1 -0
- package/dist/components/helpers2.js +9 -0
- package/dist/components/helpers2.js.map +1 -0
- package/dist/{sdk/i18n-CRBOSzNq.js → components/i18n.js} +11 -19
- package/dist/components/i18n.js.map +1 -0
- package/dist/components/index.js +5902 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index2.js +5256 -0
- package/dist/components/index2.js.map +1 -0
- package/dist/{sdk/index-XIuHpSzj.js → components/index3.js} +3 -3
- package/dist/components/index3.js.map +1 -0
- package/dist/components/logger.js +111 -0
- package/dist/components/logger.js.map +1 -0
- package/dist/{sdk/newsletter-helpers-CnufIbIZ.js → components/newsletter-helpers.js} +14 -12
- package/dist/components/newsletter-helpers.js.map +1 -0
- package/dist/{sdk/newsletter-store-CPY2gFnU.js → components/newsletter-store.js} +3 -8
- package/dist/components/newsletter-store.js.map +1 -0
- package/dist/components/pagination-store.js +14 -0
- package/dist/components/pagination-store.js.map +1 -0
- package/dist/{sdk/profile-helpers-Bdz6gmG8.js → components/profile-helpers.js} +4 -4
- package/dist/components/profile-helpers.js.map +1 -0
- package/dist/{sdk/profile-store-Dr1DP9Te.js → components/profile-store.js} +3 -3
- package/dist/components/profile-store.js.map +1 -0
- package/dist/{sdk/u-profile.entry.js → components/profile.js} +51 -18
- package/dist/components/profile.js.map +1 -0
- package/dist/{sdk/u-raw-field.entry.js → components/raw-field.js} +51 -10
- package/dist/components/raw-field.js.map +1 -0
- package/dist/components/spinner.js +35 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/submit-button.js +231 -0
- package/dist/components/submit-button.js.map +1 -0
- package/dist/components/u-conditional-render.js +121 -0
- package/dist/components/u-conditional-render.js.map +1 -0
- package/dist/components/u-config.js +113 -0
- package/dist/components/u-config.js.map +1 -0
- package/dist/components/u-email-field.js +99 -0
- package/dist/components/u-email-field.js.map +1 -0
- package/dist/components/u-error-message.js +105 -0
- package/dist/components/u-error-message.js.map +1 -0
- package/dist/components/u-field.js +9 -0
- package/dist/components/u-field.js.map +1 -0
- package/dist/components/u-flash-message.js +58 -0
- package/dist/components/u-flash-message.js.map +1 -0
- package/dist/components/u-full-profile.js +87 -0
- package/dist/components/u-full-profile.js.map +1 -0
- package/dist/components/u-logout-button.js +53 -0
- package/dist/components/u-logout-button.js.map +1 -0
- package/dist/components/u-magic-code-field.js +106 -0
- package/dist/components/u-magic-code-field.js.map +1 -0
- package/dist/components/u-missing-field.js +57 -0
- package/dist/components/u-missing-field.js.map +1 -0
- package/dist/components/u-missing-fields-submit-button.js +70 -0
- package/dist/components/u-missing-fields-submit-button.js.map +1 -0
- package/dist/components/u-newsletter-checkbox.js +77 -0
- package/dist/components/u-newsletter-checkbox.js.map +1 -0
- package/dist/components/u-newsletter-logout-button.js +51 -0
- package/dist/components/u-newsletter-logout-button.js.map +1 -0
- package/dist/components/u-newsletter-preference-checkbox.js +124 -0
- package/dist/components/u-newsletter-preference-checkbox.js.map +1 -0
- package/dist/components/u-newsletter-resend-doi-button.js +70 -0
- package/dist/components/u-newsletter-resend-doi-button.js.map +1 -0
- package/dist/components/u-newsletter-root.js +90 -0
- package/dist/components/u-newsletter-root.js.map +1 -0
- package/dist/components/u-newsletter-toggle-subscription-button.js +97 -0
- package/dist/components/u-newsletter-toggle-subscription-button.js.map +1 -0
- package/dist/components/u-pagination-button.js +86 -0
- package/dist/components/u-pagination-button.js.map +1 -0
- package/dist/components/u-pagination-page.js +66 -0
- package/dist/components/u-pagination-page.js.map +1 -0
- package/dist/components/u-passkey.js +65 -0
- package/dist/components/u-passkey.js.map +1 -0
- package/dist/components/u-password-field.js +125 -0
- package/dist/components/u-password-field.js.map +1 -0
- package/dist/components/u-profile.js +9 -0
- package/dist/components/u-profile.js.map +1 -0
- package/dist/components/u-raw-field.js +9 -0
- package/dist/components/u-raw-field.js.map +1 -0
- package/dist/components/u-registration-button.js +70 -0
- package/dist/components/u-registration-button.js.map +1 -0
- package/dist/components/u-reset-password-button.js +63 -0
- package/dist/components/u-reset-password-button.js.map +1 -0
- package/dist/components/u-send-magic-code-button.js +85 -0
- package/dist/components/u-send-magic-code-button.js.map +1 -0
- package/dist/components/u-signed-in.js +44 -0
- package/dist/components/u-signed-in.js.map +1 -0
- package/dist/components/u-signin-root.js +63 -0
- package/dist/components/u-signin-root.js.map +1 -0
- package/dist/components/u-signin-step.js +84 -0
- package/dist/components/u-signin-step.js.map +1 -0
- package/dist/components/u-signin-strategy.js +50 -0
- package/dist/components/u-signin-strategy.js.map +1 -0
- package/dist/components/u-social-login-button.js +125 -0
- package/dist/components/u-social-login-button.js.map +1 -0
- package/dist/components/u-spinner.js +9 -0
- package/dist/components/u-spinner.js.map +1 -0
- package/dist/components/u-submit-button.js +9 -0
- package/dist/components/u-submit-button.js.map +1 -0
- package/dist/components/u-ticketable-list.js +6122 -0
- package/dist/components/u-ticketable-list.js.map +1 -0
- package/dist/{sdk/unidy-store-BwZym11Y.js → components/unidy-store.js} +3 -4
- package/dist/components/unidy-store.js.map +1 -0
- package/dist/esm/app-globals-CPU9ZcqZ.js +8 -0
- package/dist/esm/app-globals-CPU9ZcqZ.js.map +1 -0
- package/dist/{sdk/auth-B95hXtvh.js → esm/auth-B0RIcDM-.js} +132 -123
- package/dist/esm/auth-B0RIcDM-.js.map +1 -0
- package/dist/{sdk/auth-store-CapiC8gJ.js → esm/auth-store-BGMYm_jK.js} +5 -6
- package/dist/esm/auth-store-BGMYm_jK.js.map +1 -0
- package/dist/esm/component-utils-D1lzXl_Z.js.map +1 -0
- package/dist/{sdk/flash-store-DNcSEn2p.js → esm/flash-store-CEvWSG0c.js} +3 -4
- package/dist/{sdk/flash-store-DXuduRA_.js.map → esm/flash-store-CEvWSG0c.js.map} +1 -1
- package/dist/esm/helpers-BqFCd65h.js.map +1 -0
- package/dist/esm/helpers-DUHc_Cx7.js.map +1 -0
- package/dist/{sdk/i18n-BCI_ARJL.js → esm/i18n-CLdWzy5J.js} +10 -19
- package/dist/esm/i18n-CLdWzy5J.js.map +1 -0
- package/dist/{sdk/index-BnBstyfp.js → esm/index-Bjp1XO-f.js} +3 -3
- package/dist/{sdk/index-XIuHpSzj.js.map → esm/index-Bjp1XO-f.js.map} +1 -1
- package/dist/esm/index-Ci3aTmzp.js +12007 -0
- package/dist/esm/index-Ci3aTmzp.js.map +1 -0
- package/dist/esm/index-DSDkaHWI.js +5254 -0
- package/dist/esm/index-DSDkaHWI.js.map +1 -0
- package/dist/esm/index.js +40 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +12 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/{sdk/newsletter-helpers-DEXEBD0F.js → esm/newsletter-helpers-CONtbKYi.js} +14 -12
- package/dist/esm/newsletter-helpers-CONtbKYi.js.map +1 -0
- package/dist/{sdk/newsletter-store-CqD-GcDC.js → esm/newsletter-store-DBL1A203.js} +3 -8
- package/dist/{sdk/newsletter-store-CPY2gFnU.js.map → esm/newsletter-store-DBL1A203.js.map} +1 -1
- package/dist/esm/pagination-store-DzdJOp-n.js +14 -0
- package/dist/esm/pagination-store-DzdJOp-n.js.map +1 -0
- package/dist/{sdk/profile-helpers-Bs3aj0CO.js → esm/profile-helpers-CglNd6Nw.js} +4 -4
- package/dist/{sdk/profile-helpers-Bdz6gmG8.js.map → esm/profile-helpers-CglNd6Nw.js.map} +1 -1
- package/dist/{sdk/profile-store-BZKApsQm.js → esm/profile-store-RmZB2PTc.js} +3 -3
- package/dist/{sdk/profile-store-Dr1DP9Te.js.map → esm/profile-store-RmZB2PTc.js.map} +1 -1
- package/dist/esm/sdk.js +22 -0
- package/dist/esm/sdk.js.map +1 -0
- package/dist/{sdk → esm}/u-conditional-render.entry.js +12 -12
- package/dist/esm/u-conditional-render.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-config.entry.js +15 -16
- package/dist/esm/u-config.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-email-field.entry.js +7 -7
- package/dist/esm/u-email-field.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-error-message.entry.js +7 -7
- package/dist/esm/u-error-message.entry.js.map +1 -0
- package/dist/esm/u-field.u-raw-field.entry.js.map +1 -0
- package/dist/esm/u-field_2.entry.js +372 -0
- package/dist/{sdk → esm}/u-flash-message.entry.js +4 -4
- package/dist/esm/u-flash-message.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-full-profile.entry.js +7 -7
- package/dist/esm/u-full-profile.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-logout-button.entry.js +12 -12
- package/dist/esm/u-logout-button.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-magic-code-field.entry.js +10 -10
- package/dist/esm/u-magic-code-field.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-missing-field.entry.js +5 -5
- package/dist/esm/u-missing-field.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-missing-fields-submit-button.entry.js +9 -9
- package/dist/esm/u-missing-fields-submit-button.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-newsletter-checkbox.entry.js +13 -13
- package/dist/esm/u-newsletter-checkbox.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-newsletter-logout-button.entry.js +12 -12
- package/dist/esm/u-newsletter-logout-button.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-newsletter-preference-checkbox.entry.js +13 -13
- package/dist/esm/u-newsletter-preference-checkbox.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-newsletter-resend-doi-button.entry.js +12 -12
- package/dist/esm/u-newsletter-resend-doi-button.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-newsletter-root.entry.js +13 -13
- package/dist/esm/u-newsletter-root.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-newsletter-toggle-subscription-button.entry.js +13 -13
- package/dist/esm/u-newsletter-toggle-subscription-button.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-pagination-button.entry.js +2 -2
- package/dist/esm/u-pagination-button.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-pagination-page.entry.js +2 -2
- package/dist/esm/u-pagination-page.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-passkey.entry.js +10 -10
- package/dist/esm/u-passkey.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-password-field.entry.js +6 -6
- package/dist/esm/u-password-field.entry.js.map +1 -0
- package/dist/esm/u-profile.u-submit-button.entry.js.map +1 -0
- package/dist/esm/u-profile_2.entry.js +324 -0
- package/dist/{sdk → esm}/u-registration-button.entry.js +6 -6
- package/dist/esm/u-registration-button.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-reset-password-button.entry.js +10 -10
- package/dist/esm/u-reset-password-button.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-send-magic-code-button.entry.js +10 -10
- package/dist/esm/u-send-magic-code-button.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-signed-in.entry.js +5 -5
- package/dist/esm/u-signed-in.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-signin-root.entry.js +7 -7
- package/dist/esm/u-signin-root.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-signin-step.entry.js +10 -11
- package/dist/esm/u-signin-step.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-signin-strategy.entry.js +5 -5
- package/dist/esm/u-signin-strategy.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-social-login-button.entry.js +7 -7
- package/dist/esm/u-social-login-button.entry.js.map +1 -0
- package/dist/esm/u-spinner.entry.js +16 -0
- package/dist/esm/u-spinner.entry.js.map +1 -0
- package/dist/{sdk → esm}/u-ticketable-list.entry.js +84 -143
- package/dist/esm/u-ticketable-list.entry.js.map +1 -0
- package/dist/{sdk/unidy-store-CtifvCkV.js → esm/unidy-store-BldTAtO0.js} +3 -4
- package/dist/{sdk/unidy-store-DPcuwuXf.js.map → esm/unidy-store-BldTAtO0.js.map} +1 -1
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/sdk/auth-BopPjv7G.js.map +1 -0
- package/dist/sdk/auth-C0vldOq6.js.map +1 -0
- package/dist/sdk/auth-store-DQaam_Qh.js.map +1 -0
- package/dist/sdk/auth-store-sOmplc4z.js.map +1 -0
- package/dist/sdk/{i18n-CRBOSzNq.js.map → i18n-B6rRU-m3.js.map} +1 -1
- package/dist/sdk/{i18n-BCI_ARJL.js.map → i18n-CZii1E-s.js.map} +1 -1
- package/dist/sdk/{index-CKre5JEG.js.map → index-B1aDcaWd.js.map} +1 -1
- package/dist/sdk/index-Df-7P3r0.js.map +1 -0
- package/dist/sdk/{index-CYip1Wgu.js.map → index-Eu7hg2ii.js.map} +1 -1
- package/dist/sdk/{index-CoYUNBeF.js.map → index-Iulyfmzq.js.map} +1 -1
- package/dist/sdk/index.esm.js +2 -22
- 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/sdk/newsletter-helpers-8ByV38YW.js.map +1 -0
- package/dist/sdk/newsletter-helpers-B-Md6T9k.js.map +1 -0
- package/dist/sdk/p-08ff2de2.entry.js +2 -0
- package/dist/sdk/p-08ff2de2.entry.js.map +1 -0
- package/dist/sdk/p-1ea49938.entry.js +2 -0
- package/dist/sdk/p-1ea49938.entry.js.map +1 -0
- package/dist/sdk/p-2a65bcbb.entry.js +2 -0
- package/dist/sdk/p-2a65bcbb.entry.js.map +1 -0
- package/dist/sdk/p-2af8b45f.entry.js +2 -0
- package/dist/sdk/p-2af8b45f.entry.js.map +1 -0
- package/dist/sdk/p-3411c743.entry.js +2 -0
- package/dist/sdk/p-3411c743.entry.js.map +1 -0
- package/dist/sdk/p-467c7304.entry.js +2 -0
- package/dist/sdk/p-467c7304.entry.js.map +1 -0
- package/dist/sdk/p-56abb377.entry.js +2 -0
- package/dist/sdk/p-56abb377.entry.js.map +1 -0
- package/dist/sdk/p-5703102b.entry.js +2 -0
- package/dist/sdk/p-5703102b.entry.js.map +1 -0
- package/dist/sdk/p-593c6dde.entry.js +2 -0
- package/dist/sdk/p-593c6dde.entry.js.map +1 -0
- package/dist/sdk/p-5b627aea.entry.js +2 -0
- package/dist/sdk/p-5b627aea.entry.js.map +1 -0
- package/dist/sdk/p-5babee6b.entry.js +2 -0
- package/dist/sdk/p-5babee6b.entry.js.map +1 -0
- package/dist/sdk/p-5cc20a8b.entry.js +2 -0
- package/dist/sdk/p-5cc20a8b.entry.js.map +1 -0
- package/dist/sdk/p-628ccd68.entry.js +2 -0
- package/dist/sdk/p-628ccd68.entry.js.map +1 -0
- package/dist/sdk/p-675eb13d.entry.js +2 -0
- package/dist/sdk/p-675eb13d.entry.js.map +1 -0
- package/dist/sdk/p-6893d167.entry.js +2 -0
- package/dist/sdk/p-6893d167.entry.js.map +1 -0
- package/dist/sdk/p-6a642433.entry.js +2 -0
- package/dist/sdk/p-6a642433.entry.js.map +1 -0
- package/dist/sdk/p-73c2ec89.entry.js +2 -0
- package/dist/sdk/p-73c2ec89.entry.js.map +1 -0
- package/dist/sdk/p-7a0cefff.entry.js +2 -0
- package/dist/sdk/p-7a0cefff.entry.js.map +1 -0
- package/dist/sdk/p-91bb8b59.entry.js +2 -0
- package/dist/sdk/p-91bb8b59.entry.js.map +1 -0
- package/dist/sdk/p-9f59909b.entry.js +2 -0
- package/dist/sdk/p-9f59909b.entry.js.map +1 -0
- package/dist/sdk/p-BZ1kW_eK.js +2 -0
- package/dist/sdk/p-BZ1kW_eK.js.map +1 -0
- package/dist/sdk/p-BlAULXyw.js +2 -0
- package/dist/sdk/p-BlAULXyw.js.map +1 -0
- package/dist/sdk/p-BlOjABPD.js +2 -0
- package/dist/sdk/p-BlOjABPD.js.map +1 -0
- package/dist/sdk/p-BqFCd65h.js +2 -0
- package/dist/sdk/p-BqFCd65h.js.map +1 -0
- package/dist/sdk/p-C0feI0p8.js +2 -0
- package/dist/sdk/p-C0feI0p8.js.map +1 -0
- package/dist/sdk/p-C3fhudPT.js +2 -0
- package/dist/sdk/p-C3fhudPT.js.map +1 -0
- package/dist/sdk/p-CFiZLMAA.js +2 -0
- package/dist/sdk/p-CFiZLMAA.js.map +1 -0
- package/dist/sdk/p-CPPYdoIv.js +2 -0
- package/dist/sdk/p-CPPYdoIv.js.map +1 -0
- package/dist/sdk/p-CbRhHGU5.js +2 -0
- package/dist/sdk/p-CbRhHGU5.js.map +1 -0
- package/dist/sdk/p-Ce8zGAi1.js +2 -0
- package/dist/sdk/p-Ce8zGAi1.js.map +1 -0
- package/dist/sdk/p-Ci3aTmzp.js +3 -0
- package/dist/sdk/p-Ci3aTmzp.js.map +1 -0
- package/dist/sdk/p-D1lzXl_Z.js +2 -0
- package/dist/sdk/p-D1lzXl_Z.js.map +1 -0
- package/dist/sdk/p-DA84OuuU.js +2 -0
- package/dist/sdk/p-DA84OuuU.js.map +1 -0
- package/dist/sdk/p-DUHc_Cx7.js +2 -0
- package/dist/sdk/p-DUHc_Cx7.js.map +1 -0
- package/dist/sdk/p-DYtgart8.js +2 -0
- package/dist/sdk/p-DYtgart8.js.map +1 -0
- package/dist/sdk/p-DdUvQelg.js +2 -0
- package/dist/sdk/p-DdUvQelg.js.map +1 -0
- package/dist/sdk/p-S3-2d2Qd.js +2 -0
- package/dist/sdk/p-S3-2d2Qd.js.map +1 -0
- package/dist/sdk/p-a4b7ffd8.entry.js +2 -0
- package/dist/sdk/p-a4b7ffd8.entry.js.map +1 -0
- package/dist/sdk/p-a5db968f.entry.js +2 -0
- package/dist/sdk/p-a5db968f.entry.js.map +1 -0
- package/dist/sdk/p-a6393d19.entry.js +2 -0
- package/dist/sdk/p-a6393d19.entry.js.map +1 -0
- package/dist/sdk/p-c31dbbb4.entry.js +2 -0
- package/dist/sdk/p-c31dbbb4.entry.js.map +1 -0
- package/dist/sdk/p-c5bffd90.entry.js +2 -0
- package/dist/sdk/p-c5bffd90.entry.js.map +1 -0
- package/dist/sdk/p-da363474.entry.js +2 -0
- package/dist/sdk/p-da363474.entry.js.map +1 -0
- package/dist/sdk/p-e3611b71.entry.js +2 -0
- package/dist/sdk/p-e3611b71.entry.js.map +1 -0
- package/dist/sdk/p-e3f28800.entry.js +2 -0
- package/dist/sdk/p-e3f28800.entry.js.map +1 -0
- package/dist/sdk/p-effaf86b.entry.js +2 -0
- package/dist/sdk/p-effaf86b.entry.js.map +1 -0
- package/dist/sdk/p-f0598e42.entry.js +2 -0
- package/dist/sdk/p-f0598e42.entry.js.map +1 -0
- package/dist/sdk/p-f369a996.entry.js +2 -0
- package/dist/sdk/p-f369a996.entry.js.map +1 -0
- package/dist/sdk/p-ffac964c.entry.js +2 -0
- package/dist/sdk/p-ffac964c.entry.js.map +1 -0
- package/dist/sdk/{profile-helpers-Bs3aj0CO.js.map → profile-helpers-BDjk573F.js.map} +1 -1
- package/dist/sdk/{profile-helpers-mfEp18Tq.js.map → profile-helpers-b8Koj20a.js.map} +1 -1
- package/dist/sdk/sdk.esm.js +2 -48
- 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 -0
- package/dist/sdk/u-full-profile.entry.esm.js.map +1 -1
- package/dist/sdk/u-magic-code-field.entry.esm.js.map +1 -1
- package/dist/sdk/u-password-field.entry.esm.js.map +1 -1
- package/dist/sdk/u-profile.u-submit-button.entry.esm.js.map +1 -0
- package/dist/sdk/u-signin-step.entry.esm.js.map +1 -1
- package/dist/sdk/u-spinner.entry.esm.js.map +1 -1
- package/dist/sdk/u-ticketable-list.entry.esm.js.map +1 -1
- package/dist/types/auth/auth-helpers.d.ts +24 -25
- package/dist/types/auth/auth.d.ts +1 -1
- package/dist/types/auth/store/auth-store.d.ts +4 -4
- package/dist/types/components.d.ts +72 -0
- package/dist/types/profile/api/profile.d.ts +1 -1
- package/dist/types/profile/components/profile/profile.d.ts +15 -0
- package/dist/types/shared/components/config/config.d.ts +1 -1
- package/dist/types/shared/components/error-message/error-message.d.ts +1 -1
- package/dist/types/ticketable/components/ticketable-list/ticketable-list.d.ts +12 -2
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +1 -1
- package/dist/sdk/auth-B95hXtvh.js.map +0 -1
- package/dist/sdk/auth-BiFlsRm-.js +0 -6821
- package/dist/sdk/auth-BiFlsRm-.js.map +0 -1
- package/dist/sdk/auth-Che07PeV.js.map +0 -1
- package/dist/sdk/auth-store-BzXDlgNb.js.map +0 -1
- package/dist/sdk/auth-store-CapiC8gJ.js.map +0 -1
- package/dist/sdk/auth-store-Mjo3PyJP.js.map +0 -1
- package/dist/sdk/auth-wavto6GW.js +0 -6822
- package/dist/sdk/auth-wavto6GW.js.map +0 -1
- package/dist/sdk/auth-y_LsX4Zn.js +0 -6822
- package/dist/sdk/auth-y_LsX4Zn.js.map +0 -1
- package/dist/sdk/i18n-CacW7WuC.js.map +0 -1
- package/dist/sdk/index-BDX4bHnk.js +0 -15349
- package/dist/sdk/index-BDX4bHnk.js.map +0 -1
- package/dist/sdk/index-BqL27K_R.js +0 -49640
- package/dist/sdk/index-C5jZjlU8.js +0 -49640
- package/dist/sdk/index-CKre5JEG.js +0 -15349
- package/dist/sdk/index-CoYUNBeF.js +0 -43
- package/dist/sdk/index-CvfZ-LfN.js +0 -43
- package/dist/sdk/index-CvfZ-LfN.js.map +0 -1
- package/dist/sdk/index-Cz3idqu9.js +0 -43
- package/dist/sdk/index-Cz3idqu9.js.map +0 -1
- package/dist/sdk/index-DJUE7Ceb.js +0 -6254
- package/dist/sdk/index-DJUE7Ceb.js.map +0 -1
- package/dist/sdk/index-DOyWRKSD.js +0 -43
- package/dist/sdk/index-DOyWRKSD.js.map +0 -1
- package/dist/sdk/index-gEcJztft.js +0 -15349
- package/dist/sdk/index-gEcJztft.js.map +0 -1
- package/dist/sdk/index-mfIOXLHL.js +0 -49640
- package/dist/sdk/index-mfIOXLHL.js.map +0 -1
- package/dist/sdk/newsletter-helpers-C3t2fsCe.js.map +0 -1
- package/dist/sdk/newsletter-helpers-CLSTOCvO.js.map +0 -1
- package/dist/sdk/newsletter-helpers-CnufIbIZ.js.map +0 -1
- package/dist/sdk/newsletter-helpers-DEXEBD0F.js.map +0 -1
- package/dist/sdk/newsletter-helpers-MgFueAV9.js +0 -276
- package/dist/sdk/newsletter-helpers-MgFueAV9.js.map +0 -1
- package/dist/sdk/profile-store-DD6sq42i.js +0 -18
- package/dist/sdk/u-field.entry.esm.js.map +0 -1
- package/dist/sdk/u-profile.entry.esm.js.map +0 -1
- package/dist/sdk/u-raw-field.entry.esm.js.map +0 -1
- package/dist/sdk/u-spinner.entry.js +0 -16
- package/dist/sdk/u-submit-button.entry.esm.js.map +0 -1
- package/dist/sdk/u-submit-button.entry.js +0 -204
- /package/dist/{sdk → esm}/component-utils-D1lzXl_Z.js +0 -0
- /package/dist/{sdk → esm}/helpers-BqFCd65h.js +0 -0
- /package/dist/{sdk → esm}/helpers-DUHc_Cx7.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer theme{:host,:root{--u-font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--u-font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--u-default-font-family:var(--u-font-sans);--u-default-mono-font-family:var(--u-font-mono);--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,::backdrop,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}::file-selector-button{appearance:button;background-color:#0000;border:0 solid;border-radius:0;box-sizing:border-box;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;margin:0;margin-inline-end:4px;opacity:1;padding:0}:host,html{font-family:var(--u-default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--u-default-font-feature-settings,normal);font-variation-settings:var(--u-default-font-variation-settings,normal);-webkit-text-size-adjust:100%;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);line-height:1.5;tab-size:4;-webkit-tap-highlight-color:transparent}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--u-default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--u-default-mono-font-feature-settings,normal);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--u-default-mono-font-variation-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}button,input,optgroup,select,textarea{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex;padding-block:0}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.u\:flex{display:flex}.u\:items-center{align-items:center}.u\:justify-center{justify-content:center}} /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer base{}@layer components;@layer utilities{.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { t } from "../../../i18n";
|
|
3
|
+
import { Flash } from "../../../shared/store/flash-store";
|
|
4
|
+
import * as NewsletterHelpers from "../../newsletter-helpers";
|
|
5
|
+
import { newsletterStore } from "../../store/newsletter-store";
|
|
6
|
+
export class ToggleNewsletterSubscriptionButton {
|
|
7
|
+
internalName;
|
|
8
|
+
componentClassName = "";
|
|
9
|
+
subscribeClassName = "";
|
|
10
|
+
unsubscribeClassName = "";
|
|
11
|
+
loading = false;
|
|
12
|
+
get isSubscribed() {
|
|
13
|
+
return NewsletterHelpers.isSubscribed(this.internalName);
|
|
14
|
+
}
|
|
15
|
+
handleClick = async () => {
|
|
16
|
+
if (this.loading)
|
|
17
|
+
return;
|
|
18
|
+
if (this.isSubscribed) {
|
|
19
|
+
await this.handleUnsubscribe();
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
await this.handleSubscribe();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
handleSubscribe = async () => {
|
|
26
|
+
const { email } = newsletterStore.state;
|
|
27
|
+
if (!email) {
|
|
28
|
+
Flash.error.addMessage(t("newsletter.errors.email_required"));
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
this.loading = true;
|
|
32
|
+
const success = await NewsletterHelpers.subscribeToNewsletter(this.internalName, email);
|
|
33
|
+
this.loading = false;
|
|
34
|
+
if (success) {
|
|
35
|
+
Flash.success.addMessage(t("newsletter.success.subscribe"));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
handleUnsubscribe = async () => {
|
|
39
|
+
this.loading = true;
|
|
40
|
+
const success = await NewsletterHelpers.deleteSubscription(this.internalName);
|
|
41
|
+
this.loading = false;
|
|
42
|
+
if (success) {
|
|
43
|
+
Flash.info.addMessage(t("newsletter.success.unsubscribe"));
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
Flash.error.addMessage(t("newsletter.errors.unsubscribe_failed"));
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
render() {
|
|
50
|
+
const isSubscribed = this.isSubscribed;
|
|
51
|
+
const stateClassName = isSubscribed ? this.unsubscribeClassName : this.subscribeClassName;
|
|
52
|
+
return (h("button", { key: '2f858a8d382dd0a2b3e7c20aca3fbf8970f4be4e', type: "button", onClick: this.handleClick, disabled: this.loading, "aria-busy": this.loading, "aria-label": isSubscribed ? t("newsletter.buttons.unsubscribe") : t("newsletter.buttons.subscribe"), "aria-live": "polite", "data-subscribed": isSubscribed, class: `${this.componentClassName} ${stateClassName} u:flex u:items-center u:justify-center`.trim() }, this.loading ? h("u-spinner", null) : isSubscribed ? t("newsletter.buttons.unsubscribe") : t("newsletter.buttons.subscribe")));
|
|
53
|
+
}
|
|
54
|
+
static get is() { return "u-newsletter-toggle-subscription-button"; }
|
|
55
|
+
static get originalStyleUrls() {
|
|
56
|
+
return {
|
|
57
|
+
"$": ["toggle-subscription-button.css"]
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
static get styleUrls() {
|
|
61
|
+
return {
|
|
62
|
+
"$": ["toggle-subscription-button.css"]
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
static get properties() {
|
|
66
|
+
return {
|
|
67
|
+
"internalName": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"mutable": false,
|
|
70
|
+
"complexType": {
|
|
71
|
+
"original": "string",
|
|
72
|
+
"resolved": "string",
|
|
73
|
+
"references": {}
|
|
74
|
+
},
|
|
75
|
+
"required": true,
|
|
76
|
+
"optional": false,
|
|
77
|
+
"docs": {
|
|
78
|
+
"tags": [],
|
|
79
|
+
"text": ""
|
|
80
|
+
},
|
|
81
|
+
"getter": false,
|
|
82
|
+
"setter": false,
|
|
83
|
+
"reflect": false,
|
|
84
|
+
"attribute": "internal-name"
|
|
85
|
+
},
|
|
86
|
+
"componentClassName": {
|
|
87
|
+
"type": "string",
|
|
88
|
+
"mutable": false,
|
|
89
|
+
"complexType": {
|
|
90
|
+
"original": "string",
|
|
91
|
+
"resolved": "string",
|
|
92
|
+
"references": {}
|
|
93
|
+
},
|
|
94
|
+
"required": false,
|
|
95
|
+
"optional": false,
|
|
96
|
+
"docs": {
|
|
97
|
+
"tags": [],
|
|
98
|
+
"text": ""
|
|
99
|
+
},
|
|
100
|
+
"getter": false,
|
|
101
|
+
"setter": false,
|
|
102
|
+
"reflect": false,
|
|
103
|
+
"attribute": "class-name",
|
|
104
|
+
"defaultValue": "\"\""
|
|
105
|
+
},
|
|
106
|
+
"subscribeClassName": {
|
|
107
|
+
"type": "string",
|
|
108
|
+
"mutable": false,
|
|
109
|
+
"complexType": {
|
|
110
|
+
"original": "string",
|
|
111
|
+
"resolved": "string",
|
|
112
|
+
"references": {}
|
|
113
|
+
},
|
|
114
|
+
"required": false,
|
|
115
|
+
"optional": false,
|
|
116
|
+
"docs": {
|
|
117
|
+
"tags": [],
|
|
118
|
+
"text": ""
|
|
119
|
+
},
|
|
120
|
+
"getter": false,
|
|
121
|
+
"setter": false,
|
|
122
|
+
"reflect": false,
|
|
123
|
+
"attribute": "subscribe-class-name",
|
|
124
|
+
"defaultValue": "\"\""
|
|
125
|
+
},
|
|
126
|
+
"unsubscribeClassName": {
|
|
127
|
+
"type": "string",
|
|
128
|
+
"mutable": false,
|
|
129
|
+
"complexType": {
|
|
130
|
+
"original": "string",
|
|
131
|
+
"resolved": "string",
|
|
132
|
+
"references": {}
|
|
133
|
+
},
|
|
134
|
+
"required": false,
|
|
135
|
+
"optional": false,
|
|
136
|
+
"docs": {
|
|
137
|
+
"tags": [],
|
|
138
|
+
"text": ""
|
|
139
|
+
},
|
|
140
|
+
"getter": false,
|
|
141
|
+
"setter": false,
|
|
142
|
+
"reflect": false,
|
|
143
|
+
"attribute": "unsubscribe-class-name",
|
|
144
|
+
"defaultValue": "\"\""
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
static get states() {
|
|
149
|
+
return {
|
|
150
|
+
"loading": {}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=toggle-subscription-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle-subscription-button.js","sourceRoot":"","sources":["../../../../src/newsletter/components/toggle-subscription-button/toggle-subscription-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC1D,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAO/D,MAAM,OAAO,kCAAkC;IACrC,YAAY,CAAU;IAEK,kBAAkB,GAAG,EAAE,CAAC;IACd,kBAAkB,GAAG,EAAE,CAAC;IACtB,oBAAoB,GAAG,EAAE,CAAC;IAEhE,OAAO,GAAG,KAAK,CAAC;IAEzB,IAAY,YAAY;QACtB,OAAO,iBAAiB,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC3D,CAAC;IAEO,WAAW,GAAG,KAAK,IAAI,EAAE;QAC/B,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO;QAEzB,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QAC/B,CAAC;IACH,CAAC,CAAC;IAEM,eAAe,GAAG,KAAK,IAAI,EAAE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W,EACzB,QAAQ,EAAE,IAAI,CAAC,OAAO,eACX,IAAI,CAAC,OAAO,gBACX,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,8BAA8B,CAAC,eACxF,QAAQ,qBACD,YAAY,EAC7B,KAAK,EAAE,GAAG,IAAI,CAAC,kBAAkB,IAAI,cAAc,yCAAyC,CAAC,IAAI,EAAE,IAElG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,oBAAa,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAC/G,CACV,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State } from \"@stencil/core\";\nimport { t } from \"../../../i18n\";\nimport { Flash } from \"../../../shared/store/flash-store\";\nimport * as NewsletterHelpers from \"../../newsletter-helpers\";\nimport { newsletterStore } from \"../../store/newsletter-store\";\n\n@Component({\n tag: \"u-newsletter-toggle-subscription-button\",\n styleUrl: \"toggle-subscription-button.css\",\n shadow: false,\n})\nexport class ToggleNewsletterSubscriptionButton {\n @Prop() internalName!: string;\n\n @Prop({ attribute: \"class-name\" }) componentClassName = \"\";\n @Prop({ attribute: \"subscribe-class-name\" }) subscribeClassName = \"\";\n @Prop({ attribute: \"unsubscribe-class-name\" }) unsubscribeClassName = \"\";\n\n @State() loading = false;\n\n private get isSubscribed(): boolean {\n return NewsletterHelpers.isSubscribed(this.internalName);\n }\n\n private handleClick = async () => {\n if (this.loading) return;\n\n if (this.isSubscribed) {\n await this.handleUnsubscribe();\n } else {\n await this.handleSubscribe();\n }\n };\n\n private handleSubscribe = async () => {\n const { email } = newsletterStore.state;\n\n if (!email) {\n Flash.error.addMessage(t(\"newsletter.errors.email_required\"));\n return;\n }\n\n this.loading = true;\n const success = await NewsletterHelpers.subscribeToNewsletter(this.internalName, email);\n this.loading = false;\n\n if (success) {\n Flash.success.addMessage(t(\"newsletter.success.subscribe\"));\n }\n };\n\n private handleUnsubscribe = async () => {\n this.loading = true;\n const success = await NewsletterHelpers.deleteSubscription(this.internalName);\n this.loading = false;\n\n if (success) {\n Flash.info.addMessage(t(\"newsletter.success.unsubscribe\"));\n } else {\n Flash.error.addMessage(t(\"newsletter.errors.unsubscribe_failed\"));\n }\n };\n\n render() {\n const isSubscribed = this.isSubscribed;\n const stateClassName = isSubscribed ? this.unsubscribeClassName : this.subscribeClassName;\n\n return (\n <button\n type=\"button\"\n onClick={this.handleClick}\n disabled={this.loading}\n aria-busy={this.loading}\n aria-label={isSubscribed ? t(\"newsletter.buttons.unsubscribe\") : t(\"newsletter.buttons.subscribe\")}\n aria-live=\"polite\"\n data-subscribed={isSubscribed}\n class={`${this.componentClassName} ${stateClassName} u:flex u:items-center u:justify-center`.trim()}\n >\n {this.loading ? <u-spinner /> : isSubscribed ? t(\"newsletter.buttons.unsubscribe\") : t(\"newsletter.buttons.subscribe\")}\n </button>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview entry point for your component library
|
|
3
|
+
*
|
|
4
|
+
* This is the entry point for your component library. Use this file to export utilities,
|
|
5
|
+
* constants or data structure that accompany your components.
|
|
6
|
+
*
|
|
7
|
+
* DO NOT use this file to export your components. Instead, use the recommended approaches
|
|
8
|
+
* to consume components of this package as outlined in the `README.md`.
|
|
9
|
+
*/
|
|
10
|
+
export * from "./api/newsletters";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/newsletter/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,cAAc,mBAAmB,CAAC","sourcesContent":["/**\n * @fileoverview entry point for your component library\n *\n * This is the entry point for your component library. Use this file to export utilities,\n * constants or data structure that accompany your components.\n *\n * DO NOT use this file to export your components. Instead, use the recommended approaches\n * to consume components of this package as outlined in the `README.md`.\n */\n\nexport * from \"./api/newsletters\";\n"]}
|
package/dist/{sdk/newsletter-helpers-C3t2fsCe.js → collection/newsletter/newsletter-helpers.js}
RENAMED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t } from
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { getUnidyClient } from "../api";
|
|
2
|
+
import { Auth } from "../auth/auth";
|
|
3
|
+
import { t } from "../i18n";
|
|
4
|
+
import { createLogger } from "../logger";
|
|
5
|
+
import { Flash } from "../shared/store/flash-store";
|
|
6
|
+
import { newsletterStore, persist, } from "./store/newsletter-store";
|
|
8
7
|
const logger = createLogger("NewsletterHelpers");
|
|
9
8
|
const PERSIST_KEY_PREFIX = "unidy_newsletter_";
|
|
10
|
-
function newsletterLogout() {
|
|
9
|
+
export function newsletterLogout() {
|
|
11
10
|
newsletterStore.state.preferenceToken = "";
|
|
12
11
|
newsletterStore.state.existingSubscriptions = [];
|
|
13
12
|
sessionStorage.removeItem(`${PERSIST_KEY_PREFIX}preferenceToken`);
|
|
14
13
|
sessionStorage.removeItem(`${PERSIST_KEY_PREFIX}email`);
|
|
15
14
|
}
|
|
16
|
-
async function resendDoi(internalName) {
|
|
15
|
+
export async function resendDoi(internalName) {
|
|
17
16
|
const { preferenceToken } = newsletterStore.state;
|
|
18
17
|
const authInstance = await Auth.getInstance();
|
|
19
18
|
const idToken = await authInstance.getToken();
|
|
@@ -31,7 +30,7 @@ async function resendDoi(internalName) {
|
|
|
31
30
|
}
|
|
32
31
|
return false;
|
|
33
32
|
}
|
|
34
|
-
async function sendLoginEmail(email) {
|
|
33
|
+
export async function sendLoginEmail(email) {
|
|
35
34
|
const response = await getUnidyClient().newsletters.sendLoginEmail({
|
|
36
35
|
email,
|
|
37
36
|
redirect_uri: redirectToAfterConfirmationUrl(),
|
|
@@ -46,7 +45,7 @@ async function sendLoginEmail(email) {
|
|
|
46
45
|
Flash.error.addMessage(t("errors.unknown", { defaultValue: "An unknown error occurred" }));
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
|
-
async function fetchSubscriptions() {
|
|
48
|
+
export async function fetchSubscriptions() {
|
|
50
49
|
const { preferenceToken } = newsletterStore.state;
|
|
51
50
|
// either preference token is needed or the user must be authenticated
|
|
52
51
|
if (!preferenceToken && !newsletterStore.state.isAuthenticated) {
|
|
@@ -160,14 +159,14 @@ async function handleCreateSubscriptionRequest(email, internalNames, showSuccess
|
|
|
160
159
|
}
|
|
161
160
|
return false;
|
|
162
161
|
}
|
|
163
|
-
async function subscribeToNewsletter(internalName, email) {
|
|
162
|
+
export async function subscribeToNewsletter(internalName, email) {
|
|
164
163
|
return handleCreateSubscriptionRequest(email, [internalName], false);
|
|
165
164
|
}
|
|
166
|
-
async function createSubscriptions({ email }) {
|
|
165
|
+
export async function createSubscriptions({ email }) {
|
|
167
166
|
const internalNames = Object.keys(newsletterStore.state.checkedNewsletters);
|
|
168
167
|
await handleCreateSubscriptionRequest(email, internalNames, true);
|
|
169
168
|
}
|
|
170
|
-
async function deleteSubscription(internalName) {
|
|
169
|
+
export async function deleteSubscription(internalName) {
|
|
171
170
|
const { preferenceToken } = newsletterStore.state;
|
|
172
171
|
// either preference token is needed or the user must be authenticated to delete a subscription
|
|
173
172
|
if (!preferenceToken && !newsletterStore.state.isAuthenticated) {
|
|
@@ -187,6 +186,12 @@ async function deleteSubscription(internalName) {
|
|
|
187
186
|
persist("preferenceToken");
|
|
188
187
|
}
|
|
189
188
|
newsletterStore.state.existingSubscriptions = newsletterStore.state.existingSubscriptions.filter((sub) => sub.newsletter_internal_name !== internalName);
|
|
189
|
+
// Reset checked preferences to defaults (preferences marked with checked='true')
|
|
190
|
+
const defaultPrefs = newsletterStore.state.defaultPreferences[internalName];
|
|
191
|
+
newsletterStore.state.checkedNewsletters = {
|
|
192
|
+
...newsletterStore.state.checkedNewsletters,
|
|
193
|
+
[internalName]: defaultPrefs ? [...defaultPrefs] : [],
|
|
194
|
+
};
|
|
190
195
|
return true;
|
|
191
196
|
}
|
|
192
197
|
if (response.status === 204) {
|
|
@@ -205,13 +210,13 @@ async function deleteSubscription(internalName) {
|
|
|
205
210
|
Flash.error.addMessage(t("errors.unknown", { defaultValue: "An unknown error occurred" }));
|
|
206
211
|
return false;
|
|
207
212
|
}
|
|
208
|
-
function getSubscription(internalName) {
|
|
213
|
+
export function getSubscription(internalName) {
|
|
209
214
|
return newsletterStore.state.existingSubscriptions.find((sub) => sub.newsletter_internal_name === internalName);
|
|
210
215
|
}
|
|
211
|
-
function isSubscribed(internalName) {
|
|
216
|
+
export function isSubscribed(internalName) {
|
|
212
217
|
return newsletterStore.state.existingSubscriptions.some((sub) => sub.newsletter_internal_name === internalName);
|
|
213
218
|
}
|
|
214
|
-
function isConfirmed(internalName) {
|
|
219
|
+
export function isConfirmed(internalName) {
|
|
215
220
|
const sub = getSubscription(internalName);
|
|
216
221
|
return sub?.confirmed ?? false;
|
|
217
222
|
}
|
|
@@ -224,11 +229,11 @@ function redirectToAfterConfirmationUrl() {
|
|
|
224
229
|
const queryString = params.toString();
|
|
225
230
|
return queryString ? `${baseUrl}?${queryString}` : baseUrl;
|
|
226
231
|
}
|
|
227
|
-
function getSubscriptionPreferences(internalName) {
|
|
232
|
+
export function getSubscriptionPreferences(internalName) {
|
|
228
233
|
const subscription = getSubscription(internalName);
|
|
229
234
|
return subscription?.preference_identifiers || [];
|
|
230
235
|
}
|
|
231
|
-
async function updateSubscriptionPreferences(internalName) {
|
|
236
|
+
export async function updateSubscriptionPreferences(internalName) {
|
|
232
237
|
const { preferenceToken } = newsletterStore.state;
|
|
233
238
|
// Either preference token is needed or the user must be authenticated
|
|
234
239
|
if (!preferenceToken && !newsletterStore.state.isAuthenticated) {
|
|
@@ -269,8 +274,4 @@ async function updateSubscriptionPreferences(internalName) {
|
|
|
269
274
|
Flash.error.addMessage(t("errors.unknown", { defaultValue: "An unknown error occurred" }));
|
|
270
275
|
return false;
|
|
271
276
|
}
|
|
272
|
-
|
|
273
|
-
export { isSubscribed as a, subscribeToNewsletter as b, createSubscriptions as c, deleteSubscription as d, fetchSubscriptions as f, isConfirmed as i, newsletterLogout as n, resendDoi as r, sendLoginEmail as s, updateSubscriptionPreferences as u };
|
|
274
|
-
//# sourceMappingURL=newsletter-helpers-C3t2fsCe.js.map
|
|
275
|
-
|
|
276
|
-
//# sourceMappingURL=newsletter-helpers-C3t2fsCe.js.map
|
|
277
|
+
//# sourceMappingURL=newsletter-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"newsletter-helpers.js","sourceRoot":"","sources":["../../src/newsletter/newsletter-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,SAAS,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAIL,eAAe,EACf,OAAO,GACR,MAAM,0BAA0B,CAAC;AAElC,MAAM,MAAM,GAAG,YAAY,CAAC,mBAAmB,CAAC,CAAC;AAEjD,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAE/C,MAAM,UAAU,gBAAgB;IAC9B,eAAe,CAAC,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC;IAC3C,eAAe,CAAC,KAAK,CAAC,qBAAqB,GAAG,EAAE,CAAC;IACjD,cAAc,CAAC,UAAU,CAAC,GAAG,kBAAkB,iBAAiB,CAAC,CAAC;IAClE,cAAc,CAAC,UAAU,CAAC,G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,CAAC,IAAI,CAAC,sBAAsB,IAAI,EAAE;aACnE,CAAC;YACF,eAAe,CAAC,KAAK,CAAC,qBAAqB,GAAG,oBAAoB,CAAC;QACrE,CAAC;QAED,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,wCAAwC,CAAC,CAAC,CAAC;QACtE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,gBAAgB,EAAE,EAAE,YAAY,EAAE,2BAA2B,EAAE,CAAC,CAAC,CAAC;IAC3F,OAAO,KAAK,CAAC;AACf,CAAC","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"]}
|
package/dist/{sdk/newsletter-store-CvULKmsu.js → collection/newsletter/store/newsletter-store.js}
RENAMED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { createStore } from "@stencil/store";
|
|
3
2
|
const PERSIST_KEY_PREFIX = "unidy_newsletter_";
|
|
4
|
-
const persist = (key) => {
|
|
3
|
+
export const persist = (key) => {
|
|
5
4
|
sessionStorage.setItem(`${PERSIST_KEY_PREFIX}${key}`, newsletterStore.state[key]);
|
|
6
5
|
};
|
|
7
6
|
const getPersistedValue = (key) => {
|
|
@@ -17,8 +16,8 @@ const initialState = {
|
|
|
17
16
|
errors: {},
|
|
18
17
|
isAuthenticated: false,
|
|
19
18
|
};
|
|
20
|
-
const newsletterStore = createStore(initialState);
|
|
21
|
-
const storeDefaultPreference = (internalName, preferenceIdentifier) => {
|
|
19
|
+
export const newsletterStore = createStore(initialState);
|
|
20
|
+
export const storeDefaultPreference = (internalName, preferenceIdentifier) => {
|
|
22
21
|
const current = newsletterStore.state.defaultPreferences[internalName] ?? new Set();
|
|
23
22
|
const updated = new Set(current);
|
|
24
23
|
updated.add(preferenceIdentifier);
|
|
@@ -27,13 +26,9 @@ const storeDefaultPreference = (internalName, preferenceIdentifier) => {
|
|
|
27
26
|
[internalName]: updated,
|
|
28
27
|
};
|
|
29
28
|
};
|
|
30
|
-
const reset = () => {
|
|
29
|
+
export const reset = () => {
|
|
31
30
|
sessionStorage.removeItem(`${PERSIST_KEY_PREFIX}preferenceToken`);
|
|
32
31
|
sessionStorage.removeItem(`${PERSIST_KEY_PREFIX}email`);
|
|
33
32
|
newsletterStore.state = initialState;
|
|
34
33
|
};
|
|
35
|
-
|
|
36
|
-
export { newsletterStore as n, persist as p, storeDefaultPreference as s };
|
|
37
|
-
//# sourceMappingURL=newsletter-store-CvULKmsu.js.map
|
|
38
|
-
|
|
39
|
-
//# sourceMappingURL=newsletter-store-CvULKmsu.js.map
|
|
34
|
+
//# sourceMappingURL=newsletter-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"newsletter-store.js","sourceRoot":"","sources":["../../../src/newsletter/store/newsletter-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAsC7C,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAE/C,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAgC,EAAE,EAAE;IAC1D,cAAc,CAAC,OAAO,CAAC,GAAG,kBAAkB,GAAG,GAAG,EAAE,EAAE,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AACpF,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,GAAgC,EAAE,EAAE;IAC7D,OAAO,cAAc,CAAC,OAAO,CAAC,GAAG,kBAAkB,GAAG,GAAG,EAAE,CAAC,CAAC;AAC/D,CAAC,CAAC;AAEF,MAAM,YAAY,GAAoB;IACpC,KAAK,EAAE,iBAAiB,CAAC,OAAO,CAAC,IAAI,EAAE;IACvC,eAAe,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,IAAI,EAAE;IAC3D,kBAAkB,EAAE,EAAE;IACtB,kBAAkB,EAAE,EAAE;IAEtB,qBAAqB,EAAE,KAAK;IAC5B,qBAAqB,EAAE,EAAE;IAEzB,MAAM,EAAE,EAAE;IACV,eAAe,EAAE,KAAK;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAkB,YAAY,CAAC,CAAC;AAE1E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,YAAoC,EAAE,oBAA0C,EAAE,EAAE;IACzH,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC,kBAAkB,CAAC,YAAY,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC;IACpF,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;IACjC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAClC,eAAe,CAAC,KAAK,CAAC,kBAAkB,GAAG;QACzC,GAAG,eAAe,CAAC,KAAK,CAAC,kBAAkB;QAC3C,CAAC,YAAY,CAAC,EAAE,OAAO;KACxB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,EAAE;IACxB,cAAc,CAAC,UAAU,CAAC,GAAG,kBAAkB,iBAAiB,CAAC,CAAC;IAClE,cAAc,CAAC,UAAU,CAAC,GAAG,kBAAkB,OAAO,CAAC,CAAC;IACxD,eAAe,CAAC,KAAK,GAAG,YAAY,CAAC;AACvC,CAAC,CAAC","sourcesContent":["import { createStore } from \"@stencil/store\";\n\nexport type NewsletterErrorIdentifier =\n | \"unconfirmed\"\n | \"already_subscribed\"\n | \"invalid_email\"\n | \"newsletter_not_found\"\n | \"preferences_not_found\"\n | \"invalid_preference_token\"\n | \"unknown\";\n\nexport type NewsletterInternalName = string;\nexport type PreferenceIdentifier = string;\n\nexport interface ExistingSubscription {\n newsletter_internal_name: NewsletterInternalName;\n confirmed: boolean;\n preference_identifiers: PreferenceIdentifier[];\n}\n\nexport type CheckedNewsletters = Record<NewsletterInternalName, PreferenceIdentifier[]>;\n\nexport type DefaultPreferences = Record<NewsletterInternalName, Set<PreferenceIdentifier>>;\n\ninterface NewsletterState {\n email: string;\n preferenceToken: string;\n checkedNewsletters: CheckedNewsletters;\n defaultPreferences: DefaultPreferences;\n\n fetchingSubscriptions: boolean;\n existingSubscriptions: ExistingSubscription[];\n\n errors: Record<string, NewsletterErrorIdentifier>;\n\n isAuthenticated: boolean;\n}\n\nconst PERSIST_KEY_PREFIX = \"unidy_newsletter_\";\n\nexport const persist = (key: \"email\" | \"preferenceToken\") => {\n sessionStorage.setItem(`${PERSIST_KEY_PREFIX}${key}`, newsletterStore.state[key]);\n};\n\nconst getPersistedValue = (key: \"email\" | \"preferenceToken\") => {\n return sessionStorage.getItem(`${PERSIST_KEY_PREFIX}${key}`);\n};\n\nconst initialState: NewsletterState = {\n email: getPersistedValue(\"email\") ?? \"\",\n preferenceToken: getPersistedValue(\"preferenceToken\") ?? \"\",\n checkedNewsletters: {},\n defaultPreferences: {},\n\n fetchingSubscriptions: false,\n existingSubscriptions: [],\n\n errors: {},\n isAuthenticated: false,\n};\n\nexport const newsletterStore = createStore<NewsletterState>(initialState);\n\nexport const storeDefaultPreference = (internalName: NewsletterInternalName, preferenceIdentifier: PreferenceIdentifier) => {\n const current = newsletterStore.state.defaultPreferences[internalName] ?? new Set();\n const updated = new Set(current);\n updated.add(preferenceIdentifier);\n newsletterStore.state.defaultPreferences = {\n ...newsletterStore.state.defaultPreferences,\n [internalName]: updated,\n };\n};\n\nexport const reset = () => {\n sessionStorage.removeItem(`${PERSIST_KEY_PREFIX}preferenceToken`);\n sessionStorage.removeItem(`${PERSIST_KEY_PREFIX}email`);\n newsletterStore.state = initialState;\n};\n"]}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import * as Sentry from "@sentry/browser";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
const FieldType = z.enum(["text", "textarea", "number", "boolean", "select", "radio", "date", "datetime-local", "checkbox", "tel"]);
|
|
4
|
+
const BaseFieldDataSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
required: z.boolean(),
|
|
7
|
+
label: z.string(),
|
|
8
|
+
attr_name: z.string(),
|
|
9
|
+
locked: z.boolean().optional(),
|
|
10
|
+
locked_text: z.string().optional(),
|
|
11
|
+
})
|
|
12
|
+
.strict();
|
|
13
|
+
const SelectOptionSchema = z
|
|
14
|
+
.object({
|
|
15
|
+
value: z.string(),
|
|
16
|
+
label: z.string(),
|
|
17
|
+
})
|
|
18
|
+
.strict();
|
|
19
|
+
const RadioValue = z.union([z.string(), z.literal("_NOT_SET_"), z.boolean()]).nullable();
|
|
20
|
+
const RadioOptionSchema = z
|
|
21
|
+
.object({
|
|
22
|
+
value: RadioValue,
|
|
23
|
+
label: z.string(),
|
|
24
|
+
checked: z.boolean(),
|
|
25
|
+
})
|
|
26
|
+
.strict();
|
|
27
|
+
const TextFieldSchema = BaseFieldDataSchema.extend({
|
|
28
|
+
value: z.union([z.string(), z.null()]),
|
|
29
|
+
type: z.enum(["text", "textarea"]),
|
|
30
|
+
}).strict();
|
|
31
|
+
const PhoneFieldSchema = BaseFieldDataSchema.extend({
|
|
32
|
+
value: z.union([z.string().nullable()]),
|
|
33
|
+
type: z.enum(["tel"]),
|
|
34
|
+
}).strict();
|
|
35
|
+
const RadioFieldSchema = BaseFieldDataSchema.extend({
|
|
36
|
+
value: RadioValue,
|
|
37
|
+
type: z.enum(["radio"]),
|
|
38
|
+
radio_options: z.array(RadioOptionSchema),
|
|
39
|
+
}).strict();
|
|
40
|
+
const SelectFieldSchema = BaseFieldDataSchema.extend({
|
|
41
|
+
value: z.string().nullable(),
|
|
42
|
+
type: z.enum(["select"]),
|
|
43
|
+
options: z.array(SelectOptionSchema),
|
|
44
|
+
}).strict();
|
|
45
|
+
const DateFieldSchema = BaseFieldDataSchema.extend({
|
|
46
|
+
value: z.union([z.string(), z.null()]),
|
|
47
|
+
type: z.enum(["date", "datetime-local"]),
|
|
48
|
+
}).strict();
|
|
49
|
+
const CustomFieldSchema = BaseFieldDataSchema.extend({
|
|
50
|
+
value: z.union([z.string(), z.null(), z.boolean(), z.number(), z.array(z.string())]),
|
|
51
|
+
type: FieldType,
|
|
52
|
+
readonly: z.boolean(),
|
|
53
|
+
radio_options: z.array(RadioOptionSchema).optional(),
|
|
54
|
+
options: z.array(SelectOptionSchema).optional(),
|
|
55
|
+
}).strict();
|
|
56
|
+
export const UserProfileSchema = z.object({
|
|
57
|
+
salutation: RadioFieldSchema,
|
|
58
|
+
first_name: TextFieldSchema,
|
|
59
|
+
last_name: TextFieldSchema,
|
|
60
|
+
email: TextFieldSchema,
|
|
61
|
+
phone_number: PhoneFieldSchema,
|
|
62
|
+
company_name: TextFieldSchema,
|
|
63
|
+
address_line_1: TextFieldSchema,
|
|
64
|
+
address_line_2: TextFieldSchema,
|
|
65
|
+
city: TextFieldSchema,
|
|
66
|
+
postal_code: TextFieldSchema,
|
|
67
|
+
country_code: SelectFieldSchema,
|
|
68
|
+
date_of_birth: DateFieldSchema,
|
|
69
|
+
preferred_language: TextFieldSchema.optional(),
|
|
70
|
+
custom_attributes: z.record(z.string(), CustomFieldSchema),
|
|
71
|
+
});
|
|
72
|
+
const UserProfileErrorSchema = z
|
|
73
|
+
.object({
|
|
74
|
+
error_identifier: z.string(),
|
|
75
|
+
})
|
|
76
|
+
.strict();
|
|
77
|
+
const FormErrorsValue = z.union([z.array(z.string()), z.array(z.tuple([z.number(), z.array(z.string())]))]);
|
|
78
|
+
const FormErrorsRawSchema = z.record(z.string(), FormErrorsValue);
|
|
79
|
+
const UserProfileFormErrorSchema = z
|
|
80
|
+
.object({
|
|
81
|
+
errors: FormErrorsRawSchema,
|
|
82
|
+
})
|
|
83
|
+
.strict()
|
|
84
|
+
.transform(({ errors }) => {
|
|
85
|
+
const flatErrors = Object.fromEntries(Object.entries(errors).map(([field, value]) => {
|
|
86
|
+
const errorMessages = Array.isArray(value) && value.length > 0 && typeof value[0] === "string"
|
|
87
|
+
? value
|
|
88
|
+
: value.flatMap(([, arr]) => arr);
|
|
89
|
+
return [field, errorMessages.join(" | ")];
|
|
90
|
+
}));
|
|
91
|
+
return { errors, flatErrors };
|
|
92
|
+
});
|
|
93
|
+
const UserProfileRailsFormErrorSchema = z
|
|
94
|
+
.object({
|
|
95
|
+
error_details: FormErrorsRawSchema,
|
|
96
|
+
})
|
|
97
|
+
.loose()
|
|
98
|
+
.transform(({ error_details }) => ({ errors: error_details }))
|
|
99
|
+
.pipe(UserProfileFormErrorSchema);
|
|
100
|
+
const ProfileResultSchema = z.union([
|
|
101
|
+
UserProfileSchema,
|
|
102
|
+
UserProfileErrorSchema,
|
|
103
|
+
UserProfileFormErrorSchema,
|
|
104
|
+
UserProfileRailsFormErrorSchema,
|
|
105
|
+
]);
|
|
106
|
+
export class ProfileService {
|
|
107
|
+
client;
|
|
108
|
+
constructor(client) {
|
|
109
|
+
this.client = client;
|
|
110
|
+
}
|
|
111
|
+
async fetchProfile({ idToken, lang }) {
|
|
112
|
+
if (!idToken) {
|
|
113
|
+
return { status: 401, success: false, headers: new Headers(), error: "missing id_token" };
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
const resp = await this.client.get(`/api/sdk/v1/profile${lang ? `?lang=${lang}` : ""}`, { "X-ID-Token": idToken });
|
|
117
|
+
const parsed = ProfileResultSchema.safeParse(resp.data);
|
|
118
|
+
if (!parsed.success) {
|
|
119
|
+
return { status: 400, success: false, headers: new Headers(), error: "invalid profile data" };
|
|
120
|
+
}
|
|
121
|
+
const data = parsed.data;
|
|
122
|
+
if ("error_identifier" in data) {
|
|
123
|
+
return { ...resp, data, error: data.error_identifier };
|
|
124
|
+
}
|
|
125
|
+
return { ...resp, data };
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
Sentry.captureException(error);
|
|
129
|
+
return {
|
|
130
|
+
status: error instanceof TypeError ? 0 : 500,
|
|
131
|
+
success: false,
|
|
132
|
+
headers: new Headers(),
|
|
133
|
+
error: error instanceof Error ? error.message : String(error),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async updateProfile({ idToken, data, lang }) {
|
|
138
|
+
if (!idToken) {
|
|
139
|
+
return { status: 401, success: false, headers: new Headers(), error: "missing id_token" };
|
|
140
|
+
}
|
|
141
|
+
const payload = data;
|
|
142
|
+
try {
|
|
143
|
+
const resp = await this.client.patch(`/api/sdk/v1/profile${lang ? `?lang=${lang}` : ""}`, { ...payload }, { "X-ID-Token": idToken });
|
|
144
|
+
const parsed = ProfileResultSchema.safeParse(resp.data);
|
|
145
|
+
if (!parsed.success) {
|
|
146
|
+
return { status: 400, success: false, headers: new Headers(), error: "invalid profile data" };
|
|
147
|
+
}
|
|
148
|
+
const result = parsed.data;
|
|
149
|
+
if ("errors" in result) {
|
|
150
|
+
return { ...resp, data: result };
|
|
151
|
+
}
|
|
152
|
+
if ("error_identifier" in result) {
|
|
153
|
+
return { ...resp, data: result, error: result.error_identifier };
|
|
154
|
+
}
|
|
155
|
+
return { ...resp, data: result };
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
Sentry.captureException(error);
|
|
159
|
+
return {
|
|
160
|
+
status: error instanceof TypeError ? 0 : 500,
|
|
161
|
+
success: false,
|
|
162
|
+
headers: new Headers(),
|
|
163
|
+
error: error instanceof Error ? error.message : String(error),
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../../src/profile/api/profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAA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,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,OAAO,EAAE,EAAE,KAAK,EAAE,sBAAsB,EAAE,CAAC;YAChG,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC;YAE3B,IAAI,QAAQ,IAAI,MAAM,EAAE,CAAC;gBACvB,OAAO,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;YACnC,CAAC;YAED,IAAI,kBAAkB,IAAI,MAAM,EAAE,CAAC;gBACjC,OAAO,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,gBAAgB,EAAE,CAAC;YACnE,CAAC;YAED,OAAO,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACnC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;YAC/B,OAAO;gBACL,MAAM,EAAE,KAAK,YAAY,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;gBAC5C,OAAO,EAAE,KAAK;gBACd,OAAO,EAAE,IAAI,OAAO,EAAE;gBACtB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;aAC9D,CAAC;QACJ,CAAC;IACH,CAAC;CACF","sourcesContent":["import * as Sentry from \"@sentry/browser\";\nimport * as z from \"zod\";\nimport type { ApiClient, ApiResponse } from \"../../api\";\n\nconst FieldType = z.enum([\"text\", \"textarea\", \"number\", \"boolean\", \"select\", \"radio\", \"date\", \"datetime-local\", \"checkbox\", \"tel\"]);\n\nconst BaseFieldDataSchema = z\n .object({\n required: z.boolean(),\n label: z.string(),\n attr_name: z.string(),\n locked: z.boolean().optional(),\n locked_text: z.string().optional(),\n })\n .strict();\n\nconst SelectOptionSchema = z\n .object({\n value: z.string(),\n label: z.string(),\n })\n .strict();\n\nconst RadioValue = z.union([z.string(), z.literal(\"_NOT_SET_\"), z.boolean()]).nullable();\n\nconst RadioOptionSchema = z\n .object({\n value: RadioValue,\n label: z.string(),\n checked: z.boolean(),\n })\n .strict();\n\nconst TextFieldSchema = BaseFieldDataSchema.extend({\n value: z.union([z.string(), z.null()]),\n type: z.enum([\"text\", \"textarea\"]),\n}).strict();\n\nconst PhoneFieldSchema = BaseFieldDataSchema.extend({\n value: z.union([z.string().nullable()]),\n type: z.enum([\"tel\"]),\n}).strict();\n\nconst RadioFieldSchema = BaseFieldDataSchema.extend({\n value: RadioValue,\n type: z.enum([\"radio\"]),\n radio_options: z.array(RadioOptionSchema),\n}).strict();\n\nconst SelectFieldSchema = BaseFieldDataSchema.extend({\n value: z.string().nullable(),\n type: z.enum([\"select\"]),\n options: z.array(SelectOptionSchema),\n}).strict();\n\nconst DateFieldSchema = BaseFieldDataSchema.extend({\n value: z.union([z.string(), z.null()]),\n type: z.enum([\"date\", \"datetime-local\"]),\n}).strict();\n\nconst CustomFieldSchema = BaseFieldDataSchema.extend({\n value: z.union([z.string(), z.null(), z.boolean(), z.number(), z.array(z.string())]),\n type: FieldType,\n readonly: z.boolean(),\n radio_options: z.array(RadioOptionSchema).optional(),\n options: z.array(SelectOptionSchema).optional(),\n}).strict();\n\nexport const UserProfileSchema = z.object({\n salutation: RadioFieldSchema,\n first_name: TextFieldSchema,\n last_name: TextFieldSchema,\n email: TextFieldSchema,\n phone_number: PhoneFieldSchema,\n company_name: TextFieldSchema,\n address_line_1: TextFieldSchema,\n address_line_2: TextFieldSchema,\n city: TextFieldSchema,\n postal_code: TextFieldSchema,\n country_code: SelectFieldSchema,\n date_of_birth: DateFieldSchema,\n preferred_language: TextFieldSchema.optional(),\n custom_attributes: z.record(z.string(), CustomFieldSchema),\n});\n\nconst UserProfileErrorSchema = z\n .object({\n error_identifier: z.string(),\n })\n .strict();\n\nconst FormErrorsValue = z.union([z.array(z.string()), z.array(z.tuple([z.number(), z.array(z.string())]))]);\n\nconst FormErrorsRawSchema = z.record(z.string(), FormErrorsValue);\n\nconst UserProfileFormErrorSchema = z\n .object({\n errors: FormErrorsRawSchema,\n })\n .strict()\n .transform(({ errors }) => {\n const flatErrors = Object.fromEntries(\n Object.entries(errors).map(([field, value]) => {\n const errorMessages =\n Array.isArray(value) && value.length > 0 && typeof value[0] === \"string\"\n ? (value as string[])\n : (value as Array<[number, string[]]>).flatMap(([, arr]) => arr);\n return [field, errorMessages.join(\" | \")];\n }),\n );\n return { errors, flatErrors };\n });\n\nconst UserProfileRailsFormErrorSchema = z\n .object({\n error_details: FormErrorsRawSchema,\n })\n .loose()\n .transform(({ error_details }) => ({ errors: error_details }))\n .pipe(UserProfileFormErrorSchema);\n\nexport type UserProfileData = z.infer<typeof UserProfileSchema>;\nexport type UserProfileError = z.infer<typeof UserProfileErrorSchema>;\nexport type UserProfileFormError = z.infer<typeof UserProfileFormErrorSchema>;\n\nconst ProfileResultSchema = z.union([\n UserProfileSchema,\n UserProfileErrorSchema,\n UserProfileFormErrorSchema,\n UserProfileRailsFormErrorSchema,\n]);\n\nexport type ProfileResult = UserProfileData | UserProfileError | UserProfileFormError | Record<string, string>;\n\ndeclare global {\n interface Window {\n UNIDY?: { auth?: { id_token?: string } };\n }\n}\n\ntype FetchProfileArgs = { idToken: string; lang?: string };\ntype UpdateProfileArgs = { idToken: string; data: unknown; lang?: string };\n\nexport class ProfileService {\n constructor(private client: ApiClient) {}\n\n async fetchProfile({ idToken, lang }: FetchProfileArgs): Promise<ApiResponse<ProfileResult>> {\n if (!idToken) {\n return { status: 401, success: false, headers: new Headers(), error: \"missing id_token\" };\n }\n\n try {\n const resp = await this.client.get<unknown>(`/api/sdk/v1/profile${lang ? `?lang=${lang}` : \"\"}`, { \"X-ID-Token\": idToken });\n\n const parsed = ProfileResultSchema.safeParse(resp.data);\n if (!parsed.success) {\n return { status: 400, success: false, headers: new Headers(), error: \"invalid profile data\" };\n }\n\n const data = parsed.data;\n\n if (\"error_identifier\" in data) {\n return { ...resp, data, error: data.error_identifier };\n }\n\n return { ...resp, data };\n } catch (error) {\n Sentry.captureException(error);\n return {\n status: error instanceof TypeError ? 0 : 500,\n success: false,\n headers: new Headers(),\n error: error instanceof Error ? error.message : String(error),\n };\n }\n }\n\n async updateProfile({ idToken, data, lang }: UpdateProfileArgs): Promise<ApiResponse<ProfileResult>> {\n if (!idToken) {\n return { status: 401, success: false, headers: new Headers(), error: \"missing id_token\" };\n }\n\n const payload = data as object;\n\n try {\n const resp = await this.client.patch<unknown>(\n `/api/sdk/v1/profile${lang ? `?lang=${lang}` : \"\"}`,\n { ...payload },\n { \"X-ID-Token\": idToken },\n );\n\n const parsed = ProfileResultSchema.safeParse(resp.data);\n if (!parsed.success) {\n return { status: 400, success: false, headers: new Headers(), error: \"invalid profile data\" };\n }\n\n const result = parsed.data;\n\n if (\"errors\" in result) {\n return { ...resp, data: result };\n }\n\n if (\"error_identifier\" in result) {\n return { ...resp, data: result, error: result.error_identifier };\n }\n\n return { ...resp, data: result };\n } catch (error) {\n Sentry.captureException(error);\n return {\n status: error instanceof TypeError ? 0 : 500,\n success: false,\n headers: new Headers(),\n error: error instanceof Error ? error.message : String(error),\n };\n }\n }\n}\n"]}
|