@burdenoff/microfe-support 2026.1029.2 → 2026.1031.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated/global-operations.js +1 -2
- package/dist/generated/global-operations.js.map +1 -1
- package/dist/generated/global-types.js +1 -2
- package/dist/generated/global-types.js.map +1 -1
- package/dist/node_modules/@tiptap/core/dist/index.js +701 -712
- package/dist/node_modules/@tiptap/core/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +1 -2
- package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js.map +1 -1
- package/dist/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js +1 -2
- package/dist/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js +15 -16
- package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-bold/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/extension-bold/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-code/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/extension-code/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +25 -26
- package/dist/node_modules/@tiptap/extension-code-block/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-document/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/extension-document/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-heading/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/extension-heading/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +16 -17
- package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-italic/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/extension-italic/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-link/dist/index.js +71 -80
- package/dist/node_modules/@tiptap/extension-link/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-list/dist/index.js +77 -90
- package/dist/node_modules/@tiptap/extension-list/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-strike/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/extension-strike/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-text/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/extension-text/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-underline/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/extension-underline/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extensions/dist/index.js +112 -113
- package/dist/node_modules/@tiptap/extensions/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/react/dist/index.js +5 -10
- package/dist/node_modules/@tiptap/react/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/starter-kit/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/starter-kit/dist/index.js.map +1 -1
- package/dist/node_modules/clsx/dist/clsx.js +1 -2
- package/dist/node_modules/clsx/dist/clsx.js.map +1 -1
- package/dist/node_modules/dompurify/dist/purify.es.js +357 -347
- package/dist/node_modules/dompurify/dist/purify.es.js.map +1 -1
- package/dist/node_modules/fast-equals/dist/es/index.js +1 -2
- package/dist/node_modules/fast-equals/dist/es/index.js.map +1 -1
- package/dist/node_modules/linkifyjs/dist/linkify.js +1 -2
- package/dist/node_modules/linkifyjs/dist/linkify.js.map +1 -1
- package/dist/node_modules/marked/lib/marked.esm.js +10 -70
- package/dist/node_modules/marked/lib/marked.esm.js.map +1 -1
- package/dist/node_modules/orderedmap/dist/index.js +1 -2
- package/dist/node_modules/orderedmap/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-commands/dist/index.js +107 -108
- package/dist/node_modules/prosemirror-commands/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-dropcursor/dist/index.js +12 -13
- package/dist/node_modules/prosemirror-dropcursor/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-gapcursor/dist/index.js +42 -47
- package/dist/node_modules/prosemirror-gapcursor/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-history/dist/index.js +47 -49
- package/dist/node_modules/prosemirror-history/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-keymap/dist/index.js +15 -16
- package/dist/node_modules/prosemirror-keymap/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-model/dist/index.js +37 -41
- package/dist/node_modules/prosemirror-model/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-schema-list/dist/index.js +36 -37
- package/dist/node_modules/prosemirror-schema-list/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-state/dist/index.js +1 -2
- package/dist/node_modules/prosemirror-state/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-transform/dist/index.js +1 -2
- package/dist/node_modules/prosemirror-transform/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-view/dist/index.js +302 -304
- package/dist/node_modules/prosemirror-view/dist/index.js.map +1 -1
- package/dist/node_modules/rope-sequence/dist/index.js +1 -2
- package/dist/node_modules/rope-sequence/dist/index.js.map +1 -1
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +4 -21
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -1
- package/dist/node_modules/w3c-keyname/index.js +0 -1
- package/dist/node_modules/w3c-keyname/index.js.map +1 -1
- package/dist/support/SupportAdminRoot.js +14 -15
- package/dist/support/SupportAdminRoot.js.map +1 -1
- package/dist/support/SupportAdminRoutes.js +5 -6
- package/dist/support/SupportAdminRoutes.js.map +1 -1
- package/dist/support/SupportUserRoot.js +10 -11
- package/dist/support/SupportUserRoot.js.map +1 -1
- package/dist/support/SupportUserRoutes.js +1 -2
- package/dist/support/SupportUserRoutes.js.map +1 -1
- package/dist/support/components/NotificationToast.js +1 -2
- package/dist/support/components/NotificationToast.js.map +1 -1
- package/dist/support/components/PageLayout.js +15 -16
- package/dist/support/components/PageLayout.js.map +1 -1
- package/dist/support/components/RouteHelpers.js +1 -2
- package/dist/support/components/RouteHelpers.js.map +1 -1
- package/dist/support/components/analytics/CategoryBreakdown.js +9 -10
- package/dist/support/components/analytics/CategoryBreakdown.js.map +1 -1
- package/dist/support/components/analytics/MetricCard.js +1 -2
- package/dist/support/components/analytics/MetricCard.js.map +1 -1
- package/dist/support/components/analytics/PriorityBreakdown.js +9 -10
- package/dist/support/components/analytics/PriorityBreakdown.js.map +1 -1
- package/dist/support/components/analytics/SLAReport.js +5 -6
- package/dist/support/components/analytics/SLAReport.js.map +1 -1
- package/dist/support/components/analytics/SatisfactionDistribution.js +5 -6
- package/dist/support/components/analytics/SatisfactionDistribution.js.map +1 -1
- package/dist/support/components/analytics/TopAgents.js +5 -6
- package/dist/support/components/analytics/TopAgents.js.map +1 -1
- package/dist/support/components/analytics/TrendChart.js +5 -6
- package/dist/support/components/analytics/TrendChart.js.map +1 -1
- package/dist/support/components/careers/BulkCandidateActionGuidance.js +1 -2
- package/dist/support/components/careers/BulkCandidateActionGuidance.js.map +1 -1
- package/dist/support/components/careers/BulkCandidateDialogs.js +321 -322
- package/dist/support/components/careers/BulkCandidateDialogs.js.map +1 -1
- package/dist/support/components/careers/BulkOperationFeedback.js +1 -2
- package/dist/support/components/careers/BulkOperationFeedback.js.map +1 -1
- package/dist/support/components/careers/BulkSelectionSummary.js +1 -2
- package/dist/support/components/careers/BulkSelectionSummary.js.map +1 -1
- package/dist/support/components/careers/JobApplicationFilterContextGuard.js +1 -2
- package/dist/support/components/careers/JobApplicationFilterContextGuard.js.map +1 -1
- package/dist/support/components/careers/RichTextEditor.js +17 -18
- package/dist/support/components/careers/RichTextEditor.js.map +1 -1
- package/dist/support/components/kb/ArticleForm.js +10 -11
- package/dist/support/components/kb/ArticleForm.js.map +1 -1
- package/dist/support/components/settings/CannedResponsesSettings.js +2 -3
- package/dist/support/components/settings/CannedResponsesSettings.js.map +1 -1
- package/dist/support/components/settings/SLAPoliciesSettings.js +1 -2
- package/dist/support/components/settings/SLAPoliciesSettings.js.map +1 -1
- package/dist/support/components/settings/TicketCategoriesSettings.js +3 -8
- package/dist/support/components/settings/TicketCategoriesSettings.js.map +1 -1
- package/dist/support/components/tickets/AttachmentList.js +4 -5
- package/dist/support/components/tickets/AttachmentList.js.map +1 -1
- package/dist/support/components/tickets/MarkdownContent.js +1 -2
- package/dist/support/components/tickets/MarkdownContent.js.map +1 -1
- package/dist/support/components/tickets/MessageComposer.js +1 -2
- package/dist/support/components/tickets/MessageComposer.js.map +1 -1
- package/dist/support/components/tickets/MessageThread.js +13 -14
- package/dist/support/components/tickets/MessageThread.js.map +1 -1
- package/dist/support/components/tickets/TicketDetailHeader.js +13 -14
- package/dist/support/components/tickets/TicketDetailHeader.js.map +1 -1
- package/dist/support/components/tickets/TicketHeader.js +1 -2
- package/dist/support/components/tickets/TicketHeader.js.map +1 -1
- package/dist/support/components/tickets/TicketSidebar.js +6 -7
- package/dist/support/components/tickets/TicketSidebar.js.map +1 -1
- package/dist/support/components/tickets/TriagePanel.js +25 -26
- package/dist/support/components/tickets/TriagePanel.js.map +1 -1
- package/dist/support/components/ui.js +1 -2
- package/dist/support/constants/pipeline.js +1 -2
- package/dist/support/constants/pipeline.js.map +1 -1
- package/dist/support/constants.js +1 -2
- package/dist/support/constants.js.map +1 -1
- package/dist/support/events/rybbit.js +1 -2
- package/dist/support/events/rybbit.js.map +1 -1
- package/dist/support/hooks/index.js +6 -6
- package/dist/support/hooks/useAnalyticsOperations.js +1 -2
- package/dist/support/hooks/useAnalyticsOperations.js.map +1 -1
- package/dist/support/hooks/useAttachmentsFailedToast.js +1 -2
- package/dist/support/hooks/useAttachmentsFailedToast.js.map +1 -1
- package/dist/support/hooks/useChatOperations.js +14 -15
- package/dist/support/hooks/useChatOperations.js.map +1 -1
- package/dist/support/hooks/useDebouncedUrlText.js +1 -2
- package/dist/support/hooks/useDebouncedUrlText.js.map +1 -1
- package/dist/support/hooks/useKnowledgeBaseOperations.js +62 -63
- package/dist/support/hooks/useKnowledgeBaseOperations.js.map +1 -1
- package/dist/support/hooks/useNotification.js +1 -2
- package/dist/support/hooks/useNotification.js.map +1 -1
- package/dist/support/hooks/useRegisterFooter.js +1 -2
- package/dist/support/hooks/useRegisterFooter.js.map +1 -1
- package/dist/support/hooks/useSettingsOperations.js +1 -2
- package/dist/support/hooks/useSettingsOperations.js.map +1 -1
- package/dist/support/hooks/useSupportAttachments.js +1 -2
- package/dist/support/hooks/useSupportAttachments.js.map +1 -1
- package/dist/support/hooks/useTicketListOperations.js +9 -10
- package/dist/support/hooks/useTicketListOperations.js.map +1 -1
- package/dist/support/hooks/useTicketOperations.d.ts +8 -0
- package/dist/support/hooks/useTicketOperations.js +92 -93
- package/dist/support/hooks/useTicketOperations.js.map +1 -1
- package/dist/support/hooks/useTr.js +1 -2
- package/dist/support/hooks/useTr.js.map +1 -1
- package/dist/support/index.js +4 -4
- package/dist/support/pages/AnalyticsPage.js +34 -35
- package/dist/support/pages/AnalyticsPage.js.map +1 -1
- package/dist/support/pages/ArticleDetailAdminPage.js +33 -38
- package/dist/support/pages/ArticleDetailAdminPage.js.map +1 -1
- package/dist/support/pages/ArticleDetailUserPage.js +22 -23
- package/dist/support/pages/ArticleDetailUserPage.js.map +1 -1
- package/dist/support/pages/ContactInquiriesPage.js +5 -6
- package/dist/support/pages/ContactInquiriesPage.js.map +1 -1
- package/dist/support/pages/ContactInquiryDetailPage.js +13 -14
- package/dist/support/pages/ContactInquiryDetailPage.js.map +1 -1
- package/dist/support/pages/CreateArticlePage.js +15 -16
- package/dist/support/pages/CreateArticlePage.js.map +1 -1
- package/dist/support/pages/CreateTicketPage.js +37 -44
- package/dist/support/pages/CreateTicketPage.js.map +1 -1
- package/dist/support/pages/EditArticlePage.js +20 -21
- package/dist/support/pages/EditArticlePage.js.map +1 -1
- package/dist/support/pages/InterviewersPage.js +121 -122
- package/dist/support/pages/InterviewersPage.js.map +1 -1
- package/dist/support/pages/JobApplicationDetailPage.js +322 -332
- package/dist/support/pages/JobApplicationDetailPage.js.map +1 -1
- package/dist/support/pages/JobApplicationsPage.js +556 -561
- package/dist/support/pages/JobApplicationsPage.js.map +1 -1
- package/dist/support/pages/JobPostingDetailPage.js +489 -490
- package/dist/support/pages/JobPostingDetailPage.js.map +1 -1
- package/dist/support/pages/JobPostingsPage.js +279 -280
- package/dist/support/pages/JobPostingsPage.js.map +1 -1
- package/dist/support/pages/KnowledgeBaseAdminPage.js +26 -27
- package/dist/support/pages/KnowledgeBaseAdminPage.js.map +1 -1
- package/dist/support/pages/KnowledgeBaseUserPage.js +23 -24
- package/dist/support/pages/KnowledgeBaseUserPage.js.map +1 -1
- package/dist/support/pages/SettingsPage.js +43 -44
- package/dist/support/pages/SettingsPage.js.map +1 -1
- package/dist/support/pages/TicketDetailAdminPage.js +54 -55
- package/dist/support/pages/TicketDetailAdminPage.js.map +1 -1
- package/dist/support/pages/TicketDetailUserPage.js +61 -62
- package/dist/support/pages/TicketDetailUserPage.js.map +1 -1
- package/dist/support/pages/TicketListPage.js +77 -78
- package/dist/support/pages/TicketListPage.js.map +1 -1
- package/dist/support/providers/SupportProvider.js +1 -2
- package/dist/support/providers/SupportProvider.js.map +1 -1
- package/dist/support/store/supportStore.js +1 -2
- package/dist/support/store/supportStore.js.map +1 -1
- package/dist/support/translations/en.js +1 -2
- package/dist/support/translations/en.js.map +1 -1
- package/dist/support/utils/attachments.js +1 -2
- package/dist/support/utils/attachments.js.map +1 -1
- package/dist/support/utils/breadcrumbRegistry.js +3 -4
- package/dist/support/utils/breadcrumbRegistry.js.map +1 -1
- package/dist/support/utils/bulkCandidateOperations.js +0 -1
- package/dist/support/utils/bulkCandidateOperations.js.map +1 -1
- package/dist/support/utils/bulkCandidateTargetQuery.js +1 -2
- package/dist/support/utils/bulkCandidateTargetQuery.js.map +1 -1
- package/dist/support/utils/categoryColors.js +1 -2
- package/dist/support/utils/categoryColors.js.map +1 -1
- package/dist/support/utils/cn.js +1 -2
- package/dist/support/utils/cn.js.map +1 -1
- package/dist/support/utils/context.js +3 -4
- package/dist/support/utils/context.js.map +1 -1
- package/dist/support/utils/errors.js +1 -2
- package/dist/support/utils/errors.js.map +1 -1
- package/dist/support/utils/i18n.js +1 -2
- package/dist/support/utils/i18n.js.map +1 -1
- package/dist/support/utils/index.js +1 -2
- package/dist/support/utils/index.js.map +1 -1
- package/dist/support/utils/jobApplicationFilterParams.js +1 -2
- package/dist/support/utils/jobApplicationFilterParams.js.map +1 -1
- package/dist/support/utils/markdown.js +1 -2
- package/dist/support/utils/markdown.js.map +1 -1
- package/dist/support/utils/supportFiles.js +2 -11
- package/dist/support/utils/supportFiles.js.map +1 -1
- package/dist/support/utils/ticketFilters.js +1 -2
- package/dist/support/utils/ticketFilters.js.map +1 -1
- package/dist/support/utils/uiTokens.js +1 -2
- package/dist/support/utils/uiTokens.js.map +1 -1
- package/dist/utils/nativeBridge.js +1 -2
- package/package.json +21 -14
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
|
|
2
|
-
|
|
2
|
+
// src/support/hooks/useNotification.ts
|
|
3
3
|
var i = 4e3;
|
|
4
4
|
function a() {
|
|
5
5
|
let [a, o] = r(null), s = n(null), c = e(() => {
|
|
@@ -20,7 +20,6 @@ function a() {
|
|
|
20
20
|
dismiss: l
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
//#endregion
|
|
24
23
|
export { a as useNotification };
|
|
25
24
|
|
|
26
25
|
//# sourceMappingURL=useNotification.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotification.js","names":[],"sources":["../../../src/support/hooks/useNotification.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nexport type NotificationType = 'success' | 'error' | 'info';\n\nexport interface NotificationState {\n type: NotificationType;\n message: string;\n}\n\nexport interface UseNotificationApi {\n notification: NotificationState | null;\n notify: (type: NotificationType, message: string, durationMs?: number) => void;\n dismiss: () => void;\n}\n\nconst DEFAULT_DURATION_MS = 4000;\n\n/**\n * Single-slot notification toast with timer coalescing.\n *\n * Back-to-back `notify()` calls cancel the previous auto-dismiss timer so a\n * slow earlier toast cannot wipe out a fresher one. The timer is also cleared\n * on unmount to avoid a setState-after-unmount warning when the user navigates\n * away mid-toast. A single `duration` of `Infinity` keeps the toast until the\n * caller dismisses it manually or a new `notify()` supersedes it.\n */\nexport function useNotification(): UseNotificationApi {\n const [notification, setNotification] = useState<NotificationState | null>(null);\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const clearTimer = useCallback((): void => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n timerRef.current = null;\n }\n }, []);\n\n const dismiss = useCallback((): void => {\n clearTimer();\n setNotification(null);\n }, [clearTimer]);\n\n const notify = useCallback(\n (type: NotificationType, message: string, durationMs: number = DEFAULT_DURATION_MS): void => {\n clearTimer();\n setNotification({ type, message });\n if (Number.isFinite(durationMs) && durationMs > 0) {\n timerRef.current = setTimeout(() => {\n setNotification(null);\n timerRef.current = null;\n }, durationMs);\n }\n },\n [clearTimer]\n );\n\n useEffect(() => clearTimer, [clearTimer]);\n\n return { notification, notify, dismiss };\n}\n"],"mappings":";;AAeA,
|
|
1
|
+
{"version":3,"file":"useNotification.js","names":["DEFAULT_DURATION_MS","useNotification","notification","setNotification","useState","timerRef","useRef","clearTimer","useCallback","dismiss","notify","durationMs","useEffect"],"sources":["../../../src/support/hooks/useNotification.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nexport type NotificationType = 'success' | 'error' | 'info';\n\nexport interface NotificationState {\n type: NotificationType;\n message: string;\n}\n\nexport interface UseNotificationApi {\n notification: NotificationState | null;\n notify: (type: NotificationType, message: string, durationMs?: number) => void;\n dismiss: () => void;\n}\n\nconst DEFAULT_DURATION_MS = 4000;\n\n/**\n * Single-slot notification toast with timer coalescing.\n *\n * Back-to-back `notify()` calls cancel the previous auto-dismiss timer so a\n * slow earlier toast cannot wipe out a fresher one. The timer is also cleared\n * on unmount to avoid a setState-after-unmount warning when the user navigates\n * away mid-toast. A single `duration` of `Infinity` keeps the toast until the\n * caller dismisses it manually or a new `notify()` supersedes it.\n */\nexport function useNotification(): UseNotificationApi {\n const [notification, setNotification] = useState<NotificationState | null>(null);\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const clearTimer = useCallback((): void => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n timerRef.current = null;\n }\n }, []);\n\n const dismiss = useCallback((): void => {\n clearTimer();\n setNotification(null);\n }, [clearTimer]);\n\n const notify = useCallback(\n (type: NotificationType, message: string, durationMs: number = DEFAULT_DURATION_MS): void => {\n clearTimer();\n setNotification({ type, message });\n if (Number.isFinite(durationMs) && durationMs > 0) {\n timerRef.current = setTimeout(() => {\n setNotification(null);\n timerRef.current = null;\n }, durationMs);\n }\n },\n [clearTimer]\n );\n\n useEffect(() => clearTimer, [clearTimer]);\n\n return { notification, notify, dismiss };\n}\n"],"mappings":";;AAeA,IAAMA,IAAsB;AAW5B,SAAgBC,IAAsC;CACpD,IAAM,CAACC,GAAcC,KAAmBC,EAAmC,IAAI,GACzEC,IAAWC,EAA6C,IAAI,GAE5DC,IAAaC,QAAwB;EACzC,AAEEH,EAAS,aADT,aAAaA,EAAS,OAAO,GACV;CAEvB,GAAG,CAAC,CAAC,GAECI,IAAUD,QAAwB;EAEtC,AADAD,EAAW,GACXJ,EAAgB,IAAI;CACtB,GAAG,CAACI,CAAU,CAAC,GAETG,IAASF,GACZ,GAAwB,GAAiB,IAAqBR,MAA8B;EAG3F,AAFAO,EAAW,GACXJ,EAAgB;GAAE;GAAM;EAAQ,CAAC,GAC7B,OAAO,SAASQ,CAAU,KAAKA,IAAa,MAC9C,EAAS,UAAU,iBAAiB;GAElC,AADAR,EAAgB,IAAI,GACpB,EAAS,UAAU;EACrB,GAAGQ,CAAU;CAEjB,GACA,CAACJ,CAAU,CACb;CAIA,OAFAK,QAAgBL,GAAY,CAACA,CAAU,CAAC,GAEjC;EAAE;EAAc;EAAQ;CAAQ;AACzC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect as e } from "react";
|
|
2
2
|
import { useI18n as t } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
3
|
-
|
|
3
|
+
// src/support/hooks/useRegisterFooter.ts
|
|
4
4
|
function n(n) {
|
|
5
5
|
let { t: r } = t(), i = (e, t) => {
|
|
6
6
|
let n = r(e);
|
|
@@ -16,7 +16,6 @@ function n(n) {
|
|
|
16
16
|
}]);
|
|
17
17
|
}, [n, r]);
|
|
18
18
|
}
|
|
19
|
-
//#endregion
|
|
20
19
|
export { n as useRegisterFooter };
|
|
21
20
|
|
|
22
21
|
//# sourceMappingURL=useRegisterFooter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRegisterFooter.js","names":[],"sources":["../../../src/support/hooks/useRegisterFooter.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport type { FooterItem } from '../types';\n\n/**\n * Shared hook for registering the support footer status indicator.\n * Used by SupportUserRoot, SupportAdminRoot, and SupportRoot.\n */\nexport function useRegisterFooter(\n registerFooterItems?: (items: FooterItem | FooterItem[]) => () => void\n) {\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const translated = t(key);\n return translated === key ? fallback : translated;\n };\n useEffect(() => {\n if (!registerFooterItems) return;\n\n const footerItems = [\n {\n id: 'support-status',\n label: tr('support.footer.ready', 'Support Ready'),\n type: 'status' as const,\n order: 10,\n section: 'left' as const,\n },\n ];\n\n const cleanup = registerFooterItems(footerItems);\n return cleanup;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [registerFooterItems, t]);\n}\n"],"mappings":";;;AAQA,
|
|
1
|
+
{"version":3,"file":"useRegisterFooter.js","names":["useRegisterFooter","useI18n","tr","translated","t","key","fallback","registerFooterItems"],"sources":["../../../src/support/hooks/useRegisterFooter.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport type { FooterItem } from '../types';\n\n/**\n * Shared hook for registering the support footer status indicator.\n * Used by SupportUserRoot, SupportAdminRoot, and SupportRoot.\n */\nexport function useRegisterFooter(\n registerFooterItems?: (items: FooterItem | FooterItem[]) => () => void\n) {\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const translated = t(key);\n return translated === key ? fallback : translated;\n };\n useEffect(() => {\n if (!registerFooterItems) return;\n\n const footerItems = [\n {\n id: 'support-status',\n label: tr('support.footer.ready', 'Support Ready'),\n type: 'status' as const,\n order: 10,\n section: 'left' as const,\n },\n ];\n\n const cleanup = registerFooterItems(footerItems);\n return cleanup;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [registerFooterItems, t]);\n}\n"],"mappings":";;;AAQA,SAAgBA,EACd,GACA;CACA,IAAM,EAAE,SAAMC,EAAQ,GAChBC,KAAM,GAAa,MAA6B;EACpD,IAAMC,IAAaC,EAAEC,CAAG;EACxB,OAAOF,MAAeE,IAAMC,IAAWH;CACzC;CACA,QAAgB;EACd,IAAKI,GAaL,OADgBA,EAAoB,CATlC;GACE,IAAI;GACJ,OAAOL,EAAG,wBAAwB,eAAe;GACjD,MAAM;GACN,OAAO;GACP,SAAS;EACX,CAGkC,CAC7B;CAET,GAAG,CAACK,GAAqBH,CAAC,CAAC;AAC7B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCreateCannedResponseMutation as e, useCreateSlaPolicyMutation as t, useCreateTicketCategoryMutation as n, useDeleteCannedResponseMutation as r, useDeleteSlaPolicyMutation as i, useDeleteTicketCategoryMutation as a, useGetCannedResponsesQuery as o, useGetSlaPoliciesQuery as s, useGetTicketCategoriesQuery as c, useUpdateCannedResponseMutation as l, useUpdateSlaPolicyMutation as u, useUpdateTicketCategoryMutation as d } from "../../generated/global-operations.js";
|
|
2
|
-
|
|
2
|
+
// src/support/hooks/useSettingsOperations.ts
|
|
3
3
|
function f() {
|
|
4
4
|
let { data: f, loading: p, error: m, refetch: h } = s({ variables: { limit: 50 } }), { data: g, loading: _, error: v, refetch: y } = o({ variables: { limit: 100 } }), { data: b, loading: x, error: S, refetch: C } = c({ variables: { limit: 50 } }), [w, { loading: T }] = t({
|
|
5
5
|
onCompleted: () => {
|
|
@@ -145,7 +145,6 @@ function f() {
|
|
|
145
145
|
refetchCategories: C
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
|
-
//#endregion
|
|
149
148
|
export { f as useSettingsOperations };
|
|
150
149
|
|
|
151
150
|
//# sourceMappingURL=useSettingsOperations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSettingsOperations.js","names":[],"sources":["../../../src/support/hooks/useSettingsOperations.ts"],"sourcesContent":["import {\n useGetSlaPoliciesQuery,\n useCreateSlaPolicyMutation,\n useUpdateSlaPolicyMutation,\n useDeleteSlaPolicyMutation,\n useGetCannedResponsesQuery,\n useCreateCannedResponseMutation,\n useUpdateCannedResponseMutation,\n useDeleteCannedResponseMutation,\n useGetTicketCategoriesQuery,\n useCreateTicketCategoryMutation,\n useUpdateTicketCategoryMutation,\n useDeleteTicketCategoryMutation,\n} from '../../generated/global-operations';\nimport type {\n CreateSlaPolicyInput,\n UpdateSlaPolicyInput,\n CreateCannedResponseInput,\n UpdateCannedResponseInput,\n CreateTicketCategoryInput,\n UpdateTicketCategoryInput,\n} from '../../generated/global-types';\n\n// Re-export input types for consumers\nexport type {\n CreateSlaPolicyInput,\n UpdateSlaPolicyInput,\n CreateCannedResponseInput,\n UpdateCannedResponseInput,\n CreateTicketCategoryInput,\n UpdateTicketCategoryInput,\n};\n\nexport function useSettingsOperations() {\n // Query: Get SLA policies\n const {\n data: slaPoliciesData,\n loading: slaPoliciesLoading,\n error: slaPoliciesError,\n refetch: refetchSLAPolicies,\n } = useGetSlaPoliciesQuery({\n variables: { limit: 50 },\n });\n\n // Query: Get canned responses\n const {\n data: cannedResponsesData,\n loading: cannedResponsesLoading,\n error: cannedResponsesError,\n refetch: refetchCannedResponses,\n } = useGetCannedResponsesQuery({\n variables: { limit: 100 },\n });\n\n // Query: Get ticket categories\n const {\n data: categoriesData,\n loading: categoriesLoading,\n error: categoriesError,\n refetch: refetchCategories,\n } = useGetTicketCategoriesQuery({\n variables: { limit: 50 },\n });\n\n // Mutation: Create SLA policy\n const [createSLAPolicyMutation, { loading: createSLAPolicyLoading }] = useCreateSlaPolicyMutation(\n {\n onCompleted: () => {\n refetchSLAPolicies();\n },\n onError: (error) => {\n console.error('Failed to create SLA policy:', error);\n },\n }\n );\n\n // Mutation: Update SLA policy\n const [updateSLAPolicyMutation, { loading: updateSLAPolicyLoading }] = useUpdateSlaPolicyMutation(\n {\n onCompleted: () => {\n refetchSLAPolicies();\n },\n onError: (error) => {\n console.error('Failed to update SLA policy:', error);\n },\n }\n );\n\n // Mutation: Delete SLA policy\n const [deleteSLAPolicyMutation, { loading: deleteSLAPolicyLoading }] = useDeleteSlaPolicyMutation(\n {\n onCompleted: () => {\n refetchSLAPolicies();\n },\n onError: (error) => {\n console.error('Failed to delete SLA policy:', error);\n },\n }\n );\n\n // Mutation: Create canned response\n const [createCannedResponseMutation, { loading: createCannedResponseLoading }] =\n useCreateCannedResponseMutation({\n onCompleted: () => {\n refetchCannedResponses();\n },\n onError: (error) => {\n console.error('Failed to create canned response:', error);\n },\n });\n\n // Mutation: Update canned response\n const [updateCannedResponseMutation, { loading: updateCannedResponseLoading }] =\n useUpdateCannedResponseMutation({\n onCompleted: () => {\n refetchCannedResponses();\n },\n onError: (error) => {\n console.error('Failed to update canned response:', error);\n },\n });\n\n // Mutation: Delete canned response\n const [deleteCannedResponseMutation, { loading: deleteCannedResponseLoading }] =\n useDeleteCannedResponseMutation({\n onCompleted: () => {\n refetchCannedResponses();\n },\n onError: (error) => {\n console.error('Failed to delete canned response:', error);\n },\n });\n\n // Mutation: Create ticket category\n const [createTicketCategoryMutation, { loading: createCategoryLoading }] =\n useCreateTicketCategoryMutation({\n onCompleted: () => {\n refetchCategories();\n },\n onError: (error) => {\n console.error('Failed to create category:', error);\n },\n });\n\n // Mutation: Update ticket category\n const [updateTicketCategoryMutation, { loading: updateCategoryLoading }] =\n useUpdateTicketCategoryMutation({\n onCompleted: () => {\n refetchCategories();\n },\n onError: (error) => {\n console.error('Failed to update category:', error);\n },\n });\n\n // Mutation: Delete ticket category\n const [deleteTicketCategoryMutation, { loading: deleteCategoryLoading }] =\n useDeleteTicketCategoryMutation({\n onCompleted: () => {\n refetchCategories();\n },\n onError: (error) => {\n console.error('Failed to delete category:', error);\n },\n });\n\n // Helper: Create SLA policy\n const createSLAPolicy = async (input: CreateSlaPolicyInput) => {\n const result = await createSLAPolicyMutation({\n variables: { input },\n });\n if (!result.data?.createSLAPolicy) {\n throw new Error('Failed to create SLA policy');\n }\n await refetchSLAPolicies();\n return result.data.createSLAPolicy;\n };\n\n // Helper: Update SLA policy\n const updateSLAPolicy = async (id: string, input: UpdateSlaPolicyInput) => {\n const result = await updateSLAPolicyMutation({\n variables: { id, input },\n });\n if (!result.data?.updateSLAPolicy) {\n throw new Error('Failed to update SLA policy');\n }\n await refetchSLAPolicies();\n return result.data.updateSLAPolicy;\n };\n\n // Helper: Delete SLA policy\n const deleteSLAPolicy = async (id: string) => {\n const result = await deleteSLAPolicyMutation({\n variables: { id },\n });\n await refetchSLAPolicies();\n return result.data?.deleteSLAPolicy;\n };\n\n // Helper: Create canned response\n const createCannedResponse = async (input: CreateCannedResponseInput) => {\n const result = await createCannedResponseMutation({\n variables: { input },\n });\n if (!result.data?.createCannedResponse) {\n throw new Error('Failed to create canned response');\n }\n await refetchCannedResponses();\n return result.data.createCannedResponse;\n };\n\n // Helper: Update canned response\n const updateCannedResponse = async (id: string, input: UpdateCannedResponseInput) => {\n const result = await updateCannedResponseMutation({\n variables: { id, input },\n });\n if (!result.data?.updateCannedResponse) {\n throw new Error('Failed to update canned response');\n }\n await refetchCannedResponses();\n return result.data.updateCannedResponse;\n };\n\n // Helper: Delete canned response\n const deleteCannedResponse = async (id: string) => {\n const result = await deleteCannedResponseMutation({\n variables: { id },\n });\n await refetchCannedResponses();\n return result.data?.deleteCannedResponse;\n };\n\n // Helper: Create ticket category\n const createTicketCategory = async (input: CreateTicketCategoryInput) => {\n const result = await createTicketCategoryMutation({\n variables: { input },\n });\n if (!result.data?.createTicketCategory) {\n throw new Error('Failed to create category');\n }\n await refetchCategories();\n return result.data.createTicketCategory;\n };\n\n // Helper: Update ticket category\n const updateTicketCategory = async (id: string, input: UpdateTicketCategoryInput) => {\n const result = await updateTicketCategoryMutation({\n variables: { id, input },\n });\n if (!result.data?.updateTicketCategory) {\n throw new Error('Failed to update category');\n }\n await refetchCategories();\n return result.data.updateTicketCategory;\n };\n\n // Helper: Delete ticket category\n const deleteTicketCategory = async (id: string) => {\n const result = await deleteTicketCategoryMutation({\n variables: { id },\n });\n if (\n result.data?.deleteTicketCategory === undefined ||\n result.data?.deleteTicketCategory === null\n ) {\n throw new Error('Failed to delete category');\n }\n await refetchCategories();\n return result.data.deleteTicketCategory;\n };\n\n return {\n // Data\n slaPolicies: slaPoliciesData?.slaPolicies?.nodes || [],\n totalSLAPolicies: slaPoliciesData?.slaPolicies?.totalCount || 0,\n cannedResponses: cannedResponsesData?.cannedResponses?.nodes || [],\n totalCannedResponses: cannedResponsesData?.cannedResponses?.totalCount || 0,\n ticketCategories: categoriesData?.ticketCategories?.nodes || [],\n totalCategories: categoriesData?.ticketCategories?.totalCount || 0,\n\n // Loading states\n slaPoliciesLoading,\n cannedResponsesLoading,\n categoriesLoading,\n createSLAPolicyLoading,\n updateSLAPolicyLoading,\n deleteSLAPolicyLoading,\n createCannedResponseLoading,\n updateCannedResponseLoading,\n deleteCannedResponseLoading,\n createCategoryLoading,\n updateCategoryLoading,\n deleteCategoryLoading,\n isLoading: slaPoliciesLoading || cannedResponsesLoading || categoriesLoading,\n\n // Errors\n slaPoliciesError,\n cannedResponsesError,\n categoriesError,\n\n // SLA Policy Operations\n createSLAPolicy,\n updateSLAPolicy,\n deleteSLAPolicy,\n refetchSLAPolicies,\n\n // Canned Response Operations\n createCannedResponse,\n updateCannedResponse,\n deleteCannedResponse,\n refetchCannedResponses,\n\n // Ticket Category Operations\n createTicketCategory,\n updateTicketCategory,\n deleteTicketCategory,\n refetchCategories,\n };\n}\n"],"mappings":";;AAiCA,SAAgB,IAAwB;CAEtC,IAAM,EACJ,MAAM,GACN,SAAS,GACT,OAAO,GACP,SAAS,MACP,EAAuB,EACzB,WAAW,EAAE,OAAO,GAAG,EACzB,CAAC,GAGK,EACJ,MAAM,GACN,SAAS,GACT,OAAO,GACP,SAAS,MACP,EAA2B,EAC7B,WAAW,EAAE,OAAO,IAAI,EAC1B,CAAC,GAGK,EACJ,MAAM,GACN,SAAS,GACT,OAAO,GACP,SAAS,MACP,EAA4B,EAC9B,WAAW,EAAE,OAAO,GAAG,EACzB,CAAC,GAGK,CAAC,GAAyB,EAAE,SAAS,OAA4B,EACrE;EACE,mBAAmB;GACjB,EAAmB;EACrB;EACA,UAAU,MAAU;GAClB,QAAQ,MAAM,gCAAgC,CAAK;EACrD;CACF,CACF,GAGM,CAAC,GAAyB,EAAE,SAAS,OAA4B,EACrE;EACE,mBAAmB;GACjB,EAAmB;EACrB;EACA,UAAU,MAAU;GAClB,QAAQ,MAAM,gCAAgC,CAAK;EACrD;CACF,CACF,GAGM,CAAC,GAAyB,E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;EAGA,6BAhFkC,MAAqC;GACvE,IAAM,IAAS,MAAM,EAA6B,EAChD,WAAW,EAAE,SAAM,EACrB,CAAC;GACD,IAAI,CAAC,EAAO,MAAM,sBAChB,MAAU,MAAM,2BAA2B;GAG7C,OADA,MAAM,EAAkB,GACjB,EAAO,KAAK;EACrB;EAwEE,6BArEkC,GAAY,MAAqC;GACnF,IAAM,IAAS,MAAM,EAA6B,EAChD,WAAW;IAAE;IAAI;GAAM,EACzB,CAAC;GACD,IAAI,CAAC,EAAO,MAAM,sBAChB,MAAU,MAAM,2BAA2B;GAG7C,OADA,MAAM,EAAkB,GACjB,EAAO,KAAK;EACrB;EA6DE,6BA1DkC,MAAe;GACjD,IAAM,IAAS,MAAM,EAA6B,EAChD,WAAW,EAAE,MAAG,EAClB,CAAC;GACD,IACE,EAAO,MAAM,yBAAyB,KAAA,KACtC,EAAO,MAAM,yBAAyB,MAEtC,MAAU,MAAM,2BAA2B;GAG7C,OADA,MAAM,EAAkB,GACjB,EAAO,KAAK;EACrB;EA+CE;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"useSettingsOperations.js","names":["useSettingsOperations","slaPoliciesData","slaPoliciesLoading","slaPoliciesError","refetchSLAPolicies","useGetSlaPoliciesQuery","cannedResponsesData","cannedResponsesLoading","cannedResponsesError","refetchCannedResponses","useGetCannedResponsesQuery","categoriesData","categoriesLoading","categoriesError","refetchCategories","useGetTicketCategoriesQuery","createSLAPolicyMutation","createSLAPolicyLoading","useCreateSlaPolicyMutation","error","updateSLAPolicyMutation","updateSLAPolicyLoading","useUpdateSlaPolicyMutation","deleteSLAPolicyMutation","deleteSLAPolicyLoading","useDeleteSlaPolicyMutation","createCannedResponseMutation","createCannedResponseLoading","useCreateCannedResponseMutation","updateCannedResponseMutation","updateCannedResponseLoading","useUpdateCannedResponseMutation","deleteCannedResponseMutation","deleteCannedResponseLoading","useDeleteCannedResponseMutation","createTicketCategoryMutation","createCategoryLoading","useCreateTicketCategoryMutation","updateTicketCategoryMutation","updateCategoryLoading","useUpdateTicketCategoryMutation","deleteTicketCategoryMutation","deleteCategoryLoading","useDeleteTicketCategoryMutation","result"],"sources":["../../../src/support/hooks/useSettingsOperations.ts"],"sourcesContent":["import {\n useGetSlaPoliciesQuery,\n useCreateSlaPolicyMutation,\n useUpdateSlaPolicyMutation,\n useDeleteSlaPolicyMutation,\n useGetCannedResponsesQuery,\n useCreateCannedResponseMutation,\n useUpdateCannedResponseMutation,\n useDeleteCannedResponseMutation,\n useGetTicketCategoriesQuery,\n useCreateTicketCategoryMutation,\n useUpdateTicketCategoryMutation,\n useDeleteTicketCategoryMutation,\n} from '../../generated/global-operations';\nimport type {\n CreateSlaPolicyInput,\n UpdateSlaPolicyInput,\n CreateCannedResponseInput,\n UpdateCannedResponseInput,\n CreateTicketCategoryInput,\n UpdateTicketCategoryInput,\n} from '../../generated/global-types';\n\n// Re-export input types for consumers\nexport type {\n CreateSlaPolicyInput,\n UpdateSlaPolicyInput,\n CreateCannedResponseInput,\n UpdateCannedResponseInput,\n CreateTicketCategoryInput,\n UpdateTicketCategoryInput,\n};\n\nexport function useSettingsOperations() {\n // Query: Get SLA policies\n const {\n data: slaPoliciesData,\n loading: slaPoliciesLoading,\n error: slaPoliciesError,\n refetch: refetchSLAPolicies,\n } = useGetSlaPoliciesQuery({\n variables: { limit: 50 },\n });\n\n // Query: Get canned responses\n const {\n data: cannedResponsesData,\n loading: cannedResponsesLoading,\n error: cannedResponsesError,\n refetch: refetchCannedResponses,\n } = useGetCannedResponsesQuery({\n variables: { limit: 100 },\n });\n\n // Query: Get ticket categories\n const {\n data: categoriesData,\n loading: categoriesLoading,\n error: categoriesError,\n refetch: refetchCategories,\n } = useGetTicketCategoriesQuery({\n variables: { limit: 50 },\n });\n\n // Mutation: Create SLA policy\n const [createSLAPolicyMutation, { loading: createSLAPolicyLoading }] = useCreateSlaPolicyMutation(\n {\n onCompleted: () => {\n refetchSLAPolicies();\n },\n onError: (error) => {\n console.error('Failed to create SLA policy:', error);\n },\n }\n );\n\n // Mutation: Update SLA policy\n const [updateSLAPolicyMutation, { loading: updateSLAPolicyLoading }] = useUpdateSlaPolicyMutation(\n {\n onCompleted: () => {\n refetchSLAPolicies();\n },\n onError: (error) => {\n console.error('Failed to update SLA policy:', error);\n },\n }\n );\n\n // Mutation: Delete SLA policy\n const [deleteSLAPolicyMutation, { loading: deleteSLAPolicyLoading }] = useDeleteSlaPolicyMutation(\n {\n onCompleted: () => {\n refetchSLAPolicies();\n },\n onError: (error) => {\n console.error('Failed to delete SLA policy:', error);\n },\n }\n );\n\n // Mutation: Create canned response\n const [createCannedResponseMutation, { loading: createCannedResponseLoading }] =\n useCreateCannedResponseMutation({\n onCompleted: () => {\n refetchCannedResponses();\n },\n onError: (error) => {\n console.error('Failed to create canned response:', error);\n },\n });\n\n // Mutation: Update canned response\n const [updateCannedResponseMutation, { loading: updateCannedResponseLoading }] =\n useUpdateCannedResponseMutation({\n onCompleted: () => {\n refetchCannedResponses();\n },\n onError: (error) => {\n console.error('Failed to update canned response:', error);\n },\n });\n\n // Mutation: Delete canned response\n const [deleteCannedResponseMutation, { loading: deleteCannedResponseLoading }] =\n useDeleteCannedResponseMutation({\n onCompleted: () => {\n refetchCannedResponses();\n },\n onError: (error) => {\n console.error('Failed to delete canned response:', error);\n },\n });\n\n // Mutation: Create ticket category\n const [createTicketCategoryMutation, { loading: createCategoryLoading }] =\n useCreateTicketCategoryMutation({\n onCompleted: () => {\n refetchCategories();\n },\n onError: (error) => {\n console.error('Failed to create category:', error);\n },\n });\n\n // Mutation: Update ticket category\n const [updateTicketCategoryMutation, { loading: updateCategoryLoading }] =\n useUpdateTicketCategoryMutation({\n onCompleted: () => {\n refetchCategories();\n },\n onError: (error) => {\n console.error('Failed to update category:', error);\n },\n });\n\n // Mutation: Delete ticket category\n const [deleteTicketCategoryMutation, { loading: deleteCategoryLoading }] =\n useDeleteTicketCategoryMutation({\n onCompleted: () => {\n refetchCategories();\n },\n onError: (error) => {\n console.error('Failed to delete category:', error);\n },\n });\n\n // Helper: Create SLA policy\n const createSLAPolicy = async (input: CreateSlaPolicyInput) => {\n const result = await createSLAPolicyMutation({\n variables: { input },\n });\n if (!result.data?.createSLAPolicy) {\n throw new Error('Failed to create SLA policy');\n }\n await refetchSLAPolicies();\n return result.data.createSLAPolicy;\n };\n\n // Helper: Update SLA policy\n const updateSLAPolicy = async (id: string, input: UpdateSlaPolicyInput) => {\n const result = await updateSLAPolicyMutation({\n variables: { id, input },\n });\n if (!result.data?.updateSLAPolicy) {\n throw new Error('Failed to update SLA policy');\n }\n await refetchSLAPolicies();\n return result.data.updateSLAPolicy;\n };\n\n // Helper: Delete SLA policy\n const deleteSLAPolicy = async (id: string) => {\n const result = await deleteSLAPolicyMutation({\n variables: { id },\n });\n await refetchSLAPolicies();\n return result.data?.deleteSLAPolicy;\n };\n\n // Helper: Create canned response\n const createCannedResponse = async (input: CreateCannedResponseInput) => {\n const result = await createCannedResponseMutation({\n variables: { input },\n });\n if (!result.data?.createCannedResponse) {\n throw new Error('Failed to create canned response');\n }\n await refetchCannedResponses();\n return result.data.createCannedResponse;\n };\n\n // Helper: Update canned response\n const updateCannedResponse = async (id: string, input: UpdateCannedResponseInput) => {\n const result = await updateCannedResponseMutation({\n variables: { id, input },\n });\n if (!result.data?.updateCannedResponse) {\n throw new Error('Failed to update canned response');\n }\n await refetchCannedResponses();\n return result.data.updateCannedResponse;\n };\n\n // Helper: Delete canned response\n const deleteCannedResponse = async (id: string) => {\n const result = await deleteCannedResponseMutation({\n variables: { id },\n });\n await refetchCannedResponses();\n return result.data?.deleteCannedResponse;\n };\n\n // Helper: Create ticket category\n const createTicketCategory = async (input: CreateTicketCategoryInput) => {\n const result = await createTicketCategoryMutation({\n variables: { input },\n });\n if (!result.data?.createTicketCategory) {\n throw new Error('Failed to create category');\n }\n await refetchCategories();\n return result.data.createTicketCategory;\n };\n\n // Helper: Update ticket category\n const updateTicketCategory = async (id: string, input: UpdateTicketCategoryInput) => {\n const result = await updateTicketCategoryMutation({\n variables: { id, input },\n });\n if (!result.data?.updateTicketCategory) {\n throw new Error('Failed to update category');\n }\n await refetchCategories();\n return result.data.updateTicketCategory;\n };\n\n // Helper: Delete ticket category\n const deleteTicketCategory = async (id: string) => {\n const result = await deleteTicketCategoryMutation({\n variables: { id },\n });\n if (\n result.data?.deleteTicketCategory === undefined ||\n result.data?.deleteTicketCategory === null\n ) {\n throw new Error('Failed to delete category');\n }\n await refetchCategories();\n return result.data.deleteTicketCategory;\n };\n\n return {\n // Data\n slaPolicies: slaPoliciesData?.slaPolicies?.nodes || [],\n totalSLAPolicies: slaPoliciesData?.slaPolicies?.totalCount || 0,\n cannedResponses: cannedResponsesData?.cannedResponses?.nodes || [],\n totalCannedResponses: cannedResponsesData?.cannedResponses?.totalCount || 0,\n ticketCategories: categoriesData?.ticketCategories?.nodes || [],\n totalCategories: categoriesData?.ticketCategories?.totalCount || 0,\n\n // Loading states\n slaPoliciesLoading,\n cannedResponsesLoading,\n categoriesLoading,\n createSLAPolicyLoading,\n updateSLAPolicyLoading,\n deleteSLAPolicyLoading,\n createCannedResponseLoading,\n updateCannedResponseLoading,\n deleteCannedResponseLoading,\n createCategoryLoading,\n updateCategoryLoading,\n deleteCategoryLoading,\n isLoading: slaPoliciesLoading || cannedResponsesLoading || categoriesLoading,\n\n // Errors\n slaPoliciesError,\n cannedResponsesError,\n categoriesError,\n\n // SLA Policy Operations\n createSLAPolicy,\n updateSLAPolicy,\n deleteSLAPolicy,\n refetchSLAPolicies,\n\n // Canned Response Operations\n createCannedResponse,\n updateCannedResponse,\n deleteCannedResponse,\n refetchCannedResponses,\n\n // Ticket Category Operations\n createTicketCategory,\n updateTicketCategory,\n deleteTicketCategory,\n refetchCategories,\n };\n}\n"],"mappings":";;AAiCA,SAAgBA,IAAwB;CAEtC,IAAM,EACJ,MAAMC,GACN,SAASC,GACT,OAAOC,GACP,SAASC,MACPC,EAAuB,EACzB,WAAW,EAAE,OAAO,GAAG,EACzB,CAAC,GAG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OADA,MAAM9B,EAAkB,GACjB8B,EAAO,KAAK;EACrB;EA+CE;CACF;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveSupportAttachmentFile as e } from "../utils/supportFiles.js";
|
|
2
2
|
import { useEffect as t, useMemo as n, useState as r } from "react";
|
|
3
|
-
|
|
3
|
+
// src/support/hooks/useSupportAttachments.ts
|
|
4
4
|
var i = {
|
|
5
5
|
attachments: [],
|
|
6
6
|
isLoading: !1
|
|
@@ -39,7 +39,6 @@ function a({ fileIds: a, ticketId: o }) {
|
|
|
39
39
|
isLoading: s.isLoading
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
//#endregion
|
|
43
42
|
export { a as useSupportAttachments };
|
|
44
43
|
|
|
45
44
|
//# sourceMappingURL=useSupportAttachments.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSupportAttachments.js","names":[],"sources":["../../../src/support/hooks/useSupportAttachments.ts"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\n\nimport { resolveSupportAttachmentFile, type SupportAttachmentRecord } from '../utils/supportFiles';\n\ninterface UseSupportAttachmentsOptions {\n fileIds: string[];\n ticketId: string;\n}\n\ninterface AttachmentsState {\n attachments: SupportAttachmentRecord[];\n isLoading: boolean;\n}\n\nconst EMPTY_STATE: AttachmentsState = { attachments: [], isLoading: false };\n\nexport function useSupportAttachments({ fileIds, ticketId }: UseSupportAttachmentsOptions) {\n const [state, setState] = useState<AttachmentsState>(EMPTY_STATE);\n\n const stableFileIds = useMemo(() => fileIds.filter(Boolean), [fileIds]);\n\n useEffect(() => {\n let cancelled = false;\n\n if (stableFileIds.length === 0 || !ticketId) {\n setState(EMPTY_STATE);\n return () => {\n cancelled = true;\n };\n }\n\n setState((prev) => ({ ...prev, isLoading: true }));\n Promise.all(\n stableFileIds.map(async (fileId) => {\n try {\n return await resolveSupportAttachmentFile(fileId, ticketId);\n } catch {\n return {\n id: fileId,\n name: fileId,\n mimeType: 'application/octet-stream',\n size: '0',\n downloadUrl: '#',\n } as SupportAttachmentRecord;\n }\n })\n ).then((resolved) => {\n if (!cancelled) {\n setState({ attachments: resolved, isLoading: false });\n }\n });\n\n return () => {\n cancelled = true;\n };\n }, [stableFileIds, ticketId]);\n\n return {\n attachments: state.attachments,\n isLoading: state.isLoading,\n };\n}\n"],"mappings":";;;AAcA,
|
|
1
|
+
{"version":3,"file":"useSupportAttachments.js","names":["EMPTY_STATE","useSupportAttachments","state","setState","useState","stableFileIds","useMemo","fileIds","useEffect","cancelled","ticketId","prev","resolveSupportAttachmentFile","fileId","resolved"],"sources":["../../../src/support/hooks/useSupportAttachments.ts"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\n\nimport { resolveSupportAttachmentFile, type SupportAttachmentRecord } from '../utils/supportFiles';\n\ninterface UseSupportAttachmentsOptions {\n fileIds: string[];\n ticketId: string;\n}\n\ninterface AttachmentsState {\n attachments: SupportAttachmentRecord[];\n isLoading: boolean;\n}\n\nconst EMPTY_STATE: AttachmentsState = { attachments: [], isLoading: false };\n\nexport function useSupportAttachments({ fileIds, ticketId }: UseSupportAttachmentsOptions) {\n const [state, setState] = useState<AttachmentsState>(EMPTY_STATE);\n\n const stableFileIds = useMemo(() => fileIds.filter(Boolean), [fileIds]);\n\n useEffect(() => {\n let cancelled = false;\n\n if (stableFileIds.length === 0 || !ticketId) {\n setState(EMPTY_STATE);\n return () => {\n cancelled = true;\n };\n }\n\n setState((prev) => ({ ...prev, isLoading: true }));\n Promise.all(\n stableFileIds.map(async (fileId) => {\n try {\n return await resolveSupportAttachmentFile(fileId, ticketId);\n } catch {\n return {\n id: fileId,\n name: fileId,\n mimeType: 'application/octet-stream',\n size: '0',\n downloadUrl: '#',\n } as SupportAttachmentRecord;\n }\n })\n ).then((resolved) => {\n if (!cancelled) {\n setState({ attachments: resolved, isLoading: false });\n }\n });\n\n return () => {\n cancelled = true;\n };\n }, [stableFileIds, ticketId]);\n\n return {\n attachments: state.attachments,\n isLoading: state.isLoading,\n };\n}\n"],"mappings":";;;AAcA,IAAMA,IAAgC;CAAE,aAAa,CAAC;CAAG,WAAW;AAAM;AAE1E,SAAgBC,EAAsB,EAAE,YAAS,eAA0C;CACzF,IAAM,CAACC,GAAOC,KAAYC,EAA2BJ,CAAW,GAE1DK,IAAgBC,QAAcC,EAAQ,OAAO,OAAO,GAAG,CAACA,CAAO,CAAC;CAsCtE,OApCAC,QAAgB;EACd,IAAIC,IAAY;EA8BhB,OA5BIJ,EAAc,WAAW,KAAK,CAACK,KACjCP,EAASH,CAAW,SACP;GACX,IAAY;EACd,MAGFG,GAAU,OAAU;GAAE,GAAGQ;GAAM,WAAW;EAAK,EAAE,GACjD,QAAQ,IACNN,EAAc,IAAI,OAAO,MAAW;GAClC,IAAI;IACF,OAAO,MAAMO,EAA6BC,GAAQH,CAAQ;GAC5D,QAAQ;IACN,OAAO;KACL,IAAIG;KACJ,MAAMA;KACN,UAAU;KACV,MAAM;KACN,aAAa;IACf;GACF;EACF,CAAC,CACH,CAAC,CAAC,MAAM,MAAa;GACnB,AAAKJ,KACHN,EAAS;IAAE,aAAaW;IAAU,WAAW;GAAM,CAAC;EAExD,CAAC,SAEY;GACX,IAAY;EACd;CACF,GAAG,CAACT,GAAeK,CAAQ,CAAC,GAErB;EACL,aAAaR,EAAM;EACnB,WAAWA,EAAM;CACnB;AACF"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { useSupportStore as e } from "../store/supportStore.js";
|
|
2
|
+
import { useGetMyTicketsQuery as t, useGetTicketsQuery as n, useSearchTicketsQuery as r } from "../../generated/global-operations.js";
|
|
3
|
+
import { useSupport as i } from "../providers/SupportProvider.js";
|
|
4
|
+
import { isAdminRole as a } from "../utils/index.js";
|
|
5
5
|
import { buildTicketFilter as o, matchesTicketClientFilters as s, matchesTicketSearch as c, scopeTicketFilterToProduct as l } from "../utils/ticketFilters.js";
|
|
6
6
|
import { useEffect as u, useMemo as d, useState as f } from "react";
|
|
7
|
-
|
|
7
|
+
// src/support/hooks/useTicketListOperations.ts
|
|
8
8
|
function p(p = !1) {
|
|
9
|
-
let { currentUser: m, productId: h, showAllProductTickets: g } =
|
|
9
|
+
let { currentUser: m, productId: h, showAllProductTickets: g } = i(), _ = e((e) => e.ticketFilter), v = e((e) => e.updateTicketFilter), [y, b] = f(() => _.search.trim()), x = !p, S = !a(m?.role) && !g, C = !S || !!h, w = S ? h : void 0, T = x ? 25 : S ? 50 : 10;
|
|
10
10
|
u(() => {
|
|
11
11
|
let e = setTimeout(() => {
|
|
12
12
|
b(_.search.trim());
|
|
@@ -27,17 +27,17 @@ function p(p = !1) {
|
|
|
27
27
|
filter: E,
|
|
28
28
|
limit: T,
|
|
29
29
|
offset: 0
|
|
30
|
-
}, k =
|
|
30
|
+
}, k = t({
|
|
31
31
|
variables: O,
|
|
32
32
|
skip: !x || !C,
|
|
33
33
|
fetchPolicy: "cache-first",
|
|
34
34
|
notifyOnNetworkStatusChange: !1
|
|
35
|
-
}), A =
|
|
35
|
+
}), A = n({
|
|
36
36
|
variables: O,
|
|
37
37
|
skip: x || !C,
|
|
38
38
|
fetchPolicy: "cache-first",
|
|
39
39
|
notifyOnNetworkStatusChange: !1
|
|
40
|
-
}), { data: j, loading: M, error: N, fetchMore: P, refetch: F } = x ? k : A, { data: I, loading: L } =
|
|
40
|
+
}), { data: j, loading: M, error: N, fetchMore: P, refetch: F } = x ? k : A, { data: I, loading: L } = r({
|
|
41
41
|
variables: {
|
|
42
42
|
query: y,
|
|
43
43
|
limit: 20
|
|
@@ -69,7 +69,6 @@ function p(p = !1) {
|
|
|
69
69
|
refetchTickets: F
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
|
-
//#endregion
|
|
73
72
|
export { p as useTicketListOperations };
|
|
74
73
|
|
|
75
74
|
//# sourceMappingURL=useTicketListOperations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTicketListOperations.js","names":[],"sources":["../../../src/support/hooks/useTicketListOperations.ts"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\nimport { useSupportStore } from '../store/supportStore';\nimport {\n useGetTicketsQuery,\n useGetMyTicketsQuery,\n useSearchTicketsQuery,\n} from '../../generated/global-operations';\nimport { type SupportTicket } from '../../generated/global-types';\nimport { useSupport } from '../providers/SupportProvider';\nimport { isAdminRole } from '../utils';\nimport {\n buildTicketFilter,\n matchesTicketSearch,\n matchesTicketClientFilters,\n scopeTicketFilterToProduct,\n} from '../utils/ticketFilters';\n\n/**\n * Drives the ticket list query for both the consumer (\"my tickets\") surface and\n * the admin triage surface.\n *\n * `adminView` is the authoritative switch:\n * - `false` (default — consumer routes): query `mySupportTickets`, which the\n * backend pins to the calling actor (`payload.sub`). This is the privacy\n * boundary — a user only ever sees tickets they created, even when the user\n * is a @burdenoff.com platform admin (the `supportTickets` query widens for\n * those accounts and would otherwise leak every user's tickets here).\n * - `true` (admin routes): query `supportTickets`, the cross-user/admin read.\n *\n * In consumer mode, search runs locally over the loaded self-scoped tickets\n * rather than calling the server `searchTickets` resolver, which applies the\n * same platform-admin widening and would re-introduce the leak.\n */\nexport function useTicketListOperations(adminView = false) {\n const { currentUser, productId, showAllProductTickets } = useSupport();\n const ticketFilter = useSupportStore((state) => state.ticketFilter);\n const updateTicketFilter = useSupportStore((state) => state.updateTicketFilter);\n const [debouncedSearch, setDebouncedSearch] = useState(() => ticketFilter.search.trim());\n const selfScoped = !adminView;\n const shouldScopeToProduct = !isAdminRole(currentUser?.role) && !showAllProductTickets;\n const hasRequiredProductScope = !shouldScopeToProduct || Boolean(productId);\n const scopedProductId = shouldScopeToProduct ? productId : undefined;\n // Keep the initial self-scoped payload small; Load More extends local search.\n const ticketListLimit = selfScoped ? 25 : shouldScopeToProduct ? 50 : 10;\n\n useEffect(() => {\n const timer = setTimeout(() => {\n setDebouncedSearch(ticketFilter.search.trim());\n }, 300);\n\n return () => clearTimeout(timer);\n }, [ticketFilter.search]);\n\n const filter = useMemo(\n () => scopeTicketFilterToProduct(buildTicketFilter(ticketFilter), scopedProductId),\n [scopedProductId, ticketFilter]\n );\n // Consumer mode always searches locally (no server searchTickets call); admin\n // mode searches locally only when scoped to a single product.\n const useScopedLocalSearch = selfScoped\n ? Boolean(debouncedSearch)\n : Boolean(scopedProductId && debouncedSearch);\n\n useEffect(() => {\n if (!hasRequiredProductScope) {\n console.warn(\n 'Support ticket list requires a productId for product-scoped views, but none was resolved.'\n );\n }\n }, [hasRequiredProductScope]);\n\n useEffect(() => {\n if (scopedProductId && ticketFilter.productId && ticketFilter.productId !== scopedProductId) {\n console.warn(\n 'Product-scoped ticket filter conflicts with active product scope; using scoped product.'\n );\n updateTicketFilter({ productId: null });\n }\n }, [scopedProductId, ticketFilter.productId, updateTicketFilter]);\n\n const queryVariables = {\n filter,\n limit: ticketListLimit,\n offset: 0,\n };\n\n // Both hooks return the same `{ supportTickets: { nodes, totalCount, hasMore } }`\n // shape — GetMyTickets aliases `mySupportTickets` to `supportTickets` — so only\n // one runs at a time (the other is skipped) and downstream code is shared.\n const myTicketsResult = useGetMyTicketsQuery({\n variables: queryVariables,\n skip: !selfScoped || !hasRequiredProductScope,\n fetchPolicy: 'cache-first',\n notifyOnNetworkStatusChange: false,\n });\n const allTicketsResult = useGetTicketsQuery({\n variables: queryVariables,\n skip: selfScoped || !hasRequiredProductScope,\n fetchPolicy: 'cache-first',\n notifyOnNetworkStatusChange: false,\n });\n\n const {\n data: ticketsData,\n loading: ticketsLoading,\n error: ticketsError,\n fetchMore: fetchMoreTickets,\n refetch: refetchTickets,\n } = selfScoped ? myTicketsResult : allTicketsResult;\n\n const { data: searchedTicketsData, loading: searchLoading } = useSearchTicketsQuery({\n variables: {\n query: debouncedSearch,\n limit: 20,\n },\n // Self mode never hits the server search resolver — see hook docs.\n skip:\n selfScoped ||\n debouncedSearch.length === 0 ||\n useScopedLocalSearch ||\n !hasRequiredProductScope,\n fetchPolicy: 'cache-first',\n notifyOnNetworkStatusChange: false,\n });\n\n const loadMoreTickets = () => {\n const currentCount = ticketsData?.supportTickets?.nodes?.length || 0;\n if (ticketsData?.supportTickets?.hasMore) {\n fetchMoreTickets({\n variables: {\n offset: currentCount,\n },\n updateQuery: (prev, { fetchMoreResult }) => {\n if (!fetchMoreResult) return prev;\n return {\n supportTickets: {\n ...fetchMoreResult.supportTickets,\n nodes: [\n ...(prev.supportTickets?.nodes || []),\n ...(fetchMoreResult.supportTickets?.nodes || []),\n ],\n },\n };\n },\n });\n }\n };\n\n const listTickets = ticketsData?.supportTickets?.nodes || [];\n let tickets: SupportTicket[] = listTickets;\n\n if (!hasRequiredProductScope) {\n tickets = [];\n } else if (useScopedLocalSearch) {\n // The search endpoint has no product filter, so scoped search is local to loaded tickets.\n tickets = listTickets.filter(\n (ticket: SupportTicket) =>\n matchesTicketSearch(ticket, debouncedSearch) &&\n matchesTicketClientFilters(ticket, ticketFilter)\n );\n } else if (debouncedSearch) {\n tickets = (searchedTicketsData?.searchTickets || []).filter((ticket: SupportTicket) =>\n matchesTicketClientFilters(ticket, ticketFilter)\n );\n }\n const shouldUseListLoading = useScopedLocalSearch || !debouncedSearch;\n // The \"results limited to loaded tickets\" hint is only truthful when more\n // tickets exist server-side than are loaded. In self mode the full set is\n // usually loaded (limit 25), so suppress the hint unless there really is more.\n const hasMore = Boolean(ticketsData?.supportTickets?.hasMore);\n const showScopedSearchHint = selfScoped ? useScopedLocalSearch && hasMore : useScopedLocalSearch;\n\n return {\n tickets,\n ticketsLoading: shouldUseListLoading ? ticketsLoading : searchLoading,\n ticketsError,\n totalTickets: useScopedLocalSearch\n ? tickets.length\n : ticketsData?.supportTickets?.totalCount || 0,\n hasMoreTickets: hasMore,\n isScopedLocalSearch: showScopedSearchHint,\n isMissingProductScope: !hasRequiredProductScope,\n loadMoreTickets,\n refetchTickets,\n };\n}\n"],"mappings":";;;;;;;AAiCA,SAAgB,EAAwB,IAAY,IAAO;CACzD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,EAAE,MAAM,GAAqB,SAAS,MAAkB,EAAsB;EAClF,WAAW;GACT,OAAO;GACP,OAAO;EACT;EAEA,MACE,KACA,EAAgB,WAAW,KAC3B,KACA,CAAC;EACH,aAAa;EACb,6BAA6B;CAC/B,CAAC,GAEK,UAAwB;EAC5B,IAAM,IAAe,GAAa,gBAAgB,OAAO,UAAU;EACnE,AAAI,GAAa,gBAAgB,WAC/B,EAAiB;GACf,WAAW,EACT,QAAQ,EACV;GACA,cAAc,GAAM,EAAE,yBACf,IACE,EACL,gBAAgB;IACd,GAAG,EAAgB;IACnB,OAAO,CACL,GAAI,EAAK,gBAAgB,SAAS,CAAC,GACnC,GAAI,EAAgB,gBAAgB,SAAS,CAAC,CAChD;GACF,EACF,IAT6B;EAWjC,CAAC;CAEL,GAEM,IAAc,GAAa,gBAAgB,SAAS,CAAC,GACvD,IAA2B;CAE/B,AAAK,IAEM,IAET,IAAU,EAAY,QACnB,MACC,EAAoB,GAAQ,CAAe,KAC3C,EAA2B,GAAQ,CAAY,CACnD,IACS,MACT,KAAW,GAAqB,iBAAiB,CAAC,EAAA,CAAG,QAAQ,MAC3D,EAA2B,GAAQ,CAAY,CACjD,KAXA,IAAU,CAAC;CAab,IAAM,IAAuB,KAAwB,CAAC,GAIhD,IAAU,EAAQ,GAAa,gBAAgB,SAC/C,IAAuB,IAAa,KAAwB,IAAU;CAE5E,OAAO;EACL;EACA,gBAAgB,IAAuB,IAAiB;EACxD;EACA,cAAc,IACV,EAAQ,SACR,GAAa,gBAAgB,cAAc;EAC/C,gBAAgB;EAChB,qBAAqB;EACrB,uBAAuB,CAAC;EACxB;EACA;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"useTicketListOperations.js","names":["useTicketListOperations","useSupport","ticketFilter","useSupportStore","state","updateTicketFilter","debouncedSearch","setDebouncedSearch","useState","selfScoped","adminView","shouldScopeToProduct","isAdminRole","currentUser","showAllProductTickets","hasRequiredProductScope","productId","scopedProductId","ticketListLimit","timer","filter","useMemo","scopeTicketFilterToProduct","buildTicketFilter","useScopedLocalSearch","useEffect","queryVariables","myTicketsResult","useGetMyTicketsQuery","allTicketsResult","useGetTicketsQuery","ticketsData","ticketsLoading","ticketsError","fetchMoreTickets","refetchTickets","searchedTicketsData","searchLoading","useSearchTicketsQuery","loadMoreTickets","currentCount","fetchMoreResult","prev","listTickets","tickets","matchesTicketSearch","ticket","matchesTicketClientFilters","shouldUseListLoading","hasMore","showScopedSearchHint"],"sources":["../../../src/support/hooks/useTicketListOperations.ts"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\nimport { useSupportStore } from '../store/supportStore';\nimport {\n useGetTicketsQuery,\n useGetMyTicketsQuery,\n useSearchTicketsQuery,\n} from '../../generated/global-operations';\nimport { type SupportTicket } from '../../generated/global-types';\nimport { useSupport } from '../providers/SupportProvider';\nimport { isAdminRole } from '../utils';\nimport {\n buildTicketFilter,\n matchesTicketSearch,\n matchesTicketClientFilters,\n scopeTicketFilterToProduct,\n} from '../utils/ticketFilters';\n\n/**\n * Drives the ticket list query for both the consumer (\"my tickets\") surface and\n * the admin triage surface.\n *\n * `adminView` is the authoritative switch:\n * - `false` (default — consumer routes): query `mySupportTickets`, which the\n * backend pins to the calling actor (`payload.sub`). This is the privacy\n * boundary — a user only ever sees tickets they created, even when the user\n * is a @burdenoff.com platform admin (the `supportTickets` query widens for\n * those accounts and would otherwise leak every user's tickets here).\n * - `true` (admin routes): query `supportTickets`, the cross-user/admin read.\n *\n * In consumer mode, search runs locally over the loaded self-scoped tickets\n * rather than calling the server `searchTickets` resolver, which applies the\n * same platform-admin widening and would re-introduce the leak.\n */\nexport function useTicketListOperations(adminView = false) {\n const { currentUser, productId, showAllProductTickets } = useSupport();\n const ticketFilter = useSupportStore((state) => state.ticketFilter);\n const updateTicketFilter = useSupportStore((state) => state.updateTicketFilter);\n const [debouncedSearch, setDebouncedSearch] = useState(() => ticketFilter.search.trim());\n const selfScoped = !adminView;\n const shouldScopeToProduct = !isAdminRole(currentUser?.role) && !showAllProductTickets;\n const hasRequiredProductScope = !shouldScopeToProduct || Boolean(productId);\n const scopedProductId = shouldScopeToProduct ? productId : undefined;\n // Keep the initial self-scoped payload small; Load More extends local search.\n const ticketListLimit = selfScoped ? 25 : shouldScopeToProduct ? 50 : 10;\n\n useEffect(() => {\n const timer = setTimeout(() => {\n setDebouncedSearch(ticketFilter.search.trim());\n }, 300);\n\n return () => clearTimeout(timer);\n }, [ticketFilter.search]);\n\n const filter = useMemo(\n () => scopeTicketFilterToProduct(buildTicketFilter(ticketFilter), scopedProductId),\n [scopedProductId, ticketFilter]\n );\n // Consumer mode always searches locally (no server searchTickets call); admin\n // mode searches locally only when scoped to a single product.\n const useScopedLocalSearch = selfScoped\n ? Boolean(debouncedSearch)\n : Boolean(scopedProductId && debouncedSearch);\n\n useEffect(() => {\n if (!hasRequiredProductScope) {\n console.warn(\n 'Support ticket list requires a productId for product-scoped views, but none was resolved.'\n );\n }\n }, [hasRequiredProductScope]);\n\n useEffect(() => {\n if (scopedProductId && ticketFilter.productId && ticketFilter.productId !== scopedProductId) {\n console.warn(\n 'Product-scoped ticket filter conflicts with active product scope; using scoped product.'\n );\n updateTicketFilter({ productId: null });\n }\n }, [scopedProductId, ticketFilter.productId, updateTicketFilter]);\n\n const queryVariables = {\n filter,\n limit: ticketListLimit,\n offset: 0,\n };\n\n // Both hooks return the same `{ supportTickets: { nodes, totalCount, hasMore } }`\n // shape — GetMyTickets aliases `mySupportTickets` to `supportTickets` — so only\n // one runs at a time (the other is skipped) and downstream code is shared.\n const myTicketsResult = useGetMyTicketsQuery({\n variables: queryVariables,\n skip: !selfScoped || !hasRequiredProductScope,\n fetchPolicy: 'cache-first',\n notifyOnNetworkStatusChange: false,\n });\n const allTicketsResult = useGetTicketsQuery({\n variables: queryVariables,\n skip: selfScoped || !hasRequiredProductScope,\n fetchPolicy: 'cache-first',\n notifyOnNetworkStatusChange: false,\n });\n\n const {\n data: ticketsData,\n loading: ticketsLoading,\n error: ticketsError,\n fetchMore: fetchMoreTickets,\n refetch: refetchTickets,\n } = selfScoped ? myTicketsResult : allTicketsResult;\n\n const { data: searchedTicketsData, loading: searchLoading } = useSearchTicketsQuery({\n variables: {\n query: debouncedSearch,\n limit: 20,\n },\n // Self mode never hits the server search resolver — see hook docs.\n skip:\n selfScoped ||\n debouncedSearch.length === 0 ||\n useScopedLocalSearch ||\n !hasRequiredProductScope,\n fetchPolicy: 'cache-first',\n notifyOnNetworkStatusChange: false,\n });\n\n const loadMoreTickets = () => {\n const currentCount = ticketsData?.supportTickets?.nodes?.length || 0;\n if (ticketsData?.supportTickets?.hasMore) {\n fetchMoreTickets({\n variables: {\n offset: currentCount,\n },\n updateQuery: (prev, { fetchMoreResult }) => {\n if (!fetchMoreResult) return prev;\n return {\n supportTickets: {\n ...fetchMoreResult.supportTickets,\n nodes: [\n ...(prev.supportTickets?.nodes || []),\n ...(fetchMoreResult.supportTickets?.nodes || []),\n ],\n },\n };\n },\n });\n }\n };\n\n const listTickets = ticketsData?.supportTickets?.nodes || [];\n let tickets: SupportTicket[] = listTickets;\n\n if (!hasRequiredProductScope) {\n tickets = [];\n } else if (useScopedLocalSearch) {\n // The search endpoint has no product filter, so scoped search is local to loaded tickets.\n tickets = listTickets.filter(\n (ticket: SupportTicket) =>\n matchesTicketSearch(ticket, debouncedSearch) &&\n matchesTicketClientFilters(ticket, ticketFilter)\n );\n } else if (debouncedSearch) {\n tickets = (searchedTicketsData?.searchTickets || []).filter((ticket: SupportTicket) =>\n matchesTicketClientFilters(ticket, ticketFilter)\n );\n }\n const shouldUseListLoading = useScopedLocalSearch || !debouncedSearch;\n // The \"results limited to loaded tickets\" hint is only truthful when more\n // tickets exist server-side than are loaded. In self mode the full set is\n // usually loaded (limit 25), so suppress the hint unless there really is more.\n const hasMore = Boolean(ticketsData?.supportTickets?.hasMore);\n const showScopedSearchHint = selfScoped ? useScopedLocalSearch && hasMore : useScopedLocalSearch;\n\n return {\n tickets,\n ticketsLoading: shouldUseListLoading ? ticketsLoading : searchLoading,\n ticketsError,\n totalTickets: useScopedLocalSearch\n ? tickets.length\n : ticketsData?.supportTickets?.totalCount || 0,\n hasMoreTickets: hasMore,\n isScopedLocalSearch: showScopedSearchHint,\n isMissingProductScope: !hasRequiredProductScope,\n loadMoreTickets,\n refetchTickets,\n };\n}\n"],"mappings":";;;;;;;AAiCA,SAAgBA,EAAwB,IAAY,IAAO;CACzD,IAAM,EAAE,gBAAa,cAAW,6BAA0BC,EAAW,GAC/DC,IAAeC,GAAiB,MAAUC,EAAM,YAAY,GAC5DC,IAAqBF,GAAiB,MAAUC,EAAM,kBAAkB,GACxE,CAACE,GAAiBC,KAAsBC,QAAeN,EAAa,OAAO,KAAK,CAAC,GACjFO,IAAa,CAACC,GACdC,IAAuB,CAACC,EAAYC,GAAa,IAAI,KAAK,CAACC,GAC3DC,IAA0B,CAACJ,KAAwB,EAAQK,GAC3DC,IAAkBN,IAAuBK,IAAY,KAAA,GAErDE,IAAkBT,IAAa,KAAKE,IAAuB,KAAK;CAEtE,QAAgB;EACd,IAAMQ,IAAQ,iBAAiB;GAC7B,EAAmBjB,EAAa,OAAO,KAAK,CAAC;EAC/C,GAAG,GAAG;EAEN,aAAa,aAAaiB,CAAK;CACjC,GAAG,CAACjB,EAAa,MAAM,CAAC;CAExB,IAAMkB,IAASC,QACPC,EAA2BC,EAAkBrB,CAAY,GAAGe,CAAe,GACjF,CAACA,GAAiBf,CAAY,CAChC,GAGMsB,IAAuBf,IACzB,EAAQH,IACR,GAAQW,KAAmBX;CAU/B,AARAmB,QAAgB;EACd,AAAKV,KACH,QAAQ,KACN,2FACF;CAEJ,GAAG,CAACA,CAAuB,CAAC,GAE5BU,QAAgB;EACd,AAAIR,KAAmBf,EAAa,aAAaA,EAAa,cAAce,MAC1E,QAAQ,KACN,yFACF,GACAZ,EAAmB,EAAE,WAAW,KAAK,CAAC;CAE1C,GAAG;EAACY;EAAiBf,EAAa;EAAWG;CAAkB,CAAC;CAEhE,IAAMqB,IAAiB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,IAAae,KAAwByB,IAAUzB;CAE5E,OAAO;EACL;EACA,gBAAgBwB,IAAuBhB,IAAiBK;EACxD;EACA,cAAcb,IACVoB,EAAQ,SACRb,GAAa,gBAAgB,cAAc;EAC/C,gBAAgBkB;EAChB,qBAAqBC;EACrB,uBAAuB,CAACnC;EACxB;EACA;CACF;AACF"}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { SupportTicketStatus, type SupportTicket, type CreateSupportTicketInput, type UpdateSupportTicketInput, type CreateSupportMessageInput, type SubmitSatisfactionSurveyInput } from '../../generated/global-types';
|
|
2
2
|
interface UseTicketOperationsOptions {
|
|
3
3
|
loadAgentProfiles?: boolean;
|
|
4
|
+
/**
|
|
5
|
+
* The ticket a detail page shows, taken from its route. Preferred over the
|
|
6
|
+
* store's `selectedTicket`, which `SupportAdminRoot`/`SupportUserRoot` reset
|
|
7
|
+
* on mount and on every context change — the root's effect runs after the
|
|
8
|
+
* page's, so a ticket opened by direct link (an email, a refresh, a shared
|
|
9
|
+
* URL) was wiped before its query ran and the page showed "Ticket not found".
|
|
10
|
+
*/
|
|
11
|
+
ticketId?: string;
|
|
4
12
|
}
|
|
5
13
|
export declare function useTicketOperations(options?: UseTicketOperationsOptions): {
|
|
6
14
|
tickets: SupportTicket[];
|
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { useAssignSupportTicketMutation as
|
|
4
|
-
import { SupportTicketStatus as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { useEffect as
|
|
8
|
-
import { useEventBus as
|
|
9
|
-
|
|
10
|
-
function
|
|
11
|
-
let { workspaceId:
|
|
12
|
-
|
|
1
|
+
import { useSupportStore as e } from "../store/supportStore.js";
|
|
2
|
+
import { emitSupportTicketClosed as t, emitSupportTicketCreated as n, emitSupportTicketReopened as r } from "../events/rybbit.js";
|
|
3
|
+
import { useAssignSupportTicketMutation as i, useCloseSupportTicketMutation as a, useCreateSupportMessageMutation as o, useCreateSupportTicketMutation as s, useGetAgentProfilesQuery as c, useGetTicketDetailQuery as l, useGetTicketsQuery as u, useResolveSupportTicketMutation as d, useSearchTicketsQuery as f, useSubmitSatisfactionSurveyMutation as p, useUpdateSupportTicketMutation as m, useUpdateSupportTicketStatusMutation as h } from "../../generated/global-operations.js";
|
|
4
|
+
import { SupportTicketStatus as g } from "../../generated/global-types.js";
|
|
5
|
+
import { useSupport as _ } from "../providers/SupportProvider.js";
|
|
6
|
+
import { buildTicketFilter as v, matchesTicketClientFilters as y } from "../utils/ticketFilters.js";
|
|
7
|
+
import { useEffect as b, useMemo as ee, useState as te } from "react";
|
|
8
|
+
import { useEventBus as x } from "@burdenoff/fe-libs/shared/events";
|
|
9
|
+
// src/support/hooks/useTicketOperations.ts
|
|
10
|
+
function S(S = {}) {
|
|
11
|
+
let { workspaceId: C, organizationId: w, productId: T, currentUser: E } = _(), { ticketFilter: D, selectedTicket: O, setSelectedTicket: k } = e(), A = S.ticketId || O?.id || void 0, j = x(), [M, N] = te(() => D.search.trim());
|
|
12
|
+
b(() => {
|
|
13
13
|
let e = setTimeout(() => {
|
|
14
|
-
|
|
14
|
+
N(D.search.trim());
|
|
15
15
|
}, 300);
|
|
16
16
|
return () => clearTimeout(e);
|
|
17
|
-
}, [
|
|
18
|
-
let
|
|
17
|
+
}, [D.search]);
|
|
18
|
+
let P = ee(() => v(D), [D]), { data: F, loading: I, error: L, fetchMore: R, refetch: z } = u({
|
|
19
19
|
variables: {
|
|
20
|
-
filter:
|
|
20
|
+
filter: P,
|
|
21
21
|
limit: 10,
|
|
22
22
|
offset: 0
|
|
23
23
|
},
|
|
24
24
|
notifyOnNetworkStatusChange: !0
|
|
25
|
-
}), { data:
|
|
25
|
+
}), { data: B, loading: ne } = f({
|
|
26
26
|
variables: {
|
|
27
|
-
query:
|
|
27
|
+
query: M,
|
|
28
28
|
limit: 20
|
|
29
29
|
},
|
|
30
|
-
skip:
|
|
30
|
+
skip: M.length === 0,
|
|
31
31
|
notifyOnNetworkStatusChange: !0
|
|
32
|
-
}), { data:
|
|
32
|
+
}), { data: V, loading: H } = c({
|
|
33
33
|
variables: {
|
|
34
34
|
filter: void 0,
|
|
35
35
|
limit: 100,
|
|
36
36
|
offset: 0
|
|
37
37
|
},
|
|
38
|
-
skip: !
|
|
39
|
-
}), { data:
|
|
40
|
-
variables: { id:
|
|
41
|
-
skip: !
|
|
42
|
-
}), [
|
|
38
|
+
skip: !S.loadAgentProfiles
|
|
39
|
+
}), { data: U, loading: W, error: G, refetch: K } = l({
|
|
40
|
+
variables: { id: A ?? "" },
|
|
41
|
+
skip: !A
|
|
42
|
+
}), [q, { loading: J }] = s({
|
|
43
43
|
onCompleted: (e) => {
|
|
44
|
-
e.createSupportTicket &&
|
|
44
|
+
e.createSupportTicket && z();
|
|
45
45
|
},
|
|
46
46
|
onError: (e) => {
|
|
47
47
|
console.error("Failed to create ticket:", e);
|
|
48
48
|
}
|
|
49
|
-
}), [
|
|
49
|
+
}), [Y, { loading: X }] = m({
|
|
50
50
|
onCompleted: (e) => {
|
|
51
|
-
e.updateSupportTicket && (
|
|
51
|
+
e.updateSupportTicket && (z(), A === e.updateSupportTicket.id && K());
|
|
52
52
|
},
|
|
53
53
|
onError: (e) => {
|
|
54
54
|
console.error("Failed to update ticket:", e);
|
|
55
55
|
}
|
|
56
|
-
}), [
|
|
56
|
+
}), [Z, { loading: re }] = i({
|
|
57
57
|
onCompleted: (e) => {
|
|
58
|
-
e.assignSupportTicket && (
|
|
58
|
+
e.assignSupportTicket && (z(), A === e.assignSupportTicket.id && K());
|
|
59
59
|
},
|
|
60
60
|
onError: (e) => {
|
|
61
61
|
console.error("Failed to assign ticket:", e);
|
|
62
62
|
}
|
|
63
|
-
}), [
|
|
63
|
+
}), [ie, { loading: ae }] = h({
|
|
64
64
|
onCompleted: (e) => {
|
|
65
|
-
e.updateSupportTicketStatus && (
|
|
65
|
+
e.updateSupportTicketStatus && (z(), A === e.updateSupportTicketStatus.id && K());
|
|
66
66
|
},
|
|
67
67
|
onError: (e) => {
|
|
68
68
|
console.error("Failed to change ticket status:", e);
|
|
69
69
|
}
|
|
70
|
-
}), [Q, { loading:
|
|
70
|
+
}), [Q, { loading: oe }] = d({
|
|
71
71
|
onCompleted: (e) => {
|
|
72
|
-
e.resolveSupportTicket && (
|
|
72
|
+
e.resolveSupportTicket && (z(), A === e.resolveSupportTicket.id && K());
|
|
73
73
|
},
|
|
74
74
|
onError: (e) => {
|
|
75
75
|
console.error("Failed to resolve ticket:", e);
|
|
76
76
|
}
|
|
77
|
-
}), [
|
|
77
|
+
}), [$, { loading: se }] = a({
|
|
78
78
|
onCompleted: (e) => {
|
|
79
|
-
e.closeSupportTicket && (
|
|
79
|
+
e.closeSupportTicket && (z(), A === e.closeSupportTicket.id && K());
|
|
80
80
|
},
|
|
81
81
|
onError: (e) => {
|
|
82
82
|
console.error("Failed to close ticket:", e);
|
|
83
83
|
}
|
|
84
|
-
}), [
|
|
84
|
+
}), [ce, { loading: le }] = o({
|
|
85
85
|
onCompleted: () => {
|
|
86
|
-
|
|
86
|
+
A && K();
|
|
87
87
|
},
|
|
88
88
|
onError: (e) => {
|
|
89
89
|
console.error("Failed to add ticket message:", e);
|
|
90
90
|
}
|
|
91
|
-
}), [
|
|
91
|
+
}), [ue, { loading: de }] = p({
|
|
92
92
|
onCompleted: () => {
|
|
93
|
-
|
|
93
|
+
A && K();
|
|
94
94
|
},
|
|
95
95
|
onError: (e) => {
|
|
96
96
|
console.error("Failed to submit satisfaction survey:", e);
|
|
97
97
|
}
|
|
98
98
|
});
|
|
99
99
|
return {
|
|
100
|
-
tickets:
|
|
101
|
-
ticketDetail:
|
|
102
|
-
agentProfiles:
|
|
103
|
-
totalTickets:
|
|
104
|
-
hasMoreTickets:
|
|
105
|
-
ticketsLoading:
|
|
106
|
-
ticketDetailLoading:
|
|
107
|
-
agentProfilesLoading:
|
|
108
|
-
createTicketLoading:
|
|
109
|
-
updateTicketLoading:
|
|
110
|
-
assignTicketLoading:
|
|
111
|
-
changeStatusLoading:
|
|
112
|
-
addMessageLoading:
|
|
113
|
-
submitSurveyLoading:
|
|
114
|
-
ticketsError:
|
|
115
|
-
ticketDetailError:
|
|
100
|
+
tickets: M ? (B?.searchTickets || []).filter((e) => y(e, D)) : F?.supportTickets?.nodes || [],
|
|
101
|
+
ticketDetail: U?.supportTicket || null,
|
|
102
|
+
agentProfiles: V?.agentProfiles?.nodes || [],
|
|
103
|
+
totalTickets: F?.supportTickets?.totalCount || 0,
|
|
104
|
+
hasMoreTickets: F?.supportTickets?.hasMore || !1,
|
|
105
|
+
ticketsLoading: M ? ne : I,
|
|
106
|
+
ticketDetailLoading: W,
|
|
107
|
+
agentProfilesLoading: H,
|
|
108
|
+
createTicketLoading: J,
|
|
109
|
+
updateTicketLoading: X,
|
|
110
|
+
assignTicketLoading: re,
|
|
111
|
+
changeStatusLoading: ae || oe || se,
|
|
112
|
+
addMessageLoading: le,
|
|
113
|
+
submitSurveyLoading: de,
|
|
114
|
+
ticketsError: L,
|
|
115
|
+
ticketDetailError: G,
|
|
116
116
|
createTicket: async (e) => {
|
|
117
117
|
try {
|
|
118
118
|
let t = {
|
|
119
119
|
...e.context ?? {},
|
|
120
|
-
workspaceId: e.context?.workspaceId ??
|
|
121
|
-
organizationId: e.context?.organizationId ??
|
|
122
|
-
productId: e.context?.productId ??
|
|
123
|
-
userId: e.context?.userId ??
|
|
124
|
-
},
|
|
120
|
+
workspaceId: e.context?.workspaceId ?? C ?? void 0,
|
|
121
|
+
organizationId: e.context?.organizationId ?? w ?? void 0,
|
|
122
|
+
productId: e.context?.productId ?? T ?? void 0,
|
|
123
|
+
userId: e.context?.userId ?? E?.id ?? void 0
|
|
124
|
+
}, r = (await q({ variables: { input: {
|
|
125
125
|
...e,
|
|
126
126
|
context: t
|
|
127
127
|
} } })).data?.createSupportTicket;
|
|
128
|
-
return
|
|
128
|
+
return r && n(j, r, C), r;
|
|
129
129
|
} catch (e) {
|
|
130
130
|
throw console.error("Error creating ticket:", e), e;
|
|
131
131
|
}
|
|
132
132
|
},
|
|
133
133
|
updateTicket: async (e, t) => {
|
|
134
134
|
try {
|
|
135
|
-
let n = (await
|
|
135
|
+
let n = (await Y({ variables: {
|
|
136
136
|
id: e,
|
|
137
137
|
input: t
|
|
138
138
|
} })).data?.updateSupportTicket;
|
|
139
|
-
return n &&
|
|
139
|
+
return n && j.emit("support.ticket.updated", {
|
|
140
140
|
ticketId: n.id,
|
|
141
141
|
status: n.status,
|
|
142
142
|
priority: n.priority,
|
|
143
143
|
categoryId: n.categoryId ?? void 0,
|
|
144
|
-
workspaceId:
|
|
144
|
+
workspaceId: C ?? void 0
|
|
145
145
|
}), n;
|
|
146
146
|
} catch (e) {
|
|
147
147
|
throw console.error("Error updating ticket:", e), e;
|
|
@@ -149,8 +149,8 @@ function x(x = {}) {
|
|
|
149
149
|
},
|
|
150
150
|
assignTicket: async (e, t) => {
|
|
151
151
|
try {
|
|
152
|
-
let n = (
|
|
153
|
-
return (await
|
|
152
|
+
let n = (V?.agentProfiles?.nodes ?? []).find((e) => e.userId === t || e.id === t);
|
|
153
|
+
return (await Z({ variables: {
|
|
154
154
|
id: e,
|
|
155
155
|
assignedTo: n?.userId ?? t
|
|
156
156
|
} })).data?.assignSupportTicket;
|
|
@@ -158,47 +158,47 @@ function x(x = {}) {
|
|
|
158
158
|
throw console.error("Error assigning ticket:", e), e;
|
|
159
159
|
}
|
|
160
160
|
},
|
|
161
|
-
changeTicketStatus: async (e,
|
|
161
|
+
changeTicketStatus: async (e, n) => {
|
|
162
162
|
try {
|
|
163
|
-
if (
|
|
164
|
-
if (
|
|
165
|
-
let
|
|
166
|
-
|
|
163
|
+
if (n === g.Resolved) return (await Q({ variables: { id: e } })).data?.resolveSupportTicket;
|
|
164
|
+
if (n === g.Closed) {
|
|
165
|
+
let n = U?.supportTicket?.status ?? O?.status, r = n !== void 0 && n !== g.Resolved && n !== g.Closed;
|
|
166
|
+
r && await Q({ variables: {
|
|
167
167
|
id: e,
|
|
168
168
|
resolution: "Closed by support."
|
|
169
169
|
} });
|
|
170
170
|
try {
|
|
171
|
-
let
|
|
172
|
-
return
|
|
171
|
+
let n = (await $({ variables: { id: e } })).data?.closeSupportTicket;
|
|
172
|
+
return n && t(j, n, C), n;
|
|
173
173
|
} catch (e) {
|
|
174
|
-
throw
|
|
174
|
+
throw r ? Error("Ticket was resolved, but closing it failed. Please try closing it again.") : e;
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
-
let
|
|
177
|
+
let i = (await ie({ variables: {
|
|
178
178
|
id: e,
|
|
179
|
-
status:
|
|
179
|
+
status: n
|
|
180
180
|
} })).data?.updateSupportTicketStatus;
|
|
181
|
-
return
|
|
181
|
+
return i && n === g.Reopened && r(j, i, C), i;
|
|
182
182
|
} catch (e) {
|
|
183
183
|
throw console.error("Error changing ticket status:", e), e;
|
|
184
184
|
}
|
|
185
185
|
},
|
|
186
186
|
addTicketMessage: async (e) => {
|
|
187
187
|
try {
|
|
188
|
-
let t = (await
|
|
188
|
+
let t = (await ce({ variables: { input: {
|
|
189
189
|
...e,
|
|
190
190
|
context: {
|
|
191
191
|
...e.context ?? {},
|
|
192
|
-
workspaceId: e.context?.workspaceId ??
|
|
193
|
-
organizationId: e.context?.organizationId ??
|
|
194
|
-
productId: e.context?.productId ??
|
|
195
|
-
userId: e.context?.userId ??
|
|
192
|
+
workspaceId: e.context?.workspaceId ?? C ?? O?.context?.workspaceId ?? void 0,
|
|
193
|
+
organizationId: e.context?.organizationId ?? w ?? O?.context?.organizationId ?? void 0,
|
|
194
|
+
productId: e.context?.productId ?? T ?? O?.context?.productId ?? void 0,
|
|
195
|
+
userId: e.context?.userId ?? E?.id ?? void 0
|
|
196
196
|
}
|
|
197
197
|
} } })).data?.createSupportMessage;
|
|
198
|
-
return t &&
|
|
198
|
+
return t && j.emit("support.ticket.message_sent", {
|
|
199
199
|
messageId: t.id,
|
|
200
200
|
ticketId: e.ticketId,
|
|
201
|
-
workspaceId:
|
|
201
|
+
workspaceId: C ?? void 0
|
|
202
202
|
}), t;
|
|
203
203
|
} catch (e) {
|
|
204
204
|
throw console.error("Error adding ticket message:", e), e;
|
|
@@ -206,14 +206,14 @@ function x(x = {}) {
|
|
|
206
206
|
},
|
|
207
207
|
submitSatisfactionSurvey: async (e) => {
|
|
208
208
|
try {
|
|
209
|
-
return (await
|
|
209
|
+
return (await ue({ variables: { input: e } })).data?.submitSatisfactionSurvey;
|
|
210
210
|
} catch (e) {
|
|
211
211
|
throw console.error("Error submitting satisfaction survey:", e), e;
|
|
212
212
|
}
|
|
213
213
|
},
|
|
214
214
|
loadMoreTickets: () => {
|
|
215
|
-
let e =
|
|
216
|
-
|
|
215
|
+
let e = F?.supportTickets?.nodes?.length || 0;
|
|
216
|
+
F?.supportTickets?.hasMore && R({
|
|
217
217
|
variables: { offset: e },
|
|
218
218
|
updateQuery: (e, { fetchMoreResult: t }) => t ? { supportTickets: {
|
|
219
219
|
...t.supportTickets,
|
|
@@ -221,12 +221,11 @@ function x(x = {}) {
|
|
|
221
221
|
} } : e
|
|
222
222
|
});
|
|
223
223
|
},
|
|
224
|
-
refetchTickets:
|
|
225
|
-
refetchTicketDetail:
|
|
226
|
-
setSelectedTicket:
|
|
224
|
+
refetchTickets: z,
|
|
225
|
+
refetchTicketDetail: K,
|
|
226
|
+
setSelectedTicket: k
|
|
227
227
|
};
|
|
228
228
|
}
|
|
229
|
-
|
|
230
|
-
export { x as useTicketOperations };
|
|
229
|
+
export { S as useTicketOperations };
|
|
231
230
|
|
|
232
231
|
//# sourceMappingURL=useTicketOperations.js.map
|