@burdenoff/microfe-bigconsole 2026.1011.10 → 2026.1012.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.
- package/README.md +19 -0
- package/dist/bigconsole/BigConsoleRoot.js +88 -82
- package/dist/bigconsole/BigConsoleRoutes.js +163 -136
- package/dist/bigconsole/assistant/assistantProduct.js +1 -4
- package/dist/bigconsole/assistant/pageContext.d.ts +0 -14
- package/dist/bigconsole/assistant/pageContext.js +1 -6
- package/dist/bigconsole/assistant/recordAdapters.js +26 -27
- package/dist/bigconsole/components/builder/inspector/DataBindingSection.js +31 -31
- package/dist/bigconsole/components/common/index.d.ts +0 -1
- package/dist/bigconsole/components/common/index.js +0 -1
- package/dist/bigconsole/components/dashboard/CreateDashboardDialog.js +44 -44
- package/dist/bigconsole/components/dashboard/DashboardCanvas.js +36 -36
- package/dist/bigconsole/components/dashboard/DashboardToolbar.js +59 -59
- package/dist/bigconsole/components/dashboard/DrilldownBreadcrumb.js +58 -57
- package/dist/bigconsole/components/dashboard/GlobalFiltersBar/FilterChip.js +30 -30
- package/dist/bigconsole/components/dashboard/GlobalFiltersBar/FilterEditor.js +41 -41
- package/dist/bigconsole/components/dashboard/GlobalFiltersBar/FilterPresetSelector.js +34 -34
- package/dist/bigconsole/components/dashboard/GlobalFiltersBar/GlobalFiltersBar.js +34 -34
- package/dist/bigconsole/components/dashboard/ImportDashboardDialog.js +110 -110
- package/dist/bigconsole/components/dashboard/PublishToStoreDialog.js +21 -21
- package/dist/bigconsole/components/dashboard/SavedViewsDropdown/SavedViewsDropdown.js +46 -46
- package/dist/bigconsole/components/dashboard/ShareDialog/EmbedTab.js +164 -173
- package/dist/bigconsole/components/dashboard/ShareDialog/ShareDialog.js +101 -101
- package/dist/bigconsole/components/dashboard/TemplateInstallOptions.js +31 -31
- package/dist/bigconsole/components/dashboard/TemplateLayoutPreview.js +15 -15
- package/dist/bigconsole/components/dashboard/TemplatePicker/TemplatePicker.js +1 -1
- package/dist/bigconsole/components/dashboard/WidgetPalette.js +165 -163
- package/dist/bigconsole/components/datasink/AlertExecutionHistory.js +37 -37
- package/dist/bigconsole/components/datasink/AlertRuleEditor.js +66 -66
- package/dist/bigconsole/components/datasink/CacheTTLSelector.js +35 -35
- package/dist/bigconsole/components/datasink/DataSinkCard.js +50 -51
- package/dist/bigconsole/components/datasink/DataSinkDeleteDialog.js +18 -18
- package/dist/bigconsole/components/datasink/DataSinkRefreshDialog.js +20 -20
- package/dist/bigconsole/components/datasink/ImportDataGuideDialog.js +47 -47
- package/dist/bigconsole/components/datasink/ImportDataSinkDialog.js +91 -91
- package/dist/bigconsole/components/datasink/RefreshTypeSelector.js +35 -35
- package/dist/bigconsole/components/parser/DataSinkSelector.js +40 -40
- package/dist/bigconsole/components/parser/ImportParserDialog.js +120 -120
- package/dist/bigconsole/components/parser/ParserSelector.js +51 -51
- package/dist/bigconsole/components/pipeline/PipelineScopePicker.js +10 -10
- package/dist/bigconsole/components/preview/AiPreviewMiniPanel.js +76 -77
- package/dist/bigconsole/components/preview/AiPreviewPanel.js +95 -96
- package/dist/bigconsole/components/widgets/ActionConfigDialog.js +4 -4
- package/dist/bigconsole/components/widgets/DrilldownConfigPanel.js +93 -93
- package/dist/bigconsole/components/widgets/PropertiesPanel.js +499 -507
- package/dist/bigconsole/components/widgets/WidgetRegistry.js +0 -1
- package/dist/bigconsole/components/widgets/calendar/CalendarWidget.js +4 -4
- package/dist/bigconsole/components/widgets/chart/ChartConfig.js +48 -48
- package/dist/bigconsole/components/widgets/comments/WidgetComments.js +46 -46
- package/dist/bigconsole/components/widgets/custom/CustomWidget.js +73 -131
- package/dist/bigconsole/components/widgets/event-logs/EventLogViewer.js +61 -61
- package/dist/bigconsole/components/widgets/form/FormWidget.js +36 -36
- package/dist/bigconsole/components/widgets/gauge/GaugeConfig.js +42 -42
- package/dist/bigconsole/components/widgets/heatmap/HeatmapConfig.js +25 -25
- package/dist/bigconsole/components/widgets/iframe-widget/IframeWidget.d.ts +28 -9
- package/dist/bigconsole/components/widgets/iframe-widget/IframeWidget.js +115 -42
- package/dist/bigconsole/components/widgets/iframe-widget/framePolicy.d.ts +20 -0
- package/dist/bigconsole/components/widgets/iframe-widget/framePolicy.js +10 -0
- package/dist/bigconsole/components/widgets/iframe-widget/index.d.ts +2 -1
- package/dist/bigconsole/components/widgets/iframe-widget/index.js +3 -2
- package/dist/bigconsole/components/widgets/kanban/KanbanWidget.js +4 -4
- package/dist/bigconsole/components/widgets/list/ListConfig.js +30 -30
- package/dist/bigconsole/components/widgets/metric-card/MetricCardConfig.js +38 -38
- package/dist/bigconsole/components/widgets/metric-card/SparklineChart.js +9 -9
- package/dist/bigconsole/components/widgets/metric-card/TrendIndicator.js +9 -9
- package/dist/bigconsole/components/widgets/pivot-table/PivotTableWidget.js +49 -49
- package/dist/bigconsole/components/widgets/progress/ProgressConfig.js +39 -39
- package/dist/bigconsole/components/widgets/table/TableConfig.js +73 -73
- package/dist/bigconsole/components/widgets/text-widget/TextWidget.js +110 -27
- package/dist/bigconsole/components/widgets/text-widget/textData.d.ts +6 -0
- package/dist/bigconsole/components/widgets/text-widget/textData.js +17 -14
- package/dist/bigconsole/components/widgets/webhook-config/WebhookConfigPanel.js +64 -64
- package/dist/bigconsole/components/workflow/WorkflowOpenGuard.js +15 -15
- package/dist/bigconsole/components/workflow/WorkflowSinkLinkForm.js +15 -15
- package/dist/bigconsole/context/BigConsoleContext.d.ts +10 -0
- package/dist/bigconsole/context/BigConsoleContext.js +47 -30
- package/dist/bigconsole/context/index.d.ts +1 -1
- package/dist/bigconsole/customWidget/CustomWidgetBuilderSheet.js +58 -49
- package/dist/bigconsole/customWidget/CustomWidgetProposalPanel.js +74 -72
- package/dist/bigconsole/customWidget/proposalPreview.d.ts +5 -0
- package/dist/bigconsole/customWidget/proposalPreview.js +31 -0
- package/dist/bigconsole/hooks/useDataSinkAlerts.d.ts +0 -23
- package/dist/bigconsole/hooks/useDataSinkAlerts.js +113 -138
- package/dist/bigconsole/hooks/useDataSinkOperations.d.ts +7 -0
- package/dist/bigconsole/hooks/useDataSinkOperations.js +109 -98
- package/dist/bigconsole/hooks/useDataSinkSubscription.js +0 -1
- package/dist/bigconsole/hooks/useDrilldown.js +68 -67
- package/dist/bigconsole/hooks/useExportDataSink.js +1 -1
- package/dist/bigconsole/hooks/useGlobalFilters.js +3 -3
- package/dist/bigconsole/hooks/useImportDataSink.js +102 -90
- package/dist/bigconsole/pages/AdminPage.js +130 -130
- package/dist/bigconsole/pages/DashboardBuilderPage.js +60 -72
- package/dist/bigconsole/pages/DashboardViewPage.js +235 -258
- package/dist/bigconsole/pages/DashboardsPage.js +221 -269
- package/dist/bigconsole/pages/DataParsersPage.js +157 -180
- package/dist/bigconsole/pages/DataSinkAlertsPage.js +55 -62
- package/dist/bigconsole/pages/DataSinkBuilderPage.js +318 -295
- package/dist/bigconsole/pages/DataSinkViewPage.js +256 -255
- package/dist/bigconsole/pages/DataSinksPage.js +216 -251
- package/dist/bigconsole/pages/DataSourcesPage.js +5 -5
- package/dist/bigconsole/pages/InsightsPage.js +265 -279
- package/dist/bigconsole/pages/OverviewPage.js +47 -47
- package/dist/bigconsole/pages/ParserBuilderPage.js +213 -229
- package/dist/bigconsole/pages/ParserViewPage.js +97 -97
- package/dist/bigconsole/pages/PipelineBuilderPage.js +214 -256
- package/dist/bigconsole/pages/PipelineViewPage.js +146 -146
- package/dist/bigconsole/pages/PipelinesPage.js +88 -107
- package/dist/bigconsole/pages/SettingsPage.js +173 -179
- package/dist/bigconsole/pages/WidgetDemoPage.js +42 -42
- package/dist/bigconsole/pages/WorkflowViewPage.js +1 -1
- package/dist/bigconsole/pages/WorkflowsPage.js +141 -141
- package/dist/bigconsole/providers/BigConsoleQuotaProvider.js +12 -12
- package/dist/bigconsole/renderers/adapters/AdaptiveCardRenderer.js +235 -122
- package/dist/bigconsole/renderers/adapters/BlockKitRenderer.d.ts +6 -1
- package/dist/bigconsole/renderers/adapters/BlockKitRenderer.js +151 -151
- package/dist/bigconsole/renderers/adapters/CustomRenderer.js +46 -46
- package/dist/bigconsole/renderers/adapters/adaptiveCardContent.d.ts +29 -0
- package/dist/bigconsole/renderers/adapters/adaptiveCardContent.js +51 -0
- package/dist/bigconsole/store/widgetStore.d.ts +0 -12
- package/dist/bigconsole/store/widgetStore.js +1 -3
- package/dist/bigconsole/types/index.d.ts +17 -2
- package/dist/bigconsole/utils/backendError.d.ts +0 -18
- package/dist/bigconsole/utils/dataSinkPayload.d.ts +48 -0
- package/dist/bigconsole/utils/dataSinkPayload.js +38 -0
- package/dist/bigconsole/utils/index.d.ts +2 -0
- package/dist/bigconsole/utils/safeUrl.d.ts +79 -0
- package/dist/bigconsole/utils/safeUrl.js +93 -0
- package/dist/bigconsole/utils/sanitizeHtml.d.ts +16 -0
- package/dist/bigconsole/utils/sanitizeHtml.js +67 -0
- package/dist/bigconsole/workflowOpen.js +14 -15
- package/dist/generated/wspace-operations.d.ts +138 -8
- package/dist/generated/wspace-operations.js +281 -240
- package/dist/node_modules/dompurify/dist/purify.es.js +800 -0
- package/package.json +9 -5
- package/dist/bigconsole/assistant/displayCopy.d.ts +0 -32
- package/dist/bigconsole/assistant/pageControls.d.ts +0 -81
- package/dist/bigconsole/assistant/pageControls.js +0 -169
- package/dist/bigconsole/assistant/previewControl.d.ts +0 -16
- package/dist/bigconsole/assistant/previewControl.js +0 -10
- package/dist/bigconsole/assistant/usePreviewControl.d.ts +0 -2
- package/dist/bigconsole/assistant/usePreviewControl.js +0 -20
- package/dist/bigconsole/components/common/SortBySelect.d.ts +0 -11
- package/dist/bigconsole/components/common/SortBySelect.js +0 -29
- package/dist/bigconsole/constants/backendErrors.js +0 -94
- package/dist/bigconsole/hooks/useDashboardLayoutBaseline.d.ts +0 -14
- package/dist/bigconsole/hooks/useDashboardLayoutBaseline.js +0 -32
- package/dist/bigconsole/utils/backendError.js +0 -42
- package/dist/bigconsole/utils/dashboardList.d.ts +0 -28
- package/dist/bigconsole/utils/dashboardList.js +0 -15
- package/dist/bigconsole/utils/dataSinkList.d.ts +0 -15
- package/dist/bigconsole/utils/dataSinkList.js +0 -15
- package/dist/bigconsole/utils/formDirty.d.ts +0 -82
- package/dist/bigconsole/utils/formDirty.js +0 -21
- package/dist/bigconsole/utils/insightsDraft.d.ts +0 -29
- package/dist/bigconsole/utils/insightsDraft.js +0 -8
- package/dist/bigconsole/utils/layoutBaseline.d.ts +0 -130
- package/dist/bigconsole/utils/layoutBaseline.js +0 -96
- package/dist/bigconsole/utils/listSort.d.ts +0 -80
- package/dist/bigconsole/utils/listSort.js +0 -85
- package/dist/bigconsole/utils/widgetFormDirty.d.ts +0 -16
- package/dist/bigconsole/utils/widgetFormDirty.js +0 -13
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { memo as e, useMemo as t } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
3
|
+
import { useI18n as i } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
4
4
|
//#region src/bigconsole/renderers/adapters/CustomRenderer.tsx
|
|
5
5
|
var a = /* @__PURE__ */ new Map();
|
|
6
6
|
function o(e, t) {
|
|
@@ -13,77 +13,77 @@ function c() {
|
|
|
13
13
|
return Array.from(a.keys());
|
|
14
14
|
}
|
|
15
15
|
o("SimpleText", ({ data: e, props: t }) => {
|
|
16
|
-
let { t:
|
|
17
|
-
return a ? /* @__PURE__ */
|
|
16
|
+
let { t: r } = i(), a = e.text || t?.text, o = t?.align || "left";
|
|
17
|
+
return a ? /* @__PURE__ */ n("div", {
|
|
18
18
|
className: `p-4 text-${o}`,
|
|
19
|
-
children: /* @__PURE__ */
|
|
19
|
+
children: /* @__PURE__ */ n("p", {
|
|
20
20
|
className: "text-primary",
|
|
21
21
|
children: a
|
|
22
22
|
})
|
|
23
|
-
}) : /* @__PURE__ */
|
|
23
|
+
}) : /* @__PURE__ */ n("div", {
|
|
24
24
|
className: "flex items-center justify-center h-full p-4 text-secondary",
|
|
25
|
-
children: /* @__PURE__ */
|
|
25
|
+
children: /* @__PURE__ */ n("p", {
|
|
26
26
|
className: "text-sm",
|
|
27
|
-
children:
|
|
27
|
+
children: r("bigconsole.widget.renderer.custom.noData", "No data available")
|
|
28
28
|
})
|
|
29
29
|
});
|
|
30
30
|
}), o("Counter", ({ data: e, props: t }) => {
|
|
31
|
-
let { t: a } =
|
|
32
|
-
if (o == null) return /* @__PURE__ */
|
|
31
|
+
let { t: a } = i(), o = e.value ?? t?.value, s = e.label || t?.label, c = t?.format || "number";
|
|
32
|
+
if (o == null) return /* @__PURE__ */ n("div", {
|
|
33
33
|
className: "flex flex-col items-center justify-center h-full p-4 text-secondary",
|
|
34
|
-
children: /* @__PURE__ */
|
|
34
|
+
children: /* @__PURE__ */ n("p", {
|
|
35
35
|
className: "text-sm",
|
|
36
36
|
children: a("bigconsole.widget.renderer.custom.noData", "No data available")
|
|
37
37
|
})
|
|
38
38
|
});
|
|
39
39
|
let l = o;
|
|
40
|
-
return /* @__PURE__ */
|
|
40
|
+
return /* @__PURE__ */ r("div", {
|
|
41
41
|
className: "flex flex-col items-center justify-center h-full p-4 animate-in fade-in duration-200",
|
|
42
|
-
children: [/* @__PURE__ */
|
|
42
|
+
children: [/* @__PURE__ */ n("span", {
|
|
43
43
|
className: "text-3xl font-bold text-primary",
|
|
44
44
|
children: c === "currency" ? new Intl.NumberFormat("en-US", {
|
|
45
45
|
style: "currency",
|
|
46
46
|
currency: "USD"
|
|
47
47
|
}).format(l) : c === "percent" ? `${(l * 100).toFixed(1)}%` : new Intl.NumberFormat().format(l)
|
|
48
|
-
}), s && /* @__PURE__ */
|
|
48
|
+
}), s && /* @__PURE__ */ n("span", {
|
|
49
49
|
className: "text-sm text-secondary mt-1",
|
|
50
50
|
children: s
|
|
51
51
|
})]
|
|
52
52
|
});
|
|
53
53
|
}), o("Card", ({ data: e, props: t, onAction: a }) => {
|
|
54
|
-
let { t: o } =
|
|
55
|
-
if (!s && !c) return /* @__PURE__ */
|
|
54
|
+
let { t: o } = i(), s = e.title || t?.title, c = e.description || t?.description || "";
|
|
55
|
+
if (!s && !c) return /* @__PURE__ */ n("div", {
|
|
56
56
|
className: "flex items-center justify-center h-full p-4 text-secondary",
|
|
57
|
-
children: /* @__PURE__ */
|
|
57
|
+
children: /* @__PURE__ */ n("p", {
|
|
58
58
|
className: "text-sm",
|
|
59
59
|
children: o("bigconsole.widget.renderer.custom.noData", "No data available")
|
|
60
60
|
})
|
|
61
61
|
});
|
|
62
62
|
let l = e.image || t?.image, u = t?.actionLabel || o("bigconsole.widget.renderer.custom.viewDetails", "View Details"), d = t?.showAction !== !1;
|
|
63
|
-
return /* @__PURE__ */
|
|
63
|
+
return /* @__PURE__ */ r("div", {
|
|
64
64
|
className: "flex flex-col h-full bg-surface rounded-lg overflow-hidden animate-in fade-in duration-200",
|
|
65
65
|
children: [
|
|
66
|
-
l && /* @__PURE__ */
|
|
66
|
+
l && /* @__PURE__ */ n("div", {
|
|
67
67
|
className: "aspect-video bg-bg-sunken",
|
|
68
|
-
children: /* @__PURE__ */
|
|
68
|
+
children: /* @__PURE__ */ n("img", {
|
|
69
69
|
src: l,
|
|
70
70
|
alt: "",
|
|
71
71
|
className: "w-full h-full object-cover"
|
|
72
72
|
})
|
|
73
73
|
}),
|
|
74
|
-
/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */ r("div", {
|
|
75
75
|
className: "flex-1 p-4",
|
|
76
|
-
children: [s && /* @__PURE__ */
|
|
76
|
+
children: [s && /* @__PURE__ */ n("h3", {
|
|
77
77
|
className: "text-lg font-semibold text-primary",
|
|
78
78
|
children: s
|
|
79
|
-
}), c && /* @__PURE__ */
|
|
79
|
+
}), c && /* @__PURE__ */ n("p", {
|
|
80
80
|
className: "text-sm text-secondary mt-1",
|
|
81
81
|
children: c
|
|
82
82
|
})]
|
|
83
83
|
}),
|
|
84
|
-
d && /* @__PURE__ */
|
|
84
|
+
d && /* @__PURE__ */ n("div", {
|
|
85
85
|
className: "p-4 pt-0",
|
|
86
|
-
children: /* @__PURE__ */
|
|
86
|
+
children: /* @__PURE__ */ n("button", {
|
|
87
87
|
type: "button",
|
|
88
88
|
onClick: () => a?.("click", { title: s }),
|
|
89
89
|
className: "w-full px-4 py-2 text-sm font-medium text-white bg-action-primary hover:bg-action-primary/90 rounded-md transition-colors",
|
|
@@ -94,25 +94,25 @@ o("SimpleText", ({ data: e, props: t }) => {
|
|
|
94
94
|
});
|
|
95
95
|
});
|
|
96
96
|
var l = ({ componentName: e }) => {
|
|
97
|
-
let { t } =
|
|
98
|
-
return /* @__PURE__ */
|
|
97
|
+
let { t } = i();
|
|
98
|
+
return /* @__PURE__ */ n("div", {
|
|
99
99
|
className: "flex flex-col items-center justify-center h-full p-4 text-secondary animate-in fade-in duration-200",
|
|
100
|
-
children: /* @__PURE__ */
|
|
100
|
+
children: /* @__PURE__ */ r("div", {
|
|
101
101
|
className: "text-center",
|
|
102
102
|
children: [
|
|
103
|
-
/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ n("p", {
|
|
104
104
|
className: "font-medium",
|
|
105
105
|
children: t("bigconsole.widget.renderer.custom.componentNotFound", "Component Not Found")
|
|
106
106
|
}),
|
|
107
|
-
/* @__PURE__ */
|
|
107
|
+
/* @__PURE__ */ n("p", {
|
|
108
108
|
className: "text-sm mt-1",
|
|
109
109
|
children: t("bigconsole.widget.renderer.custom.componentNotRegistered", "Component \"{{name}}\" is not registered", { name: e ?? "" })
|
|
110
110
|
}),
|
|
111
|
-
/* @__PURE__ */
|
|
111
|
+
/* @__PURE__ */ r("div", {
|
|
112
112
|
className: "mt-4 text-xs",
|
|
113
|
-
children: [/* @__PURE__ */
|
|
113
|
+
children: [/* @__PURE__ */ n("p", { children: t("bigconsole.widget.renderer.custom.availableComponents", "Available components:") }), /* @__PURE__ */ n("ul", {
|
|
114
114
|
className: "mt-1",
|
|
115
|
-
children: c().map((e) => /* @__PURE__ */
|
|
115
|
+
children: c().map((e) => /* @__PURE__ */ n("li", {
|
|
116
116
|
className: "text-link",
|
|
117
117
|
children: e
|
|
118
118
|
}, e))
|
|
@@ -122,44 +122,44 @@ var l = ({ componentName: e }) => {
|
|
|
122
122
|
})
|
|
123
123
|
});
|
|
124
124
|
}, u = e(function({ widget: e, data: a, template: o, isLoading: c, error: u, onDrilldown: d, onAction: f }) {
|
|
125
|
-
let { t: p } =
|
|
125
|
+
let { t: p } = i(), m = t(() => {
|
|
126
126
|
if (o && typeof o == "object" && "componentName" in o) return o.componentName;
|
|
127
127
|
let t = e.config;
|
|
128
128
|
return t?.componentName || t?.componentId || "";
|
|
129
129
|
}, [o, e.config]), h = t(() => o && typeof o == "object" && "props" in o ? o.props : {}, [o]), g = t(() => m ? s(m) : null, [m]);
|
|
130
|
-
return c ? /* @__PURE__ */
|
|
130
|
+
return c ? /* @__PURE__ */ n("div", {
|
|
131
131
|
className: "flex items-center justify-center h-full p-4 animate-in fade-in duration-200",
|
|
132
|
-
children: /* @__PURE__ */
|
|
132
|
+
children: /* @__PURE__ */ r("div", {
|
|
133
133
|
className: "animate-pulse space-y-2 w-full",
|
|
134
|
-
children: [/* @__PURE__ */
|
|
134
|
+
children: [/* @__PURE__ */ n("div", { className: "h-4 bg-bg-sunken rounded w-3/4" }), /* @__PURE__ */ n("div", { className: "h-4 bg-bg-sunken rounded w-1/2" })]
|
|
135
135
|
})
|
|
136
|
-
}) : u ? /* @__PURE__ */
|
|
136
|
+
}) : u ? /* @__PURE__ */ n("div", {
|
|
137
137
|
className: "flex items-center justify-center h-full p-4 text-red-600 dark:text-red-400",
|
|
138
|
-
children: /* @__PURE__ */
|
|
138
|
+
children: /* @__PURE__ */ r("div", {
|
|
139
139
|
className: "text-center",
|
|
140
|
-
children: [/* @__PURE__ */
|
|
140
|
+
children: [/* @__PURE__ */ n("p", {
|
|
141
141
|
className: "font-medium",
|
|
142
142
|
children: p("bigconsole.widget.renderer.custom.errorRendering", "Error rendering component")
|
|
143
|
-
}), /* @__PURE__ */
|
|
143
|
+
}), /* @__PURE__ */ n("p", {
|
|
144
144
|
className: "text-sm mt-1",
|
|
145
145
|
children: u
|
|
146
146
|
})]
|
|
147
147
|
})
|
|
148
|
-
}) : m ? g ? /* @__PURE__ */
|
|
148
|
+
}) : m ? g ? /* @__PURE__ */ n(g, {
|
|
149
149
|
widget: e,
|
|
150
150
|
data: a,
|
|
151
151
|
template: o,
|
|
152
152
|
props: h,
|
|
153
153
|
onAction: f,
|
|
154
154
|
onDrilldown: d
|
|
155
|
-
}) : /* @__PURE__ */
|
|
155
|
+
}) : /* @__PURE__ */ n(l, { componentName: m }) : /* @__PURE__ */ n("div", {
|
|
156
156
|
className: "flex items-center justify-center h-full p-4 text-secondary animate-in fade-in duration-200",
|
|
157
|
-
children: /* @__PURE__ */
|
|
157
|
+
children: /* @__PURE__ */ r("div", {
|
|
158
158
|
className: "text-center",
|
|
159
|
-
children: [/* @__PURE__ */
|
|
159
|
+
children: [/* @__PURE__ */ n("p", {
|
|
160
160
|
className: "font-medium",
|
|
161
161
|
children: p("bigconsole.widget.renderer.custom.noComponentSpecified", "No Component Specified")
|
|
162
|
-
}), /* @__PURE__ */
|
|
162
|
+
}), /* @__PURE__ */ n("p", {
|
|
163
163
|
className: "text-sm mt-1",
|
|
164
164
|
children: p("bigconsole.widget.renderer.custom.setComponentName", "Set componentName in template or widget config")
|
|
165
165
|
})]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SafeHrefOptions } from '../../utils/safeUrl';
|
|
2
|
+
import { HtmlSanitizer } from '../../utils/sanitizeHtml';
|
|
3
|
+
|
|
4
|
+
/** Links and URL actions in cards: https/http and mailto. */
|
|
5
|
+
export declare const CARD_LINK_POLICY: SafeHrefOptions;
|
|
6
|
+
/** CSS classes for markdown output; styled by the renderer's stylesheet. */
|
|
7
|
+
export declare const CARD_MARKDOWN_CODE_CLASS = "ac-md-code";
|
|
8
|
+
export declare const CARD_MARKDOWN_LINK_CLASS = "ac-md-link";
|
|
9
|
+
/**
|
|
10
|
+
* Convert the markdown subset supported in card text (`**bold**`, `*italic*`,
|
|
11
|
+
* `` `code` ``, `[label](url)` and line breaks) to sanitised HTML.
|
|
12
|
+
*
|
|
13
|
+
* Code spans and links are swapped for placeholders before emphasis is applied
|
|
14
|
+
* so their contents are never reformatted. Links whose destination fails
|
|
15
|
+
* {@link CARD_LINK_POLICY} are rendered as their label only.
|
|
16
|
+
*/
|
|
17
|
+
export declare function processCardMarkdown(text: string, sanitize?: HtmlSanitizer): string;
|
|
18
|
+
/**
|
|
19
|
+
* Return a copy of a card payload without `Action.OpenUrl` actions whose `url`
|
|
20
|
+
* fails {@link CARD_LINK_POLICY}. Such actions are dropped from action lists
|
|
21
|
+
* and removed where they are used as a `selectAction`; the surrounding content
|
|
22
|
+
* stays. Other values are copied unchanged.
|
|
23
|
+
*/
|
|
24
|
+
export declare function removeUnsafeOpenUrlActions(payload: unknown): unknown;
|
|
25
|
+
/**
|
|
26
|
+
* Remove link targets outside {@link CARD_LINK_POLICY} from a rendered card
|
|
27
|
+
* and make every remaining link open without an opener or referrer.
|
|
28
|
+
*/
|
|
29
|
+
export declare function scrubRenderedLinks(root: ParentNode): void;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { toSafeHref as e } from "../../utils/safeUrl.js";
|
|
2
|
+
import { escapeHtml as t, sanitizeWidgetHtml as n } from "../../utils/sanitizeHtml.js";
|
|
3
|
+
//#region src/bigconsole/renderers/adapters/adaptiveCardContent.ts
|
|
4
|
+
var r = { allowMailto: !0 }, i = "ac-md-code", a = "ac-md-link", o = "", s = "", c = RegExp(`[${o}${s}]`, "g");
|
|
5
|
+
function l(e) {
|
|
6
|
+
return e.replaceAll("'", "'").replaceAll(""", "\"").replaceAll(">", ">").replaceAll("<", "<").replaceAll("&", "&");
|
|
7
|
+
}
|
|
8
|
+
function u(e) {
|
|
9
|
+
return e.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>").replace(/__(.+?)__/g, "<strong>$1</strong>").replace(/\*(.+?)\*/g, "<em>$1</em>").replace(/_(.+?)_/g, "<em>$1</em>");
|
|
10
|
+
}
|
|
11
|
+
function d(d, f = n) {
|
|
12
|
+
if (!d) return "";
|
|
13
|
+
let p = [], m = (e) => (p.push(e), `${o}${p.length - 1}${s}`), h = t(d.replace(c, ""));
|
|
14
|
+
h = h.replace(/`(.+?)`/g, (e, t) => m(`<code class="${i}">${t}</code>`)), h = h.replace(/\[(.+?)\]\((.+?)\)/g, (n, i, o) => {
|
|
15
|
+
let s = e(l(o), r), c = u(i);
|
|
16
|
+
return m(s ? `<a href="${t(s)}" class="${a}">${c}</a>` : c);
|
|
17
|
+
}), h = u(h).replace(/\n/g, "<br/>");
|
|
18
|
+
let g = (e) => e.replace(RegExp(`${o}(\\d+)${s}`, "g"), (e, t) => g(p[Number(t)] ?? ""));
|
|
19
|
+
return f(g(h));
|
|
20
|
+
}
|
|
21
|
+
function f(e) {
|
|
22
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
23
|
+
}
|
|
24
|
+
function p(t) {
|
|
25
|
+
return !f(t) || typeof t.type != "string" || t.type.toLowerCase() !== "action.openurl" ? !1 : e(t.url, r) === null;
|
|
26
|
+
}
|
|
27
|
+
function m(e) {
|
|
28
|
+
let t = (e) => {
|
|
29
|
+
if (Array.isArray(e)) return e.filter((e) => !p(e)).map(t);
|
|
30
|
+
if (f(e)) {
|
|
31
|
+
let n = {};
|
|
32
|
+
for (let [r, i] of Object.entries(e)) p(i) || Object.defineProperty(n, r, {
|
|
33
|
+
value: t(i),
|
|
34
|
+
enumerable: !0,
|
|
35
|
+
writable: !0,
|
|
36
|
+
configurable: !0
|
|
37
|
+
});
|
|
38
|
+
return n;
|
|
39
|
+
}
|
|
40
|
+
return e;
|
|
41
|
+
};
|
|
42
|
+
return t(e);
|
|
43
|
+
}
|
|
44
|
+
function h(t) {
|
|
45
|
+
for (let n of Array.from(t.querySelectorAll("a, area"))) {
|
|
46
|
+
let t = n.getAttribute("href");
|
|
47
|
+
t !== null && e(t, r) === null && n.removeAttribute("href"), n.setAttribute("rel", "noopener noreferrer");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { r as CARD_LINK_POLICY, i as CARD_MARKDOWN_CODE_CLASS, a as CARD_MARKDOWN_LINK_CLASS, d as processCardMarkdown, m as removeUnsafeOpenUrlActions, h as scrubRenderedLinks };
|
|
@@ -20,18 +20,6 @@ interface WidgetState {
|
|
|
20
20
|
clipboardWidgetId: string | null;
|
|
21
21
|
clipboardAction: 'copy' | 'cut' | null;
|
|
22
22
|
gridLayout: GridLayoutItem[];
|
|
23
|
-
/**
|
|
24
|
-
* Counts the placements a PERSON made: bumped by `updateWidgetPosition` and by
|
|
25
|
-
* nothing else. The canvas calls that action only when a drag or a resize ENDS
|
|
26
|
-
* (`DashboardCanvas.handleLayoutChange`), and the inspector's "Position & size"
|
|
27
|
-
* fields call it only on a typed change that actually moves the widget
|
|
28
|
-
* (`LayoutSection.commit`). Loading (`setWidgets`), creating (`addWidget`),
|
|
29
|
-
* saving (`updateWidget`) and deleting (`removeWidget`) leave it alone, so a
|
|
30
|
-
* reader can tell "the person moved something" from "the list was refreshed"
|
|
31
|
-
* without comparing positions (BOFF-8060, the dashboard leave guard).
|
|
32
|
-
* Never reset: a reader keeps the last value it saw across `reset()`.
|
|
33
|
-
*/
|
|
34
|
-
layoutEditRevision: number;
|
|
35
23
|
typeFilter: WidgetType | null;
|
|
36
24
|
setWidgets: (widgets: Widget[]) => void;
|
|
37
25
|
addWidget: (widget: Widget) => void;
|
|
@@ -20,7 +20,6 @@ var i = {
|
|
|
20
20
|
typeFilter: null
|
|
21
21
|
}, a = e()(t(n((e, t) => ({
|
|
22
22
|
...i,
|
|
23
|
-
layoutEditRevision: 0,
|
|
24
23
|
setWidgets: (t) => e({
|
|
25
24
|
widgets: new Map(t.map((e) => [e.id, e])),
|
|
26
25
|
gridLayout: t.map((e) => ({
|
|
@@ -156,8 +155,7 @@ var i = {
|
|
|
156
155
|
y: n.y,
|
|
157
156
|
w: n.width,
|
|
158
157
|
h: n.height
|
|
159
|
-
} : e)
|
|
160
|
-
layoutEditRevision: e.layoutEditRevision + 1
|
|
158
|
+
} : e)
|
|
161
159
|
};
|
|
162
160
|
}),
|
|
163
161
|
setGridLayout: (t) => e({ gridLayout: t }),
|
|
@@ -45,6 +45,9 @@ export interface BigConsoleRootProps extends MicrofrontendRootProps {
|
|
|
45
45
|
/** Exact host routes consume their pathname before nested Routes run.
|
|
46
46
|
* Render the corresponding native feed page within the usual providers. */
|
|
47
47
|
routePage?: 'workflow-feeds' | 'workflow-detail';
|
|
48
|
+
/** Mount only authenticated dashboard discovery, viewing and authoring routes.
|
|
49
|
+
* This mode does not initialize the global FluidGrids SDK client. */
|
|
50
|
+
dashboardOnly?: boolean;
|
|
48
51
|
/**
|
|
49
52
|
* API Gateway URL (used when connecting via gateway in workspaces-app)
|
|
50
53
|
* Will append /workspaces/graphql to this URL
|
|
@@ -65,6 +68,13 @@ export interface BigConsoleRootProps extends MicrofrontendRootProps {
|
|
|
65
68
|
* for workspace-scoped operations.
|
|
66
69
|
*/
|
|
67
70
|
workspaceToken?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Exact https origins that iframe widgets may embed, e.g.
|
|
73
|
+
* `['https://reports.example.com']`. When omitted or empty, any https origin
|
|
74
|
+
* other than the app's own can be embedded. Every embedded page runs with a
|
|
75
|
+
* fixed sandbox regardless of this list.
|
|
76
|
+
*/
|
|
77
|
+
iframeAllowedOrigins?: readonly string[];
|
|
68
78
|
}
|
|
69
79
|
/**
|
|
70
80
|
* BigConsole admin microfrontend root props.
|
|
@@ -894,7 +904,13 @@ export interface DataSinkQuota {
|
|
|
894
904
|
alertThreshold: number;
|
|
895
905
|
alertRecipients?: string[];
|
|
896
906
|
}
|
|
897
|
-
/**
|
|
907
|
+
/**
|
|
908
|
+
* DataSink entity as held by the client.
|
|
909
|
+
*
|
|
910
|
+
* The payload is deliberately not part of this record: it is loaded on demand
|
|
911
|
+
* (GetDataSinkPayload) by the views that edit or compare it, and `sizeBytes` /
|
|
912
|
+
* `dataStats` describe it everywhere else.
|
|
913
|
+
*/
|
|
898
914
|
export interface DataSink {
|
|
899
915
|
id: string;
|
|
900
916
|
workspaceId: string;
|
|
@@ -906,7 +922,6 @@ export interface DataSink {
|
|
|
906
922
|
fluidGridsWorkflowId: string | null;
|
|
907
923
|
fluidGridsWorkflowExecutionId: string | null;
|
|
908
924
|
config: Record<string, unknown> | null;
|
|
909
|
-
data: Record<string, unknown>;
|
|
910
925
|
dataStats: DataSinkDataStats | null;
|
|
911
926
|
lastRefreshedAt: string;
|
|
912
927
|
lastRefreshedBy: string | null;
|
|
@@ -1,21 +1,3 @@
|
|
|
1
1
|
type TranslateFn = (key: string, fallback: string) => string;
|
|
2
2
|
export declare function resolveBackendErrorMessage(t: TranslateFn, error: unknown): string;
|
|
3
|
-
/**
|
|
4
|
-
* Every GraphQL `extensions.code` reachable from an error, in the shapes the
|
|
5
|
-
* fe-libs Apollo 4 client hands back:
|
|
6
|
-
*
|
|
7
|
-
* - `CombinedGraphQLErrors` (a `query()` resolved with `{ error }` under
|
|
8
|
-
* errorPolicy "all", or thrown under "none"): `error.errors[]`;
|
|
9
|
-
* - legacy Apollo 3 errors: `error.graphQLErrors[]`;
|
|
10
|
-
* - `ServerError` for a non-2xx answer sent as `application/json` — a subgraph
|
|
11
|
-
* that maps NOT_FOUND to HTTP 404 lands here, with the GraphQL body only in
|
|
12
|
-
* `error.bodyText` (Apollo 3 kept it parsed on `error.result`);
|
|
13
|
-
* - a bare GraphQL error: `error.extensions.code`;
|
|
14
|
-
* - any of those wrapped in `cause` / `error`.
|
|
15
|
-
*
|
|
16
|
-
* Returns `[]` when none is found. Never throws.
|
|
17
|
-
*/
|
|
18
|
-
export declare function graphQLErrorCodes(error: unknown): string[];
|
|
19
|
-
/** True when any GraphQL error reachable from `error` carries one of `codes`. */
|
|
20
|
-
export declare function hasGraphQLErrorCode(error: unknown, codes: ReadonlySet<string>): boolean;
|
|
21
3
|
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DataSink payload helpers.
|
|
3
|
+
*
|
|
4
|
+
* DataSink records held by the client (store, list, detail and mutation
|
|
5
|
+
* responses) never carry the payload. Views that need it load it on demand
|
|
6
|
+
* through the dedicated payload query, and the edit form sends it back only
|
|
7
|
+
* when the user has actually changed it — an untouched editor must never
|
|
8
|
+
* rewrite the stored payload.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Whether a sink holds a non-empty payload, judged from its size metadata so
|
|
12
|
+
* the payload itself never has to be fetched.
|
|
13
|
+
*/
|
|
14
|
+
export declare function hasDataSinkPayload(sink: {
|
|
15
|
+
sizeBytes?: number | null;
|
|
16
|
+
}): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Render a stored payload as the editor's JSON text.
|
|
19
|
+
*
|
|
20
|
+
* The result always parses as JSON: a string that is itself JSON text is
|
|
21
|
+
* pretty-printed as the value it encodes, and any other string is shown as a
|
|
22
|
+
* JSON string literal. A missing payload renders as an empty editor.
|
|
23
|
+
*/
|
|
24
|
+
export declare function formatPayloadForEditor(payload: unknown): string;
|
|
25
|
+
export type PayloadEditorChange = {
|
|
26
|
+
status: 'unchanged';
|
|
27
|
+
} | {
|
|
28
|
+
status: 'changed';
|
|
29
|
+
payload: unknown;
|
|
30
|
+
} | {
|
|
31
|
+
status: 'invalid';
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Decide what a save should do with the payload editor's contents.
|
|
35
|
+
*
|
|
36
|
+
* @param text Current editor text.
|
|
37
|
+
* @param baseline The editor text the stored payload was loaded as, or `null`
|
|
38
|
+
* when the stored payload is unknown (not loaded, or could not
|
|
39
|
+
* be read).
|
|
40
|
+
*
|
|
41
|
+
* - Text equal to the baseline, or JSON with the same value, is unchanged —
|
|
42
|
+
* reformatting alone never rewrites the payload.
|
|
43
|
+
* - Clearing the editor empties the payload (`{}`), but only when there was a
|
|
44
|
+
* known payload to clear; an editor that was empty to begin with is left alone.
|
|
45
|
+
* - With an unknown baseline, any JSON the user enters replaces the payload.
|
|
46
|
+
* - Text that is not valid JSON is reported as invalid.
|
|
47
|
+
*/
|
|
48
|
+
export declare function diffPayloadEditor(text: string, baseline: string | null): PayloadEditorChange;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//#region src/bigconsole/utils/dataSinkPayload.ts
|
|
2
|
+
var e = 2;
|
|
3
|
+
function t(t) {
|
|
4
|
+
return typeof t.sizeBytes == "number" && t.sizeBytes > e;
|
|
5
|
+
}
|
|
6
|
+
function n(e) {
|
|
7
|
+
if (e == null) return "";
|
|
8
|
+
if (typeof e == "string") try {
|
|
9
|
+
return JSON.stringify(JSON.parse(e), null, 2);
|
|
10
|
+
} catch {
|
|
11
|
+
return JSON.stringify(e);
|
|
12
|
+
}
|
|
13
|
+
return JSON.stringify(e, null, 2) ?? "";
|
|
14
|
+
}
|
|
15
|
+
var r = { status: "unchanged" };
|
|
16
|
+
function i(e, t) {
|
|
17
|
+
if (t !== null && e === t) return r;
|
|
18
|
+
let n = t !== null && t.trim() !== "";
|
|
19
|
+
if (e.trim() === "") return n ? {
|
|
20
|
+
status: "changed",
|
|
21
|
+
payload: {}
|
|
22
|
+
} : r;
|
|
23
|
+
let i;
|
|
24
|
+
try {
|
|
25
|
+
i = JSON.parse(e);
|
|
26
|
+
} catch {
|
|
27
|
+
return { status: "invalid" };
|
|
28
|
+
}
|
|
29
|
+
if (n) try {
|
|
30
|
+
if (JSON.stringify(JSON.parse(t)) === JSON.stringify(i)) return r;
|
|
31
|
+
} catch {}
|
|
32
|
+
return {
|
|
33
|
+
status: "changed",
|
|
34
|
+
payload: i
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { i as diffPayloadEditor, n as formatPayloadForEditor, t as hasDataSinkPayload };
|
|
@@ -6,5 +6,7 @@
|
|
|
6
6
|
export { SEMANTIC_COLORS, EVENT_STATUS_COLORS, COMPLEXITY_COLORS, ACTION_STYLE_COLORS, getCSSVariableValue, type SemanticColorKey, type EventStatusKey, type ComplexityKey, type ActionStyleKey, } from './semanticTokens';
|
|
7
7
|
export { parseCsv, inferCsvValue, type CsvValue, type ParsedCsv, type ParseCsvOptions } from './csv';
|
|
8
8
|
export { formatByteSize } from './format';
|
|
9
|
+
export { toSafeHref, normalizeHttpsOrigin, resolveFrameSrc, appendPathSegment, currentAppOrigin, openExternalUrl, MAX_URL_LENGTH, type SafeHrefOptions, type FrameSrcContext, type FrameSrcRejection, type FrameSrcResult, } from './safeUrl';
|
|
10
|
+
export { hasDataSinkPayload, formatPayloadForEditor, diffPayloadEditor, type PayloadEditorChange, } from './dataSinkPayload';
|
|
9
11
|
export { mapToFederationWidgetType, mapFromFederationWidgetType, isFederationAccessible, normalizeWidgetTypeForApi, type FederationWidgetType, } from './widgetTypeMapping';
|
|
10
12
|
export { findNextAvailablePosition, findPositionNextToWidget, calculatePositionFromDrop, getResponsiveCols, getResponsiveSpan, getResponsiveTier, adjustPositionsForCols, RESPONSIVE_BREAKPOINTS, RESPONSIVE_COLS, DEFAULT_GRID_CONFIG, type WidgetSize, type WidgetPosition, type GridConfig, type ResponsiveTier, } from './widgetPositioning';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URL policies for widget content.
|
|
3
|
+
*
|
|
4
|
+
* Widget configuration and parser output are data, so any URL taken from them
|
|
5
|
+
* is parsed with the WHATWG URL parser and checked against an explicit scheme
|
|
6
|
+
* allowlist before it reaches an `href`, `window.open` or an iframe `src`.
|
|
7
|
+
* Apart from {@link currentAppOrigin} and {@link openExternalUrl}, which read
|
|
8
|
+
* `window`, every helper here is pure so the rules can be unit-tested without a
|
|
9
|
+
* DOM.
|
|
10
|
+
*/
|
|
11
|
+
/** Upper bound on the length of a URL accepted from widget content. */
|
|
12
|
+
export declare const MAX_URL_LENGTH = 2048;
|
|
13
|
+
export interface SafeHrefOptions {
|
|
14
|
+
/** Also accept `mailto:` links. */
|
|
15
|
+
allowMailto?: boolean;
|
|
16
|
+
/** Also accept root-relative paths such as `/bigconsole/dashboards/1` (never `//host`). */
|
|
17
|
+
allowRootRelative?: boolean;
|
|
18
|
+
/** Also accept same-document fragment links such as `#summary`. */
|
|
19
|
+
allowFragment?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Return a navigable href for `raw`, or `null` when it is not allowed.
|
|
23
|
+
*
|
|
24
|
+
* Absolute `http:` and `https:` URLs are always accepted (without embedded
|
|
25
|
+
* credentials) and returned in normalised form. `mailto:`, root-relative paths
|
|
26
|
+
* and fragments are accepted only when the matching option is set. Every other
|
|
27
|
+
* scheme, protocol-relative URLs and bare relative paths are rejected.
|
|
28
|
+
*/
|
|
29
|
+
export declare function toSafeHref(raw: unknown, options?: SafeHrefOptions): string | null;
|
|
30
|
+
/**
|
|
31
|
+
* Validate an exact https origin such as `https://reports.example.com`.
|
|
32
|
+
*
|
|
33
|
+
* Returns the serialised origin, or `null` when the value is not an https URL
|
|
34
|
+
* or carries a path, query or fragment.
|
|
35
|
+
*/
|
|
36
|
+
export declare function normalizeHttpsOrigin(raw: unknown): string | null;
|
|
37
|
+
export type FrameSrcRejection = 'missing' | 'invalid' | 'scheme' | 'credentials' | 'same-origin' | 'origin-not-allowed';
|
|
38
|
+
export type FrameSrcResult = {
|
|
39
|
+
ok: true;
|
|
40
|
+
src: string;
|
|
41
|
+
origin: string;
|
|
42
|
+
} | {
|
|
43
|
+
ok: false;
|
|
44
|
+
reason: FrameSrcRejection;
|
|
45
|
+
};
|
|
46
|
+
export interface FrameSrcContext {
|
|
47
|
+
/** Origin of the hosting app; frames on this origin are rejected. */
|
|
48
|
+
appOrigin?: string | null;
|
|
49
|
+
/**
|
|
50
|
+
* Exact https origins that may be framed. An empty or missing list allows
|
|
51
|
+
* any https origin other than the app's own. A non-empty list with no valid
|
|
52
|
+
* entry allows nothing.
|
|
53
|
+
*/
|
|
54
|
+
allowedOrigins?: readonly string[] | null;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Decide whether `raw` may be used as an iframe `src`.
|
|
58
|
+
*
|
|
59
|
+
* Only absolute https URLs without credentials are accepted. The app's own
|
|
60
|
+
* origin is rejected, and when an allowlist is configured the URL's origin must
|
|
61
|
+
* match one of its entries exactly.
|
|
62
|
+
*/
|
|
63
|
+
export declare function resolveFrameSrc(raw: unknown, context?: FrameSrcContext): FrameSrcResult;
|
|
64
|
+
/**
|
|
65
|
+
* Append one path segment (such as a dashboard id) to an in-app base path.
|
|
66
|
+
*
|
|
67
|
+
* The segment is percent-encoded, so it cannot add path separators, a query or
|
|
68
|
+
* a fragment. Empty, `.` and `..` segments are rejected with `null`.
|
|
69
|
+
*/
|
|
70
|
+
export declare function appendPathSegment(basePath: string, segment: unknown): string | null;
|
|
71
|
+
/** The origin the app is served from, or `null` outside a browser. */
|
|
72
|
+
export declare function currentAppOrigin(): string | null;
|
|
73
|
+
/**
|
|
74
|
+
* Open `raw` in a new browsing context without an opener or referrer.
|
|
75
|
+
*
|
|
76
|
+
* Returns `false` (and opens nothing) when the URL is not allowed by
|
|
77
|
+
* {@link toSafeHref} with the given options.
|
|
78
|
+
*/
|
|
79
|
+
export declare function openExternalUrl(raw: unknown, options?: SafeHrefOptions): boolean;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
function e(e) {
|
|
2
|
+
for (let t = 0; t < e.length; t += 1) {
|
|
3
|
+
let n = e.charCodeAt(t);
|
|
4
|
+
if (n < 32 || n === 127) return !0;
|
|
5
|
+
}
|
|
6
|
+
return !1;
|
|
7
|
+
}
|
|
8
|
+
var t = "https://path-base.invalid";
|
|
9
|
+
function n(t) {
|
|
10
|
+
if (typeof t != "string") return null;
|
|
11
|
+
let n = t.trim();
|
|
12
|
+
return !n || n.length > 2048 || e(n) ? null : n;
|
|
13
|
+
}
|
|
14
|
+
function r(e) {
|
|
15
|
+
try {
|
|
16
|
+
return new URL(e);
|
|
17
|
+
} catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function i(e, i = {}) {
|
|
22
|
+
let a = n(e);
|
|
23
|
+
if (!a) return null;
|
|
24
|
+
if (a.startsWith("#")) return i.allowFragment ? a : null;
|
|
25
|
+
if (a.startsWith("/")) {
|
|
26
|
+
if (!i.allowRootRelative) return null;
|
|
27
|
+
let e;
|
|
28
|
+
try {
|
|
29
|
+
e = new URL(a, t);
|
|
30
|
+
} catch {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return e.origin === t ? `${e.pathname}${e.search}${e.hash}` : null;
|
|
34
|
+
}
|
|
35
|
+
let o = r(a);
|
|
36
|
+
return o ? o.protocol === "http:" || o.protocol === "https:" ? o.username || o.password ? null : o.href : o.protocol === "mailto:" && i.allowMailto ? o.href : null : null;
|
|
37
|
+
}
|
|
38
|
+
function a(e) {
|
|
39
|
+
if (typeof e != "string") return null;
|
|
40
|
+
let t = e.trim();
|
|
41
|
+
if (!t) return null;
|
|
42
|
+
let n = r(t);
|
|
43
|
+
return !n || n.protocol !== "https:" || n.pathname !== "" && n.pathname !== "/" || n.search || n.hash ? null : n.origin;
|
|
44
|
+
}
|
|
45
|
+
function o(e, t = {}) {
|
|
46
|
+
if (typeof e != "string" || e.trim() === "") return {
|
|
47
|
+
ok: !1,
|
|
48
|
+
reason: "missing"
|
|
49
|
+
};
|
|
50
|
+
let i = n(e);
|
|
51
|
+
if (!i) return {
|
|
52
|
+
ok: !1,
|
|
53
|
+
reason: "invalid"
|
|
54
|
+
};
|
|
55
|
+
let o = r(i);
|
|
56
|
+
if (!o) return {
|
|
57
|
+
ok: !1,
|
|
58
|
+
reason: "invalid"
|
|
59
|
+
};
|
|
60
|
+
if (o.protocol !== "https:") return {
|
|
61
|
+
ok: !1,
|
|
62
|
+
reason: "scheme"
|
|
63
|
+
};
|
|
64
|
+
if (o.username || o.password) return {
|
|
65
|
+
ok: !1,
|
|
66
|
+
reason: "credentials"
|
|
67
|
+
};
|
|
68
|
+
if (t.appOrigin && o.origin === t.appOrigin) return {
|
|
69
|
+
ok: !1,
|
|
70
|
+
reason: "same-origin"
|
|
71
|
+
};
|
|
72
|
+
let s = t.allowedOrigins ?? [];
|
|
73
|
+
return s.length > 0 && !new Set(s.map((e) => a(e)).filter((e) => e !== null)).has(o.origin) ? {
|
|
74
|
+
ok: !1,
|
|
75
|
+
reason: "origin-not-allowed"
|
|
76
|
+
} : {
|
|
77
|
+
ok: !0,
|
|
78
|
+
src: o.href,
|
|
79
|
+
origin: o.origin
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function s(e, t) {
|
|
83
|
+
return typeof t != "string" || t === "" || t === "." || t === ".." ? null : `${e.endsWith("/") ? e.slice(0, -1) : e}/${encodeURIComponent(t)}`;
|
|
84
|
+
}
|
|
85
|
+
function c() {
|
|
86
|
+
return typeof window > "u" || !window.location ? null : window.location.origin;
|
|
87
|
+
}
|
|
88
|
+
function l(e, t = {}) {
|
|
89
|
+
let n = i(e, t);
|
|
90
|
+
return !n || typeof window > "u" ? !1 : (window.open(n, "_blank", "noopener,noreferrer"), !0);
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
export { s as appendPathSegment, c as currentAppOrigin, a as normalizeHttpsOrigin, l as openExternalUrl, o as resolveFrameSrc, i as toSafeHref };
|