@burdenoff/microfe-bigconsole 2026.1008.11 → 2026.1008.12

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 (131) hide show
  1. package/dist/bigconsole/BigConsoleRoutes.d.ts.map +1 -1
  2. package/dist/bigconsole/BigConsoleRoutes.js +136 -127
  3. package/dist/bigconsole/BigConsoleRoutes.js.map +1 -1
  4. package/dist/bigconsole/assistant/assistantProduct.d.ts.map +1 -1
  5. package/dist/bigconsole/assistant/assistantProduct.js +3 -1
  6. package/dist/bigconsole/assistant/assistantProduct.js.map +1 -1
  7. package/dist/bigconsole/components/builder/inspector/DataBindingSection.js +31 -31
  8. package/dist/bigconsole/components/dashboard/CreateDashboardDialog.js +44 -44
  9. package/dist/bigconsole/components/dashboard/CreateDashboardDialog.js.map +1 -1
  10. package/dist/bigconsole/components/dashboard/DashboardCanvas.js +36 -36
  11. package/dist/bigconsole/components/dashboard/DashboardCanvas.js.map +1 -1
  12. package/dist/bigconsole/components/dashboard/DashboardToolbar.js +59 -59
  13. package/dist/bigconsole/components/dashboard/DrilldownBreadcrumb.js +15 -15
  14. package/dist/bigconsole/components/dashboard/GlobalFiltersBar/FilterChip.js +30 -30
  15. package/dist/bigconsole/components/dashboard/GlobalFiltersBar/FilterEditor.js +41 -41
  16. package/dist/bigconsole/components/dashboard/GlobalFiltersBar/FilterPresetSelector.js +34 -34
  17. package/dist/bigconsole/components/dashboard/GlobalFiltersBar/GlobalFiltersBar.js +34 -34
  18. package/dist/bigconsole/components/dashboard/ImportDashboardDialog.js +110 -110
  19. package/dist/bigconsole/components/dashboard/ImportDashboardDialog.js.map +1 -1
  20. package/dist/bigconsole/components/dashboard/PublishToStoreDialog.js +21 -21
  21. package/dist/bigconsole/components/dashboard/SavedViewsDropdown/SavedViewsDropdown.js +46 -46
  22. package/dist/bigconsole/components/dashboard/ShareDialog/EmbedTab.js +91 -91
  23. package/dist/bigconsole/components/dashboard/ShareDialog/EmbedTab.js.map +1 -1
  24. package/dist/bigconsole/components/dashboard/ShareDialog/ShareDialog.js +101 -101
  25. package/dist/bigconsole/components/dashboard/ShareDialog/ShareDialog.js.map +1 -1
  26. package/dist/bigconsole/components/dashboard/TemplateInstallOptions.js +31 -31
  27. package/dist/bigconsole/components/dashboard/TemplateLayoutPreview.js +15 -15
  28. package/dist/bigconsole/components/dashboard/TemplatePicker/TemplatePicker.js +1 -1
  29. package/dist/bigconsole/components/dashboard/WidgetPalette.js +46 -46
  30. package/dist/bigconsole/components/datasink/AlertExecutionHistory.js +37 -37
  31. package/dist/bigconsole/components/datasink/AlertRuleEditor.js +66 -66
  32. package/dist/bigconsole/components/datasink/CacheTTLSelector.js +35 -35
  33. package/dist/bigconsole/components/datasink/DataSinkCard.js +29 -29
  34. package/dist/bigconsole/components/datasink/DataSinkDeleteDialog.js +18 -18
  35. package/dist/bigconsole/components/datasink/DataSinkRefreshDialog.js +20 -20
  36. package/dist/bigconsole/components/datasink/ImportDataGuideDialog.js +47 -47
  37. package/dist/bigconsole/components/datasink/ImportDataSinkDialog.js +91 -91
  38. package/dist/bigconsole/components/datasink/RefreshTypeSelector.js +35 -35
  39. package/dist/bigconsole/components/parser/DataSinkSelector.js +40 -40
  40. package/dist/bigconsole/components/parser/ImportParserDialog.js +120 -120
  41. package/dist/bigconsole/components/parser/ImportParserDialog.js.map +1 -1
  42. package/dist/bigconsole/components/parser/ParserSelector.js +51 -51
  43. package/dist/bigconsole/components/pipeline/PipelineScopePicker.js +10 -10
  44. package/dist/bigconsole/components/preview/AiPreviewMiniPanel.js +27 -27
  45. package/dist/bigconsole/components/preview/AiPreviewPanel.js +30 -30
  46. package/dist/bigconsole/components/widgets/ActionConfigDialog.js +4 -4
  47. package/dist/bigconsole/components/widgets/DrilldownConfigPanel.js +93 -93
  48. package/dist/bigconsole/components/widgets/DrilldownConfigPanel.js.map +1 -1
  49. package/dist/bigconsole/components/widgets/PropertiesPanel.d.ts.map +1 -1
  50. package/dist/bigconsole/components/widgets/PropertiesPanel.js +280 -273
  51. package/dist/bigconsole/components/widgets/PropertiesPanel.js.map +1 -1
  52. package/dist/bigconsole/components/widgets/calendar/CalendarWidget.js +4 -4
  53. package/dist/bigconsole/components/widgets/chart/ChartConfig.js +48 -48
  54. package/dist/bigconsole/components/widgets/comments/WidgetComments.js +46 -46
  55. package/dist/bigconsole/components/widgets/event-logs/EventLogViewer.js +61 -61
  56. package/dist/bigconsole/components/widgets/form/FormWidget.js +36 -36
  57. package/dist/bigconsole/components/widgets/gauge/GaugeConfig.js +42 -42
  58. package/dist/bigconsole/components/widgets/heatmap/HeatmapConfig.js +25 -25
  59. package/dist/bigconsole/components/widgets/kanban/KanbanWidget.js +4 -4
  60. package/dist/bigconsole/components/widgets/list/ListConfig.js +30 -30
  61. package/dist/bigconsole/components/widgets/metric-card/MetricCardConfig.js +38 -38
  62. package/dist/bigconsole/components/widgets/metric-card/SparklineChart.js +9 -9
  63. package/dist/bigconsole/components/widgets/metric-card/TrendIndicator.js +9 -9
  64. package/dist/bigconsole/components/widgets/pivot-table/PivotTableWidget.js +49 -49
  65. package/dist/bigconsole/components/widgets/progress/ProgressConfig.js +39 -39
  66. package/dist/bigconsole/components/widgets/table/TableConfig.js +73 -73
  67. package/dist/bigconsole/components/widgets/webhook-config/WebhookConfigPanel.js +64 -64
  68. package/dist/bigconsole/components/workflow/WorkflowOpenGuard.js +15 -15
  69. package/dist/bigconsole/components/workflow/WorkflowSinkLinkForm.js +15 -15
  70. package/dist/bigconsole/customWidget/CustomWidgetBuilderSheet.js +9 -9
  71. package/dist/bigconsole/customWidget/CustomWidgetProposalPanel.js +67 -67
  72. package/dist/bigconsole/customWidget/CustomWidgetProposalPanel.js.map +1 -1
  73. package/dist/bigconsole/hooks/useDashboardLayoutBaseline.d.ts +15 -0
  74. package/dist/bigconsole/hooks/useDashboardLayoutBaseline.d.ts.map +1 -0
  75. package/dist/bigconsole/hooks/useDashboardLayoutBaseline.js +34 -0
  76. package/dist/bigconsole/hooks/useDashboardLayoutBaseline.js.map +1 -0
  77. package/dist/bigconsole/hooks/useDrilldown.js +3 -3
  78. package/dist/bigconsole/hooks/useGlobalFilters.js +3 -3
  79. package/dist/bigconsole/pages/AdminPage.js +130 -130
  80. package/dist/bigconsole/pages/DashboardBuilderPage.d.ts.map +1 -1
  81. package/dist/bigconsole/pages/DashboardBuilderPage.js +72 -60
  82. package/dist/bigconsole/pages/DashboardBuilderPage.js.map +1 -1
  83. package/dist/bigconsole/pages/DashboardViewPage.js +1 -1
  84. package/dist/bigconsole/pages/DataSinkAlertsPage.d.ts.map +1 -1
  85. package/dist/bigconsole/pages/DataSinkAlertsPage.js +30 -23
  86. package/dist/bigconsole/pages/DataSinkAlertsPage.js.map +1 -1
  87. package/dist/bigconsole/pages/DataSinkBuilderPage.d.ts.map +1 -1
  88. package/dist/bigconsole/pages/DataSinkBuilderPage.js +272 -263
  89. package/dist/bigconsole/pages/DataSinkBuilderPage.js.map +1 -1
  90. package/dist/bigconsole/pages/DataSinkViewPage.js +1 -1
  91. package/dist/bigconsole/pages/DataSinksPage.js +1 -1
  92. package/dist/bigconsole/pages/DataSourcesPage.js +5 -5
  93. package/dist/bigconsole/pages/InsightsPage.js +181 -181
  94. package/dist/bigconsole/pages/InsightsPage.js.map +1 -1
  95. package/dist/bigconsole/pages/OverviewPage.js +47 -47
  96. package/dist/bigconsole/pages/OverviewPage.js.map +1 -1
  97. package/dist/bigconsole/pages/ParserBuilderPage.d.ts.map +1 -1
  98. package/dist/bigconsole/pages/ParserBuilderPage.js +227 -211
  99. package/dist/bigconsole/pages/ParserBuilderPage.js.map +1 -1
  100. package/dist/bigconsole/pages/ParserViewPage.js +97 -97
  101. package/dist/bigconsole/pages/PipelineBuilderPage.d.ts.map +1 -1
  102. package/dist/bigconsole/pages/PipelineBuilderPage.js +256 -214
  103. package/dist/bigconsole/pages/PipelineBuilderPage.js.map +1 -1
  104. package/dist/bigconsole/pages/PipelineViewPage.js +146 -146
  105. package/dist/bigconsole/pages/PipelinesPage.js +88 -88
  106. package/dist/bigconsole/pages/PipelinesPage.js.map +1 -1
  107. package/dist/bigconsole/pages/SettingsPage.d.ts.map +1 -1
  108. package/dist/bigconsole/pages/SettingsPage.js +179 -173
  109. package/dist/bigconsole/pages/SettingsPage.js.map +1 -1
  110. package/dist/bigconsole/pages/WidgetDemoPage.js +42 -42
  111. package/dist/bigconsole/pages/WorkflowViewPage.js +1 -1
  112. package/dist/bigconsole/pages/WorkflowsPage.js +141 -141
  113. package/dist/bigconsole/pages/WorkflowsPage.js.map +1 -1
  114. package/dist/bigconsole/providers/BigConsoleQuotaProvider.js +12 -12
  115. package/dist/bigconsole/renderers/adapters/AdaptiveCardRenderer.js +34 -34
  116. package/dist/bigconsole/renderers/adapters/BlockKitRenderer.js +79 -79
  117. package/dist/bigconsole/renderers/adapters/CustomRenderer.js +46 -46
  118. package/dist/bigconsole/store/widgetStore.d.ts +12 -0
  119. package/dist/bigconsole/store/widgetStore.d.ts.map +1 -1
  120. package/dist/bigconsole/store/widgetStore.js +3 -1
  121. package/dist/bigconsole/store/widgetStore.js.map +1 -1
  122. package/dist/bigconsole/utils/formDirty.d.ts +83 -0
  123. package/dist/bigconsole/utils/formDirty.d.ts.map +1 -0
  124. package/dist/bigconsole/utils/formDirty.js +23 -0
  125. package/dist/bigconsole/utils/formDirty.js.map +1 -0
  126. package/dist/bigconsole/utils/layoutBaseline.d.ts +131 -0
  127. package/dist/bigconsole/utils/layoutBaseline.d.ts.map +1 -0
  128. package/dist/bigconsole/utils/layoutBaseline.js +98 -0
  129. package/dist/bigconsole/utils/layoutBaseline.js.map +1 -0
  130. package/dist/translations/en.d.ts.map +1 -1
  131. package/package.json +1 -1
@@ -1,22 +1,22 @@
1
1
  import { BIGCONSOLE_PERMISSIONS as e } from "../../../../constants/permissions.js";
2
2
  import t, { themeChoiceFromPolicy as n } from "../../../hooks/useDashboardEmbedPolicy.js";
3
3
  import { useEffect as r, useMemo as i, useRef as a, useState as o } from "react";
4
- import { usePermissions as s } from "@burdenoff/fe-libs/shared/providers/shell";
4
+ import { usePermissions as ee } from "@burdenoff/fe-libs/shared/providers/shell";
5
+ import { useI18n as s } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
5
6
  import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
6
- import { useI18n as d } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
7
7
  //#region src/bigconsole/components/dashboard/ShareDialog/EmbedTab.tsx
8
- var f = [
8
+ var d = [
9
9
  "light",
10
10
  "dark",
11
11
  "auto"
12
12
  ];
13
- function ee(e, t) {
13
+ function te(e, t) {
14
14
  return t === "light" ? e : e.replace(/(?<=\s)src="([^"]*)"/, (e, n) => {
15
15
  let r = n.indexOf("#"), i = r === -1 ? n : n.slice(0, r), a = r === -1 ? "" : n.slice(r);
16
16
  return `src="${i}${i.includes("?") ? "&" : "?"}theme=${t}${a}"`;
17
17
  });
18
18
  }
19
- function te(e) {
19
+ function ne(e) {
20
20
  let t = e.trim();
21
21
  if (!t) return null;
22
22
  try {
@@ -26,44 +26,44 @@ function te(e) {
26
26
  return null;
27
27
  }
28
28
  }
29
- function p({ dashboardId: p, colors: m }) {
30
- let { t: h } = d(), { policy: g, secret: _, loading: v, error: y, fetchPolicy: b, publishToWeb: x, applyPresentation: ne, setAllowedOrigins: S, rotateKey: C, unpublish: w } = t(), { hasPermission: T } = s(), E = T(e.DASHBOARD_MANAGE_EMBED), [D, O] = o(""), [k, A] = o([]), [j, M] = o(!1), [N, P] = o(!1), [F, I] = o("light"), [L, R] = o(!1), [z, B] = o(!1), [V, H] = o(null), U = a(null), W = a(null);
29
+ function f({ dashboardId: f, colors: p }) {
30
+ let { t: m } = s(), { policy: h, secret: g, loading: _, error: v, fetchPolicy: y, publishToWeb: b, applyPresentation: x, setAllowedOrigins: S, rotateKey: C, unpublish: w } = t(), { hasPermission: T } = ee(), E = T(e.DASHBOARD_MANAGE_EMBED), [D, O] = o(""), [k, A] = o([]), [j, M] = o(!1), [N, P] = o(!1), [F, I] = o("light"), [L, R] = o(!1), [z, B] = o(!1), [V, H] = o(null), U = a(null), W = a(null);
31
31
  r(() => {
32
- p && b(p);
33
- }, [p, b]), r(() => {
34
- !g || U.current === g.id || (U.current = g.id, I(n(g.presentationTheme)), R(g.showDashboardTitle));
35
- }, [g]), r(() => () => {
32
+ f && y(f);
33
+ }, [f, y]), r(() => {
34
+ !h || U.current === h.id || (U.current = h.id, I(n(h.presentationTheme)), R(h.showDashboardTitle));
35
+ }, [h]), r(() => () => {
36
36
  W.current && clearTimeout(W.current);
37
37
  }, []);
38
- let G = g?.status === "ACTIVE", K = G ? g?.allowedParentOrigins ?? [] : k, q = i(() => _?.iframeSnippet ? ee(_.iframeSnippet, F) : null, [_, F]), J = () => {
38
+ let G = h?.status === "ACTIVE", K = G ? h?.allowedParentOrigins ?? [] : k, q = i(() => g?.iframeSnippet ? te(g.iframeSnippet, F) : null, [g, F]), J = () => {
39
39
  H(null);
40
- let e = te(D);
40
+ let e = ne(D);
41
41
  if (!e) {
42
- H(h("bigconsole.dashboards.embed.error.invalidOrigin", "Enter a valid https origin, e.g. https://example.com"));
42
+ H(m("bigconsole.dashboards.embed.error.invalidOrigin", "Enter a valid https origin, e.g. https://example.com"));
43
43
  return;
44
44
  }
45
45
  if (K.includes(e)) {
46
46
  O("");
47
47
  return;
48
48
  }
49
- G && g ? S(g.id, [...K, e]) : A((t) => [...t, e]), O("");
49
+ G && h ? S(h.id, [...K, e]) : A((t) => [...t, e]), O("");
50
50
  }, Y = (e) => {
51
- G && g ? S(g.id, K.filter((t) => t !== e)) : A((t) => t.filter((t) => t !== e));
51
+ G && h ? S(h.id, K.filter((t) => t !== e)) : A((t) => t.filter((t) => t !== e));
52
52
  }, X = async () => {
53
53
  if (H(null), k.length === 0) {
54
- H(h("bigconsole.dashboards.embed.error.noDomains", "Add at least one allowed website domain before publishing."));
54
+ H(m("bigconsole.dashboards.embed.error.noDomains", "Add at least one allowed website domain before publishing."));
55
55
  return;
56
56
  }
57
57
  if (!j) {
58
- H(h("bigconsole.dashboards.embed.error.notAttested", "Please confirm this dashboard is safe to be public."));
58
+ H(m("bigconsole.dashboards.embed.error.notAttested", "Please confirm this dashboard is safe to be public."));
59
59
  return;
60
60
  }
61
- await x(p, k, !0, {
61
+ await b(f, k, !0, {
62
62
  theme: F,
63
63
  showTitle: L
64
64
  });
65
65
  }, re = async () => {
66
- g && (H(null), await ne(g.id, {
66
+ h && (H(null), await x(h.id, {
67
67
  theme: F,
68
68
  showTitle: L
69
69
  }) && (B(!0), W.current && clearTimeout(W.current), W.current = setTimeout(() => B(!1), 1500)));
@@ -71,13 +71,13 @@ function p({ dashboardId: p, colors: m }) {
71
71
  try {
72
72
  await navigator.clipboard.writeText(e), P(!0), setTimeout(() => P(!1), 1500);
73
73
  } catch {
74
- H(h("bigconsole.dashboards.embed.error.copyFailed", "Could not copy — select and copy manually."));
74
+ H(m("bigconsole.dashboards.embed.error.copyFailed", "Could not copy — select and copy manually."));
75
75
  }
76
76
  }, Z = {
77
77
  padding: "8px 14px",
78
78
  borderRadius: "8px",
79
79
  border: "none",
80
- background: m.actionPrimaryBg,
80
+ background: p.actionPrimaryBg,
81
81
  color: "#fff",
82
82
  fontSize: "13px",
83
83
  fontWeight: 600,
@@ -85,25 +85,25 @@ function p({ dashboardId: p, colors: m }) {
85
85
  }, Q = {
86
86
  padding: "8px 14px",
87
87
  borderRadius: "8px",
88
- border: `1px solid ${m.borderDefault}`,
88
+ border: `1px solid ${p.borderDefault}`,
89
89
  background: "transparent",
90
- color: m.textPrimary,
90
+ color: p.textPrimary,
91
91
  fontSize: "13px",
92
92
  cursor: "pointer"
93
93
  }, ae = {
94
94
  flex: 1,
95
95
  padding: "8px 10px",
96
96
  borderRadius: "8px",
97
- border: `1px solid ${m.borderDefault}`,
98
- background: m.bgSecondary,
99
- color: m.textPrimary,
97
+ border: `1px solid ${p.borderDefault}`,
98
+ background: p.bgSecondary,
99
+ color: p.textPrimary,
100
100
  fontSize: "13px"
101
101
  }, oe = {
102
102
  padding: "4px 8px",
103
103
  borderRadius: "6px",
104
- border: `1px solid ${m.borderDefault}`,
105
- background: m.bgSecondary,
106
- color: m.textPrimary,
104
+ border: `1px solid ${p.borderDefault}`,
105
+ background: p.bgSecondary,
106
+ color: p.textPrimary,
107
107
  fontSize: "12px",
108
108
  cursor: "pointer"
109
109
  }, se = {
@@ -111,11 +111,11 @@ function p({ dashboardId: p, colors: m }) {
111
111
  gap: "8px",
112
112
  alignItems: "flex-start",
113
113
  fontSize: "12px",
114
- color: m.textSecondary
115
- }, ce = i(() => f.map((e) => ({
114
+ color: p.textSecondary
115
+ }, ce = i(() => d.map((e) => ({
116
116
  value: e,
117
- label: e === "light" ? h("bigconsole.dashboards.embed.theme.option.light", "Light") : e === "dark" ? h("bigconsole.dashboards.embed.theme.option.dark", "Dark") : h("bigconsole.dashboards.embed.theme.option.auto", "Auto (match viewer)")
118
- })), [h]), $ = /* @__PURE__ */ u("div", {
117
+ label: e === "light" ? m("bigconsole.dashboards.embed.theme.option.light", "Light") : e === "dark" ? m("bigconsole.dashboards.embed.theme.option.dark", "Dark") : m("bigconsole.dashboards.embed.theme.option.auto", "Auto (match viewer)")
118
+ })), [m]), $ = /* @__PURE__ */ u("div", {
119
119
  style: {
120
120
  display: "flex",
121
121
  flexDirection: "column",
@@ -132,9 +132,9 @@ function p({ dashboardId: p, colors: m }) {
132
132
  children: [/* @__PURE__ */ l("span", {
133
133
  style: {
134
134
  fontSize: "12px",
135
- color: m.textSecondary
135
+ color: p.textSecondary
136
136
  },
137
- children: h("bigconsole.dashboards.embed.theme.label", "Theme")
137
+ children: m("bigconsole.dashboards.embed.theme.label", "Theme")
138
138
  }), /* @__PURE__ */ l("select", {
139
139
  value: F,
140
140
  onChange: (e) => {
@@ -154,14 +154,14 @@ function p({ dashboardId: p, colors: m }) {
154
154
  type: "checkbox",
155
155
  checked: L,
156
156
  onChange: (e) => R(e.target.checked)
157
- }), /* @__PURE__ */ l("span", { children: h("bigconsole.dashboards.embed.presentation.showTitle", "Show the dashboard title as a header") })]
157
+ }), /* @__PURE__ */ l("span", { children: m("bigconsole.dashboards.embed.presentation.showTitle", "Show the dashboard title as a header") })]
158
158
  }),
159
159
  /* @__PURE__ */ l("div", {
160
160
  style: {
161
161
  fontSize: "11px",
162
- color: m.textTertiary
162
+ color: p.textTertiary
163
163
  },
164
- children: h("bigconsole.dashboards.embed.presentation.brandingNote", "Embeds always carry a “Powered by BigConsole” footer.")
164
+ children: m("bigconsole.dashboards.embed.presentation.brandingNote", "Embeds always carry a “Powered by BigConsole” footer.")
165
165
  })
166
166
  ]
167
167
  });
@@ -175,23 +175,23 @@ function p({ dashboardId: p, colors: m }) {
175
175
  justifyContent: "space-between",
176
176
  padding: "12px 14px",
177
177
  borderRadius: "10px",
178
- background: m.bgSecondary,
178
+ background: p.bgSecondary,
179
179
  marginBottom: "16px"
180
180
  },
181
181
  children: [/* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("div", {
182
182
  style: {
183
183
  fontSize: "14px",
184
184
  fontWeight: 600,
185
- color: m.textPrimary
185
+ color: p.textPrimary
186
186
  },
187
- children: h("bigconsole.dashboards.embed.heading", "Publish to the web")
187
+ children: m("bigconsole.dashboards.embed.heading", "Publish to the web")
188
188
  }), /* @__PURE__ */ l("div", {
189
189
  style: {
190
190
  fontSize: "12px",
191
- color: m.textSecondary,
191
+ color: p.textSecondary,
192
192
  marginTop: "2px"
193
193
  },
194
- children: G ? h("bigconsole.dashboards.embed.status.liveDescription", "This dashboard is live. Anyone with the link on an allowed website sees its live data.") : h("bigconsole.dashboards.embed.status.privateDescription", "Embed this dashboard on your website. Viewers see live data — no login required.")
194
+ children: G ? m("bigconsole.dashboards.embed.status.liveDescription", "This dashboard is live. Anyone with the link on an allowed website sees its live data.") : m("bigconsole.dashboards.embed.status.privateDescription", "Embed this dashboard on your website. Viewers see live data — no login required.")
195
195
  })] }), /* @__PURE__ */ l("span", {
196
196
  style: {
197
197
  fontSize: "11px",
@@ -199,9 +199,9 @@ function p({ dashboardId: p, colors: m }) {
199
199
  padding: "3px 8px",
200
200
  borderRadius: "999px",
201
201
  color: "#fff",
202
- background: G ? m.statusSuccessBg : m.textTertiary
202
+ background: G ? p.statusSuccessBg : p.textTertiary
203
203
  },
204
- children: G ? h("bigconsole.dashboards.embed.badge.published", "PUBLISHED") : h("bigconsole.dashboards.embed.badge.private", "PRIVATE")
204
+ children: G ? m("bigconsole.dashboards.embed.badge.published", "PUBLISHED") : m("bigconsole.dashboards.embed.badge.private", "PRIVATE")
205
205
  })]
206
206
  }),
207
207
  /* @__PURE__ */ u("div", {
@@ -211,10 +211,10 @@ function p({ dashboardId: p, colors: m }) {
211
211
  style: {
212
212
  fontSize: "12px",
213
213
  fontWeight: 600,
214
- color: m.textSecondary,
214
+ color: p.textSecondary,
215
215
  marginBottom: "6px"
216
216
  },
217
- children: h("bigconsole.dashboards.embed.domains.label", "Allowed website domains")
217
+ children: m("bigconsole.dashboards.embed.domains.label", "Allowed website domains")
218
218
  }),
219
219
  /* @__PURE__ */ u("div", {
220
220
  style: {
@@ -224,7 +224,7 @@ function p({ dashboardId: p, colors: m }) {
224
224
  },
225
225
  children: [/* @__PURE__ */ l("input", {
226
226
  style: ae,
227
- placeholder: h("bigconsole.dashboards.embed.domains.placeholder", "https://yoursite.com"),
227
+ placeholder: m("bigconsole.dashboards.embed.domains.placeholder", "https://yoursite.com"),
228
228
  value: D,
229
229
  onChange: (e) => O(e.target.value),
230
230
  onKeyDown: (e) => {
@@ -235,15 +235,15 @@ function p({ dashboardId: p, colors: m }) {
235
235
  onClick: J,
236
236
  type: "button",
237
237
  disabled: !E,
238
- children: h("bigconsole.dashboards.embed.domains.add", "Add")
238
+ children: m("bigconsole.dashboards.embed.domains.add", "Add")
239
239
  })]
240
240
  }),
241
241
  K.length === 0 ? /* @__PURE__ */ l("div", {
242
242
  style: {
243
243
  fontSize: "12px",
244
- color: m.textTertiary
244
+ color: p.textTertiary
245
245
  },
246
- children: h("bigconsole.dashboards.embed.domains.empty", "No domains yet. Only listed https domains may frame this dashboard.")
246
+ children: m("bigconsole.dashboards.embed.domains.empty", "No domains yet. Only listed https domains may frame this dashboard.")
247
247
  }) : /* @__PURE__ */ l("div", {
248
248
  style: {
249
249
  display: "flex",
@@ -257,23 +257,23 @@ function p({ dashboardId: p, colors: m }) {
257
257
  justifyContent: "space-between",
258
258
  padding: "6px 10px",
259
259
  borderRadius: "8px",
260
- background: m.bgTertiary
260
+ background: p.bgTertiary
261
261
  },
262
262
  children: [/* @__PURE__ */ l("span", {
263
263
  style: {
264
264
  fontSize: "13px",
265
- color: m.textPrimary
265
+ color: p.textPrimary
266
266
  },
267
267
  children: e
268
268
  }), E && /* @__PURE__ */ l("button", {
269
269
  style: {
270
270
  ...Q,
271
271
  padding: "2px 8px",
272
- color: m.statusErrorText
272
+ color: p.statusErrorText
273
273
  },
274
274
  onClick: () => Y(e),
275
275
  type: "button",
276
- children: h("bigconsole.dashboards.embed.domains.remove", "Remove")
276
+ children: m("bigconsole.dashboards.embed.domains.remove", "Remove")
277
277
  })]
278
278
  }, e))
279
279
  })
@@ -285,10 +285,10 @@ function p({ dashboardId: p, colors: m }) {
285
285
  style: {
286
286
  fontSize: "12px",
287
287
  fontWeight: 600,
288
- color: m.textSecondary,
288
+ color: p.textSecondary,
289
289
  marginBottom: "8px"
290
290
  },
291
- children: h("bigconsole.dashboards.embed.presentation.heading", "Presentation")
291
+ children: m("bigconsole.dashboards.embed.presentation.heading", "Presentation")
292
292
  }), $]
293
293
  }),
294
294
  !G && /* @__PURE__ */ u("div", {
@@ -307,16 +307,16 @@ function p({ dashboardId: p, colors: m }) {
307
307
  }), /* @__PURE__ */ l("span", {
308
308
  style: {
309
309
  fontSize: "12px",
310
- color: m.textSecondary
310
+ color: p.textSecondary
311
311
  },
312
- children: h("bigconsole.dashboards.embed.attestation", "I understand this makes the dashboard’s live data visible to anyone with the link, and I confirm it is safe to be public.")
312
+ children: m("bigconsole.dashboards.embed.attestation", "I understand this makes the dashboard’s live data visible to anyone with the link, and I confirm it is safe to be public.")
313
313
  })]
314
314
  }), /* @__PURE__ */ l("button", {
315
315
  style: Z,
316
316
  onClick: X,
317
- disabled: v || !E,
317
+ disabled: _ || !E,
318
318
  type: "button",
319
- children: v ? h("bigconsole.dashboards.embed.publishing", "Publishing…") : h("bigconsole.dashboards.embed.publish", "Publish to web")
319
+ children: _ ? m("bigconsole.dashboards.embed.publishing", "Publishing…") : m("bigconsole.dashboards.embed.publish", "Publish to web")
320
320
  })]
321
321
  }),
322
322
  G && /* @__PURE__ */ u(c, { children: [
@@ -329,9 +329,9 @@ function p({ dashboardId: p, colors: m }) {
329
329
  style: {
330
330
  fontSize: "12px",
331
331
  fontWeight: 600,
332
- color: m.textSecondary
332
+ color: p.textSecondary
333
333
  },
334
- children: h("bigconsole.dashboards.embed.snippet.label", "Embed snippet")
334
+ children: m("bigconsole.dashboards.embed.snippet.label", "Embed snippet")
335
335
  })
336
336
  }),
337
337
  /* @__PURE__ */ l("textarea", {
@@ -342,9 +342,9 @@ function p({ dashboardId: p, colors: m }) {
342
342
  minHeight: "96px",
343
343
  padding: "10px",
344
344
  borderRadius: "8px",
345
- border: `1px solid ${m.borderDefault}`,
346
- background: m.bgSecondary,
347
- color: m.textPrimary,
345
+ border: `1px solid ${p.borderDefault}`,
346
+ background: p.bgSecondary,
347
+ color: p.textPrimary,
348
348
  fontFamily: "monospace",
349
349
  fontSize: "12px",
350
350
  resize: "vertical"
@@ -357,19 +357,19 @@ function p({ dashboardId: p, colors: m }) {
357
357
  },
358
358
  onClick: () => ie(q),
359
359
  type: "button",
360
- children: N ? h("bigconsole.dashboards.embed.snippet.copied", "Copied ✓") : h("bigconsole.dashboards.embed.snippet.copy", "Copy snippet")
360
+ children: N ? m("bigconsole.dashboards.embed.snippet.copied", "Copied ✓") : m("bigconsole.dashboards.embed.snippet.copy", "Copy snippet")
361
361
  })
362
362
  ]
363
363
  }) : /* @__PURE__ */ l("div", {
364
364
  style: {
365
365
  fontSize: "12px",
366
- color: m.textSecondary,
367
- background: m.bgSecondary,
366
+ color: p.textSecondary,
367
+ background: p.bgSecondary,
368
368
  borderRadius: "8px",
369
369
  padding: "10px 12px",
370
370
  marginBottom: "16px"
371
371
  },
372
- children: h("bigconsole.dashboards.embed.snippet.alreadyActive", "The embed link is already active. For security the snippet (which contains the secret key) is only shown once at publish time — use {{rotateLabel}} to generate a fresh snippet.", { rotateLabel: h("bigconsole.dashboards.embed.rotate", "Rotate link") })
372
+ children: m("bigconsole.dashboards.embed.snippet.alreadyActive", "The embed link is already active. For security the snippet (which contains the secret key) is only shown once at publish time — use {{rotateLabel}} to generate a fresh snippet.", { rotateLabel: m("bigconsole.dashboards.embed.rotate", "Rotate link") })
373
373
  }),
374
374
  /* @__PURE__ */ u("div", {
375
375
  style: { marginBottom: "16px" },
@@ -378,10 +378,10 @@ function p({ dashboardId: p, colors: m }) {
378
378
  style: {
379
379
  fontSize: "12px",
380
380
  fontWeight: 600,
381
- color: m.textSecondary,
381
+ color: p.textSecondary,
382
382
  marginBottom: "8px"
383
383
  },
384
- children: h("bigconsole.dashboards.embed.presentation.heading", "Presentation")
384
+ children: m("bigconsole.dashboards.embed.presentation.heading", "Presentation")
385
385
  }),
386
386
  $,
387
387
  /* @__PURE__ */ u("div", {
@@ -394,24 +394,24 @@ function p({ dashboardId: p, colors: m }) {
394
394
  children: [/* @__PURE__ */ l("button", {
395
395
  style: Q,
396
396
  onClick: re,
397
- disabled: v || !E,
397
+ disabled: _ || !E,
398
398
  type: "button",
399
- children: v ? h("bigconsole.dashboards.embed.applying", "Applying…") : h("bigconsole.dashboards.embed.apply", "Apply changes")
399
+ children: _ ? m("bigconsole.dashboards.embed.applying", "Applying…") : m("bigconsole.dashboards.embed.apply", "Apply changes")
400
400
  }), z && /* @__PURE__ */ l("span", {
401
401
  style: {
402
402
  fontSize: "12px",
403
- color: m.textTertiary
403
+ color: p.textTertiary
404
404
  },
405
- children: h("bigconsole.dashboards.embed.updated", "Updated ✓")
405
+ children: m("bigconsole.dashboards.embed.updated", "Updated ✓")
406
406
  })]
407
407
  }),
408
408
  /* @__PURE__ */ l("div", {
409
409
  style: {
410
410
  fontSize: "11px",
411
- color: m.textTertiary,
411
+ color: p.textTertiary,
412
412
  marginTop: "6px"
413
413
  },
414
- children: h("bigconsole.dashboards.embed.presentation.applyHelp", "Changes apply to live embeds within a few seconds — no re-publish needed, and the embed link stays the same.")
414
+ children: m("bigconsole.dashboards.embed.presentation.applyHelp", "Changes apply to live embeds within a few seconds — no re-publish needed, and the embed link stays the same.")
415
415
  })
416
416
  ]
417
417
  }),
@@ -422,37 +422,37 @@ function p({ dashboardId: p, colors: m }) {
422
422
  },
423
423
  children: [/* @__PURE__ */ l("button", {
424
424
  style: Q,
425
- onClick: () => g && C(g.id),
426
- disabled: v,
425
+ onClick: () => h && C(h.id),
426
+ disabled: _,
427
427
  type: "button",
428
- children: h("bigconsole.dashboards.embed.rotate", "Rotate link")
428
+ children: m("bigconsole.dashboards.embed.rotate", "Rotate link")
429
429
  }), /* @__PURE__ */ l("button", {
430
430
  style: {
431
431
  ...Q,
432
- color: m.statusErrorText,
433
- borderColor: m.statusErrorText
432
+ color: p.statusErrorText,
433
+ borderColor: p.statusErrorText
434
434
  },
435
435
  onClick: () => {
436
- g && window.confirm(h("bigconsole.dashboards.embed.unpublishConfirm", "Unpublish this dashboard? The embed will stop working immediately for anyone using the link.")) && w(g.id);
436
+ h && window.confirm(m("bigconsole.dashboards.embed.unpublishConfirm", "Unpublish this dashboard? The embed will stop working immediately for anyone using the link.")) && w(h.id);
437
437
  },
438
- disabled: v,
438
+ disabled: _,
439
439
  type: "button",
440
- children: h("bigconsole.dashboards.embed.unpublish", "Unpublish")
440
+ children: m("bigconsole.dashboards.embed.unpublish", "Unpublish")
441
441
  })]
442
442
  })
443
443
  ] }),
444
- (V || y) && /* @__PURE__ */ l("div", {
444
+ (V || v) && /* @__PURE__ */ l("div", {
445
445
  style: {
446
446
  marginTop: "12px",
447
447
  fontSize: "12px",
448
- color: m.statusErrorText
448
+ color: p.statusErrorText
449
449
  },
450
- children: V ?? y?.message
450
+ children: V ?? v?.message
451
451
  })
452
452
  ]
453
453
  });
454
454
  }
455
455
  //#endregion
456
- export { p as default };
456
+ export { f as default };
457
457
 
458
458
  //# sourceMappingURL=EmbedTab.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmbedTab.js","names":[],"sources":["../../../../../src/bigconsole/components/dashboard/ShareDialog/EmbedTab.tsx"],"sourcesContent":["/**\n * EmbedTab — \"Publish to web\" section of the dashboard Share dialog.\n *\n * Owner-facing UI to publish a dashboard as an anonymous-link embed serving LIVE\n * data, manage the allowed parent domains, copy the iframe snippet, rotate the\n * link key, and unpublish. Backed by {@link useDashboardEmbedPolicy}; all\n * mutations are gateway-enforced by `@rbac(manage_embed)` (owner-only).\n *\n * Self-contained (inline styles driven by the dialog's `colors`) so it slots into\n * the existing hand-styled ShareDialog without a broader refactor.\n */\n\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { useDashboardEmbedPolicy, themeChoiceFromPolicy } from '../../../hooks/useDashboardEmbedPolicy';\nimport { BIGCONSOLE_PERMISSIONS } from '../../../../constants/permissions';\n\ninterface DialogColors {\n bgPrimary: string;\n bgSecondary: string;\n bgTertiary: string;\n textPrimary: string;\n textSecondary: string;\n textTertiary: string;\n borderDefault: string;\n actionPrimaryBg: string;\n actionPrimaryBgHover: string;\n statusSuccessBg: string;\n statusErrorText: string;\n}\n\nexport interface EmbedTabProps {\n dashboardId: string;\n colors: DialogColors;\n}\n\n/** Embed color-mode baked into the iframe URL (BOFF-5734). */\ntype EmbedSnippetTheme = 'light' | 'dark' | 'auto';\n\nconst THEME_OPTION_VALUES: ReadonlyArray<EmbedSnippetTheme> = ['light', 'dark', 'auto'];\n\n/**\n * Bake the chosen color mode into an iframe snippet by adding `?theme=` to its\n * `src` URL. `light` is the default and is left implicit so existing/plain\n * snippets stay unchanged. The secret `#key=` fragment is preserved untouched.\n *\n * Inserted via string splicing (before the fragment) rather than `URL`/\n * `URLSearchParams`, which re-serialize ALL params and could subtly re-encode\n * existing ones (e.g. `%20` → `+`). `theme` is a fixed enum, so no encoding is\n * needed; every other part of the URL is passed through byte-for-byte.\n */\nexport function withThemeInSnippet(snippet: string, theme: EmbedSnippetTheme): string {\n if (theme === 'light') return snippet;\n // Require whitespace before `src` so we match the real attribute, never a\n // substring like `data-src`/`srcdoc` (the snippet is backend-generated with\n // each attribute on its own indented line).\n return snippet.replace(/(?<=\\s)src=\"([^\"]*)\"/, (_match, url: string) => {\n const hashIdx = url.indexOf('#');\n const base = hashIdx === -1 ? url : url.slice(0, hashIdx);\n const fragment = hashIdx === -1 ? '' : url.slice(hashIdx);\n const sep = base.includes('?') ? '&' : '?';\n return `src=\"${base}${sep}theme=${theme}${fragment}\"`;\n });\n}\n\n/** Validate an exact https origin (matches the backend allowlist rules). */\nfunction normalizeOrigin(raw: string): string | null {\n const trimmed = raw.trim();\n if (!trimmed) return null;\n try {\n const url = new URL(trimmed);\n if (url.protocol !== 'https:') return null;\n if ((url.pathname !== '' && url.pathname !== '/') || url.search || url.hash) return null;\n return url.origin;\n } catch {\n return null;\n }\n}\n\nexport function EmbedTab({ dashboardId, colors }: EmbedTabProps) {\n const { t } = useI18n();\n const {\n policy,\n secret,\n loading,\n error,\n fetchPolicy,\n publishToWeb,\n applyPresentation,\n setAllowedOrigins,\n rotateKey,\n unpublish,\n } = useDashboardEmbedPolicy();\n\n // All embed policy mutations (publish, rotate, revoke, set-origins, apply\n // presentation) are gateway-enforced by `@rbac(manage_embed)`. Gate the UI on\n // the same permission so the controls degrade gracefully instead of erroring.\n const { hasPermission } = usePermissions();\n const canManageEmbed = hasPermission(BIGCONSOLE_PERMISSIONS.DASHBOARD_MANAGE_EMBED);\n\n const [domainInput, setDomainInput] = useState('');\n const [pendingDomains, setPendingDomains] = useState<string[]>([]);\n const [attested, setAttested] = useState(false);\n const [copied, setCopied] = useState(false);\n // Presentation options (BOFF-5735). Defaults mirror the backend column defaults\n // so a fresh publish captures a sensible look without extra clicks.\n const [theme, setTheme] = useState<EmbedSnippetTheme>('light');\n const [showTitle, setShowTitle] = useState(false);\n const [presentationSaved, setPresentationSaved] = useState(false);\n const [localError, setLocalError] = useState<string | null>(null);\n // Only seed the presentation controls once per policy identity — NOT on every\n // `policy` object change. Otherwise an unrelated mutation (e.g. adding a domain\n // via setAllowedOrigins) would return a fresh policy object and clobber the\n // owner's in-progress, not-yet-applied theme/title edits.\n const syncedPolicyIdRef = useRef<string | null>(null);\n const savedTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n if (dashboardId) fetchPolicy(dashboardId);\n }, [dashboardId, fetchPolicy]);\n\n // Reflect the persisted presentation the first time each policy loads.\n useEffect(() => {\n if (!policy || syncedPolicyIdRef.current === policy.id) return;\n syncedPolicyIdRef.current = policy.id;\n setTheme(themeChoiceFromPolicy(policy.presentationTheme));\n setShowTitle(policy.showDashboardTitle);\n }, [policy]);\n\n // Clear any pending \"Updated ✓\" timer on unmount.\n useEffect(\n () => () => {\n if (savedTimerRef.current) clearTimeout(savedTimerRef.current);\n },\n []\n );\n\n const isPublished = policy?.status === 'ACTIVE';\n const domains = isPublished ? (policy?.allowedParentOrigins ?? []) : pendingDomains;\n\n // The copyable iframe snippet: from the one-time secret if present (fresh\n // publish/rotate), else reconstructed from the locator for an already-published\n // policy (the fragment key is only available in the one-time secret).\n const iframeSnippet = useMemo(() => {\n if (secret?.iframeSnippet) return withThemeInSnippet(secret.iframeSnippet, theme);\n return null;\n }, [secret, theme]);\n\n const addDomain = () => {\n setLocalError(null);\n const origin = normalizeOrigin(domainInput);\n if (!origin) {\n setLocalError(\n t('bigconsole.dashboards.embed.error.invalidOrigin', 'Enter a valid https origin, e.g. https://example.com')\n );\n return;\n }\n if (domains.includes(origin)) {\n setDomainInput('');\n return;\n }\n if (isPublished && policy) {\n void setAllowedOrigins(policy.id, [...domains, origin]);\n } else {\n setPendingDomains((prev) => [...prev, origin]);\n }\n setDomainInput('');\n };\n\n const removeDomain = (origin: string) => {\n if (isPublished && policy) {\n void setAllowedOrigins(\n policy.id,\n domains.filter((d) => d !== origin)\n );\n } else {\n setPendingDomains((prev) => prev.filter((d) => d !== origin));\n }\n };\n\n const handlePublish = async () => {\n setLocalError(null);\n if (pendingDomains.length === 0) {\n setLocalError(\n t('bigconsole.dashboards.embed.error.noDomains', 'Add at least one allowed website domain before publishing.')\n );\n return;\n }\n if (!attested) {\n setLocalError(\n t('bigconsole.dashboards.embed.error.notAttested', 'Please confirm this dashboard is safe to be public.')\n );\n return;\n }\n await publishToWeb(dashboardId, pendingDomains, true, { theme, showTitle });\n };\n\n const handleApplyPresentation = async () => {\n if (!policy) return;\n setLocalError(null);\n const updated = await applyPresentation(policy.id, { theme, showTitle });\n if (updated) {\n setPresentationSaved(true);\n // Clear any in-flight timer so rapid re-clicks don't hide the confirmation early.\n if (savedTimerRef.current) clearTimeout(savedTimerRef.current);\n savedTimerRef.current = setTimeout(() => setPresentationSaved(false), 1500);\n }\n };\n\n const handleCopy = async (text: string) => {\n try {\n await navigator.clipboard.writeText(text);\n setCopied(true);\n setTimeout(() => setCopied(false), 1500);\n } catch {\n setLocalError(t('bigconsole.dashboards.embed.error.copyFailed', 'Could not copy — select and copy manually.'));\n }\n };\n\n const primaryBtn: React.CSSProperties = {\n padding: '8px 14px',\n borderRadius: '8px',\n border: 'none',\n background: colors.actionPrimaryBg,\n color: '#fff',\n fontSize: '13px',\n fontWeight: 600,\n cursor: 'pointer',\n };\n const ghostBtn: React.CSSProperties = {\n padding: '8px 14px',\n borderRadius: '8px',\n border: `1px solid ${colors.borderDefault}`,\n background: 'transparent',\n color: colors.textPrimary,\n fontSize: '13px',\n cursor: 'pointer',\n };\n const inputStyle: React.CSSProperties = {\n flex: 1,\n padding: '8px 10px',\n borderRadius: '8px',\n border: `1px solid ${colors.borderDefault}`,\n background: colors.bgSecondary,\n color: colors.textPrimary,\n fontSize: '13px',\n };\n const selectStyle: React.CSSProperties = {\n padding: '4px 8px',\n borderRadius: '6px',\n border: `1px solid ${colors.borderDefault}`,\n background: colors.bgSecondary,\n color: colors.textPrimary,\n fontSize: '12px',\n cursor: 'pointer',\n };\n const toggleRow: React.CSSProperties = {\n display: 'flex',\n gap: '8px',\n alignItems: 'flex-start',\n fontSize: '12px',\n color: colors.textSecondary,\n };\n\n const themeOptions = useMemo(\n () =>\n THEME_OPTION_VALUES.map((value) => ({\n value,\n label:\n value === 'light'\n ? t('bigconsole.dashboards.embed.theme.option.light', 'Light')\n : value === 'dark'\n ? t('bigconsole.dashboards.embed.theme.option.dark', 'Dark')\n : t('bigconsole.dashboards.embed.theme.option.auto', 'Auto (match viewer)'),\n })),\n [t]\n );\n\n // Presentation controls (BOFF-5735) — shared by the pre-publish and published\n // states. Local state drives both the persisted policy and the snippet `?theme=`.\n // Branding is not a control: every embed carries the \"Powered by BigConsole\"\n // footer (no white-labelling), so the owner only sees a static note about it.\n const presentationControls = (\n <div style={{ display: 'flex', flexDirection: 'column', gap: '10px' }}>\n <label style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: '8px' }}>\n <span style={{ fontSize: '12px', color: colors.textSecondary }}>\n {t('bigconsole.dashboards.embed.theme.label', 'Theme')}\n </span>\n <select\n value={theme}\n onChange={(e) => {\n // The options are fixed, but narrow instead of casting so an\n // unexpected value can never slip into state.\n const value = e.target.value;\n if (value === 'light' || value === 'dark' || value === 'auto') {\n setTheme(value);\n }\n }}\n style={selectStyle}\n >\n {themeOptions.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </select>\n </label>\n <label style={toggleRow}>\n <input type=\"checkbox\" checked={showTitle} onChange={(e) => setShowTitle(e.target.checked)} />\n <span>{t('bigconsole.dashboards.embed.presentation.showTitle', 'Show the dashboard title as a header')}</span>\n </label>\n <div style={{ fontSize: '11px', color: colors.textTertiary }}>\n {t(\n 'bigconsole.dashboards.embed.presentation.brandingNote',\n 'Embeds always carry a “Powered by BigConsole” footer.'\n )}\n </div>\n </div>\n );\n\n return (\n <div style={{ padding: '20px 24px' }}>\n {/* Status banner */}\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n padding: '12px 14px',\n borderRadius: '10px',\n background: colors.bgSecondary,\n marginBottom: '16px',\n }}\n >\n <div>\n <div style={{ fontSize: '14px', fontWeight: 600, color: colors.textPrimary }}>\n {t('bigconsole.dashboards.embed.heading', 'Publish to the web')}\n </div>\n <div style={{ fontSize: '12px', color: colors.textSecondary, marginTop: '2px' }}>\n {isPublished\n ? t(\n 'bigconsole.dashboards.embed.status.liveDescription',\n 'This dashboard is live. Anyone with the link on an allowed website sees its live data.'\n )\n : t(\n 'bigconsole.dashboards.embed.status.privateDescription',\n 'Embed this dashboard on your website. Viewers see live data — no login required.'\n )}\n </div>\n </div>\n <span\n style={{\n fontSize: '11px',\n fontWeight: 700,\n padding: '3px 8px',\n borderRadius: '999px',\n color: '#fff',\n background: isPublished ? colors.statusSuccessBg : colors.textTertiary,\n }}\n >\n {isPublished\n ? t('bigconsole.dashboards.embed.badge.published', 'PUBLISHED')\n : t('bigconsole.dashboards.embed.badge.private', 'PRIVATE')}\n </span>\n </div>\n\n {/* Allowed domains */}\n <div style={{ marginBottom: '16px' }}>\n <div style={{ fontSize: '12px', fontWeight: 600, color: colors.textSecondary, marginBottom: '6px' }}>\n {t('bigconsole.dashboards.embed.domains.label', 'Allowed website domains')}\n </div>\n <div style={{ display: 'flex', gap: '8px', marginBottom: '8px' }}>\n <input\n style={inputStyle}\n placeholder={t('bigconsole.dashboards.embed.domains.placeholder', 'https://yoursite.com')}\n value={domainInput}\n onChange={(e) => setDomainInput(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') addDomain();\n }}\n />\n <button style={ghostBtn} onClick={addDomain} type=\"button\" disabled={!canManageEmbed}>\n {t('bigconsole.dashboards.embed.domains.add', 'Add')}\n </button>\n </div>\n {domains.length === 0 ? (\n <div style={{ fontSize: '12px', color: colors.textTertiary }}>\n {t(\n 'bigconsole.dashboards.embed.domains.empty',\n 'No domains yet. Only listed https domains may frame this dashboard.'\n )}\n </div>\n ) : (\n <div style={{ display: 'flex', flexDirection: 'column', gap: '6px' }}>\n {domains.map((d) => (\n <div\n key={d}\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n padding: '6px 10px',\n borderRadius: '8px',\n background: colors.bgTertiary,\n }}\n >\n <span style={{ fontSize: '13px', color: colors.textPrimary }}>{d}</span>\n {canManageEmbed && (\n <button\n style={{ ...ghostBtn, padding: '2px 8px', color: colors.statusErrorText }}\n onClick={() => removeDomain(d)}\n type=\"button\"\n >\n {t('bigconsole.dashboards.embed.domains.remove', 'Remove')}\n </button>\n )}\n </div>\n ))}\n </div>\n )}\n </div>\n\n {/* Presentation (unpublished — captured into the publish) */}\n {!isPublished && (\n <div style={{ marginBottom: '16px' }}>\n <div style={{ fontSize: '12px', fontWeight: 600, color: colors.textSecondary, marginBottom: '8px' }}>\n {t('bigconsole.dashboards.embed.presentation.heading', 'Presentation')}\n </div>\n {presentationControls}\n </div>\n )}\n\n {/* Publish CTA (unpublished) */}\n {!isPublished && (\n <div style={{ marginBottom: '8px' }}>\n <label style={{ display: 'flex', gap: '8px', alignItems: 'flex-start', marginBottom: '12px' }}>\n <input type=\"checkbox\" checked={attested} onChange={(e) => setAttested(e.target.checked)} />\n <span style={{ fontSize: '12px', color: colors.textSecondary }}>\n {t(\n 'bigconsole.dashboards.embed.attestation',\n 'I understand this makes the dashboard’s live data visible to anyone with the link, and I confirm it is safe to be public.'\n )}\n </span>\n </label>\n <button style={primaryBtn} onClick={handlePublish} disabled={loading || !canManageEmbed} type=\"button\">\n {loading\n ? t('bigconsole.dashboards.embed.publishing', 'Publishing…')\n : t('bigconsole.dashboards.embed.publish', 'Publish to web')}\n </button>\n </div>\n )}\n\n {/* Embed snippet + management (published) */}\n {isPublished && (\n <>\n {iframeSnippet ? (\n <div style={{ marginBottom: '16px' }}>\n <div style={{ marginBottom: '6px' }}>\n <span style={{ fontSize: '12px', fontWeight: 600, color: colors.textSecondary }}>\n {t('bigconsole.dashboards.embed.snippet.label', 'Embed snippet')}\n </span>\n </div>\n <textarea\n readOnly\n value={iframeSnippet}\n style={{\n width: '100%',\n minHeight: '96px',\n padding: '10px',\n borderRadius: '8px',\n border: `1px solid ${colors.borderDefault}`,\n background: colors.bgSecondary,\n color: colors.textPrimary,\n fontFamily: 'monospace',\n fontSize: '12px',\n resize: 'vertical',\n }}\n />\n <button style={{ ...ghostBtn, marginTop: '8px' }} onClick={() => handleCopy(iframeSnippet)} type=\"button\">\n {copied\n ? t('bigconsole.dashboards.embed.snippet.copied', 'Copied ✓')\n : t('bigconsole.dashboards.embed.snippet.copy', 'Copy snippet')}\n </button>\n </div>\n ) : (\n <div\n style={{\n fontSize: '12px',\n color: colors.textSecondary,\n background: colors.bgSecondary,\n borderRadius: '8px',\n padding: '10px 12px',\n marginBottom: '16px',\n }}\n >\n {t(\n 'bigconsole.dashboards.embed.snippet.alreadyActive',\n 'The embed link is already active. For security the snippet (which contains the secret key) is only shown once at publish time — use {{rotateLabel}} to generate a fresh snippet.',\n { rotateLabel: t('bigconsole.dashboards.embed.rotate', 'Rotate link') }\n )}\n </div>\n )}\n\n {/* Presentation (published — persisted + re-published to take effect) */}\n <div style={{ marginBottom: '16px' }}>\n <div style={{ fontSize: '12px', fontWeight: 600, color: colors.textSecondary, marginBottom: '8px' }}>\n {t('bigconsole.dashboards.embed.presentation.heading', 'Presentation')}\n </div>\n {presentationControls}\n <div style={{ display: 'flex', alignItems: 'center', gap: '10px', marginTop: '10px' }}>\n <button\n style={ghostBtn}\n onClick={handleApplyPresentation}\n disabled={loading || !canManageEmbed}\n type=\"button\"\n >\n {loading\n ? t('bigconsole.dashboards.embed.applying', 'Applying…')\n : t('bigconsole.dashboards.embed.apply', 'Apply changes')}\n </button>\n {presentationSaved && (\n <span style={{ fontSize: '12px', color: colors.textTertiary }}>\n {t('bigconsole.dashboards.embed.updated', 'Updated ✓')}\n </span>\n )}\n </div>\n <div style={{ fontSize: '11px', color: colors.textTertiary, marginTop: '6px' }}>\n {t(\n 'bigconsole.dashboards.embed.presentation.applyHelp',\n 'Changes apply to live embeds within a few seconds — no re-publish needed, and the embed link stays the same.'\n )}\n </div>\n </div>\n\n {/* Rotate/Unpublish are destructive management actions — hide entirely\n when the caller can't manage the embed. */}\n {canManageEmbed && (\n <div style={{ display: 'flex', gap: '8px' }}>\n <button style={ghostBtn} onClick={() => policy && rotateKey(policy.id)} disabled={loading} type=\"button\">\n {t('bigconsole.dashboards.embed.rotate', 'Rotate link')}\n </button>\n <button\n style={{ ...ghostBtn, color: colors.statusErrorText, borderColor: colors.statusErrorText }}\n onClick={() => {\n if (\n policy &&\n window.confirm(\n t(\n 'bigconsole.dashboards.embed.unpublishConfirm',\n 'Unpublish this dashboard? The embed will stop working immediately for anyone using the link.'\n )\n )\n ) {\n void unpublish(policy.id);\n }\n }}\n disabled={loading}\n type=\"button\"\n >\n {t('bigconsole.dashboards.embed.unpublish', 'Unpublish')}\n </button>\n </div>\n )}\n </>\n )}\n\n {(localError || error) && (\n <div style={{ marginTop: '12px', fontSize: '12px', color: colors.statusErrorText }}>\n {localError ?? error?.message}\n </div>\n )}\n </div>\n );\n}\n\nexport default EmbedTab;\n"],"mappings":";;;;;;;AAwCA,IAAM,IAAwD;CAAC;CAAS;CAAQ;CAAO;AAYvF,SAAgB,GAAmB,GAAiB,GAAkC;AAKpF,QAJI,MAAU,UAAgB,IAIvB,EAAQ,QAAQ,yBAAyB,GAAQ,MAAgB;EACtE,IAAM,IAAU,EAAI,QAAQ,IAAI,EAC1B,IAAO,MAAY,KAAK,IAAM,EAAI,MAAM,GAAG,EAAQ,EACnD,IAAW,MA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E,OAAO;OAAE,GAAG;OAAU,OAAO,EAAO;OAAiB,aAAa,EAAO;OAAiB;MAC1F,eAAe;AACb,OACE,KACA,OAAO,QACL,EACE,gDACA,+FACD,CACF,IAEI,EAAU,EAAO,GAAG;;MAG7B,UAAU;MACV,MAAK;gBAEJ,EAAE,yCAAyC,YAAY;MACjD,CAAA,CACL;;IAEP,EAAA,CAAA;IAGH,KAAc,MACd,kBAAC,OAAD;IAAK,OAAO;KAAE,WAAW;KAAQ,UAAU;KAAQ,OAAO,EAAO;KAAiB;cAC/E,KAAc,GAAO;IAClB,CAAA;GAEJ"}
1
+ {"version":3,"file":"EmbedTab.js","names":[],"sources":["../../../../../src/bigconsole/components/dashboard/ShareDialog/EmbedTab.tsx"],"sourcesContent":["/**\n * EmbedTab — \"Publish to web\" section of the dashboard Share dialog.\n *\n * Owner-facing UI to publish a dashboard as an anonymous-link embed serving LIVE\n * data, manage the allowed parent domains, copy the iframe snippet, rotate the\n * link key, and unpublish. Backed by {@link useDashboardEmbedPolicy}; all\n * mutations are gateway-enforced by `@rbac(manage_embed)` (owner-only).\n *\n * Self-contained (inline styles driven by the dialog's `colors`) so it slots into\n * the existing hand-styled ShareDialog without a broader refactor.\n */\n\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { useDashboardEmbedPolicy, themeChoiceFromPolicy } from '../../../hooks/useDashboardEmbedPolicy';\nimport { BIGCONSOLE_PERMISSIONS } from '../../../../constants/permissions';\n\ninterface DialogColors {\n bgPrimary: string;\n bgSecondary: string;\n bgTertiary: string;\n textPrimary: string;\n textSecondary: string;\n textTertiary: string;\n borderDefault: string;\n actionPrimaryBg: string;\n actionPrimaryBgHover: string;\n statusSuccessBg: string;\n statusErrorText: string;\n}\n\nexport interface EmbedTabProps {\n dashboardId: string;\n colors: DialogColors;\n}\n\n/** Embed color-mode baked into the iframe URL (BOFF-5734). */\ntype EmbedSnippetTheme = 'light' | 'dark' | 'auto';\n\nconst THEME_OPTION_VALUES: ReadonlyArray<EmbedSnippetTheme> = ['light', 'dark', 'auto'];\n\n/**\n * Bake the chosen color mode into an iframe snippet by adding `?theme=` to its\n * `src` URL. `light` is the default and is left implicit so existing/plain\n * snippets stay unchanged. The secret `#key=` fragment is preserved untouched.\n *\n * Inserted via string splicing (before the fragment) rather than `URL`/\n * `URLSearchParams`, which re-serialize ALL params and could subtly re-encode\n * existing ones (e.g. `%20` → `+`). `theme` is a fixed enum, so no encoding is\n * needed; every other part of the URL is passed through byte-for-byte.\n */\nexport function withThemeInSnippet(snippet: string, theme: EmbedSnippetTheme): string {\n if (theme === 'light') return snippet;\n // Require whitespace before `src` so we match the real attribute, never a\n // substring like `data-src`/`srcdoc` (the snippet is backend-generated with\n // each attribute on its own indented line).\n return snippet.replace(/(?<=\\s)src=\"([^\"]*)\"/, (_match, url: string) => {\n const hashIdx = url.indexOf('#');\n const base = hashIdx === -1 ? url : url.slice(0, hashIdx);\n const fragment = hashIdx === -1 ? '' : url.slice(hashIdx);\n const sep = base.includes('?') ? '&' : '?';\n return `src=\"${base}${sep}theme=${theme}${fragment}\"`;\n });\n}\n\n/** Validate an exact https origin (matches the backend allowlist rules). */\nfunction normalizeOrigin(raw: string): string | null {\n const trimmed = raw.trim();\n if (!trimmed) return null;\n try {\n const url = new URL(trimmed);\n if (url.protocol !== 'https:') return null;\n if ((url.pathname !== '' && url.pathname !== '/') || url.search || url.hash) return null;\n return url.origin;\n } catch {\n return null;\n }\n}\n\nexport function EmbedTab({ dashboardId, colors }: EmbedTabProps) {\n const { t } = useI18n();\n const {\n policy,\n secret,\n loading,\n error,\n fetchPolicy,\n publishToWeb,\n applyPresentation,\n setAllowedOrigins,\n rotateKey,\n unpublish,\n } = useDashboardEmbedPolicy();\n\n // All embed policy mutations (publish, rotate, revoke, set-origins, apply\n // presentation) are gateway-enforced by `@rbac(manage_embed)`. Gate the UI on\n // the same permission so the controls degrade gracefully instead of erroring.\n const { hasPermission } = usePermissions();\n const canManageEmbed = hasPermission(BIGCONSOLE_PERMISSIONS.DASHBOARD_MANAGE_EMBED);\n\n const [domainInput, setDomainInput] = useState('');\n const [pendingDomains, setPendingDomains] = useState<string[]>([]);\n const [attested, setAttested] = useState(false);\n const [copied, setCopied] = useState(false);\n // Presentation options (BOFF-5735). Defaults mirror the backend column defaults\n // so a fresh publish captures a sensible look without extra clicks.\n const [theme, setTheme] = useState<EmbedSnippetTheme>('light');\n const [showTitle, setShowTitle] = useState(false);\n const [presentationSaved, setPresentationSaved] = useState(false);\n const [localError, setLocalError] = useState<string | null>(null);\n // Only seed the presentation controls once per policy identity — NOT on every\n // `policy` object change. Otherwise an unrelated mutation (e.g. adding a domain\n // via setAllowedOrigins) would return a fresh policy object and clobber the\n // owner's in-progress, not-yet-applied theme/title edits.\n const syncedPolicyIdRef = useRef<string | null>(null);\n const savedTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n if (dashboardId) fetchPolicy(dashboardId);\n }, [dashboardId, fetchPolicy]);\n\n // Reflect the persisted presentation the first time each policy loads.\n useEffect(() => {\n if (!policy || syncedPolicyIdRef.current === policy.id) return;\n syncedPolicyIdRef.current = policy.id;\n setTheme(themeChoiceFromPolicy(policy.presentationTheme));\n setShowTitle(policy.showDashboardTitle);\n }, [policy]);\n\n // Clear any pending \"Updated ✓\" timer on unmount.\n useEffect(\n () => () => {\n if (savedTimerRef.current) clearTimeout(savedTimerRef.current);\n },\n []\n );\n\n const isPublished = policy?.status === 'ACTIVE';\n const domains = isPublished ? (policy?.allowedParentOrigins ?? []) : pendingDomains;\n\n // The copyable iframe snippet: from the one-time secret if present (fresh\n // publish/rotate), else reconstructed from the locator for an already-published\n // policy (the fragment key is only available in the one-time secret).\n const iframeSnippet = useMemo(() => {\n if (secret?.iframeSnippet) return withThemeInSnippet(secret.iframeSnippet, theme);\n return null;\n }, [secret, theme]);\n\n const addDomain = () => {\n setLocalError(null);\n const origin = normalizeOrigin(domainInput);\n if (!origin) {\n setLocalError(\n t('bigconsole.dashboards.embed.error.invalidOrigin', 'Enter a valid https origin, e.g. https://example.com')\n );\n return;\n }\n if (domains.includes(origin)) {\n setDomainInput('');\n return;\n }\n if (isPublished && policy) {\n void setAllowedOrigins(policy.id, [...domains, origin]);\n } else {\n setPendingDomains((prev) => [...prev, origin]);\n }\n setDomainInput('');\n };\n\n const removeDomain = (origin: string) => {\n if (isPublished && policy) {\n void setAllowedOrigins(\n policy.id,\n domains.filter((d) => d !== origin)\n );\n } else {\n setPendingDomains((prev) => prev.filter((d) => d !== origin));\n }\n };\n\n const handlePublish = async () => {\n setLocalError(null);\n if (pendingDomains.length === 0) {\n setLocalError(\n t('bigconsole.dashboards.embed.error.noDomains', 'Add at least one allowed website domain before publishing.')\n );\n return;\n }\n if (!attested) {\n setLocalError(\n t('bigconsole.dashboards.embed.error.notAttested', 'Please confirm this dashboard is safe to be public.')\n );\n return;\n }\n await publishToWeb(dashboardId, pendingDomains, true, { theme, showTitle });\n };\n\n const handleApplyPresentation = async () => {\n if (!policy) return;\n setLocalError(null);\n const updated = await applyPresentation(policy.id, { theme, showTitle });\n if (updated) {\n setPresentationSaved(true);\n // Clear any in-flight timer so rapid re-clicks don't hide the confirmation early.\n if (savedTimerRef.current) clearTimeout(savedTimerRef.current);\n savedTimerRef.current = setTimeout(() => setPresentationSaved(false), 1500);\n }\n };\n\n const handleCopy = async (text: string) => {\n try {\n await navigator.clipboard.writeText(text);\n setCopied(true);\n setTimeout(() => setCopied(false), 1500);\n } catch {\n setLocalError(t('bigconsole.dashboards.embed.error.copyFailed', 'Could not copy — select and copy manually.'));\n }\n };\n\n const primaryBtn: React.CSSProperties = {\n padding: '8px 14px',\n borderRadius: '8px',\n border: 'none',\n background: colors.actionPrimaryBg,\n color: '#fff',\n fontSize: '13px',\n fontWeight: 600,\n cursor: 'pointer',\n };\n const ghostBtn: React.CSSProperties = {\n padding: '8px 14px',\n borderRadius: '8px',\n border: `1px solid ${colors.borderDefault}`,\n background: 'transparent',\n color: colors.textPrimary,\n fontSize: '13px',\n cursor: 'pointer',\n };\n const inputStyle: React.CSSProperties = {\n flex: 1,\n padding: '8px 10px',\n borderRadius: '8px',\n border: `1px solid ${colors.borderDefault}`,\n background: colors.bgSecondary,\n color: colors.textPrimary,\n fontSize: '13px',\n };\n const selectStyle: React.CSSProperties = {\n padding: '4px 8px',\n borderRadius: '6px',\n border: `1px solid ${colors.borderDefault}`,\n background: colors.bgSecondary,\n color: colors.textPrimary,\n fontSize: '12px',\n cursor: 'pointer',\n };\n const toggleRow: React.CSSProperties = {\n display: 'flex',\n gap: '8px',\n alignItems: 'flex-start',\n fontSize: '12px',\n color: colors.textSecondary,\n };\n\n const themeOptions = useMemo(\n () =>\n THEME_OPTION_VALUES.map((value) => ({\n value,\n label:\n value === 'light'\n ? t('bigconsole.dashboards.embed.theme.option.light', 'Light')\n : value === 'dark'\n ? t('bigconsole.dashboards.embed.theme.option.dark', 'Dark')\n : t('bigconsole.dashboards.embed.theme.option.auto', 'Auto (match viewer)'),\n })),\n [t]\n );\n\n // Presentation controls (BOFF-5735) — shared by the pre-publish and published\n // states. Local state drives both the persisted policy and the snippet `?theme=`.\n // Branding is not a control: every embed carries the \"Powered by BigConsole\"\n // footer (no white-labelling), so the owner only sees a static note about it.\n const presentationControls = (\n <div style={{ display: 'flex', flexDirection: 'column', gap: '10px' }}>\n <label style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: '8px' }}>\n <span style={{ fontSize: '12px', color: colors.textSecondary }}>\n {t('bigconsole.dashboards.embed.theme.label', 'Theme')}\n </span>\n <select\n value={theme}\n onChange={(e) => {\n // The options are fixed, but narrow instead of casting so an\n // unexpected value can never slip into state.\n const value = e.target.value;\n if (value === 'light' || value === 'dark' || value === 'auto') {\n setTheme(value);\n }\n }}\n style={selectStyle}\n >\n {themeOptions.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </select>\n </label>\n <label style={toggleRow}>\n <input type=\"checkbox\" checked={showTitle} onChange={(e) => setShowTitle(e.target.checked)} />\n <span>{t('bigconsole.dashboards.embed.presentation.showTitle', 'Show the dashboard title as a header')}</span>\n </label>\n <div style={{ fontSize: '11px', color: colors.textTertiary }}>\n {t(\n 'bigconsole.dashboards.embed.presentation.brandingNote',\n 'Embeds always carry a “Powered by BigConsole” footer.'\n )}\n </div>\n </div>\n );\n\n return (\n <div style={{ padding: '20px 24px' }}>\n {/* Status banner */}\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n padding: '12px 14px',\n borderRadius: '10px',\n background: colors.bgSecondary,\n marginBottom: '16px',\n }}\n >\n <div>\n <div style={{ fontSize: '14px', fontWeight: 600, color: colors.textPrimary }}>\n {t('bigconsole.dashboards.embed.heading', 'Publish to the web')}\n </div>\n <div style={{ fontSize: '12px', color: colors.textSecondary, marginTop: '2px' }}>\n {isPublished\n ? t(\n 'bigconsole.dashboards.embed.status.liveDescription',\n 'This dashboard is live. Anyone with the link on an allowed website sees its live data.'\n )\n : t(\n 'bigconsole.dashboards.embed.status.privateDescription',\n 'Embed this dashboard on your website. Viewers see live data — no login required.'\n )}\n </div>\n </div>\n <span\n style={{\n fontSize: '11px',\n fontWeight: 700,\n padding: '3px 8px',\n borderRadius: '999px',\n color: '#fff',\n background: isPublished ? colors.statusSuccessBg : colors.textTertiary,\n }}\n >\n {isPublished\n ? t('bigconsole.dashboards.embed.badge.published', 'PUBLISHED')\n : t('bigconsole.dashboards.embed.badge.private', 'PRIVATE')}\n </span>\n </div>\n\n {/* Allowed domains */}\n <div style={{ marginBottom: '16px' }}>\n <div style={{ fontSize: '12px', fontWeight: 600, color: colors.textSecondary, marginBottom: '6px' }}>\n {t('bigconsole.dashboards.embed.domains.label', 'Allowed website domains')}\n </div>\n <div style={{ display: 'flex', gap: '8px', marginBottom: '8px' }}>\n <input\n style={inputStyle}\n placeholder={t('bigconsole.dashboards.embed.domains.placeholder', 'https://yoursite.com')}\n value={domainInput}\n onChange={(e) => setDomainInput(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') addDomain();\n }}\n />\n <button style={ghostBtn} onClick={addDomain} type=\"button\" disabled={!canManageEmbed}>\n {t('bigconsole.dashboards.embed.domains.add', 'Add')}\n </button>\n </div>\n {domains.length === 0 ? (\n <div style={{ fontSize: '12px', color: colors.textTertiary }}>\n {t(\n 'bigconsole.dashboards.embed.domains.empty',\n 'No domains yet. Only listed https domains may frame this dashboard.'\n )}\n </div>\n ) : (\n <div style={{ display: 'flex', flexDirection: 'column', gap: '6px' }}>\n {domains.map((d) => (\n <div\n key={d}\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n padding: '6px 10px',\n borderRadius: '8px',\n background: colors.bgTertiary,\n }}\n >\n <span style={{ fontSize: '13px', color: colors.textPrimary }}>{d}</span>\n {canManageEmbed && (\n <button\n style={{ ...ghostBtn, padding: '2px 8px', color: colors.statusErrorText }}\n onClick={() => removeDomain(d)}\n type=\"button\"\n >\n {t('bigconsole.dashboards.embed.domains.remove', 'Remove')}\n </button>\n )}\n </div>\n ))}\n </div>\n )}\n </div>\n\n {/* Presentation (unpublished — captured into the publish) */}\n {!isPublished && (\n <div style={{ marginBottom: '16px' }}>\n <div style={{ fontSize: '12px', fontWeight: 600, color: colors.textSecondary, marginBottom: '8px' }}>\n {t('bigconsole.dashboards.embed.presentation.heading', 'Presentation')}\n </div>\n {presentationControls}\n </div>\n )}\n\n {/* Publish CTA (unpublished) */}\n {!isPublished && (\n <div style={{ marginBottom: '8px' }}>\n <label style={{ display: 'flex', gap: '8px', alignItems: 'flex-start', marginBottom: '12px' }}>\n <input type=\"checkbox\" checked={attested} onChange={(e) => setAttested(e.target.checked)} />\n <span style={{ fontSize: '12px', color: colors.textSecondary }}>\n {t(\n 'bigconsole.dashboards.embed.attestation',\n 'I understand this makes the dashboard’s live data visible to anyone with the link, and I confirm it is safe to be public.'\n )}\n </span>\n </label>\n <button style={primaryBtn} onClick={handlePublish} disabled={loading || !canManageEmbed} type=\"button\">\n {loading\n ? t('bigconsole.dashboards.embed.publishing', 'Publishing…')\n : t('bigconsole.dashboards.embed.publish', 'Publish to web')}\n </button>\n </div>\n )}\n\n {/* Embed snippet + management (published) */}\n {isPublished && (\n <>\n {iframeSnippet ? (\n <div style={{ marginBottom: '16px' }}>\n <div style={{ marginBottom: '6px' }}>\n <span style={{ fontSize: '12px', fontWeight: 600, color: colors.textSecondary }}>\n {t('bigconsole.dashboards.embed.snippet.label', 'Embed snippet')}\n </span>\n </div>\n <textarea\n readOnly\n value={iframeSnippet}\n style={{\n width: '100%',\n minHeight: '96px',\n padding: '10px',\n borderRadius: '8px',\n border: `1px solid ${colors.borderDefault}`,\n background: colors.bgSecondary,\n color: colors.textPrimary,\n fontFamily: 'monospace',\n fontSize: '12px',\n resize: 'vertical',\n }}\n />\n <button style={{ ...ghostBtn, marginTop: '8px' }} onClick={() => handleCopy(iframeSnippet)} type=\"button\">\n {copied\n ? t('bigconsole.dashboards.embed.snippet.copied', 'Copied ✓')\n : t('bigconsole.dashboards.embed.snippet.copy', 'Copy snippet')}\n </button>\n </div>\n ) : (\n <div\n style={{\n fontSize: '12px',\n color: colors.textSecondary,\n background: colors.bgSecondary,\n borderRadius: '8px',\n padding: '10px 12px',\n marginBottom: '16px',\n }}\n >\n {t(\n 'bigconsole.dashboards.embed.snippet.alreadyActive',\n 'The embed link is already active. For security the snippet (which contains the secret key) is only shown once at publish time — use {{rotateLabel}} to generate a fresh snippet.',\n { rotateLabel: t('bigconsole.dashboards.embed.rotate', 'Rotate link') }\n )}\n </div>\n )}\n\n {/* Presentation (published — persisted + re-published to take effect) */}\n <div style={{ marginBottom: '16px' }}>\n <div style={{ fontSize: '12px', fontWeight: 600, color: colors.textSecondary, marginBottom: '8px' }}>\n {t('bigconsole.dashboards.embed.presentation.heading', 'Presentation')}\n </div>\n {presentationControls}\n <div style={{ display: 'flex', alignItems: 'center', gap: '10px', marginTop: '10px' }}>\n <button\n style={ghostBtn}\n onClick={handleApplyPresentation}\n disabled={loading || !canManageEmbed}\n type=\"button\"\n >\n {loading\n ? t('bigconsole.dashboards.embed.applying', 'Applying…')\n : t('bigconsole.dashboards.embed.apply', 'Apply changes')}\n </button>\n {presentationSaved && (\n <span style={{ fontSize: '12px', color: colors.textTertiary }}>\n {t('bigconsole.dashboards.embed.updated', 'Updated ✓')}\n </span>\n )}\n </div>\n <div style={{ fontSize: '11px', color: colors.textTertiary, marginTop: '6px' }}>\n {t(\n 'bigconsole.dashboards.embed.presentation.applyHelp',\n 'Changes apply to live embeds within a few seconds — no re-publish needed, and the embed link stays the same.'\n )}\n </div>\n </div>\n\n {/* Rotate/Unpublish are destructive management actions — hide entirely\n when the caller can't manage the embed. */}\n {canManageEmbed && (\n <div style={{ display: 'flex', gap: '8px' }}>\n <button style={ghostBtn} onClick={() => policy && rotateKey(policy.id)} disabled={loading} type=\"button\">\n {t('bigconsole.dashboards.embed.rotate', 'Rotate link')}\n </button>\n <button\n style={{ ...ghostBtn, color: colors.statusErrorText, borderColor: colors.statusErrorText }}\n onClick={() => {\n if (\n policy &&\n window.confirm(\n t(\n 'bigconsole.dashboards.embed.unpublishConfirm',\n 'Unpublish this dashboard? The embed will stop working immediately for anyone using the link.'\n )\n )\n ) {\n void unpublish(policy.id);\n }\n }}\n disabled={loading}\n type=\"button\"\n >\n {t('bigconsole.dashboards.embed.unpublish', 'Unpublish')}\n </button>\n </div>\n )}\n </>\n )}\n\n {(localError || error) && (\n <div style={{ marginTop: '12px', fontSize: '12px', color: colors.statusErrorText }}>\n {localError ?? error?.message}\n </div>\n )}\n </div>\n );\n}\n\nexport default EmbedTab;\n"],"mappings":";;;;;;;AAwCA,IAAM,IAAwD;CAAC;CAAS;CAAQ;CAAO;AAYvF,SAAgB,GAAmB,GAAiB,GAAkC;AAKpF,QAJI,MAAU,UAAgB,IAIvB,EAAQ,QAAQ,y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