@burdenoff/microfe-sandbox 2026.525.2 → 2026.527.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 (133) hide show
  1. package/dist/sandbox/components/CountdownTimer.js +39 -47
  2. package/dist/sandbox/components/CountdownTimer.js.map +1 -1
  3. package/dist/sandbox/components/ExportSandboxesDialog.js +62 -60
  4. package/dist/sandbox/components/ExportSandboxesDialog.js.map +1 -1
  5. package/dist/sandbox/components/ExtendTTLModal.js +8 -2
  6. package/dist/sandbox/components/ExtendTTLModal.js.map +1 -1
  7. package/dist/sandbox/components/FilesFolderPicker.js +53 -53
  8. package/dist/sandbox/components/FilesFolderPicker.js.map +1 -1
  9. package/dist/sandbox/components/RouteUtils.js +3 -3
  10. package/dist/sandbox/components/RouteUtils.js.map +1 -1
  11. package/dist/sandbox/components/SandboxActivityTab.js +0 -2
  12. package/dist/sandbox/components/SandboxActivityTab.js.map +1 -1
  13. package/dist/sandbox/components/SandboxUsageBanner.js +1 -2
  14. package/dist/sandbox/components/SandboxUsageBanner.js.map +1 -1
  15. package/dist/sandbox/components/StatusBadge.js +1 -2
  16. package/dist/sandbox/components/StatusBadge.js.map +1 -1
  17. package/dist/sandbox/components/TagsInput.js +2 -2
  18. package/dist/sandbox/components/TagsInput.js.map +1 -1
  19. package/dist/sandbox/pages/AdminPage.js +82 -78
  20. package/dist/sandbox/pages/AdminPage.js.map +1 -1
  21. package/dist/sandbox/pages/AdminTemplatesPage.js +1 -1
  22. package/dist/sandbox/pages/AdminTemplatesPage.js.map +1 -1
  23. package/dist/sandbox/pages/SandboxCreatePage.js +294 -249
  24. package/dist/sandbox/pages/SandboxCreatePage.js.map +1 -1
  25. package/dist/sandbox/pages/SandboxDetailPage.js +374 -339
  26. package/dist/sandbox/pages/SandboxDetailPage.js.map +1 -1
  27. package/dist/sandbox/pages/SandboxListPage.js +2 -1
  28. package/dist/sandbox/pages/SandboxListPage.js.map +1 -1
  29. package/dist/sandbox/pages/TemplateDetailPage.js +199 -150
  30. package/dist/sandbox/pages/TemplateDetailPage.js.map +1 -1
  31. package/dist/sandbox/pages/UserTemplatesPage.js +1 -1
  32. package/dist/sandbox/pages/UserTemplatesPage.js.map +1 -1
  33. package/dist/sandbox/providers/SandboxProvider.js +1 -1
  34. package/dist/sandbox/providers/SandboxProvider.js.map +1 -1
  35. package/package.json +1 -1
  36. package/dist/dev/main.d.ts +0 -2
  37. package/dist/dev/main.d.ts.map +0 -1
  38. package/dist/generated/global-operations.d.ts +0 -2
  39. package/dist/generated/global-operations.d.ts.map +0 -1
  40. package/dist/generated/global-types.d.ts +0 -23527
  41. package/dist/generated/global-types.d.ts.map +0 -1
  42. package/dist/generated/wspace-operations.d.ts +0 -1679
  43. package/dist/generated/wspace-operations.d.ts.map +0 -1
  44. package/dist/generated/wspace-types.d.ts +0 -57853
  45. package/dist/generated/wspace-types.d.ts.map +0 -1
  46. package/dist/index.d.ts +0 -6
  47. package/dist/index.d.ts.map +0 -1
  48. package/dist/sandbox/AdminRoutes.d.ts +0 -12
  49. package/dist/sandbox/AdminRoutes.d.ts.map +0 -1
  50. package/dist/sandbox/SandboxAdminRoot.d.ts +0 -21
  51. package/dist/sandbox/SandboxAdminRoot.d.ts.map +0 -1
  52. package/dist/sandbox/SandboxRoot.d.ts +0 -31
  53. package/dist/sandbox/SandboxRoot.d.ts.map +0 -1
  54. package/dist/sandbox/SandboxRoutes.d.ts +0 -18
  55. package/dist/sandbox/SandboxRoutes.d.ts.map +0 -1
  56. package/dist/sandbox/UserRoutes.d.ts +0 -11
  57. package/dist/sandbox/UserRoutes.d.ts.map +0 -1
  58. package/dist/sandbox/components/ContainerImagePicker.d.ts +0 -24
  59. package/dist/sandbox/components/ContainerImagePicker.d.ts.map +0 -1
  60. package/dist/sandbox/components/CountdownTimer.d.ts +0 -9
  61. package/dist/sandbox/components/CountdownTimer.d.ts.map +0 -1
  62. package/dist/sandbox/components/ExportSandboxesDialog.d.ts +0 -8
  63. package/dist/sandbox/components/ExportSandboxesDialog.d.ts.map +0 -1
  64. package/dist/sandbox/components/ExtendTTLModal.d.ts +0 -10
  65. package/dist/sandbox/components/ExtendTTLModal.d.ts.map +0 -1
  66. package/dist/sandbox/components/FilesFolderPicker.d.ts +0 -22
  67. package/dist/sandbox/components/FilesFolderPicker.d.ts.map +0 -1
  68. package/dist/sandbox/components/PageLayout.d.ts +0 -39
  69. package/dist/sandbox/components/PageLayout.d.ts.map +0 -1
  70. package/dist/sandbox/components/ResourceDisplay.d.ts +0 -17
  71. package/dist/sandbox/components/ResourceDisplay.d.ts.map +0 -1
  72. package/dist/sandbox/components/RouteUtils.d.ts +0 -28
  73. package/dist/sandbox/components/RouteUtils.d.ts.map +0 -1
  74. package/dist/sandbox/components/SandboxActivityTab.d.ts +0 -14
  75. package/dist/sandbox/components/SandboxActivityTab.d.ts.map +0 -1
  76. package/dist/sandbox/components/SandboxAgentAppPanel.d.ts +0 -16
  77. package/dist/sandbox/components/SandboxAgentAppPanel.d.ts.map +0 -1
  78. package/dist/sandbox/components/SandboxTypeIcon.d.ts +0 -15
  79. package/dist/sandbox/components/SandboxTypeIcon.d.ts.map +0 -1
  80. package/dist/sandbox/components/SandboxTypeSelector.d.ts +0 -35
  81. package/dist/sandbox/components/SandboxTypeSelector.d.ts.map +0 -1
  82. package/dist/sandbox/components/SandboxUsageBanner.d.ts +0 -16
  83. package/dist/sandbox/components/SandboxUsageBanner.d.ts.map +0 -1
  84. package/dist/sandbox/components/StatusBadge.d.ts +0 -15
  85. package/dist/sandbox/components/StatusBadge.d.ts.map +0 -1
  86. package/dist/sandbox/components/TagsInput.d.ts +0 -14
  87. package/dist/sandbox/components/TagsInput.d.ts.map +0 -1
  88. package/dist/sandbox/components/ui.d.ts +0 -6
  89. package/dist/sandbox/components/ui.d.ts.map +0 -1
  90. package/dist/sandbox/hooks/useRemainingSeconds.d.ts +0 -12
  91. package/dist/sandbox/hooks/useRemainingSeconds.d.ts.map +0 -1
  92. package/dist/sandbox/index.d.ts +0 -30
  93. package/dist/sandbox/index.d.ts.map +0 -1
  94. package/dist/sandbox/pages/AdminLandingPage.d.ts +0 -9
  95. package/dist/sandbox/pages/AdminLandingPage.d.ts.map +0 -1
  96. package/dist/sandbox/pages/AdminPage.d.ts +0 -2
  97. package/dist/sandbox/pages/AdminPage.d.ts.map +0 -1
  98. package/dist/sandbox/pages/AdminTemplatesPage.d.ts +0 -7
  99. package/dist/sandbox/pages/AdminTemplatesPage.d.ts.map +0 -1
  100. package/dist/sandbox/pages/SandboxCreatePage.d.ts +0 -2
  101. package/dist/sandbox/pages/SandboxCreatePage.d.ts.map +0 -1
  102. package/dist/sandbox/pages/SandboxDetailPage.d.ts +0 -6
  103. package/dist/sandbox/pages/SandboxDetailPage.d.ts.map +0 -1
  104. package/dist/sandbox/pages/SandboxLandingPage.d.ts +0 -12
  105. package/dist/sandbox/pages/SandboxLandingPage.d.ts.map +0 -1
  106. package/dist/sandbox/pages/SandboxListPage.d.ts +0 -6
  107. package/dist/sandbox/pages/SandboxListPage.d.ts.map +0 -1
  108. package/dist/sandbox/pages/TemplateDetailPage.d.ts +0 -6
  109. package/dist/sandbox/pages/TemplateDetailPage.d.ts.map +0 -1
  110. package/dist/sandbox/pages/TemplatesPage.d.ts +0 -8
  111. package/dist/sandbox/pages/TemplatesPage.d.ts.map +0 -1
  112. package/dist/sandbox/pages/UserLandingPage.d.ts +0 -9
  113. package/dist/sandbox/pages/UserLandingPage.d.ts.map +0 -1
  114. package/dist/sandbox/pages/UserTemplatesPage.d.ts +0 -8
  115. package/dist/sandbox/pages/UserTemplatesPage.d.ts.map +0 -1
  116. package/dist/sandbox/providers/SandboxProvider.d.ts +0 -13
  117. package/dist/sandbox/providers/SandboxProvider.d.ts.map +0 -1
  118. package/dist/sandbox/store/sandboxStore.d.ts +0 -16
  119. package/dist/sandbox/store/sandboxStore.d.ts.map +0 -1
  120. package/dist/sandbox/types/index.d.ts +0 -238
  121. package/dist/sandbox/types/index.d.ts.map +0 -1
  122. package/dist/sandbox/utils/cn.d.ts +0 -8
  123. package/dist/sandbox/utils/cn.d.ts.map +0 -1
  124. package/dist/sandbox/utils/formatters.d.ts +0 -7
  125. package/dist/sandbox/utils/formatters.d.ts.map +0 -1
  126. package/dist/sandbox/utils/i18n.d.ts +0 -6
  127. package/dist/sandbox/utils/i18n.d.ts.map +0 -1
  128. package/dist/sandbox/utils/navigation.d.ts +0 -5
  129. package/dist/sandbox/utils/navigation.d.ts.map +0 -1
  130. package/dist/sandbox/utils/sandboxEvents.d.ts +0 -13
  131. package/dist/sandbox/utils/sandboxEvents.d.ts.map +0 -1
  132. package/dist/utils/nativeBridge.d.ts +0 -3
  133. package/dist/utils/nativeBridge.d.ts.map +0 -1
@@ -1,75 +1,67 @@
1
1
  import { tWithFallback as e } from "../utils/i18n.js";
2
2
  import { useRemainingSeconds as t } from "../hooks/useRemainingSeconds.js";
3
- import { useEffect as n, useState as r } from "react";
4
- import { AlertTriangle as i, Plus as a, Timer as o } from "lucide-react";
5
- import { useI18n as s } from "@burdenoff/fe-libs/shared/providers/shell";
6
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
3
+ import { useRef as n } from "react";
4
+ import { AlertTriangle as r, Plus as i, Timer as a } from "lucide-react";
5
+ import { useI18n as o } from "@burdenoff/fe-libs/shared/providers/shell";
6
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
7
  //#region src/sandbox/components/CountdownTimer.tsx
8
- function u({ expiresAt: u, onExpired: d, onExtend: f, compact: p = !1 }) {
9
- let m = t(u, d), [h, g] = r(!1), { t: _ } = s();
10
- n(() => {
11
- m <= 60 && m > 0 && !h && (g(!0), "Notification" in window && Notification.permission === "granted" && new Notification(e(_, "sandbox.timer.alertTitle", "Sandbox expiring"), {
12
- body: e(_, "sandbox.timer.alertBody", "Your sandbox will be destroyed in less than 1 minute. Extend it to continue working."),
13
- icon: "/favicon.ico"
14
- }));
15
- }, [
16
- m,
17
- h,
18
- _
19
- ]), n(() => {
20
- g(!1);
21
- }, [u]);
22
- let v = Math.floor(m / 3600), y = Math.floor(m % 3600 / 60), b = m % 60, x = (e) => String(e).padStart(2, "0"), S = v > 0 ? `${x(v)}:${x(y)}:${x(b)}` : `${x(y)}:${x(b)}`, C = m <= 0 ? "text-text-secondary" : m <= 30 ? "text-status-error-text animate-pulse" : m <= 60 ? "text-status-error-text" : m <= 300 ? "text-status-warning-text" : "text-status-success-text", w = m <= 0 ? "bg-bg-sunken border-border-subtle" : m <= 60 ? "bg-status-error-bg-subtle border-border-default" : m <= 300 ? "bg-status-warning-bg-subtle border-border-default" : "bg-status-success-bg-subtle border-border-default", T = Math.max(1, Math.ceil(m / 60)), E = m <= 0 ? e(_, "sandbox.timer.expired", "Expired") : e(_, "sandbox.timer.remaining", `${T} minutes remaining`, { count: T });
23
- return p ? /* @__PURE__ */ l("span", {
8
+ function l({ expiresAt: l, onExpired: u, onExtend: d, compact: f = !1 }) {
9
+ let p = t(l, u), { t: m } = o(), h = n(null);
10
+ h.current !== l && p <= 60 && p > 0 && typeof window < "u" && "Notification" in window && Notification.permission === "granted" && (h.current = l, new Notification(e(m, "sandbox.timer.alertTitle", "Sandbox expiring"), {
11
+ body: e(m, "sandbox.timer.alertBody", "Your sandbox will be destroyed in less than 1 minute. Extend it to continue working."),
12
+ icon: "/favicon.ico"
13
+ }));
14
+ let g = Math.floor(p / 3600), _ = Math.floor(p % 3600 / 60), v = p % 60, y = (e) => String(e).padStart(2, "0"), b = g > 0 ? `${y(g)}:${y(_)}:${y(v)}` : `${y(_)}:${y(v)}`, x = p <= 0 ? "text-text-secondary" : p <= 30 ? "text-status-error-text animate-pulse" : p <= 60 ? "text-status-error-text" : p <= 300 ? "text-status-warning-text" : "text-status-success-text", S = p <= 0 ? "bg-bg-sunken border-border-subtle" : p <= 60 ? "bg-status-error-bg-subtle border-border-default" : p <= 300 ? "bg-status-warning-bg-subtle border-border-default" : "bg-status-success-bg-subtle border-border-default", C = Math.max(1, Math.ceil(p / 60)), w = p <= 0 ? e(m, "sandbox.timer.expired", "Expired") : e(m, "sandbox.timer.remaining", `${C} minutes remaining`, { count: C });
15
+ return f ? /* @__PURE__ */ c("span", {
24
16
  role: "timer",
25
17
  "aria-live": "polite",
26
- "aria-label": E,
27
- className: `inline-flex items-center gap-1 text-sm font-mono ${C}`,
28
- children: [/* @__PURE__ */ c(o, {
18
+ "aria-label": w,
19
+ className: `inline-flex items-center gap-1 text-sm font-mono ${x}`,
20
+ children: [/* @__PURE__ */ s(a, {
29
21
  "aria-hidden": "true",
30
- className: "h-3.5 w-3.5"
31
- }), S]
32
- }) : /* @__PURE__ */ l("div", {
22
+ className: "size-3.5"
23
+ }), b]
24
+ }) : /* @__PURE__ */ c("div", {
33
25
  role: "timer",
34
26
  "aria-live": "polite",
35
- "aria-label": E,
36
- className: `flex items-center gap-3 rounded-lg border px-4 py-2 ${w}`,
27
+ "aria-label": w,
28
+ className: `flex items-center gap-3 rounded-lg border px-4 py-2 ${S}`,
37
29
  children: [
38
- /* @__PURE__ */ c(o, {
30
+ /* @__PURE__ */ s(a, {
39
31
  "aria-hidden": "true",
40
- className: `h-5 w-5 ${C}`
32
+ className: `size-5 ${x}`
41
33
  }),
42
- /* @__PURE__ */ l("div", {
34
+ /* @__PURE__ */ c("div", {
43
35
  className: "flex flex-col",
44
- children: [/* @__PURE__ */ c("span", {
45
- className: `text-lg font-mono font-semibold ${C}`,
46
- children: S
47
- }), /* @__PURE__ */ c("span", {
36
+ children: [/* @__PURE__ */ s("span", {
37
+ className: `text-lg font-mono font-semibold ${x}`,
38
+ children: b
39
+ }), /* @__PURE__ */ s("span", {
48
40
  className: "text-xs text-text-secondary",
49
- children: m <= 0 ? e(_, "sandbox.timer.expired", "Expired") : e(_, "sandbox.timer.label", "Time remaining")
41
+ children: p <= 0 ? e(m, "sandbox.timer.expired", "Expired") : e(m, "sandbox.timer.label", "Time remaining")
50
42
  })]
51
43
  }),
52
- m <= 60 && m > 0 && /* @__PURE__ */ l("div", {
44
+ p <= 60 && p > 0 && /* @__PURE__ */ c("div", {
53
45
  className: "flex items-center gap-1 text-xs text-status-error-text font-medium",
54
- children: [/* @__PURE__ */ c(i, {
46
+ children: [/* @__PURE__ */ s(r, {
55
47
  "aria-hidden": "true",
56
- className: "h-3.5 w-3.5"
57
- }), e(_, "sandbox.timer.expiringSoon", "Expiring soon")]
48
+ className: "size-3.5"
49
+ }), e(m, "sandbox.timer.expiringSoon", "Expiring soon")]
58
50
  }),
59
- f && m > 0 && /* @__PURE__ */ l("button", {
51
+ d && p > 0 && /* @__PURE__ */ c("button", {
60
52
  type: "button",
61
- onClick: f,
62
- "aria-label": e(_, "sandbox.timer.extend", "Extend sandbox duration"),
53
+ onClick: d,
54
+ "aria-label": e(m, "sandbox.timer.extend", "Extend sandbox duration"),
63
55
  className: "ml-auto flex items-center gap-1 rounded-md bg-bg-surface px-3 py-1.5 text-sm font-medium text-text-secondary shadow-sm border border-border-subtle hover:bg-bg-sunken transition-colors",
64
- children: [/* @__PURE__ */ c(a, {
56
+ children: [/* @__PURE__ */ s(i, {
65
57
  "aria-hidden": "true",
66
- className: "h-3.5 w-3.5"
67
- }), e(_, "sandbox.timer.extend", "Extend")]
58
+ className: "size-3.5"
59
+ }), e(m, "sandbox.timer.extend", "Extend")]
68
60
  })
69
61
  ]
70
62
  });
71
63
  }
72
64
  //#endregion
73
- export { u as CountdownTimer };
65
+ export { l as CountdownTimer };
74
66
 
75
67
  //# sourceMappingURL=CountdownTimer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CountdownTimer.js","names":[],"sources":["../../../src/sandbox/components/CountdownTimer.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { Timer, Plus, AlertTriangle } from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { tWithFallback } from '../utils/i18n';\nimport { useRemainingSeconds } from '../hooks/useRemainingSeconds';\n\ninterface CountdownTimerProps {\n expiresAt: string;\n onExpired?: () => void;\n onExtend?: () => void;\n compact?: boolean;\n}\n\nexport function CountdownTimer({\n expiresAt,\n onExpired,\n onExtend,\n compact = false,\n}: CountdownTimerProps) {\n const remainingSeconds = useRemainingSeconds(expiresAt, onExpired);\n const [alertShown, setAlertShown] = useState(false);\n const { t } = useI18n();\n\n // Browser notification at 60 seconds remaining, once per expiresAt window.\n useEffect(() => {\n if (remainingSeconds <= 60 && remainingSeconds > 0 && !alertShown) {\n setAlertShown(true);\n if ('Notification' in window && Notification.permission === 'granted') {\n new Notification(tWithFallback(t, 'sandbox.timer.alertTitle', 'Sandbox expiring'), {\n body: tWithFallback(\n t,\n 'sandbox.timer.alertBody',\n 'Your sandbox will be destroyed in less than 1 minute. Extend it to continue working.'\n ),\n icon: '/favicon.ico',\n });\n }\n }\n }, [remainingSeconds, alertShown, t]);\n\n // Reset alert window when the parent gives us a new expiresAt (TTL extended).\n useEffect(() => {\n setAlertShown(false);\n }, [expiresAt]);\n\n const hours = Math.floor(remainingSeconds / 3600);\n const minutes = Math.floor((remainingSeconds % 3600) / 60);\n const seconds = remainingSeconds % 60;\n const fmt = (n: number) => String(n).padStart(2, '0');\n const timeString =\n hours > 0 ? `${fmt(hours)}:${fmt(minutes)}:${fmt(seconds)}` : `${fmt(minutes)}:${fmt(seconds)}`;\n\n const color = (() => {\n if (remainingSeconds <= 0) return 'text-text-secondary';\n if (remainingSeconds <= 30) return 'text-status-error-text animate-pulse';\n if (remainingSeconds <= 60) return 'text-status-error-text';\n if (remainingSeconds <= 300) return 'text-status-warning-text';\n return 'text-status-success-text';\n })();\n\n const bg = (() => {\n if (remainingSeconds <= 0) return 'bg-bg-sunken border-border-subtle';\n if (remainingSeconds <= 60) return 'bg-status-error-bg-subtle border-border-default';\n if (remainingSeconds <= 300) return 'bg-status-warning-bg-subtle border-border-default';\n return 'bg-status-success-bg-subtle border-border-default';\n })();\n\n const remainingMinutes = Math.max(1, Math.ceil(remainingSeconds / 60));\n const accessibleLabel =\n remainingSeconds <= 0\n ? tWithFallback(t, 'sandbox.timer.expired', 'Expired')\n : tWithFallback(t, 'sandbox.timer.remaining', `${remainingMinutes} minutes remaining`, {\n count: remainingMinutes,\n });\n\n if (compact) {\n return (\n <span\n role=\"timer\"\n aria-live=\"polite\"\n aria-label={accessibleLabel}\n className={`inline-flex items-center gap-1 text-sm font-mono ${color}`}\n >\n <Timer aria-hidden=\"true\" className=\"h-3.5 w-3.5\" />\n {timeString}\n </span>\n );\n }\n\n return (\n <div\n role=\"timer\"\n aria-live=\"polite\"\n aria-label={accessibleLabel}\n className={`flex items-center gap-3 rounded-lg border px-4 py-2 ${bg}`}\n >\n <Timer aria-hidden=\"true\" className={`h-5 w-5 ${color}`} />\n <div className=\"flex flex-col\">\n <span className={`text-lg font-mono font-semibold ${color}`}>{timeString}</span>\n <span className=\"text-xs text-text-secondary\">\n {remainingSeconds <= 0\n ? tWithFallback(t, 'sandbox.timer.expired', 'Expired')\n : tWithFallback(t, 'sandbox.timer.label', 'Time remaining')}\n </span>\n </div>\n\n {remainingSeconds <= 60 && remainingSeconds > 0 && (\n <div className=\"flex items-center gap-1 text-xs text-status-error-text font-medium\">\n <AlertTriangle aria-hidden=\"true\" className=\"h-3.5 w-3.5\" />\n {tWithFallback(t, 'sandbox.timer.expiringSoon', 'Expiring soon')}\n </div>\n )}\n\n {onExtend && remainingSeconds > 0 && (\n <button\n type=\"button\"\n onClick={onExtend}\n aria-label={tWithFallback(t, 'sandbox.timer.extend', 'Extend sandbox duration')}\n className=\"ml-auto flex items-center gap-1 rounded-md bg-bg-surface px-3 py-1.5 text-sm font-medium text-text-secondary shadow-sm border border-border-subtle hover:bg-bg-sunken transition-colors\"\n >\n <Plus aria-hidden=\"true\" className=\"h-3.5 w-3.5\" />\n {tWithFallback(t, 'sandbox.timer.extend', 'Extend')}\n </button>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAaA,SAAgB,EAAe,EAC7B,cACA,cACA,aACA,aAAU,MACY;CACtB,IAAM,IAAmB,EAAoB,GAAW,EAAU,E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EACE,MAAK;EACL,aAAU;EACV,cAAY;EACZ,WAAW,uDAAuD;YAJpE;GAME,kBAAC,GAAD;IAAO,eAAY;IAAO,WAAW,WAAW;IAAW,CAAA;GAC3D,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,QAAD;KAAM,WAAW,mCAAmC;eAAU;KAAkB,CAAA,EAChF,kBAAC,QAAD;KAAM,WAAU;eACb,KAAoB,IACjB,EAAc,GAAG,yBAAyB,UAAU,GACpD,EAAc,GAAG,uBAAuB,iBAAiB;KACxD,CAAA,CACH;;GAEL,KAAoB,MAAM,IAAmB,KAC5C,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,GAAD;KAAe,eAAY;KAAO,WAAU;KAAgB,CAAA,EAC3D,EAAc,GAAG,8BAA8B,gBAAgB,CAC5D;;GAGP,KAAY,IAAmB,KAC9B,kBAAC,UAAD;IACE,MAAK;IACL,SAAS;IACT,cAAY,EAAc,GAAG,wBAAwB,0BAA0B;IAC/E,WAAU;cAJZ,CAME,kBAAC,GAAD;KAAM,eAAY;KAAO,WAAU;KAAgB,CAAA,EAClD,EAAc,GAAG,wBAAwB,SAAS,CAC5C;;GAEP"}
1
+ {"version":3,"file":"CountdownTimer.js","names":[],"sources":["../../../src/sandbox/components/CountdownTimer.tsx"],"sourcesContent":["import { useRef } from 'react';\nimport { Timer, Plus, AlertTriangle } from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { tWithFallback } from '../utils/i18n';\nimport { useRemainingSeconds } from '../hooks/useRemainingSeconds';\n\ninterface CountdownTimerProps {\n expiresAt: string;\n onExpired?: () => void;\n onExtend?: () => void;\n compact?: boolean;\n}\n\nexport function CountdownTimer({\n expiresAt,\n onExpired,\n onExtend,\n compact = false,\n}: CountdownTimerProps) {\n const remainingSeconds = useRemainingSeconds(expiresAt, onExpired);\n const { t } = useI18n();\n\n // Browser notification at 60 seconds remaining, once per expiresAt window.\n // Ref-based flag avoids a render cycle and tracks the active expiresAt directly.\n const alertedForRef = useRef<string | null>(null);\n if (\n alertedForRef.current !== expiresAt &&\n remainingSeconds <= 60 &&\n remainingSeconds > 0 &&\n typeof window !== 'undefined' &&\n 'Notification' in window &&\n Notification.permission === 'granted'\n ) {\n alertedForRef.current = expiresAt;\n new Notification(tWithFallback(t, 'sandbox.timer.alertTitle', 'Sandbox expiring'), {\n body: tWithFallback(\n t,\n 'sandbox.timer.alertBody',\n 'Your sandbox will be destroyed in less than 1 minute. Extend it to continue working.'\n ),\n icon: '/favicon.ico',\n });\n }\n\n const hours = Math.floor(remainingSeconds / 3600);\n const minutes = Math.floor((remainingSeconds % 3600) / 60);\n const seconds = remainingSeconds % 60;\n const fmt = (n: number) => String(n).padStart(2, '0');\n const timeString =\n hours > 0 ? `${fmt(hours)}:${fmt(minutes)}:${fmt(seconds)}` : `${fmt(minutes)}:${fmt(seconds)}`;\n\n const color = (() => {\n if (remainingSeconds <= 0) return 'text-text-secondary';\n if (remainingSeconds <= 30) return 'text-status-error-text animate-pulse';\n if (remainingSeconds <= 60) return 'text-status-error-text';\n if (remainingSeconds <= 300) return 'text-status-warning-text';\n return 'text-status-success-text';\n })();\n\n const bg = (() => {\n if (remainingSeconds <= 0) return 'bg-bg-sunken border-border-subtle';\n if (remainingSeconds <= 60) return 'bg-status-error-bg-subtle border-border-default';\n if (remainingSeconds <= 300) return 'bg-status-warning-bg-subtle border-border-default';\n return 'bg-status-success-bg-subtle border-border-default';\n })();\n\n const remainingMinutes = Math.max(1, Math.ceil(remainingSeconds / 60));\n const accessibleLabel =\n remainingSeconds <= 0\n ? tWithFallback(t, 'sandbox.timer.expired', 'Expired')\n : tWithFallback(t, 'sandbox.timer.remaining', `${remainingMinutes} minutes remaining`, {\n count: remainingMinutes,\n });\n\n if (compact) {\n return (\n <span\n role=\"timer\"\n aria-live=\"polite\"\n aria-label={accessibleLabel}\n className={`inline-flex items-center gap-1 text-sm font-mono ${color}`}\n >\n <Timer aria-hidden=\"true\" className=\"size-3.5\" />\n {timeString}\n </span>\n );\n }\n\n return (\n <div\n role=\"timer\"\n aria-live=\"polite\"\n aria-label={accessibleLabel}\n className={`flex items-center gap-3 rounded-lg border px-4 py-2 ${bg}`}\n >\n <Timer aria-hidden=\"true\" className={`size-5 ${color}`} />\n <div className=\"flex flex-col\">\n <span className={`text-lg font-mono font-semibold ${color}`}>{timeString}</span>\n <span className=\"text-xs text-text-secondary\">\n {remainingSeconds <= 0\n ? tWithFallback(t, 'sandbox.timer.expired', 'Expired')\n : tWithFallback(t, 'sandbox.timer.label', 'Time remaining')}\n </span>\n </div>\n\n {remainingSeconds <= 60 && remainingSeconds > 0 && (\n <div className=\"flex items-center gap-1 text-xs text-status-error-text font-medium\">\n <AlertTriangle aria-hidden=\"true\" className=\"size-3.5\" />\n {tWithFallback(t, 'sandbox.timer.expiringSoon', 'Expiring soon')}\n </div>\n )}\n\n {onExtend && remainingSeconds > 0 && (\n <button\n type=\"button\"\n onClick={onExtend}\n aria-label={tWithFallback(t, 'sandbox.timer.extend', 'Extend sandbox duration')}\n className=\"ml-auto flex items-center gap-1 rounded-md bg-bg-surface px-3 py-1.5 text-sm font-medium text-text-secondary shadow-sm border border-border-subtle hover:bg-bg-sunken transition-colors\"\n >\n <Plus aria-hidden=\"true\" className=\"size-3.5\" />\n {tWithFallback(t, 'sandbox.timer.extend', 'Extend')}\n </button>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAaA,SAAgB,EAAe,EAC7B,cACA,cACA,aACA,aAAU,MACY;CACtB,IAAM,IAAmB,EAAoB,GAAW,EAAU,EAC5D,EAAE,SAAM,GAAS,EAIjB,IAAgB,EAAsB,KAAK;AACjD,CACE,EAAc,YAAY,KAC1B,KAAoB,MACpB,IAAmB,KACnB,OAAO,SAAW,OAClB,kBAAkB,UAClB,aAAa,eAAe,cAE5B,EAAc,UAAU,GACxB,IAAI,aAAa,EAAc,GAAG,4BAA4B,mBAAmB,EAAE;EACjF,MAAM,EACJ,GACA,2BACA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AAoB,MAAM,IAAmB,KAC5C,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,GAAD;KAAe,eAAY;KAAO,WAAU;KAAa,CAAA,EACxD,EAAc,GAAG,8BAA8B,gBAAgB,CAC5D;;GAGP,KAAY,IAAmB,KAC9B,kBAAC,UAAD;IACE,MAAK;IACL,SAAS;IACT,cAAY,EAAc,GAAG,wBAAwB,0BAA0B;IAC/E,WAAU;cAJZ,CAME,kBAAC,GAAD;KAAM,eAAY;KAAO,WAAU;KAAa,CAAA,EAC/C,EAAc,GAAG,wBAAwB,SAAS,CAC5C;;GAEP"}
@@ -1,12 +1,12 @@
1
1
  import { tWithFallback as e } from "../utils/i18n.js";
2
2
  import { useSandboxEvents as t } from "../utils/sandboxEvents.js";
3
- import { useState as n } from "react";
4
- import { gql as r } from "@apollo/client";
5
- import { useMutation as i, useSubscription as a } from "@apollo/client/react";
6
- import { useI18n as o } from "@burdenoff/fe-libs/shared/providers/shell";
7
- import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
3
+ import { useRef as n, useState as r } from "react";
4
+ import { gql as i } from "@apollo/client";
5
+ import { useMutation as a, useSubscription as o } from "@apollo/client/react";
6
+ import { useI18n as s } from "@burdenoff/fe-libs/shared/providers/shell";
7
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
8
8
  //#region src/sandbox/components/ExportSandboxesDialog.tsx
9
- var u = r`
9
+ var d = i`
10
10
  mutation ExportSandboxes($input: ExportSandboxesInput!) {
11
11
  exportSandboxes(input: $input) {
12
12
  id
@@ -18,7 +18,7 @@ var u = r`
18
18
  errorMessage
19
19
  }
20
20
  }
21
- `, d = r`
21
+ `, f = i`
22
22
  subscription OnSandboxExportJobChanged($workspaceId: ID!, $jobId: ID!) {
23
23
  onSandboxExportJobChanged(workspaceId: $workspaceId, jobId: $jobId) {
24
24
  id
@@ -31,93 +31,95 @@ var u = r`
31
31
  }
32
32
  }
33
33
  `;
34
- function f({ workspaceId: r, open: f, onClose: p }) {
35
- let { t: m } = o(), h = t(), [g, _] = n("CSV"), [v, y] = n(!1), [b, x] = n(null), [S, C] = n(null), [w, { loading: T }] = i(u);
36
- if (a(d, {
34
+ function p({ workspaceId: i, open: p, onClose: m }) {
35
+ let { t: h } = s(), g = t(), [_, v] = r("CSV"), [y, b] = r(!1), x = n(null), [S, C] = r(!1), [w, T] = r(null), [E, { loading: D }] = a(d);
36
+ if (o(f, {
37
37
  variables: {
38
- workspaceId: r,
39
- jobId: b
38
+ workspaceId: i,
39
+ jobId: x.current
40
40
  },
41
- skip: !b,
41
+ skip: !S,
42
42
  onData: ({ data: e }) => {
43
43
  let t = e.data?.onSandboxExportJobChanged;
44
- t && C(t);
44
+ t && T(t);
45
45
  }
46
- }), !f) return null;
47
- let E = async () => {
48
- let { data: e } = await w({ variables: { input: {
49
- workspaceId: r,
50
- format: g,
51
- includeUsageEvents: v,
52
- context: { workspaceId: r }
46
+ }), !p) return null;
47
+ let O = async () => {
48
+ let { data: e } = await E({ variables: { input: {
49
+ workspaceId: i,
50
+ format: _,
51
+ includeUsageEvents: y,
52
+ context: { workspaceId: i }
53
53
  } } });
54
- e?.exportSandboxes && (x(e.exportSandboxes.id), C(e.exportSandboxes), h.sandboxExportRequested({
54
+ e?.exportSandboxes && (x.current = e.exportSandboxes.id, C(!0), T(e.exportSandboxes), g.sandboxExportRequested({
55
55
  jobId: e.exportSandboxes.id,
56
- format: g
56
+ format: _
57
57
  }));
58
- }, D = e(m, "sandbox.exportDialog.title", "Export sandboxes");
59
- return /* @__PURE__ */ c("div", {
60
- role: "dialog",
58
+ }, k = e(h, "sandbox.exportDialog.title", "Export sandboxes");
59
+ return /* @__PURE__ */ l("dialog", {
60
+ open: !0,
61
61
  "aria-modal": "true",
62
- "aria-label": D,
63
- className: "fixed inset-0 z-50 flex items-center justify-center bg-bg-overlay/40 p-4",
64
- children: /* @__PURE__ */ l("div", {
62
+ "aria-label": k,
63
+ className: "fixed inset-0 z-50 m-0 flex h-full w-full items-center justify-center bg-bg-overlay/40 p-4",
64
+ children: /* @__PURE__ */ u("div", {
65
65
  className: "w-full max-w-md rounded-lg border border-border-default bg-bg-surface p-5 shadow-lg",
66
66
  children: [
67
- /* @__PURE__ */ c("h2", {
67
+ /* @__PURE__ */ l("h2", {
68
68
  className: "text-base font-semibold text-foreground",
69
- children: D
69
+ children: k
70
70
  }),
71
- S ? /* @__PURE__ */ c("div", {
71
+ w ? /* @__PURE__ */ l("div", {
72
72
  className: "mt-4 space-y-3 text-sm text-text-secondary",
73
- children: S.status === "COMPLETED" && S.downloadUrl ? /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("p", { children: e(m, "sandbox.exportDialog.ready", "Export ready") }), /* @__PURE__ */ c("a", {
74
- href: S.downloadUrl,
73
+ children: w.status === "COMPLETED" && w.downloadUrl ? /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("p", { children: e(h, "sandbox.exportDialog.ready", "Export ready") }), /* @__PURE__ */ l("a", {
74
+ href: w.downloadUrl,
75
75
  target: "_blank",
76
76
  rel: "noopener noreferrer",
77
77
  className: "inline-block rounded-md bg-status-info-bg-subtle px-3 py-1.5 text-status-info-text",
78
- children: e(m, "sandbox.exportDialog.download", "Download")
79
- })] }) : S.status === "FAILED" ? /* @__PURE__ */ c("p", {
78
+ children: e(h, "sandbox.exportDialog.download", "Download")
79
+ })] }) : w.status === "FAILED" ? /* @__PURE__ */ l("p", {
80
80
  className: "text-status-error-text",
81
- children: e(m, "sandbox.exportDialog.failed", `Export failed: ${S.errorMessage}`, { error: S.errorMessage ?? "unknown" })
82
- }) : /* @__PURE__ */ c("p", { children: e(m, "sandbox.exportDialog.preparing", "Preparing export…") })
83
- }) : /* @__PURE__ */ l("div", {
81
+ children: e(h, "sandbox.exportDialog.failed", `Export failed: ${w.errorMessage}`, { error: w.errorMessage ?? "unknown" })
82
+ }) : /* @__PURE__ */ l("p", { children: e(h, "sandbox.exportDialog.preparing", "Preparing export…") })
83
+ }) : /* @__PURE__ */ u("div", {
84
84
  className: "mt-4 space-y-3",
85
- children: [/* @__PURE__ */ l("fieldset", { children: [/* @__PURE__ */ c("legend", {
85
+ children: [/* @__PURE__ */ u("fieldset", { children: [/* @__PURE__ */ l("legend", {
86
86
  className: "text-sm font-medium text-text-secondary",
87
- children: e(m, "sandbox.exportDialog.format.label", "Format")
88
- }), /* @__PURE__ */ c("div", {
87
+ children: e(h, "sandbox.exportDialog.format.label", "Format")
88
+ }), /* @__PURE__ */ l("div", {
89
89
  className: "mt-2 flex gap-3",
90
- children: ["CSV", "JSON"].map((e) => /* @__PURE__ */ l("label", {
90
+ children: ["CSV", "JSON"].map((e) => /* @__PURE__ */ u("label", {
91
91
  className: "inline-flex items-center gap-1.5 text-sm",
92
- children: [/* @__PURE__ */ c("input", {
92
+ children: [/* @__PURE__ */ l("input", {
93
93
  type: "radio",
94
94
  name: "format",
95
- checked: g === e,
96
- onChange: () => _(e)
95
+ checked: _ === e,
96
+ onChange: () => v(e),
97
+ "aria-label": e
97
98
  }), e]
98
99
  }, e))
99
- })] }), /* @__PURE__ */ l("label", {
100
+ })] }), /* @__PURE__ */ u("label", {
100
101
  className: "flex items-center gap-2 text-sm text-text-secondary",
101
- children: [/* @__PURE__ */ c("input", {
102
+ children: [/* @__PURE__ */ l("input", {
102
103
  type: "checkbox",
103
- checked: v,
104
- onChange: (e) => y(e.target.checked)
105
- }), e(m, "sandbox.exportDialog.includeUsage", "Include usage events")]
104
+ checked: y,
105
+ onChange: (e) => b(e.target.checked),
106
+ "aria-label": e(h, "sandbox.exportDialog.includeUsage", "Include usage events")
107
+ }), e(h, "sandbox.exportDialog.includeUsage", "Include usage events")]
106
108
  })]
107
109
  }),
108
- /* @__PURE__ */ l("div", {
110
+ /* @__PURE__ */ u("div", {
109
111
  className: "mt-5 flex justify-end gap-2",
110
- children: [/* @__PURE__ */ c("button", {
112
+ children: [/* @__PURE__ */ l("button", {
111
113
  type: "button",
112
- onClick: p,
114
+ onClick: m,
113
115
  className: "rounded-md border border-border-subtle px-3 py-1.5 text-sm text-text-secondary hover:bg-bg-sunken",
114
- children: e(m, "sandbox.exportDialog.cancel", "Cancel")
115
- }), !S && /* @__PURE__ */ c("button", {
116
+ children: e(h, "sandbox.exportDialog.cancel", "Cancel")
117
+ }), !w && /* @__PURE__ */ l("button", {
116
118
  type: "button",
117
- onClick: E,
118
- disabled: T,
119
+ onClick: O,
120
+ disabled: D,
119
121
  className: "rounded-md bg-status-info-bg-default px-3 py-1.5 text-sm text-status-info-text-inverse disabled:opacity-50",
120
- children: e(m, "sandbox.exportDialog.submit", "Export")
122
+ children: e(h, "sandbox.exportDialog.submit", "Export")
121
123
  })]
122
124
  })
123
125
  ]
@@ -125,6 +127,6 @@ function f({ workspaceId: r, open: f, onClose: p }) {
125
127
  });
126
128
  }
127
129
  //#endregion
128
- export { f as ExportSandboxesDialog };
130
+ export { p as ExportSandboxesDialog };
129
131
 
130
132
  //# sourceMappingURL=ExportSandboxesDialog.js.map
@@ -1 +1 @@
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';\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 const [jobId, setJobId] = useState<string | null>(null);\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: jobId! },\n skip: !jobId,\n onData: ({ data }: { data: { data?: { onSandboxExportJobChanged?: Job } | null } }) => {\n const next = data.data?.onSandboxExportJobChanged;\n if (next) setJob(next);\n },\n });\n\n if (!open) return null;\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 setJobId(data.exportSandboxes.id);\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\n return (\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={heading}\n className=\"fixed inset-0 z-50 flex items-center justify-center bg-bg-overlay/40 p-4\"\n >\n <div className=\"w-full max-w-md rounded-lg border border-border-default bg-bg-surface p-5 shadow-lg\">\n <h2 className=\"text-base font-semibold text-foreground\">{heading}</h2>\n {job ? (\n <div className=\"mt-4 space-y-3 text-sm text-text-secondary\">\n {job.status === 'COMPLETED' && job.downloadUrl ? (\n <>\n <p>{tWithFallback(t, 'sandbox.exportDialog.ready', 'Export ready')}</p>\n <a\n href={job.downloadUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-block rounded-md bg-status-info-bg-subtle px-3 py-1.5 text-status-info-text\"\n >\n {tWithFallback(t, 'sandbox.exportDialog.download', 'Download')}\n </a>\n </>\n ) : job.status === 'FAILED' ? (\n <p className=\"text-status-error-text\">\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>{tWithFallback(t, 'sandbox.exportDialog.preparing', 'Preparing export…')}</p>\n )}\n </div>\n ) : (\n <div className=\"mt-4 space-y-3\">\n <fieldset>\n <legend className=\"text-sm font-medium text-text-secondary\">\n {tWithFallback(t, 'sandbox.exportDialog.format.label', 'Format')}\n </legend>\n <div className=\"mt-2 flex gap-3\">\n {(['CSV', 'JSON'] as const).map((f) => (\n <label key={f} className=\"inline-flex items-center gap-1.5 text-sm\">\n <input\n type=\"radio\"\n name=\"format\"\n checked={format === f}\n onChange={() => setFormat(f)}\n />\n {f}\n </label>\n ))}\n </div>\n </fieldset>\n <label className=\"flex items-center gap-2 text-sm text-text-secondary\">\n <input\n type=\"checkbox\"\n checked={includeUsage}\n onChange={(e) => setIncludeUsage(e.target.checked)}\n />\n {tWithFallback(t, 'sandbox.exportDialog.includeUsage', 'Include usage events')}\n </label>\n </div>\n )}\n <div className=\"mt-5 flex justify-end gap-2\">\n <button\n type=\"button\"\n onClick={onClose}\n className=\"rounded-md border border-border-subtle px-3 py-1.5 text-sm text-text-secondary hover:bg-bg-sunken\"\n >\n {tWithFallback(t, 'sandbox.exportDialog.cancel', 'Cancel')}\n </button>\n {!job && (\n <button\n type=\"button\"\n onClick={start}\n disabled={loading}\n className=\"rounded-md bg-status-info-bg-default px-3 py-1.5 text-sm text-status-info-text-inverse disabled:opacity-50\"\n >\n {tWithFallback(t, 'sandbox.exportDialog.submit', 'Export')}\n </button>\n )}\n </div>\n </div>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AEP;;IACF;;EACF,CAAA"}
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';\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 if (!open) return null;\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\n return (\n <dialog\n open\n aria-modal=\"true\"\n aria-label={heading}\n className=\"fixed inset-0 z-50 m-0 flex h-full w-full items-center justify-center bg-bg-overlay/40 p-4\"\n >\n <div className=\"w-full max-w-md rounded-lg border border-border-default bg-bg-surface p-5 shadow-lg\">\n <h2 className=\"text-base font-semibold text-foreground\">{heading}</h2>\n {job ? (\n <div className=\"mt-4 space-y-3 text-sm text-text-secondary\">\n {job.status === 'COMPLETED' && job.downloadUrl ? (\n <>\n <p>{tWithFallback(t, 'sandbox.exportDialog.ready', 'Export ready')}</p>\n <a\n href={job.downloadUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-block rounded-md bg-status-info-bg-subtle px-3 py-1.5 text-status-info-text\"\n >\n {tWithFallback(t, 'sandbox.exportDialog.download', 'Download')}\n </a>\n </>\n ) : job.status === 'FAILED' ? (\n <p className=\"text-status-error-text\">\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>{tWithFallback(t, 'sandbox.exportDialog.preparing', 'Preparing export…')}</p>\n )}\n </div>\n ) : (\n <div className=\"mt-4 space-y-3\">\n <fieldset>\n <legend className=\"text-sm font-medium text-text-secondary\">\n {tWithFallback(t, 'sandbox.exportDialog.format.label', 'Format')}\n </legend>\n <div className=\"mt-2 flex gap-3\">\n {(['CSV', 'JSON'] as const).map((f) => (\n <label key={f} className=\"inline-flex items-center gap-1.5 text-sm\">\n <input\n type=\"radio\"\n name=\"format\"\n checked={format === f}\n onChange={() => setFormat(f)}\n aria-label={f}\n />\n {f}\n </label>\n ))}\n </div>\n </fieldset>\n <label className=\"flex items-center gap-2 text-sm text-text-secondary\">\n <input\n type=\"checkbox\"\n checked={includeUsage}\n onChange={(e) => setIncludeUsage(e.target.checked)}\n aria-label={tWithFallback(\n t,\n 'sandbox.exportDialog.includeUsage',\n 'Include usage events'\n )}\n />\n {tWithFallback(t, 'sandbox.exportDialog.includeUsage', 'Include usage events')}\n </label>\n </div>\n )}\n <div className=\"mt-5 flex justify-end gap-2\">\n <button\n type=\"button\"\n onClick={onClose}\n className=\"rounded-md border border-border-subtle px-3 py-1.5 text-sm text-text-secondary hover:bg-bg-sunken\"\n >\n {tWithFallback(t, 'sandbox.exportDialog.cancel', 'Cancel')}\n </button>\n {!job && (\n <button\n type=\"button\"\n onClick={start}\n disabled={loading}\n className=\"rounded-md bg-status-info-bg-default px-3 py-1.5 text-sm text-status-info-text-inverse disabled:opacity-50\"\n >\n {tWithFallback(t, 'sandbox.exportDialog.submit', 'Export')}\n </button>\n )}\n </div>\n </div>\n </dialog>\n );\n}\n"],"mappings":";;;;;;;;AAOA,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,C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A,UAAI,EAAc,GAAG,kCAAkC,oBAAoB,EAAK,CAAA;KAE9E,CAAA,GAEN,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,YAAD,EAAA,UAAA,CACE,kBAAC,UAAD;MAAQ,WAAU;gBACf,EAAc,GAAG,qCAAqC,SAAS;MACzD,CAAA,EACT,kBAAC,OAAD;MAAK,WAAU;gBACX,CAAC,OAAO,OAAO,CAAW,KAAK,MAC/B,kBAAC,SAAD;OAAe,WAAU;iBAAzB,CACE,kBAAC,SAAD;QACE,MAAK;QACL,MAAK;QACL,SAAS,MAAW;QACpB,gBAAgB,EAAU,EAAE;QAC5B,cAAY;QACZ,CAAA,EACD,EACK;SATI,EASJ,CACR;MACE,CAAA,CACG,EAAA,CAAA,EACX,kBAAC,SAAD;MAAO,WAAU;gBAAjB,CACE,kBAAC,SAAD;OACE,MAAK;OACL,SAAS;OACT,WAAW,MAAM,EAAgB,EAAE,OAAO,QAAQ;OAClD,cAAY,EACV,GACA,qCACA,uBACD;OACD,CAAA,EACD,EAAc,GAAG,qCAAqC,uBAAuB,CACxE;QACJ;;IAER,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,UAAD;MACE,MAAK;MACL,SAAS;MACT,WAAU;gBAET,EAAc,GAAG,+BAA+B,SAAS;MACnD,CAAA,EACR,CAAC,KACA,kBAAC,UAAD;MACE,MAAK;MACL,SAAS;MACT,UAAU;MACV,WAAU;gBAET,EAAc,GAAG,+BAA+B,SAAS;MACnD,CAAA,CAEP;;IACF;;EACC,CAAA"}
@@ -34,14 +34,16 @@ function s({ isOpen: s, onClose: c, onExtend: l, currentExpiresAt: u, isLoading:
34
34
  className: "flex items-center justify-between mb-4",
35
35
  children: [/* @__PURE__ */ a("div", {
36
36
  className: "flex items-center gap-2",
37
- children: [/* @__PURE__ */ i(n, { className: "h-5 w-5 text-accent-blue" }), /* @__PURE__ */ i("h3", {
37
+ children: [/* @__PURE__ */ i(n, { className: "size-5 text-accent-blue" }), /* @__PURE__ */ i("h3", {
38
38
  className: "text-lg font-semibold",
39
39
  children: "Extend Sandbox Duration"
40
40
  })]
41
41
  }), /* @__PURE__ */ i("button", {
42
+ type: "button",
42
43
  onClick: c,
44
+ "aria-label": "Close dialog",
43
45
  className: "text-text-tertiary hover:text-text-secondary",
44
- children: /* @__PURE__ */ i(r, { className: "h-5 w-5" })
46
+ children: /* @__PURE__ */ i(r, { className: "size-5" })
45
47
  })]
46
48
  }),
47
49
  /* @__PURE__ */ a("p", {
@@ -54,6 +56,7 @@ function s({ isOpen: s, onClose: c, onExtend: l, currentExpiresAt: u, isLoading:
54
56
  /* @__PURE__ */ i("div", {
55
57
  className: "space-y-2 mb-4",
56
58
  children: o.map((e, t) => /* @__PURE__ */ a("button", {
59
+ type: "button",
57
60
  onClick: () => {
58
61
  p(t), h("");
59
62
  },
@@ -64,9 +67,11 @@ function s({ isOpen: s, onClose: c, onExtend: l, currentExpiresAt: u, isLoading:
64
67
  /* @__PURE__ */ a("div", {
65
68
  className: "mb-6",
66
69
  children: [/* @__PURE__ */ i("label", {
70
+ htmlFor: "extend-ttl-custom-minutes",
67
71
  className: "block text-sm font-medium text-text-secondary mb-1",
68
72
  children: "Custom duration (minutes)"
69
73
  }), /* @__PURE__ */ i("input", {
74
+ id: "extend-ttl-custom-minutes",
70
75
  type: "number",
71
76
  min: "1",
72
77
  max: "1440",
@@ -75,6 +80,7 @@ function s({ isOpen: s, onClose: c, onExtend: l, currentExpiresAt: u, isLoading:
75
80
  h(e.target.value), p(null);
76
81
  },
77
82
  placeholder: "Enter minutes",
83
+ "aria-label": "Custom duration in minutes",
78
84
  className: "w-full rounded-lg border border-border-subtle px-3 py-2 text-sm focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary"
79
85
  })]
80
86
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"ExtendTTLModal.js","names":[],"sources":["../../../src/sandbox/components/ExtendTTLModal.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Clock, X } from 'lucide-react';\nimport { Button } from './ui';\n\ninterface ExtendTTLModalProps {\n isOpen: boolean;\n onClose: () => void;\n onExtend: (additionalSeconds: number) => void;\n currentExpiresAt: string;\n isLoading?: boolean;\n}\n\nconst PRESET_DURATIONS = [\n { label: '15 minutes', seconds: 15 * 60 },\n { label: '30 minutes', seconds: 30 * 60 },\n { label: '1 hour', seconds: 60 * 60 },\n { label: '2 hours', seconds: 2 * 60 * 60 },\n];\n\nexport function ExtendTTLModal({\n isOpen,\n onClose,\n onExtend,\n currentExpiresAt,\n isLoading,\n}: ExtendTTLModalProps) {\n const [selectedPreset, setSelectedPreset] = useState<number | null>(null);\n const [customMinutes, setCustomMinutes] = useState('');\n\n if (!isOpen) return null;\n\n const remainingMs = new Date(currentExpiresAt).getTime() - Date.now();\n const remainingMinutes = Math.max(0, Math.floor(remainingMs / 60000));\n\n const handleExtend = () => {\n let seconds: number;\n if (selectedPreset !== null) {\n seconds = PRESET_DURATIONS[selectedPreset].seconds;\n } else if (customMinutes) {\n seconds = parseInt(customMinutes, 10) * 60;\n if (isNaN(seconds) || seconds <= 0) return;\n } else {\n return;\n }\n onExtend(seconds);\n };\n\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center bg-black/50\">\n <div className=\"w-full max-w-md rounded-xl bg-bg-surface p-6 shadow-xl\">\n <div className=\"flex items-center justify-between mb-4\">\n <div className=\"flex items-center gap-2\">\n <Clock className=\"h-5 w-5 text-accent-blue\" />\n <h3 className=\"text-lg font-semibold\">Extend Sandbox Duration</h3>\n </div>\n <button onClick={onClose} className=\"text-text-tertiary hover:text-text-secondary\">\n <X className=\"h-5 w-5\" />\n </button>\n </div>\n\n <p className=\"text-sm text-text-secondary mb-4\">\n Current remaining time: <span className=\"font-medium\">{remainingMinutes} minutes</span>\n </p>\n\n <div className=\"space-y-2 mb-4\">\n {PRESET_DURATIONS.map((preset, i) => (\n <button\n key={preset.seconds}\n onClick={() => {\n setSelectedPreset(i);\n setCustomMinutes('');\n }}\n className={`w-full rounded-lg border px-4 py-2.5 text-left text-sm font-medium transition-colors ${\n selectedPreset === i\n ? 'border-primary bg-status-info-bg-subtle text-status-info-text'\n : 'border-border-subtle hover:bg-bg-sunken text-text-secondary'\n }`}\n >\n + {preset.label}\n </button>\n ))}\n </div>\n\n <div className=\"mb-6\">\n <label className=\"block text-sm font-medium text-text-secondary mb-1\">\n Custom duration (minutes)\n </label>\n <input\n type=\"number\"\n min=\"1\"\n max=\"1440\"\n value={customMinutes}\n onChange={(e) => {\n setCustomMinutes(e.target.value);\n setSelectedPreset(null);\n }}\n placeholder=\"Enter minutes\"\n className=\"w-full rounded-lg border border-border-subtle px-3 py-2 text-sm focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary\"\n />\n </div>\n\n <div className=\"flex gap-3\">\n <Button variant=\"outline\" onClick={onClose} className=\"flex-1\">\n Cancel\n </Button>\n <Button\n onClick={handleExtend}\n disabled={isLoading || (selectedPreset === null && !customMinutes)}\n className=\"flex-1\"\n >\n {isLoading ? 'Extending...' : 'Extend'}\n </Button>\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;AAYA,IAAM,IAAmB;CACvB;EAAE,OAAO;EAAc,SAAS;EAAS;CACzC;EAAE,OAAO;EAAc,SAAS;EAAS;CACzC;EAAE,OAAO;EAAU,SAAS;EAAS;CACrC;EAAE,OAAO;EAAW,SAAS;EAAa;CAC3C;AAED,SAAgB,EAAe,EAC7B,WACA,YACA,aACA,qBACA,gBACsB;CACtB,IAAM,CAAC,GAAgB,KAAqB,EAAwB,KAAK,EACnE,CAAC,GAAe,KAAoB,EAAS,GAAG;AAEtD,KAAI,CAAC,EAAQ,QAAO;CAEpB,IAAM,IAAc,IAAI,KAAK,EAAiB,CAAC,SAAS,GAAG,KAAK,KAAK,EAC/D,IAAmB,KAAK,IAAI,GAAG,KAAK,MAAM,IAAc,IAAM,CAAC;AAerE,QACE,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,OAAD;GAAK,WAAU;aAAf;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Ac,MAAmB,QAAQ,CAAC;MACpD,WAAU;gBAET,IAAY,iBAAiB;MACvB,CAAA,CACL;;IACF;;EACF,CAAA"}
1
+ {"version":3,"file":"ExtendTTLModal.js","names":[],"sources":["../../../src/sandbox/components/ExtendTTLModal.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Clock, X } from 'lucide-react';\nimport { Button } from './ui';\n\ninterface ExtendTTLModalProps {\n isOpen: boolean;\n onClose: () => void;\n onExtend: (additionalSeconds: number) => void;\n currentExpiresAt: string;\n isLoading?: boolean;\n}\n\nconst PRESET_DURATIONS = [\n { label: '15 minutes', seconds: 15 * 60 },\n { label: '30 minutes', seconds: 30 * 60 },\n { label: '1 hour', seconds: 60 * 60 },\n { label: '2 hours', seconds: 2 * 60 * 60 },\n];\n\nexport function ExtendTTLModal({\n isOpen,\n onClose,\n onExtend,\n currentExpiresAt,\n isLoading,\n}: ExtendTTLModalProps) {\n const [selectedPreset, setSelectedPreset] = useState<number | null>(null);\n const [customMinutes, setCustomMinutes] = useState('');\n\n if (!isOpen) return null;\n\n const remainingMs = new Date(currentExpiresAt).getTime() - Date.now();\n const remainingMinutes = Math.max(0, Math.floor(remainingMs / 60000));\n\n const handleExtend = () => {\n let seconds: number;\n if (selectedPreset !== null) {\n seconds = PRESET_DURATIONS[selectedPreset].seconds;\n } else if (customMinutes) {\n seconds = parseInt(customMinutes, 10) * 60;\n if (isNaN(seconds) || seconds <= 0) return;\n } else {\n return;\n }\n onExtend(seconds);\n };\n\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center bg-black/50\">\n <div className=\"w-full max-w-md rounded-xl bg-bg-surface p-6 shadow-xl\">\n <div className=\"flex items-center justify-between mb-4\">\n <div className=\"flex items-center gap-2\">\n <Clock className=\"size-5 text-accent-blue\" />\n <h3 className=\"text-lg font-semibold\">Extend Sandbox Duration</h3>\n </div>\n <button\n type=\"button\"\n onClick={onClose}\n aria-label=\"Close dialog\"\n className=\"text-text-tertiary hover:text-text-secondary\"\n >\n <X className=\"size-5\" />\n </button>\n </div>\n\n <p className=\"text-sm text-text-secondary mb-4\">\n Current remaining time: <span className=\"font-medium\">{remainingMinutes} minutes</span>\n </p>\n\n <div className=\"space-y-2 mb-4\">\n {PRESET_DURATIONS.map((preset, i) => (\n <button\n key={preset.seconds}\n type=\"button\"\n onClick={() => {\n setSelectedPreset(i);\n setCustomMinutes('');\n }}\n className={`w-full rounded-lg border px-4 py-2.5 text-left text-sm font-medium transition-colors ${\n selectedPreset === i\n ? 'border-primary bg-status-info-bg-subtle text-status-info-text'\n : 'border-border-subtle hover:bg-bg-sunken text-text-secondary'\n }`}\n >\n + {preset.label}\n </button>\n ))}\n </div>\n\n <div className=\"mb-6\">\n <label\n htmlFor=\"extend-ttl-custom-minutes\"\n className=\"block text-sm font-medium text-text-secondary mb-1\"\n >\n Custom duration (minutes)\n </label>\n <input\n id=\"extend-ttl-custom-minutes\"\n type=\"number\"\n min=\"1\"\n max=\"1440\"\n value={customMinutes}\n onChange={(e) => {\n setCustomMinutes(e.target.value);\n setSelectedPreset(null);\n }}\n placeholder=\"Enter minutes\"\n aria-label=\"Custom duration in minutes\"\n className=\"w-full rounded-lg border border-border-subtle px-3 py-2 text-sm focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary\"\n />\n </div>\n\n <div className=\"flex gap-3\">\n <Button variant=\"outline\" onClick={onClose} className=\"flex-1\">\n Cancel\n </Button>\n <Button\n onClick={handleExtend}\n disabled={isLoading || (selectedPreset === null && !customMinutes)}\n className=\"flex-1\"\n >\n {isLoading ? 'Extending...' : 'Extend'}\n </Button>\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;AAYA,IAAM,IAAmB;CACvB;EAAE,OAAO;EAAc,SAAS;EAAS;CACzC;EAAE,OAAO;EAAc,SAAS;EAAS;CACzC;EAAE,OAAO;EAAU,SAAS;EAAS;CACrC;EAAE,OAAO;EAAW,SAAS;EAAa;CAC3C;AAED,SAAgB,EAAe,EAC7B,WACA,YACA,aACA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