@burdenoff/microfe-bigconsole 2026.1119.4 → 2026.1119.5
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 +126 -80
- package/dist/bigconsole/graphql/storeTemplates.d.ts +1 -1
- package/dist/bigconsole/graphql/storeTemplates.js +5 -5
- package/dist/bigconsole/hooks/usePublishOwnerOptions.d.ts +10 -0
- package/dist/bigconsole/hooks/usePublishOwnerOptions.js +48 -0
- package/dist/bigconsole/hooks/useStoreDashboardTemplates.d.ts +8 -0
- package/dist/bigconsole/hooks/useStoreDashboardTemplates.js +3 -1
- package/dist/bigconsole/utils/publishOwner.d.ts +100 -0
- package/dist/bigconsole/utils/publishOwner.js +71 -0
- package/dist/generated/global-operations.d.ts +19 -0
- package/dist/generated/global-operations.js +80 -1
- package/package.json +1 -1
|
@@ -1,149 +1,195 @@
|
|
|
1
|
-
import e from "../../hooks/
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { usePublishOwnerOptions as e } from "../../hooks/usePublishOwnerOptions.js";
|
|
2
|
+
import t from "../../hooks/useStoreDashboardTemplates.js";
|
|
3
|
+
import { publishOwnerName as n } from "../../utils/publishOwner.js";
|
|
4
|
+
import { memo as r, useCallback as i, useEffect as a, useState as o } from "react";
|
|
5
|
+
import { Button as s, Dialog as c, DialogContent as l, DialogDescription as u, DialogFooter as ee, DialogHeader as d, DialogTitle as f, Input as p, Select as m, SelectContent as h, SelectItem as g, SelectTrigger as _, SelectValue as v, Spinner as y, Textarea as b } from "@burdenoff/fe-libs/ui";
|
|
6
|
+
import { useI18n as te } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
7
|
+
import { jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
6
8
|
// src/bigconsole/components/dashboard/PublishToStoreDialog.tsx
|
|
7
|
-
|
|
9
|
+
var C = "__personal__";
|
|
10
|
+
function w(e) {
|
|
8
11
|
return e.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).join("-").slice(0, 60);
|
|
9
12
|
}
|
|
10
|
-
var
|
|
11
|
-
let { t:
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
var T = r(function({ isOpen: r, dashboardId: T, dashboardName: E, dashboardDescription: D, onClose: O, onPublished: k }) {
|
|
14
|
+
let { t: A } = te(), { publishToStore: j } = t({ autoLoad: !1 }), [M, N] = o(E), [P, F] = o(w(E)), [I, L] = o(D ?? ""), [R, z] = o(!1), [B, V] = o(!1), [H, U] = o(null), [W, G] = o(null), K = e(r), [q, J] = o(null), [Y, X] = o(!1);
|
|
15
|
+
a(() => {
|
|
16
|
+
Y || J(K.defaultOrganizationId);
|
|
17
|
+
}, [K.defaultOrganizationId, Y]), a(() => {
|
|
18
|
+
r && (N(E), F(w(E)), L(D ?? ""), z(!1), U(null), G(null), X(!1));
|
|
14
19
|
}, [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
r,
|
|
21
|
+
E,
|
|
22
|
+
D
|
|
18
23
|
]);
|
|
19
|
-
let
|
|
20
|
-
if (!
|
|
21
|
-
else if (!
|
|
22
|
-
else if (!
|
|
24
|
+
let Z = i(async () => {
|
|
25
|
+
if (!M.trim()) U(A("bigconsole.dashboards.publishStore.error.nameRequired", "A template name is required"));
|
|
26
|
+
else if (!P.trim()) U(A("bigconsole.dashboards.publishStore.error.slugRequired", "A slug is required"));
|
|
27
|
+
else if (!I.trim()) U(A("bigconsole.dashboards.publishStore.error.descriptionRequired", "A description is required — it is what people see in the gallery"));
|
|
23
28
|
else {
|
|
24
|
-
|
|
29
|
+
U(null), V(!0);
|
|
25
30
|
try {
|
|
26
|
-
let e = await
|
|
27
|
-
dashboardId:
|
|
28
|
-
name:
|
|
29
|
-
slug:
|
|
30
|
-
description:
|
|
31
|
-
includeSampleData:
|
|
31
|
+
let e = await j({
|
|
32
|
+
dashboardId: T,
|
|
33
|
+
name: M.trim(),
|
|
34
|
+
slug: P.trim(),
|
|
35
|
+
description: I.trim(),
|
|
36
|
+
includeSampleData: R,
|
|
37
|
+
developerOrganizationId: q
|
|
32
38
|
});
|
|
33
39
|
if (!e.success) {
|
|
34
|
-
|
|
40
|
+
U(e.errorMessage ?? A("bigconsole.dashboards.publishStore.error.publishFailed", "Failed to publish to the store"));
|
|
35
41
|
return;
|
|
36
42
|
}
|
|
37
|
-
|
|
43
|
+
G(e), k?.(e);
|
|
38
44
|
} finally {
|
|
39
|
-
|
|
45
|
+
V(!1);
|
|
40
46
|
}
|
|
41
47
|
}
|
|
42
48
|
}, [
|
|
43
|
-
E,
|
|
44
|
-
O,
|
|
45
|
-
A,
|
|
46
49
|
M,
|
|
47
|
-
|
|
50
|
+
P,
|
|
51
|
+
I,
|
|
52
|
+
R,
|
|
53
|
+
q,
|
|
48
54
|
T,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
j,
|
|
56
|
+
k,
|
|
57
|
+
A
|
|
58
|
+
]), ne = A("bigconsole.dashboards.publishStore.owner.personal", "Personal (only you)"), re = A("bigconsole.dashboards.publishStore.owner.viewerSuffix", "viewer — cannot publish"), ie = A("bigconsole.dashboards.publishStore.owner.inactiveSuffix", "inactive member — cannot publish"), ae = (e) => e.organizationId === null ? ne : e.disabledReason === "inactive" ? `${e.name} (${ie})` : e.disabledReason === "viewer" ? `${e.name} (${re})` : e.name, Q = W ? n(K.options, W.developerOrganizationId ?? null) : null, $ = {
|
|
52
59
|
display: "block",
|
|
53
60
|
marginBottom: "var(--space-2xs)",
|
|
54
61
|
fontSize: "var(--font-size-sm)"
|
|
55
62
|
};
|
|
56
|
-
return /* @__PURE__ */
|
|
57
|
-
open:
|
|
58
|
-
onOpenChange: (e) => !e && !
|
|
59
|
-
children: /* @__PURE__ */
|
|
63
|
+
return /* @__PURE__ */ x(c, {
|
|
64
|
+
open: r,
|
|
65
|
+
onOpenChange: (e) => !e && !B && O(),
|
|
66
|
+
children: /* @__PURE__ */ S(l, {
|
|
60
67
|
style: { maxWidth: "520px" },
|
|
61
68
|
children: [
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
|
|
69
|
+
/* @__PURE__ */ S(d, { children: [/* @__PURE__ */ x(f, { children: A("bigconsole.dashboards.publishStore.title", "Publish as Template") }), /* @__PURE__ */ x(u, { children: A("bigconsole.dashboards.publishStore.subtitle", "Share this dashboard as a reusable template. Your data sources are replaced with named slots, so nothing from this workspace is published.") })] }),
|
|
70
|
+
W ? /* @__PURE__ */ S("div", {
|
|
64
71
|
style: { padding: "var(--space-md) 0" },
|
|
65
72
|
children: [
|
|
66
|
-
/* @__PURE__ */
|
|
73
|
+
/* @__PURE__ */ x("p", {
|
|
67
74
|
style: { fontWeight: "var(--font-weight-medium)" },
|
|
68
|
-
children:
|
|
75
|
+
children: A("bigconsole.dashboards.publishStore.result.title", "Draft template created")
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ x("p", {
|
|
78
|
+
style: {
|
|
79
|
+
fontSize: "var(--font-size-sm)",
|
|
80
|
+
color: "var(--color-text-muted)"
|
|
81
|
+
},
|
|
82
|
+
children: W.sinkCount === 1 ? A("bigconsole.dashboards.publishStore.result.sinksOne", "{{count}} data source turned into slots. Finish in the Developer Portal: review the listing, then submit it for approval. It appears in the gallery once approved.", { count: W.sinkCount ?? "" }) : A("bigconsole.dashboards.publishStore.result.sinksMany", "{{count}} data sources turned into slots. Finish in the Developer Portal: review the listing, then submit it for approval. It appears in the gallery once approved.", { count: W.sinkCount ?? "" })
|
|
69
83
|
}),
|
|
70
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ x("p", {
|
|
85
|
+
"data-testid": "publish-store-owner-result",
|
|
71
86
|
style: {
|
|
72
87
|
fontSize: "var(--font-size-sm)",
|
|
73
88
|
color: "var(--color-text-muted)"
|
|
74
89
|
},
|
|
75
|
-
children:
|
|
90
|
+
children: Q ? A("bigconsole.dashboards.publishStore.result.ownerOrg", "Saved as a draft owned by {{owner}}. In the Developer Portal, open My Applications with {{owner}} selected in the organization switcher to find it.", { owner: Q }) : A("bigconsole.dashboards.publishStore.result.ownerPersonal", "Saved as your personal draft. In the Developer Portal, open My Applications and choose Personal (or All) in the organization switcher to find it.")
|
|
76
91
|
}),
|
|
77
|
-
|
|
92
|
+
W.unknownSinkIds.length > 0 && /* @__PURE__ */ x("p", {
|
|
78
93
|
style: {
|
|
79
94
|
fontSize: "var(--font-size-sm)",
|
|
80
95
|
color: "var(--color-text-warning)"
|
|
81
96
|
},
|
|
82
|
-
children:
|
|
97
|
+
children: W.unknownSinkIds.length === 1 ? A("bigconsole.dashboards.publishStore.result.unknownOne", "{{count}} data source could not be named — those slots use generic labels.", { count: W.unknownSinkIds.length ?? "" }) : A("bigconsole.dashboards.publishStore.result.unknownMany", "{{count}} data sources could not be named — those slots use generic labels.", { count: W.unknownSinkIds.length ?? "" })
|
|
83
98
|
})
|
|
84
99
|
]
|
|
85
|
-
}) : /* @__PURE__ */
|
|
100
|
+
}) : /* @__PURE__ */ S("div", {
|
|
86
101
|
style: {
|
|
87
102
|
display: "flex",
|
|
88
103
|
flexDirection: "column",
|
|
89
104
|
gap: "var(--space-sm)"
|
|
90
105
|
},
|
|
91
106
|
children: [
|
|
92
|
-
/* @__PURE__ */
|
|
107
|
+
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
|
|
93
108
|
htmlFor: "tpl-name",
|
|
94
|
-
style:
|
|
95
|
-
children:
|
|
96
|
-
}), /* @__PURE__ */
|
|
109
|
+
style: $,
|
|
110
|
+
children: A("bigconsole.dashboards.publishStore.field.name", "Template name")
|
|
111
|
+
}), /* @__PURE__ */ x(p, {
|
|
97
112
|
id: "tpl-name",
|
|
98
|
-
value:
|
|
99
|
-
disabled:
|
|
113
|
+
value: M,
|
|
114
|
+
disabled: B,
|
|
100
115
|
onChange: (e) => {
|
|
101
|
-
|
|
116
|
+
N(e.target.value), F(w(e.target.value));
|
|
102
117
|
}
|
|
103
118
|
})] }),
|
|
104
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
|
|
105
120
|
htmlFor: "tpl-slug",
|
|
106
|
-
style:
|
|
107
|
-
children:
|
|
108
|
-
}), /* @__PURE__ */
|
|
121
|
+
style: $,
|
|
122
|
+
children: A("bigconsole.dashboards.publishStore.field.slug", "Slug")
|
|
123
|
+
}), /* @__PURE__ */ x(p, {
|
|
109
124
|
id: "tpl-slug",
|
|
110
|
-
value:
|
|
111
|
-
disabled:
|
|
112
|
-
onChange: (e) =>
|
|
125
|
+
value: P,
|
|
126
|
+
disabled: B,
|
|
127
|
+
onChange: (e) => F(w(e.target.value))
|
|
113
128
|
})] }),
|
|
114
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ S("div", { children: [
|
|
130
|
+
/* @__PURE__ */ x("label", {
|
|
131
|
+
htmlFor: "tpl-owner",
|
|
132
|
+
style: $,
|
|
133
|
+
children: A("bigconsole.dashboards.publishStore.field.owner", "Publish as")
|
|
134
|
+
}),
|
|
135
|
+
/* @__PURE__ */ S(m, {
|
|
136
|
+
value: q ?? C,
|
|
137
|
+
disabled: B || K.loading,
|
|
138
|
+
onValueChange: (e) => {
|
|
139
|
+
X(!0), J(e === C ? null : e);
|
|
140
|
+
},
|
|
141
|
+
children: [/* @__PURE__ */ x(_, {
|
|
142
|
+
id: "tpl-owner",
|
|
143
|
+
"data-testid": "publish-store-owner",
|
|
144
|
+
children: /* @__PURE__ */ x(v, {})
|
|
145
|
+
}), /* @__PURE__ */ x(h, { children: K.options.map((e) => /* @__PURE__ */ x(g, {
|
|
146
|
+
value: e.organizationId ?? C,
|
|
147
|
+
disabled: e.disabled,
|
|
148
|
+
children: ae(e)
|
|
149
|
+
}, e.organizationId ?? C)) })]
|
|
150
|
+
}),
|
|
151
|
+
/* @__PURE__ */ x("p", {
|
|
152
|
+
style: {
|
|
153
|
+
marginTop: "var(--space-2xs)",
|
|
154
|
+
fontSize: "var(--font-size-xs)",
|
|
155
|
+
color: "var(--color-text-muted)"
|
|
156
|
+
},
|
|
157
|
+
children: K.loading ? A("bigconsole.dashboards.publishStore.owner.loading", "Loading your developer organizations…") : K.error ? A("bigconsole.dashboards.publishStore.owner.loadFailed", "Could not load your developer organizations, so this template can only be published as personal.") : A("bigconsole.dashboards.publishStore.owner.hint", "The draft appears under this owner in the Developer Portal.")
|
|
158
|
+
})
|
|
159
|
+
] }),
|
|
160
|
+
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
|
|
115
161
|
htmlFor: "tpl-desc",
|
|
116
|
-
style:
|
|
117
|
-
children:
|
|
118
|
-
}), /* @__PURE__ */
|
|
162
|
+
style: $,
|
|
163
|
+
children: A("bigconsole.dashboards.publishStore.field.description", "Description")
|
|
164
|
+
}), /* @__PURE__ */ x(b, {
|
|
119
165
|
id: "tpl-desc",
|
|
120
166
|
rows: 3,
|
|
121
|
-
value:
|
|
122
|
-
disabled:
|
|
123
|
-
placeholder:
|
|
124
|
-
onChange: (e) =>
|
|
167
|
+
value: I,
|
|
168
|
+
disabled: B,
|
|
169
|
+
placeholder: A("bigconsole.dashboards.publishStore.field.descriptionPlaceholder", "What is this dashboard for, and what data does it need?"),
|
|
170
|
+
onChange: (e) => L(e.target.value)
|
|
125
171
|
})] }),
|
|
126
|
-
|
|
172
|
+
H && /* @__PURE__ */ x("p", {
|
|
127
173
|
style: {
|
|
128
174
|
color: "var(--color-text-danger)",
|
|
129
175
|
fontSize: "var(--font-size-sm)"
|
|
130
176
|
},
|
|
131
|
-
children:
|
|
177
|
+
children: H
|
|
132
178
|
})
|
|
133
179
|
]
|
|
134
180
|
}),
|
|
135
|
-
/* @__PURE__ */
|
|
181
|
+
/* @__PURE__ */ S(ee, { children: [/* @__PURE__ */ x(s, {
|
|
136
182
|
variant: "outline",
|
|
137
|
-
onClick:
|
|
138
|
-
disabled:
|
|
139
|
-
children:
|
|
140
|
-
}), !
|
|
141
|
-
onClick:
|
|
142
|
-
disabled:
|
|
143
|
-
children:
|
|
183
|
+
onClick: O,
|
|
184
|
+
disabled: B,
|
|
185
|
+
children: W ? A("bigconsole.dashboards.publishStore.action.done", "Done") : A("bigconsole.dashboards.publishStore.action.cancel", "Cancel")
|
|
186
|
+
}), !W && /* @__PURE__ */ x(s, {
|
|
187
|
+
onClick: Z,
|
|
188
|
+
disabled: B || K.loading,
|
|
189
|
+
children: B ? /* @__PURE__ */ x(y, {}) : A("bigconsole.dashboards.publishStore.action.publish", "Publish")
|
|
144
190
|
})] })
|
|
145
191
|
]
|
|
146
192
|
})
|
|
147
193
|
});
|
|
148
194
|
});
|
|
149
|
-
export {
|
|
195
|
+
export { T as PublishToStoreDialog, T as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { BrowseDashboardTemplatesDocument as BROWSE_DASHBOARD_TEMPLATES, GetDashboardTemplateDetailDocument as GET_DASHBOARD_TEMPLATE_DETAIL, CreateDashboardTemplateAppDocument as CREATE_TEMPLATE_APP, CreateDashboardTemplateVersionDocument as CREATE_TEMPLATE_VERSION, } from '../../generated/global-operations';
|
|
1
|
+
export { BrowseDashboardTemplatesDocument as BROWSE_DASHBOARD_TEMPLATES, GetDashboardTemplateDetailDocument as GET_DASHBOARD_TEMPLATE_DETAIL, CreateDashboardTemplateAppDocument as CREATE_TEMPLATE_APP, CreateDashboardTemplateVersionDocument as CREATE_TEMPLATE_VERSION, GetPublishOwnerOrganizationsDocument as GET_PUBLISH_OWNER_ORGANIZATIONS, } from '../../generated/global-operations';
|
|
2
2
|
export declare const IMPORT_DASHBOARD_TEMPLATE: import('graphql').DocumentNode;
|
|
3
3
|
/**
|
|
4
4
|
* Same interim treatment as IMPORT_DASHBOARD_TEMPLATE, and for the same reason:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BrowseDashboardTemplatesDocument as e, CreateDashboardTemplateAppDocument as t, CreateDashboardTemplateVersionDocument as n, GetDashboardTemplateDetailDocument as r } from "../../generated/global-operations.js";
|
|
2
|
-
import { gql as
|
|
1
|
+
import { BrowseDashboardTemplatesDocument as e, CreateDashboardTemplateAppDocument as t, CreateDashboardTemplateVersionDocument as n, GetDashboardTemplateDetailDocument as r, GetPublishOwnerOrganizationsDocument as i } from "../../generated/global-operations.js";
|
|
2
|
+
import { gql as a } from "@apollo/client";
|
|
3
3
|
// src/bigconsole/graphql/storeTemplates.ts
|
|
4
|
-
var
|
|
4
|
+
var o = a`
|
|
5
5
|
mutation ImportDashboardTemplate($input: BigConsoleImportDashboardTemplateInput!) {
|
|
6
6
|
importDashboardTemplate(input: $input) {
|
|
7
7
|
success
|
|
@@ -20,7 +20,7 @@ var a = i`
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
`,
|
|
23
|
+
`, s = a`
|
|
24
24
|
query BuildDashboardTemplateContent(
|
|
25
25
|
$dashboardId: ID!
|
|
26
26
|
$defaultDashboardName: String
|
|
@@ -42,4 +42,4 @@ var a = i`
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
`;
|
|
45
|
-
export { e as BROWSE_DASHBOARD_TEMPLATES,
|
|
45
|
+
export { e as BROWSE_DASHBOARD_TEMPLATES, s as BUILD_DASHBOARD_TEMPLATE_CONTENT, t as CREATE_TEMPLATE_APP, n as CREATE_TEMPLATE_VERSION, r as GET_DASHBOARD_TEMPLATE_DETAIL, i as GET_PUBLISH_OWNER_ORGANIZATIONS, o as IMPORT_DASHBOARD_TEMPLATE };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PublishOwnerOption } from '../utils/publishOwner';
|
|
2
|
+
export interface UsePublishOwnerOptionsResult {
|
|
3
|
+
options: PublishOwnerOption[];
|
|
4
|
+
/** Owner to preselect; null means Personal. */
|
|
5
|
+
defaultOrganizationId: string | null;
|
|
6
|
+
loading: boolean;
|
|
7
|
+
/** Set when the organizations could not be loaded; Personal stays available. */
|
|
8
|
+
error: string | null;
|
|
9
|
+
}
|
|
10
|
+
export declare function usePublishOwnerOptions(enabled: boolean): UsePublishOwnerOptionsResult;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useBigConsole as e } from "../context/BigConsoleContext.js";
|
|
2
|
+
import { GetPublishOwnerOrganizationsDocument as t } from "../../generated/global-operations.js";
|
|
3
|
+
import "../graphql/storeTemplates.js";
|
|
4
|
+
import { buildPublishOwnerOptions as n, loadPublishOwnerOrganizations as r, readDevportalActiveOrg as i, resolveDefaultPublishOwner as a } from "../utils/publishOwner.js";
|
|
5
|
+
import { useEffect as o, useMemo as s, useState as c } from "react";
|
|
6
|
+
import { graphqlFetch as l } from "@burdenoff/fe-libs/shared/graphql";
|
|
7
|
+
import { print as u } from "graphql";
|
|
8
|
+
// src/bigconsole/hooks/usePublishOwnerOptions.ts
|
|
9
|
+
var d = "GetPublishOwnerOrganizations", f = u(t);
|
|
10
|
+
function p() {
|
|
11
|
+
try {
|
|
12
|
+
return typeof window > "u" ? null : window.localStorage;
|
|
13
|
+
} catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function m(t) {
|
|
18
|
+
let { currentUser: u } = e(), m = u?.id ?? null, [h, g] = c(null), [_, v] = c(!1);
|
|
19
|
+
return o(() => {
|
|
20
|
+
if (!t) return;
|
|
21
|
+
let e = new AbortController();
|
|
22
|
+
return g(null), v(!0), r(() => l({
|
|
23
|
+
gateway: "global",
|
|
24
|
+
query: f,
|
|
25
|
+
operationName: d,
|
|
26
|
+
responseCache: "reload",
|
|
27
|
+
signal: e.signal,
|
|
28
|
+
suppressGlobalErrorEvent: !0
|
|
29
|
+
})).then((t) => {
|
|
30
|
+
e.signal.aborted || (g(t), v(!1));
|
|
31
|
+
}), () => {
|
|
32
|
+
e.abort(), v(!1);
|
|
33
|
+
};
|
|
34
|
+
}, [t]), s(() => {
|
|
35
|
+
let e = n(h?.orgs ?? [], m);
|
|
36
|
+
return {
|
|
37
|
+
options: e,
|
|
38
|
+
defaultOrganizationId: a(e, i(p())),
|
|
39
|
+
loading: _,
|
|
40
|
+
error: h?.error ?? null
|
|
41
|
+
};
|
|
42
|
+
}, [
|
|
43
|
+
h,
|
|
44
|
+
_,
|
|
45
|
+
m
|
|
46
|
+
]);
|
|
47
|
+
}
|
|
48
|
+
export { m as usePublishOwnerOptions };
|
|
@@ -90,12 +90,20 @@ export interface PublishToStoreArgs {
|
|
|
90
90
|
tags?: string[];
|
|
91
91
|
/** Embed a few real rows per data source so the board renders populated. */
|
|
92
92
|
includeSampleData?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Developer organization that owns the draft. Omitted/null creates a
|
|
95
|
+
* personally owned draft, which the Developer Portal lists under its
|
|
96
|
+
* "Personal" scope rather than under any organization (BOFF-10779).
|
|
97
|
+
*/
|
|
98
|
+
developerOrganizationId?: string | null;
|
|
93
99
|
}
|
|
94
100
|
export interface PublishToStoreResult {
|
|
95
101
|
success: boolean;
|
|
96
102
|
/** The DRAFT devportal application created for this template. */
|
|
97
103
|
applicationId?: string;
|
|
98
104
|
status?: string;
|
|
105
|
+
/** Organization the draft was created under; null when personally owned. */
|
|
106
|
+
developerOrganizationId?: string | null;
|
|
99
107
|
errorMessage?: string;
|
|
100
108
|
/** Distinct data sinks the dashboard referenced, all tokenised into slots. */
|
|
101
109
|
sinkCount: number;
|
|
@@ -154,7 +154,8 @@ function g(g = {}) {
|
|
|
154
154
|
description: e.description,
|
|
155
155
|
...e.category ? { category: e.category } : {},
|
|
156
156
|
tags: e.tags ?? [],
|
|
157
|
-
compatibleProducts: ["bigconsole"]
|
|
157
|
+
compatibleProducts: ["bigconsole"],
|
|
158
|
+
...e.developerOrganizationId ? { developerOrganizationId: e.developerOrganizationId } : {}
|
|
158
159
|
} }
|
|
159
160
|
})).data?.createApplication;
|
|
160
161
|
return o ? (await b.mutate({
|
|
@@ -170,6 +171,7 @@ function g(g = {}) {
|
|
|
170
171
|
success: !0,
|
|
171
172
|
applicationId: o.id,
|
|
172
173
|
status: o.status,
|
|
174
|
+
developerOrganizationId: e.developerOrganizationId ?? null,
|
|
173
175
|
sinkCount: a,
|
|
174
176
|
unknownSinkIds: s,
|
|
175
177
|
sampleDataSinkCount: c
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Who owns a dashboard template published from BigConsole.
|
|
3
|
+
*
|
|
4
|
+
* A "Publish as Template" draft is a devportal application. The Developer
|
|
5
|
+
* Portal lists applications per developer organization, so a draft created
|
|
6
|
+
* without one (personally owned) was invisible to anyone looking at an
|
|
7
|
+
* organization's My Applications list (BOFF-10779). The publish dialog
|
|
8
|
+
* therefore asks who publishes the template, and defaults to whatever the
|
|
9
|
+
* Developer Portal currently has selected so the draft lands where the author
|
|
10
|
+
* is about to look for it.
|
|
11
|
+
*
|
|
12
|
+
* @module bigconsole/utils/publishOwner
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* localStorage key the Developer Portal microfrontend uses for its selected
|
|
16
|
+
* organization. Both microfrontends run inside the same app shell origin, so
|
|
17
|
+
* reading it here keeps the two in step without any shared runtime state.
|
|
18
|
+
*/
|
|
19
|
+
export declare const DEVPORTAL_ACTIVE_ORG_STORAGE_KEY = "devportal_active_org_v1";
|
|
20
|
+
/** Values the Developer Portal stores instead of an org id (Personal / All scopes). */
|
|
21
|
+
export declare const DEVPORTAL_PERSONAL_SCOPE = "__personal__";
|
|
22
|
+
export declare const DEVPORTAL_ALL_SCOPE = "__all__";
|
|
23
|
+
/** Developer organization role, as reported by `myDeveloperOrganizations`. */
|
|
24
|
+
export type PublishOwnerOrgRole = 'OWNER' | 'ADMIN' | 'DEVELOPER' | 'VIEWER';
|
|
25
|
+
export interface PublishOwnerOrgSource {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
kind: string;
|
|
29
|
+
members?: ReadonlyArray<{
|
|
30
|
+
userId: string;
|
|
31
|
+
role: string;
|
|
32
|
+
isActive: boolean;
|
|
33
|
+
}> | null;
|
|
34
|
+
}
|
|
35
|
+
export interface PublishOwnerOption {
|
|
36
|
+
/** Developer organization id, or null for a personally owned draft. */
|
|
37
|
+
organizationId: string | null;
|
|
38
|
+
/** Organization name; empty for the personal option (the dialog labels it). */
|
|
39
|
+
name: string;
|
|
40
|
+
/** The current user's role in the organization, when known. */
|
|
41
|
+
role: PublishOwnerOrgRole | null;
|
|
42
|
+
/**
|
|
43
|
+
* True when the backend would refuse to create an application under this
|
|
44
|
+
* organization for the current user (viewers and inactive members).
|
|
45
|
+
*/
|
|
46
|
+
disabled: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Why the option is disabled, so the dialog can say so: an inactive
|
|
49
|
+
* membership wins over the role, because reactivation is what the user
|
|
50
|
+
* needs whatever their role is. Null when the option is selectable.
|
|
51
|
+
*/
|
|
52
|
+
disabledReason: PublishOwnerDisabledReason | null;
|
|
53
|
+
}
|
|
54
|
+
/** Why an organization cannot be chosen as the owner. */
|
|
55
|
+
export type PublishOwnerDisabledReason = 'inactive' | 'viewer';
|
|
56
|
+
/**
|
|
57
|
+
* Build the "Publish as" options: every non-PHYSICAL organization the user
|
|
58
|
+
* belongs to (devportal refuses applications under seller orgs), followed by
|
|
59
|
+
* the personal option. Organizations where the user is a viewer or an
|
|
60
|
+
* inactive member stay listed but disabled, so the user can see why they are
|
|
61
|
+
* not selectable instead of wondering where the org went.
|
|
62
|
+
*/
|
|
63
|
+
export declare function buildPublishOwnerOptions(orgs: ReadonlyArray<PublishOwnerOrgSource>, currentUserId: string | null | undefined): PublishOwnerOption[];
|
|
64
|
+
/**
|
|
65
|
+
* Pick the owner the dialog starts with:
|
|
66
|
+
* 1. the organization currently selected in the Developer Portal, when the
|
|
67
|
+
* user may publish under it;
|
|
68
|
+
* 2. otherwise the user's only selectable organization;
|
|
69
|
+
* 3. otherwise Personal.
|
|
70
|
+
* The Portal's "Personal" scope selects Personal directly; its "All" scope
|
|
71
|
+
* expresses no preference and falls through to rule 2.
|
|
72
|
+
*/
|
|
73
|
+
export declare function resolveDefaultPublishOwner(options: ReadonlyArray<PublishOwnerOption>, devportalSelection: string | null): string | null;
|
|
74
|
+
/** Read the Developer Portal's selected organization; null when unavailable. */
|
|
75
|
+
export declare function readDevportalActiveOrg(storage: Pick<Storage, 'getItem'> | null | undefined): string | null;
|
|
76
|
+
/** Display name of the chosen owner; null for Personal or an unknown id. */
|
|
77
|
+
export declare function publishOwnerName(options: ReadonlyArray<PublishOwnerOption>, organizationId: string | null): string | null;
|
|
78
|
+
/** The organizations request, as the hook issues it (injected for tests). */
|
|
79
|
+
export type FetchPublishOwnerOrgs = () => Promise<{
|
|
80
|
+
data: {
|
|
81
|
+
myDeveloperOrganizations?: ReadonlyArray<PublishOwnerOrgSource> | null;
|
|
82
|
+
} | null;
|
|
83
|
+
errors?: ReadonlyArray<{
|
|
84
|
+
message: string;
|
|
85
|
+
}>;
|
|
86
|
+
}>;
|
|
87
|
+
export type PublishOwnerOrgsLoad = {
|
|
88
|
+
orgs: PublishOwnerOrgSource[];
|
|
89
|
+
error: null;
|
|
90
|
+
} | {
|
|
91
|
+
orgs: [];
|
|
92
|
+
error: string;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Run the organizations request and reduce it to orgs-or-error. Never throws:
|
|
96
|
+
* a GraphQL error, a missing field or a network failure all become `error`,
|
|
97
|
+
* which the dialog explains inline (Personal stays available), so no caller
|
|
98
|
+
* needs a try/catch and no failure escapes to a global error handler.
|
|
99
|
+
*/
|
|
100
|
+
export declare function loadPublishOwnerOrganizations(fetchOrgs: FetchPublishOwnerOrgs): Promise<PublishOwnerOrgsLoad>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// src/bigconsole/utils/publishOwner.ts
|
|
2
|
+
var e = "devportal_active_org_v1", t = "__personal__", n = "__all__", r = /* @__PURE__ */ new Set([
|
|
3
|
+
"OWNER",
|
|
4
|
+
"ADMIN",
|
|
5
|
+
"DEVELOPER",
|
|
6
|
+
"VIEWER"
|
|
7
|
+
]);
|
|
8
|
+
function i(e) {
|
|
9
|
+
return r.has(e);
|
|
10
|
+
}
|
|
11
|
+
function a(e, t) {
|
|
12
|
+
return [...e.filter((e) => e.kind !== "PHYSICAL").map((e) => {
|
|
13
|
+
let n = t ? e.members?.find((e) => e.userId === t) : void 0, r = n && i(n.role) ? n.role : null, a = n?.isActive === !1 ? "inactive" : r === "VIEWER" ? "viewer" : null;
|
|
14
|
+
return {
|
|
15
|
+
organizationId: e.id,
|
|
16
|
+
name: e.name,
|
|
17
|
+
role: r,
|
|
18
|
+
disabled: a !== null,
|
|
19
|
+
disabledReason: a
|
|
20
|
+
};
|
|
21
|
+
}).sort((e, t) => e.name.localeCompare(t.name)), {
|
|
22
|
+
organizationId: null,
|
|
23
|
+
name: "",
|
|
24
|
+
role: null,
|
|
25
|
+
disabled: !1,
|
|
26
|
+
disabledReason: null
|
|
27
|
+
}];
|
|
28
|
+
}
|
|
29
|
+
function o(e, t) {
|
|
30
|
+
let n = e.filter((e) => e.organizationId !== null && !e.disabled);
|
|
31
|
+
if (t === "__personal__") return null;
|
|
32
|
+
if (t && t !== "__all__") {
|
|
33
|
+
let e = n.find((e) => e.organizationId === t);
|
|
34
|
+
if (e) return e.organizationId;
|
|
35
|
+
}
|
|
36
|
+
return n.length === 1 ? n[0]?.organizationId ?? null : null;
|
|
37
|
+
}
|
|
38
|
+
function s(t) {
|
|
39
|
+
if (!t) return null;
|
|
40
|
+
try {
|
|
41
|
+
return t.getItem(e);
|
|
42
|
+
} catch {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function c(e, t) {
|
|
47
|
+
return t ? e.find((e) => e.organizationId === t)?.name ?? null : null;
|
|
48
|
+
}
|
|
49
|
+
async function l(e) {
|
|
50
|
+
try {
|
|
51
|
+
let t = await e(), n = t.errors?.[0];
|
|
52
|
+
if (n) return {
|
|
53
|
+
orgs: [],
|
|
54
|
+
error: n.message
|
|
55
|
+
};
|
|
56
|
+
let r = t.data?.myDeveloperOrganizations;
|
|
57
|
+
return r ? {
|
|
58
|
+
orgs: [...r],
|
|
59
|
+
error: null
|
|
60
|
+
} : {
|
|
61
|
+
orgs: [],
|
|
62
|
+
error: "The developer organizations response was empty."
|
|
63
|
+
};
|
|
64
|
+
} catch (e) {
|
|
65
|
+
return {
|
|
66
|
+
orgs: [],
|
|
67
|
+
error: e instanceof Error ? e.message : String(e)
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export { e as DEVPORTAL_ACTIVE_ORG_STORAGE_KEY, n as DEVPORTAL_ALL_SCOPE, t as DEVPORTAL_PERSONAL_SCOPE, a as buildPublishOwnerOptions, l as loadPublishOwnerOrganizations, c as publishOwnerName, s as readDevportalActiveOrg, o as resolveDefaultPublishOwner };
|
|
@@ -62,6 +62,9 @@ export type CreateApplicationVersionInput = {
|
|
|
62
62
|
requiredScopes?: Array<string> | null | undefined;
|
|
63
63
|
version: string;
|
|
64
64
|
};
|
|
65
|
+
/** DIGITAL orgs publish Applications to the store; PHYSICAL orgs list physical goods via the seller portal. Not user-selectable — fixed at creation by which flow provisioned the org. See BOFF-7285. */
|
|
66
|
+
export type DeveloperOrgKind = 'DIGITAL' | 'PHYSICAL';
|
|
67
|
+
export type DeveloperOrgRole = 'ADMIN' | 'DEVELOPER' | 'OWNER' | 'VIEWER';
|
|
65
68
|
export type PricingModel = 'FREE' | 'PAID_ONETIME' | 'SUBSCRIPTION';
|
|
66
69
|
export type ProductNature = 'DIGITAL' | 'PHYSICAL';
|
|
67
70
|
export type ProductStatus = 'ARCHIVED' | 'DEPRECATED' | 'DRAFT' | 'PENDING_REVIEW' | 'PUBLISHED' | 'REJECTED' | 'UNLISTED';
|
|
@@ -206,8 +209,24 @@ export type GetDashboardTemplateDetailQuery = {
|
|
|
206
209
|
content: Record<string, unknown> | null;
|
|
207
210
|
} | null;
|
|
208
211
|
};
|
|
212
|
+
export type GetPublishOwnerOrganizationsQueryVariables = Exact<{
|
|
213
|
+
[key: string]: never;
|
|
214
|
+
}>;
|
|
215
|
+
export type GetPublishOwnerOrganizationsQuery = {
|
|
216
|
+
myDeveloperOrganizations: Array<{
|
|
217
|
+
id: string;
|
|
218
|
+
name: string;
|
|
219
|
+
kind: Types.DeveloperOrgKind;
|
|
220
|
+
members: Array<{
|
|
221
|
+
userId: string;
|
|
222
|
+
role: Types.DeveloperOrgRole;
|
|
223
|
+
isActive: boolean;
|
|
224
|
+
}>;
|
|
225
|
+
}>;
|
|
226
|
+
};
|
|
209
227
|
export declare const CreateDashboardTemplateAppDocument: DocumentNode<CreateDashboardTemplateAppMutation, CreateDashboardTemplateAppMutationVariables>;
|
|
210
228
|
export declare const CreateDashboardTemplateVersionDocument: DocumentNode<CreateDashboardTemplateVersionMutation, CreateDashboardTemplateVersionMutationVariables>;
|
|
211
229
|
export declare const BrowseDashboardTemplatesDocument: DocumentNode<BrowseDashboardTemplatesQuery, BrowseDashboardTemplatesQueryVariables>;
|
|
212
230
|
export declare const GetDashboardTemplateDetailDocument: DocumentNode<GetDashboardTemplateDetailQuery, GetDashboardTemplateDetailQueryVariables>;
|
|
231
|
+
export declare const GetPublishOwnerOrganizationsDocument: DocumentNode<GetPublishOwnerOrganizationsQuery, GetPublishOwnerOrganizationsQueryVariables>;
|
|
213
232
|
export {};
|
|
@@ -538,5 +538,84 @@ var e = {
|
|
|
538
538
|
}]
|
|
539
539
|
}
|
|
540
540
|
}]
|
|
541
|
+
}, i = {
|
|
542
|
+
kind: "Document",
|
|
543
|
+
definitions: [{
|
|
544
|
+
kind: "OperationDefinition",
|
|
545
|
+
operation: "query",
|
|
546
|
+
name: {
|
|
547
|
+
kind: "Name",
|
|
548
|
+
value: "GetPublishOwnerOrganizations"
|
|
549
|
+
},
|
|
550
|
+
selectionSet: {
|
|
551
|
+
kind: "SelectionSet",
|
|
552
|
+
selections: [{
|
|
553
|
+
kind: "Field",
|
|
554
|
+
name: {
|
|
555
|
+
kind: "Name",
|
|
556
|
+
value: "myDeveloperOrganizations"
|
|
557
|
+
},
|
|
558
|
+
selectionSet: {
|
|
559
|
+
kind: "SelectionSet",
|
|
560
|
+
selections: [
|
|
561
|
+
{
|
|
562
|
+
kind: "Field",
|
|
563
|
+
name: {
|
|
564
|
+
kind: "Name",
|
|
565
|
+
value: "id"
|
|
566
|
+
}
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
kind: "Field",
|
|
570
|
+
name: {
|
|
571
|
+
kind: "Name",
|
|
572
|
+
value: "name"
|
|
573
|
+
}
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
kind: "Field",
|
|
577
|
+
name: {
|
|
578
|
+
kind: "Name",
|
|
579
|
+
value: "kind"
|
|
580
|
+
}
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
kind: "Field",
|
|
584
|
+
name: {
|
|
585
|
+
kind: "Name",
|
|
586
|
+
value: "members"
|
|
587
|
+
},
|
|
588
|
+
selectionSet: {
|
|
589
|
+
kind: "SelectionSet",
|
|
590
|
+
selections: [
|
|
591
|
+
{
|
|
592
|
+
kind: "Field",
|
|
593
|
+
name: {
|
|
594
|
+
kind: "Name",
|
|
595
|
+
value: "userId"
|
|
596
|
+
}
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
kind: "Field",
|
|
600
|
+
name: {
|
|
601
|
+
kind: "Name",
|
|
602
|
+
value: "role"
|
|
603
|
+
}
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
kind: "Field",
|
|
607
|
+
name: {
|
|
608
|
+
kind: "Name",
|
|
609
|
+
value: "isActive"
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
]
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
]
|
|
616
|
+
}
|
|
617
|
+
}]
|
|
618
|
+
}
|
|
619
|
+
}]
|
|
541
620
|
};
|
|
542
|
-
export { n as BrowseDashboardTemplatesDocument, e as CreateDashboardTemplateAppDocument, t as CreateDashboardTemplateVersionDocument, r as GetDashboardTemplateDetailDocument };
|
|
621
|
+
export { n as BrowseDashboardTemplatesDocument, e as CreateDashboardTemplateAppDocument, t as CreateDashboardTemplateVersionDocument, r as GetDashboardTemplateDetailDocument, i as GetPublishOwnerOrganizationsDocument };
|