@burdenoff/microfe-export 2026.1125.2 → 2026.1127.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/pages/ExportDashboardPage.js +119 -114
- package/dist/export/pages/ExportDashboardPage.js.map +1 -1
- package/dist/export/pages/ExportHistoryPage.js +157 -151
- package/dist/export/pages/ExportHistoryPage.js.map +1 -1
- package/dist/export/pages/ExportTemplatesPage.js +75 -70
- package/dist/export/pages/ExportTemplatesPage.js.map +1 -1
- package/dist/export/providers/ExportProvider.js +37 -37
- package/dist/export/utils/cn.js +2 -2
- package/dist/export/utils/permissionDenied.d.ts +33 -0
- package/dist/export/utils/permissionDenied.js +55 -0
- package/dist/export/utils/permissionDenied.js.map +1 -0
- package/dist/export/workspace-v2/SetupsList.js +0 -1
- package/dist/export/workspace-v2/SetupsList.js.map +1 -1
- package/dist/index.js +0 -1
- package/dist/translations/en.d.ts +3 -0
- package/dist/translations/en.js +3 -0
- package/dist/translations/en.js.map +1 -1
- package/package.json +5 -2
- package/dist/export/index.js +0 -5
- package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js +0 -23
- package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js.map +0 -1
- package/dist/node_modules/@apollo/client/errors/utils.js +0 -15
- package/dist/node_modules/@apollo/client/errors/utils.js.map +0 -1
- package/dist/node_modules/@apollo/client/link/core/ApolloLink.js +0 -51
- package/dist/node_modules/@apollo/client/link/core/ApolloLink.js.map +0 -1
- package/dist/node_modules/@apollo/client/link/subscriptions/index.js +0 -40
- package/dist/node_modules/@apollo/client/link/subscriptions/index.js.map +0 -1
- package/dist/node_modules/@apollo/client/link/utils/createOperation.js +0 -33
- package/dist/node_modules/@apollo/client/link/utils/createOperation.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/caching/sizes.js +0 -5
- package/dist/node_modules/@apollo/client/utilities/caching/sizes.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/graphql/print.js +0 -15
- package/dist/node_modules/@apollo/client/utilities/graphql/print.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/caches.js +0 -18
- package/dist/node_modules/@apollo/client/utilities/internal/caches.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/checkDocument.js +0 -20
- package/dist/node_modules/@apollo/client/utilities/internal/checkDocument.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getMainDefinition.js +0 -16
- package/dist/node_modules/@apollo/client/utilities/internal/getMainDefinition.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getMemoryInternals.js +0 -8
- package/dist/node_modules/@apollo/client/utilities/internal/getMemoryInternals.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationDefinition.js +0 -8
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationDefinition.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationName.js +0 -7
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationName.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js +0 -8
- package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js +0 -9
- package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js +0 -7
- package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js +0 -9
- package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/memoize.js +0 -22
- package/dist/node_modules/@apollo/client/utilities/internal/memoize.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js +0 -9
- package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/invariant/index.js +0 -56
- package/dist/node_modules/@apollo/client/utilities/invariant/index.js.map +0 -1
- package/dist/node_modules/@apollo/client/version.js +0 -5
- package/dist/node_modules/@apollo/client/version.js.map +0 -1
- package/dist/node_modules/@wry/caches/lib/weak.js +0 -66
- package/dist/node_modules/@wry/caches/lib/weak.js.map +0 -1
- package/dist/node_modules/@wry/trie/lib/index.js +0 -52
- package/dist/node_modules/@wry/trie/lib/index.js.map +0 -1
- package/dist/node_modules/clsx/dist/clsx.js +0 -19
- package/dist/node_modules/clsx/dist/clsx.js.map +0 -1
- package/dist/node_modules/graphql-ws/dist/client.js +0 -279
- package/dist/node_modules/graphql-ws/dist/client.js.map +0 -1
- package/dist/node_modules/graphql-ws/dist/common-CGW11Fyb.js +0 -61
- package/dist/node_modules/graphql-ws/dist/common-CGW11Fyb.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js +0 -20
- package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js +0 -77
- package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js +0 -116
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js +0 -96
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/config.js +0 -11
- package/dist/node_modules/rxjs/dist/esm5/internal/config.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/observable/empty.js +0 -8
- package/dist/node_modules/rxjs/dist/esm5/internal/observable/empty.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +0 -15
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js +0 -7
- package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +0 -12
- package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +0 -10
- package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +0 -10
- package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +0 -21
- package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js +0 -7
- package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +0 -7
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js +0 -5
- package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js +0 -12
- package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +0 -13
- package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js.map +0 -1
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +0 -1778
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +0 -1
- package/dist/node_modules/tslib/tslib.es6.js +0 -51
- package/dist/node_modules/tslib/tslib.es6.js.map +0 -1
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
import { useExport as e } from "../providers/ExportProvider.js";
|
|
2
|
-
import { useAvailableEntities as t, useCreateExportTemplate as ee, useDeleteExportTemplate as te, useExportTemplates as
|
|
3
|
-
import { PageLayout as
|
|
4
|
-
import { DownloadsTabs as
|
|
5
|
-
import { ConfirmDestructiveDialog as
|
|
2
|
+
import { useAvailableEntities as t, useCreateExportTemplate as ee, useDeleteExportTemplate as te, useExportTemplates as n } from "../hooks/useExportQueries.js";
|
|
3
|
+
import { PageLayout as r } from "../components/PageLayout.js";
|
|
4
|
+
import { DownloadsTabs as i } from "../components/DownloadsTabs.js";
|
|
5
|
+
import { ConfirmDestructiveDialog as ne } from "../components/ConfirmDestructiveDialog.js";
|
|
6
6
|
import { useNavigationV2 as re } from "../navigation-v2/NavigationV2.js";
|
|
7
7
|
import { useEntityLabel as ie } from "../hooks/useEntityLabel.js";
|
|
8
8
|
import { isExportEntityDisabled as ae, isForeignProductEntity as oe } from "../utils/disabledModules.js";
|
|
9
9
|
import { getFormatDisplayName as se } from "../constants/enums.js";
|
|
10
10
|
import { useTr as ce } from "../hooks/useTr.js";
|
|
11
11
|
import { cn as a } from "../utils/cn.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
12
|
+
import { isPermissionDenied as le } from "../utils/permissionDenied.js";
|
|
13
|
+
import { nativeImpact as ue, nativeNotify as o } from "../../utils/nativeBridge.js";
|
|
14
|
+
import { SkeletonBlock as s, SpinnerIcon as c } from "../components/loadingSystem.js";
|
|
15
|
+
import { useMemo as l, useState as u } from "react";
|
|
16
|
+
import { ChevronRight as d, FileBox as f, Plus as p, Search as de, Sparkles as fe, X as m } from "lucide-react";
|
|
17
|
+
import { useAppShell as pe } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
17
18
|
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
18
|
-
import { CTAOverflowMenu as
|
|
19
|
+
import { CTAOverflowMenu as me, IllustratedEmptyState as he, LoadError as ge, PagePurpose as _e, ThemedSelect as ve } from "@burdenoff/fe-libs/ui";
|
|
19
20
|
// src/export/pages/ExportTemplatesPage.tsx
|
|
20
21
|
var _ = (e, t) => (e.endsWith("/") ? e.slice(0, -1) : e) + (t.startsWith("/") ? t : `/${t}`);
|
|
21
22
|
function v() {
|
|
22
|
-
let { basePath: v = "/", navigate: y } = e(), b = ce(), { data: x, isLoading: S } =
|
|
23
|
+
let { basePath: v = "/", navigate: y } = e(), b = ce(), { data: x, isLoading: S, error: C } = n(), ye = le(C), { deleteTemplate: be } = te(), { createTemplate: xe, isPending: w } = ee(), { data: T } = t(), E = re(), D = ie(E), { productSlug: O } = pe(), k = T.filter((e) => e.enabled !== !1 && !ae(e.entityType) && !oe(e.entityType, O)), [A, j] = u(null), [M, N] = u(!1), [P, F] = u(""), [Se, I] = u(!1), [L, R] = u(""), [z, B] = u(""), [V, H] = u([]), [U, W] = u("CSV"), [G, K] = u(null), [q, J] = u(null), Y = () => {
|
|
23
24
|
R(""), B(""), H([]), W("CSV"), K(null), I(!0);
|
|
24
|
-
},
|
|
25
|
+
}, Ce = async () => {
|
|
25
26
|
if (!L.trim()) K(b("export.templates.form.errors.nameRequired", "Template name is required."));
|
|
26
27
|
else if (V.length === 0) K(b("export.templates.form.errors.entityRequired", "Select at least one entity type."));
|
|
27
28
|
else {
|
|
28
29
|
K(null);
|
|
29
30
|
try {
|
|
30
|
-
await
|
|
31
|
+
await xe({
|
|
31
32
|
name: L.trim(),
|
|
32
33
|
description: z.trim() || void 0,
|
|
33
34
|
entityTypes: V,
|
|
@@ -37,64 +38,64 @@ function v() {
|
|
|
37
38
|
K(e instanceof Error ? e.message : b("export.templates.form.errors.createFailed", "Failed to create template."));
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
|
-
},
|
|
41
|
+
}, we = (e) => {
|
|
41
42
|
H((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
|
|
42
|
-
}, X =
|
|
43
|
-
if (!
|
|
44
|
-
let e =
|
|
45
|
-
return x.filter((t) => t.name.toLowerCase().includes(e) || t.entityTypes.some((t) => t.toLowerCase().includes(e) ||
|
|
43
|
+
}, X = l(() => {
|
|
44
|
+
if (!P) return x;
|
|
45
|
+
let e = P.toLowerCase();
|
|
46
|
+
return x.filter((t) => t.name.toLowerCase().includes(e) || t.entityTypes.some((t) => t.toLowerCase().includes(e) || D(t).toLowerCase().includes(e)));
|
|
46
47
|
}, [
|
|
47
48
|
x,
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
P,
|
|
50
|
+
D
|
|
50
51
|
]), Z = (e) => {
|
|
51
52
|
y?.(_(v, `templates/${e}`));
|
|
52
|
-
},
|
|
53
|
-
e.stopPropagation(),
|
|
53
|
+
}, Te = async (e, t) => {
|
|
54
|
+
e.stopPropagation(), ue("medium"), J(t);
|
|
54
55
|
}, Q = () => {
|
|
55
|
-
J(null),
|
|
56
|
+
J(null), j(null);
|
|
56
57
|
}, $ = async () => {
|
|
57
58
|
if (q) {
|
|
58
|
-
|
|
59
|
+
j(null), N(!0);
|
|
59
60
|
try {
|
|
60
|
-
await
|
|
61
|
+
await be(q), o("success"), J(null);
|
|
61
62
|
} catch (e) {
|
|
62
|
-
o("error"),
|
|
63
|
+
o("error"), j(e instanceof Error && e.message ? e.message : b("export.templates.delete.failed", "Couldn't delete this template. Try again."));
|
|
63
64
|
} finally {
|
|
64
|
-
|
|
65
|
+
N(!1);
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
|
-
},
|
|
68
|
-
return /* @__PURE__ */ g(
|
|
68
|
+
}, Ee = x.find((e) => e.id === q)?.name ?? "";
|
|
69
|
+
return /* @__PURE__ */ g(r, {
|
|
69
70
|
title: b("export.templates.title", "Export Templates"),
|
|
70
71
|
subtitle: b("export.templates.subtitle", "Reusable export configurations for common data exports"),
|
|
71
|
-
icon: /* @__PURE__ */ h(
|
|
72
|
-
headerActions: /* @__PURE__ */ h(
|
|
72
|
+
icon: /* @__PURE__ */ h(f, { size: 24 }),
|
|
73
|
+
headerActions: /* @__PURE__ */ h(me, {
|
|
73
74
|
primary: {
|
|
74
75
|
label: b("export.templates.actions.newTemplate", "New Template"),
|
|
75
|
-
icon: /* @__PURE__ */ h(
|
|
76
|
+
icon: /* @__PURE__ */ h(p, { size: 16 }),
|
|
76
77
|
onSelect: Y
|
|
77
78
|
},
|
|
78
79
|
actions: [{
|
|
79
80
|
label: b("export.templates.actions.newExport", "New Export"),
|
|
80
|
-
icon: /* @__PURE__ */ h(
|
|
81
|
+
icon: /* @__PURE__ */ h(p, { size: 16 }),
|
|
81
82
|
onSelect: () => y?.(_(v, "new"))
|
|
82
83
|
}]
|
|
83
84
|
}),
|
|
84
85
|
headerContent: /* @__PURE__ */ g("span", {
|
|
85
86
|
className: "inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-bg-sunken text-text-secondary",
|
|
86
|
-
children: [/* @__PURE__ */ h(
|
|
87
|
+
children: [/* @__PURE__ */ h(fe, { size: 12 }), E ? X.length === 1 ? b("export.templates.summary.one", "1 setup") : b("export.templates.summary.other", "{{count}} setups", { count: X.length }) : b("export.templates.summary.available", "{{count}} template{{suffix}} available", {
|
|
87
88
|
count: X.length,
|
|
88
89
|
suffix: X.length === 1 ? "" : "s"
|
|
89
90
|
})]
|
|
90
91
|
}),
|
|
91
92
|
children: [
|
|
92
|
-
|
|
93
|
-
/* @__PURE__ */ h(
|
|
94
|
-
icon: /* @__PURE__ */ h(
|
|
93
|
+
E && /* @__PURE__ */ h(i, {}),
|
|
94
|
+
/* @__PURE__ */ h(_e, {
|
|
95
|
+
icon: /* @__PURE__ */ h(f, { size: 16 }),
|
|
95
96
|
children: b("export.templates.purpose", "Templates save an export setup — the entity types and format you regularly need — so you don't rebuild it each time. Create one here, then start a new export from it in a single click. Handy for recurring backups, periodic audits, or any export you run more than once.")
|
|
96
97
|
}),
|
|
97
|
-
|
|
98
|
+
Se && /* @__PURE__ */ g("div", {
|
|
98
99
|
className: "border border-primary/30 rounded-xl p-6 bg-accent-wash space-y-4",
|
|
99
100
|
children: [
|
|
100
101
|
/* @__PURE__ */ g("div", {
|
|
@@ -133,7 +134,7 @@ function v() {
|
|
|
133
134
|
children: [/* @__PURE__ */ g("label", {
|
|
134
135
|
className: "text-sm font-medium",
|
|
135
136
|
children: [b("export.templates.form.fields.format", "Format"), " *"]
|
|
136
|
-
}), /* @__PURE__ */ g(
|
|
137
|
+
}), /* @__PURE__ */ g(ve, {
|
|
137
138
|
value: U,
|
|
138
139
|
onChange: (e) => W(e.target.value),
|
|
139
140
|
className: "w-full px-3 py-2 border-2 border-border-subtle rounded-lg bg-bg-surface focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
|
|
@@ -176,11 +177,11 @@ function v() {
|
|
|
176
177
|
]
|
|
177
178
|
}), /* @__PURE__ */ h("div", {
|
|
178
179
|
className: "flex flex-wrap gap-2",
|
|
179
|
-
children:
|
|
180
|
+
children: k.map((e) => /* @__PURE__ */ h("button", {
|
|
180
181
|
type: "button",
|
|
181
|
-
onClick: () =>
|
|
182
|
+
onClick: () => we(e.entityType),
|
|
182
183
|
className: a("px-3 py-1.5 rounded-lg text-sm font-medium border-2 transition-all", V.includes(e.entityType) ? "border-primary bg-action-primary-bg/10 text-primary" : "border-border-subtle bg-bg-surface hover:border-primary/50"),
|
|
183
|
-
children:
|
|
184
|
+
children: E ? D(e.entityType) : e.displayName
|
|
184
185
|
}, e.entityType))
|
|
185
186
|
})]
|
|
186
187
|
}),
|
|
@@ -188,14 +189,14 @@ function v() {
|
|
|
188
189
|
className: "flex gap-3 pt-2",
|
|
189
190
|
children: [/* @__PURE__ */ g("button", {
|
|
190
191
|
type: "button",
|
|
191
|
-
onClick:
|
|
192
|
-
disabled:
|
|
192
|
+
onClick: Ce,
|
|
193
|
+
disabled: w,
|
|
193
194
|
className: "inline-flex items-center gap-2 px-5 py-2.5 bg-action-primary-bg text-action-primary-text rounded-lg hover:bg-action-primary-bg/90 transition-colors font-medium disabled:opacity-50",
|
|
194
|
-
children: [
|
|
195
|
+
children: [w ? /* @__PURE__ */ h(c, {
|
|
195
196
|
tone: "current",
|
|
196
197
|
size: 16,
|
|
197
198
|
className: "animate-spin"
|
|
198
|
-
}) : /* @__PURE__ */ h(
|
|
199
|
+
}) : /* @__PURE__ */ h(p, { size: 16 }), b("export.templates.form.actions.create", "Create Template")]
|
|
199
200
|
}), /* @__PURE__ */ h("button", {
|
|
200
201
|
type: "button",
|
|
201
202
|
onClick: () => I(!1),
|
|
@@ -208,7 +209,7 @@ function v() {
|
|
|
208
209
|
/* @__PURE__ */ g("div", {
|
|
209
210
|
className: "relative group",
|
|
210
211
|
children: [
|
|
211
|
-
/* @__PURE__ */ h(
|
|
212
|
+
/* @__PURE__ */ h(de, {
|
|
212
213
|
size: 18,
|
|
213
214
|
className: "absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary group-focus-within:text-primary transition-colors"
|
|
214
215
|
}),
|
|
@@ -216,13 +217,13 @@ function v() {
|
|
|
216
217
|
type: "text",
|
|
217
218
|
"aria-label": b("export.templates.search.placeholder", "Search templates"),
|
|
218
219
|
placeholder: b("export.templates.search.placeholder", "Search templates..."),
|
|
219
|
-
value:
|
|
220
|
-
onChange: (e) =>
|
|
220
|
+
value: P,
|
|
221
|
+
onChange: (e) => F(e.target.value),
|
|
221
222
|
className: "w-full pl-[3.25rem] pr-4 py-2.5 border-2 border-border-subtle rounded-lg bg-bg-surface focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all duration-200"
|
|
222
223
|
}),
|
|
223
|
-
|
|
224
|
+
P && /* @__PURE__ */ h("button", {
|
|
224
225
|
type: "button",
|
|
225
|
-
onClick: () =>
|
|
226
|
+
onClick: () => F(""),
|
|
226
227
|
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 rounded-md text-text-secondary hover:text-text-primary hover:bg-accent",
|
|
227
228
|
children: /* @__PURE__ */ h(m, { size: 16 })
|
|
228
229
|
})
|
|
@@ -247,7 +248,11 @@ function v() {
|
|
|
247
248
|
]
|
|
248
249
|
}, t))
|
|
249
250
|
}),
|
|
250
|
-
S ? null :
|
|
251
|
+
S ? null : ye ? /* @__PURE__ */ h(ge, {
|
|
252
|
+
kind: "denied",
|
|
253
|
+
what: b("export.templates.deniedWhat", "export templates"),
|
|
254
|
+
error: C
|
|
255
|
+
}) : X.length > 0 ? /* @__PURE__ */ h("div", {
|
|
251
256
|
className: "grid grid-cols-1 lg:grid-cols-2 gap-4",
|
|
252
257
|
children: X.map((e, t) => /* @__PURE__ */ g("div", {
|
|
253
258
|
role: "button",
|
|
@@ -266,7 +271,7 @@ function v() {
|
|
|
266
271
|
className: "flex items-center gap-3",
|
|
267
272
|
children: [/* @__PURE__ */ h("div", {
|
|
268
273
|
className: "p-2 rounded-lg bg-action-primary-bg/10",
|
|
269
|
-
children: /* @__PURE__ */ h(
|
|
274
|
+
children: /* @__PURE__ */ h(f, {
|
|
270
275
|
size: 20,
|
|
271
276
|
className: "text-primary"
|
|
272
277
|
})
|
|
@@ -284,11 +289,11 @@ function v() {
|
|
|
284
289
|
className: "flex items-center gap-2",
|
|
285
290
|
children: [/* @__PURE__ */ h("button", {
|
|
286
291
|
type: "button",
|
|
287
|
-
onClick: (t) =>
|
|
292
|
+
onClick: (t) => Te(t, e.id),
|
|
288
293
|
className: "p-1.5 rounded-md text-text-secondary hover:text-status-error-text hover:bg-status-error-bg/10 transition-colors",
|
|
289
294
|
"aria-label": b("export.templates.card.deleteAriaLabel", "Delete {{name}}", { name: e.name }),
|
|
290
295
|
children: /* @__PURE__ */ h(m, { size: 14 })
|
|
291
|
-
}), /* @__PURE__ */ h(
|
|
296
|
+
}), /* @__PURE__ */ h(d, {
|
|
292
297
|
size: 18,
|
|
293
298
|
className: "text-text-secondary group-hover:text-primary transition-colors mt-1"
|
|
294
299
|
})]
|
|
@@ -303,7 +308,7 @@ function v() {
|
|
|
303
308
|
className: "flex flex-wrap gap-1.5 overflow-hidden",
|
|
304
309
|
children: [e.entityTypes.slice(0, 6).map((e) => /* @__PURE__ */ h("span", {
|
|
305
310
|
className: "inline-flex px-2 py-0.5 rounded text-xs font-medium bg-bg-sunken text-text-secondary max-w-full truncate",
|
|
306
|
-
children:
|
|
311
|
+
children: D(e)
|
|
307
312
|
}, e)), e.entityTypes.length > 6 && /* @__PURE__ */ h("span", {
|
|
308
313
|
className: "inline-flex px-2 py-0.5 rounded text-xs font-medium bg-bg-sunken text-text-secondary",
|
|
309
314
|
children: b("export.templates.card.moreEntities", "+{{count}} more", { count: e.entityTypes.length - 6 })
|
|
@@ -311,35 +316,35 @@ function v() {
|
|
|
311
316
|
})]
|
|
312
317
|
})]
|
|
313
318
|
}, e.id))
|
|
314
|
-
}) : /* @__PURE__ */ h(
|
|
315
|
-
illustration:
|
|
316
|
-
title:
|
|
317
|
-
description:
|
|
318
|
-
action:
|
|
319
|
+
}) : /* @__PURE__ */ h(he, {
|
|
320
|
+
illustration: P ? "empty-search" : "empty-data",
|
|
321
|
+
title: P ? b("export.templates.empty.filtered.title", "No matching templates") : b("export.templates.empty.title", "No templates yet"),
|
|
322
|
+
description: P ? b("export.templates.empty.filtered.description", "Try adjusting your search to find what you are looking for.") : b("export.templates.empty.description", "Create a template to save reusable export configurations."),
|
|
323
|
+
action: P ? /* @__PURE__ */ g("button", {
|
|
319
324
|
type: "button",
|
|
320
|
-
onClick: () =>
|
|
325
|
+
onClick: () => F(""),
|
|
321
326
|
className: "inline-flex items-center gap-2 px-4 py-2 border-2 border-border-subtle rounded-lg hover:bg-accent transition-colors font-medium",
|
|
322
327
|
children: [/* @__PURE__ */ h(m, { size: 16 }), b("export.templates.empty.filtered.actions.clear", "Clear Search")]
|
|
323
328
|
}) : /* @__PURE__ */ g("button", {
|
|
324
329
|
type: "button",
|
|
325
330
|
onClick: Y,
|
|
326
331
|
className: "inline-flex items-center gap-2 px-4 py-2 bg-action-primary-bg text-action-primary-text rounded-lg hover:bg-action-primary-bg/90 transition-colors font-medium",
|
|
327
|
-
children: [/* @__PURE__ */ h(
|
|
332
|
+
children: [/* @__PURE__ */ h(p, { size: 16 }), b("export.templates.empty.actions.newTemplate", "New Template")]
|
|
328
333
|
}),
|
|
329
|
-
kind:
|
|
334
|
+
kind: P ? "no-results" : "first-use",
|
|
330
335
|
glassIllustration: "documents"
|
|
331
336
|
}),
|
|
332
|
-
|
|
337
|
+
E ? /* @__PURE__ */ h(ne, {
|
|
333
338
|
open: q !== null,
|
|
334
339
|
onOpenChange: (e) => {
|
|
335
340
|
e || Q();
|
|
336
341
|
},
|
|
337
|
-
title: b("export.templates.delete.named", "Delete “{{name}}”?", { name:
|
|
342
|
+
title: b("export.templates.delete.named", "Delete “{{name}}”?", { name: Ee }),
|
|
338
343
|
description: b("export.templates.delete.description", "This removes the saved export configuration. Existing export jobs are not deleted."),
|
|
339
344
|
confirmLabel: b("export.templates.delete.confirmAction", "Delete Template"),
|
|
340
345
|
keepLabel: b("export.templates.delete.cancel", "Keep Template"),
|
|
341
|
-
busy:
|
|
342
|
-
error:
|
|
346
|
+
busy: M,
|
|
347
|
+
error: A,
|
|
343
348
|
onConfirm: () => void $()
|
|
344
349
|
}) : q && /* @__PURE__ */ h("div", {
|
|
345
350
|
role: "dialog",
|
|
@@ -358,10 +363,10 @@ function v() {
|
|
|
358
363
|
className: "mt-2 text-sm text-text-secondary",
|
|
359
364
|
children: b("export.templates.delete.description", "This removes the saved export configuration. Existing export jobs are not deleted.")
|
|
360
365
|
}),
|
|
361
|
-
|
|
366
|
+
A && /* @__PURE__ */ h("p", {
|
|
362
367
|
role: "alert",
|
|
363
368
|
className: "mt-3 rounded-lg bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
|
|
364
|
-
children:
|
|
369
|
+
children: A
|
|
365
370
|
}),
|
|
366
371
|
/* @__PURE__ */ g("div", {
|
|
367
372
|
className: "mt-6 flex flex-col-reverse sm:flex-row sm:justify-end gap-3",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExportTemplatesPage.js","names":["joinPath","base","path","ExportTemplatesPage","useExport","tr","useTr","templates","useExportTemplates","useDeleteExportTemplate","creating","useCreateExportTemplate","availableEntities","useAvailableEntities","navigationV2","useNavigationV2","label","useEntityLabel","hostProductSlug","useAppShell","selectableEntities","isExportEntityDisabled","isForeignProductEntity","deleteError","setDeleteError","useState","deletingTemplate","setDeletingTemplate","searchQuery","setSearchQuery","showCreateForm","setShowCreateForm","newTemplateName","setNewTemplateName","newTemplateDescription","setNewTemplateDescription","newTemplateEntityTypes","setNewTemplateEntityTypes","newTemplateFormat","setNewTemplateFormat","createError","setCreateError","templatePendingDelete","setTemplatePendingDelete","handleOpenCreate","handleCreateTemplate","createTemplate","err","toggleEntity","prev","entityType","e","filteredTemplates","useMemo","q","handleTemplateClick","basePath","templateId","handleDeleteTemplate","nativeImpact","closeDeleteConfirm","confirmDeleteTemplate","deleteTemplate","nativeNotify","pendingTemplateName","t","PageLayout","FileBox","CTAOverflowMenu","Plus","navigate","Sparkles","DownloadsTabs","PagePurpose","X","ThemedSelect","entity","cn","SpinnerIcon","Search","isLoading","SkeletonBlock","i","template","index","getFormatDisplayName","ChevronRight","IllustratedEmptyState","ConfirmDestructiveDialog","open"],"sources":["../../../src/export/pages/ExportTemplatesPage.tsx"],"sourcesContent":["import { useState, useMemo } from \"react\";\nimport { Search, X, FileBox, Plus, ChevronRight, Sparkles } from \"lucide-react\";\nimport {\n CTAOverflowMenu,\n IllustratedEmptyState,\n PagePurpose,\n ThemedSelect,\n} from \"@burdenoff/fe-libs/ui\";\nimport { useExport } from \"../providers/ExportProvider\";\nimport {\n useExportTemplates,\n useDeleteExportTemplate,\n useCreateExportTemplate,\n useAvailableEntities,\n} from \"../hooks/useExportQueries\";\nimport { PageLayout } from \"../components/PageLayout\";\nimport { DownloadsTabs } from \"../components/DownloadsTabs\";\nimport { ConfirmDestructiveDialog } from \"../components/ConfirmDestructiveDialog\";\nimport { useNavigationV2 } from \"../navigation-v2/NavigationV2\";\nimport { useEntityLabel } from \"../hooks/useEntityLabel\";\nimport { useAppShell } from \"@burdenoff/fe-libs/shared/providers/shell\";\nimport {\n isExportEntityDisabled,\n isForeignProductEntity,\n} from \"../utils/disabledModules\";\nimport { getFormatDisplayName } from \"../constants/enums\";\nimport { useTr } from \"../hooks/useTr\";\nimport { cn } from \"../utils/cn\";\nimport type { ExportFormat } from \"../types\";\nimport { nativeImpact, nativeNotify } from \"../../utils/nativeBridge\";\nimport { SkeletonBlock, SpinnerIcon } from \"../components/loadingSystem\";\n\n/**\n * Helper to join paths correctly\n */\nconst joinPath = (base: string, path: string): string => {\n const cleanBase = base.endsWith(\"/\") ? base.slice(0, -1) : base;\n const cleanPath = path.startsWith(\"/\") ? path : `/${path}`;\n return cleanBase + cleanPath;\n};\n\n/**\n * Export Templates Page\n * Template management list for reusable export configurations\n */\nexport function ExportTemplatesPage() {\n const { basePath = \"/\", navigate } = useExport();\n const tr = useTr();\n const { data: templates, isLoading } = useExportTemplates();\n const { deleteTemplate } = useDeleteExportTemplate();\n const { createTemplate, isPending: creating } = useCreateExportTemplate();\n const { data: availableEntities } = useAvailableEntities();\n const navigationV2 = useNavigationV2();\n const label = useEntityLabel(navigationV2);\n const { productSlug: hostProductSlug } = useAppShell();\n // The new-setup form offers only what \"New export\" itself can select in this\n // shell: not other products' entity types, not products whose export isn't\n // available yet, and not entity types the service marks disabled.\n const selectableEntities = availableEntities.filter(\n (e) =>\n e.enabled !== false &&\n !isExportEntityDisabled(e.entityType) &&\n !isForeignProductEntity(e.entityType, hostProductSlug),\n );\n const [deleteError, setDeleteError] = useState<string | null>(null);\n const [deletingTemplate, setDeletingTemplate] = useState(false);\n\n const [searchQuery, setSearchQuery] = useState(\"\");\n const [showCreateForm, setShowCreateForm] = useState(false);\n const [newTemplateName, setNewTemplateName] = useState(\"\");\n const [newTemplateDescription, setNewTemplateDescription] = useState(\"\");\n const [newTemplateEntityTypes, setNewTemplateEntityTypes] = useState<\n string[]\n >([]);\n const [newTemplateFormat, setNewTemplateFormat] =\n useState<ExportFormat>(\"CSV\");\n const [createError, setCreateError] = useState<string | null>(null);\n const [templatePendingDelete, setTemplatePendingDelete] = useState<\n string | null\n >(null);\n\n const handleOpenCreate = () => {\n setNewTemplateName(\"\");\n setNewTemplateDescription(\"\");\n setNewTemplateEntityTypes([]);\n setNewTemplateFormat(\"CSV\");\n setCreateError(null);\n setShowCreateForm(true);\n };\n\n const handleCreateTemplate = async () => {\n if (!newTemplateName.trim()) {\n setCreateError(\n tr(\n \"export.templates.form.errors.nameRequired\",\n \"Template name is required.\",\n ),\n );\n return;\n }\n if (newTemplateEntityTypes.length === 0) {\n setCreateError(\n tr(\n \"export.templates.form.errors.entityRequired\",\n \"Select at least one entity type.\",\n ),\n );\n return;\n }\n setCreateError(null);\n try {\n await createTemplate({\n name: newTemplateName.trim(),\n description: newTemplateDescription.trim() || undefined,\n entityTypes: newTemplateEntityTypes,\n format: newTemplateFormat,\n });\n setShowCreateForm(false);\n } catch (err) {\n setCreateError(\n err instanceof Error\n ? err.message\n : tr(\n \"export.templates.form.errors.createFailed\",\n \"Failed to create template.\",\n ),\n );\n }\n };\n\n const toggleEntity = (entityType: string) => {\n setNewTemplateEntityTypes((prev) =>\n prev.includes(entityType)\n ? prev.filter((e) => e !== entityType)\n : [...prev, entityType],\n );\n };\n\n // Client-side search filter\n const filteredTemplates = useMemo(() => {\n if (!searchQuery) return templates;\n const q = searchQuery.toLowerCase();\n return templates.filter(\n (t) =>\n t.name.toLowerCase().includes(q) ||\n t.entityTypes.some(\n (e) =>\n e.toLowerCase().includes(q) || label(e).toLowerCase().includes(q),\n ),\n );\n }, [templates, searchQuery, label]);\n\n const handleTemplateClick = (templateId: string) => {\n navigate?.(joinPath(basePath, `templates/${templateId}`));\n };\n\n const handleDeleteTemplate = async (\n e: React.MouseEvent,\n templateId: string,\n ) => {\n e.stopPropagation();\n nativeImpact(\"medium\");\n setTemplatePendingDelete(templateId);\n };\n\n const closeDeleteConfirm = () => {\n setTemplatePendingDelete(null);\n setDeleteError(null);\n };\n\n const confirmDeleteTemplate = async () => {\n if (!templatePendingDelete) return;\n setDeleteError(null);\n setDeletingTemplate(true);\n try {\n await deleteTemplate(templatePendingDelete);\n nativeNotify(\"success\");\n setTemplatePendingDelete(null);\n } catch (err) {\n nativeNotify(\"error\");\n // Say why and keep the confirm open, instead of closing it silently.\n setDeleteError(\n err instanceof Error && err.message\n ? err.message\n : tr(\n \"export.templates.delete.failed\",\n \"Couldn't delete this template. Try again.\",\n ),\n );\n } finally {\n setDeletingTemplate(false);\n }\n };\n\n const pendingTemplateName =\n templates.find((t) => t.id === templatePendingDelete)?.name ?? \"\";\n\n return (\n <PageLayout\n title={tr(\"export.templates.title\", \"Export Templates\")}\n subtitle={tr(\n \"export.templates.subtitle\",\n \"Reusable export configurations for common data exports\",\n )}\n icon={<FileBox size={24} />}\n headerActions={\n <CTAOverflowMenu\n primary={{\n label: tr(\"export.templates.actions.newTemplate\", \"New Template\"),\n icon: <Plus size={16} />,\n onSelect: handleOpenCreate,\n }}\n actions={[\n {\n label: tr(\"export.templates.actions.newExport\", \"New Export\"),\n icon: <Plus size={16} />,\n onSelect: () => navigate?.(joinPath(basePath, \"new\")),\n },\n ]}\n />\n }\n headerContent={\n <span className=\"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-bg-sunken text-text-secondary\">\n <Sparkles size={12} />\n {navigationV2\n ? filteredTemplates.length === 1\n ? tr(\"export.templates.summary.one\", \"1 setup\")\n : tr(\"export.templates.summary.other\", \"{{count}} setups\", {\n count: filteredTemplates.length,\n })\n : tr(\n \"export.templates.summary.available\",\n \"{{count}} template{{suffix}} available\",\n {\n count: filteredTemplates.length,\n suffix: filteredTemplates.length !== 1 ? \"s\" : \"\",\n },\n )}\n </span>\n }\n >\n {navigationV2 && <DownloadsTabs />}\n {/* Page purpose — why templates exist */}\n <PagePurpose icon={<FileBox size={16} />}>\n {tr(\n \"export.templates.purpose\",\n \"Templates save an export setup — the entity types and format you regularly need — so you don't rebuild it each time. Create one here, then start a new export from it in a single click. Handy for recurring backups, periodic audits, or any export you run more than once.\",\n )}\n </PagePurpose>\n\n {/* Create Template Form */}\n {showCreateForm && (\n <div className=\"border border-primary/30 rounded-xl p-6 bg-accent-wash space-y-4\">\n <div className=\"flex items-center justify-between\">\n <h3 className=\"font-semibold text-lg\">\n {tr(\"export.templates.form.title\", \"New Template\")}\n </h3>\n <button\n type=\"button\"\n onClick={() => setShowCreateForm(false)}\n className=\"p-1.5 rounded-md hover:bg-accent\"\n >\n <X size={16} />\n </button>\n </div>\n {createError && (\n <p className=\"text-sm text-status-error-text bg-status-error-bg/10 rounded-lg px-3 py-2\">\n {createError}\n </p>\n )}\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-4\">\n <div className=\"space-y-1\">\n <label className=\"text-sm font-medium\">\n {tr(\"export.templates.form.fields.name\", \"Name\")} *\n </label>\n <input\n type=\"text\"\n aria-label={tr(\"export.templates.form.fields.name\", \"Name\")}\n placeholder={tr(\n \"export.templates.form.fields.namePlaceholder\",\n \"e.g. Weekly Tags Export\",\n )}\n value={newTemplateName}\n onChange={(e) => setNewTemplateName(e.target.value)}\n className=\"w-full px-3 py-2 border-2 border-border-subtle rounded-lg bg-bg-surface focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all\"\n />\n </div>\n <div className=\"space-y-1\">\n <label className=\"text-sm font-medium\">\n {tr(\"export.templates.form.fields.format\", \"Format\")} *\n </label>\n <ThemedSelect\n value={newTemplateFormat}\n onChange={(e) =>\n setNewTemplateFormat(e.target.value as ExportFormat)\n }\n className=\"w-full px-3 py-2 border-2 border-border-subtle rounded-lg bg-bg-surface focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"CSV\">{tr(\"export.format.csv\", \"CSV\")}</option>\n <option value=\"JSON\">{tr(\"export.format.json\", \"JSON\")}</option>\n </ThemedSelect>\n </div>\n </div>\n <div className=\"space-y-1\">\n <label className=\"text-sm font-medium\">\n {tr(\"export.templates.form.fields.description\", \"Description\")}\n </label>\n <input\n type=\"text\"\n aria-label={tr(\n \"export.templates.form.fields.description\",\n \"Description\",\n )}\n placeholder={tr(\n \"export.templates.form.fields.descriptionPlaceholder\",\n \"Optional description\",\n )}\n value={newTemplateDescription}\n onChange={(e) => setNewTemplateDescription(e.target.value)}\n className=\"w-full px-3 py-2 border-2 border-border-subtle rounded-lg bg-bg-surface focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all\"\n />\n </div>\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">\n {tr(\"export.templates.form.fields.entityTypes\", \"Entity Types\")} *{\" \"}\n <span className=\"text-text-secondary font-normal\">\n {tr(\n \"export.templates.form.fields.entityTypesHint\",\n \"(select at least one)\",\n )}\n </span>\n </label>\n <div className=\"flex flex-wrap gap-2\">\n {selectableEntities.map((entity) => (\n <button\n key={entity.entityType}\n type=\"button\"\n onClick={() => toggleEntity(entity.entityType)}\n className={cn(\n \"px-3 py-1.5 rounded-lg text-sm font-medium border-2 transition-all\",\n newTemplateEntityTypes.includes(entity.entityType)\n ? \"border-primary bg-action-primary-bg/10 text-primary\"\n : \"border-border-subtle bg-bg-surface hover:border-primary/50\",\n )}\n >\n {navigationV2 ? label(entity.entityType) : entity.displayName}\n </button>\n ))}\n </div>\n </div>\n <div className=\"flex gap-3 pt-2\">\n <button\n type=\"button\"\n onClick={handleCreateTemplate}\n disabled={creating}\n className=\"inline-flex items-center gap-2 px-5 py-2.5 bg-action-primary-bg text-action-primary-text rounded-lg hover:bg-action-primary-bg/90 transition-colors font-medium disabled:opacity-50\"\n >\n {creating ? (\n <SpinnerIcon\n tone=\"current\"\n size={16}\n className=\"animate-spin\"\n />\n ) : (\n <Plus size={16} />\n )}\n {tr(\"export.templates.form.actions.create\", \"Create Template\")}\n </button>\n <button\n type=\"button\"\n onClick={() => setShowCreateForm(false)}\n className=\"px-5 py-2.5 border-2 border-border-subtle rounded-lg hover:bg-accent transition-colors font-medium\"\n >\n {tr(\"export.templates.form.actions.cancel\", \"Cancel\")}\n </button>\n </div>\n </div>\n )}\n {/* Search */}\n <div className=\"relative group\">\n <Search\n size={18}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary group-focus-within:text-primary transition-colors\"\n />\n <input\n type=\"text\"\n aria-label={tr(\n \"export.templates.search.placeholder\",\n \"Search templates\",\n )}\n placeholder={tr(\n \"export.templates.search.placeholder\",\n \"Search templates...\",\n )}\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className=\"w-full pl-[3.25rem] pr-4 py-2.5 border-2 border-border-subtle rounded-lg bg-bg-surface focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all duration-200\"\n />\n {searchQuery && (\n <button\n type=\"button\"\n onClick={() => setSearchQuery(\"\")}\n className=\"absolute right-3 top-1/2 -translate-y-1/2 p-1 rounded-md text-text-secondary hover:text-text-primary hover:bg-accent\"\n >\n <X size={16} />\n </button>\n )}\n </div>\n\n {/* Loading */}\n {isLoading && (\n <div className=\"grid grid-cols-1 lg:grid-cols-2 gap-4\">\n {[...Array(4)].map((_, i) => (\n <div key={i} className=\"border border-border-seam rounded-xl p-5\">\n <SkeletonBlock className=\"h-5 w-40 bg-bg-sunken rounded mb-3 animate-vc-shimmer\" />\n <SkeletonBlock className=\"h-3 w-full bg-bg-sunken rounded mb-2 animate-vc-shimmer\" />\n <div className=\"flex gap-2 mt-4\">\n <SkeletonBlock className=\"h-5 w-16 bg-bg-sunken rounded-full animate-vc-shimmer\" />\n <SkeletonBlock className=\"h-5 w-16 bg-bg-sunken rounded-full animate-vc-shimmer\" />\n </div>\n </div>\n ))}\n </div>\n )}\n\n {/* Templates Grid */}\n {!isLoading ? (\n filteredTemplates.length > 0 ? (\n <div className=\"grid grid-cols-1 lg:grid-cols-2 gap-4\">\n {filteredTemplates.map((template, index) => (\n <div\n key={template.id}\n role=\"button\"\n tabIndex={0}\n onClick={() => handleTemplateClick(template.id)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n handleTemplateClick(template.id);\n }\n }}\n className={cn(\n \"text-left group cursor-pointer border border-border-seam rounded-xl overflow-hidden bg-bg-surface\",\n \"hover:border-primary/40 shadow-[var(--shadow-pop)] transition-colors duration-200\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40\",\n \"animate-in fade-in-0\",\n )}\n style={{ animationDelay: `${index * 50}ms` }}\n >\n {/* Header */}\n <div className=\"p-4 border-b bg-bg-sunken/30\">\n <div className=\"flex items-start justify-between\">\n <div className=\"flex items-center gap-3\">\n <div className=\"p-2 rounded-lg bg-action-primary-bg/10\">\n <FileBox size={20} className=\"text-primary\" />\n </div>\n <div>\n <h3 className=\"font-semibold\">{template.name}</h3>\n <p className=\"text-xs text-text-secondary\">\n {getFormatDisplayName(template.format)}\n {template.isDefault && (\n <span className=\"ml-1.5 inline-flex items-center px-1.5 py-0.5 rounded text-xs bg-action-primary-bg/10 text-primary font-medium\">\n {tr(\"export.templates.card.default\", \"Default\")}\n </span>\n )}\n </p>\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={(e) => handleDeleteTemplate(e, template.id)}\n className=\"p-1.5 rounded-md text-text-secondary hover:text-status-error-text hover:bg-status-error-bg/10 transition-colors\"\n aria-label={tr(\n \"export.templates.card.deleteAriaLabel\",\n \"Delete {{name}}\",\n { name: template.name },\n )}\n >\n <X size={14} />\n </button>\n <ChevronRight\n size={18}\n className=\"text-text-secondary group-hover:text-primary transition-colors mt-1\"\n />\n </div>\n </div>\n </div>\n\n {/* Body */}\n <div className=\"p-4\">\n {template.description && (\n <p className=\"text-sm text-text-secondary mb-3 line-clamp-2\">\n {template.description}\n </p>\n )}\n <div className=\"flex flex-wrap gap-1.5 overflow-hidden\">\n {template.entityTypes.slice(0, 6).map((entity) => (\n <span\n key={entity}\n className=\"inline-flex px-2 py-0.5 rounded text-xs font-medium bg-bg-sunken text-text-secondary max-w-full truncate\"\n >\n {label(entity)}\n </span>\n ))}\n {template.entityTypes.length > 6 && (\n <span className=\"inline-flex px-2 py-0.5 rounded text-xs font-medium bg-bg-sunken text-text-secondary\">\n {tr(\n \"export.templates.card.moreEntities\",\n \"+{{count}} more\",\n {\n count: template.entityTypes.length - 6,\n },\n )}\n </span>\n )}\n </div>\n </div>\n </div>\n ))}\n </div>\n ) : (\n <IllustratedEmptyState\n illustration={searchQuery ? \"empty-search\" : \"empty-data\"}\n title={\n searchQuery\n ? tr(\n \"export.templates.empty.filtered.title\",\n \"No matching templates\",\n )\n : tr(\"export.templates.empty.title\", \"No templates yet\")\n }\n description={\n searchQuery\n ? tr(\n \"export.templates.empty.filtered.description\",\n \"Try adjusting your search to find what you are looking for.\",\n )\n : tr(\n \"export.templates.empty.description\",\n \"Create a template to save reusable export configurations.\",\n )\n }\n action={\n searchQuery ? (\n <button\n type=\"button\"\n onClick={() => setSearchQuery(\"\")}\n className=\"inline-flex items-center gap-2 px-4 py-2 border-2 border-border-subtle rounded-lg hover:bg-accent transition-colors font-medium\"\n >\n <X size={16} />\n {tr(\n \"export.templates.empty.filtered.actions.clear\",\n \"Clear Search\",\n )}\n </button>\n ) : (\n <button\n type=\"button\"\n onClick={handleOpenCreate}\n className=\"inline-flex items-center gap-2 px-4 py-2 bg-action-primary-bg text-action-primary-text rounded-lg hover:bg-action-primary-bg/90 transition-colors font-medium\"\n >\n <Plus size={16} />\n {tr(\n \"export.templates.empty.actions.newTemplate\",\n \"New Template\",\n )}\n </button>\n )\n }\n kind={searchQuery ? \"no-results\" : \"first-use\"}\n glassIllustration=\"documents\"\n />\n )\n ) : null}\n {navigationV2 ? (\n <ConfirmDestructiveDialog\n open={templatePendingDelete !== null}\n onOpenChange={(open) => {\n if (!open) closeDeleteConfirm();\n }}\n title={tr(\"export.templates.delete.named\", \"Delete “{{name}}”?\", {\n name: pendingTemplateName,\n })}\n description={tr(\n \"export.templates.delete.description\",\n \"This removes the saved export configuration. Existing export jobs are not deleted.\",\n )}\n confirmLabel={tr(\n \"export.templates.delete.confirmAction\",\n \"Delete Template\",\n )}\n keepLabel={tr(\"export.templates.delete.cancel\", \"Keep Template\")}\n busy={deletingTemplate}\n error={deleteError}\n onConfirm={() => void confirmDeleteTemplate()}\n />\n ) : (\n templatePendingDelete && (\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby=\"template-list-delete-title\"\n className=\"fixed inset-0 z-50 flex items-center justify-center bg-bg-surface/80 backdrop-blur-sm p-4\"\n >\n <div className=\"w-full max-w-md rounded-xl border-2 border-border-subtle bg-bg-surface p-6 shadow-xl\">\n <h2 id=\"template-list-delete-title\" className=\"text-lg font-bold\">\n {tr(\"export.templates.delete.title\", \"Delete template?\")}\n </h2>\n <p className=\"mt-2 text-sm text-text-secondary\">\n {tr(\n \"export.templates.delete.description\",\n \"This removes the saved export configuration. Existing export jobs are not deleted.\",\n )}\n </p>\n {deleteError && (\n <p\n role=\"alert\"\n className=\"mt-3 rounded-lg bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text\"\n >\n {deleteError}\n </p>\n )}\n <div className=\"mt-6 flex flex-col-reverse sm:flex-row sm:justify-end gap-3\">\n <button\n type=\"button\"\n onClick={closeDeleteConfirm}\n className=\"px-4 py-2 rounded-lg border-2 border-border-subtle hover:bg-accent transition-colors font-medium\"\n >\n {tr(\"export.templates.delete.cancel\", \"Keep Template\")}\n </button>\n <button\n type=\"button\"\n onClick={confirmDeleteTemplate}\n className=\"px-4 py-2 rounded-lg bg-status-error-bg text-status-error-text hover:bg-status-error-bg/90 transition-colors font-medium\"\n >\n {tr(\n \"export.templates.delete.confirmAction\",\n \"Delete Template\",\n )}\n </button>\n </div>\n </div>\n </div>\n )\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmCA,IAAMA,KAAY,G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;MACFkB,KACC,kBAAC,KAAD;OACE,MAAK;OACL,WAAU;OAET,UAAAA;MACA,CAAA;MAEL,kBAAC,OAAD;OAAK,WAAU;OAAf,UAAA,CACE,kBAAC,UAAD;QACE,MAAK;QACL,SAASqC;QACT,WAAU;QAET,UAAAvD,EAAG,kCAAkC,eAAe;OAC/C,CAAA,GACR,kBAAC,UAAD;QACE,MAAK;QACL,SAASwD;QACT,WAAU;QAET,UAAAxD,EACC,yCACA,iBACF;OACM,CAAA,CACL;;KACF;;GACF,CAAA;EAGC;;AAEhB"}
|
|
1
|
+
{"version":3,"file":"ExportTemplatesPage.js","names":["joinPath","base","path","ExportTemplatesPage","useExport","tr","useTr","templates","templatesError","useExportTemplates","templatesDenied","isPermissionDenied","useDeleteExportTemplate","creating","useCreateExportTemplate","availableEntities","useAvailableEntities","navigationV2","useNavigationV2","label","useEntityLabel","hostProductSlug","useAppShell","selectableEntities","isExportEntityDisabled","isForeignProductEntity","deleteError","setDeleteError","useState","deletingTemplate","setDeletingTemplate","searchQuery","setSearchQuery","showCreateForm","setShowCreateForm","newTemplateName","setNewTemplateName","newTemplateDescription","setNewTemplateDescription","newTemplateEntityTypes","setNewTemplateEntityTypes","newTemplateFormat","setNewTemplateFormat","createError","setCreateError","templatePendingDelete","setTemplatePendingDelete","handleOpenCreate","handleCreateTemplate","createTemplate","err","toggleEntity","prev","entityType","e","filteredTemplates","useMemo","q","handleTemplateClick","basePath","templateId","handleDeleteTemplate","nativeImpact","closeDeleteConfirm","confirmDeleteTemplate","deleteTemplate","nativeNotify","pendingTemplateName","t","PageLayout","FileBox","CTAOverflowMenu","Plus","navigate","Sparkles","DownloadsTabs","PagePurpose","X","ThemedSelect","entity","cn","SpinnerIcon","Search","isLoading","SkeletonBlock","i","LoadError","template","index","getFormatDisplayName","ChevronRight","IllustratedEmptyState","ConfirmDestructiveDialog","open"],"sources":["../../../src/export/pages/ExportTemplatesPage.tsx"],"sourcesContent":["import { useState, useMemo } from \"react\";\nimport { Search, X, FileBox, Plus, ChevronRight, Sparkles } from \"lucide-react\";\nimport {\n CTAOverflowMenu,\n IllustratedEmptyState,\n LoadError,\n PagePurpose,\n ThemedSelect,\n} from \"@burdenoff/fe-libs/ui\";\nimport { useExport } from \"../providers/ExportProvider\";\nimport {\n useExportTemplates,\n useDeleteExportTemplate,\n useCreateExportTemplate,\n useAvailableEntities,\n} from \"../hooks/useExportQueries\";\nimport { PageLayout } from \"../components/PageLayout\";\nimport { DownloadsTabs } from \"../components/DownloadsTabs\";\nimport { ConfirmDestructiveDialog } from \"../components/ConfirmDestructiveDialog\";\nimport { useNavigationV2 } from \"../navigation-v2/NavigationV2\";\nimport { useEntityLabel } from \"../hooks/useEntityLabel\";\nimport { useAppShell } from \"@burdenoff/fe-libs/shared/providers/shell\";\nimport {\n isExportEntityDisabled,\n isForeignProductEntity,\n} from \"../utils/disabledModules\";\nimport { getFormatDisplayName } from \"../constants/enums\";\nimport { useTr } from \"../hooks/useTr\";\nimport { cn } from \"../utils/cn\";\nimport { isPermissionDenied } from \"../utils/permissionDenied\";\nimport type { ExportFormat } from \"../types\";\nimport { nativeImpact, nativeNotify } from \"../../utils/nativeBridge\";\nimport { SkeletonBlock, SpinnerIcon } from \"../components/loadingSystem\";\n\n/**\n * Helper to join paths correctly\n */\nconst joinPath = (base: string, path: string): string => {\n const cleanBase = base.endsWith(\"/\") ? base.slice(0, -1) : base;\n const cleanPath = path.startsWith(\"/\") ? path : `/${path}`;\n return cleanBase + cleanPath;\n};\n\n/**\n * Export Templates Page\n * Template management list for reusable export configurations\n */\nexport function ExportTemplatesPage() {\n const { basePath = \"/\", navigate } = useExport();\n const tr = useTr();\n const {\n data: templates,\n isLoading,\n error: templatesError,\n } = useExportTemplates();\n // A known caller refused (BOFF-16744): show the access state instead of the\n // \"No templates yet\" empty state.\n const templatesDenied = isPermissionDenied(templatesError);\n const { deleteTemplate } = useDeleteExportTemplate();\n const { createTemplate, isPending: creating } = useCreateExportTemplate();\n const { data: availableEntities } = useAvailableEntities();\n const navigationV2 = useNavigationV2();\n const label = useEntityLabel(navigationV2);\n const { productSlug: hostProductSlug } = useAppShell();\n // The new-setup form offers only what \"New export\" itself can select in this\n // shell: not other products' entity types, not products whose export isn't\n // available yet, and not entity types the service marks disabled.\n const selectableEntities = availableEntities.filter(\n (e) =>\n e.enabled !== false &&\n !isExportEntityDisabled(e.entityType) &&\n !isForeignProductEntity(e.entityType, hostProductSlug),\n );\n const [deleteError, setDeleteError] = useState<string | null>(null);\n const [deletingTemplate, setDeletingTemplate] = useState(false);\n\n const [searchQuery, setSearchQuery] = useState(\"\");\n const [showCreateForm, setShowCreateForm] = useState(false);\n const [newTemplateName, setNewTemplateName] = useState(\"\");\n const [newTemplateDescription, setNewTemplateDescription] = useState(\"\");\n const [newTemplateEntityTypes, setNewTemplateEntityTypes] = useState<\n string[]\n >([]);\n const [newTemplateFormat, setNewTemplateFormat] =\n useState<ExportFormat>(\"CSV\");\n const [createError, setCreateError] = useState<string | null>(null);\n const [templatePendingDelete, setTemplatePendingDelete] = useState<\n string | null\n >(null);\n\n const handleOpenCreate = () => {\n setNewTemplateName(\"\");\n setNewTemplateDescription(\"\");\n setNewTemplateEntityTypes([]);\n setNewTemplateFormat(\"CSV\");\n setCreateError(null);\n setShowCreateForm(true);\n };\n\n const handleCreateTemplate = async () => {\n if (!newTemplateName.trim()) {\n setCreateError(\n tr(\n \"export.templates.form.errors.nameRequired\",\n \"Template name is required.\",\n ),\n );\n return;\n }\n if (newTemplateEntityTypes.length === 0) {\n setCreateError(\n tr(\n \"export.templates.form.errors.entityRequired\",\n \"Select at least one entity type.\",\n ),\n );\n return;\n }\n setCreateError(null);\n try {\n await createTemplate({\n name: newTemplateName.trim(),\n description: newTemplateDescription.trim() || undefined,\n entityTypes: newTemplateEntityTypes,\n format: newTemplateFormat,\n });\n setShowCreateForm(false);\n } catch (err) {\n setCreateError(\n err instanceof Error\n ? err.message\n : tr(\n \"export.templates.form.errors.createFailed\",\n \"Failed to create template.\",\n ),\n );\n }\n };\n\n const toggleEntity = (entityType: string) => {\n setNewTemplateEntityTypes((prev) =>\n prev.includes(entityType)\n ? prev.filter((e) => e !== entityType)\n : [...prev, entityType],\n );\n };\n\n // Client-side search filter\n const filteredTemplates = useMemo(() => {\n if (!searchQuery) return templates;\n const q = searchQuery.toLowerCase();\n return templates.filter(\n (t) =>\n t.name.toLowerCase().includes(q) ||\n t.entityTypes.some(\n (e) =>\n e.toLowerCase().includes(q) || label(e).toLowerCase().includes(q),\n ),\n );\n }, [templates, searchQuery, label]);\n\n const handleTemplateClick = (templateId: string) => {\n navigate?.(joinPath(basePath, `templates/${templateId}`));\n };\n\n const handleDeleteTemplate = async (\n e: React.MouseEvent,\n templateId: string,\n ) => {\n e.stopPropagation();\n nativeImpact(\"medium\");\n setTemplatePendingDelete(templateId);\n };\n\n const closeDeleteConfirm = () => {\n setTemplatePendingDelete(null);\n setDeleteError(null);\n };\n\n const confirmDeleteTemplate = async () => {\n if (!templatePendingDelete) return;\n setDeleteError(null);\n setDeletingTemplate(true);\n try {\n await deleteTemplate(templatePendingDelete);\n nativeNotify(\"success\");\n setTemplatePendingDelete(null);\n } catch (err) {\n nativeNotify(\"error\");\n // Say why and keep the confirm open, instead of closing it silently.\n setDeleteError(\n err instanceof Error && err.message\n ? err.message\n : tr(\n \"export.templates.delete.failed\",\n \"Couldn't delete this template. Try again.\",\n ),\n );\n } finally {\n setDeletingTemplate(false);\n }\n };\n\n const pendingTemplateName =\n templates.find((t) => t.id === templatePendingDelete)?.name ?? \"\";\n\n return (\n <PageLayout\n title={tr(\"export.templates.title\", \"Export Templates\")}\n subtitle={tr(\n \"export.templates.subtitle\",\n \"Reusable export configurations for common data exports\",\n )}\n icon={<FileBox size={24} />}\n headerActions={\n <CTAOverflowMenu\n primary={{\n label: tr(\"export.templates.actions.newTemplate\", \"New Template\"),\n icon: <Plus size={16} />,\n onSelect: handleOpenCreate,\n }}\n actions={[\n {\n label: tr(\"export.templates.actions.newExport\", \"New Export\"),\n icon: <Plus size={16} />,\n onSelect: () => navigate?.(joinPath(basePath, \"new\")),\n },\n ]}\n />\n }\n headerContent={\n <span className=\"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-bg-sunken text-text-secondary\">\n <Sparkles size={12} />\n {navigationV2\n ? filteredTemplates.length === 1\n ? tr(\"export.templates.summary.one\", \"1 setup\")\n : tr(\"export.templates.summary.other\", \"{{count}} setups\", {\n count: filteredTemplates.length,\n })\n : tr(\n \"export.templates.summary.available\",\n \"{{count}} template{{suffix}} available\",\n {\n count: filteredTemplates.length,\n suffix: filteredTemplates.length !== 1 ? \"s\" : \"\",\n },\n )}\n </span>\n }\n >\n {navigationV2 && <DownloadsTabs />}\n {/* Page purpose — why templates exist */}\n <PagePurpose icon={<FileBox size={16} />}>\n {tr(\n \"export.templates.purpose\",\n \"Templates save an export setup — the entity types and format you regularly need — so you don't rebuild it each time. Create one here, then start a new export from it in a single click. Handy for recurring backups, periodic audits, or any export you run more than once.\",\n )}\n </PagePurpose>\n\n {/* Create Template Form */}\n {showCreateForm && (\n <div className=\"border border-primary/30 rounded-xl p-6 bg-accent-wash space-y-4\">\n <div className=\"flex items-center justify-between\">\n <h3 className=\"font-semibold text-lg\">\n {tr(\"export.templates.form.title\", \"New Template\")}\n </h3>\n <button\n type=\"button\"\n onClick={() => setShowCreateForm(false)}\n className=\"p-1.5 rounded-md hover:bg-accent\"\n >\n <X size={16} />\n </button>\n </div>\n {createError && (\n <p className=\"text-sm text-status-error-text bg-status-error-bg/10 rounded-lg px-3 py-2\">\n {createError}\n </p>\n )}\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-4\">\n <div className=\"space-y-1\">\n <label className=\"text-sm font-medium\">\n {tr(\"export.templates.form.fields.name\", \"Name\")} *\n </label>\n <input\n type=\"text\"\n aria-label={tr(\"export.templates.form.fields.name\", \"Name\")}\n placeholder={tr(\n \"export.templates.form.fields.namePlaceholder\",\n \"e.g. Weekly Tags Export\",\n )}\n value={newTemplateName}\n onChange={(e) => setNewTemplateName(e.target.value)}\n className=\"w-full px-3 py-2 border-2 border-border-subtle rounded-lg bg-bg-surface focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all\"\n />\n </div>\n <div className=\"space-y-1\">\n <label className=\"text-sm font-medium\">\n {tr(\"export.templates.form.fields.format\", \"Format\")} *\n </label>\n <ThemedSelect\n value={newTemplateFormat}\n onChange={(e) =>\n setNewTemplateFormat(e.target.value as ExportFormat)\n }\n className=\"w-full px-3 py-2 border-2 border-border-subtle rounded-lg bg-bg-surface focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"CSV\">{tr(\"export.format.csv\", \"CSV\")}</option>\n <option value=\"JSON\">{tr(\"export.format.json\", \"JSON\")}</option>\n </ThemedSelect>\n </div>\n </div>\n <div className=\"space-y-1\">\n <label className=\"text-sm font-medium\">\n {tr(\"export.templates.form.fields.description\", \"Description\")}\n </label>\n <input\n type=\"text\"\n aria-label={tr(\n \"export.templates.form.fields.description\",\n \"Description\",\n )}\n placeholder={tr(\n \"export.templates.form.fields.descriptionPlaceholder\",\n \"Optional description\",\n )}\n value={newTemplateDescription}\n onChange={(e) => setNewTemplateDescription(e.target.value)}\n className=\"w-full px-3 py-2 border-2 border-border-subtle rounded-lg bg-bg-surface focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all\"\n />\n </div>\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">\n {tr(\"export.templates.form.fields.entityTypes\", \"Entity Types\")} *{\" \"}\n <span className=\"text-text-secondary font-normal\">\n {tr(\n \"export.templates.form.fields.entityTypesHint\",\n \"(select at least one)\",\n )}\n </span>\n </label>\n <div className=\"flex flex-wrap gap-2\">\n {selectableEntities.map((entity) => (\n <button\n key={entity.entityType}\n type=\"button\"\n onClick={() => toggleEntity(entity.entityType)}\n className={cn(\n \"px-3 py-1.5 rounded-lg text-sm font-medium border-2 transition-all\",\n newTemplateEntityTypes.includes(entity.entityType)\n ? \"border-primary bg-action-primary-bg/10 text-primary\"\n : \"border-border-subtle bg-bg-surface hover:border-primary/50\",\n )}\n >\n {navigationV2 ? label(entity.entityType) : entity.displayName}\n </button>\n ))}\n </div>\n </div>\n <div className=\"flex gap-3 pt-2\">\n <button\n type=\"button\"\n onClick={handleCreateTemplate}\n disabled={creating}\n className=\"inline-flex items-center gap-2 px-5 py-2.5 bg-action-primary-bg text-action-primary-text rounded-lg hover:bg-action-primary-bg/90 transition-colors font-medium disabled:opacity-50\"\n >\n {creating ? (\n <SpinnerIcon\n tone=\"current\"\n size={16}\n className=\"animate-spin\"\n />\n ) : (\n <Plus size={16} />\n )}\n {tr(\"export.templates.form.actions.create\", \"Create Template\")}\n </button>\n <button\n type=\"button\"\n onClick={() => setShowCreateForm(false)}\n className=\"px-5 py-2.5 border-2 border-border-subtle rounded-lg hover:bg-accent transition-colors font-medium\"\n >\n {tr(\"export.templates.form.actions.cancel\", \"Cancel\")}\n </button>\n </div>\n </div>\n )}\n {/* Search */}\n <div className=\"relative group\">\n <Search\n size={18}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary group-focus-within:text-primary transition-colors\"\n />\n <input\n type=\"text\"\n aria-label={tr(\n \"export.templates.search.placeholder\",\n \"Search templates\",\n )}\n placeholder={tr(\n \"export.templates.search.placeholder\",\n \"Search templates...\",\n )}\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className=\"w-full pl-[3.25rem] pr-4 py-2.5 border-2 border-border-subtle rounded-lg bg-bg-surface focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all duration-200\"\n />\n {searchQuery && (\n <button\n type=\"button\"\n onClick={() => setSearchQuery(\"\")}\n className=\"absolute right-3 top-1/2 -translate-y-1/2 p-1 rounded-md text-text-secondary hover:text-text-primary hover:bg-accent\"\n >\n <X size={16} />\n </button>\n )}\n </div>\n\n {/* Loading */}\n {isLoading && (\n <div className=\"grid grid-cols-1 lg:grid-cols-2 gap-4\">\n {[...Array(4)].map((_, i) => (\n <div key={i} className=\"border border-border-seam rounded-xl p-5\">\n <SkeletonBlock className=\"h-5 w-40 bg-bg-sunken rounded mb-3 animate-vc-shimmer\" />\n <SkeletonBlock className=\"h-3 w-full bg-bg-sunken rounded mb-2 animate-vc-shimmer\" />\n <div className=\"flex gap-2 mt-4\">\n <SkeletonBlock className=\"h-5 w-16 bg-bg-sunken rounded-full animate-vc-shimmer\" />\n <SkeletonBlock className=\"h-5 w-16 bg-bg-sunken rounded-full animate-vc-shimmer\" />\n </div>\n </div>\n ))}\n </div>\n )}\n\n {/* Templates Grid */}\n {!isLoading ? (\n templatesDenied ? (\n <LoadError\n kind=\"denied\"\n what={tr(\"export.templates.deniedWhat\", \"export templates\")}\n error={templatesError}\n />\n ) : filteredTemplates.length > 0 ? (\n <div className=\"grid grid-cols-1 lg:grid-cols-2 gap-4\">\n {filteredTemplates.map((template, index) => (\n <div\n key={template.id}\n role=\"button\"\n tabIndex={0}\n onClick={() => handleTemplateClick(template.id)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n handleTemplateClick(template.id);\n }\n }}\n className={cn(\n \"text-left group cursor-pointer border border-border-seam rounded-xl overflow-hidden bg-bg-surface\",\n \"hover:border-primary/40 shadow-[var(--shadow-pop)] transition-colors duration-200\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40\",\n \"animate-in fade-in-0\",\n )}\n style={{ animationDelay: `${index * 50}ms` }}\n >\n {/* Header */}\n <div className=\"p-4 border-b bg-bg-sunken/30\">\n <div className=\"flex items-start justify-between\">\n <div className=\"flex items-center gap-3\">\n <div className=\"p-2 rounded-lg bg-action-primary-bg/10\">\n <FileBox size={20} className=\"text-primary\" />\n </div>\n <div>\n <h3 className=\"font-semibold\">{template.name}</h3>\n <p className=\"text-xs text-text-secondary\">\n {getFormatDisplayName(template.format)}\n {template.isDefault && (\n <span className=\"ml-1.5 inline-flex items-center px-1.5 py-0.5 rounded text-xs bg-action-primary-bg/10 text-primary font-medium\">\n {tr(\"export.templates.card.default\", \"Default\")}\n </span>\n )}\n </p>\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={(e) => handleDeleteTemplate(e, template.id)}\n className=\"p-1.5 rounded-md text-text-secondary hover:text-status-error-text hover:bg-status-error-bg/10 transition-colors\"\n aria-label={tr(\n \"export.templates.card.deleteAriaLabel\",\n \"Delete {{name}}\",\n { name: template.name },\n )}\n >\n <X size={14} />\n </button>\n <ChevronRight\n size={18}\n className=\"text-text-secondary group-hover:text-primary transition-colors mt-1\"\n />\n </div>\n </div>\n </div>\n\n {/* Body */}\n <div className=\"p-4\">\n {template.description && (\n <p className=\"text-sm text-text-secondary mb-3 line-clamp-2\">\n {template.description}\n </p>\n )}\n <div className=\"flex flex-wrap gap-1.5 overflow-hidden\">\n {template.entityTypes.slice(0, 6).map((entity) => (\n <span\n key={entity}\n className=\"inline-flex px-2 py-0.5 rounded text-xs font-medium bg-bg-sunken text-text-secondary max-w-full truncate\"\n >\n {label(entity)}\n </span>\n ))}\n {template.entityTypes.length > 6 && (\n <span className=\"inline-flex px-2 py-0.5 rounded text-xs font-medium bg-bg-sunken text-text-secondary\">\n {tr(\n \"export.templates.card.moreEntities\",\n \"+{{count}} more\",\n {\n count: template.entityTypes.length - 6,\n },\n )}\n </span>\n )}\n </div>\n </div>\n </div>\n ))}\n </div>\n ) : (\n <IllustratedEmptyState\n illustration={searchQuery ? \"empty-search\" : \"empty-data\"}\n title={\n searchQuery\n ? tr(\n \"export.templates.empty.filtered.title\",\n \"No matching templates\",\n )\n : tr(\"export.templates.empty.title\", \"No templates yet\")\n }\n description={\n searchQuery\n ? tr(\n \"export.templates.empty.filtered.description\",\n \"Try adjusting your search to find what you are looking for.\",\n )\n : tr(\n \"export.templates.empty.description\",\n \"Create a template to save reusable export configurations.\",\n )\n }\n action={\n searchQuery ? (\n <button\n type=\"button\"\n onClick={() => setSearchQuery(\"\")}\n className=\"inline-flex items-center gap-2 px-4 py-2 border-2 border-border-subtle rounded-lg hover:bg-accent transition-colors font-medium\"\n >\n <X size={16} />\n {tr(\n \"export.templates.empty.filtered.actions.clear\",\n \"Clear Search\",\n )}\n </button>\n ) : (\n <button\n type=\"button\"\n onClick={handleOpenCreate}\n className=\"inline-flex items-center gap-2 px-4 py-2 bg-action-primary-bg text-action-primary-text rounded-lg hover:bg-action-primary-bg/90 transition-colors font-medium\"\n >\n <Plus size={16} />\n {tr(\n \"export.templates.empty.actions.newTemplate\",\n \"New Template\",\n )}\n </button>\n )\n }\n kind={searchQuery ? \"no-results\" : \"first-use\"}\n glassIllustration=\"documents\"\n />\n )\n ) : null}\n {navigationV2 ? (\n <ConfirmDestructiveDialog\n open={templatePendingDelete !== null}\n onOpenChange={(open) => {\n if (!open) closeDeleteConfirm();\n }}\n title={tr(\"export.templates.delete.named\", \"Delete “{{name}}”?\", {\n name: pendingTemplateName,\n })}\n description={tr(\n \"export.templates.delete.description\",\n \"This removes the saved export configuration. Existing export jobs are not deleted.\",\n )}\n confirmLabel={tr(\n \"export.templates.delete.confirmAction\",\n \"Delete Template\",\n )}\n keepLabel={tr(\"export.templates.delete.cancel\", \"Keep Template\")}\n busy={deletingTemplate}\n error={deleteError}\n onConfirm={() => void confirmDeleteTemplate()}\n />\n ) : (\n templatePendingDelete && (\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby=\"template-list-delete-title\"\n className=\"fixed inset-0 z-50 flex items-center justify-center bg-bg-surface/80 backdrop-blur-sm p-4\"\n >\n <div className=\"w-full max-w-md rounded-xl border-2 border-border-subtle bg-bg-surface p-6 shadow-xl\">\n <h2 id=\"template-list-delete-title\" className=\"text-lg font-bold\">\n {tr(\"export.templates.delete.title\", \"Delete template?\")}\n </h2>\n <p className=\"mt-2 text-sm text-text-secondary\">\n {tr(\n \"export.templates.delete.description\",\n \"This removes the saved export configuration. Existing export jobs are not deleted.\",\n )}\n </p>\n {deleteError && (\n <p\n role=\"alert\"\n className=\"mt-3 rounded-lg bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text\"\n >\n {deleteError}\n </p>\n )}\n <div className=\"mt-6 flex flex-col-reverse sm:flex-row sm:justify-end gap-3\">\n <button\n type=\"button\"\n onClick={closeDeleteConfirm}\n className=\"px-4 py-2 rounded-lg border-2 border-border-subtle hover:bg-accent transition-colors font-medium\"\n >\n {tr(\"export.templates.delete.cancel\", \"Keep Template\")}\n </button>\n <button\n type=\"button\"\n onClick={confirmDeleteTemplate}\n className=\"px-4 py-2 rounded-lg bg-status-error-bg text-status-error-text hover:bg-status-error-bg/90 transition-colors font-medium\"\n >\n {tr(\n \"export.templates.delete.confirmAction\",\n \"Delete Template\",\n )}\n </button>\n </div>\n </div>\n </div>\n )\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqCA,IAAMA,KAAY,GAAc,OACZC,EAAK,SAAS,GAAG,IAAIA,EAAK,MAAM,GAAG,EAAE,IAAIA,MACzCC,EAAK,WAAW,GAAG,IAAIA,IAAO,IAAIA;AAQtD,SAAgBC,IAAsB;CACpC,IAAM,EAAE,cAAW,KAAK,gBAAaC,EAAU,GACzCC,IAAKC,GAAM,GACX,EACJ,MAAMC,GACN,cACA,OAAOC,MACLC,EAAmB,GAGjBC,KAAkBC,GAAmBH,CAAc,GACnD,EAAE,uBAAmBI,GAAwB,GAC7C,EAAE,oBAAgB,WAAWC,MAAaC,GAAwB,GAClE,EAAE,MAAMC,MAAsBC,EAAqB,GACnDC,IAAeC,GAAgB,GAC/BC,IAAQC,GAAeH,CAAY,GACnC,EAAE,aAAaI,MAAoBC,GAAY,GAI/CC,IAAqBR,EAAkB,QAC1C,MACC,EAAE,YAAY,MACd,CAACS,GAAuB,EAAE,UAAU,KACpC,CAACC,GAAuB,EAAE,YAAYJ,CAAe,CACzD,GAC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