@unidy.io/sdk 1.1.4 → 1.2.0-alpha2

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 (398) hide show
  1. package/dist/cjs/app-globals-DSKjcXX_.js.map +1 -1
  2. package/dist/cjs/{auth-store-BaxuIp4z.js → auth-store-DC9EVec8.js} +2 -3
  3. package/dist/cjs/auth-store-DC9EVec8.js.map +1 -0
  4. package/dist/cjs/{i18n-BoDZ8kd2.js → i18n-BAZB-eHh.js} +2 -8
  5. package/dist/cjs/{i18n-BoDZ8kd2.js.map → i18n-BAZB-eHh.js.map} +1 -1
  6. package/dist/cjs/{index-R2MKLaem.js → index-CvFbf5-D.js} +1477 -1105
  7. package/dist/cjs/index-CvFbf5-D.js.map +1 -0
  8. package/dist/cjs/index.cjs.js +6 -5
  9. package/dist/cjs/index.cjs.js.map +1 -1
  10. package/dist/cjs/{newsletter-helpers-DR0vsegt.js → newsletter-helpers-Dj0yYHZf.js} +61 -74
  11. package/dist/cjs/newsletter-helpers-Dj0yYHZf.js.map +1 -0
  12. package/dist/cjs/{profile-helpers-B2h2III_.js → profile-helpers-D66Ycaft.js} +3 -3
  13. package/dist/cjs/{profile-helpers-B2h2III_.js.map → profile-helpers-D66Ycaft.js.map} +1 -1
  14. package/dist/cjs/u-conditional-render.cjs.entry.js +5 -6
  15. package/dist/cjs/u-conditional-render.entry.cjs.js.map +1 -1
  16. package/dist/cjs/u-config.cjs.entry.js +5 -6
  17. package/dist/cjs/u-config.entry.cjs.js.map +1 -1
  18. package/dist/cjs/u-email-field.cjs.entry.js +2 -2
  19. package/dist/cjs/u-error-message.cjs.entry.js +3 -3
  20. package/dist/cjs/u-error-message.entry.cjs.js.map +1 -1
  21. package/dist/cjs/u-field.u-raw-field.entry.cjs.js.map +1 -1
  22. package/dist/cjs/u-field_2.cjs.entry.js +2 -2
  23. package/dist/cjs/u-full-profile.cjs.entry.js +1 -1
  24. package/dist/cjs/u-logout-button.cjs.entry.js +6 -7
  25. package/dist/cjs/u-logout-button.entry.cjs.js.map +1 -1
  26. package/dist/cjs/u-magic-code-field.cjs.entry.js +5 -6
  27. package/dist/cjs/u-magic-code-field.entry.cjs.js.map +1 -1
  28. package/dist/cjs/u-missing-field.cjs.entry.js +1 -1
  29. package/dist/cjs/u-missing-fields-submit-button.cjs.entry.js +9 -5
  30. package/dist/cjs/u-missing-fields-submit-button.entry.cjs.js.map +1 -1
  31. package/dist/cjs/u-newsletter-checkbox.cjs.entry.js +5 -6
  32. package/dist/cjs/u-newsletter-checkbox.entry.cjs.js.map +1 -1
  33. package/dist/cjs/u-newsletter-logout-button.cjs.entry.js +6 -7
  34. package/dist/cjs/u-newsletter-logout-button.entry.cjs.js.map +1 -1
  35. package/dist/cjs/u-newsletter-preference-checkbox.cjs.entry.js +5 -6
  36. package/dist/cjs/u-newsletter-preference-checkbox.entry.cjs.js.map +1 -1
  37. package/dist/cjs/u-newsletter-resend-doi-button.cjs.entry.js +4 -5
  38. package/dist/cjs/u-newsletter-resend-doi-button.entry.cjs.js.map +1 -1
  39. package/dist/cjs/u-newsletter-root.cjs.entry.js +5 -6
  40. package/dist/cjs/u-newsletter-root.entry.cjs.js.map +1 -1
  41. package/dist/cjs/u-newsletter-toggle-subscription-button.cjs.entry.js +4 -5
  42. package/dist/cjs/u-newsletter-toggle-subscription-button.entry.cjs.js.map +1 -1
  43. package/dist/cjs/u-passkey.cjs.entry.js +5 -6
  44. package/dist/cjs/u-passkey.entry.cjs.js.map +1 -1
  45. package/dist/cjs/u-password-field.cjs.entry.js +2 -2
  46. package/dist/cjs/u-profile.u-submit-button.entry.cjs.js.map +1 -1
  47. package/dist/cjs/u-profile_2.cjs.entry.js +35 -55
  48. package/dist/cjs/u-registration-button.cjs.entry.js +2 -2
  49. package/dist/cjs/u-reset-password-button.cjs.entry.js +4 -5
  50. package/dist/cjs/u-reset-password-button.entry.cjs.js.map +1 -1
  51. package/dist/cjs/u-send-magic-code-button.cjs.entry.js +5 -6
  52. package/dist/cjs/u-send-magic-code-button.entry.cjs.js.map +1 -1
  53. package/dist/cjs/u-signed-in.cjs.entry.js +1 -1
  54. package/dist/cjs/u-signin-root.cjs.entry.js +1 -1
  55. package/dist/cjs/u-signin-step.cjs.entry.js +5 -6
  56. package/dist/cjs/u-signin-step.entry.cjs.js.map +1 -1
  57. package/dist/cjs/u-signin-strategy.cjs.entry.js +1 -1
  58. package/dist/cjs/u-social-login-button.cjs.entry.js +2 -2
  59. package/dist/cjs/u-spinner.cjs.entry.js +1 -1
  60. package/dist/cjs/u-spinner.entry.cjs.js.map +1 -1
  61. package/dist/cjs/u-ticketable-list.cjs.entry.js +39 -29
  62. package/dist/cjs/u-ticketable-list.entry.cjs.js.map +1 -1
  63. package/dist/collection/api/base-client.js +129 -0
  64. package/dist/collection/api/base-client.js.map +1 -0
  65. package/dist/collection/api/base-service.js +72 -0
  66. package/dist/collection/api/base-service.js.map +1 -0
  67. package/dist/collection/api/client.js +18 -139
  68. package/dist/collection/api/client.js.map +1 -1
  69. package/dist/collection/api/index.js +25 -5
  70. package/dist/collection/api/index.js.map +1 -1
  71. package/dist/collection/api/shared.js +11 -2
  72. package/dist/collection/api/shared.js.map +1 -1
  73. package/dist/collection/api/standalone.js +88 -0
  74. package/dist/collection/api/standalone.js.map +1 -0
  75. package/dist/collection/auth/api/auth.js +66 -124
  76. package/dist/collection/auth/api/auth.js.map +1 -1
  77. package/dist/collection/auth/api/schemas.js +78 -0
  78. package/dist/collection/auth/api/schemas.js.map +1 -0
  79. package/dist/collection/auth/auth-helpers.js +47 -36
  80. package/dist/collection/auth/auth-helpers.js.map +1 -1
  81. package/dist/collection/auth/components/missing-fields-submit-button/missing-fields-submit-button.js +4 -1
  82. package/dist/collection/auth/components/missing-fields-submit-button/missing-fields-submit-button.js.map +1 -1
  83. package/dist/collection/auth/components/password-field/password-field.js +1 -1
  84. package/dist/collection/auth/passkey-auth.js +8 -6
  85. package/dist/collection/auth/passkey-auth.js.map +1 -1
  86. package/dist/collection/auth/store/auth-store.js +0 -1
  87. package/dist/collection/auth/store/auth-store.js.map +1 -1
  88. package/dist/collection/locales/de.json +0 -1
  89. package/dist/collection/locales/en.json +0 -1
  90. package/dist/collection/locales/fr.json +0 -1
  91. package/dist/collection/locales/it.json +0 -1
  92. package/dist/collection/locales/nl_be.json +0 -1
  93. package/dist/collection/locales/ro.json +0 -1
  94. package/dist/collection/newsletter/api/newsletters.js +192 -167
  95. package/dist/collection/newsletter/api/newsletters.js.map +1 -1
  96. package/dist/collection/newsletter/api/schemas.js +112 -0
  97. package/dist/collection/newsletter/api/schemas.js.map +1 -0
  98. package/dist/collection/newsletter/newsletter-helpers.js +57 -70
  99. package/dist/collection/newsletter/newsletter-helpers.js.map +1 -1
  100. package/dist/collection/profile/api/profile.js +56 -155
  101. package/dist/collection/profile/api/profile.js.map +1 -1
  102. package/dist/collection/profile/api/schemas.js +120 -0
  103. package/dist/collection/profile/api/schemas.js.map +1 -0
  104. package/dist/collection/profile/components/field/field.css +1 -1
  105. package/dist/collection/profile/components/profile/profile.js +35 -101
  106. package/dist/collection/profile/components/profile/profile.js.map +1 -1
  107. package/dist/collection/shared/components/config/config.js +2 -2
  108. package/dist/collection/shared/components/error-message/error-message.js +3 -3
  109. package/dist/collection/shared/components/error-message/error-message.js.map +1 -1
  110. package/dist/collection/shared/components/spinner/spinner.css +1 -1
  111. package/dist/collection/shared/components/submit-button/submit-button.css +1 -1
  112. package/dist/collection/ticketable/api/schemas.js +58 -9
  113. package/dist/collection/ticketable/api/schemas.js.map +1 -1
  114. package/dist/collection/ticketable/api/subscriptions.js +13 -44
  115. package/dist/collection/ticketable/api/subscriptions.js.map +1 -1
  116. package/dist/collection/ticketable/api/ticketable-service.js +74 -0
  117. package/dist/collection/ticketable/api/ticketable-service.js.map +1 -0
  118. package/dist/collection/ticketable/api/tickets.js +13 -45
  119. package/dist/collection/ticketable/api/tickets.js.map +1 -1
  120. package/dist/collection/ticketable/components/ticketable-list/ticketable-list.js +37 -77
  121. package/dist/collection/ticketable/components/ticketable-list/ticketable-list.js.map +1 -1
  122. package/dist/components/auth-store.js +0 -1
  123. package/dist/components/auth-store.js.map +1 -1
  124. package/dist/components/field.js +1 -1
  125. package/dist/components/field.js.map +1 -1
  126. package/dist/components/i18n.js +0 -6
  127. package/dist/components/i18n.js.map +1 -1
  128. package/dist/components/index.js +1 -2
  129. package/dist/components/index.js.map +1 -1
  130. package/dist/components/index2.js +1475 -1106
  131. package/dist/components/index2.js.map +1 -1
  132. package/dist/components/newsletter-helpers.js +57 -70
  133. package/dist/components/newsletter-helpers.js.map +1 -1
  134. package/dist/components/profile.js +34 -54
  135. package/dist/components/profile.js.map +1 -1
  136. package/dist/components/spinner.js +1 -1
  137. package/dist/components/spinner.js.map +1 -1
  138. package/dist/components/submit-button.js +1 -1
  139. package/dist/components/submit-button.js.map +1 -1
  140. package/dist/components/u-config.js +1 -2
  141. package/dist/components/u-config.js.map +1 -1
  142. package/dist/components/u-error-message.js +2 -2
  143. package/dist/components/u-error-message.js.map +1 -1
  144. package/dist/components/u-logout-button.js +1 -1
  145. package/dist/components/u-magic-code-field.js +1 -1
  146. package/dist/components/u-missing-fields-submit-button.js +4 -1
  147. package/dist/components/u-missing-fields-submit-button.js.map +1 -1
  148. package/dist/components/u-newsletter-root.js +1 -1
  149. package/dist/components/u-passkey.js +1 -1
  150. package/dist/components/u-reset-password-button.js +1 -1
  151. package/dist/components/u-send-magic-code-button.js +1 -1
  152. package/dist/components/u-signin-step.js +1 -1
  153. package/dist/components/u-ticketable-list.js +36 -29
  154. package/dist/components/u-ticketable-list.js.map +1 -1
  155. package/dist/esm/app-globals-CPU9ZcqZ.js.map +1 -1
  156. package/dist/esm/{auth-store-CVvBlKGv.js → auth-store-BMqUdTpC.js} +2 -3
  157. package/dist/esm/auth-store-BMqUdTpC.js.map +1 -0
  158. package/dist/esm/{i18n-CLdWzy5J.js → i18n-BANodpxG.js} +2 -8
  159. package/dist/esm/{i18n-CLdWzy5J.js.map → i18n-BANodpxG.js.map} +1 -1
  160. package/dist/esm/{index-DSDkaHWI.js → index-2p1QEJrx.js} +1477 -1108
  161. package/dist/esm/index-2p1QEJrx.js.map +1 -0
  162. package/dist/esm/index.js +3 -4
  163. package/dist/esm/index.js.map +1 -1
  164. package/dist/esm/{newsletter-helpers-Dc_24im3.js → newsletter-helpers-D64LTcSM.js} +61 -74
  165. package/dist/esm/newsletter-helpers-D64LTcSM.js.map +1 -0
  166. package/dist/esm/{profile-helpers-CglNd6Nw.js → profile-helpers-DAvXZ9Uj.js} +3 -3
  167. package/dist/esm/{profile-helpers-CglNd6Nw.js.map → profile-helpers-DAvXZ9Uj.js.map} +1 -1
  168. package/dist/esm/u-conditional-render.entry.js +5 -6
  169. package/dist/esm/u-conditional-render.entry.js.map +1 -1
  170. package/dist/esm/u-config.entry.js +4 -5
  171. package/dist/esm/u-config.entry.js.map +1 -1
  172. package/dist/esm/u-email-field.entry.js +2 -2
  173. package/dist/esm/u-error-message.entry.js +3 -3
  174. package/dist/esm/u-error-message.entry.js.map +1 -1
  175. package/dist/esm/u-field.u-raw-field.entry.js.map +1 -1
  176. package/dist/esm/u-field_2.entry.js +2 -2
  177. package/dist/esm/u-full-profile.entry.js +1 -1
  178. package/dist/esm/u-logout-button.entry.js +5 -6
  179. package/dist/esm/u-logout-button.entry.js.map +1 -1
  180. package/dist/esm/u-magic-code-field.entry.js +4 -5
  181. package/dist/esm/u-magic-code-field.entry.js.map +1 -1
  182. package/dist/esm/u-missing-field.entry.js +1 -1
  183. package/dist/esm/u-missing-fields-submit-button.entry.js +9 -5
  184. package/dist/esm/u-missing-fields-submit-button.entry.js.map +1 -1
  185. package/dist/esm/u-newsletter-checkbox.entry.js +5 -6
  186. package/dist/esm/u-newsletter-checkbox.entry.js.map +1 -1
  187. package/dist/esm/u-newsletter-logout-button.entry.js +6 -7
  188. package/dist/esm/u-newsletter-logout-button.entry.js.map +1 -1
  189. package/dist/esm/u-newsletter-preference-checkbox.entry.js +5 -6
  190. package/dist/esm/u-newsletter-preference-checkbox.entry.js.map +1 -1
  191. package/dist/esm/u-newsletter-resend-doi-button.entry.js +4 -5
  192. package/dist/esm/u-newsletter-resend-doi-button.entry.js.map +1 -1
  193. package/dist/esm/u-newsletter-root.entry.js +4 -5
  194. package/dist/esm/u-newsletter-root.entry.js.map +1 -1
  195. package/dist/esm/u-newsletter-toggle-subscription-button.entry.js +4 -5
  196. package/dist/esm/u-newsletter-toggle-subscription-button.entry.js.map +1 -1
  197. package/dist/esm/u-passkey.entry.js +4 -5
  198. package/dist/esm/u-passkey.entry.js.map +1 -1
  199. package/dist/esm/u-password-field.entry.js +2 -2
  200. package/dist/esm/u-profile.u-submit-button.entry.js.map +1 -1
  201. package/dist/esm/u-profile_2.entry.js +36 -56
  202. package/dist/esm/u-registration-button.entry.js +2 -2
  203. package/dist/esm/u-reset-password-button.entry.js +3 -4
  204. package/dist/esm/u-reset-password-button.entry.js.map +1 -1
  205. package/dist/esm/u-send-magic-code-button.entry.js +4 -5
  206. package/dist/esm/u-send-magic-code-button.entry.js.map +1 -1
  207. package/dist/esm/u-signed-in.entry.js +1 -1
  208. package/dist/esm/u-signin-root.entry.js +1 -1
  209. package/dist/esm/u-signin-step.entry.js +4 -5
  210. package/dist/esm/u-signin-step.entry.js.map +1 -1
  211. package/dist/esm/u-signin-strategy.entry.js +1 -1
  212. package/dist/esm/u-social-login-button.entry.js +2 -2
  213. package/dist/esm/u-spinner.entry.js +1 -1
  214. package/dist/esm/u-spinner.entry.js.map +1 -1
  215. package/dist/esm/u-ticketable-list.entry.js +40 -30
  216. package/dist/esm/u-ticketable-list.entry.js.map +1 -1
  217. package/dist/sdk/index.esm.js +1 -1
  218. package/dist/sdk/index.esm.js.map +1 -1
  219. package/dist/sdk/locales/de.json +0 -1
  220. package/dist/sdk/locales/en.json +0 -1
  221. package/dist/sdk/locales/fr.json +0 -1
  222. package/dist/sdk/locales/it.json +0 -1
  223. package/dist/sdk/locales/nl_be.json +0 -1
  224. package/dist/sdk/locales/ro.json +0 -1
  225. package/dist/sdk/{p-5babee6b.entry.js → p-098eef67.entry.js} +2 -2
  226. package/dist/sdk/p-0e74de96.entry.js +2 -0
  227. package/dist/sdk/p-0e74de96.entry.js.map +1 -0
  228. package/dist/sdk/p-0ed36cbb.entry.js +2 -0
  229. package/dist/sdk/p-0ed36cbb.entry.js.map +1 -0
  230. package/dist/sdk/p-1149e044.entry.js +2 -0
  231. package/dist/sdk/p-1149e044.entry.js.map +1 -0
  232. package/dist/sdk/p-16d763fd.entry.js +2 -0
  233. package/dist/sdk/p-16d763fd.entry.js.map +1 -0
  234. package/dist/sdk/p-1d404c36.entry.js +2 -0
  235. package/dist/sdk/p-1d404c36.entry.js.map +1 -0
  236. package/dist/sdk/p-32da9922.entry.js +2 -0
  237. package/dist/sdk/p-32da9922.entry.js.map +1 -0
  238. package/dist/sdk/p-3d3a9c90.entry.js +2 -0
  239. package/dist/sdk/p-3d3a9c90.entry.js.map +1 -0
  240. package/dist/sdk/p-43024bd6.entry.js +2 -0
  241. package/dist/sdk/p-43024bd6.entry.js.map +1 -0
  242. package/dist/sdk/{p-e2e7061b.entry.js → p-5da49d00.entry.js} +2 -2
  243. package/dist/sdk/{p-f961fbea.entry.js → p-67af762e.entry.js} +2 -2
  244. package/dist/sdk/{p-f961fbea.entry.js.map → p-67af762e.entry.js.map} +1 -1
  245. package/dist/sdk/p-7099bd56.entry.js +2 -0
  246. package/dist/sdk/p-7099bd56.entry.js.map +1 -0
  247. package/dist/sdk/p-745742f1.entry.js +2 -0
  248. package/dist/sdk/{p-9e71a36c.entry.js → p-74e6523f.entry.js} +2 -2
  249. package/dist/sdk/p-86d16818.entry.js +2 -0
  250. package/dist/sdk/{p-effaf86b.entry.js.map → p-86d16818.entry.js.map} +1 -1
  251. package/dist/sdk/{p-DA84OuuU.js → p-BasehRhW.js} +2 -2
  252. package/dist/sdk/{p-DA84OuuU.js.map → p-BasehRhW.js.map} +1 -1
  253. package/dist/sdk/p-C4aHo4nN.js +2 -0
  254. package/dist/sdk/p-C4aHo4nN.js.map +1 -0
  255. package/dist/sdk/p-CFiZLMAA.js.map +1 -1
  256. package/dist/sdk/p-DGDhaqCd.js +2 -0
  257. package/dist/sdk/p-DGDhaqCd.js.map +1 -0
  258. package/dist/sdk/{p-CbRhHGU5.js → p-DSq94RWc.js} +2 -2
  259. package/dist/sdk/{p-CbRhHGU5.js.map → p-DSq94RWc.js.map} +1 -1
  260. package/dist/sdk/p-DSwwVdp1.js +2 -0
  261. package/dist/sdk/p-DSwwVdp1.js.map +1 -0
  262. package/dist/sdk/p-a037bbe3.entry.js +2 -0
  263. package/dist/sdk/p-a037bbe3.entry.js.map +1 -0
  264. package/dist/sdk/p-adcb7911.entry.js +2 -0
  265. package/dist/sdk/p-adcb7911.entry.js.map +1 -0
  266. package/dist/sdk/{p-39b61f33.entry.js → p-bbbec3d4.entry.js} +2 -2
  267. package/dist/sdk/{p-f232929b.entry.js → p-c2fba7c8.entry.js} +2 -2
  268. package/dist/sdk/p-c4618822.entry.js +2 -0
  269. package/dist/sdk/p-c4618822.entry.js.map +1 -0
  270. package/dist/sdk/p-ca4e57f2.entry.js +2 -0
  271. package/dist/sdk/p-ca4e57f2.entry.js.map +1 -0
  272. package/dist/sdk/p-ce4ab77c.entry.js +2 -0
  273. package/dist/sdk/p-ce4ab77c.entry.js.map +1 -0
  274. package/dist/sdk/p-d143e097.entry.js +2 -0
  275. package/dist/sdk/p-d143e097.entry.js.map +1 -0
  276. package/dist/sdk/{p-a69b83ec.entry.js → p-e0d2397c.entry.js} +2 -2
  277. package/dist/sdk/{p-80034205.entry.js → p-e6beb9d7.entry.js} +2 -2
  278. package/dist/sdk/p-ecc7fcff.entry.js +2 -0
  279. package/dist/sdk/p-ecc7fcff.entry.js.map +1 -0
  280. package/dist/sdk/{p-2cb6a2d0.entry.js → p-f1788e52.entry.js} +2 -2
  281. package/dist/sdk/p-fb665a5c.entry.js +2 -0
  282. package/dist/sdk/p-fb665a5c.entry.js.map +1 -0
  283. package/dist/sdk/p-fc67cf07.entry.js +2 -0
  284. package/dist/sdk/p-fc67cf07.entry.js.map +1 -0
  285. package/dist/sdk/sdk.esm.js +1 -1
  286. package/dist/sdk/u-conditional-render.entry.esm.js.map +1 -1
  287. package/dist/sdk/u-config.entry.esm.js.map +1 -1
  288. package/dist/sdk/u-error-message.entry.esm.js.map +1 -1
  289. package/dist/sdk/u-field.u-raw-field.entry.esm.js.map +1 -1
  290. package/dist/sdk/u-logout-button.entry.esm.js.map +1 -1
  291. package/dist/sdk/u-magic-code-field.entry.esm.js.map +1 -1
  292. package/dist/sdk/u-missing-fields-submit-button.entry.esm.js.map +1 -1
  293. package/dist/sdk/u-newsletter-checkbox.entry.esm.js.map +1 -1
  294. package/dist/sdk/u-newsletter-logout-button.entry.esm.js.map +1 -1
  295. package/dist/sdk/u-newsletter-preference-checkbox.entry.esm.js.map +1 -1
  296. package/dist/sdk/u-newsletter-resend-doi-button.entry.esm.js.map +1 -1
  297. package/dist/sdk/u-newsletter-root.entry.esm.js.map +1 -1
  298. package/dist/sdk/u-newsletter-toggle-subscription-button.entry.esm.js.map +1 -1
  299. package/dist/sdk/u-passkey.entry.esm.js.map +1 -1
  300. package/dist/sdk/u-profile.u-submit-button.entry.esm.js.map +1 -1
  301. package/dist/sdk/u-reset-password-button.entry.esm.js.map +1 -1
  302. package/dist/sdk/u-send-magic-code-button.entry.esm.js.map +1 -1
  303. package/dist/sdk/u-signin-step.entry.esm.js.map +1 -1
  304. package/dist/sdk/u-spinner.entry.esm.js.map +1 -1
  305. package/dist/sdk/u-ticketable-list.entry.esm.js.map +1 -1
  306. package/dist/types/api/base-client.d.ts +54 -0
  307. package/dist/types/api/base-service.d.ts +62 -0
  308. package/dist/types/api/client.d.ts +9 -31
  309. package/dist/types/api/index.d.ts +1 -0
  310. package/dist/types/api/shared.d.ts +11 -0
  311. package/dist/types/api/standalone.d.ts +105 -0
  312. package/dist/types/auth/api/auth.d.ts +71 -287
  313. package/dist/types/auth/api/schemas.d.ts +572 -0
  314. package/dist/types/auth/auth-helpers.d.ts +65 -66
  315. package/dist/types/auth/store/auth-store.d.ts +3 -3
  316. package/dist/types/components.d.ts +0 -72
  317. package/dist/types/newsletter/api/newsletters.d.ts +73 -196
  318. package/dist/types/newsletter/api/schemas.d.ts +192 -0
  319. package/dist/types/profile/api/profile.d.ts +12 -237
  320. package/dist/types/profile/api/schemas.d.ts +336 -0
  321. package/dist/types/profile/components/profile/profile.d.ts +1 -17
  322. package/dist/types/shared/components/error-message/error-message.d.ts +1 -1
  323. package/dist/types/ticketable/api/schemas.d.ts +108 -15
  324. package/dist/types/ticketable/api/subscriptions.d.ts +16 -83
  325. package/dist/types/ticketable/api/ticketable-service.d.ts +39 -0
  326. package/dist/types/ticketable/api/tickets.d.ts +16 -85
  327. package/dist/types/ticketable/components/ticketable-list/ticketable-list.d.ts +2 -12
  328. package/package.json +5 -1
  329. package/dist/cjs/auth-NU3DBc-6.js +0 -581
  330. package/dist/cjs/auth-NU3DBc-6.js.map +0 -1
  331. package/dist/cjs/auth-store-BaxuIp4z.js.map +0 -1
  332. package/dist/cjs/index-R2MKLaem.js.map +0 -1
  333. package/dist/cjs/newsletter-helpers-DR0vsegt.js.map +0 -1
  334. package/dist/collection/ticketable/api/get-with-schema.js +0 -35
  335. package/dist/collection/ticketable/api/get-with-schema.js.map +0 -1
  336. package/dist/components/auth.js +0 -580
  337. package/dist/components/auth.js.map +0 -1
  338. package/dist/esm/auth-nsjRdpvS.js +0 -579
  339. package/dist/esm/auth-nsjRdpvS.js.map +0 -1
  340. package/dist/esm/auth-store-CVvBlKGv.js.map +0 -1
  341. package/dist/esm/index-DSDkaHWI.js.map +0 -1
  342. package/dist/esm/newsletter-helpers-Dc_24im3.js.map +0 -1
  343. package/dist/sdk/p-0ab98e7a.entry.js +0 -2
  344. package/dist/sdk/p-0ab98e7a.entry.js.map +0 -1
  345. package/dist/sdk/p-0d324822.entry.js +0 -2
  346. package/dist/sdk/p-0d324822.entry.js.map +0 -1
  347. package/dist/sdk/p-0fb37ee9.entry.js +0 -2
  348. package/dist/sdk/p-0fb37ee9.entry.js.map +0 -1
  349. package/dist/sdk/p-3049e73f.entry.js +0 -2
  350. package/dist/sdk/p-3049e73f.entry.js.map +0 -1
  351. package/dist/sdk/p-312b919e.entry.js +0 -2
  352. package/dist/sdk/p-312b919e.entry.js.map +0 -1
  353. package/dist/sdk/p-319c5d3b.entry.js +0 -2
  354. package/dist/sdk/p-319c5d3b.entry.js.map +0 -1
  355. package/dist/sdk/p-34b98f55.entry.js +0 -2
  356. package/dist/sdk/p-34b98f55.entry.js.map +0 -1
  357. package/dist/sdk/p-4ec3302d.entry.js +0 -2
  358. package/dist/sdk/p-4ec3302d.entry.js.map +0 -1
  359. package/dist/sdk/p-568eabbc.entry.js +0 -2
  360. package/dist/sdk/p-568eabbc.entry.js.map +0 -1
  361. package/dist/sdk/p-5b40a68b.entry.js +0 -2
  362. package/dist/sdk/p-5b40a68b.entry.js.map +0 -1
  363. package/dist/sdk/p-66587fdd.entry.js +0 -2
  364. package/dist/sdk/p-66587fdd.entry.js.map +0 -1
  365. package/dist/sdk/p-88d93d64.entry.js +0 -2
  366. package/dist/sdk/p-90e2253e.entry.js +0 -2
  367. package/dist/sdk/p-90e2253e.entry.js.map +0 -1
  368. package/dist/sdk/p-BiILQPdb.js +0 -2
  369. package/dist/sdk/p-BiILQPdb.js.map +0 -1
  370. package/dist/sdk/p-DdUvQelg.js +0 -2
  371. package/dist/sdk/p-DdUvQelg.js.map +0 -1
  372. package/dist/sdk/p-PKvQIsOt.js +0 -2
  373. package/dist/sdk/p-PKvQIsOt.js.map +0 -1
  374. package/dist/sdk/p-a4f5940f.entry.js +0 -2
  375. package/dist/sdk/p-a4f5940f.entry.js.map +0 -1
  376. package/dist/sdk/p-aMrLKr2m.js +0 -2
  377. package/dist/sdk/p-aMrLKr2m.js.map +0 -1
  378. package/dist/sdk/p-bfb04b17.entry.js +0 -2
  379. package/dist/sdk/p-bfb04b17.entry.js.map +0 -1
  380. package/dist/sdk/p-c6816542.entry.js +0 -2
  381. package/dist/sdk/p-c6816542.entry.js.map +0 -1
  382. package/dist/sdk/p-da363474.entry.js +0 -2
  383. package/dist/sdk/p-da363474.entry.js.map +0 -1
  384. package/dist/sdk/p-e54d5d38.entry.js +0 -2
  385. package/dist/sdk/p-e54d5d38.entry.js.map +0 -1
  386. package/dist/sdk/p-e81bbd62.entry.js +0 -2
  387. package/dist/sdk/p-e81bbd62.entry.js.map +0 -1
  388. package/dist/sdk/p-effaf86b.entry.js +0 -2
  389. package/dist/types/ticketable/api/get-with-schema.d.ts +0 -3
  390. /package/dist/sdk/{p-5babee6b.entry.js.map → p-098eef67.entry.js.map} +0 -0
  391. /package/dist/sdk/{p-e2e7061b.entry.js.map → p-5da49d00.entry.js.map} +0 -0
  392. /package/dist/sdk/{p-88d93d64.entry.js.map → p-745742f1.entry.js.map} +0 -0
  393. /package/dist/sdk/{p-9e71a36c.entry.js.map → p-74e6523f.entry.js.map} +0 -0
  394. /package/dist/sdk/{p-39b61f33.entry.js.map → p-bbbec3d4.entry.js.map} +0 -0
  395. /package/dist/sdk/{p-f232929b.entry.js.map → p-c2fba7c8.entry.js.map} +0 -0
  396. /package/dist/sdk/{p-a69b83ec.entry.js.map → p-e0d2397c.entry.js.map} +0 -0
  397. /package/dist/sdk/{p-80034205.entry.js.map → p-e6beb9d7.entry.js.map} +0 -0
  398. /package/dist/sdk/{p-2cb6a2d0.entry.js.map → p-f1788e52.entry.js.map} +0 -0
@@ -1,5 +1,4 @@
1
1
  import { g as getUnidyClient } from './index2.js';
2
- import { A as Auth } from './auth.js';
3
2
  import { t } from './i18n.js';
4
3
  import { c as createLogger } from './logger.js';
5
4
  import { F as Flash } from './flash-store.js';
@@ -15,16 +14,15 @@ function newsletterLogout() {
15
14
  }
16
15
  async function resendDoi(internalName) {
17
16
  const { preferenceToken } = newsletterStore.state;
18
- const authInstance = await Auth.getInstance();
19
- const idToken = await authInstance.getToken();
20
- const response = await getUnidyClient().newsletters.resendDoi(internalName, { redirect_to_after_confirmation: redirectToAfterConfirmationUrl() }, {
21
- preferenceToken: typeof preferenceToken === "string" ? preferenceToken : "",
22
- idToken: typeof idToken === "string" ? idToken : "",
17
+ const [error] = await getUnidyClient().newsletters.resendDoi({
18
+ internalName,
19
+ payload: { redirect_to_after_confirmation: redirectToAfterConfirmationUrl() },
20
+ options: { preferenceToken },
23
21
  });
24
- if (response.status === 204) {
22
+ if (error === null) {
25
23
  return true;
26
24
  }
27
- if (response.status === 401) {
25
+ if (error === "unauthorized") {
28
26
  Flash.error.addMessage(t("newsletter.errors.unauthorized"));
29
27
  newsletterLogout();
30
28
  return false;
@@ -32,15 +30,17 @@ async function resendDoi(internalName) {
32
30
  return false;
33
31
  }
34
32
  async function sendLoginEmail(email) {
35
- const response = await getUnidyClient().newsletters.sendLoginEmail({
36
- email,
37
- redirect_uri: redirectToAfterConfirmationUrl(),
33
+ const [error] = await getUnidyClient().newsletters.sendLoginEmail({
34
+ payload: {
35
+ email,
36
+ redirect_uri: redirectToAfterConfirmationUrl(),
37
+ },
38
38
  });
39
- if (response.status === 204) {
39
+ if (error === null) {
40
40
  Flash.info.addMessage(t("newsletter.success.login_email_sent"));
41
41
  }
42
- else if (response.status === 404) {
43
- Flash.error.addMessage(t("newsletter.errors.login_email_not_found"));
42
+ else if (error === "rate_limit_exceeded") {
43
+ Flash.error.addMessage(t("newsletter.errors.rate_limit_exceeded", { defaultValue: "Too many requests. Please try again later." }));
44
44
  }
45
45
  else {
46
46
  Flash.error.addMessage(t("errors.unknown", { defaultValue: "An unknown error occurred" }));
@@ -53,28 +53,25 @@ async function fetchSubscriptions() {
53
53
  logger.error("Preference token or authentication is required to fetch subscriptions");
54
54
  return;
55
55
  }
56
- const authInstance = await Auth.getInstance();
57
- const idToken = await authInstance.getToken();
58
56
  newsletterStore.state.fetchingSubscriptions = true;
59
- const response = await getUnidyClient().newsletters.listSubscriptions({
60
- preferenceToken,
61
- idToken: typeof idToken === "string" ? idToken : "",
57
+ const [error, data] = await getUnidyClient().newsletters.list({
58
+ options: { preferenceToken },
62
59
  });
63
60
  newsletterStore.state.fetchingSubscriptions = false;
64
- if (response.status === 401) {
61
+ if (error === "unauthorized") {
65
62
  newsletterLogout();
66
63
  Flash.error.addMessage(t("newsletter.errors.unauthorized"));
67
64
  return;
68
65
  }
69
- if (response.success && response.data) {
70
- newsletterStore.state.existingSubscriptions = response.data.map((sub) => ({
66
+ if (error === null && data && Array.isArray(data)) {
67
+ newsletterStore.state.existingSubscriptions = data.map((sub) => ({
71
68
  newsletter_internal_name: sub.newsletter_internal_name,
72
69
  confirmed: sub.confirmed_at !== null,
73
70
  preference_identifiers: sub.preference_identifiers || [],
74
71
  }));
75
72
  // init checked newsletters and preferences
76
73
  const checkedNewsletters = { ...newsletterStore.state.checkedNewsletters };
77
- for (const sub of response.data) {
74
+ for (const sub of data) {
78
75
  checkedNewsletters[sub.newsletter_internal_name] = [...(sub.preference_identifiers || [])];
79
76
  }
80
77
  newsletterStore.state.checkedNewsletters = checkedNewsletters;
@@ -87,7 +84,7 @@ async function handleAlreadySubscribedError(email, errors) {
87
84
  .filter((err) => err.error_identifier === "already_subscribed" && !existingNames.has(err.meta.newsletter_internal_name))
88
85
  .map((err) => ({
89
86
  newsletter_internal_name: err.meta.newsletter_internal_name,
90
- confirmed: null,
87
+ confirmed: false, // We don't know the confirmation status for already_subscribed errors
91
88
  preference_identifiers: [],
92
89
  }));
93
90
  if (newSubscriptions.length > 0) {
@@ -99,22 +96,20 @@ async function handleAlreadySubscribedError(email, errors) {
99
96
  }
100
97
  }
101
98
  async function handleCreateSubscriptionRequest(email, internalNames, showSuccessMessage = true) {
102
- const authInstance = await Auth.getInstance();
103
- const idToken = await authInstance.getToken();
104
99
  const { checkedNewsletters } = newsletterStore.state;
105
- const [error, response] = await getUnidyClient().newsletters.createSubscriptions({
106
- email,
107
- newsletter_subscriptions: internalNames.map((newsletter) => ({
108
- newsletter_internal_name: newsletter,
109
- preference_identifiers: checkedNewsletters[newsletter] || [],
110
- })),
111
- redirect_to_after_confirmation: redirectToAfterConfirmationUrl(),
112
- }, {
113
- idToken: typeof idToken === "string" ? idToken : "",
100
+ const [error, response] = await getUnidyClient().newsletters.create({
101
+ payload: {
102
+ email,
103
+ newsletter_subscriptions: internalNames.map((newsletter) => ({
104
+ newsletter_internal_name: newsletter,
105
+ preference_identifiers: checkedNewsletters[newsletter] || [],
106
+ })),
107
+ redirect_to_after_confirmation: redirectToAfterConfirmationUrl(),
108
+ },
114
109
  });
115
- if (error === null) {
116
- if (response.data?.results && response.data.results.length > 0) {
117
- const newSubscriptions = response.data.results.map((result) => ({
110
+ if (error === null && response && "results" in response) {
111
+ if (response.results.length > 0) {
112
+ const newSubscriptions = response.results.map((result) => ({
118
113
  newsletter_internal_name: result.newsletter_internal_name,
119
114
  confirmed: result.confirmed_at !== null,
120
115
  preference_identifiers: result.preference_identifiers || [],
@@ -131,8 +126,8 @@ async function handleCreateSubscriptionRequest(email, internalNames, showSuccess
131
126
  newsletterLogout();
132
127
  return false;
133
128
  }
134
- if (error === "newsletter_error") {
135
- const errors = response.data?.errors || [];
129
+ if (error === "newsletter_error" && response) {
130
+ const errors = response.errors || [];
136
131
  const errorMap = {};
137
132
  // special error case which is handled differently: if user is not authenticated, we send a login email, otherwise we add the
138
133
  // already_subscribed subscriptions to the existing subscriptions
@@ -174,38 +169,31 @@ async function deleteSubscription(internalName) {
174
169
  logger.error("Preference token or authentication is required to delete a subscription");
175
170
  return false;
176
171
  }
177
- const authInstance = await Auth.getInstance();
178
- const idToken = await authInstance.getToken();
179
- const response = await getUnidyClient().newsletters.deleteSubscription(internalName, {
180
- preferenceToken,
181
- idToken: typeof idToken === "string" ? idToken : "",
172
+ const [error, data] = await getUnidyClient().newsletters.delete({
173
+ internalName,
174
+ options: { preferenceToken },
182
175
  });
183
- if (response.status === 200 && response.data?.new_preference_token) {
184
- // if user is not authenticated, we need to store the new preference token which is used for the next request
185
- if (!newsletterStore.state.isAuthenticated) {
186
- newsletterStore.state.preferenceToken = response.data.new_preference_token;
187
- persist("preferenceToken");
176
+ if (error === null) {
177
+ if (data && "new_preference_token" in data) {
178
+ // if user is not authenticated, we need to store the new preference token which is used for the next request
179
+ if (!newsletterStore.state.isAuthenticated) {
180
+ newsletterStore.state.preferenceToken = data.new_preference_token;
181
+ persist("preferenceToken");
182
+ }
183
+ newsletterStore.state.existingSubscriptions = newsletterStore.state.existingSubscriptions.filter((sub) => sub.newsletter_internal_name !== internalName);
184
+ return true;
188
185
  }
189
- newsletterStore.state.existingSubscriptions = newsletterStore.state.existingSubscriptions.filter((sub) => sub.newsletter_internal_name !== internalName);
190
- // Reset checked preferences to defaults (preferences marked with checked='true')
191
- const defaultPrefs = newsletterStore.state.defaultPreferences[internalName];
192
- newsletterStore.state.checkedNewsletters = {
193
- ...newsletterStore.state.checkedNewsletters,
194
- [internalName]: defaultPrefs ? [...defaultPrefs] : [],
195
- };
196
- return true;
197
- }
198
- if (response.status === 204) {
186
+ // data is null - last subscription was deleted
199
187
  newsletterLogout();
200
188
  newsletterStore.state.checkedNewsletters = {};
201
189
  return true;
202
190
  }
203
- if (response.status === 401) {
191
+ if (error === "unauthorized") {
204
192
  Flash.error.addMessage(t("newsletter.errors.unauthorized"));
205
193
  newsletterLogout();
206
194
  return false;
207
195
  }
208
- if (response.status === 422) {
196
+ if (error === "not_found") {
209
197
  return false;
210
198
  }
211
199
  Flash.error.addMessage(t("errors.unknown", { defaultValue: "An unknown error occurred" }));
@@ -242,26 +230,25 @@ async function updateSubscriptionPreferences(internalName) {
242
230
  logger.error(`Cannot update preferences: not subscribed to newsletter '${internalName}'`);
243
231
  return false;
244
232
  }
245
- const authInstance = await Auth.getInstance();
246
- const idToken = await authInstance.getToken();
247
233
  const preferenceIdentifiers = newsletterStore.state.checkedNewsletters[internalName] || [];
248
- const response = await getUnidyClient().newsletters.updateSubscription(internalName, { preference_identifiers: preferenceIdentifiers }, {
249
- preferenceToken,
250
- idToken: typeof idToken === "string" ? idToken : "",
234
+ const [error, data] = await getUnidyClient().newsletters.update({
235
+ internalName,
236
+ payload: { preference_identifiers: preferenceIdentifiers },
237
+ options: { preferenceToken },
251
238
  });
252
- if (response.status === 401) {
239
+ if (error === "unauthorized") {
253
240
  Flash.error.addMessage(t("newsletter.errors.unauthorized"));
254
241
  newsletterLogout();
255
242
  return false;
256
243
  }
257
- if (response.success && response.data) {
244
+ if (error === null && data && "preference_identifiers" in data) {
258
245
  // Update the local subscription with the new preferences
259
246
  const subscriptionIndex = newsletterStore.state.existingSubscriptions.findIndex((sub) => sub.newsletter_internal_name === internalName);
260
247
  if (subscriptionIndex !== -1) {
261
248
  const updatedSubscriptions = [...newsletterStore.state.existingSubscriptions];
262
249
  updatedSubscriptions[subscriptionIndex] = {
263
250
  ...updatedSubscriptions[subscriptionIndex],
264
- preference_identifiers: response.data.preference_identifiers || [],
251
+ preference_identifiers: data.preference_identifiers || [],
265
252
  };
266
253
  newsletterStore.state.existingSubscriptions = updatedSubscriptions;
267
254
  }
@@ -1 +1 @@
1
- {"file":"newsletter-helpers.js","mappings":";;;;;;;AAaA,MAAM,MAAM,GAAG,YAAY,CAAC,mBAAmB,CAAC;AAEhD,MAAM,kBAAkB,GAAG,mBAAmB;SAE9B,gBAAgB,GAAA;AAC9B,IAAA,eAAe,CAAC,KAAK,CAAC,eAAe,GAAG,EAAE;AAC1C,IAAA,eAAe,CAAC,KAAK,CAAC,qBAAqB,GAAG,EAAE;AAChD,IAAA,cAAc,CAAC,UAAU,CAAC,GAAG,kBAAkB,CAAA,eAAA,CAAiB,CAAC;AACjE,IAAA,cAAc,CAAC,UAAU,CAAC,GAAG,kBAAkB,CAAA,KAAA,CAAO,CAAC;AACzD;AAEO,eAAe,SAAS,CAAC,YAAoB,EAAA;AAClD,IAAA,MAAM,EAAE,eAAe,EAAE,GAAG,eAAe,CAAC,KAAK;AAEjD,IAAA,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,W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AAO,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 { Auth } from \"../auth/auth\";\nimport { t } from \"../i18n\";\nimport { createLogger } from \"../logger\";\nimport { Flash } from \"../shared/store/flash-store\";\nimport {\n type CheckedNewsletters,\n type ExistingSubscription,\n type NewsletterErrorIdentifier,\n newsletterStore,\n persist,\n} from \"./store/newsletter-store\";\n\nconst logger = createLogger(\"NewsletterHelpers\");\n\nconst PERSIST_KEY_PREFIX = \"unidy_newsletter_\";\n\nexport function newsletterLogout(): void {\n newsletterStore.state.preferenceToken = \"\";\n newsletterStore.state.existingSubscriptions = [];\n sessionStorage.removeItem(`${PERSIST_KEY_PREFIX}preferenceToken`);\n sessionStorage.removeItem(`${PERSIST_KEY_PREFIX}email`);\n}\n\nexport async function resendDoi(internalName: string): Promise<boolean> {\n const { preferenceToken } = newsletterStore.state;\n\n const authInstance = await Auth.getInstance();\n const idToken = await authInstance.getToken();\n\n const response = await getUnidyClient().newsletters.resendDoi(\n internalName,\n { redirect_to_after_confirmation: redirectToAfterConfirmationUrl() },\n {\n preferenceToken: typeof preferenceToken === \"string\" ? preferenceToken : \"\",\n idToken: typeof idToken === \"string\" ? idToken : \"\",\n },\n );\n\n if (response.status === 204) {\n return true;\n }\n\n if (response.status === 401) {\n Flash.error.addMessage(t(\"newsletter.errors.unauthorized\"));\n newsletterLogout();\n return false;\n }\n\n return false;\n}\n\nexport async function sendLoginEmail(email: string): Promise<void> {\n const response = await getUnidyClient().newsletters.sendLoginEmail({\n email,\n redirect_uri: redirectToAfterConfirmationUrl(),\n });\n\n if (response.status === 204) {\n Flash.info.addMessage(t(\"newsletter.success.login_email_sent\"));\n } else if (response.status === 404) {\n Flash.error.addMessage(t(\"newsletter.errors.login_email_not_found\"));\n } else {\n Flash.error.addMessage(t(\"errors.unknown\", { defaultValue: \"An unknown error occurred\" }));\n }\n}\n\nexport async function fetchSubscriptions(): Promise<void> {\n const { preferenceToken } = newsletterStore.state;\n\n // either preference token is needed or the user must be authenticated\n if (!preferenceToken && !newsletterStore.state.isAuthenticated) {\n logger.error(\"Preference token or authentication is required to fetch subscriptions\");\n return;\n }\n\n const authInstance = await Auth.getInstance();\n const idToken = await authInstance.getToken();\n\n newsletterStore.state.fetchingSubscriptions = true;\n\n const response = await getUnidyClient().newsletters.listSubscriptions({\n preferenceToken,\n idToken: typeof idToken === \"string\" ? idToken : \"\",\n });\n\n newsletterStore.state.fetchingSubscriptions = false;\n\n if (response.status === 401) {\n newsletterLogout();\n Flash.error.addMessage(t(\"newsletter.errors.unauthorized\"));\n return;\n }\n\n if (response.success && response.data) {\n newsletterStore.state.existingSubscriptions = response.data.map(\n (sub): ExistingSubscription => ({\n newsletter_internal_name: sub.newsletter_internal_name,\n confirmed: sub.confirmed_at !== null,\n preference_identifiers: sub.preference_identifiers || [],\n }),\n );\n\n // init checked newsletters and preferences\n const checkedNewsletters: CheckedNewsletters = { ...newsletterStore.state.checkedNewsletters };\n for (const sub of response.data) {\n checkedNewsletters[sub.newsletter_internal_name] = [...(sub.preference_identifiers || [])];\n }\n newsletterStore.state.checkedNewsletters = checkedNewsletters;\n }\n}\n\nasync function handleAlreadySubscribedError(\n email: string,\n errors: Array<{ error_identifier: string; meta: { newsletter_internal_name: string } }>,\n): Promise<void> {\n if (newsletterStore.state.isAuthenticated || newsletterStore.state.preferenceToken) {\n const existingNames = new Set(newsletterStore.state.existingSubscriptions.map((s) => s.newsletter_internal_name));\n\n const newSubscriptions: ExistingSubscription[] = errors\n .filter((err) => err.error_identifier === \"already_subscribed\" && !existingNames.has(err.meta.newsletter_internal_name))\n .map((err) => ({\n newsletter_internal_name: err.meta.newsletter_internal_name,\n confirmed: null,\n preference_identifiers: [],\n }));\n\n if (newSubscriptions.length > 0) {\n newsletterStore.state.existingSubscriptions = [...newsletterStore.state.existingSubscriptions, ...newSubscriptions];\n }\n } else {\n await sendLoginEmail(email);\n }\n}\n\nasync function handleCreateSubscriptionRequest(email: string, internalNames: string[], showSuccessMessage = true): Promise<boolean> {\n const authInstance = await Auth.getInstance();\n const idToken = await authInstance.getToken();\n const { checkedNewsletters } = newsletterStore.state;\n\n const [error, response] = await getUnidyClient().newsletters.createSubscriptions(\n {\n email,\n newsletter_subscriptions: internalNames.map((newsletter) => ({\n newsletter_internal_name: newsletter,\n preference_identifiers: checkedNewsletters[newsletter] || [],\n })),\n redirect_to_after_confirmation: redirectToAfterConfirmationUrl(),\n },\n {\n idToken: typeof idToken === \"string\" ? idToken : \"\",\n },\n );\n\n if (error === null) {\n if (response.data?.results && response.data.results.length > 0) {\n const newSubscriptions: ExistingSubscription[] = response.data.results.map((result) => ({\n newsletter_internal_name: result.newsletter_internal_name,\n confirmed: result.confirmed_at !== null,\n preference_identifiers: result.preference_identifiers || [],\n }));\n\n newsletterStore.state.existingSubscriptions = [...newsletterStore.state.existingSubscriptions, ...newSubscriptions];\n }\n\n if (showSuccessMessage) {\n Flash.success.addMessage(t(\"newsletter.success.subscribe\"));\n }\n\n return true;\n }\n\n if (error === \"unauthorized\") {\n Flash.error.addMessage(t(\"newsletter.errors.unauthorized\"));\n newsletterLogout();\n return false;\n }\n\n if (error === \"newsletter_error\") {\n const errors = response.data?.errors || [];\n const errorMap: Record<string, NewsletterErrorIdentifier> = {};\n\n // special error case which is handled differently: if user is not authenticated, we send a login email, otherwise we add the\n // already_subscribed subscriptions to the existing subscriptions\n const hasAlreadySubscribedError = errors.some((err) => err.error_identifier === \"already_subscribed\");\n if (hasAlreadySubscribedError) {\n await handleAlreadySubscribedError(email, errors);\n }\n\n const newsletterNotFoundError = errors.some((err) => err.error_identifier === \"newsletter_not_found\");\n if (newsletterNotFoundError) {\n errorMap.general = \"newsletter_not_found\";\n }\n\n const hasInvalidEmailError = errors.some(\n (err) => err.error_identifier === \"validation_error\" && err.error_details && \"email\" in err.error_details,\n );\n\n if (hasInvalidEmailError) {\n errorMap.email = \"invalid_email\";\n } else {\n for (const err of errors) {\n errorMap[err.meta.newsletter_internal_name] = err.error_identifier as NewsletterErrorIdentifier;\n }\n }\n\n newsletterStore.state.errors = errorMap;\n } else {\n Flash.error.addMessage(t(\"errors.unknown\", { defaultValue: \"An unknown error occurred\" }));\n }\n\n return false;\n}\n\nexport async function subscribeToNewsletter(internalName: string, email: string): Promise<boolean> {\n return handleCreateSubscriptionRequest(email, [internalName], false);\n}\n\nexport async function createSubscriptions({ email }: { email: string }): Promise<void> {\n const internalNames = Object.keys(newsletterStore.state.checkedNewsletters);\n await handleCreateSubscriptionRequest(email, internalNames, true);\n}\n\nexport async function deleteSubscription(internalName: string): Promise<boolean> {\n const { preferenceToken } = newsletterStore.state;\n\n // either preference token is needed or the user must be authenticated to delete a subscription\n if (!preferenceToken && !newsletterStore.state.isAuthenticated) {\n logger.error(\"Preference token or authentication is required to delete a subscription\");\n return false;\n }\n\n const authInstance = await Auth.getInstance();\n const idToken = await authInstance.getToken();\n\n const response = await getUnidyClient().newsletters.deleteSubscription(internalName, {\n preferenceToken,\n idToken: typeof idToken === \"string\" ? idToken : \"\",\n });\n\n if (response.status === 200 && response.data?.new_preference_token) {\n // if user is not authenticated, we need to store the new preference token which is used for the next request\n if (!newsletterStore.state.isAuthenticated) {\n newsletterStore.state.preferenceToken = response.data.new_preference_token;\n persist(\"preferenceToken\");\n }\n\n newsletterStore.state.existingSubscriptions = newsletterStore.state.existingSubscriptions.filter(\n (sub) => sub.newsletter_internal_name !== internalName,\n );\n\n // Reset checked preferences to defaults (preferences marked with checked='true')\n const defaultPrefs = newsletterStore.state.defaultPreferences[internalName];\n newsletterStore.state.checkedNewsletters = {\n ...newsletterStore.state.checkedNewsletters,\n [internalName]: defaultPrefs ? [...defaultPrefs] : [],\n };\n\n return true;\n }\n\n if (response.status === 204) {\n newsletterLogout();\n\n newsletterStore.state.checkedNewsletters = {};\n return true;\n }\n\n if (response.status === 401) {\n Flash.error.addMessage(t(\"newsletter.errors.unauthorized\"));\n newsletterLogout();\n return false;\n }\n\n if (response.status === 422) {\n return false;\n }\n\n Flash.error.addMessage(t(\"errors.unknown\", { defaultValue: \"An unknown error occurred\" }));\n return false;\n}\n\nexport function getSubscription(internalName: string): ExistingSubscription | undefined {\n return newsletterStore.state.existingSubscriptions.find((sub) => sub.newsletter_internal_name === internalName);\n}\n\nexport function isSubscribed(internalName: string): boolean {\n return newsletterStore.state.existingSubscriptions.some((sub) => sub.newsletter_internal_name === internalName);\n}\n\nexport function isConfirmed(internalName: string): boolean {\n const sub = getSubscription(internalName);\n return sub?.confirmed ?? false;\n}\n\nfunction redirectToAfterConfirmationUrl(): string {\n const baseUrl = `${location.origin}${location.pathname}`;\n const params = new URLSearchParams(location.search);\n for (const key of [\"email\", \"newsletter_error\"]) {\n params.delete(key);\n }\n const queryString = params.toString();\n return queryString ? `${baseUrl}?${queryString}` : baseUrl;\n}\n\nexport function getSubscriptionPreferences(internalName: string): string[] {\n const subscription = getSubscription(internalName);\n return subscription?.preference_identifiers || [];\n}\n\nexport async function updateSubscriptionPreferences(internalName: string): Promise<boolean> {\n const { preferenceToken } = newsletterStore.state;\n\n // Either preference token is needed or the user must be authenticated\n if (!preferenceToken && !newsletterStore.state.isAuthenticated) {\n logger.error(\"Preference token or authentication is required to update subscription preferences\");\n return false;\n }\n\n // Check if the subscription exists\n if (!isSubscribed(internalName)) {\n logger.error(`Cannot update preferences: not subscribed to newsletter '${internalName}'`);\n return false;\n }\n\n const authInstance = await Auth.getInstance();\n const idToken = await authInstance.getToken();\n\n const preferenceIdentifiers = newsletterStore.state.checkedNewsletters[internalName] || [];\n\n const response = await getUnidyClient().newsletters.updateSubscription(\n internalName,\n { preference_identifiers: preferenceIdentifiers },\n {\n preferenceToken,\n idToken: typeof idToken === \"string\" ? idToken : \"\",\n },\n );\n\n if (response.status === 401) {\n Flash.error.addMessage(t(\"newsletter.errors.unauthorized\"));\n newsletterLogout();\n return false;\n }\n\n if (response.success && response.data) {\n // Update the local subscription with the new preferences\n const subscriptionIndex = newsletterStore.state.existingSubscriptions.findIndex((sub) => sub.newsletter_internal_name === internalName);\n\n if (subscriptionIndex !== -1) {\n const updatedSubscriptions = [...newsletterStore.state.existingSubscriptions];\n updatedSubscriptions[subscriptionIndex] = {\n ...updatedSubscriptions[subscriptionIndex],\n preference_identifiers: response.data.preference_identifiers || [],\n };\n newsletterStore.state.existingSubscriptions = updatedSubscriptions;\n }\n\n Flash.success.addMessage(t(\"newsletter.success.preferences_updated\"));\n return true;\n }\n\n Flash.error.addMessage(t(\"errors.unknown\", { defaultValue: \"An unknown error occurred\" }));\n return false;\n}\n"],"version":3}
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,CAAC,YAAoB,EAAA;AAClD,IAAA,MAAM,EAAE,eAAe,EAAE,GAAG,eAAe,CAAC,KAAK;IAEjD,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,cAAc,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC;QAC3D,YAAY;AACZ,QAAA,OAAO,EAAE,EAAE,8BAA8B,EAAE,8BAA8B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,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 },\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 {\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 },\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 },\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 newsletterStore.state.existingSubscriptions = newsletterStore.state.existingSubscriptions.filter(\n (sub) => sub.newsletter_internal_name !== internalName,\n );\n return true;\n }\n\n // data is null - last subscription was deleted\n newsletterLogout();\n newsletterStore.state.checkedNewsletters = {};\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 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 },\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,73 +1,66 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
- import { g as getUnidyClient } from './index2.js';
3
- import { a as authStore, b as authStoreOnChange } from './auth-store.js';
4
- import { A as Auth } from './auth.js';
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
5
2
  import { t } from './i18n.js';
6
- import { o as onChange, u as unidyState } from './unidy-store.js';
7
- import { v as validateRequiredFieldsUnchanged, b as buildPayload } from './profile-helpers.js';
3
+ import { b as authStoreOnChange, a as authStore } from './auth-store.js';
4
+ import { h as Auth, g as getUnidyClient } from './index2.js';
8
5
  import { s as state, a as profileStoreOnChange } from './profile-store.js';
6
+ import { o as onChange } from './unidy-store.js';
7
+ import { v as validateRequiredFieldsUnchanged, b as buildPayload } from './profile-helpers.js';
9
8
  import { Y as captureException } from './exports.js';
10
9
 
11
10
  const Profile = /*@__PURE__*/ proxyCustomElement(class Profile extends HTMLElement {
12
11
  profileId;
13
12
  initialData = "";
14
- uProfileSuccess;
15
- uProfileError;
16
13
  fetchingProfileData = false;
17
14
  constructor(registerHost) {
18
15
  super();
19
16
  if (registerHost !== false) {
20
17
  this.__registerHost();
21
18
  }
22
- this.uProfileSuccess = createEvent(this, "uProfileSuccess", 7);
23
- this.uProfileError = createEvent(this, "uProfileError", 7);
24
19
  onChange("locale", async (_locale) => {
25
- if (authStore.state.authenticated)
26
- await this.getTokenAndFetchProfile();
20
+ await this.fetchProfileData();
27
21
  });
28
22
  }
29
23
  async componentWillLoad() {
30
24
  if (this.initialData !== "") {
31
25
  state.data = typeof this.initialData === "string" ? JSON.parse(this.initialData) : this.initialData;
32
26
  }
33
- else if (authStore.state.authenticated) {
34
- await this.getTokenAndFetchProfile();
27
+ else {
28
+ await this.fetchProfileData();
35
29
  }
36
30
  state.loading = false;
37
31
  }
38
- async getTokenAndFetchProfile() {
39
- const authInstance = await Auth.getInstance();
40
- const idToken = await authInstance.getToken();
41
- if (idToken && typeof idToken === "string") {
42
- await this.fetchProfileData(idToken);
43
- }
44
- }
45
- async fetchProfileData(idToken) {
32
+ async fetchProfileData() {
46
33
  // avoid multiple requests
47
34
  if (this.fetchingProfileData)
48
35
  return;
36
+ const authInstance = await Auth.getInstance();
37
+ const isAuthenticated = await authInstance.isAuthenticated();
38
+ if (!isAuthenticated) {
39
+ // Handle unauthenticated state the same as an unauthorized error from backend
40
+ state.flashErrors = { error: t("errors.unauthorized") };
41
+ return;
42
+ }
49
43
  this.fetchingProfileData = true;
50
44
  try {
51
- const resp = await getUnidyClient().profile.fetchProfile({ idToken, lang: unidyState.locale });
52
- if (resp.success) {
53
- state.configuration = JSON.parse(JSON.stringify(resp.data));
45
+ const [error, data] = await getUnidyClient().profile.get();
46
+ if (error === null && data) {
47
+ state.configuration = JSON.parse(JSON.stringify(data));
54
48
  state.configUpdateSource = "fetch";
55
49
  state.errors = {};
56
50
  state.flashErrors = {};
57
- state.data = JSON.parse(JSON.stringify(resp.data));
51
+ state.data = JSON.parse(JSON.stringify(data));
58
52
  }
59
53
  else {
60
- state.flashErrors = { [String(resp?.status)]: String(resp?.error) };
54
+ state.flashErrors = { error: error || "unknown_error" };
61
55
  }
62
56
  }
63
- catch (error) {
64
- captureException("Failed to fetch profile data:", error);
57
+ catch (err) {
58
+ captureException(err);
65
59
  state.flashErrors = { error: t("errors.failed_to_load_profile") };
66
60
  }
67
61
  this.fetchingProfileData = false;
68
62
  }
69
63
  async submitProfile() {
70
- const authInstance = await Auth.getInstance();
71
64
  state.loading = true;
72
65
  const { configuration, ...stateWithoutConfig } = state;
73
66
  if (!validateRequiredFieldsUnchanged(stateWithoutConfig.data)) {
@@ -75,33 +68,21 @@ const Profile = /*@__PURE__*/ proxyCustomElement(class Profile extends HTMLEleme
75
68
  return;
76
69
  }
77
70
  const updatedProfileData = buildPayload(stateWithoutConfig.data);
78
- const resp = await getUnidyClient().profile.updateProfile({
79
- idToken: (await authInstance.getToken()),
80
- data: updatedProfileData,
81
- lang: unidyState.locale,
71
+ const [error, data] = await getUnidyClient().profile.update({
72
+ payload: updatedProfileData,
82
73
  });
83
- if (resp?.success) {
74
+ if (error === null && data) {
84
75
  state.loading = false;
85
- state.configuration = JSON.parse(JSON.stringify(resp.data));
76
+ state.configuration = JSON.parse(JSON.stringify(data));
86
77
  state.configUpdateSource = "submit";
87
78
  state.errors = {};
88
- this.uProfileSuccess.emit({ message: "profile_updated_successfully", payload: resp.data });
79
+ }
80
+ else if (error === "validation_error" && data && "flatErrors" in data) {
81
+ state.errors = data.flatErrors;
82
+ state.loading = false;
89
83
  }
90
84
  else {
91
- if (resp?.data && "flatErrors" in resp.data) {
92
- state.errors = resp.data.flatErrors;
93
- this.uProfileError.emit({
94
- error: "profile_update_field_errors",
95
- details: { fieldErrors: state.errors, httpStatus: resp?.status, responseData: resp?.data },
96
- });
97
- }
98
- else {
99
- state.flashErrors = { [String(resp?.status)]: String(resp?.error) };
100
- this.uProfileError.emit({
101
- error: "profile_update_failed",
102
- details: { flashErrors: state.flashErrors, httpStatus: resp?.status, responseData: resp?.data },
103
- });
104
- }
85
+ state.flashErrors = { error: error || "unknown_error" };
105
86
  state.loading = false;
106
87
  }
107
88
  }
@@ -110,9 +91,8 @@ const Profile = /*@__PURE__*/ proxyCustomElement(class Profile extends HTMLEleme
110
91
  state.data = cfg;
111
92
  });
112
93
  authStoreOnChange("token", (newToken) => {
113
- const token = newToken ?? "";
114
- if (token) {
115
- this.fetchProfileData(token);
94
+ if (newToken) {
95
+ this.fetchProfileData();
116
96
  }
117
97
  });
118
98
  }
@@ -1 +1 @@
1
- {"file":"profile.js","mappings":";;;;;;;;;;MAea,OAAO,iBAAAA,kBAAA,CAAA,MAAA,OAAA,SAAA,WAAA,CAAA;AACV,IAAA,SAAS;IACT,WAAW,GAAoC,EAAE;AAEhD,IAAA,eAAe;AACf,IAAA,aAAa;IAUb,mBAAmB,GAAG,KAAK;AAEpC,IAAA,WAAA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AO,cAAK,CAAC,CAAC,sBAAsB,CAAC,CAAM;;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement","unidyOnChange","profileState","Sentry.captureException","profileOnChange","authOnChange"],"sources":["src/profile/components/profile/profile.tsx"],"sourcesContent":["import * as Sentry from \"@sentry/browser\";\nimport { Component, Event, type EventEmitter, Host, h, Method, Prop, State } from \"@stencil/core\";\nimport { getUnidyClient } from \"../../../api\";\nimport { Auth } from \"../../../auth\";\nimport { onChange as authOnChange, authStore } from \"../../../auth/store/auth-store\";\nimport { t } from \"../../../i18n\";\nimport { onChange as unidyOnChange, unidyState } from \"../../../shared/store/unidy-store\";\nimport { buildPayload, validateRequiredFieldsUnchanged } from \"../../profile-helpers\";\nimport type { ProfileRaw } from \"../../store/profile-store\";\nimport { onChange as profileOnChange, state as profileState } from \"../../store/profile-store\";\n\n@Component({\n tag: \"u-profile\",\n shadow: false,\n})\nexport class Profile {\n @Prop() profileId?: string;\n @Prop() initialData: string | Record<string, string> = \"\";\n\n @Event() uProfileSuccess!: EventEmitter<{ message: string; payload: ProfileRaw }>;\n @Event() uProfileError!: EventEmitter<{\n error: string;\n details: {\n fieldErrors?: Record<string, string>;\n flashErrors?: Record<string, string>;\n httpStatus?: number;\n responseData?: unknown;\n };\n }>;\n\n @State() fetchingProfileData = false;\n\n constructor() {\n unidyOnChange(\"locale\", async (_locale) => {\n if (authStore.state.authenticated) await this.getTokenAndFetchProfile();\n });\n }\n\n async componentWillLoad() {\n if (this.initialData !== \"\") {\n profileState.data = typeof this.initialData === \"string\" ? JSON.parse(this.initialData) : this.initialData;\n } else if (authStore.state.authenticated) {\n await this.getTokenAndFetchProfile();\n }\n\n profileState.loading = false;\n }\n\n async getTokenAndFetchProfile() {\n const authInstance = await Auth.getInstance();\n\n const idToken = await authInstance.getToken();\n\n if (idToken && typeof idToken === \"string\") {\n await this.fetchProfileData(idToken as string);\n }\n }\n\n async fetchProfileData(idToken: string) {\n // avoid multiple requests\n if (this.fetchingProfileData) return;\n\n this.fetchingProfileData = true;\n try {\n const resp = await getUnidyClient().profile.fetchProfile({ idToken, lang: unidyState.locale });\n\n if (resp.success) {\n profileState.configuration = JSON.parse(JSON.stringify(resp.data)) as ProfileRaw;\n profileState.configUpdateSource = \"fetch\";\n profileState.errors = {};\n profileState.flashErrors = {};\n\n profileState.data = JSON.parse(JSON.stringify(resp.data)) as ProfileRaw;\n } else {\n profileState.flashErrors = { [String(resp?.status)]: String(resp?.error) };\n }\n } catch (error) {\n Sentry.captureException(\"Failed to fetch profile data:\", error);\n profileState.flashErrors = { error: t(\"errors.failed_to_load_profile\") };\n }\n this.fetchingProfileData = false;\n }\n\n @Method()\n async submitProfile() {\n const authInstance = await Auth.getInstance();\n\n profileState.loading = true;\n\n const { configuration, ...stateWithoutConfig } = profileState;\n\n if (!validateRequiredFieldsUnchanged(stateWithoutConfig.data)) {\n profileState.loading = false;\n return;\n }\n\n const updatedProfileData = buildPayload(stateWithoutConfig.data);\n\n const resp = await getUnidyClient().profile.updateProfile({\n idToken: (await authInstance.getToken()) as string,\n data: updatedProfileData,\n lang: unidyState.locale,\n });\n\n if (resp?.success) {\n profileState.loading = false;\n profileState.configuration = JSON.parse(JSON.stringify(resp.data));\n profileState.configUpdateSource = \"submit\";\n profileState.errors = {};\n this.uProfileSuccess.emit({ message: \"profile_updated_successfully\", payload: resp.data as ProfileRaw });\n } else {\n if (resp?.data && \"flatErrors\" in resp.data) {\n profileState.errors = resp.data.flatErrors as Record<string, string>;\n this.uProfileError.emit({\n error: \"profile_update_field_errors\",\n details: { fieldErrors: profileState.errors, httpStatus: resp?.status, responseData: resp?.data },\n });\n } else {\n profileState.flashErrors = { [String(resp?.status)]: String(resp?.error) };\n this.uProfileError.emit({\n error: \"profile_update_failed\",\n details: { flashErrors: profileState.flashErrors, httpStatus: resp?.status, responseData: resp?.data },\n });\n }\n profileState.loading = false;\n }\n }\n\n componentDidLoad() {\n profileOnChange(\"configuration\", (cfg) => {\n profileState.data = cfg as ProfileRaw;\n });\n\n authOnChange(\"token\", (newToken: string | null) => {\n const token = newToken ?? \"\";\n\n if (token) {\n this.fetchProfileData(token);\n }\n });\n }\n\n render() {\n const hasFieldErrors = Object.values(profileState.errors).some(Boolean);\n const errorMsg = Object.values(profileState.flashErrors).filter(Boolean).join(\", \");\n const wasSubmit = profileState.configUpdateSource === \"submit\";\n\n if (authStore.state.authenticated) {\n return this.fetchingProfileData ? (\n <div>{t(\"loading\")}</div>\n ) : (\n <Host>\n <slot />\n {!hasFieldErrors && errorMsg && <flash-message variant=\"error\" message={errorMsg} />}\n {wasSubmit && !errorMsg && !hasFieldErrors && <flash-message variant=\"success\" message={t(\"profile.updated\")} />}\n </Host>\n );\n }\n\n return <h2>{t(\"profile.signInToView\")}</h2>;\n }\n}\n"],"version":3}
1
+ {"file":"profile.js","mappings":";;;;;;;;;MAea,OAAO,iBAAAA,kBAAA,CAAA,MAAA,OAAA,SAAA,WAAA,CAAA;AACV,IAAA,SAAS;IACT,WAAW,GAAoC,EAAE;IAEhD,mBAAmB,GAAG,KAAK;AAEpC,IAAA,WAAA,CAAA,YAAA,EAAA;;;;;AACE,QAAAC,QAAa,CAAC,QAAQ,EAAE,OAAO,OAAO,KAAI;AACxC,YAAA,MAAM,IAAI,CAAC,gBAAgB,EAAE;AAC/B,SAAC,CAAC;AACH;AAED,IAAA,MAAM,iBAAiB,GAAA;AACrB,QAAA,IAAI,IAAI,CAAC,WAAW,KAAK,EAAE,EAAE;YAC3BC,KAAY,CAAC,IAAI,GAAG,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,WAAW;;aACrG;AACL,YAAA,MAAM,IAAI,CAAC,gBAAgB,EAAE;;AAG/B,QAAAA,KAAY,CAAC,OAAO,GAAG,KAAK;;AAG9B,IAAA,MAAM,gBAAgB,GAAA;;QAEpB,IAAI,IAAI,CAAC,mBAAmB;YAAE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AAM,GAAA;AACJ,QAAA,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAACH,KAAY,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;QACvE,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAACA,KAAY,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;AACnF,QAAA,MAAM,SAAS,GAAGA,KAAY,CAAC,kBAAkB,KAAK,QAAQ;AAE9D,QAAA,IAAI,SAAS,CAAC,KAAK,CAAC,aAAa,EAAE;AACjC,YAAA,OAAO,IAAI,CAAC,mBAAmB,IAC7B,CAAM,CAAA,KAAA,EAAA,IAAA,EAAA,CAAC,CAAC,SAAS,CAAC,CAAO,KAEzB,EAAC,IAAI,EAAA,IAAA,EACH,CAAQ,CAAA,MAAA,EAAA,IAAA,CAAA,EACP,CAAC,cAAc,IAAI,QAAQ,IAAI,CAAe,CAAA,eAAA,EAAA,EAAA,OAAO,EAAC,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAI,CAAA,EACnF,SAAS,IAAI,CAAC,QAAQ,IAAI,CAAC,cAAc,IAAI,qBAAe,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,CAAC,CAAC,iBAAiB,CAAC,EAAA,CAAI,CAC3G,CACR;;QAGH,OAAO,cAAK,CAAC,CAAC,sBAAsB,CAAC,CAAM;;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement","unidyOnChange","profileState","Sentry.captureException","profileOnChange","authOnChange"],"sources":["src/profile/components/profile/profile.tsx"],"sourcesContent":["import * as Sentry from \"@sentry/browser\";\nimport { Component, Host, Method, Prop, State, h } from \"@stencil/core\";\nimport { t } from \"../../../i18n\";\nimport { Auth } from \"../../../auth\";\nimport { getUnidyClient } from \"../../../api\";\nimport { authStore, onChange as authOnChange } from \"../../../auth/store/auth-store\";\nimport { state as profileState, onChange as profileOnChange } from \"../../store/profile-store\";\nimport { onChange as unidyOnChange } from \"../../../shared/store/unidy-store\";\nimport type { ProfileRaw } from \"../../store/profile-store\";\nimport { validateRequiredFieldsUnchanged, buildPayload } from \"../../profile-helpers\";\n\n@Component({\n tag: \"u-profile\",\n shadow: false,\n})\nexport class Profile {\n @Prop() profileId?: string;\n @Prop() initialData: string | Record<string, string> = \"\";\n\n @State() fetchingProfileData = false;\n\n constructor() {\n unidyOnChange(\"locale\", async (_locale) => {\n await this.fetchProfileData();\n });\n }\n\n async componentWillLoad() {\n if (this.initialData !== \"\") {\n profileState.data = typeof this.initialData === \"string\" ? JSON.parse(this.initialData) : this.initialData;\n } else {\n await this.fetchProfileData();\n }\n\n profileState.loading = false;\n }\n\n async fetchProfileData() {\n // avoid multiple requests\n if (this.fetchingProfileData) return;\n\n const authInstance = await Auth.getInstance();\n const isAuthenticated = await authInstance.isAuthenticated();\n if (!isAuthenticated) {\n // Handle unauthenticated state the same as an unauthorized error from backend\n profileState.flashErrors = { error: t(\"errors.unauthorized\") };\n return;\n }\n\n this.fetchingProfileData = true;\n try {\n const [error, data] = await getUnidyClient().profile.get();\n\n if (error === null && data) {\n profileState.configuration = JSON.parse(JSON.stringify(data)) as ProfileRaw;\n profileState.configUpdateSource = \"fetch\";\n profileState.errors = {};\n profileState.flashErrors = {};\n\n profileState.data = JSON.parse(JSON.stringify(data)) as ProfileRaw;\n } else {\n profileState.flashErrors = { error: error || \"unknown_error\" };\n }\n } catch (err) {\n Sentry.captureException(err);\n profileState.flashErrors = { error: t(\"errors.failed_to_load_profile\") };\n }\n this.fetchingProfileData = false;\n }\n\n @Method()\n async submitProfile() {\n profileState.loading = true;\n\n const { configuration, ...stateWithoutConfig } = profileState;\n\n if (!validateRequiredFieldsUnchanged(stateWithoutConfig.data)) {\n profileState.loading = false;\n return;\n }\n\n const updatedProfileData = buildPayload(stateWithoutConfig.data);\n\n const [error, data] = await getUnidyClient().profile.update({\n payload: updatedProfileData,\n });\n\n if (error === null && data) {\n profileState.loading = false;\n profileState.configuration = JSON.parse(JSON.stringify(data));\n profileState.configUpdateSource = \"submit\";\n profileState.errors = {};\n } else if (error === \"validation_error\" && data && \"flatErrors\" in data) {\n profileState.errors = data.flatErrors as Record<string, string>;\n profileState.loading = false;\n } else {\n profileState.flashErrors = { error: error || \"unknown_error\" };\n profileState.loading = false;\n }\n }\n\n componentDidLoad() {\n profileOnChange(\"configuration\", (cfg) => {\n profileState.data = cfg as ProfileRaw;\n });\n\n authOnChange(\"token\", (newToken: string | null) => {\n if (newToken) {\n this.fetchProfileData();\n }\n });\n }\n\n render() {\n const hasFieldErrors = Object.values(profileState.errors).some(Boolean);\n const errorMsg = Object.values(profileState.flashErrors).filter(Boolean).join(\", \");\n const wasSubmit = profileState.configUpdateSource === \"submit\";\n\n if (authStore.state.authenticated) {\n return this.fetchingProfileData ? (\n <div>{t(\"loading\")}</div>\n ) : (\n <Host>\n <slot />\n {!hasFieldErrors && errorMsg && <flash-message variant=\"error\" message={errorMsg} />}\n {wasSubmit && !errorMsg && !hasFieldErrors && <flash-message variant=\"success\" message={t(\"profile.updated\")} />}\n </Host>\n );\n }\n\n return <h2>{t(\"profile.signInToView\")}</h2>;\n }\n}\n"],"version":3}
@@ -1,6 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
2
 
3
- const spinnerCss = "/*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer theme{:host,:root{--u-animate-spin:spin 1s linear infinite;--u-font-sans:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--u-font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--u-default-font-family:var(--u-font-sans);--u-default-mono-font-family:var(--u-font-mono);--font-sans:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,::backdrop,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}::file-selector-button{appearance:button;background-color:#0000;border:0 solid;border-radius:0;box-sizing:border-box;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;margin:0;margin-inline-end:4px;opacity:1;padding:0}:host,html{font-family:var(--u-default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--u-default-font-feature-settings,normal);font-variation-settings:var(--u-default-font-variation-settings,normal);-webkit-text-size-adjust:100%;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);tab-size:4;-webkit-tap-highlight-color:transparent;line-height:1.5}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--u-default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--u-default-mono-font-feature-settings,normal);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--u-default-mono-font-variation-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}button,input,optgroup,select,textarea{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:currentColor;color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex;padding-block:0}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.u\\:inline-flex{display:inline-flex}.u\\:h-\\[1em\\]{height:1em}.u\\:w-\\[1em\\]{width:1em}.u\\:animate-spin{animation:var(--u-animate-spin)}.u\\:items-center{align-items:center}.u\\:justify-center{justify-content:center}.u\\:rounded-\\[50\\%\\]{border-radius:50%}}@keyframes spin{to{transform:rotate(1turn)}} /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components;@layer utilities{.u\\:flex{display:flex}.u\\:disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.u\\:disabled\\:opacity-50:disabled{opacity:.5}.u\\:justify-end{justify-content:flex-end}} /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components;@layer utilities{} /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-ring-offset-width:0px;--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer base{}@layer components;@layer utilities{.container{width:100%}.border{border-style:var(--tw-border-style);border-width:1px}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}:host{font-size:var(--spinner-font-size,20px)}.spinner-inner{border-top:.1em solid var(--spinner-color-secondary,#ccc);border:.1em solid var(--spinner-color-secondary,#ccc);border-top-color:var(--spinner-color-primary,#333)}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}";
3
+ const spinnerCss = "/*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer theme{:host,:root{--u-animate-spin:spin 1s linear infinite;--u-font-sans:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--u-font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--u-default-font-family:var(--u-font-sans);--u-default-mono-font-family:var(--u-font-mono);--font-sans:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,::backdrop,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}::file-selector-button{appearance:button;background-color:#0000;border:0 solid;border-radius:0;box-sizing:border-box;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;margin:0;margin-inline-end:4px;opacity:1;padding:0}:host,html{font-family:var(--u-default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--u-default-font-feature-settings,normal);font-variation-settings:var(--u-default-font-variation-settings,normal);-webkit-text-size-adjust:100%;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);tab-size:4;-webkit-tap-highlight-color:transparent;line-height:1.5}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--u-default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--u-default-mono-font-feature-settings,normal);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--u-default-mono-font-variation-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}button,input,optgroup,select,textarea{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:currentColor;color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex;padding-block:0}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.u\\:flex{display:flex}.u\\:justify-center{justify-content:center}.u\\:disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.u\\:disabled\\:opacity-50:disabled{opacity:.5}.u\\:inline-flex{display:inline-flex}.u\\:h-\\[1em\\]{height:1em}.u\\:w-\\[1em\\]{width:1em}.u\\:animate-spin{animation:var(--u-animate-spin)}.u\\:items-center{align-items:center}.u\\:rounded-\\[50\\%\\]{border-radius:50%}} /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components;@layer utilities{}@keyframes spin{to{transform:rotate(1turn)}} /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components;@layer utilities{.u\\:justify-end{justify-content:flex-end}} /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-ring-offset-width:0px;--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer base{}@layer components;@layer utilities{.container{width:100%}.border{border-style:var(--tw-border-style);border-width:1px}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}:host{font-size:var(--spinner-font-size,20px)}.spinner-inner{border-top:.1em solid var(--spinner-color-secondary,#ccc);border:.1em solid var(--spinner-color-secondary,#ccc);border-top-color:var(--spinner-color-primary,#333)}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}";
4
4
 
5
5
  const Spinner = /*@__PURE__*/ proxyCustomElement(class Spinner extends HTMLElement {
6
6
  constructor(registerHost) {
@@ -1 +1 @@
1
- {"file":"spinner.js","mappings":";;AAAA,MAAM,UAAU,GAAG,+3RAA+3R;;MCOr4R,OAAO,iBAAAA,kBAAA,CAAA,MAAA,OAAA,SAAA,WAAA,CAAA;;;;;;;;IAClB,MAAM,GAAA;AACJ,QAAA,QACE,CAAC,CAAA,IAAI,EAAC,EAAA,GAAA,EAAA,0CAAA,EAAA,KAAK,EAAC,+CAA+C,EAAA,EAEzD,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,KAAK,EAAC,kEAAkE,EAAC,IAAI,EAAC,SAAS,EAAC,IAAI,EAAC,QAAQ,EAAY,YAAA,EAAA,SAAS,EAAG,CAAA,CAC7H;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement"],"sources":["src/shared/components/spinner/spinner.css?tag=u-spinner&encapsulation=shadow","src/shared/components/spinner/spinner.tsx"],"sourcesContent":[":host {\n font-size: var(--spinner-font-size, 20px);\n}\n\n.spinner-inner {\n border: 0.1em solid var(--spinner-color-secondary, #ccc);\n border-top: 0.1em solid var(--spinner-color-primary, #333);\n}\n","import { Component, h, Host } from \"@stencil/core\";\n\n@Component({\n tag: \"u-spinner\",\n styleUrl: \"spinner.css\",\n shadow: true,\n})\nexport class Spinner {\n render() {\n return (\n <Host class=\"u:inline-flex u:items-center u:justify-center\">\n {/* biome-ignore lint/a11y/useSemanticElements: spinner is a visual element, output tag not appropriate */}\n <div class=\"spinner-inner u:w-[1em] u:h-[1em] u:rounded-[50%] u:animate-spin\" part=\"spinner\" role=\"status\" aria-label=\"Loading\" />\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"spinner.js","mappings":";;AAAA,MAAM,UAAU,GAAG,2xSAA2xS;;MCOjyS,OAAO,iBAAAA,kBAAA,CAAA,MAAA,OAAA,SAAA,WAAA,CAAA;;;;;;;;IAClB,MAAM,GAAA;AACJ,QAAA,QACE,CAAC,CAAA,IAAI,EAAC,EAAA,GAAA,EAAA,0CAAA,EAAA,KAAK,EAAC,+CAA+C,EAAA,EAEzD,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,KAAK,EAAC,kEAAkE,EAAC,IAAI,EAAC,SAAS,EAAC,IAAI,EAAC,QAAQ,EAAY,YAAA,EAAA,SAAS,EAAG,CAAA,CAC7H;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement"],"sources":["src/shared/components/spinner/spinner.css?tag=u-spinner&encapsulation=shadow","src/shared/components/spinner/spinner.tsx"],"sourcesContent":[":host {\n font-size: var(--spinner-font-size, 20px);\n}\n\n.spinner-inner {\n border: 0.1em solid var(--spinner-color-secondary, #ccc);\n border-top: 0.1em solid var(--spinner-color-primary, #333);\n}\n","import { Component, h, Host } from \"@stencil/core\";\n\n@Component({\n tag: \"u-spinner\",\n styleUrl: \"spinner.css\",\n shadow: true,\n})\nexport class Spinner {\n render() {\n return (\n <Host class=\"u:inline-flex u:items-center u:justify-center\">\n {/* biome-ignore lint/a11y/useSemanticElements: spinner is a visual element, output tag not appropriate */}\n <div class=\"spinner-inner u:w-[1em] u:h-[1em] u:rounded-[50%] u:animate-spin\" part=\"spinner\" role=\"status\" aria-label=\"Loading\" />\n </Host>\n );\n }\n}\n"],"version":3}