@dragonmastery/dragoncore-vue 0.0.15 → 0.0.17
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/{ChangePasswordPage-DCews8GU.js → ChangePasswordPage-D2Ci00Sh.js} +3 -3
- package/dist/{ChangePasswordPage-DCews8GU.js.map → ChangePasswordPage-D2Ci00Sh.js.map} +1 -1
- package/dist/ChangePasswordPage-DqnWhaUa.js +6 -0
- package/dist/CreateTeamForm-DH0k3ra-.js +32 -0
- package/dist/CreateTeamMemberForm-DR0krDAy.js +32 -0
- package/dist/{CreateUserPage-B8qeBZij.js → CreateUserPage-DbT_l32W.js} +3 -3
- package/dist/{CreateUserPage-B8qeBZij.js.map → CreateUserPage-DbT_l32W.js.map} +1 -1
- package/dist/CreateUserPage-cduuWl9g.js +6 -0
- package/dist/CreditBalanceDashboard-Bh6G7DdM.js +32 -0
- package/dist/CreditManagement-BGqIkJf8.js +32 -0
- package/dist/CustomerCreateSupportTicketForm-DROOc8QU.js +32 -0
- package/dist/{CustomerSupportTicketDetailPage-ryM1_h1-.js → CustomerSupportTicketDetailPage-CPnNMJRz.js} +9 -9
- package/dist/{CustomerSupportTicketDetailPage-ryM1_h1-.js.map → CustomerSupportTicketDetailPage-CPnNMJRz.js.map} +1 -1
- package/dist/CustomerSupportTicketList-BdCyjYTK.js +32 -0
- package/dist/{CustomerSupportTicketParent-BzY4pmBk.js → CustomerSupportTicketParent-C_vgUq3B.js} +3 -3
- package/dist/{CustomerSupportTicketParent-BzY4pmBk.js.map → CustomerSupportTicketParent-C_vgUq3B.js.map} +1 -1
- package/dist/CustomerSupportTicketParent-Ex-sumQ_.js +7 -0
- package/dist/CustomerSupportTicketSuccess-BiccWyEb.js +32 -0
- package/dist/EditTeamForm-COtlNY2k.js +32 -0
- package/dist/EditTeamMemberForm-8CNRrEIT.js +6 -0
- package/dist/{EditTeamMemberForm-CKbKomrL.js → EditTeamMemberForm-y4Klbm2x.js} +3 -3
- package/dist/{EditTeamMemberForm-CKbKomrL.js.map → EditTeamMemberForm-y4Klbm2x.js.map} +1 -1
- package/dist/{EditUserPage-XqF25iwz.js → EditUserPage-0lqrgP5T.js} +4 -4
- package/dist/{EditUserPage-XqF25iwz.js.map → EditUserPage-0lqrgP5T.js.map} +1 -1
- package/dist/EditUserPage-BgMNOa8G.js +7 -0
- package/dist/{ForgotPassword-D3bjL48L.js → ForgotPassword-CiEfdVT-.js} +12 -8
- package/dist/ForgotPassword-CiEfdVT-.js.map +1 -0
- package/dist/ForgotPassword-DTqvZE3S.js +7 -0
- package/dist/LoginForm-INwjqMmZ.js +7 -0
- package/dist/{LoginForm-C85U2E2r.js → LoginForm-o4gJ0QwA.js} +17 -17
- package/dist/LoginForm-o4gJ0QwA.js.map +1 -0
- package/dist/{Logout-DZuWLh0O.js → Logout-D8Ql8-OY.js} +11 -8
- package/dist/Logout-D8Ql8-OY.js.map +1 -0
- package/dist/Logout-KA5WB93_.js +6 -0
- package/dist/MfaSetup-B3-QSuKe.js +8 -0
- package/dist/MfaSetup-DzaJLZtx.js +113 -0
- package/dist/MfaSetup-DzaJLZtx.js.map +1 -0
- package/dist/MfaVerify-5DOMPhdq.js +8 -0
- package/dist/MfaVerify-C04XD4r3.js +86 -0
- package/dist/MfaVerify-C04XD4r3.js.map +1 -0
- package/dist/ResetPassword-DcVvfMU3.js +92 -0
- package/dist/ResetPassword-DcVvfMU3.js.map +1 -0
- package/dist/ResetPassword-rtEJreLv.js +7 -0
- package/dist/{SavedFiltersPage-rG33pF5X.js → SavedFiltersPage-PfwukNXV.js} +27 -22
- package/dist/{SavedFiltersPage-rG33pF5X.js.map → SavedFiltersPage-PfwukNXV.js.map} +1 -1
- package/dist/Signup-DWFxpoGA.js +7 -0
- package/dist/{Signup-hpV8J5cM.js → Signup-Wz2h_ayt.js} +52 -21
- package/dist/Signup-Wz2h_ayt.js.map +1 -0
- package/dist/StaffCreateSupportTicketForm-Cs3puA0j.js +32 -0
- package/dist/{StaffSupportTicketDetailPage-_ZOQgWv0.js → StaffSupportTicketDetailPage-DDkJcKVC.js} +10 -10
- package/dist/{StaffSupportTicketDetailPage-_ZOQgWv0.js.map → StaffSupportTicketDetailPage-DDkJcKVC.js.map} +1 -1
- package/dist/StaffSupportTicketList-B3HBQJ9r.js +32 -0
- package/dist/StaffSupportTicketParent-BiyZAW5w.js +7 -0
- package/dist/{StaffSupportTicketParent-CWWhaM37.js → StaffSupportTicketParent-Bp5pNF45.js} +3 -3
- package/dist/{StaffSupportTicketParent-CWWhaM37.js.map → StaffSupportTicketParent-Bp5pNF45.js.map} +1 -1
- package/dist/StaffSupportTicketSuccess-CegCdk-v.js +32 -0
- package/dist/{SupportStaffPage-nd0HowtH.js → SupportStaffPage-DwILSSas.js} +5 -5
- package/dist/{SupportStaffPage-nd0HowtH.js.map → SupportStaffPage-DwILSSas.js.map} +1 -1
- package/dist/{SupportTicketDevLifecycleBadge-Ba-Rm6QW.js → SupportTicketDevLifecycleBadge-B2NysMAj.js} +1 -1
- package/dist/{SupportTicketDevLifecycleBadge-Ba-Rm6QW.js.map → SupportTicketDevLifecycleBadge-B2NysMAj.js.map} +1 -1
- package/dist/{SupportTicketMaintenancePage-rcJ7EfDj.js → SupportTicketMaintenancePage-CpK1esq2.js} +4 -4
- package/dist/{SupportTicketMaintenancePage-rcJ7EfDj.js.map → SupportTicketMaintenancePage-CpK1esq2.js.map} +1 -1
- package/dist/TeamAttachmentsTab-B6_qHPKJ.js +32 -0
- package/dist/{TeamHistoryTab-CNelXR3Q.js → TeamHistoryTab-B3DvaIzC.js} +2 -2
- package/dist/{TeamHistoryTab-CNelXR3Q.js.map → TeamHistoryTab-B3DvaIzC.js.map} +1 -1
- package/dist/TeamHistoryTab-HXc3zqhQ.js +4 -0
- package/dist/TeamList-DrMqaMvI.js +32 -0
- package/dist/TeamMemberList-CEV6-g3t.js +32 -0
- package/dist/TeamMemberParent-D-MnEdRq.js +32 -0
- package/dist/TeamNotesTab-BlmZQfCR.js +7 -0
- package/dist/{TeamNotesTab-BhVRLG8h.js → TeamNotesTab-DBrJGCIe.js} +5 -5
- package/dist/{TeamNotesTab-BhVRLG8h.js.map → TeamNotesTab-DBrJGCIe.js.map} +1 -1
- package/dist/TeamParent-Dw6Njuup.js +32 -0
- package/dist/{TimelineNoteInput-CdfuzIeI.js → TimelineNoteInput-DGDgyGe-.js} +2 -2
- package/dist/{TimelineNoteInput-CdfuzIeI.js.map → TimelineNoteInput-DGDgyGe-.js.map} +1 -1
- package/dist/{TimelineSystemEvent-D58zN850.js → TimelineSystemEvent-CBwUl5G8.js} +4 -4
- package/dist/{TimelineSystemEvent-D58zN850.js.map → TimelineSystemEvent-CBwUl5G8.js.map} +1 -1
- package/dist/{UserListPage-OGYOLwlw.js → UserListPage-BGDgsd_S.js} +2 -2
- package/dist/{UserListPage-OGYOLwlw.js.map → UserListPage-BGDgsd_S.js.map} +1 -1
- package/dist/UserListPage-BZp9fGeT.js +4 -0
- package/dist/UserProfilePage-D52_Q5yf.js +7 -0
- package/dist/{UserProfilePage-uAIfC_NW.js → UserProfilePage-DMwDVgXa.js} +67 -22
- package/dist/UserProfilePage-DMwDVgXa.js.map +1 -0
- package/dist/VerifyEmail-CG1BHGSh.js +7 -0
- package/dist/VerifyEmail-CUexC8mg.js +140 -0
- package/dist/VerifyEmail-CUexC8mg.js.map +1 -0
- package/dist/VerifyEmailRequired-C35bkaXZ.js +75 -0
- package/dist/VerifyEmailRequired-C35bkaXZ.js.map +1 -0
- package/dist/ViewTeam-D9PDDpY6.js +32 -0
- package/dist/ViewTeamMember-sJb79wUy.js +32 -0
- package/dist/{displayIdFormatter-B1ZKgofu.js → displayIdFormatter-rSbbsHIX.js} +1 -1
- package/dist/{displayIdFormatter-B1ZKgofu.js.map → displayIdFormatter-rSbbsHIX.js.map} +1 -1
- package/dist/index.d.ts +306 -210
- package/dist/index.js +29 -23
- package/dist/mfaSchema-_vbG9jiT.js +30 -0
- package/dist/mfaSchema-_vbG9jiT.js.map +1 -0
- package/dist/{src-BUN-mdXa.js → src-DYBi81fS.js} +473 -400
- package/dist/src-DYBi81fS.js.map +1 -0
- package/dist/{useMutation-B4_S4Xoa.js → useMutation-DzRSXPB1.js} +3 -3
- package/dist/{useMutation-B4_S4Xoa.js.map → useMutation-DzRSXPB1.js.map} +1 -1
- package/dist/{useQuery-B7ndu5_P.js → useQuery-bvJabe9Q.js} +3 -3
- package/dist/{useQuery-B7ndu5_P.js.map → useQuery-bvJabe9Q.js.map} +1 -1
- package/dist/{useQueryCache-DqcDMsxb.js → useQueryCache-DIGf3fCM.js} +2 -2
- package/dist/{useQueryCache-DqcDMsxb.js.map → useQueryCache-DIGf3fCM.js.map} +1 -1
- package/dist/useReturnUrl-DobHOKp3.js +23 -0
- package/dist/useReturnUrl-DobHOKp3.js.map +1 -0
- package/dist/{useRpcAuth-Dp2sec-X.js → useRpcAuth-SgNzCAPa.js} +2 -1
- package/dist/useRpcAuth-SgNzCAPa.js.map +1 -0
- package/package.json +2 -2
- package/dist/ChangePasswordPage-Dm5vW0nl.js +0 -6
- package/dist/CreateTeamForm-Cm8DOOXF.js +0 -27
- package/dist/CreateTeamMemberForm-CcdQys0C.js +0 -27
- package/dist/CreateUserPage-WjYDkwpb.js +0 -6
- package/dist/CreditBalanceDashboard-RLAnIiVN.js +0 -27
- package/dist/CreditManagement-DGLhDOO5.js +0 -27
- package/dist/CustomerCreateSupportTicketForm-Dv0ZMYrw.js +0 -27
- package/dist/CustomerSupportTicketList-Cfe8gqiX.js +0 -27
- package/dist/CustomerSupportTicketParent-BnmTFigo.js +0 -7
- package/dist/CustomerSupportTicketSuccess-DnnRkxsI.js +0 -27
- package/dist/EditTeamForm-DzEAqBhc.js +0 -27
- package/dist/EditTeamMemberForm-B8-pI6Xm.js +0 -6
- package/dist/EditUserPage-BG-Fkx_c.js +0 -7
- package/dist/ForgotPassword-CjWv2V7p.js +0 -7
- package/dist/ForgotPassword-D3bjL48L.js.map +0 -1
- package/dist/LoginForm--br4Il85.js +0 -7
- package/dist/LoginForm-C85U2E2r.js.map +0 -1
- package/dist/Logout-DHT-5Qz3.js +0 -6
- package/dist/Logout-DZuWLh0O.js.map +0 -1
- package/dist/ResetPassword-COmnbNlg.js +0 -27
- package/dist/Signup-VZa7U-Ur.js +0 -7
- package/dist/Signup-hpV8J5cM.js.map +0 -1
- package/dist/StaffCreateSupportTicketForm-CIDdUNcs.js +0 -27
- package/dist/StaffSupportTicketList-DPIu3W50.js +0 -27
- package/dist/StaffSupportTicketParent-Dp1G85wc.js +0 -7
- package/dist/StaffSupportTicketSuccess-8lYa8_Sm.js +0 -27
- package/dist/TeamAttachmentsTab-VUrIDPW6.js +0 -27
- package/dist/TeamHistoryTab-siesF93u.js +0 -4
- package/dist/TeamList-BOXFY4cO.js +0 -27
- package/dist/TeamMemberList-BwqpVaNc.js +0 -27
- package/dist/TeamMemberParent-DIxwJ6EP.js +0 -27
- package/dist/TeamNotesTab-Crp-afAe.js +0 -7
- package/dist/TeamParent-pEhBNWqh.js +0 -27
- package/dist/UserListPage-D68AjrjM.js +0 -4
- package/dist/UserProfilePage-Q68NAGQQ.js +0 -7
- package/dist/UserProfilePage-uAIfC_NW.js.map +0 -1
- package/dist/ViewTeam-Cexcjy9c.js +0 -27
- package/dist/ViewTeamMember-DKBKSsAc.js +0 -27
- package/dist/src-BUN-mdXa.js.map +0 -1
- package/dist/useRpcAuth-Dp2sec-X.js.map +0 -1
- /package/dist/{Appearance-C3WguxT-.js → Appearance-CohgRf-_.js} +0 -0
- /package/dist/{TeamMembersTab-DTJxmb-M.js → TeamMembersTab-CpE9BaCi.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as executeWithAuth, s as getRefreshTokenHandler } from "./useRpcAuth-
|
|
1
|
+
import { r as executeWithAuth, s as getRefreshTokenHandler } from "./useRpcAuth-SgNzCAPa.js";
|
|
2
2
|
import { t as formatSystemTimestamp } from "./convertToLocalDateTime-DOSGtMn8.js";
|
|
3
3
|
import { computed, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, resolveComponent, toDisplayString, unref, withCtx } from "vue";
|
|
4
4
|
import { UserReadSchema } from "@dragonmastery/dragoncore-shared";
|
|
@@ -150,4 +150,4 @@ var UserListPage_default = _sfc_main;
|
|
|
150
150
|
|
|
151
151
|
//#endregion
|
|
152
152
|
export { userRowSchemaWithMetadata as n, UserTypeBadge_default as r, UserListPage_default as t };
|
|
153
|
-
//# sourceMappingURL=UserListPage-
|
|
153
|
+
//# sourceMappingURL=UserListPage-BGDgsd_S.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserListPage-
|
|
1
|
+
{"version":3,"file":"UserListPage-BGDgsd_S.js","names":["mappedUsers: UserRow[]"],"sources":["../src/slices/admin/components/UserTypeBadge.vue","../src/slices/admin/features/user_management/userRowSchema.ts","../src/slices/admin/features/user_management/UserListPage.vue"],"sourcesContent":["<template>\n <span class=\"badge badge-sm\" :class=\"badgeClasses\">\n {{ typeLabel }}\n </span>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\n\ninterface Props {\n userType: 'consumer' | 'lead' | 'staff' | 'super_admin';\n size?: 'xs' | 'sm' | 'md' | 'lg';\n}\n\nconst props = withDefaults(defineProps<Props>(), {\n size: 'sm',\n});\n\nconst typeConfig = {\n consumer: {\n label: 'Consumer',\n variant: 'neutral',\n },\n lead: {\n label: 'Lead',\n variant: 'info',\n },\n staff: {\n label: 'Staff',\n variant: 'warning',\n },\n super_admin: {\n label: 'Admin',\n variant: 'error',\n },\n};\n\nconst typeLabel = computed(() => {\n return typeConfig[props.userType]?.label || props.userType;\n});\n\nconst badgeClasses = computed(() => {\n const config = typeConfig[props.userType];\n const baseClasses = `badge-${props.size}`;\n\n if (!config) {\n return `${baseClasses} badge-neutral`;\n }\n\n return `${baseClasses} badge-${config.variant}`;\n});\n</script>\n","import { withMetadata } from '@dragonmastery/zinia-forms-core';\nimport { UserReadSchema } from '@dragonmastery/dragoncore-shared';\nimport type { z } from 'zod';\n\nexport const userRowSchemaWithMetadata = withMetadata(UserReadSchema, 'userRowSchema', {\n username: { label: 'Username' },\n email: { label: 'Email' },\n user_type: { label: 'Role' },\n email_verified: { label: 'Verified' },\n created_at: { label: 'Created' },\n});\n\nexport type UserRow = z.infer<typeof UserReadSchema>;\n","<template>\n <div class=\"mt-2\">\n <!-- Header with title and actions -->\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-2xl font-bold\">User Management</h1>\n </div>\n\n <!-- Zinia Data Table -->\n <ZiniaDataTable>\n <!-- Custom cell templates -->\n <template #cell-user_type=\"{ row }\">\n <UserTypeBadge :user-type=\"row.user_type\" />\n </template>\n\n <template #cell-email_verified=\"{ row }\">\n <span\n class=\"badge badge-sm\"\n :class=\"row.email_verified ? 'badge-success' : 'badge-error'\"\n >\n {{ row.email_verified ? 'Verified' : 'Not Verified' }}\n </span>\n </template>\n\n <template #cell-created_at=\"{ row }\">\n {{ formatSystemTimestamp(row.created_at) }}\n </template>\n\n <template #cell-actions=\"{ row }\">\n <router-link\n :to=\"{ name: 'EditUser', params: { id: row.id } }\"\n class=\"btn btn-sm btn-primary\"\n >\n Edit\n </router-link>\n </template>\n </ZiniaDataTable>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { executeWithAuth } from '../../../../composables/useRpcAuth';\nimport { getRefreshTokenHandler } from '../../../../utils/EnhancedRefreshTokenHandler';\nimport { formatSystemTimestamp } from '../../../../utils/convertToLocalDateTime';\nimport { useCursorDataTable } from '@dragonmastery/zinia-forms-core';\nimport UserTypeBadge from '../../components/UserTypeBadge.vue';\nimport { userRowSchemaWithMetadata, type UserRow } from './userRowSchema';\n\n// Set up data table\nconst { ZiniaDataTable } = useCursorDataTable(userRowSchemaWithMetadata, {\n fetchData: async () => {\n const users = await executeWithAuth(\n async (api) => {\n return await api.users.listUsers();\n },\n { refreshTokenHandler: getRefreshTokenHandler() },\n );\n\n // Map response to UserRow format\n const mappedUsers: UserRow[] = users.map((user) => ({\n id: user.id,\n username: user.username,\n email: user.email,\n email_verified: user.email_verified,\n user_type: user.user_type,\n created_at: user.created_at,\n updated_at: user.updated_at ?? null,\n }));\n\n return {\n data: mappedUsers,\n hasNextPage: false,\n hasPreviousPage: false,\n prevPageCursor: undefined,\n nextPageCursor: undefined,\n };\n },\n\n // Column configuration\n columns: {\n username: { label: 'Username', field: 'username', sortable: true },\n email: { label: 'Email', field: 'email', sortable: true },\n user_type: { label: 'Role', field: 'user_type', sortable: true },\n email_verified: {\n label: 'Verified',\n field: 'email_verified',\n sortable: true,\n },\n created_at: { label: 'Created', field: 'created_at', sortable: true },\n },\n\n // Action buttons\n actions: {\n items: [\n {\n key: 'edit',\n icon: 'edit',\n size: 'xs',\n variant: 'primary',\n type: 'link',\n href: (row: UserRow) => `/admin/users/${row.id}/edit`,\n },\n ],\n },\n\n pagination: {\n pageSize: 100,\n },\n});\n</script>\n"],"mappings":";;;;;;;;;;;;;;EAcA,MAAM,QAAQ;EAId,MAAM,aAAa;GACjB,UAAU;IACR,OAAO;IACP,SAAS;IACV;GACD,MAAM;IACJ,OAAO;IACP,SAAS;IACV;GACD,OAAO;IACL,OAAO;IACP,SAAS;IACV;GACD,aAAa;IACX,OAAO;IACP,SAAS;IACV;GACF;EAED,MAAM,YAAY,eAAe;AAC/B,UAAO,WAAW,MAAM,WAAW,SAAS,MAAM;IAClD;EAEF,MAAM,eAAe,eAAe;GAClC,MAAM,SAAS,WAAW,MAAM;GAChC,MAAM,cAAc,SAAS,MAAM;AAEnC,OAAI,CAAC,OACH,QAAO,GAAG,YAAY;AAGxB,UAAO,GAAG,YAAY,SAAS,OAAO;IACtC;;uBAjDA,mBAEO,QAAA,EAFD,OAAK,eAAA,CAAC,kBAAyB,aAAA,MAAY,CAAA,EAAA,kBAC5C,UAAA,MAAS,EAAA,EAAA;;;;;;;;ACEhB,MAAa,4BAA4B,aAAa,gBAAgB,iBAAiB;CACrF,UAAU,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B,YA2BiB,MAAA,eAAA,EAAA,MAAA;KAzBJ,kBAAc,SACqB,EADjB,UAAG,CAC9B,YAA4C,uBAAA,EAA5B,aAAW,IAAI,WAAA,EAAA,MAAA,GAAA,CAAA,YAAA,CAAA,CAAA,CAAA;KAGtB,uBAAmB,SAMrB,EANyB,UAAG,CACnC,mBAKO,QAAA,EAJL,OAAK,eAAA,CAAC,kBACE,IAAI,iBAAc,kBAAA,cAAA,CAAA,EAAA,kBAEvB,IAAI,iBAAc,aAAA,eAAA,EAAA,EAAA,CAAA,CAAA;KAId,mBAAe,SACmB,EADf,UAAG,CAAA,gCAC5B,MAAA,sBAAqB,CAAC,IAAI,WAAU,CAAA,EAAA,EAAA,CAAA,CAAA;KAG9B,gBAAY,SAMP,EANW,UAAG,CAC5B,YAKc,wBAAA;MAJX,IAAE;OAAA,MAAA;OAAA,QAAA,EAAA,IAAoC,IAAI,IAAE;OAAA;MAC7C,OAAM;;6BAGR,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAFC,UAED,GAAA,CAAA,EAAA,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "./useRpcAuth-SgNzCAPa.js";
|
|
2
|
+
import "./useQueryCache-DIGf3fCM.js";
|
|
3
|
+
import "./useMutation-DzRSXPB1.js";
|
|
4
|
+
import "./useQuery-bvJabe9Q.js";
|
|
5
|
+
import { t as UserProfilePage_default } from "./UserProfilePage-DMwDVgXa.js";
|
|
6
|
+
|
|
7
|
+
export { UserProfilePage_default as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { l as useUserSessionStore } from "./useRpcAuth-
|
|
2
|
-
import { t as useMutation } from "./useMutation-
|
|
3
|
-
import { t as useQuery } from "./useQuery-
|
|
4
|
-
import { createElementBlock, createElementVNode, createVNode, defineComponent, openBlock, toDisplayString, unref, withCtx } from "vue";
|
|
1
|
+
import { l as useUserSessionStore, m as useEnv } from "./useRpcAuth-SgNzCAPa.js";
|
|
2
|
+
import { t as useMutation } from "./useMutation-DzRSXPB1.js";
|
|
3
|
+
import { t as useQuery } from "./useQuery-bvJabe9Q.js";
|
|
4
|
+
import { createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, toDisplayString, unref, withCtx } from "vue";
|
|
5
|
+
import { toast } from "vue3-toastify";
|
|
5
6
|
import { UserProfileUpdateSchema } from "@dragonmastery/dragoncore-shared";
|
|
6
7
|
import { useForm, withMetadata } from "@dragonmastery/zinia-forms-core";
|
|
7
|
-
import { toast } from "vue3-toastify";
|
|
8
8
|
|
|
9
9
|
//#region src/slices/user/features/user_profile/userProfileSchema.ts
|
|
10
10
|
const userProfileSchemaWithMetadata = withMetadata(UserProfileUpdateSchema, "userProfileSchema", {
|
|
@@ -42,10 +42,37 @@ const _hoisted_3 = {
|
|
|
42
42
|
key: 2,
|
|
43
43
|
class: "max-w-md mx-auto bg-base-200 p-6 rounded-xl shadow-md container"
|
|
44
44
|
};
|
|
45
|
+
const _hoisted_4 = {
|
|
46
|
+
key: 0,
|
|
47
|
+
class: "mb-6 p-4 rounded-lg bg-base-300"
|
|
48
|
+
};
|
|
49
|
+
const _hoisted_5 = { class: "flex items-center justify-between gap-2" };
|
|
50
|
+
const _hoisted_6 = { class: "font-medium" };
|
|
51
|
+
const _hoisted_7 = ["disabled"];
|
|
45
52
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
46
53
|
__name: "UserProfilePage",
|
|
47
54
|
setup(__props) {
|
|
48
55
|
const session = useUserSessionStore();
|
|
56
|
+
const { emailVerificationMode } = useEnv();
|
|
57
|
+
const resendLoading = ref(false);
|
|
58
|
+
const { mutate: resendMutate } = useMutation((api, _input) => {
|
|
59
|
+
const verifyEmail = api.verifyEmail;
|
|
60
|
+
if (!verifyEmail) throw new Error("Email verification is not configured");
|
|
61
|
+
return verifyEmail.resendVerificationEmail();
|
|
62
|
+
}, { skipAuthCheck: false });
|
|
63
|
+
const resendVerification = async () => {
|
|
64
|
+
try {
|
|
65
|
+
resendLoading.value = true;
|
|
66
|
+
if ((await resendMutate(void 0))?.ok) {
|
|
67
|
+
toast.success("Verification email sent. Please check your inbox.");
|
|
68
|
+
await session.refreshToken();
|
|
69
|
+
} else toast.error("Failed to resend verification email.");
|
|
70
|
+
} catch (error) {
|
|
71
|
+
toast.error(error instanceof Error ? error.message : "Failed to resend");
|
|
72
|
+
} finally {
|
|
73
|
+
resendLoading.value = false;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
49
76
|
const { data: userProfileData, loading: userProfileFetching } = useQuery((api) => api.userProfiles.getCurrentUserProfile(), {
|
|
50
77
|
enabled: !!session.userSession?.user.userId,
|
|
51
78
|
staleTime: 300 * 1e3
|
|
@@ -99,22 +126,40 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
99
126
|
"stroke-linejoin": "round",
|
|
100
127
|
"stroke-width": "2",
|
|
101
128
|
d: "M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
102
|
-
})], -1)), createElementVNode("span", null, toDisplayString(unref(form).loadError), 1)])) : (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
129
|
+
})], -1)), createElementVNode("span", null, toDisplayString(unref(form).loadError), 1)])) : (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
130
|
+
_cache[3] || (_cache[3] = createElementVNode("h1", { class: "text-2xl font-bold mb-6 text-center" }, "Update User Profile", -1)),
|
|
131
|
+
createCommentVNode(" Email & verification status "),
|
|
132
|
+
unref(session).userSession?.user.email ? (openBlock(), createElementBlock("div", _hoisted_4, [createElementVNode("div", _hoisted_5, [createElementVNode("div", null, [
|
|
133
|
+
_cache[2] || (_cache[2] = createElementVNode("p", { class: "text-sm text-base-content/70" }, "Email", -1)),
|
|
134
|
+
createElementVNode("p", _hoisted_6, toDisplayString(unref(session).userSession.user.email), 1),
|
|
135
|
+
unref(emailVerificationMode) !== "disabled" ? (openBlock(), createElementBlock("p", {
|
|
136
|
+
key: 0,
|
|
137
|
+
class: normalizeClass(["text-sm mt-1", unref(session).userSession.user.email_verified ? "text-success" : "text-warning"])
|
|
138
|
+
}, toDisplayString(unref(session).userSession.user.email_verified ? "Verified" : "Not verified"), 3)) : createCommentVNode("v-if", true)
|
|
139
|
+
]), unref(emailVerificationMode) !== "disabled" && !unref(session).userSession.user.email_verified ? (openBlock(), createElementBlock("button", {
|
|
140
|
+
key: 0,
|
|
141
|
+
type: "button",
|
|
142
|
+
class: "btn btn-outline btn-sm",
|
|
143
|
+
disabled: resendLoading.value,
|
|
144
|
+
onClick: resendVerification
|
|
145
|
+
}, toDisplayString(resendLoading.value ? "Sending..." : "Resend verification"), 9, _hoisted_7)) : createCommentVNode("v-if", true)])])) : createCommentVNode("v-if", true),
|
|
146
|
+
createVNode(unref(ZiniaForm), {
|
|
147
|
+
onHandleSubmit: handleSubmit,
|
|
148
|
+
onSuccess: handleSuccess,
|
|
149
|
+
onError: handleError
|
|
150
|
+
}, {
|
|
151
|
+
default: withCtx(() => [
|
|
152
|
+
createVNode(unref(zinia).FirstNameField),
|
|
153
|
+
createVNode(unref(zinia).LastNameField),
|
|
154
|
+
createVNode(unref(zinia).BioField),
|
|
155
|
+
createVNode(unref(ZiniaSubmitButton), {
|
|
156
|
+
submitText: "Update",
|
|
157
|
+
submittingText: "Updating..."
|
|
158
|
+
})
|
|
159
|
+
]),
|
|
160
|
+
_: 1
|
|
161
|
+
})
|
|
162
|
+
]));
|
|
118
163
|
};
|
|
119
164
|
}
|
|
120
165
|
});
|
|
@@ -122,4 +167,4 @@ var UserProfilePage_default = _sfc_main;
|
|
|
122
167
|
|
|
123
168
|
//#endregion
|
|
124
169
|
export { userProfileSchemaWithMetadata as n, UserProfilePage_default as t };
|
|
125
|
-
//# sourceMappingURL=UserProfilePage-
|
|
170
|
+
//# sourceMappingURL=UserProfilePage-DMwDVgXa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserProfilePage-DMwDVgXa.js","names":[],"sources":["../src/slices/user/features/user_profile/userProfileSchema.ts","../src/slices/user/features/user_profile/UserProfilePage.vue"],"sourcesContent":["import { withMetadata } from '@dragonmastery/zinia-forms-core';\nimport { UserProfileBaseSchema, UserProfileUpdateSchema } from '@dragonmastery/dragoncore-shared';\nimport { z } from 'zod';\n\n// Define the login form type\nexport type UserProfileForm = z.infer<typeof UserProfileBaseSchema>;\n\n// Enhance the schema with metadata\nexport const userProfileSchemaWithMetadata = withMetadata(\n UserProfileUpdateSchema,\n 'userProfileSchema',\n {\n first_name: {\n inputType: 'text',\n placeholder: 'Enter first name',\n helpText: 'Enter the first name',\n autocomplete: 'first-name',\n autofocus: true,\n },\n\n last_name: {\n inputType: 'text',\n placeholder: 'Enter last name',\n helpText: 'Enter the last name',\n autocomplete: 'last-name',\n },\n\n bio: {\n inputType: 'textarea',\n placeholder: 'Enter bio',\n helpText: 'Enter a short bio',\n },\n },\n);\n","<template>\n <div v-if=\"form.isLoading\" class=\"flex justify-center items-center p-8\">\n <span class=\"loading loading-spinner loading-lg\"></span>\n </div>\n <div v-else-if=\"form.loadError\" class=\"alert alert-error mb-4\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"stroke-current shrink-0 h-6 w-6\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z\"\n />\n </svg>\n <span>{{ form.loadError }}</span>\n </div>\n <div v-else class=\"max-w-md mx-auto bg-base-200 p-6 rounded-xl shadow-md container\">\n <h1 class=\"text-2xl font-bold mb-6 text-center\">Update User Profile</h1>\n\n <!-- Email & verification status -->\n <div v-if=\"session.userSession?.user.email\" class=\"mb-6 p-4 rounded-lg bg-base-300\">\n <div class=\"flex items-center justify-between gap-2\">\n <div>\n <p class=\"text-sm text-base-content/70\">Email</p>\n <p class=\"font-medium\">{{ session.userSession.user.email }}</p>\n <p\n v-if=\"emailVerificationMode !== 'disabled'\"\n class=\"text-sm mt-1\"\n :class=\"session.userSession.user.email_verified ? 'text-success' : 'text-warning'\"\n >\n {{ session.userSession.user.email_verified ? 'Verified' : 'Not verified' }}\n </p>\n </div>\n <button\n v-if=\"\n emailVerificationMode !== 'disabled' &&\n !session.userSession.user.email_verified\n \"\n type=\"button\"\n class=\"btn btn-outline btn-sm\"\n :disabled=\"resendLoading\"\n @click=\"resendVerification\"\n >\n {{ resendLoading ? 'Sending...' : 'Resend verification' }}\n </button>\n </div>\n </div>\n\n <ZiniaForm @handle-submit=\"handleSubmit\" @success=\"handleSuccess\" @error=\"handleError\">\n <zinia.FirstNameField />\n <zinia.LastNameField />\n <zinia.BioField />\n\n <ZiniaSubmitButton submitText=\"Update\" submittingText=\"Updating...\" />\n </ZiniaForm>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport type { DragoncoreApi } from '@dragonmastery/dragoncore-shared';\nimport type { EmailVerificationApi } from '@dragonmastery/dragoncore-shared';\nimport type { UserProfileUpdateDto } from '@dragonmastery/dragoncore-shared';\nimport { useForm } from '@dragonmastery/zinia-forms-core';\nimport { ref } from 'vue';\nimport { toast } from 'vue3-toastify';\nimport { useEnv } from '../../../../composables/useEnv';\nimport { useMutation } from '../../../../composables/useMutation';\nimport { useQuery } from '../../../../composables/useQuery';\nimport { useUserSessionStore } from '../../../../composables/useUserSessionStore';\nimport { userProfileSchemaWithMetadata } from './userProfileSchema';\n\n//user session\nconst session = useUserSessionStore();\nconst { emailVerificationMode } = useEnv();\nconst resendLoading = ref(false);\n\nconst { mutate: resendMutate } = useMutation(\n (api, _input?: unknown) => {\n const verifyEmail = (api as DragoncoreApi).verifyEmail;\n if (!verifyEmail) throw new Error('Email verification is not configured');\n return (verifyEmail as EmailVerificationApi).resendVerificationEmail();\n },\n { skipAuthCheck: false },\n);\n\nconst resendVerification = async () => {\n try {\n resendLoading.value = true;\n const result = await resendMutate(undefined);\n if (result?.ok) {\n toast.success('Verification email sent. Please check your inbox.');\n await session.refreshToken();\n } else {\n toast.error('Failed to resend verification email.');\n }\n } catch (error) {\n toast.error(error instanceof Error ? error.message : 'Failed to resend');\n } finally {\n resendLoading.value = false;\n }\n};\n\n// fetch user profile data\nconst { data: userProfileData, loading: userProfileFetching } = useQuery(\n (api) => api.userProfiles.getCurrentUserProfile(),\n {\n enabled: !!session.userSession?.user.userId,\n staleTime: 5 * 60 * 1000,\n },\n);\n\n// Create a type-safe form using our schema with metadata\nconst { form, zinia, ZiniaForm, ZiniaSubmitButton } = useForm(userProfileSchemaWithMetadata, {\n storeName: 'user-profile-form',\n persistToLocalStorage: false,\n renderStyle: 'daisy_ui',\n fetchData: async () => {\n while (userProfileFetching.value) {\n await new Promise((resolve) => setTimeout(resolve, 100));\n }\n\n if (!userProfileData.value) {\n return {\n user_id: session.userSession?.user.userId || '',\n bio: '',\n first_name: '',\n last_name: '',\n };\n }\n\n return {\n user_id: userProfileData.value.user_id,\n bio: userProfileData.value.bio || '',\n first_name: userProfileData.value.first_name || '',\n last_name: userProfileData.value.last_name || '',\n };\n },\n});\n\nconst { mutate: updateUserProfile } = useMutation(\n (api, input: UserProfileUpdateDto) => api.userProfiles.updateUserProfile(input),\n { invalidate: /^user:profile/ },\n);\n\n// Handle form submission\nconst handleSubmit = async (data: UserProfileUpdateDto) => {\n if (!session.userSession?.user.userId) {\n throw new Error('User session not found');\n }\n\n const result = await updateUserProfile({\n user_id: session.userSession?.user.userId,\n first_name: data.first_name,\n last_name: data.last_name,\n bio: data.bio,\n });\n if (!result) throw new Error('Update user profile failed');\n\n return result;\n};\n\n// Handle success\nconst handleSuccess = (_data: any) => {\n toast.success('User profile updated successfully!');\n};\n\n// Handle error\nconst handleError = (error: any) => {\n toast.error(error.message || 'Update user profile failed');\n};\n</script>\n"],"mappings":";;;;;;;;;AAQA,MAAa,gCAAgC,aAC3C,yBACA,qBACA;CACE,YAAY;EACV,WAAW;EACX,aAAa;EACb,UAAU;EACV,cAAc;EACd,WAAW;EACZ;CAED,WAAW;EACT,WAAW;EACX,aAAa;EACb,UAAU;EACV,cAAc;EACf;CAED,KAAK;EACH,WAAW;EACX,aAAa;EACb,UAAU;EACX;CACF,CACF;;;;;;;;;;;;;;;;;;;;;;;;;;EC2CD,MAAM,UAAU,qBAAqB;EACrC,MAAM,EAAE,0BAA0B,QAAQ;EAC1C,MAAM,gBAAgB,IAAI,MAAM;EAEhC,MAAM,EAAE,QAAQ,iBAAiB,aAC9B,KAAK,WAAqB;GACzB,MAAM,cAAe,IAAsB;AAC3C,OAAI,CAAC,YAAa,OAAM,IAAI,MAAM,uCAAuC;AACzE,UAAQ,YAAqC,yBAAyB;KAExE,EAAE,eAAe,OAAO,CACzB;EAED,MAAM,qBAAqB,YAAY;AACrC,OAAI;AACF,kBAAc,QAAQ;AAEtB,SADe,MAAM,aAAa,OAAU,GAChC,IAAI;AACd,WAAM,QAAQ,oDAAoD;AAClE,WAAM,QAAQ,cAAc;UAE5B,OAAM,MAAM,uCAAuC;YAE9C,OAAO;AACd,UAAM,MAAM,iBAAiB,QAAQ,MAAM,UAAU,mBAAmB;aAChE;AACR,kBAAc,QAAQ;;;EAK1B,MAAM,EAAE,MAAM,iBAAiB,SAAS,wBAAwB,UAC7D,QAAQ,IAAI,aAAa,uBAAuB,EACjD;GACE,SAAS,CAAC,CAAC,QAAQ,aAAa,KAAK;GACrC,WAAW,MAAS;GACrB,CACF;EAGD,MAAM,EAAE,MAAM,OAAO,WAAW,sBAAsB,QAAQ,+BAA+B;GAC3F,WAAW;GACX,uBAAuB;GACvB,aAAa;GACb,WAAW,YA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AAkB,MAAA,MAAA,CAAA,SAAA;MAElB,YAAsE,MAAA,kBAAA,EAAA;OAAnD,YAAW;OAAS,gBAAe"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { l as useUserSessionStore, m as useEnv } from "./useRpcAuth-SgNzCAPa.js";
|
|
2
|
+
import { t as useMutation } from "./useMutation-DzRSXPB1.js";
|
|
3
|
+
import { t as AppLink_default } from "./AppLink-CHMMrSFI.js";
|
|
4
|
+
import { n as withReturnUrl } from "./useReturnUrl-DobHOKp3.js";
|
|
5
|
+
import { computed, createCommentVNode, createElementBlock, createElementVNode, createStaticVNode, createTextVNode, createVNode, defineComponent, onMounted, openBlock, ref, toDisplayString, withCtx } from "vue";
|
|
6
|
+
import { useRoute } from "vue-router";
|
|
7
|
+
import { toast } from "vue3-toastify";
|
|
8
|
+
|
|
9
|
+
//#region src/slices/auth/features/verify_email/VerifyEmail.vue
|
|
10
|
+
const _hoisted_1 = { class: "card bg-base-100 shadow-lg border border-base-300 max-w-md mx-auto" };
|
|
11
|
+
const _hoisted_2 = { class: "card-body p-4 sm:p-6 text-center" };
|
|
12
|
+
const _hoisted_3 = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "space-y-4"
|
|
15
|
+
};
|
|
16
|
+
const _hoisted_4 = {
|
|
17
|
+
key: 1,
|
|
18
|
+
class: "space-y-4"
|
|
19
|
+
};
|
|
20
|
+
const _hoisted_5 = { class: "text-sm text-base-content/70" };
|
|
21
|
+
const _hoisted_6 = {
|
|
22
|
+
key: 2,
|
|
23
|
+
class: "space-y-4"
|
|
24
|
+
};
|
|
25
|
+
const _hoisted_7 = { class: "text-sm text-base-content/70" };
|
|
26
|
+
const _hoisted_8 = { class: "flex flex-col gap-2 items-center" };
|
|
27
|
+
const _hoisted_9 = ["disabled"];
|
|
28
|
+
const AUTH_CHANNEL = "auth";
|
|
29
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
30
|
+
__name: "VerifyEmail",
|
|
31
|
+
setup(__props) {
|
|
32
|
+
const route = useRoute();
|
|
33
|
+
const returnUrl = computed(() => route.query.returnUrl);
|
|
34
|
+
const loginLink = computed(() => withReturnUrl("/auth/login", returnUrl.value));
|
|
35
|
+
const sessionStore = useUserSessionStore();
|
|
36
|
+
const { emailVerificationMode } = useEnv();
|
|
37
|
+
const token = route.query.token ?? route.params.token;
|
|
38
|
+
const status = ref("loading");
|
|
39
|
+
const errorMessage = ref("");
|
|
40
|
+
const verifyEmailApi = ref(false);
|
|
41
|
+
const resendLoading = ref(false);
|
|
42
|
+
const { mutate: verifyMutate } = useMutation((api, tokenToVerify) => {
|
|
43
|
+
const verifyEmail = api.verifyEmail;
|
|
44
|
+
if (!verifyEmail) throw new Error("Email verification is not configured");
|
|
45
|
+
return verifyEmail.verifyEmail(tokenToVerify);
|
|
46
|
+
}, { skipAuthCheck: true });
|
|
47
|
+
const { mutate: resendMutate } = useMutation((api, _input) => {
|
|
48
|
+
const verifyEmail = api.verifyEmail;
|
|
49
|
+
if (!verifyEmail) throw new Error("Email verification is not configured");
|
|
50
|
+
return verifyEmail.resendVerificationEmail();
|
|
51
|
+
}, { skipAuthCheck: false });
|
|
52
|
+
onMounted(async () => {
|
|
53
|
+
if (!token) {
|
|
54
|
+
status.value = "error";
|
|
55
|
+
errorMessage.value = "No verification token provided.";
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (emailVerificationMode === "disabled") {
|
|
59
|
+
status.value = "error";
|
|
60
|
+
errorMessage.value = "Email verification is not enabled for this application.";
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
const result = await verifyMutate(token);
|
|
65
|
+
verifyEmailApi.value = true;
|
|
66
|
+
if (result?.ok) {
|
|
67
|
+
status.value = "success";
|
|
68
|
+
try {
|
|
69
|
+
await sessionStore.refreshToken();
|
|
70
|
+
} catch {}
|
|
71
|
+
const channel = new BroadcastChannel(AUTH_CHANNEL);
|
|
72
|
+
channel.postMessage({ type: "email_verified" });
|
|
73
|
+
channel.close();
|
|
74
|
+
} else status.value = "error";
|
|
75
|
+
} catch (error) {
|
|
76
|
+
status.value = "error";
|
|
77
|
+
errorMessage.value = error instanceof Error ? error.message : "Something went wrong. The link may have expired.";
|
|
78
|
+
verifyEmailApi.value = true;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
const resendVerification = async () => {
|
|
82
|
+
try {
|
|
83
|
+
resendLoading.value = true;
|
|
84
|
+
if ((await resendMutate(void 0))?.ok) toast.success("Verification email sent. Please check your inbox.");
|
|
85
|
+
else toast.error("Failed to resend verification email.");
|
|
86
|
+
} catch (error) {
|
|
87
|
+
toast.error(error instanceof Error ? error.message : "Failed to resend");
|
|
88
|
+
} finally {
|
|
89
|
+
resendLoading.value = false;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
return (_ctx, _cache) => {
|
|
93
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [status.value === "loading" ? (openBlock(), createElementBlock("div", _hoisted_3, [..._cache[0] || (_cache[0] = [createElementVNode("span", { class: "loading loading-spinner loading-lg text-primary" }, null, -1), createElementVNode("p", { class: "text-sm text-base-content/70" }, "Verifying your email...", -1)])])) : status.value === "success" ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
94
|
+
_cache[4] || (_cache[4] = createElementVNode("div", { class: "w-14 h-14 rounded-full bg-success/20 flex items-center justify-center mx-auto" }, [createElementVNode("svg", {
|
|
95
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
96
|
+
class: "w-7 h-7 text-success",
|
|
97
|
+
viewBox: "0 0 24 24",
|
|
98
|
+
fill: "none",
|
|
99
|
+
stroke: "currentColor",
|
|
100
|
+
"stroke-width": "2",
|
|
101
|
+
"stroke-linecap": "round",
|
|
102
|
+
"stroke-linejoin": "round"
|
|
103
|
+
}, [createElementVNode("polyline", { points: "20 6 9 17 4 12" })])], -1)),
|
|
104
|
+
_cache[5] || (_cache[5] = createElementVNode("h3", { class: "text-lg font-semibold" }, "Email verified!", -1)),
|
|
105
|
+
createElementVNode("p", _hoisted_5, [
|
|
106
|
+
_cache[2] || (_cache[2] = createTextVNode(" Your email has been verified. Switch back to your other tab to continue, or ", -1)),
|
|
107
|
+
createVNode(AppLink_default, {
|
|
108
|
+
to: loginLink.value,
|
|
109
|
+
class: "link link-primary"
|
|
110
|
+
}, {
|
|
111
|
+
default: withCtx(() => [..._cache[1] || (_cache[1] = [createTextVNode("continue to login", -1)])]),
|
|
112
|
+
_: 1
|
|
113
|
+
}, 8, ["to"]),
|
|
114
|
+
_cache[3] || (_cache[3] = createTextVNode(". ", -1))
|
|
115
|
+
])
|
|
116
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
117
|
+
_cache[7] || (_cache[7] = createStaticVNode("<div class=\"w-14 h-14 rounded-full bg-error/20 flex items-center justify-center mx-auto\"><svg xmlns=\"http://www.w3.org/2000/svg\" class=\"w-7 h-7 text-error\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"></circle><line x1=\"15\" y1=\"9\" x2=\"9\" y2=\"15\"></line><line x1=\"9\" y1=\"9\" x2=\"15\" y2=\"15\"></line></svg></div><h3 class=\"text-lg font-semibold\">Verification failed</h3>", 2)),
|
|
118
|
+
createElementVNode("p", _hoisted_7, toDisplayString(errorMessage.value), 1),
|
|
119
|
+
createElementVNode("div", _hoisted_8, [createVNode(AppLink_default, {
|
|
120
|
+
to: loginLink.value,
|
|
121
|
+
class: "btn btn-outline btn-sm"
|
|
122
|
+
}, {
|
|
123
|
+
default: withCtx(() => [..._cache[6] || (_cache[6] = [createTextVNode("Back to login", -1)])]),
|
|
124
|
+
_: 1
|
|
125
|
+
}, 8, ["to"]), verifyEmailApi.value ? (openBlock(), createElementBlock("button", {
|
|
126
|
+
key: 0,
|
|
127
|
+
type: "button",
|
|
128
|
+
class: "btn btn-ghost btn-sm",
|
|
129
|
+
disabled: resendLoading.value,
|
|
130
|
+
onClick: resendVerification
|
|
131
|
+
}, toDisplayString(resendLoading.value ? "Sending..." : "Resend verification email"), 9, _hoisted_9)) : createCommentVNode("v-if", true)])
|
|
132
|
+
]))])]);
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
var VerifyEmail_default = _sfc_main;
|
|
137
|
+
|
|
138
|
+
//#endregion
|
|
139
|
+
export { VerifyEmail_default as t };
|
|
140
|
+
//# sourceMappingURL=VerifyEmail-CUexC8mg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VerifyEmail-CUexC8mg.js","names":[],"sources":["../src/slices/auth/features/verify_email/VerifyEmail.vue"],"sourcesContent":["<template>\n <div class=\"card bg-base-100 shadow-lg border border-base-300 max-w-md mx-auto\">\n <div class=\"card-body p-4 sm:p-6 text-center\">\n <div v-if=\"status === 'loading'\" class=\"space-y-4\">\n <span class=\"loading loading-spinner loading-lg text-primary\"></span>\n <p class=\"text-sm text-base-content/70\">Verifying your email...</p>\n </div>\n <div v-else-if=\"status === 'success'\" class=\"space-y-4\">\n <div\n class=\"w-14 h-14 rounded-full bg-success/20 flex items-center justify-center mx-auto\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"w-7 h-7 text-success\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <polyline points=\"20 6 9 17 4 12\" />\n </svg>\n </div>\n <h3 class=\"text-lg font-semibold\">Email verified!</h3>\n <p class=\"text-sm text-base-content/70\">\n Your email has been verified. Switch back to your other tab to continue, or\n <AppLink :to=\"loginLink\" class=\"link link-primary\">continue to login</AppLink>.\n </p>\n </div>\n <div v-else class=\"space-y-4\">\n <div\n class=\"w-14 h-14 rounded-full bg-error/20 flex items-center justify-center mx-auto\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"w-7 h-7 text-error\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"15\" y1=\"9\" x2=\"9\" y2=\"15\" />\n <line x1=\"9\" y1=\"9\" x2=\"15\" y2=\"15\" />\n </svg>\n </div>\n <h3 class=\"text-lg font-semibold\">Verification failed</h3>\n <p class=\"text-sm text-base-content/70\">{{ errorMessage }}</p>\n <div class=\"flex flex-col gap-2 items-center\">\n <AppLink :to=\"loginLink\" class=\"btn btn-outline btn-sm\">Back to login</AppLink>\n <button\n v-if=\"verifyEmailApi\"\n type=\"button\"\n class=\"btn btn-ghost btn-sm\"\n :disabled=\"resendLoading\"\n @click=\"resendVerification\"\n >\n {{ resendLoading ? 'Sending...' : 'Resend verification email' }}\n </button>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport AppLink from '../../../../components/AppLink.vue';\nimport { useEnv } from '../../../../composables/useEnv';\nimport { useMutation } from '../../../../composables/useMutation';\nimport { useUserSessionStore } from '../../../../composables/useUserSessionStore';\nimport { withReturnUrl } from '../../../../utils/useReturnUrl';\nimport type { DragoncoreApi } from '@dragonmastery/dragoncore-shared';\nimport type { EmailVerificationApi } from '@dragonmastery/dragoncore-shared';\nimport { computed, ref, onMounted } from 'vue';\nimport { useRoute } from 'vue-router';\nimport { toast } from 'vue3-toastify';\n\nconst AUTH_CHANNEL = 'auth';\n\nconst route = useRoute();\nconst returnUrl = computed(() => route.query.returnUrl as string | undefined);\nconst loginLink = computed(() => withReturnUrl('/auth/login', returnUrl.value));\nconst sessionStore = useUserSessionStore();\nconst { emailVerificationMode } = useEnv();\n\n// Support token from query (?token=xxx) or params (/verify-email/:token)\nconst token = (route.query.token ?? route.params.token) as string;\n\nconst status = ref<'loading' | 'success' | 'error'>('loading');\nconst errorMessage = ref<string>('');\nconst verifyEmailApi = ref<boolean>(false);\nconst resendLoading = ref(false);\n\nconst { mutate: verifyMutate } = useMutation(\n (api, tokenToVerify: string) => {\n const verifyEmail = (api as DragoncoreApi).verifyEmail;\n if (!verifyEmail) throw new Error('Email verification is not configured');\n return (verifyEmail as EmailVerificationApi).verifyEmail(tokenToVerify);\n },\n { skipAuthCheck: true },\n);\n\nconst { mutate: resendMutate } = useMutation(\n (api, _input?: unknown) => {\n const verifyEmail = (api as DragoncoreApi).verifyEmail;\n if (!verifyEmail) throw new Error('Email verification is not configured');\n return (verifyEmail as EmailVerificationApi).resendVerificationEmail();\n },\n { skipAuthCheck: false },\n);\n\nonMounted(async () => {\n if (!token) {\n status.value = 'error';\n errorMessage.value = 'No verification token provided.';\n return;\n }\n\n if (emailVerificationMode === 'disabled') {\n status.value = 'error';\n errorMessage.value = 'Email verification is not enabled for this application.';\n return;\n }\n\n try {\n const result = await verifyMutate(token);\n verifyEmailApi.value = true;\n if (result?.ok) {\n status.value = 'success';\n try {\n await sessionStore.refreshToken();\n } catch {\n // User may need to log in again; that's ok\n }\n const channel = new BroadcastChannel(AUTH_CHANNEL);\n channel.postMessage({ type: 'email_verified' });\n channel.close();\n } else {\n status.value = 'error';\n }\n } catch (error) {\n status.value = 'error';\n errorMessage.value = error instanceof Error ? error.message : 'Something went wrong. The link may have expired.';\n verifyEmailApi.value = true;\n }\n});\n\nconst resendVerification = async () => {\n try {\n resendLoading.value = true;\n const result = await resendMutate(undefined);\n if (result?.ok) {\n toast.success('Verification email sent. Please check your inbox.');\n } else {\n toast.error('Failed to resend verification email.');\n }\n } catch (error) {\n toast.error(error instanceof Error ? error.message : 'Failed to resend');\n } finally {\n resendLoading.value = false;\n }\n};\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAgFA,MAAM,eAAe;;;;EAErB,MAAM,QAAQ,UAAU;EACxB,MAAM,YAAY,eAAe,MAAM,MAA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WM,CAVJ,YAA+E,iBAAA;KAArE,IAAI,UAAA;KAAW,OAAM;;4BAAsC,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAAb,iBAAa,GAAA,CAAA,EAAA,CAAA;;mBAE7D,eAAA,SAAA,WAAA,EADR,mBAQS,UAAA;;KANP,MAAK;KACL,OAAM;KACL,UAAU,cAAA;KACV,SAAO;uBAEL,cAAA,QAAa,eAAA,4BAAA,EAAA,GAAA,WAAA,IAAA,mBAAA,QAAA,KAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { l as useUserSessionStore } from "./useRpcAuth-SgNzCAPa.js";
|
|
2
|
+
import "./useQueryCache-DIGf3fCM.js";
|
|
3
|
+
import { t as useMutation } from "./useMutation-DzRSXPB1.js";
|
|
4
|
+
import { t as useQuery } from "./useQuery-bvJabe9Q.js";
|
|
5
|
+
import { t as AppLink_default } from "./AppLink-CHMMrSFI.js";
|
|
6
|
+
import { n as withReturnUrl } from "./useReturnUrl-DobHOKp3.js";
|
|
7
|
+
import { computed, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, openBlock, ref, toDisplayString, withCtx } from "vue";
|
|
8
|
+
import { useRoute } from "vue-router";
|
|
9
|
+
import { toast } from "vue3-toastify";
|
|
10
|
+
|
|
11
|
+
//#region src/slices/auth/features/verify_email_required/VerifyEmailRequired.vue
|
|
12
|
+
const _hoisted_1 = { class: "max-w-md mx-auto bg-base-200 p-6 rounded-xl shadow-md container" };
|
|
13
|
+
const _hoisted_2 = { class: "flex flex-col gap-3" };
|
|
14
|
+
const _hoisted_3 = ["disabled"];
|
|
15
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
16
|
+
__name: "VerifyEmailRequired",
|
|
17
|
+
setup(__props) {
|
|
18
|
+
const route = useRoute();
|
|
19
|
+
const session = useUserSessionStore();
|
|
20
|
+
const returnUrl = computed(() => route.query.returnUrl);
|
|
21
|
+
const loginLink = computed(() => withReturnUrl("/auth/login", returnUrl.value));
|
|
22
|
+
const resendLoading = ref(false);
|
|
23
|
+
const verifyEmailApi = ref(false);
|
|
24
|
+
const isLoggedIn = computed(() => !!session.userSession?.user.userId);
|
|
25
|
+
useQuery((api) => {
|
|
26
|
+
verifyEmailApi.value = !!api.verifyEmail;
|
|
27
|
+
return Promise.resolve(true);
|
|
28
|
+
}, {
|
|
29
|
+
enabled: isLoggedIn,
|
|
30
|
+
staleTime: 3600 * 1e3
|
|
31
|
+
});
|
|
32
|
+
const { mutate: resendMutate } = useMutation((api, _input) => {
|
|
33
|
+
const verifyEmail = api.verifyEmail;
|
|
34
|
+
if (!verifyEmail) throw new Error("Email verification is not configured");
|
|
35
|
+
return verifyEmail.resendVerificationEmail();
|
|
36
|
+
}, { skipAuthCheck: false });
|
|
37
|
+
const resendVerification = async () => {
|
|
38
|
+
try {
|
|
39
|
+
resendLoading.value = true;
|
|
40
|
+
if ((await resendMutate(void 0))?.ok) {
|
|
41
|
+
toast.success("Verification email sent. Please check your inbox.");
|
|
42
|
+
await session.refreshToken();
|
|
43
|
+
} else toast.error("Failed to resend verification email.");
|
|
44
|
+
} catch (error) {
|
|
45
|
+
toast.error(error instanceof Error ? error.message : "Failed to resend");
|
|
46
|
+
} finally {
|
|
47
|
+
resendLoading.value = false;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
return (_ctx, _cache) => {
|
|
51
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
52
|
+
_cache[1] || (_cache[1] = createElementVNode("h1", { class: "text-2xl font-bold mb-6 text-center" }, "Check your email", -1)),
|
|
53
|
+
_cache[2] || (_cache[2] = createElementVNode("p", { class: "text-base-content/80 mb-6" }, " We sent a verification link to your email address. Click the link to verify your account, then you can log in. ", -1)),
|
|
54
|
+
createElementVNode("div", _hoisted_2, [createVNode(AppLink_default, {
|
|
55
|
+
to: loginLink.value,
|
|
56
|
+
class: "btn btn-primary"
|
|
57
|
+
}, {
|
|
58
|
+
default: withCtx(() => [..._cache[0] || (_cache[0] = [createTextVNode("Continue to login", -1)])]),
|
|
59
|
+
_: 1
|
|
60
|
+
}, 8, ["to"]), isLoggedIn.value && verifyEmailApi.value ? (openBlock(), createElementBlock("button", {
|
|
61
|
+
key: 0,
|
|
62
|
+
type: "button",
|
|
63
|
+
class: "btn btn-outline btn-sm",
|
|
64
|
+
disabled: resendLoading.value,
|
|
65
|
+
onClick: resendVerification
|
|
66
|
+
}, toDisplayString(resendLoading.value ? "Sending..." : "Resend verification email"), 9, _hoisted_3)) : createCommentVNode("v-if", true)])
|
|
67
|
+
]);
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
var VerifyEmailRequired_default = _sfc_main;
|
|
72
|
+
|
|
73
|
+
//#endregion
|
|
74
|
+
export { VerifyEmailRequired_default as default };
|
|
75
|
+
//# sourceMappingURL=VerifyEmailRequired-C35bkaXZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VerifyEmailRequired-C35bkaXZ.js","names":[],"sources":["../src/slices/auth/features/verify_email_required/VerifyEmailRequired.vue"],"sourcesContent":["<template>\n <div class=\"max-w-md mx-auto bg-base-200 p-6 rounded-xl shadow-md container\">\n <h1 class=\"text-2xl font-bold mb-6 text-center\">Check your email</h1>\n <p class=\"text-base-content/80 mb-6\">\n We sent a verification link to your email address. Click the link to verify your account,\n then you can log in.\n </p>\n <div class=\"flex flex-col gap-3\">\n <AppLink :to=\"loginLink\" class=\"btn btn-primary\">Continue to login</AppLink>\n <button\n v-if=\"isLoggedIn && verifyEmailApi\"\n type=\"button\"\n class=\"btn btn-outline btn-sm\"\n :disabled=\"resendLoading\"\n @click=\"resendVerification\"\n >\n {{ resendLoading ? 'Sending...' : 'Resend verification email' }}\n </button>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport AppLink from '../../../../components/AppLink.vue';\nimport type { DragoncoreApi } from '@dragonmastery/dragoncore-shared';\nimport type { EmailVerificationApi } from '@dragonmastery/dragoncore-shared';\nimport { computed, ref } from 'vue';\nimport { useRoute } from 'vue-router';\nimport { toast } from 'vue3-toastify';\nimport { useMutation } from '../../../../composables/useMutation';\nimport { useQuery } from '../../../../composables/useQuery';\nimport { useUserSessionStore } from '../../../../composables/useUserSessionStore';\nimport { withReturnUrl } from '../../../../utils/useReturnUrl';\n\nconst route = useRoute();\nconst session = useUserSessionStore();\n\nconst returnUrl = computed(() => route.query.returnUrl as string | undefined);\nconst loginLink = computed(() => withReturnUrl('/auth/login', returnUrl.value));\nconst resendLoading = ref(false);\nconst verifyEmailApi = ref(false);\n\nconst isLoggedIn = computed(() => !!session.userSession?.user.userId);\n\nuseQuery(\n (api) => {\n verifyEmailApi.value = !!(api as DragoncoreApi).verifyEmail;\n return Promise.resolve(true);\n },\n { enabled: isLoggedIn, staleTime: 60 * 60 * 1000 },\n);\n\nconst { mutate: resendMutate } = useMutation(\n (api, _input?: unknown) => {\n const verifyEmail = (api as DragoncoreApi).verifyEmail;\n if (!verifyEmail) throw new Error('Email verification is not configured');\n return (verifyEmail as EmailVerificationApi).resendVerificationEmail();\n },\n { skipAuthCheck: false },\n);\n\nconst resendVerification = async () => {\n try {\n resendLoading.value = true;\n const result = await resendMutate(undefined);\n if (result?.ok) {\n toast.success('Verification email sent. Please check your inbox.');\n await session.refreshToken();\n } else {\n toast.error('Failed to resend verification email.');\n }\n } catch (error) {\n toast.error(error instanceof Error ? error.message : 'Failed to resend');\n } finally {\n resendLoading.value = false;\n }\n};\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;EAkCA,MAAM,QAAQ,UAAU;EACxB,MAAM,UAAU,qBAAqB;EAErC,MAAM,YAAY,eAAe,MAAM,MAAM,UAAgC;EAC7E,MAAM,YAAY,eAAe,cAAc,eAAe,UAAU,MAAM,CAAC;EAC/E,MAAM,gBAAgB,IAAI,MAAM;EAChC,MAAM,iBAAiB,IAAI,MAAM;EAEjC,MAAM,aAAa,eAAe,CAAC,CAAC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
import "./useQueryCache-DIGf3fCM.js";
|
|
3
|
+
import "./useMutation-DzRSXPB1.js";
|
|
4
|
+
import "./useQuery-bvJabe9Q.js";
|
|
5
|
+
import { st as ViewTeam_default } from "./src-DYBi81fS.js";
|
|
6
|
+
import "./AppLink-CHMMrSFI.js";
|
|
7
|
+
import "./TimelineSystemEvent-CBwUl5G8.js";
|
|
8
|
+
import "./TeamMembersTab-4gmnP9sD.js";
|
|
9
|
+
import "./Appearance-BfPdKMXw.js";
|
|
10
|
+
import "./useBreadcrumbs-DmgSucoe.js";
|
|
11
|
+
import "./EditTeamMemberForm-y4Klbm2x.js";
|
|
12
|
+
import "./TeamHistoryTab-B3DvaIzC.js";
|
|
13
|
+
import "./UserProfilePage-DMwDVgXa.js";
|
|
14
|
+
import "./ChangePasswordPage-D2Ci00Sh.js";
|
|
15
|
+
import "./TeamNotesTab-DBrJGCIe.js";
|
|
16
|
+
import "./CustomerSupportTicketParent-C_vgUq3B.js";
|
|
17
|
+
import "./SupportTicketDevLifecycleBadge-B2NysMAj.js";
|
|
18
|
+
import "./StaffSupportTicketParent-Bp5pNF45.js";
|
|
19
|
+
import "./LoginForm-o4gJ0QwA.js";
|
|
20
|
+
import "./Signup-Wz2h_ayt.js";
|
|
21
|
+
import "./ForgotPassword-CiEfdVT-.js";
|
|
22
|
+
import "./ResetPassword-DcVvfMU3.js";
|
|
23
|
+
import "./Logout-D8Ql8-OY.js";
|
|
24
|
+
import "./mfaSchema-_vbG9jiT.js";
|
|
25
|
+
import "./MfaSetup-DzaJLZtx.js";
|
|
26
|
+
import "./MfaVerify-C04XD4r3.js";
|
|
27
|
+
import "./VerifyEmail-CUexC8mg.js";
|
|
28
|
+
import "./UserListPage-BGDgsd_S.js";
|
|
29
|
+
import "./CreateUserPage-DbT_l32W.js";
|
|
30
|
+
import "./EditUserPage-0lqrgP5T.js";
|
|
31
|
+
|
|
32
|
+
export { ViewTeam_default as default };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import "./useRpcAuth-SgNzCAPa.js";
|
|
2
|
+
import "./useQueryCache-DIGf3fCM.js";
|
|
3
|
+
import "./useMutation-DzRSXPB1.js";
|
|
4
|
+
import "./useQuery-bvJabe9Q.js";
|
|
5
|
+
import { tt as ViewTeamMember_default } from "./src-DYBi81fS.js";
|
|
6
|
+
import "./AppLink-CHMMrSFI.js";
|
|
7
|
+
import "./TimelineSystemEvent-CBwUl5G8.js";
|
|
8
|
+
import "./TeamMembersTab-4gmnP9sD.js";
|
|
9
|
+
import "./Appearance-BfPdKMXw.js";
|
|
10
|
+
import "./useBreadcrumbs-DmgSucoe.js";
|
|
11
|
+
import "./EditTeamMemberForm-y4Klbm2x.js";
|
|
12
|
+
import "./TeamHistoryTab-B3DvaIzC.js";
|
|
13
|
+
import "./UserProfilePage-DMwDVgXa.js";
|
|
14
|
+
import "./ChangePasswordPage-D2Ci00Sh.js";
|
|
15
|
+
import "./TeamNotesTab-DBrJGCIe.js";
|
|
16
|
+
import "./CustomerSupportTicketParent-C_vgUq3B.js";
|
|
17
|
+
import "./SupportTicketDevLifecycleBadge-B2NysMAj.js";
|
|
18
|
+
import "./StaffSupportTicketParent-Bp5pNF45.js";
|
|
19
|
+
import "./LoginForm-o4gJ0QwA.js";
|
|
20
|
+
import "./Signup-Wz2h_ayt.js";
|
|
21
|
+
import "./ForgotPassword-CiEfdVT-.js";
|
|
22
|
+
import "./ResetPassword-DcVvfMU3.js";
|
|
23
|
+
import "./Logout-D8Ql8-OY.js";
|
|
24
|
+
import "./mfaSchema-_vbG9jiT.js";
|
|
25
|
+
import "./MfaSetup-DzaJLZtx.js";
|
|
26
|
+
import "./MfaVerify-C04XD4r3.js";
|
|
27
|
+
import "./VerifyEmail-CUexC8mg.js";
|
|
28
|
+
import "./UserListPage-BGDgsd_S.js";
|
|
29
|
+
import "./CreateUserPage-DbT_l32W.js";
|
|
30
|
+
import "./EditUserPage-0lqrgP5T.js";
|
|
31
|
+
|
|
32
|
+
export { ViewTeamMember_default as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"displayIdFormatter-
|
|
1
|
+
{"version":3,"file":"displayIdFormatter-rSbbsHIX.js","names":[],"sources":["../src/slices/support_ticket/utils/displayIdFormatter.ts"],"sourcesContent":["/**\n * Formats a display ID with prefix (e.g., \"SP-123\")\n * Falls back to last 8 chars of ID if display_id not available\n */\nexport function formatTicketDisplayId(\n display_id: string | null | undefined,\n display_id_prefix: string | null | undefined,\n fallbackId: string,\n): string {\n if (display_id && display_id_prefix) {\n return `${display_id_prefix}-${display_id}`;\n }\n // Fallback to last 8 chars of ID\n return `#${fallbackId.slice(-8)}`;\n}\n"],"mappings":";;;;;AAIA,SAAgB,sBACd,YACA,mBACA,YACQ;AACR,KAAI,cAAc,kBAChB,QAAO,GAAG,kBAAkB,GAAG;AAGjC,QAAO,IAAI,WAAW,MAAM,GAAG"}
|