@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.
- package/dist/chunk-35TCGAW3.js +98 -0
- package/dist/chunk-35TCGAW3.js.map +1 -0
- package/dist/chunk-3BZC4VVD.js +36 -0
- package/dist/chunk-3BZC4VVD.js.map +1 -0
- package/dist/chunk-45UCLKH2.js +188 -0
- package/dist/chunk-45UCLKH2.js.map +1 -0
- package/dist/chunk-55BMNC4S.js +115 -0
- package/dist/chunk-55BMNC4S.js.map +1 -0
- package/dist/chunk-5F5FZMHE.js +94 -0
- package/dist/chunk-5F5FZMHE.js.map +1 -0
- package/dist/chunk-5M7I7WNH.js +31 -0
- package/dist/chunk-5M7I7WNH.js.map +1 -0
- package/dist/chunk-72YRO3A7.js +288 -0
- package/dist/chunk-72YRO3A7.js.map +1 -0
- package/dist/chunk-7KXTL6NT.js +48 -0
- package/dist/chunk-7KXTL6NT.js.map +1 -0
- package/dist/chunk-AIMD6R6U.js +466 -0
- package/dist/chunk-AIMD6R6U.js.map +1 -0
- package/dist/chunk-BGSHXIHI.js +953 -0
- package/dist/chunk-BGSHXIHI.js.map +1 -0
- package/dist/chunk-BZ42QPXE.js +271 -0
- package/dist/chunk-BZ42QPXE.js.map +1 -0
- package/dist/chunk-C26NPUPI.js +272 -0
- package/dist/chunk-C26NPUPI.js.map +1 -0
- package/dist/chunk-C2KFZ57H.js +194 -0
- package/dist/chunk-C2KFZ57H.js.map +1 -0
- package/dist/chunk-C5ZW7FD2.js +46 -0
- package/dist/chunk-C5ZW7FD2.js.map +1 -0
- package/dist/chunk-DPH2PHK3.js +32 -0
- package/dist/chunk-DPH2PHK3.js.map +1 -0
- package/dist/chunk-EQ4346FE.js +139 -0
- package/dist/chunk-EQ4346FE.js.map +1 -0
- package/dist/chunk-FAHN63DA.js +535 -0
- package/dist/chunk-FAHN63DA.js.map +1 -0
- package/dist/chunk-FBABIA5J.js +345 -0
- package/dist/chunk-FBABIA5J.js.map +1 -0
- package/dist/chunk-FFR5UHTS.js +99 -0
- package/dist/chunk-FFR5UHTS.js.map +1 -0
- package/dist/chunk-FHOLUOOZ.js +164 -0
- package/dist/chunk-FHOLUOOZ.js.map +1 -0
- package/dist/chunk-G2AW2H36.js +11 -0
- package/dist/chunk-G2AW2H36.js.map +1 -0
- package/dist/chunk-G7SCXCCM.js +89 -0
- package/dist/chunk-G7SCXCCM.js.map +1 -0
- package/dist/chunk-GP7GIUI3.js +64 -0
- package/dist/chunk-GP7GIUI3.js.map +1 -0
- package/dist/chunk-GRT6EBR6.js +93 -0
- package/dist/chunk-GRT6EBR6.js.map +1 -0
- package/dist/chunk-GXKBVCVS.js +102 -0
- package/dist/chunk-GXKBVCVS.js.map +1 -0
- package/dist/chunk-HOO2VLNM.js +305 -0
- package/dist/chunk-HOO2VLNM.js.map +1 -0
- package/dist/chunk-II5MLBSB.js +183 -0
- package/dist/chunk-II5MLBSB.js.map +1 -0
- package/dist/chunk-ISNNPMF7.js +95 -0
- package/dist/chunk-ISNNPMF7.js.map +1 -0
- package/dist/chunk-JB6XVST4.js +141 -0
- package/dist/chunk-JB6XVST4.js.map +1 -0
- package/dist/chunk-JUHBVG5Q.js +303 -0
- package/dist/chunk-JUHBVG5Q.js.map +1 -0
- package/dist/chunk-JZZJCBAE.js +118 -0
- package/dist/chunk-JZZJCBAE.js.map +1 -0
- package/dist/chunk-KWG4DSB5.js +55 -0
- package/dist/chunk-KWG4DSB5.js.map +1 -0
- package/dist/chunk-L4CGIO2I.js +265 -0
- package/dist/chunk-L4CGIO2I.js.map +1 -0
- package/dist/chunk-LNG736CV.js +19 -0
- package/dist/chunk-LNG736CV.js.map +1 -0
- package/dist/chunk-LSYKVFJA.js +98 -0
- package/dist/chunk-LSYKVFJA.js.map +1 -0
- package/dist/chunk-LZR4YUDV.js +107 -0
- package/dist/chunk-LZR4YUDV.js.map +1 -0
- package/dist/chunk-MELNS4QH.js +255 -0
- package/dist/chunk-MELNS4QH.js.map +1 -0
- package/dist/chunk-MS2JUZ3N.js +94 -0
- package/dist/chunk-MS2JUZ3N.js.map +1 -0
- package/dist/chunk-NEO72TMH.js +32 -0
- package/dist/chunk-NEO72TMH.js.map +1 -0
- package/dist/chunk-NJPNTAAT.js +68 -0
- package/dist/chunk-NJPNTAAT.js.map +1 -0
- package/dist/chunk-NPW7D2HZ.js +16 -0
- package/dist/chunk-NPW7D2HZ.js.map +1 -0
- package/dist/chunk-OAN4EXU4.js +310 -0
- package/dist/chunk-OAN4EXU4.js.map +1 -0
- package/dist/chunk-OFLSINVU.js +138 -0
- package/dist/chunk-OFLSINVU.js.map +1 -0
- package/dist/chunk-OHIIMUQC.js +286 -0
- package/dist/chunk-OHIIMUQC.js.map +1 -0
- package/dist/chunk-OQGJX37L.js +239 -0
- package/dist/chunk-OQGJX37L.js.map +1 -0
- package/dist/chunk-OYHH7HQG.js +65 -0
- package/dist/chunk-OYHH7HQG.js.map +1 -0
- package/dist/chunk-PSRIZMWJ.js +486 -0
- package/dist/chunk-PSRIZMWJ.js.map +1 -0
- package/dist/chunk-QNCE2B5O.js +23 -0
- package/dist/chunk-QNCE2B5O.js.map +1 -0
- package/dist/chunk-RLPZFLAS.js +23 -0
- package/dist/chunk-RLPZFLAS.js.map +1 -0
- package/dist/chunk-RT5C7IAE.js +38 -0
- package/dist/chunk-RT5C7IAE.js.map +1 -0
- package/dist/chunk-S3CXCCKL.js +272 -0
- package/dist/chunk-S3CXCCKL.js.map +1 -0
- package/dist/chunk-SOCZK4CV.js +69 -0
- package/dist/chunk-SOCZK4CV.js.map +1 -0
- package/dist/chunk-T6P7UHVP.js +34 -0
- package/dist/chunk-T6P7UHVP.js.map +1 -0
- package/dist/chunk-TFVBER3Y.js +52 -0
- package/dist/chunk-TFVBER3Y.js.map +1 -0
- package/dist/chunk-UXOZ2TME.js +104 -0
- package/dist/chunk-UXOZ2TME.js.map +1 -0
- package/dist/chunk-V2W3WPCZ.js +22 -0
- package/dist/chunk-V2W3WPCZ.js.map +1 -0
- package/dist/chunk-YZ264S2L.js +286 -0
- package/dist/chunk-YZ264S2L.js.map +1 -0
- package/dist/chunk-ZESFGO3K.js +28 -0
- package/dist/chunk-ZESFGO3K.js.map +1 -0
- package/dist/chunk-ZG6WFZHX.js +143 -0
- package/dist/chunk-ZG6WFZHX.js.map +1 -0
- package/dist/components/auth/auth-card.d.ts +3 -6
- package/dist/components/auth/auth-card.js +3 -7
- package/dist/components/auth/auth-card.js.map +1 -1
- package/dist/components/auth/auth-layout.d.ts +3 -6
- package/dist/components/auth/auth-layout.js +3 -28
- package/dist/components/auth/auth-layout.js.map +1 -1
- package/dist/components/auth/countdown.d.ts +2 -5
- package/dist/components/auth/countdown.js +5 -130
- package/dist/components/auth/countdown.js.map +1 -1
- package/dist/components/auth/forgot-password.d.ts +1 -5
- package/dist/components/auth/forgot-password.js +6 -361
- package/dist/components/auth/forgot-password.js.map +1 -1
- package/dist/components/auth/reset-password-form.d.ts +2 -5
- package/dist/components/auth/reset-password-form.js +6 -483
- package/dist/components/auth/reset-password-form.js.map +1 -1
- package/dist/components/auth/set-password.d.ts +6 -0
- package/dist/components/auth/set-password.js +13 -0
- package/dist/components/auth/set-password.js.map +1 -0
- package/dist/components/auth/sign-in.d.ts +2 -5
- package/dist/components/auth/sign-in.js +7 -540
- package/dist/components/auth/sign-in.js.map +1 -1
- package/dist/components/auth/sign-up.d.ts +2 -5
- package/dist/components/auth/sign-up.js +6 -509
- package/dist/components/auth/sign-up.js.map +1 -1
- package/dist/components/auth/verification-form.d.ts +13 -2
- package/dist/components/auth/verification-form.js +5 -217
- package/dist/components/auth/verification-form.js.map +1 -1
- package/dist/components/auth/verify-email.d.ts +2 -5
- package/dist/components/auth/verify-email.js +8 -523
- package/dist/components/auth/verify-email.js.map +1 -1
- package/dist/components/auth/verify-phone.d.ts +2 -5
- package/dist/components/auth/verify-phone.js +8 -528
- package/dist/components/auth/verify-phone.js.map +1 -1
- package/dist/components/authorization/deny.d.ts +8 -0
- package/dist/components/authorization/deny.js +9 -0
- package/dist/components/authorization/deny.js.map +1 -0
- package/dist/components/authorization/grant.d.ts +9 -0
- package/dist/components/authorization/grant.js +9 -0
- package/dist/components/authorization/grant.js.map +1 -0
- package/dist/components/error-boundary.d.ts +6 -10
- package/dist/components/error-boundary.js +4 -43
- package/dist/components/error-boundary.js.map +1 -1
- package/dist/components/iam/permission-selector.d.ts +16 -0
- package/dist/components/iam/permission-selector.js +9 -0
- package/dist/components/iam/permission-selector.js.map +1 -0
- package/dist/components/iam/permissions-page.d.ts +1 -0
- package/dist/components/iam/permissions-page.js +10 -0
- package/dist/components/iam/permissions-page.js.map +1 -0
- package/dist/components/iam/permissions.d.ts +1 -5
- package/dist/components/iam/permissions.js +5 -217
- package/dist/components/iam/permissions.js.map +1 -1
- package/dist/components/iam/role-detail-layout.d.ts +8 -0
- package/dist/components/iam/role-detail-layout.js +9 -0
- package/dist/components/iam/role-detail-layout.js.map +1 -0
- package/dist/components/iam/role-detail-page.d.ts +6 -0
- package/dist/components/iam/role-detail-page.js +9 -0
- package/dist/components/iam/role-detail-page.js.map +1 -0
- package/dist/components/iam/role-permissions-page.d.ts +5 -0
- package/dist/components/iam/role-permissions-page.js +10 -0
- package/dist/components/iam/role-permissions-page.js.map +1 -0
- package/dist/components/iam/roles-page.d.ts +1 -0
- package/dist/components/iam/roles-page.js +13 -0
- package/dist/components/iam/roles-page.js.map +1 -0
- package/dist/components/iam/roles.d.ts +1 -5
- package/dist/components/iam/roles.js +5 -215
- package/dist/components/iam/roles.js.map +1 -1
- package/dist/components/iam/sessions-page.d.ts +1 -0
- package/dist/components/iam/sessions-page.js +12 -0
- package/dist/components/iam/sessions-page.js.map +1 -0
- package/dist/components/iam/sessions.d.ts +1 -5
- package/dist/components/iam/sessions.js +5 -198
- package/dist/components/iam/sessions.js.map +1 -1
- package/dist/components/iam/tenants-page.d.ts +1 -0
- package/dist/components/iam/tenants-page.js +13 -0
- package/dist/components/iam/tenants-page.js.map +1 -0
- package/dist/components/iam/tenants.d.ts +1 -5
- package/dist/components/iam/tenants.js +5 -204
- package/dist/components/iam/tenants.js.map +1 -1
- package/dist/components/iam/users-page.d.ts +1 -0
- package/dist/components/iam/users-page.js +13 -0
- package/dist/components/iam/users-page.js.map +1 -0
- package/dist/components/iam/users.d.ts +1 -5
- package/dist/components/iam/users.js +5 -213
- package/dist/components/iam/users.js.map +1 -1
- package/dist/components/profile/account.d.ts +1 -5
- package/dist/components/profile/account.js +5 -61
- package/dist/components/profile/account.js.map +1 -1
- package/dist/components/profile/change-email-form.d.ts +1 -5
- package/dist/components/profile/change-email-form.js +9 -735
- package/dist/components/profile/change-email-form.js.map +1 -1
- package/dist/components/profile/change-password-form.d.ts +1 -5
- package/dist/components/profile/change-password-form.js +3 -262
- package/dist/components/profile/change-password-form.js.map +1 -1
- package/dist/components/profile/change-phone-form.d.ts +1 -5
- package/dist/components/profile/change-phone-form.js +10 -772
- package/dist/components/profile/change-phone-form.js.map +1 -1
- package/dist/components/profile/change-profile.d.ts +3 -6
- package/dist/components/profile/change-profile.js +2 -32
- package/dist/components/profile/change-profile.js.map +1 -1
- package/dist/components/profile/otp-verification-modal.d.ts +2 -5
- package/dist/components/profile/otp-verification-modal.js +6 -266
- package/dist/components/profile/otp-verification-modal.js.map +1 -1
- package/dist/components/profile/profile-layout.d.ts +4 -0
- package/dist/components/profile/profile-layout.js +10 -0
- package/dist/components/profile/profile-layout.js.map +1 -0
- package/dist/components/profile/request-change-email-form.d.ts +2 -5
- package/dist/components/profile/request-change-email-form.js +4 -285
- package/dist/components/profile/request-change-email-form.js.map +1 -1
- package/dist/components/profile/request-change-phone-form.d.ts +2 -5
- package/dist/components/profile/request-change-phone-form.js +5 -323
- package/dist/components/profile/request-change-phone-form.js.map +1 -1
- package/dist/components/profile/security.d.ts +1 -5
- package/dist/components/profile/security.js +15 -1474
- package/dist/components/profile/security.js.map +1 -1
- package/dist/components/profile/verify-change-email-form.d.ts +2 -5
- package/dist/components/profile/verify-change-email-form.js +7 -407
- package/dist/components/profile/verify-change-email-form.js.map +1 -1
- package/dist/components/profile/verify-change-phone-form.d.ts +2 -5
- package/dist/components/profile/verify-change-phone-form.js +7 -411
- package/dist/components/profile/verify-change-phone-form.js.map +1 -1
- package/dist/components/shared/data-table.d.ts +5 -8
- package/dist/components/shared/data-table.js +3 -79
- package/dist/components/shared/data-table.js.map +1 -1
- package/dist/components/skeletons/auth-form-skeleton.d.ts +1 -5
- package/dist/components/skeletons/auth-form-skeleton.js +3 -27
- package/dist/components/skeletons/auth-form-skeleton.js.map +1 -1
- package/dist/components/skeletons/profile-skeleton.d.ts +1 -5
- package/dist/components/skeletons/profile-skeleton.js +3 -28
- package/dist/components/skeletons/profile-skeleton.js.map +1 -1
- package/dist/components/skeletons/table-skeleton.d.ts +2 -5
- package/dist/components/skeletons/table-skeleton.js +3 -34
- package/dist/components/skeletons/table-skeleton.js.map +1 -1
- package/dist/constants/auth.error.codes.d.ts +5 -0
- package/dist/hooks/use-session-cookie-name.d.ts +1 -0
- package/dist/hooks/use-translator.d.ts +1 -0
- package/dist/index.d.ts +50 -84
- package/dist/index.js +160 -3861
- package/dist/index.js.map +1 -1
- package/dist/lib/query-options.d.ts +10 -0
- package/dist/lib/translations.d.ts +3 -0
- package/dist/pages/auth/forgot-password.d.ts +3 -0
- package/dist/pages/auth/forgot-password.js +22 -0
- package/dist/pages/auth/forgot-password.js.map +1 -0
- package/dist/pages/auth/layout.d.ts +4 -0
- package/dist/pages/auth/layout.js +39 -0
- package/dist/pages/auth/layout.js.map +1 -0
- package/dist/pages/auth/reset-password.d.ts +7 -0
- package/dist/pages/auth/reset-password.js +33 -0
- package/dist/pages/auth/reset-password.js.map +1 -0
- package/dist/pages/auth/set-password.d.ts +7 -0
- package/dist/pages/auth/set-password.js +28 -0
- package/dist/pages/auth/set-password.js.map +1 -0
- package/dist/pages/auth/sign-in.d.ts +7 -0
- package/dist/pages/auth/sign-in.js +26 -0
- package/dist/pages/auth/sign-in.js.map +1 -0
- package/dist/pages/auth/sign-up.d.ts +7 -0
- package/dist/pages/auth/sign-up.js +33 -0
- package/dist/pages/auth/sign-up.js.map +1 -0
- package/dist/pages/auth/verify-email.d.ts +7 -0
- package/dist/pages/auth/verify-email.js +38 -0
- package/dist/pages/auth/verify-email.js.map +1 -0
- package/dist/pages/auth/verify-phone.d.ts +7 -0
- package/dist/pages/auth/verify-phone.js +47 -0
- package/dist/pages/auth/verify-phone.js.map +1 -0
- package/dist/pages/iam/permissions/_components/permission-card.d.ts +6 -0
- package/dist/pages/iam/permissions/_components/permissions-data.d.ts +7 -0
- package/dist/pages/iam/permissions/_components/permissions-list.d.ts +14 -0
- package/dist/pages/iam/permissions.d.ts +1 -0
- package/dist/pages/iam/permissions.js +10 -0
- package/dist/pages/iam/permissions.js.map +1 -0
- package/dist/pages/iam/role-detail-layout.d.ts +9 -0
- package/dist/pages/iam/role-detail-layout.js +18 -0
- package/dist/pages/iam/role-detail-layout.js.map +1 -0
- package/dist/pages/iam/role-detail.d.ts +9 -0
- package/dist/pages/iam/role-detail.js +22 -0
- package/dist/pages/iam/role-detail.js.map +1 -0
- package/dist/pages/iam/role-permissions.d.ts +9 -0
- package/dist/pages/iam/role-permissions.js +23 -0
- package/dist/pages/iam/role-permissions.js.map +1 -0
- package/dist/pages/iam/role-users.d.ts +9 -0
- package/dist/pages/iam/role-users.js +26 -0
- package/dist/pages/iam/role-users.js.map +1 -0
- package/dist/pages/iam/roles/_components/role-card.d.ts +7 -0
- package/dist/pages/iam/roles/_components/role-form.d.ts +9 -0
- package/dist/pages/iam/roles/_components/role-selector.d.ts +11 -0
- package/dist/pages/iam/roles/_components/roles-data.d.ts +16 -0
- package/dist/pages/iam/roles/_components/roles-list.d.ts +15 -0
- package/dist/pages/iam/roles/users/_components/role-users-page.d.ts +5 -0
- package/dist/pages/iam/roles.d.ts +1 -0
- package/dist/pages/iam/roles.js +13 -0
- package/dist/pages/iam/roles.js.map +1 -0
- package/dist/pages/iam/sessions/_components/session-card.d.ts +6 -0
- package/dist/pages/iam/sessions/_components/sessions-data.d.ts +7 -0
- package/dist/pages/iam/sessions/_components/sessions-list.d.ts +14 -0
- package/dist/pages/iam/sessions.d.ts +1 -0
- package/dist/pages/iam/sessions.js +12 -0
- package/dist/pages/iam/sessions.js.map +1 -0
- package/dist/pages/iam/shared/navigation.d.ts +8 -0
- package/dist/pages/iam/shared/page-helpers.d.ts +12 -0
- package/dist/pages/iam/tenant-detail.d.ts +7 -0
- package/dist/pages/iam/tenant-detail.js +18 -0
- package/dist/pages/iam/tenant-detail.js.map +1 -0
- package/dist/pages/iam/tenants/_components/tenant-card.d.ts +6 -0
- package/dist/pages/iam/tenants/_components/tenant-form.d.ts +9 -0
- package/dist/pages/iam/tenants/_components/tenant-selector.d.ts +13 -0
- package/dist/pages/iam/tenants/_components/tenants-data.d.ts +12 -0
- package/dist/pages/iam/tenants/_components/tenants-list.d.ts +15 -0
- package/dist/pages/iam/tenants/tenant-detail-page-content.d.ts +5 -0
- package/dist/pages/iam/tenants.d.ts +1 -0
- package/dist/pages/iam/tenants.js +13 -0
- package/dist/pages/iam/tenants.js.map +1 -0
- package/dist/pages/iam/user-activity.d.ts +7 -0
- package/dist/pages/iam/user-activity.js +21 -0
- package/dist/pages/iam/user-activity.js.map +1 -0
- package/dist/pages/iam/user-detail-layout.d.ts +9 -0
- package/dist/pages/iam/user-detail-layout.js +18 -0
- package/dist/pages/iam/user-detail-layout.js.map +1 -0
- package/dist/pages/iam/user-detail.d.ts +7 -0
- package/dist/pages/iam/user-detail.js +15 -0
- package/dist/pages/iam/user-detail.js.map +1 -0
- package/dist/pages/iam/users/_components/bulk-invite-user-form.d.ts +6 -0
- package/dist/pages/iam/users/_components/invite-user-form.d.ts +6 -0
- package/dist/pages/iam/users/_components/invite-user-shared.d.ts +25 -0
- package/dist/pages/iam/users/_components/user-card.d.ts +6 -0
- package/dist/pages/iam/users/_components/user-detail-layout-content.d.ts +6 -0
- package/dist/pages/iam/users/_components/user-detail-page-content.d.ts +5 -0
- package/dist/pages/iam/users/_components/user-form.d.ts +9 -0
- package/dist/pages/iam/users/_components/user-selector.d.ts +12 -0
- package/dist/pages/iam/users/_components/users-data.d.ts +22 -0
- package/dist/pages/iam/users/_components/users-list.d.ts +15 -0
- package/dist/pages/iam/users/activity/_components/role-section.d.ts +3 -0
- package/dist/pages/iam/users/activity/user-activity-page-content.d.ts +5 -0
- package/dist/pages/iam/users.d.ts +1 -0
- package/dist/pages/iam/users.js +13 -0
- package/dist/pages/iam/users.js.map +1 -0
- package/dist/pages/profile/_components/profile-sidebar.d.ts +1 -0
- package/dist/pages/profile/account.d.ts +1 -0
- package/dist/pages/profile/account.js +33 -0
- package/dist/pages/profile/account.js.map +1 -0
- package/dist/pages/profile/layout.d.ts +1 -0
- package/dist/pages/profile/layout.js +10 -0
- package/dist/pages/profile/layout.js.map +1 -0
- package/dist/pages/profile/security.d.ts +1 -0
- package/dist/pages/profile/security.js +44 -0
- package/dist/pages/profile/security.js.map +1 -0
- package/dist/provider.d.ts +53 -0
- package/dist/types.d.ts +96 -0
- package/dist/utils/cookie.d.ts +2 -0
- package/dist/utils/custom-fetch.d.ts +2 -0
- package/dist/utils/handle-error.d.ts +7 -0
- package/dist/utils/normalize-phone.d.ts +1 -0
- package/package.json +103 -4
- package/dist/types-vcfvnAzQ.d.ts +0 -69
- package/dist/verification-form-ipSRTtQB.d.ts +0 -22
|
@@ -0,0 +1,953 @@
|
|
|
1
|
+
import {
|
|
2
|
+
UserCard,
|
|
3
|
+
UserForm
|
|
4
|
+
} from "./chunk-BZ42QPXE.js";
|
|
5
|
+
import {
|
|
6
|
+
Link,
|
|
7
|
+
authApi$
|
|
8
|
+
} from "./chunk-3BZC4VVD.js";
|
|
9
|
+
import {
|
|
10
|
+
defaultEntityQueryOptions
|
|
11
|
+
} from "./chunk-NPW7D2HZ.js";
|
|
12
|
+
import {
|
|
13
|
+
useApi
|
|
14
|
+
} from "./chunk-72YRO3A7.js";
|
|
15
|
+
|
|
16
|
+
// src/components/iam/users-page.tsx
|
|
17
|
+
import {
|
|
18
|
+
EntityDrawerTrigger,
|
|
19
|
+
EntityFilter,
|
|
20
|
+
EntityHeader,
|
|
21
|
+
EntitySearch,
|
|
22
|
+
EntitySort,
|
|
23
|
+
EntityViewToggle,
|
|
24
|
+
PageBody,
|
|
25
|
+
PageContainer,
|
|
26
|
+
useBreadcrumbs,
|
|
27
|
+
useEntityPagination,
|
|
28
|
+
useEntityParams
|
|
29
|
+
} from "@mesob/ui/components";
|
|
30
|
+
import { IconUsers as IconUsers3 } from "@tabler/icons-react";
|
|
31
|
+
import { useState as useState4 } from "react";
|
|
32
|
+
|
|
33
|
+
// src/pages/iam/users/_components/bulk-invite-user-form.tsx
|
|
34
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
35
|
+
import {
|
|
36
|
+
Badge as Badge2,
|
|
37
|
+
Button,
|
|
38
|
+
Card as Card2,
|
|
39
|
+
CardContent as CardContent2,
|
|
40
|
+
CardHeader as CardHeader2,
|
|
41
|
+
CardTitle as CardTitle2,
|
|
42
|
+
EntityDrawer,
|
|
43
|
+
EntityFormActions,
|
|
44
|
+
Form,
|
|
45
|
+
FormControl,
|
|
46
|
+
FormField,
|
|
47
|
+
FormItem,
|
|
48
|
+
FormLabel,
|
|
49
|
+
FormMessage,
|
|
50
|
+
Input,
|
|
51
|
+
Textarea
|
|
52
|
+
} from "@mesob/ui/components";
|
|
53
|
+
import { IconDownload, IconUsers } from "@tabler/icons-react";
|
|
54
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
55
|
+
import { useEffect, useState } from "react";
|
|
56
|
+
import { useForm } from "react-hook-form";
|
|
57
|
+
import { toast } from "sonner";
|
|
58
|
+
import { z } from "zod";
|
|
59
|
+
|
|
60
|
+
// src/pages/iam/users/_components/invite-user-shared.tsx
|
|
61
|
+
import {
|
|
62
|
+
Badge,
|
|
63
|
+
Card,
|
|
64
|
+
CardContent,
|
|
65
|
+
CardDescription,
|
|
66
|
+
CardHeader,
|
|
67
|
+
CardTitle
|
|
68
|
+
} from "@mesob/ui/components";
|
|
69
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
70
|
+
var inviteTemplateCsv = `fullName,email,phone,emailVerified,phoneVerified,sendVia,password
|
|
71
|
+
Lulit Demo,lulit@example.com,,true,false,email,
|
|
72
|
+
Abel Demo,,+251911223344,false,true,sms|email,TempPass123!
|
|
73
|
+
Marta Demo,marta@example.com,+251922334455,true,true,email|sms,`;
|
|
74
|
+
var defaultInviteUserValues = {
|
|
75
|
+
fullName: "",
|
|
76
|
+
email: "",
|
|
77
|
+
phone: "",
|
|
78
|
+
password: "",
|
|
79
|
+
emailVerified: false,
|
|
80
|
+
phoneVerified: false,
|
|
81
|
+
viaEmail: false,
|
|
82
|
+
viaSms: false
|
|
83
|
+
};
|
|
84
|
+
function buildInviteUserPayload(values) {
|
|
85
|
+
return {
|
|
86
|
+
fullName: values.fullName.trim(),
|
|
87
|
+
email: values.email.trim() || void 0,
|
|
88
|
+
phone: values.phone.trim() || void 0,
|
|
89
|
+
password: values.password.trim() || void 0,
|
|
90
|
+
emailVerified: values.emailVerified,
|
|
91
|
+
phoneVerified: values.phoneVerified,
|
|
92
|
+
sendVia: [
|
|
93
|
+
values.viaEmail ? "email" : null,
|
|
94
|
+
values.viaSms ? "sms" : null
|
|
95
|
+
].filter(Boolean)
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function parseCsvLine(line) {
|
|
99
|
+
const cells = [];
|
|
100
|
+
let current = "";
|
|
101
|
+
let quoted = false;
|
|
102
|
+
for (let i = 0; i < line.length; i += 1) {
|
|
103
|
+
const char = line[i];
|
|
104
|
+
const next = line[i + 1];
|
|
105
|
+
if (char === '"' && quoted && next === '"') {
|
|
106
|
+
current += '"';
|
|
107
|
+
i += 1;
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
if (char === '"') {
|
|
111
|
+
quoted = !quoted;
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (char === "," && !quoted) {
|
|
115
|
+
cells.push(current.trim());
|
|
116
|
+
current = "";
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
current += char;
|
|
120
|
+
}
|
|
121
|
+
cells.push(current.trim());
|
|
122
|
+
return cells;
|
|
123
|
+
}
|
|
124
|
+
function parseBoolean(value) {
|
|
125
|
+
if (!value) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
return ["true", "1", "yes", "y"].includes(value.trim().toLowerCase());
|
|
129
|
+
}
|
|
130
|
+
function parseSendVia(value) {
|
|
131
|
+
if (!value) {
|
|
132
|
+
return [];
|
|
133
|
+
}
|
|
134
|
+
return value.split("|").map((item) => item.trim().toLowerCase()).filter(
|
|
135
|
+
(item) => item === "email" || item === "sms"
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
function parseBulkInviteCsv(text) {
|
|
139
|
+
const lines = text.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
140
|
+
if (!lines.length) {
|
|
141
|
+
throw new Error("Paste at least one CSV row.");
|
|
142
|
+
}
|
|
143
|
+
const header = parseCsvLine(lines[0]).map((cell) => cell.toLowerCase());
|
|
144
|
+
const hasHeader = header.includes("fullname");
|
|
145
|
+
const rows = hasHeader ? lines.slice(1) : lines;
|
|
146
|
+
if (!rows.length) {
|
|
147
|
+
throw new Error("CSV only has a header row.");
|
|
148
|
+
}
|
|
149
|
+
const keys = hasHeader ? header : [
|
|
150
|
+
"fullName",
|
|
151
|
+
"email",
|
|
152
|
+
"phone",
|
|
153
|
+
"emailVerified",
|
|
154
|
+
"phoneVerified",
|
|
155
|
+
"sendVia",
|
|
156
|
+
"password"
|
|
157
|
+
];
|
|
158
|
+
return rows.map((line, index) => {
|
|
159
|
+
const values = parseCsvLine(line);
|
|
160
|
+
const record = Object.fromEntries(
|
|
161
|
+
keys.map((key, valueIndex) => [key, values[valueIndex] ?? ""])
|
|
162
|
+
);
|
|
163
|
+
const fullName = String(
|
|
164
|
+
record.fullname || record.fullName || record.name || ""
|
|
165
|
+
).trim();
|
|
166
|
+
const email = String(record.email || "").trim();
|
|
167
|
+
const phone = String(record.phone || "").trim();
|
|
168
|
+
if (!fullName) {
|
|
169
|
+
throw new Error(`Row ${index + 1}: fullName is required.`);
|
|
170
|
+
}
|
|
171
|
+
if (!(email || phone)) {
|
|
172
|
+
throw new Error(`Row ${index + 1}: email or phone is required.`);
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
fullName,
|
|
176
|
+
email: email || void 0,
|
|
177
|
+
phone: phone || void 0,
|
|
178
|
+
password: String(record.password || "").trim() || void 0,
|
|
179
|
+
emailVerified: parseBoolean(
|
|
180
|
+
String(record.emailverified || record.emailVerified || "")
|
|
181
|
+
),
|
|
182
|
+
phoneVerified: parseBoolean(
|
|
183
|
+
String(record.phoneverified || record.phoneVerified || "")
|
|
184
|
+
),
|
|
185
|
+
sendVia: parseSendVia(String(record.sendvia || record.sendVia || ""))
|
|
186
|
+
};
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
function downloadInviteTemplate() {
|
|
190
|
+
const blob = new Blob([inviteTemplateCsv], {
|
|
191
|
+
type: "text/csv;charset=utf-8"
|
|
192
|
+
});
|
|
193
|
+
const url = URL.createObjectURL(blob);
|
|
194
|
+
const link = document.createElement("a");
|
|
195
|
+
link.href = url;
|
|
196
|
+
link.download = "users-bulk-invite-template.csv";
|
|
197
|
+
link.click();
|
|
198
|
+
URL.revokeObjectURL(url);
|
|
199
|
+
}
|
|
200
|
+
function DeliveryBadges({ delivery }) {
|
|
201
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
202
|
+
delivery.email ? /* @__PURE__ */ jsxs(
|
|
203
|
+
Badge,
|
|
204
|
+
{
|
|
205
|
+
variant: delivery.email === "failed" ? "destructive" : "outline",
|
|
206
|
+
children: [
|
|
207
|
+
"email: ",
|
|
208
|
+
delivery.email
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
) : null,
|
|
212
|
+
delivery.sms ? /* @__PURE__ */ jsxs(Badge, { variant: delivery.sms === "failed" ? "destructive" : "outline", children: [
|
|
213
|
+
"sms: ",
|
|
214
|
+
delivery.sms
|
|
215
|
+
] }) : null,
|
|
216
|
+
delivery.email || delivery.sms ? null : /* @__PURE__ */ jsx(Badge, { variant: "secondary", children: "no delivery" })
|
|
217
|
+
] });
|
|
218
|
+
}
|
|
219
|
+
function InviteResultCard({
|
|
220
|
+
result,
|
|
221
|
+
index
|
|
222
|
+
}) {
|
|
223
|
+
return /* @__PURE__ */ jsxs(Card, { className: "border-border/60 bg-background/70", children: [
|
|
224
|
+
/* @__PURE__ */ jsx(CardHeader, { className: "pb-3", children: /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
|
|
225
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
226
|
+
/* @__PURE__ */ jsx(CardTitle, { className: "text-base", children: result.user.fullName }),
|
|
227
|
+
/* @__PURE__ */ jsx(CardDescription, { children: result.user.email || result.user.phone || "No identifier" })
|
|
228
|
+
] }),
|
|
229
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
230
|
+
typeof index === "number" ? /* @__PURE__ */ jsxs(Badge, { variant: "outline", children: [
|
|
231
|
+
"row ",
|
|
232
|
+
index + 1
|
|
233
|
+
] }) : null,
|
|
234
|
+
/* @__PURE__ */ jsx(Badge, { variant: result.hasPassword ? "secondary" : "default", children: result.hasPassword ? "password set" : "set-password flow" })
|
|
235
|
+
] })
|
|
236
|
+
] }) }),
|
|
237
|
+
/* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 text-sm", children: [
|
|
238
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
239
|
+
/* @__PURE__ */ jsxs(Badge, { variant: result.user.emailVerified ? "default" : "secondary", children: [
|
|
240
|
+
"email ",
|
|
241
|
+
result.user.emailVerified ? "verified" : "pending"
|
|
242
|
+
] }),
|
|
243
|
+
/* @__PURE__ */ jsxs(Badge, { variant: result.user.phoneVerified ? "default" : "secondary", children: [
|
|
244
|
+
"phone ",
|
|
245
|
+
result.user.phoneVerified ? "verified" : "pending"
|
|
246
|
+
] })
|
|
247
|
+
] }),
|
|
248
|
+
/* @__PURE__ */ jsx(DeliveryBadges, { delivery: result.delivery }),
|
|
249
|
+
result.inviteUrl ? /* @__PURE__ */ jsx("p", { className: "rounded-md border border-dashed border-border/70 bg-muted/40 px-3 py-2 font-mono text-xs break-all", children: result.inviteUrl }) : null
|
|
250
|
+
] })
|
|
251
|
+
] });
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// src/pages/iam/users/_components/bulk-invite-user-form.tsx
|
|
255
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
256
|
+
var schema = z.object({
|
|
257
|
+
sourceFile: z.string().optional(),
|
|
258
|
+
csvText: z.string().trim().min(1, "CSV text is required")
|
|
259
|
+
});
|
|
260
|
+
var defaults = {
|
|
261
|
+
sourceFile: "",
|
|
262
|
+
csvText: ""
|
|
263
|
+
};
|
|
264
|
+
function BulkInviteUserForm({ open, onClose }) {
|
|
265
|
+
const qc = useQueryClient();
|
|
266
|
+
const [invited, setInvited] = useState([]);
|
|
267
|
+
const [failed, setFailed] = useState([]);
|
|
268
|
+
const form = useForm({
|
|
269
|
+
resolver: zodResolver(schema),
|
|
270
|
+
defaultValues: defaults
|
|
271
|
+
});
|
|
272
|
+
const { control, formState, getValues, reset, setValue } = form;
|
|
273
|
+
const inviteBulk = authApi$.useMutation("post", "/users/invite/bulk", {
|
|
274
|
+
onSuccess: async () => {
|
|
275
|
+
await qc.invalidateQueries({ queryKey: ["get", "/users"] });
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
useEffect(() => {
|
|
279
|
+
if (open) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
reset(defaults);
|
|
283
|
+
setInvited([]);
|
|
284
|
+
setFailed([]);
|
|
285
|
+
}, [open, reset]);
|
|
286
|
+
const handleFileChange = async (event, onChange) => {
|
|
287
|
+
const file = event.target.files?.[0];
|
|
288
|
+
if (!file) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
try {
|
|
292
|
+
const text = await file.text();
|
|
293
|
+
onChange(file.name);
|
|
294
|
+
setValue("csvText", text, {
|
|
295
|
+
shouldDirty: true,
|
|
296
|
+
shouldValidate: true
|
|
297
|
+
});
|
|
298
|
+
toast.success(`Loaded ${file.name}`);
|
|
299
|
+
} catch (error) {
|
|
300
|
+
toast.error(
|
|
301
|
+
error instanceof Error ? error.message : "Failed to read CSV file"
|
|
302
|
+
);
|
|
303
|
+
} finally {
|
|
304
|
+
event.target.value = "";
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
const onSubmit = form.handleSubmit(async (values) => {
|
|
308
|
+
try {
|
|
309
|
+
const result = await inviteBulk.mutateAsync({
|
|
310
|
+
body: {
|
|
311
|
+
users: parseBulkInviteCsv(values.csvText)
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
setInvited(result.invited);
|
|
315
|
+
setFailed(result.failed);
|
|
316
|
+
toast.success(
|
|
317
|
+
`Bulk invite finished: ${result.invited.length} invited, ${result.failed.length} failed`
|
|
318
|
+
);
|
|
319
|
+
} catch (error) {
|
|
320
|
+
toast.error(
|
|
321
|
+
error instanceof Error ? error.message : "Failed to bulk invite users"
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
return /* @__PURE__ */ jsx2(
|
|
326
|
+
EntityDrawer,
|
|
327
|
+
{
|
|
328
|
+
title: "Bulk invite users",
|
|
329
|
+
open,
|
|
330
|
+
onClose,
|
|
331
|
+
isDirty: formState.isDirty,
|
|
332
|
+
size: "xl",
|
|
333
|
+
form: /* @__PURE__ */ jsx2(Form, { ...form, children: /* @__PURE__ */ jsxs2("form", { onSubmit, className: "space-y-4", children: [
|
|
334
|
+
/* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
|
|
335
|
+
/* @__PURE__ */ jsx2("p", { className: "text-sm text-muted-foreground", children: "Download the CSV template, fill it with your users, then upload or paste the CSV below." }),
|
|
336
|
+
/* @__PURE__ */ jsx2(
|
|
337
|
+
Button,
|
|
338
|
+
{
|
|
339
|
+
variant: "outline",
|
|
340
|
+
onClick: downloadInviteTemplate,
|
|
341
|
+
leftIcon: /* @__PURE__ */ jsx2(IconDownload, { className: "size-4" }),
|
|
342
|
+
children: "Download template"
|
|
343
|
+
}
|
|
344
|
+
)
|
|
345
|
+
] }),
|
|
346
|
+
/* @__PURE__ */ jsx2(
|
|
347
|
+
FormField,
|
|
348
|
+
{
|
|
349
|
+
control,
|
|
350
|
+
name: "sourceFile",
|
|
351
|
+
render: ({ field }) => /* @__PURE__ */ jsxs2(FormItem, { children: [
|
|
352
|
+
/* @__PURE__ */ jsx2(FormLabel, { children: "Upload CSV" }),
|
|
353
|
+
/* @__PURE__ */ jsx2(FormControl, { children: /* @__PURE__ */ jsx2(
|
|
354
|
+
Input,
|
|
355
|
+
{
|
|
356
|
+
type: "file",
|
|
357
|
+
accept: ".csv,text/csv",
|
|
358
|
+
onChange: (event) => handleFileChange(event, field.onChange)
|
|
359
|
+
}
|
|
360
|
+
) }),
|
|
361
|
+
field.value ? /* @__PURE__ */ jsxs2("p", { className: "text-sm text-muted-foreground", children: [
|
|
362
|
+
"Loaded file: ",
|
|
363
|
+
field.value
|
|
364
|
+
] }) : null,
|
|
365
|
+
/* @__PURE__ */ jsx2(FormMessage, {})
|
|
366
|
+
] })
|
|
367
|
+
}
|
|
368
|
+
),
|
|
369
|
+
/* @__PURE__ */ jsx2(
|
|
370
|
+
FormField,
|
|
371
|
+
{
|
|
372
|
+
control,
|
|
373
|
+
name: "csvText",
|
|
374
|
+
render: ({ field }) => /* @__PURE__ */ jsxs2(FormItem, { children: [
|
|
375
|
+
/* @__PURE__ */ jsx2(FormLabel, { children: "CSV textarea" }),
|
|
376
|
+
/* @__PURE__ */ jsx2(FormControl, { children: /* @__PURE__ */ jsx2(
|
|
377
|
+
Textarea,
|
|
378
|
+
{
|
|
379
|
+
className: "min-h-[240px] font-mono text-xs",
|
|
380
|
+
placeholder: inviteTemplateCsv,
|
|
381
|
+
...field
|
|
382
|
+
}
|
|
383
|
+
) }),
|
|
384
|
+
/* @__PURE__ */ jsx2(FormMessage, {})
|
|
385
|
+
] })
|
|
386
|
+
}
|
|
387
|
+
),
|
|
388
|
+
(invited.length > 0 || failed.length > 0) && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
389
|
+
/* @__PURE__ */ jsxs2(Card2, { className: "border-border/60", children: [
|
|
390
|
+
/* @__PURE__ */ jsx2(CardHeader2, { children: /* @__PURE__ */ jsxs2(CardTitle2, { className: "flex items-center gap-2 text-base", children: [
|
|
391
|
+
/* @__PURE__ */ jsx2(IconUsers, { className: "size-4" }),
|
|
392
|
+
"Invited",
|
|
393
|
+
/* @__PURE__ */ jsx2(Badge2, { children: invited.length })
|
|
394
|
+
] }) }),
|
|
395
|
+
/* @__PURE__ */ jsx2(CardContent2, { className: "space-y-3", children: invited.length ? invited.map((result, index) => /* @__PURE__ */ jsx2(
|
|
396
|
+
InviteResultCard,
|
|
397
|
+
{
|
|
398
|
+
result,
|
|
399
|
+
index
|
|
400
|
+
},
|
|
401
|
+
`${result.user.id}-${index}`
|
|
402
|
+
)) : /* @__PURE__ */ jsx2("p", { className: "text-sm text-muted-foreground", children: "Successful invites will show here." }) })
|
|
403
|
+
] }),
|
|
404
|
+
/* @__PURE__ */ jsxs2(Card2, { className: "border-border/60", children: [
|
|
405
|
+
/* @__PURE__ */ jsx2(CardHeader2, { children: /* @__PURE__ */ jsxs2(CardTitle2, { className: "text-base", children: [
|
|
406
|
+
"Failed rows",
|
|
407
|
+
/* @__PURE__ */ jsx2(Badge2, { className: "ml-2", variant: "destructive", children: failed.length })
|
|
408
|
+
] }) }),
|
|
409
|
+
/* @__PURE__ */ jsx2(CardContent2, { className: "space-y-3", children: failed.length ? failed.map((failure) => /* @__PURE__ */ jsxs2(
|
|
410
|
+
"div",
|
|
411
|
+
{
|
|
412
|
+
className: "rounded-lg border border-destructive/30 bg-destructive/5 p-4",
|
|
413
|
+
children: [
|
|
414
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between gap-3", children: [
|
|
415
|
+
/* @__PURE__ */ jsxs2("span", { className: "font-medium", children: [
|
|
416
|
+
"row ",
|
|
417
|
+
failure.index + 1
|
|
418
|
+
] }),
|
|
419
|
+
failure.identifier ? /* @__PURE__ */ jsx2(Badge2, { variant: "outline", children: failure.identifier }) : null
|
|
420
|
+
] }),
|
|
421
|
+
/* @__PURE__ */ jsx2("p", { className: "mt-2 text-sm text-muted-foreground", children: failure.error })
|
|
422
|
+
]
|
|
423
|
+
},
|
|
424
|
+
`${failure.index}-${failure.identifier}`
|
|
425
|
+
)) : /* @__PURE__ */ jsx2("p", { className: "text-sm text-muted-foreground", children: "Failed invites will show here." }) })
|
|
426
|
+
] })
|
|
427
|
+
] })
|
|
428
|
+
] }) }),
|
|
429
|
+
actions: /* @__PURE__ */ jsx2(
|
|
430
|
+
EntityFormActions,
|
|
431
|
+
{
|
|
432
|
+
mode: "new",
|
|
433
|
+
onSubmit,
|
|
434
|
+
onReset: () => {
|
|
435
|
+
reset(defaults);
|
|
436
|
+
setInvited([]);
|
|
437
|
+
setFailed([]);
|
|
438
|
+
},
|
|
439
|
+
isSubmitting: inviteBulk.isPending,
|
|
440
|
+
submitLabel: "Invite",
|
|
441
|
+
disabled: !getValues("csvText").trim()
|
|
442
|
+
}
|
|
443
|
+
)
|
|
444
|
+
}
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// src/pages/iam/users/_components/invite-user-form.tsx
|
|
449
|
+
import { zodResolver as zodResolver2 } from "@hookform/resolvers/zod";
|
|
450
|
+
import {
|
|
451
|
+
Checkbox,
|
|
452
|
+
EntityDrawer as EntityDrawer2,
|
|
453
|
+
EntityFormActions as EntityFormActions2,
|
|
454
|
+
Form as Form2,
|
|
455
|
+
FormControl as FormControl2,
|
|
456
|
+
FormField as FormField2,
|
|
457
|
+
FormItem as FormItem2,
|
|
458
|
+
FormLabel as FormLabel2,
|
|
459
|
+
FormMessage as FormMessage2,
|
|
460
|
+
Input as Input2,
|
|
461
|
+
Stack
|
|
462
|
+
} from "@mesob/ui/components";
|
|
463
|
+
import { useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
464
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
465
|
+
import { useForm as useForm2, useWatch } from "react-hook-form";
|
|
466
|
+
import { toast as toast2 } from "sonner";
|
|
467
|
+
import { z as z2 } from "zod";
|
|
468
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
469
|
+
var schema2 = z2.object({
|
|
470
|
+
fullName: z2.string().trim().min(1, "Full name is required"),
|
|
471
|
+
email: z2.string().email("Invalid email").or(z2.literal("")),
|
|
472
|
+
phone: z2.string(),
|
|
473
|
+
password: z2.string(),
|
|
474
|
+
emailVerified: z2.boolean(),
|
|
475
|
+
phoneVerified: z2.boolean(),
|
|
476
|
+
viaEmail: z2.boolean(),
|
|
477
|
+
viaSms: z2.boolean()
|
|
478
|
+
}).superRefine((value, ctx) => {
|
|
479
|
+
if (!(value.email.trim() || value.phone.trim())) {
|
|
480
|
+
ctx.addIssue({
|
|
481
|
+
code: z2.ZodIssueCode.custom,
|
|
482
|
+
path: ["email"],
|
|
483
|
+
message: "Email or phone is required"
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
});
|
|
487
|
+
function InviteUserForm({ open, onClose }) {
|
|
488
|
+
const qc = useQueryClient2();
|
|
489
|
+
const [result, setResult] = useState2(null);
|
|
490
|
+
const form = useForm2({
|
|
491
|
+
resolver: zodResolver2(schema2),
|
|
492
|
+
defaultValues: defaultInviteUserValues
|
|
493
|
+
});
|
|
494
|
+
const { control, formState, reset, setValue } = form;
|
|
495
|
+
const email = useWatch({ control, name: "email" }) ?? "";
|
|
496
|
+
const phone = useWatch({ control, name: "phone" }) ?? "";
|
|
497
|
+
const hasEmail = email.trim().length > 0;
|
|
498
|
+
const hasPhone = phone.trim().length > 0;
|
|
499
|
+
const inviteUser = authApi$.useMutation("post", "/users/invite", {
|
|
500
|
+
onSuccess: async () => {
|
|
501
|
+
await qc.invalidateQueries({ queryKey: ["get", "/users"] });
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
useEffect2(() => {
|
|
505
|
+
if (!hasEmail) {
|
|
506
|
+
setValue("emailVerified", false, { shouldDirty: false });
|
|
507
|
+
setValue("viaEmail", false, { shouldDirty: false });
|
|
508
|
+
}
|
|
509
|
+
}, [hasEmail, setValue]);
|
|
510
|
+
useEffect2(() => {
|
|
511
|
+
if (!hasPhone) {
|
|
512
|
+
setValue("phoneVerified", false, { shouldDirty: false });
|
|
513
|
+
setValue("viaSms", false, { shouldDirty: false });
|
|
514
|
+
}
|
|
515
|
+
}, [hasPhone, setValue]);
|
|
516
|
+
useEffect2(() => {
|
|
517
|
+
if (open) {
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
reset(defaultInviteUserValues);
|
|
521
|
+
setResult(null);
|
|
522
|
+
}, [open, reset]);
|
|
523
|
+
const onSubmit = form.handleSubmit(async (values) => {
|
|
524
|
+
try {
|
|
525
|
+
const inviteResult = await inviteUser.mutateAsync({
|
|
526
|
+
body: buildInviteUserPayload(values)
|
|
527
|
+
});
|
|
528
|
+
setResult(inviteResult);
|
|
529
|
+
reset(defaultInviteUserValues);
|
|
530
|
+
toast2.success("User invited");
|
|
531
|
+
} catch (error) {
|
|
532
|
+
toast2.error(
|
|
533
|
+
error instanceof Error ? error.message : "Failed to invite user"
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
return /* @__PURE__ */ jsx3(
|
|
538
|
+
EntityDrawer2,
|
|
539
|
+
{
|
|
540
|
+
title: "Invite user",
|
|
541
|
+
open,
|
|
542
|
+
onClose,
|
|
543
|
+
isDirty: formState.isDirty,
|
|
544
|
+
size: "lg",
|
|
545
|
+
form: /* @__PURE__ */ jsx3(Form2, { ...form, children: /* @__PURE__ */ jsx3("form", { onSubmit, className: "space-y-4", children: /* @__PURE__ */ jsxs3(Stack, { children: [
|
|
546
|
+
/* @__PURE__ */ jsx3(
|
|
547
|
+
FormField2,
|
|
548
|
+
{
|
|
549
|
+
control,
|
|
550
|
+
name: "fullName",
|
|
551
|
+
render: ({ field }) => /* @__PURE__ */ jsxs3(FormItem2, { children: [
|
|
552
|
+
/* @__PURE__ */ jsxs3(FormLabel2, { children: [
|
|
553
|
+
"Full name ",
|
|
554
|
+
/* @__PURE__ */ jsx3("span", { className: "text-destructive", children: "*" })
|
|
555
|
+
] }),
|
|
556
|
+
/* @__PURE__ */ jsx3(FormControl2, { children: /* @__PURE__ */ jsx3(Input2, { placeholder: "Aster Bekele", ...field }) }),
|
|
557
|
+
/* @__PURE__ */ jsx3(FormMessage2, {})
|
|
558
|
+
] })
|
|
559
|
+
}
|
|
560
|
+
),
|
|
561
|
+
/* @__PURE__ */ jsx3(
|
|
562
|
+
FormField2,
|
|
563
|
+
{
|
|
564
|
+
control,
|
|
565
|
+
name: "email",
|
|
566
|
+
render: ({ field }) => /* @__PURE__ */ jsxs3(FormItem2, { children: [
|
|
567
|
+
/* @__PURE__ */ jsx3(FormLabel2, { children: "Email" }),
|
|
568
|
+
/* @__PURE__ */ jsx3(FormControl2, { children: /* @__PURE__ */ jsx3(
|
|
569
|
+
Input2,
|
|
570
|
+
{
|
|
571
|
+
type: "email",
|
|
572
|
+
placeholder: "aster@example.com",
|
|
573
|
+
...field
|
|
574
|
+
}
|
|
575
|
+
) }),
|
|
576
|
+
/* @__PURE__ */ jsx3(FormMessage2, {})
|
|
577
|
+
] })
|
|
578
|
+
}
|
|
579
|
+
),
|
|
580
|
+
/* @__PURE__ */ jsx3(
|
|
581
|
+
FormField2,
|
|
582
|
+
{
|
|
583
|
+
control,
|
|
584
|
+
name: "phone",
|
|
585
|
+
render: ({ field }) => /* @__PURE__ */ jsxs3(FormItem2, { children: [
|
|
586
|
+
/* @__PURE__ */ jsx3(FormLabel2, { children: "Phone" }),
|
|
587
|
+
/* @__PURE__ */ jsx3(FormControl2, { children: /* @__PURE__ */ jsx3(Input2, { placeholder: "+251911223344", ...field }) }),
|
|
588
|
+
/* @__PURE__ */ jsx3(FormMessage2, {})
|
|
589
|
+
] })
|
|
590
|
+
}
|
|
591
|
+
),
|
|
592
|
+
/* @__PURE__ */ jsx3(
|
|
593
|
+
FormField2,
|
|
594
|
+
{
|
|
595
|
+
control,
|
|
596
|
+
name: "password",
|
|
597
|
+
render: ({ field }) => /* @__PURE__ */ jsxs3(FormItem2, { children: [
|
|
598
|
+
/* @__PURE__ */ jsx3(FormLabel2, { children: "Password" }),
|
|
599
|
+
/* @__PURE__ */ jsx3(FormControl2, { children: /* @__PURE__ */ jsx3(
|
|
600
|
+
Input2,
|
|
601
|
+
{
|
|
602
|
+
type: "password",
|
|
603
|
+
placeholder: "Optional",
|
|
604
|
+
...field
|
|
605
|
+
}
|
|
606
|
+
) }),
|
|
607
|
+
/* @__PURE__ */ jsx3(FormMessage2, {})
|
|
608
|
+
] })
|
|
609
|
+
}
|
|
610
|
+
),
|
|
611
|
+
/* @__PURE__ */ jsx3(
|
|
612
|
+
FormField2,
|
|
613
|
+
{
|
|
614
|
+
control,
|
|
615
|
+
name: "emailVerified",
|
|
616
|
+
render: ({ field }) => /* @__PURE__ */ jsx3(FormItem2, { children: /* @__PURE__ */ jsxs3("div", { className: "flex items-start gap-3", children: [
|
|
617
|
+
/* @__PURE__ */ jsx3(FormControl2, { children: /* @__PURE__ */ jsx3(
|
|
618
|
+
Checkbox,
|
|
619
|
+
{
|
|
620
|
+
checked: field.value,
|
|
621
|
+
disabled: !hasEmail,
|
|
622
|
+
onCheckedChange: (checked) => field.onChange(checked === true)
|
|
623
|
+
}
|
|
624
|
+
) }),
|
|
625
|
+
/* @__PURE__ */ jsxs3("div", { className: "grid gap-1", children: [
|
|
626
|
+
/* @__PURE__ */ jsx3(FormLabel2, { children: "Email verified" }),
|
|
627
|
+
/* @__PURE__ */ jsx3(FormMessage2, {})
|
|
628
|
+
] })
|
|
629
|
+
] }) })
|
|
630
|
+
}
|
|
631
|
+
),
|
|
632
|
+
/* @__PURE__ */ jsx3(
|
|
633
|
+
FormField2,
|
|
634
|
+
{
|
|
635
|
+
control,
|
|
636
|
+
name: "phoneVerified",
|
|
637
|
+
render: ({ field }) => /* @__PURE__ */ jsx3(FormItem2, { children: /* @__PURE__ */ jsxs3("div", { className: "flex items-start gap-3", children: [
|
|
638
|
+
/* @__PURE__ */ jsx3(FormControl2, { children: /* @__PURE__ */ jsx3(
|
|
639
|
+
Checkbox,
|
|
640
|
+
{
|
|
641
|
+
checked: field.value,
|
|
642
|
+
disabled: !hasPhone,
|
|
643
|
+
onCheckedChange: (checked) => field.onChange(checked === true)
|
|
644
|
+
}
|
|
645
|
+
) }),
|
|
646
|
+
/* @__PURE__ */ jsxs3("div", { className: "grid gap-1", children: [
|
|
647
|
+
/* @__PURE__ */ jsx3(FormLabel2, { children: "Phone verified" }),
|
|
648
|
+
/* @__PURE__ */ jsx3(FormMessage2, {})
|
|
649
|
+
] })
|
|
650
|
+
] }) })
|
|
651
|
+
}
|
|
652
|
+
),
|
|
653
|
+
/* @__PURE__ */ jsx3(
|
|
654
|
+
FormField2,
|
|
655
|
+
{
|
|
656
|
+
control,
|
|
657
|
+
name: "viaEmail",
|
|
658
|
+
render: ({ field }) => /* @__PURE__ */ jsx3(FormItem2, { children: /* @__PURE__ */ jsxs3("div", { className: "flex items-start gap-3", children: [
|
|
659
|
+
/* @__PURE__ */ jsx3(FormControl2, { children: /* @__PURE__ */ jsx3(
|
|
660
|
+
Checkbox,
|
|
661
|
+
{
|
|
662
|
+
checked: field.value,
|
|
663
|
+
disabled: !hasEmail,
|
|
664
|
+
onCheckedChange: (checked) => field.onChange(checked === true)
|
|
665
|
+
}
|
|
666
|
+
) }),
|
|
667
|
+
/* @__PURE__ */ jsxs3("div", { className: "grid gap-1", children: [
|
|
668
|
+
/* @__PURE__ */ jsx3(FormLabel2, { children: "Send email invite" }),
|
|
669
|
+
/* @__PURE__ */ jsx3(FormMessage2, {})
|
|
670
|
+
] })
|
|
671
|
+
] }) })
|
|
672
|
+
}
|
|
673
|
+
),
|
|
674
|
+
/* @__PURE__ */ jsx3(
|
|
675
|
+
FormField2,
|
|
676
|
+
{
|
|
677
|
+
control,
|
|
678
|
+
name: "viaSms",
|
|
679
|
+
render: ({ field }) => /* @__PURE__ */ jsx3(FormItem2, { children: /* @__PURE__ */ jsxs3("div", { className: "flex items-start gap-3", children: [
|
|
680
|
+
/* @__PURE__ */ jsx3(FormControl2, { children: /* @__PURE__ */ jsx3(
|
|
681
|
+
Checkbox,
|
|
682
|
+
{
|
|
683
|
+
checked: field.value,
|
|
684
|
+
disabled: !hasPhone,
|
|
685
|
+
onCheckedChange: (checked) => field.onChange(checked === true)
|
|
686
|
+
}
|
|
687
|
+
) }),
|
|
688
|
+
/* @__PURE__ */ jsxs3("div", { className: "grid gap-1", children: [
|
|
689
|
+
/* @__PURE__ */ jsx3(FormLabel2, { children: "Send SMS invite" }),
|
|
690
|
+
/* @__PURE__ */ jsx3(FormMessage2, {})
|
|
691
|
+
] })
|
|
692
|
+
] }) })
|
|
693
|
+
}
|
|
694
|
+
),
|
|
695
|
+
result ? /* @__PURE__ */ jsx3(InviteResultCard, { result }) : null
|
|
696
|
+
] }) }) }),
|
|
697
|
+
actions: /* @__PURE__ */ jsx3(
|
|
698
|
+
EntityFormActions2,
|
|
699
|
+
{
|
|
700
|
+
mode: "new",
|
|
701
|
+
onSubmit,
|
|
702
|
+
onReset: () => {
|
|
703
|
+
reset(defaultInviteUserValues);
|
|
704
|
+
setResult(null);
|
|
705
|
+
},
|
|
706
|
+
isSubmitting: inviteUser.isPending,
|
|
707
|
+
submitLabel: "Invite"
|
|
708
|
+
}
|
|
709
|
+
)
|
|
710
|
+
}
|
|
711
|
+
);
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
// src/pages/iam/users/_components/users-list.tsx
|
|
715
|
+
import {
|
|
716
|
+
Badge as Badge3,
|
|
717
|
+
DataTableAction,
|
|
718
|
+
DataTablePagination,
|
|
719
|
+
DisplayTable,
|
|
720
|
+
EntityEmptyState,
|
|
721
|
+
EntityLoadingState,
|
|
722
|
+
Tbody,
|
|
723
|
+
Td,
|
|
724
|
+
Th,
|
|
725
|
+
Thead,
|
|
726
|
+
Tr
|
|
727
|
+
} from "@mesob/ui/components";
|
|
728
|
+
import { IconCalendar, IconUsers as IconUsers2 } from "@tabler/icons-react";
|
|
729
|
+
import { useState as useState3 } from "react";
|
|
730
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
731
|
+
var TABLE_COLUMN_COUNT = 4;
|
|
732
|
+
function UsersList({
|
|
733
|
+
data,
|
|
734
|
+
isLoading,
|
|
735
|
+
view,
|
|
736
|
+
pageIndex,
|
|
737
|
+
pageSize,
|
|
738
|
+
pageCount,
|
|
739
|
+
totalRows,
|
|
740
|
+
onPageChange,
|
|
741
|
+
onPageSizeChange,
|
|
742
|
+
onCreateNew
|
|
743
|
+
}) {
|
|
744
|
+
const [editingUserId, setEditingUserId] = useState3(null);
|
|
745
|
+
if (isLoading) {
|
|
746
|
+
return /* @__PURE__ */ jsx4(
|
|
747
|
+
EntityLoadingState,
|
|
748
|
+
{
|
|
749
|
+
view,
|
|
750
|
+
rowCount: pageSize,
|
|
751
|
+
columnCount: TABLE_COLUMN_COUNT,
|
|
752
|
+
cardCount: pageSize
|
|
753
|
+
}
|
|
754
|
+
);
|
|
755
|
+
}
|
|
756
|
+
if (totalRows === 0) {
|
|
757
|
+
return /* @__PURE__ */ jsx4(
|
|
758
|
+
EntityEmptyState,
|
|
759
|
+
{
|
|
760
|
+
icon: IconUsers2,
|
|
761
|
+
entityName: "user",
|
|
762
|
+
title: "No users yet",
|
|
763
|
+
description: "Invite your first user to get started.",
|
|
764
|
+
actionLabel: "Invite user",
|
|
765
|
+
onAction: onCreateNew
|
|
766
|
+
}
|
|
767
|
+
);
|
|
768
|
+
}
|
|
769
|
+
if (view === "table") {
|
|
770
|
+
return /* @__PURE__ */ jsxs4("div", { className: "space-y-4", children: [
|
|
771
|
+
editingUserId && /* @__PURE__ */ jsx4(
|
|
772
|
+
UserForm,
|
|
773
|
+
{
|
|
774
|
+
mode: "edit",
|
|
775
|
+
userId: editingUserId,
|
|
776
|
+
open: true,
|
|
777
|
+
onClose: () => setEditingUserId(null)
|
|
778
|
+
}
|
|
779
|
+
),
|
|
780
|
+
/* @__PURE__ */ jsxs4(DisplayTable, { withTableBorder: true, children: [
|
|
781
|
+
/* @__PURE__ */ jsx4(Thead, { children: /* @__PURE__ */ jsxs4(Tr, { children: [
|
|
782
|
+
/* @__PURE__ */ jsx4(Th, { className: "w-1/4", children: "Name" }),
|
|
783
|
+
/* @__PURE__ */ jsx4(Th, { className: "w-1/4", children: "Contact" }),
|
|
784
|
+
/* @__PURE__ */ jsx4(Th, { className: "w-1/4", children: "Last sign in" }),
|
|
785
|
+
/* @__PURE__ */ jsx4(Th, { className: "w-[50px]" })
|
|
786
|
+
] }) }),
|
|
787
|
+
/* @__PURE__ */ jsx4(Tbody, { children: data.map((user) => /* @__PURE__ */ jsxs4(Tr, { className: "group", children: [
|
|
788
|
+
/* @__PURE__ */ jsx4(Td, { children: /* @__PURE__ */ jsx4(
|
|
789
|
+
Link,
|
|
790
|
+
{
|
|
791
|
+
href: `/iam/users/${user.id}`,
|
|
792
|
+
className: "block text-left font-medium hover:text-primary hover:underline cursor-pointer",
|
|
793
|
+
children: /* @__PURE__ */ jsx4("p", { children: user.fullName })
|
|
794
|
+
}
|
|
795
|
+
) }),
|
|
796
|
+
/* @__PURE__ */ jsx4(Td, { children: /* @__PURE__ */ jsxs4("div", { className: "space-y-1", children: [
|
|
797
|
+
user.email && /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
798
|
+
/* @__PURE__ */ jsx4("span", { className: "text-sm", children: user.email }),
|
|
799
|
+
user.emailVerified && /* @__PURE__ */ jsx4(Badge3, { variant: "outline", className: "text-xs", children: "Verified" })
|
|
800
|
+
] }),
|
|
801
|
+
user.phone && /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
802
|
+
/* @__PURE__ */ jsx4("span", { className: "text-sm", children: user.phone }),
|
|
803
|
+
user.phoneVerified && /* @__PURE__ */ jsx4(Badge3, { variant: "outline", className: "text-xs", children: "Verified" })
|
|
804
|
+
] }),
|
|
805
|
+
!(user.email || user.phone) && /* @__PURE__ */ jsx4("span", { className: "text-muted-foreground", children: "\u2014" })
|
|
806
|
+
] }) }),
|
|
807
|
+
/* @__PURE__ */ jsx4(Td, { children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
808
|
+
/* @__PURE__ */ jsx4(IconCalendar, { className: "h-4 w-4" }),
|
|
809
|
+
user.lastSignInAt ? new Date(user.lastSignInAt).toLocaleDateString() : "Never"
|
|
810
|
+
] }) }),
|
|
811
|
+
/* @__PURE__ */ jsx4(Td, { children: /* @__PURE__ */ jsx4(DataTableAction, { onClick: () => setEditingUserId(user.id) }) })
|
|
812
|
+
] }, user.id)) })
|
|
813
|
+
] }),
|
|
814
|
+
/* @__PURE__ */ jsx4(
|
|
815
|
+
DataTablePagination,
|
|
816
|
+
{
|
|
817
|
+
pageIndex,
|
|
818
|
+
pageSize,
|
|
819
|
+
pageCount,
|
|
820
|
+
totalRows,
|
|
821
|
+
onPageChange,
|
|
822
|
+
onPageSizeChange
|
|
823
|
+
}
|
|
824
|
+
)
|
|
825
|
+
] });
|
|
826
|
+
}
|
|
827
|
+
return /* @__PURE__ */ jsxs4("div", { className: "space-y-4", children: [
|
|
828
|
+
/* @__PURE__ */ jsx4("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", children: data.map((user) => /* @__PURE__ */ jsx4(UserCard, { user }, user.id)) }),
|
|
829
|
+
/* @__PURE__ */ jsx4(
|
|
830
|
+
DataTablePagination,
|
|
831
|
+
{
|
|
832
|
+
pageIndex,
|
|
833
|
+
pageSize,
|
|
834
|
+
pageCount,
|
|
835
|
+
totalRows,
|
|
836
|
+
onPageChange,
|
|
837
|
+
onPageSizeChange
|
|
838
|
+
}
|
|
839
|
+
)
|
|
840
|
+
] });
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
// src/components/iam/users-page.tsx
|
|
844
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
845
|
+
function UsersPage() {
|
|
846
|
+
const { hooks } = useApi();
|
|
847
|
+
useBreadcrumbs({
|
|
848
|
+
items: [
|
|
849
|
+
{ label: "Home", href: "/dashboard" },
|
|
850
|
+
{ label: "IAM", href: "/iam/users" },
|
|
851
|
+
{ label: "Users" }
|
|
852
|
+
]
|
|
853
|
+
});
|
|
854
|
+
const [inviteOpen, setInviteOpen] = useState4(false);
|
|
855
|
+
const [bulkInviteOpen, setBulkInviteOpen] = useState4(false);
|
|
856
|
+
const { queryConfig, params, setParams } = useEntityParams({
|
|
857
|
+
searchKey: "search",
|
|
858
|
+
searchParamName: "handle"
|
|
859
|
+
});
|
|
860
|
+
const usersQuery = queryConfig;
|
|
861
|
+
const { data, isPending, isFetching } = hooks.useQuery(
|
|
862
|
+
"get",
|
|
863
|
+
"/users",
|
|
864
|
+
usersQuery,
|
|
865
|
+
defaultEntityQueryOptions
|
|
866
|
+
);
|
|
867
|
+
const isLoading = isPending || isFetching;
|
|
868
|
+
const users = data?.users ?? [];
|
|
869
|
+
const { total, pageCount } = useEntityPagination({
|
|
870
|
+
items: users,
|
|
871
|
+
total: data?.total,
|
|
872
|
+
pageSize: params.pageSize
|
|
873
|
+
});
|
|
874
|
+
return /* @__PURE__ */ jsx5(PageContainer, { className: "flex flex-1 flex-col gap-4 p-4 pt-0", children: /* @__PURE__ */ jsxs5(PageBody, { className: "px-0", children: [
|
|
875
|
+
/* @__PURE__ */ jsx5(
|
|
876
|
+
EntityHeader,
|
|
877
|
+
{
|
|
878
|
+
icon: /* @__PURE__ */ jsx5(IconUsers3, { className: "h-5 w-5" }),
|
|
879
|
+
title: "Users",
|
|
880
|
+
actions: /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2", children: [
|
|
881
|
+
/* @__PURE__ */ jsx5(
|
|
882
|
+
EntityDrawerTrigger,
|
|
883
|
+
{
|
|
884
|
+
mode: "new",
|
|
885
|
+
entity: "User",
|
|
886
|
+
label: "Invite user",
|
|
887
|
+
open: inviteOpen,
|
|
888
|
+
onOpenChange: setInviteOpen,
|
|
889
|
+
children: (open, onClose) => /* @__PURE__ */ jsx5(InviteUserForm, { open, onClose })
|
|
890
|
+
}
|
|
891
|
+
),
|
|
892
|
+
/* @__PURE__ */ jsx5(
|
|
893
|
+
EntityDrawerTrigger,
|
|
894
|
+
{
|
|
895
|
+
mode: "new",
|
|
896
|
+
entity: "User",
|
|
897
|
+
label: "Bulk invite",
|
|
898
|
+
variant: "outline",
|
|
899
|
+
open: bulkInviteOpen,
|
|
900
|
+
onOpenChange: setBulkInviteOpen,
|
|
901
|
+
children: (open, onClose) => /* @__PURE__ */ jsx5(BulkInviteUserForm, { open, onClose })
|
|
902
|
+
}
|
|
903
|
+
)
|
|
904
|
+
] }),
|
|
905
|
+
search: /* @__PURE__ */ jsx5(EntitySearch, { paramKey: "search", placeholder: "Search users..." }),
|
|
906
|
+
filter: /* @__PURE__ */ jsx5(
|
|
907
|
+
EntityFilter,
|
|
908
|
+
{
|
|
909
|
+
options: [
|
|
910
|
+
{ label: "All", value: "" },
|
|
911
|
+
{ label: "Email Verified", value: "emailVerified" },
|
|
912
|
+
{ label: "Phone Verified", value: "phoneVerified" },
|
|
913
|
+
{ label: "Not Verified", value: "notVerified" }
|
|
914
|
+
],
|
|
915
|
+
placeholder: "Filter"
|
|
916
|
+
}
|
|
917
|
+
),
|
|
918
|
+
sort: /* @__PURE__ */ jsx5(
|
|
919
|
+
EntitySort,
|
|
920
|
+
{
|
|
921
|
+
options: [
|
|
922
|
+
{ label: "Created", value: "createdAt" },
|
|
923
|
+
{ label: "Updated", value: "updatedAt" },
|
|
924
|
+
{ label: "Name", value: "fullName" },
|
|
925
|
+
{ label: "Last Sign In", value: "lastSignInAt" }
|
|
926
|
+
]
|
|
927
|
+
}
|
|
928
|
+
),
|
|
929
|
+
view: /* @__PURE__ */ jsx5(EntityViewToggle, { views: ["table", "card"] })
|
|
930
|
+
}
|
|
931
|
+
),
|
|
932
|
+
/* @__PURE__ */ jsx5(
|
|
933
|
+
UsersList,
|
|
934
|
+
{
|
|
935
|
+
data: users,
|
|
936
|
+
isLoading,
|
|
937
|
+
view: params.view || "table",
|
|
938
|
+
pageIndex: params.page - 1,
|
|
939
|
+
pageSize: params.pageSize,
|
|
940
|
+
pageCount,
|
|
941
|
+
totalRows: total,
|
|
942
|
+
onCreateNew: () => setInviteOpen(true),
|
|
943
|
+
onPageChange: (p) => setParams({ page: p + 1 }),
|
|
944
|
+
onPageSizeChange: (size) => setParams({ pageSize: size, page: 1 })
|
|
945
|
+
}
|
|
946
|
+
)
|
|
947
|
+
] }) });
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
export {
|
|
951
|
+
UsersPage
|
|
952
|
+
};
|
|
953
|
+
//# sourceMappingURL=chunk-BGSHXIHI.js.map
|