@burdenoff/microfe-export 2026.1119.1 → 2026.1123.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.
@@ -272,7 +272,8 @@ function D() {
272
272
  onClick: () => O?.(E(D, "new")),
273
273
  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",
274
274
  children: [/* @__PURE__ */ x(m, { size: 16 }), k("export.history.empty.actions.createFirst", "Create First Export")]
275
- })
275
+ }),
276
+ kind: A.search ? "no-results" : X ? "filtered" : "first-use"
276
277
  }))
277
278
  ]
278
279
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ExportHistoryPage.js","names":["_Fragment","joinPath","base","path","ExportHistoryPage","useExport","tr","useTr","useExportStore","searchParams","useSearchParams","didInitFromUrlRef","useRef","statusParam","updateFilter","showFilters","setShowFilters","useState","cursorStack","setCursorStack","currentPageIndex","setCurrentPageIndex","currentCursor","jobs","useExportJobs","jobFilter","pagination","filteredJobs","useMemo","q","job","e","hasActiveFilters","handleJobClick","basePath","jobId","handleNextPage","pageInfo","newStack","prev","setPagination","handlePrevPage","prevIndex","handleResetFilters","resetFilter","applyServerFilter","change","hasPrevPage","hasNextPage","pageStart","pageEnd","totalCount","getStatusLabel","status","getStatusDisplayName","PageLayout","Clock","navigate","Download","PagePurpose","Search","cn","Filter","X","ThemedSelect","getAllStatuses","error","AlertCircle","refetch","RefreshCw","isLoading","i","Fragment","index","getFormatDisplayName","ExportStatusBadge","ChevronRight","ChevronLeft","IllustratedEmptyState"],"sources":["../../../src/export/pages/ExportHistoryPage.tsx"],"sourcesContent":["import { useState, useMemo, useEffect, useRef } from \"react\";\nimport { useSearchParams } from \"react-router\";\nimport {\n Search,\n X,\n Clock,\n Download,\n ChevronRight,\n ChevronLeft,\n RefreshCw,\n AlertCircle,\n Filter,\n} from \"lucide-react\";\nimport {\n IllustratedEmptyState,\n PagePurpose,\n ThemedSelect,\n} from \"@burdenoff/fe-libs/ui\";\nimport { useExport } from \"../providers/ExportProvider\";\nimport { useExportJobs } from \"../hooks/useExportQueries\";\nimport { useExportStore } from \"../store/exportStore\";\nimport { ExportStatusBadge } from \"../components/ExportStatusBadge\";\nimport { PageLayout } from \"../components/PageLayout\";\nimport { useTr } from \"../hooks/useTr\";\nimport { cn } from \"../utils/cn\";\nimport {\n getFormatDisplayName,\n getAllStatuses,\n getStatusDisplayName,\n} from \"../constants/enums\";\nimport type { ExportJobStatus, ExportFormat } from \"../types\";\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 History Page\n * Table/list of all past exports with filters and cursor-based pagination\n */\nexport function ExportHistoryPage() {\n const { basePath = \"/\", navigate } = useExport();\n const tr = useTr();\n const { jobFilter, updateFilter, resetFilter, pagination, setPagination } =\n useExportStore();\n const [searchParams] = useSearchParams();\n\n // Initialize status filter from URL search params (e.g. ?status=RUNNING) — once\n const didInitFromUrlRef = useRef(false);\n useEffect(() => {\n if (didInitFromUrlRef.current) return;\n didInitFromUrlRef.current = true;\n const statusParam = searchParams.get(\"status\");\n if (statusParam) {\n updateFilter({\n status: statusParam as ExportJobStatus,\n });\n }\n }, [searchParams, updateFilter]);\n\n const [showFilters, setShowFilters] = useState(false);\n // Cursor stack: index 0 = first page (no cursor), subsequent entries are \"after\" cursors\n const [cursorStack, setCursorStack] = useState<(string | null)[]>([null]);\n const [currentPageIndex, setCurrentPageIndex] = useState(0);\n\n const currentCursor = cursorStack[currentPageIndex] ?? null;\n\n const {\n data: jobs,\n totalCount,\n pageInfo,\n isLoading,\n error,\n refetch,\n } = useExportJobs(jobFilter, {\n first: pagination.pageSize,\n after: currentCursor ?? undefined,\n });\n\n // Client-side search filter (server-side filtering handles status/format)\n const filteredJobs = useMemo(() => {\n if (!jobFilter.search) return jobs;\n const q = jobFilter.search.toLowerCase();\n return jobs.filter(\n (job) =>\n job.name.toLowerCase().includes(q) ||\n job.entityTypes.some((e) => e.toLowerCase().includes(q)),\n );\n }, [jobs, jobFilter.search]);\n\n const hasActiveFilters =\n jobFilter.search ||\n jobFilter.status !== \"all\" ||\n jobFilter.format !== \"all\";\n\n const handleJobClick = (jobId: string) => {\n navigate?.(joinPath(basePath, jobId));\n };\n\n const handleNextPage = () => {\n if (!pageInfo?.hasNextPage || !pageInfo.endCursor) return;\n const newStack = [\n ...cursorStack.slice(0, currentPageIndex + 1),\n pageInfo.endCursor,\n ];\n setCursorStack(newStack);\n setCurrentPageIndex((prev) => prev + 1);\n setPagination({ page: pagination.page + 1, cursor: pageInfo.endCursor });\n };\n\n const handlePrevPage = () => {\n if (currentPageIndex === 0) return;\n const prevIndex = currentPageIndex - 1;\n setCurrentPageIndex(prevIndex);\n setPagination({\n page: pagination.page - 1,\n cursor: cursorStack[prevIndex] ?? null,\n });\n };\n\n const handleResetFilters = () => {\n resetFilter();\n setCursorStack([null]);\n setCurrentPageIndex(0);\n };\n\n // A status or format change is a new server-side query: drop the cursor too,\n // or the page shown is a later page of the old filter (not just its label).\n const applyServerFilter = (change: Parameters<typeof updateFilter>[0]) => {\n updateFilter(change);\n setCursorStack([null]);\n setCurrentPageIndex(0);\n };\n\n const hasPrevPage = currentPageIndex > 0;\n const hasNextPage = pageInfo?.hasNextPage ?? false;\n const pageStart = currentPageIndex * pagination.pageSize + 1;\n const pageEnd = Math.min(\n (currentPageIndex + 1) * pagination.pageSize,\n totalCount,\n );\n const getStatusLabel = (status: ExportJobStatus) =>\n tr(\n `export.shared.status.${status.toLowerCase()}`,\n getStatusDisplayName(status),\n );\n\n return (\n <PageLayout\n title={tr(\"export.history.title\", \"Export History\")}\n subtitle={tr(\n \"export.history.subtitle\",\n \"View and manage all your past export jobs\",\n )}\n icon={<Clock size={24} />}\n headerActions={\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, \"new\"))}\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 <Download size={16} />\n {tr(\"export.history.actions.newExport\", \"New Export\")}\n </button>\n }\n >\n {/* Page purpose — what History is for */}\n <PagePurpose icon={<Clock size={16} />}>\n {tr(\n \"export.history.purpose\",\n \"Every export you've ever started lives here. Track jobs as they run, see which finished or failed, and grab download links for completed exports before they expire. Search by name or entity type, or filter by status and format to find a specific one.\",\n )}\n </PagePurpose>\n\n {/* Search & Filters */}\n <div className=\"space-y-4\">\n <div className=\"flex flex-col sm:flex-row gap-3\">\n {/* Search */}\n <div className=\"flex-1 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.history.search.placeholder\",\n \"Search exports by name or entity type\",\n )}\n placeholder={tr(\n \"export.history.search.placeholder\",\n \"Search exports by name or entity type...\",\n )}\n value={jobFilter.search}\n onChange={(e) => updateFilter({ search: 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 </div>\n\n {/* Filter Toggle */}\n <button\n type=\"button\"\n onClick={() => setShowFilters(!showFilters)}\n className={cn(\n \"inline-flex items-center gap-2 px-4 py-2.5 border-2 rounded-lg transition-all duration-200 font-medium\",\n showFilters || hasActiveFilters\n ? \"bg-action-primary-bg text-action-primary-text border-primary\"\n : \"border-border-subtle/50 hover:border-primary/30\",\n )}\n >\n <Filter size={16} />\n {showFilters\n ? tr(\"export.history.filters.hide\", \"Hide\")\n : tr(\"export.history.filters.show\", \"Filter\")}\n </button>\n </div>\n\n {/* Filter Panel */}\n {showFilters && (\n <div className=\"border border-border-seam rounded-xl p-4 animate-in fade-in-0 duration-200\">\n <div className=\"flex items-center justify-between mb-4\">\n <h3 className=\"font-semibold flex items-center gap-2\">\n <Filter size={16} className=\"text-primary\" />\n {tr(\"export.history.filters.title\", \"Filters\")}\n </h3>\n {hasActiveFilters && (\n <button\n type=\"button\"\n onClick={handleResetFilters}\n className=\"text-sm text-text-secondary hover:text-status-error-text flex items-center gap-1\"\n >\n <X size={14} />\n {tr(\"export.history.filters.clearAll\", \"Clear All\")}\n </button>\n )}\n </div>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-4\">\n {/* Status Filter */}\n <div className=\"space-y-2\">\n <label className=\"block text-sm font-medium\">\n {tr(\"export.history.filters.status.label\", \"Status\")}\n </label>\n <ThemedSelect\n aria-label={tr(\n \"export.history.filters.status.label\",\n \"Status\",\n )}\n value={jobFilter.status}\n onChange={(e) =>\n applyServerFilter({\n status: e.target.value as ExportJobStatus | \"all\",\n })\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 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"all\">\n {tr(\"export.history.filters.status.all\", \"All Statuses\")}\n </option>\n {getAllStatuses().map((status) => (\n <option key={status} value={status}>\n {getStatusLabel(status)}\n </option>\n ))}\n </ThemedSelect>\n </div>\n\n {/* Format Filter — only CSV and JSON are supported */}\n <div className=\"space-y-2\">\n <label className=\"block text-sm font-medium\">\n {tr(\"export.history.filters.format.label\", \"Format\")}\n </label>\n <ThemedSelect\n aria-label={tr(\n \"export.history.filters.format.label\",\n \"Format\",\n )}\n value={jobFilter.format}\n onChange={(e) =>\n applyServerFilter({\n format: e.target.value as ExportFormat | \"all\",\n })\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 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"all\">\n {tr(\"export.history.filters.format.all\", \"All Formats\")}\n </option>\n <option value=\"CSV\">{tr(\"export.format.csv\", \"CSV\")}</option>\n <option value=\"JSON\">\n {tr(\"export.format.json\", \"JSON\")}\n </option>\n </ThemedSelect>\n </div>\n </div>\n </div>\n )}\n </div>\n\n {/* Error State */}\n {error && (\n <div className=\"border-2 border-border-default rounded-xl bg-status-error-bg-subtle p-6 flex items-start gap-4\">\n <AlertCircle\n size={24}\n className=\"text-status-error-text flex-shrink-0\"\n />\n <div>\n <h3 className=\"font-semibold text-status-error-text mb-1\">\n {tr(\"export.history.error.title\", \"Error loading exports\")}\n </h3>\n <p className=\"text-sm text-status-error-text mb-3\">\n {error.message}\n </p>\n <button\n type=\"button\"\n onClick={() => refetch()}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm bg-status-error-bg text-status-error-text rounded-lg hover:bg-status-error-bg/90 transition-colors\"\n >\n <RefreshCw size={14} />\n {tr(\"export.history.error.retry\", \"Try Again\")}\n </button>\n </div>\n </div>\n )}\n\n {/* Loading */}\n {isLoading && (\n <div className=\"space-y-3\">\n {[...Array(5)].map((_, i) => (\n <div key={i} className=\"border border-border-seam rounded-xl p-4\">\n <div className=\"flex items-center justify-between\">\n <div className=\"space-y-2\">\n <div className=\"h-4 w-48 bg-bg-sunken rounded animate-vc-shimmer\" />\n <div className=\"h-3 w-32 bg-bg-sunken rounded animate-vc-shimmer\" />\n </div>\n <div className=\"h-5 w-20 bg-bg-sunken rounded-full animate-vc-shimmer\" />\n </div>\n </div>\n ))}\n </div>\n )}\n\n {/* Jobs List */}\n {!isLoading &&\n !error &&\n (filteredJobs.length > 0 ? (\n <>\n <div className=\"space-y-2\">\n {filteredJobs.map((job, index) => (\n <button\n type=\"button\"\n key={job.id}\n onClick={() => handleJobClick(job.id)}\n className={cn(\n \"w-full text-left border border-border-seam rounded-xl p-4 bg-bg-surface\",\n \"hover:border-primary/40 transition-colors duration-200\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40\",\n \"group animate-in fade-in-0\",\n )}\n style={{ animationDelay: `${index * 30}ms` }}\n >\n <div className=\"flex items-start sm:items-center justify-between gap-3\">\n <div className=\"flex-1 min-w-0\">\n <h4 className=\"font-semibold text-text-primary truncate\">\n {job.name}\n </h4>\n <p className=\"text-sm text-text-secondary mt-1 line-clamp-2\">\n {job.entityTypes.join(\", \")} &middot;{\" \"}\n {getFormatDisplayName(job.format)}\n {job.createdAt &&\n ` · ${new Date(job.createdAt).toLocaleDateString()}`}\n </p>\n </div>\n <div className=\"flex items-center gap-2 flex-shrink-0\">\n <ExportStatusBadge status={job.status} />\n <ChevronRight\n size={18}\n className=\"text-text-secondary group-hover:text-primary transition-colors hidden sm:block\"\n />\n </div>\n </div>\n </button>\n ))}\n </div>\n\n {/* Pagination */}\n {totalCount > pagination.pageSize && (\n <div className=\"flex flex-col sm:flex-row items-center justify-between gap-3 pt-2\">\n <p className=\"text-sm text-text-secondary\">\n {tr(\n \"export.history.pagination.showing\",\n \"Showing {{start}}-{{end}} of {{total}}\",\n {\n start: pageStart,\n end: pageEnd,\n total: totalCount,\n },\n )}\n </p>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={handlePrevPage}\n disabled={!hasPrevPage}\n className=\"inline-flex items-center gap-1.5 px-3 py-1.5 text-sm border-2 border-border-subtle/50 rounded-lg hover:border-primary/30 disabled:opacity-40 disabled:cursor-not-allowed transition-colors font-medium\"\n >\n <ChevronLeft size={16} />\n {tr(\"export.history.pagination.prev\", \"Prev\")}\n </button>\n <span className=\"text-sm text-text-secondary px-2\">\n {tr(\"export.history.pagination.page\", \"Page {{page}}\", {\n page: pagination.page,\n })}\n </span>\n <button\n type=\"button\"\n onClick={handleNextPage}\n disabled={!hasNextPage}\n className=\"inline-flex items-center gap-1.5 px-3 py-1.5 text-sm border-2 border-border-subtle/50 rounded-lg hover:border-primary/30 disabled:opacity-40 disabled:cursor-not-allowed transition-colors font-medium\"\n >\n {tr(\"export.history.pagination.next\", \"Next\")}\n <ChevronRight size={16} />\n </button>\n </div>\n </div>\n )}\n </>\n ) : (\n <IllustratedEmptyState\n illustration={hasActiveFilters ? \"empty-search\" : \"empty-data\"}\n title={\n hasActiveFilters\n ? tr(\n \"export.history.empty.filtered.title\",\n \"No matching exports\",\n )\n : tr(\"export.history.empty.title\", \"No exports yet\")\n }\n description={\n hasActiveFilters\n ? tr(\n \"export.history.empty.filtered.description\",\n \"Try adjusting your search or filters.\",\n )\n : tr(\n \"export.history.empty.description\",\n \"Create your first export to see it here.\",\n )\n }\n action={\n hasActiveFilters ? (\n <button\n type=\"button\"\n onClick={handleResetFilters}\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.history.empty.filtered.actions.clear\",\n \"Clear Filters\",\n )}\n </button>\n ) : (\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, \"new\"))}\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 <Download size={16} />\n {tr(\n \"export.history.empty.actions.createFirst\",\n \"Create First Export\",\n )}\n </button>\n )\n }\n />\n ))}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAmCA,IAAMC,KAAY,GAAc,OACZC,EAAK,SAAS,GAAG,IAAIA,EAAK,MAAM,GAAG,EAAE,IAAIA,MACzCC,EAAK,WAAW,GAAG,IAAIA,IAAO,IAAIA;AAQtD,SAAgBC,IAAoB;CAClC,IAAM,EAAE,cAAW,KAAK,gBAAaC,EAAU,GACzCC,IAAKC,GAAM,GACX,EAAE,cAAW,iBAAc,iBAAa,eAAY,qBACxDC,EAAe,GACX,CAACC,KAAgBC,EAAgB,GAGjCC,IAAoBC,EAAO,EAAK;CACtC,QAAgB;EACd,IAAID,EAAkB,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AK,CAAA,GACpBpD,EACC,4CACA,qBACF,CACM;;GAGb,CAAA;EAEK;;AAEhB"}
1
+ {"version":3,"file":"ExportHistoryPage.js","names":["_Fragment","joinPath","base","path","ExportHistoryPage","useExport","tr","useTr","useExportStore","searchParams","useSearchParams","didInitFromUrlRef","useRef","statusParam","updateFilter","showFilters","setShowFilters","useState","cursorStack","setCursorStack","currentPageIndex","setCurrentPageIndex","currentCursor","jobs","useExportJobs","jobFilter","pagination","filteredJobs","useMemo","q","job","e","hasActiveFilters","handleJobClick","basePath","jobId","handleNextPage","pageInfo","newStack","prev","setPagination","handlePrevPage","prevIndex","handleResetFilters","resetFilter","applyServerFilter","change","hasPrevPage","hasNextPage","pageStart","pageEnd","totalCount","getStatusLabel","status","getStatusDisplayName","PageLayout","Clock","navigate","Download","PagePurpose","Search","cn","Filter","X","ThemedSelect","getAllStatuses","error","AlertCircle","refetch","RefreshCw","isLoading","i","Fragment","index","getFormatDisplayName","ExportStatusBadge","ChevronRight","ChevronLeft","IllustratedEmptyState"],"sources":["../../../src/export/pages/ExportHistoryPage.tsx"],"sourcesContent":["import { useState, useMemo, useEffect, useRef } from \"react\";\nimport { useSearchParams } from \"react-router\";\nimport {\n Search,\n X,\n Clock,\n Download,\n ChevronRight,\n ChevronLeft,\n RefreshCw,\n AlertCircle,\n Filter,\n} from \"lucide-react\";\nimport {\n IllustratedEmptyState,\n PagePurpose,\n ThemedSelect,\n} from \"@burdenoff/fe-libs/ui\";\nimport { useExport } from \"../providers/ExportProvider\";\nimport { useExportJobs } from \"../hooks/useExportQueries\";\nimport { useExportStore } from \"../store/exportStore\";\nimport { ExportStatusBadge } from \"../components/ExportStatusBadge\";\nimport { PageLayout } from \"../components/PageLayout\";\nimport { useTr } from \"../hooks/useTr\";\nimport { cn } from \"../utils/cn\";\nimport {\n getFormatDisplayName,\n getAllStatuses,\n getStatusDisplayName,\n} from \"../constants/enums\";\nimport type { ExportJobStatus, ExportFormat } from \"../types\";\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 History Page\n * Table/list of all past exports with filters and cursor-based pagination\n */\nexport function ExportHistoryPage() {\n const { basePath = \"/\", navigate } = useExport();\n const tr = useTr();\n const { jobFilter, updateFilter, resetFilter, pagination, setPagination } =\n useExportStore();\n const [searchParams] = useSearchParams();\n\n // Initialize status filter from URL search params (e.g. ?status=RUNNING) — once\n const didInitFromUrlRef = useRef(false);\n useEffect(() => {\n if (didInitFromUrlRef.current) return;\n didInitFromUrlRef.current = true;\n const statusParam = searchParams.get(\"status\");\n if (statusParam) {\n updateFilter({\n status: statusParam as ExportJobStatus,\n });\n }\n }, [searchParams, updateFilter]);\n\n const [showFilters, setShowFilters] = useState(false);\n // Cursor stack: index 0 = first page (no cursor), subsequent entries are \"after\" cursors\n const [cursorStack, setCursorStack] = useState<(string | null)[]>([null]);\n const [currentPageIndex, setCurrentPageIndex] = useState(0);\n\n const currentCursor = cursorStack[currentPageIndex] ?? null;\n\n const {\n data: jobs,\n totalCount,\n pageInfo,\n isLoading,\n error,\n refetch,\n } = useExportJobs(jobFilter, {\n first: pagination.pageSize,\n after: currentCursor ?? undefined,\n });\n\n // Client-side search filter (server-side filtering handles status/format)\n const filteredJobs = useMemo(() => {\n if (!jobFilter.search) return jobs;\n const q = jobFilter.search.toLowerCase();\n return jobs.filter(\n (job) =>\n job.name.toLowerCase().includes(q) ||\n job.entityTypes.some((e) => e.toLowerCase().includes(q)),\n );\n }, [jobs, jobFilter.search]);\n\n const hasActiveFilters =\n jobFilter.search ||\n jobFilter.status !== \"all\" ||\n jobFilter.format !== \"all\";\n\n const handleJobClick = (jobId: string) => {\n navigate?.(joinPath(basePath, jobId));\n };\n\n const handleNextPage = () => {\n if (!pageInfo?.hasNextPage || !pageInfo.endCursor) return;\n const newStack = [\n ...cursorStack.slice(0, currentPageIndex + 1),\n pageInfo.endCursor,\n ];\n setCursorStack(newStack);\n setCurrentPageIndex((prev) => prev + 1);\n setPagination({ page: pagination.page + 1, cursor: pageInfo.endCursor });\n };\n\n const handlePrevPage = () => {\n if (currentPageIndex === 0) return;\n const prevIndex = currentPageIndex - 1;\n setCurrentPageIndex(prevIndex);\n setPagination({\n page: pagination.page - 1,\n cursor: cursorStack[prevIndex] ?? null,\n });\n };\n\n const handleResetFilters = () => {\n resetFilter();\n setCursorStack([null]);\n setCurrentPageIndex(0);\n };\n\n // A status or format change is a new server-side query: drop the cursor too,\n // or the page shown is a later page of the old filter (not just its label).\n const applyServerFilter = (change: Parameters<typeof updateFilter>[0]) => {\n updateFilter(change);\n setCursorStack([null]);\n setCurrentPageIndex(0);\n };\n\n const hasPrevPage = currentPageIndex > 0;\n const hasNextPage = pageInfo?.hasNextPage ?? false;\n const pageStart = currentPageIndex * pagination.pageSize + 1;\n const pageEnd = Math.min(\n (currentPageIndex + 1) * pagination.pageSize,\n totalCount,\n );\n const getStatusLabel = (status: ExportJobStatus) =>\n tr(\n `export.shared.status.${status.toLowerCase()}`,\n getStatusDisplayName(status),\n );\n\n return (\n <PageLayout\n title={tr(\"export.history.title\", \"Export History\")}\n subtitle={tr(\n \"export.history.subtitle\",\n \"View and manage all your past export jobs\",\n )}\n icon={<Clock size={24} />}\n headerActions={\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, \"new\"))}\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 <Download size={16} />\n {tr(\"export.history.actions.newExport\", \"New Export\")}\n </button>\n }\n >\n {/* Page purpose — what History is for */}\n <PagePurpose icon={<Clock size={16} />}>\n {tr(\n \"export.history.purpose\",\n \"Every export you've ever started lives here. Track jobs as they run, see which finished or failed, and grab download links for completed exports before they expire. Search by name or entity type, or filter by status and format to find a specific one.\",\n )}\n </PagePurpose>\n\n {/* Search & Filters */}\n <div className=\"space-y-4\">\n <div className=\"flex flex-col sm:flex-row gap-3\">\n {/* Search */}\n <div className=\"flex-1 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.history.search.placeholder\",\n \"Search exports by name or entity type\",\n )}\n placeholder={tr(\n \"export.history.search.placeholder\",\n \"Search exports by name or entity type...\",\n )}\n value={jobFilter.search}\n onChange={(e) => updateFilter({ search: 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 </div>\n\n {/* Filter Toggle */}\n <button\n type=\"button\"\n onClick={() => setShowFilters(!showFilters)}\n className={cn(\n \"inline-flex items-center gap-2 px-4 py-2.5 border-2 rounded-lg transition-all duration-200 font-medium\",\n showFilters || hasActiveFilters\n ? \"bg-action-primary-bg text-action-primary-text border-primary\"\n : \"border-border-subtle/50 hover:border-primary/30\",\n )}\n >\n <Filter size={16} />\n {showFilters\n ? tr(\"export.history.filters.hide\", \"Hide\")\n : tr(\"export.history.filters.show\", \"Filter\")}\n </button>\n </div>\n\n {/* Filter Panel */}\n {showFilters && (\n <div className=\"border border-border-seam rounded-xl p-4 animate-in fade-in-0 duration-200\">\n <div className=\"flex items-center justify-between mb-4\">\n <h3 className=\"font-semibold flex items-center gap-2\">\n <Filter size={16} className=\"text-primary\" />\n {tr(\"export.history.filters.title\", \"Filters\")}\n </h3>\n {hasActiveFilters && (\n <button\n type=\"button\"\n onClick={handleResetFilters}\n className=\"text-sm text-text-secondary hover:text-status-error-text flex items-center gap-1\"\n >\n <X size={14} />\n {tr(\"export.history.filters.clearAll\", \"Clear All\")}\n </button>\n )}\n </div>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-4\">\n {/* Status Filter */}\n <div className=\"space-y-2\">\n <label className=\"block text-sm font-medium\">\n {tr(\"export.history.filters.status.label\", \"Status\")}\n </label>\n <ThemedSelect\n aria-label={tr(\n \"export.history.filters.status.label\",\n \"Status\",\n )}\n value={jobFilter.status}\n onChange={(e) =>\n applyServerFilter({\n status: e.target.value as ExportJobStatus | \"all\",\n })\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 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"all\">\n {tr(\"export.history.filters.status.all\", \"All Statuses\")}\n </option>\n {getAllStatuses().map((status) => (\n <option key={status} value={status}>\n {getStatusLabel(status)}\n </option>\n ))}\n </ThemedSelect>\n </div>\n\n {/* Format Filter — only CSV and JSON are supported */}\n <div className=\"space-y-2\">\n <label className=\"block text-sm font-medium\">\n {tr(\"export.history.filters.format.label\", \"Format\")}\n </label>\n <ThemedSelect\n aria-label={tr(\n \"export.history.filters.format.label\",\n \"Format\",\n )}\n value={jobFilter.format}\n onChange={(e) =>\n applyServerFilter({\n format: e.target.value as ExportFormat | \"all\",\n })\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 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"all\">\n {tr(\"export.history.filters.format.all\", \"All Formats\")}\n </option>\n <option value=\"CSV\">{tr(\"export.format.csv\", \"CSV\")}</option>\n <option value=\"JSON\">\n {tr(\"export.format.json\", \"JSON\")}\n </option>\n </ThemedSelect>\n </div>\n </div>\n </div>\n )}\n </div>\n\n {/* Error State */}\n {error && (\n <div className=\"border-2 border-border-default rounded-xl bg-status-error-bg-subtle p-6 flex items-start gap-4\">\n <AlertCircle\n size={24}\n className=\"text-status-error-text flex-shrink-0\"\n />\n <div>\n <h3 className=\"font-semibold text-status-error-text mb-1\">\n {tr(\"export.history.error.title\", \"Error loading exports\")}\n </h3>\n <p className=\"text-sm text-status-error-text mb-3\">\n {error.message}\n </p>\n <button\n type=\"button\"\n onClick={() => refetch()}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm bg-status-error-bg text-status-error-text rounded-lg hover:bg-status-error-bg/90 transition-colors\"\n >\n <RefreshCw size={14} />\n {tr(\"export.history.error.retry\", \"Try Again\")}\n </button>\n </div>\n </div>\n )}\n\n {/* Loading */}\n {isLoading && (\n <div className=\"space-y-3\">\n {[...Array(5)].map((_, i) => (\n <div key={i} className=\"border border-border-seam rounded-xl p-4\">\n <div className=\"flex items-center justify-between\">\n <div className=\"space-y-2\">\n <div className=\"h-4 w-48 bg-bg-sunken rounded animate-vc-shimmer\" />\n <div className=\"h-3 w-32 bg-bg-sunken rounded animate-vc-shimmer\" />\n </div>\n <div className=\"h-5 w-20 bg-bg-sunken rounded-full animate-vc-shimmer\" />\n </div>\n </div>\n ))}\n </div>\n )}\n\n {/* Jobs List */}\n {!isLoading &&\n !error &&\n (filteredJobs.length > 0 ? (\n <>\n <div className=\"space-y-2\">\n {filteredJobs.map((job, index) => (\n <button\n type=\"button\"\n key={job.id}\n onClick={() => handleJobClick(job.id)}\n className={cn(\n \"w-full text-left border border-border-seam rounded-xl p-4 bg-bg-surface\",\n \"hover:border-primary/40 transition-colors duration-200\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40\",\n \"group animate-in fade-in-0\",\n )}\n style={{ animationDelay: `${index * 30}ms` }}\n >\n <div className=\"flex items-start sm:items-center justify-between gap-3\">\n <div className=\"flex-1 min-w-0\">\n <h4 className=\"font-semibold text-text-primary truncate\">\n {job.name}\n </h4>\n <p className=\"text-sm text-text-secondary mt-1 line-clamp-2\">\n {job.entityTypes.join(\", \")} &middot;{\" \"}\n {getFormatDisplayName(job.format)}\n {job.createdAt &&\n ` · ${new Date(job.createdAt).toLocaleDateString()}`}\n </p>\n </div>\n <div className=\"flex items-center gap-2 flex-shrink-0\">\n <ExportStatusBadge status={job.status} />\n <ChevronRight\n size={18}\n className=\"text-text-secondary group-hover:text-primary transition-colors hidden sm:block\"\n />\n </div>\n </div>\n </button>\n ))}\n </div>\n\n {/* Pagination */}\n {totalCount > pagination.pageSize && (\n <div className=\"flex flex-col sm:flex-row items-center justify-between gap-3 pt-2\">\n <p className=\"text-sm text-text-secondary\">\n {tr(\n \"export.history.pagination.showing\",\n \"Showing {{start}}-{{end}} of {{total}}\",\n {\n start: pageStart,\n end: pageEnd,\n total: totalCount,\n },\n )}\n </p>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={handlePrevPage}\n disabled={!hasPrevPage}\n className=\"inline-flex items-center gap-1.5 px-3 py-1.5 text-sm border-2 border-border-subtle/50 rounded-lg hover:border-primary/30 disabled:opacity-40 disabled:cursor-not-allowed transition-colors font-medium\"\n >\n <ChevronLeft size={16} />\n {tr(\"export.history.pagination.prev\", \"Prev\")}\n </button>\n <span className=\"text-sm text-text-secondary px-2\">\n {tr(\"export.history.pagination.page\", \"Page {{page}}\", {\n page: pagination.page,\n })}\n </span>\n <button\n type=\"button\"\n onClick={handleNextPage}\n disabled={!hasNextPage}\n className=\"inline-flex items-center gap-1.5 px-3 py-1.5 text-sm border-2 border-border-subtle/50 rounded-lg hover:border-primary/30 disabled:opacity-40 disabled:cursor-not-allowed transition-colors font-medium\"\n >\n {tr(\"export.history.pagination.next\", \"Next\")}\n <ChevronRight size={16} />\n </button>\n </div>\n </div>\n )}\n </>\n ) : (\n <IllustratedEmptyState\n illustration={hasActiveFilters ? \"empty-search\" : \"empty-data\"}\n title={\n hasActiveFilters\n ? tr(\n \"export.history.empty.filtered.title\",\n \"No matching exports\",\n )\n : tr(\"export.history.empty.title\", \"No exports yet\")\n }\n description={\n hasActiveFilters\n ? tr(\n \"export.history.empty.filtered.description\",\n \"Try adjusting your search or filters.\",\n )\n : tr(\n \"export.history.empty.description\",\n \"Create your first export to see it here.\",\n )\n }\n action={\n hasActiveFilters ? (\n <button\n type=\"button\"\n onClick={handleResetFilters}\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.history.empty.filtered.actions.clear\",\n \"Clear Filters\",\n )}\n </button>\n ) : (\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, \"new\"))}\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 <Download size={16} />\n {tr(\n \"export.history.empty.actions.createFirst\",\n \"Create First Export\",\n )}\n </button>\n )\n }\n kind={\n jobFilter.search\n ? \"no-results\"\n : hasActiveFilters\n ? \"filtered\"\n : \"first-use\"\n }\n />\n ))}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAmCA,IAAMC,KAAY,GAAc,OACZC,EAAK,SAAS,GAAG,IAAIA,EAAK,MAAM,GAAG,EAAE,IAAIA,MACzCC,EAAK,WAAW,GAAG,IAAIA,IAAO,IAAIA;AAQtD,SAAgBC,IAAoB;CAClC,IAAM,EAAE,cAAW,KAAK,gBAAaC,EAAU,GACzCC,IAAKC,GAAM,GACX,EAAE,cAAW,iBAAc,iBAAa,eAAY,qBACxDC,EAAe,GACX,CAACC,KAAgBC,EAAgB,GAGjCC,IAAoBC,EAAO,EAAK;CACtC,QAAgB;EACd,IAAID,EAAkB,SAAS;EAC/B,EAAkB,UAAU;EAC5B,IAAME,IAAcJ,EAAa,IAAI,QAAQ;EAC7C,AAAII,KACFC,EAAa,EACX,QAAQD,EACV,CAAC;CAEL,GAAG,CAACJ,GAAcK,CAAY,CAAC;CAE/B,IAAM,CAACC,GAAaC,KAAkBC,EAAS,EAAK,GAE9C,CAACC,GAAaC,KAAkBF,EAA4B,CAAC,IAAI,CAAC,GAClE,CAACG,GAAkBC,KAAuBJ,EAAS,C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AD;OACE,MAAK;OACL,SAASV;OACT,UAAU,CAACM;OACX,WAAU;OAJZ,UAAA,CAME,kBAAC8B,IAAD,EAAa,MAAM,GAAK,CAAA,GACvBvE,EAAG,kCAAkC,MAAM,CACtC;;MACR,kBAAC,QAAD;OAAM,WAAU;OACb,UAAAA,EAAG,kCAAkC,iBAAiB,EACrD,MAAMoB,EAAW,KACnB,CAAC;MACG,CAAA;MACN,kBAAC,UAAD;OACE,MAAK;OACL,SAASU;OACT,UAAU,CAACY;OACX,WAAU;OAJZ,UAAA,CAMG1C,EAAG,kCAAkC,MAAM,GAC5C,kBAACsE,GAAD,EAAc,MAAM,GAAK,CAAA,CACnB;;KACL;IACF,CAAA,CAAA;GAEP,CAAA,CAAA,EAAA,CAAA,IAEF,kBAACE,GAAD;IACE,cAAc9C,IAAmB,iBAAiB;IAClD,OACEA,IACI1B,EACE,uCACA,qBACF,IACAA,EAAG,8BAA8B,gBAAgB;IAEvD,aACE0B,IACI1B,EACE,6CACA,uCACF,IACAA,EACE,oCACA,0CACF;IAEN,QACE0B,IACE,kBAAC,UAAD;KACE,MAAK;KACL,SAASW;KACT,WAAU;KAHZ,UAAA,CAKE,kBAACoB,GAAD,EAAG,MAAM,GAAK,CAAA,GACbzD,EACC,+CACA,eACF,CACM;IAER,CAAA,IAAA,kBAAC,UAAD;KACE,MAAK;KACL,eAAemD,IAAWxD,EAASiC,GAAU,KAAK,CAAC;KACnD,WAAU;KAHZ,UAAA,CAKE,kBAACwB,GAAD,EAAU,MAAM,GAAK,CAAA,GACpBpD,EACC,4CACA,qBACF,CACM;;IAGZ,MACEmB,EAAU,SACN,eACAO,IACE,aACA;GAET,CAAA;EAEK;;AAEhB"}
@@ -323,7 +323,9 @@ function y() {
323
323
  onClick: Y,
324
324
  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",
325
325
  children: [/* @__PURE__ */ m(f, { size: 16 }), x("export.templates.empty.actions.newTemplate", "New Template")]
326
- })
326
+ }),
327
+ kind: N ? "no-results" : "first-use",
328
+ glassIllustration: "documents"
327
329
  }),
328
330
  T ? /* @__PURE__ */ m(re, {
329
331
  open: q !== null,
@@ -1 +1 @@
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","ThemedSelect","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 ThemedSelect,\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 <ThemedSelect\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 </ThemedSelect>\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":";;;;;;;;;;;;;;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AAD;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"}
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","ThemedSelect","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 ThemedSelect,\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 <ThemedSelect\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 </ThemedSelect>\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 kind={searchQuery ? \"no-results\" : \"first-use\"}\n glassIllustration=\"documents\"\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":";;;;;;;;;;;;;;;;;;AA0CA,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,GAAgB,GAC/BC,IAAQC,GAAeH,CAAY,GACnC,EAAE,aAAaI,MAAoBC,GAAY,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,CAACK,GAAgBC,KAAqBN,EAAS,EAAK,GACpD,CAACO,GAAiBC,KAAsBR,EAAS,EAAE,GACnD,CAACS,GAAwBC,KAA6BV,EAAS,EAAE,GACjE,CAACW,GAAwBC,KAA6BZ,EAE1D,CAAC,CAAC,GACE,CAACa,GAAmBC,KACxBd,EAAuB,KAAK,GACxB,CAACe,GAAaC,KAAkBhB,EAAwB,IAAI,GAC5D,CAACiB,GAAuBC,KAA4BlB,EAExD,IAAI,GAE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,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"}
@@ -49,7 +49,8 @@ function M() {
49
49
  onClick: () => P?.(j(N, "templates")),
50
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",
51
51
  children: [/* @__PURE__ */ w(m, { size: 18 }), F("export.templateDetail.actions.backToTemplates", "Back to Templates")]
52
- })
52
+ }),
53
+ kind: "not-found"
53
54
  })]
54
55
  });
55
56
  let K = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateDetailPage.js","names":["joinPath","base","path","TemplateDetailPage","useParams","useExport","tr","useTr","showDeleteConfirm","setShowDeleteConfirm","useState","template","useExportTemplate","templateId","deleting","useDeleteExportTemplate","navigationV2","useNavigationV2","label","useEntityLabel","deleteError","setDeleteError","isLoading","Loader2","PageLayout","navigate","basePath","ArrowLeft","IllustratedEmptyState","handleUseTemplate","handleDelete","nativeImpact","deleteTemplate","nativeNotify","err","closeDeleteConfirm","overflowActions","Trash2","nextSteps","Play","FileBox","CTAOverflowMenu","FileText","getFormatDisplayName","HardDrive","getArchiveFormatDisplayName","Download","Clock","GlassCard","item","NextSteps","PageSection","ShowMore","entity","ConfirmDestructiveDialog","open"],"sources":["../../../src/export/pages/TemplateDetailPage.tsx"],"sourcesContent":["import { useParams } from \"react-router\";\nimport { useState } from \"react\";\nimport {\n ArrowLeft,\n FileBox,\n Download,\n Play,\n Trash2,\n Clock,\n FileText,\n HardDrive,\n Loader2,\n} from \"lucide-react\";\nimport {\n GlassCard,\n CTAOverflowMenu,\n ShowMore,\n IllustratedEmptyState,\n NextSteps,\n type NextStep,\n} from \"@burdenoff/fe-libs/ui\";\nimport type { CTAAction } from \"@burdenoff/fe-libs/ui\";\nimport { useExport } from \"../providers/ExportProvider\";\nimport {\n useExportTemplate,\n useDeleteExportTemplate,\n} from \"../hooks/useExportQueries\";\nimport {\n getFormatDisplayName,\n getArchiveFormatDisplayName,\n} from \"../constants/enums\";\nimport { PageLayout, PageSection } from \"../components/PageLayout\";\nimport { useTr } from \"../hooks/useTr\";\nimport { useEntityLabel } from \"../hooks/useEntityLabel\";\nimport { useNavigationV2 } from \"../navigation-v2/NavigationV2\";\nimport { ConfirmDestructiveDialog } from \"../components/ConfirmDestructiveDialog\";\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 * Template Detail Page\n * View template details and use it to create a new export.\n * Fetches template from the backend via useExportTemplate hook.\n */\nexport function TemplateDetailPage() {\n const { templateId } = useParams<{ templateId: string }>();\n const { basePath = \"/\", navigate } = useExport();\n const tr = useTr();\n const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);\n\n const { data: template, isLoading } = useExportTemplate(templateId);\n const { deleteTemplate, isPending: deleting } = useDeleteExportTemplate();\n const navigationV2 = useNavigationV2();\n const label = useEntityLabel(navigationV2);\n const [deleteError, setDeleteError] = useState<string | null>(null);\n\n // Loading\n if (isLoading) {\n return (\n <div className=\"flex flex-col items-center justify-center py-20\">\n <Loader2 size={48} className=\"animate-spin text-primary\" />\n <span className=\"mt-6 text-sm font-medium text-text-secondary\">\n {tr(\"export.templateDetail.loading\", \"Loading template details…\")}\n </span>\n </div>\n );\n }\n\n if (!template) {\n return (\n <PageLayout showHeader={false}>\n <div className=\"flex items-center gap-3 mb-6\">\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, \"templates\"))}\n aria-label={tr(\n \"export.templateDetail.actions.backToTemplates\",\n \"Back to templates\",\n )}\n className=\"p-2.5 hover:bg-accent rounded-lg transition-all duration-200\"\n >\n <ArrowLeft size={20} />\n </button>\n <h1 className=\"text-xl font-bold\">\n {tr(\"export.templateDetail.notFound.title\", \"Template Not Found\")}\n </h1>\n </div>\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title={tr(\n \"export.templateDetail.notFound.heading\",\n \"Template not found\",\n )}\n description={tr(\n \"export.templateDetail.notFound.description\",\n \"The template you are looking for does not exist.\",\n )}\n action={\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, \"templates\"))}\n 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\"\n >\n <ArrowLeft size={18} />\n {tr(\n \"export.templateDetail.actions.backToTemplates\",\n \"Back to Templates\",\n )}\n </button>\n }\n />\n </PageLayout>\n );\n }\n\n const handleUseTemplate = () => {\n // Navigate to new export page pre-selected with this template\n navigate?.(joinPath(basePath, `new?templateId=${templateId}`));\n };\n\n const handleDelete = async () => {\n if (!templateId) return;\n nativeImpact(\"medium\");\n setDeleteError(null);\n try {\n await deleteTemplate(templateId);\n nativeNotify(\"success\");\n navigate?.(joinPath(basePath, \"templates\"));\n } catch (err) {\n nativeNotify(\"error\");\n // Say why, instead of leaving the confirm open with no message.\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 }\n };\n\n const closeDeleteConfirm = () => {\n setShowDeleteConfirm(false);\n setDeleteError(null);\n };\n\n const overflowActions: CTAAction[] = template.isDefault\n ? []\n : [\n {\n label: tr(\"export.templateDetail.actions.delete\", \"Delete Template\"),\n icon: <Trash2 size={16} />,\n intent: \"destructive\",\n disabled: deleting,\n onSelect: () => setShowDeleteConfirm(true),\n },\n ];\n\n // Next-step guidance — what a new user would do with a saved template.\n const nextSteps: NextStep[] = [\n {\n id: \"use\",\n label: tr(\n \"export.templateDetail.nextSteps.use.label\",\n \"Start an export from this template\",\n ),\n description: tr(\n \"export.templateDetail.nextSteps.use.description\",\n \"Pre-fills a new export with this template's entity types and format.\",\n ),\n icon: <Play size={16} />,\n onClick: handleUseTemplate,\n },\n {\n id: \"browse\",\n label: tr(\n \"export.templateDetail.nextSteps.browse.label\",\n \"Browse all templates\",\n ),\n description: tr(\n \"export.templateDetail.nextSteps.browse.description\",\n \"Manage your other saved export configurations.\",\n ),\n icon: <FileBox size={16} />,\n onClick: () => navigate?.(joinPath(basePath, \"templates\")),\n },\n ];\n\n return (\n <PageLayout showHeader={false}>\n {/* Header */}\n <div className=\"relative overflow-hidden rounded-xl bg-accent-wash border border-border-seam p-6 shadow-[var(--shadow-pop)]\">\n <div className=\"relative z-10 flex flex-col sm:flex-row sm:items-center gap-4\">\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, \"templates\"))}\n aria-label={tr(\n \"export.templateDetail.actions.backToTemplates\",\n \"Back to templates\",\n )}\n 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\"\n >\n <ArrowLeft size={20} />\n </button>\n <div className=\"flex items-center gap-3 flex-1 min-w-0\">\n <div className=\"p-2.5 rounded-lg bg-action-primary-bg/10\">\n <FileBox size={24} className=\"text-primary\" />\n </div>\n <div className=\"flex-1 min-w-0\">\n <h1 className=\"text-xl sm:text-2xl font-bold truncate\">\n {template.name}\n </h1>\n <p className=\"text-sm text-text-secondary mt-1\">\n {template.isDefault\n ? tr(\n \"export.templateDetail.badge.default\",\n \"Default template\",\n )\n : tr(\"export.templateDetail.badge.custom\", \"Custom template\")}\n </p>\n </div>\n </div>\n <div className=\"flex-shrink-0\">\n <CTAOverflowMenu\n primary={{\n label: tr(\"export.templateDetail.actions.use\", \"Use Template\"),\n icon: <Play size={16} />,\n onSelect: handleUseTemplate,\n }}\n actions={overflowActions}\n />\n </div>\n </div>\n </div>\n\n {/* Description */}\n {template.description && (\n <div className=\"border border-border-seam rounded-xl p-5 bg-bg-surface\">\n <p className=\"text-sm text-text-secondary\">{template.description}</p>\n </div>\n )}\n\n {/* Info Grid */}\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4\">\n {[\n {\n icon: <FileText size={18} />,\n label: tr(\"export.templateDetail.info.format\", \"Format\"),\n value: getFormatDisplayName(template.format),\n },\n {\n icon: <HardDrive size={18} />,\n label: tr(\"export.templateDetail.info.archive\", \"Archive\"),\n // A saved setup stores no archive format: every download is\n // packaged the same way, so Navigation v2 says so instead of\n // presenting \"ZIP\" as a stored setting.\n value: navigationV2\n ? tr(\n \"export.templateDetail.info.archiveEvery\",\n \"Every download is a ZIP file\",\n )\n : getArchiveFormatDisplayName(\"ZIP\"),\n },\n {\n icon: <Download size={18} />,\n label: tr(\"export.templateDetail.info.entityTypes\", \"Entity Types\"),\n value: tr(\n \"export.templateDetail.info.entityTypesCount\",\n \"{{count}} type{{suffix}}\",\n {\n count: template.entityTypes.length,\n suffix: template.entityTypes.length !== 1 ? \"s\" : \"\",\n },\n ),\n },\n {\n icon: <Clock size={18} />,\n label: tr(\"export.templateDetail.info.lastUpdated\", \"Last Updated\"),\n value: new Date(template.updatedAt).toLocaleDateString(),\n },\n ].map((item) => (\n <GlassCard\n key={item.label}\n treatment=\"metric\"\n className=\"p-4 border-border-seam\"\n >\n <div className=\"flex items-center gap-2 text-text-secondary mb-1\">\n {item.icon}\n <span className=\"text-xs font-medium\">{item.label}</span>\n </div>\n <p className=\"font-bold text-lg tabular-nums\">{item.value}</p>\n </GlassCard>\n ))}\n </div>\n\n {/* Next-step guidance (dismissable, per-template). Navigation v2 drops\n it: it repeats the primary \"Use this setup\" button. */}\n {!navigationV2 && (\n <NextSteps\n storageKey={`export-template-${template.id}`}\n title={tr(\"export.templateDetail.nextSteps.title\", \"What's next\")}\n steps={nextSteps}\n />\n )}\n\n {/* Entity Types */}\n <PageSection\n title={tr(\n \"export.templateDetail.entityTypes.title\",\n \"Included Entity Types\",\n )}\n description={tr(\n \"export.templateDetail.entityTypes.description\",\n \"Data types that will be exported\",\n )}\n >\n <ShowMore collapsedHeight={96}>\n <div className=\"flex flex-wrap gap-2\">\n {template.entityTypes.map((entity) => (\n <span\n key={entity}\n 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\"\n >\n {label(entity)}\n </span>\n ))}\n </div>\n </ShowMore>\n </PageSection>\n\n {navigationV2 ? (\n <ConfirmDestructiveDialog\n open={showDeleteConfirm}\n onOpenChange={(open) => {\n if (!open) closeDeleteConfirm();\n }}\n title={tr(\"export.templates.delete.named\", \"Delete “{{name}}”?\", {\n name: template.name,\n })}\n description={tr(\n \"export.templateDetail.delete.description\",\n \"This removes the saved export configuration. Existing export jobs are not deleted.\",\n )}\n confirmLabel={tr(\n \"export.templateDetail.delete.confirmAction\",\n \"Delete Template\",\n )}\n keepLabel={tr(\"export.templateDetail.delete.keep\", \"Keep Template\")}\n busy={deleting}\n error={deleteError}\n onConfirm={() => void handleDelete()}\n />\n ) : (\n showDeleteConfirm && (\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby=\"template-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-delete-title\" className=\"text-lg font-bold\">\n {tr(\"export.templateDetail.delete.title\", \"Delete template?\")}\n </h2>\n <p className=\"mt-2 text-sm text-text-secondary\">\n {tr(\n \"export.templateDetail.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.templateDetail.delete.keep\", \"Keep Template\")}\n </button>\n <button\n type=\"button\"\n onClick={handleDelete}\n disabled={deleting}\n 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\"\n >\n {deleting ? (\n <Loader2 size={16} className=\"animate-spin\" />\n ) : null}\n {tr(\n \"export.templateDetail.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;AAStD,SAAgBC,IAAqB;CACnC,IAAM,EAAE,kBAAeC,EAAkC,GACnD,EAAE,cAAW,KAAK,gBAAaC,EAAU,GACzCC,IAAKC,EAAM,GACX,CAACC,GAAmBC,KAAwBC,EAAS,EAAK,GAE1D,EAAE,MAAMC,GAAU,iBAAcC,EAA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AEV,UAAA,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA;MACE,kBAAC,MAAD;OAAI,IAAG;OAAwB,WAAU;OACtC,UAAAF,EAAG,sCAAsC,kBAAkB;MAC1D,CAAA;MACJ,kBAAC,KAAD;OAAG,WAAU;OACV,UAAAA,EACC,4CACA,oFACF;MACC,CAAA;MACFc,KACC,kBAAC,KAAD;OACE,MAAK;OACL,WAAU;OAET,UAAAA;MACA,CAAA;MAEL,kBAAC,OAAD;OAAK,WAAU;OAAf,UAAA,CACE,kBAAC,UAAD;QACE,MAAK;QACL,SAASe;QACT,WAAU;QAET,UAAA7B,EAAG,qCAAqC,eAAe;OAClD,CAAA,GACR,kBAAC,UAAD;QACE,MAAK;QACL,SAASwB;QACT,UAAUhB;QACV,WAAU;QAJZ,UAAA,CAMGA,IACC,kBAACS,GAAD;SAAS,MAAM;SAAI,WAAU;QAAgB,CAAA,IAC3C,MACHjB,EACC,8CACA,iBACF,CACM;OACL,CAAA,CAAA;;KACF;;GACF,CAAA;EAGC;;AAEhB"}
1
+ {"version":3,"file":"TemplateDetailPage.js","names":["joinPath","base","path","TemplateDetailPage","useParams","useExport","tr","useTr","showDeleteConfirm","setShowDeleteConfirm","useState","template","useExportTemplate","templateId","deleting","useDeleteExportTemplate","navigationV2","useNavigationV2","label","useEntityLabel","deleteError","setDeleteError","isLoading","Loader2","PageLayout","navigate","basePath","ArrowLeft","IllustratedEmptyState","handleUseTemplate","handleDelete","nativeImpact","deleteTemplate","nativeNotify","err","closeDeleteConfirm","overflowActions","Trash2","nextSteps","Play","FileBox","CTAOverflowMenu","FileText","getFormatDisplayName","HardDrive","getArchiveFormatDisplayName","Download","Clock","GlassCard","item","NextSteps","PageSection","ShowMore","entity","ConfirmDestructiveDialog","open"],"sources":["../../../src/export/pages/TemplateDetailPage.tsx"],"sourcesContent":["import { useParams } from \"react-router\";\nimport { useState } from \"react\";\nimport {\n ArrowLeft,\n FileBox,\n Download,\n Play,\n Trash2,\n Clock,\n FileText,\n HardDrive,\n Loader2,\n} from \"lucide-react\";\nimport {\n GlassCard,\n CTAOverflowMenu,\n ShowMore,\n IllustratedEmptyState,\n NextSteps,\n type NextStep,\n} from \"@burdenoff/fe-libs/ui\";\nimport type { CTAAction } from \"@burdenoff/fe-libs/ui\";\nimport { useExport } from \"../providers/ExportProvider\";\nimport {\n useExportTemplate,\n useDeleteExportTemplate,\n} from \"../hooks/useExportQueries\";\nimport {\n getFormatDisplayName,\n getArchiveFormatDisplayName,\n} from \"../constants/enums\";\nimport { PageLayout, PageSection } from \"../components/PageLayout\";\nimport { useTr } from \"../hooks/useTr\";\nimport { useEntityLabel } from \"../hooks/useEntityLabel\";\nimport { useNavigationV2 } from \"../navigation-v2/NavigationV2\";\nimport { ConfirmDestructiveDialog } from \"../components/ConfirmDestructiveDialog\";\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 * Template Detail Page\n * View template details and use it to create a new export.\n * Fetches template from the backend via useExportTemplate hook.\n */\nexport function TemplateDetailPage() {\n const { templateId } = useParams<{ templateId: string }>();\n const { basePath = \"/\", navigate } = useExport();\n const tr = useTr();\n const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);\n\n const { data: template, isLoading } = useExportTemplate(templateId);\n const { deleteTemplate, isPending: deleting } = useDeleteExportTemplate();\n const navigationV2 = useNavigationV2();\n const label = useEntityLabel(navigationV2);\n const [deleteError, setDeleteError] = useState<string | null>(null);\n\n // Loading\n if (isLoading) {\n return (\n <div className=\"flex flex-col items-center justify-center py-20\">\n <Loader2 size={48} className=\"animate-spin text-primary\" />\n <span className=\"mt-6 text-sm font-medium text-text-secondary\">\n {tr(\"export.templateDetail.loading\", \"Loading template details…\")}\n </span>\n </div>\n );\n }\n\n if (!template) {\n return (\n <PageLayout showHeader={false}>\n <div className=\"flex items-center gap-3 mb-6\">\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, \"templates\"))}\n aria-label={tr(\n \"export.templateDetail.actions.backToTemplates\",\n \"Back to templates\",\n )}\n className=\"p-2.5 hover:bg-accent rounded-lg transition-all duration-200\"\n >\n <ArrowLeft size={20} />\n </button>\n <h1 className=\"text-xl font-bold\">\n {tr(\"export.templateDetail.notFound.title\", \"Template Not Found\")}\n </h1>\n </div>\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title={tr(\n \"export.templateDetail.notFound.heading\",\n \"Template not found\",\n )}\n description={tr(\n \"export.templateDetail.notFound.description\",\n \"The template you are looking for does not exist.\",\n )}\n action={\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, \"templates\"))}\n 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\"\n >\n <ArrowLeft size={18} />\n {tr(\n \"export.templateDetail.actions.backToTemplates\",\n \"Back to Templates\",\n )}\n </button>\n }\n kind=\"not-found\"\n />\n </PageLayout>\n );\n }\n\n const handleUseTemplate = () => {\n // Navigate to new export page pre-selected with this template\n navigate?.(joinPath(basePath, `new?templateId=${templateId}`));\n };\n\n const handleDelete = async () => {\n if (!templateId) return;\n nativeImpact(\"medium\");\n setDeleteError(null);\n try {\n await deleteTemplate(templateId);\n nativeNotify(\"success\");\n navigate?.(joinPath(basePath, \"templates\"));\n } catch (err) {\n nativeNotify(\"error\");\n // Say why, instead of leaving the confirm open with no message.\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 }\n };\n\n const closeDeleteConfirm = () => {\n setShowDeleteConfirm(false);\n setDeleteError(null);\n };\n\n const overflowActions: CTAAction[] = template.isDefault\n ? []\n : [\n {\n label: tr(\"export.templateDetail.actions.delete\", \"Delete Template\"),\n icon: <Trash2 size={16} />,\n intent: \"destructive\",\n disabled: deleting,\n onSelect: () => setShowDeleteConfirm(true),\n },\n ];\n\n // Next-step guidance — what a new user would do with a saved template.\n const nextSteps: NextStep[] = [\n {\n id: \"use\",\n label: tr(\n \"export.templateDetail.nextSteps.use.label\",\n \"Start an export from this template\",\n ),\n description: tr(\n \"export.templateDetail.nextSteps.use.description\",\n \"Pre-fills a new export with this template's entity types and format.\",\n ),\n icon: <Play size={16} />,\n onClick: handleUseTemplate,\n },\n {\n id: \"browse\",\n label: tr(\n \"export.templateDetail.nextSteps.browse.label\",\n \"Browse all templates\",\n ),\n description: tr(\n \"export.templateDetail.nextSteps.browse.description\",\n \"Manage your other saved export configurations.\",\n ),\n icon: <FileBox size={16} />,\n onClick: () => navigate?.(joinPath(basePath, \"templates\")),\n },\n ];\n\n return (\n <PageLayout showHeader={false}>\n {/* Header */}\n <div className=\"relative overflow-hidden rounded-xl bg-accent-wash border border-border-seam p-6 shadow-[var(--shadow-pop)]\">\n <div className=\"relative z-10 flex flex-col sm:flex-row sm:items-center gap-4\">\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, \"templates\"))}\n aria-label={tr(\n \"export.templateDetail.actions.backToTemplates\",\n \"Back to templates\",\n )}\n 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\"\n >\n <ArrowLeft size={20} />\n </button>\n <div className=\"flex items-center gap-3 flex-1 min-w-0\">\n <div className=\"p-2.5 rounded-lg bg-action-primary-bg/10\">\n <FileBox size={24} className=\"text-primary\" />\n </div>\n <div className=\"flex-1 min-w-0\">\n <h1 className=\"text-xl sm:text-2xl font-bold truncate\">\n {template.name}\n </h1>\n <p className=\"text-sm text-text-secondary mt-1\">\n {template.isDefault\n ? tr(\n \"export.templateDetail.badge.default\",\n \"Default template\",\n )\n : tr(\"export.templateDetail.badge.custom\", \"Custom template\")}\n </p>\n </div>\n </div>\n <div className=\"flex-shrink-0\">\n <CTAOverflowMenu\n primary={{\n label: tr(\"export.templateDetail.actions.use\", \"Use Template\"),\n icon: <Play size={16} />,\n onSelect: handleUseTemplate,\n }}\n actions={overflowActions}\n />\n </div>\n </div>\n </div>\n\n {/* Description */}\n {template.description && (\n <div className=\"border border-border-seam rounded-xl p-5 bg-bg-surface\">\n <p className=\"text-sm text-text-secondary\">{template.description}</p>\n </div>\n )}\n\n {/* Info Grid */}\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4\">\n {[\n {\n icon: <FileText size={18} />,\n label: tr(\"export.templateDetail.info.format\", \"Format\"),\n value: getFormatDisplayName(template.format),\n },\n {\n icon: <HardDrive size={18} />,\n label: tr(\"export.templateDetail.info.archive\", \"Archive\"),\n // A saved setup stores no archive format: every download is\n // packaged the same way, so Navigation v2 says so instead of\n // presenting \"ZIP\" as a stored setting.\n value: navigationV2\n ? tr(\n \"export.templateDetail.info.archiveEvery\",\n \"Every download is a ZIP file\",\n )\n : getArchiveFormatDisplayName(\"ZIP\"),\n },\n {\n icon: <Download size={18} />,\n label: tr(\"export.templateDetail.info.entityTypes\", \"Entity Types\"),\n value: tr(\n \"export.templateDetail.info.entityTypesCount\",\n \"{{count}} type{{suffix}}\",\n {\n count: template.entityTypes.length,\n suffix: template.entityTypes.length !== 1 ? \"s\" : \"\",\n },\n ),\n },\n {\n icon: <Clock size={18} />,\n label: tr(\"export.templateDetail.info.lastUpdated\", \"Last Updated\"),\n value: new Date(template.updatedAt).toLocaleDateString(),\n },\n ].map((item) => (\n <GlassCard\n key={item.label}\n treatment=\"metric\"\n className=\"p-4 border-border-seam\"\n >\n <div className=\"flex items-center gap-2 text-text-secondary mb-1\">\n {item.icon}\n <span className=\"text-xs font-medium\">{item.label}</span>\n </div>\n <p className=\"font-bold text-lg tabular-nums\">{item.value}</p>\n </GlassCard>\n ))}\n </div>\n\n {/* Next-step guidance (dismissable, per-template). Navigation v2 drops\n it: it repeats the primary \"Use this setup\" button. */}\n {!navigationV2 && (\n <NextSteps\n storageKey={`export-template-${template.id}`}\n title={tr(\"export.templateDetail.nextSteps.title\", \"What's next\")}\n steps={nextSteps}\n />\n )}\n\n {/* Entity Types */}\n <PageSection\n title={tr(\n \"export.templateDetail.entityTypes.title\",\n \"Included Entity Types\",\n )}\n description={tr(\n \"export.templateDetail.entityTypes.description\",\n \"Data types that will be exported\",\n )}\n >\n <ShowMore collapsedHeight={96}>\n <div className=\"flex flex-wrap gap-2\">\n {template.entityTypes.map((entity) => (\n <span\n key={entity}\n 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\"\n >\n {label(entity)}\n </span>\n ))}\n </div>\n </ShowMore>\n </PageSection>\n\n {navigationV2 ? (\n <ConfirmDestructiveDialog\n open={showDeleteConfirm}\n onOpenChange={(open) => {\n if (!open) closeDeleteConfirm();\n }}\n title={tr(\"export.templates.delete.named\", \"Delete “{{name}}”?\", {\n name: template.name,\n })}\n description={tr(\n \"export.templateDetail.delete.description\",\n \"This removes the saved export configuration. Existing export jobs are not deleted.\",\n )}\n confirmLabel={tr(\n \"export.templateDetail.delete.confirmAction\",\n \"Delete Template\",\n )}\n keepLabel={tr(\"export.templateDetail.delete.keep\", \"Keep Template\")}\n busy={deleting}\n error={deleteError}\n onConfirm={() => void handleDelete()}\n />\n ) : (\n showDeleteConfirm && (\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby=\"template-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-delete-title\" className=\"text-lg font-bold\">\n {tr(\"export.templateDetail.delete.title\", \"Delete template?\")}\n </h2>\n <p className=\"mt-2 text-sm text-text-secondary\">\n {tr(\n \"export.templateDetail.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.templateDetail.delete.keep\", \"Keep Template\")}\n </button>\n <button\n type=\"button\"\n onClick={handleDelete}\n disabled={deleting}\n 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\"\n >\n {deleting ? (\n <Loader2 size={16} className=\"animate-spin\" />\n ) : null}\n {tr(\n \"export.templateDetail.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;AAStD,SAAgBC,IAAqB;CACnC,IAAM,EAAE,kBAAeC,EAAkC,GACnD,EAAE,cAAW,KAAK,gBAAaC,EAAU,GACzCC,IAAKC,EAAM,GACX,CAACC,GAAmBC,KAAwBC,EAAS,EAAK,GAE1D,EAAE,MAAMC,GAAU,iBAAcC,EAAkBC,CAAU,GAC5D,EAAE,mBAAgB,WAAWC,MAAaC,EAAwB,GAClEC,IAAeC,EAAgB,GAC/BC,IAAQC,EAAeH,CAAY,GACnC,CAACI,GAAaC,KAAkBX,EAAwB,IAAI;CAGlE,IAAIY,GACF,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAACC,GAAD;GA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,KACC,kBAAC,KAAD;OACE,MAAK;OACL,WAAU;OAET,UAAAA;MACA,CAAA;MAEL,kBAAC,OAAD;OAAK,WAAU;OAAf,UAAA,CACE,kBAAC,UAAD;QACE,MAAK;QACL,SAASe;QACT,WAAU;QAET,UAAA7B,EAAG,qCAAqC,eAAe;OAClD,CAAA,GACR,kBAAC,UAAD;QACE,MAAK;QACL,SAASwB;QACT,UAAUhB;QACV,WAAU;QAJZ,UAAA,CAMGA,IACC,kBAACS,GAAD;SAAS,MAAM;SAAI,WAAU;QAAgB,CAAA,IAC3C,MACHjB,EACC,8CACA,iBACF,CACM;OACL,CAAA,CAAA;;KACF;;GACF,CAAA;EAGC;;AAEhB"}
@@ -47,7 +47,8 @@ function D() {
47
47
  size: 16,
48
48
  "aria-hidden": "true"
49
49
  }), j("export.downloads.backToList", "Back to Download your data")]
50
- })
50
+ }),
51
+ kind: "not-found"
51
52
  })
52
53
  });
53
54
  let J = d(q), le = ne(q.status), Y = te(q.status), X = async () => {
@@ -1 +1 @@
1
- {"version":3,"file":"DownloadDetailPage.js","names":["DownloadDetailPage","useParams","useExport","routerNavigate","useNavigate","tr","useTr","label","useEntityLabel","job","useExportJob","jobId","progressJob","useExportJobProgress","cancelling","useCancelExportJob","deleting","useDeleteExportJob","retrying","useRetryExportJob","pendingAction","setPendingAction","useState","actionError","setActionError","retryError","setRetryError","liveJob","handleBack","navigate","basePath","isLoading","Loader2","PageLayout","IllustratedEmptyState","ArrowLeft","archiveUrl","exportArchiveDownload","inProgress","isInProgress","retryable","canTryAgain","tryAgain","next","retryJob","joinPath","err","confirm","cancelJob","deleteJob","nativeNotify","tryAgainLabel","primary","Download","RotateCcw","overflow","XCircle","Trash2","nativeImpact","technical","getFormatDisplayName","getArchiveFormatDisplayName","DownloadStatus","CTAOverflowMenu","DownloadSections","ShowTechnicalDetails","ConfirmDestructiveDialog","open"],"sources":["../../../../src/export/pages/v2/DownloadDetailPage.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { useNavigate, useParams } from \"react-router\";\nimport {\n ArrowLeft,\n Download,\n Loader2,\n RotateCcw,\n Trash2,\n XCircle,\n} from \"lucide-react\";\nimport {\n CTAOverflowMenu,\n IllustratedEmptyState,\n ShowTechnicalDetails,\n type CTAAction,\n type CTAPrimaryAction,\n} from \"@burdenoff/fe-libs/ui\";\nimport { useExport } from \"../../providers/ExportProvider\";\nimport {\n useCancelExportJob,\n useDeleteExportJob,\n useExportJob,\n useExportJobProgress,\n useRetryExportJob,\n} from \"../../hooks/useExportQueries\";\nimport { useEntityLabel } from \"../../hooks/useEntityLabel\";\nimport { useTr } from \"../../hooks/useTr\";\nimport { PageLayout } from \"../../components/PageLayout\";\nimport { DownloadStatus } from \"../../components/DownloadStatus\";\nimport { ConfirmDestructiveDialog } from \"../../components/ConfirmDestructiveDialog\";\nimport { DownloadSections } from \"../../components/DownloadSections\";\nimport { exportArchiveDownload } from \"../../utils/exportAuthority\";\nimport { canTryAgain, isInProgress } from \"../../utils/downloadStatus\";\nimport {\n getArchiveFormatDisplayName,\n getFormatDisplayName,\n} from \"../../constants/enums\";\nimport { joinPath } from \"../../utils/paths\";\nimport { nativeImpact, nativeNotify } from \"../../../utils/nativeBridge\";\n\n/**\n * The download's own page (Navigation v2, BOFF-11870). One primary action:\n * \"Download all\" (the complete ZIP, every part) when ready, \"Try again\" when\n * it didn't finish. Cancel and Delete sit in \"⋯\" behind a confirm that names\n * the download. The raw error, format and archive sit under \"Show technical\n * details\"; the \"What's next\" panel is gone (it repeated the primary button).\n */\nexport function DownloadDetailPage() {\n const { jobId } = useParams<{ jobId: string }>();\n const { basePath = \"/\", navigate } = useExport();\n const routerNavigate = useNavigate();\n const tr = useTr();\n const label = useEntityLabel();\n\n const { data: job, isLoading } = useExportJob(jobId);\n const { data: progressJob } = useExportJobProgress(jobId);\n const { cancelJob, isPending: cancelling } = useCancelExportJob();\n const { deleteJob, isPending: deleting } = useDeleteExportJob();\n const { retryJob, isPending: retrying } = useRetryExportJob();\n\n const [pendingAction, setPendingAction] = useState<\n \"cancel\" | \"delete\" | null\n >(null);\n const [actionError, setActionError] = useState<string | null>(null);\n const [retryError, setRetryError] = useState<string | null>(null);\n\n const liveJob = progressJob ?? job ?? null;\n\n const handleBack = () => {\n if (window.history.length > 1) routerNavigate(-1);\n else navigate?.(basePath);\n };\n\n if (isLoading) {\n return (\n <div\n className=\"flex flex-col items-center justify-center py-20\"\n role=\"status\"\n >\n <Loader2\n size={40}\n className=\"animate-spin text-primary\"\n aria-hidden=\"true\"\n />\n <span className=\"mt-4 text-sm text-text-secondary\">\n {tr(\"export.detail.loading\", \"Loading export details…\")}\n </span>\n </div>\n );\n }\n\n if (!liveJob) {\n return (\n <PageLayout\n title={tr(\"export.detail.notFound.title\", \"Export Not Found\")}\n >\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title={tr(\"export.detail.notFound.heading\", \"Export not found\")}\n description={tr(\n \"export.detail.notFound.description\",\n \"The export job you are looking for does not exist or has been deleted.\",\n )}\n action={\n <button\n type=\"button\"\n onClick={() => navigate?.(basePath)}\n className=\"inline-flex items-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2 font-medium text-action-primary-text\"\n >\n <ArrowLeft size={16} aria-hidden=\"true\" />\n {tr(\"export.downloads.backToList\", \"Back to Download your data\")}\n </button>\n }\n />\n </PageLayout>\n );\n }\n\n const archiveUrl = exportArchiveDownload(liveJob);\n const inProgress = isInProgress(liveJob.status);\n const retryable = canTryAgain(liveJob.status);\n\n const tryAgain = async () => {\n setRetryError(null);\n try {\n const next = await retryJob(liveJob.id);\n if (next?.id) navigate?.(joinPath(basePath, next.id));\n } catch (err) {\n setRetryError(\n err instanceof Error && err.message\n ? err.message\n : tr(\n \"export.downloads.errors.retryFailed\",\n \"Couldn't start it again. Try once more.\",\n ),\n );\n }\n };\n\n const confirm = async () => {\n if (!pendingAction) return;\n setActionError(null);\n try {\n if (pendingAction === \"cancel\") {\n await cancelJob(liveJob.id);\n } else {\n await deleteJob(liveJob.id);\n navigate?.(basePath);\n }\n nativeNotify(\"success\");\n setPendingAction(null);\n } catch (err) {\n nativeNotify(\"error\");\n setActionError(\n err instanceof Error && err.message\n ? err.message\n : pendingAction === \"cancel\"\n ? tr(\n \"export.detail.confirm.cancelFailed\",\n \"Couldn't cancel. Try again.\",\n )\n : tr(\n \"export.detail.confirm.deleteFailed\",\n \"Couldn't delete. Try again.\",\n ),\n );\n }\n };\n\n const tryAgainLabel = tr(\"export.detail.actions.retry\", \"Retry Export\");\n const primary: CTAPrimaryAction | undefined = archiveUrl\n ? {\n label: tr(\"export.detail.actions.downloadAll\", \"Download all\"),\n icon: <Download size={16} />,\n onSelect: () => window.location.assign(archiveUrl),\n }\n : retryable\n ? {\n label: tryAgainLabel,\n icon: <RotateCcw size={16} />,\n disabled: retrying,\n onSelect: () => void tryAgain(),\n }\n : undefined;\n\n const overflow: CTAAction[] = [];\n if (archiveUrl && retryable) {\n overflow.push({\n label: tryAgainLabel,\n icon: <RotateCcw size={16} />,\n disabled: retrying,\n onSelect: () => void tryAgain(),\n });\n }\n if (inProgress) {\n overflow.push({\n label: tr(\"export.detail.actions.cancel\", \"Cancel Export\"),\n icon: <XCircle size={16} />,\n disabled: cancelling,\n onSelect: () => setPendingAction(\"cancel\"),\n });\n } else {\n overflow.push({\n label: tr(\"export.detail.actions.delete\", \"Delete Export\"),\n icon: <Trash2 size={16} />,\n intent: \"destructive\",\n disabled: deleting,\n onSelect: () => {\n nativeImpact(\"medium\");\n setPendingAction(\"delete\");\n },\n });\n }\n\n const technical = [\n `${tr(\"export.detail.info.format\", \"Format\")}: ${getFormatDisplayName(liveJob.format)}`,\n `${tr(\"export.detail.info.archive\", \"Archive\")}: ${getArchiveFormatDisplayName(liveJob.archiveFormat)}`,\n `ID: ${liveJob.id}`,\n ].join(\"\\n\");\n\n return (\n <PageLayout showHeader={false}>\n <header className=\"flex flex-col gap-4 sm:flex-row sm:items-center\">\n <button\n type=\"button\"\n onClick={handleBack}\n aria-label={tr(\"export.detail.actions.back\", \"Go back\")}\n className=\"self-start rounded-lg p-2 hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 sm:self-center\"\n >\n <ArrowLeft size={20} aria-hidden=\"true\" />\n </button>\n <div className=\"min-w-0 flex-1 space-y-1\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <h1 className=\"truncate text-xl font-bold text-text-primary sm:text-2xl\">\n {liveJob.name}\n </h1>\n <DownloadStatus status={liveJob.status} badge />\n </div>\n <p className=\"text-sm text-text-secondary\">\n {liveJob.entityTypes.map(label).join(\", \")}\n </p>\n </div>\n {(primary || overflow.length > 0) && (\n <div className=\"shrink-0\">\n <CTAOverflowMenu primary={primary} actions={overflow} />\n </div>\n )}\n </header>\n\n {retryError && (\n <p\n role=\"alert\"\n className=\"rounded-lg bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text\"\n >\n {retryError}\n </p>\n )}\n\n <DownloadSections job={liveJob} label={label} />\n\n <ShowTechnicalDetails copyable>{technical}</ShowTechnicalDetails>\n\n <ConfirmDestructiveDialog\n open={pendingAction !== null}\n onOpenChange={(open) => {\n if (!open) {\n setPendingAction(null);\n setActionError(null);\n }\n }}\n title={\n pendingAction === \"cancel\"\n ? tr(\"export.detail.confirm.cancel.named\", \"Cancel “{{name}}”?\", {\n name: liveJob.name,\n })\n : tr(\"export.detail.confirm.delete.named\", \"Delete “{{name}}”?\", {\n name: liveJob.name,\n })\n }\n description={\n pendingAction === \"cancel\"\n ? tr(\n \"export.detail.confirm.cancel.description\",\n \"This stops the running export job. You can retry it later if needed.\",\n )\n : tr(\n \"export.detail.confirm.delete.description\",\n \"This removes the export job from history. This action cannot be undone.\",\n )\n }\n confirmLabel={\n pendingAction === \"cancel\"\n ? tr(\"export.detail.actions.cancel\", \"Cancel Export\")\n : tr(\"export.detail.actions.delete\", \"Delete Export\")\n }\n keepLabel={tr(\"export.detail.confirm.keep\", \"Keep Export\")}\n busy={cancelling || deleting}\n error={actionError}\n onConfirm={()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UAAAA,EAAQ,YAAY,IAAIpB,CAAK,CAAC,CAAC,KAAK,IAAI;MACxC,CAAA,CACA;;MACH6C,KAAWG,EAAS,SAAS,MAC7B,kBAAC,OAAD;MAAK,WAAU;MACb,UAAA,kBAACQ,GAAD;OAA0B;OAAS,SAASR;MAAW,CAAA;KACpD,CAAA;IAED;;GAEP9B,KACC,kBAAC,KAAD;IACE,MAAK;IACL,WAAU;IAET,UAAAA;GACA,CAAA;GAGL,kBAACuC,GAAD;IAAkB,KAAKrC;IAAgB;GAAQ,CAAA;GAE/C,kBAACsC,GAAD;IAAsB,UAAA;IAAU,UAAAN;GAAgC,CAAA;GAEhE,kBAACO,GAAD;IACE,MAAM9C,MAAkB;IACxB,eAAe,MAAS;KACtB,AAAK+C,MACH9C,EAAiB,IAAI,GACrBG,EAAe,IAAI;IAEvB;IACA,OACEJ,MAAkB,WACdf,EAAG,sCAAsC,sBAAsB,EAC7D,MAAMsB,EAAQ,KAChB,CAAC,IACDtB,EAAG,sCAAsC,sBAAsB,EAC7D,MAAMsB,EAAQ,KAChB,CAAC;IAEP,aACEP,MAAkB,WACdf,EACE,4CACA,sEACF,IACAA,EACE,4CACA,yEACF;IAEN,cACEe,MAAkB,WACdf,EAAG,gCAAgC,eAAe,IAClDA,EAAG,gCAAgC,eAAe;IAExD,WAAWA,EAAG,8BAA8B,aAAa;IACzD,MAAMS,KAAcE;IACpB,OAAOO;IACP,iBAAiB,KAAKwB,GAAQ;GAC/B,CAAA;EACS;;AAEhB"}
1
+ {"version":3,"file":"DownloadDetailPage.js","names":["DownloadDetailPage","useParams","useExport","routerNavigate","useNavigate","tr","useTr","label","useEntityLabel","job","useExportJob","jobId","progressJob","useExportJobProgress","cancelling","useCancelExportJob","deleting","useDeleteExportJob","retrying","useRetryExportJob","pendingAction","setPendingAction","useState","actionError","setActionError","retryError","setRetryError","liveJob","handleBack","navigate","basePath","isLoading","Loader2","PageLayout","IllustratedEmptyState","ArrowLeft","archiveUrl","exportArchiveDownload","inProgress","isInProgress","retryable","canTryAgain","tryAgain","next","retryJob","joinPath","err","confirm","cancelJob","deleteJob","nativeNotify","tryAgainLabel","primary","Download","RotateCcw","overflow","XCircle","Trash2","nativeImpact","technical","getFormatDisplayName","getArchiveFormatDisplayName","DownloadStatus","CTAOverflowMenu","DownloadSections","ShowTechnicalDetails","ConfirmDestructiveDialog","open"],"sources":["../../../../src/export/pages/v2/DownloadDetailPage.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { useNavigate, useParams } from \"react-router\";\nimport {\n ArrowLeft,\n Download,\n Loader2,\n RotateCcw,\n Trash2,\n XCircle,\n} from \"lucide-react\";\nimport {\n CTAOverflowMenu,\n IllustratedEmptyState,\n ShowTechnicalDetails,\n type CTAAction,\n type CTAPrimaryAction,\n} from \"@burdenoff/fe-libs/ui\";\nimport { useExport } from \"../../providers/ExportProvider\";\nimport {\n useCancelExportJob,\n useDeleteExportJob,\n useExportJob,\n useExportJobProgress,\n useRetryExportJob,\n} from \"../../hooks/useExportQueries\";\nimport { useEntityLabel } from \"../../hooks/useEntityLabel\";\nimport { useTr } from \"../../hooks/useTr\";\nimport { PageLayout } from \"../../components/PageLayout\";\nimport { DownloadStatus } from \"../../components/DownloadStatus\";\nimport { ConfirmDestructiveDialog } from \"../../components/ConfirmDestructiveDialog\";\nimport { DownloadSections } from \"../../components/DownloadSections\";\nimport { exportArchiveDownload } from \"../../utils/exportAuthority\";\nimport { canTryAgain, isInProgress } from \"../../utils/downloadStatus\";\nimport {\n getArchiveFormatDisplayName,\n getFormatDisplayName,\n} from \"../../constants/enums\";\nimport { joinPath } from \"../../utils/paths\";\nimport { nativeImpact, nativeNotify } from \"../../../utils/nativeBridge\";\n\n/**\n * The download's own page (Navigation v2, BOFF-11870). One primary action:\n * \"Download all\" (the complete ZIP, every part) when ready, \"Try again\" when\n * it didn't finish. Cancel and Delete sit in \"⋯\" behind a confirm that names\n * the download. The raw error, format and archive sit under \"Show technical\n * details\"; the \"What's next\" panel is gone (it repeated the primary button).\n */\nexport function DownloadDetailPage() {\n const { jobId } = useParams<{ jobId: string }>();\n const { basePath = \"/\", navigate } = useExport();\n const routerNavigate = useNavigate();\n const tr = useTr();\n const label = useEntityLabel();\n\n const { data: job, isLoading } = useExportJob(jobId);\n const { data: progressJob } = useExportJobProgress(jobId);\n const { cancelJob, isPending: cancelling } = useCancelExportJob();\n const { deleteJob, isPending: deleting } = useDeleteExportJob();\n const { retryJob, isPending: retrying } = useRetryExportJob();\n\n const [pendingAction, setPendingAction] = useState<\n \"cancel\" | \"delete\" | null\n >(null);\n const [actionError, setActionError] = useState<string | null>(null);\n const [retryError, setRetryError] = useState<string | null>(null);\n\n const liveJob = progressJob ?? job ?? null;\n\n const handleBack = () => {\n if (window.history.length > 1) routerNavigate(-1);\n else navigate?.(basePath);\n };\n\n if (isLoading) {\n return (\n <div\n className=\"flex flex-col items-center justify-center py-20\"\n role=\"status\"\n >\n <Loader2\n size={40}\n className=\"animate-spin text-primary\"\n aria-hidden=\"true\"\n />\n <span className=\"mt-4 text-sm text-text-secondary\">\n {tr(\"export.detail.loading\", \"Loading export details…\")}\n </span>\n </div>\n );\n }\n\n if (!liveJob) {\n return (\n <PageLayout\n title={tr(\"export.detail.notFound.title\", \"Export Not Found\")}\n >\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title={tr(\"export.detail.notFound.heading\", \"Export not found\")}\n description={tr(\n \"export.detail.notFound.description\",\n \"The export job you are looking for does not exist or has been deleted.\",\n )}\n action={\n <button\n type=\"button\"\n onClick={() => navigate?.(basePath)}\n className=\"inline-flex items-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2 font-medium text-action-primary-text\"\n >\n <ArrowLeft size={16} aria-hidden=\"true\" />\n {tr(\"export.downloads.backToList\", \"Back to Download your data\")}\n </button>\n }\n kind=\"not-found\"\n />\n </PageLayout>\n );\n }\n\n const archiveUrl = exportArchiveDownload(liveJob);\n const inProgress = isInProgress(liveJob.status);\n const retryable = canTryAgain(liveJob.status);\n\n const tryAgain = async () => {\n setRetryError(null);\n try {\n const next = await retryJob(liveJob.id);\n if (next?.id) navigate?.(joinPath(basePath, next.id));\n } catch (err) {\n setRetryError(\n err instanceof Error && err.message\n ? err.message\n : tr(\n \"export.downloads.errors.retryFailed\",\n \"Couldn't start it again. Try once more.\",\n ),\n );\n }\n };\n\n const confirm = async () => {\n if (!pendingAction) return;\n setActionError(null);\n try {\n if (pendingAction === \"cancel\") {\n await cancelJob(liveJob.id);\n } else {\n await deleteJob(liveJob.id);\n navigate?.(basePath);\n }\n nativeNotify(\"success\");\n setPendingAction(null);\n } catch (err) {\n nativeNotify(\"error\");\n setActionError(\n err instanceof Error && err.message\n ? err.message\n : pendingAction === \"cancel\"\n ? tr(\n \"export.detail.confirm.cancelFailed\",\n \"Couldn't cancel. Try again.\",\n )\n : tr(\n \"export.detail.confirm.deleteFailed\",\n \"Couldn't delete. Try again.\",\n ),\n );\n }\n };\n\n const tryAgainLabel = tr(\"export.detail.actions.retry\", \"Retry Export\");\n const primary: CTAPrimaryAction | undefined = archiveUrl\n ? {\n label: tr(\"export.detail.actions.downloadAll\", \"Download all\"),\n icon: <Download size={16} />,\n onSelect: () => window.location.assign(archiveUrl),\n }\n : retryable\n ? {\n label: tryAgainLabel,\n icon: <RotateCcw size={16} />,\n disabled: retrying,\n onSelect: () => void tryAgain(),\n }\n : undefined;\n\n const overflow: CTAAction[] = [];\n if (archiveUrl && retryable) {\n overflow.push({\n label: tryAgainLabel,\n icon: <RotateCcw size={16} />,\n disabled: retrying,\n onSelect: () => void tryAgain(),\n });\n }\n if (inProgress) {\n overflow.push({\n label: tr(\"export.detail.actions.cancel\", \"Cancel Export\"),\n icon: <XCircle size={16} />,\n disabled: cancelling,\n onSelect: () => setPendingAction(\"cancel\"),\n });\n } else {\n overflow.push({\n label: tr(\"export.detail.actions.delete\", \"Delete Export\"),\n icon: <Trash2 size={16} />,\n intent: \"destructive\",\n disabled: deleting,\n onSelect: () => {\n nativeImpact(\"medium\");\n setPendingAction(\"delete\");\n },\n });\n }\n\n const technical = [\n `${tr(\"export.detail.info.format\", \"Format\")}: ${getFormatDisplayName(liveJob.format)}`,\n `${tr(\"export.detail.info.archive\", \"Archive\")}: ${getArchiveFormatDisplayName(liveJob.archiveFormat)}`,\n `ID: ${liveJob.id}`,\n ].join(\"\\n\");\n\n return (\n <PageLayout showHeader={false}>\n <header className=\"flex flex-col gap-4 sm:flex-row sm:items-center\">\n <button\n type=\"button\"\n onClick={handleBack}\n aria-label={tr(\"export.detail.actions.back\", \"Go back\")}\n className=\"self-start rounded-lg p-2 hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 sm:self-center\"\n >\n <ArrowLeft size={20} aria-hidden=\"true\" />\n </button>\n <div className=\"min-w-0 flex-1 space-y-1\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <h1 className=\"truncate text-xl font-bold text-text-primary sm:text-2xl\">\n {liveJob.name}\n </h1>\n <DownloadStatus status={liveJob.status} badge />\n </div>\n <p className=\"text-sm text-text-secondary\">\n {liveJob.entityTypes.map(label).join(\", \")}\n </p>\n </div>\n {(primary || overflow.length > 0) && (\n <div className=\"shrink-0\">\n <CTAOverflowMenu primary={primary} actions={overflow} />\n </div>\n )}\n </header>\n\n {retryError && (\n <p\n role=\"alert\"\n className=\"rounded-lg bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text\"\n >\n {retryError}\n </p>\n )}\n\n <DownloadSections job={liveJob} label={label} />\n\n <ShowTechnicalDetails copyable>{technical}</ShowTechnicalDetails>\n\n <ConfirmDestructiveDialog\n open={pendingAction !== null}\n onOpenChange={(open) => {\n if (!open) {\n setPendingAction(null);\n setActionError(null);\n }\n }}\n title={\n pendingAction === \"cancel\"\n ? tr(\"export.detail.confirm.cancel.named\", \"Cancel “{{name}}”?\", {\n name: liveJob.name,\n })\n : tr(\"export.detail.confirm.delete.named\", \"Delete “{{name}}”?\", {\n name: liveJob.name,\n })\n }\n description={\n pendingAction === \"cancel\"\n ? tr(\n \"export.detail.confirm.cancel.description\",\n \"This stops the running export job. You can retry it later if needed.\",\n )\n : tr(\n \"export.detail.confirm.delete.description\",\n \"This removes the export job from history. This action cannot be undone.\",\n )\n }\n confirmLabel={\n pendingAction === \"cancel\"\n ? tr(\"export.detail.actions.cancel\", \"Cancel Export\")\n : tr(\"export.detail.actions.delete\", \"Delete Export\")\n }\n keepLabel={tr(\"export.detail.confirm.keep\", \"Keep Export\")}\n busy={cancelling || deleting}\n error={actionError}\n onConfirm={() => void confirm()}\n />\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA+CA,SAAgBA,IAAqB;CACnC,IAAM,EAAE,aAAUC,GAA6B,GACzC,EAAE,cAAW,KAAK,gBAAaC,EAAU,GACzCC,IAAiBC,GAAY,GAC7BC,IAAKC,EAAM,GACXC,IAAQC,EAAe,GAEvB,EAAE,MAAMC,GAAK,iBAAcC,GAAaC,CAAK,GAC7C,EAAE,MAAMC,MAAgBC,EAAqBF,CAAK,GAClD,EAAE,cAAW,WAAWG,MAAeC,EAAmB,GAC1D,EAAE,eAAW,WAAWC,MAAaC,EAAmB,GACxD,EAAE,aAAU,WAAWC,MAAaC,EAAkB,GAEtD,CAACC,GAAeC,KAAoBC,EAExC,IAAI,GACA,CAACC,GAAaC,KAAkBF,EAAwB,IAAI,GAC5D,CAACG,GAAYC,KAAiBJ,EAAwB,IAAI,GAE1DK,IAAUf,KAAeH,KAAO,MAEhCmB,WAAmB;EACvB,AAAI,OAAO,QAAQ,SAAS,IAAGzB,EAAe,EAAE,IAC3C0B,IAAWC,CAAQ;CAC1B;CAEA,IAAIC,GACF,OACE,kBAAC,OAAD;EACE,WAAU;EACV,MAAK;EAFP,UAAA,CAIE,kBAACC,GAAD;GACE,MAAM;GACN,WAAU;GACV,eAAY;EACb,CAAA,GACD,kBAAC,QAAD;GAAM,WAAU;GACb,UAAA3B,EAAG,yBAAyB,yBAAyB;EAClD,CAAA,CACH;;CAIT,IAAI,CAACs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