@burdenoff/microfe-support 2026.531.2 → 2026.601.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 +67 -27
- package/dist/generated/global-operations.js.map +1 -1
- package/dist/support/SupportAdminRoutes.js +1 -1
- package/dist/support/SupportAdminRoutes.js.map +1 -1
- package/dist/support/hooks/useTicketListOperations.js +47 -41
- package/dist/support/hooks/useTicketListOperations.js.map +1 -1
- package/dist/support/pages/TicketListPage.js +80 -80
- package/dist/support/pages/TicketListPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupportAdminRoutes.js","names":[],"sources":["../../src/support/SupportAdminRoutes.tsx"],"sourcesContent":["import { lazy, Suspense } from 'react';\nimport { Routes, Route, Navigate, useLocation } from 'react-router-dom';\nimport { PageLoader, CatchAllRedirect } from './components/RouteHelpers';\n\n// TicketListPage is eagerly imported — it's the default landing page after redirect,\n// so lazy-loading would cause a visible loading flash on every initial navigation.\nimport { TicketListPage } from './pages/TicketListPage';\n\n// Lazy loaded pages — admin-specific variants for mixed pages\nconst TicketDetailAdminPage = lazy(() =>\n import('./pages/TicketDetailAdminPage').then((m) => ({ default: m.TicketDetailAdminPage }))\n);\nconst ContactInquiriesPage = lazy(() =>\n import('./pages/ContactInquiriesPage').then((m) => ({ default: m.ContactInquiriesPage }))\n);\nconst ContactInquiryDetailPage = lazy(() =>\n import('./pages/ContactInquiryDetailPage').then((m) => ({\n default: m.ContactInquiryDetailPage,\n }))\n);\nconst JobApplicationsPage = lazy(() =>\n import('./pages/JobApplicationsPage').then((m) => ({ default: m.JobApplicationsPage }))\n);\nconst JobApplicationDetailPage = lazy(() =>\n import('./pages/JobApplicationDetailPage').then((m) => ({\n default: m.JobApplicationDetailPage,\n }))\n);\nconst KnowledgeBaseAdminPage = lazy(() =>\n import('./pages/KnowledgeBaseAdminPage').then((m) => ({ default: m.KnowledgeBaseAdminPage }))\n);\nconst ArticleDetailAdminPage = lazy(() =>\n import('./pages/ArticleDetailAdminPage').then((m) => ({ default: m.ArticleDetailAdminPage }))\n);\nconst CreateArticlePage = lazy(() =>\n import('./pages/CreateArticlePage').then((m) => ({ default: m.CreateArticlePage }))\n);\nconst EditArticlePage = lazy(() =>\n import('./pages/EditArticlePage').then((m) => ({ default: m.EditArticlePage }))\n);\nconst AnalyticsPage = lazy(() =>\n import('./pages/AnalyticsPage').then((m) => ({ default: m.AnalyticsPage }))\n);\nconst SettingsPage = lazy(() =>\n import('./pages/SettingsPage').then((m) => ({ default: m.SettingsPage }))\n);\n\n// /knowledge-base/* deep links land here and immediately redirect to the canonical\n// /kb/* path so the URL stays consistent with the page-level navigation (which\n// hardcodes /kb paths). One wildcard route covers every sub-path so adding new\n// kb/* routes does not require maintaining a parallel knowledge-base/* mirror.\nfunction KnowledgeBaseAliasRedirect() {\n const location = useLocation();\n const targetPath = location.pathname.replace('/knowledge-base', '/kb');\n return <Navigate to={`${targetPath}${location.search}${location.hash}`} replace />;\n}\n\n/**\n * Admin-facing routes for the Support microfrontend.\n *\n * Includes all support management routes:\n * - Ticket management (list and view with full admin controls)\n * - Contact inquiries management\n * - Knowledge base authoring (create, edit, publish)\n * - Support analytics and reporting\n * - Support settings (SLA policies, canned responses, categories)\n *\n * User-only ticket and knowledge-base routes are excluded — see SupportUserRoutes for those.\n */\nexport function SupportAdminRoutes() {\n return (\n <Suspense fallback={<PageLoader />}>\n <Routes>\n {/* Default redirect */}\n <Route index element={<Navigate to=\"tickets\" replace />} />\n\n {/* Tickets */}\n <Route path=\"tickets\" element={<TicketListPage />} />\n <Route path=\"tickets/new\" element={<Navigate to=\"../tickets\" replace />} />\n <Route path=\"tickets/:ticketId\" element={<TicketDetailAdminPage />} />\n\n {/* Contact Inquiries */}\n <Route path=\"inquiries\" element={<ContactInquiriesPage />} />\n <Route path=\"inquiries/:id\" element={<ContactInquiryDetailPage />} />\n\n {/* Job Applications (careers form submissions) */}\n <Route path=\"applications\" element={<JobApplicationsPage />} />\n <Route path=\"applications/:id\" element={<JobApplicationDetailPage />} />\n\n {/* Knowledge Base (full authoring) — canonical /kb paths */}\n <Route path=\"kb\" element={<KnowledgeBaseAdminPage />} />\n <Route path=\"kb/articles/new\" element={<CreateArticlePage />} />\n <Route path=\"kb/articles/:slug\" element={<ArticleDetailAdminPage />} />\n <Route path=\"kb/articles/:slug/edit\" element={<EditArticlePage />} />\n\n {/* /knowledge-base/* alias — redirects to the canonical /kb/* path */}\n <Route path=\"knowledge-base/*\" element={<KnowledgeBaseAliasRedirect />} />\n\n {/* Analytics (admin/manager only) */}\n <Route path=\"analytics\" element={<AnalyticsPage />} />\n\n {/* Settings (admin only) */}\n <Route path=\"settings\" element={<SettingsPage />} />\n\n {/* Catch-all redirect */}\n <Route path=\"*\" element={<CatchAllRedirect />} />\n </Routes>\n </Suspense>\n );\n}\n"],"mappings":";;;;;;AASA,IAAM,IAAwB,QAC5B,OAAO,oCAAiC,MAAM,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAC5F,EACK,IAAuB,QAC3B,OAAO,mCAAgC,MAAM,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,CAC1F,EACK,IAA2B,QAC/B,OAAO,uCAAoC,MAAM,OAAO,EACtD,SAAS,EAAE,0BACZ,EAAE,CACJ,EACK,IAAsB,QAC1B,OAAO,kCAA+B,MAAM,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,CACxF,EACK,IAA2B,QAC/B,OAAO,uCAAoC,MAAM,OAAO,EACtD,SAAS,EAAE,0BACZ,EAAE,CACJ,EACK,IAAyB,QAC7B,OAAO,qCAAkC,MAAM,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,CAC9F,EACK,IAAyB,QAC7B,OAAO,qCAAkC,MAAM,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,CAC9F,EACK,IAAoB,QACxB,OAAO,gCAA6B,MAAM,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,CACpF,EACK,IAAkB,QACtB,OAAO,8BAA2B,MAAM,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAChF,EACK,IAAgB,QACpB,OAAO,4BAAyB,MAAM,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CAC5E,EACK,IAAe,QACnB,OAAO,2BAAwB,MAAM,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAC1E;AAMD,SAAS,IAA6B;CACpC,IAAM,IAAW,GAAa;AAE9B,QAAO,kBAAC,GAAD;EAAU,IAAI,GADF,EAAS,SAAS,QAAQ,mBAAmB,MAAM,GACjC,EAAS,SAAS,EAAS;EAAQ,SAAA;EAAU,CAAA;;AAepF,SAAgB,IAAqB;AACnC,QACE,kBAAC,GAAD;EAAU,UAAU,kBAAC,GAAD,EAAc,CAAA;YAChC,kBAAC,GAAD,EAAA,UAAA;GAEE,kBAAC,GAAD;IAAO,OAAA;IAAM,SAAS,kBAAC,GAAD;KAAU,IAAG;KAAU,SAAA;KAAU,CAAA;IAAI,CAAA;GAG3D,kBAAC,GAAD;IAAO,MAAK;IAAU,SAAS,kBAAC,GAAD,
|
|
1
|
+
{"version":3,"file":"SupportAdminRoutes.js","names":[],"sources":["../../src/support/SupportAdminRoutes.tsx"],"sourcesContent":["import { lazy, Suspense } from 'react';\nimport { Routes, Route, Navigate, useLocation } from 'react-router-dom';\nimport { PageLoader, CatchAllRedirect } from './components/RouteHelpers';\n\n// TicketListPage is eagerly imported — it's the default landing page after redirect,\n// so lazy-loading would cause a visible loading flash on every initial navigation.\nimport { TicketListPage } from './pages/TicketListPage';\n\n// Lazy loaded pages — admin-specific variants for mixed pages\nconst TicketDetailAdminPage = lazy(() =>\n import('./pages/TicketDetailAdminPage').then((m) => ({ default: m.TicketDetailAdminPage }))\n);\nconst ContactInquiriesPage = lazy(() =>\n import('./pages/ContactInquiriesPage').then((m) => ({ default: m.ContactInquiriesPage }))\n);\nconst ContactInquiryDetailPage = lazy(() =>\n import('./pages/ContactInquiryDetailPage').then((m) => ({\n default: m.ContactInquiryDetailPage,\n }))\n);\nconst JobApplicationsPage = lazy(() =>\n import('./pages/JobApplicationsPage').then((m) => ({ default: m.JobApplicationsPage }))\n);\nconst JobApplicationDetailPage = lazy(() =>\n import('./pages/JobApplicationDetailPage').then((m) => ({\n default: m.JobApplicationDetailPage,\n }))\n);\nconst KnowledgeBaseAdminPage = lazy(() =>\n import('./pages/KnowledgeBaseAdminPage').then((m) => ({ default: m.KnowledgeBaseAdminPage }))\n);\nconst ArticleDetailAdminPage = lazy(() =>\n import('./pages/ArticleDetailAdminPage').then((m) => ({ default: m.ArticleDetailAdminPage }))\n);\nconst CreateArticlePage = lazy(() =>\n import('./pages/CreateArticlePage').then((m) => ({ default: m.CreateArticlePage }))\n);\nconst EditArticlePage = lazy(() =>\n import('./pages/EditArticlePage').then((m) => ({ default: m.EditArticlePage }))\n);\nconst AnalyticsPage = lazy(() =>\n import('./pages/AnalyticsPage').then((m) => ({ default: m.AnalyticsPage }))\n);\nconst SettingsPage = lazy(() =>\n import('./pages/SettingsPage').then((m) => ({ default: m.SettingsPage }))\n);\n\n// /knowledge-base/* deep links land here and immediately redirect to the canonical\n// /kb/* path so the URL stays consistent with the page-level navigation (which\n// hardcodes /kb paths). One wildcard route covers every sub-path so adding new\n// kb/* routes does not require maintaining a parallel knowledge-base/* mirror.\nfunction KnowledgeBaseAliasRedirect() {\n const location = useLocation();\n const targetPath = location.pathname.replace('/knowledge-base', '/kb');\n return <Navigate to={`${targetPath}${location.search}${location.hash}`} replace />;\n}\n\n/**\n * Admin-facing routes for the Support microfrontend.\n *\n * Includes all support management routes:\n * - Ticket management (list and view with full admin controls)\n * - Contact inquiries management\n * - Knowledge base authoring (create, edit, publish)\n * - Support analytics and reporting\n * - Support settings (SLA policies, canned responses, categories)\n *\n * User-only ticket and knowledge-base routes are excluded — see SupportUserRoutes for those.\n */\nexport function SupportAdminRoutes() {\n return (\n <Suspense fallback={<PageLoader />}>\n <Routes>\n {/* Default redirect */}\n <Route index element={<Navigate to=\"tickets\" replace />} />\n\n {/* Tickets — admin triage lists all users' tickets */}\n <Route path=\"tickets\" element={<TicketListPage adminView />} />\n <Route path=\"tickets/new\" element={<Navigate to=\"../tickets\" replace />} />\n <Route path=\"tickets/:ticketId\" element={<TicketDetailAdminPage />} />\n\n {/* Contact Inquiries */}\n <Route path=\"inquiries\" element={<ContactInquiriesPage />} />\n <Route path=\"inquiries/:id\" element={<ContactInquiryDetailPage />} />\n\n {/* Job Applications (careers form submissions) */}\n <Route path=\"applications\" element={<JobApplicationsPage />} />\n <Route path=\"applications/:id\" element={<JobApplicationDetailPage />} />\n\n {/* Knowledge Base (full authoring) — canonical /kb paths */}\n <Route path=\"kb\" element={<KnowledgeBaseAdminPage />} />\n <Route path=\"kb/articles/new\" element={<CreateArticlePage />} />\n <Route path=\"kb/articles/:slug\" element={<ArticleDetailAdminPage />} />\n <Route path=\"kb/articles/:slug/edit\" element={<EditArticlePage />} />\n\n {/* /knowledge-base/* alias — redirects to the canonical /kb/* path */}\n <Route path=\"knowledge-base/*\" element={<KnowledgeBaseAliasRedirect />} />\n\n {/* Analytics (admin/manager only) */}\n <Route path=\"analytics\" element={<AnalyticsPage />} />\n\n {/* Settings (admin only) */}\n <Route path=\"settings\" element={<SettingsPage />} />\n\n {/* Catch-all redirect */}\n <Route path=\"*\" element={<CatchAllRedirect />} />\n </Routes>\n </Suspense>\n );\n}\n"],"mappings":"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"}
|
|
@@ -1,66 +1,72 @@
|
|
|
1
1
|
import { useSupport as e } from "../providers/SupportProvider.js";
|
|
2
2
|
import { isAdminRole as t } from "../utils/index.js";
|
|
3
3
|
import { useSupportStore as n } from "../store/supportStore.js";
|
|
4
|
-
import {
|
|
5
|
-
import { buildTicketFilter as
|
|
6
|
-
import { useEffect as
|
|
4
|
+
import { useGetMyTicketsQuery as r, useGetTicketsQuery as i, useSearchTicketsQuery as a } from "../../generated/global-operations.js";
|
|
5
|
+
import { buildTicketFilter as o, matchesTicketClientFilters as s, matchesTicketSearch as c, scopeTicketFilterToProduct as l } from "../utils/ticketFilters.js";
|
|
6
|
+
import { useEffect as u, useMemo as d, useState as f } from "react";
|
|
7
7
|
//#region src/support/hooks/useTicketListOperations.ts
|
|
8
|
-
function
|
|
9
|
-
let { currentUser:
|
|
10
|
-
|
|
8
|
+
function p(p = !1) {
|
|
9
|
+
let { currentUser: m, productId: h, showAllProductTickets: g } = e(), _ = n((e) => e.ticketFilter), v = n((e) => e.updateTicketFilter), [y, b] = f(() => _.search.trim()), x = !p, S = !t(m?.role) && !g, C = !S || !!h, w = S ? h : void 0, T = x ? 100 : S ? 50 : 10;
|
|
10
|
+
u(() => {
|
|
11
11
|
let e = setTimeout(() => {
|
|
12
|
-
|
|
12
|
+
b(_.search.trim());
|
|
13
13
|
}, 300);
|
|
14
14
|
return () => clearTimeout(e);
|
|
15
|
-
}, [
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}, [
|
|
20
|
-
|
|
15
|
+
}, [_.search]);
|
|
16
|
+
let E = d(() => l(o(_), w), [w, _]), D = x ? !!y : !!(w && y);
|
|
17
|
+
u(() => {
|
|
18
|
+
C || console.warn("Support ticket list requires a productId for product-scoped views, but none was resolved.");
|
|
19
|
+
}, [C]), u(() => {
|
|
20
|
+
w && _.productId && _.productId !== w && (console.warn("Product-scoped ticket filter conflicts with active product scope; using scoped product."), v({ productId: null }));
|
|
21
21
|
}, [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
w,
|
|
23
|
+
_.productId,
|
|
24
|
+
v
|
|
25
25
|
]);
|
|
26
|
-
let
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
skip: !
|
|
26
|
+
let O = {
|
|
27
|
+
filter: E,
|
|
28
|
+
limit: T,
|
|
29
|
+
offset: 0
|
|
30
|
+
}, k = r({
|
|
31
|
+
variables: O,
|
|
32
|
+
skip: !x || !C,
|
|
33
|
+
notifyOnNetworkStatusChange: !0
|
|
34
|
+
}), A = i({
|
|
35
|
+
variables: O,
|
|
36
|
+
skip: x || !C,
|
|
33
37
|
notifyOnNetworkStatusChange: !0
|
|
34
|
-
}), { data: A, loading:
|
|
38
|
+
}), { data: j, loading: M, error: N, fetchMore: P, refetch: F } = x ? k : A, { data: I, loading: L } = a({
|
|
35
39
|
variables: {
|
|
36
|
-
query:
|
|
40
|
+
query: y,
|
|
37
41
|
limit: 20
|
|
38
42
|
},
|
|
39
|
-
skip:
|
|
43
|
+
skip: x || y.length === 0 || D || !C,
|
|
40
44
|
notifyOnNetworkStatusChange: !0
|
|
41
|
-
}),
|
|
42
|
-
let e =
|
|
43
|
-
|
|
45
|
+
}), R = () => {
|
|
46
|
+
let e = j?.supportTickets?.nodes?.length || 0;
|
|
47
|
+
j?.supportTickets?.hasMore && P({
|
|
44
48
|
variables: { offset: e },
|
|
45
49
|
updateQuery: (e, { fetchMoreResult: t }) => t ? { supportTickets: {
|
|
46
50
|
...t.supportTickets,
|
|
47
51
|
nodes: [...e.supportTickets?.nodes || [], ...t.supportTickets?.nodes || []]
|
|
48
52
|
} } : e
|
|
49
53
|
});
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
}, z = j?.supportTickets?.nodes || [], B = z;
|
|
55
|
+
C ? D ? B = z.filter((e) => c(e, y) && s(e, _)) : y && (B = (I?.searchTickets || []).filter((e) => s(e, _))) : B = [];
|
|
56
|
+
let V = D || !y, H = !!j?.supportTickets?.hasMore, U = x ? D && H : D;
|
|
57
|
+
return {
|
|
58
|
+
tickets: B,
|
|
59
|
+
ticketsLoading: V ? M : L,
|
|
60
|
+
ticketsError: N,
|
|
61
|
+
totalTickets: D ? B.length : j?.supportTickets?.totalCount || 0,
|
|
62
|
+
hasMoreTickets: H,
|
|
63
|
+
isScopedLocalSearch: U,
|
|
64
|
+
isMissingProductScope: !C,
|
|
65
|
+
loadMoreTickets: R,
|
|
66
|
+
refetchTickets: F
|
|
61
67
|
};
|
|
62
68
|
}
|
|
63
69
|
//#endregion
|
|
64
|
-
export {
|
|
70
|
+
export { p as useTicketListOperations };
|
|
65
71
|
|
|
66
72
|
//# 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 {
|
|
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 // Self mode loads a larger page so client-side search covers the user's full\n // (typically small) ticket set; admin keeps the paginated server behaviour.\n const ticketListLimit = selfScoped ? 100 : 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 notifyOnNetworkStatusChange: true,\n });\n const allTicketsResult = useGetTicketsQuery({\n variables: queryVariables,\n skip: selfScoped || !hasRequiredProductScope,\n notifyOnNetworkStatusChange: true,\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 notifyOnNetworkStatusChange: true,\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 100), 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,IAAM,EAAE,gBAAa,cAAW,6BAA0B,GAAY,EAChE,IAAe,GAAiB,MAAU,EAAM,aAAa,EAC7D,IAAqB,GAAiB,MAAU,EAAM,mBAAmB,EACzE,CAAC,GAAiB,KAAsB,QAAe,EAAa,OAAO,MAAM,CAAC,EAClF,IAAa,CAAC,GACd,IAAuB,CAAC,EAAY,GAAa,KAAK,IAAI,CAAC,GAC3D,IAA0B,CAAC,KAAwB,EAAQ,GAC3D,IAAkB,IAAuB,IAAY,KAAA,GAGrD,IAAkB,IAAa,MAAM,IAAuB,KAAK;AAEvE,SAAgB;EACd,IAAM,IAAQ,iBAAiB;AAC7B,KAAmB,EAAa,OAAO,MAAM,CAAC;KAC7C,IAAI;AAEP,eAAa,aAAa,EAAM;IAC/B,CAAC,EAAa,OAAO,CAAC;CAEzB,IAAM,IAAS,QACP,EAA2B,EAAkB,EAAa,EAAE,EAAgB,EAClF,CAAC,GAAiB,EAAa,CAChC,EAGK,IAAuB,IACzB,EAAQ,IACR,GAAQ,KAAmB;AAU/B,CARA,QAAgB;AACd,EAAK,KACH,QAAQ,KACN,4FACD;IAEF,CAAC,EAAwB,CAAC,EAE7B,QAAgB;AACd,EAAI,KAAmB,EAAa,aAAa,EAAa,cAAc,MAC1E,QAAQ,KACN,0FACD,EACD,EAAmB,EAAE,WAAW,MAAM,CAAC;IAExC;EAAC;EAAiB,EAAa;EAAW;EAAmB,CAAC;CAEjE,IAAM,IAAiB;EACrB;EACA,OAAO;EACP,QAAQ;EACT,EAKK,IAAkB,EAAqB;EAC3C,WAAW;EACX,MAAM,CAAC,KAAc,CAAC;EACtB,6BAA6B;EAC9B,CAAC,EACI,IAAmB,EAAmB;EAC1C,WAAW;EACX,MAAM,KAAc,CAAC;EACrB,6BAA6B;EAC9B,CAAC,EAEI,EACJ,MAAM,GACN,SAAS,GACT,OAAO,GACP,WAAW,GACX,SAAS,MACP,IAAa,IAAkB,GAE7B,EAAE,MAAM,GAAqB,SAAS,MAAkB,EAAsB;EAClF,WAAW;GACT,OAAO;GACP,OAAO;GACR;EAED,MACE,KACA,EAAgB,WAAW,KAC3B,KACA,CAAC;EACH,6BAA6B;EAC9B,CAAC,EAEI,UAAwB;EAC5B,IAAM,IAAe,GAAa,gBAAgB,OAAO,UAAU;AACnE,EAAI,GAAa,gBAAgB,WAC/B,EAAiB;GACf,WAAW,EACT,QAAQ,GACT;GACD,cAAc,GAAM,EAAE,yBACf,IACE,EACL,gBAAgB;IACd,GAAG,EAAgB;IACnB,OAAO,CACL,GAAI,EAAK,gBAAgB,SAAS,EAAE,EACpC,GAAI,EAAgB,gBAAgB,SAAS,EAAE,CAChD;IACF,EACF,GAT4B;GAWhC,CAAC;IAIA,IAAc,GAAa,gBAAgB,SAAS,EAAE,EACxD,IAA2B;AAE/B,CAAK,IAEM,IAET,IAAU,EAAY,QACnB,MACC,EAAoB,GAAQ,EAAgB,IAC5C,EAA2B,GAAQ,EAAa,CACnD,GACQ,MACT,KAAW,GAAqB,iBAAiB,EAAE,EAAE,QAAQ,MAC3D,EAA2B,GAAQ,EAAa,CACjD,IAXD,IAAU,EAAE;CAad,IAAM,IAAuB,KAAwB,CAAC,GAIhD,IAAU,EAAQ,GAAa,gBAAgB,SAC/C,IAAuB,IAAa,KAAwB,IAAU;AAE5E,QAAO;EACL;EACA,gBAAgB,IAAuB,IAAiB;EACxD;EACA,cAAc,IACV,EAAQ,SACR,GAAa,gBAAgB,cAAc;EAC/C,gBAAgB;EAChB,qBAAqB;EACrB,uBAAuB,CAAC;EACxB;EACA;EACD"}
|
|
@@ -32,16 +32,16 @@ var j = {
|
|
|
32
32
|
NORMAL: "Normal",
|
|
33
33
|
LOW: "Low"
|
|
34
34
|
};
|
|
35
|
-
function N() {
|
|
36
|
-
let
|
|
37
|
-
return
|
|
38
|
-
title: u(
|
|
39
|
-
subtitle: u(
|
|
35
|
+
function N({ adminView: k = !1 }) {
|
|
36
|
+
let N = w(), { t: P } = O(), { currentUser: F, showAllProductTickets: I } = e(), { tickets: L, ticketsLoading: R, ticketsError: z, hasMoreTickets: B, loadMoreTickets: V, totalTickets: H, isScopedLocalSearch: U, isMissingProductScope: W } = o(k), G = a((e) => e.viewMode), K = a((e) => e.setViewMode), q = a((e) => e.ticketFilter), J = a((e) => e.updateTicketFilter), [Y, X] = h(!1), Z = k && t(F?.role), Q = Z || I;
|
|
37
|
+
return R && L.length === 0 ? /* @__PURE__ */ E(l, {
|
|
38
|
+
title: u(P, "support.ticketList.title", "Support Tickets"),
|
|
39
|
+
subtitle: u(P, "support.ticketList.subtitle", "Manage and respond to customer support requests"),
|
|
40
40
|
icon: /* @__PURE__ */ E(C, { size: 24 }),
|
|
41
|
-
children: /* @__PURE__ */ E(c, { message: u(
|
|
42
|
-
}) :
|
|
43
|
-
title: u(
|
|
44
|
-
subtitle: u(
|
|
41
|
+
children: /* @__PURE__ */ E(c, { message: u(P, "support.ticketList.loading", "Loading tickets...") })
|
|
42
|
+
}) : z ? /* @__PURE__ */ E(l, {
|
|
43
|
+
title: u(P, "support.ticketList.title", "Support Tickets"),
|
|
44
|
+
subtitle: u(P, "support.ticketList.subtitle", "Manage and respond to customer support requests"),
|
|
45
45
|
icon: /* @__PURE__ */ E(C, { size: 24 }),
|
|
46
46
|
children: /* @__PURE__ */ D("div", {
|
|
47
47
|
className: "flex flex-col items-center justify-center py-16 text-center",
|
|
@@ -52,31 +52,31 @@ function N() {
|
|
|
52
52
|
}),
|
|
53
53
|
/* @__PURE__ */ E("h3", {
|
|
54
54
|
className: "text-lg font-semibold mb-2",
|
|
55
|
-
children: u(
|
|
55
|
+
children: u(P, "support.ticketList.error.title", "Failed to load tickets")
|
|
56
56
|
}),
|
|
57
57
|
/* @__PURE__ */ E("p", {
|
|
58
58
|
className: "text-sm text-muted-foreground max-w-md",
|
|
59
|
-
children:
|
|
59
|
+
children: z.message || u(P, "support.ticketList.error.description", "An error occurred while loading tickets. Please try again.")
|
|
60
60
|
})
|
|
61
61
|
]
|
|
62
62
|
})
|
|
63
63
|
}) : /* @__PURE__ */ D(l, {
|
|
64
|
-
title: u(
|
|
65
|
-
subtitle: u(
|
|
64
|
+
title: u(P, "support.ticketList.title", "Support Tickets"),
|
|
65
|
+
subtitle: u(P, "support.ticketList.subtitle", "Manage and respond to customer support requests"),
|
|
66
66
|
icon: /* @__PURE__ */ E(C, { size: 24 }),
|
|
67
67
|
headerActions: /* @__PURE__ */ D(r, {
|
|
68
68
|
"data-tour": "support-new-ticket-button",
|
|
69
|
-
onClick: () =>
|
|
70
|
-
children: [/* @__PURE__ */ E(x, { size: 18 }), u(
|
|
69
|
+
onClick: () => N("new"),
|
|
70
|
+
children: [/* @__PURE__ */ E(x, { size: 18 }), u(P, "support.ticketList.actions.newTicket", "New Ticket")]
|
|
71
71
|
}),
|
|
72
72
|
headerContent: /* @__PURE__ */ E("div", {
|
|
73
73
|
className: "flex items-center gap-2",
|
|
74
74
|
children: /* @__PURE__ */ E(n, {
|
|
75
75
|
variant: "secondary",
|
|
76
76
|
className: "font-medium",
|
|
77
|
-
children: u(
|
|
78
|
-
count:
|
|
79
|
-
label:
|
|
77
|
+
children: u(P, "support.ticketList.count", "{{count}} {{label}}", {
|
|
78
|
+
count: H,
|
|
79
|
+
label: H === 1 ? u(P, "support.ticketList.count.single", "ticket") : u(P, "support.ticketList.count.plural", "tickets")
|
|
80
80
|
})
|
|
81
81
|
})
|
|
82
82
|
}),
|
|
@@ -93,9 +93,9 @@ function N() {
|
|
|
93
93
|
}), /* @__PURE__ */ E(i, {
|
|
94
94
|
"data-tour": "support-ticket-search",
|
|
95
95
|
type: "text",
|
|
96
|
-
placeholder: u(
|
|
97
|
-
value:
|
|
98
|
-
onChange: (e) =>
|
|
96
|
+
placeholder: u(P, "support.ticketList.search.placeholder", "Search tickets..."),
|
|
97
|
+
value: q.search,
|
|
98
|
+
onChange: (e) => J({ search: e.target.value }),
|
|
99
99
|
className: "pl-[3.25rem]"
|
|
100
100
|
})]
|
|
101
101
|
}),
|
|
@@ -103,16 +103,16 @@ function N() {
|
|
|
103
103
|
"data-tour": "support-ticket-view-toggle",
|
|
104
104
|
className: "flex items-center gap-1 p-1 rounded-lg border bg-muted/50",
|
|
105
105
|
children: [/* @__PURE__ */ E(r, {
|
|
106
|
-
variant:
|
|
106
|
+
variant: G === "list" ? "secondary" : "ghost",
|
|
107
107
|
size: "sm",
|
|
108
|
-
onClick: () =>
|
|
108
|
+
onClick: () => K("list"),
|
|
109
109
|
className: "px-3",
|
|
110
110
|
"aria-label": "Show tickets as a list",
|
|
111
111
|
children: /* @__PURE__ */ E(y, { size: 18 })
|
|
112
112
|
}), /* @__PURE__ */ E(r, {
|
|
113
|
-
variant:
|
|
113
|
+
variant: G === "grid" ? "secondary" : "ghost",
|
|
114
114
|
size: "sm",
|
|
115
|
-
onClick: () =>
|
|
115
|
+
onClick: () => K("grid"),
|
|
116
116
|
className: "px-3",
|
|
117
117
|
"aria-label": "Show tickets as a grid",
|
|
118
118
|
children: /* @__PURE__ */ E(v, { size: 18 })
|
|
@@ -120,20 +120,20 @@ function N() {
|
|
|
120
120
|
}),
|
|
121
121
|
/* @__PURE__ */ D(r, {
|
|
122
122
|
"data-tour": "support-ticket-filters-button",
|
|
123
|
-
variant:
|
|
124
|
-
onClick: () =>
|
|
125
|
-
children: [/* @__PURE__ */ E(_, { size: 18 }), u(
|
|
123
|
+
variant: Y ? "secondary" : "outline",
|
|
124
|
+
onClick: () => X(!Y),
|
|
125
|
+
children: [/* @__PURE__ */ E(_, { size: 18 }), u(P, "support.ticketList.filters.toggle", "Filters")]
|
|
126
126
|
})
|
|
127
127
|
]
|
|
128
128
|
}),
|
|
129
|
-
|
|
129
|
+
U && /* @__PURE__ */ D("div", {
|
|
130
130
|
className: "flex items-start gap-2 rounded-lg border bg-muted/30 p-3 text-sm text-muted-foreground",
|
|
131
131
|
children: [/* @__PURE__ */ E(g, {
|
|
132
132
|
size: 16,
|
|
133
133
|
className: "mt-0.5 shrink-0"
|
|
134
|
-
}), /* @__PURE__ */ E("span", { children: u(
|
|
134
|
+
}), /* @__PURE__ */ E("span", { children: u(P, "support.ticketList.scopedSearch.hint", "Search results are limited to tickets already loaded for this product. Load more tickets to expand the searchable set.") })]
|
|
135
135
|
}),
|
|
136
|
-
|
|
136
|
+
Y && /* @__PURE__ */ E("div", {
|
|
137
137
|
className: "p-4 rounded-xl border bg-muted/30",
|
|
138
138
|
children: /* @__PURE__ */ D("div", {
|
|
139
139
|
className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",
|
|
@@ -141,72 +141,72 @@ function N() {
|
|
|
141
141
|
/* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("label", {
|
|
142
142
|
className: "block text-sm font-medium mb-2 text-muted-foreground",
|
|
143
143
|
htmlFor: "ticketlistpage-twithfallback-t-support-ticketlist-filte-0",
|
|
144
|
-
children: u(
|
|
144
|
+
children: u(P, "support.ticketList.filters.status.label", "Status")
|
|
145
145
|
}), /* @__PURE__ */ D("select", {
|
|
146
146
|
id: "ticketlistpage-twithfallback-t-support-ticketlist-filte-0",
|
|
147
|
-
value:
|
|
148
|
-
onChange: (e) =>
|
|
147
|
+
value: q.status,
|
|
148
|
+
onChange: (e) => J({ status: e.target.value }),
|
|
149
149
|
className: "w-full px-3 py-2 rounded-lg border bg-background text-foreground",
|
|
150
150
|
children: [
|
|
151
151
|
/* @__PURE__ */ E("option", {
|
|
152
152
|
value: "all",
|
|
153
|
-
children: u(
|
|
153
|
+
children: u(P, "support.ticketList.filters.status.all", "All Statuses")
|
|
154
154
|
}),
|
|
155
155
|
/* @__PURE__ */ E("option", {
|
|
156
156
|
value: "NEW",
|
|
157
|
-
children: u(
|
|
157
|
+
children: u(P, "support.shared.status.new", "New")
|
|
158
158
|
}),
|
|
159
159
|
/* @__PURE__ */ E("option", {
|
|
160
160
|
value: "IN_PROGRESS",
|
|
161
|
-
children: u(
|
|
161
|
+
children: u(P, "support.shared.status.inProgress", "In Progress")
|
|
162
162
|
}),
|
|
163
163
|
/* @__PURE__ */ E("option", {
|
|
164
164
|
value: "WAITING_CUSTOMER",
|
|
165
|
-
children: u(
|
|
165
|
+
children: u(P, "support.shared.status.waitingCustomer", "Waiting on Customer")
|
|
166
166
|
}),
|
|
167
167
|
/* @__PURE__ */ E("option", {
|
|
168
168
|
value: "RESOLVED",
|
|
169
|
-
children: u(
|
|
169
|
+
children: u(P, "support.shared.status.resolved", "Resolved")
|
|
170
170
|
}),
|
|
171
171
|
/* @__PURE__ */ E("option", {
|
|
172
172
|
value: "CLOSED",
|
|
173
|
-
children: u(
|
|
173
|
+
children: u(P, "support.shared.status.closed", "Closed")
|
|
174
174
|
}),
|
|
175
175
|
/* @__PURE__ */ E("option", {
|
|
176
176
|
value: "REOPENED",
|
|
177
|
-
children: u(
|
|
177
|
+
children: u(P, "support.shared.status.reopened", "Reopened")
|
|
178
178
|
})
|
|
179
179
|
]
|
|
180
180
|
})] }),
|
|
181
181
|
/* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("label", {
|
|
182
182
|
className: "block text-sm font-medium mb-2 text-muted-foreground",
|
|
183
183
|
htmlFor: "ticketlistpage-twithfallback-t-support-ticketlist-filte-2",
|
|
184
|
-
children: u(
|
|
184
|
+
children: u(P, "support.ticketList.filters.priority.label", "Priority")
|
|
185
185
|
}), /* @__PURE__ */ D("select", {
|
|
186
186
|
id: "ticketlistpage-twithfallback-t-support-ticketlist-filte-2",
|
|
187
|
-
value:
|
|
188
|
-
onChange: (e) =>
|
|
187
|
+
value: q.priority,
|
|
188
|
+
onChange: (e) => J({ priority: e.target.value }),
|
|
189
189
|
className: "w-full px-3 py-2 rounded-lg border bg-background text-foreground",
|
|
190
190
|
children: [
|
|
191
191
|
/* @__PURE__ */ E("option", {
|
|
192
192
|
value: "all",
|
|
193
|
-
children: u(
|
|
193
|
+
children: u(P, "support.ticketList.filters.priority.all", "All Priorities")
|
|
194
194
|
}),
|
|
195
195
|
/* @__PURE__ */ E("option", {
|
|
196
196
|
value: "CRITICAL",
|
|
197
|
-
children: u(
|
|
197
|
+
children: u(P, "support.shared.priority.critical", "Critical")
|
|
198
198
|
}),
|
|
199
199
|
/* @__PURE__ */ E("option", {
|
|
200
200
|
value: "HIGH",
|
|
201
|
-
children: u(
|
|
201
|
+
children: u(P, "support.shared.priority.high", "High")
|
|
202
202
|
}),
|
|
203
203
|
/* @__PURE__ */ E("option", {
|
|
204
204
|
value: "NORMAL",
|
|
205
|
-
children: u(
|
|
205
|
+
children: u(P, "support.shared.priority.normal", "Normal")
|
|
206
206
|
}),
|
|
207
207
|
/* @__PURE__ */ E("option", {
|
|
208
208
|
value: "LOW",
|
|
209
|
-
children: u(
|
|
209
|
+
children: u(P, "support.shared.priority.low", "Low")
|
|
210
210
|
})
|
|
211
211
|
]
|
|
212
212
|
})] }),
|
|
@@ -217,9 +217,9 @@ function N() {
|
|
|
217
217
|
}), /* @__PURE__ */ E(i, {
|
|
218
218
|
id: "ticket-filter-date-from",
|
|
219
219
|
type: "date",
|
|
220
|
-
value:
|
|
221
|
-
onChange: (e) =>
|
|
222
|
-
...
|
|
220
|
+
value: q.dateRange.start ? q.dateRange.start.toISOString().slice(0, 10) : "",
|
|
221
|
+
onChange: (e) => J({ dateRange: {
|
|
222
|
+
...q.dateRange,
|
|
223
223
|
start: e.target.value ? /* @__PURE__ */ new Date(`${e.target.value}T00:00:00`) : null
|
|
224
224
|
} })
|
|
225
225
|
})] }),
|
|
@@ -230,21 +230,21 @@ function N() {
|
|
|
230
230
|
}), /* @__PURE__ */ E(i, {
|
|
231
231
|
id: "ticket-filter-date-to",
|
|
232
232
|
type: "date",
|
|
233
|
-
value:
|
|
234
|
-
onChange: (e) =>
|
|
235
|
-
...
|
|
233
|
+
value: q.dateRange.end ? q.dateRange.end.toISOString().slice(0, 10) : "",
|
|
234
|
+
onChange: (e) => J({ dateRange: {
|
|
235
|
+
...q.dateRange,
|
|
236
236
|
end: e.target.value ? /* @__PURE__ */ new Date(`${e.target.value}T23:59:59`) : null
|
|
237
237
|
} })
|
|
238
238
|
})] }),
|
|
239
|
-
|
|
239
|
+
Z && /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("label", {
|
|
240
240
|
htmlFor: "ticket-filter-product",
|
|
241
241
|
className: "block text-sm font-medium mb-2 text-muted-foreground",
|
|
242
242
|
children: "Product"
|
|
243
243
|
}), /* @__PURE__ */ E(i, {
|
|
244
244
|
id: "ticket-filter-product",
|
|
245
245
|
type: "text",
|
|
246
|
-
value:
|
|
247
|
-
onChange: (e) =>
|
|
246
|
+
value: q.productId || "",
|
|
247
|
+
onChange: (e) => J({ productId: e.target.value || null }),
|
|
248
248
|
placeholder: "vibecontrols"
|
|
249
249
|
})] }), /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("label", {
|
|
250
250
|
htmlFor: "ticket-filter-assignee",
|
|
@@ -253,31 +253,31 @@ function N() {
|
|
|
253
253
|
}), /* @__PURE__ */ E(i, {
|
|
254
254
|
id: "ticket-filter-assignee",
|
|
255
255
|
type: "text",
|
|
256
|
-
value:
|
|
257
|
-
onChange: (e) =>
|
|
256
|
+
value: q.assignedToId || "",
|
|
257
|
+
onChange: (e) => J({ assignedToId: e.target.value || null }),
|
|
258
258
|
placeholder: "User ID"
|
|
259
259
|
})] })] })
|
|
260
260
|
]
|
|
261
261
|
})
|
|
262
262
|
}),
|
|
263
|
-
|
|
263
|
+
W ? /* @__PURE__ */ E(s, {
|
|
264
264
|
icon: /* @__PURE__ */ E(g, { size: 48 }),
|
|
265
|
-
title: u(
|
|
266
|
-
description: u(
|
|
267
|
-
}) :
|
|
265
|
+
title: u(P, "support.ticketList.missingProduct.title", "Unable to load tickets for this product"),
|
|
266
|
+
description: u(P, "support.ticketList.missingProduct.description", "This support view needs a product configuration before tickets can be loaded.")
|
|
267
|
+
}) : L.length === 0 ? /* @__PURE__ */ E(s, {
|
|
268
268
|
icon: /* @__PURE__ */ E(C, { size: 48 }),
|
|
269
|
-
title: u(
|
|
270
|
-
description: u(
|
|
269
|
+
title: u(P, "support.ticketList.empty.title", "No tickets found"),
|
|
270
|
+
description: u(P, "support.ticketList.empty.description", "Create your first support ticket to get started, or adjust your filters."),
|
|
271
271
|
action: /* @__PURE__ */ D(r, {
|
|
272
|
-
onClick: () =>
|
|
273
|
-
children: [/* @__PURE__ */ E(x, { size: 18 }), u(
|
|
272
|
+
onClick: () => N("new"),
|
|
273
|
+
children: [/* @__PURE__ */ E(x, { size: 18 }), u(P, "support.ticketList.empty.action", "Create Ticket")]
|
|
274
274
|
})
|
|
275
275
|
}) : /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E("div", {
|
|
276
|
-
className:
|
|
277
|
-
children:
|
|
276
|
+
className: G === "grid" ? "grid grid-cols-1 md:grid-cols-2 gap-4" : "space-y-3",
|
|
277
|
+
children: L.map((e) => /* @__PURE__ */ E("button", {
|
|
278
278
|
type: "button",
|
|
279
279
|
"data-tour": "support-ticket-card",
|
|
280
|
-
onClick: () =>
|
|
280
|
+
onClick: () => N(e.id),
|
|
281
281
|
className: "w-full text-left group p-4 rounded-xl border border-default bg-surface hover:border-primary/50 hover:shadow-md cursor-pointer transition-colors duration-150",
|
|
282
282
|
children: /* @__PURE__ */ D("div", {
|
|
283
283
|
className: "flex items-start justify-between gap-4",
|
|
@@ -302,7 +302,7 @@ function N() {
|
|
|
302
302
|
}),
|
|
303
303
|
e.slaBreachStatus && e.slaBreachStatus !== "NONE" && /* @__PURE__ */ E(n, {
|
|
304
304
|
className: d[e.slaBreachStatus],
|
|
305
|
-
children: e.slaBreachStatus === "BREACHED" ? u(
|
|
305
|
+
children: e.slaBreachStatus === "BREACHED" ? u(P, "support.ticketList.sla.breached", "SLA Breached") : u(P, "support.ticketList.sla.atRisk", "SLA At Risk")
|
|
306
306
|
})
|
|
307
307
|
]
|
|
308
308
|
}),
|
|
@@ -313,14 +313,14 @@ function N() {
|
|
|
313
313
|
/* @__PURE__ */ D("div", {
|
|
314
314
|
className: "flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground",
|
|
315
315
|
children: [
|
|
316
|
-
/* @__PURE__ */ E("span", { children: A(e, u(
|
|
316
|
+
/* @__PURE__ */ E("span", { children: A(e, u(P, "support.ticketList.category.general", "General")) }),
|
|
317
317
|
/* @__PURE__ */ E("span", { children: "•" }),
|
|
318
318
|
/* @__PURE__ */ E("span", { children: new Date(e.createdAt).toLocaleDateString() }),
|
|
319
|
-
|
|
319
|
+
Q && e.context?.productId && /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E("span", { children: "•" }), /* @__PURE__ */ E(n, {
|
|
320
320
|
variant: "outline",
|
|
321
321
|
children: e.context.productId
|
|
322
322
|
})] }),
|
|
323
|
-
e.assignedTo && /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E("span", { children: "•" }), /* @__PURE__ */ E("span", { children: u(
|
|
323
|
+
e.assignedTo && /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E("span", { children: "•" }), /* @__PURE__ */ E("span", { children: u(P, "support.ticketList.meta.assigned", "Assigned") })] })
|
|
324
324
|
]
|
|
325
325
|
})
|
|
326
326
|
]
|
|
@@ -334,16 +334,16 @@ function N() {
|
|
|
334
334
|
})]
|
|
335
335
|
})
|
|
336
336
|
}, e.id))
|
|
337
|
-
}),
|
|
337
|
+
}), B && /* @__PURE__ */ E("div", {
|
|
338
338
|
className: "flex justify-center pt-4",
|
|
339
339
|
children: /* @__PURE__ */ E(r, {
|
|
340
340
|
variant: "outline",
|
|
341
|
-
onClick:
|
|
342
|
-
disabled:
|
|
343
|
-
children:
|
|
341
|
+
onClick: V,
|
|
342
|
+
disabled: R,
|
|
343
|
+
children: R ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(b, {
|
|
344
344
|
size: 18,
|
|
345
345
|
className: "animate-spin"
|
|
346
|
-
}), u(
|
|
346
|
+
}), u(P, "support.ticketList.actions.loadingMore", "Loading...")] }) : u(P, "support.ticketList.actions.loadMore", "Load More")
|
|
347
347
|
})
|
|
348
348
|
})] })
|
|
349
349
|
]
|