@burdenoff/microfe-sandbox 2026.1014.1 → 2026.1101.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.
@@ -1 +1 @@
1
- {"version":3,"file":"ExportSandboxesDialog.d.ts","sourceRoot":"","sources":["../../../src/sandbox/components/ExportSandboxesDialog.tsx"],"names":[],"mappings":"AAwDA,UAAU,KAAK;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,qBAAqB,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,+BAkJ1E"}
1
+ {"version":3,"file":"ExportSandboxesDialog.d.ts","sourceRoot":"","sources":["../../../src/sandbox/components/ExportSandboxesDialog.tsx"],"names":[],"mappings":"AAwFA,UAAU,KAAK;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,qBAAqB,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,+BA0K1E"}
@@ -1,126 +1,146 @@
1
1
  import { Button as e, Checkbox as t, Dialog as n, DialogContent as r, DialogDescription as i, DialogFooter as a, DialogHeader as o, DialogTitle as s } from "./ui.js";
2
2
  import { tWithFallback as c } from "../utils/i18n.js";
3
3
  import { useSandboxEvents as l } from "../utils/sandboxEvents.js";
4
- import { useRef as u, useState as d } from "react";
5
- import { gql as f } from "@apollo/client";
6
- import { useMutation as p, useSubscription as m } from "@apollo/client/react";
7
- import { useI18n as h } from "@burdenoff/fe-libs/shared/providers/shell";
8
- import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
4
+ import { useState as u } from "react";
5
+ import { gql as d } from "@apollo/client";
6
+ import { useMutation as f, useSubscription as p } from "@apollo/client/react";
7
+ import { useI18n as m } from "@burdenoff/fe-libs/shared/providers/shell";
8
+ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
9
9
  //#region src/sandbox/components/ExportSandboxesDialog.tsx
10
- var y = f`
11
- mutation ExportSandboxes($input: ExportSandboxesInput!) {
12
- exportSandboxes(input: $input) {
10
+ var v = d`
11
+ mutation ExportSandboxes($context: ContextInput, $input: CreateExportJobInput!) {
12
+ createExportJob(context: $context, input: $input) {
13
13
  id
14
- workspaceId
15
14
  status
16
15
  format
17
16
  downloadUrl
18
- expiresAt
19
17
  errorMessage
20
18
  }
21
19
  }
22
- `, b = f`
23
- subscription OnSandboxExportJobChanged($workspaceId: ID!, $jobId: ID!) {
24
- onSandboxExportJobChanged(workspaceId: $workspaceId, jobId: $jobId) {
20
+ `, y = d`
21
+ subscription OnExportJobProgress($jobId: ID!) {
22
+ exportJobProgress(jobId: $jobId) {
25
23
  id
26
24
  status
27
25
  format
28
- rowCount
29
26
  downloadUrl
30
- expiresAt
31
27
  errorMessage
32
28
  }
33
29
  }
34
30
  `;
35
- function x({ workspaceId: f, open: x, onClose: S }) {
36
- let { t: C } = h(), w = l(), [T, E] = d("CSV"), [D, O] = d(!1), k = u(null), [A, j] = d(!1), [M, N] = d(null), [P, { loading: F }] = p(y);
37
- m(b, {
38
- variables: {
39
- workspaceId: f,
40
- jobId: k.current
41
- },
42
- skip: !A,
31
+ function b(e) {
32
+ return e === "COMPLETED" ? "READY" : e === "FAILED" || e === "CANCELLED" || e === "EXPIRED" || e === "DELETED" ? "FAILED" : "PENDING";
33
+ }
34
+ function x(e) {
35
+ return {
36
+ id: e.id,
37
+ status: b(e.status),
38
+ format: e.format === "CSV" ? "CSV" : "JSON",
39
+ downloadUrl: e.downloadUrl,
40
+ errorMessage: e.errorMessage
41
+ };
42
+ }
43
+ function S({ workspaceId: d, open: b, onClose: S }) {
44
+ let { t: C } = m(), w = l(), [T, E] = u("CSV"), [D, O] = u(!1), [k, A] = u(null), [j, M] = u(null), [N, P] = u(null), [F, { loading: I }] = f(v);
45
+ p(y, {
46
+ variables: { jobId: k ?? "" },
47
+ skip: k === null,
43
48
  onData: ({ data: e }) => {
44
- let t = e.data?.onSandboxExportJobChanged;
45
- t && N(t);
49
+ let t = e.data?.exportJobProgress;
50
+ t && M(x(t));
46
51
  }
47
52
  });
48
- let I = async () => {
49
- let { data: e } = await P({ variables: { input: {
50
- workspaceId: f,
51
- format: T,
52
- includeUsageEvents: D,
53
- context: { workspaceId: f }
54
- } } });
55
- e?.exportSandboxes && (k.current = e.exportSandboxes.id, j(!0), N(e.exportSandboxes), w.sandboxExportRequested({
56
- jobId: e.exportSandboxes.id,
57
- format: T
58
- }));
59
- }, L = c(C, "sandbox.exportDialog.title", "Export sandboxes"), R = c(C, "sandbox.exportDialog.description", "Generate a downloadable snapshot of the sandboxes matching your current filters.");
60
- return /* @__PURE__ */ _(n, {
61
- open: x,
53
+ let L = async () => {
54
+ P(null);
55
+ try {
56
+ let { data: e } = await F({ variables: {
57
+ context: { workspaceId: d },
58
+ input: {
59
+ name: `sandbox-export-${Date.now()}`,
60
+ entityTypes: D ? ["sandbox_environments", "sandbox_usage_events"] : ["sandbox_environments"],
61
+ format: T
62
+ }
63
+ } });
64
+ e?.createExportJob && (A(e.createExportJob.id), M(x(e.createExportJob)), w.sandboxExportRequested({
65
+ jobId: e.createExportJob.id,
66
+ format: T
67
+ }));
68
+ } catch (e) {
69
+ P(e instanceof Error ? e.message : "unknown");
70
+ }
71
+ }, R = c(C, "sandbox.exportDialog.title", "Export sandboxes"), z = c(C, "sandbox.exportDialog.description", "Generate a downloadable snapshot of the sandboxes matching your current filters.");
72
+ return /* @__PURE__ */ g(n, {
73
+ open: b,
62
74
  onOpenChange: (e) => {
63
75
  e || S();
64
76
  },
65
- children: /* @__PURE__ */ v(r, {
66
- "aria-label": L,
77
+ children: /* @__PURE__ */ _(r, {
78
+ "aria-label": R,
67
79
  children: [
68
- /* @__PURE__ */ v(o, { children: [/* @__PURE__ */ _(s, { children: L }), /* @__PURE__ */ _(i, { children: R })] }),
69
- M ? /* @__PURE__ */ _("div", {
80
+ /* @__PURE__ */ _(o, { children: [/* @__PURE__ */ g(s, { children: R }), /* @__PURE__ */ g(i, { children: z })] }),
81
+ j ? /* @__PURE__ */ g("div", {
70
82
  className: "space-y-3 text-sm text-text-secondary",
71
- children: M.status === "COMPLETED" && M.downloadUrl ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("p", {
83
+ children: j.status === "READY" && j.downloadUrl ? /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("p", {
72
84
  className: "text-status-success-text font-medium",
73
85
  children: c(C, "sandbox.exportDialog.ready", "Export ready")
74
- }), /* @__PURE__ */ _("a", {
75
- href: M.downloadUrl,
86
+ }), /* @__PURE__ */ g("a", {
87
+ href: j.downloadUrl,
76
88
  target: "_blank",
77
89
  rel: "noopener noreferrer",
78
90
  className: "inline-flex items-center rounded-md bg-status-info-bg-subtle px-3 py-1.5 text-status-info-text hover:bg-status-info-bg-default hover:text-status-info-text-inverse transition-colors",
79
91
  children: c(C, "sandbox.exportDialog.download", "Download")
80
- })] }) : M.status === "FAILED" ? /* @__PURE__ */ _("p", {
92
+ })] }) : j.status === "FAILED" ? /* @__PURE__ */ g("p", {
81
93
  className: "text-status-danger-text",
82
94
  role: "alert",
83
- children: c(C, "sandbox.exportDialog.failed", `Export failed: ${M.errorMessage}`, { error: M.errorMessage ?? "unknown" })
84
- }) : /* @__PURE__ */ _("p", {
95
+ children: c(C, "sandbox.exportDialog.failed", `Export failed: ${j.errorMessage}`, { error: j.errorMessage ?? "unknown" })
96
+ }) : /* @__PURE__ */ g("p", {
85
97
  className: "text-status-info-text",
86
98
  children: c(C, "sandbox.exportDialog.preparing", "Preparing export…")
87
99
  })
88
- }) : /* @__PURE__ */ v("div", {
100
+ }) : /* @__PURE__ */ _("div", {
89
101
  className: "space-y-4",
90
- children: [/* @__PURE__ */ v("fieldset", { children: [/* @__PURE__ */ _("legend", {
91
- className: "text-sm font-medium text-text-primary",
92
- children: c(C, "sandbox.exportDialog.format.label", "Format")
93
- }), /* @__PURE__ */ _("div", {
94
- className: "mt-2 flex gap-4",
95
- children: ["CSV", "JSON"].map((e) => /* @__PURE__ */ v("label", {
96
- className: "inline-flex items-center gap-1.5 text-sm text-text-primary cursor-pointer",
97
- children: [/* @__PURE__ */ _("input", {
98
- type: "radio",
99
- name: "format",
100
- checked: T === e,
101
- onChange: () => E(e),
102
- "aria-label": e,
103
- className: "accent-primary"
104
- }), e]
105
- }, e))
106
- })] }), /* @__PURE__ */ v("label", {
107
- className: "flex items-center gap-2 text-sm text-text-primary cursor-pointer",
108
- children: [/* @__PURE__ */ _(t, {
109
- checked: D,
110
- onCheckedChange: (e) => O(e === !0),
111
- "aria-label": c(C, "sandbox.exportDialog.includeUsage", "Include usage events")
112
- }), /* @__PURE__ */ _("span", { children: c(C, "sandbox.exportDialog.includeUsage", "Include usage events") })]
113
- })]
102
+ children: [
103
+ /* @__PURE__ */ _("fieldset", { children: [/* @__PURE__ */ g("legend", {
104
+ className: "text-sm font-medium text-text-primary",
105
+ children: c(C, "sandbox.exportDialog.format.label", "Format")
106
+ }), /* @__PURE__ */ g("div", {
107
+ className: "mt-2 flex gap-4",
108
+ children: ["CSV", "JSON"].map((e) => /* @__PURE__ */ _("label", {
109
+ className: "inline-flex items-center gap-1.5 text-sm text-text-primary cursor-pointer",
110
+ children: [/* @__PURE__ */ g("input", {
111
+ type: "radio",
112
+ name: "format",
113
+ checked: T === e,
114
+ onChange: () => E(e),
115
+ "aria-label": e,
116
+ className: "accent-primary"
117
+ }), e]
118
+ }, e))
119
+ })] }),
120
+ N ? /* @__PURE__ */ g("p", {
121
+ className: "text-status-danger-text",
122
+ role: "alert",
123
+ children: c(C, "sandbox.exportDialog.startFailed", `Could not start the export: ${N}`, { error: N })
124
+ }) : null,
125
+ /* @__PURE__ */ _("label", {
126
+ className: "flex items-center gap-2 text-sm text-text-primary cursor-pointer",
127
+ children: [/* @__PURE__ */ g(t, {
128
+ checked: D,
129
+ onCheckedChange: (e) => O(e === !0),
130
+ "aria-label": c(C, "sandbox.exportDialog.includeUsage", "Include usage events")
131
+ }), /* @__PURE__ */ g("span", { children: c(C, "sandbox.exportDialog.includeUsage", "Include usage events") })]
132
+ })
133
+ ]
114
134
  }),
115
- /* @__PURE__ */ v(a, { children: [/* @__PURE__ */ _(e, {
135
+ /* @__PURE__ */ _(a, { children: [/* @__PURE__ */ g(e, {
116
136
  type: "button",
117
137
  variant: "outline",
118
138
  onClick: S,
119
139
  children: c(C, "sandbox.exportDialog.cancel", "Cancel")
120
- }), !M && /* @__PURE__ */ _(e, {
140
+ }), !j && /* @__PURE__ */ g(e, {
121
141
  type: "button",
122
- onClick: I,
123
- disabled: F,
142
+ onClick: L,
143
+ disabled: I,
124
144
  children: c(C, "sandbox.exportDialog.submit", "Export")
125
145
  })] })
126
146
  ]
@@ -128,6 +148,6 @@ function x({ workspaceId: f, open: x, onClose: S }) {
128
148
  });
129
149
  }
130
150
  //#endregion
131
- export { x as ExportSandboxesDialog };
151
+ export { S as ExportSandboxesDialog };
132
152
 
133
153
  //# sourceMappingURL=ExportSandboxesDialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExportSandboxesDialog.js","names":[],"sources":["../../../src/sandbox/components/ExportSandboxesDialog.tsx"],"sourcesContent":["import { useState, useRef } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useSubscription } from '@apollo/client/react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { tWithFallback } from '../utils/i18n';\nimport { useSandboxEvents } from '../utils/sandboxEvents';\nimport {\n Button,\n Checkbox,\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from './ui';\n\nconst EXPORT_MUTATION = gql`\n mutation ExportSandboxes($input: ExportSandboxesInput!) {\n exportSandboxes(input: $input) {\n id\n workspaceId\n status\n format\n downloadUrl\n expiresAt\n errorMessage\n }\n }\n`;\n\nconst EXPORT_SUBSCRIPTION = gql`\n subscription OnSandboxExportJobChanged($workspaceId: ID!, $jobId: ID!) {\n onSandboxExportJobChanged(workspaceId: $workspaceId, jobId: $jobId) {\n id\n status\n format\n rowCount\n downloadUrl\n expiresAt\n errorMessage\n }\n }\n`;\n\ntype ExportFormat = 'CSV' | 'JSON';\ntype Job = {\n id: string;\n status: 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED';\n format: ExportFormat;\n rowCount?: number | null;\n downloadUrl?: string | null;\n expiresAt?: string | null;\n errorMessage?: string | null;\n};\n\ninterface Props {\n workspaceId: string;\n open: boolean;\n onClose: () => void;\n}\n\nexport function ExportSandboxesDialog({ workspaceId, open, onClose }: Props) {\n const { t } = useI18n();\n const events = useSandboxEvents();\n const [format, setFormat] = useState<ExportFormat>('CSV');\n const [includeUsage, setIncludeUsage] = useState(false);\n // Job id is only read inside the subscription callback (not the render),\n // so keep it in a ref to avoid an unused-state re-render per status tick.\n const jobIdRef = useRef<string | null>(null);\n const [jobIdActive, setJobIdActive] = useState(false);\n const [job, setJob] = useState<Job | null>(null);\n\n const [trigger, { loading }] = useMutation<{ exportSandboxes: Job }>(EXPORT_MUTATION);\n\n useSubscription<{ onSandboxExportJobChanged: Job }>(EXPORT_SUBSCRIPTION, {\n variables: { workspaceId, jobId: jobIdRef.current! },\n skip: !jobIdActive,\n onData: ({ data }: { data: { data?: { onSandboxExportJobChanged?: Job } | null } }) => {\n const next = data.data?.onSandboxExportJobChanged;\n if (next) setJob(next);\n },\n });\n\n const start = async () => {\n const { data } = await trigger({\n variables: {\n input: { workspaceId, format, includeUsageEvents: includeUsage, context: { workspaceId } },\n },\n });\n if (data?.exportSandboxes) {\n jobIdRef.current = data.exportSandboxes.id;\n setJobIdActive(true);\n setJob(data.exportSandboxes);\n events.sandboxExportRequested({ jobId: data.exportSandboxes.id, format });\n }\n };\n\n const heading = tWithFallback(t, 'sandbox.exportDialog.title', 'Export sandboxes');\n const description = tWithFallback(\n t,\n 'sandbox.exportDialog.description',\n 'Generate a downloadable snapshot of the sandboxes matching your current filters.'\n );\n\n return (\n <Dialog\n open={open}\n onOpenChange={(next) => {\n if (!next) onClose();\n }}\n >\n <DialogContent aria-label={heading}>\n <DialogHeader>\n <DialogTitle>{heading}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n\n {job ? (\n <div className=\"space-y-3 text-sm text-text-secondary\">\n {job.status === 'COMPLETED' && job.downloadUrl ? (\n <>\n <p className=\"text-status-success-text font-medium\">\n {tWithFallback(t, 'sandbox.exportDialog.ready', 'Export ready')}\n </p>\n <a\n href={job.downloadUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center rounded-md bg-status-info-bg-subtle px-3 py-1.5 text-status-info-text hover:bg-status-info-bg-default hover:text-status-info-text-inverse transition-colors\"\n >\n {tWithFallback(t, 'sandbox.exportDialog.download', 'Download')}\n </a>\n </>\n ) : job.status === 'FAILED' ? (\n <p className=\"text-status-danger-text\" role=\"alert\">\n {tWithFallback(\n t,\n 'sandbox.exportDialog.failed',\n `Export failed: ${job.errorMessage}`,\n {\n error: job.errorMessage ?? 'unknown',\n }\n )}\n </p>\n ) : (\n <p className=\"text-status-info-text\">\n {tWithFallback(t, 'sandbox.exportDialog.preparing', 'Preparing export…')}\n </p>\n )}\n </div>\n ) : (\n <div className=\"space-y-4\">\n <fieldset>\n <legend className=\"text-sm font-medium text-text-primary\">\n {tWithFallback(t, 'sandbox.exportDialog.format.label', 'Format')}\n </legend>\n <div className=\"mt-2 flex gap-4\">\n {(['CSV', 'JSON'] as const).map((f) => (\n <label\n key={f}\n className=\"inline-flex items-center gap-1.5 text-sm text-text-primary cursor-pointer\"\n >\n <input\n type=\"radio\"\n name=\"format\"\n checked={format === f}\n onChange={() => setFormat(f)}\n aria-label={f}\n className=\"accent-primary\"\n />\n {f}\n </label>\n ))}\n </div>\n </fieldset>\n <label className=\"flex items-center gap-2 text-sm text-text-primary cursor-pointer\">\n <Checkbox\n checked={includeUsage}\n onCheckedChange={(checked: boolean | 'indeterminate') =>\n setIncludeUsage(checked === true)\n }\n aria-label={tWithFallback(\n t,\n 'sandbox.exportDialog.includeUsage',\n 'Include usage events'\n )}\n />\n <span>\n {tWithFallback(t, 'sandbox.exportDialog.includeUsage', 'Include usage events')}\n </span>\n </label>\n </div>\n )}\n\n <DialogFooter>\n <Button type=\"button\" variant=\"outline\" onClick={onClose}>\n {tWithFallback(t, 'sandbox.exportDialog.cancel', 'Cancel')}\n </Button>\n {!job && (\n <Button type=\"button\" onClick={start} disabled={loading}>\n {tWithFallback(t, 'sandbox.exportDialog.submit', 'Export')}\n </Button>\n )}\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";;;;;;;;;AAiBA,IAAM,IAAkB,CAAG;;;;;;;;;;;;GAcrB,IAAsB,CAAG;;;;;;;;;;;;;AA+B/B,SAAgB,EAAsB,EAAE,gBAAa,SAAM,cAAkB;CAC3E,IAAM,EAAE,SAAM,GAAS,EACjB,IAAS,GAAkB,EAC3B,CAAC,GAAQ,KAAa,EAAuB,MAAM,EACnD,CAAC,GAAc,KAAmB,EAAS,GAAM,EAGjD,IAAW,EAAsB,KAAK,EACtC,CAAC,GAAa,KAAkB,EAAS,GAAM,EAC/C,CAAC,GAAK,KAAU,EAAqB,KAAK,EAE1C,CAAC,GAAS,EAAE,gBAAa,EAAsC,EAAgB;AAErF,GAAoD,GAAqB;EACvE,WAAW;GAAE;GAAa,OAAO,EAAS;GAAU;EACpD,MAAM,CAAC;EACP,SAAS,EAAE,cAA4E;GACrF,IAAM,IAAO,EAAK,MAAM;AACxB,GAAI,KAAM,EAAO,EAAK;;EAEzB,CAAC;CAEF,IAAM,IAAQ,YAAY;EACxB,IAAM,EAAE,YAAS,MAAM,EAAQ,EAC7B,WAAW,EACT,OAAO;GAAE;GAAa;GAAQ,oBAAoB;GAAc,SAAS,EAAE,gBAAa;GAAE,EAC3F,EACF,CAAC;AAC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,CAAW,KAAK,MAC/B,kBAAC,SAAD;OAEE,WAAU;iBAFZ,CAIE,kBAAC,SAAD;QACE,MAAK;QACL,MAAK;QACL,SAAS,MAAW;QACpB,gBAAgB,EAAU,EAAE;QAC5B,cAAY;QACZ,WAAU;QACV,CAAA,EACD,EACK;SAZD,EAYC,CACR;MACE,CAAA,CACG,EAAA,CAAA,EACX,kBAAC,SAAD;MAAO,WAAU;gBAAjB,CACE,kBAAC,GAAD;OACE,SAAS;OACT,kBAAkB,MAChB,EAAgB,MAAY,GAAK;OAEnC,cAAY,EACV,GACA,qCACA,uBACD;OACD,CAAA,EACF,kBAAC,QAAD,EAAA,UACG,EAAc,GAAG,qCAAqC,uBAAuB,EACzE,CAAA,CACD;QACJ;;IAGR,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD;KAAQ,MAAK;KAAS,SAAQ;KAAU,SAAS;eAC9C,EAAc,GAAG,+BAA+B,SAAS;KACnD,CAAA,EACR,CAAC,KACA,kBAAC,GAAD;KAAQ,MAAK;KAAS,SAAS;KAAO,UAAU;eAC7C,EAAc,GAAG,+BAA+B,SAAS;KACnD,CAAA,CAEE,EAAA,CAAA;IACD;;EACT,CAAA"}
1
+ {"version":3,"file":"ExportSandboxesDialog.js","names":[],"sources":["../../../src/sandbox/components/ExportSandboxesDialog.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useSubscription } from '@apollo/client/react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { tWithFallback } from '../utils/i18n';\nimport { useSandboxEvents } from '../utils/sandboxEvents';\nimport {\n Button,\n Checkbox,\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from './ui';\n\n/**\n * The sandbox export is delegated to wspace-export-svc (BOFF-5318): the\n * dialog drives the canonical `createExportJob` mutation and tracks it with\n * the export service's `exportJobProgress` subscription. `sandbox_environments`\n * is the entity config the export service pages over the sandbox data with;\n * the usage-events checkbox adds `sandbox_usage_events`.\n */\nconst EXPORT_MUTATION = gql`\n mutation ExportSandboxes($context: ContextInput, $input: CreateExportJobInput!) {\n createExportJob(context: $context, input: $input) {\n id\n status\n format\n downloadUrl\n errorMessage\n }\n }\n`;\n\nconst EXPORT_SUBSCRIPTION = gql`\n subscription OnExportJobProgress($jobId: ID!) {\n exportJobProgress(jobId: $jobId) {\n id\n status\n format\n downloadUrl\n errorMessage\n }\n }\n`;\n\ntype ExportFormat = 'CSV' | 'JSON';\n\n/**\n * The export service's job status, projected onto what the dialog can render.\n * `COMPLETED` is ready (real presigned download URL); `FAILED` and the\n * terminal non-success states are failures; everything else is still running.\n */\ntype Job = {\n id: string;\n status: 'PENDING' | 'READY' | 'FAILED';\n format: ExportFormat;\n downloadUrl?: string | null;\n errorMessage?: string | null;\n};\n\nfunction projectStatus(status: string): Job['status'] {\n if (status === 'COMPLETED') return 'READY';\n if (status === 'FAILED' || status === 'CANCELLED' || status === 'EXPIRED' || status === 'DELETED')\n return 'FAILED';\n return 'PENDING';\n}\n\ntype RawJob = {\n id: string;\n status: string;\n format: string;\n downloadUrl?: string | null;\n errorMessage?: string | null;\n};\n\nfunction toJob(raw: RawJob): Job {\n return {\n id: raw.id,\n status: projectStatus(raw.status),\n format: raw.format === 'CSV' ? 'CSV' : 'JSON',\n downloadUrl: raw.downloadUrl,\n errorMessage: raw.errorMessage,\n };\n}\n\ninterface Props {\n workspaceId: string;\n open: boolean;\n onClose: () => void;\n}\n\nexport function ExportSandboxesDialog({ workspaceId, open, onClose }: Props) {\n const { t } = useI18n();\n const events = useSandboxEvents();\n const [format, setFormat] = useState<ExportFormat>('CSV');\n const [includeUsage, setIncludeUsage] = useState(false);\n const [jobId, setJobId] = useState<string | null>(null);\n const [job, setJob] = useState<Job | null>(null);\n const [startError, setStartError] = useState<string | null>(null);\n\n const [trigger, { loading }] = useMutation<\n { createExportJob: RawJob },\n { context: object; input: object }\n >(EXPORT_MUTATION);\n\n useSubscription<{ exportJobProgress: RawJob }>(EXPORT_SUBSCRIPTION, {\n variables: { jobId: jobId ?? '' },\n skip: jobId === null,\n onData: ({ data }: { data: { data?: { exportJobProgress?: RawJob } | null } }) => {\n const next = data.data?.exportJobProgress;\n if (next) setJob(toJob(next));\n },\n });\n\n const start = async () => {\n setStartError(null);\n try {\n const { data } = await trigger({\n variables: {\n context: { workspaceId },\n input: {\n name: `sandbox-export-${Date.now()}`,\n entityTypes: includeUsage\n ? ['sandbox_environments', 'sandbox_usage_events']\n : ['sandbox_environments'],\n format,\n },\n },\n });\n if (data?.createExportJob) {\n setJobId(data.createExportJob.id);\n setJob(toJob(data.createExportJob));\n events.sandboxExportRequested({ jobId: data.createExportJob.id, format });\n }\n } catch (err) {\n // The mutation can fail quota gates or auth without Apollo surfacing it\n // — show the failure in the dialog instead of leaving a dead button.\n setStartError(err instanceof Error ? err.message : 'unknown');\n }\n };\n\n const heading = tWithFallback(t, 'sandbox.exportDialog.title', 'Export sandboxes');\n const description = tWithFallback(\n t,\n 'sandbox.exportDialog.description',\n 'Generate a downloadable snapshot of the sandboxes matching your current filters.'\n );\n\n return (\n <Dialog\n open={open}\n onOpenChange={(next) => {\n if (!next) onClose();\n }}\n >\n <DialogContent aria-label={heading}>\n <DialogHeader>\n <DialogTitle>{heading}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n\n {job ? (\n <div className=\"space-y-3 text-sm text-text-secondary\">\n {job.status === 'READY' && job.downloadUrl ? (\n <>\n <p className=\"text-status-success-text font-medium\">\n {tWithFallback(t, 'sandbox.exportDialog.ready', 'Export ready')}\n </p>\n <a\n href={job.downloadUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center rounded-md bg-status-info-bg-subtle px-3 py-1.5 text-status-info-text hover:bg-status-info-bg-default hover:text-status-info-text-inverse transition-colors\"\n >\n {tWithFallback(t, 'sandbox.exportDialog.download', 'Download')}\n </a>\n </>\n ) : job.status === 'FAILED' ? (\n <p className=\"text-status-danger-text\" role=\"alert\">\n {tWithFallback(\n t,\n 'sandbox.exportDialog.failed',\n `Export failed: ${job.errorMessage}`,\n {\n error: job.errorMessage ?? 'unknown',\n }\n )}\n </p>\n ) : (\n <p className=\"text-status-info-text\">\n {tWithFallback(t, 'sandbox.exportDialog.preparing', 'Preparing export…')}\n </p>\n )}\n </div>\n ) : (\n <div className=\"space-y-4\">\n <fieldset>\n <legend className=\"text-sm font-medium text-text-primary\">\n {tWithFallback(t, 'sandbox.exportDialog.format.label', 'Format')}\n </legend>\n <div className=\"mt-2 flex gap-4\">\n {(['CSV', 'JSON'] as const).map((f) => (\n <label\n key={f}\n className=\"inline-flex items-center gap-1.5 text-sm text-text-primary cursor-pointer\"\n >\n <input\n type=\"radio\"\n name=\"format\"\n checked={format === f}\n onChange={() => setFormat(f)}\n aria-label={f}\n className=\"accent-primary\"\n />\n {f}\n </label>\n ))}\n </div>\n </fieldset>\n {startError ? (\n <p className=\"text-status-danger-text\" role=\"alert\">\n {tWithFallback(\n t,\n 'sandbox.exportDialog.startFailed',\n `Could not start the export: ${startError}`,\n { error: startError }\n )}\n </p>\n ) : null}\n <label className=\"flex items-center gap-2 text-sm text-text-primary cursor-pointer\">\n <Checkbox\n checked={includeUsage}\n onCheckedChange={(checked: boolean | 'indeterminate') =>\n setIncludeUsage(checked === true)\n }\n aria-label={tWithFallback(\n t,\n 'sandbox.exportDialog.includeUsage',\n 'Include usage events'\n )}\n />\n <span>\n {tWithFallback(t, 'sandbox.exportDialog.includeUsage', 'Include usage events')}\n </span>\n </label>\n </div>\n )}\n\n <DialogFooter>\n <Button type=\"button\" variant=\"outline\" onClick={onClose}>\n {tWithFallback(t, 'sandbox.exportDialog.cancel', 'Cancel')}\n </Button>\n {!job && (\n <Button type=\"button\" onClick={start} disabled={loading}>\n {tWithFallback(t, 'sandbox.exportDialog.submit', 'Export')}\n </Button>\n )}\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";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D;QAEE,WAAU;kBAFZ,CAIE,kBAAC,SAAD;SACE,MAAK;SACL,MAAK;SACL,SAAS,MAAW;SACpB,gBAAgB,EAAU,EAAE;SAC5B,cAAY;SACZ,WAAU;SACV,CAAA,EACD,EACK;UAZD,EAYC,CACR;OACE,CAAA,CACG,EAAA,CAAA;MACV,IACC,kBAAC,KAAD;OAAG,WAAU;OAA0B,MAAK;iBACzC,EACC,GACA,oCACA,+BAA+B,KAC/B,EAAE,OAAO,GAAY,CACtB;OACC,CAAA,GACF;MACJ,kBAAC,SAAD;OAAO,WAAU;iBAAjB,CACE,kBAAC,GAAD;QACE,SAAS;QACT,kBAAkB,MAChB,EAAgB,MAAY,GAAK;QAEnC,cAAY,EACV,GACA,qCACA,uBACD;QACD,CAAA,EACF,kBAAC,QAAD,EAAA,UACG,EAAc,GAAG,qCAAqC,uBAAuB,EACzE,CAAA,CACD;;MACJ;;IAGR,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD;KAAQ,MAAK;KAAS,SAAQ;KAAU,SAAS;eAC9C,EAAc,GAAG,+BAA+B,SAAS;KACnD,CAAA,EACR,CAAC,KACA,kBAAC,GAAD;KAAQ,MAAK;KAAS,SAAS;KAAO,UAAU;eAC7C,EAAc,GAAG,+BAA+B,SAAS;KACnD,CAAA,CAEE,EAAA,CAAA;IACD;;EACT,CAAA"}
@@ -2,6 +2,6 @@
2
2
  * UI Component re-exports from @burdenoff/fe-libs
3
3
  * All styled components are imported from the shared fe-libs package
4
4
  */
5
- export { Button, Badge, Card, CardContent, Checkbox, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, Input, Skeleton, Separator, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Switch, Tabs, TabsList, TabsTrigger, TabsContent, GlassCard, EmphasisPanel, ShowMore, CTAOverflowMenu, } from '@burdenoff/fe-libs/ui';
5
+ export { Button, Badge, Card, CardContent, Checkbox, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, Input, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, Skeleton, Separator, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Switch, Tabs, TabsList, TabsTrigger, TabsContent, GlassCard, EmphasisPanel, ShowMore, CTAOverflowMenu, } from '@burdenoff/fe-libs/ui';
6
6
  export type { CTAAction, CTAPrimaryAction } from '@burdenoff/fe-libs/ui';
7
7
  //# sourceMappingURL=ui.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../src/sandbox/components/ui.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,MAAM,EACN,KAAK,EACL,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,MAAM,EACN,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,KAAK,EACL,QAAQ,EACR,SAAS,EACT,MAAM,EACN,aAAa,EACb,UAAU,EACV,aAAa,EACb,WAAW,EACX,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,WAAW,EAEX,SAAS,EACT,aAAa,EACb,QAAQ,EACR,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../src/sandbox/components/ui.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,MAAM,EACN,KAAK,EACL,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,MAAM,EACN,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,KAAK,EACL,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,MAAM,EACN,aAAa,EACb,UAAU,EACV,aAAa,EACb,WAAW,EACX,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,WAAW,EAEX,SAAS,EACT,aAAa,EACb,QAAQ,EACR,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1,2 +1,2 @@
1
- import { Badge as e, Button as t, CTAOverflowMenu as n, Card as r, CardContent as i, Checkbox as a, Dialog as o, DialogContent as s, DialogDescription as c, DialogFooter as l, DialogHeader as u, DialogTitle as d, EmphasisPanel as f, GlassCard as p, Input as m, Select as h, SelectContent as g, SelectItem as _, SelectTrigger as v, SelectValue as y, ShowMore as b, Skeleton as x } from "@burdenoff/fe-libs/ui";
2
- export { e as Badge, t as Button, n as CTAOverflowMenu, r as Card, i as CardContent, a as Checkbox, o as Dialog, s as DialogContent, c as DialogDescription, l as DialogFooter, u as DialogHeader, d as DialogTitle, f as EmphasisPanel, p as GlassCard, m as Input, h as Select, g as SelectContent, _ as SelectItem, v as SelectTrigger, y as SelectValue, b as ShowMore, x as Skeleton };
1
+ import { AlertDialog as e, AlertDialogAction as t, AlertDialogCancel as n, AlertDialogContent as r, AlertDialogDescription as i, AlertDialogFooter as a, AlertDialogHeader as o, AlertDialogTitle as s, Badge as c, Button as l, CTAOverflowMenu as u, Card as d, CardContent as f, Checkbox as p, Dialog as m, DialogContent as h, DialogDescription as g, DialogFooter as _, DialogHeader as v, DialogTitle as y, EmphasisPanel as b, GlassCard as x, Input as S, Select as C, SelectContent as w, SelectItem as T, SelectTrigger as E, SelectValue as D, ShowMore as O, Skeleton as k } from "@burdenoff/fe-libs/ui";
2
+ export { e as AlertDialog, t as AlertDialogAction, n as AlertDialogCancel, r as AlertDialogContent, i as AlertDialogDescription, a as AlertDialogFooter, o as AlertDialogHeader, s as AlertDialogTitle, c as Badge, l as Button, u as CTAOverflowMenu, d as Card, f as CardContent, p as Checkbox, m as Dialog, h as DialogContent, g as DialogDescription, _ as DialogFooter, v as DialogHeader, y as DialogTitle, b as EmphasisPanel, x as GlassCard, S as Input, C as Select, w as SelectContent, T as SelectItem, E as SelectTrigger, D as SelectValue, O as ShowMore, k as Skeleton };
@@ -1 +1 @@
1
- {"version":3,"file":"SandboxCreatePage.d.ts","sourceRoot":"","sources":["../../../src/sandbox/pages/SandboxCreatePage.tsx"],"names":[],"mappings":"AAqKA,wBAAgB,iBAAiB,gCA0iDhC"}
1
+ {"version":3,"file":"SandboxCreatePage.d.ts","sourceRoot":"","sources":["../../../src/sandbox/pages/SandboxCreatePage.tsx"],"names":[],"mappings":"AAoLA,wBAAgB,iBAAiB,gCA2kDhC"}