@mesob/auth-react 0.3.5 → 0.4.1

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 (372) hide show
  1. package/dist/chunk-35TCGAW3.js +98 -0
  2. package/dist/chunk-35TCGAW3.js.map +1 -0
  3. package/dist/chunk-3BZC4VVD.js +36 -0
  4. package/dist/chunk-3BZC4VVD.js.map +1 -0
  5. package/dist/chunk-45UCLKH2.js +188 -0
  6. package/dist/chunk-45UCLKH2.js.map +1 -0
  7. package/dist/chunk-55BMNC4S.js +115 -0
  8. package/dist/chunk-55BMNC4S.js.map +1 -0
  9. package/dist/chunk-5F5FZMHE.js +94 -0
  10. package/dist/chunk-5F5FZMHE.js.map +1 -0
  11. package/dist/chunk-5M7I7WNH.js +31 -0
  12. package/dist/chunk-5M7I7WNH.js.map +1 -0
  13. package/dist/chunk-72YRO3A7.js +288 -0
  14. package/dist/chunk-72YRO3A7.js.map +1 -0
  15. package/dist/chunk-7KXTL6NT.js +48 -0
  16. package/dist/chunk-7KXTL6NT.js.map +1 -0
  17. package/dist/chunk-AIMD6R6U.js +466 -0
  18. package/dist/chunk-AIMD6R6U.js.map +1 -0
  19. package/dist/chunk-BGSHXIHI.js +953 -0
  20. package/dist/chunk-BGSHXIHI.js.map +1 -0
  21. package/dist/chunk-BZ42QPXE.js +271 -0
  22. package/dist/chunk-BZ42QPXE.js.map +1 -0
  23. package/dist/chunk-C26NPUPI.js +272 -0
  24. package/dist/chunk-C26NPUPI.js.map +1 -0
  25. package/dist/chunk-C2KFZ57H.js +194 -0
  26. package/dist/chunk-C2KFZ57H.js.map +1 -0
  27. package/dist/chunk-C5ZW7FD2.js +46 -0
  28. package/dist/chunk-C5ZW7FD2.js.map +1 -0
  29. package/dist/chunk-DPH2PHK3.js +32 -0
  30. package/dist/chunk-DPH2PHK3.js.map +1 -0
  31. package/dist/chunk-EQ4346FE.js +139 -0
  32. package/dist/chunk-EQ4346FE.js.map +1 -0
  33. package/dist/chunk-FAHN63DA.js +535 -0
  34. package/dist/chunk-FAHN63DA.js.map +1 -0
  35. package/dist/chunk-FBABIA5J.js +345 -0
  36. package/dist/chunk-FBABIA5J.js.map +1 -0
  37. package/dist/chunk-FFR5UHTS.js +99 -0
  38. package/dist/chunk-FFR5UHTS.js.map +1 -0
  39. package/dist/chunk-FHOLUOOZ.js +164 -0
  40. package/dist/chunk-FHOLUOOZ.js.map +1 -0
  41. package/dist/chunk-G2AW2H36.js +11 -0
  42. package/dist/chunk-G2AW2H36.js.map +1 -0
  43. package/dist/chunk-G7SCXCCM.js +89 -0
  44. package/dist/chunk-G7SCXCCM.js.map +1 -0
  45. package/dist/chunk-GP7GIUI3.js +64 -0
  46. package/dist/chunk-GP7GIUI3.js.map +1 -0
  47. package/dist/chunk-GRT6EBR6.js +93 -0
  48. package/dist/chunk-GRT6EBR6.js.map +1 -0
  49. package/dist/chunk-GXKBVCVS.js +102 -0
  50. package/dist/chunk-GXKBVCVS.js.map +1 -0
  51. package/dist/chunk-HOO2VLNM.js +305 -0
  52. package/dist/chunk-HOO2VLNM.js.map +1 -0
  53. package/dist/chunk-II5MLBSB.js +183 -0
  54. package/dist/chunk-II5MLBSB.js.map +1 -0
  55. package/dist/chunk-ISNNPMF7.js +95 -0
  56. package/dist/chunk-ISNNPMF7.js.map +1 -0
  57. package/dist/chunk-JB6XVST4.js +141 -0
  58. package/dist/chunk-JB6XVST4.js.map +1 -0
  59. package/dist/chunk-JUHBVG5Q.js +303 -0
  60. package/dist/chunk-JUHBVG5Q.js.map +1 -0
  61. package/dist/chunk-JZZJCBAE.js +118 -0
  62. package/dist/chunk-JZZJCBAE.js.map +1 -0
  63. package/dist/chunk-KWG4DSB5.js +55 -0
  64. package/dist/chunk-KWG4DSB5.js.map +1 -0
  65. package/dist/chunk-L4CGIO2I.js +265 -0
  66. package/dist/chunk-L4CGIO2I.js.map +1 -0
  67. package/dist/chunk-LNG736CV.js +19 -0
  68. package/dist/chunk-LNG736CV.js.map +1 -0
  69. package/dist/chunk-LSYKVFJA.js +98 -0
  70. package/dist/chunk-LSYKVFJA.js.map +1 -0
  71. package/dist/chunk-LZR4YUDV.js +107 -0
  72. package/dist/chunk-LZR4YUDV.js.map +1 -0
  73. package/dist/chunk-MELNS4QH.js +255 -0
  74. package/dist/chunk-MELNS4QH.js.map +1 -0
  75. package/dist/chunk-MS2JUZ3N.js +94 -0
  76. package/dist/chunk-MS2JUZ3N.js.map +1 -0
  77. package/dist/chunk-NEO72TMH.js +32 -0
  78. package/dist/chunk-NEO72TMH.js.map +1 -0
  79. package/dist/chunk-NJPNTAAT.js +68 -0
  80. package/dist/chunk-NJPNTAAT.js.map +1 -0
  81. package/dist/chunk-NPW7D2HZ.js +16 -0
  82. package/dist/chunk-NPW7D2HZ.js.map +1 -0
  83. package/dist/chunk-OAN4EXU4.js +310 -0
  84. package/dist/chunk-OAN4EXU4.js.map +1 -0
  85. package/dist/chunk-OFLSINVU.js +138 -0
  86. package/dist/chunk-OFLSINVU.js.map +1 -0
  87. package/dist/chunk-OHIIMUQC.js +286 -0
  88. package/dist/chunk-OHIIMUQC.js.map +1 -0
  89. package/dist/chunk-OQGJX37L.js +239 -0
  90. package/dist/chunk-OQGJX37L.js.map +1 -0
  91. package/dist/chunk-OYHH7HQG.js +65 -0
  92. package/dist/chunk-OYHH7HQG.js.map +1 -0
  93. package/dist/chunk-PSRIZMWJ.js +486 -0
  94. package/dist/chunk-PSRIZMWJ.js.map +1 -0
  95. package/dist/chunk-QNCE2B5O.js +23 -0
  96. package/dist/chunk-QNCE2B5O.js.map +1 -0
  97. package/dist/chunk-RLPZFLAS.js +23 -0
  98. package/dist/chunk-RLPZFLAS.js.map +1 -0
  99. package/dist/chunk-RT5C7IAE.js +38 -0
  100. package/dist/chunk-RT5C7IAE.js.map +1 -0
  101. package/dist/chunk-S3CXCCKL.js +272 -0
  102. package/dist/chunk-S3CXCCKL.js.map +1 -0
  103. package/dist/chunk-SOCZK4CV.js +69 -0
  104. package/dist/chunk-SOCZK4CV.js.map +1 -0
  105. package/dist/chunk-T6P7UHVP.js +34 -0
  106. package/dist/chunk-T6P7UHVP.js.map +1 -0
  107. package/dist/chunk-TFVBER3Y.js +52 -0
  108. package/dist/chunk-TFVBER3Y.js.map +1 -0
  109. package/dist/chunk-UXOZ2TME.js +104 -0
  110. package/dist/chunk-UXOZ2TME.js.map +1 -0
  111. package/dist/chunk-V2W3WPCZ.js +22 -0
  112. package/dist/chunk-V2W3WPCZ.js.map +1 -0
  113. package/dist/chunk-YZ264S2L.js +286 -0
  114. package/dist/chunk-YZ264S2L.js.map +1 -0
  115. package/dist/chunk-ZESFGO3K.js +28 -0
  116. package/dist/chunk-ZESFGO3K.js.map +1 -0
  117. package/dist/chunk-ZG6WFZHX.js +143 -0
  118. package/dist/chunk-ZG6WFZHX.js.map +1 -0
  119. package/dist/components/auth/auth-card.d.ts +3 -6
  120. package/dist/components/auth/auth-card.js +3 -7
  121. package/dist/components/auth/auth-card.js.map +1 -1
  122. package/dist/components/auth/auth-layout.d.ts +3 -6
  123. package/dist/components/auth/auth-layout.js +3 -28
  124. package/dist/components/auth/auth-layout.js.map +1 -1
  125. package/dist/components/auth/countdown.d.ts +2 -5
  126. package/dist/components/auth/countdown.js +5 -130
  127. package/dist/components/auth/countdown.js.map +1 -1
  128. package/dist/components/auth/forgot-password.d.ts +1 -5
  129. package/dist/components/auth/forgot-password.js +6 -361
  130. package/dist/components/auth/forgot-password.js.map +1 -1
  131. package/dist/components/auth/reset-password-form.d.ts +2 -5
  132. package/dist/components/auth/reset-password-form.js +6 -483
  133. package/dist/components/auth/reset-password-form.js.map +1 -1
  134. package/dist/components/auth/set-password.d.ts +6 -0
  135. package/dist/components/auth/set-password.js +13 -0
  136. package/dist/components/auth/set-password.js.map +1 -0
  137. package/dist/components/auth/sign-in.d.ts +2 -5
  138. package/dist/components/auth/sign-in.js +7 -540
  139. package/dist/components/auth/sign-in.js.map +1 -1
  140. package/dist/components/auth/sign-up.d.ts +2 -5
  141. package/dist/components/auth/sign-up.js +6 -509
  142. package/dist/components/auth/sign-up.js.map +1 -1
  143. package/dist/components/auth/verification-form.d.ts +13 -2
  144. package/dist/components/auth/verification-form.js +5 -217
  145. package/dist/components/auth/verification-form.js.map +1 -1
  146. package/dist/components/auth/verify-email.d.ts +2 -5
  147. package/dist/components/auth/verify-email.js +8 -523
  148. package/dist/components/auth/verify-email.js.map +1 -1
  149. package/dist/components/auth/verify-phone.d.ts +2 -5
  150. package/dist/components/auth/verify-phone.js +8 -528
  151. package/dist/components/auth/verify-phone.js.map +1 -1
  152. package/dist/components/authorization/deny.d.ts +8 -0
  153. package/dist/components/authorization/deny.js +9 -0
  154. package/dist/components/authorization/deny.js.map +1 -0
  155. package/dist/components/authorization/grant.d.ts +9 -0
  156. package/dist/components/authorization/grant.js +9 -0
  157. package/dist/components/authorization/grant.js.map +1 -0
  158. package/dist/components/error-boundary.d.ts +6 -10
  159. package/dist/components/error-boundary.js +4 -43
  160. package/dist/components/error-boundary.js.map +1 -1
  161. package/dist/components/iam/permission-selector.d.ts +16 -0
  162. package/dist/components/iam/permission-selector.js +9 -0
  163. package/dist/components/iam/permission-selector.js.map +1 -0
  164. package/dist/components/iam/permissions-page.d.ts +1 -0
  165. package/dist/components/iam/permissions-page.js +10 -0
  166. package/dist/components/iam/permissions-page.js.map +1 -0
  167. package/dist/components/iam/permissions.d.ts +1 -5
  168. package/dist/components/iam/permissions.js +5 -217
  169. package/dist/components/iam/permissions.js.map +1 -1
  170. package/dist/components/iam/role-detail-layout.d.ts +8 -0
  171. package/dist/components/iam/role-detail-layout.js +9 -0
  172. package/dist/components/iam/role-detail-layout.js.map +1 -0
  173. package/dist/components/iam/role-detail-page.d.ts +6 -0
  174. package/dist/components/iam/role-detail-page.js +9 -0
  175. package/dist/components/iam/role-detail-page.js.map +1 -0
  176. package/dist/components/iam/role-permissions-page.d.ts +5 -0
  177. package/dist/components/iam/role-permissions-page.js +10 -0
  178. package/dist/components/iam/role-permissions-page.js.map +1 -0
  179. package/dist/components/iam/roles-page.d.ts +1 -0
  180. package/dist/components/iam/roles-page.js +13 -0
  181. package/dist/components/iam/roles-page.js.map +1 -0
  182. package/dist/components/iam/roles.d.ts +1 -5
  183. package/dist/components/iam/roles.js +5 -215
  184. package/dist/components/iam/roles.js.map +1 -1
  185. package/dist/components/iam/sessions-page.d.ts +1 -0
  186. package/dist/components/iam/sessions-page.js +12 -0
  187. package/dist/components/iam/sessions-page.js.map +1 -0
  188. package/dist/components/iam/sessions.d.ts +1 -5
  189. package/dist/components/iam/sessions.js +5 -198
  190. package/dist/components/iam/sessions.js.map +1 -1
  191. package/dist/components/iam/tenants-page.d.ts +1 -0
  192. package/dist/components/iam/tenants-page.js +13 -0
  193. package/dist/components/iam/tenants-page.js.map +1 -0
  194. package/dist/components/iam/tenants.d.ts +1 -5
  195. package/dist/components/iam/tenants.js +5 -204
  196. package/dist/components/iam/tenants.js.map +1 -1
  197. package/dist/components/iam/users-page.d.ts +1 -0
  198. package/dist/components/iam/users-page.js +13 -0
  199. package/dist/components/iam/users-page.js.map +1 -0
  200. package/dist/components/iam/users.d.ts +1 -5
  201. package/dist/components/iam/users.js +5 -213
  202. package/dist/components/iam/users.js.map +1 -1
  203. package/dist/components/profile/account.d.ts +1 -5
  204. package/dist/components/profile/account.js +5 -61
  205. package/dist/components/profile/account.js.map +1 -1
  206. package/dist/components/profile/change-email-form.d.ts +1 -5
  207. package/dist/components/profile/change-email-form.js +9 -735
  208. package/dist/components/profile/change-email-form.js.map +1 -1
  209. package/dist/components/profile/change-password-form.d.ts +1 -5
  210. package/dist/components/profile/change-password-form.js +3 -262
  211. package/dist/components/profile/change-password-form.js.map +1 -1
  212. package/dist/components/profile/change-phone-form.d.ts +1 -5
  213. package/dist/components/profile/change-phone-form.js +10 -772
  214. package/dist/components/profile/change-phone-form.js.map +1 -1
  215. package/dist/components/profile/change-profile.d.ts +3 -6
  216. package/dist/components/profile/change-profile.js +2 -32
  217. package/dist/components/profile/change-profile.js.map +1 -1
  218. package/dist/components/profile/otp-verification-modal.d.ts +2 -5
  219. package/dist/components/profile/otp-verification-modal.js +6 -266
  220. package/dist/components/profile/otp-verification-modal.js.map +1 -1
  221. package/dist/components/profile/profile-layout.d.ts +4 -0
  222. package/dist/components/profile/profile-layout.js +10 -0
  223. package/dist/components/profile/profile-layout.js.map +1 -0
  224. package/dist/components/profile/request-change-email-form.d.ts +2 -5
  225. package/dist/components/profile/request-change-email-form.js +4 -285
  226. package/dist/components/profile/request-change-email-form.js.map +1 -1
  227. package/dist/components/profile/request-change-phone-form.d.ts +2 -5
  228. package/dist/components/profile/request-change-phone-form.js +5 -323
  229. package/dist/components/profile/request-change-phone-form.js.map +1 -1
  230. package/dist/components/profile/security.d.ts +1 -5
  231. package/dist/components/profile/security.js +15 -1474
  232. package/dist/components/profile/security.js.map +1 -1
  233. package/dist/components/profile/verify-change-email-form.d.ts +2 -5
  234. package/dist/components/profile/verify-change-email-form.js +7 -407
  235. package/dist/components/profile/verify-change-email-form.js.map +1 -1
  236. package/dist/components/profile/verify-change-phone-form.d.ts +2 -5
  237. package/dist/components/profile/verify-change-phone-form.js +7 -411
  238. package/dist/components/profile/verify-change-phone-form.js.map +1 -1
  239. package/dist/components/shared/data-table.d.ts +5 -8
  240. package/dist/components/shared/data-table.js +3 -79
  241. package/dist/components/shared/data-table.js.map +1 -1
  242. package/dist/components/skeletons/auth-form-skeleton.d.ts +1 -5
  243. package/dist/components/skeletons/auth-form-skeleton.js +3 -27
  244. package/dist/components/skeletons/auth-form-skeleton.js.map +1 -1
  245. package/dist/components/skeletons/profile-skeleton.d.ts +1 -5
  246. package/dist/components/skeletons/profile-skeleton.js +3 -28
  247. package/dist/components/skeletons/profile-skeleton.js.map +1 -1
  248. package/dist/components/skeletons/table-skeleton.d.ts +2 -5
  249. package/dist/components/skeletons/table-skeleton.js +3 -34
  250. package/dist/components/skeletons/table-skeleton.js.map +1 -1
  251. package/dist/constants/auth.error.codes.d.ts +5 -0
  252. package/dist/hooks/use-session-cookie-name.d.ts +1 -0
  253. package/dist/hooks/use-translator.d.ts +1 -0
  254. package/dist/index.d.ts +50 -84
  255. package/dist/index.js +160 -3861
  256. package/dist/index.js.map +1 -1
  257. package/dist/lib/query-options.d.ts +10 -0
  258. package/dist/lib/translations.d.ts +3 -0
  259. package/dist/pages/auth/forgot-password.d.ts +3 -0
  260. package/dist/pages/auth/forgot-password.js +22 -0
  261. package/dist/pages/auth/forgot-password.js.map +1 -0
  262. package/dist/pages/auth/layout.d.ts +4 -0
  263. package/dist/pages/auth/layout.js +39 -0
  264. package/dist/pages/auth/layout.js.map +1 -0
  265. package/dist/pages/auth/reset-password.d.ts +7 -0
  266. package/dist/pages/auth/reset-password.js +33 -0
  267. package/dist/pages/auth/reset-password.js.map +1 -0
  268. package/dist/pages/auth/set-password.d.ts +7 -0
  269. package/dist/pages/auth/set-password.js +28 -0
  270. package/dist/pages/auth/set-password.js.map +1 -0
  271. package/dist/pages/auth/sign-in.d.ts +7 -0
  272. package/dist/pages/auth/sign-in.js +26 -0
  273. package/dist/pages/auth/sign-in.js.map +1 -0
  274. package/dist/pages/auth/sign-up.d.ts +7 -0
  275. package/dist/pages/auth/sign-up.js +33 -0
  276. package/dist/pages/auth/sign-up.js.map +1 -0
  277. package/dist/pages/auth/verify-email.d.ts +7 -0
  278. package/dist/pages/auth/verify-email.js +38 -0
  279. package/dist/pages/auth/verify-email.js.map +1 -0
  280. package/dist/pages/auth/verify-phone.d.ts +7 -0
  281. package/dist/pages/auth/verify-phone.js +47 -0
  282. package/dist/pages/auth/verify-phone.js.map +1 -0
  283. package/dist/pages/iam/permissions/_components/permission-card.d.ts +6 -0
  284. package/dist/pages/iam/permissions/_components/permissions-data.d.ts +7 -0
  285. package/dist/pages/iam/permissions/_components/permissions-list.d.ts +14 -0
  286. package/dist/pages/iam/permissions.d.ts +1 -0
  287. package/dist/pages/iam/permissions.js +10 -0
  288. package/dist/pages/iam/permissions.js.map +1 -0
  289. package/dist/pages/iam/role-detail-layout.d.ts +9 -0
  290. package/dist/pages/iam/role-detail-layout.js +18 -0
  291. package/dist/pages/iam/role-detail-layout.js.map +1 -0
  292. package/dist/pages/iam/role-detail.d.ts +9 -0
  293. package/dist/pages/iam/role-detail.js +22 -0
  294. package/dist/pages/iam/role-detail.js.map +1 -0
  295. package/dist/pages/iam/role-permissions.d.ts +9 -0
  296. package/dist/pages/iam/role-permissions.js +23 -0
  297. package/dist/pages/iam/role-permissions.js.map +1 -0
  298. package/dist/pages/iam/role-users.d.ts +9 -0
  299. package/dist/pages/iam/role-users.js +26 -0
  300. package/dist/pages/iam/role-users.js.map +1 -0
  301. package/dist/pages/iam/roles/_components/role-card.d.ts +7 -0
  302. package/dist/pages/iam/roles/_components/role-form.d.ts +9 -0
  303. package/dist/pages/iam/roles/_components/role-selector.d.ts +11 -0
  304. package/dist/pages/iam/roles/_components/roles-data.d.ts +16 -0
  305. package/dist/pages/iam/roles/_components/roles-list.d.ts +15 -0
  306. package/dist/pages/iam/roles/users/_components/role-users-page.d.ts +5 -0
  307. package/dist/pages/iam/roles.d.ts +1 -0
  308. package/dist/pages/iam/roles.js +13 -0
  309. package/dist/pages/iam/roles.js.map +1 -0
  310. package/dist/pages/iam/sessions/_components/session-card.d.ts +6 -0
  311. package/dist/pages/iam/sessions/_components/sessions-data.d.ts +7 -0
  312. package/dist/pages/iam/sessions/_components/sessions-list.d.ts +14 -0
  313. package/dist/pages/iam/sessions.d.ts +1 -0
  314. package/dist/pages/iam/sessions.js +12 -0
  315. package/dist/pages/iam/sessions.js.map +1 -0
  316. package/dist/pages/iam/shared/navigation.d.ts +8 -0
  317. package/dist/pages/iam/shared/page-helpers.d.ts +12 -0
  318. package/dist/pages/iam/tenant-detail.d.ts +7 -0
  319. package/dist/pages/iam/tenant-detail.js +18 -0
  320. package/dist/pages/iam/tenant-detail.js.map +1 -0
  321. package/dist/pages/iam/tenants/_components/tenant-card.d.ts +6 -0
  322. package/dist/pages/iam/tenants/_components/tenant-form.d.ts +9 -0
  323. package/dist/pages/iam/tenants/_components/tenant-selector.d.ts +13 -0
  324. package/dist/pages/iam/tenants/_components/tenants-data.d.ts +12 -0
  325. package/dist/pages/iam/tenants/_components/tenants-list.d.ts +15 -0
  326. package/dist/pages/iam/tenants/tenant-detail-page-content.d.ts +5 -0
  327. package/dist/pages/iam/tenants.d.ts +1 -0
  328. package/dist/pages/iam/tenants.js +13 -0
  329. package/dist/pages/iam/tenants.js.map +1 -0
  330. package/dist/pages/iam/user-activity.d.ts +7 -0
  331. package/dist/pages/iam/user-activity.js +21 -0
  332. package/dist/pages/iam/user-activity.js.map +1 -0
  333. package/dist/pages/iam/user-detail-layout.d.ts +9 -0
  334. package/dist/pages/iam/user-detail-layout.js +18 -0
  335. package/dist/pages/iam/user-detail-layout.js.map +1 -0
  336. package/dist/pages/iam/user-detail.d.ts +7 -0
  337. package/dist/pages/iam/user-detail.js +15 -0
  338. package/dist/pages/iam/user-detail.js.map +1 -0
  339. package/dist/pages/iam/users/_components/bulk-invite-user-form.d.ts +6 -0
  340. package/dist/pages/iam/users/_components/invite-user-form.d.ts +6 -0
  341. package/dist/pages/iam/users/_components/invite-user-shared.d.ts +25 -0
  342. package/dist/pages/iam/users/_components/user-card.d.ts +6 -0
  343. package/dist/pages/iam/users/_components/user-detail-layout-content.d.ts +6 -0
  344. package/dist/pages/iam/users/_components/user-detail-page-content.d.ts +5 -0
  345. package/dist/pages/iam/users/_components/user-form.d.ts +9 -0
  346. package/dist/pages/iam/users/_components/user-selector.d.ts +12 -0
  347. package/dist/pages/iam/users/_components/users-data.d.ts +22 -0
  348. package/dist/pages/iam/users/_components/users-list.d.ts +15 -0
  349. package/dist/pages/iam/users/activity/_components/role-section.d.ts +3 -0
  350. package/dist/pages/iam/users/activity/user-activity-page-content.d.ts +5 -0
  351. package/dist/pages/iam/users.d.ts +1 -0
  352. package/dist/pages/iam/users.js +13 -0
  353. package/dist/pages/iam/users.js.map +1 -0
  354. package/dist/pages/profile/_components/profile-sidebar.d.ts +1 -0
  355. package/dist/pages/profile/account.d.ts +1 -0
  356. package/dist/pages/profile/account.js +33 -0
  357. package/dist/pages/profile/account.js.map +1 -0
  358. package/dist/pages/profile/layout.d.ts +1 -0
  359. package/dist/pages/profile/layout.js +10 -0
  360. package/dist/pages/profile/layout.js.map +1 -0
  361. package/dist/pages/profile/security.d.ts +1 -0
  362. package/dist/pages/profile/security.js +44 -0
  363. package/dist/pages/profile/security.js.map +1 -0
  364. package/dist/provider.d.ts +53 -0
  365. package/dist/types.d.ts +96 -0
  366. package/dist/utils/cookie.d.ts +2 -0
  367. package/dist/utils/custom-fetch.d.ts +2 -0
  368. package/dist/utils/handle-error.d.ts +7 -0
  369. package/dist/utils/normalize-phone.d.ts +1 -0
  370. package/package.json +103 -4
  371. package/dist/types-vcfvnAzQ.d.ts +0 -69
  372. package/dist/verification-form-ipSRTtQB.d.ts +0 -22
@@ -1,740 +1,14 @@
1
1
  "use client";
2
-
3
- // src/components/profile/change-email-form.tsx
4
2
  import {
5
- Button as Button3,
6
- Collapsible,
7
- CollapsibleContent,
8
- CollapsibleTrigger
9
- } from "@mesob/ui/components";
10
- import { IconChevronDown } from "@tabler/icons-react";
11
- import { useState as useState5 } from "react";
12
-
13
- // src/provider.tsx
14
- import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
15
- import { deepmerge } from "deepmerge-ts";
16
- import createFetchClient from "openapi-fetch";
17
- import createClient from "openapi-react-query";
18
- import { createContext, useContext, useMemo, useState } from "react";
19
-
20
- // src/lib/translations.ts
21
- function createTranslator(messages, namespace) {
22
- return (key, params) => {
23
- const fullKey = namespace ? `${namespace}.${key}` : key;
24
- const keys = fullKey.split(".");
25
- let value = messages;
26
- for (const k of keys) {
27
- if (value && typeof value === "object" && value !== null) {
28
- value = value[k];
29
- } else {
30
- return fullKey;
31
- }
32
- }
33
- if (typeof value !== "string") {
34
- return fullKey;
35
- }
36
- if (params) {
37
- return value.replace(
38
- /\{(\w+)\}/g,
39
- (_, param) => String(params[param] ?? `{${param}}`)
40
- );
41
- }
42
- return value;
43
- };
44
- }
45
-
46
- // src/utils/cookie.ts
47
- var isProduction = typeof process !== "undefined" && process.env.NODE_ENV === "production";
48
-
49
- // src/provider.tsx
50
- import { jsx } from "react/jsx-runtime";
51
- var SessionContext = createContext(null);
52
- var ApiContext = createContext(null);
53
- var ConfigContext = createContext(null);
54
- var queryClient = new QueryClient({
55
- defaultOptions: {
56
- queries: {
57
- refetchOnWindowFocus: false
58
- }
59
- }
60
- });
61
- function useSession() {
62
- const context = useContext(SessionContext);
63
- if (!context) {
64
- throw new Error("useSession must be used within MesobAuthProvider");
65
- }
66
- return context;
67
- }
68
- function useApi() {
69
- const context = useContext(ApiContext);
70
- if (!context) {
71
- throw new Error("useApi must be used within MesobAuthProvider");
72
- }
73
- return context;
74
- }
75
- function useConfig() {
76
- const context = useContext(ConfigContext);
77
- if (!context) {
78
- throw new Error("useConfig must be used within MesobAuthProvider");
79
- }
80
- return context;
81
- }
82
-
83
- // src/components/profile/request-change-email-form.tsx
84
- import { zodResolver } from "@hookform/resolvers/zod";
85
- import { Button, Input, Label, Spinner } from "@mesob/ui/components";
86
- import { IconEye, IconEyeOff } from "@tabler/icons-react";
87
- import { useEffect, useState as useState2 } from "react";
88
- import { useForm } from "react-hook-form";
89
- import { toast } from "sonner";
90
- import { z } from "zod";
91
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
92
- var emailPasswordSchema = z.object({
93
- email: z.string().email("Invalid email address"),
94
- password: z.string().min(8, "Password must be at least 8 characters").max(128, "Password too long")
95
- });
96
- function isAuthError(error) {
97
- return typeof error === "object" && error !== null && ("code" in error || "message" in error || "name" in error);
98
- }
99
- function getErrorCode(error) {
100
- if (error.code) {
101
- return error.code;
102
- }
103
- if (error.message) {
104
- const upperMessage = error.message.toUpperCase().trim();
105
- const validCodes = [
106
- "USER_NOT_FOUND",
107
- "USER_EXISTS",
108
- "INVALID_PASSWORD",
109
- "VERIFICATION_EXPIRED",
110
- "VERIFICATION_MISMATCH",
111
- "VERIFICATION_NOT_FOUND",
112
- "TOO_MANY_ATTEMPTS",
113
- "UNAUTHORIZED"
114
- ];
115
- if (validCodes.includes(upperMessage)) {
116
- return upperMessage;
117
- }
118
- }
119
- return void 0;
120
- }
121
- function getErrorMessage(error) {
122
- if (isAuthError(error)) {
123
- const errorCode = getErrorCode(error);
124
- switch (errorCode) {
125
- case "USER_EXISTS":
126
- return "This email is already taken. Please use a different email.";
127
- case "VERIFICATION_EXPIRED":
128
- return "Verification code has expired. Please request a new one.";
129
- case "VERIFICATION_MISMATCH":
130
- return "Invalid verification code. Please try again.";
131
- case "VERIFICATION_NOT_FOUND":
132
- return "Verification not found. Please request a new code.";
133
- default:
134
- return error.message || "An error occurred. Please try again.";
135
- }
136
- }
137
- if (error instanceof Error) {
138
- return error.message;
139
- }
140
- return "An error occurred. Please try again.";
141
- }
142
- function RequestChangeEmailForm({
143
- onSuccess,
144
- onCancel,
145
- buttonText
146
- }) {
147
- const { user } = useSession();
148
- const { hooks } = useApi();
149
- const [isSubmitting, setIsSubmitting] = useState2(false);
150
- const [isChecking, setIsChecking] = useState2(true);
151
- const [showPassword, setShowPassword] = useState2(false);
152
- const getPendingAccountChangeQuery = hooks.useQuery(
153
- "get",
154
- "/account-change/pending",
155
- {},
156
- { enabled: false }
157
- );
158
- const verifyPasswordMutation = hooks.useMutation("post", "/password/verify");
159
- const checkUserMutation = hooks.useMutation("post", "/check-account");
160
- const requestEmailVerificationMutation = hooks.useMutation(
161
- "post",
162
- "/email/verification/request"
163
- );
164
- const emailPasswordForm = useForm({
165
- resolver: zodResolver(emailPasswordSchema),
166
- defaultValues: {
167
- email: "",
168
- password: ""
169
- }
170
- });
171
- const {
172
- register,
173
- handleSubmit,
174
- getValues,
175
- setValue,
176
- formState: { errors }
177
- } = emailPasswordForm;
178
- useEffect(() => {
179
- let active = true;
180
- const run = async () => {
181
- try {
182
- const data = await getPendingAccountChangeQuery.refetch();
183
- if (!active) {
184
- return;
185
- }
186
- const accountChange = data.data?.accountChange;
187
- const verificationId = data.data?.verificationId;
188
- if (accountChange?.changeType !== "email") {
189
- setIsChecking(false);
190
- return;
191
- }
192
- if (!accountChange.newEmail) {
193
- setIsChecking(false);
194
- return;
195
- }
196
- if (getValues("email")) {
197
- setIsChecking(false);
198
- return;
199
- }
200
- setValue("email", accountChange.newEmail, { shouldValidate: true });
201
- if (verificationId) {
202
- toast.message("Resuming verification\u2026");
203
- onSuccess(verificationId, accountChange.newEmail);
204
- return;
205
- }
206
- setIsChecking(false);
207
- } catch {
208
- setIsChecking(false);
209
- }
210
- };
211
- run().catch(() => void 0);
212
- return () => {
213
- active = false;
214
- };
215
- }, [getPendingAccountChangeQuery.refetch, getValues, onSuccess, setValue]);
216
- const onEmailPasswordSubmit = async (data) => {
217
- if (!user) {
218
- toast.error("User not found");
219
- return;
220
- }
221
- try {
222
- setIsSubmitting(true);
223
- await verifyPasswordMutation.mutateAsync({
224
- body: { password: data.password }
225
- });
226
- const checkResult = await checkUserMutation.mutateAsync({
227
- body: { identifier: data.email }
228
- });
229
- if (checkResult.data?.exists) {
230
- if (user?.email?.toLowerCase() === data.email.toLowerCase()) {
231
- toast.error("This is already your current email address.");
232
- return;
233
- }
234
- toast.error(
235
- "This email is already taken. Please use a different email."
236
- );
237
- return;
238
- }
239
- const verification = await requestEmailVerificationMutation.mutateAsync({
240
- body: { email: data.email }
241
- });
242
- toast.success("Verification code sent to your email");
243
- onSuccess(verification.data?.verificationId ?? "", data.email);
244
- } catch (error) {
245
- const errorMessage = getErrorMessage(error);
246
- if (isAuthError(error)) {
247
- const errorCode = getErrorCode(error);
248
- if (errorCode === "INVALID_PASSWORD" || errorCode === "USER_NOT_FOUND") {
249
- toast.error("Incorrect password. Please try again.");
250
- return;
251
- }
252
- }
253
- toast.error(errorMessage);
254
- } finally {
255
- setIsSubmitting(false);
256
- }
257
- };
258
- const isLoading = isSubmitting || isChecking;
259
- return /* @__PURE__ */ jsxs(
260
- "form",
261
- {
262
- onSubmit: handleSubmit(onEmailPasswordSubmit),
263
- className: "p-4 space-y-4 border-t",
264
- children: [
265
- /* @__PURE__ */ jsxs("div", { className: "space-y-4 w-full md:w-1/2", children: [
266
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
267
- /* @__PURE__ */ jsx2(Label, { htmlFor: "email", children: "New Email Address" }),
268
- /* @__PURE__ */ jsx2(
269
- Input,
270
- {
271
- id: "email",
272
- type: "email",
273
- placeholder: "Enter your new email",
274
- ...register("email"),
275
- disabled: isLoading
276
- }
277
- ),
278
- errors.email && /* @__PURE__ */ jsx2("p", { className: "text-sm text-destructive", children: errors.email.message })
279
- ] }),
280
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
281
- /* @__PURE__ */ jsx2(Label, { htmlFor: "password", children: "Password" }),
282
- /* @__PURE__ */ jsxs("div", { className: "relative", children: [
283
- /* @__PURE__ */ jsx2(
284
- Input,
285
- {
286
- id: "password",
287
- type: showPassword ? "text" : "password",
288
- autoComplete: "current-password",
289
- placeholder: "Enter your password",
290
- ...register("password"),
291
- disabled: isLoading
292
- }
293
- ),
294
- /* @__PURE__ */ jsx2(
295
- "button",
296
- {
297
- type: "button",
298
- onClick: () => setShowPassword(!showPassword),
299
- className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",
300
- disabled: isLoading,
301
- children: showPassword ? /* @__PURE__ */ jsx2(IconEyeOff, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx2(IconEye, { className: "h-4 w-4" })
302
- }
303
- )
304
- ] }),
305
- errors.password && /* @__PURE__ */ jsx2("p", { className: "text-sm text-destructive", children: errors.password.message })
306
- ] })
307
- ] }),
308
- /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
309
- /* @__PURE__ */ jsx2(
310
- Button,
311
- {
312
- type: "button",
313
- variant: "outline",
314
- onClick: onCancel,
315
- disabled: isLoading,
316
- children: "Cancel"
317
- }
318
- ),
319
- /* @__PURE__ */ jsxs(Button, { type: "submit", disabled: isLoading, children: [
320
- isLoading && /* @__PURE__ */ jsx2(Spinner, { className: "mr-2 h-4 w-4" }),
321
- isChecking ? "Checking\u2026" : buttonText
322
- ] })
323
- ] })
324
- ]
325
- }
326
- );
327
- }
328
-
329
- // src/components/profile/verify-change-email-form.tsx
330
- import { useState as useState4 } from "react";
331
- import { toast as toast2 } from "sonner";
332
-
333
- // src/components/profile/otp-verification-modal.tsx
334
- import {
335
- Dialog,
336
- DialogContent,
337
- DialogDescription,
338
- DialogHeader,
339
- DialogTitle
340
- } from "@mesob/ui/components";
341
-
342
- // src/components/auth/verification-form.tsx
343
- import { zodResolver as zodResolver2 } from "@hookform/resolvers/zod";
344
- import {
345
- Button as Button2,
346
- Form,
347
- FormControl,
348
- FormField,
349
- FormItem,
350
- FormLabel,
351
- FormMessage,
352
- InputOTP,
353
- InputOTPGroup,
354
- InputOTPSlot
355
- } from "@mesob/ui/components";
356
- import { useForm as useForm2 } from "react-hook-form";
357
- import { z as z2 } from "zod";
358
-
359
- // src/hooks/use-translator.ts
360
- import { useMesob } from "@mesob/ui/providers";
361
- function useTranslator(namespace) {
362
- const mesob = useMesob();
363
- const { config } = useConfig();
364
- if (mesob?.t) {
365
- return (key, params) => {
366
- const fullKey = namespace ? `${namespace}.${key}` : key;
367
- return mesob.t?.(fullKey, params) ?? fullKey;
368
- };
369
- }
370
- return createTranslator(config.messages || {}, namespace);
371
- }
372
-
373
- // src/components/auth/countdown.tsx
374
- import { Spinner as Spinner2 } from "@mesob/ui/components";
375
- import { useEffect as useEffect2, useState as useState3 } from "react";
376
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
377
- var Countdown = ({
378
- initialSeconds = 60,
379
- onResend,
380
- resending = false
381
- }) => {
382
- const t = useTranslator("Common");
383
- const [seconds, setSeconds] = useState3(initialSeconds);
384
- const [isResending, setIsResending] = useState3(false);
385
- useEffect2(() => {
386
- if (seconds <= 0) {
387
- return;
388
- }
389
- const timer = setInterval(() => {
390
- setSeconds((prev) => {
391
- if (prev <= 1) {
392
- clearInterval(timer);
393
- return 0;
394
- }
395
- return prev - 1;
396
- });
397
- }, 1e3);
398
- return () => clearInterval(timer);
399
- }, [seconds]);
400
- const handleResend = async () => {
401
- setIsResending(true);
402
- try {
403
- await onResend();
404
- setSeconds(initialSeconds);
405
- } catch (_error) {
406
- } finally {
407
- setIsResending(false);
408
- }
409
- };
410
- const busy = isResending || resending;
411
- if (seconds > 0) {
412
- return /* @__PURE__ */ jsx3("p", { className: "text-sm text-muted-foreground", children: t("resendIn", { seconds }) });
413
- }
414
- return /* @__PURE__ */ jsxs2(
415
- "button",
416
- {
417
- type: "button",
418
- onClick: handleResend,
419
- disabled: busy,
420
- className: "text-sm text-primary hover:underline disabled:opacity-50 flex items-center gap-1",
421
- children: [
422
- busy && /* @__PURE__ */ jsx3(Spinner2, { className: "h-3 w-3" }),
423
- t("resend")
424
- ]
425
- }
426
- );
427
- };
428
-
429
- // src/components/auth/verification-form.tsx
430
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
431
- var verificationSchema = (t) => z2.object({
432
- code: z2.string().length(6, t("form.codeLength"))
433
- });
434
- var VerificationForm = ({
435
- onSubmit,
436
- onResend,
437
- isLoading = false
438
- }) => {
439
- const t = useTranslator("Auth.verification");
440
- const form = useForm2({
441
- resolver: zodResolver2(verificationSchema(t)),
442
- defaultValues: { code: "" }
443
- });
444
- const handleSubmit = form.handleSubmit(async (values) => {
445
- await onSubmit(values);
446
- });
447
- const codeLength = form.watch("code").length;
448
- return /* @__PURE__ */ jsx4(Form, { ...form, children: /* @__PURE__ */ jsxs3(
449
- "form",
450
- {
451
- id: "verification-form",
452
- onSubmit: handleSubmit,
453
- className: "space-y-4",
454
- children: [
455
- /* @__PURE__ */ jsx4(
456
- FormField,
457
- {
458
- control: form.control,
459
- name: "code",
460
- render: ({ field }) => /* @__PURE__ */ jsxs3(FormItem, { children: [
461
- /* @__PURE__ */ jsx4("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx4(FormLabel, { children: t("form.codeLabel") }) }),
462
- /* @__PURE__ */ jsx4(FormControl, { children: /* @__PURE__ */ jsx4(
463
- InputOTP,
464
- {
465
- maxLength: 6,
466
- required: true,
467
- value: field.value ?? "",
468
- onChange: field.onChange,
469
- onBlur: field.onBlur,
470
- containerClassName: "gap-4 justify-center mb-2 flex items-center",
471
- children: /* @__PURE__ */ jsxs3(InputOTPGroup, { className: "gap-3 *:data-[slot=input-otp-slot]:h-12 *:data-[slot=input-otp-slot]:w-12 *:data-[slot=input-otp-slot]:rounded-md *:data-[slot=input-otp-slot]:border *:data-[slot=input-otp-slot]:text-xl", children: [
472
- /* @__PURE__ */ jsx4(InputOTPSlot, { className: "h-12", index: 0 }),
473
- /* @__PURE__ */ jsx4(InputOTPSlot, { className: "h-12", index: 1 }),
474
- /* @__PURE__ */ jsx4(InputOTPSlot, { className: "h-12", index: 2 }),
475
- /* @__PURE__ */ jsx4(InputOTPSlot, { className: "h-12", index: 3 }),
476
- /* @__PURE__ */ jsx4(InputOTPSlot, { className: "h-12", index: 4 }),
477
- /* @__PURE__ */ jsx4(InputOTPSlot, { className: "h-12", index: 5 })
478
- ] })
479
- }
480
- ) }),
481
- /* @__PURE__ */ jsx4(FormMessage, {})
482
- ] })
483
- }
484
- ),
485
- /* @__PURE__ */ jsx4(
486
- Button2,
487
- {
488
- type: "submit",
489
- form: "verification-form",
490
- className: "w-full",
491
- disabled: isLoading || codeLength !== 6,
492
- loading: isLoading,
493
- children: t("form.confirm")
494
- }
495
- ),
496
- /* @__PURE__ */ jsx4("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx4(Countdown, { onResend, resending: isLoading }) })
497
- ]
498
- }
499
- ) });
500
- };
501
-
502
- // src/components/profile/otp-verification-modal.tsx
503
- import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
504
- function OtpVerificationModal({
505
- open,
506
- title,
507
- description,
508
- verificationId,
509
- isLoading,
510
- onSubmit,
511
- onResend,
512
- onCancel
513
- }) {
514
- return /* @__PURE__ */ jsx5(
515
- Dialog,
516
- {
517
- open,
518
- onOpenChange: (nextOpen) => {
519
- if (!nextOpen) {
520
- onCancel?.();
521
- }
522
- },
523
- children: /* @__PURE__ */ jsxs4(DialogContent, { children: [
524
- /* @__PURE__ */ jsxs4(DialogHeader, { children: [
525
- /* @__PURE__ */ jsx5(DialogTitle, { children: title }),
526
- description && /* @__PURE__ */ jsx5(DialogDescription, { children: description })
527
- ] }),
528
- /* @__PURE__ */ jsx5(
529
- VerificationForm,
530
- {
531
- verificationId,
532
- isLoading,
533
- onSubmit: async ({ code }) => onSubmit(code),
534
- onResend: onResend ?? (() => void 0)
535
- }
536
- )
537
- ] })
538
- }
539
- );
540
- }
541
-
542
- // src/components/profile/verify-change-email-form.tsx
543
- import { jsx as jsx6 } from "react/jsx-runtime";
544
- function isAuthError2(error) {
545
- return typeof error === "object" && error !== null && ("code" in error || "message" in error || "name" in error);
546
- }
547
- function getErrorCode2(error) {
548
- if (error.code) {
549
- return error.code;
550
- }
551
- if (error.message) {
552
- const upperMessage = error.message.toUpperCase().trim();
553
- const validCodes = [
554
- "USER_NOT_FOUND",
555
- "USER_EXISTS",
556
- "INVALID_PASSWORD",
557
- "VERIFICATION_EXPIRED",
558
- "VERIFICATION_MISMATCH",
559
- "VERIFICATION_NOT_FOUND",
560
- "TOO_MANY_ATTEMPTS",
561
- "UNAUTHORIZED"
562
- ];
563
- if (validCodes.includes(upperMessage)) {
564
- return upperMessage;
565
- }
566
- }
567
- return void 0;
568
- }
569
- function getErrorMessage2(error) {
570
- if (isAuthError2(error)) {
571
- const errorCode = getErrorCode2(error);
572
- switch (errorCode) {
573
- case "USER_EXISTS":
574
- return "This email is already taken. Please use a different email.";
575
- case "VERIFICATION_EXPIRED":
576
- return "Verification code has expired. Please request a new one.";
577
- case "VERIFICATION_MISMATCH":
578
- return "Invalid verification code. Please try again.";
579
- case "VERIFICATION_NOT_FOUND":
580
- return "Verification not found. Please request a new code.";
581
- default:
582
- return error.message || "An error occurred. Please try again.";
583
- }
584
- }
585
- if (error instanceof Error) {
586
- return error.message;
587
- }
588
- return "An error occurred. Please try again.";
589
- }
590
- function VerifyChangeEmailForm({
591
- email,
592
- verificationId,
593
- onSuccess,
594
- onCancel
595
- }) {
596
- const { refresh } = useSession();
597
- const { hooks } = useApi();
598
- const [isSubmitting, setIsSubmitting] = useState4(false);
599
- const [currentVerificationId, setCurrentVerificationId] = useState4(verificationId);
600
- const verifyEmailMutation = hooks.useMutation(
601
- "post",
602
- "/email/verification/confirm"
603
- );
604
- const updateEmailMutation = hooks.useMutation("put", "/profile/email");
605
- const requestEmailVerificationMutation = hooks.useMutation(
606
- "post",
607
- "/email/verification/request"
608
- );
609
- const onOtpSubmit = async (code) => {
610
- if (!currentVerificationId) {
611
- toast2.error("Verification not found. Please request a new code.");
612
- return;
613
- }
614
- try {
615
- setIsSubmitting(true);
616
- await verifyEmailMutation.mutateAsync({
617
- body: {
618
- verificationId: currentVerificationId,
619
- code
620
- }
621
- });
622
- await updateEmailMutation.mutateAsync({
623
- body: { email }
624
- });
625
- toast2.success("Email updated successfully");
626
- await refresh();
627
- onSuccess();
628
- } catch (error) {
629
- const errorMessage = getErrorMessage2(error);
630
- toast2.error(errorMessage);
631
- } finally {
632
- setIsSubmitting(false);
633
- }
634
- };
635
- if (!currentVerificationId) {
636
- toast2.error("Verification not found. Please request a new code.");
637
- return null;
638
- }
639
- return /* @__PURE__ */ jsx6(
640
- OtpVerificationModal,
641
- {
642
- open: true,
643
- title: "Verify email",
644
- description: `Enter the verification code sent to ${email}`,
645
- verificationId: currentVerificationId,
646
- isLoading: isSubmitting,
647
- onSubmit: onOtpSubmit,
648
- onResend: async () => {
649
- try {
650
- setIsSubmitting(true);
651
- const next = await requestEmailVerificationMutation.mutateAsync({
652
- body: { email }
653
- });
654
- setCurrentVerificationId(next.data?.verificationId ?? null);
655
- toast2.success("Verification code resent");
656
- } catch (error) {
657
- toast2.error(getErrorMessage2(error));
658
- } finally {
659
- setIsSubmitting(false);
660
- }
661
- },
662
- onCancel
663
- }
664
- );
665
- }
666
-
667
- // src/components/profile/change-email-form.tsx
668
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
669
- function ChangeEmailForm() {
670
- const { user } = useSession();
671
- const [isOpen, setIsOpen] = useState5(false);
672
- const [showOtp, setShowOtp] = useState5(false);
673
- const [verificationId, setVerificationId] = useState5(null);
674
- const [newEmail, setNewEmail] = useState5("");
675
- const resetForms = () => {
676
- setShowOtp(false);
677
- setVerificationId(null);
678
- setNewEmail("");
679
- };
680
- const handleRequestSuccess = (id, email) => {
681
- setVerificationId(id);
682
- setNewEmail(email);
683
- setShowOtp(true);
684
- };
685
- const handleVerifySuccess = () => {
686
- resetForms();
687
- setIsOpen(false);
688
- };
689
- const handleCancel = () => {
690
- resetForms();
691
- setIsOpen(false);
692
- };
693
- const title = user?.email ? "Change Email" : "Add Email";
694
- const description = user?.email ? "Update your email address" : "Add an email address to your account";
695
- return /* @__PURE__ */ jsx7(Collapsible, { open: isOpen, onOpenChange: setIsOpen, children: /* @__PURE__ */ jsxs5("div", { className: "border rounded-lg", children: [
696
- /* @__PURE__ */ jsxs5(
697
- CollapsibleTrigger,
698
- {
699
- render: /* @__PURE__ */ jsx7(
700
- Button3,
701
- {
702
- variant: "ghost",
703
- className: "w-full justify-between p-4 h-auto"
704
- }
705
- ),
706
- children: [
707
- /* @__PURE__ */ jsxs5("div", { className: "flex flex-col items-start", children: [
708
- /* @__PURE__ */ jsx7("span", { className: "font-medium", children: title }),
709
- /* @__PURE__ */ jsx7("span", { className: "text-sm text-muted-foreground", children: description })
710
- ] }),
711
- /* @__PURE__ */ jsx7(
712
- IconChevronDown,
713
- {
714
- className: `h-4 w-4 transition-transform ${isOpen ? "rotate-180" : ""}`
715
- }
716
- )
717
- ]
718
- }
719
- ),
720
- /* @__PURE__ */ jsx7(CollapsibleContent, { children: showOtp ? /* @__PURE__ */ jsx7(
721
- VerifyChangeEmailForm,
722
- {
723
- email: newEmail,
724
- verificationId,
725
- onSuccess: handleVerifySuccess,
726
- onCancel: handleCancel
727
- }
728
- ) : /* @__PURE__ */ jsx7(
729
- RequestChangeEmailForm,
730
- {
731
- onSuccess: handleRequestSuccess,
732
- onCancel: handleCancel,
733
- buttonText: title
734
- }
735
- ) })
736
- ] }) });
737
- }
3
+ ChangeEmailForm
4
+ } from "../../chunk-MS2JUZ3N.js";
5
+ import "../../chunk-MELNS4QH.js";
6
+ import "../../chunk-EQ4346FE.js";
7
+ import "../../chunk-KWG4DSB5.js";
8
+ import "../../chunk-FFR5UHTS.js";
9
+ import "../../chunk-GP7GIUI3.js";
10
+ import "../../chunk-QNCE2B5O.js";
11
+ import "../../chunk-72YRO3A7.js";
738
12
  export {
739
13
  ChangeEmailForm
740
14
  };