@burdenoff/microfe-support 2026.626.1 → 2026.716.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/dist/generated/global-operations.d.ts +2517 -0
  2. package/dist/generated/global-types.d.ts +22913 -0
  3. package/dist/generated/wspace-operations.d.ts +1 -0
  4. package/dist/generated/wspace-types.d.ts +57850 -0
  5. package/dist/index.d.ts +5 -0
  6. package/dist/support/SupportAdminRoot.d.ts +20 -0
  7. package/dist/support/SupportAdminRoutes.d.ts +13 -0
  8. package/dist/support/SupportUserRoot.d.ts +17 -0
  9. package/dist/support/SupportUserRoutes.d.ts +11 -0
  10. package/dist/support/components/NotificationToast.d.ts +17 -0
  11. package/dist/support/components/PageLayout.d.ts +71 -0
  12. package/dist/support/components/RouteHelpers.d.ts +9 -0
  13. package/dist/support/components/analytics/CategoryBreakdown.d.ts +9 -0
  14. package/dist/support/components/analytics/MetricCard.d.ts +10 -0
  15. package/dist/support/components/analytics/PriorityBreakdown.d.ts +9 -0
  16. package/dist/support/components/analytics/SLAReport.d.ts +23 -0
  17. package/dist/support/components/analytics/SatisfactionDistribution.d.ts +23 -0
  18. package/dist/support/components/analytics/TopAgents.d.ts +19 -0
  19. package/dist/support/components/analytics/TrendChart.d.ts +15 -0
  20. package/dist/support/components/kb/ArticleForm.d.ts +25 -0
  21. package/dist/support/components/kb/ArticleForm.js.map +1 -1
  22. package/dist/support/components/settings/CannedResponsesSettings.d.ts +21 -0
  23. package/dist/support/components/settings/CannedResponsesSettings.js.map +1 -1
  24. package/dist/support/components/settings/SLAPoliciesSettings.d.ts +18 -0
  25. package/dist/support/components/settings/TicketCategoriesSettings.d.ts +20 -0
  26. package/dist/support/components/tickets/AttachmentList.d.ts +7 -0
  27. package/dist/support/components/tickets/AttachmentList.js.map +1 -1
  28. package/dist/support/components/tickets/MarkdownContent.d.ts +7 -0
  29. package/dist/support/components/tickets/MessageComposer.d.ts +22 -0
  30. package/dist/support/components/tickets/MessageThread.d.ts +12 -0
  31. package/dist/support/components/tickets/TicketDetailHeader.d.ts +16 -0
  32. package/dist/support/components/tickets/TicketDetailHeader.js.map +1 -1
  33. package/dist/support/components/tickets/TicketHeader.d.ts +9 -0
  34. package/dist/support/components/tickets/TicketSidebar.d.ts +7 -0
  35. package/dist/support/components/tickets/TicketSidebar.js.map +1 -1
  36. package/dist/support/components/ui.d.ts +5 -0
  37. package/dist/support/constants.d.ts +20 -0
  38. package/dist/support/events/rybbit.d.ts +13 -0
  39. package/dist/support/hooks/index.d.ts +5 -0
  40. package/dist/support/hooks/useAnalyticsOperations.d.ts +51 -0
  41. package/dist/support/hooks/useAttachmentsFailedToast.d.ts +2 -0
  42. package/dist/support/hooks/useChatOperations.d.ts +27 -0
  43. package/dist/support/hooks/useKnowledgeBaseOperations.d.ts +55 -0
  44. package/dist/support/hooks/useNotification.d.ts +20 -0
  45. package/dist/support/hooks/useRegisterFooter.d.ts +6 -0
  46. package/dist/support/hooks/useSettingsOperations.d.ts +47 -0
  47. package/dist/support/hooks/useSupportAttachments.d.ts +10 -0
  48. package/dist/support/hooks/useTicketListOperations.d.ts +31 -0
  49. package/dist/support/hooks/useTicketOperations.d.ts +39 -0
  50. package/dist/support/index.d.ts +44 -0
  51. package/dist/support/pages/AnalyticsPage.d.ts +1 -0
  52. package/dist/support/pages/ArticleDetailAdminPage.d.ts +7 -0
  53. package/dist/support/pages/ArticleDetailUserPage.d.ts +7 -0
  54. package/dist/support/pages/ContactInquiriesPage.d.ts +1 -0
  55. package/dist/support/pages/ContactInquiryDetailPage.d.ts +1 -0
  56. package/dist/support/pages/ContactInquiryDetailPage.js +174 -166
  57. package/dist/support/pages/ContactInquiryDetailPage.js.map +1 -1
  58. package/dist/support/pages/CreateArticlePage.d.ts +1 -0
  59. package/dist/support/pages/CreateTicketPage.d.ts +1 -0
  60. package/dist/support/pages/CreateTicketPage.js.map +1 -1
  61. package/dist/support/pages/EditArticlePage.d.ts +1 -0
  62. package/dist/support/pages/JobApplicationDetailPage.d.ts +1 -0
  63. package/dist/support/pages/JobApplicationDetailPage.js.map +1 -1
  64. package/dist/support/pages/JobApplicationsPage.d.ts +1 -0
  65. package/dist/support/pages/JobApplicationsPage.js.map +1 -1
  66. package/dist/support/pages/KnowledgeBaseAdminPage.d.ts +7 -0
  67. package/dist/support/pages/KnowledgeBaseAdminPage.js.map +1 -1
  68. package/dist/support/pages/KnowledgeBaseUserPage.d.ts +8 -0
  69. package/dist/support/pages/SettingsPage.d.ts +1 -0
  70. package/dist/support/pages/SettingsPage.js.map +1 -1
  71. package/dist/support/pages/TicketDetailAdminPage.d.ts +8 -0
  72. package/dist/support/pages/TicketDetailAdminPage.js +102 -101
  73. package/dist/support/pages/TicketDetailAdminPage.js.map +1 -1
  74. package/dist/support/pages/TicketDetailUserPage.d.ts +8 -0
  75. package/dist/support/pages/TicketListPage.d.ts +11 -0
  76. package/dist/support/providers/SupportProvider.d.ts +16 -0
  77. package/dist/support/store/supportStore.d.ts +66 -0
  78. package/dist/support/types/index.d.ts +160 -0
  79. package/dist/support/utils/attachments.d.ts +27 -0
  80. package/dist/support/utils/breadcrumbRegistry.d.ts +2 -0
  81. package/dist/support/utils/breadcrumbRegistry.js +14 -0
  82. package/dist/support/utils/breadcrumbRegistry.js.map +1 -0
  83. package/dist/support/utils/categoryColors.d.ts +10 -0
  84. package/dist/support/utils/cn.d.ts +6 -0
  85. package/dist/support/utils/context.d.ts +2 -0
  86. package/dist/support/utils/errors.d.ts +2 -0
  87. package/dist/support/utils/i18n.d.ts +4 -0
  88. package/dist/support/utils/index.d.ts +57 -0
  89. package/dist/support/utils/markdown.d.ts +2 -0
  90. package/dist/support/utils/supportFiles.d.ts +15 -0
  91. package/dist/support/utils/ticketFilters.d.ts +6 -0
  92. package/dist/support/utils/uiTokens.d.ts +7 -0
  93. package/dist/utils/nativeBridge.d.ts +2 -0
  94. package/package.json +3 -3
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Support Microfrontend - Root Export
3
+ * Re-exports from the main support module for build-time composition
4
+ */
5
+ export * from './support';
@@ -0,0 +1,20 @@
1
+ import type { FC } from 'react';
2
+ import type { SupportRootProps } from './types';
3
+ /**
4
+ * Admin-facing root component for the Support microfrontend.
5
+ *
6
+ * Renders admin support management routes (tickets with full controls,
7
+ * contact inquiries, KB authoring, analytics, settings).
8
+ *
9
+ * Use this in admin-app where platform administrators manage support operations.
10
+ *
11
+ * Navigation registration is optional — admin-app uses shell-owned nav
12
+ * (NavRegistration.tsx with contentMfeProps), so registerNavItems won't be provided.
13
+ * Other shells that pass registerNavItems will get admin nav items registered.
14
+ *
15
+ * For user-facing support features, use SupportUserRoot instead.
16
+ *
17
+ * Note: This is a UI-layer route split, not a security boundary.
18
+ * Access control is enforced at the API/server level.
19
+ */
20
+ export declare const SupportAdminRoot: FC<SupportRootProps>;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Admin-facing routes for the Support microfrontend.
3
+ *
4
+ * Includes all support management routes:
5
+ * - Ticket management (list and view with full admin controls)
6
+ * - Contact inquiries management
7
+ * - Knowledge base authoring (create, edit, publish)
8
+ * - Support analytics and reporting
9
+ * - Support settings (SLA policies, canned responses, categories)
10
+ *
11
+ * User-only ticket and knowledge-base routes are excluded — see SupportUserRoutes for those.
12
+ */
13
+ export declare function SupportAdminRoutes(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import type { FC } from 'react';
2
+ import type { SupportRootProps } from './types';
3
+ /**
4
+ * User-facing root component for the Support microfrontend.
5
+ *
6
+ * Renders only user-relevant routes (tickets and KB browsing)
7
+ * and registers user-only navigation items with the shell.
8
+ *
9
+ * Use this in product app shells (vibecontrols-app, bigconsole, etc.)
10
+ * where end users interact with the support module.
11
+ *
12
+ * For admin-facing support features, use SupportAdminRoot instead.
13
+ *
14
+ * Note: This is a UI-layer route split, not a security boundary.
15
+ * Access control is enforced at the API/server level.
16
+ */
17
+ export declare const SupportUserRoot: FC<SupportRootProps>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * User-facing routes for the Support microfrontend.
3
+ *
4
+ * Only includes routes relevant to end users:
5
+ * - Ticket management (list, create, view)
6
+ * - Knowledge base browsing (read-only, published articles)
7
+ *
8
+ * Admin-only features (inquiries, analytics, settings, KB authoring)
9
+ * are excluded — see SupportAdminRoutes for those.
10
+ */
11
+ export declare function SupportUserRoutes(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { NotificationState } from '../hooks/useNotification';
3
+ interface NotificationToastProps {
4
+ notification: NotificationState | null;
5
+ }
6
+ /**
7
+ * Shared fixed-corner toast for CreateTicketPage + TicketDetail* pages.
8
+ *
9
+ * ARIA: `alert` + `assertive` for errors so a screen reader interrupts; `status`
10
+ * + `polite` for success/info so it's announced without cutting off other
11
+ * speech. `aria-atomic` so the full message reads as one unit.
12
+ *
13
+ * Icon choice: `Info` for the `'info'` variant — `AlertCircle` incorrectly
14
+ * implies failure/warning in sighted UX.
15
+ */
16
+ export declare function NotificationToast({ notification }: NotificationToastProps): ReactElement | null;
17
+ export {};
@@ -0,0 +1,71 @@
1
+ import type { ReactNode } from 'react';
2
+ interface PageLayoutProps {
3
+ children: ReactNode;
4
+ /** Page title */
5
+ title?: string;
6
+ /** Page subtitle/description */
7
+ subtitle?: string;
8
+ /** Icon component to display next to title */
9
+ icon?: ReactNode;
10
+ /** Actions to display in header (buttons, etc.) */
11
+ headerActions?: ReactNode;
12
+ /** Additional header content below title */
13
+ headerContent?: ReactNode;
14
+ /** Maximum width of content: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full' */
15
+ maxWidth?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full';
16
+ /** Whether to show the header section */
17
+ showHeader?: boolean;
18
+ /** Additional CSS classes for the container */
19
+ className?: string;
20
+ /** Additional CSS classes for the content area */
21
+ contentClassName?: string;
22
+ /**
23
+ * Boff UI 2.0 living-glass hero backdrop. When true, the header zone is wrapped
24
+ * in a `relative overflow-hidden` container with a subtle drifting AuroraBackground
25
+ * behind it (sits at -z-10, never moves content, reduced-motion safe). Reserve for
26
+ * the MFE's primary landing page — ONE aurora per MFE.
27
+ */
28
+ aurora?: boolean;
29
+ /**
30
+ * When provided, the title is split so this trailing noun is rendered with a
31
+ * brand GradientText fill (one hero heading accent per page). The remaining
32
+ * leading text stays in the plain title colour.
33
+ */
34
+ titleAccent?: string;
35
+ }
36
+ /**
37
+ * PageLayout - A consistent page wrapper with responsive design for Support module
38
+ *
39
+ * Features:
40
+ * - Proper max-width constraints
41
+ * - Responsive padding
42
+ * - Animated entrance
43
+ * - Consistent header styling
44
+ */
45
+ export declare function PageLayout({ children, title, subtitle, icon, headerActions, headerContent, maxWidth, showHeader, className, contentClassName, aurora, titleAccent, }: PageLayoutProps): import("react/jsx-runtime").JSX.Element;
46
+ /**
47
+ * EmptyState - A consistent empty state component
48
+ */
49
+ export declare function EmptyState({ icon, illustration, illustrationAlt, title, description, action, className, }: {
50
+ icon?: ReactNode;
51
+ /**
52
+ * Boff UI 2.0 on-brand illustration name (served by the host shell at
53
+ * /illustrations/<name>.webp). When provided, the empty state renders the
54
+ * richer IllustratedEmptyState instead of the plain icon variant. Reserve for
55
+ * genuine zero/no-results states — keep gate/permission states on the icon.
56
+ */
57
+ illustration?: string;
58
+ illustrationAlt?: string;
59
+ title: string;
60
+ description?: string;
61
+ action?: ReactNode;
62
+ className?: string;
63
+ }): import("react/jsx-runtime").JSX.Element;
64
+ /**
65
+ * LoadingState - A consistent loading state component
66
+ */
67
+ export declare function LoadingState({ message, className, }: {
68
+ message?: string;
69
+ className?: string;
70
+ }): import("react/jsx-runtime").JSX.Element;
71
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Shared loading fallback for lazy-loaded route pages.
3
+ */
4
+ export declare function PageLoader(): import("react/jsx-runtime").JSX.Element;
5
+ /**
6
+ * Catch-all redirect that sends unknown paths to the tickets page.
7
+ * Uses basePath from SupportProvider context and joinPath to avoid double-slashes.
8
+ */
9
+ export declare function CatchAllRedirect(): null;
@@ -0,0 +1,9 @@
1
+ interface CategoryCount {
2
+ category: string;
3
+ count: number;
4
+ }
5
+ interface CategoryBreakdownProps {
6
+ data: CategoryCount[];
7
+ }
8
+ export declare function CategoryBreakdown({ data }: CategoryBreakdownProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,10 @@
1
+ import { LucideIcon } from 'lucide-react';
2
+ interface MetricCardProps {
3
+ title: string;
4
+ value: string;
5
+ icon: LucideIcon;
6
+ iconColor: string;
7
+ subtitle?: string;
8
+ }
9
+ export declare function MetricCard({ title, value, icon: Icon, iconColor, subtitle }: MetricCardProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,9 @@
1
+ interface PriorityCount {
2
+ priority: string;
3
+ count: number;
4
+ }
5
+ interface PriorityBreakdownProps {
6
+ data: PriorityCount[];
7
+ }
8
+ export declare function PriorityBreakdown({ data }: PriorityBreakdownProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,23 @@
1
+ interface SLAComplianceByPriority {
2
+ priority: string;
3
+ tickets: number;
4
+ compliance: number;
5
+ }
6
+ interface SLAReportProps {
7
+ report: {
8
+ period: {
9
+ startDate: string;
10
+ endDate: string;
11
+ label: string;
12
+ };
13
+ totalTickets: number;
14
+ firstResponseCompliance: number;
15
+ resolutionCompliance: number;
16
+ avgFirstResponseTime: number;
17
+ avgResolutionTime: number;
18
+ breachedTickets: number;
19
+ byPriority: SLAComplianceByPriority[];
20
+ };
21
+ }
22
+ export declare function SLAReport({ report }: SLAReportProps): import("react/jsx-runtime").JSX.Element;
23
+ export {};
@@ -0,0 +1,23 @@
1
+ interface SatisfactionMetrics {
2
+ period: {
3
+ startDate: string;
4
+ endDate: string;
5
+ label: string;
6
+ };
7
+ totalResponses: number;
8
+ averageRating: number;
9
+ csat: number;
10
+ nps: number;
11
+ ratings: {
12
+ rating1: number;
13
+ rating2: number;
14
+ rating3: number;
15
+ rating4: number;
16
+ rating5: number;
17
+ };
18
+ }
19
+ interface SatisfactionDistributionProps {
20
+ metrics: SatisfactionMetrics;
21
+ }
22
+ export declare function SatisfactionDistribution({ metrics }: SatisfactionDistributionProps): import("react/jsx-runtime").JSX.Element;
23
+ export {};
@@ -0,0 +1,19 @@
1
+ interface TopAgent {
2
+ agent: {
3
+ id: string;
4
+ user: {
5
+ id: string;
6
+ name: string;
7
+ email: string;
8
+ avatarUrl?: string | null;
9
+ };
10
+ };
11
+ ticketsResolved: number;
12
+ avgRating: number;
13
+ rank: number;
14
+ }
15
+ interface TopAgentsProps {
16
+ agents: TopAgent[];
17
+ }
18
+ export declare function TopAgents({ agents }: TopAgentsProps): import("react/jsx-runtime").JSX.Element;
19
+ export {};
@@ -0,0 +1,15 @@
1
+ interface TrendDataPoint {
2
+ timestamp: string;
3
+ value: number;
4
+ label?: string | null;
5
+ }
6
+ interface TrendChartProps {
7
+ trends: TrendDataPoint[];
8
+ period: {
9
+ startDate: string;
10
+ endDate: string;
11
+ label: string;
12
+ };
13
+ }
14
+ export declare function TrendChart({ trends, period }: TrendChartProps): import("react/jsx-runtime").JSX.Element | null;
15
+ export {};
@@ -0,0 +1,25 @@
1
+ export interface ArticleFormData {
2
+ title: string;
3
+ slug: string;
4
+ content: string;
5
+ excerpt: string;
6
+ categoryId: string;
7
+ tags: string[];
8
+ metaDescription: string;
9
+ status: 'DRAFT' | 'PUBLISHED';
10
+ }
11
+ interface Category {
12
+ id: string;
13
+ name: string;
14
+ color?: string;
15
+ }
16
+ interface ArticleFormProps {
17
+ initialData?: Partial<ArticleFormData>;
18
+ categories: Category[];
19
+ onSubmit: (data: ArticleFormData) => Promise<void>;
20
+ onCancel: () => void;
21
+ isSubmitting: boolean;
22
+ submitLabel?: string;
23
+ }
24
+ export declare function ArticleForm({ initialData, categories, onSubmit, onCancel, isSubmitting, submitLabel, }: ArticleFormProps): import("react/jsx-runtime").JSX.Element;
25
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"ArticleForm.js","names":[],"sources":["../../../../src/support/components/kb/ArticleForm.tsx"],"sourcesContent":["import { useState, useMemo, useRef } from 'react';\nimport { Loader2, Save, X, Eye, Edit } from 'lucide-react';\nimport { Button, Input } from '../ui';\nimport { renderSupportMarkdown } from '../../utils/markdown';\n\nexport interface ArticleFormData {\n title: string;\n slug: string;\n content: string;\n excerpt: string;\n categoryId: string;\n tags: string[];\n metaDescription: string;\n status: 'DRAFT' | 'PUBLISHED';\n}\n\ninterface Category {\n id: string;\n name: string;\n color?: string;\n}\n\ninterface ArticleFormProps {\n initialData?: Partial<ArticleFormData>;\n categories: Category[];\n onSubmit: (data: ArticleFormData) => Promise<void>;\n onCancel: () => void;\n isSubmitting: boolean;\n submitLabel?: string;\n}\n\n// Generate URL-friendly slug from title\nfunction generateSlug(title: string): string {\n return title\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '')\n .substring(0, 100);\n}\n\nexport function ArticleForm({\n initialData,\n categories,\n onSubmit,\n onCancel,\n isSubmitting,\n submitLabel = 'Save Article',\n}: ArticleFormProps) {\n const [formData, setFormData] = useState<ArticleFormData>({\n title: initialData?.title || '',\n slug: initialData?.slug || '',\n content: initialData?.content || '',\n excerpt: initialData?.excerpt || '',\n categoryId: initialData?.categoryId || '',\n tags: initialData?.tags || [],\n metaDescription: initialData?.metaDescription || '',\n status: initialData?.status || 'DRAFT',\n });\n\n const [tagsInput, setTagsInput] = useState(initialData?.tags?.join(', ') || '');\n const slugManuallyEditedRef = useRef(false);\n const [showPreview, setShowPreview] = useState(false);\n\n // Parse markdown content for preview\n const parsedContent = useMemo(() => {\n if (!formData.content) return '';\n try {\n return renderSupportMarkdown(formData.content);\n } catch {\n return formData.content;\n }\n }, [formData.content]);\n\n // Handle title change with auto-slug generation\n const handleTitleChange = (title: string) => {\n if (!slugManuallyEditedRef.current) {\n setFormData((prev) => ({\n ...prev,\n title,\n slug: generateSlug(title),\n }));\n } else {\n setFormData((prev) => ({ ...prev, title }));\n }\n };\n\n // Parse tags from comma-separated input\n const handleTagsChange = (value: string) => {\n setTagsInput(value);\n const tags = value\n .split(',')\n .map((tag) => tag.trim())\n .filter((tag) => tag.length > 0);\n setFormData((prev) => ({ ...prev, tags }));\n };\n\n const handleSlugChange = (value: string) => {\n slugManuallyEditedRef.current = true;\n setFormData((prev) => ({ ...prev, slug: value }));\n };\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n await onSubmit(formData);\n };\n\n const isValid = formData.title.trim() && formData.slug.trim() && formData.content.trim();\n\n return (\n <form onSubmit={handleSubmit} className=\"space-y-6\">\n <div className=\"p-6 rounded-xl border border-border-seam bg-bg-surface space-y-6\">\n {/* Title */}\n <div>\n <label\n htmlFor=\"support-article-title\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n Title <span className=\"text-status-error-text\">*</span>\n </label>\n <Input\n id=\"support-article-title\"\n type=\"text\"\n required\n value={formData.title}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => handleTitleChange(e.target.value)}\n placeholder=\"Article title\"\n />\n </div>\n\n {/* Slug */}\n <div>\n <label\n htmlFor=\"support-article-slug\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n URL Slug <span className=\"text-status-error-text\">*</span>\n </label>\n <div className=\"flex flex-col gap-2 sm:flex-row sm:items-center\">\n <span className=\"text-sm text-text-secondary\">/kb/articles/</span>\n <Input\n id=\"support-article-slug\"\n type=\"text\"\n required\n value={formData.slug}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n handleSlugChange(e.target.value)\n }\n placeholder=\"article-url-slug\"\n className=\"flex-1\"\n />\n </div>\n <p className=\"text-xs text-text-secondary mt-1\">\n Auto-generated from title. Edit to customize.\n </p>\n </div>\n\n {/* Excerpt */}\n <div>\n <label\n htmlFor=\"support-article-excerpt\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n Excerpt\n </label>\n <textarea\n id=\"support-article-excerpt\"\n aria-label=\"Excerpt\"\n rows={3}\n value={formData.excerpt}\n onChange={(e) => setFormData({ ...formData, excerpt: 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=\"Brief summary of the article (displayed in search results)\"\n />\n </div>\n\n {/* Content */}\n <div>\n <div className=\"flex items-center justify-between mb-2\">\n <label\n htmlFor=\"support-article-content\"\n className=\"text-sm font-medium text-text-primary\"\n >\n Content <span className=\"text-status-error-text\">*</span>\n </label>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => setShowPreview(!showPreview)}\n className=\"text-xs\"\n >\n {showPreview ? (\n <>\n <Edit size={14} />\n Edit\n </>\n ) : (\n <>\n <Eye size={14} />\n Preview\n </>\n )}\n </Button>\n </div>\n\n {showPreview ? (\n <div className=\"w-full min-h-[400px] px-4 py-3 rounded-lg border bg-bg-surface overflow-auto\">\n <div\n className=\"prose prose-sm max-w-none dark:prose-invert\"\n dangerouslySetInnerHTML={{\n __html:\n parsedContent || '<p class=\"text-text-secondary\">Nothing to preview</p>',\n }}\n />\n </div>\n ) : (\n <textarea\n id=\"support-article-content\"\n aria-label=\"Article content\"\n required\n rows={20}\n value={formData.content}\n onChange={(e) => setFormData({ ...formData, content: 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 font-mono text-sm\"\n placeholder=\"Article content (supports Markdown)\"\n />\n )}\n <p className=\"text-xs text-text-secondary mt-1\">\n Supports Markdown: **bold**, *italic*, # headings, - lists, [links](url), ```code```\n </p>\n </div>\n\n {/* Category */}\n <div>\n <label\n htmlFor=\"support-article-category\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n Category\n </label>\n <select\n id=\"support-article-category\"\n value={formData.categoryId}\n onChange={(e) => setFormData({ ...formData, categoryId: e.target.value })}\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=\"\">Select a category</option>\n {categories.map((cat) => (\n <option key={cat.id} value={cat.id}>\n {cat.name}\n </option>\n ))}\n </select>\n </div>\n\n {/* Tags */}\n <div>\n <label\n htmlFor=\"support-article-tags\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n Tags\n </label>\n <Input\n id=\"support-article-tags\"\n type=\"text\"\n value={tagsInput}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => handleTagsChange(e.target.value)}\n placeholder=\"Enter tags separated by commas (e.g., billing, account, setup)\"\n />\n {formData.tags.length > 0 && (\n <div className=\"flex flex-wrap gap-2 mt-2\">\n {formData.tags.map((tag) => (\n <span\n key={tag}\n className=\"px-2 py-1 text-xs rounded-full bg-action-primary-bg/10 text-primary\"\n >\n {tag}\n </span>\n ))}\n </div>\n )}\n </div>\n\n {/* Meta Description */}\n <div>\n <label\n htmlFor=\"support-article-meta-description\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n Meta Description\n </label>\n <textarea\n id=\"support-article-meta-description\"\n aria-label=\"Meta Description\"\n rows={2}\n value={formData.metaDescription}\n onChange={(e) => setFormData({ ...formData, metaDescription: 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=\"SEO meta description (optional)\"\n />\n </div>\n\n {/* Status */}\n <div>\n <label\n htmlFor=\"support-article-status\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n Status\n </label>\n <select\n id=\"support-article-status\"\n value={formData.status}\n onChange={(e) =>\n setFormData({ ...formData, status: e.target.value as 'DRAFT' | 'PUBLISHED' })\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=\"DRAFT\">Draft - Not visible to users</option>\n <option value=\"PUBLISHED\">Published - Visible to all users</option>\n </select>\n </div>\n </div>\n\n {/* Actions */}\n <div className=\"flex gap-3\">\n <Button type=\"submit\" disabled={isSubmitting || !isValid} className=\"flex-1\">\n {isSubmitting ? (\n <>\n <Loader2 size={18} className=\"animate-spin\" />\n Saving…\n </>\n ) : (\n <>\n <Save size={18} />\n {submitLabel}\n </>\n )}\n </Button>\n <Button type=\"button\" variant=\"outline\" onClick={onCancel}>\n <X size={18} />\n Cancel\n </Button>\n </div>\n </form>\n );\n}\n"],"mappings":";;;;;;AAgCA,SAAS,EAAa,GAAuB;AAC3C,QAAO,EACJ,aAAa,CACb,QAAQ,eAAe,IAAI,CAC3B,QAAQ,YAAY,GAAG,CACvB,UAAU,GAAG,IAAI;;AAGtB,SAAgB,EAAY,EAC1B,gBACA,eACA,aACA,aACA,iBACA,iBAAc,kBACK;CACnB,IAAM,CAAC,GAAU,KAAe,EAA0B;EACxD,OAAO,GAAa,SAAS;EAC7B,MAAM,GAAa,QAAQ;EAC3B,SAAS,GAAa,WAAW;EACjC,SAAS,GAAa,WAAW;EACjC,YAAY,GAAa,cAAc;EACvC,MAAM,GAAa,QAAQ,EAAE;EAC7B,iBAAiB,GAAa,mBAAmB;EACjD,QAAQ,GAAa,UAAU;EAChC,CAAC,EAEI,CAAC,GAAW,KAAgB,EAAS,GAAa,MAAM,KAAK,KAAK,IAAI,GAAG,EACzE,IAAwB,EAAO,GAAM,EACrC,CAAC,GAAa,KAAkB,EAAS,GAAM,EAG/C,IAAgB,QAAc;AAClC,MAAI,CAAC,EAAS,QAAS,QAAO;AAC9B,MAAI;AACF,UAAO,EAAsB,EAAS,QAAQ;UACxC;AACN,UAAO,EAAS;;IAEjB,CAAC,EAAS,QAAQ,CAAC,EAGhB,KAAqB,MAAkB;AAC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,SAAD;KACE,SAAQ;KACR,WAAU;eACX;KAEO,CAAA,EACR,kBAAC,UAAD;KACE,IAAG;KACH,OAAO,EAAS;KAChB,WAAW,MACT,EAAY;MAAE,GAAG;MAAU,QAAQ,EAAE,OAAO;MAAgC,CAAC;KAE/E,WAAU;eANZ,CAQE,kBAAC,UAAD;MAAQ,OAAM;gBAAQ;MAAqC,CAAA,EAC3D,kBAAC,UAAD;MAAQ,OAAM;gBAAY;MAAyC,CAAA,CAC5D;OACL,EAAA,CAAA;IACF;MAGN,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,GAAD;IAAQ,MAAK;IAAS,UAAU,KAAgB,CAAC;IAAS,WAAU;cACjE,IACC,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD;KAAS,MAAM;KAAI,WAAU;KAAiB,CAAA,EAAA,UAE7C,EAAA,CAAA,GAEH,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD,EAAM,MAAM,IAAM,CAAA,EACjB,EACA,EAAA,CAAA;IAEE,CAAA,EACT,kBAAC,GAAD;IAAQ,MAAK;IAAS,SAAQ;IAAU,SAAS;cAAjD,CACE,kBAAC,GAAD,EAAG,MAAM,IAAM,CAAA,EAAA,SAER;MACL;KACD"}
1
+ {"version":3,"file":"ArticleForm.js","names":[],"sources":["../../../../src/support/components/kb/ArticleForm.tsx"],"sourcesContent":["import { useState, useMemo, useRef } from 'react';\nimport { Loader2, Save, X, Eye, Edit } from 'lucide-react';\nimport { Button, Input } from '../ui';\nimport { renderSupportMarkdown } from '../../utils/markdown';\n\nexport interface ArticleFormData {\n title: string;\n slug: string;\n content: string;\n excerpt: string;\n categoryId: string;\n tags: string[];\n metaDescription: string;\n status: 'DRAFT' | 'PUBLISHED';\n}\n\ninterface Category {\n id: string;\n name: string;\n color?: string;\n}\n\ninterface ArticleFormProps {\n initialData?: Partial<ArticleFormData>;\n categories: Category[];\n onSubmit: (data: ArticleFormData) => Promise<void>;\n onCancel: () => void;\n isSubmitting: boolean;\n submitLabel?: string;\n}\n\n// Generate URL-friendly slug from title\nfunction generateSlug(title: string): string {\n return title\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '')\n .substring(0, 100);\n}\n\nexport function ArticleForm({\n initialData,\n categories,\n onSubmit,\n onCancel,\n isSubmitting,\n submitLabel = 'Save Article',\n}: ArticleFormProps) {\n const [formData, setFormData] = useState<ArticleFormData>({\n title: initialData?.title || '',\n slug: initialData?.slug || '',\n content: initialData?.content || '',\n excerpt: initialData?.excerpt || '',\n categoryId: initialData?.categoryId || '',\n tags: initialData?.tags || [],\n metaDescription: initialData?.metaDescription || '',\n status: initialData?.status || 'DRAFT',\n });\n\n const [tagsInput, setTagsInput] = useState(initialData?.tags?.join(', ') || '');\n const slugManuallyEditedRef = useRef(false);\n const [showPreview, setShowPreview] = useState(false);\n\n // Parse markdown content for preview\n const parsedContent = useMemo(() => {\n if (!formData.content) return '';\n try {\n return renderSupportMarkdown(formData.content);\n } catch {\n return formData.content;\n }\n }, [formData.content]);\n\n // Handle title change with auto-slug generation\n const handleTitleChange = (title: string) => {\n if (!slugManuallyEditedRef.current) {\n setFormData((prev) => ({\n ...prev,\n title,\n slug: generateSlug(title),\n }));\n } else {\n setFormData((prev) => ({ ...prev, title }));\n }\n };\n\n // Parse tags from comma-separated input\n const handleTagsChange = (value: string) => {\n setTagsInput(value);\n const tags = value\n .split(',')\n .map((tag) => tag.trim())\n .filter((tag) => tag.length > 0);\n setFormData((prev) => ({ ...prev, tags }));\n };\n\n const handleSlugChange = (value: string) => {\n slugManuallyEditedRef.current = true;\n setFormData((prev) => ({ ...prev, slug: value }));\n };\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n await onSubmit(formData);\n };\n\n const isValid = formData.title.trim() && formData.slug.trim() && formData.content.trim();\n\n return (\n <form onSubmit={handleSubmit} className=\"space-y-6\">\n <div className=\"p-6 rounded-xl border border-border-seam bg-bg-surface space-y-6\">\n {/* Title */}\n <div>\n <label\n htmlFor=\"support-article-title\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n Title <span className=\"text-status-error-text\">*</span>\n </label>\n <Input\n id=\"support-article-title\"\n type=\"text\"\n required\n value={formData.title}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => handleTitleChange(e.target.value)}\n placeholder=\"Article title\"\n />\n </div>\n\n {/* Slug */}\n <div>\n <label\n htmlFor=\"support-article-slug\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n URL Slug <span className=\"text-status-error-text\">*</span>\n </label>\n <div className=\"flex flex-col gap-2 sm:flex-row sm:items-center\">\n <span className=\"text-sm text-text-secondary\">/kb/articles/</span>\n <Input\n id=\"support-article-slug\"\n type=\"text\"\n required\n value={formData.slug}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n handleSlugChange(e.target.value)\n }\n placeholder=\"article-url-slug\"\n className=\"flex-1\"\n />\n </div>\n <p className=\"text-xs text-text-secondary mt-1\">\n Auto-generated from title. Edit to customize.\n </p>\n </div>\n\n {/* Excerpt */}\n <div>\n <label\n htmlFor=\"support-article-excerpt\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n Excerpt\n </label>\n <textarea\n id=\"support-article-excerpt\"\n aria-label=\"Excerpt\"\n rows={3}\n value={formData.excerpt}\n onChange={(e) => setFormData({ ...formData, excerpt: 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=\"Brief summary of the article (displayed in search results)\"\n />\n </div>\n\n {/* Content */}\n <div>\n <div className=\"flex items-center justify-between mb-2\">\n <label\n htmlFor=\"support-article-content\"\n className=\"text-sm font-medium text-text-primary\"\n >\n Content <span className=\"text-status-error-text\">*</span>\n </label>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => setShowPreview(!showPreview)}\n className=\"text-xs\"\n >\n {showPreview ? (\n <>\n <Edit size={14} />\n Edit\n </>\n ) : (\n <>\n <Eye size={14} />\n Preview\n </>\n )}\n </Button>\n </div>\n\n {showPreview ? (\n <div className=\"w-full min-h-[400px] px-4 py-3 rounded-lg border bg-bg-surface overflow-auto\">\n <div\n className=\"prose prose-sm max-w-none dark:prose-invert\"\n dangerouslySetInnerHTML={{\n __html: parsedContent || '<p class=\"text-text-secondary\">Nothing to preview</p>',\n }}\n />\n </div>\n ) : (\n <textarea\n id=\"support-article-content\"\n aria-label=\"Article content\"\n required\n rows={20}\n value={formData.content}\n onChange={(e) => setFormData({ ...formData, content: 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 font-mono text-sm\"\n placeholder=\"Article content (supports Markdown)\"\n />\n )}\n <p className=\"text-xs text-text-secondary mt-1\">\n Supports Markdown: **bold**, *italic*, # headings, - lists, [links](url), ```code```\n </p>\n </div>\n\n {/* Category */}\n <div>\n <label\n htmlFor=\"support-article-category\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n Category\n </label>\n <select\n id=\"support-article-category\"\n value={formData.categoryId}\n onChange={(e) => setFormData({ ...formData, categoryId: e.target.value })}\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=\"\">Select a category</option>\n {categories.map((cat) => (\n <option key={cat.id} value={cat.id}>\n {cat.name}\n </option>\n ))}\n </select>\n </div>\n\n {/* Tags */}\n <div>\n <label\n htmlFor=\"support-article-tags\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n Tags\n </label>\n <Input\n id=\"support-article-tags\"\n type=\"text\"\n value={tagsInput}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => handleTagsChange(e.target.value)}\n placeholder=\"Enter tags separated by commas (e.g., billing, account, setup)\"\n />\n {formData.tags.length > 0 && (\n <div className=\"flex flex-wrap gap-2 mt-2\">\n {formData.tags.map((tag) => (\n <span\n key={tag}\n className=\"px-2 py-1 text-xs rounded-full bg-action-primary-bg/10 text-primary\"\n >\n {tag}\n </span>\n ))}\n </div>\n )}\n </div>\n\n {/* Meta Description */}\n <div>\n <label\n htmlFor=\"support-article-meta-description\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n Meta Description\n </label>\n <textarea\n id=\"support-article-meta-description\"\n aria-label=\"Meta Description\"\n rows={2}\n value={formData.metaDescription}\n onChange={(e) => setFormData({ ...formData, metaDescription: 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=\"SEO meta description (optional)\"\n />\n </div>\n\n {/* Status */}\n <div>\n <label\n htmlFor=\"support-article-status\"\n className=\"mb-2 block text-sm font-medium text-text-primary\"\n >\n Status\n </label>\n <select\n id=\"support-article-status\"\n value={formData.status}\n onChange={(e) =>\n setFormData({ ...formData, status: e.target.value as 'DRAFT' | 'PUBLISHED' })\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=\"DRAFT\">Draft - Not visible to users</option>\n <option value=\"PUBLISHED\">Published - Visible to all users</option>\n </select>\n </div>\n </div>\n\n {/* Actions */}\n <div className=\"flex gap-3\">\n <Button type=\"submit\" disabled={isSubmitting || !isValid} className=\"flex-1\">\n {isSubmitting ? (\n <>\n <Loader2 size={18} className=\"animate-spin\" />\n Saving…\n </>\n ) : (\n <>\n <Save size={18} />\n {submitLabel}\n </>\n )}\n </Button>\n <Button type=\"button\" variant=\"outline\" onClick={onCancel}>\n <X size={18} />\n Cancel\n </Button>\n </div>\n </form>\n );\n}\n"],"mappings":";;;;;;AAgCA,SAAS,EAAa,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D;KAAS,MAAM;KAAI,WAAU;KAAiB,CAAA,EAAA,UAE7C,EAAA,CAAA,GAEH,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD,EAAM,MAAM,IAAM,CAAA,EACjB,EACA,EAAA,CAAA;IAEE,CAAA,EACT,kBAAC,GAAD;IAAQ,MAAK;IAAS,SAAQ;IAAU,SAAS;cAAjD,CACE,kBAAC,GAAD,EAAG,MAAM,IAAM,CAAA,EAAA,SAER;MACL;KACD"}
@@ -0,0 +1,21 @@
1
+ interface CannedResponse {
2
+ id: string;
3
+ title: string;
4
+ content: string;
5
+ tags?: string[];
6
+ isActive?: boolean;
7
+ }
8
+ interface CannedResponseInput {
9
+ title: string;
10
+ content: string;
11
+ tags?: string[];
12
+ isActive?: boolean;
13
+ }
14
+ interface CannedResponsesSettingsProps {
15
+ responses: CannedResponse[];
16
+ onCreate: (input: CannedResponseInput) => Promise<CannedResponse>;
17
+ onUpdate: (id: string, input: Partial<CannedResponseInput>) => Promise<CannedResponse>;
18
+ onDelete: (id: string) => Promise<void>;
19
+ }
20
+ export declare function CannedResponsesSettings({ responses, onCreate, onUpdate, onDelete, }: CannedResponsesSettingsProps): import("react/jsx-runtime").JSX.Element;
21
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"CannedResponsesSettings.js","names":[],"sources":["../../../../src/support/components/settings/CannedResponsesSettings.tsx"],"sourcesContent":["import { useState, type FormEvent } from 'react';\nimport { MessageCircle, Plus, Edit2, Trash2, Tag, X, Check } from 'lucide-react';\n\ninterface CannedResponse {\n id: string;\n title: string;\n content: string;\n tags?: string[];\n isActive?: boolean;\n}\n\ninterface CannedResponseInput {\n title: string;\n content: string;\n tags?: string[];\n isActive?: boolean;\n}\n\ninterface CannedResponsesSettingsProps {\n responses: CannedResponse[];\n onCreate: (input: CannedResponseInput) => Promise<CannedResponse>;\n onUpdate: (id: string, input: Partial<CannedResponseInput>) => Promise<CannedResponse>;\n onDelete: (id: string) => Promise<void>;\n}\n\nconst emptyForm = {\n title: '',\n content: '',\n tags: '',\n};\n\nfunction parseTags(value: string): string[] {\n return value.split(',').flatMap((tag) => {\n const trimmed = tag.trim();\n return trimmed ? [trimmed] : [];\n });\n}\n\nexport function CannedResponsesSettings({\n responses,\n onCreate,\n onUpdate,\n onDelete,\n}: CannedResponsesSettingsProps) {\n const [showForm, setShowForm] = useState(false);\n const [editingId, setEditingId] = useState<string | null>(null);\n const [form, setForm] = useState(emptyForm);\n const [saving, setSaving] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n const handleNew = () => {\n setEditingId(null);\n setForm(emptyForm);\n setError(null);\n setShowForm(true);\n };\n\n const handleEdit = (response: CannedResponse) => {\n setEditingId(response.id);\n setForm({\n title: response.title,\n content: response.content,\n tags: response.tags?.join(', ') ?? '',\n });\n setError(null);\n setShowForm(true);\n };\n\n const handleCancel = () => {\n setShowForm(false);\n setEditingId(null);\n setForm(emptyForm);\n setError(null);\n };\n\n const handleSubmit = async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n if (!form.title.trim() || !form.content.trim()) return;\n\n setSaving(true);\n setError(null);\n try {\n const input = {\n title: form.title.trim(),\n content: form.content.trim(),\n tags: parseTags(form.tags),\n };\n\n if (editingId) {\n const existingResponse = responses.find((response) => response.id === editingId);\n await onUpdate(editingId, {\n ...input,\n isActive: existingResponse?.isActive ?? true,\n });\n } else {\n await onCreate({ ...input, isActive: true });\n }\n\n handleCancel();\n } catch (submitError) {\n setError(submitError instanceof Error ? submitError.message : 'Failed to save response.');\n } finally {\n setSaving(false);\n }\n };\n\n const handleDelete = async (id: string) => {\n setError(null);\n try {\n await onDelete(id);\n } catch (deleteError) {\n setError(deleteError instanceof Error ? deleteError.message : 'Failed to delete response.');\n }\n };\n\n return (\n <div className=\"space-y-6 animate-in fade-in-0 slide-in-from-bottom-2 duration-200\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h2 className=\"text-xl font-semibold mb-2 text-primary\">Canned Responses</h2>\n <p className=\"text-sm text-secondary\">\n Pre-written responses for common customer inquiries\n </p>\n </div>\n <button\n type=\"button\"\n onClick={handleNew}\n className=\"min-h-11 inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg transition-all duration-200 bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg/90\"\n >\n <Plus size={20} />\n New Response\n </button>\n </div>\n\n {showForm && (\n <form\n onSubmit={handleSubmit}\n className=\"p-5 rounded-lg border-2 border-primary/30 bg-surface animate-in fade-in-0 slide-in-from-top-2 duration-200\"\n >\n <h3 className=\"font-semibold mb-4 text-primary\">\n {editingId ? 'Edit Response' : 'Create New Response'}\n </h3>\n\n <div className=\"space-y-4\">\n <div>\n <label\n className=\"block text-sm font-medium mb-1 text-secondary\"\n htmlFor=\"cannedresponsessettings-title-0\"\n >\n Title *\n </label>\n <input\n id=\"cannedresponsessettings-title-0\"\n type=\"text\"\n aria-label=\"Title\"\n value={form.title}\n onChange={(event) => setForm({ ...form, title: event.target.value })}\n className=\"w-full 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\"\n placeholder=\"e.g., Troubleshooting next steps\"\n />\n </div>\n\n <div>\n <label\n className=\"block text-sm font-medium mb-1 text-secondary\"\n htmlFor=\"cannedresponsessettings-response-2\"\n >\n Response *\n </label>\n <textarea\n id=\"cannedresponsessettings-response-2\"\n aria-label=\"Response\"\n value={form.content}\n onChange={(event) => setForm({ ...form, content: event.target.value })}\n rows={5}\n className=\"w-full 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\"\n placeholder=\"Write the saved reply agents can reuse.\"\n />\n </div>\n\n <div>\n <label\n className=\"block text-sm font-medium mb-1 text-secondary\"\n htmlFor=\"cannedresponsessettings-tags-4\"\n >\n Tags\n </label>\n <input\n id=\"cannedresponsessettings-tags-4\"\n type=\"text\"\n aria-label=\"Tags\"\n value={form.tags}\n onChange={(event) => setForm({ ...form, tags: event.target.value })}\n className=\"w-full 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\"\n placeholder=\"billing, onboarding, bug\"\n />\n </div>\n\n {error && <p className=\"text-sm text-error\">{error}</p>}\n </div>\n\n <div className=\"flex flex-col gap-2 mt-5 pt-4 border-t border-border-subtle sm:flex-row sm:items-center sm:justify-end\">\n <button\n type=\"button\"\n onClick={handleCancel}\n className=\"min-h-11 inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg border border-border-subtle bg-bg-surface text-text-primary transition-colors hover:bg-bg-sunken\"\n >\n <X size={16} />\n Cancel\n </button>\n <button\n type=\"submit\"\n disabled={saving || !form.title.trim() || !form.content.trim()}\n className=\"min-h-11 inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg bg-action-primary-bg text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:opacity-50\"\n >\n <Check size={16} />\n {saving ? 'Saving...' : editingId ? 'Update Response' : 'Create Response'}\n </button>\n </div>\n </form>\n )}\n\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n {responses.map((response) => (\n <div\n key={response.id}\n className=\"p-4 rounded-lg border border-border-seam bg-bg-surface shadow-[var(--shadow-pop)] transition-[box-shadow,border-color] duration-200 hover:shadow-[var(--shadow-pop-hover)] hover:border-border-strong\"\n >\n <div className=\"flex items-start justify-between mb-3\">\n <div className=\"flex items-start gap-3\">\n <div className=\"size-8 rounded-full flex items-center justify-center flex-shrink-0 bg-action-primary-bg/10\">\n <MessageCircle size={16} className=\"text-primary\" />\n </div>\n <div className=\"flex-1 min-w-0\">\n <h3 className=\"font-semibold truncate text-primary\">{response.title}</h3>\n </div>\n </div>\n <div className=\"flex items-center gap-1\">\n <button\n type=\"button\"\n onClick={() => handleEdit(response)}\n className=\"min-h-11 min-w-11 p-1.5 rounded transition-colors duration-200 text-secondary hover:bg-bg-sunken\"\n aria-label=\"Edit canned response\"\n >\n <Edit2 size={16} />\n </button>\n <button\n type=\"button\"\n className=\"min-h-11 min-w-11 p-1.5 rounded transition-colors duration-200 text-error hover:bg-error/10\"\n onClick={() => void handleDelete(response.id)}\n aria-label=\"Delete canned response\"\n >\n <Trash2 size={16} />\n </button>\n </div>\n </div>\n\n <p className=\"text-sm line-clamp-2 mb-3 text-secondary\">{response.content}</p>\n\n {response.tags && response.tags.length > 0 && (\n <div className=\"flex items-center gap-2 flex-wrap\">\n <Tag size={12} className=\"text-tertiary\" />\n {response.tags.map((tag: string) => (\n <span key={tag} className=\"text-xs px-2 py-0.5 rounded bg-bg-sunken text-secondary\">\n {tag}\n </span>\n ))}\n </div>\n )}\n </div>\n ))}\n\n {responses.length === 0 && !showForm && (\n <div className=\"col-span-2 text-center py-12 animate-in fade-in-0 duration-200\">\n <MessageCircle size={48} className=\"text-tertiary mx-auto\" />\n <p className=\"mt-4 text-secondary\">No canned responses configured</p>\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;AAyBA,IAAM,IAAY;CAChB,OAAO;CACP,SAAS;CACT,MAAM;CACP;AAED,SAAS,EAAU,GAAyB;AAC1C,QAAO,EAAM,MAAM,IAAI,CAAC,SAAS,MAAQ;EACvC,IAAM,IAAU,EAAI,MAAM;AAC1B,SAAO,IAAU,CAAC,EAAQ,GAAG,EAAE;GAC/B;;AAGJ,SAAgB,EAAwB,EACtC,cACA,aACA,aACA,eAC+B;CAC/B,IAAM,CAAC,GAAU,KAAe,EAAS,GAAM,EACzC,CAAC,GAAW,KAAgB,EAAwB,KAAK,EACzD,CAAC,GAAM,KAAW,EAAS,EAAU,EACrC,CAAC,GAAQ,KAAa,EAAS,GAAM,EACrC,CAAC,GAAO,KAAY,EAAwB,KAAK,EAEjD,UAAkB;AAItB,EAHA,EAAa,KAAK,EAClB,EAAQ,EAAU,EAClB,EAAS,KAAK,EACd,EAAY,GAAK;IAGb,KAAc,MAA6B;AAQ/C,EAPA,EAAa,EAAS,GAAG,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;;MAEJ;OA5CC,EAAS,GA4CV,CACN,EAED,EAAU,WAAW,KAAK,CAAC,KAC1B,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,GAAD;MAAe,MAAM;MAAI,WAAU;MAA0B,CAAA,EAC7D,kBAAC,KAAD;MAAG,WAAU;gBAAsB;MAAkC,CAAA,CACjE;OAEJ;;GACF"}
1
+ {"version":3,"file":"CannedResponsesSettings.js","names":[],"sources":["../../../../src/support/components/settings/CannedResponsesSettings.tsx"],"sourcesContent":["import { useState, type FormEvent } from 'react';\nimport { MessageCircle, Plus, Edit2, Trash2, Tag, X, Check } from 'lucide-react';\n\ninterface CannedResponse {\n id: string;\n title: string;\n content: string;\n tags?: string[];\n isActive?: boolean;\n}\n\ninterface CannedResponseInput {\n title: string;\n content: string;\n tags?: string[];\n isActive?: boolean;\n}\n\ninterface CannedResponsesSettingsProps {\n responses: CannedResponse[];\n onCreate: (input: CannedResponseInput) => Promise<CannedResponse>;\n onUpdate: (id: string, input: Partial<CannedResponseInput>) => Promise<CannedResponse>;\n onDelete: (id: string) => Promise<void>;\n}\n\nconst emptyForm = {\n title: '',\n content: '',\n tags: '',\n};\n\nfunction parseTags(value: string): string[] {\n return value.split(',').flatMap((tag) => {\n const trimmed = tag.trim();\n return trimmed ? [trimmed] : [];\n });\n}\n\nexport function CannedResponsesSettings({\n responses,\n onCreate,\n onUpdate,\n onDelete,\n}: CannedResponsesSettingsProps) {\n const [showForm, setShowForm] = useState(false);\n const [editingId, setEditingId] = useState<string | null>(null);\n const [form, setForm] = useState(emptyForm);\n const [saving, setSaving] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n const handleNew = () => {\n setEditingId(null);\n setForm(emptyForm);\n setError(null);\n setShowForm(true);\n };\n\n const handleEdit = (response: CannedResponse) => {\n setEditingId(response.id);\n setForm({\n title: response.title,\n content: response.content,\n tags: response.tags?.join(', ') ?? '',\n });\n setError(null);\n setShowForm(true);\n };\n\n const handleCancel = () => {\n setShowForm(false);\n setEditingId(null);\n setForm(emptyForm);\n setError(null);\n };\n\n const handleSubmit = async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n if (!form.title.trim() || !form.content.trim()) return;\n\n setSaving(true);\n setError(null);\n try {\n const input = {\n title: form.title.trim(),\n content: form.content.trim(),\n tags: parseTags(form.tags),\n };\n\n if (editingId) {\n const existingResponse = responses.find((response) => response.id === editingId);\n await onUpdate(editingId, {\n ...input,\n isActive: existingResponse?.isActive ?? true,\n });\n } else {\n await onCreate({ ...input, isActive: true });\n }\n\n handleCancel();\n } catch (submitError) {\n setError(submitError instanceof Error ? submitError.message : 'Failed to save response.');\n } finally {\n setSaving(false);\n }\n };\n\n const handleDelete = async (id: string) => {\n setError(null);\n try {\n await onDelete(id);\n } catch (deleteError) {\n setError(deleteError instanceof Error ? deleteError.message : 'Failed to delete response.');\n }\n };\n\n return (\n <div className=\"space-y-6 animate-in fade-in-0 slide-in-from-bottom-2 duration-200\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h2 className=\"text-xl font-semibold mb-2 text-primary\">Canned Responses</h2>\n <p className=\"text-sm text-secondary\">\n Pre-written responses for common customer inquiries\n </p>\n </div>\n <button\n type=\"button\"\n onClick={handleNew}\n className=\"min-h-11 inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg transition-all duration-200 bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg/90\"\n >\n <Plus size={20} />\n New Response\n </button>\n </div>\n\n {showForm && (\n <form\n onSubmit={handleSubmit}\n className=\"p-5 rounded-lg border-2 border-primary/30 bg-surface animate-in fade-in-0 slide-in-from-top-2 duration-200\"\n >\n <h3 className=\"font-semibold mb-4 text-primary\">\n {editingId ? 'Edit Response' : 'Create New Response'}\n </h3>\n\n <div className=\"space-y-4\">\n <div>\n <label\n className=\"block text-sm font-medium mb-1 text-secondary\"\n htmlFor=\"cannedresponsessettings-title-0\"\n >\n Title *\n </label>\n <input\n id=\"cannedresponsessettings-title-0\"\n type=\"text\"\n aria-label=\"Title\"\n value={form.title}\n onChange={(event) => setForm({ ...form, title: event.target.value })}\n className=\"w-full 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\"\n placeholder=\"e.g., Troubleshooting next steps\"\n />\n </div>\n\n <div>\n <label\n className=\"block text-sm font-medium mb-1 text-secondary\"\n htmlFor=\"cannedresponsessettings-response-2\"\n >\n Response *\n </label>\n <textarea\n id=\"cannedresponsessettings-response-2\"\n aria-label=\"Response\"\n value={form.content}\n onChange={(event) => setForm({ ...form, content: event.target.value })}\n rows={5}\n className=\"w-full 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\"\n placeholder=\"Write the saved reply agents can reuse.\"\n />\n </div>\n\n <div>\n <label\n className=\"block text-sm font-medium mb-1 text-secondary\"\n htmlFor=\"cannedresponsessettings-tags-4\"\n >\n Tags\n </label>\n <input\n id=\"cannedresponsessettings-tags-4\"\n type=\"text\"\n aria-label=\"Tags\"\n value={form.tags}\n onChange={(event) => setForm({ ...form, tags: event.target.value })}\n className=\"w-full 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\"\n placeholder=\"billing, onboarding, bug\"\n />\n </div>\n\n {error && <p className=\"text-sm text-error\">{error}</p>}\n </div>\n\n <div className=\"flex flex-col gap-2 mt-5 pt-4 border-t border-border-subtle sm:flex-row sm:items-center sm:justify-end\">\n <button\n type=\"button\"\n onClick={handleCancel}\n className=\"min-h-11 inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg border border-border-subtle bg-bg-surface text-text-primary transition-colors hover:bg-bg-sunken\"\n >\n <X size={16} />\n Cancel\n </button>\n <button\n type=\"submit\"\n disabled={saving || !form.title.trim() || !form.content.trim()}\n className=\"min-h-11 inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg bg-action-primary-bg text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:opacity-50\"\n >\n <Check size={16} />\n {saving ? 'Saving...' : editingId ? 'Update Response' : 'Create Response'}\n </button>\n </div>\n </form>\n )}\n\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n {responses.map((response) => (\n <div\n key={response.id}\n className=\"p-4 rounded-lg border border-border-seam bg-bg-surface shadow-[var(--shadow-pop)] transition-[box-shadow,border-color] duration-200 hover:shadow-[var(--shadow-pop-hover)] hover:border-border-strong\"\n >\n <div className=\"flex items-start justify-between mb-3\">\n <div className=\"flex items-start gap-3\">\n <div className=\"size-8 rounded-full flex items-center justify-center flex-shrink-0 bg-action-primary-bg/10\">\n <MessageCircle size={16} className=\"text-primary\" />\n </div>\n <div className=\"flex-1 min-w-0\">\n <h3 className=\"font-semibold truncate text-primary\">{response.title}</h3>\n </div>\n </div>\n <div className=\"flex items-center gap-1\">\n <button\n type=\"button\"\n onClick={() => handleEdit(response)}\n className=\"min-h-11 min-w-11 p-1.5 rounded transition-colors duration-200 text-secondary hover:bg-bg-sunken\"\n aria-label=\"Edit canned response\"\n >\n <Edit2 size={16} />\n </button>\n <button\n type=\"button\"\n className=\"min-h-11 min-w-11 p-1.5 rounded transition-colors duration-200 text-error hover:bg-error/10\"\n onClick={() => void handleDelete(response.id)}\n aria-label=\"Delete canned response\"\n >\n <Trash2 size={16} />\n </button>\n </div>\n </div>\n\n <p className=\"text-sm line-clamp-2 mb-3 text-secondary\">{response.content}</p>\n\n {response.tags && response.tags.length > 0 && (\n <div className=\"flex items-center gap-2 flex-wrap\">\n <Tag size={12} className=\"text-tertiary\" />\n {response.tags.map((tag: string) => (\n <span\n key={tag}\n className=\"text-xs px-2 py-0.5 rounded bg-bg-sunken text-secondary\"\n >\n {tag}\n </span>\n ))}\n </div>\n )}\n </div>\n ))}\n\n {responses.length === 0 && !showForm && (\n <div className=\"col-span-2 text-center py-12 animate-in fade-in-0 duration-200\">\n <MessageCircle size={48} className=\"text-t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AAD;SAAK,WAAU;mBACb,kBAAC,MAAD;UAAI,WAAU;oBAAuC,EAAS;UAAW,CAAA;SACrE,CAAA,CACF;WACN,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,UAAD;SACE,MAAK;SACL,eAAe,EAAW,EAAS;SACnC,WAAU;SACV,cAAW;mBAEX,kBAAC,GAAD,EAAO,MAAM,IAAM,CAAA;SACZ,CAAA,EACT,kBAAC,UAAD;SACE,MAAK;SACL,WAAU;SACV,eAAe,KAAK,EAAa,EAAS,GAAG;SAC7C,cAAW;mBAEX,kBAAC,GAAD,EAAQ,MAAM,IAAM,CAAA;SACb,CAAA,CACL;UACF;;MAEN,kBAAC,KAAD;OAAG,WAAU;iBAA4C,EAAS;OAAY,CAAA;MAE7E,EAAS,QAAQ,EAAS,KAAK,SAAS,KACvC,kBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,kBAAC,GAAD;QAAK,MAAM;QAAI,WAAU;QAAkB,CAAA,EAC1C,EAAS,KAAK,KAAK,MAClB,kBAAC,QAAD;QAEE,WAAU;kBAET;QACI,EAJA,EAIA,CACP,CACE;;MAEJ;OA/CC,EAAS,GA+CV,CACN,EAED,EAAU,WAAW,KAAK,CAAC,KAC1B,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,GAAD;MAAe,MAAM;MAAI,WAAU;MAA0B,CAAA,EAC7D,kBAAC,KAAD;MAAG,WAAU;gBAAsB;MAAkC,CAAA,CACjE;OAEJ;;GACF"}
@@ -0,0 +1,18 @@
1
+ interface SLAPolicy {
2
+ id: string;
3
+ name: string;
4
+ priority: string;
5
+ firstResponseTimeMinutes: number;
6
+ resolutionTimeMinutes: number;
7
+ businessHoursOnly: boolean;
8
+ active: boolean;
9
+ }
10
+ interface SLAPoliciesSettingsProps {
11
+ policies: SLAPolicy[];
12
+ defaultPolicyId?: string;
13
+ onCreate: (input: SLAPolicy) => Promise<SLAPolicy>;
14
+ onUpdate: (id: string, input: SLAPolicy) => Promise<SLAPolicy>;
15
+ onDelete: (id: string) => Promise<void>;
16
+ }
17
+ export declare function SLAPoliciesSettings({ policies, defaultPolicyId, onCreate, onUpdate, onDelete, }: SLAPoliciesSettingsProps): import("react/jsx-runtime").JSX.Element;
18
+ export {};
@@ -0,0 +1,20 @@
1
+ interface TicketCategory {
2
+ id?: string;
3
+ name: string;
4
+ slug: string;
5
+ description?: string;
6
+ color?: string;
7
+ icon?: string;
8
+ displayOrder?: number;
9
+ isActive?: boolean;
10
+ articleCount?: number;
11
+ parentId?: string;
12
+ }
13
+ interface TicketCategoriesSettingsProps {
14
+ categories: TicketCategory[];
15
+ onCreate: (input: Omit<TicketCategory, 'id' | 'articleCount'>) => Promise<TicketCategory | null | undefined>;
16
+ onUpdate: (id: string, input: Partial<TicketCategory>) => Promise<TicketCategory | null | undefined>;
17
+ onDelete: (id: string) => Promise<boolean | null | undefined>;
18
+ }
19
+ export declare function TicketCategoriesSettings({ categories, onCreate, onUpdate, onDelete, }: TicketCategoriesSettingsProps): import("react/jsx-runtime").JSX.Element;
20
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { FC } from 'react';
2
+ interface AttachmentListProps {
3
+ fileIds: string[];
4
+ ticketId: string;
5
+ }
6
+ export declare const AttachmentList: FC<AttachmentListProps>;
7
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentList.js","names":[],"sources":["../../../../src/support/components/tickets/AttachmentList.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { ImageIcon, Loader2, Paperclip } from 'lucide-react';\n\nimport { useSupportAttachments } from '../../hooks/useSupportAttachments';\n\ninterface AttachmentListProps {\n fileIds: string[];\n ticketId: string;\n}\n\nexport const AttachmentList: FC<AttachmentListProps> = ({ fileIds, ticketId }) => {\n const { attachments, isLoading } = useSupportAttachments({ fileIds, ticketId });\n\n if (fileIds.length === 0) {\n return null;\n }\n\n if (isLoading) {\n return (\n <div className=\"flex items-center gap-2 text-sm text-text-secondary\">\n <Loader2 size={16} className=\"animate-spin\" />\n Loading attachments…\n </div>\n );\n }\n\n return (\n <div className=\"space-y-3\">\n {attachments.map((attachment) => {\n const isImage = attachment.mimeType.startsWith('image/');\n\n return (\n <div key={attachment.id} className=\"rounded-lg border border-border-subtle bg-bg-sunken/30 p-3\">\n <div className=\"flex items-center gap-2 text-sm\">\n {isImage ? <ImageIcon size={16} /> : <Paperclip size={16} />}\n <a\n href={attachment.downloadUrl}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"font-medium text-primary hover:underline\"\n >\n {attachment.name}\n </a>\n <span className=\"text-text-secondary\">({attachment.mimeType})</span>\n </div>\n\n {isImage && attachment.downloadUrl !== '#' && (\n <img\n src={attachment.downloadUrl}\n alt={attachment.name}\n className=\"mt-3 max-h-64 rounded-lg border border-border-subtle object-contain\"\n />\n )}\n </div>\n );\n })}\n </div>\n );\n};\n"],"mappings":";;;;AAUA,IAAa,KAA2C,EAAE,YAAS,kBAAe;CAChF,IAAM,EAAE,gBAAa,iBAAc,EAAsB;EAAE;EAAS;EAAU,CAAC;AAe/E,QAbI,EAAQ,WAAW,IACd,OAGL,IAEA,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,GAAD;GAAS,MAAM;GAAI,WAAU;GAAiB,CAAA,EAAA,uBAE1C;MAKR,kBAAC,OAAD;EAAK,WAAU;YACZ,EAAY,KAAK,MAAe;GAC/B,IAAM,IAAU,EAAW,SAAS,WAAW,SAAS;AAExD,UACE,kBAAC,OAAD;IAAyB,WAAU;cAAnC,CACE,kBAAC,OAAD;KAAK,WAAU;eAAf;MACa,EAAV,IAAW,IAA0B,GAA3B,EAAW,MAAM,IAAM,CAA0B;MAC5D,kBAAC,KAAD;OACE,MAAM,EAAW;OACjB,QAAO;OACP,KAAI;OACJ,WAAU;iBAET,EAAW;OACV,CAAA;MACJ,kBAAC,QAAD;OAAM,WAAU;iBAAhB;QAAsC;QAAE,EAAW;QAAS;QAAQ;;MAChE;QAEL,KAAW,EAAW,gBAAgB,OACrC,kBAAC,OAAD;KACE,KAAK,EAAW;KAChB,KAAK,EAAW;KAChB,WAAU;KACV,CAAA,CAEA;MArBI,EAAW,GAqBf;IAER;EACE,CAAA"}
1
+ {"version":3,"file":"AttachmentList.js","names":[],"sources":["../../../../src/support/components/tickets/AttachmentList.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { ImageIcon, Loader2, Paperclip } from 'lucide-react';\n\nimport { useSupportAttachments } from '../../hooks/useSupportAttachments';\n\ninterface AttachmentListProps {\n fileIds: string[];\n ticketId: string;\n}\n\nexport const AttachmentList: FC<AttachmentListProps> = ({ fileIds, ticketId }) => {\n const { attachments, isLoading } = useSupportAttachments({ fileIds, ticketId });\n\n if (fileIds.length === 0) {\n return null;\n }\n\n if (isLoading) {\n return (\n <div className=\"flex items-center gap-2 text-sm text-text-secondary\">\n <Loader2 size={16} className=\"animate-spin\" />\n Loading attachments…\n </div>\n );\n }\n\n return (\n <div className=\"space-y-3\">\n {attachments.map((attachment) => {\n const isImage = attachment.mimeType.startsWith('image/');\n\n return (\n <div\n key={attachment.id}\n className=\"rounded-lg border border-border-subtle bg-bg-sunken/30 p-3\"\n >\n <div className=\"flex items-center gap-2 text-sm\">\n {isImage ? <ImageIcon size={16} /> : <Paperclip size={16} />}\n <a\n href={attachment.downloadUrl}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"font-medium text-primary hover:underline\"\n >\n {attachment.name}\n </a>\n <span className=\"text-text-secondary\">({attachment.mimeType})</span>\n </div>\n\n {isImage && attachment.downloadUrl !== '#' && (\n <img\n src={attachment.downloadUrl}\n alt={attachment.name}\n className=\"mt-3 max-h-64 rounded-lg border border-border-subtle object-contain\"\n />\n )}\n </div>\n );\n })}\n </div>\n );\n};\n"],"mappings":";;;;AAUA,IAAa,KAA2C,EAAE,YAAS,kBAAe;CAChF,IAAM,EAAE,gBAAa,iBAAc,EAAsB;EAAE;EAAS;EAAU,CAAC;AAe/E,QAbI,EAAQ,WAAW,IACd,OAGL,IAEA,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,GAAD;GAAS,MAAM;GAAI,WAAU;GAAiB,CAAA,EAAA,uBAE1C;MAKR,kBAAC,OAAD;EAAK,WAAU;YACZ,EAAY,KAAK,MAAe;GAC/B,IAAM,IAAU,EAAW,SAAS,WAAW,SAAS;AAExD,UACE,kBAAC,OAAD;IAEE,WAAU;cAFZ,CAIE,kBAAC,OAAD;KAAK,WAAU;eAAf;MACa,EAAV,IAAW,IAA0B,GAA3B,EAAW,MAAM,IAAM,CAA0B;MAC5D,kBAAC,KAAD;OACE,MAAM,EAAW;OACjB,QAAO;OACP,KAAI;OACJ,WAAU;iBAET,EAAW;OACV,CAAA;MACJ,kBAAC,QAAD;OAAM,WAAU;iBAAhB;QAAsC;QAAE,EAAW;QAAS;QAAQ;;MAChE;QAEL,KAAW,EAAW,gBAAgB,OACrC,kBAAC,OAAD;KACE,KAAK,EAAW;KAChB,KAAK,EAAW;KAChB,WAAU;KACV,CAAA,CAEA;MAvBC,EAAW,GAuBZ;IAER;EACE,CAAA"}
@@ -0,0 +1,7 @@
1
+ import type { FC } from 'react';
2
+ interface MarkdownContentProps {
3
+ content: string;
4
+ className?: string;
5
+ }
6
+ export declare const MarkdownContent: FC<MarkdownContentProps>;
7
+ export {};
@@ -0,0 +1,22 @@
1
+ import { type FC } from 'react';
2
+ export interface MessageComposerSendResult {
3
+ preserveAttachedFiles?: boolean;
4
+ preserveMessage?: boolean;
5
+ }
6
+ interface MessageComposerProps {
7
+ ticketId: string;
8
+ onSendMessage: (content: string, isInternal: boolean, files: File[]) => Promise<MessageComposerSendResult | void>;
9
+ placeholder?: string;
10
+ disabled?: boolean;
11
+ allowInternalNotes?: boolean;
12
+ cannedResponses?: readonly CannedResponseOption[];
13
+ cannedResponsesLoading?: boolean;
14
+ }
15
+ export interface CannedResponseOption {
16
+ id: string;
17
+ title: string;
18
+ content: string;
19
+ shortcut?: string | null;
20
+ }
21
+ export declare const MessageComposer: FC<MessageComposerProps>;
22
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { FC } from 'react';
2
+ import type { SupportMessage } from '../../../generated/global-types';
3
+ interface MessageThreadProps {
4
+ ticketId: string;
5
+ messages: SupportMessage[];
6
+ currentUserId?: string;
7
+ viewerRole?: 'customer' | 'agent';
8
+ showInternalMessages?: boolean;
9
+ showRealAgentIdentity?: boolean;
10
+ }
11
+ export declare const MessageThread: FC<MessageThreadProps>;
12
+ export {};