@burdenoff/microfe-bigconsole 2026.801.3 → 2026.803.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bigconsole/components/dashboard/PublishToStoreDialog.js +35 -33
- package/dist/bigconsole/components/dashboard/PublishToStoreDialog.js.map +1 -1
- package/dist/bigconsole/components/dashboard/ShareDialog/EmbedTab.js +147 -88
- package/dist/bigconsole/components/dashboard/ShareDialog/EmbedTab.js.map +1 -1
- package/dist/bigconsole/components/widgets/WidgetHeader.js +22 -17
- package/dist/bigconsole/components/widgets/WidgetHeader.js.map +1 -1
- package/dist/bigconsole/components/widgets/WidgetWrapper.js +22 -17
- package/dist/bigconsole/components/widgets/WidgetWrapper.js.map +1 -1
- package/dist/bigconsole/graphql/storeTemplates.js +3 -0
- package/dist/bigconsole/graphql/storeTemplates.js.map +1 -1
- package/dist/bigconsole/hooks/useStoreDashboardTemplates.js +12 -7
- package/dist/bigconsole/hooks/useStoreDashboardTemplates.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,63 +7,65 @@ function _(e) {
|
|
|
7
7
|
return e.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).join("-").slice(0, 60);
|
|
8
8
|
}
|
|
9
9
|
var v = t(function({ isOpen: t, dashboardId: v, dashboardName: y, dashboardDescription: b, onClose: x, onPublished: S }) {
|
|
10
|
-
let { publishToStore: C } = e({ autoLoad: !1 }), [w, T] = i(y), [E, D] = i(_(y)), [O, k] = i(b ?? ""), [A, j] = i(!1), [M, N] = i(
|
|
10
|
+
let { publishToStore: C } = e({ autoLoad: !1 }), [w, T] = i(y), [E, D] = i(_(y)), [O, k] = i(b ?? ""), [A, j] = i(!1), [M, N] = i(!1), [P, F] = i(null), [I, L] = i(null);
|
|
11
11
|
r(() => {
|
|
12
|
-
t && (T(y), D(_(y)), k(b ?? ""),
|
|
12
|
+
t && (T(y), D(_(y)), k(b ?? ""), j(!1), F(null), L(null));
|
|
13
13
|
}, [
|
|
14
14
|
t,
|
|
15
15
|
y,
|
|
16
16
|
b
|
|
17
17
|
]);
|
|
18
|
-
let
|
|
18
|
+
let R = n(async () => {
|
|
19
19
|
if (!w.trim()) {
|
|
20
|
-
|
|
20
|
+
F("A template name is required");
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
if (!E.trim()) {
|
|
24
|
-
|
|
24
|
+
F("A slug is required");
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
if (!O.trim()) {
|
|
28
|
-
|
|
28
|
+
F("A description is required — it is what people see in the gallery");
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
F(null), N(!0);
|
|
32
32
|
try {
|
|
33
33
|
let e = await C({
|
|
34
34
|
dashboardId: v,
|
|
35
35
|
name: w.trim(),
|
|
36
36
|
slug: E.trim(),
|
|
37
|
-
description: O.trim()
|
|
37
|
+
description: O.trim(),
|
|
38
|
+
includeSampleData: A
|
|
38
39
|
});
|
|
39
40
|
if (!e.success) {
|
|
40
|
-
|
|
41
|
+
F(e.errorMessage ?? "Failed to publish to the store");
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
+
L(e), S?.(e);
|
|
44
45
|
} finally {
|
|
45
|
-
|
|
46
|
+
N(!1);
|
|
46
47
|
}
|
|
47
48
|
}, [
|
|
48
49
|
w,
|
|
49
50
|
E,
|
|
50
51
|
O,
|
|
52
|
+
A,
|
|
51
53
|
v,
|
|
52
54
|
C,
|
|
53
55
|
S
|
|
54
|
-
]),
|
|
56
|
+
]), z = {
|
|
55
57
|
display: "block",
|
|
56
58
|
marginBottom: "var(--space-2xs)",
|
|
57
59
|
fontSize: "var(--font-size-sm)"
|
|
58
60
|
};
|
|
59
61
|
return /* @__PURE__ */ h(o, {
|
|
60
62
|
open: t,
|
|
61
|
-
onOpenChange: (e) => !e && !
|
|
63
|
+
onOpenChange: (e) => !e && !M && x(),
|
|
62
64
|
children: /* @__PURE__ */ g(s, {
|
|
63
65
|
style: { maxWidth: "520px" },
|
|
64
66
|
children: [
|
|
65
67
|
/* @__PURE__ */ g(u, { children: [/* @__PURE__ */ h(d, { children: "Publish as Template" }), /* @__PURE__ */ h(c, { children: "Share this dashboard as a reusable template. Your data sources are replaced with named slots, so nothing from this workspace is published." })] }),
|
|
66
|
-
|
|
68
|
+
I ? /* @__PURE__ */ g("div", {
|
|
67
69
|
style: { padding: "var(--space-md) 0" },
|
|
68
70
|
children: [
|
|
69
71
|
/* @__PURE__ */ h("p", {
|
|
@@ -76,21 +78,21 @@ var v = t(function({ isOpen: t, dashboardId: v, dashboardName: y, dashboardDescr
|
|
|
76
78
|
color: "var(--color-text-muted)"
|
|
77
79
|
},
|
|
78
80
|
children: [
|
|
79
|
-
|
|
81
|
+
I.sinkCount,
|
|
80
82
|
" data source",
|
|
81
|
-
|
|
83
|
+
I.sinkCount === 1 ? "" : "s",
|
|
82
84
|
" turned into slots. Finish in the Developer Portal: review the listing, then submit it for approval. It appears in the gallery once approved."
|
|
83
85
|
]
|
|
84
86
|
}),
|
|
85
|
-
|
|
87
|
+
I.unknownSinkIds.length > 0 && /* @__PURE__ */ g("p", {
|
|
86
88
|
style: {
|
|
87
89
|
fontSize: "var(--font-size-sm)",
|
|
88
90
|
color: "var(--color-text-warning)"
|
|
89
91
|
},
|
|
90
92
|
children: [
|
|
91
|
-
|
|
93
|
+
I.unknownSinkIds.length,
|
|
92
94
|
" data source",
|
|
93
|
-
|
|
95
|
+
I.unknownSinkIds.length === 1 ? "" : "s",
|
|
94
96
|
" could not be named — those slots use generic labels."
|
|
95
97
|
]
|
|
96
98
|
})
|
|
@@ -104,56 +106,56 @@ var v = t(function({ isOpen: t, dashboardId: v, dashboardName: y, dashboardDescr
|
|
|
104
106
|
children: [
|
|
105
107
|
/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("label", {
|
|
106
108
|
htmlFor: "tpl-name",
|
|
107
|
-
style:
|
|
109
|
+
style: z,
|
|
108
110
|
children: "Template name"
|
|
109
111
|
}), /* @__PURE__ */ h(f, {
|
|
110
112
|
id: "tpl-name",
|
|
111
113
|
value: w,
|
|
112
|
-
disabled:
|
|
114
|
+
disabled: M,
|
|
113
115
|
onChange: (e) => {
|
|
114
116
|
T(e.target.value), D(_(e.target.value));
|
|
115
117
|
}
|
|
116
118
|
})] }),
|
|
117
119
|
/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("label", {
|
|
118
120
|
htmlFor: "tpl-slug",
|
|
119
|
-
style:
|
|
121
|
+
style: z,
|
|
120
122
|
children: "Slug"
|
|
121
123
|
}), /* @__PURE__ */ h(f, {
|
|
122
124
|
id: "tpl-slug",
|
|
123
125
|
value: E,
|
|
124
|
-
disabled:
|
|
126
|
+
disabled: M,
|
|
125
127
|
onChange: (e) => D(_(e.target.value))
|
|
126
128
|
})] }),
|
|
127
129
|
/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("label", {
|
|
128
130
|
htmlFor: "tpl-desc",
|
|
129
|
-
style:
|
|
131
|
+
style: z,
|
|
130
132
|
children: "Description"
|
|
131
133
|
}), /* @__PURE__ */ h(m, {
|
|
132
134
|
id: "tpl-desc",
|
|
133
135
|
rows: 3,
|
|
134
136
|
value: O,
|
|
135
|
-
disabled:
|
|
137
|
+
disabled: M,
|
|
136
138
|
placeholder: "What is this dashboard for, and what data does it need?",
|
|
137
139
|
onChange: (e) => k(e.target.value)
|
|
138
140
|
})] }),
|
|
139
|
-
|
|
141
|
+
P && /* @__PURE__ */ h("p", {
|
|
140
142
|
style: {
|
|
141
143
|
color: "var(--color-text-danger)",
|
|
142
144
|
fontSize: "var(--font-size-sm)"
|
|
143
145
|
},
|
|
144
|
-
children:
|
|
146
|
+
children: P
|
|
145
147
|
})
|
|
146
148
|
]
|
|
147
149
|
}),
|
|
148
150
|
/* @__PURE__ */ g(l, { children: [/* @__PURE__ */ h(a, {
|
|
149
151
|
variant: "outline",
|
|
150
152
|
onClick: x,
|
|
151
|
-
disabled:
|
|
152
|
-
children:
|
|
153
|
-
}), !
|
|
154
|
-
onClick:
|
|
155
|
-
disabled:
|
|
156
|
-
children:
|
|
153
|
+
disabled: M,
|
|
154
|
+
children: I ? "Done" : "Cancel"
|
|
155
|
+
}), !I && /* @__PURE__ */ h(a, {
|
|
156
|
+
onClick: R,
|
|
157
|
+
disabled: M,
|
|
158
|
+
children: M ? /* @__PURE__ */ h(p, {}) : "Publish"
|
|
157
159
|
})] })
|
|
158
160
|
]
|
|
159
161
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublishToStoreDialog.js","names":[],"sources":["../../../../src/bigconsole/components/dashboard/PublishToStoreDialog.tsx"],"sourcesContent":["/**\n * PublishToStoreDialog\n *\n * Turns the open dashboard into a store template.\n *\n * WHY THIS EXISTS:\n * A workflow template's {nodes, edges} can plausibly be hand-written into the\n * developer portal. A dashboard export — every widget with its layout\n * coordinates, bindings and filters — cannot. Without this, authoring a\n * dashboard template means hand-crafting a large JSON document, which nobody\n * will do, and the gallery stays empty.\n *\n * The backend tokenises the board (replacing this workspace's data-sink\n * references with named slots), then a DRAFT Dashboard Template application is\n * created in the developer portal from the result. It deliberately stops there\n * rather than writing a store product directly: devportal already owns\n * versioning, review and publisher identity for dashboard templates, and\n * forking that pipeline would orphan the listing.\n *\n * @module bigconsole/components/dashboard/PublishToStoreDialog\n */\nimport {\n Button,\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n Input,\n Spinner,\n Textarea,\n} from '@burdenoff/fe-libs/ui';\nimport { type FC, memo, useCallback, useEffect, useState } from 'react';\n\nimport { useStoreDashboardTemplates, type PublishToStoreResult } from '../../hooks/useStoreDashboardTemplates';\n\nexport interface PublishToStoreDialogProps {\n isOpen: boolean;\n dashboardId: string;\n dashboardName: string;\n dashboardDescription?: string | null;\n onClose: () => void;\n onPublished?: (result: PublishToStoreResult) => void;\n}\n\n/** Store slugs are lowercase, hyphenated and unique. */\nfunction slugify(value: string): string {\n return value\n .toLowerCase()\n .split(/[^a-z0-9]+/)\n .filter(Boolean)\n .join('-')\n .slice(0, 60);\n}\n\nexport const PublishToStoreDialog: FC<PublishToStoreDialogProps> = memo(function PublishToStoreDialog({\n isOpen,\n dashboardId,\n dashboardName,\n dashboardDescription,\n onClose,\n onPublished,\n}) {\n const { publishToStore } = useStoreDashboardTemplates({ autoLoad: false });\n\n const [name, setName] = useState(dashboardName);\n const [slug, setSlug] = useState(slugify(dashboardName));\n const [description, setDescription] = useState(dashboardDescription ?? '');\n const [publishing, setPublishing] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [result, setResult] = useState<PublishToStoreResult | null>(null);\n\n useEffect(() => {\n if (!isOpen) return;\n setName(dashboardName);\n setSlug(slugify(dashboardName));\n setDescription(dashboardDescription ?? '');\n setError(null);\n setResult(null);\n }, [isOpen, dashboardName, dashboardDescription]);\n\n const handlePublish = useCallback(async () => {\n if (!name.trim()) {\n setError('A template name is required');\n return;\n }\n if (!slug.trim()) {\n setError('A slug is required');\n return;\n }\n if (!description.trim()) {\n setError('A description is required — it is what people see in the gallery');\n return;\n }\n\n setError(null);\n setPublishing(true);\n try {\n const published = await publishToStore({\n dashboardId,\n name: name.trim(),\n slug: slug.trim(),\n description: description.trim(),\n });\n if (!published.success) {\n setError(published.errorMessage ?? 'Failed to publish to the store');\n return;\n }\n setResult(published);\n onPublished?.(published);\n } finally {\n setPublishing(false);\n }\n }, [name, slug, description, dashboardId, publishToStore, onPublished]);\n\n const label = { display: 'block', marginBottom: 'var(--space-2xs)', fontSize: 'var(--font-size-sm)' };\n\n return (\n <Dialog open={isOpen} onOpenChange={(open) => !open && !publishing && onClose()}>\n <DialogContent style={{ maxWidth: '520px' }}>\n <DialogHeader>\n <DialogTitle>Publish as Template</DialogTitle>\n <DialogDescription>\n Share this dashboard as a reusable template. Your data sources are replaced with named slots, so nothing\n from this workspace is published.\n </DialogDescription>\n </DialogHeader>\n\n {result ? (\n <div style={{ padding: 'var(--space-md) 0' }}>\n <p style={{ fontWeight: 'var(--font-weight-medium)' }}>Draft template created</p>\n <p style={{ fontSize: 'var(--font-size-sm)', color: 'var(--color-text-muted)' }}>\n {result.sinkCount} data source{result.sinkCount === 1 ? '' : 's'} turned into slots. Finish in the\n Developer Portal: review the listing, then submit it for approval. It appears in the gallery once\n approved.\n </p>\n {result.unknownSinkIds.length > 0 && (\n <p style={{ fontSize: 'var(--font-size-sm)', color: 'var(--color-text-warning)' }}>\n {result.unknownSinkIds.length} data source\n {result.unknownSinkIds.length === 1 ? '' : 's'} could not be named — those slots use generic labels.\n </p>\n )}\n </div>\n ) : (\n <div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--space-sm)' }}>\n <div>\n <label htmlFor=\"tpl-name\" style={label}>\n Template name\n </label>\n <Input\n id=\"tpl-name\"\n value={name}\n disabled={publishing}\n onChange={(e) => {\n setName(e.target.value);\n setSlug(slugify(e.target.value));\n }}\n />\n </div>\n\n <div>\n <label htmlFor=\"tpl-slug\" style={label}>\n Slug\n </label>\n <Input\n id=\"tpl-slug\"\n value={slug}\n disabled={publishing}\n onChange={(e) => setSlug(slugify(e.target.value))}\n />\n </div>\n\n <div>\n <label htmlFor=\"tpl-desc\" style={label}>\n Description\n </label>\n <Textarea\n id=\"tpl-desc\"\n rows={3}\n value={description}\n disabled={publishing}\n placeholder=\"What is this dashboard for, and what data does it need?\"\n onChange={(e) => setDescription(e.target.value)}\n />\n </div>\n\n {error && <p style={{ color: 'var(--color-text-danger)', fontSize: 'var(--font-size-sm)' }}>{error}</p>}\n </div>\n )}\n\n <DialogFooter>\n <Button variant=\"outline\" onClick={onClose} disabled={publishing}>\n {result ? 'Done' : 'Cancel'}\n </Button>\n {!result && (\n <Button onClick={handlePublish} disabled={publishing}>\n {publishing ? <Spinner /> : 'Publish'}\n </Button>\n )}\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n});\n\nexport default PublishToStoreDialog;\n"],"mappings":";;;;;AA+CA,SAAS,EAAQ,G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;OAEhC,CAAA,EACR,kBAAC,GAAD;OACE,IAAG;OACH,OAAO;OACP,UAAU;OACV,WAAW,MAAM,EAAQ,EAAQ,EAAE,OAAO,MAAM,CAAC;OACjD,CAAA,CACE,EAAA,CAAA;MAEN,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,SAAD;OAAO,SAAQ;OAAW,OAAO;iBAAO;OAEhC,CAAA,EACR,kBAAC,GAAD;OACE,IAAG;OACH,MAAM;OACN,OAAO;OACP,UAAU;OACV,aAAY;OACZ,WAAW,MAAM,EAAe,EAAE,OAAO,MAAM;OAC/C,CAAA,CACE,EAAA,CAAA;MAEL,KAAS,kBAAC,KAAD;OAAG,OAAO;QAAE,OAAO;QAA4B,UAAU;QAAuB;iBAAG;OAAU,CAAA;MACnG;;IAGR,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD;KAAQ,SAAQ;KAAU,SAAS;KAAS,UAAU;eACnD,IAAS,SAAS;KACZ,CAAA,EACR,CAAC,KACA,kBAAC,GAAD;KAAQ,SAAS;KAAe,UAAU;eACvC,IAAa,kBAAC,GAAD,EAAW,CAAA,GAAG;KACrB,CAAA,CAEE,EAAA,CAAA;IACD;;EACT,CAAA;EAEX"}
|
|
1
|
+
{"version":3,"file":"PublishToStoreDialog.js","names":[],"sources":["../../../../src/bigconsole/components/dashboard/PublishToStoreDialog.tsx"],"sourcesContent":["/**\n * PublishToStoreDialog\n *\n * Turns the open dashboard into a store template.\n *\n * WHY THIS EXISTS:\n * A workflow template's {nodes, edges} can plausibly be hand-written into the\n * developer portal. A dashboard export — every widget with its layout\n * coordinates, bindings and filters — cannot. Without this, authoring a\n * dashboard template means hand-crafting a large JSON document, which nobody\n * will do, and the gallery stays empty.\n *\n * The backend tokenises the board (replacing this workspace's data-sink\n * references with named slots), then a DRAFT Dashboard Template application is\n * created in the developer portal from the result. It deliberately stops there\n * rather than writing a store product directly: devportal already owns\n * versioning, review and publisher identity for dashboard templates, and\n * forking that pipeline would orphan the listing.\n *\n * @module bigconsole/components/dashboard/PublishToStoreDialog\n */\nimport {\n Button,\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n Input,\n Spinner,\n Textarea,\n} from '@burdenoff/fe-libs/ui';\nimport { type FC, memo, useCallback, useEffect, useState } from 'react';\n\nimport { useStoreDashboardTemplates, type PublishToStoreResult } from '../../hooks/useStoreDashboardTemplates';\n\nexport interface PublishToStoreDialogProps {\n isOpen: boolean;\n dashboardId: string;\n dashboardName: string;\n dashboardDescription?: string | null;\n onClose: () => void;\n onPublished?: (result: PublishToStoreResult) => void;\n}\n\n/** Store slugs are lowercase, hyphenated and unique. */\nfunction slugify(value: string): string {\n return value\n .toLowerCase()\n .split(/[^a-z0-9]+/)\n .filter(Boolean)\n .join('-')\n .slice(0, 60);\n}\n\nexport const PublishToStoreDialog: FC<PublishToStoreDialogProps> = memo(function PublishToStoreDialog({\n isOpen,\n dashboardId,\n dashboardName,\n dashboardDescription,\n onClose,\n onPublished,\n}) {\n const { publishToStore } = useStoreDashboardTemplates({ autoLoad: false });\n\n const [name, setName] = useState(dashboardName);\n const [slug, setSlug] = useState(slugify(dashboardName));\n const [description, setDescription] = useState(dashboardDescription ?? '');\n const [includeSampleData, setIncludeSampleData] = useState(false);\n const [publishing, setPublishing] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [result, setResult] = useState<PublishToStoreResult | null>(null);\n\n useEffect(() => {\n if (!isOpen) return;\n setName(dashboardName);\n setSlug(slugify(dashboardName));\n setDescription(dashboardDescription ?? '');\n setIncludeSampleData(false);\n setError(null);\n setResult(null);\n }, [isOpen, dashboardName, dashboardDescription]);\n\n const handlePublish = useCallback(async () => {\n if (!name.trim()) {\n setError('A template name is required');\n return;\n }\n if (!slug.trim()) {\n setError('A slug is required');\n return;\n }\n if (!description.trim()) {\n setError('A description is required — it is what people see in the gallery');\n return;\n }\n\n setError(null);\n setPublishing(true);\n try {\n const published = await publishToStore({\n dashboardId,\n name: name.trim(),\n slug: slug.trim(),\n description: description.trim(),\n includeSampleData,\n });\n if (!published.success) {\n setError(published.errorMessage ?? 'Failed to publish to the store');\n return;\n }\n setResult(published);\n onPublished?.(published);\n } finally {\n setPublishing(false);\n }\n }, [name, slug, description, includeSampleData, dashboardId, publishToStore, onPublished]);\n\n const label = { display: 'block', marginBottom: 'var(--space-2xs)', fontSize: 'var(--font-size-sm)' };\n\n return (\n <Dialog open={isOpen} onOpenChange={(open) => !open && !publishing && onClose()}>\n <DialogContent style={{ maxWidth: '520px' }}>\n <DialogHeader>\n <DialogTitle>Publish as Template</DialogTitle>\n <DialogDescription>\n Share this dashboard as a reusable template. Your data sources are replaced with named slots, so nothing\n from this workspace is published.\n </DialogDescription>\n </DialogHeader>\n\n {result ? (\n <div style={{ padding: 'var(--space-md) 0' }}>\n <p style={{ fontWeight: 'var(--font-weight-medium)' }}>Draft template created</p>\n <p style={{ fontSize: 'var(--font-size-sm)', color: 'var(--color-text-muted)' }}>\n {result.sinkCount} data source{result.sinkCount === 1 ? '' : 's'} turned into slots. Finish in the\n Developer Portal: review the listing, then submit it for approval. It appears in the gallery once\n approved.\n </p>\n {result.unknownSinkIds.length > 0 && (\n <p style={{ fontSize: 'var(--font-size-sm)', color: 'var(--color-text-warning)' }}>\n {result.unknownSinkIds.length} data source\n {result.unknownSinkIds.length === 1 ? '' : 's'} could not be named — those slots use generic labels.\n </p>\n )}\n </div>\n ) : (\n <div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--space-sm)' }}>\n <div>\n <label htmlFor=\"tpl-name\" style={label}>\n Template name\n </label>\n <Input\n id=\"tpl-name\"\n value={name}\n disabled={publishing}\n onChange={(e) => {\n setName(e.target.value);\n setSlug(slugify(e.target.value));\n }}\n />\n </div>\n\n <div>\n <label htmlFor=\"tpl-slug\" style={label}>\n Slug\n </label>\n <Input\n id=\"tpl-slug\"\n value={slug}\n disabled={publishing}\n onChange={(e) => setSlug(slugify(e.target.value))}\n />\n </div>\n\n <div>\n <label htmlFor=\"tpl-desc\" style={label}>\n Description\n </label>\n <Textarea\n id=\"tpl-desc\"\n rows={3}\n value={description}\n disabled={publishing}\n placeholder=\"What is this dashboard for, and what data does it need?\"\n onChange={(e) => setDescription(e.target.value)}\n />\n </div>\n\n {error && <p style={{ color: 'var(--color-text-danger)', fontSize: 'var(--font-size-sm)' }}>{error}</p>}\n </div>\n )}\n\n <DialogFooter>\n <Button variant=\"outline\" onClick={onClose} disabled={publishing}>\n {result ? 'Done' : 'Cancel'}\n </Button>\n {!result && (\n <Button onClick={handlePublish} disabled={publishing}>\n {publishing ? <Spinner /> : 'Publish'}\n </Button>\n )}\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n});\n\nexport default PublishToStoreDialog;\n"],"mappings":";;;;;AA+CA,SAAS,EAAQ,GAAuB;AACtC,QAAO,EACJ,aAAa,CACb,MAAM,aAAa,CACnB,OAAO,QAAQ,CACf,KAAK,IAAI,CACT,MAAM,GAAG,GAAG;;AAGjB,IAAa,IAAsD,EAAK,SAA8B,EACpG,WACA,gBACA,kBACA,yBACA,YACA,kBACC;CACD,IAAM,EAAE,sBAAmB,EAA2B,EAAE,UAAU,IAAO,CAAC,EAEpE,CAAC,GAAM,KAAW,EAAS,EAAc,EACzC,CAAC,GAAM,KAAW,EAAS,EAAQ,EAAc,CAAC,EAClD,CAAC,GAAa,KAAkB,EAAS,KAAwB,GAAG,EACpE,CAAC,GAAmB,KAAwB,EAAS,GAAM,EAC3D,CAAC,GAAY,KAAiB,EAAS,GAAM,EAC7C,CAAC,GAAO,KAAY,EAAwB,KAAK,EACjD,CAAC,GAAQ,KAAa,EAAsC,KAAK;AAEvE,SAAgB;AACT,QACL,EAAQ,EAAc,EACtB,EAAQ,EAAQ,EAAc,CAAC,EAC/B,EAAe,KAAwB,GAAG,EAC1C,EAAqB,GAAM,EAC3B,EAAS,KAAK,EACd,EAAU,KAAK;IACd;EAAC;EAAQ;EAAe;EAAqB,CAAC;CAEjD,IAAM,IAAgB,EA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,IAAa,kBAAC,GAAD,EAAW,CAAA,GAAG;KACrB,CAAA,CAEE,EAAA,CAAA;IACD;;EACT,CAAA;EAEX"}
|
|
@@ -2,7 +2,27 @@ import e from "../../../hooks/useDashboardEmbedPolicy.js";
|
|
|
2
2
|
import { useEffect as t, useMemo as n, useState as r } from "react";
|
|
3
3
|
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
4
4
|
//#region src/bigconsole/components/dashboard/ShareDialog/EmbedTab.tsx
|
|
5
|
-
|
|
5
|
+
var s = [
|
|
6
|
+
{
|
|
7
|
+
value: "light",
|
|
8
|
+
label: "Light"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
value: "dark",
|
|
12
|
+
label: "Dark"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
value: "auto",
|
|
16
|
+
label: "Auto (match viewer)"
|
|
17
|
+
}
|
|
18
|
+
];
|
|
19
|
+
function c(e, t) {
|
|
20
|
+
return t === "light" ? e : e.replace(/(?<=\s)src="([^"]*)"/, (e, n) => {
|
|
21
|
+
let r = n.indexOf("#"), i = r === -1 ? n : n.slice(0, r), a = r === -1 ? "" : n.slice(r);
|
|
22
|
+
return `src="${i}${i.includes("?") ? "&" : "?"}theme=${t}${a}"`;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function l(e) {
|
|
6
26
|
let t = e.trim();
|
|
7
27
|
if (!t) return null;
|
|
8
28
|
try {
|
|
@@ -12,65 +32,65 @@ function s(e) {
|
|
|
12
32
|
return null;
|
|
13
33
|
}
|
|
14
34
|
}
|
|
15
|
-
function
|
|
16
|
-
let { policy:
|
|
35
|
+
function u({ dashboardId: u, colors: d }) {
|
|
36
|
+
let { policy: f, secret: p, loading: m, error: h, fetchPolicy: g, publishToWeb: _, setAllowedOrigins: v, rotateKey: y, unpublish: b } = e(), [x, S] = r(""), [C, w] = r([]), [T, E] = r(!1), [D, O] = r(!1), [k, A] = r("light"), [j, M] = r(null);
|
|
17
37
|
t(() => {
|
|
18
|
-
|
|
19
|
-
}, [
|
|
20
|
-
let
|
|
21
|
-
|
|
22
|
-
let e =
|
|
38
|
+
u && g(u);
|
|
39
|
+
}, [u, g]);
|
|
40
|
+
let N = f?.status === "ACTIVE", P = N ? f?.allowedParentOrigins ?? [] : C, F = n(() => p?.iframeSnippet ? c(p.iframeSnippet, k) : null, [p, k]), I = () => {
|
|
41
|
+
M(null);
|
|
42
|
+
let e = l(x);
|
|
23
43
|
if (!e) {
|
|
24
|
-
|
|
44
|
+
M("Enter a valid https origin, e.g. https://example.com");
|
|
25
45
|
return;
|
|
26
46
|
}
|
|
27
|
-
if (
|
|
28
|
-
|
|
47
|
+
if (P.includes(e)) {
|
|
48
|
+
S("");
|
|
29
49
|
return;
|
|
30
50
|
}
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
if (
|
|
36
|
-
|
|
51
|
+
N && f ? v(f.id, [...P, e]) : w((t) => [...t, e]), S("");
|
|
52
|
+
}, L = (e) => {
|
|
53
|
+
N && f ? v(f.id, P.filter((t) => t !== e)) : w((t) => t.filter((t) => t !== e));
|
|
54
|
+
}, R = async () => {
|
|
55
|
+
if (M(null), C.length === 0) {
|
|
56
|
+
M("Add at least one allowed website domain before publishing.");
|
|
37
57
|
return;
|
|
38
58
|
}
|
|
39
|
-
if (!
|
|
40
|
-
|
|
59
|
+
if (!T) {
|
|
60
|
+
M("Please confirm this dashboard is safe to be public.");
|
|
41
61
|
return;
|
|
42
62
|
}
|
|
43
|
-
await
|
|
44
|
-
},
|
|
63
|
+
await _(u, C, !0);
|
|
64
|
+
}, z = async (e) => {
|
|
45
65
|
try {
|
|
46
|
-
await navigator.clipboard.writeText(e),
|
|
66
|
+
await navigator.clipboard.writeText(e), O(!0), setTimeout(() => O(!1), 1500);
|
|
47
67
|
} catch {
|
|
48
|
-
|
|
68
|
+
M("Could not copy — select and copy manually.");
|
|
49
69
|
}
|
|
50
|
-
},
|
|
70
|
+
}, B = {
|
|
51
71
|
padding: "8px 14px",
|
|
52
72
|
borderRadius: "8px",
|
|
53
73
|
border: "none",
|
|
54
|
-
background:
|
|
74
|
+
background: d.actionPrimaryBg,
|
|
55
75
|
color: "#fff",
|
|
56
76
|
fontSize: "13px",
|
|
57
77
|
fontWeight: 600,
|
|
58
78
|
cursor: "pointer"
|
|
59
|
-
},
|
|
79
|
+
}, V = {
|
|
60
80
|
padding: "8px 14px",
|
|
61
81
|
borderRadius: "8px",
|
|
62
|
-
border: `1px solid ${
|
|
82
|
+
border: `1px solid ${d.borderDefault}`,
|
|
63
83
|
background: "transparent",
|
|
64
|
-
color:
|
|
84
|
+
color: d.textPrimary,
|
|
65
85
|
fontSize: "13px",
|
|
66
86
|
cursor: "pointer"
|
|
67
|
-
},
|
|
87
|
+
}, H = {
|
|
68
88
|
flex: 1,
|
|
69
89
|
padding: "8px 10px",
|
|
70
90
|
borderRadius: "8px",
|
|
71
|
-
border: `1px solid ${
|
|
72
|
-
background:
|
|
73
|
-
color:
|
|
91
|
+
border: `1px solid ${d.borderDefault}`,
|
|
92
|
+
background: d.bgSecondary,
|
|
93
|
+
color: d.textPrimary,
|
|
74
94
|
fontSize: "13px"
|
|
75
95
|
};
|
|
76
96
|
return /* @__PURE__ */ o("div", {
|
|
@@ -83,23 +103,23 @@ function c({ dashboardId: c, colors: l }) {
|
|
|
83
103
|
justifyContent: "space-between",
|
|
84
104
|
padding: "12px 14px",
|
|
85
105
|
borderRadius: "10px",
|
|
86
|
-
background:
|
|
106
|
+
background: d.bgSecondary,
|
|
87
107
|
marginBottom: "16px"
|
|
88
108
|
},
|
|
89
109
|
children: [/* @__PURE__ */ o("div", { children: [/* @__PURE__ */ a("div", {
|
|
90
110
|
style: {
|
|
91
111
|
fontSize: "14px",
|
|
92
112
|
fontWeight: 600,
|
|
93
|
-
color:
|
|
113
|
+
color: d.textPrimary
|
|
94
114
|
},
|
|
95
115
|
children: "Publish to the web"
|
|
96
116
|
}), /* @__PURE__ */ a("div", {
|
|
97
117
|
style: {
|
|
98
118
|
fontSize: "12px",
|
|
99
|
-
color:
|
|
119
|
+
color: d.textSecondary,
|
|
100
120
|
marginTop: "2px"
|
|
101
121
|
},
|
|
102
|
-
children:
|
|
122
|
+
children: N ? "This dashboard is live. Anyone with the link on an allowed website sees its live data." : "Embed this dashboard on your website. Viewers see live data — no login required."
|
|
103
123
|
})] }), /* @__PURE__ */ a("span", {
|
|
104
124
|
style: {
|
|
105
125
|
fontSize: "11px",
|
|
@@ -107,9 +127,9 @@ function c({ dashboardId: c, colors: l }) {
|
|
|
107
127
|
padding: "3px 8px",
|
|
108
128
|
borderRadius: "999px",
|
|
109
129
|
color: "#fff",
|
|
110
|
-
background:
|
|
130
|
+
background: N ? d.statusSuccessBg : d.textTertiary
|
|
111
131
|
},
|
|
112
|
-
children:
|
|
132
|
+
children: N ? "PUBLISHED" : "PRIVATE"
|
|
113
133
|
})]
|
|
114
134
|
}),
|
|
115
135
|
/* @__PURE__ */ o("div", {
|
|
@@ -119,7 +139,7 @@ function c({ dashboardId: c, colors: l }) {
|
|
|
119
139
|
style: {
|
|
120
140
|
fontSize: "12px",
|
|
121
141
|
fontWeight: 600,
|
|
122
|
-
color:
|
|
142
|
+
color: d.textSecondary,
|
|
123
143
|
marginBottom: "6px"
|
|
124
144
|
},
|
|
125
145
|
children: "Allowed website domains"
|
|
@@ -131,24 +151,24 @@ function c({ dashboardId: c, colors: l }) {
|
|
|
131
151
|
marginBottom: "8px"
|
|
132
152
|
},
|
|
133
153
|
children: [/* @__PURE__ */ a("input", {
|
|
134
|
-
style:
|
|
154
|
+
style: H,
|
|
135
155
|
placeholder: "https://yoursite.com",
|
|
136
|
-
value:
|
|
137
|
-
onChange: (e) =>
|
|
156
|
+
value: x,
|
|
157
|
+
onChange: (e) => S(e.target.value),
|
|
138
158
|
onKeyDown: (e) => {
|
|
139
|
-
e.key === "Enter" &&
|
|
159
|
+
e.key === "Enter" && I();
|
|
140
160
|
}
|
|
141
161
|
}), /* @__PURE__ */ a("button", {
|
|
142
|
-
style:
|
|
143
|
-
onClick:
|
|
162
|
+
style: V,
|
|
163
|
+
onClick: I,
|
|
144
164
|
type: "button",
|
|
145
165
|
children: "Add"
|
|
146
166
|
})]
|
|
147
167
|
}),
|
|
148
|
-
|
|
168
|
+
P.length === 0 ? /* @__PURE__ */ a("div", {
|
|
149
169
|
style: {
|
|
150
170
|
fontSize: "12px",
|
|
151
|
-
color:
|
|
171
|
+
color: d.textTertiary
|
|
152
172
|
},
|
|
153
173
|
children: "No domains yet. Only listed https domains may frame this dashboard."
|
|
154
174
|
}) : /* @__PURE__ */ a("div", {
|
|
@@ -157,28 +177,28 @@ function c({ dashboardId: c, colors: l }) {
|
|
|
157
177
|
flexDirection: "column",
|
|
158
178
|
gap: "6px"
|
|
159
179
|
},
|
|
160
|
-
children:
|
|
180
|
+
children: P.map((e) => /* @__PURE__ */ o("div", {
|
|
161
181
|
style: {
|
|
162
182
|
display: "flex",
|
|
163
183
|
alignItems: "center",
|
|
164
184
|
justifyContent: "space-between",
|
|
165
185
|
padding: "6px 10px",
|
|
166
186
|
borderRadius: "8px",
|
|
167
|
-
background:
|
|
187
|
+
background: d.bgTertiary
|
|
168
188
|
},
|
|
169
189
|
children: [/* @__PURE__ */ a("span", {
|
|
170
190
|
style: {
|
|
171
191
|
fontSize: "13px",
|
|
172
|
-
color:
|
|
192
|
+
color: d.textPrimary
|
|
173
193
|
},
|
|
174
194
|
children: e
|
|
175
195
|
}), /* @__PURE__ */ a("button", {
|
|
176
196
|
style: {
|
|
177
|
-
...
|
|
197
|
+
...V,
|
|
178
198
|
padding: "2px 8px",
|
|
179
|
-
color:
|
|
199
|
+
color: d.statusErrorText
|
|
180
200
|
},
|
|
181
|
-
onClick: () =>
|
|
201
|
+
onClick: () => L(e),
|
|
182
202
|
type: "button",
|
|
183
203
|
children: "Remove"
|
|
184
204
|
})]
|
|
@@ -186,7 +206,7 @@ function c({ dashboardId: c, colors: l }) {
|
|
|
186
206
|
})
|
|
187
207
|
]
|
|
188
208
|
}),
|
|
189
|
-
!
|
|
209
|
+
!N && /* @__PURE__ */ o("div", {
|
|
190
210
|
style: { marginBottom: "8px" },
|
|
191
211
|
children: [/* @__PURE__ */ o("label", {
|
|
192
212
|
style: {
|
|
@@ -197,46 +217,85 @@ function c({ dashboardId: c, colors: l }) {
|
|
|
197
217
|
},
|
|
198
218
|
children: [/* @__PURE__ */ a("input", {
|
|
199
219
|
type: "checkbox",
|
|
200
|
-
checked:
|
|
201
|
-
onChange: (e) =>
|
|
220
|
+
checked: T,
|
|
221
|
+
onChange: (e) => E(e.target.checked)
|
|
202
222
|
}), /* @__PURE__ */ a("span", {
|
|
203
223
|
style: {
|
|
204
224
|
fontSize: "12px",
|
|
205
|
-
color:
|
|
225
|
+
color: d.textSecondary
|
|
206
226
|
},
|
|
207
227
|
children: "I understand this makes the dashboard's live data visible to anyone with the link, and I confirm it is safe to be public."
|
|
208
228
|
})]
|
|
209
229
|
}), /* @__PURE__ */ a("button", {
|
|
210
|
-
style:
|
|
211
|
-
onClick:
|
|
212
|
-
disabled:
|
|
230
|
+
style: B,
|
|
231
|
+
onClick: R,
|
|
232
|
+
disabled: m,
|
|
213
233
|
type: "button",
|
|
214
|
-
children:
|
|
234
|
+
children: m ? "Publishing…" : "Publish to web"
|
|
215
235
|
})]
|
|
216
236
|
}),
|
|
217
|
-
|
|
237
|
+
N && /* @__PURE__ */ o(i, { children: [F ? /* @__PURE__ */ o("div", {
|
|
218
238
|
style: { marginBottom: "16px" },
|
|
219
239
|
children: [
|
|
220
|
-
/* @__PURE__ */
|
|
240
|
+
/* @__PURE__ */ o("div", {
|
|
221
241
|
style: {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
242
|
+
display: "flex",
|
|
243
|
+
alignItems: "center",
|
|
244
|
+
justifyContent: "space-between",
|
|
225
245
|
marginBottom: "6px"
|
|
226
246
|
},
|
|
227
|
-
children: "
|
|
247
|
+
children: [/* @__PURE__ */ a("span", {
|
|
248
|
+
style: {
|
|
249
|
+
fontSize: "12px",
|
|
250
|
+
fontWeight: 600,
|
|
251
|
+
color: d.textSecondary
|
|
252
|
+
},
|
|
253
|
+
children: "Embed snippet"
|
|
254
|
+
}), /* @__PURE__ */ o("label", {
|
|
255
|
+
style: {
|
|
256
|
+
display: "flex",
|
|
257
|
+
alignItems: "center",
|
|
258
|
+
gap: "6px"
|
|
259
|
+
},
|
|
260
|
+
children: [/* @__PURE__ */ a("span", {
|
|
261
|
+
style: {
|
|
262
|
+
fontSize: "12px",
|
|
263
|
+
color: d.textTertiary
|
|
264
|
+
},
|
|
265
|
+
children: "Theme"
|
|
266
|
+
}), /* @__PURE__ */ a("select", {
|
|
267
|
+
value: k,
|
|
268
|
+
onChange: (e) => {
|
|
269
|
+
let t = e.target.value;
|
|
270
|
+
(t === "light" || t === "dark" || t === "auto") && A(t);
|
|
271
|
+
},
|
|
272
|
+
style: {
|
|
273
|
+
padding: "4px 8px",
|
|
274
|
+
borderRadius: "6px",
|
|
275
|
+
border: `1px solid ${d.borderDefault}`,
|
|
276
|
+
background: d.bgSecondary,
|
|
277
|
+
color: d.textPrimary,
|
|
278
|
+
fontSize: "12px",
|
|
279
|
+
cursor: "pointer"
|
|
280
|
+
},
|
|
281
|
+
children: s.map((e) => /* @__PURE__ */ a("option", {
|
|
282
|
+
value: e.value,
|
|
283
|
+
children: e.label
|
|
284
|
+
}, e.value))
|
|
285
|
+
})]
|
|
286
|
+
})]
|
|
228
287
|
}),
|
|
229
288
|
/* @__PURE__ */ a("textarea", {
|
|
230
289
|
readOnly: !0,
|
|
231
|
-
value:
|
|
290
|
+
value: F,
|
|
232
291
|
style: {
|
|
233
292
|
width: "100%",
|
|
234
293
|
minHeight: "96px",
|
|
235
294
|
padding: "10px",
|
|
236
295
|
borderRadius: "8px",
|
|
237
|
-
border: `1px solid ${
|
|
238
|
-
background:
|
|
239
|
-
color:
|
|
296
|
+
border: `1px solid ${d.borderDefault}`,
|
|
297
|
+
background: d.bgSecondary,
|
|
298
|
+
color: d.textPrimary,
|
|
240
299
|
fontFamily: "monospace",
|
|
241
300
|
fontSize: "12px",
|
|
242
301
|
resize: "vertical"
|
|
@@ -244,19 +303,19 @@ function c({ dashboardId: c, colors: l }) {
|
|
|
244
303
|
}),
|
|
245
304
|
/* @__PURE__ */ a("button", {
|
|
246
305
|
style: {
|
|
247
|
-
...
|
|
306
|
+
...V,
|
|
248
307
|
marginTop: "8px"
|
|
249
308
|
},
|
|
250
|
-
onClick: () => F
|
|
309
|
+
onClick: () => z(F),
|
|
251
310
|
type: "button",
|
|
252
|
-
children:
|
|
311
|
+
children: D ? "Copied ✓" : "Copy snippet"
|
|
253
312
|
})
|
|
254
313
|
]
|
|
255
314
|
}) : /* @__PURE__ */ o("div", {
|
|
256
315
|
style: {
|
|
257
316
|
fontSize: "12px",
|
|
258
|
-
color:
|
|
259
|
-
background:
|
|
317
|
+
color: d.textSecondary,
|
|
318
|
+
background: d.bgSecondary,
|
|
260
319
|
borderRadius: "8px",
|
|
261
320
|
padding: "10px 12px",
|
|
262
321
|
marginBottom: "16px"
|
|
@@ -272,37 +331,37 @@ function c({ dashboardId: c, colors: l }) {
|
|
|
272
331
|
gap: "8px"
|
|
273
332
|
},
|
|
274
333
|
children: [/* @__PURE__ */ a("button", {
|
|
275
|
-
style:
|
|
276
|
-
onClick: () =>
|
|
277
|
-
disabled:
|
|
334
|
+
style: V,
|
|
335
|
+
onClick: () => f && y(f.id),
|
|
336
|
+
disabled: m,
|
|
278
337
|
type: "button",
|
|
279
338
|
children: "Rotate link"
|
|
280
339
|
}), /* @__PURE__ */ a("button", {
|
|
281
340
|
style: {
|
|
282
|
-
...
|
|
283
|
-
color:
|
|
284
|
-
borderColor:
|
|
341
|
+
...V,
|
|
342
|
+
color: d.statusErrorText,
|
|
343
|
+
borderColor: d.statusErrorText
|
|
285
344
|
},
|
|
286
345
|
onClick: () => {
|
|
287
|
-
|
|
346
|
+
f && window.confirm("Unpublish this dashboard? The embed will stop working immediately for anyone using the link.") && b(f.id);
|
|
288
347
|
},
|
|
289
|
-
disabled:
|
|
348
|
+
disabled: m,
|
|
290
349
|
type: "button",
|
|
291
350
|
children: "Unpublish"
|
|
292
351
|
})]
|
|
293
352
|
})] }),
|
|
294
|
-
(
|
|
353
|
+
(j || h) && /* @__PURE__ */ a("div", {
|
|
295
354
|
style: {
|
|
296
355
|
marginTop: "12px",
|
|
297
356
|
fontSize: "12px",
|
|
298
|
-
color:
|
|
357
|
+
color: d.statusErrorText
|
|
299
358
|
},
|
|
300
|
-
children:
|
|
359
|
+
children: j ?? h?.message
|
|
301
360
|
})
|
|
302
361
|
]
|
|
303
362
|
});
|
|
304
363
|
}
|
|
305
364
|
//#endregion
|
|
306
|
-
export {
|
|
365
|
+
export { u as default };
|
|
307
366
|
|
|
308
367
|
//# sourceMappingURL=EmbedTab.js.map
|