deepspotscreen-sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +485 -0
- package/dist/DeepspotSDK-CyX06_c2.js +1486 -0
- package/dist/DeepspotSDK-g7o9tAip.cjs +546 -0
- package/dist/_commonjsHelpers-MeVG4QFm.cjs +1 -0
- package/dist/_commonjsHelpers-bAxELxBV.js +8 -0
- package/dist/apexcharts.common-DGzslxI3.cjs +808 -0
- package/dist/apexcharts.common-k3hLWpB8.js +8956 -0
- package/dist/components/DashboardElement.d.ts +18 -0
- package/dist/components/ReportElement.d.ts +15 -0
- package/dist/core/ApiClient.d.ts +41 -0
- package/dist/core/DeepspotSDK.d.ts +11 -0
- package/dist/core/EmbedInstance.d.ts +46 -0
- package/dist/deepspot-sdk.esm.js +1704 -0
- package/dist/deepspot-sdk.js +1655 -0
- package/dist/html2canvas.esm-CzwMv54K.js +4870 -0
- package/dist/html2canvas.esm-EoNFmhrp.cjs +22 -0
- package/dist/index.d.ts +146 -0
- package/dist/index.es-C-ai08UC.js +5632 -0
- package/dist/index.es-ELJ1Oc0z.cjs +18 -0
- package/dist/index.es-TiU5c3LF.js +5632 -0
- package/dist/jspdf.es.min-D6GjoB2T.cjs +243 -0
- package/dist/jspdf.es.min-Ge0fRUwj.js +8107 -0
- package/dist/jspdf.es.min-d9hlG26J.js +8107 -0
- package/dist/layout/GridLayout.d.ts +25 -0
- package/dist/purify.es-CuxL4pit.js +471 -0
- package/dist/purify.es-D_pYQKft.cjs +3 -0
- package/dist/react/index.cjs +1 -0
- package/dist/react/index.d.ts +33 -0
- package/dist/react/index.mjs +188 -0
- package/dist/renderer/CardRenderer.d.ts +6 -0
- package/dist/renderer/ChartRenderer.d.ts +19 -0
- package/dist/renderer/DashboardRenderer.d.ts +64 -0
- package/dist/renderer/FilterRenderer.d.ts +20 -0
- package/dist/renderer/ReportRenderer.d.ts +14 -0
- package/dist/renderer/TableRenderer.d.ts +8 -0
- package/dist/types.d.ts +140 -0
- package/dist/utils.d.ts +4 -0
- package/dist/vue/index.cjs +1 -0
- package/dist/vue/index.d.ts +212 -0
- package/dist/vue/index.mjs +138 -0
- package/package.json +69 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { useRef as $, useState as q, useEffect as H, createElement as n } from "react";
|
|
2
|
+
function M({
|
|
3
|
+
apiKey: f,
|
|
4
|
+
baseUrl: p,
|
|
5
|
+
dashboardId: l,
|
|
6
|
+
userId: d,
|
|
7
|
+
tenantId: x,
|
|
8
|
+
embedLevel: y,
|
|
9
|
+
theme: m,
|
|
10
|
+
height: v,
|
|
11
|
+
pageId: z,
|
|
12
|
+
tabId: L,
|
|
13
|
+
filters: c,
|
|
14
|
+
hideFilters: j,
|
|
15
|
+
hideExport: B,
|
|
16
|
+
onReady: b,
|
|
17
|
+
onFilterChange: r,
|
|
18
|
+
onTabSwitch: g,
|
|
19
|
+
onError: o,
|
|
20
|
+
className: D,
|
|
21
|
+
style: R,
|
|
22
|
+
loadingNode: u
|
|
23
|
+
}) {
|
|
24
|
+
const t = $(null), S = $(void 0), [s, e] = q(!0), [i, k] = q("");
|
|
25
|
+
return H(() => {
|
|
26
|
+
if (!t.current) return;
|
|
27
|
+
let C = !1;
|
|
28
|
+
async function J() {
|
|
29
|
+
var w;
|
|
30
|
+
if (t.current)
|
|
31
|
+
try {
|
|
32
|
+
e(!0), k("");
|
|
33
|
+
const { DeepspotSDK: a } = await import("../DeepspotSDK-CyX06_c2.js");
|
|
34
|
+
if (C || !t.current) return;
|
|
35
|
+
const G = await new a({ apiKey: f, baseUrl: p }).embedDashboard({
|
|
36
|
+
dashboardId: l,
|
|
37
|
+
container: t.current,
|
|
38
|
+
userId: d,
|
|
39
|
+
tenantId: x,
|
|
40
|
+
embedLevel: y,
|
|
41
|
+
theme: m,
|
|
42
|
+
height: v,
|
|
43
|
+
pageId: z,
|
|
44
|
+
tabId: L,
|
|
45
|
+
filters: c,
|
|
46
|
+
hideFilters: j,
|
|
47
|
+
hideExport: B,
|
|
48
|
+
onReady: b,
|
|
49
|
+
onFilterChange: r,
|
|
50
|
+
onTabSwitch: g,
|
|
51
|
+
onError: o
|
|
52
|
+
});
|
|
53
|
+
if (C) {
|
|
54
|
+
G.destroy();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
S.current = G, e(!1);
|
|
58
|
+
} catch (a) {
|
|
59
|
+
if (C) return;
|
|
60
|
+
const A = (w = a == null ? void 0 : a.message) != null ? w : String(a);
|
|
61
|
+
k(A), e(!1), o == null || o(A);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return J(), () => {
|
|
65
|
+
var w;
|
|
66
|
+
C = !0, (w = S.current) == null || w.destroy(), S.current = void 0;
|
|
67
|
+
};
|
|
68
|
+
}, [f, p, l, d, x, y, m, v, z, L, j, B]), n(
|
|
69
|
+
"div",
|
|
70
|
+
{ style: { position: "relative", width: "100%" } },
|
|
71
|
+
// Loading overlay
|
|
72
|
+
s && !i ? u != null ? u : n("div", {
|
|
73
|
+
style: {
|
|
74
|
+
position: "absolute",
|
|
75
|
+
inset: 0,
|
|
76
|
+
display: "flex",
|
|
77
|
+
alignItems: "center",
|
|
78
|
+
justifyContent: "center",
|
|
79
|
+
background: "rgba(255,255,255,0.6)",
|
|
80
|
+
zIndex: 1,
|
|
81
|
+
fontSize: "14px",
|
|
82
|
+
color: "#666"
|
|
83
|
+
}
|
|
84
|
+
}, "Loading dashboard…") : null,
|
|
85
|
+
// Error banner
|
|
86
|
+
i ? n("div", {
|
|
87
|
+
style: {
|
|
88
|
+
padding: "12px 16px",
|
|
89
|
+
background: "#fef2f2",
|
|
90
|
+
border: "1px solid #fca5a5",
|
|
91
|
+
borderRadius: "6px",
|
|
92
|
+
color: "#b91c1c",
|
|
93
|
+
fontSize: "13px",
|
|
94
|
+
marginBottom: "8px"
|
|
95
|
+
}
|
|
96
|
+
}, `Deepspot error: ${i}`) : null,
|
|
97
|
+
// Dashboard mount point
|
|
98
|
+
n("div", { ref: t, className: D, style: R })
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
function O({
|
|
102
|
+
apiKey: f,
|
|
103
|
+
baseUrl: p,
|
|
104
|
+
dashboardId: l,
|
|
105
|
+
componentId: d,
|
|
106
|
+
userId: x,
|
|
107
|
+
tenantId: y,
|
|
108
|
+
theme: m,
|
|
109
|
+
height: v,
|
|
110
|
+
filters: z,
|
|
111
|
+
onReady: L,
|
|
112
|
+
onError: c,
|
|
113
|
+
className: j,
|
|
114
|
+
style: B,
|
|
115
|
+
loadingNode: b
|
|
116
|
+
}) {
|
|
117
|
+
const r = $(null), g = $(void 0), [o, D] = q(!0), [R, u] = q("");
|
|
118
|
+
return H(() => {
|
|
119
|
+
if (!r.current) return;
|
|
120
|
+
let t = !1;
|
|
121
|
+
async function S() {
|
|
122
|
+
var s;
|
|
123
|
+
if (r.current)
|
|
124
|
+
try {
|
|
125
|
+
D(!0), u("");
|
|
126
|
+
const { DeepspotSDK: e } = await import("../DeepspotSDK-CyX06_c2.js");
|
|
127
|
+
if (t || !r.current) return;
|
|
128
|
+
const k = await new e({ apiKey: f, baseUrl: p }).embedReport({
|
|
129
|
+
dashboardId: l,
|
|
130
|
+
componentId: d,
|
|
131
|
+
container: r.current,
|
|
132
|
+
userId: x,
|
|
133
|
+
tenantId: y,
|
|
134
|
+
theme: m,
|
|
135
|
+
height: v,
|
|
136
|
+
filters: z,
|
|
137
|
+
onReady: L,
|
|
138
|
+
onError: c
|
|
139
|
+
});
|
|
140
|
+
if (t) {
|
|
141
|
+
k.destroy();
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
g.current = k, D(!1);
|
|
145
|
+
} catch (e) {
|
|
146
|
+
if (t) return;
|
|
147
|
+
const i = (s = e == null ? void 0 : e.message) != null ? s : String(e);
|
|
148
|
+
u(i), D(!1), c == null || c(i);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return S(), () => {
|
|
152
|
+
var s;
|
|
153
|
+
t = !0, (s = g.current) == null || s.destroy(), g.current = void 0;
|
|
154
|
+
};
|
|
155
|
+
}, [f, p, l, d, x, y, m, v]), n(
|
|
156
|
+
"div",
|
|
157
|
+
{ style: { position: "relative", width: "100%" } },
|
|
158
|
+
o && !R ? b != null ? b : n("div", {
|
|
159
|
+
style: {
|
|
160
|
+
position: "absolute",
|
|
161
|
+
inset: 0,
|
|
162
|
+
display: "flex",
|
|
163
|
+
alignItems: "center",
|
|
164
|
+
justifyContent: "center",
|
|
165
|
+
background: "rgba(255,255,255,0.6)",
|
|
166
|
+
zIndex: 1,
|
|
167
|
+
fontSize: "14px",
|
|
168
|
+
color: "#666"
|
|
169
|
+
}
|
|
170
|
+
}, "Loading…") : null,
|
|
171
|
+
R ? n("div", {
|
|
172
|
+
style: {
|
|
173
|
+
padding: "12px 16px",
|
|
174
|
+
background: "#fef2f2",
|
|
175
|
+
border: "1px solid #fca5a5",
|
|
176
|
+
borderRadius: "6px",
|
|
177
|
+
color: "#b91c1c",
|
|
178
|
+
fontSize: "13px",
|
|
179
|
+
marginBottom: "8px"
|
|
180
|
+
}
|
|
181
|
+
}, `Deepspot error: ${R}`) : null,
|
|
182
|
+
n("div", { ref: r, className: j, style: B })
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
export {
|
|
186
|
+
M as DeepspotDashboard,
|
|
187
|
+
O as DeepspotReport
|
|
188
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ComponentConfig } from '../types';
|
|
2
|
+
|
|
3
|
+
export declare class ChartRenderer {
|
|
4
|
+
private chart;
|
|
5
|
+
private container;
|
|
6
|
+
constructor(container: HTMLElement);
|
|
7
|
+
render(component: ComponentConfig, data: Record<string, any>[], theme: 'light' | 'dark',
|
|
8
|
+
/** Explicit pixel height of the chart body (excludes the title bar).
|
|
9
|
+
* Passed from DashboardRenderer so ApexCharts never has to guess the
|
|
10
|
+
* flex-child height at render time (which can be 0 before layout settles). */
|
|
11
|
+
chartBodyHeight?: number): Promise<void>;
|
|
12
|
+
update(component: ComponentConfig, data: Record<string, any>[], theme: 'light' | 'dark'): Promise<void>;
|
|
13
|
+
destroy(): void;
|
|
14
|
+
private buildOptions;
|
|
15
|
+
private buildCartesianOptions;
|
|
16
|
+
private buildPieOptions;
|
|
17
|
+
private extractSeriesAndCategories;
|
|
18
|
+
private renderEmpty;
|
|
19
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { RenderResponse, EmbedLevel } from '../types';
|
|
2
|
+
|
|
3
|
+
export interface DashboardRenderOptions {
|
|
4
|
+
embedLevel: EmbedLevel;
|
|
5
|
+
theme: 'light' | 'dark';
|
|
6
|
+
hideFilters: boolean;
|
|
7
|
+
hideExport: boolean;
|
|
8
|
+
initialFilters: Record<string, any>;
|
|
9
|
+
onFilterChange?: (filters: Record<string, any>) => void;
|
|
10
|
+
onReady?: () => void;
|
|
11
|
+
/** Caller must fetch fresh data for (pageId, tabId) then call update() */
|
|
12
|
+
onTabSwitch: (pageId: string, tabId: string) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Called for each dropdown / multi-select filter whose options are empty.
|
|
15
|
+
* The caller (DashboardElement / DeepspotSDK) fetches options from
|
|
16
|
+
* GET /dashboard-builder/{dashboardId}/filters/{filterId}/options
|
|
17
|
+
* and returns the string[] to populate the select.
|
|
18
|
+
*/
|
|
19
|
+
onFetchFilterOptions?: (filterId: string) => Promise<string[]>;
|
|
20
|
+
}
|
|
21
|
+
export declare class DashboardRenderer {
|
|
22
|
+
private root;
|
|
23
|
+
private opts;
|
|
24
|
+
private renderData;
|
|
25
|
+
private activePageId;
|
|
26
|
+
private activeTabId;
|
|
27
|
+
private activeFilters;
|
|
28
|
+
private chartRenderers;
|
|
29
|
+
private filterRenderer;
|
|
30
|
+
private tableRenderer;
|
|
31
|
+
private cardRenderer;
|
|
32
|
+
private isLoadingTab;
|
|
33
|
+
constructor(root: HTMLElement, opts: DashboardRenderOptions);
|
|
34
|
+
render(data: RenderResponse): void;
|
|
35
|
+
update(data: RenderResponse): void;
|
|
36
|
+
goToPage(pageId: string): void;
|
|
37
|
+
goToTab(pageId: string, tabId: string): void;
|
|
38
|
+
destroy(): void;
|
|
39
|
+
exportPDF(): void;
|
|
40
|
+
exportCSV(): void;
|
|
41
|
+
updateFilterValues(values: Record<string, any>): void;
|
|
42
|
+
private buildShell;
|
|
43
|
+
private buildExportToolbar;
|
|
44
|
+
private renderNavigation;
|
|
45
|
+
private renderPageNav;
|
|
46
|
+
private renderTabNav;
|
|
47
|
+
private buildTabButtons;
|
|
48
|
+
/** Optimistically highlight new tab + show spinner, then fire callback */
|
|
49
|
+
private triggerTabSwitch;
|
|
50
|
+
private syncNavHighlight;
|
|
51
|
+
private renderFilterBar;
|
|
52
|
+
private updateFilterBar;
|
|
53
|
+
/**
|
|
54
|
+
* For every dropdown / multi-select filter whose options array is empty,
|
|
55
|
+
* call onFetchFilterOptions(filterId) and populate the select element.
|
|
56
|
+
* Mirrors: GET /dashboard-builder/{dashboardId}/filters/{filterId}/options
|
|
57
|
+
*/
|
|
58
|
+
private fetchFilterOptions;
|
|
59
|
+
private renderGrid;
|
|
60
|
+
private renderComponent;
|
|
61
|
+
private showTabSpinner;
|
|
62
|
+
private hideTabSpinner;
|
|
63
|
+
private getTabsForPage;
|
|
64
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FilterDefinition } from '../types';
|
|
2
|
+
|
|
3
|
+
export declare class FilterRenderer {
|
|
4
|
+
private container;
|
|
5
|
+
private onFilterChange;
|
|
6
|
+
private currentValues;
|
|
7
|
+
constructor(container: HTMLElement, onFilterChange: (filterId: string, value: any) => void);
|
|
8
|
+
render(filters: FilterDefinition[], initialValues?: Record<string, any>): void;
|
|
9
|
+
/**
|
|
10
|
+
* Populate a dropdown / multi-select with options fetched from the API.
|
|
11
|
+
* Called asynchronously after the filter bar is rendered.
|
|
12
|
+
*/
|
|
13
|
+
updateOptions(filterId: string, options: string[]): void;
|
|
14
|
+
/** Update the stored values without re-rendering (for programmatic setFilter) */
|
|
15
|
+
updateValues(values: Record<string, any>): void;
|
|
16
|
+
private renderFilter;
|
|
17
|
+
private attachListeners;
|
|
18
|
+
private escAttr;
|
|
19
|
+
private escText;
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RenderResponse } from '../types';
|
|
2
|
+
|
|
3
|
+
export declare class ReportRenderer {
|
|
4
|
+
private root;
|
|
5
|
+
private theme;
|
|
6
|
+
private chartRenderer;
|
|
7
|
+
private tableRenderer;
|
|
8
|
+
private cardRenderer;
|
|
9
|
+
constructor(root: HTMLElement, theme: 'light' | 'dark');
|
|
10
|
+
render(data: RenderResponse, onReady?: () => void): void;
|
|
11
|
+
update(data: RenderResponse): void;
|
|
12
|
+
destroy(): void;
|
|
13
|
+
private renderComponent;
|
|
14
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
export interface SDKConfig {
|
|
2
|
+
apiKey: string;
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
}
|
|
5
|
+
export type EmbedLevel = 'report' | 'tab' | 'page' | 'dashboard';
|
|
6
|
+
export interface EmbedDashboardOptions {
|
|
7
|
+
dashboardId: string;
|
|
8
|
+
container: string | HTMLElement;
|
|
9
|
+
/** Controls what navigation is visible and what gets lazy-loaded */
|
|
10
|
+
embedLevel?: EmbedLevel;
|
|
11
|
+
userId?: string;
|
|
12
|
+
tenantId?: string;
|
|
13
|
+
theme?: 'light' | 'dark';
|
|
14
|
+
filters?: Record<string, any>;
|
|
15
|
+
/** Initial page to show — required for embedLevel 'tab' and 'page' */
|
|
16
|
+
pageId?: string;
|
|
17
|
+
/** Initial tab to show — required for embedLevel 'tab' */
|
|
18
|
+
tabId?: string;
|
|
19
|
+
hideFilters?: boolean;
|
|
20
|
+
hideExport?: boolean;
|
|
21
|
+
height?: string;
|
|
22
|
+
onReady?: () => void;
|
|
23
|
+
onFilterChange?: (filters: Record<string, any>) => void;
|
|
24
|
+
onTabSwitch?: (pageId: string, tabId: string) => void;
|
|
25
|
+
onPageSwitch?: (pageId: string) => void;
|
|
26
|
+
onError?: (error: string) => void;
|
|
27
|
+
}
|
|
28
|
+
export interface EmbedReportOptions {
|
|
29
|
+
dashboardId: string;
|
|
30
|
+
componentId: string;
|
|
31
|
+
container: string | HTMLElement;
|
|
32
|
+
userId?: string;
|
|
33
|
+
tenantId?: string;
|
|
34
|
+
theme?: 'light' | 'dark';
|
|
35
|
+
filters?: Record<string, any>;
|
|
36
|
+
height?: string;
|
|
37
|
+
onReady?: () => void;
|
|
38
|
+
onError?: (error: string) => void;
|
|
39
|
+
}
|
|
40
|
+
export interface EmbedInstance {
|
|
41
|
+
setFilter(field: string, value: any): void;
|
|
42
|
+
setFilters(filters: Record<string, any>): void;
|
|
43
|
+
goToPage(pageId: string): void;
|
|
44
|
+
goToTab(pageId: string, tabId: string): void;
|
|
45
|
+
refresh(): void;
|
|
46
|
+
exportPDF(): void;
|
|
47
|
+
destroy(): void;
|
|
48
|
+
}
|
|
49
|
+
export type ComponentType = 'bar' | 'line' | 'pie' | 'donut' | 'area' | 'table' | 'number-card' | 'filter' | 'text';
|
|
50
|
+
export interface ComponentPosition {
|
|
51
|
+
x: number;
|
|
52
|
+
y: number;
|
|
53
|
+
w: number;
|
|
54
|
+
h: number;
|
|
55
|
+
}
|
|
56
|
+
export interface ComponentConfig {
|
|
57
|
+
id: string;
|
|
58
|
+
type: ComponentType;
|
|
59
|
+
title: string;
|
|
60
|
+
position: ComponentPosition;
|
|
61
|
+
tabId: string;
|
|
62
|
+
pageId: string;
|
|
63
|
+
properties?: {
|
|
64
|
+
xAxis?: string;
|
|
65
|
+
yAxis?: string | string[];
|
|
66
|
+
selectedYAxisColumn?: any;
|
|
67
|
+
columns?: string[];
|
|
68
|
+
metric?: string;
|
|
69
|
+
aggregation?: string;
|
|
70
|
+
prefix?: string;
|
|
71
|
+
suffix?: string;
|
|
72
|
+
currencySymbol?: string;
|
|
73
|
+
backgroundColor?: string;
|
|
74
|
+
textColor?: string;
|
|
75
|
+
colors?: Record<string, string>;
|
|
76
|
+
showLegend?: boolean;
|
|
77
|
+
xAxisLabel?: string;
|
|
78
|
+
yAxisLabel?: string;
|
|
79
|
+
content?: string;
|
|
80
|
+
style?: Record<string, any>;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export interface PageTab {
|
|
84
|
+
id: string;
|
|
85
|
+
title: string;
|
|
86
|
+
tabOrder?: number;
|
|
87
|
+
isDefault?: boolean;
|
|
88
|
+
}
|
|
89
|
+
export interface DashboardPage {
|
|
90
|
+
pageId: string;
|
|
91
|
+
title: string;
|
|
92
|
+
backgroundColor?: string;
|
|
93
|
+
tabs: PageTab[];
|
|
94
|
+
}
|
|
95
|
+
export interface FilterDefinition {
|
|
96
|
+
filterId: string;
|
|
97
|
+
label: string;
|
|
98
|
+
type: 'dropdown' | 'multi-select' | 'date-range' | 'text-input' | 'number-input';
|
|
99
|
+
options?: string[];
|
|
100
|
+
defaultValue?: any;
|
|
101
|
+
targetComponents: string[];
|
|
102
|
+
filterOperator?: string;
|
|
103
|
+
applyToField?: string;
|
|
104
|
+
}
|
|
105
|
+
export interface RenderResponse {
|
|
106
|
+
embedType: 'dashboard' | 'report';
|
|
107
|
+
embedLevel: EmbedLevel;
|
|
108
|
+
dashboard: {
|
|
109
|
+
name: string;
|
|
110
|
+
theme: 'light' | 'dark';
|
|
111
|
+
/** ALL pages + tabs metadata — always returned for building navigation */
|
|
112
|
+
pages: DashboardPage[];
|
|
113
|
+
};
|
|
114
|
+
/** Currently active page ID */
|
|
115
|
+
activePage: string;
|
|
116
|
+
/** Currently active tab ID */
|
|
117
|
+
activeTab: string;
|
|
118
|
+
/** ONLY components belonging to the active page + tab */
|
|
119
|
+
components: ComponentConfig[];
|
|
120
|
+
/** Pre-executed SQL results — only for active tab's components */
|
|
121
|
+
data: Record<string, Record<string, any>[]>;
|
|
122
|
+
filters: FilterDefinition[];
|
|
123
|
+
}
|
|
124
|
+
export interface EmbedTokenResponse {
|
|
125
|
+
token: string;
|
|
126
|
+
expiresAt: string;
|
|
127
|
+
}
|
|
128
|
+
export interface ApiKey {
|
|
129
|
+
keyId: string;
|
|
130
|
+
name: string;
|
|
131
|
+
apiKey: string;
|
|
132
|
+
allowedOrigins: string[];
|
|
133
|
+
createdAt: string;
|
|
134
|
+
lastUsed?: string;
|
|
135
|
+
}
|
|
136
|
+
export interface CreateApiKeyPayload {
|
|
137
|
+
name: string;
|
|
138
|
+
allowedOrigins: string[];
|
|
139
|
+
tenantId?: string;
|
|
140
|
+
}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("vue"),u=require("../DeepspotSDK-g7o9tAip.cjs"),y=d.defineComponent({name:"DeepspotDashboard",props:{apiKey:{type:String,required:!0},baseUrl:{type:String,required:!0},dashboardId:{type:String,required:!0},userId:{type:String,default:void 0},tenantId:{type:String,default:void 0},embedLevel:{type:String,default:"dashboard"},theme:{type:String,default:"light"},height:{type:String,default:"600px"},pageId:{type:String,default:void 0},tabId:{type:String,default:void 0},hideFilters:{type:Boolean,default:!1},hideExport:{type:Boolean,default:!1},filters:{type:Object,default:()=>({})}},emits:["ready","filter-change","tab-switch","error"],setup(e,{emit:r}){const i=d.ref();let t;async function o(){var l;if(i.value){t==null||t.destroy(),t=void 0;try{t=await new u.DeepspotSDK({apiKey:e.apiKey,baseUrl:e.baseUrl}).embedDashboard({dashboardId:e.dashboardId,container:i.value,userId:e.userId,tenantId:e.tenantId,embedLevel:e.embedLevel,theme:e.theme,height:e.height,pageId:e.pageId,tabId:e.tabId,hideFilters:e.hideFilters,hideExport:e.hideExport,filters:e.filters,onReady:()=>r("ready"),onFilterChange:n=>r("filter-change",n),onTabSwitch:(n,h)=>r("tab-switch",n,h),onError:n=>r("error",n)})}catch(a){r("error",(l=a==null?void 0:a.message)!=null?l:String(a))}}}return d.onMounted(()=>{o()}),d.onUnmounted(()=>{t==null||t.destroy()}),d.watch(()=>[e.dashboardId,e.userId,e.tenantId,e.apiKey,e.baseUrl,e.embedLevel,e.theme,e.height,e.pageId,e.tabId,e.hideFilters,e.hideExport],()=>{o()}),()=>d.h("div",{ref:i,style:{display:"block"}})}}),g=d.defineComponent({name:"DeepspotReport",props:{apiKey:{type:String,required:!0},baseUrl:{type:String,required:!0},dashboardId:{type:String,required:!0},componentId:{type:String,required:!0},userId:{type:String,default:void 0},tenantId:{type:String,default:void 0},theme:{type:String,default:"light"},height:{type:String,default:"400px"},filters:{type:Object,default:()=>({})}},emits:["ready","error"],setup(e,{emit:r}){const i=d.ref();let t;async function o(){var l;if(i.value){t==null||t.destroy(),t=void 0;try{t=await new u.DeepspotSDK({apiKey:e.apiKey,baseUrl:e.baseUrl}).embedReport({dashboardId:e.dashboardId,componentId:e.componentId,container:i.value,userId:e.userId,tenantId:e.tenantId,theme:e.theme,height:e.height,filters:e.filters,onReady:()=>r("ready"),onError:n=>r("error",n)})}catch(a){r("error",(l=a==null?void 0:a.message)!=null?l:String(a))}}}return d.onMounted(()=>{o()}),d.onUnmounted(()=>{t==null||t.destroy()}),d.watch(()=>[e.dashboardId,e.componentId,e.userId,e.apiKey,e.baseUrl,e.theme,e.height],()=>{o()}),()=>d.h("div",{ref:i,style:{display:"block"}})}});exports.DeepspotDashboard=y;exports.DeepspotReport=g;
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
export declare const DeepspotDashboard: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
2
|
+
apiKey: {
|
|
3
|
+
type: StringConstructor;
|
|
4
|
+
required: true;
|
|
5
|
+
};
|
|
6
|
+
baseUrl: {
|
|
7
|
+
type: StringConstructor;
|
|
8
|
+
required: true;
|
|
9
|
+
};
|
|
10
|
+
dashboardId: {
|
|
11
|
+
type: StringConstructor;
|
|
12
|
+
required: true;
|
|
13
|
+
};
|
|
14
|
+
userId: {
|
|
15
|
+
type: StringConstructor;
|
|
16
|
+
default: undefined;
|
|
17
|
+
};
|
|
18
|
+
tenantId: {
|
|
19
|
+
type: StringConstructor;
|
|
20
|
+
default: undefined;
|
|
21
|
+
};
|
|
22
|
+
embedLevel: {
|
|
23
|
+
type: StringConstructor;
|
|
24
|
+
default: string;
|
|
25
|
+
};
|
|
26
|
+
theme: {
|
|
27
|
+
type: StringConstructor;
|
|
28
|
+
default: string;
|
|
29
|
+
};
|
|
30
|
+
height: {
|
|
31
|
+
type: StringConstructor;
|
|
32
|
+
default: string;
|
|
33
|
+
};
|
|
34
|
+
pageId: {
|
|
35
|
+
type: StringConstructor;
|
|
36
|
+
default: undefined;
|
|
37
|
+
};
|
|
38
|
+
tabId: {
|
|
39
|
+
type: StringConstructor;
|
|
40
|
+
default: undefined;
|
|
41
|
+
};
|
|
42
|
+
hideFilters: {
|
|
43
|
+
type: BooleanConstructor;
|
|
44
|
+
default: boolean;
|
|
45
|
+
};
|
|
46
|
+
hideExport: {
|
|
47
|
+
type: BooleanConstructor;
|
|
48
|
+
default: boolean;
|
|
49
|
+
};
|
|
50
|
+
filters: {
|
|
51
|
+
type: ObjectConstructor;
|
|
52
|
+
default: () => {};
|
|
53
|
+
};
|
|
54
|
+
}>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
55
|
+
[key: string]: any;
|
|
56
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("error" | "ready" | "filter-change" | "tab-switch")[], "error" | "ready" | "filter-change" | "tab-switch", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
57
|
+
apiKey: {
|
|
58
|
+
type: StringConstructor;
|
|
59
|
+
required: true;
|
|
60
|
+
};
|
|
61
|
+
baseUrl: {
|
|
62
|
+
type: StringConstructor;
|
|
63
|
+
required: true;
|
|
64
|
+
};
|
|
65
|
+
dashboardId: {
|
|
66
|
+
type: StringConstructor;
|
|
67
|
+
required: true;
|
|
68
|
+
};
|
|
69
|
+
userId: {
|
|
70
|
+
type: StringConstructor;
|
|
71
|
+
default: undefined;
|
|
72
|
+
};
|
|
73
|
+
tenantId: {
|
|
74
|
+
type: StringConstructor;
|
|
75
|
+
default: undefined;
|
|
76
|
+
};
|
|
77
|
+
embedLevel: {
|
|
78
|
+
type: StringConstructor;
|
|
79
|
+
default: string;
|
|
80
|
+
};
|
|
81
|
+
theme: {
|
|
82
|
+
type: StringConstructor;
|
|
83
|
+
default: string;
|
|
84
|
+
};
|
|
85
|
+
height: {
|
|
86
|
+
type: StringConstructor;
|
|
87
|
+
default: string;
|
|
88
|
+
};
|
|
89
|
+
pageId: {
|
|
90
|
+
type: StringConstructor;
|
|
91
|
+
default: undefined;
|
|
92
|
+
};
|
|
93
|
+
tabId: {
|
|
94
|
+
type: StringConstructor;
|
|
95
|
+
default: undefined;
|
|
96
|
+
};
|
|
97
|
+
hideFilters: {
|
|
98
|
+
type: BooleanConstructor;
|
|
99
|
+
default: boolean;
|
|
100
|
+
};
|
|
101
|
+
hideExport: {
|
|
102
|
+
type: BooleanConstructor;
|
|
103
|
+
default: boolean;
|
|
104
|
+
};
|
|
105
|
+
filters: {
|
|
106
|
+
type: ObjectConstructor;
|
|
107
|
+
default: () => {};
|
|
108
|
+
};
|
|
109
|
+
}>> & Readonly<{
|
|
110
|
+
onReady?: ((...args: any[]) => any) | undefined;
|
|
111
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
112
|
+
"onFilter-change"?: ((...args: any[]) => any) | undefined;
|
|
113
|
+
"onTab-switch"?: ((...args: any[]) => any) | undefined;
|
|
114
|
+
}>, {
|
|
115
|
+
embedLevel: string;
|
|
116
|
+
pageId: string;
|
|
117
|
+
tabId: string;
|
|
118
|
+
theme: string;
|
|
119
|
+
height: string;
|
|
120
|
+
userId: string;
|
|
121
|
+
tenantId: string;
|
|
122
|
+
filters: Record<string, any>;
|
|
123
|
+
hideFilters: boolean;
|
|
124
|
+
hideExport: boolean;
|
|
125
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
126
|
+
export declare const DeepspotReport: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
127
|
+
apiKey: {
|
|
128
|
+
type: StringConstructor;
|
|
129
|
+
required: true;
|
|
130
|
+
};
|
|
131
|
+
baseUrl: {
|
|
132
|
+
type: StringConstructor;
|
|
133
|
+
required: true;
|
|
134
|
+
};
|
|
135
|
+
dashboardId: {
|
|
136
|
+
type: StringConstructor;
|
|
137
|
+
required: true;
|
|
138
|
+
};
|
|
139
|
+
componentId: {
|
|
140
|
+
type: StringConstructor;
|
|
141
|
+
required: true;
|
|
142
|
+
};
|
|
143
|
+
userId: {
|
|
144
|
+
type: StringConstructor;
|
|
145
|
+
default: undefined;
|
|
146
|
+
};
|
|
147
|
+
tenantId: {
|
|
148
|
+
type: StringConstructor;
|
|
149
|
+
default: undefined;
|
|
150
|
+
};
|
|
151
|
+
theme: {
|
|
152
|
+
type: StringConstructor;
|
|
153
|
+
default: string;
|
|
154
|
+
};
|
|
155
|
+
height: {
|
|
156
|
+
type: StringConstructor;
|
|
157
|
+
default: string;
|
|
158
|
+
};
|
|
159
|
+
filters: {
|
|
160
|
+
type: ObjectConstructor;
|
|
161
|
+
default: () => {};
|
|
162
|
+
};
|
|
163
|
+
}>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
164
|
+
[key: string]: any;
|
|
165
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("error" | "ready")[], "error" | "ready", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
166
|
+
apiKey: {
|
|
167
|
+
type: StringConstructor;
|
|
168
|
+
required: true;
|
|
169
|
+
};
|
|
170
|
+
baseUrl: {
|
|
171
|
+
type: StringConstructor;
|
|
172
|
+
required: true;
|
|
173
|
+
};
|
|
174
|
+
dashboardId: {
|
|
175
|
+
type: StringConstructor;
|
|
176
|
+
required: true;
|
|
177
|
+
};
|
|
178
|
+
componentId: {
|
|
179
|
+
type: StringConstructor;
|
|
180
|
+
required: true;
|
|
181
|
+
};
|
|
182
|
+
userId: {
|
|
183
|
+
type: StringConstructor;
|
|
184
|
+
default: undefined;
|
|
185
|
+
};
|
|
186
|
+
tenantId: {
|
|
187
|
+
type: StringConstructor;
|
|
188
|
+
default: undefined;
|
|
189
|
+
};
|
|
190
|
+
theme: {
|
|
191
|
+
type: StringConstructor;
|
|
192
|
+
default: string;
|
|
193
|
+
};
|
|
194
|
+
height: {
|
|
195
|
+
type: StringConstructor;
|
|
196
|
+
default: string;
|
|
197
|
+
};
|
|
198
|
+
filters: {
|
|
199
|
+
type: ObjectConstructor;
|
|
200
|
+
default: () => {};
|
|
201
|
+
};
|
|
202
|
+
}>> & Readonly<{
|
|
203
|
+
onReady?: ((...args: any[]) => any) | undefined;
|
|
204
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
205
|
+
}>, {
|
|
206
|
+
theme: string;
|
|
207
|
+
height: string;
|
|
208
|
+
userId: string;
|
|
209
|
+
tenantId: string;
|
|
210
|
+
filters: Record<string, any>;
|
|
211
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
212
|
+
export type { EmbedInstance, EmbedLevel } from '../types';
|