@burdenoff/microfe-support 2026.1001.1 → 2026.1013.2

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.
@@ -132,7 +132,7 @@ function k() {
132
132
  }), /* @__PURE__ */ E("select", {
133
133
  value: R,
134
134
  onChange: (e) => V(e.target.value),
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",
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 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
136
136
  children: M.map((e) => /* @__PURE__ */ E("option", {
137
137
  value: e.value,
138
138
  children: e.label
@@ -1 +1 @@
1
- {"version":3,"file":"AnalyticsPage.js","names":[],"sources":["../../../src/support/pages/AnalyticsPage.tsx"],"sourcesContent":["import {\n BarChart3,\n TrendingUp,\n Clock,\n CheckCircle,\n Calendar,\n Download,\n ThumbsUp,\n ShieldAlert,\n} from 'lucide-react';\nimport { Button, EmphasisPanel, PagePurpose, NextSteps } from '../components/ui';\nimport { useAnalyticsOperations, type TimePeriod } from '../hooks/useAnalyticsOperations';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { useTr } from '../hooks/useTr';\nimport { tWithFallback } from '../utils/i18n';\nimport { MetricCard } from '../components/analytics/MetricCard';\nimport { TrendChart } from '../components/analytics/TrendChart';\nimport { PriorityBreakdown } from '../components/analytics/PriorityBreakdown';\nimport { CategoryBreakdown } from '../components/analytics/CategoryBreakdown';\nimport { SLAReport } from '../components/analytics/SLAReport';\nimport { TopAgents } from '../components/analytics/TopAgents';\nimport { SatisfactionDistribution } from '../components/analytics/SatisfactionDistribution';\nimport { PageLayout, LoadingState, EmptyState } from '../components/PageLayout';\n\n// Helper to check if error is a permission/authorization error\nfunction isPermissionError(error: unknown): boolean {\n if (!error) return false;\n const errorMessage = String(error).toLowerCase();\n return (\n errorMessage.includes('forbidden') ||\n errorMessage.includes('not authorized') ||\n errorMessage.includes('permission denied') ||\n errorMessage.includes('admin')\n );\n}\n\nexport function AnalyticsPage() {\n const { t } = useI18n();\n const tr = useTr();\n const trFallback = (key: string, fallback: string) => tWithFallback(t, key, fallback);\n\n const periodOptions: { value: TimePeriod; label: string }[] = [\n {\n value: 'LAST_7_DAYS' as TimePeriod,\n label: trFallback('support.analytics.period.last7', 'Last 7 Days'),\n },\n {\n value: 'LAST_30_DAYS' as TimePeriod,\n label: trFallback('support.analytics.period.last30', 'Last 30 Days'),\n },\n {\n value: 'LAST_90_DAYS' as TimePeriod,\n label: trFallback('support.analytics.period.last90', 'Last 90 Days'),\n },\n {\n value: 'LAST_YEAR' as TimePeriod,\n label: trFallback('support.analytics.period.lastYear', 'Last Year'),\n },\n ];\n\n const {\n analytics,\n trends,\n slaReport,\n satisfaction,\n agentLeaderboard,\n period,\n analyticsLoading,\n trendsLoading,\n updatePeriod,\n exportReport,\n analyticsError,\n slaReportError,\n satisfactionError,\n } = useAnalyticsOperations();\n\n // Check for permission errors across all analytics queries\n const hasPermissionError =\n isPermissionError(analyticsError) ||\n isPermissionError(slaReportError) ||\n isPermissionError(satisfactionError);\n\n if (hasPermissionError) {\n return (\n <PageLayout\n title={trFallback('support.analytics.title', 'Support Analytics')}\n subtitle={trFallback('support.analytics.subtitle', 'View support performance metrics')}\n icon={<BarChart3 size={24} />}\n >\n <EmptyState\n icon={<ShieldAlert size={48} />}\n title={trFallback('support.analytics.adminRequired.title', 'Admin Access Required')}\n description={trFallback(\n 'support.analytics.adminRequired.description',\n 'You need administrator privileges to view support analytics. Please contact your workspace admin for access.'\n )}\n />\n </PageLayout>\n );\n }\n\n if (analyticsLoading || trendsLoading) {\n return (\n <PageLayout\n title={trFallback('support.analytics.title', 'Support Analytics')}\n subtitle={trFallback('support.analytics.loadingSubtitle', 'Loading analytics data...')}\n icon={<BarChart3 size={24} />}\n >\n <LoadingState message={trFallback('support.analytics.loading', 'Loading analytics...')} />\n </PageLayout>\n );\n }\n\n if (!analytics || analytics.stats.totalTickets === 0) {\n return (\n <PageLayout\n title={trFallback('support.analytics.title', 'Support Analytics')}\n subtitle={trFallback('support.analytics.subtitle', 'View support performance metrics')}\n icon={<BarChart3 size={24} />}\n >\n <EmptyState\n illustration=\"empty-data\"\n title={trFallback('support.analytics.noData.title', 'No analytics data available')}\n description={trFallback(\n 'support.analytics.noData.description',\n \"Analytics data will appear once there's ticket activity to report.\"\n )}\n />\n </PageLayout>\n );\n }\n\n const periodLabel = periodOptions.find((option) => option.value === period)?.label || 'Custom';\n const periodRange = {\n startDate: slaReport?.startDate ?? satisfaction?.startDate ?? new Date().toISOString(),\n endDate: slaReport?.endDate ?? satisfaction?.endDate ?? new Date().toISOString(),\n label: periodLabel,\n };\n const ticketStats = {\n total: analytics.stats.totalTickets,\n open: analytics.stats.openTickets,\n resolved: analytics.stats.resolvedTickets,\n avgResponseTimeHours: analytics.stats.averageFirstResponseTimeHours || 0,\n avgResolutionTimeHours: analytics.stats.averageResolutionTimeHours || 0,\n byPriority: analytics.priorityBreakdown,\n };\n const transformedSlaReport = {\n period: periodRange,\n totalTickets: slaReport?.totalTickets ?? analytics.stats.totalTickets,\n firstResponseCompliance:\n slaReport?.firstResponseCompliance ?? analytics.stats.slaComplianceRate ?? 0,\n resolutionCompliance: slaReport?.resolutionCompliance ?? analytics.stats.slaComplianceRate ?? 0,\n avgFirstResponseTime: slaReport?.averageFirstResponseMinutes || 0,\n avgResolutionTime: slaReport?.averageResolutionMinutes || 0,\n breachedTickets: slaReport?.totalBreaches ?? 0,\n byPriority: (slaReport?.byPriority ?? []).map(\n (item: { priority: string; totalTickets: number; resolutionCompliance: number }) => ({\n priority: item.priority,\n tickets: item.totalTickets,\n compliance: item.resolutionCompliance,\n })\n ),\n };\n const ratingDistribution = satisfaction?.ratingDistribution ?? [];\n const satisfactionMetrics = {\n period: periodRange,\n totalResponses: satisfaction?.totalResponses ?? 0,\n averageRating: satisfaction?.averageRating || 0,\n csat: satisfaction?.csatScore || 0,\n nps: satisfaction?.npsScore || 0,\n ratings: {\n rating1:\n ratingDistribution.find((item: { rating: number; count: number }) => item.rating === 1)\n ?.count || 0,\n rating2:\n ratingDistribution.find((item: { rating: number; count: number }) => item.rating === 2)\n ?.count || 0,\n rating3:\n ratingDistribution.find((item: { rating: number; count: number }) => item.rating === 3)\n ?.count || 0,\n rating4:\n ratingDistribution.find((item: { rating: number; count: number }) => item.rating === 4)\n ?.count || 0,\n rating5:\n ratingDistribution.find((item: { rating: number; count: number }) => item.rating === 5)\n ?.count || 0,\n },\n };\n const topAgents = (agentLeaderboard?.agents ?? []).map(\n (item: {\n rank: number;\n ticketsResolved: number;\n averageRating?: number | null;\n agent: { id: string; userId: string };\n }) => ({\n rank: item.rank,\n ticketsResolved: item.ticketsResolved,\n avgRating: item.averageRating || 0,\n agent: {\n id: item.agent.id,\n user: {\n id: item.agent.userId,\n name: item.agent.userId,\n email: item.agent.userId,\n },\n },\n })\n );\n const trendSource = trends.length > 0 ? trends : analytics.ticketTrends;\n const trendChartData = trendSource.map(\n (trend: { date: string; count: number; groupBy: string }) => ({\n timestamp: trend.date,\n value: trend.count,\n label: trend.groupBy,\n })\n );\n\n return (\n <PageLayout\n title={tr('support.analytics.title', 'Support Analytics')}\n subtitle={periodLabel}\n icon={<BarChart3 size={24} />}\n headerActions={\n <div className=\"flex items-center gap-3\">\n {/* Period Selector */}\n <div className=\"flex items-center gap-2\">\n <Calendar size={20} className=\"text-text-secondary\" />\n <select\n value={period}\n onChange={(e) => updatePeriod(e.target.value as TimePeriod)}\n 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\"\n >\n {periodOptions.map((option) => (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n ))}\n </select>\n </div>\n\n {/* Export Button */}\n <Button onClick={() => exportReport('PDF')}>\n <Download size={18} />\n {trFallback('support.analytics.export', 'Export')}\n </Button>\n </div>\n }\n >\n <div className=\"space-y-6\">\n <PagePurpose>\n {tr(\n 'support.analytics.purpose',\n '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.'\n )}\n </PagePurpose>\n\n <NextSteps\n storageKey=\"support-analytics\"\n title={tr('support.analytics.nextSteps.title', 'Make the most of your data')}\n steps={[\n {\n id: 'period',\n label: tr('support.analytics.nextSteps.period.label', 'Switch the reporting period'),\n description: tr(\n 'support.analytics.nextSteps.period.description',\n 'Compare the last 7, 30, 90 days or a full year to spot trends.'\n ),\n onClick: () => updatePeriod('LAST_90_DAYS' as TimePeriod),\n },\n {\n id: 'export',\n label: tr('support.analytics.nextSteps.export.label', 'Export a PDF report'),\n description: tr(\n 'support.analytics.nextSteps.export.description',\n 'Share performance with stakeholders in one click.'\n ),\n onClick: () => exportReport('PDF'),\n },\n {\n id: 'sla',\n label: tr('support.analytics.nextSteps.sla.label', 'Review SLA compliance'),\n description: tr(\n 'support.analytics.nextSteps.sla.description',\n 'Scroll to the SLA report to see where commitments slipped.'\n ),\n onClick: () =>\n document\n .querySelector('[data-tour=\"support-analytics-sla\"]')\n ?.scrollIntoView({ behavior: 'smooth', block: 'start' }),\n },\n ]}\n />\n\n {/* Key Metrics — the single emphasis zone of the analytics page */}\n <EmphasisPanel className=\"p-4 sm:p-5\">\n <div className=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4\">\n <MetricCard\n title={tr('support.analytics.metric.totalTickets.title', 'Total Tickets')}\n value={ticketStats.total.toString()}\n icon={TrendingUp}\n iconColor=\"text-primary\"\n subtitle={tr(\n 'support.analytics.metric.totalTickets.subtitle',\n '{{open}} open, {{resolved}} resolved',\n { open: ticketStats.open, resolved: ticketStats.resolved }\n )}\n />\n <MetricCard\n title={tr('support.analytics.metric.avgResponseTime.title', 'Avg Response Time')}\n value={`${ticketStats.avgResponseTimeHours.toFixed(1)}h`}\n icon={Clock}\n iconColor=\"text-accent\"\n subtitle={tr(\n 'support.analytics.metric.avgResponseTime.subtitle',\n 'Resolution: {{resolution}}h',\n { resolution: ticketStats.avgResolutionTimeHours.toFixed(1) }\n )}\n />\n <MetricCard\n title={tr('support.analytics.metric.slaCompliance.title', 'SLA Compliance')}\n value={`${transformedSlaReport.firstResponseCompliance.toFixed(1)}%`}\n icon={CheckCircle}\n iconColor={\n transformedSlaReport.firstResponseCompliance >= 90 ? 'text-success' : 'text-warning'\n }\n subtitle={tr(\n 'support.analytics.metric.slaCompliance.subtitle',\n '{{count}} breached',\n { count: transformedSlaReport.breachedTickets }\n )}\n />\n <MetricCard\n title={tr('support.analytics.metric.satisfaction.title', 'Satisfaction')}\n value={satisfactionMetrics.averageRating.toFixed(1)}\n icon={ThumbsUp}\n iconColor=\"text-success\"\n subtitle={tr(\n 'support.analytics.metric.satisfaction.subtitle',\n 'CSAT: {{csat}}%, NPS: {{nps}}',\n {\n csat: satisfactionMetrics.csat.toFixed(0),\n nps: satisfactionMetrics.nps.toFixed(0),\n }\n )}\n />\n </div>\n </EmphasisPanel>\n\n {/* Ticket Trends Chart */}\n <TrendChart trends={trendChartData} period={satisfactionMetrics.period} />\n\n {/* Breakdowns Row */}\n <div className=\"grid grid-cols-1 lg:grid-cols-2 gap-6\">\n <PriorityBreakdown data={ticketStats.byPriority} />\n <CategoryBreakdown data={analytics.categoryBreakdown} />\n </div>\n\n {/* SLA Report */}\n <div data-tour=\"support-analytics-sla\">\n <SLAReport report={transformedSlaReport} />\n </div>\n\n {/* Bottom Row */}\n <div className=\"grid grid-cols-1 lg:grid-cols-2 gap-6\">\n <SatisfactionDistribution metrics={satisfactionMetrics} />\n <TopAgents agents={topAgents} />\n </div>\n </div>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAyBA,SAAS,EAAkB,GAAyB;C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Y,EAAY,uBAAuB,QAAQ,CAAC,EAAE,CAC9D;OACD,CAAA;OACD,kBAAC,GAAD;QACE,OAAO,EAAG,gDAAgD,gBAAgB;QAC1E,OAAO,GAAG,EAAqB,wBAAwB,QAAQ,CAAC,EAAE;QAClE,MAAM;QACN,WACE,EAAqB,2BAA2B,KAAK,iBAAiB;QAExE,UAAU,EACR,mDACA,sBACA,EAAE,OAAO,EAAqB,gBAAgB,CAChD;OACD,CAAA;OACD,kBAAC,GAAD;QACE,OAAO,EAAG,+CAA+C,cAAc;QACvE,OAAO,EAAoB,cAAc,QAAQ,CAAC;QAClD,MAAM;QACN,WAAU;QACV,UAAU,EACR,kDACA,iCACA;SACE,MAAM,EAAoB,KAAK,QAAQ,CAAC;SACxC,KAAK,EAAoB,IAAI,QAAQ,CAAC;QACxC,CACF;OACD,CAAA;MACE;;IACQ,CAAA;IAGf,kBAAC,GAAD;KAAY,QAAQ;KAAgB,QAAQ,EAAoB;IAAS,CAAA;IAGzE,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAAC,GAAD,EAAmB,MAAM,EAAY,WAAa,CAAA,GAClD,kBAAC,GAAD,EAAmB,MAAM,EAAU,kBAAoB,CAAA,CACpD;;IAGL,kBAAC,OAAD;KAAK,aAAU;KACb,UAAA,kBAAC,GAAD,EAAW,QAAQ,EAAuB,CAAA;IACvC,CAAA;IAGL,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAAC,GAAD,EAA0B,SAAS,EAAsB,CAAA,GACzD,kBAAC,GAAD,EAAW,QAAQ,EAAY,CAAA,CAC5B;;GACF;;CACK,CAAA;AAEhB"}
1
+ {"version":3,"file":"AnalyticsPage.js","names":[],"sources":["../../../src/support/pages/AnalyticsPage.tsx"],"sourcesContent":["import {\n BarChart3,\n TrendingUp,\n Clock,\n CheckCircle,\n Calendar,\n Download,\n ThumbsUp,\n ShieldAlert,\n} from 'lucide-react';\nimport { Button, EmphasisPanel, PagePurpose, NextSteps } from '../components/ui';\nimport { useAnalyticsOperations, type TimePeriod } from '../hooks/useAnalyticsOperations';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { useTr } from '../hooks/useTr';\nimport { tWithFallback } from '../utils/i18n';\nimport { MetricCard } from '../components/analytics/MetricCard';\nimport { TrendChart } from '../components/analytics/TrendChart';\nimport { PriorityBreakdown } from '../components/analytics/PriorityBreakdown';\nimport { CategoryBreakdown } from '../components/analytics/CategoryBreakdown';\nimport { SLAReport } from '../components/analytics/SLAReport';\nimport { TopAgents } from '../components/analytics/TopAgents';\nimport { SatisfactionDistribution } from '../components/analytics/SatisfactionDistribution';\nimport { PageLayout, LoadingState, EmptyState } from '../components/PageLayout';\n\n// Helper to check if error is a permission/authorization error\nfunction isPermissionError(error: unknown): boolean {\n if (!error) return false;\n const errorMessage = String(error).toLowerCase();\n return (\n errorMessage.includes('forbidden') ||\n errorMessage.includes('not authorized') ||\n errorMessage.includes('permission denied') ||\n errorMessage.includes('admin')\n );\n}\n\nexport function AnalyticsPage() {\n const { t } = useI18n();\n const tr = useTr();\n const trFallback = (key: string, fallback: string) => tWithFallback(t, key, fallback);\n\n const periodOptions: { value: TimePeriod; label: string }[] = [\n {\n value: 'LAST_7_DAYS' as TimePeriod,\n label: trFallback('support.analytics.period.last7', 'Last 7 Days'),\n },\n {\n value: 'LAST_30_DAYS' as TimePeriod,\n label: trFallback('support.analytics.period.last30', 'Last 30 Days'),\n },\n {\n value: 'LAST_90_DAYS' as TimePeriod,\n label: trFallback('support.analytics.period.last90', 'Last 90 Days'),\n },\n {\n value: 'LAST_YEAR' as TimePeriod,\n label: trFallback('support.analytics.period.lastYear', 'Last Year'),\n },\n ];\n\n const {\n analytics,\n trends,\n slaReport,\n satisfaction,\n agentLeaderboard,\n period,\n analyticsLoading,\n trendsLoading,\n updatePeriod,\n exportReport,\n analyticsError,\n slaReportError,\n satisfactionError,\n } = useAnalyticsOperations();\n\n // Check for permission errors across all analytics queries\n const hasPermissionError =\n isPermissionError(analyticsError) ||\n isPermissionError(slaReportError) ||\n isPermissionError(satisfactionError);\n\n if (hasPermissionError) {\n return (\n <PageLayout\n title={trFallback('support.analytics.title', 'Support Analytics')}\n subtitle={trFallback('support.analytics.subtitle', 'View support performance metrics')}\n icon={<BarChart3 size={24} />}\n >\n <EmptyState\n icon={<ShieldAlert size={48} />}\n title={trFallback('support.analytics.adminRequired.title', 'Admin Access Required')}\n description={trFallback(\n 'support.analytics.adminRequired.description',\n 'You need administrator privileges to view support analytics. Please contact your workspace admin for access.'\n )}\n />\n </PageLayout>\n );\n }\n\n if (analyticsLoading || trendsLoading) {\n return (\n <PageLayout\n title={trFallback('support.analytics.title', 'Support Analytics')}\n subtitle={trFallback('support.analytics.loadingSubtitle', 'Loading analytics data...')}\n icon={<BarChart3 size={24} />}\n >\n <LoadingState message={trFallback('support.analytics.loading', 'Loading analytics...')} />\n </PageLayout>\n );\n }\n\n if (!analytics || analytics.stats.totalTickets === 0) {\n return (\n <PageLayout\n title={trFallback('support.analytics.title', 'Support Analytics')}\n subtitle={trFallback('support.analytics.subtitle', 'View support performance metrics')}\n icon={<BarChart3 size={24} />}\n >\n <EmptyState\n illustration=\"empty-data\"\n title={trFallback('support.analytics.noData.title', 'No analytics data available')}\n description={trFallback(\n 'support.analytics.noData.description',\n \"Analytics data will appear once there's ticket activity to report.\"\n )}\n />\n </PageLayout>\n );\n }\n\n const periodLabel = periodOptions.find((option) => option.value === period)?.label || 'Custom';\n const periodRange = {\n startDate: slaReport?.startDate ?? satisfaction?.startDate ?? new Date().toISOString(),\n endDate: slaReport?.endDate ?? satisfaction?.endDate ?? new Date().toISOString(),\n label: periodLabel,\n };\n const ticketStats = {\n total: analytics.stats.totalTickets,\n open: analytics.stats.openTickets,\n resolved: analytics.stats.resolvedTickets,\n avgResponseTimeHours: analytics.stats.averageFirstResponseTimeHours || 0,\n avgResolutionTimeHours: analytics.stats.averageResolutionTimeHours || 0,\n byPriority: analytics.priorityBreakdown,\n };\n const transformedSlaReport = {\n period: periodRange,\n totalTickets: slaReport?.totalTickets ?? analytics.stats.totalTickets,\n firstResponseCompliance:\n slaReport?.firstResponseCompliance ?? analytics.stats.slaComplianceRate ?? 0,\n resolutionCompliance: slaReport?.resolutionCompliance ?? analytics.stats.slaComplianceRate ?? 0,\n avgFirstResponseTime: slaReport?.averageFirstResponseMinutes || 0,\n avgResolutionTime: slaReport?.averageResolutionMinutes || 0,\n breachedTickets: slaReport?.totalBreaches ?? 0,\n byPriority: (slaReport?.byPriority ?? []).map(\n (item: { priority: string; totalTickets: number; resolutionCompliance: number }) => ({\n priority: item.priority,\n tickets: item.totalTickets,\n compliance: item.resolutionCompliance,\n })\n ),\n };\n const ratingDistribution = satisfaction?.ratingDistribution ?? [];\n const satisfactionMetrics = {\n period: periodRange,\n totalResponses: satisfaction?.totalResponses ?? 0,\n averageRating: satisfaction?.averageRating || 0,\n csat: satisfaction?.csatScore || 0,\n nps: satisfaction?.npsScore || 0,\n ratings: {\n rating1:\n ratingDistribution.find((item: { rating: number; count: number }) => item.rating === 1)\n ?.count || 0,\n rating2:\n ratingDistribution.find((item: { rating: number; count: number }) => item.rating === 2)\n ?.count || 0,\n rating3:\n ratingDistribution.find((item: { rating: number; count: number }) => item.rating === 3)\n ?.count || 0,\n rating4:\n ratingDistribution.find((item: { rating: number; count: number }) => item.rating === 4)\n ?.count || 0,\n rating5:\n ratingDistribution.find((item: { rating: number; count: number }) => item.rating === 5)\n ?.count || 0,\n },\n };\n const topAgents = (agentLeaderboard?.agents ?? []).map(\n (item: {\n rank: number;\n ticketsResolved: number;\n averageRating?: number | null;\n agent: { id: string; userId: string };\n }) => ({\n rank: item.rank,\n ticketsResolved: item.ticketsResolved,\n avgRating: item.averageRating || 0,\n agent: {\n id: item.agent.id,\n user: {\n id: item.agent.userId,\n name: item.agent.userId,\n email: item.agent.userId,\n },\n },\n })\n );\n const trendSource = trends.length > 0 ? trends : analytics.ticketTrends;\n const trendChartData = trendSource.map(\n (trend: { date: string; count: number; groupBy: string }) => ({\n timestamp: trend.date,\n value: trend.count,\n label: trend.groupBy,\n })\n );\n\n return (\n <PageLayout\n title={tr('support.analytics.title', 'Support Analytics')}\n subtitle={periodLabel}\n icon={<BarChart3 size={24} />}\n headerActions={\n <div className=\"flex items-center gap-3\">\n {/* Period Selector */}\n <div className=\"flex items-center gap-2\">\n <Calendar size={20} className=\"text-text-secondary\" />\n <select\n value={period}\n onChange={(e) => updatePeriod(e.target.value as TimePeriod)}\n 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 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n {periodOptions.map((option) => (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n ))}\n </select>\n </div>\n\n {/* Export Button */}\n <Button onClick={() => exportReport('PDF')}>\n <Download size={18} />\n {trFallback('support.analytics.export', 'Export')}\n </Button>\n </div>\n }\n >\n <div className=\"space-y-6\">\n <PagePurpose>\n {tr(\n 'support.analytics.purpose',\n '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.'\n )}\n </PagePurpose>\n\n <NextSteps\n storageKey=\"support-analytics\"\n title={tr('support.analytics.nextSteps.title', 'Make the most of your data')}\n steps={[\n {\n id: 'period',\n label: tr('support.analytics.nextSteps.period.label', 'Switch the reporting period'),\n description: tr(\n 'support.analytics.nextSteps.period.description',\n 'Compare the last 7, 30, 90 days or a full year to spot trends.'\n ),\n onClick: () => updatePeriod('LAST_90_DAYS' as TimePeriod),\n },\n {\n id: 'export',\n label: tr('support.analytics.nextSteps.export.label', 'Export a PDF report'),\n description: tr(\n 'support.analytics.nextSteps.export.description',\n 'Share performance with stakeholders in one click.'\n ),\n onClick: () => exportReport('PDF'),\n },\n {\n id: 'sla',\n label: tr('support.analytics.nextSteps.sla.label', 'Review SLA compliance'),\n description: tr(\n 'support.analytics.nextSteps.sla.description',\n 'Scroll to the SLA report to see where commitments slipped.'\n ),\n onClick: () =>\n document\n .querySelector('[data-tour=\"support-analytics-sla\"]')\n ?.scrollIntoView({ behavior: 'smooth', block: 'start' }),\n },\n ]}\n />\n\n {/* Key Metrics — the single emphasis zone of the analytics page */}\n <EmphasisPanel className=\"p-4 sm:p-5\">\n <div className=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4\">\n <MetricCard\n title={tr('support.analytics.metric.totalTickets.title', 'Total Tickets')}\n value={ticketStats.total.toString()}\n icon={TrendingUp}\n iconColor=\"text-primary\"\n subtitle={tr(\n 'support.analytics.metric.totalTickets.subtitle',\n '{{open}} open, {{resolved}} resolved',\n { open: ticketStats.open, resolved: ticketStats.resolved }\n )}\n />\n <MetricCard\n title={tr('support.analytics.metric.avgResponseTime.title', 'Avg Response Time')}\n value={`${ticketStats.avgResponseTimeHours.toFixed(1)}h`}\n icon={Clock}\n iconColor=\"text-accent\"\n subtitle={tr(\n 'support.analytics.metric.avgResponseTime.subtitle',\n 'Resolution: {{resolution}}h',\n { resolution: ticketStats.avgResolutionTimeHours.toFixed(1) }\n )}\n />\n <MetricCard\n title={tr('support.analytics.metric.slaCompliance.title', 'SLA Compliance')}\n value={`${transformedSlaReport.firstResponseCompliance.toFixed(1)}%`}\n icon={CheckCircle}\n iconColor={\n transformedSlaReport.firstResponseCompliance >= 90 ? 'text-success' : 'text-warning'\n }\n subtitle={tr(\n 'support.analytics.metric.slaCompliance.subtitle',\n '{{count}} breached',\n { count: transformedSlaReport.breachedTickets }\n )}\n />\n <MetricCard\n title={tr('support.analytics.metric.satisfaction.title', 'Satisfaction')}\n value={satisfactionMetrics.averageRating.toFixed(1)}\n icon={ThumbsUp}\n iconColor=\"text-success\"\n subtitle={tr(\n 'support.analytics.metric.satisfaction.subtitle',\n 'CSAT: {{csat}}%, NPS: {{nps}}',\n {\n csat: satisfactionMetrics.csat.toFixed(0),\n nps: satisfactionMetrics.nps.toFixed(0),\n }\n )}\n />\n </div>\n </EmphasisPanel>\n\n {/* Ticket Trends Chart */}\n <TrendChart trends={trendChartData} period={satisfactionMetrics.period} />\n\n {/* Breakdowns Row */}\n <div className=\"grid grid-cols-1 lg:grid-cols-2 gap-6\">\n <PriorityBreakdown data={ticketStats.byPriority} />\n <CategoryBreakdown data={analytics.categoryBreakdown} />\n </div>\n\n {/* SLA Report */}\n <div data-tour=\"support-analytics-sla\">\n <SLAReport report={transformedSlaReport} />\n </div>\n\n {/* Bottom Row */}\n <div className=\"grid grid-cols-1 lg:grid-cols-2 gap-6\">\n <SatisfactionDistribution metrics={satisfactionMetrics} />\n <TopAgents agents={topAgents} />\n </div>\n </div>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAyBA,SAAS,EAAkB,GAAyB;CAClD,IAAI,CAAC,GAAO,OAAO;CACnB,IAAM,IAAe,OAAO,CAAK,CAAC,CAAC,YAAY;CAC/C,OACE,EAAa,SAAS,WAAW,KACjC,EAAa,SAAS,gBAAgB,KACtC,EAAa,SAAS,mBAAmB,KACzC,EAAa,SAAS,OAAO;AAEjC;AAEA,SAAgB,IAAgB;CAC9B,IAAM,EAAE,SAAM,EAAQ,GAChB,IAAK,EAAM,GACX,KAAc,GAAa,MAAqB,EAAc,GAAG,GAAK,CAAQ,GAE9E,IAAwD;EAC5D;GACE,OAAO;GACP,OAAO,EAAW,kCAAkC,aAAa;EACnE;EACA;GACE,OAAO;GACP,OAAO,EAAW,mCAAmC,cAAc;EACrE;EACA;GACE,OAAO;GACP,OAAO,EAAW,mCAAmC,cAAc;EACrE;EACA;GACE,OAAO;GACP,OAAO,EAAW,qCAAqC,WAAW;EACpE;CACF,GAEM,EACJ,cACA,WACA,cACA,iBACA,qBACA,WACA,qBACA,kBACA,iBACA,iBACA,mBACA,mBACA,yBACE,EAAuB;CAQ3B,IAJE,EAAkB,CAAc,KAChC,EAAkB,CAAc,KAChC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Aa,CAAA,GAClD,kBAAC,GAAD,EAAmB,MAAM,EAAU,kBAAoB,CAAA,CACpD;;IAGL,kBAAC,OAAD;KAAK,aAAU;KACb,UAAA,kBAAC,GAAD,EAAW,QAAQ,EAAuB,CAAA;IACvC,CAAA;IAGL,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAAC,GAAD,EAA0B,SAAS,EAAsB,CAAA,GACzD,kBAAC,GAAD,EAAW,QAAQ,EAAY,CAAA,CAC5B;;GACF;;CACK,CAAA;AAEhB"}
@@ -177,7 +177,7 @@ function M() {
177
177
  ...V,
178
178
  priority: e.target.value
179
179
  }),
180
- className: "w-full px-4 py-3 rounded-lg border bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors",
180
+ className: "w-full px-4 py-3 rounded-lg border bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
181
181
  children: [
182
182
  /* @__PURE__ */ O("option", {
183
183
  value: "LOW",
@@ -209,7 +209,7 @@ function M() {
209
209
  ...V,
210
210
  categoryId: e.target.value || void 0
211
211
  }),
212
- className: "w-full px-4 py-3 rounded-lg border bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors",
212
+ className: "w-full px-4 py-3 rounded-lg border bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
213
213
  children: [/* @__PURE__ */ O("option", {
214
214
  value: "",
215
215
  children: z ? P("support.createTicket.category.loading", "Loading categories...") : P("support.createTicket.category.select", "Select a category")
@@ -1 +1 @@
1
- {"version":3,"file":"CreateTicketPage.js","names":[],"sources":["../../../src/support/pages/CreateTicketPage.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { useNavigate } from 'react-router';\nimport { ArrowLeft, Loader2, Plus, Paperclip } from 'lucide-react';\nimport { Button, Input, GlassCard, PagePurpose } from '../components/ui';\nimport { useTicketOperations } from '../hooks/useTicketOperations';\nimport { useTr } from '../hooks/useTr';\nimport { useGetTicketCategoriesQuery } from '../../generated/global-operations';\nimport { useNotification } from '../hooks/useNotification';\nimport { PageLayout } from '../components/PageLayout';\nimport { NotificationToast } from '../components/NotificationToast';\nimport { useSupport } from '../providers/SupportProvider';\nimport { joinPath } from '../utils';\nimport { extractErrorMessage } from '../utils/errors';\nimport {\n SUPPORT_ATTACHMENT_ACCEPT,\n partitionAttachments,\n rejectedAttachmentsMessage,\n} from '../utils/attachments';\nimport { uploadSupportAttachmentFiles } from '../utils/supportFiles';\nimport { ATTACHMENTS_FAILED_PARAM } from '../constants';\nimport { SupportTicketPriority, type CreateSupportTicketInput } from '../../generated/global-types';\n\n/**\n * Client-side minimum lengths. Keep these in lockstep with the server-side\n * validators in global-support-svc/src/modules/support/utils/validation.ts —\n * when the server tightens or loosens these, update them here too. These are\n * best-effort UX hints only; the server's validation error is authoritative\n * and surfaces through `extractErrorMessage` on the catch path.\n */\nconst MIN_SUBJECT_LENGTH = 5;\nconst MIN_DESCRIPTION_LENGTH = 10;\n\nexport function CreateTicketPage() {\n const navigate = useNavigate();\n const { basePath = '' } = useSupport();\n const tr = useTr();\n const { createTicket, createTicketLoading, updateTicket } = useTicketOperations();\n const { data: categoriesData, loading: categoriesLoading } = useGetTicketCategoriesQuery({\n variables: {\n filter: { isActive: true },\n limit: 100,\n offset: 0,\n },\n });\n const activeCategories = [...(categoriesData?.ticketCategories?.nodes ?? [])].sort(\n (first, second) => first.displayOrder - second.displayOrder\n );\n const [formData, setFormData] = useState<CreateSupportTicketInput>({\n subject: '',\n description: '',\n priority: SupportTicketPriority.Normal,\n categoryId: undefined,\n });\n const [attachedFiles, setAttachedFiles] = useState<File[]>([]);\n const [uploadingFileName, setUploadingFileName] = useState<string | null>(null);\n const { notification, notify: showNotification } = useNotification();\n\n // Track the post-success navigate timer so unmounting mid-flight (Cancel\n // / back button / fast subsequent create) doesn't fire a delayed navigate.\n const navigateTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const clearNavigateTimeout = (): void => {\n if (navigateTimeoutRef.current) {\n clearTimeout(navigateTimeoutRef.current);\n navigateTimeoutRef.current = null;\n }\n };\n\n useEffect(() => clearNavigateTimeout, []);\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n\n if (formData.subject.trim().length < MIN_SUBJECT_LENGTH) {\n showNotification(\n 'error',\n tr(\n 'support.createTicket.validation.subjectMin',\n 'Subject must be at least {{min}} characters long.',\n { min: MIN_SUBJECT_LENGTH }\n )\n );\n return;\n }\n if ((formData.description ?? '').trim().length < MIN_DESCRIPTION_LENGTH) {\n showNotification(\n 'error',\n tr(\n 'support.createTicket.validation.descriptionMin',\n 'Description must be at least {{min}} characters long.',\n { min: MIN_DESCRIPTION_LENGTH }\n )\n );\n return;\n }\n\n try {\n const ticket = await createTicket({\n ...formData,\n priority: formData.priority ?? undefined,\n categoryId: formData.categoryId ?? undefined,\n });\n if (!ticket) {\n return;\n }\n\n if (attachedFiles.length > 0) {\n try {\n const uploadResult = await uploadSupportAttachmentFiles({\n ticketId: ticket.id,\n files: attachedFiles,\n onFileProgress: (fileName, progress) => {\n if (progress < 100) {\n setUploadingFileName(fileName);\n }\n },\n });\n\n await updateTicket(ticket.id, {\n metadata: {\n initialAttachmentIds: uploadResult.files.map((file) => file.id),\n },\n });\n setUploadingFileName(null);\n setAttachedFiles([]);\n } catch (uploadError) {\n setUploadingFileName(null);\n // Carry only a code-level flag in the URL — never the raw backend\n // error. Query strings persist in browser history, referer, proxy\n // logs, and analytics; a verbose server error (e.g. an S3 key, a\n // tenant id, a stack line) landing there is an information leak.\n // The destination page composes the user-facing message entirely\n // client-side via useAttachmentsFailedToast.\n console.error('[support] create ticket: attachments failed', uploadError);\n const nextParams = new URLSearchParams({\n [ATTACHMENTS_FAILED_PARAM]: '1',\n });\n navigate(joinPath(basePath, `tickets/${ticket.id}?${nextParams.toString()}`));\n return;\n }\n }\n\n showNotification(\n 'success',\n tr('support.createTicket.notifications.created', 'Ticket created successfully!')\n );\n clearNavigateTimeout();\n navigateTimeoutRef.current = setTimeout(() => {\n navigate(joinPath(basePath, `tickets/${ticket.id}`));\n navigateTimeoutRef.current = null;\n }, 1000);\n } catch (error) {\n // Prefer the server error message when available — client-side\n // validation (`MIN_SUBJECT_LENGTH` etc.) is best-effort; the server\n // is authoritative and its message is what should reach the user\n // if we reached the `createTicket` call and it rejected.\n const message = extractErrorMessage(\n error,\n tr('support.createTicket.errors.createFailed', 'Failed to create ticket. Please try again.')\n );\n showNotification('error', message, 5000);\n }\n };\n\n const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const files = Array.from(event.target.files || []);\n const { accepted, rejected } = partitionAttachments(files);\n if (accepted.length > 0) {\n setAttachedFiles((current) => [...current, ...accepted]);\n }\n if (rejected.length > 0) {\n showNotification('error', rejectedAttachmentsMessage(rejected), 6000);\n }\n event.target.value = '';\n };\n\n const removeAttachedFile = (fileIndex: number) => {\n setAttachedFiles((current) => current.filter((_, index) => index !== fileIndex));\n };\n\n return (\n <PageLayout showHeader={false}>\n <NotificationToast notification={notification} />\n\n {/* Header */}\n <div className=\"flex items-center gap-4 mb-6\">\n <Button variant=\"ghost\" size=\"sm\" onClick={() => navigate('..')} className=\"p-2\">\n <ArrowLeft size={20} />\n </Button>\n <div>\n <h1 className=\"text-2xl font-bold text-text-primary\">\n {tr('support.createTicket.title', 'Create New Ticket')}\n </h1>\n <p className=\"text-sm text-text-secondary\">\n {tr('support.createTicket.subtitle', 'Submit a new support request')}\n </p>\n </div>\n </div>\n\n <PagePurpose className=\"mb-6 max-w-2xl\">\n {tr(\n 'support.createTicket.purpose',\n 'Tell us what is going wrong and our support team will pick it up. The clearer your subject, description and priority, the faster we can help — attach screenshots, logs or files if they explain the problem. You will be able to follow the reply right here once it is submitted.'\n )}\n </PagePurpose>\n\n {/* Form */}\n <div className=\"max-w-2xl\">\n <form onSubmit={handleSubmit} className=\"space-y-6\">\n <GlassCard treatment=\"glass\" glow className=\"p-6 space-y-6\">\n <div>\n <label\n htmlFor=\"support-ticket-subject\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n {tr('support.createTicket.labels.subject', 'Subject')}{' '}\n <span className=\"text-status-error-text\">*</span>\n </label>\n <Input\n id=\"support-ticket-subject\"\n data-tour=\"support-ticket-subject\"\n type=\"text\"\n required\n value={formData.subject}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n setFormData({ ...formData, subject: e.target.value })\n }\n placeholder={tr(\n 'support.createTicket.placeholders.subject',\n 'Brief description of your issue'\n )}\n />\n </div>\n\n <div>\n <label\n htmlFor=\"support-ticket-description\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n {tr('support.createTicket.labels.description', 'Description')}{' '}\n <span className=\"text-status-error-text\">*</span>\n </label>\n <textarea\n id=\"support-ticket-description\"\n data-tour=\"support-ticket-description\"\n aria-label={tr('support.createTicket.labels.description', 'Description')}\n required\n rows={6}\n value={formData.description || ''}\n onChange={(e) => setFormData({ ...formData, description: e.target.value })}\n className=\"w-full px-4 py-3 rounded-lg border bg-bg-surface text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors\"\n placeholder={tr(\n 'support.createTicket.placeholders.description',\n 'Provide detailed information about your issue'\n )}\n />\n <p className=\"mt-2 text-xs text-text-secondary\">\n {tr(\n 'support.createTicket.markdownHint',\n 'Markdown is supported, including fenced code blocks.'\n )}\n </p>\n </div>\n\n <div>\n <label\n htmlFor=\"support-ticket-priority\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n {tr('support.createTicket.labels.priority', 'Priority')}\n </label>\n <select\n id=\"support-ticket-priority\"\n data-tour=\"support-ticket-priority\"\n value={formData.priority || 'NORMAL'}\n onChange={(e) =>\n setFormData({ ...formData, priority: e.target.value as SupportTicketPriority })\n }\n className=\"w-full px-4 py-3 rounded-lg border bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors\"\n >\n <option value=\"LOW\">\n {tr('support.createTicket.priority.low', 'Low - General question or minor issue')}\n </option>\n <option value=\"NORMAL\">\n {tr('support.createTicket.priority.normal', 'Normal - Standard support request')}\n </option>\n <option value=\"HIGH\">\n {tr('support.createTicket.priority.high', 'High - Significant impact on work')}\n </option>\n <option value=\"CRITICAL\">\n {tr(\n 'support.createTicket.priority.critical',\n 'Critical - Complete blocker, urgent'\n )}\n </option>\n </select>\n </div>\n\n <div>\n <label\n htmlFor=\"support-ticket-category\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n {tr('support.createTicket.labels.category', 'Category')}\n </label>\n <select\n id=\"support-ticket-category\"\n data-tour=\"support-ticket-category\"\n value={formData.categoryId || ''}\n onChange={(e) =>\n setFormData({\n ...formData,\n categoryId: e.target.value || undefined,\n })\n }\n className=\"w-full px-4 py-3 rounded-lg border bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors\"\n >\n <option value=\"\">\n {categoriesLoading\n ? tr('support.createTicket.category.loading', 'Loading categories...')\n : tr('support.createTicket.category.select', 'Select a category')}\n </option>\n {activeCategories.map((category) => (\n <option key={category.id} value={category.id}>\n {category.name}\n </option>\n ))}\n </select>\n </div>\n\n <div>\n <span\n id=\"create-ticket-attachments-heading\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n {tr('support.createTicket.labels.attachments', 'Attachments')}\n </span>\n <label\n data-tour=\"support-ticket-attachments\"\n className=\"flex cursor-pointer items-center justify-center gap-2 rounded-lg border border-dashed border-border-subtle bg-bg-sunken/20 p-4 text-sm text-text-secondary transition-colors hover:bg-bg-sunken/40\"\n >\n <Paperclip size={16} />\n <span>\n {tr(\n 'support.createTicket.attachments.label',\n 'Attach files, screenshots, logs, or documents'\n )}\n </span>\n <input\n type=\"file\"\n multiple\n aria-labelledby=\"create-ticket-attachments-heading\"\n className=\"hidden\"\n accept={SUPPORT_ATTACHMENT_ACCEPT}\n onChange={handleFileChange}\n />\n </label>\n\n {attachedFiles.length > 0 && (\n <div className=\"mt-3 flex flex-wrap gap-2\">\n {attachedFiles.map((file, index) => (\n <div\n key={`${file.name}-${index}`}\n className=\"flex items-center gap-2 rounded-lg border bg-bg-surface px-3 py-2 text-sm\"\n >\n <Paperclip size={14} />\n <span className=\"max-w-[240px] truncate\">{file.name}</span>\n <button\n type=\"button\"\n className=\"flex min-h-11 min-w-11 items-center justify-center rounded text-text-secondary hover:text-text-primary\"\n onClick={() => removeAttachedFile(index)}\n aria-label={tr(\n 'support.createTicket.attachments.remove',\n 'Remove attachment {{fileName}}',\n { fileName: file.name }\n )}\n >\n ×\n </button>\n </div>\n ))}\n </div>\n )}\n\n {uploadingFileName && (\n <p className=\"mt-2 text-xs text-text-secondary\">\n {tr('support.createTicket.attachments.uploading', 'Uploading {{fileName}}...', {\n fileName: uploadingFileName,\n })}\n </p>\n )}\n </div>\n </GlassCard>\n\n <div className=\"flex flex-col gap-3 sm:flex-row\">\n <Button\n type=\"submit\"\n data-tour=\"support-ticket-submit\"\n disabled={createTicketLoading || !formData.subject || !formData.description}\n className=\"flex-1\"\n >\n {createTicketLoading ? (\n <>\n <Loader2 size={18} className=\"animate-spin\" />\n {tr('support.createTicket.actions.submitting', 'Creating…')}\n </>\n ) : (\n <>\n <Plus size={18} />\n {tr('support.createTicket.actions.submit', 'Create Ticket')}\n </>\n )}\n </Button>\n <Button type=\"button\" variant=\"outline\" onClick={() => navigate('..')}>\n {tr('support.createTicket.actions.cancel', 'Cancel')}\n </Button>\n </div>\n </form>\n </div>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA6BA,IAAM,IAAqB,GACrB,IAAyB;AAE/B,SAAgB,IAAmB;CACjC,IAAM,IAAW,EAAY,GACvB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A,CACE,kBAAC,GAAD;OACE,MAAK;OACL,aAAU;OACV,UAAU,KAAuB,CAAC,EAAS,WAAW,CAAC,EAAS;OAChE,WAAU;OAET,UAAA,IACC,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD;QAAS,MAAM;QAAI,WAAU;OAAgB,CAAA,GAC5C,EAAG,2CAA2C,WAAW,CAC1D,EAAA,CAAA,IAEF,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD,EAAM,MAAM,GAAK,CAAA,GAChB,EAAG,uCAAuC,eAAe,CAC1D,EAAA,CAAA;MAEE,CAAA,GACR,kBAAC,GAAD;OAAQ,MAAK;OAAS,SAAQ;OAAU,eAAe,EAAS,IAAI;OACjE,UAAA,EAAG,uCAAuC,QAAQ;MAC7C,CAAA,CACL;KACD,CAAA,CAAA;;GACH,CAAA;EACK;;AAEhB"}
1
+ {"version":3,"file":"CreateTicketPage.js","names":[],"sources":["../../../src/support/pages/CreateTicketPage.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { useNavigate } from 'react-router';\nimport { ArrowLeft, Loader2, Plus, Paperclip } from 'lucide-react';\nimport { Button, Input, GlassCard, PagePurpose } from '../components/ui';\nimport { useTicketOperations } from '../hooks/useTicketOperations';\nimport { useTr } from '../hooks/useTr';\nimport { useGetTicketCategoriesQuery } from '../../generated/global-operations';\nimport { useNotification } from '../hooks/useNotification';\nimport { PageLayout } from '../components/PageLayout';\nimport { NotificationToast } from '../components/NotificationToast';\nimport { useSupport } from '../providers/SupportProvider';\nimport { joinPath } from '../utils';\nimport { extractErrorMessage } from '../utils/errors';\nimport {\n SUPPORT_ATTACHMENT_ACCEPT,\n partitionAttachments,\n rejectedAttachmentsMessage,\n} from '../utils/attachments';\nimport { uploadSupportAttachmentFiles } from '../utils/supportFiles';\nimport { ATTACHMENTS_FAILED_PARAM } from '../constants';\nimport { SupportTicketPriority, type CreateSupportTicketInput } from '../../generated/global-types';\n\n/**\n * Client-side minimum lengths. Keep these in lockstep with the server-side\n * validators in global-support-svc/src/modules/support/utils/validation.ts —\n * when the server tightens or loosens these, update them here too. These are\n * best-effort UX hints only; the server's validation error is authoritative\n * and surfaces through `extractErrorMessage` on the catch path.\n */\nconst MIN_SUBJECT_LENGTH = 5;\nconst MIN_DESCRIPTION_LENGTH = 10;\n\nexport function CreateTicketPage() {\n const navigate = useNavigate();\n const { basePath = '' } = useSupport();\n const tr = useTr();\n const { createTicket, createTicketLoading, updateTicket } = useTicketOperations();\n const { data: categoriesData, loading: categoriesLoading } = useGetTicketCategoriesQuery({\n variables: {\n filter: { isActive: true },\n limit: 100,\n offset: 0,\n },\n });\n const activeCategories = [...(categoriesData?.ticketCategories?.nodes ?? [])].sort(\n (first, second) => first.displayOrder - second.displayOrder\n );\n const [formData, setFormData] = useState<CreateSupportTicketInput>({\n subject: '',\n description: '',\n priority: SupportTicketPriority.Normal,\n categoryId: undefined,\n });\n const [attachedFiles, setAttachedFiles] = useState<File[]>([]);\n const [uploadingFileName, setUploadingFileName] = useState<string | null>(null);\n const { notification, notify: showNotification } = useNotification();\n\n // Track the post-success navigate timer so unmounting mid-flight (Cancel\n // / back button / fast subsequent create) doesn't fire a delayed navigate.\n const navigateTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const clearNavigateTimeout = (): void => {\n if (navigateTimeoutRef.current) {\n clearTimeout(navigateTimeoutRef.current);\n navigateTimeoutRef.current = null;\n }\n };\n\n useEffect(() => clearNavigateTimeout, []);\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n\n if (formData.subject.trim().length < MIN_SUBJECT_LENGTH) {\n showNotification(\n 'error',\n tr(\n 'support.createTicket.validation.subjectMin',\n 'Subject must be at least {{min}} characters long.',\n { min: MIN_SUBJECT_LENGTH }\n )\n );\n return;\n }\n if ((formData.description ?? '').trim().length < MIN_DESCRIPTION_LENGTH) {\n showNotification(\n 'error',\n tr(\n 'support.createTicket.validation.descriptionMin',\n 'Description must be at least {{min}} characters long.',\n { min: MIN_DESCRIPTION_LENGTH }\n )\n );\n return;\n }\n\n try {\n const ticket = await createTicket({\n ...formData,\n priority: formData.priority ?? undefined,\n categoryId: formData.categoryId ?? undefined,\n });\n if (!ticket) {\n return;\n }\n\n if (attachedFiles.length > 0) {\n try {\n const uploadResult = await uploadSupportAttachmentFiles({\n ticketId: ticket.id,\n files: attachedFiles,\n onFileProgress: (fileName, progress) => {\n if (progress < 100) {\n setUploadingFileName(fileName);\n }\n },\n });\n\n await updateTicket(ticket.id, {\n metadata: {\n initialAttachmentIds: uploadResult.files.map((file) => file.id),\n },\n });\n setUploadingFileName(null);\n setAttachedFiles([]);\n } catch (uploadError) {\n setUploadingFileName(null);\n // Carry only a code-level flag in the URL — never the raw backend\n // error. Query strings persist in browser history, referer, proxy\n // logs, and analytics; a verbose server error (e.g. an S3 key, a\n // tenant id, a stack line) landing there is an information leak.\n // The destination page composes the user-facing message entirely\n // client-side via useAttachmentsFailedToast.\n console.error('[support] create ticket: attachments failed', uploadError);\n const nextParams = new URLSearchParams({\n [ATTACHMENTS_FAILED_PARAM]: '1',\n });\n navigate(joinPath(basePath, `tickets/${ticket.id}?${nextParams.toString()}`));\n return;\n }\n }\n\n showNotification(\n 'success',\n tr('support.createTicket.notifications.created', 'Ticket created successfully!')\n );\n clearNavigateTimeout();\n navigateTimeoutRef.current = setTimeout(() => {\n navigate(joinPath(basePath, `tickets/${ticket.id}`));\n navigateTimeoutRef.current = null;\n }, 1000);\n } catch (error) {\n // Prefer the server error message when available — client-side\n // validation (`MIN_SUBJECT_LENGTH` etc.) is best-effort; the server\n // is authoritative and its message is what should reach the user\n // if we reached the `createTicket` call and it rejected.\n const message = extractErrorMessage(\n error,\n tr('support.createTicket.errors.createFailed', 'Failed to create ticket. Please try again.')\n );\n showNotification('error', message, 5000);\n }\n };\n\n const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const files = Array.from(event.target.files || []);\n const { accepted, rejected } = partitionAttachments(files);\n if (accepted.length > 0) {\n setAttachedFiles((current) => [...current, ...accepted]);\n }\n if (rejected.length > 0) {\n showNotification('error', rejectedAttachmentsMessage(rejected), 6000);\n }\n event.target.value = '';\n };\n\n const removeAttachedFile = (fileIndex: number) => {\n setAttachedFiles((current) => current.filter((_, index) => index !== fileIndex));\n };\n\n return (\n <PageLayout showHeader={false}>\n <NotificationToast notification={notification} />\n\n {/* Header */}\n <div className=\"flex items-center gap-4 mb-6\">\n <Button variant=\"ghost\" size=\"sm\" onClick={() => navigate('..')} className=\"p-2\">\n <ArrowLeft size={20} />\n </Button>\n <div>\n <h1 className=\"text-2xl font-bold text-text-primary\">\n {tr('support.createTicket.title', 'Create New Ticket')}\n </h1>\n <p className=\"text-sm text-text-secondary\">\n {tr('support.createTicket.subtitle', 'Submit a new support request')}\n </p>\n </div>\n </div>\n\n <PagePurpose className=\"mb-6 max-w-2xl\">\n {tr(\n 'support.createTicket.purpose',\n 'Tell us what is going wrong and our support team will pick it up. The clearer your subject, description and priority, the faster we can help — attach screenshots, logs or files if they explain the problem. You will be able to follow the reply right here once it is submitted.'\n )}\n </PagePurpose>\n\n {/* Form */}\n <div className=\"max-w-2xl\">\n <form onSubmit={handleSubmit} className=\"space-y-6\">\n <GlassCard treatment=\"glass\" glow className=\"p-6 space-y-6\">\n <div>\n <label\n htmlFor=\"support-ticket-subject\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n {tr('support.createTicket.labels.subject', 'Subject')}{' '}\n <span className=\"text-status-error-text\">*</span>\n </label>\n <Input\n id=\"support-ticket-subject\"\n data-tour=\"support-ticket-subject\"\n type=\"text\"\n required\n value={formData.subject}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n setFormData({ ...formData, subject: e.target.value })\n }\n placeholder={tr(\n 'support.createTicket.placeholders.subject',\n 'Brief description of your issue'\n )}\n />\n </div>\n\n <div>\n <label\n htmlFor=\"support-ticket-description\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n {tr('support.createTicket.labels.description', 'Description')}{' '}\n <span className=\"text-status-error-text\">*</span>\n </label>\n <textarea\n id=\"support-ticket-description\"\n data-tour=\"support-ticket-description\"\n aria-label={tr('support.createTicket.labels.description', 'Description')}\n required\n rows={6}\n value={formData.description || ''}\n onChange={(e) => setFormData({ ...formData, description: e.target.value })}\n className=\"w-full px-4 py-3 rounded-lg border bg-bg-surface text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors\"\n placeholder={tr(\n 'support.createTicket.placeholders.description',\n 'Provide detailed information about your issue'\n )}\n />\n <p className=\"mt-2 text-xs text-text-secondary\">\n {tr(\n 'support.createTicket.markdownHint',\n 'Markdown is supported, including fenced code blocks.'\n )}\n </p>\n </div>\n\n <div>\n <label\n htmlFor=\"support-ticket-priority\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n {tr('support.createTicket.labels.priority', 'Priority')}\n </label>\n <select\n id=\"support-ticket-priority\"\n data-tour=\"support-ticket-priority\"\n value={formData.priority || 'NORMAL'}\n onChange={(e) =>\n setFormData({ ...formData, priority: e.target.value as SupportTicketPriority })\n }\n className=\"w-full px-4 py-3 rounded-lg border bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"LOW\">\n {tr('support.createTicket.priority.low', 'Low - General question or minor issue')}\n </option>\n <option value=\"NORMAL\">\n {tr('support.createTicket.priority.normal', 'Normal - Standard support request')}\n </option>\n <option value=\"HIGH\">\n {tr('support.createTicket.priority.high', 'High - Significant impact on work')}\n </option>\n <option value=\"CRITICAL\">\n {tr(\n 'support.createTicket.priority.critical',\n 'Critical - Complete blocker, urgent'\n )}\n </option>\n </select>\n </div>\n\n <div>\n <label\n htmlFor=\"support-ticket-category\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n {tr('support.createTicket.labels.category', 'Category')}\n </label>\n <select\n id=\"support-ticket-category\"\n data-tour=\"support-ticket-category\"\n value={formData.categoryId || ''}\n onChange={(e) =>\n setFormData({\n ...formData,\n categoryId: e.target.value || undefined,\n })\n }\n className=\"w-full px-4 py-3 rounded-lg border bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"\">\n {categoriesLoading\n ? tr('support.createTicket.category.loading', 'Loading categories...')\n : tr('support.createTicket.category.select', 'Select a category')}\n </option>\n {activeCategories.map((category) => (\n <option key={category.id} value={category.id}>\n {category.name}\n </option>\n ))}\n </select>\n </div>\n\n <div>\n <span\n id=\"create-ticket-attachments-heading\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n {tr('support.createTicket.labels.attachments', 'Attachments')}\n </span>\n <label\n data-tour=\"support-ticket-attachments\"\n className=\"flex cursor-pointer items-center justify-center gap-2 rounded-lg border border-dashed border-border-subtle bg-bg-sunken/20 p-4 text-sm text-text-secondary transition-colors hover:bg-bg-sunken/40\"\n >\n <Paperclip size={16} />\n <span>\n {tr(\n 'support.createTicket.attachments.label',\n 'Attach files, screenshots, logs, or documents'\n )}\n </span>\n <input\n type=\"file\"\n multiple\n aria-labelledby=\"create-ticket-attachments-heading\"\n className=\"hidden\"\n accept={SUPPORT_ATTACHMENT_ACCEPT}\n onChange={handleFileChange}\n />\n </label>\n\n {attachedFiles.length > 0 && (\n <div className=\"mt-3 flex flex-wrap gap-2\">\n {attachedFiles.map((file, index) => (\n <div\n key={`${file.name}-${index}`}\n className=\"flex items-center gap-2 rounded-lg border bg-bg-surface px-3 py-2 text-sm\"\n >\n <Paperclip size={14} />\n <span className=\"max-w-[240px] truncate\">{file.name}</span>\n <button\n type=\"button\"\n className=\"flex min-h-11 min-w-11 items-center justify-center rounded text-text-secondary hover:text-text-primary\"\n onClick={() => removeAttachedFile(index)}\n aria-label={tr(\n 'support.createTicket.attachments.remove',\n 'Remove attachment {{fileName}}',\n { fileName: file.name }\n )}\n >\n ×\n </button>\n </div>\n ))}\n </div>\n )}\n\n {uploadingFileName && (\n <p className=\"mt-2 text-xs text-text-secondary\">\n {tr('support.createTicket.attachments.uploading', 'Uploading {{fileName}}...', {\n fileName: uploadingFileName,\n })}\n </p>\n )}\n </div>\n </GlassCard>\n\n <div className=\"flex flex-col gap-3 sm:flex-row\">\n <Button\n type=\"submit\"\n data-tour=\"support-ticket-submit\"\n disabled={createTicketLoading || !formData.subject || !formData.description}\n className=\"flex-1\"\n >\n {createTicketLoading ? (\n <>\n <Loader2 size={18} className=\"animate-spin\" />\n {tr('support.createTicket.actions.submitting', 'Creating…')}\n </>\n ) : (\n <>\n <Plus size={18} />\n {tr('support.createTicket.actions.submit', 'Create Ticket')}\n </>\n )}\n </Button>\n <Button type=\"button\" variant=\"outline\" onClick={() => navigate('..')}>\n {tr('support.createTicket.actions.cancel', 'Cancel')}\n </Button>\n </div>\n </form>\n </div>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA6BA,IAAM,IAAqB,GACrB,IAAyB;AAE/B,SAAgB,IAAmB;CACjC,IAAM,IAAW,EAAY,GACvB,EAAE,cAAW,OAAO,EAAW,GAC/B,IAAK,EAAM,GACX,EAAE,iBAAc,wBAAqB,oBAAiB,EAAoB,GAC1E,EAAE,MAAM,GAAgB,SAAS,MAAsB,EAA4B,EACvF,WAAW;EACT,QAAQ,EAAE,UAAU,GAAK;EACzB,OAAO;EACP,QAAQ;CACV,EACF,CAAC,GACK,IAAmB,CAAC,GAAI,GAAgB,kBAAkB,SAAS,CAAC,CAAE,CAAC,CAAC,MAC3E,GAAO,MAAW,EAAM,eAAe,EAAO,YACjD,GACM,CAAC,GAAU,KAAe,EAAmC;EACjE,SAAS;EACT,aAAa;EACb,UAAU,EAAsB;EAChC,YAAY,KAAA;CACd,CAAC,GACK,CAAC,GAAe,KAAoB,EAAiB,CAAC,CAAC,GAC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AQ;MAC7C,CAAA,CACL;KACD,CAAA,CAAA;;GACH,CAAA;EACK;;AAEhB"}
@@ -681,7 +681,7 @@ function j() {
681
681
  ...X,
682
682
  employmentType: e.target.value
683
683
  }),
684
- className: "w-full px-4 py-2.5 rounded-lg border border-border-default bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary",
684
+ className: "w-full px-4 py-2.5 rounded-lg border border-border-default bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
685
685
  children: [
686
686
  /* @__PURE__ */ x("option", {
687
687
  value: "",
@@ -715,7 +715,7 @@ function j() {
715
715
  ...X,
716
716
  status: e.target.value
717
717
  }),
718
- className: "w-full px-4 py-2.5 rounded-lg border border-border-default bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary",
718
+ className: "w-full px-4 py-2.5 rounded-lg border border-border-default bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
719
719
  children: [
720
720
  /* @__PURE__ */ x("option", {
721
721
  value: s.Draft,
@@ -904,7 +904,7 @@ function j() {
904
904
  ...R,
905
905
  roundType: e.target.value
906
906
  }),
907
- className: "w-full px-4 py-2.5 rounded-lg border border-border-default bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary",
907
+ className: "w-full px-4 py-2.5 rounded-lg border border-border-default bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
908
908
  children: Object.values(o).map((e) => /* @__PURE__ */ x("option", {
909
909
  value: e,
910
910
  children: Ne[e]