@burdenoff/microfe-support 2026.625.2 → 2026.715.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/dist/generated/global-operations.d.ts +2517 -0
  2. package/dist/generated/global-types.d.ts +22913 -0
  3. package/dist/generated/wspace-operations.d.ts +1 -0
  4. package/dist/generated/wspace-types.d.ts +57850 -0
  5. package/dist/index.d.ts +5 -0
  6. package/dist/support/SupportAdminRoot.d.ts +20 -0
  7. package/dist/support/SupportAdminRoutes.d.ts +13 -0
  8. package/dist/support/SupportUserRoot.d.ts +17 -0
  9. package/dist/support/SupportUserRoutes.d.ts +11 -0
  10. package/dist/support/components/NotificationToast.d.ts +17 -0
  11. package/dist/support/components/PageLayout.d.ts +71 -0
  12. package/dist/support/components/RouteHelpers.d.ts +9 -0
  13. package/dist/support/components/analytics/CategoryBreakdown.d.ts +9 -0
  14. package/dist/support/components/analytics/MetricCard.d.ts +10 -0
  15. package/dist/support/components/analytics/PriorityBreakdown.d.ts +9 -0
  16. package/dist/support/components/analytics/SLAReport.d.ts +23 -0
  17. package/dist/support/components/analytics/SatisfactionDistribution.d.ts +23 -0
  18. package/dist/support/components/analytics/TopAgents.d.ts +19 -0
  19. package/dist/support/components/analytics/TrendChart.d.ts +15 -0
  20. package/dist/support/components/kb/ArticleForm.d.ts +25 -0
  21. package/dist/support/components/settings/CannedResponsesSettings.d.ts +21 -0
  22. package/dist/support/components/settings/SLAPoliciesSettings.d.ts +18 -0
  23. package/dist/support/components/settings/TicketCategoriesSettings.d.ts +20 -0
  24. package/dist/support/components/tickets/AttachmentList.d.ts +7 -0
  25. package/dist/support/components/tickets/MarkdownContent.d.ts +7 -0
  26. package/dist/support/components/tickets/MessageComposer.d.ts +22 -0
  27. package/dist/support/components/tickets/MessageThread.d.ts +12 -0
  28. package/dist/support/components/tickets/TicketDetailHeader.d.ts +16 -0
  29. package/dist/support/components/tickets/TicketHeader.d.ts +9 -0
  30. package/dist/support/components/tickets/TicketSidebar.d.ts +7 -0
  31. package/dist/support/components/ui.d.ts +5 -0
  32. package/dist/support/components/ui.js +2 -2
  33. package/dist/support/constants.d.ts +20 -0
  34. package/dist/support/events/rybbit.d.ts +13 -0
  35. package/dist/support/hooks/index.d.ts +5 -0
  36. package/dist/support/hooks/useAnalyticsOperations.d.ts +51 -0
  37. package/dist/support/hooks/useAttachmentsFailedToast.d.ts +2 -0
  38. package/dist/support/hooks/useChatOperations.d.ts +27 -0
  39. package/dist/support/hooks/useKnowledgeBaseOperations.d.ts +55 -0
  40. package/dist/support/hooks/useNotification.d.ts +20 -0
  41. package/dist/support/hooks/useRegisterFooter.d.ts +6 -0
  42. package/dist/support/hooks/useSettingsOperations.d.ts +47 -0
  43. package/dist/support/hooks/useSupportAttachments.d.ts +10 -0
  44. package/dist/support/hooks/useTicketListOperations.d.ts +31 -0
  45. package/dist/support/hooks/useTicketOperations.d.ts +39 -0
  46. package/dist/support/index.d.ts +44 -0
  47. package/dist/support/pages/AnalyticsPage.d.ts +1 -0
  48. package/dist/support/pages/AnalyticsPage.js +144 -113
  49. package/dist/support/pages/AnalyticsPage.js.map +1 -1
  50. package/dist/support/pages/ArticleDetailAdminPage.d.ts +7 -0
  51. package/dist/support/pages/ArticleDetailAdminPage.js +150 -113
  52. package/dist/support/pages/ArticleDetailAdminPage.js.map +1 -1
  53. package/dist/support/pages/ArticleDetailUserPage.d.ts +7 -0
  54. package/dist/support/pages/ArticleDetailUserPage.js +90 -83
  55. package/dist/support/pages/ArticleDetailUserPage.js.map +1 -1
  56. package/dist/support/pages/ContactInquiriesPage.d.ts +1 -0
  57. package/dist/support/pages/ContactInquiriesPage.js +48 -44
  58. package/dist/support/pages/ContactInquiriesPage.js.map +1 -1
  59. package/dist/support/pages/ContactInquiryDetailPage.d.ts +1 -0
  60. package/dist/support/pages/ContactInquiryDetailPage.js +225 -205
  61. package/dist/support/pages/ContactInquiryDetailPage.js.map +1 -1
  62. package/dist/support/pages/CreateArticlePage.d.ts +1 -0
  63. package/dist/support/pages/CreateArticlePage.js +50 -46
  64. package/dist/support/pages/CreateArticlePage.js.map +1 -1
  65. package/dist/support/pages/CreateTicketPage.d.ts +1 -0
  66. package/dist/support/pages/CreateTicketPage.js +122 -116
  67. package/dist/support/pages/CreateTicketPage.js.map +1 -1
  68. package/dist/support/pages/EditArticlePage.d.ts +1 -0
  69. package/dist/support/pages/EditArticlePage.js +76 -80
  70. package/dist/support/pages/EditArticlePage.js.map +1 -1
  71. package/dist/support/pages/JobApplicationDetailPage.d.ts +1 -0
  72. package/dist/support/pages/JobApplicationDetailPage.js +292 -269
  73. package/dist/support/pages/JobApplicationDetailPage.js.map +1 -1
  74. package/dist/support/pages/JobApplicationsPage.d.ts +1 -0
  75. package/dist/support/pages/JobApplicationsPage.js +50 -46
  76. package/dist/support/pages/JobApplicationsPage.js.map +1 -1
  77. package/dist/support/pages/KnowledgeBaseAdminPage.d.ts +7 -0
  78. package/dist/support/pages/KnowledgeBaseAdminPage.js +84 -81
  79. package/dist/support/pages/KnowledgeBaseAdminPage.js.map +1 -1
  80. package/dist/support/pages/KnowledgeBaseUserPage.d.ts +8 -0
  81. package/dist/support/pages/KnowledgeBaseUserPage.js +76 -75
  82. package/dist/support/pages/KnowledgeBaseUserPage.js.map +1 -1
  83. package/dist/support/pages/SettingsPage.d.ts +1 -0
  84. package/dist/support/pages/SettingsPage.js +215 -182
  85. package/dist/support/pages/SettingsPage.js.map +1 -1
  86. package/dist/support/pages/TicketDetailAdminPage.d.ts +8 -0
  87. package/dist/support/pages/TicketDetailAdminPage.js +158 -128
  88. package/dist/support/pages/TicketDetailAdminPage.js.map +1 -1
  89. package/dist/support/pages/TicketDetailUserPage.d.ts +8 -0
  90. package/dist/support/pages/TicketDetailUserPage.js +174 -141
  91. package/dist/support/pages/TicketDetailUserPage.js.map +1 -1
  92. package/dist/support/pages/TicketListPage.d.ts +11 -0
  93. package/dist/support/pages/TicketListPage.js +171 -170
  94. package/dist/support/pages/TicketListPage.js.map +1 -1
  95. package/dist/support/providers/SupportProvider.d.ts +16 -0
  96. package/dist/support/store/supportStore.d.ts +66 -0
  97. package/dist/support/types/index.d.ts +160 -0
  98. package/dist/support/utils/attachments.d.ts +27 -0
  99. package/dist/support/utils/categoryColors.d.ts +10 -0
  100. package/dist/support/utils/cn.d.ts +6 -0
  101. package/dist/support/utils/context.d.ts +2 -0
  102. package/dist/support/utils/errors.d.ts +2 -0
  103. package/dist/support/utils/i18n.d.ts +4 -0
  104. package/dist/support/utils/index.d.ts +57 -0
  105. package/dist/support/utils/markdown.d.ts +2 -0
  106. package/dist/support/utils/supportFiles.d.ts +15 -0
  107. package/dist/support/utils/ticketFilters.d.ts +6 -0
  108. package/dist/support/utils/uiTokens.d.ts +7 -0
  109. package/dist/utils/nativeBridge.d.ts +2 -0
  110. package/package.json +4 -4
@@ -0,0 +1,55 @@
1
+ import type { KnowledgeBaseArticle, CreateKnowledgeBaseArticleInput, UpdateKnowledgeBaseArticleInput } from '../../generated/global-types';
2
+ import type { KnowledgeBaseArticleState } from '../store/supportStore';
3
+ export type { CreateKnowledgeBaseArticleInput, UpdateKnowledgeBaseArticleInput };
4
+ export declare function useKnowledgeBaseOperations(articleSlug?: string): {
5
+ articles: KnowledgeBaseArticle[];
6
+ popularArticles: KnowledgeBaseArticle[];
7
+ categories: any;
8
+ searchResults: KnowledgeBaseArticleState[];
9
+ articleDetail: any;
10
+ totalArticles: any;
11
+ totalResults: any;
12
+ hasMoreArticles: any;
13
+ hasMoreResults: boolean;
14
+ articlesLoading: boolean;
15
+ popularLoading: boolean;
16
+ categoriesLoading: boolean;
17
+ searchLoading: boolean;
18
+ articleLoading: boolean;
19
+ ratingArticle: boolean;
20
+ creatingArticle: boolean;
21
+ updatingArticle: boolean;
22
+ deletingArticle: boolean;
23
+ publishingArticle: boolean;
24
+ unpublishingArticle: boolean;
25
+ archivingArticle: boolean;
26
+ articlesError: import("@apollo/client").ErrorLike | undefined;
27
+ searchError: import("@apollo/client").ErrorLike | undefined;
28
+ articleError: import("@apollo/client").ErrorLike | undefined;
29
+ searchArticles: (query: string, filters?: {
30
+ categoryId?: string;
31
+ tags?: string[];
32
+ }) => void;
33
+ filterArticles: (filters?: {
34
+ categoryId?: string;
35
+ tags?: string[];
36
+ }) => void;
37
+ loadMoreArticles: () => void;
38
+ voteArticle: (articleId: string, helpful: boolean) => Promise<void>;
39
+ recordView: (articleId: string) => Promise<void>;
40
+ refetchArticles: (variables?: any) => Promise<{
41
+ data: any;
42
+ error?: import("@apollo/client").ErrorLike;
43
+ }>;
44
+ refetchArticle: (variables?: any) => Promise<{
45
+ data: any;
46
+ error?: import("@apollo/client").ErrorLike;
47
+ }>;
48
+ setSelectedArticle: (article: KnowledgeBaseArticleState | null) => void;
49
+ createArticle: (input: CreateKnowledgeBaseArticleInput) => Promise<any>;
50
+ updateArticle: (id: string, input: UpdateKnowledgeBaseArticleInput) => Promise<any>;
51
+ deleteArticle: (id: string) => Promise<any>;
52
+ publishArticle: (id: string) => Promise<any>;
53
+ unpublishArticle: (id: string) => Promise<any>;
54
+ archiveArticle: (id: string) => Promise<any>;
55
+ };
@@ -0,0 +1,20 @@
1
+ export type NotificationType = 'success' | 'error' | 'info';
2
+ export interface NotificationState {
3
+ type: NotificationType;
4
+ message: string;
5
+ }
6
+ export interface UseNotificationApi {
7
+ notification: NotificationState | null;
8
+ notify: (type: NotificationType, message: string, durationMs?: number) => void;
9
+ dismiss: () => void;
10
+ }
11
+ /**
12
+ * Single-slot notification toast with timer coalescing.
13
+ *
14
+ * Back-to-back `notify()` calls cancel the previous auto-dismiss timer so a
15
+ * slow earlier toast cannot wipe out a fresher one. The timer is also cleared
16
+ * on unmount to avoid a setState-after-unmount warning when the user navigates
17
+ * away mid-toast. A single `duration` of `Infinity` keeps the toast until the
18
+ * caller dismisses it manually or a new `notify()` supersedes it.
19
+ */
20
+ export declare function useNotification(): UseNotificationApi;
@@ -0,0 +1,6 @@
1
+ import type { FooterItem } from '../types';
2
+ /**
3
+ * Shared hook for registering the support footer status indicator.
4
+ * Used by SupportUserRoot, SupportAdminRoot, and SupportRoot.
5
+ */
6
+ export declare function useRegisterFooter(registerFooterItems?: (items: FooterItem | FooterItem[]) => () => void): void;
@@ -0,0 +1,47 @@
1
+ import type { CreateSlaPolicyInput, UpdateSlaPolicyInput, CreateCannedResponseInput, UpdateCannedResponseInput, CreateTicketCategoryInput, UpdateTicketCategoryInput } from '../../generated/global-types';
2
+ export type { CreateSlaPolicyInput, UpdateSlaPolicyInput, CreateCannedResponseInput, UpdateCannedResponseInput, CreateTicketCategoryInput, UpdateTicketCategoryInput, };
3
+ export declare function useSettingsOperations(): {
4
+ slaPolicies: any;
5
+ totalSLAPolicies: any;
6
+ cannedResponses: any;
7
+ totalCannedResponses: any;
8
+ ticketCategories: any;
9
+ totalCategories: any;
10
+ slaPoliciesLoading: boolean;
11
+ cannedResponsesLoading: boolean;
12
+ categoriesLoading: boolean;
13
+ createSLAPolicyLoading: boolean;
14
+ updateSLAPolicyLoading: boolean;
15
+ deleteSLAPolicyLoading: boolean;
16
+ createCannedResponseLoading: boolean;
17
+ updateCannedResponseLoading: boolean;
18
+ deleteCannedResponseLoading: boolean;
19
+ createCategoryLoading: boolean;
20
+ updateCategoryLoading: boolean;
21
+ deleteCategoryLoading: boolean;
22
+ isLoading: boolean;
23
+ slaPoliciesError: import("@apollo/client").ErrorLike | undefined;
24
+ cannedResponsesError: import("@apollo/client").ErrorLike | undefined;
25
+ categoriesError: import("@apollo/client").ErrorLike | undefined;
26
+ createSLAPolicy: (input: CreateSlaPolicyInput) => Promise<any>;
27
+ updateSLAPolicy: (id: string, input: UpdateSlaPolicyInput) => Promise<any>;
28
+ deleteSLAPolicy: (id: string) => Promise<any>;
29
+ refetchSLAPolicies: (variables?: any) => Promise<{
30
+ data: any;
31
+ error?: import("@apollo/client").ErrorLike;
32
+ }>;
33
+ createCannedResponse: (input: CreateCannedResponseInput) => Promise<any>;
34
+ updateCannedResponse: (id: string, input: UpdateCannedResponseInput) => Promise<any>;
35
+ deleteCannedResponse: (id: string) => Promise<any>;
36
+ refetchCannedResponses: (variables?: any) => Promise<{
37
+ data: any;
38
+ error?: import("@apollo/client").ErrorLike;
39
+ }>;
40
+ createTicketCategory: (input: CreateTicketCategoryInput) => Promise<any>;
41
+ updateTicketCategory: (id: string, input: UpdateTicketCategoryInput) => Promise<any>;
42
+ deleteTicketCategory: (id: string) => Promise<any>;
43
+ refetchCategories: (variables?: any) => Promise<{
44
+ data: any;
45
+ error?: import("@apollo/client").ErrorLike;
46
+ }>;
47
+ };
@@ -0,0 +1,10 @@
1
+ import { type SupportAttachmentRecord } from '../utils/supportFiles';
2
+ interface UseSupportAttachmentsOptions {
3
+ fileIds: string[];
4
+ ticketId: string;
5
+ }
6
+ export declare function useSupportAttachments({ fileIds, ticketId }: UseSupportAttachmentsOptions): {
7
+ attachments: SupportAttachmentRecord[];
8
+ isLoading: boolean;
9
+ };
10
+ export {};
@@ -0,0 +1,31 @@
1
+ import { type SupportTicket } from '../../generated/global-types';
2
+ /**
3
+ * Drives the ticket list query for both the consumer ("my tickets") surface and
4
+ * the admin triage surface.
5
+ *
6
+ * `adminView` is the authoritative switch:
7
+ * - `false` (default — consumer routes): query `mySupportTickets`, which the
8
+ * backend pins to the calling actor (`payload.sub`). This is the privacy
9
+ * boundary — a user only ever sees tickets they created, even when the user
10
+ * is a @burdenoff.com platform admin (the `supportTickets` query widens for
11
+ * those accounts and would otherwise leak every user's tickets here).
12
+ * - `true` (admin routes): query `supportTickets`, the cross-user/admin read.
13
+ *
14
+ * In consumer mode, search runs locally over the loaded self-scoped tickets
15
+ * rather than calling the server `searchTickets` resolver, which applies the
16
+ * same platform-admin widening and would re-introduce the leak.
17
+ */
18
+ export declare function useTicketListOperations(adminView?: boolean): {
19
+ tickets: SupportTicket[];
20
+ ticketsLoading: boolean;
21
+ ticketsError: import("@apollo/client").ErrorLike | undefined;
22
+ totalTickets: any;
23
+ hasMoreTickets: boolean;
24
+ isScopedLocalSearch: boolean;
25
+ isMissingProductScope: boolean;
26
+ loadMoreTickets: () => void;
27
+ refetchTickets: (variables?: any) => Promise<{
28
+ data: any;
29
+ error?: import("@apollo/client").ErrorLike;
30
+ }>;
31
+ };
@@ -0,0 +1,39 @@
1
+ import { SupportTicketStatus, type SupportTicket, type CreateSupportTicketInput, type UpdateSupportTicketInput, type CreateSupportMessageInput, type SubmitSatisfactionSurveyInput } from '../../generated/global-types';
2
+ interface UseTicketOperationsOptions {
3
+ loadAgentProfiles?: boolean;
4
+ }
5
+ export declare function useTicketOperations(options?: UseTicketOperationsOptions): {
6
+ tickets: SupportTicket[];
7
+ ticketDetail: any;
8
+ agentProfiles: any;
9
+ totalTickets: any;
10
+ hasMoreTickets: any;
11
+ ticketsLoading: boolean;
12
+ ticketDetailLoading: boolean;
13
+ agentProfilesLoading: boolean;
14
+ createTicketLoading: boolean;
15
+ updateTicketLoading: boolean;
16
+ assignTicketLoading: boolean;
17
+ changeStatusLoading: boolean;
18
+ addMessageLoading: boolean;
19
+ submitSurveyLoading: boolean;
20
+ ticketsError: import("@apollo/client").ErrorLike | undefined;
21
+ ticketDetailError: import("@apollo/client").ErrorLike | undefined;
22
+ createTicket: (input: CreateSupportTicketInput) => Promise<any>;
23
+ updateTicket: (id: string, input: UpdateSupportTicketInput) => Promise<any>;
24
+ assignTicket: (ticketId: string, assignedTo: string) => Promise<any>;
25
+ changeTicketStatus: (ticketId: string, status: SupportTicketStatus) => Promise<any>;
26
+ addTicketMessage: (input: CreateSupportMessageInput) => Promise<any>;
27
+ submitSatisfactionSurvey: (input: SubmitSatisfactionSurveyInput) => Promise<any>;
28
+ loadMoreTickets: () => void;
29
+ refetchTickets: (variables?: any) => Promise<{
30
+ data: any;
31
+ error?: import("@apollo/client").ErrorLike;
32
+ }>;
33
+ refetchTicketDetail: (variables?: any) => Promise<{
34
+ data: any;
35
+ error?: import("@apollo/client").ErrorLike;
36
+ }>;
37
+ setSelectedTicket: (ticket: SupportTicket | null) => void;
38
+ };
39
+ export {};
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Support Microfrontend
3
+ *
4
+ * Provides a comprehensive customer support and help desk UI for the Burdenoff
5
+ * multi-tenant platform. This is a GLOBAL module (uses the global API gateway).
6
+ *
7
+ * Features:
8
+ * - Ticket management (create, track, respond)
9
+ * - Ticket conversation thread
10
+ * - Knowledge base and help center
11
+ * - Support analytics and reporting
12
+ * - SLA tracking and alerts
13
+ *
14
+ * Pick a root based on who the host shell serves:
15
+ * - `SupportUserRoot` — end-user app-shells (vibecontrols-app, workspaces,
16
+ * bigconsole, botlit-app, etc.). Tickets + KB browse only.
17
+ * - `SupportAdminRoot` — admin-app. Adds contact-inquiry inbox, KB authoring,
18
+ * analytics, and settings.
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * import { SupportUserRoot, type SupportRootProps } from '@burdenoff/microfe-support';
23
+ *
24
+ * function App() {
25
+ * const props: SupportRootProps = {
26
+ * basePath: '/support',
27
+ * navigate: (path) => router.push(path),
28
+ * currentUser: { id: '1', email: 'user@example.com' },
29
+ * apiGatewayUrl: 'http://localhost:4000/global/graphql',
30
+ * authToken: 'token',
31
+ * onTicketCreated: (ticket) => console.log('Ticket created:', ticket),
32
+ * };
33
+ *
34
+ * return <SupportUserRoot {...props} />;
35
+ * }
36
+ * ```
37
+ */
38
+ export { SupportUserRoot } from './SupportUserRoot';
39
+ export { SupportAdminRoot } from './SupportAdminRoot';
40
+ export { SUPPORT_RYBBIT_EVENT_ALLOWLIST } from './events/rybbit';
41
+ export type { SupportRootProps, Ticket, SLAMetrics, ChatSession, ChatMessage, TicketFilters, AddTicketMessageInput, ViewMode, KnowledgeBaseArticleState, SupportTicketStatus, SupportTicketPriority, SLABreachStatus, } from './types';
42
+ export { useSupport } from './providers/SupportProvider';
43
+ export { useTicketOperations, useChatOperations, useKnowledgeBaseOperations, useAnalyticsOperations, useSupportStore, } from './hooks';
44
+ export { formatTicketStatus, getPriorityColor, getPriorityIcon, formatFileSize, formatTimeAgo, formatDuration, calculateSLAStatus, truncateText, getInitials, isValidEmail, stringToColor, } from './utils';
@@ -0,0 +1 @@
1
+ export declare function AnalyticsPage(): import("react/jsx-runtime").JSX.Element;
@@ -1,24 +1,24 @@
1
- import { Button as e, EmphasisPanel as t } from "../components/ui.js";
2
- import { EmptyState as n, LoadingState as r, PageLayout as i } from "../components/PageLayout.js";
3
- import { tWithFallback as a } from "../utils/i18n.js";
4
- import { useAnalyticsOperations as o } from "../hooks/useAnalyticsOperations.js";
5
- import { MetricCard as s } from "../components/analytics/MetricCard.js";
6
- import { TrendChart as c } from "../components/analytics/TrendChart.js";
7
- import { PriorityBreakdown as l } from "../components/analytics/PriorityBreakdown.js";
8
- import { CategoryBreakdown as u } from "../components/analytics/CategoryBreakdown.js";
9
- import { SLAReport as d } from "../components/analytics/SLAReport.js";
10
- import { TopAgents as f } from "../components/analytics/TopAgents.js";
11
- import { SatisfactionDistribution as p } from "../components/analytics/SatisfactionDistribution.js";
12
- import { BarChart3 as m, Calendar as h, CheckCircle as g, Clock as _, Download as v, ShieldAlert as y, ThumbsUp as b, TrendingUp as x } from "lucide-react";
13
- import { jsx as S, jsxs as C } from "react/jsx-runtime";
14
- import { useI18n as w } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
1
+ import { Button as e, EmphasisPanel as t, NextSteps as n, PagePurpose as r } from "../components/ui.js";
2
+ import { EmptyState as i, LoadingState as a, PageLayout as o } from "../components/PageLayout.js";
3
+ import { tWithFallback as s } from "../utils/i18n.js";
4
+ import { useAnalyticsOperations as c } from "../hooks/useAnalyticsOperations.js";
5
+ import { MetricCard as l } from "../components/analytics/MetricCard.js";
6
+ import { TrendChart as u } from "../components/analytics/TrendChart.js";
7
+ import { PriorityBreakdown as d } from "../components/analytics/PriorityBreakdown.js";
8
+ import { CategoryBreakdown as f } from "../components/analytics/CategoryBreakdown.js";
9
+ import { SLAReport as p } from "../components/analytics/SLAReport.js";
10
+ import { TopAgents as m } from "../components/analytics/TopAgents.js";
11
+ import { SatisfactionDistribution as h } from "../components/analytics/SatisfactionDistribution.js";
12
+ import { BarChart3 as g, Calendar as _, CheckCircle as v, Clock as y, Download as b, ShieldAlert as x, ThumbsUp as S, TrendingUp as C } from "lucide-react";
13
+ import { jsx as w, jsxs as T } from "react/jsx-runtime";
14
+ import { useI18n as E } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
15
15
  //#region src/support/pages/AnalyticsPage.tsx
16
- function T(e) {
16
+ function D(e) {
17
17
  if (!e) return !1;
18
18
  let t = String(e).toLowerCase();
19
19
  return t.includes("forbidden") || t.includes("not authorized") || t.includes("permission denied") || t.includes("admin");
20
20
  }
21
- var E = [
21
+ var O = [
22
22
  {
23
23
  value: "LAST_7_DAYS",
24
24
  label: "Last 7 Days"
@@ -36,72 +36,72 @@ var E = [
36
36
  label: "Last Year"
37
37
  }
38
38
  ];
39
- function D() {
40
- let { t: D } = w(), O = (e, t) => a(D, e, t), { analytics: k, trends: A, slaReport: j, satisfaction: M, agentLeaderboard: N, period: P, analyticsLoading: F, trendsLoading: I, updatePeriod: L, exportReport: R, analyticsError: z, slaReportError: B, satisfactionError: V } = o();
41
- if (T(z) || T(B) || T(V)) return /* @__PURE__ */ S(i, {
42
- title: O("support.analytics.title", "Support Analytics"),
43
- subtitle: O("support.analytics.subtitle", "View support performance metrics"),
44
- icon: /* @__PURE__ */ S(m, { size: 24 }),
45
- children: /* @__PURE__ */ S(n, {
46
- icon: /* @__PURE__ */ S(y, { size: 48 }),
47
- title: O("support.analytics.adminRequired.title", "Admin Access Required"),
48
- description: O("support.analytics.adminRequired.description", "You need administrator privileges to view support analytics. Please contact your workspace admin for access.")
39
+ function k() {
40
+ let { t: k } = E(), A = (e, t) => s(k, e, t), { analytics: j, trends: M, slaReport: N, satisfaction: P, agentLeaderboard: F, period: I, analyticsLoading: L, trendsLoading: R, updatePeriod: z, exportReport: B, analyticsError: V, slaReportError: H, satisfactionError: U } = c();
41
+ if (D(V) || D(H) || D(U)) return /* @__PURE__ */ w(o, {
42
+ title: A("support.analytics.title", "Support Analytics"),
43
+ subtitle: A("support.analytics.subtitle", "View support performance metrics"),
44
+ icon: /* @__PURE__ */ w(g, { size: 24 }),
45
+ children: /* @__PURE__ */ w(i, {
46
+ icon: /* @__PURE__ */ w(x, { size: 48 }),
47
+ title: A("support.analytics.adminRequired.title", "Admin Access Required"),
48
+ description: A("support.analytics.adminRequired.description", "You need administrator privileges to view support analytics. Please contact your workspace admin for access.")
49
49
  })
50
50
  });
51
- if (F || I) return /* @__PURE__ */ S(i, {
52
- title: O("support.analytics.title", "Support Analytics"),
53
- subtitle: O("support.analytics.loadingSubtitle", "Loading analytics data..."),
54
- icon: /* @__PURE__ */ S(m, { size: 24 }),
55
- children: /* @__PURE__ */ S(r, { message: O("support.analytics.loading", "Loading analytics...") })
51
+ if (L || R) return /* @__PURE__ */ w(o, {
52
+ title: A("support.analytics.title", "Support Analytics"),
53
+ subtitle: A("support.analytics.loadingSubtitle", "Loading analytics data..."),
54
+ icon: /* @__PURE__ */ w(g, { size: 24 }),
55
+ children: /* @__PURE__ */ w(a, { message: A("support.analytics.loading", "Loading analytics...") })
56
56
  });
57
- if (!k || k.stats.totalTickets === 0) return /* @__PURE__ */ S(i, {
58
- title: O("support.analytics.title", "Support Analytics"),
59
- subtitle: O("support.analytics.subtitle", "View support performance metrics"),
60
- icon: /* @__PURE__ */ S(m, { size: 24 }),
61
- children: /* @__PURE__ */ S(n, {
57
+ if (!j || j.stats.totalTickets === 0) return /* @__PURE__ */ w(o, {
58
+ title: A("support.analytics.title", "Support Analytics"),
59
+ subtitle: A("support.analytics.subtitle", "View support performance metrics"),
60
+ icon: /* @__PURE__ */ w(g, { size: 24 }),
61
+ children: /* @__PURE__ */ w(i, {
62
62
  illustration: "empty-data",
63
- title: O("support.analytics.noData.title", "No analytics data available"),
64
- description: O("support.analytics.noData.description", "Analytics data will appear once there's ticket activity to report.")
63
+ title: A("support.analytics.noData.title", "No analytics data available"),
64
+ description: A("support.analytics.noData.description", "Analytics data will appear once there's ticket activity to report.")
65
65
  })
66
66
  });
67
- let H = E.find((e) => e.value === P)?.label || "Custom", U = {
68
- startDate: j?.startDate ?? M?.startDate ?? (/* @__PURE__ */ new Date()).toISOString(),
69
- endDate: j?.endDate ?? M?.endDate ?? (/* @__PURE__ */ new Date()).toISOString(),
70
- label: H
71
- }, W = {
72
- total: k.stats.totalTickets,
73
- open: k.stats.openTickets,
74
- resolved: k.stats.resolvedTickets,
75
- avgResponseTimeHours: k.stats.averageFirstResponseTimeHours || 0,
76
- avgResolutionTimeHours: k.stats.averageResolutionTimeHours || 0,
77
- byPriority: k.priorityBreakdown
78
- }, G = {
79
- period: U,
80
- totalTickets: j?.totalTickets ?? k.stats.totalTickets,
81
- firstResponseCompliance: j?.firstResponseCompliance ?? k.stats.slaComplianceRate ?? 0,
82
- resolutionCompliance: j?.resolutionCompliance ?? k.stats.slaComplianceRate ?? 0,
83
- avgFirstResponseTime: j?.averageFirstResponseMinutes || 0,
84
- avgResolutionTime: j?.averageResolutionMinutes || 0,
85
- breachedTickets: j?.totalBreaches ?? 0,
86
- byPriority: (j?.byPriority ?? []).map((e) => ({
67
+ let W = O.find((e) => e.value === I)?.label || "Custom", G = {
68
+ startDate: N?.startDate ?? P?.startDate ?? (/* @__PURE__ */ new Date()).toISOString(),
69
+ endDate: N?.endDate ?? P?.endDate ?? (/* @__PURE__ */ new Date()).toISOString(),
70
+ label: W
71
+ }, K = {
72
+ total: j.stats.totalTickets,
73
+ open: j.stats.openTickets,
74
+ resolved: j.stats.resolvedTickets,
75
+ avgResponseTimeHours: j.stats.averageFirstResponseTimeHours || 0,
76
+ avgResolutionTimeHours: j.stats.averageResolutionTimeHours || 0,
77
+ byPriority: j.priorityBreakdown
78
+ }, q = {
79
+ period: G,
80
+ totalTickets: N?.totalTickets ?? j.stats.totalTickets,
81
+ firstResponseCompliance: N?.firstResponseCompliance ?? j.stats.slaComplianceRate ?? 0,
82
+ resolutionCompliance: N?.resolutionCompliance ?? j.stats.slaComplianceRate ?? 0,
83
+ avgFirstResponseTime: N?.averageFirstResponseMinutes || 0,
84
+ avgResolutionTime: N?.averageResolutionMinutes || 0,
85
+ breachedTickets: N?.totalBreaches ?? 0,
86
+ byPriority: (N?.byPriority ?? []).map((e) => ({
87
87
  priority: e.priority,
88
88
  tickets: e.totalTickets,
89
89
  compliance: e.resolutionCompliance
90
90
  }))
91
- }, K = M?.ratingDistribution ?? [], q = {
92
- period: U,
93
- totalResponses: M?.totalResponses ?? 0,
94
- averageRating: M?.averageRating || 0,
95
- csat: M?.csatScore || 0,
96
- nps: M?.npsScore || 0,
91
+ }, J = P?.ratingDistribution ?? [], Y = {
92
+ period: G,
93
+ totalResponses: P?.totalResponses ?? 0,
94
+ averageRating: P?.averageRating || 0,
95
+ csat: P?.csatScore || 0,
96
+ nps: P?.npsScore || 0,
97
97
  ratings: {
98
- rating1: K.find((e) => e.rating === 1)?.count || 0,
99
- rating2: K.find((e) => e.rating === 2)?.count || 0,
100
- rating3: K.find((e) => e.rating === 3)?.count || 0,
101
- rating4: K.find((e) => e.rating === 4)?.count || 0,
102
- rating5: K.find((e) => e.rating === 5)?.count || 0
98
+ rating1: J.find((e) => e.rating === 1)?.count || 0,
99
+ rating2: J.find((e) => e.rating === 2)?.count || 0,
100
+ rating3: J.find((e) => e.rating === 3)?.count || 0,
101
+ rating4: J.find((e) => e.rating === 4)?.count || 0,
102
+ rating5: J.find((e) => e.rating === 5)?.count || 0
103
103
  }
104
- }, J = (N?.agents ?? []).map((e) => ({
104
+ }, X = (F?.agents ?? []).map((e) => ({
105
105
  rank: e.rank,
106
106
  ticketsResolved: e.ticketsResolved,
107
107
  avgRating: e.averageRating || 0,
@@ -113,93 +113,124 @@ function D() {
113
113
  email: e.agent.userId
114
114
  }
115
115
  }
116
- })), Y = (A.length > 0 ? A : k.ticketTrends).map((e) => ({
116
+ })), Z = (M.length > 0 ? M : j.ticketTrends).map((e) => ({
117
117
  timestamp: e.date,
118
118
  value: e.count,
119
119
  label: e.groupBy
120
120
  }));
121
- return /* @__PURE__ */ S(i, {
121
+ return /* @__PURE__ */ w(o, {
122
122
  title: "Support Analytics",
123
- subtitle: H,
124
- icon: /* @__PURE__ */ S(m, { size: 24 }),
125
- headerActions: /* @__PURE__ */ C("div", {
123
+ subtitle: W,
124
+ icon: /* @__PURE__ */ w(g, { size: 24 }),
125
+ headerActions: /* @__PURE__ */ T("div", {
126
126
  className: "flex items-center gap-3",
127
- children: [/* @__PURE__ */ C("div", {
127
+ children: [/* @__PURE__ */ T("div", {
128
128
  className: "flex items-center gap-2",
129
- children: [/* @__PURE__ */ S(h, {
129
+ children: [/* @__PURE__ */ w(_, {
130
130
  size: 20,
131
131
  className: "text-text-secondary"
132
- }), /* @__PURE__ */ S("select", {
133
- value: P,
134
- onChange: (e) => L(e.target.value),
132
+ }), /* @__PURE__ */ w("select", {
133
+ value: I,
134
+ onChange: (e) => z(e.target.value),
135
135
  className: "px-3 py-2 rounded-lg border border-border-subtle bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary",
136
- children: E.map((e) => /* @__PURE__ */ S("option", {
136
+ children: O.map((e) => /* @__PURE__ */ w("option", {
137
137
  value: e.value,
138
138
  children: e.label
139
139
  }, e.value))
140
140
  })]
141
- }), /* @__PURE__ */ C(e, {
142
- onClick: () => R("PDF"),
143
- children: [/* @__PURE__ */ S(v, { size: 18 }), O("support.analytics.export", "Export")]
141
+ }), /* @__PURE__ */ T(e, {
142
+ onClick: () => B("PDF"),
143
+ children: [/* @__PURE__ */ w(b, { size: 18 }), A("support.analytics.export", "Export")]
144
144
  })]
145
145
  }),
146
- children: /* @__PURE__ */ C("div", {
146
+ children: /* @__PURE__ */ T("div", {
147
147
  className: "space-y-6",
148
148
  children: [
149
- /* @__PURE__ */ S(t, {
149
+ /* @__PURE__ */ w(r, { children: "Measure how your support operation is performing. Track ticket volume, first-response and resolution times, SLA compliance and customer satisfaction so you can spot bottlenecks, balance agent workload, and prove the impact of your team. Adjust the period to compare trends over time." }),
150
+ /* @__PURE__ */ w(n, {
151
+ storageKey: "support-analytics",
152
+ title: "Make the most of your data",
153
+ steps: [
154
+ {
155
+ id: "period",
156
+ label: "Switch the reporting period",
157
+ description: "Compare the last 7, 30, 90 days or a full year to spot trends.",
158
+ onClick: () => z("LAST_90_DAYS")
159
+ },
160
+ {
161
+ id: "export",
162
+ label: "Export a PDF report",
163
+ description: "Share performance with stakeholders in one click.",
164
+ onClick: () => B("PDF")
165
+ },
166
+ {
167
+ id: "sla",
168
+ label: "Review SLA compliance",
169
+ description: "Scroll to the SLA report to see where commitments slipped.",
170
+ onClick: () => document.querySelector("[data-tour=\"support-analytics-sla\"]")?.scrollIntoView({
171
+ behavior: "smooth",
172
+ block: "start"
173
+ })
174
+ }
175
+ ]
176
+ }),
177
+ /* @__PURE__ */ w(t, {
150
178
  className: "p-4 sm:p-5",
151
- children: /* @__PURE__ */ C("div", {
179
+ children: /* @__PURE__ */ T("div", {
152
180
  className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",
153
181
  children: [
154
- /* @__PURE__ */ S(s, {
182
+ /* @__PURE__ */ w(l, {
155
183
  title: "Total Tickets",
156
- value: W.total.toString(),
157
- icon: x,
184
+ value: K.total.toString(),
185
+ icon: C,
158
186
  iconColor: "text-primary",
159
- subtitle: `${W.open} open, ${W.resolved} resolved`
187
+ subtitle: `${K.open} open, ${K.resolved} resolved`
160
188
  }),
161
- /* @__PURE__ */ S(s, {
189
+ /* @__PURE__ */ w(l, {
162
190
  title: "Avg Response Time",
163
- value: `${W.avgResponseTimeHours.toFixed(1)}h`,
164
- icon: _,
191
+ value: `${K.avgResponseTimeHours.toFixed(1)}h`,
192
+ icon: y,
165
193
  iconColor: "text-accent",
166
- subtitle: `Resolution: ${W.avgResolutionTimeHours.toFixed(1)}h`
194
+ subtitle: `Resolution: ${K.avgResolutionTimeHours.toFixed(1)}h`
167
195
  }),
168
- /* @__PURE__ */ S(s, {
196
+ /* @__PURE__ */ w(l, {
169
197
  title: "SLA Compliance",
170
- value: `${G.firstResponseCompliance.toFixed(1)}%`,
171
- icon: g,
172
- iconColor: G.firstResponseCompliance >= 90 ? "text-success" : "text-warning",
173
- subtitle: `${G.breachedTickets} breached`
198
+ value: `${q.firstResponseCompliance.toFixed(1)}%`,
199
+ icon: v,
200
+ iconColor: q.firstResponseCompliance >= 90 ? "text-success" : "text-warning",
201
+ subtitle: `${q.breachedTickets} breached`
174
202
  }),
175
- /* @__PURE__ */ S(s, {
203
+ /* @__PURE__ */ w(l, {
176
204
  title: "Satisfaction",
177
- value: q.averageRating.toFixed(1),
178
- icon: b,
205
+ value: Y.averageRating.toFixed(1),
206
+ icon: S,
179
207
  iconColor: "text-success",
180
- subtitle: `CSAT: ${q.csat.toFixed(0)}%, NPS: ${q.nps.toFixed(0)}`
208
+ subtitle: `CSAT: ${Y.csat.toFixed(0)}%, NPS: ${Y.nps.toFixed(0)}`
181
209
  })
182
210
  ]
183
211
  })
184
212
  }),
185
- /* @__PURE__ */ S(c, {
186
- trends: Y,
187
- period: q.period
213
+ /* @__PURE__ */ w(u, {
214
+ trends: Z,
215
+ period: Y.period
188
216
  }),
189
- /* @__PURE__ */ C("div", {
217
+ /* @__PURE__ */ T("div", {
190
218
  className: "grid grid-cols-1 lg:grid-cols-2 gap-6",
191
- children: [/* @__PURE__ */ S(l, { data: W.byPriority }), /* @__PURE__ */ S(u, { data: k.categoryBreakdown })]
219
+ children: [/* @__PURE__ */ w(d, { data: K.byPriority }), /* @__PURE__ */ w(f, { data: j.categoryBreakdown })]
220
+ }),
221
+ /* @__PURE__ */ w("div", {
222
+ "data-tour": "support-analytics-sla",
223
+ children: /* @__PURE__ */ w(p, { report: q })
192
224
  }),
193
- /* @__PURE__ */ S(d, { report: G }),
194
- /* @__PURE__ */ C("div", {
225
+ /* @__PURE__ */ T("div", {
195
226
  className: "grid grid-cols-1 lg:grid-cols-2 gap-6",
196
- children: [/* @__PURE__ */ S(p, { metrics: q }), /* @__PURE__ */ S(f, { agents: J })]
227
+ children: [/* @__PURE__ */ w(h, { metrics: Y }), /* @__PURE__ */ w(m, { agents: X })]
197
228
  })
198
229
  ]
199
230
  })
200
231
  });
201
232
  }
202
233
  //#endregion
203
- export { D as AnalyticsPage };
234
+ export { k as AnalyticsPage };
204
235
 
205
236
  //# sourceMappingURL=AnalyticsPage.js.map