@unidy.io/sdk 1.2.0-alpha9 → 1.2.0

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.
Files changed (715) hide show
  1. package/dist/cjs/_commonjsHelpers-CFO10eej.js +10 -0
  2. package/dist/cjs/_commonjsHelpers-CFO10eej.js.map +1 -0
  3. package/dist/cjs/app-globals-C-Wl5lPS.js +10 -0
  4. package/dist/cjs/app-globals-C-Wl5lPS.js.map +1 -0
  5. package/dist/cjs/{auth-store-DPmGKHZ2.js → auth-store-0vv3uOib.js} +4 -4
  6. package/dist/cjs/{auth-store-DPmGKHZ2.js.map → auth-store-0vv3uOib.js.map} +1 -1
  7. package/dist/cjs/component-DLxnZCW6.js +34 -0
  8. package/dist/cjs/component-DLxnZCW6.js.map +1 -0
  9. package/dist/cjs/component-utils-XXctnOM9.js +38 -0
  10. package/dist/cjs/component-utils-XXctnOM9.js.map +1 -0
  11. package/dist/cjs/de-BWF6Glzg.js +704 -0
  12. package/dist/cjs/de-BWF6Glzg.js.map +1 -0
  13. package/dist/cjs/en-GB-DhD5mdQw.js +119 -0
  14. package/dist/cjs/en-GB-DhD5mdQw.js.map +1 -0
  15. package/dist/cjs/{flash-store-gbSYhPAV.js → flash-store-CR6Umh1O.js} +3 -3
  16. package/dist/cjs/{flash-store-gbSYhPAV.js.map → flash-store-CR6Umh1O.js.map} +1 -1
  17. package/dist/cjs/fr-j2wwoj-A.js +577 -0
  18. package/dist/cjs/fr-j2wwoj-A.js.map +1 -0
  19. package/dist/cjs/has-slot-content-CfJbU4t-.js +37 -0
  20. package/dist/cjs/has-slot-content-CfJbU4t-.js.map +1 -0
  21. package/dist/cjs/{i18n-D5j_Zl-4.js → i18n-ClWrNmGh.js} +100 -4
  22. package/dist/cjs/{i18n-D5j_Zl-4.js.map → i18n-ClWrNmGh.js.map} +1 -1
  23. package/dist/cjs/{index-B325yXfO.js → index-2Fz3r5o0.js} +5 -41
  24. package/dist/cjs/index-2Fz3r5o0.js.map +1 -0
  25. package/dist/cjs/{index-yaeiYlfa.js → index-C6ZBKFYr.js} +3 -3
  26. package/dist/cjs/{index-yaeiYlfa.js.map → index-C6ZBKFYr.js.map} +1 -1
  27. package/dist/cjs/{index-BzPYBLYC.js → index-CpPKy1CZ.js} +1170 -1087
  28. package/dist/cjs/index-CpPKy1CZ.js.map +1 -0
  29. package/dist/cjs/index.cjs.js +24 -11
  30. package/dist/cjs/index.cjs.js.map +1 -1
  31. package/dist/cjs/loader.cjs.js +3 -3
  32. package/dist/cjs/{newsletter-helpers-hdDC5X-V.js → newsletter-helpers-BHvOI8M4.js} +46 -9
  33. package/dist/cjs/newsletter-helpers-BHvOI8M4.js.map +1 -0
  34. package/dist/cjs/{newsletter-store-CupsLgO9.js → newsletter-store-22Jswiqe.js} +5 -3
  35. package/dist/cjs/newsletter-store-22Jswiqe.js.map +1 -0
  36. package/dist/cjs/nl-BE-yKvOp1-G.js +542 -0
  37. package/dist/cjs/nl-BE-yKvOp1-G.js.map +1 -0
  38. package/dist/cjs/{profile-helpers-Bprrm-Xl.js → profile-helpers-BBpAqHjK.js} +4 -4
  39. package/dist/cjs/{profile-helpers-Bprrm-Xl.js.map → profile-helpers-BBpAqHjK.js.map} +1 -1
  40. package/dist/cjs/{profile-store-C_q-TuA_.js → profile-store-CQEQhPQD.js} +4 -4
  41. package/dist/cjs/{profile-store-C_q-TuA_.js.map → profile-store-CQEQhPQD.js.map} +1 -1
  42. package/dist/cjs/redirect-with-token-wupYX97S.js +37 -0
  43. package/dist/cjs/redirect-with-token-wupYX97S.js.map +1 -0
  44. package/dist/cjs/ro-CXq9d1lv.js +578 -0
  45. package/dist/cjs/ro-CXq9d1lv.js.map +1 -0
  46. package/dist/cjs/sdk.cjs.js +3 -3
  47. package/dist/cjs/sv-CMln4V33.js +597 -0
  48. package/dist/cjs/sv-CMln4V33.js.map +1 -0
  49. package/dist/cjs/u-conditional-render.cjs.entry.js +14 -14
  50. package/dist/cjs/u-conditional-render.entry.cjs.js.map +1 -1
  51. package/dist/cjs/u-config.cjs.entry.js +24 -11
  52. package/dist/cjs/u-config.entry.cjs.js.map +1 -1
  53. package/dist/cjs/u-email-field.cjs.entry.js +7 -7
  54. package/dist/cjs/u-error-message.cjs.entry.js +49 -22
  55. package/dist/cjs/u-error-message.entry.cjs.js.map +1 -1
  56. package/dist/cjs/u-field.u-raw-field.entry.cjs.js.map +1 -1
  57. package/dist/cjs/u-field_2.cjs.entry.js +124 -12
  58. package/dist/cjs/u-flash-message.cjs.entry.js +3 -3
  59. package/dist/cjs/u-full-profile.cjs.entry.js +6 -6
  60. package/dist/cjs/u-jump-to-service.cjs.entry.js +23 -44
  61. package/dist/cjs/u-jump-to-service.entry.cjs.js.map +1 -1
  62. package/dist/cjs/u-jump-to-unidy.cjs.entry.js +22 -43
  63. package/dist/cjs/u-jump-to-unidy.entry.cjs.js.map +1 -1
  64. package/dist/cjs/u-logout-button.u-signed-in.entry.cjs.js.map +1 -1
  65. package/dist/cjs/u-logout-button_2.cjs.entry.js +15 -22
  66. package/dist/cjs/u-magic-code-field.cjs.entry.js +8 -9
  67. package/dist/cjs/u-magic-code-field.entry.cjs.js.map +1 -1
  68. package/dist/cjs/u-missing-field.cjs.entry.js +6 -5
  69. package/dist/cjs/u-missing-field.entry.cjs.js.map +1 -1
  70. package/dist/cjs/u-missing-fields-submit-button.cjs.entry.js +16 -14
  71. package/dist/cjs/u-missing-fields-submit-button.entry.cjs.js.map +1 -1
  72. package/dist/cjs/u-newsletter-checkbox.cjs.entry.js +11 -12
  73. package/dist/cjs/u-newsletter-checkbox.entry.cjs.js.map +1 -1
  74. package/dist/cjs/u-newsletter-consent-checkbox.cjs.entry.js +4 -4
  75. package/dist/cjs/u-newsletter-logout-button.cjs.entry.js +15 -20
  76. package/dist/cjs/u-newsletter-logout-button.entry.cjs.js.map +1 -1
  77. package/dist/cjs/u-newsletter-preference-checkbox.cjs.entry.js +11 -12
  78. package/dist/cjs/u-newsletter-preference-checkbox.entry.cjs.js.map +1 -1
  79. package/dist/cjs/u-newsletter-resend-doi-button.cjs.entry.js +10 -11
  80. package/dist/cjs/u-newsletter-resend-doi-button.entry.cjs.js.map +1 -1
  81. package/dist/cjs/u-newsletter-root.cjs.entry.js +45 -22
  82. package/dist/cjs/u-newsletter-root.entry.cjs.js.map +1 -1
  83. package/dist/cjs/u-newsletter-toggle-subscription-button.cjs.entry.js +11 -12
  84. package/dist/cjs/u-newsletter-toggle-subscription-button.entry.cjs.js.map +1 -1
  85. package/dist/cjs/u-pagination-button.cjs.entry.js +4 -4
  86. package/dist/cjs/u-pagination-button.entry.cjs.js.map +1 -1
  87. package/dist/cjs/u-pagination-page.cjs.entry.js +4 -4
  88. package/dist/cjs/u-pagination-page.entry.cjs.js.map +1 -1
  89. package/dist/cjs/u-passkey.cjs.entry.js +8 -9
  90. package/dist/cjs/u-passkey.entry.cjs.js.map +1 -1
  91. package/dist/cjs/u-password-field.cjs.entry.js +5 -5
  92. package/dist/cjs/u-profile.u-submit-button.entry.cjs.js.map +1 -1
  93. package/dist/cjs/u-profile_2.cjs.entry.js +31 -33
  94. package/dist/cjs/u-registration-button.cjs.entry.js +5 -5
  95. package/dist/cjs/u-reset-password-button.cjs.entry.js +12 -15
  96. package/dist/cjs/u-reset-password-button.entry.cjs.js.map +1 -1
  97. package/dist/cjs/u-send-magic-code-button.cjs.entry.js +8 -9
  98. package/dist/cjs/u-send-magic-code-button.entry.cjs.js.map +1 -1
  99. package/dist/cjs/u-signin-root.cjs.entry.js +6 -8
  100. package/dist/cjs/u-signin-root.entry.cjs.js.map +1 -1
  101. package/dist/cjs/u-signin-step.cjs.entry.js +17 -21
  102. package/dist/cjs/u-signin-step.entry.cjs.js.map +1 -1
  103. package/dist/cjs/u-social-login-button.cjs.entry.js +16 -15
  104. package/dist/cjs/u-social-login-button.entry.cjs.js.map +1 -1
  105. package/dist/cjs/u-spinner.cjs.entry.js +3 -3
  106. package/dist/cjs/u-spinner.entry.cjs.js.map +1 -1
  107. package/dist/cjs/u-ticketable-export.cjs.entry.js +76 -0
  108. package/dist/cjs/u-ticketable-export.entry.cjs.js.map +1 -0
  109. package/dist/cjs/u-ticketable-list-D3M8iA-g.js +3991 -0
  110. package/dist/cjs/u-ticketable-list-D3M8iA-g.js.map +1 -0
  111. package/dist/cjs/u-ticketable-list.cjs.entry.js +11 -6118
  112. package/dist/cjs/u-ticketable-list.entry.cjs.js.map +1 -1
  113. package/dist/cjs/{unidy-store-BGnWn9pc.js → unidy-store-Bvnl24i9.js} +3 -3
  114. package/dist/cjs/{unidy-store-BGnWn9pc.js.map → unidy-store-Bvnl24i9.js.map} +1 -1
  115. package/dist/collection/api/base-service.js.map +1 -1
  116. package/dist/collection/api/client.js.map +1 -1
  117. package/dist/collection/api/index.js +6 -6
  118. package/dist/collection/api/index.js.map +1 -1
  119. package/dist/collection/api/standalone.js +88 -39
  120. package/dist/collection/api/standalone.js.map +1 -1
  121. package/dist/collection/auth/api/auth.js.map +1 -1
  122. package/dist/collection/auth/api/schemas.js +5 -5
  123. package/dist/collection/auth/api/schemas.js.map +1 -1
  124. package/dist/collection/auth/auth-helpers.js +7 -8
  125. package/dist/collection/auth/auth-helpers.js.map +1 -1
  126. package/dist/collection/auth/auth.js +1 -0
  127. package/dist/collection/auth/auth.js.map +1 -1
  128. package/dist/collection/auth/components/jump-to-service/jump-to-service.js +20 -40
  129. package/dist/collection/auth/components/jump-to-service/jump-to-service.js.map +1 -1
  130. package/dist/collection/auth/components/jump-to-unidy/jump-to-unidy.js +20 -39
  131. package/dist/collection/auth/components/jump-to-unidy/jump-to-unidy.js.map +1 -1
  132. package/dist/collection/auth/components/logout-button/logout-button.js +7 -11
  133. package/dist/collection/auth/components/logout-button/logout-button.js.map +1 -1
  134. package/dist/collection/auth/components/missing-field/missing-field.js +25 -1
  135. package/dist/collection/auth/components/missing-field/missing-field.js.map +1 -1
  136. package/dist/collection/auth/components/missing-fields-submit-button/missing-fields-submit-button.js +33 -7
  137. package/dist/collection/auth/components/missing-fields-submit-button/missing-fields-submit-button.js.map +1 -1
  138. package/dist/collection/auth/components/password-field/password-field.js +1 -1
  139. package/dist/collection/auth/components/reset-pass-button/reset-pass-button.js +6 -8
  140. package/dist/collection/auth/components/reset-pass-button/reset-pass-button.js.map +1 -1
  141. package/dist/collection/auth/components/signed-in/signed-in.js +2 -5
  142. package/dist/collection/auth/components/signed-in/signed-in.js.map +1 -1
  143. package/dist/collection/auth/components/signin-root/signin-root.js +2 -5
  144. package/dist/collection/auth/components/signin-root/signin-root.js.map +1 -1
  145. package/dist/collection/auth/components/signin-step/signin-step.js +9 -13
  146. package/dist/collection/auth/components/signin-step/signin-step.js.map +1 -1
  147. package/dist/collection/auth/components/social-logins/social-login-button.css +1 -1
  148. package/dist/collection/auth/components/social-logins/social-login-button.js +11 -12
  149. package/dist/collection/auth/components/social-logins/social-login-button.js.map +1 -1
  150. package/dist/collection/auth/components/submit-button/auth-submit-button.js +10 -0
  151. package/dist/collection/auth/components/submit-button/auth-submit-button.js.map +1 -1
  152. package/dist/collection/collection-manifest.json +1 -0
  153. package/dist/collection/locales/de.json +16 -0
  154. package/dist/collection/locales/en.json +16 -0
  155. package/dist/collection/locales/fr.json +16 -0
  156. package/dist/collection/locales/it.json +16 -0
  157. package/dist/collection/locales/nl_be.json +16 -0
  158. package/dist/collection/locales/ro.json +16 -0
  159. package/dist/collection/logger.js +0 -37
  160. package/dist/collection/logger.js.map +1 -1
  161. package/dist/collection/newsletter/api/newsletters.js +19 -18
  162. package/dist/collection/newsletter/api/newsletters.js.map +1 -1
  163. package/dist/collection/newsletter/components/consent-checkbox/consent-checkbox.js +1 -1
  164. package/dist/collection/newsletter/components/logout-button/logout-button.js +6 -10
  165. package/dist/collection/newsletter/components/logout-button/logout-button.js.map +1 -1
  166. package/dist/collection/newsletter/components/newsletter-checkbox/newsletter-checkbox.js +1 -1
  167. package/dist/collection/newsletter/components/newsletter-root/newsletter-root.js +65 -10
  168. package/dist/collection/newsletter/components/newsletter-root/newsletter-root.js.map +1 -1
  169. package/dist/collection/newsletter/components/preference-checkbox/preference-checkbox.js +1 -1
  170. package/dist/collection/newsletter/components/toggle-subscription-button/toggle-subscription-button.js +1 -1
  171. package/dist/collection/newsletter/newsletter-helpers.js +39 -2
  172. package/dist/collection/newsletter/newsletter-helpers.js.map +1 -1
  173. package/dist/collection/newsletter/store/newsletter-store.js +2 -0
  174. package/dist/collection/newsletter/store/newsletter-store.js.map +1 -1
  175. package/dist/collection/profile/api/profile.js.map +1 -1
  176. package/dist/collection/profile/api/schemas.js +1 -1
  177. package/dist/collection/profile/api/schemas.js.map +1 -1
  178. package/dist/collection/profile/components/field/field.js +3 -1
  179. package/dist/collection/profile/components/field/field.js.map +1 -1
  180. package/dist/collection/profile/components/full-profile/full-profile.js +1 -1
  181. package/dist/collection/profile/components/raw-field/raw-field.js +40 -7
  182. package/dist/collection/profile/components/raw-field/raw-field.js.map +1 -1
  183. package/dist/collection/profile/store/profile-store.js +1 -1
  184. package/dist/collection/profile/store/profile-store.js.map +1 -1
  185. package/dist/collection/shared/base/component.js +28 -0
  186. package/dist/collection/shared/base/component.js.map +1 -0
  187. package/dist/collection/shared/base/has-slot-content.js +31 -0
  188. package/dist/collection/shared/base/has-slot-content.js.map +1 -0
  189. package/dist/collection/shared/component-utils.js +23 -27
  190. package/dist/collection/shared/component-utils.js.map +1 -1
  191. package/dist/collection/shared/components/conditional-render/conditional-render.js +4 -5
  192. package/dist/collection/shared/components/conditional-render/conditional-render.js.map +1 -1
  193. package/dist/collection/shared/components/config/config.js +18 -5
  194. package/dist/collection/shared/components/config/config.js.map +1 -1
  195. package/dist/collection/shared/components/email-field/email-field.js +1 -1
  196. package/dist/collection/shared/components/error-message/error-message.css +1 -1
  197. package/dist/collection/shared/components/error-message/error-message.js +44 -17
  198. package/dist/collection/shared/components/error-message/error-message.js.map +1 -1
  199. package/dist/collection/shared/components/spinner/spinner.css +1 -1
  200. package/dist/collection/shared/components/spinner/spinner.js +1 -1
  201. package/dist/collection/shared/components/submit-button/submit-button.css +1 -1
  202. package/dist/collection/shared/components/submit-button/submit-button.js +12 -23
  203. package/dist/collection/shared/components/submit-button/submit-button.js.map +1 -1
  204. package/dist/collection/shared/context-utils.js +96 -0
  205. package/dist/collection/shared/context-utils.js.map +1 -0
  206. package/dist/collection/shared/utils/redirect-with-token.js +30 -0
  207. package/dist/collection/shared/utils/redirect-with-token.js.map +1 -0
  208. package/dist/collection/shared/utils/url-utils.js +25 -0
  209. package/dist/collection/shared/utils/url-utils.js.map +1 -0
  210. package/dist/collection/ticketable/api/schemas.js +10 -2
  211. package/dist/collection/ticketable/api/schemas.js.map +1 -1
  212. package/dist/collection/ticketable/api/subscriptions.js +22 -1
  213. package/dist/collection/ticketable/api/subscriptions.js.map +1 -1
  214. package/dist/collection/ticketable/api/tickets.js +22 -1
  215. package/dist/collection/ticketable/api/tickets.js.map +1 -1
  216. package/dist/collection/ticketable/components/pagination/pagination-button.js +3 -5
  217. package/dist/collection/ticketable/components/pagination/pagination-button.js.map +1 -1
  218. package/dist/collection/ticketable/components/pagination/pagination-page.js +3 -5
  219. package/dist/collection/ticketable/components/pagination/pagination-page.js.map +1 -1
  220. package/dist/collection/ticketable/components/ticketable-export/ticketable-export.js +175 -0
  221. package/dist/collection/ticketable/components/ticketable-export/ticketable-export.js.map +1 -0
  222. package/dist/collection/ticketable/components/ticketable-list/ticketable-list.js +163 -25
  223. package/dist/collection/ticketable/components/ticketable-list/ticketable-list.js.map +1 -1
  224. package/dist/collection/ticketable/index.js +1 -0
  225. package/dist/collection/ticketable/index.js.map +1 -1
  226. package/dist/components/_commonjsHelpers.js +8 -0
  227. package/dist/components/_commonjsHelpers.js.map +1 -0
  228. package/dist/components/component-utils.js +25 -28
  229. package/dist/components/component-utils.js.map +1 -1
  230. package/dist/components/component.js +33 -0
  231. package/dist/components/component.js.map +1 -0
  232. package/dist/components/de.js +702 -0
  233. package/dist/components/de.js.map +1 -0
  234. package/dist/components/en-GB.js +117 -0
  235. package/dist/components/en-GB.js.map +1 -0
  236. package/dist/components/field.js +3 -1
  237. package/dist/components/field.js.map +1 -1
  238. package/dist/components/fr.js +575 -0
  239. package/dist/components/fr.js.map +1 -0
  240. package/dist/components/has-slot-content.js +35 -0
  241. package/dist/components/has-slot-content.js.map +1 -0
  242. package/dist/components/i18n.js +96 -0
  243. package/dist/components/i18n.js.map +1 -1
  244. package/dist/components/index.js +11 -3
  245. package/dist/components/index.js.map +1 -1
  246. package/dist/components/index2.js +1158 -1083
  247. package/dist/components/index2.js.map +1 -1
  248. package/dist/components/logger.js +1 -39
  249. package/dist/components/logger.js.map +1 -1
  250. package/dist/components/newsletter-helpers.js +39 -2
  251. package/dist/components/newsletter-helpers.js.map +1 -1
  252. package/dist/components/newsletter-store.js +2 -0
  253. package/dist/components/newsletter-store.js.map +1 -1
  254. package/dist/components/nl-BE.js +540 -0
  255. package/dist/components/nl-BE.js.map +1 -0
  256. package/dist/components/profile-store.js +1 -1
  257. package/dist/components/profile-store.js.map +1 -1
  258. package/dist/components/raw-field.js +116 -7
  259. package/dist/components/raw-field.js.map +1 -1
  260. package/dist/components/redirect-with-token.js +35 -0
  261. package/dist/components/redirect-with-token.js.map +1 -0
  262. package/dist/components/ro.js +576 -0
  263. package/dist/components/ro.js.map +1 -0
  264. package/dist/components/spinner.js +2 -2
  265. package/dist/components/spinner.js.map +1 -1
  266. package/dist/components/submit-button.js +21 -24
  267. package/dist/components/submit-button.js.map +1 -1
  268. package/dist/components/sv.js +595 -0
  269. package/dist/components/sv.js.map +1 -0
  270. package/dist/components/u-conditional-render.js +5 -6
  271. package/dist/components/u-conditional-render.js.map +1 -1
  272. package/dist/components/u-config.js +16 -3
  273. package/dist/components/u-config.js.map +1 -1
  274. package/dist/components/u-email-field.js +1 -1
  275. package/dist/components/u-error-message.js +44 -19
  276. package/dist/components/u-error-message.js.map +1 -1
  277. package/dist/components/u-full-profile.js +1 -1
  278. package/dist/components/u-jump-to-service.js +16 -38
  279. package/dist/components/u-jump-to-service.js.map +1 -1
  280. package/dist/components/u-jump-to-unidy.js +16 -37
  281. package/dist/components/u-jump-to-unidy.js.map +1 -1
  282. package/dist/components/u-logout-button.js +5 -11
  283. package/dist/components/u-logout-button.js.map +1 -1
  284. package/dist/components/u-missing-field.js +5 -2
  285. package/dist/components/u-missing-field.js.map +1 -1
  286. package/dist/components/u-missing-fields-submit-button.js +10 -8
  287. package/dist/components/u-missing-fields-submit-button.js.map +1 -1
  288. package/dist/components/u-newsletter-checkbox.js +1 -1
  289. package/dist/components/u-newsletter-consent-checkbox.js +1 -1
  290. package/dist/components/u-newsletter-logout-button.js +6 -12
  291. package/dist/components/u-newsletter-logout-button.js.map +1 -1
  292. package/dist/components/u-newsletter-preference-checkbox.js +1 -1
  293. package/dist/components/u-newsletter-root.js +35 -12
  294. package/dist/components/u-newsletter-root.js.map +1 -1
  295. package/dist/components/u-newsletter-toggle-subscription-button.js +1 -1
  296. package/dist/components/u-pagination-button.js +3 -4
  297. package/dist/components/u-pagination-button.js.map +1 -1
  298. package/dist/components/u-pagination-page.js +3 -4
  299. package/dist/components/u-pagination-page.js.map +1 -1
  300. package/dist/components/u-reset-password-button.js +4 -8
  301. package/dist/components/u-reset-password-button.js.map +1 -1
  302. package/dist/components/u-signed-in.js +3 -6
  303. package/dist/components/u-signed-in.js.map +1 -1
  304. package/dist/components/u-signin-root.js +3 -6
  305. package/dist/components/u-signin-root.js.map +1 -1
  306. package/dist/components/u-signin-step.js +10 -14
  307. package/dist/components/u-signin-step.js.map +1 -1
  308. package/dist/components/u-social-login-button.js +13 -14
  309. package/dist/components/u-social-login-button.js.map +1 -1
  310. package/dist/components/u-ticketable-export.d.ts +11 -0
  311. package/dist/components/u-ticketable-export.js +93 -0
  312. package/dist/components/u-ticketable-export.js.map +1 -0
  313. package/dist/components/u-ticketable-list.js +256 -2396
  314. package/dist/components/u-ticketable-list.js.map +1 -1
  315. package/dist/esm/_commonjsHelpers-B85MJLTf.js +8 -0
  316. package/dist/esm/_commonjsHelpers-B85MJLTf.js.map +1 -0
  317. package/dist/esm/app-globals-J743qnJf.js +8 -0
  318. package/dist/esm/app-globals-J743qnJf.js.map +1 -0
  319. package/dist/esm/{auth-store-DBlGNGhq.js → auth-store-CSpEdi46.js} +4 -4
  320. package/dist/esm/{auth-store-DBlGNGhq.js.map → auth-store-CSpEdi46.js.map} +1 -1
  321. package/dist/esm/component-qfegGRWr.js +32 -0
  322. package/dist/esm/component-qfegGRWr.js.map +1 -0
  323. package/dist/esm/component-utils-WEof9bTg.js +36 -0
  324. package/dist/esm/component-utils-WEof9bTg.js.map +1 -0
  325. package/dist/esm/de-C6AnCqsA.js +702 -0
  326. package/dist/esm/de-C6AnCqsA.js.map +1 -0
  327. package/dist/esm/en-GB-DO63WPxt.js +117 -0
  328. package/dist/esm/en-GB-DO63WPxt.js.map +1 -0
  329. package/dist/esm/{flash-store-Df2YkLTB.js → flash-store-Dn1Bava8.js} +3 -3
  330. package/dist/esm/{flash-store-Df2YkLTB.js.map → flash-store-Dn1Bava8.js.map} +1 -1
  331. package/dist/esm/fr-C0oU6-EJ.js +575 -0
  332. package/dist/esm/fr-C0oU6-EJ.js.map +1 -0
  333. package/dist/esm/has-slot-content-DSMkJu9G.js +35 -0
  334. package/dist/esm/has-slot-content-DSMkJu9G.js.map +1 -0
  335. package/dist/esm/{i18n-Da7S9Oqf.js → i18n-ioyZxWsT.js} +100 -4
  336. package/dist/esm/{i18n-Da7S9Oqf.js.map → i18n-ioyZxWsT.js.map} +1 -1
  337. package/dist/esm/{index-FTKB5a1d.js → index-BsJDptgj.js} +4 -40
  338. package/dist/esm/index-BsJDptgj.js.map +1 -0
  339. package/dist/esm/{index-BnAYOYR5.js → index-C8kmD3tu.js} +3 -3
  340. package/dist/esm/{index-BnAYOYR5.js.map → index-C8kmD3tu.js.map} +1 -1
  341. package/dist/esm/{index-BVlbCQEX.js → index-kgGjfc-n.js} +1163 -1088
  342. package/dist/esm/index-kgGjfc-n.js.map +1 -0
  343. package/dist/esm/index.js +18 -12
  344. package/dist/esm/index.js.map +1 -1
  345. package/dist/esm/loader.js +4 -4
  346. package/dist/esm/{newsletter-helpers-fCpxzovf.js → newsletter-helpers-DoKGN_Kq.js} +46 -9
  347. package/dist/esm/newsletter-helpers-DoKGN_Kq.js.map +1 -0
  348. package/dist/esm/{newsletter-store-BB618FgS.js → newsletter-store-DpR85vaC.js} +5 -3
  349. package/dist/esm/newsletter-store-DpR85vaC.js.map +1 -0
  350. package/dist/esm/nl-BE-C8uPYb_H.js +540 -0
  351. package/dist/esm/nl-BE-C8uPYb_H.js.map +1 -0
  352. package/dist/esm/{profile-helpers-CXK2X6Ts.js → profile-helpers-BMJy0ei_.js} +4 -4
  353. package/dist/esm/{profile-helpers-CXK2X6Ts.js.map → profile-helpers-BMJy0ei_.js.map} +1 -1
  354. package/dist/esm/{profile-store-CHlSKuTY.js → profile-store-7wBS3gBH.js} +4 -4
  355. package/dist/esm/{profile-store-CHlSKuTY.js.map → profile-store-7wBS3gBH.js.map} +1 -1
  356. package/dist/esm/redirect-with-token-StCLJlSp.js +35 -0
  357. package/dist/esm/redirect-with-token-StCLJlSp.js.map +1 -0
  358. package/dist/esm/ro-BlDHz7d-.js +576 -0
  359. package/dist/esm/ro-BlDHz7d-.js.map +1 -0
  360. package/dist/esm/sdk.js +4 -4
  361. package/dist/esm/sv-B_Gq29K0.js +595 -0
  362. package/dist/esm/sv-B_Gq29K0.js.map +1 -0
  363. package/dist/esm/u-conditional-render.entry.js +14 -14
  364. package/dist/esm/u-conditional-render.entry.js.map +1 -1
  365. package/dist/esm/u-config.entry.js +24 -11
  366. package/dist/esm/u-config.entry.js.map +1 -1
  367. package/dist/esm/u-email-field.entry.js +7 -7
  368. package/dist/esm/u-error-message.entry.js +49 -22
  369. package/dist/esm/u-error-message.entry.js.map +1 -1
  370. package/dist/esm/u-field.u-raw-field.entry.js.map +1 -1
  371. package/dist/esm/u-field_2.entry.js +124 -12
  372. package/dist/esm/u-flash-message.entry.js +3 -3
  373. package/dist/esm/u-full-profile.entry.js +6 -6
  374. package/dist/esm/u-jump-to-service.entry.js +23 -44
  375. package/dist/esm/u-jump-to-service.entry.js.map +1 -1
  376. package/dist/esm/u-jump-to-unidy.entry.js +22 -43
  377. package/dist/esm/u-jump-to-unidy.entry.js.map +1 -1
  378. package/dist/esm/u-logout-button.u-signed-in.entry.js.map +1 -1
  379. package/dist/esm/u-logout-button_2.entry.js +15 -22
  380. package/dist/esm/u-magic-code-field.entry.js +8 -9
  381. package/dist/esm/u-magic-code-field.entry.js.map +1 -1
  382. package/dist/esm/u-missing-field.entry.js +6 -5
  383. package/dist/esm/u-missing-field.entry.js.map +1 -1
  384. package/dist/esm/u-missing-fields-submit-button.entry.js +16 -14
  385. package/dist/esm/u-missing-fields-submit-button.entry.js.map +1 -1
  386. package/dist/esm/u-newsletter-checkbox.entry.js +11 -12
  387. package/dist/esm/u-newsletter-checkbox.entry.js.map +1 -1
  388. package/dist/esm/u-newsletter-consent-checkbox.entry.js +4 -4
  389. package/dist/esm/u-newsletter-logout-button.entry.js +15 -20
  390. package/dist/esm/u-newsletter-logout-button.entry.js.map +1 -1
  391. package/dist/esm/u-newsletter-preference-checkbox.entry.js +11 -12
  392. package/dist/esm/u-newsletter-preference-checkbox.entry.js.map +1 -1
  393. package/dist/esm/u-newsletter-resend-doi-button.entry.js +10 -11
  394. package/dist/esm/u-newsletter-resend-doi-button.entry.js.map +1 -1
  395. package/dist/esm/u-newsletter-root.entry.js +42 -19
  396. package/dist/esm/u-newsletter-root.entry.js.map +1 -1
  397. package/dist/esm/u-newsletter-toggle-subscription-button.entry.js +11 -12
  398. package/dist/esm/u-newsletter-toggle-subscription-button.entry.js.map +1 -1
  399. package/dist/esm/u-pagination-button.entry.js +4 -4
  400. package/dist/esm/u-pagination-button.entry.js.map +1 -1
  401. package/dist/esm/u-pagination-page.entry.js +4 -4
  402. package/dist/esm/u-pagination-page.entry.js.map +1 -1
  403. package/dist/esm/u-passkey.entry.js +8 -9
  404. package/dist/esm/u-passkey.entry.js.map +1 -1
  405. package/dist/esm/u-password-field.entry.js +5 -5
  406. package/dist/esm/u-profile.u-submit-button.entry.js.map +1 -1
  407. package/dist/esm/u-profile_2.entry.js +31 -33
  408. package/dist/esm/u-registration-button.entry.js +5 -5
  409. package/dist/esm/u-reset-password-button.entry.js +12 -15
  410. package/dist/esm/u-reset-password-button.entry.js.map +1 -1
  411. package/dist/esm/u-send-magic-code-button.entry.js +8 -9
  412. package/dist/esm/u-send-magic-code-button.entry.js.map +1 -1
  413. package/dist/esm/u-signin-root.entry.js +6 -8
  414. package/dist/esm/u-signin-root.entry.js.map +1 -1
  415. package/dist/esm/u-signin-step.entry.js +17 -21
  416. package/dist/esm/u-signin-step.entry.js.map +1 -1
  417. package/dist/esm/u-social-login-button.entry.js +16 -15
  418. package/dist/esm/u-social-login-button.entry.js.map +1 -1
  419. package/dist/esm/u-spinner.entry.js +3 -3
  420. package/dist/esm/u-spinner.entry.js.map +1 -1
  421. package/dist/esm/u-ticketable-export.entry.js +74 -0
  422. package/dist/esm/u-ticketable-export.entry.js.map +1 -0
  423. package/dist/esm/u-ticketable-list-D2p21JjR.js +3981 -0
  424. package/dist/esm/u-ticketable-list-D2p21JjR.js.map +1 -0
  425. package/dist/esm/u-ticketable-list.entry.js +10 -6121
  426. package/dist/esm/u-ticketable-list.entry.js.map +1 -1
  427. package/dist/esm/{unidy-store-Bg7IaIMd.js → unidy-store-B5Bf4Vit.js} +3 -3
  428. package/dist/esm/{unidy-store-Bg7IaIMd.js.map → unidy-store-B5Bf4Vit.js.map} +1 -1
  429. package/dist/sdk/index.esm.js +1 -1
  430. package/dist/sdk/index.esm.js.map +1 -1
  431. package/dist/sdk/locales/de.json +16 -0
  432. package/dist/sdk/locales/en.json +16 -0
  433. package/dist/sdk/locales/fr.json +16 -0
  434. package/dist/sdk/locales/it.json +16 -0
  435. package/dist/sdk/locales/nl_be.json +16 -0
  436. package/dist/sdk/locales/ro.json +16 -0
  437. package/dist/sdk/p-02dce5da.entry.js +2 -0
  438. package/dist/sdk/p-02dce5da.entry.js.map +1 -0
  439. package/dist/sdk/p-043c7643.entry.js +2 -0
  440. package/dist/sdk/p-043c7643.entry.js.map +1 -0
  441. package/dist/sdk/p-18c17747.entry.js +2 -0
  442. package/dist/sdk/p-18c17747.entry.js.map +1 -0
  443. package/dist/sdk/p-1a1c1af0.entry.js +2 -0
  444. package/dist/sdk/p-1a1c1af0.entry.js.map +1 -0
  445. package/dist/sdk/p-271781c7.entry.js +2 -0
  446. package/dist/sdk/{p-1a8973a6.entry.js.map → p-271781c7.entry.js.map} +1 -1
  447. package/dist/sdk/p-29473a55.entry.js +2 -0
  448. package/dist/sdk/p-29473a55.entry.js.map +1 -0
  449. package/dist/sdk/p-2a25d62e.entry.js +2 -0
  450. package/dist/sdk/p-2a25d62e.entry.js.map +1 -0
  451. package/dist/sdk/{p-C8lRzJEX.js → p-2bKltz_F.js} +2 -2
  452. package/dist/sdk/{p-C8lRzJEX.js.map → p-2bKltz_F.js.map} +1 -1
  453. package/dist/sdk/p-2cc3a00d.entry.js +2 -0
  454. package/dist/sdk/p-2cc3a00d.entry.js.map +1 -0
  455. package/dist/sdk/p-2f49e0cb.entry.js +2 -0
  456. package/dist/sdk/p-2f49e0cb.entry.js.map +1 -0
  457. package/dist/sdk/p-34f5d201.entry.js +2 -0
  458. package/dist/sdk/p-34f5d201.entry.js.map +1 -0
  459. package/dist/sdk/p-52c4bdd9.entry.js +2 -0
  460. package/dist/sdk/p-52c4bdd9.entry.js.map +1 -0
  461. package/dist/sdk/p-585a0efa.entry.js +2 -0
  462. package/dist/sdk/p-585a0efa.entry.js.map +1 -0
  463. package/dist/sdk/p-60675019.entry.js +2 -0
  464. package/dist/sdk/p-60675019.entry.js.map +1 -0
  465. package/dist/sdk/p-79ef9a70.entry.js +2 -0
  466. package/dist/sdk/p-79ef9a70.entry.js.map +1 -0
  467. package/dist/sdk/p-7d88e21c.entry.js +2 -0
  468. package/dist/sdk/p-7d88e21c.entry.js.map +1 -0
  469. package/dist/sdk/p-7eaf3468.entry.js +2 -0
  470. package/dist/sdk/p-7eaf3468.entry.js.map +1 -0
  471. package/dist/sdk/{p-88beb872.entry.js → p-8412762c.entry.js} +2 -2
  472. package/dist/sdk/p-8ea70c08.entry.js +2 -0
  473. package/dist/sdk/p-8ea70c08.entry.js.map +1 -0
  474. package/dist/sdk/p-946cdb0a.entry.js +2 -0
  475. package/dist/sdk/p-946cdb0a.entry.js.map +1 -0
  476. package/dist/sdk/p-94bb0217.entry.js +2 -0
  477. package/dist/sdk/p-94bb0217.entry.js.map +1 -0
  478. package/dist/sdk/{p-bcca06f1.entry.js → p-96860b09.entry.js} +2 -2
  479. package/dist/sdk/p-B1A6Nu24.js +2 -0
  480. package/dist/sdk/p-B1A6Nu24.js.map +1 -0
  481. package/dist/sdk/p-B85MJLTf.js +2 -0
  482. package/dist/sdk/p-B85MJLTf.js.map +1 -0
  483. package/dist/sdk/p-B8N6Bwsa.js +2 -0
  484. package/dist/sdk/{p-DCG3L43i.js.map → p-B8N6Bwsa.js.map} +1 -1
  485. package/dist/sdk/p-Ba5szISo.js +2 -0
  486. package/dist/sdk/p-Ba5szISo.js.map +1 -0
  487. package/dist/sdk/p-BsJDptgj.js +14 -0
  488. package/dist/sdk/p-BsJDptgj.js.map +1 -0
  489. package/dist/sdk/{p-bpXpOZY_.js → p-C0Mo15qt.js} +2 -2
  490. package/dist/sdk/{p-bpXpOZY_.js.map → p-C0Mo15qt.js.map} +1 -1
  491. package/dist/sdk/p-C10MAuCE.js +2 -0
  492. package/dist/sdk/p-C10MAuCE.js.map +1 -0
  493. package/dist/sdk/p-CTy6pQSg.js +2 -0
  494. package/dist/sdk/p-CTy6pQSg.js.map +1 -0
  495. package/dist/sdk/p-CW6kGAuQ.js +2 -0
  496. package/dist/sdk/p-CW6kGAuQ.js.map +1 -0
  497. package/dist/sdk/{p-DdMKVWx8.js → p-CbSP8My1.js} +2 -2
  498. package/dist/sdk/{p-DdMKVWx8.js.map → p-CbSP8My1.js.map} +1 -1
  499. package/dist/sdk/p-CbzzI4uW.js +2 -0
  500. package/dist/sdk/p-CbzzI4uW.js.map +1 -0
  501. package/dist/sdk/p-CgT6fZjb.js +2 -0
  502. package/dist/sdk/p-CgT6fZjb.js.map +1 -0
  503. package/dist/sdk/p-CuHZ3IkE.js +2 -0
  504. package/dist/sdk/p-CuHZ3IkE.js.map +1 -0
  505. package/dist/sdk/p-Cysk_vik.js +2 -0
  506. package/dist/sdk/p-Cysk_vik.js.map +1 -0
  507. package/dist/sdk/p-D0ut3waq.js +2 -0
  508. package/dist/sdk/p-D0ut3waq.js.map +1 -0
  509. package/dist/sdk/{p-BigbTrKk.js → p-D2Rf-QGm.js} +2 -2
  510. package/dist/sdk/{p-BigbTrKk.js.map → p-D2Rf-QGm.js.map} +1 -1
  511. package/dist/sdk/{p-6rqGeAfT.js → p-D9yFO_ID.js} +2 -2
  512. package/dist/sdk/{p-6rqGeAfT.js.map → p-D9yFO_ID.js.map} +1 -1
  513. package/dist/sdk/p-DD_5soRi.js +2 -0
  514. package/dist/sdk/p-DD_5soRi.js.map +1 -0
  515. package/dist/sdk/p-DHuvvagO.js +2 -0
  516. package/dist/sdk/p-DHuvvagO.js.map +1 -0
  517. package/dist/sdk/p-DSMkJu9G.js +2 -0
  518. package/dist/sdk/p-DSMkJu9G.js.map +1 -0
  519. package/dist/sdk/p-DcirMfca.js +2 -0
  520. package/dist/sdk/p-DcirMfca.js.map +1 -0
  521. package/dist/sdk/p-J0cv5IOA.js +2 -0
  522. package/dist/sdk/p-J0cv5IOA.js.map +1 -0
  523. package/dist/sdk/p-_5evboqW.js +2 -0
  524. package/dist/sdk/{p-DSktNM_k.js.map → p-_5evboqW.js.map} +1 -1
  525. package/dist/sdk/{p-7ee2f2ab.entry.js → p-ac3a6bbf.entry.js} +2 -2
  526. package/dist/sdk/p-b498bcdd.entry.js +2 -0
  527. package/dist/sdk/p-b498bcdd.entry.js.map +1 -0
  528. package/dist/sdk/p-b5dd5b4c.entry.js +2 -0
  529. package/dist/sdk/p-b5dd5b4c.entry.js.map +1 -0
  530. package/dist/sdk/{p-6b061b18.entry.js → p-b99588a8.entry.js} +2 -2
  531. package/dist/sdk/p-bf9c27a8.entry.js +2 -0
  532. package/dist/sdk/p-bf9c27a8.entry.js.map +1 -0
  533. package/dist/sdk/p-c10d9b8e.entry.js +2 -0
  534. package/dist/sdk/p-c10d9b8e.entry.js.map +1 -0
  535. package/dist/sdk/{p-10e20afd.entry.js → p-c2634439.entry.js} +2 -2
  536. package/dist/sdk/p-d6777395.entry.js +2 -0
  537. package/dist/sdk/p-d6777395.entry.js.map +1 -0
  538. package/dist/sdk/p-dbfe7b29.entry.js +2 -0
  539. package/dist/sdk/p-dbfe7b29.entry.js.map +1 -0
  540. package/dist/sdk/p-def4e874.entry.js +2 -0
  541. package/dist/sdk/p-def4e874.entry.js.map +1 -0
  542. package/dist/sdk/p-e872a012.entry.js +2 -0
  543. package/dist/sdk/p-e872a012.entry.js.map +1 -0
  544. package/dist/sdk/p-eaaf3989.entry.js +2 -0
  545. package/dist/sdk/p-eaaf3989.entry.js.map +1 -0
  546. package/dist/sdk/p-fd46b459.entry.js +2 -0
  547. package/dist/sdk/{p-830778eb.entry.js.map → p-fd46b459.entry.js.map} +1 -1
  548. package/dist/sdk/sdk.esm.js +1 -1
  549. package/dist/sdk/u-conditional-render.entry.esm.js.map +1 -1
  550. package/dist/sdk/u-config.entry.esm.js.map +1 -1
  551. package/dist/sdk/u-error-message.entry.esm.js.map +1 -1
  552. package/dist/sdk/u-field.u-raw-field.entry.esm.js.map +1 -1
  553. package/dist/sdk/u-jump-to-service.entry.esm.js.map +1 -1
  554. package/dist/sdk/u-jump-to-unidy.entry.esm.js.map +1 -1
  555. package/dist/sdk/u-logout-button.u-signed-in.entry.esm.js.map +1 -1
  556. package/dist/sdk/u-magic-code-field.entry.esm.js.map +1 -1
  557. package/dist/sdk/u-missing-field.entry.esm.js.map +1 -1
  558. package/dist/sdk/u-missing-fields-submit-button.entry.esm.js.map +1 -1
  559. package/dist/sdk/u-newsletter-checkbox.entry.esm.js.map +1 -1
  560. package/dist/sdk/u-newsletter-logout-button.entry.esm.js.map +1 -1
  561. package/dist/sdk/u-newsletter-preference-checkbox.entry.esm.js.map +1 -1
  562. package/dist/sdk/u-newsletter-resend-doi-button.entry.esm.js.map +1 -1
  563. package/dist/sdk/u-newsletter-root.entry.esm.js.map +1 -1
  564. package/dist/sdk/u-newsletter-toggle-subscription-button.entry.esm.js.map +1 -1
  565. package/dist/sdk/u-pagination-button.entry.esm.js.map +1 -1
  566. package/dist/sdk/u-pagination-page.entry.esm.js.map +1 -1
  567. package/dist/sdk/u-passkey.entry.esm.js.map +1 -1
  568. package/dist/sdk/u-profile.u-submit-button.entry.esm.js.map +1 -1
  569. package/dist/sdk/u-reset-password-button.entry.esm.js.map +1 -1
  570. package/dist/sdk/u-send-magic-code-button.entry.esm.js.map +1 -1
  571. package/dist/sdk/u-signin-root.entry.esm.js.map +1 -1
  572. package/dist/sdk/u-signin-step.entry.esm.js.map +1 -1
  573. package/dist/sdk/u-social-login-button.entry.esm.js.map +1 -1
  574. package/dist/sdk/u-spinner.entry.esm.js.map +1 -1
  575. package/dist/sdk/u-ticketable-export.entry.esm.js.map +1 -0
  576. package/dist/sdk/u-ticketable-list.entry.esm.js.map +1 -1
  577. package/dist/types/api/client.d.ts +1 -1
  578. package/dist/types/api/index.d.ts +4 -4
  579. package/dist/types/api/standalone.d.ts +9 -9
  580. package/dist/types/auth/api/auth.d.ts +2 -3
  581. package/dist/types/auth/api/schemas.d.ts +19 -19
  582. package/dist/types/auth/auth-helpers.d.ts +1 -0
  583. package/dist/types/auth/components/jump-to-service/jump-to-service.d.ts +13 -5
  584. package/dist/types/auth/components/jump-to-unidy/jump-to-unidy.d.ts +13 -9
  585. package/dist/types/auth/components/logout-button/logout-button.d.ts +13 -4
  586. package/dist/types/auth/components/missing-field/missing-field.d.ts +1 -0
  587. package/dist/types/auth/components/missing-fields-submit-button/missing-fields-submit-button.d.ts +14 -2
  588. package/dist/types/auth/components/reset-pass-button/reset-pass-button.d.ts +13 -4
  589. package/dist/types/auth/components/social-logins/social-login-button.d.ts +11 -7
  590. package/dist/types/components.d.ts +73 -0
  591. package/dist/types/logger.d.ts +0 -34
  592. package/dist/types/newsletter/components/logout-button/logout-button.d.ts +13 -4
  593. package/dist/types/newsletter/components/newsletter-root/newsletter-root.d.ts +16 -2
  594. package/dist/types/newsletter/newsletter-helpers.d.ts +8 -2
  595. package/dist/types/newsletter/store/newsletter-store.d.ts +8 -1
  596. package/dist/types/profile/api/profile.d.ts +2 -2
  597. package/dist/types/profile/api/schemas.d.ts +21 -21
  598. package/dist/types/profile/components/raw-field/raw-field.d.ts +14 -2
  599. package/dist/types/shared/base/component.d.ts +46 -0
  600. package/dist/types/shared/base/has-slot-content.d.ts +10 -0
  601. package/dist/types/shared/component-utils.d.ts +20 -12
  602. package/dist/types/shared/components/conditional-render/conditional-render.d.ts +7 -2
  603. package/dist/types/shared/components/config/config.d.ts +7 -2
  604. package/dist/types/shared/components/error-message/error-message.d.ts +14 -2
  605. package/dist/types/shared/components/submit-button/submit-button.d.ts +13 -4
  606. package/dist/types/shared/context-utils.d.ts +73 -0
  607. package/dist/types/shared/utils/redirect-with-token.d.ts +21 -0
  608. package/dist/types/shared/utils/url-utils.d.ts +16 -0
  609. package/dist/types/ticketable/api/schemas.d.ts +16 -2
  610. package/dist/types/ticketable/api/subscriptions.d.ts +8 -3
  611. package/dist/types/ticketable/api/tickets.d.ts +8 -3
  612. package/dist/types/ticketable/components/pagination/pagination-button.d.ts +8 -4
  613. package/dist/types/ticketable/components/pagination/pagination-page.d.ts +8 -4
  614. package/dist/types/ticketable/components/ticketable-export/ticketable-export.d.ts +24 -0
  615. package/dist/types/ticketable/components/ticketable-list/ticketable-list.d.ts +10 -4
  616. package/dist/types/ticketable/index.d.ts +1 -0
  617. package/package.json +6 -2
  618. package/readme.md +248 -27
  619. package/dist/cjs/app-globals-hdkLqF51.js +0 -10
  620. package/dist/cjs/app-globals-hdkLqF51.js.map +0 -1
  621. package/dist/cjs/component-utils-bu3SY4dE.js +0 -42
  622. package/dist/cjs/component-utils-bu3SY4dE.js.map +0 -1
  623. package/dist/cjs/index-B325yXfO.js.map +0 -1
  624. package/dist/cjs/index-BzPYBLYC.js.map +0 -1
  625. package/dist/cjs/newsletter-helpers-hdDC5X-V.js.map +0 -1
  626. package/dist/cjs/newsletter-store-CupsLgO9.js.map +0 -1
  627. package/dist/cjs/pagination-store-zo48QpTm.js +0 -16
  628. package/dist/cjs/pagination-store-zo48QpTm.js.map +0 -1
  629. package/dist/components/pagination-store.js +0 -14
  630. package/dist/components/pagination-store.js.map +0 -1
  631. package/dist/esm/app-globals-iHhGdwBB.js +0 -8
  632. package/dist/esm/app-globals-iHhGdwBB.js.map +0 -1
  633. package/dist/esm/component-utils-BGq0leDV.js +0 -39
  634. package/dist/esm/component-utils-BGq0leDV.js.map +0 -1
  635. package/dist/esm/index-BVlbCQEX.js.map +0 -1
  636. package/dist/esm/index-FTKB5a1d.js.map +0 -1
  637. package/dist/esm/newsletter-helpers-fCpxzovf.js.map +0 -1
  638. package/dist/esm/newsletter-store-BB618FgS.js.map +0 -1
  639. package/dist/esm/pagination-store-DxmcQH8R.js +0 -14
  640. package/dist/esm/pagination-store-DxmcQH8R.js.map +0 -1
  641. package/dist/sdk/p-1a8973a6.entry.js +0 -2
  642. package/dist/sdk/p-35ad60ab.entry.js +0 -2
  643. package/dist/sdk/p-35ad60ab.entry.js.map +0 -1
  644. package/dist/sdk/p-3f352f38.entry.js +0 -2
  645. package/dist/sdk/p-3f352f38.entry.js.map +0 -1
  646. package/dist/sdk/p-468aaf62.entry.js +0 -2
  647. package/dist/sdk/p-468aaf62.entry.js.map +0 -1
  648. package/dist/sdk/p-4e2e6a13.entry.js +0 -2
  649. package/dist/sdk/p-4e2e6a13.entry.js.map +0 -1
  650. package/dist/sdk/p-57c8dc68.entry.js +0 -2
  651. package/dist/sdk/p-57c8dc68.entry.js.map +0 -1
  652. package/dist/sdk/p-594aec0c.entry.js +0 -2
  653. package/dist/sdk/p-594aec0c.entry.js.map +0 -1
  654. package/dist/sdk/p-60c8be64.entry.js +0 -2
  655. package/dist/sdk/p-60c8be64.entry.js.map +0 -1
  656. package/dist/sdk/p-760718d3.entry.js +0 -2
  657. package/dist/sdk/p-760718d3.entry.js.map +0 -1
  658. package/dist/sdk/p-77f541f3.entry.js +0 -2
  659. package/dist/sdk/p-77f541f3.entry.js.map +0 -1
  660. package/dist/sdk/p-830778eb.entry.js +0 -2
  661. package/dist/sdk/p-8839648e.entry.js +0 -2
  662. package/dist/sdk/p-8839648e.entry.js.map +0 -1
  663. package/dist/sdk/p-B6MYe-dh.js +0 -2
  664. package/dist/sdk/p-B6MYe-dh.js.map +0 -1
  665. package/dist/sdk/p-BGq0leDV.js +0 -2
  666. package/dist/sdk/p-BGq0leDV.js.map +0 -1
  667. package/dist/sdk/p-C_UZBwdm.js +0 -2
  668. package/dist/sdk/p-C_UZBwdm.js.map +0 -1
  669. package/dist/sdk/p-CbazSxaZ.js +0 -2
  670. package/dist/sdk/p-CbazSxaZ.js.map +0 -1
  671. package/dist/sdk/p-DCG3L43i.js +0 -2
  672. package/dist/sdk/p-DEUPZOH-.js +0 -2
  673. package/dist/sdk/p-DEUPZOH-.js.map +0 -1
  674. package/dist/sdk/p-DSktNM_k.js +0 -2
  675. package/dist/sdk/p-FTKB5a1d.js +0 -14
  676. package/dist/sdk/p-FTKB5a1d.js.map +0 -1
  677. package/dist/sdk/p-a7ffcff9.entry.js +0 -2
  678. package/dist/sdk/p-a7ffcff9.entry.js.map +0 -1
  679. package/dist/sdk/p-acaba1d5.entry.js +0 -2
  680. package/dist/sdk/p-acaba1d5.entry.js.map +0 -1
  681. package/dist/sdk/p-ae47a7a3.entry.js +0 -2
  682. package/dist/sdk/p-ae47a7a3.entry.js.map +0 -1
  683. package/dist/sdk/p-aec580e4.entry.js +0 -2
  684. package/dist/sdk/p-aec580e4.entry.js.map +0 -1
  685. package/dist/sdk/p-b63438ff.entry.js +0 -2
  686. package/dist/sdk/p-b63438ff.entry.js.map +0 -1
  687. package/dist/sdk/p-baaaa7f5.entry.js +0 -2
  688. package/dist/sdk/p-baaaa7f5.entry.js.map +0 -1
  689. package/dist/sdk/p-bba2da84.entry.js +0 -2
  690. package/dist/sdk/p-bba2da84.entry.js.map +0 -1
  691. package/dist/sdk/p-bc47f42b.entry.js +0 -2
  692. package/dist/sdk/p-bc47f42b.entry.js.map +0 -1
  693. package/dist/sdk/p-bd51e26f.entry.js +0 -2
  694. package/dist/sdk/p-bd51e26f.entry.js.map +0 -1
  695. package/dist/sdk/p-c3552f75.entry.js +0 -2
  696. package/dist/sdk/p-c3552f75.entry.js.map +0 -1
  697. package/dist/sdk/p-d9900482.entry.js +0 -2
  698. package/dist/sdk/p-d9900482.entry.js.map +0 -1
  699. package/dist/sdk/p-e6796c38.entry.js +0 -2
  700. package/dist/sdk/p-e6796c38.entry.js.map +0 -1
  701. package/dist/sdk/p-f272eb38.entry.js +0 -2
  702. package/dist/sdk/p-f272eb38.entry.js.map +0 -1
  703. package/dist/sdk/p-f4a47ef8.entry.js +0 -2
  704. package/dist/sdk/p-f4a47ef8.entry.js.map +0 -1
  705. package/dist/sdk/p-f608e64a.entry.js +0 -2
  706. package/dist/sdk/p-f608e64a.entry.js.map +0 -1
  707. package/dist/sdk/p-f762ac70.entry.js +0 -2
  708. package/dist/sdk/p-f762ac70.entry.js.map +0 -1
  709. package/dist/sdk/p-l6NinBiD.js +0 -2
  710. package/dist/sdk/p-l6NinBiD.js.map +0 -1
  711. /package/dist/sdk/{p-88beb872.entry.js.map → p-8412762c.entry.js.map} +0 -0
  712. /package/dist/sdk/{p-bcca06f1.entry.js.map → p-96860b09.entry.js.map} +0 -0
  713. /package/dist/sdk/{p-7ee2f2ab.entry.js.map → p-ac3a6bbf.entry.js.map} +0 -0
  714. /package/dist/sdk/{p-6b061b18.entry.js.map → p-b99588a8.entry.js.map} +0 -0
  715. /package/dist/sdk/{p-10e20afd.entry.js.map → p-c2634439.entry.js.map} +0 -0
@@ -1,5 +1,3 @@
1
- import { Mixin } from '@stencil/core/internal/client';
2
-
3
1
  const DEFAULT_LOG_LEVEL = "info";
4
2
  const LOG_LEVELS = {
5
3
  trace: 4,
@@ -41,42 +39,6 @@ const createLogger = (prefix) => {
41
39
  return logger;
42
40
  }, {});
43
41
  };
44
- /**
45
- * Stencil mixin factory that adds a logger property to the component.
46
- * The logger automatically uses the component's class name as the prefix.
47
- */
48
- // biome-ignore lint/suspicious/noExplicitAny: if we have no Base we have to invent one
49
- const loggerFactory = (Base = Object) => {
50
- class LoggerMixin extends Base {
51
- /** @internal */
52
- __logger = null;
53
- get logger() {
54
- if (!this.__logger) {
55
- this.__logger = createLogger(this.constructor.name);
56
- }
57
- return this.__logger;
58
- }
59
- }
60
- return LoggerMixin;
61
- };
62
- /**
63
- * Base class for Unidy Stencil components that provides logging functionality.
64
- * Components extending this class get a `this.logger` property that automatically
65
- * prefixes log messages with the component's class name.
66
- *
67
- * @example
68
- * ```tsx
69
- * import { UnidyComponent } from '../logger';
70
- *
71
- * @Component({ tag: 'my-component' })
72
- * export class MyComponent extends UnidyComponent {
73
- * componentDidLoad() {
74
- * this.logger.debug('Component loaded');
75
- * }
76
- * }
77
- * ```
78
- */
79
- const UnidyComponent = Mixin(loggerFactory);
80
42
  // Global logger for non-class contexts (backwards compatibility)
81
43
  const logger = createLogger("");
82
44
  // biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case
@@ -105,7 +67,7 @@ const i18nLogger = {
105
67
  },
106
68
  };
107
69
 
108
- export { UnidyComponent as U, createLogger as c, i18nLogger as i, logger as l };
70
+ export { createLogger as c, i18nLogger as i, logger as l };
109
71
  //# sourceMappingURL=logger.js.map
110
72
 
111
73
  //# sourceMappingURL=logger.js.map
@@ -1 +1 @@
1
- {"file":"logger.js","mappings":";;AAWA,MAAM,iBAAiB,GAAa,M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AW,KAAI;QACrB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAAC,IAAI,CAAC;AACnD,QAAA,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC;KAC9B;;AAED,IAAA,IAAI,EAAE,CAAC,IAAW,KAAI;QACpB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAAC,IAAI,CAAC;AACnD,QAAA,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;KAC7B;;AAED,IAAA,GAAG,EAAE,CAAC,IAAW,KAAI;QACnB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAAC,IAAI,CAAC;AACnD,QAAA,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;KAC7B;;;;;","names":[],"sources":["src/logger.ts"],"sourcesContent":["import { type MixedInCtor, Mixin } from \"@stencil/core\";\nimport type { LoggerModule } from \"i18next\";\n\ndeclare global {\n interface Window {\n setLogLevel: (level: LogLevel) => void;\n }\n}\n\ntype LogLevel = \"error\" | \"warn\" | \"info\" | \"debug\" | \"trace\";\n\nconst DEFAULT_LOG_LEVEL: LogLevel = \"info\";\n\nconst LOG_LEVELS: Record<LogLevel, number> = {\n trace: 4,\n debug: 3,\n info: 2,\n warn: 1,\n error: 0,\n};\n\nconst getLogLevel = (): LogLevel => {\n if (typeof window === \"undefined\") {\n return DEFAULT_LOG_LEVEL;\n }\n return (localStorage.getItem(\"unidy_log_level\") as LogLevel) || DEFAULT_LOG_LEVEL;\n};\n\nconst setLogLevel = (level: LogLevel) => {\n if (typeof window !== \"undefined\") {\n localStorage.setItem(\"unidy_log_level\", level);\n }\n};\n\nif (typeof window !== \"undefined\") {\n window.setLogLevel = setLogLevel;\n}\n\nconst canLog = (level: LogLevel) => LOG_LEVELS[getLogLevel()] >= LOG_LEVELS[level];\n\n// biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case\nconst log = (level: LogLevel, prefix: string, ...args: any[]) => {\n if (canLog(level)) {\n const prefixedArgs = prefix ? [`[${prefix}]`, ...args] : args;\n console[level](...prefixedArgs);\n }\n};\n\nexport interface Logger {\n // biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case\n error: (...args: any[]) => void;\n // biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case\n warn: (...args: any[]) => void;\n // biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case\n info: (...args: any[]) => void;\n // biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case\n debug: (...args: any[]) => void;\n // biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case\n trace: (...args: any[]) => void;\n}\n\nconst LOG_METHODS: LogLevel[] = [\"error\", \"warn\", \"info\", \"debug\", \"trace\"];\n\n/**\n * Creates a logger instance with a specific prefix (typically class/component name)\n */\nexport const createLogger = (prefix: string): Logger => {\n return LOG_METHODS.reduce((logger, level) => {\n // biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case\n logger[level] = (...args: any[]) => log(level, prefix, ...args);\n return logger;\n }, {} as Logger);\n};\n\n/**\n * Stencil mixin factory that adds a logger property to the component.\n * The logger automatically uses the component's class name as the prefix.\n */\n// biome-ignore lint/suspicious/noExplicitAny: if we have no Base we have to invent one\nexport const loggerFactory = <B extends MixedInCtor>(Base: B = Object as any) => {\n class LoggerMixin extends Base {\n /** @internal */\n __logger: Logger | null = null;\n\n get logger(): Logger {\n if (!this.__logger) {\n this.__logger = createLogger(this.constructor.name);\n }\n return this.__logger;\n }\n }\n return LoggerMixin;\n};\n\n/**\n * Base class for Unidy Stencil components that provides logging functionality.\n * Components extending this class get a `this.logger` property that automatically\n * prefixes log messages with the component's class name.\n *\n * @example\n * ```tsx\n * import { UnidyComponent } from '../logger';\n *\n * @Component({ tag: 'my-component' })\n * export class MyComponent extends UnidyComponent {\n * componentDidLoad() {\n * this.logger.debug('Component loaded');\n * }\n * }\n * ```\n */\nexport const UnidyComponent = Mixin(loggerFactory);\n\n// Global logger for non-class contexts (backwards compatibility)\nexport const logger = createLogger(\"\");\n\n// biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case\nconst formatI18nMessage = (args: any[]): { prefix: string; message: string } => {\n const [caller_action, ...messages] = args;\n const [caller, action] = caller_action.split(\": \");\n const message = typeof messages[0] === \"object\" ? action : `${action}: ${messages.join(\" \")}`;\n return { prefix: caller || \"i18next\", message };\n};\n\nexport const i18nLogger: LoggerModule = {\n type: \"logger\",\n // biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case\n error: (args: any[]) => {\n const { prefix, message } = formatI18nMessage(args);\n log(\"error\", prefix, message);\n },\n // biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case\n warn: (args: any[]) => {\n const { prefix, message } = formatI18nMessage(args);\n log(\"warn\", prefix, message);\n },\n // biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case\n log: (args: any[]) => {\n const { prefix, message } = formatI18nMessage(args);\n log(\"info\", prefix, message);\n },\n};\n"],"version":3}
1
+ {"file":"logger.js","mappings":"AAUA,MAAM,iBAAiB,GAAa,MAAM;AAE1C,MAAM,UAAU,GAA6B;AAC3C,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,KAAK,EAAE,CAAC;CACT;AAED,MAAM,WAAW,GAAG,MAAe;AACjC,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACjC,QAAA,OAAO,iBAAiB;;IAE1B,OAAQ,YAAY,CAAC,OAAO,CAAC,iBAAiB,CAAc,IAAI,iBAAiB;AACnF,CAAC;AAED,MAAM,WAAW,GAAG,CAAC,KAAe,KAAI;AACtC,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACjC,QAAA,YAAY,CAAC,OAAO,CAAC,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AC,CAAC,CAAC,KAAK,QAAQ,GAAG,MAAM,GAAG,CAAG,EAAA,MAAM,CAAK,EAAA,EAAA,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA,CAAE;IAC7F,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,SAAS,EAAE,OAAO,EAAE;AACjD,CAAC;AAEY,MAAA,UAAU,GAAiB;AACtC,IAAA,IAAI,EAAE,QAAQ;;AAEd,IAAA,KAAK,EAAE,CAAC,IAAW,KAAI;QACrB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAAC,IAAI,CAAC;AACnD,QAAA,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC;KAC9B;;AAED,IAAA,IAAI,EAAE,CAAC,IAAW,KAAI;QACpB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAAC,IAAI,CAAC;AACnD,QAAA,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;KAC7B;;AAED,IAAA,GAAG,EAAE,CAAC,IAAW,KAAI;QACnB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAAC,IAAI,CAAC;AACnD,QAAA,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;KAC7B;;;;;","names":[],"sources":["src/logger.ts"],"sourcesContent":["import type { LoggerModule } from \"i18next\";\n\ndeclare global {\n interface Window {\n setLogLevel: (level: LogLevel) => void;\n }\n}\n\ntype LogLevel = \"error\" | \"warn\" | \"info\" | \"debug\" | \"trace\";\n\nconst DEFAULT_LOG_LEVEL: LogLevel = \"info\";\n\nconst LOG_LEVELS: Record<LogLevel, number> = {\n trace: 4,\n debug: 3,\n info: 2,\n warn: 1,\n error: 0,\n};\n\nconst getLogLevel = (): LogLevel => {\n if (typeof window === \"undefined\") {\n return DEFAULT_LOG_LEVEL;\n }\n return (localStorage.getItem(\"unidy_log_level\") as LogLevel) || DEFAULT_LOG_LEVEL;\n};\n\nconst setLogLevel = (level: LogLevel) => {\n if (typeof window !== \"undefined\") {\n localStorage.setItem(\"unidy_log_level\", level);\n }\n};\n\nif (typeof window !== \"undefined\") {\n window.setLogLevel = setLogLevel;\n}\n\nconst canLog = (level: LogLevel) => LOG_LEVELS[getLogLevel()] >= LOG_LEVELS[level];\n\n// biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case\nconst log = (level: LogLevel, prefix: string, ...args: any[]) => {\n if (canLog(level)) {\n const prefixedArgs = prefix ? [`[${prefix}]`, ...args] : args;\n console[level](...prefixedArgs);\n }\n};\n\nexport interface Logger {\n // biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case\n error: (...args: any[]) => void;\n // biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case\n warn: (...args: any[]) => void;\n // biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case\n info: (...args: any[]) => void;\n // biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case\n debug: (...args: any[]) => void;\n // biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case\n trace: (...args: any[]) => void;\n}\n\nconst LOG_METHODS: LogLevel[] = [\"error\", \"warn\", \"info\", \"debug\", \"trace\"];\n\n/**\n * Creates a logger instance with a specific prefix (typically class/component name)\n */\nexport const createLogger = (prefix: string): Logger => {\n return LOG_METHODS.reduce((logger, level) => {\n // biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case\n logger[level] = (...args: any[]) => log(level, prefix, ...args);\n return logger;\n }, {} as Logger);\n};\n\n// Global logger for non-class contexts (backwards compatibility)\nexport const logger = createLogger(\"\");\n\n// biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case\nconst formatI18nMessage = (args: any[]): { prefix: string; message: string } => {\n const [caller_action, ...messages] = args;\n const [caller, action] = caller_action.split(\": \");\n const message = typeof messages[0] === \"object\" ? action : `${action}: ${messages.join(\" \")}`;\n return { prefix: caller || \"i18next\", message };\n};\n\nexport const i18nLogger: LoggerModule = {\n type: \"logger\",\n // biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case\n error: (args: any[]) => {\n const { prefix, message } = formatI18nMessage(args);\n log(\"error\", prefix, message);\n },\n // biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case\n warn: (args: any[]) => {\n const { prefix, message } = formatI18nMessage(args);\n log(\"warn\", prefix, message);\n },\n // biome-ignore lint/suspicious/noExplicitAny: External interfaces require the use of any in this case\n log: (args: any[]) => {\n const { prefix, message } = formatI18nMessage(args);\n log(\"info\", prefix, message);\n },\n};\n"],"version":3}
@@ -5,6 +5,24 @@ import { F as Flash } from './flash-store.js';
5
5
  import { n as newsletterStore, p as persist } from './newsletter-store.js';
6
6
 
7
7
  const logger = createLogger("NewsletterHelpers");
8
+ function buildAdditionalFieldsPayload(additionalFields) {
9
+ const payload = {};
10
+ for (const [key, node] of Object.entries(additionalFields)) {
11
+ if (node.value === undefined || node.value === null || (typeof node.value === "string" && node.value.trim() === ""))
12
+ continue;
13
+ if (key.startsWith("custom_attributes.")) {
14
+ // custom attributes
15
+ const attrKey = key.replace("custom_attributes.", "");
16
+ payload.custom_attributes = payload.custom_attributes || {};
17
+ payload.custom_attributes[attrKey] = node.value;
18
+ }
19
+ else {
20
+ // standard user attributes
21
+ payload[key] = node.value;
22
+ }
23
+ }
24
+ return payload;
25
+ }
8
26
  const PERSIST_KEY_PREFIX = "unidy_newsletter_";
9
27
  function newsletterLogout() {
10
28
  newsletterStore.state.preferenceToken = "";
@@ -38,15 +56,19 @@ async function sendLoginEmail(email) {
38
56
  });
39
57
  if (error === null) {
40
58
  Flash.info.addMessage(t("newsletter.success.login_email_sent"));
59
+ return { success: true };
41
60
  }
42
61
  else if (error === "rate_limit_exceeded") {
43
62
  Flash.error.addMessage(t("newsletter.errors.rate_limit_exceeded", { defaultValue: "Too many requests. Please try again later." }));
63
+ return { success: false, error: "rate_limit_exceeded" };
44
64
  }
45
65
  else if (error === "not_found") {
46
66
  Flash.error.addMessage(t("newsletter.errors.login_email_not_found", { defaultValue: "Email address not found" }));
67
+ return { success: false, error: "not_found" };
47
68
  }
48
69
  else {
49
70
  Flash.error.addMessage(t("errors.unknown", { defaultValue: "An unknown error occurred" }));
71
+ return { success: false, error: "unknown" };
50
72
  }
51
73
  }
52
74
  async function fetchSubscriptions() {
@@ -99,7 +121,8 @@ async function handleAlreadySubscribedError(email, errors) {
99
121
  }
100
122
  }
101
123
  async function handleCreateSubscriptionRequest(email, internalNames, showSuccessMessage = true) {
102
- const { checkedNewsletters } = newsletterStore.state;
124
+ const { checkedNewsletters, additionalFields } = newsletterStore.state;
125
+ const additionalFieldsPayload = buildAdditionalFieldsPayload(additionalFields);
103
126
  const [error, response] = await getUnidyClient().newsletters.create({
104
127
  payload: {
105
128
  email,
@@ -108,6 +131,7 @@ async function handleCreateSubscriptionRequest(email, internalNames, showSuccess
108
131
  preference_identifiers: checkedNewsletters[newsletter] || [],
109
132
  })),
110
133
  redirect_to_after_confirmation: redirectToAfterConfirmationUrl(),
134
+ ...(Object.keys(additionalFieldsPayload).length > 0 && { additional_fields: additionalFieldsPayload }),
111
135
  },
112
136
  });
113
137
  if (error === null && response && "results" in response) {
@@ -132,6 +156,7 @@ async function handleCreateSubscriptionRequest(email, internalNames, showSuccess
132
156
  if (error === "newsletter_error" && response) {
133
157
  const errors = response.errors || [];
134
158
  const errorMap = {};
159
+ const additionalFieldErrors = {};
135
160
  // special error case which is handled differently: if user is not authenticated, we send a login email, otherwise we add the
136
161
  // already_subscribed subscriptions to the existing subscriptions
137
162
  const hasAlreadySubscribedError = errors.some((err) => err.error_identifier === "already_subscribed");
@@ -143,15 +168,27 @@ async function handleCreateSubscriptionRequest(email, internalNames, showSuccess
143
168
  errorMap.general = "newsletter_not_found";
144
169
  }
145
170
  const hasInvalidEmailError = errors.some((err) => err.error_identifier === "validation_error" && err.error_details && "email" in err.error_details);
171
+ const userValidationErrors = errors.filter((err) => err.error_identifier === "user_validation_error" && err.error_details);
172
+ for (const err of userValidationErrors) {
173
+ for (const [field, messages] of Object.entries(err.error_details || {})) {
174
+ if (Array.isArray(messages) && messages.length > 0) {
175
+ additionalFieldErrors[field] = messages[0];
176
+ }
177
+ }
178
+ }
146
179
  if (hasInvalidEmailError) {
147
180
  errorMap.email = "invalid_email";
148
181
  }
149
182
  else {
150
183
  for (const err of errors) {
184
+ // Skip user_validation_error - handled via additionalFieldErrors
185
+ if (err.error_identifier === "user_validation_error")
186
+ continue;
151
187
  errorMap[err.meta.newsletter_internal_name] = err.error_identifier;
152
188
  }
153
189
  }
154
190
  newsletterStore.state.errors = errorMap;
191
+ newsletterStore.state.additionalFieldErrors = additionalFieldErrors;
155
192
  }
156
193
  else {
157
194
  Flash.error.addMessage(t("errors.unknown", { defaultValue: "An unknown error occurred" }));
@@ -163,7 +200,7 @@ async function subscribeToNewsletter(internalName, email) {
163
200
  }
164
201
  async function createSubscriptions({ email }) {
165
202
  const internalNames = Object.keys(newsletterStore.state.checkedNewsletters);
166
- await handleCreateSubscriptionRequest(email, internalNames, true);
203
+ return handleCreateSubscriptionRequest(email, internalNames, true);
167
204
  }
168
205
  async function deleteSubscription(internalName) {
169
206
  const { preferenceToken } = newsletterStore.state;
@@ -1 +1 @@
1
- {"file":"newsletter-helpers.js","mappings":";;;;;;AAYA,MAAM,MAAM,GAAG,YAAY,CAAC,mBAAmB,CAAC;AAEhD,MAAM,kBAAkB,GAAG,mBAAmB;SAE9B,gBAAgB,GAAA;AAC9B,IAAA,eAAe,CAAC,KAAK,CAAC,eAAe,GAAG,EAAE;AAC1C,IAAA,eAAe,CAAC,KAAK,CAAC,qBAAqB,GAAG,EAAE;AAChD,IAAA,cAAc,CAAC,UAAU,CAAC,GAAG,kBAAkB,CAAA,eAAA,CAAiB,CAAC;AACjE,IAAA,cAAc,CAAC,UAAU,CAAC,GAAG,kBAAkB,CAAA,KAAA,CAAO,CAAC;AACzD;AAEO,eAAe,SAAS,CAA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CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC;AAC3D,QAAA,gBAAgB,EAAE;AAClB,QAAA,OAAO,KAAK;;IAGd,IAAI,KAAK,KAAK,IAAI,IAAI,IAAI,IAAI,wBAAwB,IAAI,IAAI,EAAE;;QAE9D,MAAM,iBAAiB,GAAG,eAAe,CAAC,KAAK,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,wBAAwB,KAAK,YAAY,CAAC;AAEvI,QAAA,IAAI,iBAAiB,KAAK,EAAE,EAAE;YAC5B,MAAM,oBAAoB,GAAG,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,qBAAqB,CAAC;YAC7E,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;gBACxC,GAAG,oBAAoB,CAAC,iBAAiB,CAAC;AAC1C,gBAAA,sBAAsB,EAAE,IAAI,CAAC,sBAAsB,IAAI,EAAE;aAC1D;AACD,YAAA,eAAe,CAAC,KAAK,CAAC,qBAAqB,GAAG,oBAAoB;;QAGpE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,wCAAwC,CAAC,CAAC;AACrE,QAAA,OAAO,IAAI;;AAGb,IAAA,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,gBAAgB,EAAE,EAAE,YAAY,EAAE,2BAA2B,EAAE,CAAC,CAAC;AAC1F,IAAA,OAAO,KAAK;AACd;;;;","names":[],"sources":["src/newsletter/newsletter-helpers.ts"],"sourcesContent":["import { getUnidyClient } from \"../api\";\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 [error] = await getUnidyClient().newsletters.resendDoi({\n internalName,\n payload: { redirect_to_after_confirmation: redirectToAfterConfirmationUrl() },\n options: preferenceToken ? { preferenceToken } : undefined,\n });\n\n if (error === null) {\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 return false;\n}\n\nexport async function sendLoginEmail(email: string): Promise<void> {\n const [error] = await getUnidyClient().newsletters.sendLoginEmail({\n payload: {\n email,\n redirect_uri: redirectToAfterConfirmationUrl(),\n },\n });\n\n if (error === null) {\n Flash.info.addMessage(t(\"newsletter.success.login_email_sent\"));\n } else if (error === \"rate_limit_exceeded\") {\n Flash.error.addMessage(t(\"newsletter.errors.rate_limit_exceeded\", { defaultValue: \"Too many requests. Please try again later.\" }));\n } else if (error === \"not_found\") {\n Flash.error.addMessage(t(\"newsletter.errors.login_email_not_found\", { defaultValue: \"Email address 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 newsletterStore.state.fetchingSubscriptions = true;\n\n const [error, data] = await getUnidyClient().newsletters.list({\n options: preferenceToken ? { preferenceToken } : undefined,\n });\n\n newsletterStore.state.fetchingSubscriptions = false;\n\n if (error === \"unauthorized\") {\n newsletterLogout();\n Flash.error.addMessage(t(\"newsletter.errors.unauthorized\"));\n return;\n }\n\n if (error === null && data && Array.isArray(data)) {\n newsletterStore.state.existingSubscriptions = 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 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: false, // We don't know the confirmation status for already_subscribed errors\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 { checkedNewsletters } = newsletterStore.state;\n\n const [error, response] = await getUnidyClient().newsletters.create({\n payload: {\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\n if (error === null && response && \"results\" in response) {\n if (response.results.length > 0) {\n const newSubscriptions: ExistingSubscription[] = response.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\" && response) {\n const errors = response.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 [error, data] = await getUnidyClient().newsletters.delete({\n internalName,\n options: preferenceToken ? { preferenceToken } : undefined,\n });\n\n if (error === null) {\n if (data && \"new_preference_token\" in data) {\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 = data.new_preference_token;\n persist(\"preferenceToken\");\n }\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 (error === \"unauthorized\") {\n Flash.error.addMessage(t(\"newsletter.errors.unauthorized\"));\n newsletterLogout();\n return false;\n }\n\n if (error === \"not_found\") {\n return false;\n }\n\n // 422 Unprocessable Entity - silently fail (e.g., trying to delete something that can't be deleted)\n if (error === \"unprocessable_entity\") {\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 preferenceIdentifiers = newsletterStore.state.checkedNewsletters[internalName] || [];\n\n const [error, data] = await getUnidyClient().newsletters.update({\n internalName,\n payload: { preference_identifiers: preferenceIdentifiers },\n options: preferenceToken ? { preferenceToken } : undefined,\n });\n\n if (error === \"unauthorized\") {\n Flash.error.addMessage(t(\"newsletter.errors.unauthorized\"));\n newsletterLogout();\n return false;\n }\n\n if (error === null && data && \"preference_identifiers\" in 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: 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"],"version":3}
1
+ {"file":"newsletter-helpers.js","mappings":";;;;;;AAaA,MAAM,MAAM,GAAG,YAAY,CAAC,mBAAmB,CAAC;AAEhD,SAAS,4BAA4B,CAAC,gBAAsC,EAAA;IAC1E,MAAM,OAAO,GAA4B,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AAiB,KAAK,EAAE,EAAE;YAC5B,MAAM,oBAAoB,GAAG,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,qBAAqB,CAAC;YAC7E,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;gBACxC,GAAG,oBAAoB,CAAC,iBAAiB,CAAC;AAC1C,gBAAA,sBAAsB,EAAE,IAAI,CAAC,sBAAsB,IAAI,EAAE;aAC1D;AACD,YAAA,eAAe,CAAC,KAAK,CAAC,qBAAqB,GAAG,oBAAoB;;QAGpE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,wCAAwC,CAAC,CAAC;AACrE,QAAA,OAAO,IAAI;;AAGb,IAAA,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,gBAAgB,EAAE,EAAE,YAAY,EAAE,2BAA2B,EAAE,CAAC,CAAC;AAC1F,IAAA,OAAO,KAAK;AACd;;;;","names":[],"sources":["src/newsletter/newsletter-helpers.ts"],"sourcesContent":["import { getUnidyClient } from \"../api\";\nimport { t } from \"../i18n\";\nimport { createLogger } from \"../logger\";\nimport { Flash } from \"../shared/store/flash-store\";\nimport {\n type AdditionalFieldsData,\n type CheckedNewsletters,\n type ExistingSubscription,\n type NewsletterErrorIdentifier,\n newsletterStore,\n persist,\n} from \"./store/newsletter-store\";\n\nconst logger = createLogger(\"NewsletterHelpers\");\n\nfunction buildAdditionalFieldsPayload(additionalFields: AdditionalFieldsData): Record<string, unknown> {\n const payload: Record<string, unknown> = {};\n\n for (const [key, node] of Object.entries(additionalFields)) {\n if (node.value === undefined || node.value === null || (typeof node.value === \"string\" && node.value.trim() === \"\")) continue;\n\n if (key.startsWith(\"custom_attributes.\")) {\n // custom attributes\n const attrKey = key.replace(\"custom_attributes.\", \"\");\n payload.custom_attributes = payload.custom_attributes || {};\n (payload.custom_attributes as Record<string, unknown>)[attrKey] = node.value;\n } else {\n // standard user attributes\n payload[key] = node.value;\n }\n }\n\n return payload;\n}\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 [error] = await getUnidyClient().newsletters.resendDoi({\n internalName,\n payload: { redirect_to_after_confirmation: redirectToAfterConfirmationUrl() },\n options: preferenceToken ? { preferenceToken } : undefined,\n });\n\n if (error === null) {\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 return false;\n}\n\nexport type LoginEmailResult = { success: true } | { success: false; error: \"rate_limit_exceeded\" | \"not_found\" | \"unknown\" };\n\nexport async function sendLoginEmail(email: string): Promise<LoginEmailResult> {\n const [error] = await getUnidyClient().newsletters.sendLoginEmail({\n payload: {\n email,\n redirect_uri: redirectToAfterConfirmationUrl(),\n },\n });\n\n if (error === null) {\n Flash.info.addMessage(t(\"newsletter.success.login_email_sent\"));\n return { success: true };\n } else if (error === \"rate_limit_exceeded\") {\n Flash.error.addMessage(t(\"newsletter.errors.rate_limit_exceeded\", { defaultValue: \"Too many requests. Please try again later.\" }));\n return { success: false, error: \"rate_limit_exceeded\" };\n } else if (error === \"not_found\") {\n Flash.error.addMessage(t(\"newsletter.errors.login_email_not_found\", { defaultValue: \"Email address not found\" }));\n return { success: false, error: \"not_found\" };\n } else {\n Flash.error.addMessage(t(\"errors.unknown\", { defaultValue: \"An unknown error occurred\" }));\n return { success: false, error: \"unknown\" };\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 newsletterStore.state.fetchingSubscriptions = true;\n\n const [error, data] = await getUnidyClient().newsletters.list({\n options: preferenceToken ? { preferenceToken } : undefined,\n });\n\n newsletterStore.state.fetchingSubscriptions = false;\n\n if (error === \"unauthorized\") {\n newsletterLogout();\n Flash.error.addMessage(t(\"newsletter.errors.unauthorized\"));\n return;\n }\n\n if (error === null && data && Array.isArray(data)) {\n newsletterStore.state.existingSubscriptions = 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 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: false, // We don't know the confirmation status for already_subscribed errors\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 { checkedNewsletters, additionalFields } = newsletterStore.state;\n\n const additionalFieldsPayload = buildAdditionalFieldsPayload(additionalFields);\n\n const [error, response] = await getUnidyClient().newsletters.create({\n payload: {\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 ...(Object.keys(additionalFieldsPayload).length > 0 && { additional_fields: additionalFieldsPayload }),\n },\n });\n\n if (error === null && response && \"results\" in response) {\n if (response.results.length > 0) {\n const newSubscriptions: ExistingSubscription[] = response.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\" && response) {\n const errors = response.errors || [];\n const errorMap: Record<string, NewsletterErrorIdentifier> = {};\n const additionalFieldErrors: Record<string, string> = {};\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 const userValidationErrors = errors.filter((err) => err.error_identifier === \"user_validation_error\" && err.error_details);\n for (const err of userValidationErrors) {\n for (const [field, messages] of Object.entries(err.error_details || {})) {\n if (Array.isArray(messages) && messages.length > 0) {\n additionalFieldErrors[field] = messages[0];\n }\n }\n }\n\n if (hasInvalidEmailError) {\n errorMap.email = \"invalid_email\";\n } else {\n for (const err of errors) {\n // Skip user_validation_error - handled via additionalFieldErrors\n if (err.error_identifier === \"user_validation_error\") continue;\n errorMap[err.meta.newsletter_internal_name] = err.error_identifier as NewsletterErrorIdentifier;\n }\n }\n\n newsletterStore.state.errors = errorMap;\n newsletterStore.state.additionalFieldErrors = additionalFieldErrors;\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<boolean> {\n const internalNames = Object.keys(newsletterStore.state.checkedNewsletters);\n return 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 [error, data] = await getUnidyClient().newsletters.delete({\n internalName,\n options: preferenceToken ? { preferenceToken } : undefined,\n });\n\n if (error === null) {\n if (data && \"new_preference_token\" in data) {\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 = data.new_preference_token;\n persist(\"preferenceToken\");\n }\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 (error === \"unauthorized\") {\n Flash.error.addMessage(t(\"newsletter.errors.unauthorized\"));\n newsletterLogout();\n return false;\n }\n\n if (error === \"not_found\") {\n return false;\n }\n\n // 422 Unprocessable Entity - silently fail (e.g., trying to delete something that can't be deleted)\n if (error === \"unprocessable_entity\") {\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 preferenceIdentifiers = newsletterStore.state.checkedNewsletters[internalName] || [];\n\n const [error, data] = await getUnidyClient().newsletters.update({\n internalName,\n payload: { preference_identifiers: preferenceIdentifiers },\n options: preferenceToken ? { preferenceToken } : undefined,\n });\n\n if (error === \"unauthorized\") {\n Flash.error.addMessage(t(\"newsletter.errors.unauthorized\"));\n newsletterLogout();\n return false;\n }\n\n if (error === null && data && \"preference_identifiers\" in 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: 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"],"version":3}
@@ -12,6 +12,8 @@ const initialState = {
12
12
  preferenceToken: getPersistedValue("preferenceToken") ?? "",
13
13
  checkedNewsletters: {},
14
14
  defaultPreferences: {},
15
+ additionalFields: {},
16
+ additionalFieldErrors: {},
15
17
  fetchingSubscriptions: false,
16
18
  existingSubscriptions: [],
17
19
  errors: {},
@@ -1 +1 @@
1
- {"file":"newsletter-store.js","mappings":";;AAyCA,MAAM,kBAAkB,GAAG,mBAAmB;AAEjC,MAAA,OAAO,GAAG,CAAC,GAAgC,KAAI;AAC1D,IAAA,cAAc,CAAC,OAAO,CAAC,CAAG,EAAA,kBAAkB,GAAG,GAAG,CAAA,CAAE,EAAE,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACnF;AAEA,MAAM,iBAAiB,GAAG,CAAC,GAAgC,KAAI;IAC7D,OAAO,cAAc,CAAC,OAAO,CAAC,CAAA,EAAG,kBAAkB,CAAG,EAAA,GAAG,CAAE,CAAA,CAAC;AAC9D,CAAC;AAED,MAAM,YAAY,GAAoB;AACpC,IAAA,KAAK,EAAE,iBAAiB,CAAC,OAAO,CAAC,IAAI,EAAE;AACvC,IAAA,eAAe,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,IAAI,EAAE;AAC3D,IAAA,kBAAkB,EAAE,EAAE;AACtB,IAAA,kBAAkB,EAAE,EAAE;AAEtB,IAAA,qBAAqB,EAAE,KAAK;AAC5B,IAAA,qBAAqB,EAAE,EAAE;AAEzB,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,YAAY,EAAE,KAAK;AACnB,IAAA,eAAe,EAAE,KAAK;AAEtB,IAAA,eAAe,EAAE,KAAK;CACvB;MAEY,eAAe,GAAG,WAAW,CAAkB,YAAY;MAE3D,sBAAsB,GAAG,CAAC,YAAoC,EAAE,oBAA0C,KAAI;AACzH,IAAA,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC,kBAAkB,CAAC,YAAY,CAAC,IAAI,IAAI,GAAG,EAAE;AACnF,IAAA,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC;AAChC,IAAA,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;AACjC,IAAA,eAAe,CAAC,KAAK,CAAC,kBAAkB,GAAG;AACzC,QAAA,GAAG,eAAe,CAAC,KAAK,CAAC,kBAAkB;QAC3C,CAAC,YAAY,GAAG,OAAO;KACxB;AACH;;;;","names":[],"sources":["src/newsletter/store/newsletter-store.ts"],"sourcesContent":["import { createStore } from \"@stencil/store\";\n\nexport type NewsletterErrorIdentifier =\n | \"unconfirmed\"\n | \"already_subscribed\"\n | \"consent_required\"\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 consentGiven: boolean;\n consentRequired: boolean;\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 consentGiven: false,\n consentRequired: false,\n\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 const consentRequired = newsletterStore.state.consentRequired;\n newsletterStore.state = initialState;\n newsletterStore.state.consentRequired = consentRequired;\n};\n"],"version":3}
1
+ {"file":"newsletter-store.js","mappings":";;AAmDA,MAAM,kBAAkB,GAAG,mBAAmB;AAEjC,MAAA,OAAO,GAAG,CAAC,GAAgC,KAAI;AAC1D,IAAA,cAAc,CAAC,OAAO,CAAC,CAAG,EAAA,kBAAkB,GAAG,GAAG,CAAA,CAAE,EAAE,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACnF;AAEA,MAAM,iBAAiB,GAAG,CAAC,GAAgC,KAAI;IAC7D,OAAO,cAAc,CAAC,OAAO,CAAC,CAAA,EAAG,kBAAkB,CAAG,EAAA,GAAG,CAAE,CAAA,CAAC;AAC9D,CAAC;AAED,MAAM,YAAY,GAAoB;AACpC,IAAA,KAAK,EAAE,iBAAiB,CAAC,OAAO,CAAC,IAAI,EAAE;AACvC,IAAA,eAAe,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,IAAI,EAAE;AAC3D,IAAA,kBAAkB,EAAE,EAAE;AACtB,IAAA,kBAAkB,EAAE,EAAE;AACtB,IAAA,gBAAgB,EAAE,EAAE;AACpB,IAAA,qBAAqB,EAAE,EAAE;AAEzB,IAAA,qBAAqB,EAAE,KAAK;AAC5B,IAAA,qBAAqB,EAAE,EAAE;AAEzB,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,YAAY,EAAE,KAAK;AACnB,IAAA,eAAe,EAAE,KAAK;AAEtB,IAAA,eAAe,EAAE,KAAK;CACvB;MAEY,eAAe,GAAG,WAAW,CAAkB,YAAY;MAE3D,sBAAsB,GAAG,CAAC,YAAoC,EAAE,oBAA0C,KAAI;AACzH,IAAA,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC,kBAAkB,CAAC,YAAY,CAAC,IAAI,IAAI,GAAG,EAAE;AACnF,IAAA,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC;AAChC,IAAA,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;AACjC,IAAA,eAAe,CAAC,KAAK,CAAC,kBAAkB,GAAG;AACzC,QAAA,GAAG,eAAe,CAAC,KAAK,CAAC,kBAAkB;QAC3C,CAAC,YAAY,GAAG,OAAO;KACxB;AACH;;;;","names":[],"sources":["src/newsletter/store/newsletter-store.ts"],"sourcesContent":["import { createStore } from \"@stencil/store\";\n\nexport type NewsletterErrorIdentifier =\n | \"unconfirmed\"\n | \"already_subscribed\"\n | \"consent_required\"\n | \"invalid_email\"\n | \"newsletter_not_found\"\n | \"preferences_not_found\"\n | \"invalid_preference_token\"\n | \"internal_server_error\"\n | \"user_validation_error\"\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\nexport interface AdditionalFieldNode {\n value?: string | string[];\n type?: string;\n}\nexport type AdditionalFieldsData = Record<string, AdditionalFieldNode>;\n\ninterface NewsletterState {\n email: string;\n preferenceToken: string;\n checkedNewsletters: CheckedNewsletters;\n defaultPreferences: DefaultPreferences;\n additionalFields: AdditionalFieldsData;\n additionalFieldErrors: Record<string, string>;\n\n fetchingSubscriptions: boolean;\n existingSubscriptions: ExistingSubscription[];\n\n errors: Record<string, NewsletterErrorIdentifier>;\n consentGiven: boolean;\n consentRequired: boolean;\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 additionalFields: {},\n additionalFieldErrors: {},\n\n fetchingSubscriptions: false,\n existingSubscriptions: [],\n\n errors: {},\n consentGiven: false,\n consentRequired: false,\n\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 const consentRequired = newsletterStore.state.consentRequired;\n newsletterStore.state = initialState;\n newsletterStore.state.consentRequired = consentRequired;\n};\n"],"version":3}