@burdenoff/microfe-export 2026.1108.1 → 2026.1113.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/export/ExportRoot.js +45 -40
  2. package/dist/export/ExportRoot.js.map +1 -1
  3. package/dist/export/ExportRoutes.d.ts +7 -0
  4. package/dist/export/ExportRoutes.js +70 -51
  5. package/dist/export/ExportRoutes.js.map +1 -1
  6. package/dist/export/components/ConfirmDestructiveDialog.d.ts +21 -0
  7. package/dist/export/components/ConfirmDestructiveDialog.js +37 -0
  8. package/dist/export/components/ConfirmDestructiveDialog.js.map +1 -0
  9. package/dist/export/components/DownloadSections.d.ts +10 -0
  10. package/dist/export/components/DownloadSections.js +161 -0
  11. package/dist/export/components/DownloadSections.js.map +1 -0
  12. package/dist/export/components/DownloadStatus.d.ts +13 -0
  13. package/dist/export/components/DownloadStatus.js +36 -0
  14. package/dist/export/components/DownloadStatus.js.map +1 -0
  15. package/dist/export/components/DownloadsTabs.d.ts +5 -0
  16. package/dist/export/components/DownloadsTabs.js +25 -0
  17. package/dist/export/components/DownloadsTabs.js.map +1 -0
  18. package/dist/export/hooks/useEntityLabel.d.ts +7 -0
  19. package/dist/export/hooks/useEntityLabel.js +16 -0
  20. package/dist/export/hooks/useEntityLabel.js.map +1 -0
  21. package/dist/export/hooks/useExportQueries.d.ts +7 -1
  22. package/dist/export/hooks/useExportQueries.js +40 -36
  23. package/dist/export/hooks/useExportQueries.js.map +1 -1
  24. package/dist/export/navigation-v2/NavigationV2.d.ts +7 -0
  25. package/dist/export/navigation-v2/NavigationV2.js +16 -0
  26. package/dist/export/navigation-v2/NavigationV2.js.map +1 -0
  27. package/dist/export/pages/CreateExportPage.js +123 -121
  28. package/dist/export/pages/CreateExportPage.js.map +1 -1
  29. package/dist/export/pages/ExportDetailPage.js +131 -124
  30. package/dist/export/pages/ExportDetailPage.js.map +1 -1
  31. package/dist/export/pages/ExportHistoryPage.js +61 -57
  32. package/dist/export/pages/ExportHistoryPage.js.map +1 -1
  33. package/dist/export/pages/ExportTemplatesPage.js +214 -182
  34. package/dist/export/pages/ExportTemplatesPage.js.map +1 -1
  35. package/dist/export/pages/TemplateDetailPage.js +141 -119
  36. package/dist/export/pages/TemplateDetailPage.js.map +1 -1
  37. package/dist/export/pages/v2/DownloadDetailPage.d.ts +8 -0
  38. package/dist/export/pages/v2/DownloadDetailPage.js +176 -0
  39. package/dist/export/pages/v2/DownloadDetailPage.js.map +1 -0
  40. package/dist/export/pages/v2/DownloadsPage.d.ts +10 -0
  41. package/dist/export/pages/v2/DownloadsPage.js +401 -0
  42. package/dist/export/pages/v2/DownloadsPage.js.map +1 -0
  43. package/dist/export/pages/v2/NewDownloadPage.d.ts +8 -0
  44. package/dist/export/pages/v2/NewDownloadPage.js +440 -0
  45. package/dist/export/pages/v2/NewDownloadPage.js.map +1 -0
  46. package/dist/export/types/index.d.ts +7 -0
  47. package/dist/export/utils/billing.d.ts +6 -0
  48. package/dist/export/utils/billing.js +7 -0
  49. package/dist/export/utils/billing.js.map +1 -0
  50. package/dist/export/utils/downloadStatus.d.ts +15 -0
  51. package/dist/export/utils/downloadStatus.js +48 -0
  52. package/dist/export/utils/downloadStatus.js.map +1 -0
  53. package/dist/export/utils/entityLabels.d.ts +47 -0
  54. package/dist/export/utils/entityLabels.js +150 -0
  55. package/dist/export/utils/entityLabels.js.map +1 -0
  56. package/dist/export/utils/formatBytes.d.ts +2 -0
  57. package/dist/export/utils/formatBytes.js +15 -0
  58. package/dist/export/utils/formatBytes.js.map +1 -0
  59. package/dist/export/utils/newDownloadForm.d.ts +32 -0
  60. package/dist/export/utils/newDownloadForm.js +42 -0
  61. package/dist/export/utils/newDownloadForm.js.map +1 -0
  62. package/dist/export/utils/paths.d.ts +2 -0
  63. package/dist/export/utils/paths.js +7 -0
  64. package/dist/export/utils/paths.js.map +1 -0
  65. package/package.json +2 -2
@@ -0,0 +1,161 @@
1
+ import { useTr as e } from "../hooks/useTr.js";
2
+ import { PageSection as t } from "./PageLayout.js";
3
+ import { ExportProgressBar as n } from "./ExportProgressBar.js";
4
+ import { formatBytes as r } from "../utils/formatBytes.js";
5
+ import { isInProgress as i } from "../utils/downloadStatus.js";
6
+ import { AlertCircle as a, CheckCircle2 as o, Clock as s, Download as c, FileDown as l, HardDrive as u } from "lucide-react";
7
+ import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
8
+ import { GlassCard as m, ShowTechnicalDetails as h } from "@burdenoff/fe-libs/ui";
9
+ // src/export/components/DownloadSections.tsx
10
+ function g({ job: g, label: _ }) {
11
+ let v = e(), y = i(g.status);
12
+ return /* @__PURE__ */ p(d, { children: [
13
+ y && /* @__PURE__ */ p("div", {
14
+ className: "space-y-2 rounded-xl border border-border-subtle bg-bg-surface p-5",
15
+ role: "status",
16
+ children: [
17
+ /* @__PURE__ */ f("p", {
18
+ className: "font-medium text-text-primary",
19
+ children: v("export.detail.progress.preparing", "Preparing your files…")
20
+ }),
21
+ /* @__PURE__ */ f(n, {
22
+ progress: g.progress,
23
+ size: "md"
24
+ }),
25
+ g.processedEntities != null && g.totalEntities != null && /* @__PURE__ */ f("p", {
26
+ className: "text-sm text-text-secondary",
27
+ children: v("export.detail.progress.items", "{{processed}} of {{total}} items ready", {
28
+ processed: g.processedEntities.toLocaleString(),
29
+ total: g.totalEntities.toLocaleString()
30
+ })
31
+ })
32
+ ]
33
+ }),
34
+ g.status === "FAILED" && /* @__PURE__ */ p("div", {
35
+ className: "flex items-start gap-3 rounded-xl border border-border-default bg-status-error-bg-subtle p-5",
36
+ children: [/* @__PURE__ */ f(a, {
37
+ size: 20,
38
+ "aria-hidden": "true",
39
+ className: "mt-0.5 shrink-0 text-status-error-text"
40
+ }), /* @__PURE__ */ p("div", {
41
+ className: "min-w-0 space-y-2",
42
+ children: [
43
+ /* @__PURE__ */ f("p", {
44
+ className: "font-medium text-status-error-text",
45
+ children: v("export.detail.failed.title", "This download didn't finish")
46
+ }),
47
+ /* @__PURE__ */ f("p", {
48
+ className: "text-sm text-text-secondary",
49
+ children: v("export.detail.failed.description", "Try again. If it stops again, pick less data or a shorter date range.")
50
+ }),
51
+ g.errorMessage ? /* @__PURE__ */ f(h, {
52
+ copyable: !0,
53
+ children: g.errorMessage
54
+ }) : null
55
+ ]
56
+ })]
57
+ }),
58
+ g.status === "EXPIRED" && /* @__PURE__ */ f("p", {
59
+ className: "rounded-xl border border-border-subtle bg-bg-surface p-4 text-sm text-text-secondary",
60
+ children: v("export.detail.expired.description", "The download link has expired. Try again to make a fresh copy.")
61
+ }),
62
+ /* @__PURE__ */ f("div", {
63
+ className: "grid grid-cols-1 gap-3 sm:grid-cols-2",
64
+ children: [{
65
+ icon: /* @__PURE__ */ f(u, {
66
+ size: 16,
67
+ "aria-hidden": "true"
68
+ }),
69
+ name: v("export.detail.info.totalSize", "Total Size"),
70
+ value: g.totalSizeBytes == null ? "-" : r(g.totalSizeBytes)
71
+ }, {
72
+ icon: /* @__PURE__ */ f(s, {
73
+ size: 16,
74
+ "aria-hidden": "true"
75
+ }),
76
+ name: v("export.detail.info.created", "Created"),
77
+ value: new Date(g.createdAt).toLocaleDateString()
78
+ }].map((e) => /* @__PURE__ */ p(m, {
79
+ treatment: "metric",
80
+ className: "border-border-seam p-4",
81
+ children: [/* @__PURE__ */ p("div", {
82
+ className: "mb-1 flex items-center gap-2 text-text-secondary",
83
+ children: [e.icon, /* @__PURE__ */ f("span", {
84
+ className: "text-xs font-medium",
85
+ children: e.name
86
+ })]
87
+ }), /* @__PURE__ */ f("p", {
88
+ className: "text-lg font-bold tabular-nums",
89
+ children: e.value
90
+ })]
91
+ }, e.name))
92
+ }),
93
+ g.parts.length > 0 && /* @__PURE__ */ f(t, {
94
+ title: v("export.detail.parts.title", "Export Parts"),
95
+ children: /* @__PURE__ */ f("ul", {
96
+ className: "space-y-2",
97
+ children: g.parts.map((e) => /* @__PURE__ */ p("li", {
98
+ className: "flex flex-col gap-3 rounded-xl border border-border-subtle bg-bg-surface p-4 sm:flex-row sm:items-center sm:justify-between",
99
+ children: [/* @__PURE__ */ p("div", {
100
+ className: "flex min-w-0 items-center gap-3",
101
+ children: [/* @__PURE__ */ f(l, {
102
+ size: 20,
103
+ "aria-hidden": "true",
104
+ className: "shrink-0 text-text-secondary"
105
+ }), /* @__PURE__ */ p("div", {
106
+ className: "min-w-0",
107
+ children: [/* @__PURE__ */ f("p", {
108
+ className: "truncate font-medium",
109
+ children: e.fileName
110
+ }), /* @__PURE__ */ p("p", {
111
+ className: "text-sm text-text-secondary",
112
+ children: [
113
+ e.entityTypes.map(_).join(", "),
114
+ " ·",
115
+ " ",
116
+ r(e.sizeBytes),
117
+ e.downloadExpiresAt && ` · ${v("export.detail.parts.availableUntil", "Available until {{date}}", { date: new Date(e.downloadExpiresAt).toLocaleDateString() })}`
118
+ ]
119
+ })]
120
+ })]
121
+ }), e.downloadUrl ? /* @__PURE__ */ p("a", {
122
+ href: e.downloadUrl,
123
+ className: "inline-flex shrink-0 items-center gap-2 self-start rounded-lg border border-border-subtle px-3 py-1.5 text-sm font-medium hover:bg-accent sm:self-auto",
124
+ "aria-label": v("export.detail.parts.downloadAria", "Download {{name}}", { name: e.fileName }),
125
+ children: [/* @__PURE__ */ f(c, {
126
+ size: 14,
127
+ "aria-hidden": "true"
128
+ }), v("export.detail.parts.download", "Download")]
129
+ }) : /* @__PURE__ */ p("span", {
130
+ className: "inline-flex items-center gap-1.5 text-sm text-text-secondary",
131
+ children: [/* @__PURE__ */ f(s, {
132
+ size: 14,
133
+ "aria-hidden": "true"
134
+ }), v("export.detail.parts.pending", "Pending")]
135
+ })]
136
+ }, e.id))
137
+ })
138
+ }),
139
+ g.status === "COMPLETED" && g.parts.length === 0 && /* @__PURE__ */ p("div", {
140
+ className: "rounded-xl border border-border-subtle bg-bg-surface p-6 text-center",
141
+ children: [
142
+ /* @__PURE__ */ f(o, {
143
+ size: 36,
144
+ "aria-hidden": "true",
145
+ className: "mx-auto mb-2 text-text-secondary"
146
+ }),
147
+ /* @__PURE__ */ f("p", {
148
+ className: "font-semibold",
149
+ children: v("export.detail.complete.title", "Export Complete")
150
+ }),
151
+ /* @__PURE__ */ f("p", {
152
+ className: "text-sm text-text-secondary",
153
+ children: v("export.detail.complete.noParts", "Your export has completed but no download parts are available yet.")
154
+ })
155
+ ]
156
+ })
157
+ ] });
158
+ }
159
+ export { g as DownloadSections };
160
+
161
+ //# sourceMappingURL=DownloadSections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DownloadSections.js","names":["_Fragment","DownloadSections","tr","useTr","inProgress","isInProgress","job","Fragment","ExportProgressBar","AlertCircle","ShowTechnicalDetails","HardDrive","formatBytes","Clock","GlassCard","item","PageSection","FileDown","part","label","Download","CheckCircle2"],"sources":["../../../src/export/components/DownloadSections.tsx"],"sourcesContent":["import {\n AlertCircle,\n CheckCircle2,\n Clock,\n Download,\n FileDown,\n HardDrive,\n} from \"lucide-react\";\nimport { GlassCard, ShowTechnicalDetails } from \"@burdenoff/fe-libs/ui\";\nimport { useTr } from \"../hooks/useTr\";\nimport { PageSection } from \"./PageLayout\";\nimport { ExportProgressBar } from \"./ExportProgressBar\";\nimport { formatBytes } from \"../utils/formatBytes\";\nimport { isInProgress } from \"../utils/downloadStatus\";\nimport type { ExportJob } from \"../types\";\n\n/**\n * The body of a download's page in Navigation v2 (BOFF-11870): progress while\n * it prepares, the failure or expiry note, the size and date cards, the files\n * and the \"complete, files not ready yet\" state.\n */\nexport function DownloadSections({\n job,\n label,\n}: {\n job: ExportJob;\n label: (entityType: string) => string;\n}) {\n const tr = useTr();\n const inProgress = isInProgress(job.status);\n return (\n <>\n {inProgress && (\n <div\n className=\"space-y-2 rounded-xl border border-border-subtle bg-bg-surface p-5\"\n role=\"status\"\n >\n <p className=\"font-medium text-text-primary\">\n {tr(\"export.detail.progress.preparing\", \"Preparing your files…\")}\n </p>\n <ExportProgressBar progress={job.progress} size=\"md\" />\n {job.processedEntities != null && job.totalEntities != null && (\n <p className=\"text-sm text-text-secondary\">\n {tr(\n \"export.detail.progress.items\",\n \"{{processed}} of {{total}} items ready\",\n {\n processed: job.processedEntities.toLocaleString(),\n total: job.totalEntities.toLocaleString(),\n },\n )}\n </p>\n )}\n </div>\n )}\n\n {job.status === \"FAILED\" && (\n <div className=\"flex items-start gap-3 rounded-xl border border-border-default bg-status-error-bg-subtle p-5\">\n <AlertCircle\n size={20}\n aria-hidden=\"true\"\n className=\"mt-0.5 shrink-0 text-status-error-text\"\n />\n <div className=\"min-w-0 space-y-2\">\n <p className=\"font-medium text-status-error-text\">\n {tr(\"export.detail.failed.title\", \"This download didn't finish\")}\n </p>\n <p className=\"text-sm text-text-secondary\">\n {tr(\n \"export.detail.failed.description\",\n \"Try again. If it stops again, pick less data or a shorter date range.\",\n )}\n </p>\n {job.errorMessage ? (\n <ShowTechnicalDetails copyable>\n {job.errorMessage}\n </ShowTechnicalDetails>\n ) : null}\n </div>\n </div>\n )}\n\n {job.status === \"EXPIRED\" && (\n <p className=\"rounded-xl border border-border-subtle bg-bg-surface p-4 text-sm text-text-secondary\">\n {tr(\n \"export.detail.expired.description\",\n \"The download link has expired. Try again to make a fresh copy.\",\n )}\n </p>\n )}\n\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n {[\n {\n icon: <HardDrive size={16} aria-hidden=\"true\" />,\n name: tr(\"export.detail.info.totalSize\", \"Total Size\"),\n value:\n job.totalSizeBytes != null\n ? formatBytes(job.totalSizeBytes)\n : \"-\",\n },\n {\n icon: <Clock size={16} aria-hidden=\"true\" />,\n name: tr(\"export.detail.info.created\", \"Created\"),\n value: new Date(job.createdAt).toLocaleDateString(),\n },\n ].map((item) => (\n <GlassCard\n key={item.name}\n treatment=\"metric\"\n className=\"border-border-seam p-4\"\n >\n <div className=\"mb-1 flex items-center gap-2 text-text-secondary\">\n {item.icon}\n <span className=\"text-xs font-medium\">{item.name}</span>\n </div>\n <p className=\"text-lg font-bold tabular-nums\">{item.value}</p>\n </GlassCard>\n ))}\n </div>\n\n {job.parts.length > 0 && (\n <PageSection title={tr(\"export.detail.parts.title\", \"Export Parts\")}>\n <ul className=\"space-y-2\">\n {job.parts.map((part) => (\n <li\n key={part.id}\n className=\"flex flex-col gap-3 rounded-xl border border-border-subtle bg-bg-surface p-4 sm:flex-row sm:items-center sm:justify-between\"\n >\n <div className=\"flex min-w-0 items-center gap-3\">\n <FileDown\n size={20}\n aria-hidden=\"true\"\n className=\"shrink-0 text-text-secondary\"\n />\n <div className=\"min-w-0\">\n <p className=\"truncate font-medium\">{part.fileName}</p>\n <p className=\"text-sm text-text-secondary\">\n {part.entityTypes.map(label).join(\", \")} ·{\" \"}\n {formatBytes(part.sizeBytes)}\n {part.downloadExpiresAt &&\n ` · ${tr(\n \"export.detail.parts.availableUntil\",\n \"Available until {{date}}\",\n {\n date: new Date(\n part.downloadExpiresAt,\n ).toLocaleDateString(),\n },\n )}`}\n </p>\n </div>\n </div>\n {part.downloadUrl ? (\n <a\n href={part.downloadUrl}\n className=\"inline-flex shrink-0 items-center gap-2 self-start rounded-lg border border-border-subtle px-3 py-1.5 text-sm font-medium hover:bg-accent sm:self-auto\"\n aria-label={tr(\n \"export.detail.parts.downloadAria\",\n \"Download {{name}}\",\n {\n name: part.fileName,\n },\n )}\n >\n <Download size={14} aria-hidden=\"true\" />\n {tr(\"export.detail.parts.download\", \"Download\")}\n </a>\n ) : (\n <span className=\"inline-flex items-center gap-1.5 text-sm text-text-secondary\">\n <Clock size={14} aria-hidden=\"true\" />\n {tr(\"export.detail.parts.pending\", \"Pending\")}\n </span>\n )}\n </li>\n ))}\n </ul>\n </PageSection>\n )}\n\n {job.status === \"COMPLETED\" && job.parts.length === 0 && (\n <div className=\"rounded-xl border border-border-subtle bg-bg-surface p-6 text-center\">\n <CheckCircle2\n size={36}\n aria-hidden=\"true\"\n className=\"mx-auto mb-2 text-text-secondary\"\n />\n <p className=\"font-semibold\">\n {tr(\"export.detail.complete.title\", \"Export Complete\")}\n </p>\n <p className=\"text-sm text-text-secondary\">\n {tr(\n \"export.detail.complete.noParts\",\n \"Your export has completed but no download parts are available yet.\",\n )}\n </p>\n </div>\n )}\n </>\n );\n}\n"],"mappings":";;;;;;;;;AAqBA,SAAgBC,EAAiB,EAC/B,QACA,YAIC;CACD,IAAMC,IAAKC,EAAM,GACXC,IAAaC,EAAaC,EAAI,MAAM;CAC1C,OACE,kBAAAN,GAAA,EAAA,UAAA;EACGI,KACC,kBAAC,OAAD;GACE,WAAU;GACV,MAAK;GAFP,UAAA;IAIE,kBAAC,KAAD;KAAG,WAAU;KACV,UAAAF,EAAG,oCAAoC,uBAAuB;IAC9D,CAAA;IACH,kBAACM,GAAD;KAAmB,UAAUF,EAAI;KAAU,MAAK;IAAM,CAAA;IACrDA,EAAI,qBAAqB,QAAQA,EAAI,iBAAiB,QACrD,kBAAC,KAAD;KAAG,WAAU;KACV,UAAAJ,EACC,gCACA,0CACA;MACE,WAAWI,EAAI,kBAAkB,eAAe;MAChD,OAAOA,EAAI,cAAc,eAAe;KAC1C,CACF;IACC,CAAA;GAEF;;EAGNA,EAAI,WAAW,YACd,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAACG,GAAD;IACE,MAAM;IACN,eAAY;IACZ,WAAU;GACX,CAAA,GACD,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA;KACE,kBAAC,KAAD;MAAG,WAAU;MACV,UAAAP,EAAG,8BAA8B,6BAA6B;KAC9D,CAAA;KACH,kBAAC,KAAD;MAAG,WAAU;MACV,UAAAA,EACC,oCACA,uEACF;KACC,CAAA;KACFI,EAAI,eACH,kBAACI,GAAD;MAAsB,UAAA;MACnB,UAAAJ,EAAI;KACe,CAAA,IACpB;IACD;GACF,CAAA,CAAA;;EAGNA,EAAI,WAAW,aACd,kBAAC,KAAD;GAAG,WAAU;GACV,UAAAJ,EACC,qCACA,gEACF;EACC,CAAA;EAGL,kBAAC,OAAD;GAAK,WAAU;GACZ,UAAA,CACC;IACE,MAAM,kBAACS,GAAD;KAAW,MAAM;KAAI,eAAY;IAAQ,CAAA;IAC/C,MAAMT,EAAG,gCAAgC,YAAY;IACrD,OACEI,EAAI,kBAAkB,OAElB,MADAM,EAAYN,EAAI,cAAc;GAEtC,GACA;IACE,MAAM,kBAACO,GAAD;KAAO,MAAM;KAAI,eAAY;IAAQ,CAAA;IAC3C,MAAMX,EAAG,8BAA8B,SAAS;IAChD,OAAO,IAAI,KAAKI,EAAI,SAAS,CAAC,CAAC,mBAAmB;GACpD,CACF,CAAC,CAAC,KAAK,MACL,kBAACQ,GAAD;IAEE,WAAU;IACV,WAAU;IAHZ,UAAA,CAKE,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACGC,EAAK,MACN,kBAAC,QAAD;MAAM,WAAU;MAAuB,UAAAA,EAAK;KAAW,CAAA,CACpD;IACL,CAAA,GAAA,kBAAC,KAAD;KAAG,WAAU;KAAkC,UAAAA,EAAK;IAAS,CAAA,CACpD;GATJ,GAAAA,EAAK,IASD,CACZ;EACE,CAAA;EAEJT,EAAI,MAAM,SAAS,KAClB,kBAACU,GAAD;GAAa,OAAOd,EAAG,6BAA6B,cAAc;GAChE,UAAA,kBAAC,MAAD;IAAI,WAAU;IACX,UAAAI,EAAI,MAAM,KAAK,MACd,kBAAC,MAAD;KAEE,WAAU;KAFZ,UAAA,CAIE,kBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACE,kBAACW,GAAD;OACE,MAAM;OACN,eAAY;OACZ,WAAU;MACX,CAAA,GACD,kBAAC,OAAD;OAAK,WAAU;OAAf,UAAA,CACE,kBAAC,KAAD;QAAG,WAAU;QAAwB,UAAAC,EAAK;OAAY,CAAA,GACtD,kBAAC,KAAD;QAAG,WAAU;QAAb,UAAA;SACGA,EAAK,YAAY,IAAIC,CAAK,CAAC,CAAC,KAAK,IAAI;SAAE;SAAG;SAC1CP,EAAYM,EAAK,SAAS;SAC1BA,EAAK,qBACJ,MAAMhB,EACJ,sCACA,4BACA,EACE,MAAM,IAAI,KACRgB,EAAK,iBACP,CAAC,CAAC,mBAAmB,EACvB,CACF;QACD;OACA,CAAA,CAAA;MACF,CAAA,CAAA;KACJ,CAAA,GAAAA,EAAK,cACJ,kBAAC,KAAD;MACE,MAAMA,EAAK;MACX,WAAU;MACV,cAAYhB,EACV,oCACA,qBACA,EACE,MAAMgB,EAAK,SACb,CACF;MATF,UAAA,CAWE,kBAACE,GAAD;OAAU,MAAM;OAAI,eAAY;MAAQ,CAAA,GACvClB,EAAG,gCAAgC,UAAU,CAC7C;KAEH,CAAA,IAAA,kBAAC,QAAD;MAAM,WAAU;MAAhB,UAAA,CACE,kBAACW,GAAD;OAAO,MAAM;OAAI,eAAY;MAAQ,CAAA,GACpCX,EAAG,+BAA+B,SAAS,CACxC;KAEN,CAAA,CAAA;IAhDG,GAAAgB,EAAK,EAgDR,CACL;GACC,CAAA;EACO,CAAA;EAGdZ,EAAI,WAAW,eAAeA,EAAI,MAAM,WAAW,KAClD,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA;IACE,kBAACe,GAAD;KACE,MAAM;KACN,eAAY;KACZ,WAAU;IACX,CAAA;IACD,kBAAC,KAAD;KAAG,WAAU;KACV,UAAAnB,EAAG,gCAAgC,iBAAiB;IACpD,CAAA;IACH,kBAAC,KAAD;KAAG,WAAU;KACV,UAAAA,EACC,kCACA,oEACF;IACC,CAAA;GACA;;CAEP,EAAA,CAAA;AAEN"}
@@ -0,0 +1,13 @@
1
+ import { ExportJobStatus } from '../types';
2
+ /** The plain status words, for code that needs the text only. */
3
+ export declare function useDownloadStatusLabel(): (status: ExportJobStatus) => string;
4
+ /**
5
+ * Navigation v2 status: an icon and the plain words, in the text colour. The
6
+ * words carry the meaning, so nothing depends on colour.
7
+ */
8
+ export declare function DownloadStatus({ status, className, badge, }: {
9
+ status: ExportJobStatus;
10
+ className?: string;
11
+ /** A bordered pill, for a page header. */
12
+ badge?: boolean;
13
+ }): import('react').JSX.Element;
@@ -0,0 +1,36 @@
1
+ import { useTr as e } from "../hooks/useTr.js";
2
+ import { cn as t } from "../utils/cn.js";
3
+ import { DOWNLOAD_PHASE_COPY as n, downloadPhase as r } from "../utils/downloadStatus.js";
4
+ import { CheckCircle2 as i, Loader2 as a, RotateCcw as o, XCircle as s } from "lucide-react";
5
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
6
+ // src/export/components/DownloadStatus.tsx
7
+ var u = {
8
+ preparing: a,
9
+ ready: i,
10
+ failed: s,
11
+ cancelled: s,
12
+ expired: o,
13
+ deleted: s
14
+ };
15
+ function d() {
16
+ let t = e();
17
+ return (e) => {
18
+ let i = n[r(e)];
19
+ return t(i.key, i.label);
20
+ };
21
+ }
22
+ function f({ status: e, className: n, badge: i = !1 }) {
23
+ let a = d(), o = r(e), s = u[o];
24
+ return /* @__PURE__ */ l("span", {
25
+ "data-phase": o,
26
+ className: t("inline-flex items-center gap-1.5 text-sm text-text-secondary", i && "rounded-full border border-border-subtle bg-bg-surface px-2.5 py-0.5 text-xs font-medium text-text-primary", n),
27
+ children: [/* @__PURE__ */ c(s, {
28
+ size: 14,
29
+ "aria-hidden": "true",
30
+ className: t("shrink-0", o === "preparing" && "motion-safe:animate-spin")
31
+ }), a(e)]
32
+ });
33
+ }
34
+ export { f as DownloadStatus, d as useDownloadStatusLabel };
35
+
36
+ //# sourceMappingURL=DownloadStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DownloadStatus.js","names":["PHASE_ICON","Loader2","CheckCircle2","XCircle","RotateCcw","useDownloadStatusLabel","tr","useTr","copy","DOWNLOAD_PHASE_COPY","downloadPhase","status","DownloadStatus","label","phase","Icon","cn","badge","className"],"sources":["../../../src/export/components/DownloadStatus.tsx"],"sourcesContent":["import { CheckCircle2, Clock, Loader2, RotateCcw, XCircle } from \"lucide-react\";\nimport { useTr } from \"../hooks/useTr\";\nimport { cn } from \"../utils/cn\";\nimport {\n DOWNLOAD_PHASE_COPY,\n downloadPhase,\n type DownloadPhase,\n} from \"../utils/downloadStatus\";\nimport type { ExportJobStatus } from \"../types\";\n\nconst PHASE_ICON: Record<DownloadPhase, typeof Clock> = {\n preparing: Loader2,\n ready: CheckCircle2,\n failed: XCircle,\n cancelled: XCircle,\n expired: RotateCcw,\n deleted: XCircle,\n};\n\n/** The plain status words, for code that needs the text only. */\nexport function useDownloadStatusLabel(): (status: ExportJobStatus) => string {\n const tr = useTr();\n return (status) => {\n const copy = DOWNLOAD_PHASE_COPY[downloadPhase(status)];\n return tr(copy.key, copy.label);\n };\n}\n\n/**\n * Navigation v2 status: an icon and the plain words, in the text colour. The\n * words carry the meaning, so nothing depends on colour.\n */\nexport function DownloadStatus({\n status,\n className,\n badge = false,\n}: {\n status: ExportJobStatus;\n className?: string;\n /** A bordered pill, for a page header. */\n badge?: boolean;\n}) {\n const label = useDownloadStatusLabel();\n const phase = downloadPhase(status);\n const Icon = PHASE_ICON[phase];\n return (\n <span\n data-phase={phase}\n className={cn(\n \"inline-flex items-center gap-1.5 text-sm text-text-secondary\",\n badge &&\n \"rounded-full border border-border-subtle bg-bg-surface px-2.5 py-0.5 text-xs font-medium text-text-primary\",\n className,\n )}\n >\n <Icon\n size={14}\n aria-hidden=\"true\"\n className={cn(\n \"shrink-0\",\n phase === \"preparing\" && \"motion-safe:animate-spin\",\n )}\n />\n {label(status)}\n </span>\n );\n}\n"],"mappings":";;;;;;AAUA,IAAMA,IAAkD;CACtD,WAAWC;CACX,OAAOC;CACP,QAAQC;CACR,WAAWA;CACX,SAASC;CACT,SAASD;AACX;AAGA,SAAgBE,IAA8D;CAC5E,IAAMC,IAAKC,EAAM;CACjB,QAAQ,MAAW;EACjB,IAAMC,IAAOC,EAAoBC,EAAcC,CAAM;EACrD,OAAOL,EAAGE,EAAK,KAAKA,EAAK,KAAK;CAChC;AACF;AAMA,SAAgBI,EAAe,EAC7B,WACA,cACA,WAAQ,MAMP;CACD,IAAMC,IAAQR,EAAuB,GAC/BS,IAAQJ,EAAcC,CAAM,GAC5BI,IAAOf,EAAWc;CACxB,OACE,kBAAC,QAAD;EACE,cAAYA;EACZ,WAAWE,EACT,gEACAC,KACE,8GACFC,CACF;EAPF,UAAA,CASE,kBAACH,GAAD;GACE,MAAM;GACN,eAAY;GACZ,WAAWC,EACT,YACAF,MAAU,eAAe,0BAC3B;EACD,CAAA,GACAD,EAAMF,CAAM,CACT;;AAEV"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Navigation v2 tab row for "Download your data": the list first, "Saved
3
+ * setups" one click away under "More ▾" (BOFF-11870, page table row 4).
4
+ */
5
+ export declare function DownloadsTabs(): import('react').JSX.Element;
@@ -0,0 +1,25 @@
1
+ import { useExport as e } from "../providers/ExportProvider.js";
2
+ import { useTr as t } from "../hooks/useTr.js";
3
+ import { joinPath as n } from "../utils/paths.js";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ import { PageTabs as i } from "@burdenoff/fe-libs/ui";
6
+ // src/export/components/DownloadsTabs.tsx
7
+ function a() {
8
+ let { basePath: a = "/" } = e(), o = t(), s = [{
9
+ id: "downloads",
10
+ label: o("export.downloads.tabs.downloads", "Downloads"),
11
+ href: a
12
+ }, {
13
+ id: "templates",
14
+ label: o("export.downloads.tabs.savedSetups", "Saved setups"),
15
+ href: n(a, "templates")
16
+ }];
17
+ return /* @__PURE__ */ r(i, {
18
+ tabs: s,
19
+ maxVisible: 1,
20
+ ariaLabel: o("export.downloads.tabs.label", "Download your data")
21
+ });
22
+ }
23
+ export { a as DownloadsTabs };
24
+
25
+ //# sourceMappingURL=DownloadsTabs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DownloadsTabs.js","names":["DownloadsTabs","useExport","tr","useTr","tabs","basePath","joinPath","PageTabs"],"sources":["../../../src/export/components/DownloadsTabs.tsx"],"sourcesContent":["import { PageTabs, type PageTabItem } from \"@burdenoff/fe-libs/ui\";\nimport { useExport } from \"../providers/ExportProvider\";\nimport { useTr } from \"../hooks/useTr\";\nimport { joinPath } from \"../utils/paths\";\n\n/**\n * Navigation v2 tab row for \"Download your data\": the list first, \"Saved\n * setups\" one click away under \"More ▾\" (BOFF-11870, page table row 4).\n */\nexport function DownloadsTabs() {\n const { basePath = \"/\" } = useExport();\n const tr = useTr();\n const tabs: PageTabItem[] = [\n {\n id: \"downloads\",\n label: tr(\"export.downloads.tabs.downloads\", \"Downloads\"),\n href: basePath,\n },\n {\n id: \"templates\",\n label: tr(\"export.downloads.tabs.savedSetups\", \"Saved setups\"),\n href: joinPath(basePath, \"templates\"),\n },\n ];\n return (\n <PageTabs\n tabs={tabs}\n maxVisible={1}\n ariaLabel={tr(\"export.downloads.tabs.label\", \"Download your data\")}\n />\n );\n}\n"],"mappings":";;;;;;AASA,SAAgBA,IAAgB;CAC9B,IAAM,EAAE,cAAW,QAAQC,EAAU,GAC/BC,IAAKC,EAAM,GACXC,IAAsB,CAC1B;EACE,IAAI;EACJ,OAAOF,EAAG,mCAAmC,WAAW;EACxD,MAAMG;CACR,GACA;EACE,IAAI;EACJ,OAAOH,EAAG,qCAAqC,cAAc;EAC7D,MAAMI,EAASD,GAAU,WAAW;CACtC,CACF;CACA,OACE,kBAACE,GAAD;EACQ;EACN,YAAY;EACZ,WAAWL,EAAG,+BAA+B,oBAAoB;CAClE,CAAA;AAEL"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `(entityType) => plain name`, backed by the workspace's entity catalog
3
+ * (`useAvailableEntities`). Use it wherever an entity type is shown, so a raw
4
+ * key such as `rbac_role_members` never reaches the page. Pass `false` to
5
+ * keep the raw key and skip the catalog query.
6
+ */
7
+ export declare function useEntityLabel(enabled?: boolean): (entityType: string) => string;
@@ -0,0 +1,16 @@
1
+ import { useAvailableEntities as e } from "./useExportQueries.js";
2
+ import { useTr as t } from "./useTr.js";
3
+ import { entityLabel as n } from "../utils/entityLabels.js";
4
+ import { useCallback as r } from "react";
5
+ // src/export/hooks/useEntityLabel.ts
6
+ function i(i = !0) {
7
+ let a = t(), { data: o } = e(void 0, { skip: !i });
8
+ return r((e) => i ? n(e, a, o) : e, [
9
+ i,
10
+ a,
11
+ o
12
+ ]);
13
+ }
14
+ export { i as useEntityLabel };
15
+
16
+ //# sourceMappingURL=useEntityLabel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useEntityLabel.js","names":["useEntityLabel","tr","useTr","available","useAvailableEntities","enabled","useCallback","entityLabel","entityType"],"sources":["../../../src/export/hooks/useEntityLabel.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useAvailableEntities } from \"./useExportQueries\";\nimport { useTr } from \"./useTr\";\nimport { entityLabel } from \"../utils/entityLabels\";\n\n/**\n * `(entityType) => plain name`, backed by the workspace's entity catalog\n * (`useAvailableEntities`). Use it wherever an entity type is shown, so a raw\n * key such as `rbac_role_members` never reaches the page. Pass `false` to\n * keep the raw key and skip the catalog query.\n */\nexport function useEntityLabel(enabled = true): (entityType: string) => string {\n const tr = useTr();\n // Off (the legacy pages), the catalog is not fetched and the label is the key.\n const { data: available } = useAvailableEntities(undefined, {\n skip: !enabled,\n });\n return useCallback(\n (entityType: string) =>\n enabled ? entityLabel(entityType, tr, available) : entityType,\n [enabled, tr, available],\n );\n}\n"],"mappings":";;;;;AAWA,SAAgBA,EAAe,IAAU,IAAsC;CAC7E,IAAMC,IAAKC,EAAM,GAEX,EAAE,MAAMC,MAAcC,EAAqB,KAAA,GAAW,EAC1D,MAAM,CAACC,EACT,CAAC;CACD,OAAOC,GACJ,MACCD,IAAUE,EAAYC,GAAYP,GAAIE,CAAS,IAAIK,GACrD;EAACH;EAASJ;EAAIE;CAAS,CACzB;AACF"}
@@ -80,10 +80,16 @@ export declare function useExportJobProgress(jobId: string | undefined): {
80
80
  isLoading: boolean;
81
81
  error: import('@apollo/client').ErrorLike | null;
82
82
  };
83
+ /** Keep the first row for each entity type, in order. */
84
+ export declare function uniqueByEntityType<T extends {
85
+ entityType: string;
86
+ }>(rows: readonly T[]): T[];
83
87
  /**
84
88
  * Hook to fetch available entity types for export in a workspace
85
89
  */
86
- export declare function useAvailableEntities(overrideWorkspaceId?: string): {
90
+ export declare function useAvailableEntities(overrideWorkspaceId?: string, options?: {
91
+ skip?: boolean;
92
+ }): {
87
93
  data: ExportAvailableEntity[];
88
94
  totalCount: number;
89
95
  pageInfo: PageInfo | null;
@@ -174,59 +174,63 @@ function L(e) {
174
174
  error: r ?? null
175
175
  };
176
176
  }
177
- function R(e, { fetchMoreResult: t }) {
177
+ function R(e) {
178
+ let t = /* @__PURE__ */ new Set();
179
+ return e.filter((e) => !t.has(e.entityType) && (t.add(e.entityType), !0));
180
+ }
181
+ function z(e, { fetchMoreResult: t }) {
178
182
  return t ? { getAvailableExportEntities: {
179
183
  ...t.getAvailableExportEntities,
180
184
  edges: [...e.getAvailableExportEntities.edges, ...t.getAvailableExportEntities.edges]
181
185
  } } : e;
182
186
  }
183
- function z(e) {
184
- let { workspaceId: t } = g(), n = e ?? t, { data: r, loading: i, error: a, refetch: o, fetchMore: c } = x(s, {
187
+ function B(e, t = {}) {
188
+ let { workspaceId: n } = g(), r = t.skip ? void 0 : e ?? n, { data: i, loading: a, error: o, refetch: c, fetchMore: l } = x(s, {
185
189
  variables: {
186
- context: { workspaceId: n },
190
+ context: { workspaceId: r },
187
191
  pagination: { first: 100 }
188
192
  },
189
- skip: !n
190
- }), l = r?.getAvailableExportEntities, u = l?.edges.map((e) => j(e.node)) ?? [], d = async () => {
191
- n && l?.pageInfo.hasNextPage && await c({
193
+ skip: !r
194
+ }), u = i?.getAvailableExportEntities, d = R(u?.edges.map((e) => j(e.node)) ?? []), f = async () => {
195
+ r && u?.pageInfo.hasNextPage && await l({
192
196
  variables: {
193
- context: { workspaceId: n },
197
+ context: { workspaceId: r },
194
198
  pagination: {
195
199
  first: 100,
196
- after: l.pageInfo.endCursor
200
+ after: u.pageInfo.endCursor
197
201
  }
198
202
  },
199
- updateQuery: R
203
+ updateQuery: z
200
204
  });
201
- }, f = l?.pageInfo.hasNextPage ?? !1, p = l?.pageInfo.endCursor ?? null, m = y(null);
205
+ }, p = u?.pageInfo.hasNextPage ?? !1, m = u?.pageInfo.endCursor ?? null, h = y(null);
202
206
  return v(() => {
203
- !i && n && f && p && m.current !== p && (m.current = p, c({
207
+ !a && r && p && m && h.current !== m && (h.current = m, l({
204
208
  variables: {
205
- context: { workspaceId: n },
209
+ context: { workspaceId: r },
206
210
  pagination: {
207
211
  first: 100,
208
- after: p
212
+ after: m
209
213
  }
210
214
  },
211
- updateQuery: R
215
+ updateQuery: z
212
216
  }));
213
217
  }, [
214
- i,
215
- n,
216
- f,
218
+ a,
219
+ r,
217
220
  p,
218
- c
221
+ m,
222
+ l
219
223
  ]), {
220
- data: u,
221
- totalCount: l?.totalCount ?? 0,
222
- pageInfo: l?.pageInfo ? D(l.pageInfo) : null,
223
- loadMore: d,
224
- error: a ?? null,
225
- isLoading: i,
226
- refetch: o
224
+ data: d,
225
+ totalCount: u?.totalCount ?? 0,
226
+ pageInfo: u?.pageInfo ? D(u.pageInfo) : null,
227
+ loadMore: f,
228
+ error: o ?? null,
229
+ isLoading: a,
230
+ refetch: c
227
231
  };
228
232
  }
229
- function B(e) {
233
+ function V(e) {
230
234
  let { workspaceId: t } = g(), n = e ?? t, { data: r, loading: i, error: a, refetch: o, fetchMore: s } = x(d, {
231
235
  variables: {
232
236
  context: { workspaceId: n },
@@ -258,7 +262,7 @@ function B(e) {
258
262
  refetch: o
259
263
  };
260
264
  }
261
- function V(e) {
265
+ function H(e) {
262
266
  let { workspaceId: t } = g(), { data: n, loading: r, error: i } = x(l, {
263
267
  variables: {
264
268
  id: e ?? "",
@@ -272,7 +276,7 @@ function V(e) {
272
276
  error: i ?? null
273
277
  };
274
278
  }
275
- function H() {
279
+ function U() {
276
280
  let e = g(), { workspaceId: n } = e, [r, { loading: i, error: a }] = b(t), o = async (t) => {
277
281
  let { filters: i, ...a } = t, o = {
278
282
  ...a,
@@ -301,7 +305,7 @@ function H() {
301
305
  error: a ?? null
302
306
  };
303
307
  }
304
- function U() {
308
+ function W() {
305
309
  let t = g(), { workspaceId: n } = t, [r, { loading: i, error: a }] = b(e), o = async (e) => {
306
310
  let i = await r({
307
311
  variables: {
@@ -328,7 +332,7 @@ function U() {
328
332
  error: a ?? null
329
333
  };
330
334
  }
331
- function W() {
335
+ function G() {
332
336
  let e = g(), { workspaceId: t } = e, [n, { loading: i, error: a }] = b(r), o = async (r) => (await n({
333
337
  variables: {
334
338
  id: r,
@@ -348,7 +352,7 @@ function W() {
348
352
  error: a ?? null
349
353
  };
350
354
  }
351
- function G() {
355
+ function K() {
352
356
  let e = g(), { workspaceId: t } = e, [n, { loading: r, error: i }] = b(f);
353
357
  return {
354
358
  retryJob: async (r) => {
@@ -376,7 +380,7 @@ function G() {
376
380
  error: i ?? null
377
381
  };
378
382
  }
379
- function K() {
383
+ function q() {
380
384
  let e = g(), { workspaceId: t } = e, [r, { loading: i, error: a }] = b(n);
381
385
  return {
382
386
  createTemplate: async (n) => {
@@ -401,7 +405,7 @@ function K() {
401
405
  error: a ?? null
402
406
  };
403
407
  }
404
- function q() {
408
+ function J() {
405
409
  let e = g(), { workspaceId: t } = e, [n, { loading: r, error: a }] = b(i);
406
410
  return {
407
411
  deleteTemplate: async (r) => (await n({
@@ -419,7 +423,7 @@ function q() {
419
423
  error: a ?? null
420
424
  };
421
425
  }
422
- function J(e) {
426
+ function Y(e) {
423
427
  let { data: t, loading: n, error: r } = x(o, {
424
428
  variables: { scopeId: e ?? "" },
425
429
  skip: !e,
@@ -427,6 +431,6 @@ function J(e) {
427
431
  });
428
432
  return !!e && !!t && !n && !r && t?.myPermissions.scopeId === e && t.myPermissions.permissions.some((e) => e.resourceType === "export" && e.allowedActions.includes("organization_admin"));
429
433
  }
430
- export { z as useAvailableEntities, U as useCancelExportJob, H as useCreateExportJob, K as useCreateExportTemplate, W as useDeleteExportJob, q as useDeleteExportTemplate, I as useExportJob, L as useExportJobProgress, F as useExportJobs, V as useExportTemplate, B as useExportTemplates, J as useOrganizationExportPermission, G as useRetryExportJob };
434
+ export { R as uniqueByEntityType, B as useAvailableEntities, W as useCancelExportJob, U as useCreateExportJob, q as useCreateExportTemplate, G as useDeleteExportJob, J as useDeleteExportTemplate, I as useExportJob, L as useExportJobProgress, F as useExportJobs, H as useExportTemplate, V as useExportTemplates, Y as useOrganizationExportPermission, K as useRetryExportJob };
431
435
 
432
436
  //# sourceMappingURL=useExportQueries.js.map