@burdenoff/microfe-export 2026.1108.1 → 2026.1113.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 (65) hide show
  1. package/dist/export/ExportRoot.js +45 -40
  2. package/dist/export/ExportRoot.js.map +1 -1
  3. package/dist/export/ExportRoutes.d.ts +7 -0
  4. package/dist/export/ExportRoutes.js +70 -51
  5. package/dist/export/ExportRoutes.js.map +1 -1
  6. package/dist/export/components/ConfirmDestructiveDialog.d.ts +21 -0
  7. package/dist/export/components/ConfirmDestructiveDialog.js +37 -0
  8. package/dist/export/components/ConfirmDestructiveDialog.js.map +1 -0
  9. package/dist/export/components/DownloadSections.d.ts +10 -0
  10. package/dist/export/components/DownloadSections.js +161 -0
  11. package/dist/export/components/DownloadSections.js.map +1 -0
  12. package/dist/export/components/DownloadStatus.d.ts +13 -0
  13. package/dist/export/components/DownloadStatus.js +36 -0
  14. package/dist/export/components/DownloadStatus.js.map +1 -0
  15. package/dist/export/components/DownloadsTabs.d.ts +5 -0
  16. package/dist/export/components/DownloadsTabs.js +25 -0
  17. package/dist/export/components/DownloadsTabs.js.map +1 -0
  18. package/dist/export/hooks/useEntityLabel.d.ts +7 -0
  19. package/dist/export/hooks/useEntityLabel.js +16 -0
  20. package/dist/export/hooks/useEntityLabel.js.map +1 -0
  21. package/dist/export/hooks/useExportQueries.d.ts +3 -1
  22. package/dist/export/hooks/useExportQueries.js +23 -23
  23. package/dist/export/hooks/useExportQueries.js.map +1 -1
  24. package/dist/export/navigation-v2/NavigationV2.d.ts +7 -0
  25. package/dist/export/navigation-v2/NavigationV2.js +16 -0
  26. package/dist/export/navigation-v2/NavigationV2.js.map +1 -0
  27. package/dist/export/pages/CreateExportPage.js +123 -121
  28. package/dist/export/pages/CreateExportPage.js.map +1 -1
  29. package/dist/export/pages/ExportDetailPage.js +131 -124
  30. package/dist/export/pages/ExportDetailPage.js.map +1 -1
  31. package/dist/export/pages/ExportHistoryPage.js +61 -57
  32. package/dist/export/pages/ExportHistoryPage.js.map +1 -1
  33. package/dist/export/pages/ExportTemplatesPage.js +214 -182
  34. package/dist/export/pages/ExportTemplatesPage.js.map +1 -1
  35. package/dist/export/pages/TemplateDetailPage.js +141 -119
  36. package/dist/export/pages/TemplateDetailPage.js.map +1 -1
  37. package/dist/export/pages/v2/DownloadDetailPage.d.ts +8 -0
  38. package/dist/export/pages/v2/DownloadDetailPage.js +176 -0
  39. package/dist/export/pages/v2/DownloadDetailPage.js.map +1 -0
  40. package/dist/export/pages/v2/DownloadsPage.d.ts +10 -0
  41. package/dist/export/pages/v2/DownloadsPage.js +401 -0
  42. package/dist/export/pages/v2/DownloadsPage.js.map +1 -0
  43. package/dist/export/pages/v2/NewDownloadPage.d.ts +8 -0
  44. package/dist/export/pages/v2/NewDownloadPage.js +440 -0
  45. package/dist/export/pages/v2/NewDownloadPage.js.map +1 -0
  46. package/dist/export/types/index.d.ts +7 -0
  47. package/dist/export/utils/billing.d.ts +6 -0
  48. package/dist/export/utils/billing.js +7 -0
  49. package/dist/export/utils/billing.js.map +1 -0
  50. package/dist/export/utils/downloadStatus.d.ts +15 -0
  51. package/dist/export/utils/downloadStatus.js +48 -0
  52. package/dist/export/utils/downloadStatus.js.map +1 -0
  53. package/dist/export/utils/entityLabels.d.ts +47 -0
  54. package/dist/export/utils/entityLabels.js +150 -0
  55. package/dist/export/utils/entityLabels.js.map +1 -0
  56. package/dist/export/utils/formatBytes.d.ts +2 -0
  57. package/dist/export/utils/formatBytes.js +15 -0
  58. package/dist/export/utils/formatBytes.js.map +1 -0
  59. package/dist/export/utils/newDownloadForm.d.ts +32 -0
  60. package/dist/export/utils/newDownloadForm.js +42 -0
  61. package/dist/export/utils/newDownloadForm.js.map +1 -0
  62. package/dist/export/utils/paths.d.ts +2 -0
  63. package/dist/export/utils/paths.js +7 -0
  64. package/dist/export/utils/paths.js.map +1 -0
  65. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"ExportTemplatesPage.js","names":["joinPath","base","path","ExportTemplatesPage","useExport","tr","useTr","templates","useExportTemplates","useDeleteExportTemplate","creating","useCreateExportTemplate","availableEntities","useAvailableEntities","searchQuery","setSearchQuery","useState","showCreateForm","setShowCreateForm","newTemplateName","setNewTemplateName","newTemplateDescription","setNewTemplateDescription","newTemplateEntityTypes","setNewTemplateEntityTypes","newTemplateFormat","setNewTemplateFormat","createError","setCreateError","templatePendingDelete","setTemplatePendingDelete","handleOpenCreate","handleCreateTemplate","createTemplate","err","toggleEntity","prev","entityType","e","filteredTemplates","useMemo","q","handleTemplateClick","basePath","templateId","handleDeleteTemplate","nativeImpact","confirmDeleteTemplate","deleteTemplate","nativeNotify","PageLayout","FileBox","CTAOverflowMenu","Plus","navigate","Sparkles","PagePurpose","X","entity","cn","Loader2","Search","isLoading","i","template","index","getFormatDisplayName","ChevronRight","IllustratedEmptyState"],"sources":["../../../src/export/pages/ExportTemplatesPage.tsx"],"sourcesContent":["import { useState, useMemo } from \"react\";\nimport {\n Search,\n X,\n FileBox,\n Plus,\n ChevronRight,\n Sparkles,\n Loader2,\n} from \"lucide-react\";\nimport {\n CTAOverflowMenu,\n IllustratedEmptyState,\n PagePurpose,\n} from \"@burdenoff/fe-libs/ui\";\nimport { useExport } from \"../providers/ExportProvider\";\nimport {\n useExportTemplates,\n useDeleteExportTemplate,\n useCreateExportTemplate,\n useAvailableEntities,\n} from \"../hooks/useExportQueries\";\nimport { PageLayout } from \"../components/PageLayout\";\nimport { getFormatDisplayName } from \"../constants/enums\";\nimport { useTr } from \"../hooks/useTr\";\nimport { cn } from \"../utils/cn\";\nimport type { ExportFormat } from \"../types\";\nimport { nativeImpact, nativeNotify } from \"../../utils/nativeBridge\";\n\n/**\n * Helper to join paths correctly\n */\nconst joinPath = (base: string, path: string): string => {\n const cleanBase = base.endsWith(\"/\") ? base.slice(0, -1) : base;\n const cleanPath = path.startsWith(\"/\") ? path : `/${path}`;\n return cleanBase + cleanPath;\n};\n\n/**\n * Export Templates Page\n * Template management list for reusable export configurations\n */\nexport function ExportTemplatesPage() {\n const { basePath = \"/\", navigate } = useExport();\n const tr = useTr();\n const { data: templates, isLoading } = useExportTemplates();\n const { deleteTemplate } = useDeleteExportTemplate();\n const { createTemplate, isPending: creating } = useCreateExportTemplate();\n const { data: availableEntities } = useAvailableEntities();\n\n const [searchQuery, setSearchQuery] = useState(\"\");\n const [showCreateForm, setShowCreateForm] = useState(false);\n const [newTemplateName, setNewTemplateName] = useState(\"\");\n const [newTemplateDescription, setNewTemplateDescription] = useState(\"\");\n const [newTemplateEntityTypes, setNewTemplateEntityTypes] = useState<\n string[]\n >([]);\n const [newTemplateFormat, setNewTemplateFormat] =\n useState<ExportFormat>(\"CSV\");\n const [createError, setCreateError] = useState<string | null>(null);\n const [templatePendingDelete, setTemplatePendingDelete] = useState<\n string | null\n >(null);\n\n const handleOpenCreate = () => {\n setNewTemplateName(\"\");\n setNewTemplateDescription(\"\");\n setNewTemplateEntityTypes([]);\n setNewTemplateFormat(\"CSV\");\n setCreateError(null);\n setShowCreateForm(true);\n };\n\n const handleCreateTemplate = async () => {\n if (!newTemplateName.trim()) {\n setCreateError(\n tr(\n \"export.templates.form.errors.nameRequired\",\n \"Template name is required.\",\n ),\n );\n return;\n }\n if (newTemplateEntityTypes.length === 0) {\n setCreateError(\n tr(\n \"export.templates.form.errors.entityRequired\",\n \"Select at least one entity type.\",\n ),\n );\n return;\n }\n setCreateError(null);\n try {\n await createTemplate({\n name: newTemplateName.trim(),\n description: newTemplateDescription.trim() || undefined,\n entityTypes: newTemplateEntityTypes,\n format: newTemplateFormat,\n });\n setShowCreateForm(false);\n } catch (err) {\n setCreateError(\n err instanceof Error\n ? err.message\n : tr(\n \"export.templates.form.errors.createFailed\",\n \"Failed to create template.\",\n ),\n );\n }\n };\n\n const toggleEntity = (entityType: string) => {\n setNewTemplateEntityTypes((prev) =>\n prev.includes(entityType)\n ? prev.filter((e) => e !== entityType)\n : [...prev, entityType],\n );\n };\n\n // Client-side search filter\n const filteredTemplates = useMemo(() => {\n if (!searchQuery) return templates;\n const q = searchQuery.toLowerCase();\n return templates.filter(\n (t) =>\n t.name.toLowerCase().includes(q) ||\n t.entityTypes.some((e) => e.toLowerCase().includes(q)),\n );\n }, [templates, searchQuery]);\n\n const handleTemplateClick = (templateId: string) => {\n navigate?.(joinPath(basePath, `templates/${templateId}`));\n };\n\n const handleDeleteTemplate = async (\n e: React.MouseEvent,\n templateId: string,\n ) => {\n e.stopPropagation();\n nativeImpact(\"medium\");\n setTemplatePendingDelete(templateId);\n };\n\n const confirmDeleteTemplate = async () => {\n if (!templatePendingDelete) return;\n try {\n await deleteTemplate(templatePendingDelete);\n nativeNotify(\"success\");\n } catch {\n nativeNotify(\"error\");\n }\n setTemplatePendingDelete(null);\n };\n\n return (\n <PageLayout\n title={tr(\"export.templates.title\", \"Export Templates\")}\n subtitle={tr(\n \"export.templates.subtitle\",\n \"Reusable export configurations for common data exports\",\n )}\n icon={<FileBox size={24} />}\n headerActions={\n <CTAOverflowMenu\n primary={{\n label: tr(\"export.templates.actions.newTemplate\", \"New Template\"),\n icon: <Plus size={16} />,\n onSelect: handleOpenCreate,\n }}\n actions={[\n {\n label: tr(\"export.templates.actions.newExport\", \"New Export\"),\n icon: <Plus size={16} />,\n onSelect: () => navigate?.(joinPath(basePath, \"new\")),\n },\n ]}\n />\n }\n headerContent={\n <span className=\"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-bg-sunken text-text-secondary\">\n <Sparkles size={12} />\n {tr(\n \"export.templates.summary.available\",\n \"{{count}} template{{suffix}} available\",\n {\n count: filteredTemplates.length,\n suffix: filteredTemplates.length !== 1 ? \"s\" : \"\",\n },\n )}\n </span>\n }\n >\n {/* Page purpose — why templates exist */}\n <PagePurpose icon={<FileBox size={16} />}>\n {tr(\n \"export.templates.purpose\",\n \"Templates save an export setup — the entity types and format you regularly need — so you don't rebuild it each time. Create one here, then start a new export from it in a single click. Handy for recurring backups, periodic audits, or any export you run more than once.\",\n )}\n </PagePurpose>\n\n {/* Create Template Form */}\n {showCreateForm && (\n <div className=\"border border-primary/30 rounded-xl p-6 bg-accent-wash space-y-4\">\n <div className=\"flex items-center justify-between\">\n <h3 className=\"font-semibold text-lg\">\n {tr(\"export.templates.form.title\", \"New Template\")}\n </h3>\n <button\n type=\"button\"\n onClick={() => setShowCreateForm(false)}\n className=\"p-1.5 rounded-md hover:bg-accent\"\n >\n <X size={16} />\n </button>\n </div>\n {createError && (\n <p className=\"text-sm text-status-error-text bg-status-error-bg/10 rounded-lg px-3 py-2\">\n {createError}\n </p>\n )}\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-4\">\n <div className=\"space-y-1\">\n <label className=\"text-sm font-medium\">\n {tr(\"export.templates.form.fields.name\", \"Name\")} *\n </label>\n <input\n type=\"text\"\n aria-label={tr(\"export.templates.form.fields.name\", \"Name\")}\n placeholder={tr(\n \"export.templates.form.fields.namePlaceholder\",\n \"e.g. Weekly Tags Export\",\n )}\n value={newTemplateName}\n onChange={(e) => setNewTemplateName(e.target.value)}\n className=\"w-full px-3 py-2 border-2 border-border-subtle rounded-lg bg-bg-surface focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all\"\n />\n </div>\n <div className=\"space-y-1\">\n <label className=\"text-sm font-medium\">\n {tr(\"export.templates.form.fields.format\", \"Format\")} *\n </label>\n <select\n value={newTemplateFormat}\n onChange={(e) =>\n setNewTemplateFormat(e.target.value as ExportFormat)\n }\n className=\"w-full px-3 py-2 border-2 border-border-subtle rounded-lg bg-bg-surface focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"CSV\">{tr(\"export.format.csv\", \"CSV\")}</option>\n <option value=\"JSON\">{tr(\"export.format.json\", \"JSON\")}</option>\n </select>\n </div>\n </div>\n <div className=\"space-y-1\">\n <label className=\"text-sm font-medium\">\n {tr(\"export.templates.form.fields.description\", \"Description\")}\n </label>\n <input\n type=\"text\"\n aria-label={tr(\n \"export.templates.form.fields.description\",\n \"Description\",\n )}\n placeholder={tr(\n \"export.templates.form.fields.descriptionPlaceholder\",\n \"Optional description\",\n )}\n value={newTemplateDescription}\n onChange={(e) => setNewTemplateDescription(e.target.value)}\n className=\"w-full px-3 py-2 border-2 border-border-subtle rounded-lg bg-bg-surface focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all\"\n />\n </div>\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">\n {tr(\"export.templates.form.fields.entityTypes\", \"Entity Types\")} *{\" \"}\n <span className=\"text-text-secondary font-normal\">\n {tr(\n \"export.templates.form.fields.entityTypesHint\",\n \"(select at least one)\",\n )}\n </span>\n </label>\n <div className=\"flex flex-wrap gap-2\">\n {availableEntities.map((entity) => (\n <button\n key={entity.entityType}\n type=\"button\"\n onClick={() => toggleEntity(entity.entityType)}\n className={cn(\n \"px-3 py-1.5 rounded-lg text-sm font-medium border-2 transition-all\",\n newTemplateEntityTypes.includes(entity.entityType)\n ? \"border-primary bg-action-primary-bg/10 text-primary\"\n : \"border-border-subtle bg-bg-surface hover:border-primary/50\",\n )}\n >\n {entity.displayName}\n </button>\n ))}\n </div>\n </div>\n <div className=\"flex gap-3 pt-2\">\n <button\n type=\"button\"\n onClick={handleCreateTemplate}\n disabled={creating}\n className=\"inline-flex items-center gap-2 px-5 py-2.5 bg-action-primary-bg text-action-primary-text rounded-lg hover:bg-action-primary-bg/90 transition-colors font-medium disabled:opacity-50\"\n >\n {creating ? (\n <Loader2 size={16} className=\"animate-spin\" />\n ) : (\n <Plus size={16} />\n )}\n {tr(\"export.templates.form.actions.create\", \"Create Template\")}\n </button>\n <button\n type=\"button\"\n onClick={() => setShowCreateForm(false)}\n className=\"px-5 py-2.5 border-2 border-border-subtle rounded-lg hover:bg-accent transition-colors font-medium\"\n >\n {tr(\"export.templates.form.actions.cancel\", \"Cancel\")}\n </button>\n </div>\n </div>\n )}\n {/* Search */}\n <div className=\"relative group\">\n <Search\n size={18}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary group-focus-within:text-primary transition-colors\"\n />\n <input\n type=\"text\"\n aria-label={tr(\n \"export.templates.search.placeholder\",\n \"Search templates\",\n )}\n placeholder={tr(\n \"export.templates.search.placeholder\",\n \"Search templates...\",\n )}\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className=\"w-full pl-[3.25rem] pr-4 py-2.5 border-2 border-border-subtle rounded-lg bg-bg-surface focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all duration-200\"\n />\n {searchQuery && (\n <button\n type=\"button\"\n onClick={() => setSearchQuery(\"\")}\n className=\"absolute right-3 top-1/2 -translate-y-1/2 p-1 rounded-md text-text-secondary hover:text-text-primary hover:bg-accent\"\n >\n <X size={16} />\n </button>\n )}\n </div>\n\n {/* Loading */}\n {isLoading && (\n <div className=\"grid grid-cols-1 lg:grid-cols-2 gap-4\">\n {[...Array(4)].map((_, i) => (\n <div key={i} className=\"border border-border-seam rounded-xl p-5\">\n <div className=\"h-5 w-40 bg-bg-sunken rounded mb-3 animate-vc-shimmer\" />\n <div className=\"h-3 w-full bg-bg-sunken rounded mb-2 animate-vc-shimmer\" />\n <div className=\"flex gap-2 mt-4\">\n <div className=\"h-5 w-16 bg-bg-sunken rounded-full animate-vc-shimmer\" />\n <div className=\"h-5 w-16 bg-bg-sunken rounded-full animate-vc-shimmer\" />\n </div>\n </div>\n ))}\n </div>\n )}\n\n {/* Templates Grid */}\n {!isLoading ? (\n filteredTemplates.length > 0 ? (\n <div className=\"grid grid-cols-1 lg:grid-cols-2 gap-4\">\n {filteredTemplates.map((template, index) => (\n <div\n key={template.id}\n role=\"button\"\n tabIndex={0}\n onClick={() => handleTemplateClick(template.id)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n handleTemplateClick(template.id);\n }\n }}\n className={cn(\n \"text-left group cursor-pointer border border-border-seam rounded-xl overflow-hidden bg-bg-surface\",\n \"hover:border-primary/40 shadow-[var(--shadow-pop)] transition-colors duration-200\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40\",\n \"animate-in fade-in-0\",\n )}\n style={{ animationDelay: `${index * 50}ms` }}\n >\n {/* Header */}\n <div className=\"p-4 border-b bg-bg-sunken/30\">\n <div className=\"flex items-start justify-between\">\n <div className=\"flex items-center gap-3\">\n <div className=\"p-2 rounded-lg bg-action-primary-bg/10\">\n <FileBox size={20} className=\"text-primary\" />\n </div>\n <div>\n <h3 className=\"font-semibold\">{template.name}</h3>\n <p className=\"text-xs text-text-secondary\">\n {getFormatDisplayName(template.format)}\n {template.isDefault && (\n <span className=\"ml-1.5 inline-flex items-center px-1.5 py-0.5 rounded text-xs bg-action-primary-bg/10 text-primary font-medium\">\n {tr(\"export.templates.card.default\", \"Default\")}\n </span>\n )}\n </p>\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={(e) => handleDeleteTemplate(e, template.id)}\n className=\"p-1.5 rounded-md text-text-secondary hover:text-status-error-text hover:bg-status-error-bg/10 transition-colors\"\n aria-label={tr(\n \"export.templates.card.deleteAriaLabel\",\n \"Delete {{name}}\",\n { name: template.name },\n )}\n >\n <X size={14} />\n </button>\n <ChevronRight\n size={18}\n className=\"text-text-secondary group-hover:text-primary transition-colors mt-1\"\n />\n </div>\n </div>\n </div>\n\n {/* Body */}\n <div className=\"p-4\">\n {template.description && (\n <p className=\"text-sm text-text-secondary mb-3 line-clamp-2\">\n {template.description}\n </p>\n )}\n <div className=\"flex flex-wrap gap-1.5 overflow-hidden\">\n {template.entityTypes.slice(0, 6).map((entity) => (\n <span\n key={entity}\n className=\"inline-flex px-2 py-0.5 rounded text-xs font-medium bg-bg-sunken text-text-secondary max-w-full truncate\"\n >\n {entity}\n </span>\n ))}\n {template.entityTypes.length > 6 && (\n <span className=\"inline-flex px-2 py-0.5 rounded text-xs font-medium bg-bg-sunken text-text-secondary\">\n {tr(\n \"export.templates.card.moreEntities\",\n \"+{{count}} more\",\n {\n count: template.entityTypes.length - 6,\n },\n )}\n </span>\n )}\n </div>\n </div>\n </div>\n ))}\n </div>\n ) : (\n <IllustratedEmptyState\n illustration={searchQuery ? \"empty-search\" : \"empty-data\"}\n title={\n searchQuery\n ? tr(\n \"export.templates.empty.filtered.title\",\n \"No matching templates\",\n )\n : tr(\"export.templates.empty.title\", \"No templates yet\")\n }\n description={\n searchQuery\n ? tr(\n \"export.templates.empty.filtered.description\",\n \"Try adjusting your search to find what you are looking for.\",\n )\n : tr(\n \"export.templates.empty.description\",\n \"Create a template to save reusable export configurations.\",\n )\n }\n action={\n searchQuery ? (\n <button\n type=\"button\"\n onClick={() => setSearchQuery(\"\")}\n className=\"inline-flex items-center gap-2 px-4 py-2 border-2 border-border-subtle rounded-lg hover:bg-accent transition-colors font-medium\"\n >\n <X size={16} />\n {tr(\n \"export.templates.empty.filtered.actions.clear\",\n \"Clear Search\",\n )}\n </button>\n ) : (\n <button\n type=\"button\"\n onClick={handleOpenCreate}\n className=\"inline-flex items-center gap-2 px-4 py-2 bg-action-primary-bg text-action-primary-text rounded-lg hover:bg-action-primary-bg/90 transition-colors font-medium\"\n >\n <Plus size={16} />\n {tr(\n \"export.templates.empty.actions.newTemplate\",\n \"New Template\",\n )}\n </button>\n )\n }\n />\n )\n ) : null}\n {templatePendingDelete && (\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby=\"template-list-delete-title\"\n className=\"fixed inset-0 z-50 flex items-center justify-center bg-bg-surface/80 backdrop-blur-sm p-4\"\n >\n <div className=\"w-full max-w-md rounded-xl border-2 border-border-subtle bg-bg-surface p-6 shadow-xl\">\n <h2 id=\"template-list-delete-title\" className=\"text-lg font-bold\">\n {tr(\"export.templates.delete.title\", \"Delete template?\")}\n </h2>\n <p className=\"mt-2 text-sm text-text-secondary\">\n {tr(\n \"export.templates.delete.description\",\n \"This removes the saved export configuration. Existing export jobs are not deleted.\",\n )}\n </p>\n <div className=\"mt-6 flex flex-col-reverse sm:flex-row sm:justify-end gap-3\">\n <button\n type=\"button\"\n onClick={() => setTemplatePendingDelete(null)}\n className=\"px-4 py-2 rounded-lg border-2 border-border-subtle hover:bg-accent transition-colors font-medium\"\n >\n {tr(\"export.templates.delete.cancel\", \"Keep Template\")}\n </button>\n <button\n type=\"button\"\n onClick={confirmDeleteTemplate}\n className=\"px-4 py-2 rounded-lg bg-status-error-bg text-status-error-text hover:bg-status-error-bg/90 transition-colors font-medium\"\n >\n {tr(\"export.templates.delete.confirmAction\", \"Delete Template\")}\n </button>\n </div>\n </div>\n </div>\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,IAAMA,KAAY,GAAc,OACZC,EAAK,SAAS,GAAG,IAAIA,EAAK,MAAM,GAAG,EAAE,IAAIA,MACzCC,EAAK,WAAW,GAAG,IAAIA,IAAO,IAAIA;AAQtD,SAAgBC,IAAsB;CACpC,IAAM,EAAE,cAAW,KAAK,gBAAaC,EAAU,GACzCC,IAAKC,EAAM,GACX,EAAE,MAAMC,GAAW,iBAAcC,EAAmB,GACpD,EAAE,sBAAmBC,EAAwB,GAC7C,EAAE,mBAAgB,WAAWC,MAAaC,EAAwB,GAClE,EAAE,MAAMC,MAAsBC,EAAqB,GAEnD,CAACC,GAAaC,KAAkBC,EAAS,EAAE,GAC3C,CAACC,GAAgBC,KAAqBF,EAAS,EAAK,GACpD,CAACG,GAAiBC,KAAsBJ,EAAS,EAAE,GACnD,CAACK,GAAwBC,KAA6BN,EAAS,EAAE,GACjE,CAACO,GAAwBC,KAA6BR,EAE1D,CAAC,CAAC,GACE,CAACS,GAAmBC,KACxBV,EAAuB,KAAK,GACxB,CAACW,GAAaC,KAAkBZ,EAAwB,IAAI,GAC5D,CAACa,GAAuBC,KAA4Bd,EAExD,IAAI,GAEAe,UAAyB;EAM7B,AALAX,EAAmB,EAAE,GACr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,SAAS0B;KACT,WAAU;KAHZ,UAAA,CAKE,kBAACsB,GAAD,EAAM,MAAM,GAAK,CAAA,GAChBhD,EACC,8CACA,cACF,CACM;;GAGb,CAAA;GAGJwB,KACC,kBAAC,OAAD;IACE,MAAK;IACL,cAAW;IACX,mBAAgB;IAChB,WAAU;IAEV,UAAA,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA;MACE,kBAAC,MAAD;OAAI,IAAG;OAA6B,WAAU;OAC3C,UAAAxB,EAAG,iCAAiC,kBAAkB;MACrD,CAAA;MACJ,kBAAC,KAAD;OAAG,WAAU;OACV,UAAAA,EACC,uCACA,oFACF;MACC,CAAA;MACH,kBAAC,OAAD;OAAK,WAAU;OAAf,UAAA,CACE,kBAAC,UAAD;QACE,MAAK;QACL,eAAeyB,EAAyB,IAAI;QAC5C,WAAU;QAET,UAAAzB,EAAG,kCAAkC,eAAe;OAC/C,CAAA,GACR,kBAAC,UAAD;QACE,MAAK;QACL,SAAS0C;QACT,WAAU;QAET,UAAA1C,EAAG,yCAAyC,iBAAiB;OACxD,CAAA,CACL;;KACF;;GACF,CAAA;EAEG;;AAEhB"}
1
+ {"version":3,"file":"ExportTemplatesPage.js","names":["joinPath","base","path","ExportTemplatesPage","useExport","tr","useTr","templates","useExportTemplates","useDeleteExportTemplate","creating","useCreateExportTemplate","availableEntities","useAvailableEntities","navigationV2","useNavigationV2","label","useEntityLabel","hostProductSlug","useAppShell","selectableEntities","isExportEntityDisabled","isForeignProductEntity","deleteError","setDeleteError","useState","deletingTemplate","setDeletingTemplate","searchQuery","setSearchQuery","showCreateForm","setShowCreateForm","newTemplateName","setNewTemplateName","newTemplateDescription","setNewTemplateDescription","newTemplateEntityTypes","setNewTemplateEntityTypes","newTemplateFormat","setNewTemplateFormat","createError","setCreateError","templatePendingDelete","setTemplatePendingDelete","handleOpenCreate","handleCreateTemplate","createTemplate","err","toggleEntity","prev","entityType","e","filteredTemplates","useMemo","q","handleTemplateClick","basePath","templateId","handleDeleteTemplate","nativeImpact","closeDeleteConfirm","confirmDeleteTemplate","deleteTemplate","nativeNotify","pendingTemplateName","t","PageLayout","FileBox","CTAOverflowMenu","Plus","navigate","Sparkles","DownloadsTabs","PagePurpose","X","entity","cn","Loader2","Search","isLoading","i","template","index","getFormatDisplayName","ChevronRight","IllustratedEmptyState","ConfirmDestructiveDialog","open"],"sources":["../../../src/export/pages/ExportTemplatesPage.tsx"],"sourcesContent":["import { useState, useMemo } from \"react\";\nimport {\n Search,\n X,\n FileBox,\n Plus,\n ChevronRight,\n Sparkles,\n Loader2,\n} from \"lucide-react\";\nimport {\n CTAOverflowMenu,\n IllustratedEmptyState,\n PagePurpose,\n} from \"@burdenoff/fe-libs/ui\";\nimport { useExport } from \"../providers/ExportProvider\";\nimport {\n useExportTemplates,\n useDeleteExportTemplate,\n useCreateExportTemplate,\n useAvailableEntities,\n} from \"../hooks/useExportQueries\";\nimport { PageLayout } from \"../components/PageLayout\";\nimport { DownloadsTabs } from \"../components/DownloadsTabs\";\nimport { ConfirmDestructiveDialog } from \"../components/ConfirmDestructiveDialog\";\nimport { useNavigationV2 } from \"../navigation-v2/NavigationV2\";\nimport { useEntityLabel } from \"../hooks/useEntityLabel\";\nimport { useAppShell } from \"@burdenoff/fe-libs/shared/providers/shell\";\nimport {\n isExportEntityDisabled,\n isForeignProductEntity,\n} from \"../utils/disabledModules\";\nimport { getFormatDisplayName } from \"../constants/enums\";\nimport { useTr } from \"../hooks/useTr\";\nimport { cn } from \"../utils/cn\";\nimport type { ExportFormat } from \"../types\";\nimport { nativeImpact, nativeNotify } from \"../../utils/nativeBridge\";\n\n/**\n * Helper to join paths correctly\n */\nconst joinPath = (base: string, path: string): string => {\n const cleanBase = base.endsWith(\"/\") ? base.slice(0, -1) : base;\n const cleanPath = path.startsWith(\"/\") ? path : `/${path}`;\n return cleanBase + cleanPath;\n};\n\n/**\n * Export Templates Page\n * Template management list for reusable export configurations\n */\nexport function ExportTemplatesPage() {\n const { basePath = \"/\", navigate } = useExport();\n const tr = useTr();\n const { data: templates, isLoading } = useExportTemplates();\n const { deleteTemplate } = useDeleteExportTemplate();\n const { createTemplate, isPending: creating } = useCreateExportTemplate();\n const { data: availableEntities } = useAvailableEntities();\n const navigationV2 = useNavigationV2();\n const label = useEntityLabel(navigationV2);\n const { productSlug: hostProductSlug } = useAppShell();\n // The new-setup form offers only what \"New export\" itself can select in this\n // shell: not other products' entity types, not products whose export isn't\n // available yet, and not entity types the service marks disabled.\n const selectableEntities = availableEntities.filter(\n (e) =>\n e.enabled !== false &&\n !isExportEntityDisabled(e.entityType) &&\n !isForeignProductEntity(e.entityType, hostProductSlug),\n );\n const [deleteError, setDeleteError] = useState<string | null>(null);\n const [deletingTemplate, setDeletingTemplate] = useState(false);\n\n const [searchQuery, setSearchQuery] = useState(\"\");\n const [showCreateForm, setShowCreateForm] = useState(false);\n const [newTemplateName, setNewTemplateName] = useState(\"\");\n const [newTemplateDescription, setNewTemplateDescription] = useState(\"\");\n const [newTemplateEntityTypes, setNewTemplateEntityTypes] = useState<\n string[]\n >([]);\n const [newTemplateFormat, setNewTemplateFormat] =\n useState<ExportFormat>(\"CSV\");\n const [createError, setCreateError] = useState<string | null>(null);\n const [templatePendingDelete, setTemplatePendingDelete] = useState<\n string | null\n >(null);\n\n const handleOpenCreate = () => {\n setNewTemplateName(\"\");\n setNewTemplateDescription(\"\");\n setNewTemplateEntityTypes([]);\n setNewTemplateFormat(\"CSV\");\n setCreateError(null);\n setShowCreateForm(true);\n };\n\n const handleCreateTemplate = async () => {\n if (!newTemplateName.trim()) {\n setCreateError(\n tr(\n \"export.templates.form.errors.nameRequired\",\n \"Template name is required.\",\n ),\n );\n return;\n }\n if (newTemplateEntityTypes.length === 0) {\n setCreateError(\n tr(\n \"export.templates.form.errors.entityRequired\",\n \"Select at least one entity type.\",\n ),\n );\n return;\n }\n setCreateError(null);\n try {\n await createTemplate({\n name: newTemplateName.trim(),\n description: newTemplateDescription.trim() || undefined,\n entityTypes: newTemplateEntityTypes,\n format: newTemplateFormat,\n });\n setShowCreateForm(false);\n } catch (err) {\n setCreateError(\n err instanceof Error\n ? err.message\n : tr(\n \"export.templates.form.errors.createFailed\",\n \"Failed to create template.\",\n ),\n );\n }\n };\n\n const toggleEntity = (entityType: string) => {\n setNewTemplateEntityTypes((prev) =>\n prev.includes(entityType)\n ? prev.filter((e) => e !== entityType)\n : [...prev, entityType],\n );\n };\n\n // Client-side search filter\n const filteredTemplates = useMemo(() => {\n if (!searchQuery) return templates;\n const q = searchQuery.toLowerCase();\n return templates.filter(\n (t) =>\n t.name.toLowerCase().includes(q) ||\n t.entityTypes.some(\n (e) =>\n e.toLowerCase().includes(q) || label(e).toLowerCase().includes(q),\n ),\n );\n }, [templates, searchQuery, label]);\n\n const handleTemplateClick = (templateId: string) => {\n navigate?.(joinPath(basePath, `templates/${templateId}`));\n };\n\n const handleDeleteTemplate = async (\n e: React.MouseEvent,\n templateId: string,\n ) => {\n e.stopPropagation();\n nativeImpact(\"medium\");\n setTemplatePendingDelete(templateId);\n };\n\n const closeDeleteConfirm = () => {\n setTemplatePendingDelete(null);\n setDeleteError(null);\n };\n\n const confirmDeleteTemplate = async () => {\n if (!templatePendingDelete) return;\n setDeleteError(null);\n setDeletingTemplate(true);\n try {\n await deleteTemplate(templatePendingDelete);\n nativeNotify(\"success\");\n setTemplatePendingDelete(null);\n } catch (err) {\n nativeNotify(\"error\");\n // Say why and keep the confirm open, instead of closing it silently.\n setDeleteError(\n err instanceof Error && err.message\n ? err.message\n : tr(\n \"export.templates.delete.failed\",\n \"Couldn't delete this template. Try again.\",\n ),\n );\n } finally {\n setDeletingTemplate(false);\n }\n };\n\n const pendingTemplateName =\n templates.find((t) => t.id === templatePendingDelete)?.name ?? \"\";\n\n return (\n <PageLayout\n title={tr(\"export.templates.title\", \"Export Templates\")}\n subtitle={tr(\n \"export.templates.subtitle\",\n \"Reusable export configurations for common data exports\",\n )}\n icon={<FileBox size={24} />}\n headerActions={\n <CTAOverflowMenu\n primary={{\n label: tr(\"export.templates.actions.newTemplate\", \"New Template\"),\n icon: <Plus size={16} />,\n onSelect: handleOpenCreate,\n }}\n actions={[\n {\n label: tr(\"export.templates.actions.newExport\", \"New Export\"),\n icon: <Plus size={16} />,\n onSelect: () => navigate?.(joinPath(basePath, \"new\")),\n },\n ]}\n />\n }\n headerContent={\n <span className=\"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-bg-sunken text-text-secondary\">\n <Sparkles size={12} />\n {navigationV2\n ? filteredTemplates.length === 1\n ? tr(\"export.templates.summary.one\", \"1 setup\")\n : tr(\"export.templates.summary.other\", \"{{count}} setups\", {\n count: filteredTemplates.length,\n })\n : tr(\n \"export.templates.summary.available\",\n \"{{count}} template{{suffix}} available\",\n {\n count: filteredTemplates.length,\n suffix: filteredTemplates.length !== 1 ? \"s\" : \"\",\n },\n )}\n </span>\n }\n >\n {navigationV2 && <DownloadsTabs />}\n {/* Page purpose — why templates exist */}\n <PagePurpose icon={<FileBox size={16} />}>\n {tr(\n \"export.templates.purpose\",\n \"Templates save an export setup — the entity types and format you regularly need — so you don't rebuild it each time. Create one here, then start a new export from it in a single click. Handy for recurring backups, periodic audits, or any export you run more than once.\",\n )}\n </PagePurpose>\n\n {/* Create Template Form */}\n {showCreateForm && (\n <div className=\"border border-primary/30 rounded-xl p-6 bg-accent-wash space-y-4\">\n <div className=\"flex items-center justify-between\">\n <h3 className=\"font-semibold text-lg\">\n {tr(\"export.templates.form.title\", \"New Template\")}\n </h3>\n <button\n type=\"button\"\n onClick={() => setShowCreateForm(false)}\n className=\"p-1.5 rounded-md hover:bg-accent\"\n >\n <X size={16} />\n </button>\n </div>\n {createError && (\n <p className=\"text-sm text-status-error-text bg-status-error-bg/10 rounded-lg px-3 py-2\">\n {createError}\n </p>\n )}\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-4\">\n <div className=\"space-y-1\">\n <label className=\"text-sm font-medium\">\n {tr(\"export.templates.form.fields.name\", \"Name\")} *\n </label>\n <input\n type=\"text\"\n aria-label={tr(\"export.templates.form.fields.name\", \"Name\")}\n placeholder={tr(\n \"export.templates.form.fields.namePlaceholder\",\n \"e.g. Weekly Tags Export\",\n )}\n value={newTemplateName}\n onChange={(e) => setNewTemplateName(e.target.value)}\n className=\"w-full px-3 py-2 border-2 border-border-subtle rounded-lg bg-bg-surface focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all\"\n />\n </div>\n <div className=\"space-y-1\">\n <label className=\"text-sm font-medium\">\n {tr(\"export.templates.form.fields.format\", \"Format\")} *\n </label>\n <select\n value={newTemplateFormat}\n onChange={(e) =>\n setNewTemplateFormat(e.target.value as ExportFormat)\n }\n className=\"w-full px-3 py-2 border-2 border-border-subtle rounded-lg bg-bg-surface focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"CSV\">{tr(\"export.format.csv\", \"CSV\")}</option>\n <option value=\"JSON\">{tr(\"export.format.json\", \"JSON\")}</option>\n </select>\n </div>\n </div>\n <div className=\"space-y-1\">\n <label className=\"text-sm font-medium\">\n {tr(\"export.templates.form.fields.description\", \"Description\")}\n </label>\n <input\n type=\"text\"\n aria-label={tr(\n \"export.templates.form.fields.description\",\n \"Description\",\n )}\n placeholder={tr(\n \"export.templates.form.fields.descriptionPlaceholder\",\n \"Optional description\",\n )}\n value={newTemplateDescription}\n onChange={(e) => setNewTemplateDescription(e.target.value)}\n className=\"w-full px-3 py-2 border-2 border-border-subtle rounded-lg bg-bg-surface focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all\"\n />\n </div>\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">\n {tr(\"export.templates.form.fields.entityTypes\", \"Entity Types\")} *{\" \"}\n <span className=\"text-text-secondary font-normal\">\n {tr(\n \"export.templates.form.fields.entityTypesHint\",\n \"(select at least one)\",\n )}\n </span>\n </label>\n <div className=\"flex flex-wrap gap-2\">\n {selectableEntities.map((entity) => (\n <button\n key={entity.entityType}\n type=\"button\"\n onClick={() => toggleEntity(entity.entityType)}\n className={cn(\n \"px-3 py-1.5 rounded-lg text-sm font-medium border-2 transition-all\",\n newTemplateEntityTypes.includes(entity.entityType)\n ? \"border-primary bg-action-primary-bg/10 text-primary\"\n : \"border-border-subtle bg-bg-surface hover:border-primary/50\",\n )}\n >\n {navigationV2 ? label(entity.entityType) : entity.displayName}\n </button>\n ))}\n </div>\n </div>\n <div className=\"flex gap-3 pt-2\">\n <button\n type=\"button\"\n onClick={handleCreateTemplate}\n disabled={creating}\n className=\"inline-flex items-center gap-2 px-5 py-2.5 bg-action-primary-bg text-action-primary-text rounded-lg hover:bg-action-primary-bg/90 transition-colors font-medium disabled:opacity-50\"\n >\n {creating ? (\n <Loader2 size={16} className=\"animate-spin\" />\n ) : (\n <Plus size={16} />\n )}\n {tr(\"export.templates.form.actions.create\", \"Create Template\")}\n </button>\n <button\n type=\"button\"\n onClick={() => setShowCreateForm(false)}\n className=\"px-5 py-2.5 border-2 border-border-subtle rounded-lg hover:bg-accent transition-colors font-medium\"\n >\n {tr(\"export.templates.form.actions.cancel\", \"Cancel\")}\n </button>\n </div>\n </div>\n )}\n {/* Search */}\n <div className=\"relative group\">\n <Search\n size={18}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary group-focus-within:text-primary transition-colors\"\n />\n <input\n type=\"text\"\n aria-label={tr(\n \"export.templates.search.placeholder\",\n \"Search templates\",\n )}\n placeholder={tr(\n \"export.templates.search.placeholder\",\n \"Search templates...\",\n )}\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className=\"w-full pl-[3.25rem] pr-4 py-2.5 border-2 border-border-subtle rounded-lg bg-bg-surface focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all duration-200\"\n />\n {searchQuery && (\n <button\n type=\"button\"\n onClick={() => setSearchQuery(\"\")}\n className=\"absolute right-3 top-1/2 -translate-y-1/2 p-1 rounded-md text-text-secondary hover:text-text-primary hover:bg-accent\"\n >\n <X size={16} />\n </button>\n )}\n </div>\n\n {/* Loading */}\n {isLoading && (\n <div className=\"grid grid-cols-1 lg:grid-cols-2 gap-4\">\n {[...Array(4)].map((_, i) => (\n <div key={i} className=\"border border-border-seam rounded-xl p-5\">\n <div className=\"h-5 w-40 bg-bg-sunken rounded mb-3 animate-vc-shimmer\" />\n <div className=\"h-3 w-full bg-bg-sunken rounded mb-2 animate-vc-shimmer\" />\n <div className=\"flex gap-2 mt-4\">\n <div className=\"h-5 w-16 bg-bg-sunken rounded-full animate-vc-shimmer\" />\n <div className=\"h-5 w-16 bg-bg-sunken rounded-full animate-vc-shimmer\" />\n </div>\n </div>\n ))}\n </div>\n )}\n\n {/* Templates Grid */}\n {!isLoading ? (\n filteredTemplates.length > 0 ? (\n <div className=\"grid grid-cols-1 lg:grid-cols-2 gap-4\">\n {filteredTemplates.map((template, index) => (\n <div\n key={template.id}\n role=\"button\"\n tabIndex={0}\n onClick={() => handleTemplateClick(template.id)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n handleTemplateClick(template.id);\n }\n }}\n className={cn(\n \"text-left group cursor-pointer border border-border-seam rounded-xl overflow-hidden bg-bg-surface\",\n \"hover:border-primary/40 shadow-[var(--shadow-pop)] transition-colors duration-200\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40\",\n \"animate-in fade-in-0\",\n )}\n style={{ animationDelay: `${index * 50}ms` }}\n >\n {/* Header */}\n <div className=\"p-4 border-b bg-bg-sunken/30\">\n <div className=\"flex items-start justify-between\">\n <div className=\"flex items-center gap-3\">\n <div className=\"p-2 rounded-lg bg-action-primary-bg/10\">\n <FileBox size={20} className=\"text-primary\" />\n </div>\n <div>\n <h3 className=\"font-semibold\">{template.name}</h3>\n <p className=\"text-xs text-text-secondary\">\n {getFormatDisplayName(template.format)}\n {template.isDefault && (\n <span className=\"ml-1.5 inline-flex items-center px-1.5 py-0.5 rounded text-xs bg-action-primary-bg/10 text-primary font-medium\">\n {tr(\"export.templates.card.default\", \"Default\")}\n </span>\n )}\n </p>\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={(e) => handleDeleteTemplate(e, template.id)}\n className=\"p-1.5 rounded-md text-text-secondary hover:text-status-error-text hover:bg-status-error-bg/10 transition-colors\"\n aria-label={tr(\n \"export.templates.card.deleteAriaLabel\",\n \"Delete {{name}}\",\n { name: template.name },\n )}\n >\n <X size={14} />\n </button>\n <ChevronRight\n size={18}\n className=\"text-text-secondary group-hover:text-primary transition-colors mt-1\"\n />\n </div>\n </div>\n </div>\n\n {/* Body */}\n <div className=\"p-4\">\n {template.description && (\n <p className=\"text-sm text-text-secondary mb-3 line-clamp-2\">\n {template.description}\n </p>\n )}\n <div className=\"flex flex-wrap gap-1.5 overflow-hidden\">\n {template.entityTypes.slice(0, 6).map((entity) => (\n <span\n key={entity}\n className=\"inline-flex px-2 py-0.5 rounded text-xs font-medium bg-bg-sunken text-text-secondary max-w-full truncate\"\n >\n {label(entity)}\n </span>\n ))}\n {template.entityTypes.length > 6 && (\n <span className=\"inline-flex px-2 py-0.5 rounded text-xs font-medium bg-bg-sunken text-text-secondary\">\n {tr(\n \"export.templates.card.moreEntities\",\n \"+{{count}} more\",\n {\n count: template.entityTypes.length - 6,\n },\n )}\n </span>\n )}\n </div>\n </div>\n </div>\n ))}\n </div>\n ) : (\n <IllustratedEmptyState\n illustration={searchQuery ? \"empty-search\" : \"empty-data\"}\n title={\n searchQuery\n ? tr(\n \"export.templates.empty.filtered.title\",\n \"No matching templates\",\n )\n : tr(\"export.templates.empty.title\", \"No templates yet\")\n }\n description={\n searchQuery\n ? tr(\n \"export.templates.empty.filtered.description\",\n \"Try adjusting your search to find what you are looking for.\",\n )\n : tr(\n \"export.templates.empty.description\",\n \"Create a template to save reusable export configurations.\",\n )\n }\n action={\n searchQuery ? (\n <button\n type=\"button\"\n onClick={() => setSearchQuery(\"\")}\n className=\"inline-flex items-center gap-2 px-4 py-2 border-2 border-border-subtle rounded-lg hover:bg-accent transition-colors font-medium\"\n >\n <X size={16} />\n {tr(\n \"export.templates.empty.filtered.actions.clear\",\n \"Clear Search\",\n )}\n </button>\n ) : (\n <button\n type=\"button\"\n onClick={handleOpenCreate}\n className=\"inline-flex items-center gap-2 px-4 py-2 bg-action-primary-bg text-action-primary-text rounded-lg hover:bg-action-primary-bg/90 transition-colors font-medium\"\n >\n <Plus size={16} />\n {tr(\n \"export.templates.empty.actions.newTemplate\",\n \"New Template\",\n )}\n </button>\n )\n }\n />\n )\n ) : null}\n {navigationV2 ? (\n <ConfirmDestructiveDialog\n open={templatePendingDelete !== null}\n onOpenChange={(open) => {\n if (!open) closeDeleteConfirm();\n }}\n title={tr(\"export.templates.delete.named\", \"Delete “{{name}}”?\", {\n name: pendingTemplateName,\n })}\n description={tr(\n \"export.templates.delete.description\",\n \"This removes the saved export configuration. Existing export jobs are not deleted.\",\n )}\n confirmLabel={tr(\n \"export.templates.delete.confirmAction\",\n \"Delete Template\",\n )}\n keepLabel={tr(\"export.templates.delete.cancel\", \"Keep Template\")}\n busy={deletingTemplate}\n error={deleteError}\n onConfirm={() => void confirmDeleteTemplate()}\n />\n ) : (\n templatePendingDelete && (\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby=\"template-list-delete-title\"\n className=\"fixed inset-0 z-50 flex items-center justify-center bg-bg-surface/80 backdrop-blur-sm p-4\"\n >\n <div className=\"w-full max-w-md rounded-xl border-2 border-border-subtle bg-bg-surface p-6 shadow-xl\">\n <h2 id=\"template-list-delete-title\" className=\"text-lg font-bold\">\n {tr(\"export.templates.delete.title\", \"Delete template?\")}\n </h2>\n <p className=\"mt-2 text-sm text-text-secondary\">\n {tr(\n \"export.templates.delete.description\",\n \"This removes the saved export configuration. Existing export jobs are not deleted.\",\n )}\n </p>\n {deleteError && (\n <p\n role=\"alert\"\n className=\"mt-3 rounded-lg bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text\"\n >\n {deleteError}\n </p>\n )}\n <div className=\"mt-6 flex flex-col-reverse sm:flex-row sm:justify-end gap-3\">\n <button\n type=\"button\"\n onClick={closeDeleteConfirm}\n className=\"px-4 py-2 rounded-lg border-2 border-border-subtle hover:bg-accent transition-colors font-medium\"\n >\n {tr(\"export.templates.delete.cancel\", \"Keep Template\")}\n </button>\n <button\n type=\"button\"\n onClick={confirmDeleteTemplate}\n className=\"px-4 py-2 rounded-lg bg-status-error-bg text-status-error-text hover:bg-status-error-bg/90 transition-colors font-medium\"\n >\n {tr(\n \"export.templates.delete.confirmAction\",\n \"Delete Template\",\n )}\n </button>\n </div>\n </div>\n </div>\n )\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyCA,IAAMA,KAAY,GAAc,OACZC,EAAK,SAAS,GAAG,IAAIA,EAAK,MAAM,GAAG,EAAE,IAAIA,MACzCC,EAAK,WAAW,GAAG,IAAIA,IAAO,IAAIA;AAQtD,SAAgBC,IAAsB;CACpC,IAAM,EAAE,cAAW,KAAK,gBAAaC,EAAU,GACzCC,IAAKC,EAAM,GACX,EAAE,MAAMC,GAAW,iBAAcC,GAAmB,GACpD,EAAE,uBAAmBC,GAAwB,GAC7C,EAAE,oBAAgB,WAAWC,MAAaC,GAAwB,GAClE,EAAE,MAAMC,OAAsBC,EAAqB,GACnDC,IAAeC,EAAgB,GAC/BC,IAAQC,GAAeH,CAAY,GACnC,EAAE,aAAaI,MAAoBC,EAAY,GAI/CC,IAAqBR,GAAkB,QAC1C,MACC,EAAE,YAAY,MACd,CAACS,GAAuB,EAAE,UAAU,KACpC,CAACC,GAAuB,EAAE,YAAYJ,CAAe,CACzD,GACM,CAACK,GAAaC,KAAkBC,EAAwB,IAAI,GAC5D,CAACC,GAAkBC,KAAuBF,EAAS,EAAK,GAExD,CAACG,GAAaC,KAAkBJ,EAAS,EAAE,GAC3C,C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,iCAAiC,sBAAsB,EAC/D,MAAM2D,GACR,CAAC;IACD,aAAa3D,EACX,uCACA,oFACF;IACA,cAAcA,EACZ,yCACA,iBACF;IACA,WAAWA,EAAG,kCAAkC,eAAe;IAC/D,MAAMqB;IACN,OAAOH;IACP,iBAAiB,KAAKsC,EAAsB;GAC7C,CAAA,IAEDnB,KACE,kBAAC,OAAD;IACE,MAAK;IACL,cAAW;IACX,mBAAgB;IAChB,WAAU;IAEV,UAAA,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA;MACE,kBAAC,MAAD;OAAI,IAAG;OAA6B,WAAU;OAC3C,UAAArC,EAAG,iCAAiC,kBAAkB;MACrD,CAAA;MACJ,kBAAC,KAAD;OAAG,WAAU;OACV,UAAAA,EACC,uCACA,oFACF;MACC,CAAA;MACFkB,KACC,kBAAC,KAAD;OACE,MAAK;OACL,WAAU;OAET,UAAAA;MACA,CAAA;MAEL,kBAAC,OAAD;OAAK,WAAU;OAAf,UAAA,CACE,kBAAC,UAAD;QACE,MAAK;QACL,SAASqC;QACT,WAAU;QAET,UAAAvD,EAAG,kCAAkC,eAAe;OAC/C,CAAA,GACR,kBAAC,UAAD;QACE,MAAK;QACL,SAASwD;QACT,WAAU;QAET,UAAAxD,EACC,yCACA,iBACF;OACM,CAAA,CACL;;KACF;;GACF,CAAA;EAGC;;AAEhB"}
@@ -3,230 +3,252 @@ import { useDeleteExportTemplate as t, useExportTemplate as n } from "../hooks/u
3
3
  import { getArchiveFormatDisplayName as r, getFormatDisplayName as i } from "../constants/enums.js";
4
4
  import { PageLayout as a, PageSection as o } from "../components/PageLayout.js";
5
5
  import { useTr as s } from "../hooks/useTr.js";
6
- import { nativeImpact as c, nativeNotify as l } from "../../utils/nativeBridge.js";
7
- import { useState as u } from "react";
8
- import { ArrowLeft as d, Clock as f, Download as p, FileBox as m, FileText as h, HardDrive as g, Loader2 as _, Play as v, Trash2 as y } from "lucide-react";
9
- import { useParams as b } from "react-router";
10
- import { jsx as x, jsxs as S } from "react/jsx-runtime";
11
- import { CTAOverflowMenu as C, GlassCard as w, IllustratedEmptyState as T, NextSteps as E, ShowMore as D } from "@burdenoff/fe-libs/ui";
6
+ import { useEntityLabel as c } from "../hooks/useEntityLabel.js";
7
+ import { useNavigationV2 as l } from "../navigation-v2/NavigationV2.js";
8
+ import { ConfirmDestructiveDialog as u } from "../components/ConfirmDestructiveDialog.js";
9
+ import { nativeImpact as d, nativeNotify as f } from "../../utils/nativeBridge.js";
10
+ import { useState as p } from "react";
11
+ import { ArrowLeft as m, Clock as h, Download as g, FileBox as _, FileText as v, HardDrive as y, Loader2 as b, Play as x, Trash2 as S } from "lucide-react";
12
+ import { useParams as C } from "react-router";
13
+ import { jsx as w, jsxs as T } from "react/jsx-runtime";
14
+ import { CTAOverflowMenu as E, GlassCard as D, IllustratedEmptyState as O, NextSteps as k, ShowMore as A } from "@burdenoff/fe-libs/ui";
12
15
  // src/export/pages/TemplateDetailPage.tsx
13
- var O = (e, t) => (e.endsWith("/") ? e.slice(0, -1) : e) + (t.startsWith("/") ? t : `/${t}`);
14
- function k() {
15
- let { templateId: k } = b(), { basePath: A = "/", navigate: j } = e(), M = s(), [N, P] = u(!1), { data: F, isLoading: I } = n(k), { deleteTemplate: L, isPending: R } = t();
16
- if (I) return /* @__PURE__ */ S("div", {
16
+ var j = (e, t) => (e.endsWith("/") ? e.slice(0, -1) : e) + (t.startsWith("/") ? t : `/${t}`);
17
+ function M() {
18
+ let { templateId: M } = C(), { basePath: N = "/", navigate: P } = e(), F = s(), [I, L] = p(!1), { data: R, isLoading: z } = n(M), { deleteTemplate: B, isPending: V } = t(), H = l(), U = c(H), [W, G] = p(null);
19
+ if (z) return /* @__PURE__ */ T("div", {
17
20
  className: "flex flex-col items-center justify-center py-20",
18
- children: [/* @__PURE__ */ x(_, {
21
+ children: [/* @__PURE__ */ w(b, {
19
22
  size: 48,
20
23
  className: "animate-spin text-primary"
21
- }), /* @__PURE__ */ x("span", {
24
+ }), /* @__PURE__ */ w("span", {
22
25
  className: "mt-6 text-sm font-medium text-text-secondary",
23
- children: M("export.templateDetail.loading", "Loading template details…")
26
+ children: F("export.templateDetail.loading", "Loading template details…")
24
27
  })]
25
28
  });
26
- if (!F) return /* @__PURE__ */ S(a, {
29
+ if (!R) return /* @__PURE__ */ T(a, {
27
30
  showHeader: !1,
28
- children: [/* @__PURE__ */ S("div", {
31
+ children: [/* @__PURE__ */ T("div", {
29
32
  className: "flex items-center gap-3 mb-6",
30
- children: [/* @__PURE__ */ x("button", {
33
+ children: [/* @__PURE__ */ w("button", {
31
34
  type: "button",
32
- onClick: () => j?.(O(A, "templates")),
33
- "aria-label": M("export.templateDetail.actions.backToTemplates", "Back to templates"),
35
+ onClick: () => P?.(j(N, "templates")),
36
+ "aria-label": F("export.templateDetail.actions.backToTemplates", "Back to templates"),
34
37
  className: "p-2.5 hover:bg-accent rounded-lg transition-all duration-200",
35
- children: /* @__PURE__ */ x(d, { size: 20 })
36
- }), /* @__PURE__ */ x("h1", {
38
+ children: /* @__PURE__ */ w(m, { size: 20 })
39
+ }), /* @__PURE__ */ w("h1", {
37
40
  className: "text-xl font-bold",
38
- children: M("export.templateDetail.notFound.title", "Template Not Found")
41
+ children: F("export.templateDetail.notFound.title", "Template Not Found")
39
42
  })]
40
- }), /* @__PURE__ */ x(T, {
43
+ }), /* @__PURE__ */ w(O, {
41
44
  illustration: "empty-data",
42
- title: M("export.templateDetail.notFound.heading", "Template not found"),
43
- description: M("export.templateDetail.notFound.description", "The template you are looking for does not exist."),
44
- action: /* @__PURE__ */ S("button", {
45
+ title: F("export.templateDetail.notFound.heading", "Template not found"),
46
+ description: F("export.templateDetail.notFound.description", "The template you are looking for does not exist."),
47
+ action: /* @__PURE__ */ T("button", {
45
48
  type: "button",
46
- onClick: () => j?.(O(A, "templates")),
49
+ onClick: () => P?.(j(N, "templates")),
47
50
  className: "inline-flex items-center gap-2 px-6 py-3 bg-action-primary-bg text-action-primary-text rounded-lg hover:bg-action-primary-bg/90 transition-colors font-medium",
48
- children: [/* @__PURE__ */ x(d, { size: 18 }), M("export.templateDetail.actions.backToTemplates", "Back to Templates")]
51
+ children: [/* @__PURE__ */ w(m, { size: 18 }), F("export.templateDetail.actions.backToTemplates", "Back to Templates")]
49
52
  })
50
53
  })]
51
54
  });
52
- let z = () => {
53
- j?.(O(A, `new?templateId=${k}`));
54
- }, B = async () => {
55
- if (k) {
56
- c("medium");
55
+ let K = () => {
56
+ P?.(j(N, `new?templateId=${M}`));
57
+ }, q = async () => {
58
+ if (M) {
59
+ d("medium"), G(null);
57
60
  try {
58
- await L(k), l("success"), j?.(O(A, "templates"));
59
- } catch {
60
- l("error");
61
+ await B(M), f("success"), P?.(j(N, "templates"));
62
+ } catch (e) {
63
+ f("error"), G(e instanceof Error && e.message ? e.message : F("export.templates.delete.failed", "Couldn't delete this template. Try again."));
61
64
  }
62
65
  }
63
- }, V = F.isDefault ? [] : [{
64
- label: M("export.templateDetail.actions.delete", "Delete Template"),
65
- icon: /* @__PURE__ */ x(y, { size: 16 }),
66
+ }, J = () => {
67
+ L(!1), G(null);
68
+ }, Y = R.isDefault ? [] : [{
69
+ label: F("export.templateDetail.actions.delete", "Delete Template"),
70
+ icon: /* @__PURE__ */ w(S, { size: 16 }),
66
71
  intent: "destructive",
67
- disabled: R,
68
- onSelect: () => P(!0)
69
- }], H = [{
72
+ disabled: V,
73
+ onSelect: () => L(!0)
74
+ }], X = [{
70
75
  id: "use",
71
- label: M("export.templateDetail.nextSteps.use.label", "Start an export from this template"),
72
- description: M("export.templateDetail.nextSteps.use.description", "Pre-fills a new export with this template's entity types and format."),
73
- icon: /* @__PURE__ */ x(v, { size: 16 }),
74
- onClick: z
76
+ label: F("export.templateDetail.nextSteps.use.label", "Start an export from this template"),
77
+ description: F("export.templateDetail.nextSteps.use.description", "Pre-fills a new export with this template's entity types and format."),
78
+ icon: /* @__PURE__ */ w(x, { size: 16 }),
79
+ onClick: K
75
80
  }, {
76
81
  id: "browse",
77
- label: M("export.templateDetail.nextSteps.browse.label", "Browse all templates"),
78
- description: M("export.templateDetail.nextSteps.browse.description", "Manage your other saved export configurations."),
79
- icon: /* @__PURE__ */ x(m, { size: 16 }),
80
- onClick: () => j?.(O(A, "templates"))
82
+ label: F("export.templateDetail.nextSteps.browse.label", "Browse all templates"),
83
+ description: F("export.templateDetail.nextSteps.browse.description", "Manage your other saved export configurations."),
84
+ icon: /* @__PURE__ */ w(_, { size: 16 }),
85
+ onClick: () => P?.(j(N, "templates"))
81
86
  }];
82
- return /* @__PURE__ */ S(a, {
87
+ return /* @__PURE__ */ T(a, {
83
88
  showHeader: !1,
84
89
  children: [
85
- /* @__PURE__ */ x("div", {
90
+ /* @__PURE__ */ w("div", {
86
91
  className: "relative overflow-hidden rounded-xl bg-accent-wash border border-border-seam p-6 shadow-[var(--shadow-pop)]",
87
- children: /* @__PURE__ */ S("div", {
92
+ children: /* @__PURE__ */ T("div", {
88
93
  className: "relative z-10 flex flex-col sm:flex-row sm:items-center gap-4",
89
94
  children: [
90
- /* @__PURE__ */ x("button", {
95
+ /* @__PURE__ */ w("button", {
91
96
  type: "button",
92
- onClick: () => j?.(O(A, "templates")),
93
- "aria-label": M("export.templateDetail.actions.backToTemplates", "Back to templates"),
97
+ onClick: () => P?.(j(N, "templates")),
98
+ "aria-label": F("export.templateDetail.actions.backToTemplates", "Back to templates"),
94
99
  className: "p-2.5 hover:bg-accent rounded-lg transition-colors duration-200 self-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
95
- children: /* @__PURE__ */ x(d, { size: 20 })
100
+ children: /* @__PURE__ */ w(m, { size: 20 })
96
101
  }),
97
- /* @__PURE__ */ S("div", {
102
+ /* @__PURE__ */ T("div", {
98
103
  className: "flex items-center gap-3 flex-1 min-w-0",
99
- children: [/* @__PURE__ */ x("div", {
104
+ children: [/* @__PURE__ */ w("div", {
100
105
  className: "p-2.5 rounded-lg bg-action-primary-bg/10",
101
- children: /* @__PURE__ */ x(m, {
106
+ children: /* @__PURE__ */ w(_, {
102
107
  size: 24,
103
108
  className: "text-primary"
104
109
  })
105
- }), /* @__PURE__ */ S("div", {
110
+ }), /* @__PURE__ */ T("div", {
106
111
  className: "flex-1 min-w-0",
107
- children: [/* @__PURE__ */ x("h1", {
112
+ children: [/* @__PURE__ */ w("h1", {
108
113
  className: "text-xl sm:text-2xl font-bold truncate",
109
- children: F.name
110
- }), /* @__PURE__ */ x("p", {
114
+ children: R.name
115
+ }), /* @__PURE__ */ w("p", {
111
116
  className: "text-sm text-text-secondary mt-1",
112
- children: F.isDefault ? M("export.templateDetail.badge.default", "Default template") : M("export.templateDetail.badge.custom", "Custom template")
117
+ children: R.isDefault ? F("export.templateDetail.badge.default", "Default template") : F("export.templateDetail.badge.custom", "Custom template")
113
118
  })]
114
119
  })]
115
120
  }),
116
- /* @__PURE__ */ x("div", {
121
+ /* @__PURE__ */ w("div", {
117
122
  className: "flex-shrink-0",
118
- children: /* @__PURE__ */ x(C, {
123
+ children: /* @__PURE__ */ w(E, {
119
124
  primary: {
120
- label: M("export.templateDetail.actions.use", "Use Template"),
121
- icon: /* @__PURE__ */ x(v, { size: 16 }),
122
- onSelect: z
125
+ label: F("export.templateDetail.actions.use", "Use Template"),
126
+ icon: /* @__PURE__ */ w(x, { size: 16 }),
127
+ onSelect: K
123
128
  },
124
- actions: V
129
+ actions: Y
125
130
  })
126
131
  })
127
132
  ]
128
133
  })
129
134
  }),
130
- F.description && /* @__PURE__ */ x("div", {
135
+ R.description && /* @__PURE__ */ w("div", {
131
136
  className: "border border-border-seam rounded-xl p-5 bg-bg-surface",
132
- children: /* @__PURE__ */ x("p", {
137
+ children: /* @__PURE__ */ w("p", {
133
138
  className: "text-sm text-text-secondary",
134
- children: F.description
139
+ children: R.description
135
140
  })
136
141
  }),
137
- /* @__PURE__ */ x("div", {
142
+ /* @__PURE__ */ w("div", {
138
143
  className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",
139
144
  children: [
140
145
  {
141
- icon: /* @__PURE__ */ x(h, { size: 18 }),
142
- label: M("export.templateDetail.info.format", "Format"),
143
- value: i(F.format)
146
+ icon: /* @__PURE__ */ w(v, { size: 18 }),
147
+ label: F("export.templateDetail.info.format", "Format"),
148
+ value: i(R.format)
144
149
  },
145
150
  {
146
- icon: /* @__PURE__ */ x(g, { size: 18 }),
147
- label: M("export.templateDetail.info.archive", "Archive"),
148
- value: r("ZIP")
151
+ icon: /* @__PURE__ */ w(y, { size: 18 }),
152
+ label: F("export.templateDetail.info.archive", "Archive"),
153
+ value: H ? F("export.templateDetail.info.archiveEvery", "Every download is a ZIP file") : r("ZIP")
149
154
  },
150
155
  {
151
- icon: /* @__PURE__ */ x(p, { size: 18 }),
152
- label: M("export.templateDetail.info.entityTypes", "Entity Types"),
153
- value: M("export.templateDetail.info.entityTypesCount", "{{count}} type{{suffix}}", {
154
- count: F.entityTypes.length,
155
- suffix: F.entityTypes.length === 1 ? "" : "s"
156
+ icon: /* @__PURE__ */ w(g, { size: 18 }),
157
+ label: F("export.templateDetail.info.entityTypes", "Entity Types"),
158
+ value: F("export.templateDetail.info.entityTypesCount", "{{count}} type{{suffix}}", {
159
+ count: R.entityTypes.length,
160
+ suffix: R.entityTypes.length === 1 ? "" : "s"
156
161
  })
157
162
  },
158
163
  {
159
- icon: /* @__PURE__ */ x(f, { size: 18 }),
160
- label: M("export.templateDetail.info.lastUpdated", "Last Updated"),
161
- value: new Date(F.updatedAt).toLocaleDateString()
164
+ icon: /* @__PURE__ */ w(h, { size: 18 }),
165
+ label: F("export.templateDetail.info.lastUpdated", "Last Updated"),
166
+ value: new Date(R.updatedAt).toLocaleDateString()
162
167
  }
163
- ].map((e) => /* @__PURE__ */ S(w, {
168
+ ].map((e) => /* @__PURE__ */ T(D, {
164
169
  treatment: "metric",
165
170
  className: "p-4 border-border-seam",
166
- children: [/* @__PURE__ */ S("div", {
171
+ children: [/* @__PURE__ */ T("div", {
167
172
  className: "flex items-center gap-2 text-text-secondary mb-1",
168
- children: [e.icon, /* @__PURE__ */ x("span", {
173
+ children: [e.icon, /* @__PURE__ */ w("span", {
169
174
  className: "text-xs font-medium",
170
175
  children: e.label
171
176
  })]
172
- }), /* @__PURE__ */ x("p", {
177
+ }), /* @__PURE__ */ w("p", {
173
178
  className: "font-bold text-lg tabular-nums",
174
179
  children: e.value
175
180
  })]
176
181
  }, e.label))
177
182
  }),
178
- /* @__PURE__ */ x(E, {
179
- storageKey: `export-template-${F.id}`,
180
- title: M("export.templateDetail.nextSteps.title", "What's next"),
181
- steps: H
183
+ !H && /* @__PURE__ */ w(k, {
184
+ storageKey: `export-template-${R.id}`,
185
+ title: F("export.templateDetail.nextSteps.title", "What's next"),
186
+ steps: X
182
187
  }),
183
- /* @__PURE__ */ x(o, {
184
- title: M("export.templateDetail.entityTypes.title", "Included Entity Types"),
185
- description: M("export.templateDetail.entityTypes.description", "Data types that will be exported"),
186
- children: /* @__PURE__ */ x(D, {
188
+ /* @__PURE__ */ w(o, {
189
+ title: F("export.templateDetail.entityTypes.title", "Included Entity Types"),
190
+ description: F("export.templateDetail.entityTypes.description", "Data types that will be exported"),
191
+ children: /* @__PURE__ */ w(A, {
187
192
  collapsedHeight: 96,
188
- children: /* @__PURE__ */ x("div", {
193
+ children: /* @__PURE__ */ w("div", {
189
194
  className: "flex flex-wrap gap-2",
190
- children: F.entityTypes.map((e) => /* @__PURE__ */ x("span", {
195
+ children: R.entityTypes.map((e) => /* @__PURE__ */ w("span", {
191
196
  className: "inline-flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium border border-border-seam bg-bg-sunken/30",
192
- children: e
197
+ children: U(e)
193
198
  }, e))
194
199
  })
195
200
  })
196
201
  }),
197
- N && /* @__PURE__ */ x("div", {
202
+ H ? /* @__PURE__ */ w(u, {
203
+ open: I,
204
+ onOpenChange: (e) => {
205
+ e || J();
206
+ },
207
+ title: F("export.templates.delete.named", "Delete “{{name}}”?", { name: R.name }),
208
+ description: F("export.templateDetail.delete.description", "This removes the saved export configuration. Existing export jobs are not deleted."),
209
+ confirmLabel: F("export.templateDetail.delete.confirmAction", "Delete Template"),
210
+ keepLabel: F("export.templateDetail.delete.keep", "Keep Template"),
211
+ busy: V,
212
+ error: W,
213
+ onConfirm: () => void q()
214
+ }) : I && /* @__PURE__ */ w("div", {
198
215
  role: "dialog",
199
216
  "aria-modal": "true",
200
217
  "aria-labelledby": "template-delete-title",
201
218
  className: "fixed inset-0 z-50 flex items-center justify-center bg-bg-surface/80 backdrop-blur-sm p-4",
202
- children: /* @__PURE__ */ S("div", {
219
+ children: /* @__PURE__ */ T("div", {
203
220
  className: "w-full max-w-md rounded-xl border-2 border-border-subtle bg-bg-surface p-6 shadow-xl",
204
221
  children: [
205
- /* @__PURE__ */ x("h2", {
222
+ /* @__PURE__ */ w("h2", {
206
223
  id: "template-delete-title",
207
224
  className: "text-lg font-bold",
208
- children: M("export.templateDetail.delete.title", "Delete template?")
225
+ children: F("export.templateDetail.delete.title", "Delete template?")
209
226
  }),
210
- /* @__PURE__ */ x("p", {
227
+ /* @__PURE__ */ w("p", {
211
228
  className: "mt-2 text-sm text-text-secondary",
212
- children: M("export.templateDetail.delete.description", "This removes the saved export configuration. Existing export jobs are not deleted.")
229
+ children: F("export.templateDetail.delete.description", "This removes the saved export configuration. Existing export jobs are not deleted.")
213
230
  }),
214
- /* @__PURE__ */ S("div", {
231
+ W && /* @__PURE__ */ w("p", {
232
+ role: "alert",
233
+ className: "mt-3 rounded-lg bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
234
+ children: W
235
+ }),
236
+ /* @__PURE__ */ T("div", {
215
237
  className: "mt-6 flex flex-col-reverse sm:flex-row sm:justify-end gap-3",
216
- children: [/* @__PURE__ */ x("button", {
238
+ children: [/* @__PURE__ */ w("button", {
217
239
  type: "button",
218
- onClick: () => P(!1),
240
+ onClick: J,
219
241
  className: "px-4 py-2 rounded-lg border-2 border-border-subtle hover:bg-accent transition-colors font-medium",
220
- children: M("export.templateDetail.delete.keep", "Keep Template")
221
- }), /* @__PURE__ */ S("button", {
242
+ children: F("export.templateDetail.delete.keep", "Keep Template")
243
+ }), /* @__PURE__ */ T("button", {
222
244
  type: "button",
223
- onClick: B,
224
- disabled: R,
245
+ onClick: q,
246
+ disabled: V,
225
247
  className: "inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg bg-status-error-bg text-status-error-text hover:bg-status-error-bg/90 transition-colors font-medium disabled:opacity-50",
226
- children: [R ? /* @__PURE__ */ x(_, {
248
+ children: [V ? /* @__PURE__ */ w(b, {
227
249
  size: 16,
228
250
  className: "animate-spin"
229
- }) : null, M("export.templateDetail.delete.confirmAction", "Delete Template")]
251
+ }) : null, F("export.templateDetail.delete.confirmAction", "Delete Template")]
230
252
  })]
231
253
  })
232
254
  ]
@@ -235,6 +257,6 @@ function k() {
235
257
  ]
236
258
  });
237
259
  }
238
- export { k as TemplateDetailPage };
260
+ export { M as TemplateDetailPage };
239
261
 
240
262
  //# sourceMappingURL=TemplateDetailPage.js.map