@burdenoff/microfe-export 2026.1108.1 → 2026.1113.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/export/ExportRoot.js +45 -40
- package/dist/export/ExportRoot.js.map +1 -1
- package/dist/export/ExportRoutes.d.ts +7 -0
- package/dist/export/ExportRoutes.js +70 -51
- package/dist/export/ExportRoutes.js.map +1 -1
- package/dist/export/components/ConfirmDestructiveDialog.d.ts +21 -0
- package/dist/export/components/ConfirmDestructiveDialog.js +37 -0
- package/dist/export/components/ConfirmDestructiveDialog.js.map +1 -0
- package/dist/export/components/DownloadSections.d.ts +10 -0
- package/dist/export/components/DownloadSections.js +161 -0
- package/dist/export/components/DownloadSections.js.map +1 -0
- package/dist/export/components/DownloadStatus.d.ts +13 -0
- package/dist/export/components/DownloadStatus.js +36 -0
- package/dist/export/components/DownloadStatus.js.map +1 -0
- package/dist/export/components/DownloadsTabs.d.ts +5 -0
- package/dist/export/components/DownloadsTabs.js +25 -0
- package/dist/export/components/DownloadsTabs.js.map +1 -0
- package/dist/export/hooks/useEntityLabel.d.ts +7 -0
- package/dist/export/hooks/useEntityLabel.js +16 -0
- package/dist/export/hooks/useEntityLabel.js.map +1 -0
- package/dist/export/hooks/useExportQueries.d.ts +3 -1
- package/dist/export/hooks/useExportQueries.js +23 -23
- package/dist/export/hooks/useExportQueries.js.map +1 -1
- package/dist/export/navigation-v2/NavigationV2.d.ts +7 -0
- package/dist/export/navigation-v2/NavigationV2.js +16 -0
- package/dist/export/navigation-v2/NavigationV2.js.map +1 -0
- package/dist/export/pages/CreateExportPage.js +123 -121
- package/dist/export/pages/CreateExportPage.js.map +1 -1
- package/dist/export/pages/ExportDetailPage.js +131 -124
- package/dist/export/pages/ExportDetailPage.js.map +1 -1
- package/dist/export/pages/ExportHistoryPage.js +61 -57
- package/dist/export/pages/ExportHistoryPage.js.map +1 -1
- package/dist/export/pages/ExportTemplatesPage.js +214 -182
- package/dist/export/pages/ExportTemplatesPage.js.map +1 -1
- package/dist/export/pages/TemplateDetailPage.js +141 -119
- package/dist/export/pages/TemplateDetailPage.js.map +1 -1
- package/dist/export/pages/v2/DownloadDetailPage.d.ts +8 -0
- package/dist/export/pages/v2/DownloadDetailPage.js +176 -0
- package/dist/export/pages/v2/DownloadDetailPage.js.map +1 -0
- package/dist/export/pages/v2/DownloadsPage.d.ts +10 -0
- package/dist/export/pages/v2/DownloadsPage.js +401 -0
- package/dist/export/pages/v2/DownloadsPage.js.map +1 -0
- package/dist/export/pages/v2/NewDownloadPage.d.ts +8 -0
- package/dist/export/pages/v2/NewDownloadPage.js +440 -0
- package/dist/export/pages/v2/NewDownloadPage.js.map +1 -0
- package/dist/export/types/index.d.ts +7 -0
- package/dist/export/utils/billing.d.ts +6 -0
- package/dist/export/utils/billing.js +7 -0
- package/dist/export/utils/billing.js.map +1 -0
- package/dist/export/utils/downloadStatus.d.ts +15 -0
- package/dist/export/utils/downloadStatus.js +48 -0
- package/dist/export/utils/downloadStatus.js.map +1 -0
- package/dist/export/utils/entityLabels.d.ts +47 -0
- package/dist/export/utils/entityLabels.js +150 -0
- package/dist/export/utils/entityLabels.js.map +1 -0
- package/dist/export/utils/formatBytes.d.ts +2 -0
- package/dist/export/utils/formatBytes.js +15 -0
- package/dist/export/utils/formatBytes.js.map +1 -0
- package/dist/export/utils/newDownloadForm.d.ts +32 -0
- package/dist/export/utils/newDownloadForm.js +42 -0
- package/dist/export/utils/newDownloadForm.js.map +1 -0
- package/dist/export/utils/paths.d.ts +2 -0
- package/dist/export/utils/paths.js +7 -0
- package/dist/export/utils/paths.js.map +1 -0
- package/package.json +2 -2
|
@@ -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","isLoading","Loader2","PageLayout","navigate","basePath","ArrowLeft","IllustratedEmptyState","handleUseTemplate","handleDelete","deleteTemplate","nativeNotify","overflowActions","Trash2","nextSteps","Play","FileBox","CTAOverflowMenu","FileText","getFormatDisplayName","HardDrive","getArchiveFormatDisplayName","Download","Clock","GlassCard","item","NextSteps","PageSection","ShowMore","entity"],"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 { 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\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 try {\n await deleteTemplate(templateId);\n nativeNotify(\"success\");\n navigate?.(joinPath(basePath, \"templates\"));\n } catch {\n nativeNotify(\"error\");\n }\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 // Backend template doesn't carry archiveFormat, default to ZIP\n value: 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) */}\n <NextSteps\n storageKey={`export-template-${template.id}`}\n title={tr(\"export.templateDetail.nextSteps.title\", \"What's next\")}\n steps={nextSteps}\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 {entity}\n </span>\n ))}\n </div>\n </ShowMore>\n </PageSection>\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 <div className=\"mt-6 flex flex-col-reverse sm:flex-row sm:justify-end gap-3\">\n <button\n type=\"button\"\n onClick={() => setShowDeleteConfirm(false)}\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 </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAsCA,IAAMA,KAAY,GAAc,OACZC,EAAK,SAAS,GAAG,IAAIA,EAAK,MAAM,GAAG,EAAE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JZ,UAAA,CAMGA,IACC,kBAACG,GAAD;SAAS,MAAM;SAAI,WAAU;QAAgB,CAAA,IAC3C,MACHX,EACC,8CACA,iBACF,CACM;OACL,CAAA,CAAA;;KACF;;GACF,CAAA;EAEG;;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 />\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;GAAS,MAAM;GAAI,WAAU;EAA6B,CAAA,GAC1D,kBAAC,QAAD;GAAM,WAAU;GACb,UAAAjB,EAAG,iCAAiC,2BAA2B;EAC5D,CAAA,CACH;;CAIT,IAAI,CAACK,GACH,OACE,kBAACa,GAAD;EAAY,YAAY;EAAxB,UAAA,CACE,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAAC,UAAD;IACE,MAAK;IACL,eAAeC,IAAWzB,EAAS0B,GAAU,WAAW,CAAC;IACzD,cAAYpB,EACV,iDACA,mBACF;IACA,WAAU;IAEV,UAAA,kBAACqB,GAAD,EAAW,MAAM,GAAK,CAAA;GAChB,CAAA,GACR,kBAAC,MAAD;IAAI,WAAU;IACX,UAAArB,EAAG,wCAAwC,oBAAoB;GAC9D,CAAA,CACD;E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F-11870). One primary action:
|
|
3
|
+
* "Download all" (the complete ZIP, every part) when ready, "Try again" when
|
|
4
|
+
* it didn't finish. Cancel and Delete sit in "⋯" behind a confirm that names
|
|
5
|
+
* the download. The raw error, format and archive sit under "Show technical
|
|
6
|
+
* details"; the "What's next" panel is gone (it repeated the primary button).
|
|
7
|
+
*/
|
|
8
|
+
export declare function DownloadDetailPage(): import('react').JSX.Element;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { useExport as e } from "../../providers/ExportProvider.js";
|
|
2
|
+
import { useCancelExportJob as t, useDeleteExportJob as n, useExportJob as ee, useExportJobProgress as r, useRetryExportJob as i } from "../../hooks/useExportQueries.js";
|
|
3
|
+
import { useEntityLabel as a } from "../../hooks/useEntityLabel.js";
|
|
4
|
+
import { useTr as o } from "../../hooks/useTr.js";
|
|
5
|
+
import { PageLayout as s } from "../../components/PageLayout.js";
|
|
6
|
+
import { DownloadStatus as c } from "../../components/DownloadStatus.js";
|
|
7
|
+
import { ConfirmDestructiveDialog as l } from "../../components/ConfirmDestructiveDialog.js";
|
|
8
|
+
import { DownloadSections as u } from "../../components/DownloadSections.js";
|
|
9
|
+
import { exportArchiveDownload as d } from "../../utils/exportAuthority.js";
|
|
10
|
+
import { canTryAgain as te, isInProgress as ne } from "../../utils/downloadStatus.js";
|
|
11
|
+
import { getArchiveFormatDisplayName as re, getFormatDisplayName as f } from "../../constants/enums.js";
|
|
12
|
+
import { joinPath as p } from "../../utils/paths.js";
|
|
13
|
+
import { nativeImpact as m, nativeNotify as h } from "../../../utils/nativeBridge.js";
|
|
14
|
+
import { useState as g } from "react";
|
|
15
|
+
import { ArrowLeft as _, Download as v, Loader2 as y, RotateCcw as b, Trash2 as x, XCircle as ie } from "lucide-react";
|
|
16
|
+
import { useNavigate as ae, useParams as oe } from "react-router";
|
|
17
|
+
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
18
|
+
import { CTAOverflowMenu as w, IllustratedEmptyState as T, ShowTechnicalDetails as E } from "@burdenoff/fe-libs/ui";
|
|
19
|
+
// src/export/pages/v2/DownloadDetailPage.tsx
|
|
20
|
+
function D() {
|
|
21
|
+
let { jobId: D } = oe(), { basePath: O = "/", navigate: k } = e(), A = ae(), j = o(), M = a(), { data: N, isLoading: P } = ee(D), { data: F } = r(D), { cancelJob: I, isPending: L } = t(), { deleteJob: se, isPending: R } = n(), { retryJob: z, isPending: B } = i(), [V, H] = g(null), [U, W] = g(null), [G, K] = g(null), q = F ?? N ?? null, ce = () => {
|
|
22
|
+
window.history.length > 1 ? A(-1) : k?.(O);
|
|
23
|
+
};
|
|
24
|
+
if (P) return /* @__PURE__ */ C("div", {
|
|
25
|
+
className: "flex flex-col items-center justify-center py-20",
|
|
26
|
+
role: "status",
|
|
27
|
+
children: [/* @__PURE__ */ S(y, {
|
|
28
|
+
size: 40,
|
|
29
|
+
className: "animate-spin text-primary",
|
|
30
|
+
"aria-hidden": "true"
|
|
31
|
+
}), /* @__PURE__ */ S("span", {
|
|
32
|
+
className: "mt-4 text-sm text-text-secondary",
|
|
33
|
+
children: j("export.detail.loading", "Loading export details…")
|
|
34
|
+
})]
|
|
35
|
+
});
|
|
36
|
+
if (!q) return /* @__PURE__ */ S(s, {
|
|
37
|
+
title: j("export.detail.notFound.title", "Export Not Found"),
|
|
38
|
+
children: /* @__PURE__ */ S(T, {
|
|
39
|
+
illustration: "empty-data",
|
|
40
|
+
title: j("export.detail.notFound.heading", "Export not found"),
|
|
41
|
+
description: j("export.detail.notFound.description", "The export job you are looking for does not exist or has been deleted."),
|
|
42
|
+
action: /* @__PURE__ */ C("button", {
|
|
43
|
+
type: "button",
|
|
44
|
+
onClick: () => k?.(O),
|
|
45
|
+
className: "inline-flex items-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2 font-medium text-action-primary-text",
|
|
46
|
+
children: [/* @__PURE__ */ S(_, {
|
|
47
|
+
size: 16,
|
|
48
|
+
"aria-hidden": "true"
|
|
49
|
+
}), j("export.downloads.backToList", "Back to Download your data")]
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
let J = d(q), le = ne(q.status), Y = te(q.status), X = async () => {
|
|
54
|
+
K(null);
|
|
55
|
+
try {
|
|
56
|
+
let e = await z(q.id);
|
|
57
|
+
e?.id && k?.(p(O, e.id));
|
|
58
|
+
} catch (e) {
|
|
59
|
+
K(e instanceof Error && e.message ? e.message : j("export.downloads.errors.retryFailed", "Couldn't start it again. Try once more."));
|
|
60
|
+
}
|
|
61
|
+
}, ue = async () => {
|
|
62
|
+
if (V) {
|
|
63
|
+
W(null);
|
|
64
|
+
try {
|
|
65
|
+
V === "cancel" ? await I(q.id) : (await se(q.id), k?.(O)), h("success"), H(null);
|
|
66
|
+
} catch (e) {
|
|
67
|
+
h("error"), W(e instanceof Error && e.message ? e.message : V === "cancel" ? j("export.detail.confirm.cancelFailed", "Couldn't cancel. Try again.") : j("export.detail.confirm.deleteFailed", "Couldn't delete. Try again."));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}, Z = j("export.detail.actions.retry", "Retry Export"), Q = J ? {
|
|
71
|
+
label: j("export.detail.actions.downloadAll", "Download all"),
|
|
72
|
+
icon: /* @__PURE__ */ S(v, { size: 16 }),
|
|
73
|
+
onSelect: () => window.location.assign(J)
|
|
74
|
+
} : Y ? {
|
|
75
|
+
label: Z,
|
|
76
|
+
icon: /* @__PURE__ */ S(b, { size: 16 }),
|
|
77
|
+
disabled: B,
|
|
78
|
+
onSelect: () => void X()
|
|
79
|
+
} : void 0, $ = [];
|
|
80
|
+
J && Y && $.push({
|
|
81
|
+
label: Z,
|
|
82
|
+
icon: /* @__PURE__ */ S(b, { size: 16 }),
|
|
83
|
+
disabled: B,
|
|
84
|
+
onSelect: () => void X()
|
|
85
|
+
}), le ? $.push({
|
|
86
|
+
label: j("export.detail.actions.cancel", "Cancel Export"),
|
|
87
|
+
icon: /* @__PURE__ */ S(ie, { size: 16 }),
|
|
88
|
+
disabled: L,
|
|
89
|
+
onSelect: () => H("cancel")
|
|
90
|
+
}) : $.push({
|
|
91
|
+
label: j("export.detail.actions.delete", "Delete Export"),
|
|
92
|
+
icon: /* @__PURE__ */ S(x, { size: 16 }),
|
|
93
|
+
intent: "destructive",
|
|
94
|
+
disabled: R,
|
|
95
|
+
onSelect: () => {
|
|
96
|
+
m("medium"), H("delete");
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
let de = [
|
|
100
|
+
`${j("export.detail.info.format", "Format")}: ${f(q.format)}`,
|
|
101
|
+
`${j("export.detail.info.archive", "Archive")}: ${re(q.archiveFormat)}`,
|
|
102
|
+
`ID: ${q.id}`
|
|
103
|
+
].join("\n");
|
|
104
|
+
return /* @__PURE__ */ C(s, {
|
|
105
|
+
showHeader: !1,
|
|
106
|
+
children: [
|
|
107
|
+
/* @__PURE__ */ C("header", {
|
|
108
|
+
className: "flex flex-col gap-4 sm:flex-row sm:items-center",
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ S("button", {
|
|
111
|
+
type: "button",
|
|
112
|
+
onClick: ce,
|
|
113
|
+
"aria-label": j("export.detail.actions.back", "Go back"),
|
|
114
|
+
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",
|
|
115
|
+
children: /* @__PURE__ */ S(_, {
|
|
116
|
+
size: 20,
|
|
117
|
+
"aria-hidden": "true"
|
|
118
|
+
})
|
|
119
|
+
}),
|
|
120
|
+
/* @__PURE__ */ C("div", {
|
|
121
|
+
className: "min-w-0 flex-1 space-y-1",
|
|
122
|
+
children: [/* @__PURE__ */ C("div", {
|
|
123
|
+
className: "flex flex-wrap items-center gap-2",
|
|
124
|
+
children: [/* @__PURE__ */ S("h1", {
|
|
125
|
+
className: "truncate text-xl font-bold text-text-primary sm:text-2xl",
|
|
126
|
+
children: q.name
|
|
127
|
+
}), /* @__PURE__ */ S(c, {
|
|
128
|
+
status: q.status,
|
|
129
|
+
badge: !0
|
|
130
|
+
})]
|
|
131
|
+
}), /* @__PURE__ */ S("p", {
|
|
132
|
+
className: "text-sm text-text-secondary",
|
|
133
|
+
children: q.entityTypes.map(M).join(", ")
|
|
134
|
+
})]
|
|
135
|
+
}),
|
|
136
|
+
(Q || $.length > 0) && /* @__PURE__ */ S("div", {
|
|
137
|
+
className: "shrink-0",
|
|
138
|
+
children: /* @__PURE__ */ S(w, {
|
|
139
|
+
primary: Q,
|
|
140
|
+
actions: $
|
|
141
|
+
})
|
|
142
|
+
})
|
|
143
|
+
]
|
|
144
|
+
}),
|
|
145
|
+
G && /* @__PURE__ */ S("p", {
|
|
146
|
+
role: "alert",
|
|
147
|
+
className: "rounded-lg bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
|
|
148
|
+
children: G
|
|
149
|
+
}),
|
|
150
|
+
/* @__PURE__ */ S(u, {
|
|
151
|
+
job: q,
|
|
152
|
+
label: M
|
|
153
|
+
}),
|
|
154
|
+
/* @__PURE__ */ S(E, {
|
|
155
|
+
copyable: !0,
|
|
156
|
+
children: de
|
|
157
|
+
}),
|
|
158
|
+
/* @__PURE__ */ S(l, {
|
|
159
|
+
open: V !== null,
|
|
160
|
+
onOpenChange: (e) => {
|
|
161
|
+
e || (H(null), W(null));
|
|
162
|
+
},
|
|
163
|
+
title: V === "cancel" ? j("export.detail.confirm.cancel.named", "Cancel “{{name}}”?", { name: q.name }) : j("export.detail.confirm.delete.named", "Delete “{{name}}”?", { name: q.name }),
|
|
164
|
+
description: V === "cancel" ? j("export.detail.confirm.cancel.description", "This stops the running export job. You can retry it later if needed.") : j("export.detail.confirm.delete.description", "This removes the export job from history. This action cannot be undone."),
|
|
165
|
+
confirmLabel: V === "cancel" ? j("export.detail.actions.cancel", "Cancel Export") : j("export.detail.actions.delete", "Delete Export"),
|
|
166
|
+
keepLabel: j("export.detail.confirm.keep", "Keep Export"),
|
|
167
|
+
busy: L || R,
|
|
168
|
+
error: U,
|
|
169
|
+
onConfirm: () => void ue()
|
|
170
|
+
})
|
|
171
|
+
]
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
export { D as DownloadDetailPage };
|
|
175
|
+
|
|
176
|
+
//# sourceMappingURL=DownloadDetailPage.js.map
|
|
@@ -0,0 +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={() => 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,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tB,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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** "More filters" appears once the list is long enough to need it. */
|
|
2
|
+
export declare const FILTERS_THRESHOLD = 5;
|
|
3
|
+
/**
|
|
4
|
+
* "Download your data" (Navigation v2, BOFF-11870): the one list that
|
|
5
|
+
* replaces the Dashboard and History tabs. Level 1 is the "New download"
|
|
6
|
+
* button, the "In progress" block and the downloads with Download / Try again
|
|
7
|
+
* on each row. The summary numbers sit under "⋯", search and the status and
|
|
8
|
+
* format filters under "More filters", and Saved setups under "More ▾".
|
|
9
|
+
*/
|
|
10
|
+
export declare function DownloadsPage(): import('react').JSX.Element;
|