@dragonmastery/dragoncore-vue 0.0.19 → 0.0.21
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/AppLink-CHMMrSFI.js +54 -0
- package/dist/AppLink-CHMMrSFI.js.map +1 -0
- package/dist/Appearance-D5pwxuf4.js +3 -0
- package/dist/{Appearance-BfPdKMXw.js → Appearance-DxWTyx1M.js} +1 -1
- package/dist/{Appearance-BfPdKMXw.js.map → Appearance-DxWTyx1M.js.map} +1 -1
- package/dist/{ChangePasswordPage-DXzU3NI9.js → ChangePasswordPage--3XwluwE.js} +2 -2
- package/dist/{ChangePasswordPage-DXzU3NI9.js.map → ChangePasswordPage--3XwluwE.js.map} +1 -1
- package/dist/ChangePasswordPage-CpDPmEml.js +6 -0
- package/dist/ConsentRequired-C4IRMA0c.js +213 -0
- package/dist/ConsentRequired-C4IRMA0c.js.map +1 -0
- package/dist/CreateTeamForm-B4cIuYAf.js +35 -0
- package/dist/CreateTeamMemberForm-Chrw1y00.js +35 -0
- package/dist/{CreateUserPage-bwR6fq5C.js → CreateUserPage-DLwXeLAq.js} +2 -2
- package/dist/{CreateUserPage-bwR6fq5C.js.map → CreateUserPage-DLwXeLAq.js.map} +1 -1
- package/dist/CreateUserPage-WruMs7WP.js +6 -0
- package/dist/CreditBalanceDashboard-CkcsrZ_e.js +35 -0
- package/dist/CreditManagement-Ddvu9dMw.js +35 -0
- package/dist/CustomerCreateSupportTicketForm-BKperKGS.js +35 -0
- package/dist/{CustomerSupportTicketDetailPage-D_1t2EpN.js → CustomerSupportTicketDetailPage-BdyaKG1v.js} +9 -9
- package/dist/{CustomerSupportTicketDetailPage-D_1t2EpN.js.map → CustomerSupportTicketDetailPage-BdyaKG1v.js.map} +1 -1
- package/dist/CustomerSupportTicketList-DcbrjDa9.js +35 -0
- package/dist/CustomerSupportTicketParent-BeNzUwuP.js +7 -0
- package/dist/{CustomerSupportTicketParent-B09_iFpJ.js → CustomerSupportTicketParent-HIxwSVdu.js} +4 -4
- package/dist/{CustomerSupportTicketParent-B09_iFpJ.js.map → CustomerSupportTicketParent-HIxwSVdu.js.map} +1 -1
- package/dist/CustomerSupportTicketSuccess-CC967u3y.js +35 -0
- package/dist/EditTeamForm-B5Tee5wL.js +35 -0
- package/dist/{EditTeamMemberForm-DJW7yRQW.js → EditTeamMemberForm-CaS2GLjV.js} +2 -2
- package/dist/{EditTeamMemberForm-DJW7yRQW.js.map → EditTeamMemberForm-CaS2GLjV.js.map} +1 -1
- package/dist/EditTeamMemberForm-OtcS8QWt.js +6 -0
- package/dist/{EditUserPage-aDygGmfD.js → EditUserPage-DURc5rmi.js} +4 -4
- package/dist/{EditUserPage-aDygGmfD.js.map → EditUserPage-DURc5rmi.js.map} +1 -1
- package/dist/EditUserPage-T4DQlKhf.js +7 -0
- package/dist/ForgotPassword-CUifhmqP.js +7 -0
- package/dist/{ForgotPassword-CJjzm9GK.js → ForgotPassword-OjIPi9s9.js} +4 -3
- package/dist/{ForgotPassword-CJjzm9GK.js.map → ForgotPassword-OjIPi9s9.js.map} +1 -1
- package/dist/LoginForm-9UFnA-fO.js +118 -0
- package/dist/LoginForm-9UFnA-fO.js.map +1 -0
- package/dist/LoginForm-Bg7GoZEA.js +7 -0
- package/dist/Logout-Bs92csWH.js +7 -0
- package/dist/{Logout-Cm9kEzgH.js → Logout-YgTgOFUH.js} +5 -4
- package/dist/{Logout-Cm9kEzgH.js.map → Logout-YgTgOFUH.js.map} +1 -1
- package/dist/MfaSetup-BACX5XP-.js +8 -0
- package/dist/{MfaSetup-Ch0w-gTN.js → MfaSetup-RtFMY_dj.js} +5 -4
- package/dist/{MfaSetup-Ch0w-gTN.js.map → MfaSetup-RtFMY_dj.js.map} +1 -1
- package/dist/{MfaVerify-BwzjVrTj.js → MfaVerify-Cvhe8bEM.js} +6 -5
- package/dist/{MfaVerify-BwzjVrTj.js.map → MfaVerify-Cvhe8bEM.js.map} +1 -1
- package/dist/MfaVerify-ak4iSdQ2.js +8 -0
- package/dist/RecordVersionViewer-BWZ78vvE.js +490 -0
- package/dist/RecordVersionViewer-BWZ78vvE.js.map +1 -0
- package/dist/{ResetPassword-DuLuXaNp.js → ResetPassword-BE4mXK9q.js} +4 -3
- package/dist/{ResetPassword-DuLuXaNp.js.map → ResetPassword-BE4mXK9q.js.map} +1 -1
- package/dist/ResetPassword-pY1uhTdl.js +7 -0
- package/dist/{SavedFiltersPage-CawED9Oz.js → SavedFiltersPage-DQt6uc8m.js} +33 -30
- package/dist/{SavedFiltersPage-CawED9Oz.js.map → SavedFiltersPage-DQt6uc8m.js.map} +1 -1
- package/dist/Signup-9TjMMnU4.js +204 -0
- package/dist/Signup-9TjMMnU4.js.map +1 -0
- package/dist/Signup-Bq-G3D-s.js +9 -0
- package/dist/SignupConsentFlow-QUZGKjdB.js +269 -0
- package/dist/SignupConsentFlow-QUZGKjdB.js.map +1 -0
- package/dist/SignupRequirementsPage-DfbYmpQD.js +360 -0
- package/dist/SignupRequirementsPage-DfbYmpQD.js.map +1 -0
- package/dist/StaffCreateSupportTicketForm-D0ZuisDk.js +35 -0
- package/dist/{StaffSupportTicketDetailPage-DZZN3jmt.js → StaffSupportTicketDetailPage-DQdfh6H1.js} +11 -11
- package/dist/{StaffSupportTicketDetailPage-DZZN3jmt.js.map → StaffSupportTicketDetailPage-DQdfh6H1.js.map} +1 -1
- package/dist/StaffSupportTicketList-CiqC05XB.js +35 -0
- package/dist/{StaffSupportTicketParent-BYxQPuhI.js → StaffSupportTicketParent-CilR4RGM.js} +4 -4
- package/dist/{StaffSupportTicketParent-BYxQPuhI.js.map → StaffSupportTicketParent-CilR4RGM.js.map} +1 -1
- package/dist/StaffSupportTicketParent-DkV329NI.js +7 -0
- package/dist/StaffSupportTicketSuccess-CUYnimaI.js +35 -0
- package/dist/{SupportStaffPage-B05UR5LK.js → SupportStaffPage-KKugAnFm.js} +7 -7
- package/dist/{SupportStaffPage-B05UR5LK.js.map → SupportStaffPage-KKugAnFm.js.map} +1 -1
- package/dist/{SupportTicketDevLifecycleBadge-Ba-Rm6QW.js → SupportTicketDevLifecycleBadge-EMrQHfyG.js} +1 -1
- package/dist/{SupportTicketDevLifecycleBadge-Ba-Rm6QW.js.map → SupportTicketDevLifecycleBadge-EMrQHfyG.js.map} +1 -1
- package/dist/{SupportTicketMaintenancePage-BoZpjcAF.js → SupportTicketMaintenancePage-smItdkrD.js} +4 -4
- package/dist/{SupportTicketMaintenancePage-BoZpjcAF.js.map → SupportTicketMaintenancePage-smItdkrD.js.map} +1 -1
- package/dist/TeamAttachmentsTab-DUtCD1Yi.js +35 -0
- package/dist/TeamHistoryTab-BsUoH4VK.js +4 -0
- package/dist/{TeamHistoryTab-BrC6FFIw.js → TeamHistoryTab-D5biUPmq.js} +3 -3
- package/dist/{TeamHistoryTab-BrC6FFIw.js.map → TeamHistoryTab-D5biUPmq.js.map} +1 -1
- package/dist/TeamList-BkPIqZ8V.js +35 -0
- package/dist/TeamMemberList-1mxUGCNa.js +35 -0
- package/dist/TeamMemberParent-DzeBIElY.js +35 -0
- package/dist/{TeamNotesTab-B2eETkAz.js → TeamNotesTab-BzGZZ1h8.js} +5 -5
- package/dist/{TeamNotesTab-B2eETkAz.js.map → TeamNotesTab-BzGZZ1h8.js.map} +1 -1
- package/dist/TeamNotesTab-ClHl2nXd.js +7 -0
- package/dist/TeamParent-DJa9UZTP.js +35 -0
- package/dist/{TimelineNoteInput-C0a0WRQC.js → TimelineNoteInput-0p-M4Qie.js} +2 -2
- package/dist/{TimelineNoteInput-C0a0WRQC.js.map → TimelineNoteInput-0p-M4Qie.js.map} +1 -1
- package/dist/{TimelineSystemEvent-Dj2TMOF6.js → TimelineSystemEvent-BHzFr46C.js} +4 -4
- package/dist/{TimelineSystemEvent-Dj2TMOF6.js.map → TimelineSystemEvent-BHzFr46C.js.map} +1 -1
- package/dist/UserListPage-BTLE4J0s.js +4 -0
- package/dist/{UserListPage-QSdxrJT6.js → UserListPage-DUE5gJTo.js} +3 -3
- package/dist/{UserListPage-QSdxrJT6.js.map → UserListPage-DUE5gJTo.js.map} +1 -1
- package/dist/{UserProfilePage-X4z2lG-J.js → UserProfilePage-C3b93Keh.js} +4 -4
- package/dist/{UserProfilePage-X4z2lG-J.js.map → UserProfilePage-C3b93Keh.js.map} +1 -1
- package/dist/UserProfilePage-CVTORtSx.js +7 -0
- package/dist/VerifyEmail-DCP4DWIw.js +9 -0
- package/dist/VerifyEmail-DlOmWGG-.js +257 -0
- package/dist/VerifyEmail-DlOmWGG-.js.map +1 -0
- package/dist/ViewTeam-DVfnLMhV.js +35 -0
- package/dist/ViewTeamMember-L4v3gCIn.js +35 -0
- package/dist/{convertToLocalDateTime-DOSGtMn8.js → convertToLocalDateTime-CFhtN6PI.js} +12 -2
- package/dist/convertToLocalDateTime-CFhtN6PI.js.map +1 -0
- package/dist/{displayIdFormatter-B1ZKgofu.js → displayIdFormatter-Dz900Awr.js} +1 -1
- package/dist/{displayIdFormatter-B1ZKgofu.js.map → displayIdFormatter-Dz900Awr.js.map} +1 -1
- package/dist/{extractRpcErrorMessage-C_UbKgHL.js → extractRpcErrorMessage-Di8E8-Wh.js} +1 -1
- package/dist/{extractRpcErrorMessage-C_UbKgHL.js.map → extractRpcErrorMessage-Di8E8-Wh.js.map} +1 -1
- package/dist/index.d.ts +62 -17
- package/dist/index.js +37 -33
- package/dist/{mfaSchema-nfNCcEhM.js → mfaSchema-BnRWf0ma.js} +1 -1
- package/dist/{mfaSchema-nfNCcEhM.js.map → mfaSchema-BnRWf0ma.js.map} +1 -1
- package/dist/{src-CkgUIye9.js → src-QZJyMfGX.js} +422 -812
- package/dist/src-QZJyMfGX.js.map +1 -0
- package/dist/{useBreadcrumbs-DmgSucoe.js → useBreadcrumbs-qB6ghsAf.js} +1 -1
- package/dist/{useBreadcrumbs-DmgSucoe.js.map → useBreadcrumbs-qB6ghsAf.js.map} +1 -1
- package/dist/useEmailVerificationChannel-BNi926Ho.js +37 -0
- package/dist/useEmailVerificationChannel-BNi926Ho.js.map +1 -0
- package/dist/{useMutation-DbzXtqf1.js → useMutation-BTsyHKyn.js} +3 -3
- package/dist/{useMutation-DbzXtqf1.js.map → useMutation-BTsyHKyn.js.map} +1 -1
- package/dist/{useQuery-BKb5JXVS.js → useQuery-BggIE52P.js} +5 -5
- package/dist/useQuery-BggIE52P.js.map +1 -0
- package/dist/{useQueryCache-CHG4-HGF.js → useQueryCache-Bjm-S8v5.js} +2 -2
- package/dist/{useQueryCache-CHG4-HGF.js.map → useQueryCache-Bjm-S8v5.js.map} +1 -1
- package/dist/{useReturnUrl-Da8PpLb9.js → useReturnUrl-qFeazn-G.js} +2 -54
- package/dist/useReturnUrl-qFeazn-G.js.map +1 -0
- package/dist/{useRpcAuth-8Byr6SSI.js → useRpcAuth-rmHf7bYx.js} +42 -2
- package/dist/useRpcAuth-rmHf7bYx.js.map +1 -0
- package/dist/useSignupPendingData-BWHwUHhL.js +47 -0
- package/dist/useSignupPendingData-BWHwUHhL.js.map +1 -0
- package/package.json +5 -2
- package/src/daisyui.css +1 -0
- package/dist/Appearance-C3WguxT-.js +0 -3
- package/dist/ChangePasswordPage-BuVNYC_G.js +0 -6
- package/dist/CreateTeamForm-BuMrZ169.js +0 -32
- package/dist/CreateTeamMemberForm-D0xqR9me.js +0 -32
- package/dist/CreateUserPage-BWIvFF-4.js +0 -6
- package/dist/CreditBalanceDashboard-BR-er7gs.js +0 -32
- package/dist/CreditManagement-CyjrE1ep.js +0 -32
- package/dist/CustomerCreateSupportTicketForm-C9-CLRRQ.js +0 -32
- package/dist/CustomerSupportTicketList-B0dC7lgD.js +0 -32
- package/dist/CustomerSupportTicketParent-D0wLnKXf.js +0 -7
- package/dist/CustomerSupportTicketSuccess-BvuBglg8.js +0 -32
- package/dist/EditTeamForm-BJlOKEkI.js +0 -32
- package/dist/EditTeamMemberForm-CbDvTLXI.js +0 -6
- package/dist/EditUserPage-CsHl1h_g.js +0 -7
- package/dist/ForgotPassword-DJjmzU_m.js +0 -7
- package/dist/LoginForm-BeiI_y3E.js +0 -7
- package/dist/LoginForm-IEP-hEh0.js +0 -115
- package/dist/LoginForm-IEP-hEh0.js.map +0 -1
- package/dist/Logout-DmZTNQDP.js +0 -7
- package/dist/MfaSetup-BwkenBRD.js +0 -8
- package/dist/MfaVerify-BaUROEol.js +0 -8
- package/dist/ResetPassword-DEFj1pgV.js +0 -7
- package/dist/Signup-C94alv87.js +0 -166
- package/dist/Signup-C94alv87.js.map +0 -1
- package/dist/Signup-CFUbdrYs.js +0 -7
- package/dist/StaffCreateSupportTicketForm-AxprwWRv.js +0 -32
- package/dist/StaffSupportTicketList-DYKysNs3.js +0 -32
- package/dist/StaffSupportTicketParent-CT8oYFd6.js +0 -7
- package/dist/StaffSupportTicketSuccess-zWEagE4E.js +0 -32
- package/dist/TeamAttachmentsTab-BFRMbPlZ.js +0 -32
- package/dist/TeamHistoryTab-CYrt5KnE.js +0 -4
- package/dist/TeamList-CF5BQhfx.js +0 -32
- package/dist/TeamMemberList-Dfi2iKOH.js +0 -32
- package/dist/TeamMemberParent-DXcumR-Q.js +0 -32
- package/dist/TeamNotesTab-Bv_HPC6f.js +0 -7
- package/dist/TeamParent-DLoNn-mW.js +0 -32
- package/dist/UserListPage-CBwfXo15.js +0 -4
- package/dist/UserProfilePage-cTrZuwOT.js +0 -7
- package/dist/VerifyEmail-8bsvoDdM.js +0 -175
- package/dist/VerifyEmail-8bsvoDdM.js.map +0 -1
- package/dist/VerifyEmail-Cpc0umIu.js +0 -7
- package/dist/VerifyEmailRequired-CN1FU1AE.js +0 -74
- package/dist/VerifyEmailRequired-CN1FU1AE.js.map +0 -1
- package/dist/ViewTeam-DpjnoTwo.js +0 -32
- package/dist/ViewTeamMember-CRb2oBHG.js +0 -32
- package/dist/convertToLocalDateTime-DOSGtMn8.js.map +0 -1
- package/dist/src-CkgUIye9.js.map +0 -1
- package/dist/useQuery-BKb5JXVS.js.map +0 -1
- package/dist/useReturnUrl-Da8PpLb9.js.map +0 -1
- package/dist/useRpcAuth-8Byr6SSI.js.map +0 -1
- /package/dist/{TeamMembersTab-DTJxmb-M.js → TeamMembersTab-CBB2Yl_I.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as executeWithAuth, s as getRefreshTokenHandler } from "./useRpcAuth-
|
|
2
|
-
import { t as formatSystemTimestamp } from "./convertToLocalDateTime-
|
|
1
|
+
import { r as executeWithAuth, s as getRefreshTokenHandler } from "./useRpcAuth-rmHf7bYx.js";
|
|
2
|
+
import { t as formatSystemTimestamp } from "./convertToLocalDateTime-CFhtN6PI.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";
|
|
5
5
|
import { useCursorDataTable, withMetadata } from "@dragonmastery/zinia-forms-core";
|
|
@@ -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-DUE5gJTo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserListPage-
|
|
1
|
+
{"version":3,"file":"UserListPage-DUE5gJTo.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;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ACX;IACD,YAAY;KAAE,OAAO;KAAW,OAAO;KAAc,UAAU;KAAM;IACtE;GAGD,SAAS,EACP,OAAO,CACL;IACE,KAAK;IACL,MAAM;IACN,MAAM;IACN,SAAS;IACT,MAAM;IACN,OAAO,QAAiB,gBAAgB,IAAI,GAAG;IAChD,CACF,EACF;GAED,YAAY,EACV,UAAU,KACX;GACF,CAAC;;;uBA1GA,mBAmCM,OAnCN,YAmCM;IAlCJ,mBAAA,kCAAsC;8BACtC,mBAEM,OAAA,EAFD,OAAM,0CAAwC,EAAA,CACjD,mBAAmD,MAAA,EAA/C,OAAM,sBAAoB,EAAC,kBAAe,CAAA;IAGhD,mBAAA,qBAAyB;IACzB,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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { l as useUserSessionStore, m as useEnv } from "./useRpcAuth-
|
|
2
|
-
import { t as useMutation } from "./useMutation-
|
|
3
|
-
import { t as useQuery } from "./useQuery-
|
|
1
|
+
import { l as useUserSessionStore, m as useEnv } from "./useRpcAuth-rmHf7bYx.js";
|
|
2
|
+
import { t as useMutation } from "./useMutation-BTsyHKyn.js";
|
|
3
|
+
import { t as useQuery } from "./useQuery-BggIE52P.js";
|
|
4
4
|
import { createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, toDisplayString, unref, withCtx } from "vue";
|
|
5
5
|
import { toast } from "vue3-toastify";
|
|
6
6
|
import { UserProfileUpdateSchema } from "@dragonmastery/dragoncore-shared";
|
|
@@ -167,4 +167,4 @@ var UserProfilePage_default = _sfc_main;
|
|
|
167
167
|
|
|
168
168
|
//#endregion
|
|
169
169
|
export { userProfileSchemaWithMetadata as n, UserProfilePage_default as t };
|
|
170
|
-
//# sourceMappingURL=UserProfilePage-
|
|
170
|
+
//# sourceMappingURL=UserProfilePage-C3b93Keh.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserProfilePage-X4z2lG-J.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,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B,MAAA,sBAAqB,KAAA,cAAA,CAAgC,MAAA,QAAO,CAAC,YAAY,KAAK,kBAAA,WAAA,EADnG,mBAWS,UAAA;;KANP,MAAK;KACL,OAAM;KACL,UAAU,cAAA;KACV,SAAO;uBAEL,cAAA,QAAa,eAAA,sBAAA,EAAA,GAAA,WAAA,IAAA,mBAAA,QAAA,KAAA,CAAA,CAAA,CAAA,CAAA,IAAA,mBAAA,QAAA,KAAA;IAKtB,YAMY,MAAA,UAAA,EAAA;KANA,gBAAe;KAAe,WAAS;KAAgB,SAAO;;4BAChD;MAAxB,YAAwB,MAAA,MAAA,CAAA,eAAA;MACxB,YAAuB,MAAA,MAAA,CAAA,cAAA;MACvB,YAAkB,MAAA,MAAA,CAAA,SAAA;MAElB,YAAsE,MAAA,kBAAA,EAAA;OAAnD,YAAW;OAAS,gBAAe"}
|
|
1
|
+
{"version":3,"file":"UserProfilePage-C3b93Keh.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,uCA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K,kBAAA,WAAA,EADnG,mBAWS,UAAA;;KANP,MAAK;KACL,OAAM;KACL,UAAU,cAAA;KACV,SAAO;uBAEL,cAAA,QAAa,eAAA,sBAAA,EAAA,GAAA,WAAA,IAAA,mBAAA,QAAA,KAAA,CAAA,CAAA,CAAA,CAAA,IAAA,mBAAA,QAAA,KAAA;IAKtB,YAMY,MAAA,UAAA,EAAA;KANA,gBAAe;KAAe,WAAS;KAAgB,SAAO;;4BAChD;MAAxB,YAAwB,MAAA,MAAA,CAAA,eAAA;MACxB,YAAuB,MAAA,MAAA,CAAA,cAAA;MACvB,YAAkB,MAAA,MAAA,CAAA,SAAA;MAElB,YAAsE,MAAA,kBAAA,EAAA;OAAnD,YAAW;OAAS,gBAAe"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "./useRpcAuth-rmHf7bYx.js";
|
|
2
|
+
import "./useQueryCache-Bjm-S8v5.js";
|
|
3
|
+
import "./useMutation-BTsyHKyn.js";
|
|
4
|
+
import "./useQuery-BggIE52P.js";
|
|
5
|
+
import { t as UserProfilePage_default } from "./UserProfilePage-C3b93Keh.js";
|
|
6
|
+
|
|
7
|
+
export { UserProfilePage_default as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "./useRpcAuth-rmHf7bYx.js";
|
|
2
|
+
import "./useQueryCache-Bjm-S8v5.js";
|
|
3
|
+
import "./useMutation-BTsyHKyn.js";
|
|
4
|
+
import "./useQuery-BggIE52P.js";
|
|
5
|
+
import "./AppLink-CHMMrSFI.js";
|
|
6
|
+
import "./useEmailVerificationChannel-BNi926Ho.js";
|
|
7
|
+
import { t as VerifyEmail_default } from "./VerifyEmail-DlOmWGG-.js";
|
|
8
|
+
|
|
9
|
+
export { VerifyEmail_default as default };
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { l as useUserSessionStore, m as useEnv } from "./useRpcAuth-rmHf7bYx.js";
|
|
2
|
+
import { t as useMutation } from "./useMutation-BTsyHKyn.js";
|
|
3
|
+
import { t as useQuery } from "./useQuery-BggIE52P.js";
|
|
4
|
+
import { t as AppLink_default } from "./AppLink-CHMMrSFI.js";
|
|
5
|
+
import { o as withReturnUrl, r as getValidReturnUrl, t as getAndClearEmailVerificationReturnUrl } from "./useReturnUrl-qFeazn-G.js";
|
|
6
|
+
import { t as useEmailVerificationChannel } from "./useEmailVerificationChannel-BNi926Ho.js";
|
|
7
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createStaticVNode, createTextVNode, createVNode, defineComponent, onUnmounted, openBlock, ref, toDisplayString, unref, withCtx } from "vue";
|
|
8
|
+
import { useRoute, useRouter } from "vue-router";
|
|
9
|
+
import { toast } from "vue3-toastify";
|
|
10
|
+
|
|
11
|
+
//#region src/slices/auth/features/verify_email/VerifyEmail.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: "text-center" };
|
|
14
|
+
const _hoisted_3 = {
|
|
15
|
+
key: 0,
|
|
16
|
+
class: "space-y-4"
|
|
17
|
+
};
|
|
18
|
+
const _hoisted_4 = {
|
|
19
|
+
key: 0,
|
|
20
|
+
class: "text-sm text-base-content/80 text-left font-medium"
|
|
21
|
+
};
|
|
22
|
+
const _hoisted_5 = { class: "flex flex-col gap-2 items-center pt-2" };
|
|
23
|
+
const _hoisted_6 = ["disabled"];
|
|
24
|
+
const _hoisted_7 = { class: "space-y-4" };
|
|
25
|
+
const _hoisted_8 = {
|
|
26
|
+
key: 0,
|
|
27
|
+
class: "text-sm text-base-content/80 font-medium"
|
|
28
|
+
};
|
|
29
|
+
const _hoisted_9 = ["disabled"];
|
|
30
|
+
const _hoisted_10 = { class: "space-y-4" };
|
|
31
|
+
const _hoisted_11 = {
|
|
32
|
+
key: 0,
|
|
33
|
+
class: "text-sm text-base-content/70"
|
|
34
|
+
};
|
|
35
|
+
const _hoisted_12 = {
|
|
36
|
+
key: 1,
|
|
37
|
+
class: "text-sm text-base-content/70"
|
|
38
|
+
};
|
|
39
|
+
const _hoisted_13 = {
|
|
40
|
+
key: 2,
|
|
41
|
+
class: "text-sm text-base-content/60"
|
|
42
|
+
};
|
|
43
|
+
const _hoisted_14 = { class: "space-y-4" };
|
|
44
|
+
const _hoisted_15 = { class: "text-sm text-base-content/70" };
|
|
45
|
+
const _hoisted_16 = { class: "flex flex-col gap-2 items-center" };
|
|
46
|
+
const _hoisted_17 = ["disabled"];
|
|
47
|
+
const AUTH_CHANNEL = "auth";
|
|
48
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
49
|
+
__name: "VerifyEmail",
|
|
50
|
+
setup(__props) {
|
|
51
|
+
const route = useRoute();
|
|
52
|
+
const router = useRouter();
|
|
53
|
+
const returnUrl = computed(() => route.query.returnUrl);
|
|
54
|
+
const loginLink = computed(() => withReturnUrl("/auth/login", returnUrl.value));
|
|
55
|
+
const appLink = computed(() => getValidReturnUrl(route, "/"));
|
|
56
|
+
const sessionStore = useUserSessionStore();
|
|
57
|
+
const { emailVerificationMode } = useEnv();
|
|
58
|
+
const token = route.query.token ?? route.params.token;
|
|
59
|
+
const status = ref("idle");
|
|
60
|
+
const errorMessage = ref("");
|
|
61
|
+
const verifyEmailApi = ref(false);
|
|
62
|
+
const resendLoading = ref(false);
|
|
63
|
+
const resendCountdown = ref(0);
|
|
64
|
+
let resendCountdownInterval = null;
|
|
65
|
+
const verifyLoading = ref(false);
|
|
66
|
+
const redirectTarget = ref(null);
|
|
67
|
+
const isLoggedIn = computed(() => !!sessionStore.userSession?.user.userId);
|
|
68
|
+
useEmailVerificationChannel(computed(() => !token && status.value !== "loading" && status.value !== "success"), (targetUrl) => router.push(targetUrl), () => getValidReturnUrl(route, "/"));
|
|
69
|
+
const { mutate: verifyMutate } = useMutation((api, tokenToVerify) => {
|
|
70
|
+
const verifyEmail = api.verifyEmail;
|
|
71
|
+
if (!verifyEmail) throw new Error("Email verification is not configured");
|
|
72
|
+
return verifyEmail.verifyEmail(tokenToVerify);
|
|
73
|
+
}, {
|
|
74
|
+
skipAuthCheck: true,
|
|
75
|
+
credentials: "include"
|
|
76
|
+
});
|
|
77
|
+
const { mutate: resendMutate } = useMutation((api, _input) => {
|
|
78
|
+
const verifyEmail = api.verifyEmail;
|
|
79
|
+
if (!verifyEmail) throw new Error("Email verification is not configured");
|
|
80
|
+
return verifyEmail.resendVerificationEmail();
|
|
81
|
+
}, { skipAuthCheck: false });
|
|
82
|
+
async function handleVerify() {
|
|
83
|
+
if (!token) return;
|
|
84
|
+
if (emailVerificationMode === "disabled") {
|
|
85
|
+
status.value = "error";
|
|
86
|
+
errorMessage.value = "Email verification is not enabled for this application.";
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
status.value = "loading";
|
|
91
|
+
verifyLoading.value = true;
|
|
92
|
+
errorMessage.value = "";
|
|
93
|
+
const result = await verifyMutate(token);
|
|
94
|
+
verifyEmailApi.value = true;
|
|
95
|
+
if (result?.ok) {
|
|
96
|
+
status.value = "success";
|
|
97
|
+
const hadSession = !!(result.session?.access_token && result.session?.user_details_token);
|
|
98
|
+
if (hadSession) {
|
|
99
|
+
sessionStore.setSession(result.session.user_details_token);
|
|
100
|
+
sessionStore.setAccessToken(result.session.access_token);
|
|
101
|
+
} else try {
|
|
102
|
+
await sessionStore.refreshToken();
|
|
103
|
+
} catch {}
|
|
104
|
+
const channel = new BroadcastChannel(AUTH_CHANNEL);
|
|
105
|
+
channel.postMessage({ type: "email_verified" });
|
|
106
|
+
channel.close();
|
|
107
|
+
const target = getAndClearEmailVerificationReturnUrl() ?? (hadSession ? "/" : null);
|
|
108
|
+
if (target) {
|
|
109
|
+
redirectTarget.value = target;
|
|
110
|
+
setTimeout(() => router.push(target), 1e3);
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
status.value = "error";
|
|
114
|
+
errorMessage.value = "The link may have expired. Please try again or resend the verification email.";
|
|
115
|
+
}
|
|
116
|
+
} catch (error) {
|
|
117
|
+
status.value = "error";
|
|
118
|
+
errorMessage.value = error instanceof Error ? error.message : "Something went wrong. The link may have expired.";
|
|
119
|
+
verifyEmailApi.value = true;
|
|
120
|
+
} finally {
|
|
121
|
+
verifyLoading.value = false;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function startResendCountdown(seconds) {
|
|
125
|
+
if (resendCountdownInterval) {
|
|
126
|
+
clearInterval(resendCountdownInterval);
|
|
127
|
+
resendCountdownInterval = null;
|
|
128
|
+
}
|
|
129
|
+
resendCountdown.value = seconds;
|
|
130
|
+
resendCountdownInterval = setInterval(() => {
|
|
131
|
+
resendCountdown.value = Math.max(0, resendCountdown.value - 1);
|
|
132
|
+
if (resendCountdown.value <= 0 && resendCountdownInterval) {
|
|
133
|
+
clearInterval(resendCountdownInterval);
|
|
134
|
+
resendCountdownInterval = null;
|
|
135
|
+
}
|
|
136
|
+
}, 1e3);
|
|
137
|
+
}
|
|
138
|
+
const resendVerification = async () => {
|
|
139
|
+
try {
|
|
140
|
+
resendLoading.value = true;
|
|
141
|
+
const result = await resendMutate(void 0);
|
|
142
|
+
if (result?.ok) if (result.sent) {
|
|
143
|
+
toast.success("Verification email sent. Please check your inbox.");
|
|
144
|
+
startResendCountdown(60);
|
|
145
|
+
} else if (result.seconds_until_next_send != null) {
|
|
146
|
+
toast.info(`Please wait ${result.seconds_until_next_send} seconds before resending.`);
|
|
147
|
+
startResendCountdown(result.seconds_until_next_send);
|
|
148
|
+
} else {
|
|
149
|
+
toast.success("Verification email sent. Please check your inbox.");
|
|
150
|
+
startResendCountdown(60);
|
|
151
|
+
}
|
|
152
|
+
else toast.error("Failed to resend verification email.");
|
|
153
|
+
} catch (error) {
|
|
154
|
+
toast.error(error instanceof Error ? error.message : "Failed to resend");
|
|
155
|
+
} finally {
|
|
156
|
+
resendLoading.value = false;
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
onUnmounted(() => {
|
|
160
|
+
resendCountdownInterval && clearInterval(resendCountdownInterval);
|
|
161
|
+
});
|
|
162
|
+
useQuery((api) => {
|
|
163
|
+
verifyEmailApi.value = !!api.verifyEmail;
|
|
164
|
+
return Promise.resolve(true);
|
|
165
|
+
}, {
|
|
166
|
+
enabled: isLoggedIn,
|
|
167
|
+
staleTime: 3600 * 1e3
|
|
168
|
+
});
|
|
169
|
+
return (_ctx, _cache) => {
|
|
170
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createCommentVNode(" State A: No token (after signup, waiting for email) "), !unref(token) && status.value !== "loading" && status.value !== "success" ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
171
|
+
_cache[1] || (_cache[1] = createElementVNode("h3", { class: "text-lg font-semibold" }, "Check your email", -1)),
|
|
172
|
+
_cache[2] || (_cache[2] = createElementVNode("p", { class: "text-sm text-base-content/70 text-left" }, " We've sent a verification email to your inbox. It may take a couple of minutes to arrive. Be sure to check your junk or spam folder if you don't see it. ", -1)),
|
|
173
|
+
_cache[3] || (_cache[3] = createElementVNode("p", { class: "text-sm text-base-content/70 text-left" }, " When you receive the email, click the link inside. You'll land on a page where you need to click the \"Verify email\" button to complete verification. ", -1)),
|
|
174
|
+
unref(emailVerificationMode) === "strict" ? (openBlock(), createElementBlock("p", _hoisted_4, " Application access is restricted until email verification is completed. ")) : createCommentVNode("v-if", true),
|
|
175
|
+
createElementVNode("div", _hoisted_5, [unref(emailVerificationMode) !== "strict" ? (openBlock(), createBlock(AppLink_default, {
|
|
176
|
+
key: 0,
|
|
177
|
+
to: appLink.value,
|
|
178
|
+
class: "btn btn-outline btn-sm"
|
|
179
|
+
}, {
|
|
180
|
+
default: withCtx(() => [..._cache[0] || (_cache[0] = [createTextVNode(" Continue to app ", -1)])]),
|
|
181
|
+
_: 1
|
|
182
|
+
}, 8, ["to"])) : createCommentVNode("v-if", true), isLoggedIn.value && verifyEmailApi.value ? (openBlock(), createElementBlock("button", {
|
|
183
|
+
key: 1,
|
|
184
|
+
type: "button",
|
|
185
|
+
class: "btn btn-outline btn-sm",
|
|
186
|
+
disabled: resendLoading.value || resendCountdown.value > 0,
|
|
187
|
+
onClick: resendVerification
|
|
188
|
+
}, toDisplayString(resendLoading.value ? "Sending..." : resendCountdown.value > 0 ? `Try again in ${resendCountdown.value}` : "Resend verification email"), 9, _hoisted_6)) : createCommentVNode("v-if", true)])
|
|
189
|
+
])) : unref(token) && status.value !== "loading" && status.value !== "success" && status.value !== "error" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" State B: Token present, waiting for user to click verify "), createElementVNode("div", _hoisted_7, [
|
|
190
|
+
_cache[4] || (_cache[4] = createElementVNode("h3", { class: "text-lg font-semibold" }, "Verify your email", -1)),
|
|
191
|
+
_cache[5] || (_cache[5] = createElementVNode("p", { class: "text-sm text-base-content/70" }, " Click the button below to complete verification. You'll be redirected once it's done. ", -1)),
|
|
192
|
+
unref(emailVerificationMode) === "strict" ? (openBlock(), createElementBlock("p", _hoisted_8, " Application access is restricted until email verification is completed. ")) : createCommentVNode("v-if", true),
|
|
193
|
+
createElementVNode("button", {
|
|
194
|
+
type: "button",
|
|
195
|
+
class: "btn btn-primary",
|
|
196
|
+
disabled: verifyLoading.value,
|
|
197
|
+
onClick: handleVerify
|
|
198
|
+
}, toDisplayString(verifyLoading.value ? "Verifying..." : "Verify email"), 9, _hoisted_9)
|
|
199
|
+
])], 2112)) : status.value === "loading" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [createCommentVNode(" Loading (after clicking verify) "), _cache[6] || (_cache[6] = createElementVNode("div", { class: "space-y-4" }, [createElementVNode("span", { class: "loading loading-spinner loading-lg text-primary" }), createElementVNode("p", { class: "text-sm text-base-content/70" }, "Verifying your email...")], -1))], 2112)) : status.value === "success" ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [createCommentVNode(" Success "), createElementVNode("div", _hoisted_10, [
|
|
200
|
+
_cache[13] || (_cache[13] = createElementVNode("div", { class: "w-14 h-14 rounded-full bg-success/20 flex items-center justify-center mx-auto" }, [createElementVNode("svg", {
|
|
201
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
202
|
+
class: "w-7 h-7 text-success",
|
|
203
|
+
viewBox: "0 0 24 24",
|
|
204
|
+
fill: "none",
|
|
205
|
+
stroke: "currentColor",
|
|
206
|
+
"stroke-width": "2",
|
|
207
|
+
"stroke-linecap": "round",
|
|
208
|
+
"stroke-linejoin": "round"
|
|
209
|
+
}, [createElementVNode("polyline", { points: "20 6 9 17 4 12" })])], -1)),
|
|
210
|
+
_cache[14] || (_cache[14] = createElementVNode("h3", { class: "text-lg font-semibold" }, "Email verified!", -1)),
|
|
211
|
+
redirectTarget.value ? (openBlock(), createElementBlock("p", _hoisted_11, "Redirecting you...")) : (openBlock(), createElementBlock("p", _hoisted_12, [
|
|
212
|
+
_cache[8] || (_cache[8] = createTextVNode(" Your email has been verified. Switch back to your other tab to continue, or ", -1)),
|
|
213
|
+
createVNode(AppLink_default, {
|
|
214
|
+
to: appLink.value,
|
|
215
|
+
class: "link link-primary"
|
|
216
|
+
}, {
|
|
217
|
+
default: withCtx(() => [..._cache[7] || (_cache[7] = [createTextVNode("continue to the app", -1)])]),
|
|
218
|
+
_: 1
|
|
219
|
+
}, 8, ["to"]),
|
|
220
|
+
_cache[9] || (_cache[9] = createTextVNode(". ", -1))
|
|
221
|
+
])),
|
|
222
|
+
redirectTarget.value ? (openBlock(), createElementBlock("p", _hoisted_13, [
|
|
223
|
+
_cache[11] || (_cache[11] = createTextVNode(" If you aren't redirected automatically, ", -1)),
|
|
224
|
+
createVNode(AppLink_default, {
|
|
225
|
+
to: redirectTarget.value,
|
|
226
|
+
class: "link link-primary"
|
|
227
|
+
}, {
|
|
228
|
+
default: withCtx(() => [..._cache[10] || (_cache[10] = [createTextVNode("click here", -1)])]),
|
|
229
|
+
_: 1
|
|
230
|
+
}, 8, ["to"]),
|
|
231
|
+
_cache[12] || (_cache[12] = createTextVNode(". ", -1))
|
|
232
|
+
])) : createCommentVNode("v-if", true)
|
|
233
|
+
])], 2112)) : (openBlock(), createElementBlock(Fragment, { key: 4 }, [createCommentVNode(" Error "), createElementVNode("div", _hoisted_14, [
|
|
234
|
+
_cache[16] || (_cache[16] = 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)),
|
|
235
|
+
createElementVNode("p", _hoisted_15, toDisplayString(errorMessage.value), 1),
|
|
236
|
+
createElementVNode("div", _hoisted_16, [createVNode(AppLink_default, {
|
|
237
|
+
to: loginLink.value,
|
|
238
|
+
class: "btn btn-outline btn-sm"
|
|
239
|
+
}, {
|
|
240
|
+
default: withCtx(() => [..._cache[15] || (_cache[15] = [createTextVNode("Back to login", -1)])]),
|
|
241
|
+
_: 1
|
|
242
|
+
}, 8, ["to"]), verifyEmailApi.value ? (openBlock(), createElementBlock("button", {
|
|
243
|
+
key: 0,
|
|
244
|
+
type: "button",
|
|
245
|
+
class: "btn btn-outline btn-sm",
|
|
246
|
+
disabled: resendLoading.value || resendCountdown.value > 0,
|
|
247
|
+
onClick: resendVerification
|
|
248
|
+
}, toDisplayString(resendLoading.value ? "Sending..." : resendCountdown.value > 0 ? `Try again in ${resendCountdown.value}` : "Resend verification email"), 9, _hoisted_17)) : createCommentVNode("v-if", true)])
|
|
249
|
+
])], 2112))])]);
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
var VerifyEmail_default = _sfc_main;
|
|
254
|
+
|
|
255
|
+
//#endregion
|
|
256
|
+
export { VerifyEmail_default as t };
|
|
257
|
+
//# sourceMappingURL=VerifyEmail-DlOmWGG-.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VerifyEmail-DlOmWGG-.js","names":["resendCountdownInterval: ReturnType<typeof setInterval> | null"],"sources":["../src/slices/auth/features/verify_email/VerifyEmail.vue"],"sourcesContent":["<template>\n <div class=\"max-w-md mx-auto bg-base-200 p-6 rounded-xl shadow-md container\">\n <div class=\"text-center\">\n <!-- State A: No token (after signup, waiting for email) -->\n <div v-if=\"!token && status !== 'loading' && status !== 'success'\" class=\"space-y-4\">\n <h3 class=\"text-lg font-semibold\">Check your email</h3>\n <p class=\"text-sm text-base-content/70 text-left\">\n We've sent a verification email to your inbox. It may take a couple of minutes to\n arrive. Be sure to check your junk or spam folder if you don't see it.\n </p>\n <p class=\"text-sm text-base-content/70 text-left\">\n When you receive the email, click the link inside. You'll land on a page where you\n need to click the \"Verify email\" button to complete verification.\n </p>\n <p\n v-if=\"emailVerificationMode === 'strict'\"\n class=\"text-sm text-base-content/80 text-left font-medium\"\n >\n Application access is restricted until email verification is completed.\n </p>\n <div class=\"flex flex-col gap-2 items-center pt-2\">\n <AppLink\n v-if=\"emailVerificationMode !== 'strict'\"\n :to=\"appLink\"\n class=\"btn btn-outline btn-sm\"\n >\n Continue to app\n </AppLink>\n <button\n v-if=\"isLoggedIn && verifyEmailApi\"\n type=\"button\"\n class=\"btn btn-outline btn-sm\"\n :disabled=\"resendLoading || resendCountdown > 0\"\n @click=\"resendVerification\"\n >\n {{\n resendLoading\n ? 'Sending...'\n : resendCountdown > 0\n ? `Try again in ${resendCountdown}`\n : 'Resend verification email'\n }}\n </button>\n </div>\n </div>\n\n <!-- State B: Token present, waiting for user to click verify -->\n <div\n v-else-if=\"token && status !== 'loading' && status !== 'success' && status !== 'error'\"\n class=\"space-y-4\"\n >\n <h3 class=\"text-lg font-semibold\">Verify your email</h3>\n <p class=\"text-sm text-base-content/70\">\n Click the button below to complete verification. You'll be redirected once it's done.\n </p>\n <p\n v-if=\"emailVerificationMode === 'strict'\"\n class=\"text-sm text-base-content/80 font-medium\"\n >\n Application access is restricted until email verification is completed.\n </p>\n <button\n type=\"button\"\n class=\"btn btn-primary\"\n :disabled=\"verifyLoading\"\n @click=\"handleVerify\"\n >\n {{ verifyLoading ? 'Verifying...' : 'Verify email' }}\n </button>\n </div>\n\n <!-- Loading (after clicking verify) -->\n <div v-else-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\n <!-- Success -->\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 v-if=\"redirectTarget\" class=\"text-sm text-base-content/70\">Redirecting you...</p>\n <p v-else 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=\"appLink\" class=\"link link-primary\">continue to the app</AppLink>.\n </p>\n <p v-if=\"redirectTarget\" class=\"text-sm text-base-content/60\">\n If you aren't redirected automatically,\n <AppLink :to=\"redirectTarget\" class=\"link link-primary\">click here</AppLink>.\n </p>\n </div>\n\n <!-- Error -->\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-outline btn-sm\"\n :disabled=\"resendLoading || resendCountdown > 0\"\n @click=\"resendVerification\"\n >\n {{\n resendLoading\n ? 'Sending...'\n : resendCountdown > 0\n ? `Try again in ${resendCountdown}`\n : 'Resend verification email'\n }}\n </button>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport type { DragoncoreApi, EmailVerificationApi } from '@dragonmastery/dragoncore-shared';\nimport { computed, onUnmounted, ref } from 'vue';\nimport { useRoute, useRouter } from 'vue-router';\nimport { toast } from 'vue3-toastify';\nimport AppLink from '../../../../components/AppLink.vue';\nimport { useEnv } from '../../../../composables/useEnv';\nimport { useMutation } from '../../../../composables/useMutation';\nimport { useQuery } from '../../../../composables/useQuery';\nimport { useUserSessionStore } from '../../../../composables/useUserSessionStore';\nimport {\n getAndClearEmailVerificationReturnUrl,\n getValidReturnUrl,\n withReturnUrl,\n} from '../../../../utils/useReturnUrl';\nimport { useEmailVerificationChannel } from '../../useEmailVerificationChannel';\n\nconst AUTH_CHANNEL = 'auth';\n\nconst route = useRoute();\nconst router = useRouter();\nconst returnUrl = computed(() => route.query.returnUrl as string | undefined);\nconst loginLink = computed(() => withReturnUrl('/auth/login', returnUrl.value));\nconst appLink = computed(() => getValidReturnUrl(route, '/'));\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<'idle' | 'loading' | 'success' | 'error'>('idle');\nconst errorMessage = ref('');\nconst verifyEmailApi = ref(false);\nconst resendLoading = ref(false);\nconst resendCountdown = ref(0);\nlet resendCountdownInterval: ReturnType<typeof setInterval> | null = null;\nconst verifyLoading = ref(false);\nconst redirectTarget = ref<string | null>(null);\n\nconst isLoggedIn = computed(() => !!sessionStore.userSession?.user.userId);\n\n// When on \"Check your email\" (no token), listen for verification in another tab\nconst isAwaitingVerification = computed(\n () => !token && status.value !== 'loading' && status.value !== 'success',\n);\nuseEmailVerificationChannel(\n isAwaitingVerification,\n (targetUrl) => router.push(targetUrl),\n () => getValidReturnUrl(route, '/'),\n);\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, credentials: 'include' },\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\nasync function handleVerify() {\n if (!token) return;\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 status.value = 'loading';\n verifyLoading.value = true;\n errorMessage.value = '';\n const result = await verifyMutate(token);\n verifyEmailApi.value = true;\n if (result?.ok) {\n status.value = 'success';\n const hadSession = !!(\n result.session?.access_token && result.session?.user_details_token\n );\n if (hadSession) {\n sessionStore.setSession(result.session!.user_details_token);\n sessionStore.setAccessToken(result.session!.access_token);\n } else {\n try {\n await sessionStore.refreshToken();\n } catch {\n // User may need to log in again; that's ok\n }\n }\n const channel = new BroadcastChannel(AUTH_CHANNEL);\n channel.postMessage({ type: 'email_verified' });\n channel.close();\n const storedReturnUrl = getAndClearEmailVerificationReturnUrl();\n const target = storedReturnUrl ?? (hadSession ? '/' : null);\n if (target) {\n redirectTarget.value = target;\n setTimeout(() => router.push(target), 1000);\n }\n } else {\n status.value = 'error';\n errorMessage.value =\n 'The link may have expired. Please try again or resend the verification email.';\n }\n } catch (error) {\n status.value = 'error';\n errorMessage.value =\n error instanceof Error\n ? error.message\n : 'Something went wrong. The link may have expired.';\n verifyEmailApi.value = true;\n } finally {\n verifyLoading.value = false;\n }\n}\n\nfunction startResendCountdown(seconds: number) {\n if (resendCountdownInterval) {\n clearInterval(resendCountdownInterval);\n resendCountdownInterval = null;\n }\n resendCountdown.value = seconds;\n resendCountdownInterval = setInterval(() => {\n resendCountdown.value = Math.max(0, resendCountdown.value - 1);\n if (resendCountdown.value <= 0 && resendCountdownInterval) {\n clearInterval(resendCountdownInterval);\n resendCountdownInterval = null;\n }\n }, 1000);\n}\n\nconst resendVerification = async () => {\n try {\n resendLoading.value = true;\n const result = await resendMutate(undefined);\n if (result?.ok) {\n if (result.sent) {\n toast.success('Verification email sent. Please check your inbox.');\n startResendCountdown(60);\n } else if (result.seconds_until_next_send != null) {\n toast.info(`Please wait ${result.seconds_until_next_send} seconds before resending.`);\n startResendCountdown(result.seconds_until_next_send);\n } else {\n toast.success('Verification email sent. Please check your inbox.');\n startResendCountdown(60);\n }\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\nonUnmounted(() => {\n resendCountdownInterval && clearInterval(resendCountdownInterval);\n});\n\n// Detect if verifyEmail API is available (for resend button)\nuseQuery(\n (api) => {\n verifyEmailApi.value = !!(api as DragoncoreApi).verifyEmail;\n return Promise.resolve(true);\n },\n { enabled: isLoggedIn, staleTime: 60 * 60 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ZP,MAAK;KACL,OAAM;KACL,UAAU,cAAA,SAAiB,gBAAA,QAAe;KAC1C,SAAO;uBAGN,cAAA,QAAA,eAA+D,gBAAA,QAAe,IAAA,gBAAyC,gBAAA,UAAA,4BAAA,EAAA,GAAA,YAAA,IAAA,mBAAA,QAAA,KAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import "./useRpcAuth-rmHf7bYx.js";
|
|
2
|
+
import "./useQueryCache-Bjm-S8v5.js";
|
|
3
|
+
import "./useMutation-BTsyHKyn.js";
|
|
4
|
+
import "./useQuery-BggIE52P.js";
|
|
5
|
+
import { st as ViewTeam_default } from "./src-QZJyMfGX.js";
|
|
6
|
+
import "./AppLink-CHMMrSFI.js";
|
|
7
|
+
import "./TimelineSystemEvent-BHzFr46C.js";
|
|
8
|
+
import "./TeamMembersTab-4gmnP9sD.js";
|
|
9
|
+
import "./Appearance-DxWTyx1M.js";
|
|
10
|
+
import "./useSignupPendingData-BWHwUHhL.js";
|
|
11
|
+
import "./useBreadcrumbs-qB6ghsAf.js";
|
|
12
|
+
import "./EditTeamMemberForm-CaS2GLjV.js";
|
|
13
|
+
import "./RecordVersionViewer-BWZ78vvE.js";
|
|
14
|
+
import "./TeamHistoryTab-D5biUPmq.js";
|
|
15
|
+
import "./UserProfilePage-C3b93Keh.js";
|
|
16
|
+
import "./ChangePasswordPage--3XwluwE.js";
|
|
17
|
+
import "./TeamNotesTab-BzGZZ1h8.js";
|
|
18
|
+
import "./CustomerSupportTicketParent-HIxwSVdu.js";
|
|
19
|
+
import "./SupportTicketDevLifecycleBadge-EMrQHfyG.js";
|
|
20
|
+
import "./StaffSupportTicketParent-CilR4RGM.js";
|
|
21
|
+
import "./LoginForm-9UFnA-fO.js";
|
|
22
|
+
import "./useEmailVerificationChannel-BNi926Ho.js";
|
|
23
|
+
import "./Signup-9TjMMnU4.js";
|
|
24
|
+
import "./ForgotPassword-OjIPi9s9.js";
|
|
25
|
+
import "./ResetPassword-BE4mXK9q.js";
|
|
26
|
+
import "./Logout-YgTgOFUH.js";
|
|
27
|
+
import "./mfaSchema-BnRWf0ma.js";
|
|
28
|
+
import "./MfaSetup-RtFMY_dj.js";
|
|
29
|
+
import "./MfaVerify-Cvhe8bEM.js";
|
|
30
|
+
import "./VerifyEmail-DlOmWGG-.js";
|
|
31
|
+
import "./UserListPage-DUE5gJTo.js";
|
|
32
|
+
import "./CreateUserPage-DLwXeLAq.js";
|
|
33
|
+
import "./EditUserPage-DURc5rmi.js";
|
|
34
|
+
|
|
35
|
+
export { ViewTeam_default as default };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import "./useRpcAuth-rmHf7bYx.js";
|
|
2
|
+
import "./useQueryCache-Bjm-S8v5.js";
|
|
3
|
+
import "./useMutation-BTsyHKyn.js";
|
|
4
|
+
import "./useQuery-BggIE52P.js";
|
|
5
|
+
import { tt as ViewTeamMember_default } from "./src-QZJyMfGX.js";
|
|
6
|
+
import "./AppLink-CHMMrSFI.js";
|
|
7
|
+
import "./TimelineSystemEvent-BHzFr46C.js";
|
|
8
|
+
import "./TeamMembersTab-4gmnP9sD.js";
|
|
9
|
+
import "./Appearance-DxWTyx1M.js";
|
|
10
|
+
import "./useSignupPendingData-BWHwUHhL.js";
|
|
11
|
+
import "./useBreadcrumbs-qB6ghsAf.js";
|
|
12
|
+
import "./EditTeamMemberForm-CaS2GLjV.js";
|
|
13
|
+
import "./RecordVersionViewer-BWZ78vvE.js";
|
|
14
|
+
import "./TeamHistoryTab-D5biUPmq.js";
|
|
15
|
+
import "./UserProfilePage-C3b93Keh.js";
|
|
16
|
+
import "./ChangePasswordPage--3XwluwE.js";
|
|
17
|
+
import "./TeamNotesTab-BzGZZ1h8.js";
|
|
18
|
+
import "./CustomerSupportTicketParent-HIxwSVdu.js";
|
|
19
|
+
import "./SupportTicketDevLifecycleBadge-EMrQHfyG.js";
|
|
20
|
+
import "./StaffSupportTicketParent-CilR4RGM.js";
|
|
21
|
+
import "./LoginForm-9UFnA-fO.js";
|
|
22
|
+
import "./useEmailVerificationChannel-BNi926Ho.js";
|
|
23
|
+
import "./Signup-9TjMMnU4.js";
|
|
24
|
+
import "./ForgotPassword-OjIPi9s9.js";
|
|
25
|
+
import "./ResetPassword-BE4mXK9q.js";
|
|
26
|
+
import "./Logout-YgTgOFUH.js";
|
|
27
|
+
import "./mfaSchema-BnRWf0ma.js";
|
|
28
|
+
import "./MfaSetup-RtFMY_dj.js";
|
|
29
|
+
import "./MfaVerify-Cvhe8bEM.js";
|
|
30
|
+
import "./VerifyEmail-DlOmWGG-.js";
|
|
31
|
+
import "./UserListPage-DUE5gJTo.js";
|
|
32
|
+
import "./CreateUserPage-DLwXeLAq.js";
|
|
33
|
+
import "./EditUserPage-DURc5rmi.js";
|
|
34
|
+
|
|
35
|
+
export { ViewTeamMember_default as default };
|
|
@@ -14,6 +14,16 @@ function formatToISODate(date) {
|
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
+
function formatToISODatetime(date) {
|
|
18
|
+
console.log("formatToISODatetime", date);
|
|
19
|
+
if (!date) return null;
|
|
20
|
+
try {
|
|
21
|
+
return new Date(date).toISOString();
|
|
22
|
+
} catch (e) {
|
|
23
|
+
console.error("Invalid date format:", e);
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
17
27
|
/**
|
|
18
28
|
* Extracts YYYY-MM-DD from a date string (handles both date-only and ISO format)
|
|
19
29
|
* Used to avoid timezone issues: ISO strings like "2024-02-02T00:00:00.000Z" are
|
|
@@ -117,5 +127,5 @@ function getTimezoneOffsetString(date) {
|
|
|
117
127
|
}
|
|
118
128
|
|
|
119
129
|
//#endregion
|
|
120
|
-
export {
|
|
121
|
-
//# sourceMappingURL=convertToLocalDateTime-
|
|
130
|
+
export { getTimezoneOffsetString as a, formatUserDate as i, formatToISODate as n, toStringWithLocalTimeZoneOffSet as o, formatToISODatetime as r, formatSystemTimestamp as t };
|
|
131
|
+
//# sourceMappingURL=convertToLocalDateTime-CFhtN6PI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertToLocalDateTime-CFhtN6PI.js","names":["date: Date"],"sources":["../src/utils/convertToLocalDateTime.ts"],"sourcesContent":["/**\n * Format a date value to ISO date string (YYYY-MM-DD)\n * Used as formatter for date input fields to ensure consistent ISO format\n * @param date - Date string or Date object\n * @returns ISO date string (YYYY-MM-DD) or null if invalid\n */\nexport function formatToISODate(date: string | Date | null): string | null {\n if (!date) {\n return null;\n }\n try {\n return new Date(date).toISOString().split('T')[0] ?? null;\n } catch (e) {\n console.error('Invalid date format:', e);\n return null;\n }\n}\n\nexport function formatToISODatetime(date: string | Date | null): string | null {\n console.log('formatToISODatetime', date);\n if (!date) {\n return null;\n }\n try {\n return new Date(date).toISOString();\n } catch (e) {\n console.error('Invalid date format:', e);\n return null;\n }\n}\n\n/**\n * Extracts YYYY-MM-DD from a date string (handles both date-only and ISO format)\n * Used to avoid timezone issues: ISO strings like \"2024-02-02T00:00:00.000Z\" are\n * interpreted as UTC by Date(), which shows wrong date in western timezones\n */\nfunction extractDateOnly(dateString: string): string | null {\n const match = dateString.match(/^(\\d{4}-\\d{2}-\\d{2})/);\n const datePart = match?.[1];\n return datePart != null ? datePart : null;\n}\n\n/**\n * Formats user-inputted date-only fields (YYYY-MM-DD format) or ISO timestamps\n * These represent calendar dates in the user's local context, not precise timestamps\n * @param dateString - Date string in YYYY-MM-DD format or ISO timestamp\n * @param dateOnly - If true, returns only the date portion without time (default: true)\n * @returns Formatted date string or empty string if no date provided\n */\nexport function formatUserDate(\n dateString: string | null | undefined,\n dateOnly: boolean = true,\n): string {\n if (!dateString) return '';\n\n try {\n let date: Date;\n\n // For date-only fields, extract YYYY-MM-DD and parse as local to avoid timezone issues.\n // ISO strings like \"2024-02-02T00:00:00.000Z\" would otherwise be parsed as UTC midnight,\n // showing the wrong day (e.g. Feb 1 instead of Feb 2) in western timezones.\n const dateOnlyPart = extractDateOnly(dateString);\n if (dateOnlyPart) {\n const [year, month, day] = dateOnlyPart.split('-').map(Number);\n date = new Date(year!, month! - 1, day!); // month is 0-indexed\n } else {\n // Fallback for non-standard formats\n date = new Date(dateString);\n }\n\n // Check if date is valid (e.g., catches invalid dates like 2023-02-31)\n if (isNaN(date.getTime())) {\n console.warn('formatUserDate received invalid date:', dateString);\n return dateString;\n }\n\n if (dateOnly) {\n return date.toLocaleDateString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n });\n }\n\n return date.toLocaleString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n timeZoneName: 'short',\n });\n } catch (error) {\n console.error('Error formatting user date:', error);\n return dateString;\n }\n}\n\n/**\n * Formats system-generated timestamps (ISO format with time)\n * These represent precise moments in time, typically in UTC\n * @param timestamp - ISO timestamp string or YYYY-MM-DD date string\n * @param dateOnly - If true, returns only the date portion without time (default: false)\n * @returns Formatted timestamp string or empty string if no timestamp provided\n */\nexport function formatSystemTimestamp(\n timestamp: string | null | undefined,\n dateOnly: boolean = false,\n): string {\n if (!timestamp) return '';\n\n try {\n let date: Date;\n\n // Handle YYYY-MM-DD format specially to avoid timezone issues\n if (dateOnly && /^\\d{4}-\\d{2}-\\d{2}$/.test(timestamp)) {\n // For date-only strings, parse as local date to avoid UTC interpretation\n const [year, month, day] = timestamp.split('-').map(Number);\n date = new Date(year!, month! - 1, day!); // month is 0-indexed\n } else {\n // Handle ISO timestamp or other formats\n date = new Date(timestamp);\n }\n\n // Check if date is valid\n if (isNaN(date.getTime())) {\n console.warn('formatSystemTimestamp received invalid timestamp:', timestamp);\n return timestamp;\n }\n\n if (dateOnly) {\n return date.toLocaleDateString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n });\n }\n\n return date.toLocaleString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n timeZoneName: 'short',\n });\n } catch (error) {\n console.error('Error formatting system timestamp:', error);\n return timestamp;\n }\n}\n\nexport const toStringWithLocalTimeZoneOffSet = (date?: string | null) => {\n if (!date) return null;\n date = date.split('Z')[0];\n if (!date) return null;\n if (date.includes('T')) {\n return date + getTimezoneOffsetString(date);\n } else {\n return date + 'T12:00:00.000' + getTimezoneOffsetString(date);\n }\n};\n\nexport function getTimezoneOffsetString(date: string) {\n let offset = -new Date(date).getTimezoneOffset();\n let sign = offset < 0 ? '-' : '+';\n let hours = Math.floor(Math.abs(offset / 60));\n let minutes = Math.abs(offset % 60);\n return sign + pad(hours) + ':' + pad(minutes);\n\n function pad(n: number) {\n return n < 10 ? '0' + n : '' + n;\n }\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,gBAAgB,MAA2C;AACzE,KAAI,CAAC,KACH,QAAO;AAET,KAAI;AACF,SAAO,IAAI,KAAK,KAAK,CAAC,aAAa,CAAC,MAAM,IAAI,CAAC,MAAM;UAC9C,GAAG;AACV,UAAQ,MAAM,wBAAwB,EAAE;AACxC,SAAO;;;AAIX,SAAgB,oBAAoB,MAA2C;AAC7E,SAAQ,IAAI,uBAAuB,KAAK;AACxC,KAAI,CAAC,KACH,QAAO;AAET,KAAI;AACF,SAAO,IAAI,KAAK,KAAK,CAAC,aAAa;UAC5B,GAAG;AACV,UAAQ,MAAM,wBAAwB,EAAE;AACxC,SAAO;;;;;;;;AASX,SAAS,gBAAgB,YAAmC;CAE1D,MAAM,WADQ,WAAW,MAAM,uBAAuB,GAC7B;AACzB,QAAO,YAAY,OAAO,WAAW;;;;;;;;;AAUvC,SAAgB,eACd,YACA,WAAoB,MACZ;AACR,KAAI,CAAC,WAAY,QAAO;AAExB,KAAI;EACF,IAAIA;EAKJ,MAAM,eAAe,gBAAgB,WAAW;AAChD,MAAI,cAAc;GAChB,MAAM,CAAC,MAAM,OAAO,OAAO,aAAa,MAAM,IAAI,CAAC,IAAI,OAAO;AAC9D,UAAO,IAAI,KAAK,MAAO,QAAS,GAAG,IAAK;Q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kB,wBAAwB,KAAK;;AAIjE,SAAgB,wBAAwB,MAAc;CACpD,IAAI,SAAS,CAAC,IAAI,KAAK,KAAK,CAAC,mBAAmB;CAChD,IAAI,OAAO,SAAS,IAAI,MAAM;CAC9B,IAAI,QAAQ,KAAK,MAAM,KAAK,IAAI,SAAS,GAAG,CAAC;CAC7C,IAAI,UAAU,KAAK,IAAI,SAAS,GAAG;AACnC,QAAO,OAAO,IAAI,MAAM,GAAG,MAAM,IAAI,QAAQ;CAE7C,SAAS,IAAI,GAAW;AACtB,SAAO,IAAI,KAAK,MAAM,IAAI,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"displayIdFormatter-
|
|
1
|
+
{"version":3,"file":"displayIdFormatter-Dz900Awr.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"}
|
package/dist/{extractRpcErrorMessage-C_UbKgHL.js.map → extractRpcErrorMessage-Di8E8-Wh.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractRpcErrorMessage-
|
|
1
|
+
{"version":3,"file":"extractRpcErrorMessage-Di8E8-Wh.js","names":[],"sources":["../src/utils/extractRpcErrorMessage.ts"],"sourcesContent":["/**\n * Extracts a user-friendly error message from RPC/API errors.\n * Handles various error shapes: Error instances, nested RPC payloads, etc.\n */\nexport function extractRpcErrorMessage(error: unknown, fallback = 'An unknown error occurred.'): string {\n if (error instanceof Error && error.message) {\n return error.message;\n }\n if (typeof error === 'object' && error !== null) {\n const obj = error as Record<string, unknown>;\n // RPC errors may nest: { error: { error_message: '...' } }\n const inner = obj.error as Record<string, unknown> | undefined;\n if (inner && typeof inner === 'object' && typeof inner.error_message === 'string') {\n return inner.error_message;\n }\n if (typeof obj.error_message === 'string') {\n return obj.error_message;\n }\n if (typeof obj.message === 'string') {\n return obj.message;\n }\n }\n return fallback;\n}\n"],"mappings":";;;;;AAIA,SAAgB,uBAAuB,OAAgB,WAAW,8BAAsC;AACtG,KAAI,iBAAiB,SAAS,MAAM,QAClC,QAAO,MAAM;AAEf,KAAI,OAAO,UAAU,YAAY,UAAU,MAAM;EAC/C,MAAM,MAAM;EAEZ,MAAM,QAAQ,IAAI;AAClB,MAAI,SAAS,OAAO,UAAU,YAAY,OAAO,MAAM,kBAAkB,SACvE,QAAO,MAAM;AAEf,MAAI,OAAO,IAAI,kBAAkB,SAC/B,QAAO,IAAI;AAEb,MAAI,OAAO,IAAI,YAAY,SACzB,QAAO,IAAI;;AAGf,QAAO"}
|