@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.
- 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 +7 -1
- package/dist/export/hooks/useExportQueries.js +40 -36
- 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
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import { useExport as e } from "../../providers/ExportProvider.js";
|
|
2
|
+
import { useAvailableEntities as t, useCreateExportJob as n, useExportTemplates as r, useOrganizationExportPermission as ee } from "../../hooks/useExportQueries.js";
|
|
3
|
+
import { useTr as i } from "../../hooks/useTr.js";
|
|
4
|
+
import { PageLayout as a } from "../../components/PageLayout.js";
|
|
5
|
+
import { entityLabel as te, offeredGroups as ne } from "../../utils/entityLabels.js";
|
|
6
|
+
import { isExportEntityDisabled as re, isForeignProductEntity as ie } from "../../utils/disabledModules.js";
|
|
7
|
+
import { DEFAULT_NEW_DOWNLOAD_FORM as ae, SUPPORTED_FORMATS as oe, applySavedSetup as o, suggestedDownloadName as se, toCreateExportInput as s } from "../../utils/newDownloadForm.js";
|
|
8
|
+
import { joinPath as c } from "../../utils/paths.js";
|
|
9
|
+
import { openBilling as l } from "../../utils/billing.js";
|
|
10
|
+
import { cn as u } from "../../utils/cn.js";
|
|
11
|
+
import { useCallback as d, useEffect as f, useMemo as ce, useRef as p, useState as m } from "react";
|
|
12
|
+
import { ArrowRight as le, Check as h, Download as g, Loader2 as ue, Minus as _ } from "lucide-react";
|
|
13
|
+
import { useAppShell as de, usePermission as fe } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
14
|
+
import { useSearchParams as pe } from "react-router";
|
|
15
|
+
import { isQuotaExhaustedError as me } from "@burdenoff/fe-libs/shared/utils";
|
|
16
|
+
import { Fragment as he, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
17
|
+
import { AlertDialog as ge, AlertDialogAction as _e, AlertDialogCancel as ve, AlertDialogContent as ye, AlertDialogDescription as be, AlertDialogFooter as xe, AlertDialogHeader as Se, AlertDialogTitle as Ce, Button as b, IllustratedEmptyState as we, OptionalFields as Te, Stepper as x } from "@burdenoff/fe-libs/ui";
|
|
18
|
+
// src/export/pages/v2/NewDownloadPage.tsx
|
|
19
|
+
var S = {
|
|
20
|
+
INDIVIDUAL: {
|
|
21
|
+
labelKey: "export.create.scope.individual.label",
|
|
22
|
+
label: "My Data Only",
|
|
23
|
+
descKey: "export.create.scope.individual.description",
|
|
24
|
+
desc: "Export data you personally created across selected modules."
|
|
25
|
+
},
|
|
26
|
+
WORKSPACE_ADMIN: {
|
|
27
|
+
labelKey: "export.create.scope.workspaceAdmin.label",
|
|
28
|
+
label: "All Workspace Data",
|
|
29
|
+
descKey: "export.create.scope.workspaceAdmin.description",
|
|
30
|
+
desc: "Export all data in this workspace regardless of who created it. Requires workspace admin access."
|
|
31
|
+
},
|
|
32
|
+
ORG_ADMIN: {
|
|
33
|
+
labelKey: "export.create.scope.orgAdmin.label",
|
|
34
|
+
label: "All Organization Data",
|
|
35
|
+
descKey: "export.create.scope.orgAdmin.description",
|
|
36
|
+
desc: "Export data from every workspace in your organization. Requires org-admin access."
|
|
37
|
+
}
|
|
38
|
+
}, C = {
|
|
39
|
+
CSV: ["export.format.csv", "CSV"],
|
|
40
|
+
JSON: ["export.format.json", "JSON"]
|
|
41
|
+
}, w = "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary";
|
|
42
|
+
function T({ checked: e, onToggle: t, title: n, description: r }) {
|
|
43
|
+
return /* @__PURE__ */ y("button", {
|
|
44
|
+
type: "button",
|
|
45
|
+
role: "checkbox",
|
|
46
|
+
"aria-checked": e,
|
|
47
|
+
onClick: t,
|
|
48
|
+
className: u("flex w-full items-start gap-3 rounded-xl border p-4 text-left transition-colors", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40", e === !0 ? "border-primary bg-action-primary-bg/5" : "border-border-subtle hover:border-primary/40"),
|
|
49
|
+
children: [/* @__PURE__ */ y("span", {
|
|
50
|
+
"aria-hidden": "true",
|
|
51
|
+
className: u("mt-0.5 flex size-5 shrink-0 items-center justify-center rounded border", e ? "border-primary bg-action-primary-bg text-action-primary-text" : "border-border-default"),
|
|
52
|
+
children: [e === !0 ? /* @__PURE__ */ v(h, { size: 14 }) : null, e === "mixed" ? /* @__PURE__ */ v(_, { size: 14 }) : null]
|
|
53
|
+
}), /* @__PURE__ */ y("span", {
|
|
54
|
+
className: "min-w-0",
|
|
55
|
+
children: [/* @__PURE__ */ v("span", {
|
|
56
|
+
className: "block font-medium text-text-primary",
|
|
57
|
+
children: n
|
|
58
|
+
}), r ? /* @__PURE__ */ v("span", {
|
|
59
|
+
className: "block text-sm text-text-secondary",
|
|
60
|
+
children: r
|
|
61
|
+
}) : null]
|
|
62
|
+
})]
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function E() {
|
|
66
|
+
let { basePath: h = "/", navigate: _, organizationId: E } = e(), D = i(), { createJob: O, isPending: k } = n(), { data: A } = t(), { data: j } = r(), [M] = pe(), { productSlug: N } = de(), Ee = fe("export:workspace_admin"), De = ee(E), P = [
|
|
67
|
+
"INDIVIDUAL",
|
|
68
|
+
...Ee ? ["WORKSPACE_ADMIN"] : [],
|
|
69
|
+
...De ? ["ORG_ADMIN"] : []
|
|
70
|
+
], F = d((e) => !re(e) && !ie(e, N), [N]), I = ce(() => A.filter((e) => e.enabled !== !1 && F(e.entityType)), [A, F]), L = ne(I.map((e) => e.entityType)), R = (e) => te(e, D, A), [z, B] = m(0), [V, H] = m(() => ({
|
|
71
|
+
...ae,
|
|
72
|
+
templateId: M.get("templateId") ?? void 0
|
|
73
|
+
})), U = p(!1), [W, Oe] = m(!1), [G, K] = m(null), [ke, q] = m(!1), J = p(null);
|
|
74
|
+
f(() => {
|
|
75
|
+
let e = M.get("templateId");
|
|
76
|
+
if (!e || !j.length || J.current === e) return;
|
|
77
|
+
let t = j.find((t) => t.id === e);
|
|
78
|
+
t && (J.current = e, H((e) => o(e, t, F, !1)));
|
|
79
|
+
}, [
|
|
80
|
+
F,
|
|
81
|
+
M,
|
|
82
|
+
j
|
|
83
|
+
]);
|
|
84
|
+
let Y = new Set(V.entityTypes), X = (e) => H((t) => ({
|
|
85
|
+
...t,
|
|
86
|
+
entityTypes: e
|
|
87
|
+
})), Ae = (e) => X(Y.has(e) ? V.entityTypes.filter((t) => t !== e) : [...V.entityTypes, e]), je = (e) => {
|
|
88
|
+
let t = e.every((e) => Y.has(e)), n = new Set(e);
|
|
89
|
+
X(t ? V.entityTypes.filter((e) => !n.has(e)) : [...V.entityTypes, ...e.filter((e) => !Y.has(e))]);
|
|
90
|
+
}, Me = () => {
|
|
91
|
+
let e = L.filter(({ entityTypes: e }) => e.every((e) => Y.has(e))), t = new Set(e.flatMap((e) => e.entityTypes)), n = V.entityTypes.filter((e) => !t.has(e)), r = e.length === 1 && n.length === 0 ? D(e[0].group.labelKey, e[0].group.label) : e.length === 0 && n.length === 1 ? R(n[0]) : D("export.create.name.myData", "My data");
|
|
92
|
+
return se(r);
|
|
93
|
+
}, Z = () => {
|
|
94
|
+
V.entityTypes.length === 0 ? K(D("export.create.errors.selectEntity", "Please select at least one entity type to export")) : (K(null), U.current || H((e) => ({
|
|
95
|
+
...e,
|
|
96
|
+
name: Me()
|
|
97
|
+
})), B(1));
|
|
98
|
+
}, Ne = async () => {
|
|
99
|
+
if (!V.name.trim()) K(D("export.create.errors.exportNameRequired", "Please provide a name for this export"));
|
|
100
|
+
else {
|
|
101
|
+
K(null);
|
|
102
|
+
try {
|
|
103
|
+
let e = await O(s(V, E));
|
|
104
|
+
_?.(e?.id ? c(h, e.id) : h);
|
|
105
|
+
} catch (e) {
|
|
106
|
+
if (me(e)) {
|
|
107
|
+
q(!0), K(D("export.create.errors.quotaReached", "You have reached your export limit for this month."));
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
K(e instanceof Error ? e.message : D("export.create.errors.createFailed", "Failed to create export"));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}, Q = (e) => D(S[e].labelKey, S[e].label), $ = (e) => D(C[e][0], C[e][1]), Pe = V.entityTypes.map(R);
|
|
114
|
+
return /* @__PURE__ */ y(a, {
|
|
115
|
+
title: D("export.create.title", "New Export"),
|
|
116
|
+
icon: /* @__PURE__ */ v(g, { size: 24 }),
|
|
117
|
+
maxWidth: "3xl",
|
|
118
|
+
children: [
|
|
119
|
+
/* @__PURE__ */ v(x, {
|
|
120
|
+
steps: [{
|
|
121
|
+
key: "what",
|
|
122
|
+
label: D("export.create.steps.what", "What do you want to download?")
|
|
123
|
+
}, {
|
|
124
|
+
key: "review",
|
|
125
|
+
label: D("export.create.steps.review", "Review")
|
|
126
|
+
}],
|
|
127
|
+
active: z,
|
|
128
|
+
onStepClick: (e) => {
|
|
129
|
+
e === 0 && B(0);
|
|
130
|
+
}
|
|
131
|
+
}),
|
|
132
|
+
G && /* @__PURE__ */ v("p", {
|
|
133
|
+
role: "alert",
|
|
134
|
+
className: "rounded-xl border border-border-default bg-status-error-bg-subtle p-4 text-sm text-status-error-text",
|
|
135
|
+
children: G
|
|
136
|
+
}),
|
|
137
|
+
z === 0 && /* @__PURE__ */ y("section", {
|
|
138
|
+
"aria-labelledby": "new-download-what",
|
|
139
|
+
className: "space-y-4",
|
|
140
|
+
children: [/* @__PURE__ */ v("h2", {
|
|
141
|
+
id: "new-download-what",
|
|
142
|
+
className: "text-lg font-semibold",
|
|
143
|
+
children: D("export.create.select.question", "What do you want to download?")
|
|
144
|
+
}), I.length === 0 ? /* @__PURE__ */ v(we, {
|
|
145
|
+
illustration: "empty-data",
|
|
146
|
+
title: D("export.create.select.emptyTitle", "Nothing to export yet"),
|
|
147
|
+
description: D("export.create.select.empty", "No exportable entity types are configured for this workspace yet. Once your workspace has data in supported modules, they'll show up here to select.")
|
|
148
|
+
}) : /* @__PURE__ */ y(he, { children: [L.length > 0 && /* @__PURE__ */ v("div", {
|
|
149
|
+
className: "grid grid-cols-1 gap-3 sm:grid-cols-2",
|
|
150
|
+
children: L.map(({ group: e, entityTypes: t }) => {
|
|
151
|
+
let n = t.filter((e) => Y.has(e)).length;
|
|
152
|
+
return /* @__PURE__ */ v(T, {
|
|
153
|
+
checked: n === t.length || n > 0 && "mixed",
|
|
154
|
+
onToggle: () => je(t),
|
|
155
|
+
title: D(e.labelKey, e.label),
|
|
156
|
+
description: D(e.descriptionKey, e.description)
|
|
157
|
+
}, e.id);
|
|
158
|
+
})
|
|
159
|
+
}), /* @__PURE__ */ y("div", {
|
|
160
|
+
className: "space-y-3",
|
|
161
|
+
children: [/* @__PURE__ */ v(b, {
|
|
162
|
+
type: "button",
|
|
163
|
+
variant: "ghost",
|
|
164
|
+
size: "sm",
|
|
165
|
+
"aria-expanded": W || L.length === 0,
|
|
166
|
+
"aria-controls": "new-download-all-types",
|
|
167
|
+
onClick: () => Oe(!W),
|
|
168
|
+
hidden: L.length === 0,
|
|
169
|
+
children: W ? D("export.create.select.hideAll", "Hide the full list") : D("export.create.select.showAll", "Show all data types")
|
|
170
|
+
}), /* @__PURE__ */ v("div", {
|
|
171
|
+
id: "new-download-all-types",
|
|
172
|
+
hidden: !W && L.length > 0,
|
|
173
|
+
className: "grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",
|
|
174
|
+
children: I.map((e) => /* @__PURE__ */ v(T, {
|
|
175
|
+
checked: Y.has(e.entityType),
|
|
176
|
+
onToggle: () => Ae(e.entityType),
|
|
177
|
+
title: R(e.entityType)
|
|
178
|
+
}, e.entityType))
|
|
179
|
+
})]
|
|
180
|
+
})] })]
|
|
181
|
+
}),
|
|
182
|
+
z === 1 && /* @__PURE__ */ y("section", {
|
|
183
|
+
"aria-labelledby": "new-download-review",
|
|
184
|
+
className: "space-y-4",
|
|
185
|
+
children: [
|
|
186
|
+
/* @__PURE__ */ v("h2", {
|
|
187
|
+
id: "new-download-review",
|
|
188
|
+
className: "sr-only",
|
|
189
|
+
children: D("export.create.steps.review", "Review")
|
|
190
|
+
}),
|
|
191
|
+
/* @__PURE__ */ y("div", {
|
|
192
|
+
className: "space-y-4 rounded-xl border border-border-subtle bg-bg-surface p-4 sm:p-6",
|
|
193
|
+
children: [
|
|
194
|
+
/* @__PURE__ */ v("p", {
|
|
195
|
+
className: "text-sm text-text-primary",
|
|
196
|
+
"data-testid": "new-download-summary",
|
|
197
|
+
children: D("export.create.summary", "{{kinds}} · {{whose}} · {{format}}", {
|
|
198
|
+
kinds: Pe.join(", "),
|
|
199
|
+
whose: Q(V.scope),
|
|
200
|
+
format: $(V.format)
|
|
201
|
+
})
|
|
202
|
+
}),
|
|
203
|
+
/* @__PURE__ */ y("div", {
|
|
204
|
+
className: "space-y-1",
|
|
205
|
+
children: [/* @__PURE__ */ y("label", {
|
|
206
|
+
htmlFor: "new-download-name",
|
|
207
|
+
className: "block text-sm font-medium",
|
|
208
|
+
children: [
|
|
209
|
+
D("export.create.options.name", "Export Name"),
|
|
210
|
+
" ",
|
|
211
|
+
/* @__PURE__ */ v("span", {
|
|
212
|
+
"aria-hidden": "true",
|
|
213
|
+
className: "text-status-error-text",
|
|
214
|
+
children: "*"
|
|
215
|
+
})
|
|
216
|
+
]
|
|
217
|
+
}), /* @__PURE__ */ v("input", {
|
|
218
|
+
id: "new-download-name",
|
|
219
|
+
type: "text",
|
|
220
|
+
required: !0,
|
|
221
|
+
"aria-required": "true",
|
|
222
|
+
value: V.name,
|
|
223
|
+
onChange: (e) => {
|
|
224
|
+
U.current = !0, H((t) => ({
|
|
225
|
+
...t,
|
|
226
|
+
name: e.target.value
|
|
227
|
+
}));
|
|
228
|
+
},
|
|
229
|
+
className: w
|
|
230
|
+
})]
|
|
231
|
+
}),
|
|
232
|
+
/* @__PURE__ */ v("p", {
|
|
233
|
+
className: "text-sm text-text-secondary",
|
|
234
|
+
children: D("export.create.zipNote", "You'll get a ZIP file.")
|
|
235
|
+
})
|
|
236
|
+
]
|
|
237
|
+
}),
|
|
238
|
+
/* @__PURE__ */ y(Te, {
|
|
239
|
+
storageKey: "export.new.moreOptions",
|
|
240
|
+
children: [
|
|
241
|
+
P.length > 1 ? /* @__PURE__ */ y("fieldset", {
|
|
242
|
+
className: "space-y-2",
|
|
243
|
+
children: [/* @__PURE__ */ v("legend", {
|
|
244
|
+
className: "text-sm font-medium",
|
|
245
|
+
children: D("export.create.options.scope", "Export Scope")
|
|
246
|
+
}), /* @__PURE__ */ v("div", {
|
|
247
|
+
className: "grid grid-cols-1 gap-2 sm:grid-cols-3",
|
|
248
|
+
children: P.map((e) => /* @__PURE__ */ y("label", {
|
|
249
|
+
className: u("flex cursor-pointer items-start gap-2 rounded-lg border p-3 text-sm", V.scope === e ? "border-primary bg-action-primary-bg/5" : "border-border-subtle"),
|
|
250
|
+
children: [/* @__PURE__ */ v("input", {
|
|
251
|
+
type: "radio",
|
|
252
|
+
name: "new-download-scope",
|
|
253
|
+
value: e,
|
|
254
|
+
checked: V.scope === e,
|
|
255
|
+
onChange: () => H((t) => ({
|
|
256
|
+
...t,
|
|
257
|
+
scope: e
|
|
258
|
+
})),
|
|
259
|
+
className: "mt-1"
|
|
260
|
+
}), /* @__PURE__ */ y("span", { children: [/* @__PURE__ */ v("span", {
|
|
261
|
+
className: "block font-medium",
|
|
262
|
+
children: Q(e)
|
|
263
|
+
}), /* @__PURE__ */ v("span", {
|
|
264
|
+
className: "block text-xs text-text-secondary",
|
|
265
|
+
children: D(S[e].descKey, S[e].desc)
|
|
266
|
+
})] })]
|
|
267
|
+
}, e))
|
|
268
|
+
})]
|
|
269
|
+
}) : null,
|
|
270
|
+
/* @__PURE__ */ y("fieldset", {
|
|
271
|
+
className: "space-y-2",
|
|
272
|
+
children: [/* @__PURE__ */ v("legend", {
|
|
273
|
+
className: "text-sm font-medium",
|
|
274
|
+
children: D("export.create.options.outputFormat", "Output Format")
|
|
275
|
+
}), /* @__PURE__ */ v("div", {
|
|
276
|
+
className: "grid grid-cols-1 gap-2 sm:grid-cols-2",
|
|
277
|
+
children: oe.map((e) => /* @__PURE__ */ y("label", {
|
|
278
|
+
className: u("flex cursor-pointer items-center gap-2 rounded-lg border p-3 text-sm", V.format === e ? "border-primary bg-action-primary-bg/5" : "border-border-subtle"),
|
|
279
|
+
children: [/* @__PURE__ */ v("input", {
|
|
280
|
+
type: "radio",
|
|
281
|
+
name: "new-download-format",
|
|
282
|
+
value: e,
|
|
283
|
+
checked: V.format === e,
|
|
284
|
+
onChange: () => H((t) => ({
|
|
285
|
+
...t,
|
|
286
|
+
format: e
|
|
287
|
+
}))
|
|
288
|
+
}), $(e)]
|
|
289
|
+
}, e))
|
|
290
|
+
})]
|
|
291
|
+
}),
|
|
292
|
+
/* @__PURE__ */ y("fieldset", {
|
|
293
|
+
className: "space-y-2",
|
|
294
|
+
children: [
|
|
295
|
+
/* @__PURE__ */ y("legend", {
|
|
296
|
+
className: "text-sm font-medium",
|
|
297
|
+
children: [
|
|
298
|
+
D("export.create.options.dateRange", "Date Range"),
|
|
299
|
+
" ",
|
|
300
|
+
/* @__PURE__ */ v("span", {
|
|
301
|
+
className: "font-normal text-text-secondary",
|
|
302
|
+
children: D("export.create.shared.optional", "(optional)")
|
|
303
|
+
})
|
|
304
|
+
]
|
|
305
|
+
}),
|
|
306
|
+
/* @__PURE__ */ y("div", {
|
|
307
|
+
className: "grid grid-cols-1 gap-3 sm:grid-cols-2",
|
|
308
|
+
children: [/* @__PURE__ */ y("label", {
|
|
309
|
+
className: "space-y-1 text-xs text-text-secondary",
|
|
310
|
+
children: [/* @__PURE__ */ v("span", { children: D("export.create.options.dateFrom", "From") }), /* @__PURE__ */ v("input", {
|
|
311
|
+
type: "date",
|
|
312
|
+
value: V.dateFrom,
|
|
313
|
+
onChange: (e) => H((t) => ({
|
|
314
|
+
...t,
|
|
315
|
+
dateFrom: e.target.value
|
|
316
|
+
})),
|
|
317
|
+
className: w
|
|
318
|
+
})]
|
|
319
|
+
}), /* @__PURE__ */ y("label", {
|
|
320
|
+
className: "space-y-1 text-xs text-text-secondary",
|
|
321
|
+
children: [/* @__PURE__ */ v("span", { children: D("export.create.options.dateTo", "To") }), /* @__PURE__ */ v("input", {
|
|
322
|
+
type: "date",
|
|
323
|
+
value: V.dateTo,
|
|
324
|
+
min: V.dateFrom || void 0,
|
|
325
|
+
onChange: (e) => H((t) => ({
|
|
326
|
+
...t,
|
|
327
|
+
dateTo: e.target.value
|
|
328
|
+
})),
|
|
329
|
+
className: w
|
|
330
|
+
})]
|
|
331
|
+
})]
|
|
332
|
+
}),
|
|
333
|
+
/* @__PURE__ */ v("p", {
|
|
334
|
+
className: "text-xs text-text-secondary",
|
|
335
|
+
children: D("export.create.options.dateRangeDescription", "Leave blank to export all data regardless of date.")
|
|
336
|
+
})
|
|
337
|
+
]
|
|
338
|
+
}),
|
|
339
|
+
/* @__PURE__ */ y("div", {
|
|
340
|
+
className: "space-y-1",
|
|
341
|
+
children: [/* @__PURE__ */ y("label", {
|
|
342
|
+
htmlFor: "new-download-setup",
|
|
343
|
+
className: "block text-sm font-medium",
|
|
344
|
+
children: [
|
|
345
|
+
D("export.create.options.basedOnTemplate", "Based on Template"),
|
|
346
|
+
" ",
|
|
347
|
+
/* @__PURE__ */ v("span", {
|
|
348
|
+
className: "font-normal text-text-secondary",
|
|
349
|
+
children: D("export.create.shared.optional", "(optional)")
|
|
350
|
+
})
|
|
351
|
+
]
|
|
352
|
+
}), j.length > 0 ? /* @__PURE__ */ y("select", {
|
|
353
|
+
id: "new-download-setup",
|
|
354
|
+
value: V.templateId ?? "",
|
|
355
|
+
onChange: (e) => {
|
|
356
|
+
let t = j.find((t) => t.id === e.target.value);
|
|
357
|
+
H((e) => t ? o(e, t, F, U.current) : {
|
|
358
|
+
...e,
|
|
359
|
+
templateId: void 0
|
|
360
|
+
});
|
|
361
|
+
},
|
|
362
|
+
className: w,
|
|
363
|
+
children: [/* @__PURE__ */ v("option", {
|
|
364
|
+
value: "",
|
|
365
|
+
children: D("export.create.options.noTemplate", "No template")
|
|
366
|
+
}), j.map((e) => /* @__PURE__ */ v("option", {
|
|
367
|
+
value: e.id,
|
|
368
|
+
children: e.name
|
|
369
|
+
}, e.id))]
|
|
370
|
+
}) : /* @__PURE__ */ y("p", {
|
|
371
|
+
className: "text-sm text-text-secondary",
|
|
372
|
+
children: [
|
|
373
|
+
D("export.create.options.noTemplates", "No templates yet."),
|
|
374
|
+
" ",
|
|
375
|
+
/* @__PURE__ */ v("button", {
|
|
376
|
+
type: "button",
|
|
377
|
+
onClick: () => _?.(c(h, "templates")),
|
|
378
|
+
className: "text-primary underline-offset-2 hover:underline",
|
|
379
|
+
children: D("export.create.options.createTemplateLink", "Create one")
|
|
380
|
+
}),
|
|
381
|
+
" ",
|
|
382
|
+
D("export.create.options.reuseTemplateHint", "to reuse export configurations.")
|
|
383
|
+
]
|
|
384
|
+
})]
|
|
385
|
+
})
|
|
386
|
+
]
|
|
387
|
+
})
|
|
388
|
+
]
|
|
389
|
+
}),
|
|
390
|
+
/* @__PURE__ */ y("div", {
|
|
391
|
+
className: "flex flex-col-reverse gap-3 pt-2 sm:flex-row sm:justify-end",
|
|
392
|
+
children: [
|
|
393
|
+
/* @__PURE__ */ v(b, {
|
|
394
|
+
type: "button",
|
|
395
|
+
variant: "outline",
|
|
396
|
+
onClick: () => _?.(h),
|
|
397
|
+
children: D("export.create.actions.cancel", "Cancel")
|
|
398
|
+
}),
|
|
399
|
+
z === 1 && /* @__PURE__ */ v(b, {
|
|
400
|
+
type: "button",
|
|
401
|
+
variant: "outline",
|
|
402
|
+
onClick: () => B(0),
|
|
403
|
+
children: D("export.create.actions.back", "Back")
|
|
404
|
+
}),
|
|
405
|
+
z === 0 ? /* @__PURE__ */ y(b, {
|
|
406
|
+
type: "button",
|
|
407
|
+
onClick: Z,
|
|
408
|
+
children: [D("export.create.actions.next", "Next"), /* @__PURE__ */ v(le, {
|
|
409
|
+
size: 16,
|
|
410
|
+
"aria-hidden": "true"
|
|
411
|
+
})]
|
|
412
|
+
}) : /* @__PURE__ */ y(b, {
|
|
413
|
+
type: "button",
|
|
414
|
+
onClick: () => void Ne(),
|
|
415
|
+
disabled: k,
|
|
416
|
+
children: [k ? /* @__PURE__ */ v(ue, {
|
|
417
|
+
size: 16,
|
|
418
|
+
className: "animate-spin",
|
|
419
|
+
"aria-hidden": "true"
|
|
420
|
+
}) : /* @__PURE__ */ v(g, {
|
|
421
|
+
size: 16,
|
|
422
|
+
"aria-hidden": "true"
|
|
423
|
+
}), D("export.create.actions.startExport", "Start Export")]
|
|
424
|
+
})
|
|
425
|
+
]
|
|
426
|
+
}),
|
|
427
|
+
/* @__PURE__ */ v(ge, {
|
|
428
|
+
open: ke,
|
|
429
|
+
onOpenChange: q,
|
|
430
|
+
children: /* @__PURE__ */ y(ye, { children: [/* @__PURE__ */ y(Se, { children: [/* @__PURE__ */ v(Ce, { children: D("export.create.quotaDialog.title", "Export Limit Reached") }), /* @__PURE__ */ v(be, { children: D("export.create.quotaDialog.description", "You have reached your export limit for this month.") })] }), /* @__PURE__ */ y(xe, { children: [/* @__PURE__ */ v(ve, { children: D("export.create.quotaDialog.dismiss", "Dismiss") }), /* @__PURE__ */ v(_e, {
|
|
431
|
+
onClick: () => l(_),
|
|
432
|
+
children: D("export.create.quotaDialog.viewBilling", "View Billing")
|
|
433
|
+
})] })] })
|
|
434
|
+
})
|
|
435
|
+
]
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
export { E as NewDownloadPage };
|
|
439
|
+
|
|
440
|
+
//# sourceMappingURL=NewDownloadPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NewDownloadPage.js","names":["_Fragment","SCOPE_COPY","FORMAT_COPY","fieldClass","ChoiceCard","checked","onToggle","cn","Check","Minus","title","description","NewDownloadPage","useExport","tr","useTr","useCreateExportJob","availableEntities","useAvailableEntities","templates","useExportTemplates","searchParams","useSearchParams","hostProductSlug","useAppShell","canWorkspaceAdmin","usePermission","canOrgAdmin","useOrganizationExportPermission","organizationId","scopes","isSelectable","useCallback","isExportEntityDisabled","entityType","isForeignProductEntity","offered","useMemo","groups","offeredGroups","label","entityLabel","step","setStep","useState","form","setForm","DEFAULT_NEW_DOWNLOAD_FORM","nameTouchedRef","useRef","showAll","setShowAll","error","setError","showQuotaDialog","setShowQuotaDialog","appliedTemplateRef","paramId","setup","applySavedSetup","f","selected","setEntities","next","toggleEntity","e","toggleGroup","all","types","t","group","suggestedName","whole","entityTypes","covered","g","loose","what","suggestedDownloadName","goNext","submit","job","createJob","toCreateExportInput","joinPath","basePath","err","isQuotaExhaustedError","scopeLabel","scope","formatLabel","format","kinds","PageLayout","Download","Stepper","i","IllustratedEmptyState","Fragment","count","Button","entity","OptionalFields","SUPPORTED_FORMATS","navigate","ArrowRight","isPending","Loader2","AlertDialog","AlertDialogContent","AlertDialogHeader","AlertDialogTitle","AlertDialogDescription","AlertDialogFooter","AlertDialogCancel","AlertDialogAction","openBilling"],"sources":["../../../../src/export/pages/v2/NewDownloadPage.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useSearchParams } from \"react-router\";\nimport { isQuotaExhaustedError } from \"@burdenoff/fe-libs/shared/utils\";\nimport {\n useAppShell,\n usePermission,\n} from \"@burdenoff/fe-libs/shared/providers/shell\";\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n Button,\n IllustratedEmptyState,\n OptionalFields,\n Stepper,\n} from \"@burdenoff/fe-libs/ui\";\nimport { ArrowRight, Check, Download, Loader2, Minus } from \"lucide-react\";\nimport { useExport } from \"../../providers/ExportProvider\";\nimport {\n useAvailableEntities,\n useCreateExportJob,\n useExportTemplates,\n useOrganizationExportPermission,\n} from \"../../hooks/useExportQueries\";\nimport { useTr } from \"../../hooks/useTr\";\nimport { PageLayout } from \"../../components/PageLayout\";\nimport { entityLabel, offeredGroups } from \"../../utils/entityLabels\";\nimport {\n isExportEntityDisabled,\n isForeignProductEntity,\n} from \"../../utils/disabledModules\";\nimport {\n applySavedSetup,\n DEFAULT_NEW_DOWNLOAD_FORM,\n suggestedDownloadName,\n SUPPORTED_FORMATS,\n toCreateExportInput,\n type NewDownloadForm,\n} from \"../../utils/newDownloadForm\";\nimport { joinPath } from \"../../utils/paths\";\nimport { openBilling } from \"../../utils/billing\";\nimport { cn } from \"../../utils/cn\";\nimport type { ExportFormat, ExportScope } from \"../../types\";\n\ntype Step = 0 | 1;\n\nconst SCOPE_COPY: Record<\n ExportScope,\n { labelKey: string; label: string; descKey: string; desc: string }\n> = {\n INDIVIDUAL: {\n labelKey: \"export.create.scope.individual.label\",\n label: \"My Data Only\",\n descKey: \"export.create.scope.individual.description\",\n desc: \"Export data you personally created across selected modules.\",\n },\n WORKSPACE_ADMIN: {\n labelKey: \"export.create.scope.workspaceAdmin.label\",\n label: \"All Workspace Data\",\n descKey: \"export.create.scope.workspaceAdmin.description\",\n desc: \"Export all data in this workspace regardless of who created it. Requires workspace admin access.\",\n },\n ORG_ADMIN: {\n labelKey: \"export.create.scope.orgAdmin.label\",\n label: \"All Organization Data\",\n descKey: \"export.create.scope.orgAdmin.description\",\n desc: \"Export data from every workspace in your organization. Requires org-admin access.\",\n },\n};\n\nconst FORMAT_COPY: Record<ExportFormat, [string, string]> = {\n CSV: [\"export.format.csv\", \"CSV\"],\n JSON: [\"export.format.json\", \"JSON\"],\n};\n\nconst fieldClass =\n \"w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\";\n\n/** A card that toggles: a checkbox for the screen reader, a card for the eye. */\nfunction ChoiceCard({\n checked,\n onToggle,\n title,\n description,\n}: {\n checked: boolean | \"mixed\";\n onToggle: () => void;\n title: string;\n description?: string;\n}) {\n return (\n <button\n type=\"button\"\n role=\"checkbox\"\n aria-checked={checked}\n onClick={onToggle}\n className={cn(\n \"flex w-full items-start gap-3 rounded-xl border p-4 text-left transition-colors\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40\",\n checked === true\n ? \"border-primary bg-action-primary-bg/5\"\n : \"border-border-subtle hover:border-primary/40\",\n )}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n \"mt-0.5 flex size-5 shrink-0 items-center justify-center rounded border\",\n checked\n ? \"border-primary bg-action-primary-bg text-action-primary-text\"\n : \"border-border-default\",\n )}\n >\n {checked === true ? <Check size={14} /> : null}\n {checked === \"mixed\" ? <Minus size={14} /> : null}\n </span>\n <span className=\"min-w-0\">\n <span className=\"block font-medium text-text-primary\">{title}</span>\n {description ? (\n <span className=\"block text-sm text-text-secondary\">\n {description}\n </span>\n ) : null}\n </span>\n </button>\n );\n}\n\n/**\n * \"New download\" (Navigation v2, BOFF-11870): two short steps in place of the\n * three-tab wizard. Step 1 picks what to download from plain groups (\"Show all\n * data types\" lists the rest). Step 2 is a one-line summary, the prefilled\n * name and \"Start download\"; whose data, the format, a date range and a saved\n * setup sit in one \"More options\" fold. The service call is the wizard's.\n */\nexport function NewDownloadPage() {\n const { basePath = \"/\", navigate, organizationId } = useExport();\n const tr = useTr();\n const { createJob, isPending } = useCreateExportJob();\n const { data: availableEntities } = useAvailableEntities();\n const { data: templates } = useExportTemplates();\n const [searchParams] = useSearchParams();\n const { productSlug: hostProductSlug } = useAppShell();\n\n const canWorkspaceAdmin = usePermission(\"export:workspace_admin\");\n const canOrgAdmin = useOrganizationExportPermission(organizationId);\n // Scopes the person can't use are hidden, not shown locked.\n const scopes: ExportScope[] = [\n \"INDIVIDUAL\",\n ...(canWorkspaceAdmin ? ([\"WORKSPACE_ADMIN\"] as const) : []),\n ...(canOrgAdmin ? ([\"ORG_ADMIN\"] as const) : []),\n ];\n\n const isSelectable = useCallback(\n (entityType: string) =>\n !isExportEntityDisabled(entityType) &&\n !isForeignProductEntity(entityType, hostProductSlug),\n [hostProductSlug],\n );\n\n // Only what this person can download in this shell. Products whose\n // download isn't available yet are not listed at all.\n const offered = useMemo(\n () =>\n availableEntities.filter(\n (e) => e.enabled !== false && isSelectable(e.entityType),\n ),\n [availableEntities, isSelectable],\n );\n const groups = offeredGroups(offered.map((e) => e.entityType));\n const label = (entityType: string) =>\n entityLabel(entityType, tr, availableEntities);\n\n const [step, setStep] = useState<Step>(0);\n const [form, setForm] = useState<NewDownloadForm>(() => ({\n ...DEFAULT_NEW_DOWNLOAD_FORM,\n templateId: searchParams.get(\"templateId\") ?? undefined,\n }));\n // Only read in handlers: whether the person typed their own name.\n const nameTouchedRef = useRef(false);\n const [showAll, setShowAll] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [showQuotaDialog, setShowQuotaDialog] = useState(false);\n\n // Arriving from \"Use this setup\" (?templateId=): apply it once.\n const appliedTemplateRef = useRef<string | null>(null);\n useEffect(() => {\n const paramId = searchParams.get(\"templateId\");\n if (!paramId || !templates.length) return;\n if (appliedTemplateRef.current === paramId) return;\n const setup = templates.find((t) => t.id === paramId);\n if (!setup) return;\n appliedTemplateRef.current = paramId;\n setForm((f) => applySavedSetup(f, setup, isSelectable, false));\n }, [isSelectable, searchParams, templates]);\n\n const selected = new Set(form.entityTypes);\n const setEntities = (next: string[]) =>\n setForm((f) => ({ ...f, entityTypes: next }));\n const toggleEntity = (entityType: string) =>\n setEntities(\n selected.has(entityType)\n ? form.entityTypes.filter((e) => e !== entityType)\n : [...form.entityTypes, entityType],\n );\n const toggleGroup = (types: string[]) => {\n const all = types.every((t) => selected.has(t));\n const group = new Set(types);\n setEntities(\n all\n ? form.entityTypes.filter((e) => !group.has(e))\n : [...form.entityTypes, ...types.filter((t) => !selected.has(t))],\n );\n };\n\n // The name a download gets unless the person types one: the one group (or\n // data type) it covers, else \"My data\", with today's date.\n const suggestedName = () => {\n const whole = groups.filter(({ entityTypes }) =>\n entityTypes.every((t) => selected.has(t)),\n );\n const covered = new Set(whole.flatMap((g) => g.entityTypes));\n const loose = form.entityTypes.filter((t) => !covered.has(t));\n const what =\n whole.length === 1 && loose.length === 0\n ? tr(whole[0]!.group.labelKey, whole[0]!.group.label)\n : whole.length === 0 && loose.length === 1\n ? label(loose[0]!)\n : tr(\"export.create.name.myData\", \"My data\");\n return suggestedDownloadName(what);\n };\n\n const goNext = () => {\n if (form.entityTypes.length === 0) {\n setError(\n tr(\n \"export.create.errors.selectEntity\",\n \"Please select at least one entity type to export\",\n ),\n );\n return;\n }\n setError(null);\n if (!nameTouchedRef.current)\n setForm((f) => ({ ...f, name: suggestedName() }));\n setStep(1);\n };\n\n const submit = async () => {\n if (!form.name.trim()) {\n setError(\n tr(\n \"export.create.errors.exportNameRequired\",\n \"Please provide a name for this export\",\n ),\n );\n return;\n }\n setError(null);\n try {\n const job = await createJob(toCreateExportInput(form, organizationId));\n // Land on the new download's own page to watch it prepare.\n navigate?.(job?.id ? joinPath(basePath, job.id) : basePath);\n } catch (err) {\n if (isQuotaExhaustedError(err)) {\n setShowQuotaDialog(true);\n setError(\n tr(\n \"export.create.errors.quotaReached\",\n \"You have reached your export limit for this month.\",\n ),\n );\n return;\n }\n setError(\n err instanceof Error\n ? err.message\n : tr(\"export.create.errors.createFailed\", \"Failed to create export\"),\n );\n }\n };\n\n const scopeLabel = (scope: ExportScope) =>\n tr(SCOPE_COPY[scope].labelKey, SCOPE_COPY[scope].label);\n const formatLabel = (format: ExportFormat) =>\n tr(FORMAT_COPY[format][0], FORMAT_COPY[format][1]);\n const kinds = form.entityTypes.map(label);\n\n return (\n <PageLayout\n title={tr(\"export.create.title\", \"New Export\")}\n icon={<Download size={24} />}\n maxWidth=\"3xl\"\n >\n <Stepper\n steps={[\n {\n key: \"what\",\n label: tr(\n \"export.create.steps.what\",\n \"What do you want to download?\",\n ),\n },\n { key: \"review\", label: tr(\"export.create.steps.review\", \"Review\") },\n ]}\n active={step}\n onStepClick={(i) => {\n if (i === 0) setStep(0);\n }}\n />\n\n {error && (\n <p\n role=\"alert\"\n className=\"rounded-xl border border-border-default bg-status-error-bg-subtle p-4 text-sm text-status-error-text\"\n >\n {error}\n </p>\n )}\n\n {step === 0 && (\n <section aria-labelledby=\"new-download-what\" className=\"space-y-4\">\n <h2 id=\"new-download-what\" className=\"text-lg font-semibold\">\n {tr(\n \"export.create.select.question\",\n \"What do you want to download?\",\n )}\n </h2>\n {offered.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title={tr(\n \"export.create.select.emptyTitle\",\n \"Nothing to export yet\",\n )}\n description={tr(\n \"export.create.select.empty\",\n \"No exportable entity types are configured for this workspace yet. Once your workspace has data in supported modules, they'll show up here to select.\",\n )}\n />\n ) : (\n <>\n {groups.length > 0 && (\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n {groups.map(({ group, entityTypes }) => {\n const count = entityTypes.filter((t) =>\n selected.has(t),\n ).length;\n return (\n <ChoiceCard\n key={group.id}\n checked={\n count === entityTypes.length\n ? true\n : count > 0\n ? \"mixed\"\n : false\n }\n onToggle={() => toggleGroup(entityTypes)}\n title={tr(group.labelKey, group.label)}\n description={tr(\n group.descriptionKey,\n group.description,\n )}\n />\n );\n })}\n </div>\n )}\n <div className=\"space-y-3\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n aria-expanded={showAll || groups.length === 0}\n aria-controls=\"new-download-all-types\"\n onClick={() => setShowAll(!showAll)}\n hidden={groups.length === 0}\n >\n {showAll\n ? tr(\"export.create.select.hideAll\", \"Hide the full list\")\n : tr(\"export.create.select.showAll\", \"Show all data types\")}\n </Button>\n <div\n id=\"new-download-all-types\"\n hidden={!showAll && groups.length > 0}\n className=\"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3\"\n >\n {offered.map((entity) => (\n <ChoiceCard\n key={entity.entityType}\n checked={selected.has(entity.entityType)}\n onToggle={() => toggleEntity(entity.entityType)}\n title={label(entity.entityType)}\n />\n ))}\n </div>\n </div>\n </>\n )}\n </section>\n )}\n\n {step === 1 && (\n <section aria-labelledby=\"new-download-review\" className=\"space-y-4\">\n <h2 id=\"new-download-review\" className=\"sr-only\">\n {tr(\"export.create.steps.review\", \"Review\")}\n </h2>\n <div className=\"space-y-4 rounded-xl border border-border-subtle bg-bg-surface p-4 sm:p-6\">\n <p\n className=\"text-sm text-text-primary\"\n data-testid=\"new-download-summary\"\n >\n {tr(\n \"export.create.summary\",\n \"{{kinds}} · {{whose}} · {{format}}\",\n {\n kinds: kinds.join(\", \"),\n whose: scopeLabel(form.scope),\n format: formatLabel(form.format),\n },\n )}\n </p>\n <div className=\"space-y-1\">\n <label\n htmlFor=\"new-download-name\"\n className=\"block text-sm font-medium\"\n >\n {tr(\"export.create.options.name\", \"Export Name\")}{\" \"}\n <span aria-hidden=\"true\" className=\"text-status-error-text\">\n *\n </span>\n </label>\n <input\n id=\"new-download-name\"\n type=\"text\"\n required\n aria-required=\"true\"\n value={form.name}\n onChange={(e) => {\n nameTouchedRef.current = true;\n setForm((f) => ({ ...f, name: e.target.value }));\n }}\n className={fieldClass}\n />\n </div>\n <p className=\"text-sm text-text-secondary\">\n {tr(\"export.create.zipNote\", \"You'll get a ZIP file.\")}\n </p>\n </div>\n\n <OptionalFields storageKey=\"export.new.moreOptions\">\n {scopes.length > 1 ? (\n <fieldset className=\"space-y-2\">\n <legend className=\"text-sm font-medium\">\n {tr(\"export.create.options.scope\", \"Export Scope\")}\n </legend>\n <div className=\"grid grid-cols-1 gap-2 sm:grid-cols-3\">\n {scopes.map((scope) => (\n <label\n key={scope}\n className={cn(\n \"flex cursor-pointer items-start gap-2 rounded-lg border p-3 text-sm\",\n form.scope === scope\n ? \"border-primary bg-action-primary-bg/5\"\n : \"border-border-subtle\",\n )}\n >\n <input\n type=\"radio\"\n name=\"new-download-scope\"\n value={scope}\n checked={form.scope === scope}\n onChange={() => setForm((f) => ({ ...f, scope }))}\n className=\"mt-1\"\n />\n <span>\n <span className=\"block font-medium\">\n {scopeLabel(scope)}\n </span>\n <span className=\"block text-xs text-text-secondary\">\n {tr(\n SCOPE_COPY[scope].descKey,\n SCOPE_COPY[scope].desc,\n )}\n </span>\n </span>\n </label>\n ))}\n </div>\n </fieldset>\n ) : null}\n\n <fieldset className=\"space-y-2\">\n <legend className=\"text-sm font-medium\">\n {tr(\"export.create.options.outputFormat\", \"Output Format\")}\n </legend>\n <div className=\"grid grid-cols-1 gap-2 sm:grid-cols-2\">\n {SUPPORTED_FORMATS.map((format) => (\n <label\n key={format}\n className={cn(\n \"flex cursor-pointer items-center gap-2 rounded-lg border p-3 text-sm\",\n form.format === format\n ? \"border-primary bg-action-primary-bg/5\"\n : \"border-border-subtle\",\n )}\n >\n <input\n type=\"radio\"\n name=\"new-download-format\"\n value={format}\n checked={form.format === format}\n onChange={() => setForm((f) => ({ ...f, format }))}\n />\n {formatLabel(format)}\n </label>\n ))}\n </div>\n </fieldset>\n\n <fieldset className=\"space-y-2\">\n <legend className=\"text-sm font-medium\">\n {tr(\"export.create.options.dateRange\", \"Date Range\")}{\" \"}\n <span className=\"font-normal text-text-secondary\">\n {tr(\"export.create.shared.optional\", \"(optional)\")}\n </span>\n </legend>\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n <label className=\"space-y-1 text-xs text-text-secondary\">\n <span>{tr(\"export.create.options.dateFrom\", \"From\")}</span>\n <input\n type=\"date\"\n value={form.dateFrom}\n onChange={(e) =>\n setForm((f) => ({ ...f, dateFrom: e.target.value }))\n }\n className={fieldClass}\n />\n </label>\n <label className=\"space-y-1 text-xs text-text-secondary\">\n <span>{tr(\"export.create.options.dateTo\", \"To\")}</span>\n <input\n type=\"date\"\n value={form.dateTo}\n min={form.dateFrom || undefined}\n onChange={(e) =>\n setForm((f) => ({ ...f, dateTo: e.target.value }))\n }\n className={fieldClass}\n />\n </label>\n </div>\n <p className=\"text-xs text-text-secondary\">\n {tr(\n \"export.create.options.dateRangeDescription\",\n \"Leave blank to export all data regardless of date.\",\n )}\n </p>\n </fieldset>\n\n <div className=\"space-y-1\">\n <label\n htmlFor=\"new-download-setup\"\n className=\"block text-sm font-medium\"\n >\n {tr(\n \"export.create.options.basedOnTemplate\",\n \"Based on Template\",\n )}{\" \"}\n <span className=\"font-normal text-text-secondary\">\n {tr(\"export.create.shared.optional\", \"(optional)\")}\n </span>\n </label>\n {templates.length > 0 ? (\n <select\n id=\"new-download-setup\"\n value={form.templateId ?? \"\"}\n onChange={(e) => {\n const setup = templates.find(\n (t) => t.id === e.target.value,\n );\n setForm((f) =>\n setup\n ? applySavedSetup(\n f,\n setup,\n isSelectable,\n nameTouchedRef.current,\n )\n : { ...f, templateId: undefined },\n );\n }}\n className={fieldClass}\n >\n <option value=\"\">\n {tr(\"export.create.options.noTemplate\", \"No template\")}\n </option>\n {templates.map((t) => (\n <option key={t.id} value={t.id}>\n {t.name}\n </option>\n ))}\n </select>\n ) : (\n <p className=\"text-sm text-text-secondary\">\n {tr(\"export.create.options.noTemplates\", \"No templates yet.\")}{\" \"}\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, \"templates\"))}\n className=\"text-primary underline-offset-2 hover:underline\"\n >\n {tr(\n \"export.create.options.createTemplateLink\",\n \"Create one\",\n )}\n </button>{\" \"}\n {tr(\n \"export.create.options.reuseTemplateHint\",\n \"to reuse export configurations.\",\n )}\n </p>\n )}\n </div>\n </OptionalFields>\n </section>\n )}\n\n <div className=\"flex flex-col-reverse gap-3 pt-2 sm:flex-row sm:justify-end\">\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => navigate?.(basePath)}\n >\n {tr(\"export.create.actions.cancel\", \"Cancel\")}\n </Button>\n {step === 1 && (\n <Button type=\"button\" variant=\"outline\" onClick={() => setStep(0)}>\n {tr(\"export.create.actions.back\", \"Back\")}\n </Button>\n )}\n {step === 0 ? (\n <Button type=\"button\" onClick={goNext}>\n {tr(\"export.create.actions.next\", \"Next\")}\n <ArrowRight size={16} aria-hidden=\"true\" />\n </Button>\n ) : (\n <Button\n type=\"button\"\n onClick={() => void submit()}\n disabled={isPending}\n >\n {isPending ? (\n <Loader2 size={16} className=\"animate-spin\" aria-hidden=\"true\" />\n ) : (\n <Download size={16} aria-hidden=\"true\" />\n )}\n {tr(\"export.create.actions.startExport\", \"Start Export\")}\n </Button>\n )}\n </div>\n\n <AlertDialog open={showQuotaDialog} onOpenChange={setShowQuotaDialog}>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>\n {tr(\"export.create.quotaDialog.title\", \"Export Limit Reached\")}\n </AlertDialogTitle>\n <AlertDialogDescription>\n {tr(\n \"export.create.quotaDialog.description\",\n \"You have reached your export limit for this month.\",\n )}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>\n {tr(\"export.create.quotaDialog.dismiss\", \"Dismiss\")}\n </AlertDialogCancel>\n <AlertDialogAction onClick={() => openBilling(navigate)}>\n {tr(\"export.create.quotaDialog.viewBilling\", \"View Billing\")}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmDA,IAAMC,IAGF;CACF,YAAY;EACV,UAAU;EACV,OAAO;EACP,SAAS;EACT,MAAM;CACR;CACA,iBAAiB;EACf,UAAU;EACV,OAAO;EACP,SAAS;EACT,MAAM;CACR;CACA,WAAW;EACT,UAAU;EACV,OAAO;EACP,SAAS;EACT,MAAM;CACR;AACF,GAEMC,IAAsD;CAC1D,KAAK,CAAC,qBAAqB,KAAK;CAChC,MAAM,CAAC,sBAAsB,MAAM;AACrC,GAEMC,IACJ;AAGF,SAASC,EAAW,EAClB,YACA,aACA,UACA,kBAMC;CACD,OACE,kBAAC,UAAD;EACE,MAAK;EACL,MAAK;EACL,gBAAcC;EACd,SAASC;EACT,WAAWC,EACT,mFACA,iFACAF,MAAY,KACR,0CACA,8CACN;EAXF,UAAA,CAaE,kBAAC,QAAD;GACE,eAAY;GACZ,WAAWE,EACT,0EACAF,IACI,iEACA,uBACN;GAPF,UAAA,CASGA,MAAY,KAAO,kBAACG,GAAD,EAAO,MAAM,GAAK,CAAA,IAAI,MACzCH,MAAY,UAAU,kBAACI,GAAD,EAAO,MAAM,GAAK,CAAA,IAAI,IACzC;EACN,CAAA,GAAA,kBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA,CACE,kBAAC,QAAD;IAAM,WAAU;IAAuC,UAAAC;GAAY,CAAA,GAClEC,IACC,kBAAC,QAAD;IAAM,WAAU;IACb,UAAAA;GACG,CAAA,IACJ,IACA;EACA,CAAA,CAAA;;AAEZ;A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,IACC,kBAACC,IAAD;OAAS,MAAM;OAAI,WAAU;OAAe,eAAY;MAAQ,CAAA,IAEhE,kBAACb,GAAD;OAAU,MAAM;OAAI,eAAY;MAAQ,CAAA,GAEzChF,EAAG,qCAAqC,cAAc,CACjD;;IAEP;;GAEL,kBAAC8F,IAAD;IAAa,MAAMtD;IAAiB,cAAcC;IAChD,UAAA,kBAACsD,IAAD,EAAA,UAAA,CACE,kBAACC,IAAD,EAAA,UAAA,CACE,kBAACC,IAAD,EAAA,UACGjG,EAAG,mCAAmC,sBAAsB,EAC7C,CAAA,GAClB,kBAACkG,IAAD,EAAA,UACGlG,EACC,yCACA,oDACF,EACsB,CAAA,CACP,EAAA,CAAA,GACnB,kBAACmG,IAAD,EAAA,UAAA,CACE,kBAACC,IAAD,EAAA,UACGpG,EAAG,qCAAqC,SAAS,EACjC,CAAA,GACnB,kBAACqG,IAAD;KAAmB,eAAeC,EAAYZ,CAAQ;KACnD,UAAA1F,EAAG,yCAAyC,cAAc;IAC1C,CAAA,CACF,EAAA,CAAA,CACD,EAAA,CAAA;GACT,CAAA;EACH;;AAEhB"}
|
|
@@ -96,6 +96,13 @@ export interface ExportRootProps extends MicrofrontendRootProps {
|
|
|
96
96
|
* Injected by the shell app
|
|
97
97
|
*/
|
|
98
98
|
registerFooterItems?: (items: FooterItem | FooterItem[]) => () => void;
|
|
99
|
+
/**
|
|
100
|
+
* Opt in to FluidGrids' Navigation v2 pages (BOFF-11870): one "Download your
|
|
101
|
+
* data" list, a two-step "New download", plain status words and the
|
|
102
|
+
* BOFF-11841 shared pieces. Default `false`: the module renders exactly as
|
|
103
|
+
* before. Only fluidgrids-app passes it.
|
|
104
|
+
*/
|
|
105
|
+
navigationV2?: boolean;
|
|
99
106
|
}
|
|
100
107
|
/**
|
|
101
108
|
* Export job status
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "View billing" from the download-limit dialog goes through the host's own
|
|
3
|
+
* navigation (no full page reload). Only a host that passes no `navigate`
|
|
4
|
+
* falls back to a page load.
|
|
5
|
+
*/
|
|
6
|
+
export declare function openBilling(navigate: ((path: string) => void) | undefined): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.js","names":["openBilling","navigate"],"sources":["../../../src/export/utils/billing.ts"],"sourcesContent":["/**\n * \"View billing\" from the download-limit dialog goes through the host's own\n * navigation (no full page reload). Only a host that passes no `navigate`\n * falls back to a page load.\n */\nexport function openBilling(\n navigate: ((path: string) => void) | undefined,\n): void {\n if (navigate) navigate(\"/billing\");\n else window.location.assign(\"/billing\");\n}\n"],"mappings":";AAKA,SAAgBA,EACd,GACM;CACN,AAAIC,IAAUA,EAAS,UAAU,IAC5B,OAAO,SAAS,OAAO,UAAU;AACxC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ExportJobStatus } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Navigation v2's plain status words (BOFF-11870). Created, Queued and Running
|
|
4
|
+
* read as one "Preparing…" state; each finished state says what to do next.
|
|
5
|
+
*/
|
|
6
|
+
export type DownloadPhase = "preparing" | "ready" | "failed" | "cancelled" | "expired" | "deleted";
|
|
7
|
+
export declare function downloadPhase(status: ExportJobStatus): DownloadPhase;
|
|
8
|
+
/** Translation key and English for each phase. */
|
|
9
|
+
export declare const DOWNLOAD_PHASE_COPY: Readonly<Record<DownloadPhase, {
|
|
10
|
+
key: string;
|
|
11
|
+
label: string;
|
|
12
|
+
}>>;
|
|
13
|
+
export declare function isInProgress(status: ExportJobStatus): boolean;
|
|
14
|
+
/** Failed, cancelled and expired downloads can be started again. */
|
|
15
|
+
export declare function canTryAgain(status: ExportJobStatus): boolean;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// src/export/utils/downloadStatus.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
switch (e) {
|
|
4
|
+
case "CREATED":
|
|
5
|
+
case "QUEUED":
|
|
6
|
+
case "RUNNING": return "preparing";
|
|
7
|
+
case "COMPLETED": return "ready";
|
|
8
|
+
case "FAILED": return "failed";
|
|
9
|
+
case "CANCELLED": return "cancelled";
|
|
10
|
+
case "EXPIRED": return "expired";
|
|
11
|
+
default: return "deleted";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
var t = {
|
|
15
|
+
preparing: {
|
|
16
|
+
key: "export.status.preparing",
|
|
17
|
+
label: "Preparing…"
|
|
18
|
+
},
|
|
19
|
+
ready: {
|
|
20
|
+
key: "export.status.ready",
|
|
21
|
+
label: "Ready to download"
|
|
22
|
+
},
|
|
23
|
+
failed: {
|
|
24
|
+
key: "export.status.failed",
|
|
25
|
+
label: "Didn't finish"
|
|
26
|
+
},
|
|
27
|
+
cancelled: {
|
|
28
|
+
key: "export.status.cancelled",
|
|
29
|
+
label: "Cancelled"
|
|
30
|
+
},
|
|
31
|
+
expired: {
|
|
32
|
+
key: "export.status.expired",
|
|
33
|
+
label: "Link expired: start again"
|
|
34
|
+
},
|
|
35
|
+
deleted: {
|
|
36
|
+
key: "export.status.deleted",
|
|
37
|
+
label: "Deleted"
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
function n(t) {
|
|
41
|
+
return e(t) === "preparing";
|
|
42
|
+
}
|
|
43
|
+
function r(e) {
|
|
44
|
+
return e === "FAILED" || e === "CANCELLED" || e === "EXPIRED";
|
|
45
|
+
}
|
|
46
|
+
export { t as DOWNLOAD_PHASE_COPY, r as canTryAgain, e as downloadPhase, n as isInProgress };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=downloadStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"downloadStatus.js","names":["downloadPhase","status","DOWNLOAD_PHASE_COPY","isInProgress","canTryAgain"],"sources":["../../../src/export/utils/downloadStatus.ts"],"sourcesContent":["import type { ExportJobStatus } from \"../types\";\n\n/**\n * Navigation v2's plain status words (BOFF-11870). Created, Queued and Running\n * read as one \"Preparing…\" state; each finished state says what to do next.\n */\nexport type DownloadPhase =\n \"preparing\" | \"ready\" | \"failed\" | \"cancelled\" | \"expired\" | \"deleted\";\n\nexport function downloadPhase(status: ExportJobStatus): DownloadPhase {\n switch (status) {\n case \"CREATED\":\n case \"QUEUED\":\n case \"RUNNING\":\n return \"preparing\";\n case \"COMPLETED\":\n return \"ready\";\n case \"FAILED\":\n return \"failed\";\n case \"CANCELLED\":\n return \"cancelled\";\n case \"EXPIRED\":\n return \"expired\";\n default:\n return \"deleted\";\n }\n}\n\n/** Translation key and English for each phase. */\nexport const DOWNLOAD_PHASE_COPY: Readonly<\n Record<DownloadPhase, { key: string; label: string }>\n> = {\n preparing: { key: \"export.status.preparing\", label: \"Preparing…\" },\n ready: { key: \"export.status.ready\", label: \"Ready to download\" },\n failed: { key: \"export.status.failed\", label: \"Didn't finish\" },\n cancelled: { key: \"export.status.cancelled\", label: \"Cancelled\" },\n expired: {\n key: \"export.status.expired\",\n label: \"Link expired: start again\",\n },\n deleted: { key: \"export.status.deleted\", label: \"Deleted\" },\n};\n\nexport function isInProgress(status: ExportJobStatus): boolean {\n return downloadPhase(status) === \"preparing\";\n}\n\n/** Failed, cancelled and expired downloads can be started again. */\nexport function canTryAgain(status: ExportJobStatus): boolean {\n return status === \"FAILED\" || status === \"CANCELLED\" || status === \"EXPIRED\";\n}\n"],"mappings":";AASA,SAAgBA,EAAc,GAAwC;CACpE,QAAQC,GAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK,WACH,OAAO;EACT,KAAK,aACH,OAAO;EACT,KAAK,UACH,OAAO;EACT,KAAK,aACH,OAAO;EACT,KAAK,WACH,OAAO;EACT,SACE,OAAO;CACX;AACF;AAGA,IAAaC,IAET;CACF,WAAW;EAAE,KAAK;EAA2B,OAAO;CAAa;CACjE,OAAO;EAAE,KAAK;EAAuB,OAAO;CAAoB;CAChE,QAAQ;EAAE,KAAK;EAAwB,OAAO;CAAgB;CAC9D,WAAW;EAAE,KAAK;EAA2B,OAAO;CAAY;CAChE,SAAS;EACP,KAAK;EACL,OAAO;CACT;CACA,SAAS;EAAE,KAAK;EAAyB,OAAO;CAAU;AAC5D;AAEA,SAAgBC,EAAa,GAAkC;CAC7D,OAAOH,EAAcC,CAAM,MAAM;AACnC;AAGA,SAAgBG,EAAY,GAAkC;CAC5D,OAAOH,MAAW,YAAYA,MAAW,eAAeA,MAAW;AACrE"}
|