@burdenoff/microfe-support 2026.527.1 → 2026.527.3

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 (66) hide show
  1. package/dist/support/components/PageLayout.js +2 -2
  2. package/dist/support/components/PageLayout.js.map +1 -1
  3. package/dist/support/components/RouteHelpers.js +1 -1
  4. package/dist/support/components/RouteHelpers.js.map +1 -1
  5. package/dist/support/components/analytics/TrendChart.js +5 -5
  6. package/dist/support/components/analytics/TrendChart.js.map +1 -1
  7. package/dist/support/components/kb/ArticleForm.js +97 -94
  8. package/dist/support/components/kb/ArticleForm.js.map +1 -1
  9. package/dist/support/components/settings/CannedResponsesSettings.js +14 -2
  10. package/dist/support/components/settings/CannedResponsesSettings.js.map +1 -1
  11. package/dist/support/components/settings/SLAPoliciesSettings.js +19 -1
  12. package/dist/support/components/settings/SLAPoliciesSettings.js.map +1 -1
  13. package/dist/support/components/settings/TicketCategoriesSettings.js +27 -6
  14. package/dist/support/components/settings/TicketCategoriesSettings.js.map +1 -1
  15. package/dist/support/components/tickets/AttachmentList.js +1 -1
  16. package/dist/support/components/tickets/AttachmentList.js.map +1 -1
  17. package/dist/support/components/tickets/MessageComposer.js +59 -56
  18. package/dist/support/components/tickets/MessageComposer.js.map +1 -1
  19. package/dist/support/components/tickets/TicketDetailHeader.js +15 -23
  20. package/dist/support/components/tickets/TicketDetailHeader.js.map +1 -1
  21. package/dist/support/components/tickets/TicketHeader.js +1 -0
  22. package/dist/support/components/tickets/TicketHeader.js.map +1 -1
  23. package/dist/support/components/tickets/TicketSidebar.js +4 -4
  24. package/dist/support/components/tickets/TicketSidebar.js.map +1 -1
  25. package/dist/support/hooks/useAnalyticsOperations.js.map +1 -1
  26. package/dist/support/hooks/useSupportAttachments.js +20 -12
  27. package/dist/support/hooks/useSupportAttachments.js.map +1 -1
  28. package/dist/support/hooks/useTicketListOperations.js +1 -1
  29. package/dist/support/hooks/useTicketListOperations.js.map +1 -1
  30. package/dist/support/hooks/useTicketOperations.js +1 -1
  31. package/dist/support/hooks/useTicketOperations.js.map +1 -1
  32. package/dist/support/pages/ArticleDetailAdminPage.js +5 -5
  33. package/dist/support/pages/ArticleDetailAdminPage.js.map +1 -1
  34. package/dist/support/pages/ContactInquiriesPage.js +118 -108
  35. package/dist/support/pages/ContactInquiriesPage.js.map +1 -1
  36. package/dist/support/pages/ContactInquiryDetailPage.js +21 -12
  37. package/dist/support/pages/ContactInquiryDetailPage.js.map +1 -1
  38. package/dist/support/pages/CreateArticlePage.js +0 -1
  39. package/dist/support/pages/CreateArticlePage.js.map +1 -1
  40. package/dist/support/pages/CreateTicketPage.js +6 -3
  41. package/dist/support/pages/CreateTicketPage.js.map +1 -1
  42. package/dist/support/pages/EditArticlePage.js +0 -1
  43. package/dist/support/pages/EditArticlePage.js.map +1 -1
  44. package/dist/support/pages/JobApplicationDetailPage.js +26 -17
  45. package/dist/support/pages/JobApplicationDetailPage.js.map +1 -1
  46. package/dist/support/pages/JobApplicationsPage.js +121 -113
  47. package/dist/support/pages/JobApplicationsPage.js.map +1 -1
  48. package/dist/support/pages/KnowledgeBaseAdminPage.js +3 -0
  49. package/dist/support/pages/KnowledgeBaseAdminPage.js.map +1 -1
  50. package/dist/support/pages/KnowledgeBaseUserPage.js +3 -0
  51. package/dist/support/pages/KnowledgeBaseUserPage.js.map +1 -1
  52. package/dist/support/pages/SettingsPage.js +1 -0
  53. package/dist/support/pages/SettingsPage.js.map +1 -1
  54. package/dist/support/pages/TicketDetailAdminPage.js +4 -0
  55. package/dist/support/pages/TicketDetailAdminPage.js.map +1 -1
  56. package/dist/support/pages/TicketDetailUserPage.js +140 -142
  57. package/dist/support/pages/TicketDetailUserPage.js.map +1 -1
  58. package/dist/support/pages/TicketListPage.js +15 -2
  59. package/dist/support/pages/TicketListPage.js.map +1 -1
  60. package/dist/support/providers/SupportProvider.js +1 -1
  61. package/dist/support/providers/SupportProvider.js.map +1 -1
  62. package/dist/support/utils/supportFiles.js +14 -15
  63. package/dist/support/utils/supportFiles.js.map +1 -1
  64. package/dist/support/utils/uiTokens.js.map +1 -1
  65. package/package.json +1 -1
  66. package/dist/support/components/kb/index.js +0 -1
@@ -12,7 +12,7 @@ var r = {
12
12
  };
13
13
  function i({ children: i, title: a, subtitle: o, icon: s, headerActions: c, headerContent: l, maxWidth: u = "xl", showHeader: d = !0, className: f, contentClassName: p }) {
14
14
  return /* @__PURE__ */ t("div", {
15
- className: e("min-h-full w-full", "px-4 sm:px-6 lg:px-8 xl:px-12", "py-6 sm:py-8 lg:py-10", "animate-in fade-in-0 slide-in-from-bottom-4 duration-500", f),
15
+ className: e("min-size-full", "px-4 sm:px-6 lg:px-8 xl:px-12", "py-6 sm:py-8 lg:py-10", "animate-in fade-in-0 slide-in-from-bottom-4 duration-500", f),
16
16
  children: /* @__PURE__ */ n("div", {
17
17
  className: e("mx-auto w-full", r[u], p),
18
18
  children: [d && (a || c) && /* @__PURE__ */ n("header", {
@@ -74,7 +74,7 @@ function o({ message: r = "Loading...", className: i }) {
74
74
  className: e("flex flex-col items-center justify-center py-20", i),
75
75
  children: [/* @__PURE__ */ n("div", {
76
76
  className: "relative",
77
- children: [/* @__PURE__ */ t("div", { className: "absolute inset-0 bg-primary/20 rounded-full blur-xl animate-pulse" }), /* @__PURE__ */ t("div", { className: "relative w-12 h-12 border-4 border-primary/30 border-t-primary rounded-full animate-spin" })]
77
+ children: [/* @__PURE__ */ t("div", { className: "absolute inset-0 bg-primary/20 rounded-full blur-xl animate-pulse" }), /* @__PURE__ */ t("div", { className: "relative size-12 border-4 border-primary/30 border-t-primary rounded-full animate-spin" })]
78
78
  }), /* @__PURE__ */ t("span", {
79
79
  className: "mt-6 text-sm font-medium text-muted-foreground",
80
80
  children: r
@@ -1 +1 @@
1
- {"version":3,"file":"PageLayout.js","names":[],"sources":["../../../src/support/components/PageLayout.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { cn } from '../utils/cn';\n\ninterface PageLayoutProps {\n children: ReactNode;\n /** Page title */\n title?: string;\n /** Page subtitle/description */\n subtitle?: string;\n /** Icon component to display next to title */\n icon?: ReactNode;\n /** Actions to display in header (buttons, etc.) */\n headerActions?: ReactNode;\n /** Additional header content below title */\n headerContent?: ReactNode;\n /** Maximum width of content: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full' */\n maxWidth?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full';\n /** Whether to show the header section */\n showHeader?: boolean;\n /** Additional CSS classes for the container */\n className?: string;\n /** Additional CSS classes for the content area */\n contentClassName?: string;\n}\n\nconst maxWidthClasses = {\n sm: 'max-w-screen-sm', // 640px\n md: 'max-w-screen-md', // 768px\n lg: 'max-w-screen-lg', // 1024px\n xl: 'max-w-screen-xl', // 1280px\n '2xl': 'max-w-screen-2xl', // 1536px\n '3xl': 'max-w-[1600px]',\n full: 'max-w-full',\n};\n\n/**\n * PageLayout - A consistent page wrapper with responsive design for Support module\n *\n * Features:\n * - Proper max-width constraints\n * - Responsive padding\n * - Animated entrance\n * - Consistent header styling\n */\nexport function PageLayout({\n children,\n title,\n subtitle,\n icon,\n headerActions,\n headerContent,\n maxWidth = 'xl',\n showHeader = true,\n className,\n contentClassName,\n}: PageLayoutProps) {\n return (\n <div\n className={cn(\n // Base styles - full width container with padding\n 'min-h-full w-full',\n // Responsive horizontal padding\n 'px-4 sm:px-6 lg:px-8 xl:px-12',\n // Responsive vertical padding\n 'py-6 sm:py-8 lg:py-10',\n // Entrance animation\n 'animate-in fade-in-0 slide-in-from-bottom-4 duration-500',\n className\n )}\n >\n {/* Max-width constrained content container */}\n <div className={cn('mx-auto w-full', maxWidthClasses[maxWidth], contentClassName)}>\n {/* Page Header */}\n {showHeader && (title || headerActions) && (\n <header className=\"mb-6 sm:mb-8\">\n <div className=\"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between\">\n {/* Title Section */}\n <div className=\"space-y-1\">\n {(title || icon) && (\n <div className=\"flex items-center gap-3\">\n {icon && (\n <div className=\"flex-shrink-0 p-2.5 rounded-xl bg-primary/10 text-primary\">\n {icon}\n </div>\n )}\n {title && (\n <h1 className=\"text-2xl sm:text-3xl font-bold tracking-tight text-foreground\">\n {title}\n </h1>\n )}\n </div>\n )}\n {subtitle && (\n <p className=\"text-sm sm:text-base text-muted-foreground max-w-2xl\">{subtitle}</p>\n )}\n </div>\n\n {/* Header Actions */}\n {headerActions && (\n <div className=\"flex items-center gap-2 flex-shrink-0\">{headerActions}</div>\n )}\n </div>\n\n {/* Additional Header Content */}\n {headerContent && <div className=\"mt-4\">{headerContent}</div>}\n </header>\n )}\n\n {/* Page content — must not use a <main> landmark here because the\n host shell (AppShellLayout) already renders one; nesting <main>\n elements is invalid HTML and an a11y violation. */}\n <div className=\"space-y-6\">{children}</div>\n </div>\n </div>\n );\n}\n\n/**\n * PageSection - A section within a page with consistent spacing\n */\nexport function PageSection({\n children,\n title,\n description,\n actions,\n className,\n}: {\n children: ReactNode;\n title?: string;\n description?: string;\n actions?: ReactNode;\n className?: string;\n}) {\n return (\n <section className={cn('space-y-4', className)}>\n {(title || actions) && (\n <div className=\"flex items-center justify-between\">\n <div>\n {title && <h2 className=\"text-lg font-semibold text-foreground\">{title}</h2>}\n {description && <p className=\"text-sm text-muted-foreground\">{description}</p>}\n </div>\n {actions && <div className=\"flex items-center gap-2\">{actions}</div>}\n </div>\n )}\n {children}\n </section>\n );\n}\n\n/**\n * EmptyState - A consistent empty state component\n */\nexport function EmptyState({\n icon,\n title,\n description,\n action,\n className,\n}: {\n icon?: ReactNode;\n title: string;\n description?: string;\n action?: ReactNode;\n className?: string;\n}) {\n return (\n <div\n className={cn(\n 'flex flex-col items-center justify-center',\n 'py-12 sm:py-16 px-4',\n 'text-center',\n 'animate-in fade-in-0 zoom-in-95 duration-300',\n className\n )}\n >\n {icon && <div className=\"mb-4 p-4 rounded-2xl bg-muted/50 text-muted-foreground\">{icon}</div>}\n <h3 className=\"text-lg font-semibold text-foreground mb-1\">{title}</h3>\n {description && <p className=\"text-sm text-muted-foreground max-w-sm mb-4\">{description}</p>}\n {action}\n </div>\n );\n}\n\n/**\n * LoadingState - A consistent loading state component\n */\nexport function LoadingState({\n message = 'Loading...',\n className,\n}: {\n message?: string;\n className?: string;\n}) {\n return (\n <div className={cn('flex flex-col items-center justify-center py-20', className)}>\n <div className=\"relative\">\n <div className=\"absolute inset-0 bg-primary/20 rounded-full blur-xl animate-pulse\" />\n <div className=\"relative w-12 h-12 border-4 border-primary/30 border-t-primary rounded-full animate-spin\" />\n </div>\n <span className=\"mt-6 text-sm font-medium text-muted-foreground\">{message}</span>\n </div>\n );\n}\n"],"mappings":";;;AAyBA,IAAM,IAAkB;CACtB,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,MAAM;CACP;AAWD,SAAgB,EAAW,EACzB,aACA,UACA,aACA,SACA,kBACA,kBACA,cAAW,MACX,gBAAa,IACb,cACA,uBACkB;AAClB,QACE,kBAAC,OAAD;EACE,WAAW,EAET,qBAEA,iCAEA,yBAEA,4DACA,EACD;YAGD,kBAAC,OAAD;GAAK,WAAW,EAAG,kBAAkB,EAAgB,IAAW,EAAiB;aAAjF,CAEG,MAAe,KAAS,MACvB,kBAAC,UAAD;IAAQ,WAAU;cAAlB,CACE,kBAAC,OAAD;KAAK,WAAU;eAAf,CAEE,kBAAC,OAAD;MAAK,WAAU;gBAAf,EACI,KAAS,MACT,kBAAC,OAAD;OAAK,WAAU;iBAAf,CACG,KACC,kBAAC,OAAD;QAAK,WAAU;kBACZ;QACG,CAAA,EAEP,KACC,kBAAC,MAAD;QAAI,WAAU;kBACX;QACE,CAAA,CAEH;UAEP,KACC,kBAAC,KAAD;OAAG,WAAU;iBAAwD;OAAa,CAAA,CAEhF;SAGL,KACC,kBAAC,OAAD;MAAK,WAAU;gBAAyC;MAAoB,CAAA,CAE1E;QAGL,KAAiB,kBAAC,OAAD;KAAK,WAAU;eAAQ;KAAoB,CAAA,CACtD;OAMX,kBAAC,OAAD;IAAK,WAAU;IAAa;IAAe,CAAA,CACvC;;EACF,CAAA;;AAuCV,SAAgB,EAAW,EACzB,SACA,UACA,gBACA,WACA,gBAOC;AACD,QACE,kBAAC,OAAD;EACE,WAAW,EACT,6CACA,uBACA,eACA,gDACA,EACD;YAPH;GASG,KAAQ,kBAAC,OAAD;IAAK,WAAU;cAA0D;IAAW,CAAA;GAC7F,kBAAC,MAAD;IAAI,WAAU;cAA8C;IAAW,CAAA;GACtE,KAAe,kBAAC,KAAD;IAAG,WAAU;cAA+C;IAAgB,CAAA;GAC3F;GACG;;;AAOV,SAAgB,EAAa,EAC3B,aAAU,cACV,gBAIC;AACD,QACE,kBAAC,OAAD;EAAK,WAAW,EAAG,mDAAmD,EAAU;YAAhF,CACE,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,OAAD,EAAK,WAAU,qEAAsE,CAAA,EACrF,kBAAC,OAAD,EAAK,WAAU,4FAA6F,CAAA,CACxG;MACN,kBAAC,QAAD;GAAM,WAAU;aAAkD;GAAe,CAAA,CAC7E"}
1
+ {"version":3,"file":"PageLayout.js","names":[],"sources":["../../../src/support/components/PageLayout.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { cn } from '../utils/cn';\n\ninterface PageLayoutProps {\n children: ReactNode;\n /** Page title */\n title?: string;\n /** Page subtitle/description */\n subtitle?: string;\n /** Icon component to display next to title */\n icon?: ReactNode;\n /** Actions to display in header (buttons, etc.) */\n headerActions?: ReactNode;\n /** Additional header content below title */\n headerContent?: ReactNode;\n /** Maximum width of content: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full' */\n maxWidth?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full';\n /** Whether to show the header section */\n showHeader?: boolean;\n /** Additional CSS classes for the container */\n className?: string;\n /** Additional CSS classes for the content area */\n contentClassName?: string;\n}\n\nconst maxWidthClasses = {\n sm: 'max-w-screen-sm', // 640px\n md: 'max-w-screen-md', // 768px\n lg: 'max-w-screen-lg', // 1024px\n xl: 'max-w-screen-xl', // 1280px\n '2xl': 'max-w-screen-2xl', // 1536px\n '3xl': 'max-w-[1600px]',\n full: 'max-w-full',\n};\n\n/**\n * PageLayout - A consistent page wrapper with responsive design for Support module\n *\n * Features:\n * - Proper max-width constraints\n * - Responsive padding\n * - Animated entrance\n * - Consistent header styling\n */\nexport function PageLayout({\n children,\n title,\n subtitle,\n icon,\n headerActions,\n headerContent,\n maxWidth = 'xl',\n showHeader = true,\n className,\n contentClassName,\n}: PageLayoutProps) {\n return (\n <div\n className={cn(\n // Base styles - full width container with padding\n 'min-size-full',\n // Responsive horizontal padding\n 'px-4 sm:px-6 lg:px-8 xl:px-12',\n // Responsive vertical padding\n 'py-6 sm:py-8 lg:py-10',\n // Entrance animation\n 'animate-in fade-in-0 slide-in-from-bottom-4 duration-500',\n className\n )}\n >\n {/* Max-width constrained content container */}\n <div className={cn('mx-auto w-full', maxWidthClasses[maxWidth], contentClassName)}>\n {/* Page Header */}\n {showHeader && (title || headerActions) && (\n <header className=\"mb-6 sm:mb-8\">\n <div className=\"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between\">\n {/* Title Section */}\n <div className=\"space-y-1\">\n {(title || icon) && (\n <div className=\"flex items-center gap-3\">\n {icon && (\n <div className=\"flex-shrink-0 p-2.5 rounded-xl bg-primary/10 text-primary\">\n {icon}\n </div>\n )}\n {title && (\n <h1 className=\"text-2xl sm:text-3xl font-bold tracking-tight text-foreground\">\n {title}\n </h1>\n )}\n </div>\n )}\n {subtitle && (\n <p className=\"text-sm sm:text-base text-muted-foreground max-w-2xl\">{subtitle}</p>\n )}\n </div>\n\n {/* Header Actions */}\n {headerActions && (\n <div className=\"flex items-center gap-2 flex-shrink-0\">{headerActions}</div>\n )}\n </div>\n\n {/* Additional Header Content */}\n {headerContent && <div className=\"mt-4\">{headerContent}</div>}\n </header>\n )}\n\n {/* Page content — must not use a <main> landmark here because the\n host shell (AppShellLayout) already renders one; nesting <main>\n elements is invalid HTML and an a11y violation. */}\n <div className=\"space-y-6\">{children}</div>\n </div>\n </div>\n );\n}\n\n\n/**\n * EmptyState - A consistent empty state component\n */\nexport function EmptyState({\n icon,\n title,\n description,\n action,\n className,\n}: {\n icon?: ReactNode;\n title: string;\n description?: string;\n action?: ReactNode;\n className?: string;\n}) {\n return (\n <div\n className={cn(\n 'flex flex-col items-center justify-center',\n 'py-12 sm:py-16 px-4',\n 'text-center',\n 'animate-in fade-in-0 zoom-in-95 duration-300',\n className\n )}\n >\n {icon && <div className=\"mb-4 p-4 rounded-2xl bg-muted/50 text-muted-foreground\">{icon}</div>}\n <h3 className=\"text-lg font-semibold text-foreground mb-1\">{title}</h3>\n {description && <p className=\"text-sm text-muted-foreground max-w-sm mb-4\">{description}</p>}\n {action}\n </div>\n );\n}\n\n/**\n * LoadingState - A consistent loading state component\n */\nexport function LoadingState({\n message = 'Loading...',\n className,\n}: {\n message?: string;\n className?: string;\n}) {\n return (\n <div className={cn('flex flex-col items-center justify-center py-20', className)}>\n <div className=\"relative\">\n <div className=\"absolute inset-0 bg-primary/20 rounded-full blur-xl animate-pulse\" />\n <div className=\"relative size-12 border-4 border-primary/30 border-t-primary rounded-full animate-spin\" />\n </div>\n <span className=\"mt-6 text-sm font-medium text-muted-foreground\">{message}</span>\n </div>\n );\n}\n"],"mappings":";;;AAyBA,IAAM,IAAkB;CACtB,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,MAAM;CACP;AAWD,SAAgB,EAAW,EACzB,aACA,UACA,aACA,SACA,kBACA,kBACA,cAAW,MACX,gBAAa,IACb,cACA,uBACkB;AAClB,QACE,kBAAC,OAAD;EACE,WAAW,EAET,iBAEA,iCAEA,yBAEA,4DACA,EACD;YAGD,kBAAC,OAAD;GAAK,WAAW,EAAG,kBAAkB,EAAgB,IAAW,EAAiB;aAAjF,CAEG,MAAe,KAAS,MACvB,k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64 items-center justify-center",
10
- children: /* @__PURE__ */ i("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
10
+ children: /* @__PURE__ */ i("div", { className: "size-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
11
11
  });
12
12
  }
13
13
  function o() {
@@ -1 +1 @@
1
- {"version":3,"file":"RouteHelpers.js","names":[],"sources":["../../../src/support/components/RouteHelpers.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { useSupport } from '../providers/SupportProvider';\nimport { joinPath } from '../utils';\n\n/**\n * Shared loading fallback for lazy-loaded route pages.\n */\nexport function PageLoader() {\n return (\n <div className=\"flex h-64 items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\n );\n}\n\n/**\n * Catch-all redirect that sends unknown paths to the tickets page.\n * Uses basePath from SupportProvider context and joinPath to avoid double-slashes.\n */\nexport function CatchAllRedirect() {\n const { basePath = '/' } = useSupport();\n const navigate = useNavigate();\n useEffect(() => {\n navigate(joinPath(basePath, 'tickets'), { replace: true });\n }, [basePath, navigate]);\n return null;\n}\n"],"mappings":";;;;;;AAQA,SAAgB,IAAa;AAC3B,QACE,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,OAAD,EAAK,WAAU,kFAAmF,CAAA;EAC9F,CAAA;;AAQV,SAAgB,IAAmB;CACjC,IAAM,EAAE,cAAW,QAAQ,GAAY,EACjC,IAAW,GAAa;AAI9B,QAHA,QAAgB;AACd,IAAS,EAAS,GAAU,UAAU,EAAE,EAAE,SAAS,IAAM,CAAC;IACzD,CAAC,GAAU,EAAS,CAAC,EACjB"}
1
+ {"version":3,"file":"RouteHelpers.js","names":[],"sources":["../../../src/support/components/RouteHelpers.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { useSupport } from '../providers/SupportProvider';\nimport { joinPath } from '../utils';\n\n/**\n * Shared loading fallback for lazy-loaded route pages.\n */\nexport function PageLoader() {\n return (\n <div className=\"flex h-64 items-center justify-center\">\n <div className=\"size-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\n );\n}\n\n/**\n * Catch-all redirect that sends unknown paths to the tickets page.\n * Uses basePath from SupportProvider context and joinPath to avoid double-slashes.\n */\nexport function CatchAllRedirect() {\n const { basePath = '/' } = useSupport();\n const navigate = useNavigate();\n useEffect(() => {\n navigate(joinPath(basePath, 'tickets'), { replace: true });\n }, [basePath, navigate]);\n return null;\n}\n"],"mappings":";;;;;;AAQA,SAAgB,IAAa;AAC3B,QACE,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,OAAD,EAAK,WAAU,iFAAkF,CAAA;EAC7F,CAAA;;AAQV,SAAgB,IAAmB;CACjC,IAAM,EAAE,cAAW,QAAQ,GAAY,EACjC,IAAW,GAAa;AAI9B,QAHA,QAAgB;AACd,IAAS,EAAS,GAAU,UAAU,EAAE,EAAE,SAAS,IAAM,CAAC;IACzD,CAAC,GAAU,EAAS,CAAC,EACjB"}
@@ -17,13 +17,13 @@ function r({ trends: r, period: i }) {
17
17
  })] })
18
18
  }), /* @__PURE__ */ t("div", {
19
19
  className: "space-y-2",
20
- children: r.map((e, r) => {
21
- let i = (e.value - o) / s * 100, a = new Date(e.timestamp);
20
+ children: r.map((e) => {
21
+ let r = (e.value - o) / s * 100, i = new Date(e.timestamp);
22
22
  return /* @__PURE__ */ n("div", {
23
23
  className: "flex items-center gap-3 transition-colors duration-200 hover:bg-muted/50 p-1 rounded",
24
24
  children: [/* @__PURE__ */ t("span", {
25
25
  className: "text-xs w-20 text-right text-tertiary",
26
- children: e.label || a.toLocaleDateString("en-US", {
26
+ children: e.label || i.toLocaleDateString("en-US", {
27
27
  month: "short",
28
28
  day: "numeric"
29
29
  })
@@ -31,13 +31,13 @@ function r({ trends: r, period: i }) {
31
31
  className: "flex-1 flex items-center gap-2",
32
32
  children: [/* @__PURE__ */ t("div", {
33
33
  className: "h-8 rounded transition-all duration-300 bg-primary/80 hover:bg-primary",
34
- style: { width: `${Math.max(i, 2)}%` }
34
+ style: { width: `${Math.max(r, 2)}%` }
35
35
  }), /* @__PURE__ */ t("span", {
36
36
  className: "text-sm font-medium text-primary",
37
37
  children: e.value
38
38
  })]
39
39
  })]
40
- }, r);
40
+ }, e.timestamp);
41
41
  })
42
42
  })]
43
43
  });
@@ -1 +1 @@
1
- {"version":3,"file":"TrendChart.js","names":[],"sources":["../../../../src/support/components/analytics/TrendChart.tsx"],"sourcesContent":["import { TrendingUp } from 'lucide-react';\n\ninterface TrendDataPoint {\n timestamp: string;\n value: number;\n label?: string | null;\n}\n\ninterface TrendChartProps {\n trends: TrendDataPoint[];\n period: {\n startDate: string;\n endDate: string;\n label: string;\n };\n}\n\nexport function TrendChart({ trends, period }: TrendChartProps) {\n if (!trends || trends.length === 0) {\n return null;\n }\n\n const maxValue = Math.max(...trends.map((t) => t.value));\n const minValue = Math.min(...trends.map((t) => t.value));\n const range = maxValue - minValue || 1;\n\n return (\n <div className=\"p-6 rounded-lg border border-default bg-surface transition-all duration-200 hover:shadow-sm animate-in fade-in-0 slide-in-from-bottom-2\">\n <div className=\"flex items-center justify-between mb-6\">\n <div>\n <h2 className=\"text-xl font-semibold flex items-center gap-2 text-primary\">\n <TrendingUp size={20} />\n Ticket Volume Trends\n </h2>\n <p className=\"text-sm mt-1 text-secondary\">{period.label}</p>\n </div>\n </div>\n\n <div className=\"space-y-2\">\n {trends.map((point, index) => {\n const heightPercent = ((point.value - minValue) / range) * 100;\n const date = new Date(point.timestamp);\n const label =\n point.label || date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });\n\n return (\n <div\n key={index}\n className=\"flex items-center gap-3 transition-colors duration-200 hover:bg-muted/50 p-1 rounded\"\n >\n <span className=\"text-xs w-20 text-right text-tertiary\">{label}</span>\n <div className=\"flex-1 flex items-center gap-2\">\n <div\n className=\"h-8 rounded transition-all duration-300 bg-primary/80 hover:bg-primary\"\n style={{\n width: `${Math.max(heightPercent, 2)}%`,\n }}\n />\n <span className=\"text-sm font-medium text-primary\">{point.value}</span>\n </div>\n </div>\n );\n })}\n </div>\n </div>\n );\n}\n"],"mappings":";;;AAiBA,SAAgB,EAAW,EAAE,WAAQ,aAA2B;AAC9D,KAAI,CAAC,KAAU,EAAO,WAAW,EAC/B,QAAO;CAGT,IAAM,IAAW,KAAK,IAAI,GAAG,EAAO,KAAK,MAAM,EAAE,MAAM,CAAC,EAClD,IAAW,KAAK,IAAI,GAAG,EAAO,KAAK,MAAM,EAAE,MAAM,CAAC,EAClD,IAAQ,IAAW,KAAY;AAErC,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,OAAD;GAAK,WAAU;aACb,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;IAAI,WAAU;cAAd,CACE,kBAAC,GAAD,EAAY,MAAM,IAAM,CAAA,EAAA,uBAErB;OACL,kBAAC,KAAD;IAAG,WAAU;cAA+B,EAAO;IAAU,CAAA,CACzD,EAAA,CAAA;GACF,CAAA,EAEN,kBAAC,OAAD;GAAK,WAAU;aACZ,EAAO,KAAK,GAAO,MAAU;IAC5B,IAAM,KAAkB,EAAM,QAAQ,KAAY,IAAS,KACrD,IAAO,IAAI,KAAK,EAAM,UAAU;AAItC,WACE,kBAAC,OAAD;KAEE,WAAU;eAFZ,CAIE,kBAAC,QAAD;MAAM,WAAU;gBAPlB,EAAM,SAAS,EAAK,mBAAmB,SAAS;OAAE,OAAO;OAAS,KAAK;OAAW,CAAC;MAOX,CAAA,EACtE,kBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,kBAAC,OAAD;OACE,WAAU;OACV,OAAO,EACL,OAAO,GAAG,KAAK,IAAI,GAAe,EAAE,CAAC,IACtC;OACD,CAAA,EACF,kBAAC,QAAD;OAAM,WAAU;iBAAoC,EAAM;OAAa,CAAA,CACnE;QACF;OAbC,EAaD;KAER;GACE,CAAA,CACF"}
1
+ {"version":3,"file":"TrendChart.js","names":[],"sources":["../../../../src/support/components/analytics/TrendChart.tsx"],"sourcesContent":["import { TrendingUp } from 'lucide-react';\n\ninterface TrendDataPoint {\n timestamp: string;\n value: number;\n label?: string | null;\n}\n\ninterface TrendChartProps {\n trends: TrendDataPoint[];\n period: {\n startDate: string;\n endDate: string;\n label: string;\n };\n}\n\nexport function TrendChart({ trends, period }: TrendChartProps) {\n if (!trends || trends.length === 0) {\n return null;\n }\n\n const maxValue = Math.max(...trends.map((t) => t.value));\n const minValue = Math.min(...trends.map((t) => t.value));\n const range = maxValue - minValue || 1;\n\n return (\n <div className=\"p-6 rounded-lg border border-default bg-surface transition-all duration-200 hover:shadow-sm animate-in fade-in-0 slide-in-from-bottom-2\">\n <div className=\"flex items-center justify-between mb-6\">\n <div>\n <h2 className=\"text-xl font-semibold flex items-center gap-2 text-primary\">\n <TrendingUp size={20} />\n Ticket Volume Trends\n </h2>\n <p className=\"text-sm mt-1 text-secondary\">{period.label}</p>\n </div>\n </div>\n\n <div className=\"space-y-2\">\n {trends.map((point) => {\n const heightPercent = ((point.value - minValue) / range) * 100;\n const date = new Date(point.timestamp);\n const label =\n point.label || date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });\n\n return (\n <div\n key={point.timestamp}\n className=\"flex items-center gap-3 transition-colors duration-200 hover:bg-muted/50 p-1 rounded\"\n >\n <span className=\"text-xs w-20 text-right text-tertiary\">{label}</span>\n <div className=\"flex-1 flex items-center gap-2\">\n <div\n className=\"h-8 rounded transition-all duration-300 bg-primary/80 hover:bg-primary\"\n style={{\n width: `${Math.max(heightPercent, 2)}%`,\n }}\n />\n <span className=\"text-sm font-medium text-primary\">{point.value}</span>\n </div>\n </div>\n );\n })}\n </div>\n </div>\n );\n}\n"],"mappings":";;;AAiBA,SAAgB,EAAW,EAAE,WAAQ,aAA2B;AAC9D,KAAI,CAAC,KAAU,EAAO,WAAW,EAC/B,QAAO;CAGT,IAAM,IAAW,KAAK,IAAI,GAAG,EAAO,KAAK,MAAM,EAAE,MAAM,CAAC,EAClD,IAAW,KAAK,IAAI,GAAG,EAAO,KAAK,MAAM,EAAE,MAAM,CAAC,EAClD,IAAQ,IAAW,KAAY;AAErC,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,OAAD;GAAK,WAAU;aACb,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;IAAI,WAAU;cAAd,CACE,kBAAC,GAAD,EAAY,MAAM,IAAM,CAAA,EAAA,uBAErB;OACL,kBAAC,KAAD;IAAG,WAAU;cAA+B,EAAO;IAAU,CAAA,CACzD,EAAA,CAAA;GACF,CAAA,EAEN,kBAAC,OAAD;GAAK,WAAU;aACZ,EAAO,KAAK,MAAU;IACrB,IAAM,KAAkB,EAAM,QAAQ,KAAY,IAAS,KACrD,IAAO,IAAI,KAAK,EAAM,UAAU;AAItC,WACE,kBAAC,OAAD;KAEE,WAAU;eAFZ,CAIE,kBAAC,QAAD;MAAM,WAAU;gBAPlB,EAAM,SAAS,EAAK,mBAAmB,SAAS;OAAE,OAAO;OAAS,KAAK;OAAW,CAAC;MAOX,CAAA,EACtE,kBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,kBAAC,OAAD;OACE,WAAU;OACV,OAAO,EACL,OAAO,GAAG,KAAK,IAAI,GAAe,EAAE,CAAC,IACtC;OACD,CAAA,EACF,kBAAC,QAAD;OAAM,WAAU;iBAAoC,EAAM;OAAa,CAAA,CACnE;QACF;OAbC,EAAM,UAaP;KAER;GACE,CAAA,CACF"}
@@ -1,257 +1,260 @@
1
1
  import { Button as e, Input as t } from "../ui.js";
2
2
  import { renderSupportMarkdown as n } from "../../utils/markdown.js";
3
- import { useMemo as r, useState as i } from "react";
4
- import { Edit as a, Eye as o, Loader2 as s, Save as c, X as l } from "lucide-react";
5
- import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
3
+ import { useMemo as r, useRef as i, useState as a } from "react";
4
+ import { Edit as o, Eye as s, Loader2 as c, Save as l, X as u } from "lucide-react";
5
+ import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
6
6
  //#region src/support/components/kb/ArticleForm.tsx
7
- function p(e) {
7
+ function m(e) {
8
8
  return e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").substring(0, 100);
9
9
  }
10
- function m({ initialData: m, categories: h, onSubmit: g, onCancel: _, isSubmitting: v, submitLabel: y = "Save Article" }) {
11
- let [b, x] = i({
12
- title: m?.title || "",
13
- slug: m?.slug || "",
14
- content: m?.content || "",
15
- excerpt: m?.excerpt || "",
16
- categoryId: m?.categoryId || "",
17
- tags: m?.tags || [],
18
- metaDescription: m?.metaDescription || "",
19
- status: m?.status || "DRAFT"
20
- }), [S, C] = i(m?.tags?.join(", ") || ""), [w, T] = i(!1), [E, D] = i(!1), O = r(() => {
21
- if (!b.content) return "";
10
+ function h({ initialData: h, categories: g, onSubmit: _, onCancel: v, isSubmitting: y, submitLabel: b = "Save Article" }) {
11
+ let [x, S] = a({
12
+ title: h?.title || "",
13
+ slug: h?.slug || "",
14
+ content: h?.content || "",
15
+ excerpt: h?.excerpt || "",
16
+ categoryId: h?.categoryId || "",
17
+ tags: h?.tags || [],
18
+ metaDescription: h?.metaDescription || "",
19
+ status: h?.status || "DRAFT"
20
+ }), [C, w] = a(h?.tags?.join(", ") || ""), T = i(!1), [E, D] = a(!1), O = r(() => {
21
+ if (!x.content) return "";
22
22
  try {
23
- return n(b.content);
23
+ return n(x.content);
24
24
  } catch {
25
- return b.content;
25
+ return x.content;
26
26
  }
27
- }, [b.content]), k = (e) => {
28
- x(w ? (t) => ({
27
+ }, [x.content]), k = (e) => {
28
+ T.current ? S((t) => ({
29
29
  ...t,
30
30
  title: e
31
- }) : (t) => ({
31
+ })) : S((t) => ({
32
32
  ...t,
33
33
  title: e,
34
- slug: p(e)
34
+ slug: m(e)
35
35
  }));
36
36
  }, A = (e) => {
37
- C(e);
37
+ w(e);
38
38
  let t = e.split(",").map((e) => e.trim()).filter((e) => e.length > 0);
39
- x((e) => ({
39
+ S((e) => ({
40
40
  ...e,
41
41
  tags: t
42
42
  }));
43
43
  }, j = (e) => {
44
- T(!0), x((t) => ({
44
+ T.current = !0, S((t) => ({
45
45
  ...t,
46
46
  slug: e
47
47
  }));
48
48
  }, M = async (e) => {
49
- e.preventDefault(), await g(b);
50
- }, N = b.title.trim() && b.slug.trim() && b.content.trim();
51
- return /* @__PURE__ */ f("form", {
49
+ e.preventDefault(), await _(x);
50
+ }, N = x.title.trim() && x.slug.trim() && x.content.trim();
51
+ return /* @__PURE__ */ p("form", {
52
52
  onSubmit: M,
53
53
  className: "space-y-6",
54
- children: [/* @__PURE__ */ f("div", {
54
+ children: [/* @__PURE__ */ p("div", {
55
55
  className: "p-6 rounded-xl border bg-card space-y-6",
56
56
  children: [
57
- /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ f("label", {
57
+ /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ p("label", {
58
58
  htmlFor: "support-article-title",
59
59
  className: "mb-2 block text-sm font-medium text-foreground",
60
- children: ["Title ", /* @__PURE__ */ d("span", {
60
+ children: ["Title ", /* @__PURE__ */ f("span", {
61
61
  className: "text-destructive",
62
62
  children: "*"
63
63
  })]
64
- }), /* @__PURE__ */ d(t, {
64
+ }), /* @__PURE__ */ f(t, {
65
65
  id: "support-article-title",
66
66
  type: "text",
67
67
  required: !0,
68
- value: b.title,
68
+ value: x.title,
69
69
  onChange: (e) => k(e.target.value),
70
70
  placeholder: "Article title"
71
71
  })] }),
72
- /* @__PURE__ */ f("div", { children: [
73
- /* @__PURE__ */ f("label", {
72
+ /* @__PURE__ */ p("div", { children: [
73
+ /* @__PURE__ */ p("label", {
74
74
  htmlFor: "support-article-slug",
75
75
  className: "mb-2 block text-sm font-medium text-foreground",
76
- children: ["URL Slug ", /* @__PURE__ */ d("span", {
76
+ children: ["URL Slug ", /* @__PURE__ */ f("span", {
77
77
  className: "text-destructive",
78
78
  children: "*"
79
79
  })]
80
80
  }),
81
- /* @__PURE__ */ f("div", {
81
+ /* @__PURE__ */ p("div", {
82
82
  className: "flex flex-col gap-2 sm:flex-row sm:items-center",
83
- children: [/* @__PURE__ */ d("span", {
83
+ children: [/* @__PURE__ */ f("span", {
84
84
  className: "text-sm text-muted-foreground",
85
85
  children: "/kb/articles/"
86
- }), /* @__PURE__ */ d(t, {
86
+ }), /* @__PURE__ */ f(t, {
87
87
  id: "support-article-slug",
88
88
  type: "text",
89
89
  required: !0,
90
- value: b.slug,
90
+ value: x.slug,
91
91
  onChange: (e) => j(e.target.value),
92
92
  placeholder: "article-url-slug",
93
93
  className: "flex-1"
94
94
  })]
95
95
  }),
96
- /* @__PURE__ */ d("p", {
96
+ /* @__PURE__ */ f("p", {
97
97
  className: "text-xs text-muted-foreground mt-1",
98
98
  children: "Auto-generated from title. Edit to customize."
99
99
  })
100
100
  ] }),
101
- /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
101
+ /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("label", {
102
102
  htmlFor: "support-article-excerpt",
103
103
  className: "mb-2 block text-sm font-medium text-foreground",
104
104
  children: "Excerpt"
105
- }), /* @__PURE__ */ d("textarea", {
105
+ }), /* @__PURE__ */ f("textarea", {
106
106
  id: "support-article-excerpt",
107
+ "aria-label": "Excerpt",
107
108
  rows: 3,
108
- value: b.excerpt,
109
- onChange: (e) => x({
110
- ...b,
109
+ value: x.excerpt,
110
+ onChange: (e) => S({
111
+ ...x,
111
112
  excerpt: e.target.value
112
113
  }),
113
114
  className: "w-full px-4 py-3 rounded-lg border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors",
114
115
  placeholder: "Brief summary of the article (displayed in search results)"
115
116
  })] }),
116
- /* @__PURE__ */ f("div", { children: [
117
- /* @__PURE__ */ f("div", {
117
+ /* @__PURE__ */ p("div", { children: [
118
+ /* @__PURE__ */ p("div", {
118
119
  className: "flex items-center justify-between mb-2",
119
- children: [/* @__PURE__ */ f("label", {
120
+ children: [/* @__PURE__ */ p("label", {
120
121
  htmlFor: "support-article-content",
121
122
  className: "text-sm font-medium text-foreground",
122
- children: ["Content ", /* @__PURE__ */ d("span", {
123
+ children: ["Content ", /* @__PURE__ */ f("span", {
123
124
  className: "text-destructive",
124
125
  children: "*"
125
126
  })]
126
- }), /* @__PURE__ */ d(e, {
127
+ }), /* @__PURE__ */ f(e, {
127
128
  type: "button",
128
129
  variant: "ghost",
129
130
  size: "sm",
130
131
  onClick: () => D(!E),
131
132
  className: "text-xs",
132
- children: E ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(a, { size: 14 }), "Edit"] }) : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(o, { size: 14 }), "Preview"] })
133
+ children: E ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(o, { size: 14 }), "Edit"] }) : /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(s, { size: 14 }), "Preview"] })
133
134
  })]
134
135
  }),
135
- E ? /* @__PURE__ */ d("div", {
136
+ E ? /* @__PURE__ */ f("div", {
136
137
  className: "w-full min-h-[400px] px-4 py-3 rounded-lg border bg-background overflow-auto",
137
- children: /* @__PURE__ */ d("div", {
138
+ children: /* @__PURE__ */ f("div", {
138
139
  className: "prose prose-sm max-w-none dark:prose-invert",
139
140
  dangerouslySetInnerHTML: { __html: O || "<p class=\"text-muted-foreground\">Nothing to preview</p>" }
140
141
  })
141
- }) : /* @__PURE__ */ d("textarea", {
142
+ }) : /* @__PURE__ */ f("textarea", {
142
143
  id: "support-article-content",
144
+ "aria-label": "Article content",
143
145
  required: !0,
144
146
  rows: 20,
145
- value: b.content,
146
- onChange: (e) => x({
147
- ...b,
147
+ value: x.content,
148
+ onChange: (e) => S({
149
+ ...x,
148
150
  content: e.target.value
149
151
  }),
150
152
  className: "w-full px-4 py-3 rounded-lg border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors font-mono text-sm",
151
153
  placeholder: "Article content (supports Markdown)"
152
154
  }),
153
- /* @__PURE__ */ d("p", {
155
+ /* @__PURE__ */ f("p", {
154
156
  className: "text-xs text-muted-foreground mt-1",
155
157
  children: "Supports Markdown: **bold**, *italic*, # headings, - lists, [links](url), ```code```"
156
158
  })
157
159
  ] }),
158
- /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
160
+ /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("label", {
159
161
  htmlFor: "support-article-category",
160
162
  className: "mb-2 block text-sm font-medium text-foreground",
161
163
  children: "Category"
162
- }), /* @__PURE__ */ f("select", {
164
+ }), /* @__PURE__ */ p("select", {
163
165
  id: "support-article-category",
164
- value: b.categoryId,
165
- onChange: (e) => x({
166
- ...b,
166
+ value: x.categoryId,
167
+ onChange: (e) => S({
168
+ ...x,
167
169
  categoryId: e.target.value
168
170
  }),
169
171
  className: "w-full px-4 py-3 rounded-lg border bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors",
170
- children: [/* @__PURE__ */ d("option", {
172
+ children: [/* @__PURE__ */ f("option", {
171
173
  value: "",
172
174
  children: "Select a category"
173
- }), h.map((e) => /* @__PURE__ */ d("option", {
175
+ }), g.map((e) => /* @__PURE__ */ f("option", {
174
176
  value: e.id,
175
177
  children: e.name
176
178
  }, e.id))]
177
179
  })] }),
178
- /* @__PURE__ */ f("div", { children: [
179
- /* @__PURE__ */ d("label", {
180
+ /* @__PURE__ */ p("div", { children: [
181
+ /* @__PURE__ */ f("label", {
180
182
  htmlFor: "support-article-tags",
181
183
  className: "mb-2 block text-sm font-medium text-foreground",
182
184
  children: "Tags"
183
185
  }),
184
- /* @__PURE__ */ d(t, {
186
+ /* @__PURE__ */ f(t, {
185
187
  id: "support-article-tags",
186
188
  type: "text",
187
- value: S,
189
+ value: C,
188
190
  onChange: (e) => A(e.target.value),
189
191
  placeholder: "Enter tags separated by commas (e.g., billing, account, setup)"
190
192
  }),
191
- b.tags.length > 0 && /* @__PURE__ */ d("div", {
193
+ x.tags.length > 0 && /* @__PURE__ */ f("div", {
192
194
  className: "flex flex-wrap gap-2 mt-2",
193
- children: b.tags.map((e, t) => /* @__PURE__ */ d("span", {
195
+ children: x.tags.map((e) => /* @__PURE__ */ f("span", {
194
196
  className: "px-2 py-1 text-xs rounded-full bg-primary/10 text-primary",
195
197
  children: e
196
- }, t))
198
+ }, e))
197
199
  })
198
200
  ] }),
199
- /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
201
+ /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("label", {
200
202
  htmlFor: "support-article-meta-description",
201
203
  className: "mb-2 block text-sm font-medium text-foreground",
202
204
  children: "Meta Description"
203
- }), /* @__PURE__ */ d("textarea", {
205
+ }), /* @__PURE__ */ f("textarea", {
204
206
  id: "support-article-meta-description",
207
+ "aria-label": "Meta Description",
205
208
  rows: 2,
206
- value: b.metaDescription,
207
- onChange: (e) => x({
208
- ...b,
209
+ value: x.metaDescription,
210
+ onChange: (e) => S({
211
+ ...x,
209
212
  metaDescription: e.target.value
210
213
  }),
211
214
  className: "w-full px-4 py-3 rounded-lg border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors",
212
215
  placeholder: "SEO meta description (optional)"
213
216
  })] }),
214
- /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
217
+ /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("label", {
215
218
  htmlFor: "support-article-status",
216
219
  className: "mb-2 block text-sm font-medium text-foreground",
217
220
  children: "Status"
218
- }), /* @__PURE__ */ f("select", {
221
+ }), /* @__PURE__ */ p("select", {
219
222
  id: "support-article-status",
220
- value: b.status,
221
- onChange: (e) => x({
222
- ...b,
223
+ value: x.status,
224
+ onChange: (e) => S({
225
+ ...x,
223
226
  status: e.target.value
224
227
  }),
225
228
  className: "w-full px-4 py-3 rounded-lg border bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors",
226
- children: [/* @__PURE__ */ d("option", {
229
+ children: [/* @__PURE__ */ f("option", {
227
230
  value: "DRAFT",
228
231
  children: "Draft - Not visible to users"
229
- }), /* @__PURE__ */ d("option", {
232
+ }), /* @__PURE__ */ f("option", {
230
233
  value: "PUBLISHED",
231
234
  children: "Published - Visible to all users"
232
235
  })]
233
236
  })] })
234
237
  ]
235
- }), /* @__PURE__ */ f("div", {
238
+ }), /* @__PURE__ */ p("div", {
236
239
  className: "flex gap-3",
237
- children: [/* @__PURE__ */ d(e, {
240
+ children: [/* @__PURE__ */ f(e, {
238
241
  type: "submit",
239
- disabled: v || !N,
242
+ disabled: y || !N,
240
243
  className: "flex-1",
241
- children: v ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(s, {
244
+ children: y ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(c, {
242
245
  size: 18,
243
246
  className: "animate-spin"
244
- }), "Saving..."] }) : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(c, { size: 18 }), y] })
245
- }), /* @__PURE__ */ f(e, {
247
+ }), "Saving…"] }) : /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(l, { size: 18 }), b] })
248
+ }), /* @__PURE__ */ p(e, {
246
249
  type: "button",
247
250
  variant: "outline",
248
- onClick: _,
249
- children: [/* @__PURE__ */ d(l, { size: 18 }), "Cancel"]
251
+ onClick: v,
252
+ children: [/* @__PURE__ */ f(u, { size: 18 }), "Cancel"]
250
253
  })]
251
254
  })]
252
255
  });
253
256
  }
254
257
  //#endregion
255
- export { m as ArticleForm };
258
+ export { h as ArticleForm };
256
259
 
257
260
  //# sourceMappingURL=ArticleForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ArticleForm.js","names":[],"sources":["../../../../src/support/components/kb/ArticleForm.tsx"],"sourcesContent":["import { useState, useMemo } 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 [slugManuallyEdited, setSlugManuallyEdited] = useState(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 (!slugManuallyEdited) {\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 setSlugManuallyEdited(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 bg-card space-y-6\">\n {/* Title */}\n <div>\n <label\n htmlFor=\"support-article-title\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Title <span className=\"text-destructive\">*</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-foreground\"\n >\n URL Slug <span className=\"text-destructive\">*</span>\n </label>\n <div className=\"flex flex-col gap-2 sm:flex-row sm:items-center\">\n <span className=\"text-sm text-muted-foreground\">/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-muted-foreground 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-foreground\"\n >\n Excerpt\n </label>\n <textarea\n id=\"support-article-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-background text-foreground placeholder:text-muted-foreground 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-foreground\"\n >\n Content <span className=\"text-destructive\">*</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-background overflow-auto\">\n <div\n className=\"prose prose-sm max-w-none dark:prose-invert\"\n dangerouslySetInnerHTML={{\n __html:\n parsedContent || '<p class=\"text-muted-foreground\">Nothing to preview</p>',\n }}\n />\n </div>\n ) : (\n <textarea\n id=\"support-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-background text-foreground placeholder:text-muted-foreground 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-muted-foreground 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-foreground\"\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-background text-foreground 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-foreground\"\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, index) => (\n <span\n key={index}\n className=\"px-2 py-1 text-xs rounded-full bg-primary/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-foreground\"\n >\n Meta Description\n </label>\n <textarea\n id=\"support-article-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-background text-foreground placeholder:text-muted-foreground 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-foreground\"\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-background text-foreground 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,CAAC,GAAoB,KAAyB,EAAS,GAAM,EAC7D,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;AAC3C,EAOE,EAPG,KAOU,OAAU;GAAE,GAAG;GAAM;GAAO,KAN5B,OAAU;GACrB,GAAG;GACH;GACA,MAAM,EAAa,EAAM;GAC1B,EAE0C;IAKzC,KAAoB,MAAkB;AAC1C,IAAa,EAAM;EACnB,IAAM,IAAO,EACV,MAAM,IAAI,CACV,KAAK,MAAQ,EAAI,MAAM,CAAC,CACxB,QAAQ,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yC,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,YAE7C,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 bg-card space-y-6\">\n {/* Title */}\n <div>\n <label\n htmlFor=\"support-article-title\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Title <span className=\"text-destructive\">*</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-foreground\"\n >\n URL Slug <span className=\"text-destructive\">*</span>\n </label>\n <div className=\"flex flex-col gap-2 sm:flex-row sm:items-center\">\n <span className=\"text-sm text-muted-foreground\">/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-muted-foreground 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-foreground\"\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-background text-foreground placeholder:text-muted-foreground 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-foreground\"\n >\n Content <span className=\"text-destructive\">*</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-background overflow-auto\">\n <div\n className=\"prose prose-sm max-w-none dark:prose-invert\"\n dangerouslySetInnerHTML={{\n __html:\n parsedContent || '<p class=\"text-muted-foreground\">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-background text-foreground placeholder:text-muted-foreground 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-muted-foreground 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-foreground\"\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-background text-foreground 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-foreground\"\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-primary/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-foreground\"\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-background text-foreground placeholder:text-muted-foreground 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-foreground\"\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-background text-foreground 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,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