@burdenoff/microfe-export 2026.1120.1 → 2026.1124.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/export/ExportRoutes.js +23 -22
  2. package/dist/export/ExportRoutes.js.map +1 -1
  3. package/dist/export/hooks/useExportQueries.d.ts +89 -1
  4. package/dist/export/hooks/useExportQueries.js +167 -127
  5. package/dist/export/hooks/useExportQueries.js.map +1 -1
  6. package/dist/export/workspace-v2/DownloadCells.d.ts +29 -0
  7. package/dist/export/workspace-v2/DownloadCells.js +105 -0
  8. package/dist/export/workspace-v2/DownloadCells.js.map +1 -0
  9. package/dist/export/workspace-v2/DownloadsList.d.ts +13 -0
  10. package/dist/export/workspace-v2/DownloadsList.js +208 -0
  11. package/dist/export/workspace-v2/DownloadsList.js.map +1 -0
  12. package/dist/export/workspace-v2/DownloadsPage.d.ts +1 -0
  13. package/dist/export/workspace-v2/DownloadsPage.js +114 -0
  14. package/dist/export/workspace-v2/DownloadsPage.js.map +1 -0
  15. package/dist/export/workspace-v2/ExportV2Routes.d.ts +1 -0
  16. package/dist/export/workspace-v2/ExportV2Routes.js +68 -0
  17. package/dist/export/workspace-v2/ExportV2Routes.js.map +1 -0
  18. package/dist/export/workspace-v2/NewDownloadDialog.d.ts +10 -0
  19. package/dist/export/workspace-v2/NewDownloadDialog.js +432 -0
  20. package/dist/export/workspace-v2/NewDownloadDialog.js.map +1 -0
  21. package/dist/export/workspace-v2/SetupsList.d.ts +13 -0
  22. package/dist/export/workspace-v2/SetupsList.js +132 -0
  23. package/dist/export/workspace-v2/SetupsList.js.map +1 -0
  24. package/dist/export/workspace-v2/downloadsModel.d.ts +108 -0
  25. package/dist/export/workspace-v2/downloadsModel.js +138 -0
  26. package/dist/export/workspace-v2/downloadsModel.js.map +1 -0
  27. package/dist/export/workspace-v2/newDownloadModel.d.ts +48 -0
  28. package/dist/export/workspace-v2/newDownloadModel.js +76 -0
  29. package/dist/export/workspace-v2/newDownloadModel.js.map +1 -0
  30. package/dist/export/workspace-v2/useDownloadActions.d.ts +20 -0
  31. package/dist/export/workspace-v2/useDownloadActions.js +127 -0
  32. package/dist/export/workspace-v2/useDownloadActions.js.map +1 -0
  33. package/dist/export/workspace-v2/useDownloadsData.d.ts +57 -0
  34. package/dist/export/workspace-v2/useDownloadsData.js +186 -0
  35. package/dist/export/workspace-v2/useDownloadsData.js.map +1 -0
  36. package/dist/export/workspace-v2/useDownloadsPage.d.ts +22 -0
  37. package/dist/export/workspace-v2/useDownloadsPage.js +45 -0
  38. package/dist/export/workspace-v2/useDownloadsPage.js.map +1 -0
  39. package/dist/export/workspace-v2/useExportAccess.d.ts +21 -0
  40. package/dist/export/workspace-v2/useExportAccess.js +16 -0
  41. package/dist/export/workspace-v2/useExportAccess.js.map +1 -0
  42. package/dist/export/workspace-v2/useListClock.d.ts +4 -0
  43. package/dist/export/workspace-v2/useListClock.js +20 -0
  44. package/dist/export/workspace-v2/useListClock.js.map +1 -0
  45. package/dist/export/workspace-v2/useOfferedKinds.d.ts +19 -0
  46. package/dist/export/workspace-v2/useOfferedKinds.js +30 -0
  47. package/dist/export/workspace-v2/useOfferedKinds.js.map +1 -0
  48. package/dist/export/workspace-v2/useOnceAtATime.d.ts +7 -0
  49. package/dist/export/workspace-v2/useOnceAtATime.js +17 -0
  50. package/dist/export/workspace-v2/useOnceAtATime.js.map +1 -0
  51. package/dist/generated/global-types.d.ts +9901 -584
  52. package/dist/generated/wspace-operations.js +9 -11
  53. package/dist/generated/wspace-operations.js.map +1 -1
  54. package/dist/generated/wspace-types.d.ts +195315 -42067
  55. package/dist/generated/wspace-types.js +5 -1
  56. package/dist/generated/wspace-types.js.map +1 -1
  57. package/dist/translations/en.d.ts +190 -0
  58. package/dist/translations/en.js +191 -1
  59. package/dist/translations/en.js.map +1 -1
  60. package/package.json +11 -3
@@ -0,0 +1,114 @@
1
+ import { useTr as e } from "../hooks/useTr.js";
2
+ import { CONTAINS_FILTER as t, STATUS_FILTER as n, searchFromOldParams as r, statusesFor as i } from "./downloadsModel.js";
3
+ import { DownloadsList as a } from "./DownloadsList.js";
4
+ import { NewDownloadDialog as o } from "./NewDownloadDialog.js";
5
+ import { SetupsList as s } from "./SetupsList.js";
6
+ import { useDownloadActions as c } from "./useDownloadActions.js";
7
+ import { useDownloadsList as l, useSavedSetups as u } from "./useDownloadsData.js";
8
+ import { useDownloadsPage as d } from "./useDownloadsPage.js";
9
+ import { useExportAccess as f } from "./useExportAccess.js";
10
+ import { useOfferedKinds as p } from "./useOfferedKinds.js";
11
+ import { Archive as m, Download as h, Plus as g } from "lucide-react";
12
+ import { Navigate as _, useLocation as v } from "react-router";
13
+ import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
14
+ import { LockedButton as S, WorkspacePage as C, useNotify as w } from "@burdenoff/fe-libs/ui";
15
+ import { PageHeader as T, Tabs as E } from "@burdenoff/fe-libs/chrome";
16
+ // src/export/workspace-v2/DownloadsPage.tsx
17
+ function D() {
18
+ let e = v(), t = r(e.search);
19
+ return t === null ? /* @__PURE__ */ b(O, {}) : /* @__PURE__ */ b(_, {
20
+ to: {
21
+ pathname: e.pathname,
22
+ search: t
23
+ },
24
+ replace: !0
25
+ });
26
+ }
27
+ function O() {
28
+ let r = e(), _ = w(), v = d(), D = p(), O = f(), k = D.groups.find((e) => e.id === v.list.filters[t]?.[0]), A = l({
29
+ statuses: i(v.list.filters[n]),
30
+ entityTypes: k?.entityTypes,
31
+ search: v.list.query,
32
+ sort: v.list.sort,
33
+ page: v.list.page,
34
+ pageSize: v.list.pageSize
35
+ }), j = u(), M = c({
36
+ refreshDownloads: A.refresh,
37
+ refreshSetups: j.refresh,
38
+ showDownloads: () => v.setTab("downloads"),
39
+ showSetups: () => v.setTab("setups"),
40
+ isOffered: D.isOffered
41
+ }), N = [v.tab === "setups" ? {
42
+ id: "downloads",
43
+ label: r("export.v2.tabs.downloads", "Downloads"),
44
+ icon: h,
45
+ onSelect: () => v.setTab("downloads")
46
+ } : {
47
+ id: "setups",
48
+ label: r("export.v2.tabs.setups", "Saved setups"),
49
+ icon: m,
50
+ onSelect: () => v.setTab("setups")
51
+ }];
52
+ return /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ x(C, { children: [
53
+ /* @__PURE__ */ b(T, {
54
+ variant: "compact",
55
+ title: r("export.v2.title", "Download your data"),
56
+ description: r("export.v2.purpose", "Copies of your workflows, runs, files and more, packaged as one ZIP file of CSV or JSON."),
57
+ primary: /* @__PURE__ */ b(S, {
58
+ type: "button",
59
+ locked: O.settled && !O.canCreate,
60
+ reason: r("export.v2.new.createLocked", "Starting a download needs permission to export in this workspace. Ask a workspace admin."),
61
+ icon: g,
62
+ onClick: () => v.openNew(),
63
+ "data-tour": "export-new-download",
64
+ children: r("export.v2.newDownload", "New download")
65
+ }),
66
+ more: N,
67
+ moreLabel: r("export.v2.moreLabel", "More for Download your data")
68
+ }),
69
+ /* @__PURE__ */ b(E, {
70
+ variant: "check",
71
+ ariaLabel: r("export.v2.tabs.label", "Download your data"),
72
+ activeTabId: v.tab,
73
+ onTabChange: (e) => v.setTab(e === "setups" ? "setups" : "downloads"),
74
+ items: [{
75
+ id: "downloads",
76
+ label: r("export.v2.tabs.downloads", "Downloads"),
77
+ icon: /* @__PURE__ */ b(h, { "aria-hidden": "true" }),
78
+ badge: v.list.narrowed ? void 0 : A.total
79
+ }, {
80
+ id: "setups",
81
+ label: r("export.v2.tabs.setups", "Saved setups"),
82
+ icon: /* @__PURE__ */ b(m, { "aria-hidden": "true" }),
83
+ badge: j.total
84
+ }]
85
+ }),
86
+ v.tab === "setups" ? /* @__PURE__ */ b(s, {
87
+ page: v,
88
+ data: j,
89
+ kinds: D,
90
+ access: O,
91
+ actions: M
92
+ }) : /* @__PURE__ */ b(a, {
93
+ page: v,
94
+ data: A,
95
+ kinds: D,
96
+ access: O,
97
+ actions: M
98
+ })
99
+ ] }), /* @__PURE__ */ b(o, {
100
+ open: v.dialogOpen,
101
+ setupId: v.dialogSetupId,
102
+ onClose: v.closeNew,
103
+ onStarted: (e) => {
104
+ v.finishNew(), A.refresh(), j.refresh(), _({
105
+ tone: "success",
106
+ title: r("export.v2.started", "Started “{{name}}”", { name: e.name }),
107
+ description: r("export.v2.startedDescription", "It shows up in Downloads, and you can download it when it’s ready.")
108
+ });
109
+ }
110
+ })] });
111
+ }
112
+ export { D as DownloadsPage };
113
+
114
+ //# sourceMappingURL=DownloadsPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DownloadsPage.js","names":["_Fragment","DownloadsPage","location","useLocation","mapped","searchFromOldParams","DownloadsPageContent","Navigate","tr","useTr","notify","useNotify","page","useDownloadsPage","kinds","useOfferedKinds","access","useExportAccess","containsGroup","group","CONTAINS_FILTER","downloads","useDownloadsList","statusesFor","STATUS_FILTER","setups","useSavedSetups","actions","useDownloadActions","more","Download","Archive","Fragment","WorkspacePage","PageHeader","LockedButton","Plus","Tabs","id","SetupsList","DownloadsList","NewDownloadDialog","job"],"sources":["../../../src/export/workspace-v2/DownloadsPage.tsx"],"sourcesContent":["/**\n * \"Download your data\", redesigned (BOFF-15822, Workspace pages v2): the\n * page's header (New download, ⋯), then two tabs: Downloads (each download's\n * status and the one action that fits it, with the shared pager) and Saved\n * setups (Run now). New download is a dialog. The state lives in the address\n * (see `useDownloadsPage`), and old addresses open the right view.\n */\nimport { Navigate, useLocation } from \"react-router\";\nimport { Archive, Download, Plus } from \"lucide-react\";\nimport { PageHeader, Tabs } from \"@burdenoff/fe-libs/chrome\";\nimport {\n LockedButton,\n WorkspacePage,\n useNotify,\n type ActionMenuItem,\n} from \"@burdenoff/fe-libs/ui\";\nimport { useTr } from \"../hooks/useTr\";\nimport {\n CONTAINS_FILTER,\n STATUS_FILTER,\n searchFromOldParams,\n statusesFor,\n} from \"./downloadsModel\";\nimport { DownloadsList } from \"./DownloadsList\";\nimport { NewDownloadDialog } from \"./NewDownloadDialog\";\nimport { SetupsList } from \"./SetupsList\";\nimport { useDownloadActions } from \"./useDownloadActions\";\nimport { useDownloadsList, useSavedSetups } from \"./useDownloadsData\";\nimport { useDownloadsPage } from \"./useDownloadsPage\";\nimport { useExportAccess } from \"./useExportAccess\";\nimport { useOfferedKinds } from \"./useOfferedKinds\";\n\nexport function DownloadsPage() {\n const location = useLocation();\n // Old links (?tab=templates, ?status=COMPLETED, ?templateId=) open the right view.\n const mapped = searchFromOldParams(location.search);\n if (mapped !== null) {\n return (\n <Navigate to={{ pathname: location.pathname, search: mapped }} replace />\n );\n }\n return <DownloadsPageContent />;\n}\n\nfunction DownloadsPageContent() {\n const tr = useTr();\n const notify = useNotify();\n const page = useDownloadsPage();\n const kinds = useOfferedKinds();\n const access = useExportAccess();\n const containsGroup = kinds.groups.find(\n (group) => group.id === page.list.filters[CONTAINS_FILTER]?.[0],\n );\n const downloads = useDownloadsList({\n statuses: statusesFor(page.list.filters[STATUS_FILTER]),\n entityTypes: containsGroup?.entityTypes,\n search: page.list.query,\n sort: page.list.sort,\n page: page.list.page,\n pageSize: page.list.pageSize,\n });\n const setups = useSavedSetups();\n const actions = useDownloadActions({\n refreshDownloads: downloads.refresh,\n refreshSetups: setups.refresh,\n showDownloads: () => page.setTab(\"downloads\"),\n showSetups: () => page.setTab(\"setups\"),\n isOffered: kinds.isOffered,\n });\n\n const more: ActionMenuItem[] = [\n page.tab === \"setups\"\n ? {\n id: \"downloads\",\n label: tr(\"export.v2.tabs.downloads\", \"Downloads\"),\n icon: Download,\n onSelect: () => page.setTab(\"downloads\"),\n }\n : {\n id: \"setups\",\n label: tr(\"export.v2.tabs.setups\", \"Saved setups\"),\n icon: Archive,\n onSelect: () => page.setTab(\"setups\"),\n },\n ];\n\n return (\n <>\n <WorkspacePage>\n <PageHeader\n variant=\"compact\"\n title={tr(\"export.v2.title\", \"Download your data\")}\n description={tr(\n \"export.v2.purpose\",\n \"Copies of your workflows, runs, files and more, packaged as one ZIP file of CSV or JSON.\",\n )}\n primary={\n <LockedButton\n type=\"button\"\n locked={access.settled && !access.canCreate}\n reason={tr(\n \"export.v2.new.createLocked\",\n \"Starting a download needs permission to export in this workspace. Ask a workspace admin.\",\n )}\n icon={Plus}\n onClick={() => page.openNew()}\n data-tour=\"export-new-download\"\n >\n {tr(\"export.v2.newDownload\", \"New download\")}\n </LockedButton>\n }\n more={more}\n moreLabel={tr(\"export.v2.moreLabel\", \"More for Download your data\")}\n />\n <Tabs\n variant=\"check\"\n ariaLabel={tr(\"export.v2.tabs.label\", \"Download your data\")}\n activeTabId={page.tab}\n onTabChange={(id) =>\n page.setTab(id === \"setups\" ? \"setups\" : \"downloads\")\n }\n items={[\n {\n id: \"downloads\",\n label: tr(\"export.v2.tabs.downloads\", \"Downloads\"),\n icon: <Download aria-hidden=\"true\" />,\n // The count of everything: only while no search or filter narrows it.\n badge: page.list.narrowed ? undefined : downloads.total,\n },\n {\n id: \"setups\",\n label: tr(\"export.v2.tabs.setups\", \"Saved setups\"),\n icon: <Archive aria-hidden=\"true\" />,\n badge: setups.total,\n },\n ]}\n />\n {page.tab === \"setups\" ? (\n <SetupsList\n page={page}\n data={setups}\n kinds={kinds}\n access={access}\n actions={actions}\n />\n ) : (\n <DownloadsList\n page={page}\n data={downloads}\n kinds={kinds}\n access={access}\n actions={actions}\n />\n )}\n </WorkspacePage>\n <NewDownloadDialog\n open={page.dialogOpen}\n setupId={page.dialogSetupId}\n onClose={page.closeNew}\n onStarted={(job) => {\n page.finishNew();\n downloads.refresh();\n setups.refresh();\n notify({\n tone: \"success\",\n title: tr(\"export.v2.started\", \"Started “{{name}}”\", {\n name: job.name,\n }),\n description: tr(\n \"export.v2.startedDescription\",\n \"It shows up in Downloads, and you can download it when it’s ready.\",\n ),\n });\n }}\n />\n </>\n );\n}\n"],"mappings":"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"}
@@ -0,0 +1 @@
1
+ export declare function ExportV2Routes(): import('react').JSX.Element;
@@ -0,0 +1,68 @@
1
+ import { useExport as e } from "../providers/ExportProvider.js";
2
+ import { targetForOldList as t, targetForOldNew as n, targetForOldSetups as r } from "./downloadsModel.js";
3
+ import { DownloadsPage as i } from "./DownloadsPage.js";
4
+ import { lazy as a } from "react";
5
+ import { Navigate as o, Route as s, Routes as c, useLocation as l } from "react-router";
6
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
7
+ // src/export/workspace-v2/ExportV2Routes.tsx
8
+ var f = a(() => import("../pages/v2/DownloadDetailPage.js").then((e) => ({ default: e.DownloadDetailPage }))), p = a(() => import("../pages/TemplateDetailPage.js").then((e) => ({ default: e.TemplateDetailPage })));
9
+ function m(e) {
10
+ let t = e || "/";
11
+ return t.length > 1 ? t.replace(/\/+$/, "") : t;
12
+ }
13
+ function h({ listPath: e }) {
14
+ let { search: t } = l();
15
+ return /* @__PURE__ */ u(o, {
16
+ to: n(e, t),
17
+ replace: !0
18
+ });
19
+ }
20
+ function g({ listPath: e }) {
21
+ let { search: n } = l();
22
+ return /* @__PURE__ */ u(o, {
23
+ to: t(e, n),
24
+ replace: !0
25
+ });
26
+ }
27
+ function _() {
28
+ let t = m(e().basePath);
29
+ return /* @__PURE__ */ d(c, { children: [
30
+ /* @__PURE__ */ u(s, {
31
+ index: !0,
32
+ element: /* @__PURE__ */ u(i, {})
33
+ }),
34
+ /* @__PURE__ */ u(s, {
35
+ path: "new",
36
+ element: /* @__PURE__ */ u(h, { listPath: t })
37
+ }),
38
+ /* @__PURE__ */ u(s, {
39
+ path: "history",
40
+ element: /* @__PURE__ */ u(g, { listPath: t })
41
+ }),
42
+ /* @__PURE__ */ u(s, {
43
+ path: "templates",
44
+ element: /* @__PURE__ */ u(o, {
45
+ to: r(t),
46
+ replace: !0
47
+ })
48
+ }),
49
+ /* @__PURE__ */ u(s, {
50
+ path: "templates/:templateId",
51
+ element: /* @__PURE__ */ u(p, {})
52
+ }),
53
+ /* @__PURE__ */ u(s, {
54
+ path: ":jobId",
55
+ element: /* @__PURE__ */ u(f, {})
56
+ }),
57
+ /* @__PURE__ */ u(s, {
58
+ path: "*",
59
+ element: /* @__PURE__ */ u(o, {
60
+ to: t,
61
+ replace: !0
62
+ })
63
+ })
64
+ ] });
65
+ }
66
+ export { _ as ExportV2Routes };
67
+
68
+ //# sourceMappingURL=ExportV2Routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExportV2Routes.js","names":["DownloadDetailPage","lazy","m","TemplateDetailPage","listPathOf","path","basePath","OldNewRedirect","useLocation","Navigate","targetForOldNew","listPath","search","OldListRedirect","targetForOldList","ExportV2Routes","useExport","Routes","Route","DownloadsPage","targetForOldSetups"],"sources":["../../../src/export/workspace-v2/ExportV2Routes.tsx"],"sourcesContent":["/**\n * The \"Download your data\" routes under Workspace pages v2 (BOFF-15822).\n * `ExportRoutes` renders these instead of its own only when\n * `useWorkspacePagesV2()` is on.\n *\n * Every address the old pages had still lands somewhere sensible:\n * - `/` → Downloads (old `?tab=`, `?status=` and `?templateId=` mapped);\n * - `/new` → Downloads with New download open (`?dialog=new`; a\n * `?templateId=` fills it in from that setup);\n * - `/history` → Downloads (its `?status=` as the Status filter);\n * - `/templates` → the Saved setups tab (`?tab=setups`);\n * - `/templates/:templateId` → that setup's own page, as before (editing it);\n * - `/:jobId` → that download's own page (its parts and progress), as before.\n */\nimport { lazy } from \"react\";\nimport { Navigate, Route, Routes, useLocation } from \"react-router\";\nimport { useExport } from \"../providers/ExportProvider\";\nimport {\n targetForOldList,\n targetForOldNew,\n targetForOldSetups,\n} from \"./downloadsModel\";\nimport { DownloadsPage } from \"./DownloadsPage\";\n\nconst DownloadDetailPage = lazy(() =>\n import(\"../pages/v2/DownloadDetailPage\").then((m) => ({\n default: m.DownloadDetailPage,\n })),\n);\nconst TemplateDetailPage = lazy(() =>\n import(\"../pages/TemplateDetailPage\").then((m) => ({\n default: m.TemplateDetailPage,\n })),\n);\n\n/** The module's own address, without a trailing slash (`/` stays `/`). */\nfunction listPathOf(basePath: string | undefined): string {\n const path = basePath || \"/\";\n return path.length > 1 ? path.replace(/\\/+$/, \"\") : path;\n}\n\nfunction OldNewRedirect({ listPath }: { listPath: string }) {\n const { search } = useLocation();\n return <Navigate to={targetForOldNew(listPath, search)} replace />;\n}\n\nfunction OldListRedirect({ listPath }: { listPath: string }) {\n const { search } = useLocation();\n return <Navigate to={targetForOldList(listPath, search)} replace />;\n}\n\nexport function ExportV2Routes() {\n const listPath = listPathOf(useExport().basePath);\n return (\n <Routes>\n <Route index element={<DownloadsPage />} />\n <Route path=\"new\" element={<OldNewRedirect listPath={listPath} />} />\n <Route path=\"history\" element={<OldListRedirect listPath={listPath} />} />\n <Route\n path=\"templates\"\n element={<Navigate to={targetForOldSetups(listPath)} replace />}\n />\n <Route path=\"templates/:templateId\" element={<TemplateDetailPage />} />\n <Route path=\":jobId\" element={<DownloadDetailPage />} />\n <Route path=\"*\" element={<Navigate to={listPath} replace />} />\n </Routes>\n );\n}\n"],"mappings":";;;;;;;AAwBA,IAAMA,IAAqBC,QACzB,OAAO,oCAAiC,CAAC,MAAM,OAAO,EACpD,SAASC,EAAE,mBACb,EAAE,CACJ,GACMC,IAAqBF,QACzB,OAAO,iCAA8B,CAAC,MAAM,OAAO,EACjD,SAASC,EAAE,mBACb,EAAE,CACJ;AAGA,SAASE,EAAW,GAAsC;CACxD,IAAMC,IAAOC,KAAY;CACzB,OAAOD,EAAK,SAAS,IAAIA,EAAK,QAAQ,QAAQ,EAAE,IAAIA;AACtD;AAEA,SAASE,EAAe,EAAE,eAAkC;CAC1D,IAAM,EAAE,cAAWC,EAAY;CAC/B,OAAO,kBAACC,GAAD;EAAU,IAAIC,EAAgBC,GAAUC,CAAM;EAAG,SAAA;CAAS,CAAA;AACnE;AAEA,SAASC,EAAgB,EAAE,eAAkC;CAC3D,IAAM,EAAE,cAAWL,EAAY;CAC/B,OAAO,kBAACC,GAAD;EAAU,IAAIK,EAAiBH,GAAUC,CAAM;EAAG,SAAA;CAAS,CAAA;AACpE;AAEA,SAAgBG,IAAiB;CAC/B,IAAMJ,IAAWP,EAAWY,EAAU,CAAC,CAAC,QAAQ;CAChD,OACE,kBAACC,GAAD,EAAA,UAAA;EACE,kBAACC,GAAD;GAAO,OAAA;GAAM,SAAS,kBAACC,GAAD,CAAgB,CAAA;EAAI,CAAA;EAC1C,kBAACD,GAAD;GAAO,MAAK;GAAM,SAAS,kBAACX,GAAD,EAA0B,YAAW,CAAA;EAAI,CAAA;EACpE,kBAACW,GAAD;GAAO,MAAK;GAAU,SAAS,kBAACL,GAAD,EAA2B,YAAW,CAAA;EAAI,CAAA;EACzE,kBAACK,GAAD;GACE,MAAK;GACL,SAAS,kBAACT,GAAD;IAAU,IAAIW,EAAmBT,CAAQ;IAAG,SAAA;GAAS,CAAA;EAC/D,CAAA;EACD,kBAACO,GAAD;GAAO,MAAK;GAAwB,SAAS,kBAACf,GAAD,CAAqB,CAAA;EAAI,CAAA;EACtE,kBAACe,GAAD;GAAO,MAAK;GAAS,SAAS,kBAAClB,GAAD,CAAqB,CAAA;EAAI,CAAA;EACvD,kBAACkB,GAAD;GAAO,MAAK;GAAI,SAAS,kBAACT,GAAD;IAAU,IAAIE;IAAU,SAAA;GAAS,CAAA;EAAI,CAAA;CACxD,EAAA,CAAA;AAEZ"}
@@ -0,0 +1,10 @@
1
+ import { ExportJob } from '../types';
2
+ export interface NewDownloadDialogProps {
3
+ open: boolean;
4
+ /** Start from this saved setup. */
5
+ setupId?: string | null;
6
+ onClose: () => void;
7
+ /** The download started (after its setup, if any, was saved). */
8
+ onStarted: (job: ExportJob) => void;
9
+ }
10
+ export declare function NewDownloadDialog(props: NewDownloadDialogProps): import('react').JSX.Element;
@@ -0,0 +1,432 @@
1
+ import { useCreateExportJob as e, useCreateExportTemplate as t, useOrganizationExportPermission as n, useUpdateExportTemplate as r } from "../hooks/useExportQueries.js";
2
+ import { useTr as i } from "../hooks/useTr.js";
3
+ import { useExport as a } from "../providers/ExportProvider.js";
4
+ import { openBilling as o } from "../utils/billing.js";
5
+ import { suggestedDownloadName as s } from "../utils/newDownloadForm.js";
6
+ import { EMPTY_DRAFT as c, draftFromSetup as l, draftProblem as u, groupState as d, jobInput as f, setupInput as p, toggleKinds as m } from "./newDownloadModel.js";
7
+ import { useSavedSetups as h, useSetupById as g } from "./useDownloadsData.js";
8
+ import { useExportAccess as _ } from "./useExportAccess.js";
9
+ import { useOfferedKinds as v } from "./useOfferedKinds.js";
10
+ import { useState as y } from "react";
11
+ import { Archive as b, CalendarClock as x, Download as S, FileText as C, ListChecks as w, Lock as T, UserRound as E } from "lucide-react";
12
+ import { isQuotaExhaustedError as D } from "@burdenoff/fe-libs/shared/utils";
13
+ import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
14
+ import { Button as j, Checkbox as M, EmptyState as N, Input as P, LockNote as F, LockedButton as I, Notice as L, OptionalFields as R, Segmented as z, SettingRow as B, SettingsSection as V, Skeleton as H, Switch as ee, TabbedDialog as U, TabbedDialogContent as W, TabbedDialogFooter as G, TabbedDialogHeader as K, TabbedDialogTabs as q } from "@burdenoff/fe-libs/ui";
15
+ // src/export/workspace-v2/NewDownloadDialog.tsx
16
+ function J(e) {
17
+ let t = i(), [n, r] = y(!1);
18
+ return /* @__PURE__ */ k(U, {
19
+ open: e.open,
20
+ onOpenChange: (t) => {
21
+ !t && !n && e.onClose();
22
+ },
23
+ children: /* @__PURE__ */ A(W, {
24
+ size: "viewer",
25
+ width: "medium",
26
+ presentation: "sheet",
27
+ "data-testid": "new-download-dialog",
28
+ children: [/* @__PURE__ */ k(K, {
29
+ icon: /* @__PURE__ */ k("span", {
30
+ "aria-hidden": "true",
31
+ className: "grid size-9 shrink-0 place-items-center rounded-lg border border-border-subtle bg-accent-soft text-action-primary-bg",
32
+ children: /* @__PURE__ */ k(S, {
33
+ className: "size-4",
34
+ "aria-hidden": "true"
35
+ })
36
+ }),
37
+ title: t("export.v2.new.title", "New download"),
38
+ description: t("export.v2.new.description", "We package it as one ZIP file. It shows up in Downloads when it’s ready."),
39
+ closeLabel: t("export.v2.common.close", "Close")
40
+ }), e.open ? /* @__PURE__ */ k(Z, {
41
+ ...e,
42
+ onBusy: r
43
+ }) : null]
44
+ })
45
+ });
46
+ }
47
+ function Y(e) {
48
+ let t = h(), n = e ? t.setups.find((t) => t.id === e) : void 0, r = g(e && !t.loading && !n ? e : void 0);
49
+ return e ? n ? {
50
+ kind: "found",
51
+ setup: n
52
+ } : t.loading ? { kind: "waiting" } : r.error ? {
53
+ kind: "failed",
54
+ retry: r.retry
55
+ } : r.answered ? r.setup ? {
56
+ kind: "found",
57
+ setup: r.setup
58
+ } : { kind: "missing" } : { kind: "waiting" } : { kind: "none" };
59
+ }
60
+ function X({ message: e, onRetry: t, testId: n }) {
61
+ let r = i();
62
+ return /* @__PURE__ */ k("div", {
63
+ className: "min-h-0 flex-1 p-5",
64
+ children: /* @__PURE__ */ k(L, {
65
+ tone: "bad",
66
+ "data-testid": n,
67
+ action: /* @__PURE__ */ k(j, {
68
+ type: "button",
69
+ size: "sm",
70
+ variant: "outline",
71
+ onClick: t,
72
+ children: r("export.v2.common.tryAgain", "Try again")
73
+ }),
74
+ children: e
75
+ })
76
+ });
77
+ }
78
+ function Z(e) {
79
+ let t = i(), n = v(), r = Y(e.setupId);
80
+ return n.error ? /* @__PURE__ */ k(X, {
81
+ message: t("export.v2.new.kindsFailed", "Couldn’t load what you can download."),
82
+ onRetry: n.retry
83
+ }) : r.kind === "failed" ? /* @__PURE__ */ k(X, {
84
+ testId: "new-download-setup-failed",
85
+ message: t("export.v2.new.setupFailed", "Couldn’t load the saved setup to start from."),
86
+ onRetry: r.retry
87
+ }) : n.loading || r.kind === "waiting" ? /* @__PURE__ */ A("div", {
88
+ className: "flex min-h-0 flex-1 flex-col gap-3 p-5",
89
+ "data-testid": "new-download-loading",
90
+ "aria-busy": "true",
91
+ children: [/* @__PURE__ */ k(H, { className: "h-10 w-full rounded-card" }), /* @__PURE__ */ k(H, { className: "h-40 w-full rounded-card" })]
92
+ }) : n.groups.length === 0 && n.others.length === 0 ? /* @__PURE__ */ k(Q, {}) : /* @__PURE__ */ k(re, {
93
+ ...e,
94
+ kinds: n,
95
+ initial: r.kind === "found" ? l(r.setup, n.isOffered) : c,
96
+ setupMissing: r.kind === "missing"
97
+ });
98
+ }
99
+ function Q() {
100
+ let e = i();
101
+ return /* @__PURE__ */ k("div", {
102
+ className: "min-h-0 flex-1 p-5",
103
+ "data-testid": "new-download-nothing",
104
+ children: /* @__PURE__ */ k(N, {
105
+ size: "panel",
106
+ illustration: "documents",
107
+ icon: /* @__PURE__ */ k(b, { "aria-hidden": "true" }),
108
+ title: e("export.create.select.emptyTitle", "Nothing to export yet"),
109
+ description: e("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.")
110
+ })
111
+ });
112
+ }
113
+ function te(e) {
114
+ let t = i();
115
+ return (n) => {
116
+ let r = new Set(n), i = e.groups.filter((e) => e.entityTypes.every((e) => r.has(e))), a = new Set(i.flatMap((e) => e.entityTypes)), o = n.filter((e) => !a.has(e)), c = t("export.v2.new.nameMyData", "My data");
117
+ return i.length === 1 && o.length === 0 && i[0] ? c = i[0].label : i.length === 0 && o.length === 1 && o[0] && (c = e.label(o[0])), s(c);
118
+ };
119
+ }
120
+ function ne(n, i) {
121
+ let { organizationId: o } = a(), { createJob: s } = e(), { createTemplate: c } = t(), { updateTemplate: l } = r(), [u, d] = y(!1), [m, h] = y(null), [g, _] = y(null);
122
+ return {
123
+ start: async (e) => {
124
+ d(!0), i(!0), h(null);
125
+ try {
126
+ let t = e.setupId;
127
+ if (e.save) {
128
+ let n = p(e), r = JSON.stringify(n);
129
+ if (g) g.input !== r && (await l(g.id, n), _({
130
+ id: g.id,
131
+ input: r
132
+ })), t = g.id;
133
+ else {
134
+ let e = await c(n);
135
+ _({
136
+ id: e.id,
137
+ input: r
138
+ }), t = e.id;
139
+ }
140
+ }
141
+ n(await s(f(e, o, t)));
142
+ } catch (e) {
143
+ h(D(e) ? { kind: "quota" } : {
144
+ kind: "failed",
145
+ reason: e instanceof Error && e.message ? e.message : null
146
+ });
147
+ } finally {
148
+ d(!1), i(!1);
149
+ }
150
+ },
151
+ busy: u,
152
+ problem: m,
153
+ setupSaved: g !== null
154
+ };
155
+ }
156
+ function re({ kinds: e, initial: t, setupMissing: r, onClose: o, onStarted: s, onBusy: c }) {
157
+ let l = i(), d = _(), { organizationId: f } = a(), p = n(f, { quiet: !0 }), m = te(e), [h, g] = y("what"), [v, b] = y(t), { start: T, busy: E, problem: D, setupSaved: M } = ne(s, c), N = v.nameEdited ? v.name : m(v.entityTypes), P = {
158
+ ...v,
159
+ name: N
160
+ }, F = u(P), R = (e) => b((t) => ({
161
+ ...t,
162
+ ...e
163
+ }));
164
+ return /* @__PURE__ */ A(O, { children: [
165
+ r || D ? /* @__PURE__ */ A("div", {
166
+ className: "flex shrink-0 flex-col gap-2 border-b border-border-subtle px-5 py-3",
167
+ children: [r ? /* @__PURE__ */ k(L, {
168
+ tone: "warn",
169
+ "data-testid": "new-download-setup-missing",
170
+ children: l("export.v2.new.setupMissing", "That saved setup wasn’t found. It may have been deleted. You can still make a new download here.")
171
+ }) : null, D ? /* @__PURE__ */ k(ie, { problem: D }) : null]
172
+ }) : null,
173
+ /* @__PURE__ */ k(q, {
174
+ tabs: [
175
+ {
176
+ value: "what",
177
+ label: l("export.v2.new.tabWhat", "What"),
178
+ icon: w
179
+ },
180
+ {
181
+ value: "format",
182
+ label: l("export.v2.new.tabFormat", "Format"),
183
+ icon: C
184
+ },
185
+ {
186
+ value: "when",
187
+ label: l("export.v2.new.tabWhen", "When"),
188
+ icon: x
189
+ }
190
+ ],
191
+ value: h,
192
+ onValueChange: g,
193
+ "aria-label": l("export.v2.new.title", "New download"),
194
+ renderPanel: (t) => t === "what" ? /* @__PURE__ */ k(ae, {
195
+ draft: v,
196
+ access: d,
197
+ canOrganization: p,
198
+ kinds: e,
199
+ change: R
200
+ }) : t === "format" ? /* @__PURE__ */ k(oe, {
201
+ draft: P,
202
+ kinds: e,
203
+ change: R
204
+ }) : /* @__PURE__ */ k(se, {
205
+ draft: P,
206
+ access: d,
207
+ setupSaved: M,
208
+ change: R
209
+ })
210
+ }),
211
+ /* @__PURE__ */ A(G, { children: [
212
+ /* @__PURE__ */ k("span", {
213
+ className: "me-auto min-w-0 truncate text-sm text-text-secondary",
214
+ "data-testid": "new-download-summary",
215
+ children: v.entityTypes.length > 0 ? v.entityTypes.map(e.label).join(", ") : l("export.v2.new.pickKinds", "Pick at least one kind of data")
216
+ }),
217
+ /* @__PURE__ */ k(j, {
218
+ type: "button",
219
+ variant: "outline",
220
+ onClick: o,
221
+ disabled: E,
222
+ children: l("export.v2.common.cancel", "Cancel")
223
+ }),
224
+ /* @__PURE__ */ k(I, {
225
+ type: "button",
226
+ locked: d.settled && !d.canCreate,
227
+ reason: l("export.v2.new.createLocked", "Starting a download needs permission to export in this workspace. Ask a workspace admin."),
228
+ icon: S,
229
+ disabled: E || F === "noKinds",
230
+ "aria-busy": E || void 0,
231
+ onClick: () => {
232
+ F === "noKinds" ? g("what") : F ? g("when") : T(P);
233
+ },
234
+ children: E ? l("export.v2.new.starting", "Starting…") : l("export.v2.new.start", "Start download")
235
+ })
236
+ ] })
237
+ ] });
238
+ }
239
+ function ie({ problem: e }) {
240
+ let t = i(), { navigate: n } = a();
241
+ return e.kind === "quota" ? /* @__PURE__ */ k(L, {
242
+ tone: "warn",
243
+ action: /* @__PURE__ */ k(j, {
244
+ type: "button",
245
+ size: "sm",
246
+ variant: "outline",
247
+ onClick: () => o(n),
248
+ children: t("export.v2.new.seePlans", "See plans")
249
+ }),
250
+ children: t("export.v2.new.quota", "You’ve reached this month’s download limit. A bigger plan raises it.")
251
+ }) : /* @__PURE__ */ k(L, {
252
+ tone: "bad",
253
+ children: e.reason ? t("export.v2.new.failedWithReason", "Couldn’t start the download: {{reason}}", { reason: e.reason }) : t("export.v2.new.failed", "Couldn’t start the download. Try again.")
254
+ });
255
+ }
256
+ function ae({ draft: e, access: t, canOrganization: n, kinds: r, change: a }) {
257
+ let o = i(), s = t.settled && !t.canWorkspace, c = [{
258
+ value: "INDIVIDUAL",
259
+ label: o("export.v2.new.scopeMine", "Just mine")
260
+ }, {
261
+ value: "WORKSPACE_ADMIN",
262
+ label: o("export.v2.new.scopeWorkspace", "All of the workspace"),
263
+ disabled: !t.canWorkspace
264
+ }];
265
+ n && c.push({
266
+ value: "ORG_ADMIN",
267
+ label: o("export.v2.new.scopeOrganization", "All of the organization")
268
+ });
269
+ let l = (t, n, r, i) => /* @__PURE__ */ k(B, {
270
+ label: n,
271
+ description: r,
272
+ control: (t) => /* @__PURE__ */ k(M, {
273
+ checked: d(e.entityTypes, i),
274
+ onCheckedChange: () => a({ entityTypes: m(e.entityTypes, i) }),
275
+ "aria-labelledby": t.labelId,
276
+ "aria-describedby": t.descriptionId
277
+ })
278
+ }, t);
279
+ return /* @__PURE__ */ A("div", {
280
+ className: "flex flex-col gap-4",
281
+ children: [
282
+ /* @__PURE__ */ k(V, {
283
+ title: o("export.v2.new.whose", "Whose data"),
284
+ icon: E,
285
+ children: /* @__PURE__ */ k(B, {
286
+ label: o("export.v2.new.whoseLabel", "Download"),
287
+ description: e.scope === "INDIVIDUAL" ? o("export.v2.new.scopeMineHelp", "What you made or can see.") : e.scope === "WORKSPACE_ADMIN" ? o("export.v2.new.scopeWorkspaceHelp", "Every person’s data in this workspace.") : o("export.v2.new.scopeOrganizationHelp", "The data of every workspace in your organization."),
288
+ control: (t) => /* @__PURE__ */ k(z, {
289
+ options: c,
290
+ value: e.scope,
291
+ onValueChange: (e) => a({ scope: e }),
292
+ "aria-labelledby": t.labelId,
293
+ "aria-describedby": t.descriptionId
294
+ })
295
+ })
296
+ }),
297
+ t.settled && !t.canCreate ? /* @__PURE__ */ k(F, { children: o("export.v2.new.createLocked", "Starting a download needs permission to export in this workspace. Ask a workspace admin.") }) : s ? /* @__PURE__ */ k(F, { children: o("export.v2.new.workspaceLocked", "Downloading the whole workspace is for workspace admins. You can download your own data.") }) : null,
298
+ /* @__PURE__ */ k(V, {
299
+ title: o("export.v2.new.kinds", "What to include"),
300
+ icon: w,
301
+ children: r.groups.map((e) => l(e.id, e.label, e.description, e.entityTypes))
302
+ }),
303
+ r.others.length > 0 ? /* @__PURE__ */ k(R, {
304
+ storageKey: "export.newDownload.moreKinds",
305
+ label: o("export.v2.new.moreKinds", "More kinds of data"),
306
+ children: /* @__PURE__ */ k(V, { children: r.others.map((e) => l(e, r.label(e), void 0, [e])) })
307
+ }) : null
308
+ ]
309
+ });
310
+ }
311
+ function oe({ draft: e, kinds: t, change: n }) {
312
+ let r = i(), a = [{
313
+ value: "CSV",
314
+ label: r("export.v2.new.formatCsv", "CSV")
315
+ }, {
316
+ value: "JSON",
317
+ label: r("export.v2.new.formatJson", "JSON")
318
+ }];
319
+ return /* @__PURE__ */ A("div", {
320
+ className: "flex flex-col gap-4",
321
+ children: [/* @__PURE__ */ k(V, {
322
+ title: r("export.v2.new.fileType", "File type"),
323
+ icon: C,
324
+ children: /* @__PURE__ */ k(B, {
325
+ label: r("export.v2.new.formatLabel", "Files inside the ZIP"),
326
+ description: e.format === "CSV" ? r("export.v2.new.formatCsvHelp", "Spreadsheets, one per kind of data.") : r("export.v2.new.formatJsonHelp", "One file per kind of data, for other tools and backups."),
327
+ control: (t) => /* @__PURE__ */ k(z, {
328
+ options: a,
329
+ value: e.format,
330
+ onValueChange: (e) => n({ format: e }),
331
+ "aria-labelledby": t.labelId,
332
+ "aria-describedby": t.descriptionId
333
+ })
334
+ })
335
+ }), /* @__PURE__ */ A(V, {
336
+ title: r("export.v2.new.summary", "This download"),
337
+ children: [/* @__PURE__ */ k($, {
338
+ label: r("export.v2.new.summaryContains", "Contains"),
339
+ children: e.entityTypes.length > 0 ? e.entityTypes.map(t.label).join(", ") : r("export.v2.new.summaryNothing", "Nothing yet")
340
+ }), /* @__PURE__ */ k($, {
341
+ label: r("export.v2.new.summaryName", "Name"),
342
+ children: e.name || "—"
343
+ })]
344
+ })]
345
+ });
346
+ }
347
+ function $({ label: e, children: t }) {
348
+ return /* @__PURE__ */ k(B, {
349
+ label: e,
350
+ control: /* @__PURE__ */ k("span", {
351
+ className: "text-end text-sm text-text-primary",
352
+ children: t
353
+ })
354
+ });
355
+ }
356
+ function se({ draft: e, access: t, setupSaved: n, change: r }) {
357
+ let a = i(), o = [
358
+ {
359
+ value: "all",
360
+ label: a("export.v2.new.periodAll", "All time")
361
+ },
362
+ {
363
+ value: "30",
364
+ label: a("export.v2.new.period30", "Last 30 days")
365
+ },
366
+ {
367
+ value: "90",
368
+ label: a("export.v2.new.period90", "Last 90 days")
369
+ }
370
+ ], s = t.settled && !t.canSetups;
371
+ return /* @__PURE__ */ A("div", {
372
+ className: "flex flex-col gap-4",
373
+ children: [/* @__PURE__ */ A(V, {
374
+ title: a("export.v2.new.when", "When"),
375
+ icon: x,
376
+ children: [/* @__PURE__ */ k(B, {
377
+ label: a("export.v2.new.period", "Data from"),
378
+ description: a("export.v2.new.periodHelp", "All time includes everything. A shorter period makes a smaller download."),
379
+ control: (t) => /* @__PURE__ */ k(z, {
380
+ options: o,
381
+ value: e.period,
382
+ onValueChange: (e) => r({ period: e }),
383
+ "aria-labelledby": t.labelId,
384
+ "aria-describedby": t.descriptionId
385
+ })
386
+ }), /* @__PURE__ */ k(B, {
387
+ label: a("export.v2.new.name", "Name"),
388
+ description: a("export.v2.new.nameHelp", "How it shows in Downloads."),
389
+ control: (t) => /* @__PURE__ */ k(P, {
390
+ className: "w-72 max-md:w-full",
391
+ value: e.name,
392
+ maxLength: 200,
393
+ onChange: (e) => r({
394
+ name: e.target.value,
395
+ nameEdited: !0
396
+ }),
397
+ "aria-labelledby": t.labelId,
398
+ "aria-describedby": t.descriptionId,
399
+ "aria-invalid": !e.name.trim() || void 0
400
+ })
401
+ })]
402
+ }), /* @__PURE__ */ A(V, {
403
+ title: a("export.v2.new.setupTitle", "Saved setup"),
404
+ icon: s ? T : b,
405
+ readOnly: !t.canSetups,
406
+ lockNote: s ? a("export.v2.new.setupLocked", "Saving setups needs permission to manage them in this workspace. Ask a workspace admin.") : void 0,
407
+ children: [/* @__PURE__ */ k(B, {
408
+ label: a("export.v2.new.save", "Save as a setup"),
409
+ description: n ? a("export.v2.new.saveDone", "Saved. Starting the download uses it.") : a("export.v2.new.saveHelp", "Shows up in Saved setups, to run again in one click."),
410
+ control: (t) => /* @__PURE__ */ k(ee, {
411
+ checked: e.save,
412
+ onCheckedChange: (e) => r({ save: e }),
413
+ "aria-labelledby": t.labelId,
414
+ "aria-describedby": t.descriptionId
415
+ })
416
+ }), e.save ? /* @__PURE__ */ k(B, {
417
+ label: a("export.v2.new.setupName", "Setup name"),
418
+ control: (t) => /* @__PURE__ */ k(P, {
419
+ className: "w-72 max-md:w-full",
420
+ value: e.setupName,
421
+ placeholder: e.name,
422
+ maxLength: 200,
423
+ onChange: (e) => r({ setupName: e.target.value }),
424
+ "aria-labelledby": t.labelId
425
+ })
426
+ }) : null]
427
+ })]
428
+ });
429
+ }
430
+ export { J as NewDownloadDialog };
431
+
432
+ //# sourceMappingURL=NewDownloadDialog.js.map