@burdenoff/microfe-bigconsole 2026.1001.4 → 2026.1001.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/CreateDashboardDialog.d.ts.map +1 -1
- package/dist/bigconsole/components/dashboard/CreateDashboardDialog.js +220 -161
- package/dist/bigconsole/components/dashboard/CreateDashboardDialog.js.map +1 -1
- package/dist/bigconsole/components/dashboard/TemplateInstallOptions.d.ts +11 -0
- package/dist/bigconsole/components/dashboard/TemplateInstallOptions.d.ts.map +1 -0
- package/dist/bigconsole/components/dashboard/TemplateInstallOptions.js +208 -0
- package/dist/bigconsole/components/dashboard/TemplateInstallOptions.js.map +1 -0
- package/dist/bigconsole/components/dashboard/TemplateLayoutPreview.d.ts +7 -0
- package/dist/bigconsole/components/dashboard/TemplateLayoutPreview.d.ts.map +1 -0
- package/dist/bigconsole/components/dashboard/TemplateLayoutPreview.js +51 -0
- package/dist/bigconsole/components/dashboard/TemplateLayoutPreview.js.map +1 -0
- package/dist/bigconsole/hooks/useStoreDashboardTemplates.d.ts +2 -0
- package/dist/bigconsole/hooks/useStoreDashboardTemplates.d.ts.map +1 -1
- package/dist/bigconsole/hooks/useStoreDashboardTemplates.js +91 -90
- package/dist/bigconsole/hooks/useStoreDashboardTemplates.js.map +1 -1
- package/dist/bigconsole/utils/dashboardTemplateContent.d.ts +10 -0
- package/dist/bigconsole/utils/dashboardTemplateContent.d.ts.map +1 -0
- package/dist/bigconsole/utils/dashboardTemplateContent.js +36 -0
- package/dist/bigconsole/utils/dashboardTemplateContent.js.map +1 -0
- package/dist/bigconsole/utils/templateInstallInputs.d.ts +5 -0
- package/dist/bigconsole/utils/templateInstallInputs.d.ts.map +1 -0
- package/dist/bigconsole/utils/templateInstallInputs.js +22 -0
- package/dist/bigconsole/utils/templateInstallInputs.js.map +1 -0
- package/dist/generated/global-operations.d.ts +1 -0
- package/dist/generated/global-operations.d.ts.map +1 -1
- package/dist/generated/global-operations.js +1 -0
- package/dist/generated/global-operations.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { isInstallableDashboardTemplate as e, withDashboardTemplateMetadata as t } from "../utils/dashboardTemplateContent.js";
|
|
2
|
+
import { BrowseDashboardTemplatesDocument as n, CreateDashboardTemplateAppDocument as r, CreateDashboardTemplateVersionDocument as i, GetDashboardTemplateDetailDocument as a } from "../../generated/global-operations.js";
|
|
3
|
+
import { BUILD_DASHBOARD_TEMPLATE_CONTENT as o, IMPORT_DASHBOARD_TEMPLATE as s } from "../graphql/storeTemplates.js";
|
|
4
|
+
import { useCallback as c, useEffect as l, useMemo as u, useState as d } from "react";
|
|
5
|
+
import { useApolloClient as f } from "@apollo/client/react";
|
|
6
|
+
import { useGatewayClient as p } from "@burdenoff/fe-libs/shared/graphql";
|
|
6
7
|
//#region src/bigconsole/hooks/useStoreDashboardTemplates.ts
|
|
7
|
-
function
|
|
8
|
+
function m(e) {
|
|
8
9
|
let t = e.pricingModel ?? "FREE";
|
|
9
10
|
return {
|
|
10
11
|
id: e.id,
|
|
@@ -22,20 +23,20 @@ function f(e) {
|
|
|
22
23
|
requiresPurchase: t !== "FREE" && (e.price ?? 0) > 0
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
-
let { search:
|
|
27
|
-
if (
|
|
28
|
-
|
|
26
|
+
function h(h = {}) {
|
|
27
|
+
let { search: g, category: _, autoLoad: v = !0 } = h, y = p("global"), b = f(), [x, S] = d([]), [C, w] = d(0), [T, E] = d(!1), [D, O] = d(null), k = c(async (t) => {
|
|
28
|
+
if (y) {
|
|
29
|
+
E(!0), O(null);
|
|
29
30
|
try {
|
|
30
|
-
let
|
|
31
|
-
query:
|
|
31
|
+
let r = ((await y.query({
|
|
32
|
+
query: n,
|
|
32
33
|
variables: { input: {
|
|
33
34
|
filter: {
|
|
34
35
|
type: "DASHBOARD",
|
|
35
36
|
status: "PUBLISHED",
|
|
36
37
|
compatibleWith: "bigconsole",
|
|
37
|
-
...t ??
|
|
38
|
-
...
|
|
38
|
+
...t ?? g ? { search: t ?? g } : {},
|
|
39
|
+
..._ && _ !== "ALL" ? { category: _ } : {}
|
|
39
40
|
},
|
|
40
41
|
sortBy: "RELEVANCE",
|
|
41
42
|
pagination: {
|
|
@@ -44,50 +45,50 @@ function p(p = {}) {
|
|
|
44
45
|
}
|
|
45
46
|
} },
|
|
46
47
|
fetchPolicy: "network-only"
|
|
47
|
-
});
|
|
48
|
-
|
|
48
|
+
})).data?.browseStore?.products ?? []).filter((t) => e(t.content));
|
|
49
|
+
S(r.map(m)), w(r.length);
|
|
49
50
|
} catch (e) {
|
|
50
|
-
|
|
51
|
+
O(e instanceof Error ? e.message : "Failed to load templates from the store"), S([]), w(0);
|
|
51
52
|
} finally {
|
|
52
|
-
|
|
53
|
+
E(!1);
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
}, [
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
y,
|
|
58
|
+
g,
|
|
59
|
+
_
|
|
59
60
|
]);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}, [
|
|
63
|
-
let
|
|
64
|
-
if (!
|
|
61
|
+
l(() => {
|
|
62
|
+
v && k();
|
|
63
|
+
}, [v, k]);
|
|
64
|
+
let A = c(async (t) => {
|
|
65
|
+
if (!y) return null;
|
|
65
66
|
try {
|
|
66
|
-
let
|
|
67
|
-
query:
|
|
68
|
-
variables: { id:
|
|
67
|
+
let n = (await y.query({
|
|
68
|
+
query: a,
|
|
69
|
+
variables: { id: t },
|
|
69
70
|
fetchPolicy: "network-only"
|
|
70
71
|
})).data?.product?.content;
|
|
71
|
-
if (!
|
|
72
|
-
let
|
|
73
|
-
return
|
|
74
|
-
definition:
|
|
75
|
-
requiredDataSinks:
|
|
76
|
-
requiredWidgetTypes:
|
|
77
|
-
requiredInputs:
|
|
78
|
-
defaultDashboardName:
|
|
79
|
-
defaultCategory:
|
|
80
|
-
defaultTags:
|
|
81
|
-
difficultyLevel:
|
|
72
|
+
if (!e(n)) return null;
|
|
73
|
+
let r = n;
|
|
74
|
+
return r.definition ? {
|
|
75
|
+
definition: r.definition,
|
|
76
|
+
requiredDataSinks: r.requiredDataSinks ?? [],
|
|
77
|
+
requiredWidgetTypes: r.requiredWidgetTypes ?? [],
|
|
78
|
+
requiredInputs: r.requiredInputs ?? [],
|
|
79
|
+
defaultDashboardName: r.defaultDashboardName,
|
|
80
|
+
defaultCategory: r.defaultCategory ?? null,
|
|
81
|
+
defaultTags: r.defaultTags ?? [],
|
|
82
|
+
difficultyLevel: r.difficultyLevel ?? "medium"
|
|
82
83
|
} : null;
|
|
83
84
|
} catch {
|
|
84
85
|
return null;
|
|
85
86
|
}
|
|
86
|
-
}, [
|
|
87
|
-
let
|
|
88
|
-
mutation:
|
|
87
|
+
}, [y]), j = c(async (e) => {
|
|
88
|
+
let n = (await b.mutate({
|
|
89
|
+
mutation: s,
|
|
89
90
|
variables: { input: {
|
|
90
|
-
content: e.content,
|
|
91
|
+
content: t(e.content, e),
|
|
91
92
|
sourceTemplateId: e.templateId,
|
|
92
93
|
sourceTemplateName: e.templateName,
|
|
93
94
|
...e.name ? { name: e.name } : {},
|
|
@@ -96,14 +97,14 @@ function p(p = {}) {
|
|
|
96
97
|
...e.inputValues && Object.keys(e.inputValues).length ? { inputValues: e.inputValues } : {}
|
|
97
98
|
} }
|
|
98
99
|
})).data?.importDashboardTemplate;
|
|
99
|
-
return
|
|
100
|
-
success:
|
|
101
|
-
dashboardId:
|
|
102
|
-
errorMessage:
|
|
103
|
-
unresolvedSlots:
|
|
104
|
-
resolvedSlots:
|
|
105
|
-
widgetsNeedingData:
|
|
106
|
-
warnings:
|
|
100
|
+
return n ? {
|
|
101
|
+
success: n.success,
|
|
102
|
+
dashboardId: n.dashboard?.id,
|
|
103
|
+
errorMessage: n.errorMessage,
|
|
104
|
+
unresolvedSlots: n.unresolvedSlots ?? [],
|
|
105
|
+
resolvedSlots: n.resolvedSlots ?? [],
|
|
106
|
+
widgetsNeedingData: n.widgetsNeedingData ?? 0,
|
|
107
|
+
warnings: n.warnings ?? []
|
|
107
108
|
} : {
|
|
108
109
|
success: !1,
|
|
109
110
|
errorMessage: "No response from the server",
|
|
@@ -112,19 +113,19 @@ function p(p = {}) {
|
|
|
112
113
|
widgetsNeedingData: 0,
|
|
113
114
|
warnings: []
|
|
114
115
|
};
|
|
115
|
-
}, [
|
|
116
|
-
let
|
|
116
|
+
}, [b]), M = c(async (e) => {
|
|
117
|
+
let t = (e) => ({
|
|
117
118
|
success: !1,
|
|
118
119
|
errorMessage: e,
|
|
119
120
|
sinkCount: 0,
|
|
120
121
|
unknownSinkIds: [],
|
|
121
122
|
sampleDataSinkCount: 0
|
|
122
123
|
});
|
|
123
|
-
if (!
|
|
124
|
-
let
|
|
124
|
+
if (!y) return t("Store is unavailable right now.");
|
|
125
|
+
let n, a = 0, s = [], c = 0;
|
|
125
126
|
try {
|
|
126
|
-
let
|
|
127
|
-
query:
|
|
127
|
+
let r = (await b.query({
|
|
128
|
+
query: o,
|
|
128
129
|
variables: {
|
|
129
130
|
dashboardId: e.dashboardId,
|
|
130
131
|
defaultDashboardName: e.name,
|
|
@@ -134,14 +135,14 @@ function p(p = {}) {
|
|
|
134
135
|
},
|
|
135
136
|
fetchPolicy: "network-only"
|
|
136
137
|
})).data?.buildDashboardTemplateContent;
|
|
137
|
-
if (!
|
|
138
|
-
|
|
138
|
+
if (!r?.content) return t("Could not build a template from this dashboard.");
|
|
139
|
+
n = r.content, a = r.sinkCount, s = r.unknownSinkIds ?? [], c = r.sampleDataSinkCount ?? 0;
|
|
139
140
|
} catch (e) {
|
|
140
|
-
return
|
|
141
|
+
return t(e instanceof Error ? e.message : "Failed to build the template.");
|
|
141
142
|
}
|
|
142
143
|
try {
|
|
143
|
-
let
|
|
144
|
-
mutation:
|
|
144
|
+
let o = (await y.mutate({
|
|
145
|
+
mutation: r,
|
|
145
146
|
variables: { input: {
|
|
146
147
|
appType: "DASHBOARD",
|
|
147
148
|
name: e.name,
|
|
@@ -153,58 +154,58 @@ function p(p = {}) {
|
|
|
153
154
|
compatibleProducts: ["bigconsole"]
|
|
154
155
|
} }
|
|
155
156
|
})).data?.createApplication;
|
|
156
|
-
return
|
|
157
|
-
mutation:
|
|
157
|
+
return o ? (await y.mutate({
|
|
158
|
+
mutation: i,
|
|
158
159
|
variables: {
|
|
159
|
-
applicationId:
|
|
160
|
+
applicationId: o.id,
|
|
160
161
|
input: {
|
|
161
162
|
version: "1.0.0",
|
|
162
|
-
manifest:
|
|
163
|
+
manifest: n
|
|
163
164
|
}
|
|
164
165
|
}
|
|
165
166
|
}), {
|
|
166
167
|
success: !0,
|
|
167
|
-
applicationId:
|
|
168
|
-
status:
|
|
169
|
-
sinkCount:
|
|
168
|
+
applicationId: o.id,
|
|
169
|
+
status: o.status,
|
|
170
|
+
sinkCount: a,
|
|
170
171
|
unknownSinkIds: s,
|
|
171
172
|
sampleDataSinkCount: c
|
|
172
173
|
}) : {
|
|
173
|
-
...
|
|
174
|
-
sinkCount:
|
|
174
|
+
...t("The developer portal did not create the app."),
|
|
175
|
+
sinkCount: a,
|
|
175
176
|
unknownSinkIds: s,
|
|
176
177
|
sampleDataSinkCount: c
|
|
177
178
|
};
|
|
178
179
|
} catch (e) {
|
|
179
180
|
return {
|
|
180
|
-
...
|
|
181
|
-
sinkCount:
|
|
181
|
+
...t(e instanceof Error ? e.message : "Failed to publish to the developer portal."),
|
|
182
|
+
sinkCount: a,
|
|
182
183
|
unknownSinkIds: s,
|
|
183
184
|
sampleDataSinkCount: c
|
|
184
185
|
};
|
|
185
186
|
}
|
|
186
|
-
}, [
|
|
187
|
-
return
|
|
188
|
-
templates:
|
|
189
|
-
loading:
|
|
190
|
-
error:
|
|
191
|
-
totalCount:
|
|
192
|
-
refetch:
|
|
193
|
-
fetchTemplateContent:
|
|
194
|
-
installTemplate:
|
|
195
|
-
publishToStore:
|
|
187
|
+
}, [y, b]);
|
|
188
|
+
return u(() => ({
|
|
189
|
+
templates: x,
|
|
190
|
+
loading: T,
|
|
191
|
+
error: D,
|
|
192
|
+
totalCount: C,
|
|
193
|
+
refetch: k,
|
|
194
|
+
fetchTemplateContent: A,
|
|
195
|
+
installTemplate: j,
|
|
196
|
+
publishToStore: M
|
|
196
197
|
}), [
|
|
197
|
-
y,
|
|
198
|
-
C,
|
|
199
|
-
T,
|
|
200
198
|
x,
|
|
199
|
+
T,
|
|
201
200
|
D,
|
|
202
|
-
|
|
201
|
+
C,
|
|
203
202
|
k,
|
|
204
|
-
A
|
|
203
|
+
A,
|
|
204
|
+
j,
|
|
205
|
+
M
|
|
205
206
|
]);
|
|
206
207
|
}
|
|
207
208
|
//#endregion
|
|
208
|
-
export {
|
|
209
|
+
export { h as default };
|
|
209
210
|
|
|
210
211
|
//# sourceMappingURL=useStoreDashboardTemplates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStoreDashboardTemplates.js","names":[],"sources":["../../../src/bigconsole/hooks/useStoreDashboardTemplates.ts"],"sourcesContent":["/**\n * Store-distributed dashboard templates.\n *\n * Dashboard templates live in the global store as `StoreProduct` rows of type\n * `DASHBOARD` whose `content` column holds a `DashboardTemplateContent`\n * document. This mirrors how FluidGrids sources its workflow templates\n * (`browseStore(type: WORKFLOW)` → `content.definitionJson` →\n * `importWorkflowTemplate`).\n *\n * Two gateways are involved: the catalog is read from the **global** gateway,\n * and the install mutation runs against the **workspace** gateway, which is\n * where the dashboard is created.\n *\n * @module bigconsole/hooks/useStoreDashboardTemplates\n */\nimport { useApolloClient } from '@apollo/client/react';\nimport { useGatewayClient } from '@burdenoff/fe-libs/shared/graphql';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\n\nimport {\n BROWSE_DASHBOARD_TEMPLATES,\n BUILD_DASHBOARD_TEMPLATE_CONTENT,\n CREATE_TEMPLATE_APP,\n CREATE_TEMPLATE_VERSION,\n GET_DASHBOARD_TEMPLATE_DETAIL,\n IMPORT_DASHBOARD_TEMPLATE,\n} from '../graphql/storeTemplates';\n\n/** A column a widget expects from the sink bound to its slot. */\nexport interface TemplateExpectedField {\n name: string;\n role?: string;\n}\n\n/** A data-binding slot the template needs filled. */\nexport interface TemplateRequiredDataSink {\n slot: string;\n label: string;\n description?: string | null;\n expectedFields: TemplateExpectedField[];\n widgetTitles: string[];\n}\n\nexport interface TemplateRequiredWidgetType {\n widgetType: string;\n widgetTypeKey?: string | null;\n publishType: 'BUILTIN' | 'STORE' | 'CUSTOM';\n displayName?: string;\n requiresPurchase?: boolean;\n}\n\nexport interface TemplateRequiredInput {\n name: string;\n type: 'string' | 'number' | 'boolean' | 'select' | 'secret';\n label: string;\n placeholder?: string;\n required: boolean;\n defaultValue?: string | number | boolean | null;\n options?: { label: string; value: string }[];\n helpText?: string;\n}\n\nexport interface DashboardTemplateContent {\n definition: unknown;\n requiredDataSinks: TemplateRequiredDataSink[];\n requiredWidgetTypes: TemplateRequiredWidgetType[];\n requiredInputs: TemplateRequiredInput[];\n defaultDashboardName?: string;\n defaultCategory?: string | null;\n defaultTags?: string[];\n difficultyLevel?: 'easy' | 'medium' | 'hard';\n}\n\n/** A store product presented as a template card. */\nexport interface StoreDashboardTemplate {\n id: string;\n name: string;\n slug: string;\n description?: string | null;\n icon?: string | null;\n category?: string | null;\n tags: string[];\n featured: boolean;\n downloads: number;\n rating?: number | null;\n pricingModel: string;\n price: number;\n /** True for anything the workspace has to buy before it can be installed. */\n requiresPurchase: boolean;\n}\n\ninterface RawStoreProduct {\n id: string;\n name: string;\n slug: string;\n description?: string | null;\n icon?: string | null;\n category?: string | null;\n tags?: string[] | null;\n featured?: boolean | null;\n downloads?: number | null;\n rating?: number | null;\n pricingModel?: string | null;\n price?: number | null;\n}\n\nexport interface InstallTemplateArgs {\n templateId: string;\n templateName: string;\n content: DashboardTemplateContent;\n name?: string;\n visibility?: string;\n dataSinkBindings?: { slot: string; dataSinkId: string }[];\n inputValues?: Record<string, unknown>;\n}\n\nexport interface InstallTemplateResult {\n success: boolean;\n dashboardId?: string;\n errorMessage?: string;\n unresolvedSlots: string[];\n resolvedSlots: string[];\n widgetsNeedingData: number;\n warnings: string[];\n}\n\nfunction normalizeProduct(raw: RawStoreProduct): StoreDashboardTemplate {\n const pricingModel = raw.pricingModel ?? 'FREE';\n return {\n id: raw.id,\n name: raw.name,\n slug: raw.slug,\n description: raw.description ?? null,\n icon: raw.icon ?? null,\n category: raw.category ?? null,\n tags: raw.tags ?? [],\n featured: raw.featured ?? false,\n downloads: raw.downloads ?? 0,\n rating: raw.rating ?? null,\n pricingModel,\n price: raw.price ?? 0,\n requiresPurchase: pricingModel !== 'FREE' && (raw.price ?? 0) > 0,\n };\n}\n\nexport interface PublishToStoreArgs {\n dashboardId: string;\n name: string;\n slug: string;\n description: string;\n category?: string;\n tags?: string[];\n /** Embed a few real rows per data source so the board renders populated. */\n includeSampleData?: boolean;\n}\n\nexport interface PublishToStoreResult {\n success: boolean;\n /** The DRAFT devportal application created for this template. */\n applicationId?: string;\n status?: string;\n errorMessage?: string;\n /** Distinct data sinks the dashboard referenced, all tokenised into slots. */\n sinkCount: number;\n /** Sinks that could not be resolved; their slots fall back to positional names. */\n unknownSinkIds: string[];\n /** How many data sources contributed sample rows. */\n sampleDataSinkCount: number;\n}\n\nexport interface UseStoreDashboardTemplatesResult {\n templates: StoreDashboardTemplate[];\n loading: boolean;\n error: string | null;\n totalCount: number;\n refetch: (search?: string) => Promise<void>;\n /** Fetch the full template document. Kept lazy: content is large. */\n fetchTemplateContent: (templateId: string) => Promise<DashboardTemplateContent | null>;\n installTemplate: (args: InstallTemplateArgs) => Promise<InstallTemplateResult>;\n publishToStore: (args: PublishToStoreArgs) => Promise<PublishToStoreResult>;\n}\n\nexport function useStoreDashboardTemplates(\n options: { search?: string; category?: string; autoLoad?: boolean } = {}\n): UseStoreDashboardTemplatesResult {\n const { search, category, autoLoad = true } = options;\n\n const globalClient = useGatewayClient('global');\n const workspaceClient = useApolloClient();\n\n const [templates, setTemplates] = useState<StoreDashboardTemplate[]>([]);\n const [totalCount, setTotalCount] = useState(0);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n const refetch = useCallback(\n async (overrideSearch?: string): Promise<void> => {\n if (!globalClient) return;\n setLoading(true);\n setError(null);\n try {\n const result = await globalClient.query<{\n browseStore?: { products?: RawStoreProduct[]; totalCount?: number };\n }>({\n query: BROWSE_DASHBOARD_TEMPLATES,\n variables: {\n input: {\n filter: {\n type: 'DASHBOARD',\n status: 'PUBLISHED',\n // Without this a template published from another product's\n // devportal listing would show up in BigConsole's gallery.\n compatibleWith: 'bigconsole',\n ...((overrideSearch ?? search) ? { search: overrideSearch ?? search } : {}),\n ...(category && category !== 'ALL' ? { category } : {}),\n },\n sortBy: 'RELEVANCE',\n pagination: { limit: 50, offset: 0 },\n },\n },\n fetchPolicy: 'network-only',\n });\n\n setTemplates((result.data?.browseStore?.products ?? []).map(normalizeProduct));\n setTotalCount(result.data?.browseStore?.totalCount ?? 0);\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to load templates from the store');\n setTemplates([]);\n setTotalCount(0);\n } finally {\n setLoading(false);\n }\n },\n [globalClient, search, category]\n );\n\n useEffect(() => {\n if (autoLoad) void refetch();\n }, [autoLoad, refetch]);\n\n const fetchTemplateContent = useCallback(\n async (templateId: string): Promise<DashboardTemplateContent | null> => {\n if (!globalClient) return null;\n try {\n const result = await globalClient.query<{ product?: { content?: unknown } }>({\n query: GET_DASHBOARD_TEMPLATE_DETAIL,\n variables: { id: templateId },\n fetchPolicy: 'network-only',\n });\n const content = result.data?.product?.content;\n if (!content || typeof content !== 'object') return null;\n const doc = content as Partial<DashboardTemplateContent>;\n if (!doc.definition) return null;\n return {\n definition: doc.definition,\n requiredDataSinks: doc.requiredDataSinks ?? [],\n requiredWidgetTypes: doc.requiredWidgetTypes ?? [],\n requiredInputs: doc.requiredInputs ?? [],\n defaultDashboardName: doc.defaultDashboardName,\n defaultCategory: doc.defaultCategory ?? null,\n defaultTags: doc.defaultTags ?? [],\n difficultyLevel: doc.difficultyLevel ?? 'medium',\n };\n } catch {\n return null;\n }\n },\n [globalClient]\n );\n\n const installTemplate = useCallback(\n async (args: InstallTemplateArgs): Promise<InstallTemplateResult> => {\n const result = await workspaceClient.mutate<{\n importDashboardTemplate?: InstallTemplateResult & { dashboard?: { id: string } | null };\n }>({\n mutation: IMPORT_DASHBOARD_TEMPLATE,\n variables: {\n input: {\n content: args.content,\n sourceTemplateId: args.templateId,\n sourceTemplateName: args.templateName,\n ...(args.name ? { name: args.name } : {}),\n ...(args.visibility ? { visibility: args.visibility } : {}),\n ...(args.dataSinkBindings?.length ? { dataSinkBindings: args.dataSinkBindings } : {}),\n ...(args.inputValues && Object.keys(args.inputValues).length ? { inputValues: args.inputValues } : {}),\n },\n },\n });\n\n const payload = result.data?.importDashboardTemplate;\n if (!payload) {\n return {\n success: false,\n errorMessage: 'No response from the server',\n unresolvedSlots: [],\n resolvedSlots: [],\n widgetsNeedingData: 0,\n warnings: [],\n };\n }\n\n return {\n success: payload.success,\n dashboardId: payload.dashboard?.id,\n errorMessage: payload.errorMessage,\n unresolvedSlots: payload.unresolvedSlots ?? [],\n resolvedSlots: payload.resolvedSlots ?? [],\n widgetsNeedingData: payload.widgetsNeedingData ?? 0,\n warnings: payload.warnings ?? [],\n };\n },\n [workspaceClient]\n );\n\n /**\n * Turn a live dashboard into a Dashboard Template application in the\n * developer portal.\n *\n * It deliberately does NOT create a StoreProduct directly. devportal already\n * owns dashboard-template publishing end to end — versioning, submit/review,\n * publisher identity, and the `metadata.sourceApplicationId` the store uses\n * for ownership on later updates. Writing a product straight to the store\n * would fork that pipeline and orphan the listing: a later devportal publish\n * of the same slug would hit the store's slug-collision guard and refuse.\n *\n * So this fills in the one thing devportal cannot do — produce the template\n * document from a live dashboard — and hands off to the existing flow. The\n * app is left in DRAFT so the author reviews the listing and submits it\n * themselves.\n *\n * Two hops: the workspace gateway tokenises the dashboard (it owns the data\n * sinks), the global gateway owns devportal. Brokering through the client\n * keeps both directions free of cross-layer M2M, exactly like install.\n */\n const publishToStore = useCallback(\n async (args: PublishToStoreArgs): Promise<PublishToStoreResult> => {\n const failure = (errorMessage: string): PublishToStoreResult => ({\n success: false,\n errorMessage,\n sinkCount: 0,\n unknownSinkIds: [],\n sampleDataSinkCount: 0,\n });\n\n if (!globalClient) return failure('Store is unavailable right now.');\n\n let content: unknown;\n let sinkCount = 0;\n let unknownSinkIds: string[] = [];\n let sampleDataSinkCount = 0;\n try {\n const built = await workspaceClient.query<{\n buildDashboardTemplateContent?: {\n content: unknown;\n sinkCount: number;\n unknownSinkIds: string[];\n sampleDataSinkCount: number;\n };\n }>({\n query: BUILD_DASHBOARD_TEMPLATE_CONTENT,\n variables: {\n dashboardId: args.dashboardId,\n defaultDashboardName: args.name,\n defaultCategory: args.category ?? null,\n defaultTags: args.tags ?? [],\n includeSampleData: args.includeSampleData ?? false,\n },\n fetchPolicy: 'network-only',\n });\n const payload = built.data?.buildDashboardTemplateContent;\n if (!payload?.content) return failure('Could not build a template from this dashboard.');\n content = payload.content;\n sinkCount = payload.sinkCount;\n unknownSinkIds = payload.unknownSinkIds ?? [];\n sampleDataSinkCount = payload.sampleDataSinkCount ?? 0;\n } catch (err) {\n return failure(err instanceof Error ? err.message : 'Failed to build the template.');\n }\n\n try {\n const app = await globalClient.mutate<{\n createApplication?: { id: string; status: string };\n }>({\n mutation: CREATE_TEMPLATE_APP,\n variables: {\n input: {\n appType: 'DASHBOARD',\n name: args.name,\n slug: args.slug,\n shortDescription: args.description.slice(0, 200),\n description: args.description,\n ...(args.category ? { category: args.category } : {}),\n tags: args.tags ?? [],\n compatibleProducts: ['bigconsole'],\n },\n },\n });\n\n const application = app.data?.createApplication;\n if (!application) {\n return {\n ...failure('The developer portal did not create the app.'),\n sinkCount,\n unknownSinkIds,\n sampleDataSinkCount,\n };\n }\n\n // The version manifest is what devportal maps onto StoreProduct.content\n // when the app is submitted and approved.\n await globalClient.mutate({\n mutation: CREATE_TEMPLATE_VERSION,\n variables: {\n applicationId: application.id,\n input: { version: '1.0.0', manifest: content },\n },\n });\n\n return {\n success: true,\n applicationId: application.id,\n status: application.status,\n sinkCount,\n unknownSinkIds,\n sampleDataSinkCount,\n };\n } catch (err) {\n return {\n ...failure(err instanceof Error ? err.message : 'Failed to publish to the developer portal.'),\n sinkCount,\n unknownSinkIds,\n sampleDataSinkCount,\n };\n }\n },\n [globalClient, workspaceClient]\n );\n\n return useMemo(\n () => ({\n templates,\n loading,\n error,\n totalCount,\n refetch,\n fetchTemplateContent,\n installTemplate,\n publishToStore,\n }),\n [templates, loading, error, totalCount, refetch, fetchTemplateContent, installTemplate, publishToStore]\n );\n}\n\nexport default useStoreDashboardTemplates;\n"],"mappings":";;;;;;AA8HA,SAAS,EAAiB,GAA8C;CACtE,IAAM,IAAe,EAAI,gBAAgB;AACzC,QAAO;EACL,IAAI,EAAI;EACR,MAAM,EAAI;EACV,MAAM,EAAI;EACV,aAAa,EAAI,eAAe;EAChC,MAAM,EAAI,QAAQ;EAClB,UAAU,EAAI,YAAY;EAC1B,MAAM,EAAI,QAAQ,EAAE;EACpB,UAAU,EAAI,YAAY;EAC1B,WAAW,EAAI,aAAa;EAC5B,QAAQ,EAAI,UAAU;EACtB;EACA,OAAO,EAAI,SAAS;EACpB,kBAAkB,MAAiB,WAAW,EAAI,SAAS,KAAK;EACjE;;AAwCH,SAAgB,EACd,IAAsE,EAAE,EACtC;CAClC,IAAM,EAAE,WAAQ,aAAU,cAAW,OAAS,GAExC,IAAe,EAAiB,SAAS,EACzC,IAAkB,GAAiB,EAEnC,CAAC,GAAW,KAAgB,EAAmC,EAAE,CAAC,EAClE,CAAC,GAAY,KAAiB,EAAS,EAAE,EACzC,CAAC,GAAS,KAAc,EAAS,GAAM,EACvC,CAAC,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A;EACA;EACA;EACA;EACA;EACA;EACA;EACD,GACD;EAAC;EAAW;EAAS;EAAO;EAAY;EAAS;EAAsB;EAAiB;EAAe,CACxG"}
|
|
1
|
+
{"version":3,"file":"useStoreDashboardTemplates.js","names":[],"sources":["../../../src/bigconsole/hooks/useStoreDashboardTemplates.ts"],"sourcesContent":["/**\n * Store-distributed dashboard templates.\n *\n * Dashboard templates live in the global store as `StoreProduct` rows of type\n * `DASHBOARD` whose `content` column holds a `DashboardTemplateContent`\n * document. This mirrors how FluidGrids sources its workflow templates\n * (`browseStore(type: WORKFLOW)` → `content.definitionJson` →\n * `importWorkflowTemplate`).\n *\n * Two gateways are involved: the catalog is read from the **global** gateway,\n * and the install mutation runs against the **workspace** gateway, which is\n * where the dashboard is created.\n *\n * @module bigconsole/hooks/useStoreDashboardTemplates\n */\nimport { useApolloClient } from '@apollo/client/react';\nimport { useGatewayClient } from '@burdenoff/fe-libs/shared/graphql';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport { isInstallableDashboardTemplate, withDashboardTemplateMetadata } from '../utils/dashboardTemplateContent';\n\nimport {\n BROWSE_DASHBOARD_TEMPLATES,\n BUILD_DASHBOARD_TEMPLATE_CONTENT,\n CREATE_TEMPLATE_APP,\n CREATE_TEMPLATE_VERSION,\n GET_DASHBOARD_TEMPLATE_DETAIL,\n IMPORT_DASHBOARD_TEMPLATE,\n} from '../graphql/storeTemplates';\n\n/** A column a widget expects from the sink bound to its slot. */\nexport interface TemplateExpectedField {\n name: string;\n role?: string;\n}\n\n/** A data-binding slot the template needs filled. */\nexport interface TemplateRequiredDataSink {\n slot: string;\n label: string;\n description?: string | null;\n expectedFields: TemplateExpectedField[];\n widgetTitles: string[];\n}\n\nexport interface TemplateRequiredWidgetType {\n widgetType: string;\n widgetTypeKey?: string | null;\n publishType: 'BUILTIN' | 'STORE' | 'CUSTOM';\n displayName?: string;\n requiresPurchase?: boolean;\n}\n\nexport interface TemplateRequiredInput {\n name: string;\n type: 'string' | 'number' | 'boolean' | 'select' | 'secret';\n label: string;\n placeholder?: string;\n required: boolean;\n defaultValue?: string | number | boolean | null;\n options?: { label: string; value: string }[];\n helpText?: string;\n}\n\nexport interface DashboardTemplateContent {\n definition: unknown;\n requiredDataSinks: TemplateRequiredDataSink[];\n requiredWidgetTypes: TemplateRequiredWidgetType[];\n requiredInputs: TemplateRequiredInput[];\n defaultDashboardName?: string;\n defaultCategory?: string | null;\n defaultTags?: string[];\n difficultyLevel?: 'easy' | 'medium' | 'hard';\n}\n\n/** A store product presented as a template card. */\nexport interface StoreDashboardTemplate {\n id: string;\n name: string;\n slug: string;\n description?: string | null;\n icon?: string | null;\n category?: string | null;\n tags: string[];\n featured: boolean;\n downloads: number;\n rating?: number | null;\n pricingModel: string;\n price: number;\n /** True for anything the workspace has to buy before it can be installed. */\n requiresPurchase: boolean;\n}\n\ninterface RawStoreProduct {\n id: string;\n name: string;\n slug: string;\n description?: string | null;\n icon?: string | null;\n category?: string | null;\n tags?: string[] | null;\n featured?: boolean | null;\n downloads?: number | null;\n rating?: number | null;\n pricingModel?: string | null;\n price?: number | null;\n content?: unknown;\n}\n\nexport interface InstallTemplateArgs {\n templateId: string;\n templateName: string;\n content: DashboardTemplateContent;\n name?: string;\n visibility?: string;\n description?: string;\n tags?: string[];\n dataSinkBindings?: { slot: string; dataSinkId: string }[];\n inputValues?: Record<string, unknown>;\n}\n\nexport interface InstallTemplateResult {\n success: boolean;\n dashboardId?: string;\n errorMessage?: string;\n unresolvedSlots: string[];\n resolvedSlots: string[];\n widgetsNeedingData: number;\n warnings: string[];\n}\n\nfunction normalizeProduct(raw: RawStoreProduct): StoreDashboardTemplate {\n const pricingModel = raw.pricingModel ?? 'FREE';\n return {\n id: raw.id,\n name: raw.name,\n slug: raw.slug,\n description: raw.description ?? null,\n icon: raw.icon ?? null,\n category: raw.category ?? null,\n tags: raw.tags ?? [],\n featured: raw.featured ?? false,\n downloads: raw.downloads ?? 0,\n rating: raw.rating ?? null,\n pricingModel,\n price: raw.price ?? 0,\n requiresPurchase: pricingModel !== 'FREE' && (raw.price ?? 0) > 0,\n };\n}\n\nexport interface PublishToStoreArgs {\n dashboardId: string;\n name: string;\n slug: string;\n description: string;\n category?: string;\n tags?: string[];\n /** Embed a few real rows per data source so the board renders populated. */\n includeSampleData?: boolean;\n}\n\nexport interface PublishToStoreResult {\n success: boolean;\n /** The DRAFT devportal application created for this template. */\n applicationId?: string;\n status?: string;\n errorMessage?: string;\n /** Distinct data sinks the dashboard referenced, all tokenised into slots. */\n sinkCount: number;\n /** Sinks that could not be resolved; their slots fall back to positional names. */\n unknownSinkIds: string[];\n /** How many data sources contributed sample rows. */\n sampleDataSinkCount: number;\n}\n\nexport interface UseStoreDashboardTemplatesResult {\n templates: StoreDashboardTemplate[];\n loading: boolean;\n error: string | null;\n totalCount: number;\n refetch: (search?: string) => Promise<void>;\n /** Fetch the full template document. Kept lazy: content is large. */\n fetchTemplateContent: (templateId: string) => Promise<DashboardTemplateContent | null>;\n installTemplate: (args: InstallTemplateArgs) => Promise<InstallTemplateResult>;\n publishToStore: (args: PublishToStoreArgs) => Promise<PublishToStoreResult>;\n}\n\nexport function useStoreDashboardTemplates(\n options: { search?: string; category?: string; autoLoad?: boolean } = {}\n): UseStoreDashboardTemplatesResult {\n const { search, category, autoLoad = true } = options;\n\n const globalClient = useGatewayClient('global');\n const workspaceClient = useApolloClient();\n\n const [templates, setTemplates] = useState<StoreDashboardTemplate[]>([]);\n const [totalCount, setTotalCount] = useState(0);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n const refetch = useCallback(\n async (overrideSearch?: string): Promise<void> => {\n if (!globalClient) return;\n setLoading(true);\n setError(null);\n try {\n const result = await globalClient.query<{\n browseStore?: { products?: RawStoreProduct[]; totalCount?: number };\n }>({\n query: BROWSE_DASHBOARD_TEMPLATES,\n variables: {\n input: {\n filter: {\n type: 'DASHBOARD',\n status: 'PUBLISHED',\n // Without this a template published from another product's\n // devportal listing would show up in BigConsole's gallery.\n compatibleWith: 'bigconsole',\n ...((overrideSearch ?? search) ? { search: overrideSearch ?? search } : {}),\n ...(category && category !== 'ALL' ? { category } : {}),\n },\n sortBy: 'RELEVANCE',\n pagination: { limit: 50, offset: 0 },\n },\n },\n fetchPolicy: 'network-only',\n });\n\n const installable = (result.data?.browseStore?.products ?? []).filter((product) =>\n isInstallableDashboardTemplate(product.content)\n );\n setTemplates(installable.map(normalizeProduct));\n setTotalCount(installable.length);\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to load templates from the store');\n setTemplates([]);\n setTotalCount(0);\n } finally {\n setLoading(false);\n }\n },\n [globalClient, search, category]\n );\n\n useEffect(() => {\n if (autoLoad) void refetch();\n }, [autoLoad, refetch]);\n\n const fetchTemplateContent = useCallback(\n async (templateId: string): Promise<DashboardTemplateContent | null> => {\n if (!globalClient) return null;\n try {\n const result = await globalClient.query<{ product?: { content?: unknown } }>({\n query: GET_DASHBOARD_TEMPLATE_DETAIL,\n variables: { id: templateId },\n fetchPolicy: 'network-only',\n });\n const content = result.data?.product?.content;\n if (!isInstallableDashboardTemplate(content)) return null;\n const doc = content as Partial<DashboardTemplateContent>;\n if (!doc.definition) return null;\n return {\n definition: doc.definition,\n requiredDataSinks: doc.requiredDataSinks ?? [],\n requiredWidgetTypes: doc.requiredWidgetTypes ?? [],\n requiredInputs: doc.requiredInputs ?? [],\n defaultDashboardName: doc.defaultDashboardName,\n defaultCategory: doc.defaultCategory ?? null,\n defaultTags: doc.defaultTags ?? [],\n difficultyLevel: doc.difficultyLevel ?? 'medium',\n };\n } catch {\n return null;\n }\n },\n [globalClient]\n );\n\n const installTemplate = useCallback(\n async (args: InstallTemplateArgs): Promise<InstallTemplateResult> => {\n const result = await workspaceClient.mutate<{\n importDashboardTemplate?: InstallTemplateResult & { dashboard?: { id: string } | null };\n }>({\n mutation: IMPORT_DASHBOARD_TEMPLATE,\n variables: {\n input: {\n content: withDashboardTemplateMetadata(args.content, args),\n sourceTemplateId: args.templateId,\n sourceTemplateName: args.templateName,\n ...(args.name ? { name: args.name } : {}),\n ...(args.visibility ? { visibility: args.visibility } : {}),\n ...(args.dataSinkBindings?.length ? { dataSinkBindings: args.dataSinkBindings } : {}),\n ...(args.inputValues && Object.keys(args.inputValues).length ? { inputValues: args.inputValues } : {}),\n },\n },\n });\n\n const payload = result.data?.importDashboardTemplate;\n if (!payload) {\n return {\n success: false,\n errorMessage: 'No response from the server',\n unresolvedSlots: [],\n resolvedSlots: [],\n widgetsNeedingData: 0,\n warnings: [],\n };\n }\n\n return {\n success: payload.success,\n dashboardId: payload.dashboard?.id,\n errorMessage: payload.errorMessage,\n unresolvedSlots: payload.unresolvedSlots ?? [],\n resolvedSlots: payload.resolvedSlots ?? [],\n widgetsNeedingData: payload.widgetsNeedingData ?? 0,\n warnings: payload.warnings ?? [],\n };\n },\n [workspaceClient]\n );\n\n /**\n * Turn a live dashboard into a Dashboard Template application in the\n * developer portal.\n *\n * It deliberately does NOT create a StoreProduct directly. devportal already\n * owns dashboard-template publishing end to end — versioning, submit/review,\n * publisher identity, and the `metadata.sourceApplicationId` the store uses\n * for ownership on later updates. Writing a product straight to the store\n * would fork that pipeline and orphan the listing: a later devportal publish\n * of the same slug would hit the store's slug-collision guard and refuse.\n *\n * So this fills in the one thing devportal cannot do — produce the template\n * document from a live dashboard — and hands off to the existing flow. The\n * app is left in DRAFT so the author reviews the listing and submits it\n * themselves.\n *\n * Two hops: the workspace gateway tokenises the dashboard (it owns the data\n * sinks), the global gateway owns devportal. Brokering through the client\n * keeps both directions free of cross-layer M2M, exactly like install.\n */\n const publishToStore = useCallback(\n async (args: PublishToStoreArgs): Promise<PublishToStoreResult> => {\n const failure = (errorMessage: string): PublishToStoreResult => ({\n success: false,\n errorMessage,\n sinkCount: 0,\n unknownSinkIds: [],\n sampleDataSinkCount: 0,\n });\n\n if (!globalClient) return failure('Store is unavailable right now.');\n\n let content: unknown;\n let sinkCount = 0;\n let unknownSinkIds: string[] = [];\n let sampleDataSinkCount = 0;\n try {\n const built = await workspaceClient.query<{\n buildDashboardTemplateContent?: {\n content: unknown;\n sinkCount: number;\n unknownSinkIds: string[];\n sampleDataSinkCount: number;\n };\n }>({\n query: BUILD_DASHBOARD_TEMPLATE_CONTENT,\n variables: {\n dashboardId: args.dashboardId,\n defaultDashboardName: args.name,\n defaultCategory: args.category ?? null,\n defaultTags: args.tags ?? [],\n includeSampleData: args.includeSampleData ?? false,\n },\n fetchPolicy: 'network-only',\n });\n const payload = built.data?.buildDashboardTemplateContent;\n if (!payload?.content) return failure('Could not build a template from this dashboard.');\n content = payload.content;\n sinkCount = payload.sinkCount;\n unknownSinkIds = payload.unknownSinkIds ?? [];\n sampleDataSinkCount = payload.sampleDataSinkCount ?? 0;\n } catch (err) {\n return failure(err instanceof Error ? err.message : 'Failed to build the template.');\n }\n\n try {\n const app = await globalClient.mutate<{\n createApplication?: { id: string; status: string };\n }>({\n mutation: CREATE_TEMPLATE_APP,\n variables: {\n input: {\n appType: 'DASHBOARD',\n name: args.name,\n slug: args.slug,\n shortDescription: args.description.slice(0, 200),\n description: args.description,\n ...(args.category ? { category: args.category } : {}),\n tags: args.tags ?? [],\n compatibleProducts: ['bigconsole'],\n },\n },\n });\n\n const application = app.data?.createApplication;\n if (!application) {\n return {\n ...failure('The developer portal did not create the app.'),\n sinkCount,\n unknownSinkIds,\n sampleDataSinkCount,\n };\n }\n\n // The version manifest is what devportal maps onto StoreProduct.content\n // when the app is submitted and approved.\n await globalClient.mutate({\n mutation: CREATE_TEMPLATE_VERSION,\n variables: {\n applicationId: application.id,\n input: { version: '1.0.0', manifest: content },\n },\n });\n\n return {\n success: true,\n applicationId: application.id,\n status: application.status,\n sinkCount,\n unknownSinkIds,\n sampleDataSinkCount,\n };\n } catch (err) {\n return {\n ...failure(err instanceof Error ? err.message : 'Failed to publish to the developer portal.'),\n sinkCount,\n unknownSinkIds,\n sampleDataSinkCount,\n };\n }\n },\n [globalClient, workspaceClient]\n );\n\n return useMemo(\n () => ({\n templates,\n loading,\n error,\n totalCount,\n refetch,\n fetchTemplateContent,\n installTemplate,\n publishToStore,\n }),\n [templates, loading, error, totalCount, refetch, fetchTemplateContent, installTemplate, publishToStore]\n );\n}\n\nexport default useStoreDashboardTemplates;\n"],"mappings":";;;;;;;AAkIA,SAAS,EAAiB,GAA8C;CACtE,IAAM,IAAe,EAAI,gBAAgB;AACzC,QAAO;EACL,IAAI,EAAI;EACR,MAAM,EAAI;EACV,MAAM,EAAI;EACV,aAAa,EAAI,eAAe;EAChC,MAAM,EAAI,QAAQ;EAClB,UAAU,EAAI,YAAY;EAC1B,MAAM,EAAI,QAAQ,EAAE;EACpB,UAAU,EAAI,YAAY;EAC1B,WAAW,EAAI,aAAa;EAC5B,QAAQ,EAAI,UAAU;EACtB;EACA,OAAO,EAAI,SAAS;EACpB,kBAAkB,MAAiB,WAAW,EAAI,SAAS,KAAK;EACjE;;AAwCH,SAAgB,EACd,IAAsE,EAAE,EACtC;CAClC,IAAM,EAAE,WAAQ,aAAU,cAAW,OAAS,GAExC,IAAe,EAAiB,SAAS,EACzC,IAAkB,GAAiB,EAEnC,CAAC,GAAW,KAAgB,EAAmC,EAAE,CAAC,EAClE,CAAC,GAAY,KAAiB,EAAS,EAAE,EACzC,CAAC,GAAS,KAAc,EAAS,GAAM,EACvC,CAAC,GAAO,KAAY,EAAwB,KAAK,EAEjD,IAAU,EACd,OAAO,MAA2C;AAC3C,SAEL;GADA,EAAW,GAAK,EAChB,EAAS,KAAK;AACd,OAAI;IAuBF,IAAM,MAtBS,MAAM,EAAa,MAE/B;KACD,OAAO;KACP,WAAW,EACT,OAAO;MACL,QAAQ;OACN,MAAM;OACN,QAAQ;OAGR,gBAAgB;OAChB,GAAK,KAAkB,IAAU,EAAE,QAAQ,KAAkB,GAAQ,GAAG,EAAE;OAC1E,GAAI,KAAY,MAAa,QAAQ,EAAE,aAAU,GAAG,EAAE;OACvD;MACD,QAAQ;MACR,YAAY;OAAE,OAAO;OAAI,QAAQ;OA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,EAC7C,IAAsB,EAAQ,uBAAuB;WAC9C,GAAK;AACZ,UAAO,EAAQ,aAAe,QAAQ,EAAI,UAAU,gCAAgC;;AAGtF,MAAI;GAmBF,IAAM,KAlBM,MAAM,EAAa,OAE5B;IACD,UAAU;IACV,WAAW,EACT,OAAO;KACL,SAAS;KACT,MAAM,EAAK;KACX,MAAM,EAAK;KACX,kBAAkB,EAAK,YAAY,MAAM,GAAG,IAAI;KAChD,aAAa,EAAK;KAClB,GAAI,EAAK,WAAW,EAAE,UAAU,EAAK,UAAU,GAAG,EAAE;KACpD,MAAM,EAAK,QAAQ,EAAE;KACrB,oBAAoB,CAAC,aAAa;KACnC,EACF;IACF,CAAC,EAEsB,MAAM;AAoB9B,UAnBK,KAWL,MAAM,EAAa,OAAO;IACxB,UAAU;IACV,WAAW;KACT,eAAe,EAAY;KAC3B,OAAO;MAAE,SAAS;MAAS,UAAU;MAAS;KAC/C;IACF,CAAC,EAEK;IACL,SAAS;IACT,eAAe,EAAY;IAC3B,QAAQ,EAAY;IACpB;IACA;IACA;IACD,IAzBQ;IACL,GAAG,EAAQ,+CAA+C;IAC1D;IACA;IACA;IACD;WAqBI,GAAK;AACZ,UAAO;IACL,GAAG,EAAQ,aAAe,QAAQ,EAAI,UAAU,6CAA6C;IAC7F;IACA;IACA;IACD;;IAGL,CAAC,GAAc,EAAgB,CAChC;AAED,QAAO,SACE;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,GACD;EAAC;EAAW;EAAS;EAAO;EAAY;EAAS;EAAsB;EAAiB;EAAe,CACxG"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DashboardTemplateContent } from '../hooks/useStoreDashboardTemplates';
|
|
2
|
+
|
|
3
|
+
/** Exclude envelopes the backend parser or dashboard importer cannot accept. */
|
|
4
|
+
export declare function isInstallableDashboardTemplate(content: unknown): boolean;
|
|
5
|
+
/** Keep creation metadata in the same import transaction as pages and widgets. */
|
|
6
|
+
export declare function withDashboardTemplateMetadata(content: DashboardTemplateContent, metadata: {
|
|
7
|
+
description?: string;
|
|
8
|
+
tags?: string[];
|
|
9
|
+
}): DashboardTemplateContent;
|
|
10
|
+
//# sourceMappingURL=dashboardTemplateContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboardTemplateContent.d.ts","sourceRoot":"","sources":["../../../src/bigconsole/utils/dashboardTemplateContent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAMpF,gFAAgF;AAChF,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CA6CxE;AAED,kFAAkF;AAClF,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,wBAAwB,EACjC,QAAQ,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAClD,wBAAwB,CAwB1B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//#region src/bigconsole/utils/dashboardTemplateContent.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
4
|
+
}
|
|
5
|
+
function t(t) {
|
|
6
|
+
return e(t) && e(t.definition) && e(t.definition.dashboard) && typeof t.definition.schemaVersion == "string" && t.definition.schemaVersion.length > 0 && typeof t.definition.dashboard.name == "string" && t.definition.dashboard.name.length > 0 && Array.isArray(t.definition.pages) && t.definition.pages.length > 0 && (t.requiredInputs === void 0 || Array.isArray(t.requiredInputs) && t.requiredInputs.every((t) => e(t) && typeof t.name == "string" && typeof t.label == "string" && (t.placeholder === void 0 || t.placeholder === null || typeof t.placeholder == "string") && typeof t.required == "boolean" && [
|
|
7
|
+
"string",
|
|
8
|
+
"number",
|
|
9
|
+
"boolean",
|
|
10
|
+
"select",
|
|
11
|
+
"secret"
|
|
12
|
+
].includes(String(t.type)) && (t.type !== "select" || Array.isArray(t.options) && t.options.every((t) => e(t) && typeof t.label == "string" && typeof t.value == "string")))) && (t.requiredDataSinks === void 0 || Array.isArray(t.requiredDataSinks) && t.requiredDataSinks.every((t) => e(t) && typeof t.slot == "string" && typeof t.label == "string" && (t.description === void 0 || t.description === null || typeof t.description == "string") && Array.isArray(t.expectedFields) && t.expectedFields.every((t) => e(t) && typeof t.name == "string") && Array.isArray(t.widgetTitles) && t.widgetTitles.every((e) => typeof e == "string"))) && t.definition.pages.every((t) => e(t) && (t.widgets === void 0 || Array.isArray(t.widgets) && t.widgets.every(e)));
|
|
13
|
+
}
|
|
14
|
+
function n(t, n) {
|
|
15
|
+
let r = t.definition;
|
|
16
|
+
if (!e(r) || !e(r.dashboard)) throw Error("This template has no valid dashboard definition and cannot be installed.");
|
|
17
|
+
let i = r.dashboard;
|
|
18
|
+
return {
|
|
19
|
+
...t,
|
|
20
|
+
definition: {
|
|
21
|
+
...r,
|
|
22
|
+
dashboard: {
|
|
23
|
+
...i,
|
|
24
|
+
...n.description === void 0 ? {} : { description: n.description },
|
|
25
|
+
...n.tags === void 0 ? {} : { metadata: {
|
|
26
|
+
...e(i.metadata) ? i.metadata : {},
|
|
27
|
+
tags: [...n.tags]
|
|
28
|
+
} }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { t as isInstallableDashboardTemplate, n as withDashboardTemplateMetadata };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=dashboardTemplateContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboardTemplateContent.js","names":[],"sources":["../../../src/bigconsole/utils/dashboardTemplateContent.ts"],"sourcesContent":["import type { DashboardTemplateContent } from '../hooks/useStoreDashboardTemplates';\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\n/** Exclude envelopes the backend parser or dashboard importer cannot accept. */\nexport function isInstallableDashboardTemplate(content: unknown): boolean {\n return (\n isRecord(content) &&\n isRecord(content.definition) &&\n isRecord(content.definition.dashboard) &&\n typeof content.definition.schemaVersion === 'string' &&\n content.definition.schemaVersion.length > 0 &&\n typeof content.definition.dashboard.name === 'string' &&\n content.definition.dashboard.name.length > 0 &&\n Array.isArray(content.definition.pages) &&\n content.definition.pages.length > 0 &&\n (content.requiredInputs === undefined ||\n (Array.isArray(content.requiredInputs) &&\n content.requiredInputs.every(\n (input) =>\n isRecord(input) &&\n typeof input.name === 'string' &&\n typeof input.label === 'string' &&\n (input.placeholder === undefined || input.placeholder === null || typeof input.placeholder === 'string') &&\n typeof input.required === 'boolean' &&\n ['string', 'number', 'boolean', 'select', 'secret'].includes(String(input.type)) &&\n (input.type !== 'select' ||\n (Array.isArray(input.options) &&\n input.options.every(\n (option) => isRecord(option) && typeof option.label === 'string' && typeof option.value === 'string'\n )))\n ))) &&\n (content.requiredDataSinks === undefined ||\n (Array.isArray(content.requiredDataSinks) &&\n content.requiredDataSinks.every(\n (slot) =>\n isRecord(slot) &&\n typeof slot.slot === 'string' &&\n typeof slot.label === 'string' &&\n (slot.description === undefined || slot.description === null || typeof slot.description === 'string') &&\n Array.isArray(slot.expectedFields) &&\n slot.expectedFields.every((field) => isRecord(field) && typeof field.name === 'string') &&\n Array.isArray(slot.widgetTitles) &&\n slot.widgetTitles.every((title) => typeof title === 'string')\n ))) &&\n content.definition.pages.every(\n (page) =>\n isRecord(page) && (page.widgets === undefined || (Array.isArray(page.widgets) && page.widgets.every(isRecord)))\n )\n );\n}\n\n/** Keep creation metadata in the same import transaction as pages and widgets. */\nexport function withDashboardTemplateMetadata(\n content: DashboardTemplateContent,\n metadata: { description?: string; tags?: string[] }\n): DashboardTemplateContent {\n const definition = content.definition;\n if (!isRecord(definition) || !isRecord(definition.dashboard)) {\n throw new Error('This template has no valid dashboard definition and cannot be installed.');\n }\n const dashboard = definition.dashboard;\n return {\n ...content,\n definition: {\n ...definition,\n dashboard: {\n ...dashboard,\n ...(metadata.description !== undefined ? { description: metadata.description } : {}),\n ...(metadata.tags !== undefined\n ? {\n metadata: {\n ...(isRecord(dashboard.metadata) ? dashboard.metadata : {}),\n tags: [...metadata.tags],\n },\n }\n : {}),\n },\n },\n };\n}\n"],"mappings":";AAEA,SAAS,EAAS,GAAkD;AAClE,QAAyB,OAAO,KAAU,cAAnC,KAA+C,CAAC,MAAM,QAAQ,EAAM;;AAI7E,SAAgB,EAA+B,GAA2B;AACxE,QACE,EAAS,EAAQ,IACjB,EAAS,EAAQ,WAAW,IAC5B,EAAS,EAAQ,WAAW,UAAU,IACtC,OAAO,EAAQ,WAAW,iBAAkB,YAC5C,EAAQ,WAAW,cAAc,SAAS,KAC1C,OAAO,EAAQ,WAAW,UAAU,QAAS,YAC7C,EAAQ,WAAW,UAAU,KAAK,SAAS,KAC3C,MAAM,QAAQ,EAAQ,WAAW,MAAM,IACvC,EAAQ,WAAW,MAAM,SAAS,MACjC,EAAQ,mBAAmB,KAAA,KACzB,MAAM,QAAQ,EAAQ,eAAe,IACpC,EAAQ,eAAe,OACpB,MACC,EAAS,EAAM,IACf,OAAO,EAAM,QAAS,YACtB,OAAO,EAAM,SAAU,aACtB,EAAM,gBAAgB,KAAA,KAAa,EAAM,gBAAgB,QAAQ,OAAO,EAAM,eAAgB,aAC/F,OAAO,EAAM,YAAa,aAC1B;EAAC;EAAU;EAAU;EAAW;EAAU;EAAS,CAAC,SAAS,OAAO,EAAM,KAAK,CAAC,KAC/E,EAAM,SAAS,YACb,MAAM,QAAQ,EAAM,QAAQ,IAC3B,EAAM,QAAQ,OACX,MAAW,EAAS,EAAO,IAAI,OAAO,EAAO,SAAU,YAAY,OAAO,EAAO,SAAU,SAC7F,EACR,MACJ,EAAQ,sBAAsB,KAAA,KAC5B,MAAM,QAAQ,EAAQ,kBAAkB,IACvC,EAAQ,kBAAkB,OACvB,MACC,EAAS,EAAK,IACd,OAAO,EAAK,QAAS,YACrB,OAAO,EAAK,SAAU,aACrB,EAAK,gBAAgB,KAAA,KAAa,EAAK,gBAAgB,QAAQ,OAAO,EAAK,eAAgB,aAC5F,MAAM,QAAQ,EAAK,eAAe,IAClC,EAAK,eAAe,OAAO,MAAU,EAAS,EAAM,IAAI,OAAO,EAAM,QAAS,SAAS,IACvF,MAAM,QAAQ,EAAK,aAAa,IAChC,EAAK,aAAa,OAAO,MAAU,OAAO,KAAU,SAAS,CAChE,KACL,EAAQ,WAAW,MAAM,OACtB,MACC,EAAS,EAAK,KAAK,EAAK,YAAY,KAAA,KAAc,MAAM,QAAQ,EAAK,QAAQ,IAAI,EAAK,QAAQ,MAAM,EAAS,EAChH;;AAKL,SAAgB,EACd,GACA,GAC0B;CAC1B,IAAM,IAAa,EAAQ;AAC3B,KAAI,CAAC,EAAS,EAAW,IAAI,CAAC,EAAS,EAAW,UAAU,CAC1D,OAAU,MAAM,2EAA2E;CAE7F,IAAM,IAAY,EAAW;AAC7B,QAAO;EACL,GAAG;EACH,YAAY;GACV,GAAG;GACH,WAAW;IACT,GAAG;IACH,GAAI,EAAS,gBAAgB,KAAA,IAAoD,EAAE,GAA1C,EAAE,aAAa,EAAS,aAAa;IAC9E,GAAI,EAAS,SAAS,KAAA,IAOlB,EAAE,GANF,EACE,UAAU;KACR,GAAI,EAAS,EAAU,SAAS,GAAG,EAAU,WAAW,EAAE;KAC1D,MAAM,CAAC,GAAG,EAAS,KAAK;KACzB,EACF;IAEN;GACF;EACF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TemplateRequiredInput } from '../hooks/useStoreDashboardTemplates';
|
|
2
|
+
|
|
3
|
+
export declare function templateInputDefaults(inputs: TemplateRequiredInput[]): Record<string, unknown>;
|
|
4
|
+
export declare function templateInputError(inputs: TemplateRequiredInput[], values: Record<string, unknown>, translate?: (key: string, fallback: string, params: Record<string, string>) => string): string | null;
|
|
5
|
+
//# sourceMappingURL=templateInstallInputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templateInstallInputs.d.ts","sourceRoot":"","sources":["../../../src/bigconsole/utils/templateInstallInputs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAEjF,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAM9F;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,qBAAqB,EAAE,EAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,SAAS,GAAE,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAC1B,GACnD,MAAM,GAAG,IAAI,CA6Bf"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/bigconsole/utils/templateInstallInputs.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
return Object.fromEntries(e.filter((e) => e.defaultValue !== null && e.defaultValue !== void 0 && e.type !== "secret").map((e) => [e.name, e.defaultValue]));
|
|
4
|
+
}
|
|
5
|
+
function t(e, t, n = (e, t, n) => t.replaceAll("{label}", n.label ?? "")) {
|
|
6
|
+
for (let r of e) {
|
|
7
|
+
let e = t[r.name];
|
|
8
|
+
if (e == null || typeof e == "string" && !e.trim()) {
|
|
9
|
+
if (r.required) return n("bigconsole.dashboards.templateSetup.inputRequired", "{label} is required.", { label: r.label });
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
if (r.type === "number" && (typeof e != "number" || !Number.isFinite(e))) return n("bigconsole.dashboards.templateSetup.inputNumber", "{label} must be a number.", { label: r.label });
|
|
13
|
+
if (r.type === "boolean" && typeof e != "boolean") return n("bigconsole.dashboards.templateSetup.inputBoolean", "{label} must be true or false.", { label: r.label });
|
|
14
|
+
if (r.type === "select" && !r.options?.some((t) => t.value === e)) return n("bigconsole.dashboards.templateSetup.inputSelect", "Choose a valid {label}.", { label: r.label });
|
|
15
|
+
if ((r.type === "string" || r.type === "secret") && typeof e != "string") return n("bigconsole.dashboards.templateSetup.inputText", "{label} must be text.", { label: r.label });
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { e as templateInputDefaults, t as templateInputError };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=templateInstallInputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templateInstallInputs.js","names":[],"sources":["../../../src/bigconsole/utils/templateInstallInputs.ts"],"sourcesContent":["import type { TemplateRequiredInput } from '../hooks/useStoreDashboardTemplates';\n\nexport function templateInputDefaults(inputs: TemplateRequiredInput[]): Record<string, unknown> {\n return Object.fromEntries(\n inputs\n .filter((input) => input.defaultValue !== null && input.defaultValue !== undefined && input.type !== 'secret')\n .map((input) => [input.name, input.defaultValue])\n );\n}\n\nexport function templateInputError(\n inputs: TemplateRequiredInput[],\n values: Record<string, unknown>,\n translate: (key: string, fallback: string, params: Record<string, string>) => string = (_key, fallback, params) =>\n fallback.replaceAll('{label}', params.label ?? '')\n): string | null {\n for (const input of inputs) {\n const value = values[input.name];\n const absent = value === undefined || value === null || (typeof value === 'string' && !value.trim());\n if (absent) {\n if (input.required)\n return translate('bigconsole.dashboards.templateSetup.inputRequired', '{label} is required.', {\n label: input.label,\n });\n continue;\n }\n if (input.type === 'number' && (typeof value !== 'number' || !Number.isFinite(value)))\n return translate('bigconsole.dashboards.templateSetup.inputNumber', '{label} must be a number.', {\n label: input.label,\n });\n if (input.type === 'boolean' && typeof value !== 'boolean')\n return translate('bigconsole.dashboards.templateSetup.inputBoolean', '{label} must be true or false.', {\n label: input.label,\n });\n if (input.type === 'select' && !input.options?.some((option) => option.value === value))\n return translate('bigconsole.dashboards.templateSetup.inputSelect', 'Choose a valid {label}.', {\n label: input.label,\n });\n if ((input.type === 'string' || input.type === 'secret') && typeof value !== 'string')\n return translate('bigconsole.dashboards.templateSetup.inputText', '{label} must be text.', {\n label: input.label,\n });\n }\n return null;\n}\n"],"mappings":";AAEA,SAAgB,EAAsB,GAA0D;AAC9F,QAAO,OAAO,YACZ,EACG,QAAQ,MAAU,EAAM,iBAAiB,QAAQ,EAAM,iBAAiB,KAAA,KAAa,EAAM,SAAS,SAAS,CAC7G,KAAK,MAAU,CAAC,EAAM,MAAM,EAAM,aAAa,CAAC,CACpD;;AAGH,SAAgB,EACd,GACA,GACA,KAAwF,GAAM,GAAU,MACtG,EAAS,WAAW,WAAW,EAAO,SAAS,GAAG,EACrC;AACf,MAAK,IAAM,KAAS,GAAQ;EAC1B,IAAM,IAAQ,EAAO,EAAM;AAE3B,MADe,KAAiC,QAAS,OAAO,KAAU,YAAY,CAAC,EAAM,MAAM,EACvF;AACV,OAAI,EAAM,SACR,QAAO,EAAU,qDAAqD,wBAAwB,EAC5F,OAAO,EAAM,OACd,CAAC;AACJ;;AAEF,MAAI,EAAM,SAAS,aAAa,OAAO,KAAU,YAAY,CAAC,OAAO,SAAS,EAAM,EAClF,QAAO,EAAU,mDAAmD,6BAA6B,EAC/F,OAAO,EAAM,OACd,CAAC;AACJ,MAAI,EAAM,SAAS,aAAa,OAAO,KAAU,UAC/C,QAAO,EAAU,oDAAoD,kCAAkC,EACrG,OAAO,EAAM,OACd,CAAC;AACJ,MAAI,EAAM,SAAS,YAAY,CAAC,EAAM,SAAS,MAAM,MAAW,EAAO,UAAU,EAAM,CACrF,QAAO,EAAU,mDAAmD,2BAA2B,EAC7F,OAAO,EAAM,OACd,CAAC;AACJ,OAAK,EAAM,SAAS,YAAY,EAAM,SAAS,aAAa,OAAO,KAAU,SAC3E,QAAO,EAAU,iDAAiD,yBAAyB,EACzF,OAAO,EAAM,OACd,CAAC;;AAEN,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-operations.d.ts","sourceRoot":"","sources":["../../src/generated/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KAAK,CAAC,+BAA+B,EAAE,KAAK,CAAC,wCAAwC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-operations.js","names":[],"sources":["../../src/generated/global-operations.ts"],"sourcesContent":["// @ts-nocheck\nimport * as Types from './global-types';\n\nimport { gql } from '@apollo/client';\nimport * as Apollo from '@apollo/client';\nimport * as ApolloReactHooks from '@apollo/client/react';\nconst defaultOptions = {} as const;\nexport type CreateDashboardTemplateAppMutationVariables = Types.Exact<{\n input: Types.CreateApplicationInput;\n}>;\n\n\nexport type CreateDashboardTemplateAppMutation = { __typename?: 'Mutation', createApplication: { __typename?: 'Application', id: string, name: string, slug: string, status: Types.AppStatus } };\n\nexport type CreateDashboardTemplateVersionMutationVariables = Types.Exact<{\n applicationId: Types.Scalars['ID']['input'];\n input: Types.CreateApplicationVersionInput;\n}>;\n\n\nexport type CreateDashboardTemplateVersionMutation = { __typename?: 'Mutation', createApplicationVersion: { __typename?: 'ApplicationVersion', id: string, version: string, status: string } };\n\nexport type BrowseDashboardTemplatesQueryVariables = Types.Exact<{\n input: Types.BrowseStoreInput;\n}>;\n\n\nexport type BrowseDashboardTemplatesQuery = { __typename?: 'Query', browseStore: { __typename?: 'BrowseStoreResult', totalCount: number, hasMore: boolean, products: Array<{ __typename?: 'StoreProduct', id: string, name: string, slug: string, description?: string | null, icon?: string | null, category?: string | null, tags: Array<string>, featured: boolean, downloads: number, rating?: number | null, pricingModel: Types.PricingModel, price: number }> } };\n\nexport type GetDashboardTemplateDetailQueryVariables = Types.Exact<{\n id: Types.Scalars['ID']['input'];\n}>;\n\n\nexport type GetDashboardTemplateDetailQuery = { __typename?: 'Query', product?: { __typename?: 'StoreProduct', id: string, name: string, slug: string, description?: string | null, longDescription?: string | null, icon?: string | null, screenshots: Array<string>, category?: string | null, tags: Array<string>, pricingModel: Types.PricingModel, price: number, downloads: number, rating?: number | null, reviewCount: number, content?: Record<string, unknown> | null } | null };\n\n\nexport const CreateDashboardTemplateAppDocument = gql`\n mutation CreateDashboardTemplateApp($input: CreateApplicationInput!) {\n createApplication(input: $input) {\n id\n name\n slug\n status\n }\n}\n `;\nexport type CreateDashboardTemplateAppMutationFn = Apollo.MutationFunction<Types.CreateDashboardTemplateAppMutation, Types.CreateDashboardTemplateAppMutationVariables>;\n\n/**\n * __useCreateDashboardTemplateAppMutation__\n *\n * To run a mutation, you first call `useCreateDashboardTemplateAppMutation` within a React component and pass it any options that fit your needs.\n * When your component renders, `useCreateDashboardTemplateAppMutation` returns a tuple that includes:\n * - A mutate function that you can call at any time to execute the mutation\n * - An object with fields that represent the current status of the mutation's execution\n *\n * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;\n *\n * @example\n * const [createDashboardTemplateAppMutation, { data, loading, error }] = useCreateDashboardTemplateAppMutation({\n * variables: {\n * input: // value for 'input'\n * },\n * });\n */\nexport function useCreateDashboardTemplateAppMutation(baseOptions?: ApolloReactHooks.MutationHookOptions<Types.CreateDashboardTemplateAppMutation, Types.CreateDashboardTemplateAppMutationVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useMutation<Types.CreateDashboardTemplateAppMutation, Types.CreateDashboardTemplateAppMutationVariables>(CreateDashboardTemplateAppDocument, options);\n }\nexport type CreateDashboardTemplateAppMutationHookResult = ReturnType<typeof useCreateDashboardTemplateAppMutation>;\nexport type CreateDashboardTemplateAppMutationResult = Apollo.MutationResult<Types.CreateDashboardTemplateAppMutation>;\nexport type CreateDashboardTemplateAppMutationOptions = Apollo.BaseMutationOptions<Types.CreateDashboardTemplateAppMutation, Types.CreateDashboardTemplateAppMutationVariables>;\nexport const CreateDashboardTemplateVersionDocument = gql`\n mutation CreateDashboardTemplateVersion($applicationId: ID!, $input: CreateApplicationVersionInput!) {\n createApplicationVersion(applicationId: $applicationId, input: $input) {\n id\n version\n status\n }\n}\n `;\nexport type CreateDashboardTemplateVersionMutationFn = Apollo.MutationFunction<Types.CreateDashboardTemplateVersionMutation, Types.CreateDashboardTemplateVersionMutationVariables>;\n\n/**\n * __useCreateDashboardTemplateVersionMutation__\n *\n * To run a mutation, you first call `useCreateDashboardTemplateVersionMutation` within a React component and pass it any options that fit your needs.\n * When your component renders, `useCreateDashboardTemplateVersionMutation` returns a tuple that includes:\n * - A mutate function that you can call at any time to execute the mutation\n * - An object with fields that represent the current status of the mutation's execution\n *\n * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;\n *\n * @example\n * const [createDashboardTemplateVersionMutation, { data, loading, error }] = useCreateDashboardTemplateVersionMutation({\n * variables: {\n * applicationId: // value for 'applicationId'\n * input: // value for 'input'\n * },\n * });\n */\nexport function useCreateDashboardTemplateVersionMutation(baseOptions?: ApolloReactHooks.MutationHookOptions<Types.CreateDashboardTemplateVersionMutation, Types.CreateDashboardTemplateVersionMutationVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useMutation<Types.CreateDashboardTemplateVersionMutation, Types.CreateDashboardTemplateVersionMutationVariables>(CreateDashboardTemplateVersionDocument, options);\n }\nexport type CreateDashboardTemplateVersionMutationHookResult = ReturnType<typeof useCreateDashboardTemplateVersionMutation>;\nexport type CreateDashboardTemplateVersionMutationResult = Apollo.MutationResult<Types.CreateDashboardTemplateVersionMutation>;\nexport type CreateDashboardTemplateVersionMutationOptions = Apollo.BaseMutationOptions<Types.CreateDashboardTemplateVersionMutation, Types.CreateDashboardTemplateVersionMutationVariables>;\nexport const BrowseDashboardTemplatesDocument = gql`\n query BrowseDashboardTemplates($input: BrowseStoreInput!) {\n browseStore(input: $input) {\n totalCount\n hasMore\n products {\n id\n name\n slug\n description\n icon\n category\n tags\n featured\n downloads\n rating\n pricingModel\n price\n }\n }\n}\n `;\n\n/**\n * __useBrowseDashboardTemplatesQuery__\n *\n * To run a query within a React component, call `useBrowseDashboardTemplatesQuery` and pass it any options that fit your needs.\n * When your component renders, `useBrowseDashboardTemplatesQuery` returns an object from Apollo Client that contains loading, error, and data properties\n * you can use to render your UI.\n *\n * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;\n *\n * @example\n * const { data, loading, error } = useBrowseDashboardTemplatesQuery({\n * variables: {\n * input: // value for 'input'\n * },\n * });\n */\nexport function useBrowseDashboardTemplatesQuery(baseOptions: ApolloReactHooks.QueryHookOptions<Types.BrowseDashboardTemplatesQuery, Types.BrowseDashboardTemplatesQueryVariables> & ({ variables: Types.BrowseDashboardTemplatesQueryVariables; skip?: boolean; } | { skip: boolean; }) ) {\n const options = {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useQuery<Types.BrowseDashboardTemplatesQuery, Types.BrowseDashboardTemplatesQueryVariables>(BrowseDashboardTemplatesDocument, options);\n }\nexport function useBrowseDashboardTemplatesLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions<Types.BrowseDashboardTemplatesQuery, Types.BrowseDashboardTemplatesQueryVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useLazyQuery<Types.BrowseDashboardTemplatesQuery, Types.BrowseDashboardTemplatesQueryVariables>(BrowseDashboardTemplatesDocument, options);\n }\n// @ts-ignore\nexport function useBrowseDashboardTemplatesSuspenseQuery(baseOptions?: ApolloReactHooks.SuspenseQueryHookOptions<Types.BrowseDashboardTemplatesQuery, Types.BrowseDashboardTemplatesQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.BrowseDashboardTemplatesQuery, Types.BrowseDashboardTemplatesQueryVariables>;\nexport function useBrowseDashboardTemplatesSuspenseQuery(baseOptions?: ApolloReactHooks.SkipToken | ApolloReactHooks.SuspenseQueryHookOptions<Types.BrowseDashboardTemplatesQuery, Types.BrowseDashboardTemplatesQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.BrowseDashboardTemplatesQuery | undefined, Types.BrowseDashboardTemplatesQueryVariables>;\nexport function useBrowseDashboardTemplatesSuspenseQuery(baseOptions?: ApolloReactHooks.SkipToken | ApolloReactHooks.SuspenseQueryHookOptions<Types.BrowseDashboardTemplatesQuery, Types.BrowseDashboardTemplatesQueryVariables>) {\n const options = baseOptions === ApolloReactHooks.skipToken ? baseOptions : {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useSuspenseQuery<Types.BrowseDashboardTemplatesQuery, Types.BrowseDashboardTemplatesQueryVariables>(BrowseDashboardTemplatesDocument, options);\n }\nexport type BrowseDashboardTemplatesQueryHookResult = ReturnType<typeof useBrowseDashboardTemplatesQuery>;\nexport type BrowseDashboardTemplatesLazyQueryHookResult = ReturnType<typeof useBrowseDashboardTemplatesLazyQuery>;\nexport type BrowseDashboardTemplatesSuspenseQueryHookResult = ReturnType<typeof useBrowseDashboardTemplatesSuspenseQuery>;\nexport type BrowseDashboardTemplatesQueryResult = Apollo.QueryResult<Types.BrowseDashboardTemplatesQuery, Types.BrowseDashboardTemplatesQueryVariables>;\nexport const GetDashboardTemplateDetailDocument = gql`\n query GetDashboardTemplateDetail($id: ID!) {\n product(id: $id) {\n id\n name\n slug\n description\n longDescription\n icon\n screenshots\n category\n tags\n pricingModel\n price\n downloads\n rating\n reviewCount\n content\n }\n}\n `;\n\n/**\n * __useGetDashboardTemplateDetailQuery__\n *\n * To run a query within a React component, call `useGetDashboardTemplateDetailQuery` and pass it any options that fit your needs.\n * When your component renders, `useGetDashboardTemplateDetailQuery` returns an object from Apollo Client that contains loading, error, and data properties\n * you can use to render your UI.\n *\n * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;\n *\n * @example\n * const { data, loading, error } = useGetDashboardTemplateDetailQuery({\n * variables: {\n * id: // value for 'id'\n * },\n * });\n */\nexport function useGetDashboardTemplateDetailQuery(baseOptions: ApolloReactHooks.QueryHookOptions<Types.GetDashboardTemplateDetailQuery, Types.GetDashboardTemplateDetailQueryVariables> & ({ variables: Types.GetDashboardTemplateDetailQueryVariables; skip?: boolean; } | { skip: boolean; }) ) {\n const options = {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useQuery<Types.GetDashboardTemplateDetailQuery, Types.GetDashboardTemplateDetailQueryVariables>(GetDashboardTemplateDetailDocument, options);\n }\nexport function useGetDashboardTemplateDetailLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions<Types.GetDashboardTemplateDetailQuery, Types.GetDashboardTemplateDetailQueryVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useLazyQuery<Types.GetDashboardTemplateDetailQuery, Types.GetDashboardTemplateDetailQueryVariables>(GetDashboardTemplateDetailDocument, options);\n }\n// @ts-ignore\nexport function useGetDashboardTemplateDetailSuspenseQuery(baseOptions?: ApolloReactHooks.SuspenseQueryHookOptions<Types.GetDashboardTemplateDetailQuery, Types.GetDashboardTemplateDetailQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.GetDashboardTemplateDetailQuery, Types.GetDashboardTemplateDetailQueryVariables>;\nexport function useGetDashboardTemplateDetailSuspenseQuery(baseOptions?: ApolloReactHooks.SkipToken | ApolloReactHooks.SuspenseQueryHookOptions<Types.GetDashboardTemplateDetailQuery, Types.GetDashboardTemplateDetailQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.GetDashboardTemplateDetailQuery | undefined, Types.GetDashboardTemplateDetailQueryVariables>;\nexport function useGetDashboardTemplateDetailSuspenseQuery(baseOptions?: ApolloReactHooks.SkipToken | ApolloReactHooks.SuspenseQueryHookOptions<Types.GetDashboardTemplateDetailQuery, Types.GetDashboardTemplateDetailQueryVariables>) {\n const options = baseOptions === ApolloReactHooks.skipToken ? baseOptions : {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useSuspenseQuery<Types.GetDashboardTemplateDetailQuery, Types.GetDashboardTemplateDetailQueryVariables>(GetDashboardTemplateDetailDocument, options);\n }\nexport type GetDashboardTemplateDetailQueryHookResult = ReturnType<typeof useGetDashboardTemplateDetailQuery>;\nexport type GetDashboardTemplateDetailLazyQueryHookResult = ReturnType<typeof useGetDashboardTemplateDetailLazyQuery>;\nexport type GetDashboardTemplateDetailSuspenseQueryHookResult = ReturnType<typeof useGetDashboardTemplateDetailSuspenseQuery>;\nexport type GetDashboardTemplateDetailQueryResult = Apollo.QueryResult<Types.GetDashboardTemplateDetailQuery, Types.GetDashboardTemplateDetailQueryVariables>;"],"mappings":";;;AAqCA,IAAa,IAAqC,CAAG;;;;;;;;;OAoCxC,IAAyC,CAAG;;;;;;;;OAoC5C,IAAmC,CAAG;;;;;;;;;;;;;;;;;;;;;OA0DtC,IAAqC,CAAG"}
|
|
1
|
+
{"version":3,"file":"global-operations.js","names":[],"sources":["../../src/generated/global-operations.ts"],"sourcesContent":["// @ts-nocheck\nimport * as Types from './global-types';\n\nimport { gql } from '@apollo/client';\nimport * as Apollo from '@apollo/client';\nimport * as ApolloReactHooks from '@apollo/client/react';\nconst defaultOptions = {} as const;\nexport type CreateDashboardTemplateAppMutationVariables = Types.Exact<{\n input: Types.CreateApplicationInput;\n}>;\n\n\nexport type CreateDashboardTemplateAppMutation = { __typename?: 'Mutation', createApplication: { __typename?: 'Application', id: string, name: string, slug: string, status: Types.AppStatus } };\n\nexport type CreateDashboardTemplateVersionMutationVariables = Types.Exact<{\n applicationId: Types.Scalars['ID']['input'];\n input: Types.CreateApplicationVersionInput;\n}>;\n\n\nexport type CreateDashboardTemplateVersionMutation = { __typename?: 'Mutation', createApplicationVersion: { __typename?: 'ApplicationVersion', id: string, version: string, status: string } };\n\nexport type BrowseDashboardTemplatesQueryVariables = Types.Exact<{\n input: Types.BrowseStoreInput;\n}>;\n\n\nexport type BrowseDashboardTemplatesQuery = { __typename?: 'Query', browseStore: { __typename?: 'BrowseStoreResult', totalCount: number, hasMore: boolean, products: Array<{ __typename?: 'StoreProduct', id: string, name: string, slug: string, description?: string | null, icon?: string | null, category?: string | null, tags: Array<string>, featured: boolean, downloads: number, rating?: number | null, pricingModel: Types.PricingModel, price: number, content?: Record<string, unknown> | null }> } };\n\nexport type GetDashboardTemplateDetailQueryVariables = Types.Exact<{\n id: Types.Scalars['ID']['input'];\n}>;\n\n\nexport type GetDashboardTemplateDetailQuery = { __typename?: 'Query', product?: { __typename?: 'StoreProduct', id: string, name: string, slug: string, description?: string | null, longDescription?: string | null, icon?: string | null, screenshots: Array<string>, category?: string | null, tags: Array<string>, pricingModel: Types.PricingModel, price: number, downloads: number, rating?: number | null, reviewCount: number, content?: Record<string, unknown> | null } | null };\n\n\nexport const CreateDashboardTemplateAppDocument = gql`\n mutation CreateDashboardTemplateApp($input: CreateApplicationInput!) {\n createApplication(input: $input) {\n id\n name\n slug\n status\n }\n}\n `;\nexport type CreateDashboardTemplateAppMutationFn = Apollo.MutationFunction<Types.CreateDashboardTemplateAppMutation, Types.CreateDashboardTemplateAppMutationVariables>;\n\n/**\n * __useCreateDashboardTemplateAppMutation__\n *\n * To run a mutation, you first call `useCreateDashboardTemplateAppMutation` within a React component and pass it any options that fit your needs.\n * When your component renders, `useCreateDashboardTemplateAppMutation` returns a tuple that includes:\n * - A mutate function that you can call at any time to execute the mutation\n * - An object with fields that represent the current status of the mutation's execution\n *\n * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;\n *\n * @example\n * const [createDashboardTemplateAppMutation, { data, loading, error }] = useCreateDashboardTemplateAppMutation({\n * variables: {\n * input: // value for 'input'\n * },\n * });\n */\nexport function useCreateDashboardTemplateAppMutation(baseOptions?: ApolloReactHooks.MutationHookOptions<Types.CreateDashboardTemplateAppMutation, Types.CreateDashboardTemplateAppMutationVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useMutation<Types.CreateDashboardTemplateAppMutation, Types.CreateDashboardTemplateAppMutationVariables>(CreateDashboardTemplateAppDocument, options);\n }\nexport type CreateDashboardTemplateAppMutationHookResult = ReturnType<typeof useCreateDashboardTemplateAppMutation>;\nexport type CreateDashboardTemplateAppMutationResult = Apollo.MutationResult<Types.CreateDashboardTemplateAppMutation>;\nexport type CreateDashboardTemplateAppMutationOptions = Apollo.BaseMutationOptions<Types.CreateDashboardTemplateAppMutation, Types.CreateDashboardTemplateAppMutationVariables>;\nexport const CreateDashboardTemplateVersionDocument = gql`\n mutation CreateDashboardTemplateVersion($applicationId: ID!, $input: CreateApplicationVersionInput!) {\n createApplicationVersion(applicationId: $applicationId, input: $input) {\n id\n version\n status\n }\n}\n `;\nexport type CreateDashboardTemplateVersionMutationFn = Apollo.MutationFunction<Types.CreateDashboardTemplateVersionMutation, Types.CreateDashboardTemplateVersionMutationVariables>;\n\n/**\n * __useCreateDashboardTemplateVersionMutation__\n *\n * To run a mutation, you first call `useCreateDashboardTemplateVersionMutation` within a React component and pass it any options that fit your needs.\n * When your component renders, `useCreateDashboardTemplateVersionMutation` returns a tuple that includes:\n * - A mutate function that you can call at any time to execute the mutation\n * - An object with fields that represent the current status of the mutation's execution\n *\n * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;\n *\n * @example\n * const [createDashboardTemplateVersionMutation, { data, loading, error }] = useCreateDashboardTemplateVersionMutation({\n * variables: {\n * applicationId: // value for 'applicationId'\n * input: // value for 'input'\n * },\n * });\n */\nexport function useCreateDashboardTemplateVersionMutation(baseOptions?: ApolloReactHooks.MutationHookOptions<Types.CreateDashboardTemplateVersionMutation, Types.CreateDashboardTemplateVersionMutationVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useMutation<Types.CreateDashboardTemplateVersionMutation, Types.CreateDashboardTemplateVersionMutationVariables>(CreateDashboardTemplateVersionDocument, options);\n }\nexport type CreateDashboardTemplateVersionMutationHookResult = ReturnType<typeof useCreateDashboardTemplateVersionMutation>;\nexport type CreateDashboardTemplateVersionMutationResult = Apollo.MutationResult<Types.CreateDashboardTemplateVersionMutation>;\nexport type CreateDashboardTemplateVersionMutationOptions = Apollo.BaseMutationOptions<Types.CreateDashboardTemplateVersionMutation, Types.CreateDashboardTemplateVersionMutationVariables>;\nexport const BrowseDashboardTemplatesDocument = gql`\n query BrowseDashboardTemplates($input: BrowseStoreInput!) {\n browseStore(input: $input) {\n totalCount\n hasMore\n products {\n id\n name\n slug\n description\n icon\n category\n tags\n featured\n downloads\n rating\n pricingModel\n price\n content\n }\n }\n}\n `;\n\n/**\n * __useBrowseDashboardTemplatesQuery__\n *\n * To run a query within a React component, call `useBrowseDashboardTemplatesQuery` and pass it any options that fit your needs.\n * When your component renders, `useBrowseDashboardTemplatesQuery` returns an object from Apollo Client that contains loading, error, and data properties\n * you can use to render your UI.\n *\n * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;\n *\n * @example\n * const { data, loading, error } = useBrowseDashboardTemplatesQuery({\n * variables: {\n * input: // value for 'input'\n * },\n * });\n */\nexport function useBrowseDashboardTemplatesQuery(baseOptions: ApolloReactHooks.QueryHookOptions<Types.BrowseDashboardTemplatesQuery, Types.BrowseDashboardTemplatesQueryVariables> & ({ variables: Types.BrowseDashboardTemplatesQueryVariables; skip?: boolean; } | { skip: boolean; }) ) {\n const options = {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useQuery<Types.BrowseDashboardTemplatesQuery, Types.BrowseDashboardTemplatesQueryVariables>(BrowseDashboardTemplatesDocument, options);\n }\nexport function useBrowseDashboardTemplatesLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions<Types.BrowseDashboardTemplatesQuery, Types.BrowseDashboardTemplatesQueryVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useLazyQuery<Types.BrowseDashboardTemplatesQuery, Types.BrowseDashboardTemplatesQueryVariables>(BrowseDashboardTemplatesDocument, options);\n }\n// @ts-ignore\nexport function useBrowseDashboardTemplatesSuspenseQuery(baseOptions?: ApolloReactHooks.SuspenseQueryHookOptions<Types.BrowseDashboardTemplatesQuery, Types.BrowseDashboardTemplatesQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.BrowseDashboardTemplatesQuery, Types.BrowseDashboardTemplatesQueryVariables>;\nexport function useBrowseDashboardTemplatesSuspenseQuery(baseOptions?: ApolloReactHooks.SkipToken | ApolloReactHooks.SuspenseQueryHookOptions<Types.BrowseDashboardTemplatesQuery, Types.BrowseDashboardTemplatesQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.BrowseDashboardTemplatesQuery | undefined, Types.BrowseDashboardTemplatesQueryVariables>;\nexport function useBrowseDashboardTemplatesSuspenseQuery(baseOptions?: ApolloReactHooks.SkipToken | ApolloReactHooks.SuspenseQueryHookOptions<Types.BrowseDashboardTemplatesQuery, Types.BrowseDashboardTemplatesQueryVariables>) {\n const options = baseOptions === ApolloReactHooks.skipToken ? baseOptions : {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useSuspenseQuery<Types.BrowseDashboardTemplatesQuery, Types.BrowseDashboardTemplatesQueryVariables>(BrowseDashboardTemplatesDocument, options);\n }\nexport type BrowseDashboardTemplatesQueryHookResult = ReturnType<typeof useBrowseDashboardTemplatesQuery>;\nexport type BrowseDashboardTemplatesLazyQueryHookResult = ReturnType<typeof useBrowseDashboardTemplatesLazyQuery>;\nexport type BrowseDashboardTemplatesSuspenseQueryHookResult = ReturnType<typeof useBrowseDashboardTemplatesSuspenseQuery>;\nexport type BrowseDashboardTemplatesQueryResult = Apollo.QueryResult<Types.BrowseDashboardTemplatesQuery, Types.BrowseDashboardTemplatesQueryVariables>;\nexport const GetDashboardTemplateDetailDocument = gql`\n query GetDashboardTemplateDetail($id: ID!) {\n product(id: $id) {\n id\n name\n slug\n description\n longDescription\n icon\n screenshots\n category\n tags\n pricingModel\n price\n downloads\n rating\n reviewCount\n content\n }\n}\n `;\n\n/**\n * __useGetDashboardTemplateDetailQuery__\n *\n * To run a query within a React component, call `useGetDashboardTemplateDetailQuery` and pass it any options that fit your needs.\n * When your component renders, `useGetDashboardTemplateDetailQuery` returns an object from Apollo Client that contains loading, error, and data properties\n * you can use to render your UI.\n *\n * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;\n *\n * @example\n * const { data, loading, error } = useGetDashboardTemplateDetailQuery({\n * variables: {\n * id: // value for 'id'\n * },\n * });\n */\nexport function useGetDashboardTemplateDetailQuery(baseOptions: ApolloReactHooks.QueryHookOptions<Types.GetDashboardTemplateDetailQuery, Types.GetDashboardTemplateDetailQueryVariables> & ({ variables: Types.GetDashboardTemplateDetailQueryVariables; skip?: boolean; } | { skip: boolean; }) ) {\n const options = {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useQuery<Types.GetDashboardTemplateDetailQuery, Types.GetDashboardTemplateDetailQueryVariables>(GetDashboardTemplateDetailDocument, options);\n }\nexport function useGetDashboardTemplateDetailLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions<Types.GetDashboardTemplateDetailQuery, Types.GetDashboardTemplateDetailQueryVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useLazyQuery<Types.GetDashboardTemplateDetailQuery, Types.GetDashboardTemplateDetailQueryVariables>(GetDashboardTemplateDetailDocument, options);\n }\n// @ts-ignore\nexport function useGetDashboardTemplateDetailSuspenseQuery(baseOptions?: ApolloReactHooks.SuspenseQueryHookOptions<Types.GetDashboardTemplateDetailQuery, Types.GetDashboardTemplateDetailQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.GetDashboardTemplateDetailQuery, Types.GetDashboardTemplateDetailQueryVariables>;\nexport function useGetDashboardTemplateDetailSuspenseQuery(baseOptions?: ApolloReactHooks.SkipToken | ApolloReactHooks.SuspenseQueryHookOptions<Types.GetDashboardTemplateDetailQuery, Types.GetDashboardTemplateDetailQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.GetDashboardTemplateDetailQuery | undefined, Types.GetDashboardTemplateDetailQueryVariables>;\nexport function useGetDashboardTemplateDetailSuspenseQuery(baseOptions?: ApolloReactHooks.SkipToken | ApolloReactHooks.SuspenseQueryHookOptions<Types.GetDashboardTemplateDetailQuery, Types.GetDashboardTemplateDetailQueryVariables>) {\n const options = baseOptions === ApolloReactHooks.skipToken ? baseOptions : {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useSuspenseQuery<Types.GetDashboardTemplateDetailQuery, Types.GetDashboardTemplateDetailQueryVariables>(GetDashboardTemplateDetailDocument, options);\n }\nexport type GetDashboardTemplateDetailQueryHookResult = ReturnType<typeof useGetDashboardTemplateDetailQuery>;\nexport type GetDashboardTemplateDetailLazyQueryHookResult = ReturnType<typeof useGetDashboardTemplateDetailLazyQuery>;\nexport type GetDashboardTemplateDetailSuspenseQueryHookResult = ReturnType<typeof useGetDashboardTemplateDetailSuspenseQuery>;\nexport type GetDashboardTemplateDetailQueryResult = Apollo.QueryResult<Types.GetDashboardTemplateDetailQuery, Types.GetDashboardTemplateDetailQueryVariables>;"],"mappings":";;;AAqCA,IAAa,IAAqC,CAAG;;;;;;;;;OAoCxC,IAAyC,CAAG;;;;;;;;OAoC5C,IAAmC,CAAG;;;;;;;;;;;;;;;;;;;;;;OA2DtC,IAAqC,CAAG"}
|