@luzmo/embed 5.0.5 → 5.0.7
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/CHANGELOG.md +48 -0
- package/MIGRATIONS.md +1 -0
- package/README.md +27 -2
- package/index.cjs +2218 -0
- package/index.js +1391 -918
- package/lib/dashboard-component/dashboard-component.d.ts +4 -2
- package/luzmo-embed.min.js +159 -1598
- package/package.json +4 -3
- package/src/index.d.ts +1 -0
- package/src/lib/dashboard-component/dashboard-component.d.ts +91 -0
- package/src/lib/dashboard-component/dashboard-styles.d.ts +1 -0
- package/src/lib/helper/event-bus-handler.d.ts +1 -0
- package/src/lib/luzmo-service.d.ts +6 -0
- package/index.mjs +0 -1716
- package/index.umd.js +0 -1734
package/index.cjs
ADDED
|
@@ -0,0 +1,2218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
20
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
21
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
22
|
+
if (decorator = decorators[i])
|
|
23
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
24
|
+
if (kind && result)
|
|
25
|
+
__defProp(target, key, result);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// libs/embed-libs/embed/src/index.ts
|
|
30
|
+
var src_exports2 = {};
|
|
31
|
+
__export(src_exports2, {
|
|
32
|
+
LuzmoDashboard: () => LuzmoDashboard
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(src_exports2);
|
|
35
|
+
|
|
36
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/error.ts
|
|
37
|
+
var _handleError = (errorMessage, parameters) => {
|
|
38
|
+
let message = "The dashboard component encountered an error";
|
|
39
|
+
if (typeof parameters?.dashboardId === "string") {
|
|
40
|
+
message += ` for dashboard with id ${parameters.dashboardId}`;
|
|
41
|
+
}
|
|
42
|
+
if (typeof parameters?.dashboardSlug === "string") {
|
|
43
|
+
message += ` for dashboard with slug ${parameters.dashboardSlug}`;
|
|
44
|
+
}
|
|
45
|
+
if (typeof parameters?.container === "string") {
|
|
46
|
+
message += ` in container ${parameters.container}`;
|
|
47
|
+
}
|
|
48
|
+
if (errorMessage) {
|
|
49
|
+
message += `:
|
|
50
|
+
${errorMessage}`;
|
|
51
|
+
console.error(message);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/browser-check.ts
|
|
56
|
+
var _browserCheck = (dashboardComponent) => {
|
|
57
|
+
let hasError = false;
|
|
58
|
+
let errorMessage = "";
|
|
59
|
+
const document_ = document.body || document.documentElement;
|
|
60
|
+
const style = document_.style;
|
|
61
|
+
const browserCheck = {
|
|
62
|
+
svg: !!("createElementNS" in document && document.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGRect),
|
|
63
|
+
flexbox: style.webkitFlexWrap === "" || style.flexWrap === "",
|
|
64
|
+
postMessage: !!window.postMessage
|
|
65
|
+
};
|
|
66
|
+
const browserCheckKeys = ["svg", "flexbox", "postMessage"];
|
|
67
|
+
for (const key of browserCheckKeys) {
|
|
68
|
+
if (!browserCheck[key]) {
|
|
69
|
+
hasError = true;
|
|
70
|
+
dashboardComponent.browserNotSupported = dashboardComponent.browserNotSupported || [];
|
|
71
|
+
dashboardComponent.browserNotSupported.push(key);
|
|
72
|
+
errorMessage += `Your browser does not support: ${key}
|
|
73
|
+
`;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const ua = window.navigator.userAgent;
|
|
77
|
+
const msie = ua.includes("MSIE");
|
|
78
|
+
const trident = ua.includes("Trident/");
|
|
79
|
+
if (msie || trident) {
|
|
80
|
+
hasError = true;
|
|
81
|
+
errorMessage = "IE is not supported.";
|
|
82
|
+
}
|
|
83
|
+
if (hasError) {
|
|
84
|
+
_handleError(errorMessage);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/default-parameters.ts
|
|
89
|
+
var DEFAULT_PARAMETERS = {
|
|
90
|
+
appServer: "https://app.luzmo.com/",
|
|
91
|
+
apiHost: "https://api.luzmo.com/",
|
|
92
|
+
dashboardId: null,
|
|
93
|
+
dashboardSlug: null,
|
|
94
|
+
container: null,
|
|
95
|
+
key: null,
|
|
96
|
+
token: null,
|
|
97
|
+
language: "auto",
|
|
98
|
+
qeVersion: null,
|
|
99
|
+
editMode: null,
|
|
100
|
+
screenMode: null,
|
|
101
|
+
switchScreenModeOnResize: true,
|
|
102
|
+
itemId: null,
|
|
103
|
+
mainColor: "",
|
|
104
|
+
accentColor: "",
|
|
105
|
+
itemDimensions: {
|
|
106
|
+
width: "auto",
|
|
107
|
+
height: "auto"
|
|
108
|
+
},
|
|
109
|
+
loaderBackground: "#f9f9f9",
|
|
110
|
+
loaderFontColor: "#5a5a5a",
|
|
111
|
+
loaderSpinnerColor: "rgba(255, 165, 0, 0.7)",
|
|
112
|
+
loaderSpinnerBackground: "rgba(169, 169, 169, 0.14)",
|
|
113
|
+
timezoneId: null,
|
|
114
|
+
contextId: null
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/extents.ts
|
|
118
|
+
var EXTENTS = [
|
|
119
|
+
{ mode: "mobile", width: [150, 767] },
|
|
120
|
+
{ mode: "tablet", width: [768, 1199] },
|
|
121
|
+
{ mode: "desktop", width: [1200, 1599] },
|
|
122
|
+
{ mode: "largeScreen", width: [1600, 9999] },
|
|
123
|
+
{ mode: "fixed", width: [] }
|
|
124
|
+
];
|
|
125
|
+
|
|
126
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/translations.ts
|
|
127
|
+
var TRANSLATIONS = {
|
|
128
|
+
initializing: { en: "Initializing...", nl: "Laden...", fr: "Chargement..." },
|
|
129
|
+
errorDashboard: {
|
|
130
|
+
en: "Oops, we could not load this dashboard!",
|
|
131
|
+
nl: "Oeps, we konden het dashboard niet laden.",
|
|
132
|
+
fr: "Le chargement a echou\xE9."
|
|
133
|
+
},
|
|
134
|
+
errorItem: {
|
|
135
|
+
en: "Oops, we could not load this item!",
|
|
136
|
+
nl: "Oeps, we konden de grafiek niet laden.",
|
|
137
|
+
fr: "Le chargement a echou\xE9."
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
var translations_default = TRANSLATIONS;
|
|
141
|
+
|
|
142
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/utils.ts
|
|
143
|
+
var addTrailingSlash = (serverUrl) => {
|
|
144
|
+
if (!serverUrl) {
|
|
145
|
+
return "";
|
|
146
|
+
}
|
|
147
|
+
return serverUrl.endsWith("/") ? serverUrl : `${serverUrl}/`;
|
|
148
|
+
};
|
|
149
|
+
var removeTrailingSlash = (serverUrl) => {
|
|
150
|
+
if (!serverUrl) {
|
|
151
|
+
return "";
|
|
152
|
+
}
|
|
153
|
+
return serverUrl.endsWith("/") ? serverUrl.slice(0, -1) : serverUrl;
|
|
154
|
+
};
|
|
155
|
+
var formatDashboardList = (dashboards, integrationId, user, dashboardComponent) => {
|
|
156
|
+
const combineRights = (securable, user2) => {
|
|
157
|
+
const matchingUser = securable.users.find((u) => u.id === user2.id);
|
|
158
|
+
const securableAccessRights = matchingUser && matchingUser.userAccessRight ? {
|
|
159
|
+
flagRead: matchingUser.userAccessRight.flagRead,
|
|
160
|
+
flagUse: matchingUser.userAccessRight.flagUse,
|
|
161
|
+
flagModify: matchingUser.userAccessRight.flagModify,
|
|
162
|
+
flagOwn: matchingUser.userAccessRight.flagOwn
|
|
163
|
+
} : {
|
|
164
|
+
flagRead: false,
|
|
165
|
+
flagUse: false,
|
|
166
|
+
flagModify: false,
|
|
167
|
+
flagOwn: false
|
|
168
|
+
};
|
|
169
|
+
const groups = securable.groups.filter(
|
|
170
|
+
(group) => user2.userGroups.includes(group.id) || group.public === true
|
|
171
|
+
);
|
|
172
|
+
const groupsAccess = groups.map((group) => {
|
|
173
|
+
if (group.groupAccessRight) {
|
|
174
|
+
return group.groupAccessRight;
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
for (const groupAccess of groupsAccess) {
|
|
178
|
+
if (!securableAccessRights.flagRead && groupAccess.flagRead) {
|
|
179
|
+
securableAccessRights.flagRead = groupAccess.flagRead;
|
|
180
|
+
}
|
|
181
|
+
if (!securableAccessRights.flagUse && groupAccess.flagUse) {
|
|
182
|
+
securableAccessRights.flagUse = groupAccess.flagUse;
|
|
183
|
+
}
|
|
184
|
+
if (!securableAccessRights.flagModify && groupAccess.flagModify) {
|
|
185
|
+
securableAccessRights.flagModify = groupAccess.flagModify;
|
|
186
|
+
}
|
|
187
|
+
if (!securableAccessRights.flagOwn && groupAccess.flagOwn) {
|
|
188
|
+
securableAccessRights.flagOwn = groupAccess.flagOwn;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
const integrationsAccess = securable.integrations?.length > 0 ? securable.integrations.map((integration) => {
|
|
192
|
+
if (integration.integrationAccessRight) {
|
|
193
|
+
return integration.integrationAccessRight;
|
|
194
|
+
}
|
|
195
|
+
}) : [];
|
|
196
|
+
for (const integrationAccess of integrationsAccess) {
|
|
197
|
+
if (!securableAccessRights.flagRead && integrationAccess.flagRead) {
|
|
198
|
+
securableAccessRights.flagRead = integrationAccess.flagRead;
|
|
199
|
+
}
|
|
200
|
+
if (!securableAccessRights.flagUse && integrationAccess.flagUse) {
|
|
201
|
+
securableAccessRights.flagUse = integrationAccess.flagUse;
|
|
202
|
+
}
|
|
203
|
+
if (!securableAccessRights.flagModify && integrationAccess.flagModify) {
|
|
204
|
+
securableAccessRights.flagModify = integrationAccess.flagModify;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return securableAccessRights;
|
|
208
|
+
};
|
|
209
|
+
const localize = (item, locale) => {
|
|
210
|
+
if (item === null || item === void 0) {
|
|
211
|
+
return "";
|
|
212
|
+
}
|
|
213
|
+
if (typeof item !== "object" || Object.keys(item).length === 0) {
|
|
214
|
+
if (typeof item === "object" && Object.keys(item).length === 0) {
|
|
215
|
+
return "";
|
|
216
|
+
}
|
|
217
|
+
return item;
|
|
218
|
+
}
|
|
219
|
+
let localizedItem;
|
|
220
|
+
localizedItem = locale && item[locale] ? item[locale] : item[Object.keys(item)[0]];
|
|
221
|
+
if (localizedItem === void 0 || localizedItem === null) {
|
|
222
|
+
localizedItem = "";
|
|
223
|
+
}
|
|
224
|
+
return localizedItem;
|
|
225
|
+
};
|
|
226
|
+
const treatedDashboards = [];
|
|
227
|
+
for (const dashboard of dashboards) {
|
|
228
|
+
const treatedDashboard = {
|
|
229
|
+
accessibleBy: [],
|
|
230
|
+
accessRights: combineRights(dashboard, user),
|
|
231
|
+
id: dashboard.id,
|
|
232
|
+
modifiedAt: dashboard.modified_at,
|
|
233
|
+
name: localize(dashboard.name, dashboardComponent.language),
|
|
234
|
+
slug: null,
|
|
235
|
+
tags: dashboard.tags.map((t) => t.tag).sort((t1, t2) => t1.localeCompare(t2))
|
|
236
|
+
};
|
|
237
|
+
const currentIntegration = dashboard.integrations.find(
|
|
238
|
+
(i) => i.id === integrationId
|
|
239
|
+
);
|
|
240
|
+
if (currentIntegration?.integrationAccessRight?.slug) {
|
|
241
|
+
treatedDashboard.slug = currentIntegration.integrationAccessRight.slug;
|
|
242
|
+
}
|
|
243
|
+
const users = dashboard.users.map((u) => ({
|
|
244
|
+
model: "User",
|
|
245
|
+
id: u.id,
|
|
246
|
+
name: localize(u.name, user.locale_id)
|
|
247
|
+
}));
|
|
248
|
+
const groups = dashboard.groups.map((g) => ({
|
|
249
|
+
model: "Group",
|
|
250
|
+
id: g.id,
|
|
251
|
+
name: localize(g.name, user.locale_id) || {}
|
|
252
|
+
}));
|
|
253
|
+
const integrations = dashboard.integrations.map((i) => ({
|
|
254
|
+
model: "Integration",
|
|
255
|
+
id: i.id,
|
|
256
|
+
name: localize(i.name, user.locale_id) || {}
|
|
257
|
+
}));
|
|
258
|
+
treatedDashboard.accessibleBy = [...users, ...groups, ...integrations];
|
|
259
|
+
treatedDashboards.push(treatedDashboard);
|
|
260
|
+
}
|
|
261
|
+
return treatedDashboards;
|
|
262
|
+
};
|
|
263
|
+
var VERSION = "0.0.0-shared-luzmo";
|
|
264
|
+
var sanitizeUrl = (url) => {
|
|
265
|
+
const invalidPrototcolRegex = /^(%20|\s)*(javascript|data)/im;
|
|
266
|
+
const ctrlCharactersRegex = /[^\u0020-\u007E]/gim;
|
|
267
|
+
const urlSchemeRegex = /^([^:]+):/gm;
|
|
268
|
+
const relativeFirstCharacters = /* @__PURE__ */ new Set([".", "/"]);
|
|
269
|
+
const isRelativeUrlWithoutProtocol = (relativeUrl) => relativeFirstCharacters.has(relativeUrl[0]);
|
|
270
|
+
if (!url) {
|
|
271
|
+
return "about:blank";
|
|
272
|
+
}
|
|
273
|
+
const sanitizedUrl = url.replaceAll(ctrlCharactersRegex, "").trim();
|
|
274
|
+
if (isRelativeUrlWithoutProtocol(sanitizedUrl)) {
|
|
275
|
+
return sanitizedUrl;
|
|
276
|
+
}
|
|
277
|
+
const urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex);
|
|
278
|
+
if (!urlSchemeParseResults) {
|
|
279
|
+
return sanitizedUrl;
|
|
280
|
+
}
|
|
281
|
+
const urlScheme = urlSchemeParseResults[0];
|
|
282
|
+
if (invalidPrototcolRegex.test(urlScheme)) {
|
|
283
|
+
return "about:blank";
|
|
284
|
+
}
|
|
285
|
+
return sanitizedUrl;
|
|
286
|
+
};
|
|
287
|
+
var cloneDeep = (obj) => JSON.parse(JSON.stringify(obj));
|
|
288
|
+
var isObject = (o) => o && typeof o === "object";
|
|
289
|
+
var defaultsDeep = (target, defaults) => {
|
|
290
|
+
Object.entries(defaults).forEach(([k, v]) => {
|
|
291
|
+
if (k in target) {
|
|
292
|
+
if (target[k] === void 0) {
|
|
293
|
+
target[k] = v;
|
|
294
|
+
} else {
|
|
295
|
+
target[k] = isObject(v) ? defaultsDeep(
|
|
296
|
+
target[k],
|
|
297
|
+
v
|
|
298
|
+
) : target[k];
|
|
299
|
+
}
|
|
300
|
+
} else {
|
|
301
|
+
target[k] = v;
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
return target;
|
|
305
|
+
};
|
|
306
|
+
var uuidv4 = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g, function(c) {
|
|
307
|
+
const r = Math.random() * 16 | 0;
|
|
308
|
+
const v = c == "x" ? r : r & 3 | 8;
|
|
309
|
+
return v.toString(16);
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/iframe-url.ts
|
|
313
|
+
var createIframeUrl = (dashboardContent) => {
|
|
314
|
+
const searchString = [];
|
|
315
|
+
const {
|
|
316
|
+
appServer,
|
|
317
|
+
language,
|
|
318
|
+
qeVersion,
|
|
319
|
+
loaderBackground,
|
|
320
|
+
loaderSpinnerColor,
|
|
321
|
+
loaderSpinnerBackground,
|
|
322
|
+
loaderFontColor,
|
|
323
|
+
screenMode,
|
|
324
|
+
key,
|
|
325
|
+
token,
|
|
326
|
+
timezoneId,
|
|
327
|
+
itemEmbedding,
|
|
328
|
+
itemDimensions,
|
|
329
|
+
dashboardId,
|
|
330
|
+
dashboardSlug,
|
|
331
|
+
itemId,
|
|
332
|
+
mainColor,
|
|
333
|
+
accentColor,
|
|
334
|
+
editMode
|
|
335
|
+
} = dashboardContent.params;
|
|
336
|
+
if (language && language !== "auto") {
|
|
337
|
+
searchString.push("language=" + language);
|
|
338
|
+
}
|
|
339
|
+
if (qeVersion) {
|
|
340
|
+
searchString.push(`qe_version=${qeVersion}`);
|
|
341
|
+
}
|
|
342
|
+
if (loaderBackground) {
|
|
343
|
+
searchString.push(`ldrbg=${loaderBackground}`);
|
|
344
|
+
}
|
|
345
|
+
if (loaderFontColor) {
|
|
346
|
+
searchString.push(`ldrftclr=${loaderFontColor}`);
|
|
347
|
+
}
|
|
348
|
+
if (loaderSpinnerColor) {
|
|
349
|
+
searchString.push(`ldrspclr=${loaderSpinnerColor}`);
|
|
350
|
+
}
|
|
351
|
+
if (loaderSpinnerBackground) {
|
|
352
|
+
searchString.push(`ldrspbg=${loaderSpinnerBackground}`);
|
|
353
|
+
}
|
|
354
|
+
if (mainColor) {
|
|
355
|
+
searchString.push(`mainColor=${mainColor}`);
|
|
356
|
+
}
|
|
357
|
+
if (accentColor) {
|
|
358
|
+
searchString.push(`accentColor=${accentColor}`);
|
|
359
|
+
}
|
|
360
|
+
if (screenMode && screenMode !== "auto") {
|
|
361
|
+
searchString.push("screenMode=" + screenMode);
|
|
362
|
+
}
|
|
363
|
+
if (timezoneId) {
|
|
364
|
+
searchString.push("timezoneId=" + timezoneId);
|
|
365
|
+
}
|
|
366
|
+
if (itemEmbedding && itemDimensions && itemDimensions.width) {
|
|
367
|
+
searchString.push("width=" + itemDimensions.width);
|
|
368
|
+
}
|
|
369
|
+
if (itemEmbedding && itemDimensions && itemDimensions.height) {
|
|
370
|
+
searchString.push("height=" + itemDimensions.height);
|
|
371
|
+
}
|
|
372
|
+
if (editMode) {
|
|
373
|
+
searchString.push("editMode=" + editMode);
|
|
374
|
+
}
|
|
375
|
+
const keyTokenUrlAnchor = key && token ? "#" + key + ":" + token : "";
|
|
376
|
+
searchString.push("version=" + (dashboardContent.VERSION || VERSION));
|
|
377
|
+
const iframeUrl = itemEmbedding ? `${appServer}i/${dashboardId || dashboardSlug}/${itemId}?${encodeURIComponent(
|
|
378
|
+
searchString.join("&")
|
|
379
|
+
)}${keyTokenUrlAnchor}` : `${appServer}i/${dashboardId || dashboardSlug}?${encodeURIComponent(
|
|
380
|
+
searchString.join("&")
|
|
381
|
+
)}${keyTokenUrlAnchor}`;
|
|
382
|
+
return sanitizeUrl(iframeUrl);
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/get-loader.ts
|
|
386
|
+
var getLoader = (dashboardComponent) => {
|
|
387
|
+
let errorMsg;
|
|
388
|
+
if (dashboardComponent.params.error || dashboardComponent.browserNotSupported.length > 0) {
|
|
389
|
+
dashboardComponent.params.error = true;
|
|
390
|
+
if (dashboardComponent.browserNotSupported) {
|
|
391
|
+
errorMsg = "Browser is not supported.";
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
const loadingMsg = translations_default.initializing[dashboardComponent.params.language] || translations_default.initializing.en;
|
|
395
|
+
return dashboardComponent.browserNotSupported || dashboardComponent.params.error ? { loadingMsg, errorMsg } : { loadingMsg, errorMsg: "" };
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/promise-dispatch.ts
|
|
399
|
+
function resolvePromise(dashboardComponent, requestId, data) {
|
|
400
|
+
if (dashboardComponent.promises[requestId]) {
|
|
401
|
+
dashboardComponent.promises[requestId].resolve(data);
|
|
402
|
+
delete dashboardComponent.promises[requestId];
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
function rejectPromise(dashboardComponent, requestId, data) {
|
|
406
|
+
if (dashboardComponent.promises[requestId]) {
|
|
407
|
+
dashboardComponent.promises[requestId].reject(data);
|
|
408
|
+
delete dashboardComponent.promises[requestId];
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/styles.ts
|
|
413
|
+
function containerStyles(dashboardComponent) {
|
|
414
|
+
const styles = {};
|
|
415
|
+
if (dashboardComponent.params.loaderBackground && !dashboardComponent.iframeLoaded) {
|
|
416
|
+
styles.background = dashboardComponent.params.loaderBackground;
|
|
417
|
+
}
|
|
418
|
+
return styles;
|
|
419
|
+
}
|
|
420
|
+
function containerLoaderStyles(dashboardComponent) {
|
|
421
|
+
const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
422
|
+
const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
|
|
423
|
+
const display = dashboardComponent.iframeLoaded ? "none" : "";
|
|
424
|
+
return {
|
|
425
|
+
display,
|
|
426
|
+
height: `${chartHeightDefined ? height : dashboardComponent.minHeight}px`
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
function loaderStyles(dashboardComponent) {
|
|
430
|
+
const background = dashboardComponent.params.loaderBackground || DEFAULT_PARAMETERS.loaderBackground;
|
|
431
|
+
if (dashboardComponent.params.itemEmbedding) {
|
|
432
|
+
dashboardComponent.loaderSize = 24;
|
|
433
|
+
dashboardComponent.borderWidth = 4;
|
|
434
|
+
dashboardComponent.minHeight = 200;
|
|
435
|
+
const width = dashboardComponent.params.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
|
|
436
|
+
const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
437
|
+
const chartWidthDefined = width !== "auto";
|
|
438
|
+
const chartHeightDefined = height !== "auto";
|
|
439
|
+
return {
|
|
440
|
+
background,
|
|
441
|
+
width: chartWidthDefined ? `${width}px` : "100%",
|
|
442
|
+
height: `${chartHeightDefined ? height : "200"}px`,
|
|
443
|
+
"min-height": chartHeightDefined ? "" : "200px"
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
return {
|
|
447
|
+
background
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
function plStyles(dashboardComponent) {
|
|
451
|
+
const {
|
|
452
|
+
loaderSpinnerColor: defaultSpinnerColor,
|
|
453
|
+
loaderSpinnerBackground: defaultSpinnerBackground
|
|
454
|
+
} = DEFAULT_PARAMETERS;
|
|
455
|
+
const spinnerColorBorder = generateBorderStyle(
|
|
456
|
+
dashboardComponent.borderWidth,
|
|
457
|
+
dashboardComponent.params.loaderSpinnerColor || defaultSpinnerColor
|
|
458
|
+
);
|
|
459
|
+
const spinnerBackgroundBorder = generateBorderStyle(
|
|
460
|
+
dashboardComponent.borderWidth,
|
|
461
|
+
dashboardComponent.params.loaderSpinnerBackground || defaultSpinnerBackground
|
|
462
|
+
);
|
|
463
|
+
const size = `${dashboardComponent.loaderSize}px`;
|
|
464
|
+
return {
|
|
465
|
+
"border-top": spinnerColorBorder,
|
|
466
|
+
"border-right": spinnerColorBorder,
|
|
467
|
+
"border-bottom": spinnerBackgroundBorder,
|
|
468
|
+
"border-left": spinnerBackgroundBorder,
|
|
469
|
+
width: size,
|
|
470
|
+
height: size
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
function lcStyles(dashboardComponent) {
|
|
474
|
+
const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
475
|
+
const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
|
|
476
|
+
const getPaddingStr = (value) => `${(value - dashboardComponent.loaderSize - 32) / 2}px`;
|
|
477
|
+
const verticalPadding = dashboardComponent.params.itemId ? chartHeightDefined ? getPaddingStr(Number.parseInt(`${height}`, 10)) : getPaddingStr(dashboardComponent.minHeight) : "128px";
|
|
478
|
+
return {
|
|
479
|
+
padding: `${verticalPadding} 16px`
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
function calculateIframeStyles(dashboardComponent) {
|
|
483
|
+
const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
484
|
+
const width = dashboardComponent.params.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
|
|
485
|
+
if (dashboardComponent.params.itemEmbedding && height !== "auto") {
|
|
486
|
+
dashboardComponent.iframeHeight = `${height}px`;
|
|
487
|
+
} else if (dashboardComponent.params.itemEmbedding) {
|
|
488
|
+
dashboardComponent.iframeHeight = "200px";
|
|
489
|
+
} else if (["editFull", "editLimited"].includes(dashboardComponent.params.editMode)) {
|
|
490
|
+
dashboardComponent.iframeHeight = "100%";
|
|
491
|
+
} else {
|
|
492
|
+
dashboardComponent.iframeHeight = "400px";
|
|
493
|
+
}
|
|
494
|
+
dashboardComponent.iframeWidth = dashboardComponent.params.itemEmbedding && width !== "auto" ? `${width}px` : "100%";
|
|
495
|
+
const styles = {
|
|
496
|
+
height: dashboardComponent.iframeHeight,
|
|
497
|
+
width: dashboardComponent.iframeWidth
|
|
498
|
+
};
|
|
499
|
+
if (dashboardComponent.iframeLoaded) {
|
|
500
|
+
styles.opacity = 1;
|
|
501
|
+
} else if (dashboardComponent.error) {
|
|
502
|
+
styles.opacity = 1;
|
|
503
|
+
styles.width = "100%";
|
|
504
|
+
styles.height = "400px";
|
|
505
|
+
} else {
|
|
506
|
+
styles.opacity = 0;
|
|
507
|
+
}
|
|
508
|
+
return styles;
|
|
509
|
+
}
|
|
510
|
+
function generateBorderStyle(borderWidth, color) {
|
|
511
|
+
return `${borderWidth}px solid ${color}`;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/update-iframe-url.ts
|
|
515
|
+
var updateIframeUrl = (iframe, iframeUrl) => {
|
|
516
|
+
if (iframe?.contentWindow) {
|
|
517
|
+
iframe.contentWindow.location.replace(iframeUrl);
|
|
518
|
+
}
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
// libs/embed-libs/shared-embed/src/lib/methods/export-dashboard.ts
|
|
522
|
+
var exportDashboard = (dashboardComponent, iframe, format) => {
|
|
523
|
+
const requestId = uuidv4();
|
|
524
|
+
if (iframe?.contentWindow) {
|
|
525
|
+
iframe.contentWindow.postMessage(
|
|
526
|
+
{
|
|
527
|
+
action: "exportDashboard",
|
|
528
|
+
format: format || "png",
|
|
529
|
+
_version: dashboardComponent.VERSION,
|
|
530
|
+
requestId
|
|
531
|
+
},
|
|
532
|
+
"*"
|
|
533
|
+
);
|
|
534
|
+
return new Promise((resolve, reject) => {
|
|
535
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
536
|
+
setTimeout(() => {
|
|
537
|
+
if (dashboardComponent.promises[requestId]) {
|
|
538
|
+
const errorMessage = "exportDashboard request timed out.";
|
|
539
|
+
dashboardComponent.promises[requestId].reject(
|
|
540
|
+
new Error(errorMessage)
|
|
541
|
+
);
|
|
542
|
+
delete dashboardComponent.promises[requestId];
|
|
543
|
+
}
|
|
544
|
+
}, 12e5);
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
// libs/embed-libs/shared-embed/src/lib/methods/get-accessible-dashboards.ts
|
|
551
|
+
var getAccessibleDashboards = (dashboardComponent, iframe) => {
|
|
552
|
+
if ((dashboardComponent.dashboardId || dashboardComponent.dashboardSlug) && iframe?.contentWindow) {
|
|
553
|
+
const requestId = uuidv4();
|
|
554
|
+
iframe.contentWindow.postMessage(
|
|
555
|
+
{
|
|
556
|
+
action: "getAccessibleDashboards",
|
|
557
|
+
_version: dashboardComponent.VERSION,
|
|
558
|
+
requestId
|
|
559
|
+
},
|
|
560
|
+
"*"
|
|
561
|
+
);
|
|
562
|
+
return new Promise((resolve, reject) => {
|
|
563
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
564
|
+
setTimeout(() => {
|
|
565
|
+
if (dashboardComponent.promises[requestId]) {
|
|
566
|
+
const errorMessage = "getAccessibleDashboards request timed out.";
|
|
567
|
+
dashboardComponent.promises[requestId].reject(
|
|
568
|
+
new Error(errorMessage)
|
|
569
|
+
);
|
|
570
|
+
delete dashboardComponent.promises[requestId];
|
|
571
|
+
}
|
|
572
|
+
}, 2e3);
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
const fetchUser = new Promise((resolve, reject) => {
|
|
576
|
+
void (() => {
|
|
577
|
+
try {
|
|
578
|
+
const responsePromise = window.fetch(
|
|
579
|
+
`${String(dashboardComponent.params.apiHost)}0.1.0/authorization`,
|
|
580
|
+
{
|
|
581
|
+
method: "POST",
|
|
582
|
+
mode: "cors",
|
|
583
|
+
cache: "no-cache",
|
|
584
|
+
headers: { "Content-Type": "application/json" },
|
|
585
|
+
redirect: "follow",
|
|
586
|
+
body: JSON.stringify({
|
|
587
|
+
action: "get",
|
|
588
|
+
version: "0.1.0",
|
|
589
|
+
key: dashboardComponent.authKey,
|
|
590
|
+
token: dashboardComponent.authToken,
|
|
591
|
+
find: {
|
|
592
|
+
where: { id: dashboardComponent.authKey },
|
|
593
|
+
attributes: ["id", "integration_id"],
|
|
594
|
+
include: [
|
|
595
|
+
{
|
|
596
|
+
model: "User",
|
|
597
|
+
attributes: ["id", "name", "locale_id"],
|
|
598
|
+
include: [{ model: "Group" }]
|
|
599
|
+
}
|
|
600
|
+
]
|
|
601
|
+
}
|
|
602
|
+
})
|
|
603
|
+
}
|
|
604
|
+
);
|
|
605
|
+
responsePromise.then((response) => response.json()).then((data) => {
|
|
606
|
+
if (!data || !data.rows || data.rows.length === 0 || !data.rows[0].user || !data.rows[0].integration_id) {
|
|
607
|
+
reject();
|
|
608
|
+
} else {
|
|
609
|
+
data.rows[0].user.userGroups = data.rows[0].user.groups.map(
|
|
610
|
+
(group) => group.id
|
|
611
|
+
);
|
|
612
|
+
delete data.rows[0].user.groups;
|
|
613
|
+
resolve({
|
|
614
|
+
integrationId: data.rows[0].integration_id,
|
|
615
|
+
user: data.rows[0].user
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
});
|
|
619
|
+
} catch (error) {
|
|
620
|
+
reject(error);
|
|
621
|
+
}
|
|
622
|
+
})();
|
|
623
|
+
});
|
|
624
|
+
return new Promise((resolve, reject) => void (() => {
|
|
625
|
+
try {
|
|
626
|
+
fetchUser.then((authorizationData) => {
|
|
627
|
+
const responsePromise = window.fetch(
|
|
628
|
+
`${String(dashboardComponent.params.apiHost)}0.1.0/securable`,
|
|
629
|
+
{
|
|
630
|
+
method: "POST",
|
|
631
|
+
mode: "cors",
|
|
632
|
+
cache: "no-cache",
|
|
633
|
+
headers: { "Content-Type": "application/json" },
|
|
634
|
+
redirect: "follow",
|
|
635
|
+
body: JSON.stringify({
|
|
636
|
+
action: "get",
|
|
637
|
+
version: "0.1.0",
|
|
638
|
+
key: dashboardComponent.authKey,
|
|
639
|
+
token: dashboardComponent.authToken,
|
|
640
|
+
find: {
|
|
641
|
+
where: { type: "dashboard", is_variant: false },
|
|
642
|
+
attributes: ["id", "name", "modified_at"],
|
|
643
|
+
order: [["modified_at", "desc"]],
|
|
644
|
+
include: [
|
|
645
|
+
{ model: "Tag", attributes: ["tag"] },
|
|
646
|
+
{ model: "User", attributes: ["id", "name"] },
|
|
647
|
+
{
|
|
648
|
+
model: "Group",
|
|
649
|
+
attributes: ["id", "name", "public"]
|
|
650
|
+
},
|
|
651
|
+
{ model: "Integration", attributes: ["id", "name"] }
|
|
652
|
+
]
|
|
653
|
+
}
|
|
654
|
+
})
|
|
655
|
+
}
|
|
656
|
+
);
|
|
657
|
+
responsePromise.then((response) => response.json()).then((data) => {
|
|
658
|
+
const dashboardList = data.rows.length > 0 ? formatDashboardList(
|
|
659
|
+
data.rows,
|
|
660
|
+
authorizationData.integrationId,
|
|
661
|
+
authorizationData.user,
|
|
662
|
+
dashboardComponent
|
|
663
|
+
) : [];
|
|
664
|
+
resolve(dashboardList);
|
|
665
|
+
});
|
|
666
|
+
}).catch((error) => {
|
|
667
|
+
reject(error);
|
|
668
|
+
});
|
|
669
|
+
} catch (error) {
|
|
670
|
+
reject(error);
|
|
671
|
+
}
|
|
672
|
+
})());
|
|
673
|
+
};
|
|
674
|
+
|
|
675
|
+
// libs/embed-libs/shared-embed/src/lib/methods/get-data.ts
|
|
676
|
+
var getData = (dashboardComponent, iframe, itemId) => {
|
|
677
|
+
if (iframe?.contentWindow) {
|
|
678
|
+
const requestId = uuidv4();
|
|
679
|
+
iframe.contentWindow.postMessage(
|
|
680
|
+
{
|
|
681
|
+
action: "getData",
|
|
682
|
+
id: itemId,
|
|
683
|
+
_version: dashboardComponent.VERSION,
|
|
684
|
+
requestId
|
|
685
|
+
},
|
|
686
|
+
"*"
|
|
687
|
+
);
|
|
688
|
+
return new Promise((resolve, reject) => {
|
|
689
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
690
|
+
setTimeout(() => {
|
|
691
|
+
if (dashboardComponent.promises[requestId]) {
|
|
692
|
+
const errorMessage = "getData request timed out.";
|
|
693
|
+
dashboardComponent.promises[requestId].reject(
|
|
694
|
+
new Error(errorMessage)
|
|
695
|
+
);
|
|
696
|
+
delete dashboardComponent.promises[requestId];
|
|
697
|
+
}
|
|
698
|
+
}, 2e3);
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
702
|
+
};
|
|
703
|
+
|
|
704
|
+
// libs/embed-libs/shared-embed/src/lib/methods/get-filters.ts
|
|
705
|
+
var getFilters = (dashboardComponent, iframe) => {
|
|
706
|
+
if (iframe?.contentWindow) {
|
|
707
|
+
const requestId = uuidv4();
|
|
708
|
+
iframe.contentWindow.postMessage(
|
|
709
|
+
{ action: "getFilters", _version: dashboardComponent.VERSION, requestId },
|
|
710
|
+
"*"
|
|
711
|
+
);
|
|
712
|
+
return new Promise((resolve, reject) => {
|
|
713
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
714
|
+
setTimeout(() => {
|
|
715
|
+
if (dashboardComponent.promises[requestId]) {
|
|
716
|
+
const errorMessage = "getFilters request timed out.";
|
|
717
|
+
dashboardComponent.promises[requestId].reject(
|
|
718
|
+
new Error(errorMessage)
|
|
719
|
+
);
|
|
720
|
+
delete dashboardComponent.promises[requestId];
|
|
721
|
+
}
|
|
722
|
+
}, 2e3);
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
// libs/embed-libs/shared-embed/src/lib/methods/refresh-data.ts
|
|
729
|
+
var refreshData = (dashboardComponent, iframe, itemId) => {
|
|
730
|
+
if (iframe) {
|
|
731
|
+
iframe.contentWindow.postMessage(
|
|
732
|
+
{
|
|
733
|
+
action: "refreshData",
|
|
734
|
+
id: itemId ?? null,
|
|
735
|
+
_version: dashboardComponent.VERSION
|
|
736
|
+
},
|
|
737
|
+
"*"
|
|
738
|
+
);
|
|
739
|
+
return Promise.resolve();
|
|
740
|
+
}
|
|
741
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
742
|
+
};
|
|
743
|
+
|
|
744
|
+
// libs/embed-libs/shared-embed/src/lib/methods/reload-dashboard.ts
|
|
745
|
+
var reloadDashboard = (dashboardComponent, iframe) => {
|
|
746
|
+
if (iframe) {
|
|
747
|
+
iframe.contentWindow.postMessage(
|
|
748
|
+
{ action: "reloadDashboard", _version: dashboardComponent.VERSION },
|
|
749
|
+
"*"
|
|
750
|
+
);
|
|
751
|
+
return Promise.resolve();
|
|
752
|
+
}
|
|
753
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
754
|
+
};
|
|
755
|
+
|
|
756
|
+
// libs/embed-libs/shared-embed/src/lib/methods/set-authorization.ts
|
|
757
|
+
var setAuthorization = (dashboardComponent, iframe, key, token) => {
|
|
758
|
+
if (iframe) {
|
|
759
|
+
iframe.contentWindow.postMessage(
|
|
760
|
+
{
|
|
761
|
+
action: "setAuthorization",
|
|
762
|
+
key,
|
|
763
|
+
token,
|
|
764
|
+
_version: dashboardComponent.VERSION
|
|
765
|
+
},
|
|
766
|
+
"*"
|
|
767
|
+
);
|
|
768
|
+
return Promise.resolve();
|
|
769
|
+
}
|
|
770
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
771
|
+
};
|
|
772
|
+
|
|
773
|
+
// libs/embed-libs/shared-embed/src/lib/methods/set-edit-mode.ts
|
|
774
|
+
var setEditMode = (dashboardComponent, iframe, editMode) => {
|
|
775
|
+
if (iframe && iframe.contentWindow) {
|
|
776
|
+
const requestId = uuidv4();
|
|
777
|
+
if (dashboardComponent.params.editMode === editMode) {
|
|
778
|
+
return Promise.reject(
|
|
779
|
+
new Error("editMode parameter is currently already set to " + editMode)
|
|
780
|
+
);
|
|
781
|
+
} else if (editMode !== "editFull" && editMode !== "editLimited" && editMode !== "view") {
|
|
782
|
+
return Promise.reject(
|
|
783
|
+
new Error(
|
|
784
|
+
"The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'."
|
|
785
|
+
)
|
|
786
|
+
);
|
|
787
|
+
}
|
|
788
|
+
iframe.contentWindow.postMessage(
|
|
789
|
+
{
|
|
790
|
+
action: "setEditMode",
|
|
791
|
+
editMode,
|
|
792
|
+
_version: dashboardComponent.VERSION,
|
|
793
|
+
requestId
|
|
794
|
+
},
|
|
795
|
+
"*"
|
|
796
|
+
);
|
|
797
|
+
return new Promise((resolve, reject) => {
|
|
798
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
802
|
+
};
|
|
803
|
+
|
|
804
|
+
// libs/embed-libs/shared-embed/src/lib/methods/set-filters.ts
|
|
805
|
+
var setFilters = (dashboardComponent, iframe, itemId, filters) => {
|
|
806
|
+
if (iframe) {
|
|
807
|
+
const requestId = uuidv4();
|
|
808
|
+
iframe.contentWindow.postMessage(
|
|
809
|
+
{
|
|
810
|
+
action: "setFilters",
|
|
811
|
+
itemId,
|
|
812
|
+
filters,
|
|
813
|
+
_version: dashboardComponent.VERSION,
|
|
814
|
+
requestId
|
|
815
|
+
},
|
|
816
|
+
"*"
|
|
817
|
+
);
|
|
818
|
+
return new Promise((resolve, reject) => {
|
|
819
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
820
|
+
setTimeout(() => {
|
|
821
|
+
if (dashboardComponent.promises[requestId]) {
|
|
822
|
+
const errorMessage = "setFilters request timed out.";
|
|
823
|
+
dashboardComponent.promises[requestId].reject(
|
|
824
|
+
new Error(errorMessage)
|
|
825
|
+
);
|
|
826
|
+
delete dashboardComponent.promises[requestId];
|
|
827
|
+
}
|
|
828
|
+
}, 2e3);
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
return Promise.reject();
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
// libs/embed-libs/shared-embed/src/lib/methods/set-preview.ts
|
|
835
|
+
var setPreview = (dashboardComponent, iframe, preview) => {
|
|
836
|
+
if (iframe) {
|
|
837
|
+
const requestId = uuidv4();
|
|
838
|
+
iframe.contentWindow.postMessage(
|
|
839
|
+
{
|
|
840
|
+
action: "setPreview",
|
|
841
|
+
preview,
|
|
842
|
+
requestId,
|
|
843
|
+
_version: dashboardComponent.VERSION
|
|
844
|
+
},
|
|
845
|
+
"*"
|
|
846
|
+
);
|
|
847
|
+
return new Promise((resolve, reject) => {
|
|
848
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
849
|
+
setTimeout(() => {
|
|
850
|
+
if (dashboardComponent.promises[requestId]) {
|
|
851
|
+
const errorMessage = "setPreview request timed out.";
|
|
852
|
+
dashboardComponent.promises[requestId].reject(
|
|
853
|
+
new Error(errorMessage)
|
|
854
|
+
);
|
|
855
|
+
delete dashboardComponent.promises[requestId];
|
|
856
|
+
}
|
|
857
|
+
}, 2e3);
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
861
|
+
};
|
|
862
|
+
|
|
863
|
+
// libs/embed-libs/shared-embed/src/lib/service/calculate-dimensions.ts
|
|
864
|
+
var _setCalculatedDimensions = (dashboardComponent) => {
|
|
865
|
+
if (!dashboardComponent.dimensions) {
|
|
866
|
+
dashboardComponent.params.error = true;
|
|
867
|
+
_handleError("Got no valid dimensions.", dashboardComponent.params);
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
const dashboardDimensionKeys = Object.keys(
|
|
871
|
+
dashboardComponent.dimensions
|
|
872
|
+
);
|
|
873
|
+
const availableScreenModeExtents = [];
|
|
874
|
+
let currentMode;
|
|
875
|
+
let currentWidth = 0;
|
|
876
|
+
let currentHeight = 0;
|
|
877
|
+
if (!dashboardComponent.params.switchScreenModeOnResize && dashboardComponent.currentScreenMode) {
|
|
878
|
+
dashboardComponent.params.screenMode = dashboardComponent.currentScreenMode;
|
|
879
|
+
}
|
|
880
|
+
if (dashboardComponent.dimensions && dashboardDimensionKeys?.[0] === "fixed") {
|
|
881
|
+
currentMode = "fixed";
|
|
882
|
+
currentWidth = dashboardComponent.dimensions.fixed[0];
|
|
883
|
+
currentHeight = dashboardComponent.dimensions.fixed[1];
|
|
884
|
+
} else {
|
|
885
|
+
const screenModes = [
|
|
886
|
+
"mobile",
|
|
887
|
+
"tablet",
|
|
888
|
+
"desktop",
|
|
889
|
+
"largeScreen"
|
|
890
|
+
];
|
|
891
|
+
if (dashboardComponent.params.itemEmbedding) {
|
|
892
|
+
const [firstMatch] = dashboardDimensionKeys;
|
|
893
|
+
let match = cloneDeep(firstMatch);
|
|
894
|
+
for (const screenMode of screenModes) {
|
|
895
|
+
const found = dashboardDimensionKeys.find((key) => key === screenMode);
|
|
896
|
+
if (found) {
|
|
897
|
+
match = cloneDeep(found);
|
|
898
|
+
} else {
|
|
899
|
+
dashboardComponent.dimensions[screenMode] = dashboardComponent.dimensions[match];
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
for (const key of dashboardDimensionKeys) {
|
|
904
|
+
if (screenModes.includes(key)) {
|
|
905
|
+
const screenMode = EXTENTS.find((extent) => extent.mode === key);
|
|
906
|
+
availableScreenModeExtents.push({
|
|
907
|
+
...screenMode,
|
|
908
|
+
height: dashboardComponent.dimensions[key][1] || 50
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
if (!availableScreenModeExtents.map((screenModeExtent) => screenModeExtent.mode).includes(dashboardComponent.params.screenMode)) {
|
|
913
|
+
dashboardComponent.params.screenMode = "auto";
|
|
914
|
+
}
|
|
915
|
+
if (dashboardComponent.params.screenMode === "auto") {
|
|
916
|
+
availableScreenModeExtents.sort(
|
|
917
|
+
(a, b) => screenModes.indexOf(a.mode) - screenModes.indexOf(b.mode)
|
|
918
|
+
);
|
|
919
|
+
for (const screenModeExtent of availableScreenModeExtents) {
|
|
920
|
+
const [screenModeExtentMinWidth, screenModeExtentMaxWidth] = screenModeExtent.width;
|
|
921
|
+
if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
|
|
922
|
+
if (screenModeExtentMinWidth < dashboardComponent.params.itemDimensions.width) {
|
|
923
|
+
currentMode = screenModeExtent.mode;
|
|
924
|
+
currentWidth = Number.parseInt(
|
|
925
|
+
dashboardComponent.params.itemDimensions.width,
|
|
926
|
+
10
|
|
927
|
+
);
|
|
928
|
+
currentHeight = dashboardComponent.dimensions[currentMode][1];
|
|
929
|
+
}
|
|
930
|
+
} else {
|
|
931
|
+
if (screenModeExtentMinWidth < dashboardComponent.containerWidth) {
|
|
932
|
+
currentMode = screenModeExtent.mode;
|
|
933
|
+
if (dashboardComponent.params.itemEmbedding) {
|
|
934
|
+
currentWidth = dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto" ? Number.parseInt(
|
|
935
|
+
dashboardComponent.params.itemDimensions.width,
|
|
936
|
+
10
|
|
937
|
+
) : Math.min(
|
|
938
|
+
dashboardComponent.containerWidth,
|
|
939
|
+
screenModeExtentMaxWidth
|
|
940
|
+
);
|
|
941
|
+
currentHeight = dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto" ? Number.parseInt(
|
|
942
|
+
dashboardComponent.params.itemDimensions.height,
|
|
943
|
+
10
|
|
944
|
+
) : dashboardComponent.dimensions[currentMode][1];
|
|
945
|
+
if (dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
|
|
946
|
+
currentWidth = Number.parseInt(
|
|
947
|
+
dashboardComponent.params.itemDimensions.width,
|
|
948
|
+
10
|
|
949
|
+
);
|
|
950
|
+
currentHeight = dashboardComponent.dimensions[currentMode][1];
|
|
951
|
+
}
|
|
952
|
+
} else {
|
|
953
|
+
currentWidth = Math.max(
|
|
954
|
+
Math.min(
|
|
955
|
+
screenModeExtentMaxWidth,
|
|
956
|
+
dashboardComponent.containerWidth
|
|
957
|
+
),
|
|
958
|
+
screenModeExtentMinWidth
|
|
959
|
+
);
|
|
960
|
+
currentHeight = screenModeExtent.height;
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
} else {
|
|
966
|
+
const {
|
|
967
|
+
height: chosenModeHeight,
|
|
968
|
+
width: [chosenModeMinWidth, chosenModeMaxWidth]
|
|
969
|
+
} = availableScreenModeExtents.find(
|
|
970
|
+
(d) => d.mode === dashboardComponent.params.screenMode
|
|
971
|
+
);
|
|
972
|
+
currentMode = dashboardComponent.params.screenMode;
|
|
973
|
+
currentWidth = Math.max(
|
|
974
|
+
Math.min(chosenModeMaxWidth, dashboardComponent.containerWidth),
|
|
975
|
+
chosenModeMinWidth
|
|
976
|
+
);
|
|
977
|
+
currentHeight = chosenModeHeight;
|
|
978
|
+
if (dashboardComponent.params.itemEmbedding) {
|
|
979
|
+
if (dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto") {
|
|
980
|
+
currentWidth = Number.parseInt(
|
|
981
|
+
dashboardComponent.params.itemDimensions.width,
|
|
982
|
+
10
|
|
983
|
+
);
|
|
984
|
+
}
|
|
985
|
+
if (dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto") {
|
|
986
|
+
currentHeight = Number.parseInt(
|
|
987
|
+
dashboardComponent.params.itemDimensions.height,
|
|
988
|
+
10
|
|
989
|
+
);
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
if (!currentMode && availableScreenModeExtents.length > 0) {
|
|
994
|
+
const [lowestModeExtent] = availableScreenModeExtents;
|
|
995
|
+
currentMode = lowestModeExtent.mode;
|
|
996
|
+
currentWidth = lowestModeExtent.width[0];
|
|
997
|
+
currentHeight = lowestModeExtent.height;
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
dashboardComponent.currentScreenMode = currentMode;
|
|
1001
|
+
const style = {
|
|
1002
|
+
height: currentHeight === 0 ? "100%" : `${String(currentHeight)}px`,
|
|
1003
|
+
width: currentWidth === 0 ? "100%" : `${String(currentWidth)}px`,
|
|
1004
|
+
opacity: 1
|
|
1005
|
+
};
|
|
1006
|
+
const dashboardEditModes = ["editFull", "editLimited"];
|
|
1007
|
+
if (dashboardEditModes.includes(dashboardComponent.params.editMode)) {
|
|
1008
|
+
style.height = "100%";
|
|
1009
|
+
style.width = "100%";
|
|
1010
|
+
} else if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions) {
|
|
1011
|
+
style.height = dashboardComponent.params.itemDimensions.height === "auto" ? style.height : `${String(dashboardComponent.params.itemDimensions.height).replace(
|
|
1012
|
+
"px",
|
|
1013
|
+
""
|
|
1014
|
+
)}px`;
|
|
1015
|
+
style.width = dashboardComponent.params.itemDimensions.width === "auto" ? style.width : `${String(dashboardComponent.params.itemDimensions.width).replace(
|
|
1016
|
+
"px",
|
|
1017
|
+
""
|
|
1018
|
+
)}px`;
|
|
1019
|
+
} else {
|
|
1020
|
+
style.height = currentHeight === 0 ? "100%" : `${String(currentHeight)}px`;
|
|
1021
|
+
style.width = currentWidth === 0 ? "100%" : `${String(currentWidth)}px`;
|
|
1022
|
+
}
|
|
1023
|
+
dashboardComponent.currentScreenMode = currentMode;
|
|
1024
|
+
dashboardComponent.iframeStyle = style;
|
|
1025
|
+
};
|
|
1026
|
+
|
|
1027
|
+
// libs/embed-libs/shared-embed/src/lib/service/extend-and-validate.ts
|
|
1028
|
+
var _extendAndValidate = (dashboardContent) => {
|
|
1029
|
+
const defaultKeys = Object.keys(
|
|
1030
|
+
DEFAULT_PARAMETERS
|
|
1031
|
+
);
|
|
1032
|
+
const errorMessages = [];
|
|
1033
|
+
const requiredStringParams = [
|
|
1034
|
+
"appServer",
|
|
1035
|
+
"language",
|
|
1036
|
+
"apiHost"
|
|
1037
|
+
];
|
|
1038
|
+
const requiredStringOrEmptyParams = [
|
|
1039
|
+
"key",
|
|
1040
|
+
"token",
|
|
1041
|
+
"screenMode",
|
|
1042
|
+
"timezoneId",
|
|
1043
|
+
"itemId",
|
|
1044
|
+
"container",
|
|
1045
|
+
"loaderBackground",
|
|
1046
|
+
"loaderFontColor",
|
|
1047
|
+
"loaderSpinnerColor",
|
|
1048
|
+
"loaderSpinnerBackground"
|
|
1049
|
+
];
|
|
1050
|
+
const objectParams = ["itemDimensions"];
|
|
1051
|
+
const screenModes = [
|
|
1052
|
+
"mobile",
|
|
1053
|
+
"tablet",
|
|
1054
|
+
"desktop",
|
|
1055
|
+
"largeScreen",
|
|
1056
|
+
"fixed",
|
|
1057
|
+
"auto"
|
|
1058
|
+
];
|
|
1059
|
+
for (const key of defaultKeys) {
|
|
1060
|
+
if (dashboardContent.params[key] === null) {
|
|
1061
|
+
delete dashboardContent.params[key];
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
dashboardContent.params = defaultsDeep(
|
|
1065
|
+
dashboardContent.params,
|
|
1066
|
+
DEFAULT_PARAMETERS
|
|
1067
|
+
);
|
|
1068
|
+
if ((!dashboardContent.params.dashboardId || typeof dashboardContent.params.dashboardId !== "string") && (!dashboardContent.params.dashboardSlug || typeof dashboardContent.params.dashboardSlug !== "string")) {
|
|
1069
|
+
delete dashboardContent.params.dashboardId;
|
|
1070
|
+
delete dashboardContent.params.dashboardSlug;
|
|
1071
|
+
}
|
|
1072
|
+
for (const key of requiredStringParams) {
|
|
1073
|
+
if (typeof dashboardContent.params[key] !== "string") {
|
|
1074
|
+
delete dashboardContent.params[key];
|
|
1075
|
+
errorMessages.push(`${key} needs to be of type string.`);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
for (const key of requiredStringOrEmptyParams) {
|
|
1079
|
+
if (typeof dashboardContent.params[key] !== "string" && dashboardContent.params[key] !== null && dashboardContent.params[key] !== void 0) {
|
|
1080
|
+
delete dashboardContent.params[key];
|
|
1081
|
+
errorMessages.push(`${key} needs to be of type string or empty.`);
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
if (dashboardContent.params.screenMode && !screenModes.includes(dashboardContent.params.screenMode)) {
|
|
1085
|
+
const validTypesString = screenModes.map((mode) => `"${mode}"`).join(", ");
|
|
1086
|
+
errorMessages.push(
|
|
1087
|
+
`"screenMode" needs should be one of these types: ${validTypesString}`
|
|
1088
|
+
);
|
|
1089
|
+
dashboardContent.params.screenMode = "auto";
|
|
1090
|
+
}
|
|
1091
|
+
if (dashboardContent.params.itemId) {
|
|
1092
|
+
dashboardContent.params.itemEmbedding = true;
|
|
1093
|
+
}
|
|
1094
|
+
for (const key of objectParams) {
|
|
1095
|
+
if (typeof dashboardContent.params[key] !== "object" && dashboardContent.params[key] !== null) {
|
|
1096
|
+
delete dashboardContent.params[key];
|
|
1097
|
+
errorMessages.push(`${key} needs to be of type object or empty.`);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
if (typeof dashboardContent.params.switchScreenModeOnResize !== "boolean") {
|
|
1101
|
+
errorMessages.push("switchScreenModeOnResize needs to be of type boolean.");
|
|
1102
|
+
dashboardContent.params.switchScreenModeOnResize = true;
|
|
1103
|
+
}
|
|
1104
|
+
if (dashboardContent.params.itemDimensions) {
|
|
1105
|
+
const itemDimensionsKeys = [
|
|
1106
|
+
"width",
|
|
1107
|
+
"height"
|
|
1108
|
+
];
|
|
1109
|
+
for (const key of itemDimensionsKeys) {
|
|
1110
|
+
if (!["string", "number"].includes(
|
|
1111
|
+
typeof dashboardContent.params.itemDimensions[key]
|
|
1112
|
+
) && dashboardContent.params.itemDimensions[key] !== null) {
|
|
1113
|
+
errorMessages.push(
|
|
1114
|
+
`itemDimensions ${key} needs to be of type string, number or empty.`
|
|
1115
|
+
);
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
dashboardContent.params = defaultsDeep(
|
|
1120
|
+
dashboardContent.params,
|
|
1121
|
+
DEFAULT_PARAMETERS
|
|
1122
|
+
);
|
|
1123
|
+
if (dashboardContent.params.screenMode && dashboardContent.params.screenMode !== "auto") {
|
|
1124
|
+
dashboardContent.params.switchScreenModeOnResize = false;
|
|
1125
|
+
}
|
|
1126
|
+
if (dashboardContent.params.itemDimensions.width !== "auto") {
|
|
1127
|
+
dashboardContent.params.itemDimensions.width = Number.parseInt(
|
|
1128
|
+
`${dashboardContent.params.itemDimensions.width}`.replace("px", ""),
|
|
1129
|
+
10
|
|
1130
|
+
) || "auto";
|
|
1131
|
+
}
|
|
1132
|
+
if (dashboardContent.params.itemDimensions.height !== "auto") {
|
|
1133
|
+
dashboardContent.params.itemDimensions.height = Number.parseInt(
|
|
1134
|
+
`${dashboardContent.params.itemDimensions.height}`.replace("px", ""),
|
|
1135
|
+
10
|
|
1136
|
+
) || "auto";
|
|
1137
|
+
}
|
|
1138
|
+
dashboardContent.params.itemEmbedding = !!dashboardContent.params.itemId;
|
|
1139
|
+
if (dashboardContent.params.error || errorMessages.length > 0) {
|
|
1140
|
+
_handleError(errorMessages.join("\n"), dashboardContent.params);
|
|
1141
|
+
}
|
|
1142
|
+
};
|
|
1143
|
+
|
|
1144
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/remote-federation.ts
|
|
1145
|
+
var remotesMap = {
|
|
1146
|
+
// "remote_app": { url: "http://localhost:4201/remoteEntry.mjs", format: "esm", from: "vite" },
|
|
1147
|
+
};
|
|
1148
|
+
var loadJS = async (url, fn) => {
|
|
1149
|
+
const resolvedUrl = typeof url === "function" ? await url() : url;
|
|
1150
|
+
const script = document.createElement("script");
|
|
1151
|
+
script.type = "text/javascript";
|
|
1152
|
+
script.addEventListener("load", fn);
|
|
1153
|
+
script.src = resolvedUrl;
|
|
1154
|
+
document.querySelectorAll("head")[0].append(script);
|
|
1155
|
+
};
|
|
1156
|
+
var wrapShareModule = (remoteFrom) => ({});
|
|
1157
|
+
async function __federationMethodEnsure(remoteId) {
|
|
1158
|
+
const remote = remotesMap[remoteId];
|
|
1159
|
+
if (remote.inited) {
|
|
1160
|
+
return remote.lib;
|
|
1161
|
+
}
|
|
1162
|
+
if (remote.format === "var") {
|
|
1163
|
+
return new Promise((resolve) => {
|
|
1164
|
+
const callback = () => {
|
|
1165
|
+
if (!remote.inited) {
|
|
1166
|
+
remote.lib = window[remoteId];
|
|
1167
|
+
remote.lib.init(wrapShareModule(remote.from));
|
|
1168
|
+
remote.inited = true;
|
|
1169
|
+
}
|
|
1170
|
+
resolve(remote.lib);
|
|
1171
|
+
};
|
|
1172
|
+
return loadJS(remote.url, callback);
|
|
1173
|
+
});
|
|
1174
|
+
} else if (["esm", "systemjs"].includes(remote.format)) {
|
|
1175
|
+
return new Promise((resolve, reject) => {
|
|
1176
|
+
const getUrl = typeof remote.url === "function" ? remote.url : () => Promise.resolve(remote.url);
|
|
1177
|
+
getUrl().then((url) => {
|
|
1178
|
+
import(
|
|
1179
|
+
/* @vite-ignore */
|
|
1180
|
+
/* webpackIgnore: true */
|
|
1181
|
+
url
|
|
1182
|
+
).then((lib) => {
|
|
1183
|
+
if (!remote.inited) {
|
|
1184
|
+
const shareScope = wrapShareModule(remote.from);
|
|
1185
|
+
lib.init(shareScope);
|
|
1186
|
+
remote.lib = lib;
|
|
1187
|
+
remote.lib.init(shareScope);
|
|
1188
|
+
remote.inited = true;
|
|
1189
|
+
}
|
|
1190
|
+
resolve(remote.lib);
|
|
1191
|
+
}).catch(reject);
|
|
1192
|
+
});
|
|
1193
|
+
});
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
function __federationMethodWrapDefault(module2, need) {
|
|
1197
|
+
if (!(module2 == null ? void 0 : module2.default) && need) {
|
|
1198
|
+
const obj = /* @__PURE__ */ Object.create(null);
|
|
1199
|
+
obj.default = module2;
|
|
1200
|
+
obj.__esModule = true;
|
|
1201
|
+
return obj;
|
|
1202
|
+
}
|
|
1203
|
+
return module2;
|
|
1204
|
+
}
|
|
1205
|
+
async function __federationMethodGetRemote(remoteName, componentName) {
|
|
1206
|
+
return __federationMethodEnsure(remoteName).then((remote) => remote.get(componentName).then((factory) => factory()));
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
|
|
1210
|
+
var import_lit2 = require("lit");
|
|
1211
|
+
var import_decorators = require("lit/decorators.js");
|
|
1212
|
+
var import_style_map = require("lit/directives/style-map.js");
|
|
1213
|
+
|
|
1214
|
+
// libs/embed-libs/embed/package.json
|
|
1215
|
+
var version = "5.0.7";
|
|
1216
|
+
|
|
1217
|
+
// libs/embed-libs/embed/src/lib/luzmo-service.ts
|
|
1218
|
+
var LuzmoService = class {
|
|
1219
|
+
constructor() {
|
|
1220
|
+
this._components = [];
|
|
1221
|
+
}
|
|
1222
|
+
};
|
|
1223
|
+
var luzmo_service_default = new LuzmoService();
|
|
1224
|
+
|
|
1225
|
+
// libs/embed-libs/embed/src/lib/helper/event-bus-handler.ts
|
|
1226
|
+
var _setEventHandler = () => {
|
|
1227
|
+
if (typeof window.__luzmoMessageHandler === "function") {
|
|
1228
|
+
return;
|
|
1229
|
+
}
|
|
1230
|
+
window.__luzmoMessageHandler = (event) => {
|
|
1231
|
+
const dashboardComponent = luzmo_service_default._components.find(
|
|
1232
|
+
(c) => event.data.name === c._iframeId
|
|
1233
|
+
);
|
|
1234
|
+
if (!dashboardComponent) {
|
|
1235
|
+
return;
|
|
1236
|
+
}
|
|
1237
|
+
switch (event.data?.type) {
|
|
1238
|
+
case "load": {
|
|
1239
|
+
dashboardComponent.dispatchEvent(
|
|
1240
|
+
new CustomEvent("load", { detail: { data: event.data } })
|
|
1241
|
+
);
|
|
1242
|
+
if (dashboardComponent._loadTimeoutHandle) {
|
|
1243
|
+
clearTimeout(dashboardComponent._loadTimeoutHandle);
|
|
1244
|
+
dashboardComponent._loadTimeoutHandle = void 0;
|
|
1245
|
+
}
|
|
1246
|
+
dashboardComponent.iframeLoaded = true;
|
|
1247
|
+
dashboardComponent.dimensions = event.data.dimensions;
|
|
1248
|
+
dashboardComponent._calculateDimAfterDashboardLoaded();
|
|
1249
|
+
break;
|
|
1250
|
+
}
|
|
1251
|
+
case "error": {
|
|
1252
|
+
dashboardComponent.dashboardError = true;
|
|
1253
|
+
if (dashboardComponent._loadTimeoutHandle) {
|
|
1254
|
+
clearTimeout(dashboardComponent._loadTimeoutHandle);
|
|
1255
|
+
dashboardComponent._loadTimeoutHandle = void 0;
|
|
1256
|
+
}
|
|
1257
|
+
dashboardComponent.iframeLoaded = true;
|
|
1258
|
+
dashboardComponent._displayError();
|
|
1259
|
+
break;
|
|
1260
|
+
}
|
|
1261
|
+
case "data": {
|
|
1262
|
+
resolvePromise(
|
|
1263
|
+
dashboardComponent,
|
|
1264
|
+
event.data.requestId,
|
|
1265
|
+
event.data.data
|
|
1266
|
+
);
|
|
1267
|
+
break;
|
|
1268
|
+
}
|
|
1269
|
+
case "filters": {
|
|
1270
|
+
resolvePromise(
|
|
1271
|
+
dashboardComponent,
|
|
1272
|
+
event.data.requestId,
|
|
1273
|
+
event.data.filters
|
|
1274
|
+
);
|
|
1275
|
+
break;
|
|
1276
|
+
}
|
|
1277
|
+
case "getAccessibleDashboards": {
|
|
1278
|
+
resolvePromise(
|
|
1279
|
+
dashboardComponent,
|
|
1280
|
+
event.data.requestId,
|
|
1281
|
+
event.data.accessibleDashboards
|
|
1282
|
+
);
|
|
1283
|
+
break;
|
|
1284
|
+
}
|
|
1285
|
+
case "dashboardAction": {
|
|
1286
|
+
dashboardComponent.dispatchEvent(
|
|
1287
|
+
new CustomEvent("dashboardAction", { detail: { data: event.data } })
|
|
1288
|
+
);
|
|
1289
|
+
break;
|
|
1290
|
+
}
|
|
1291
|
+
case "export": {
|
|
1292
|
+
if (event.data.error) {
|
|
1293
|
+
rejectPromise(
|
|
1294
|
+
dashboardComponent,
|
|
1295
|
+
event.data.requestId,
|
|
1296
|
+
event.data
|
|
1297
|
+
);
|
|
1298
|
+
} else {
|
|
1299
|
+
dashboardComponent.dispatchEvent(
|
|
1300
|
+
new CustomEvent("exported", { detail: { data: event.data } })
|
|
1301
|
+
);
|
|
1302
|
+
resolvePromise(
|
|
1303
|
+
dashboardComponent,
|
|
1304
|
+
event.data.requestId,
|
|
1305
|
+
event.data
|
|
1306
|
+
);
|
|
1307
|
+
}
|
|
1308
|
+
break;
|
|
1309
|
+
}
|
|
1310
|
+
case "changedFilters": {
|
|
1311
|
+
dashboardComponent.dispatchEvent(
|
|
1312
|
+
new CustomEvent("changedFilters", { detail: { data: event.data } })
|
|
1313
|
+
);
|
|
1314
|
+
break;
|
|
1315
|
+
}
|
|
1316
|
+
case "customEvent": {
|
|
1317
|
+
dashboardComponent.dispatchEvent(
|
|
1318
|
+
new CustomEvent("customEvent", { detail: { data: event.data } })
|
|
1319
|
+
);
|
|
1320
|
+
break;
|
|
1321
|
+
}
|
|
1322
|
+
case "chartsRendered":
|
|
1323
|
+
case "itemsRendered": {
|
|
1324
|
+
event.data.type = "itemsRendered";
|
|
1325
|
+
dashboardComponent.dispatchEvent(
|
|
1326
|
+
new CustomEvent("itemsRendered", { detail: { data: event.data } })
|
|
1327
|
+
);
|
|
1328
|
+
break;
|
|
1329
|
+
}
|
|
1330
|
+
case "setEditMode": {
|
|
1331
|
+
if (event.data.error) {
|
|
1332
|
+
rejectPromise(
|
|
1333
|
+
dashboardComponent,
|
|
1334
|
+
event.data.requestId,
|
|
1335
|
+
event.data
|
|
1336
|
+
);
|
|
1337
|
+
} else {
|
|
1338
|
+
resolvePromise(
|
|
1339
|
+
dashboardComponent,
|
|
1340
|
+
event.data.requestId,
|
|
1341
|
+
event.data
|
|
1342
|
+
);
|
|
1343
|
+
dashboardComponent.params.editMode = event.data.editMode;
|
|
1344
|
+
dashboardComponent._containerStyle = containerStyles(dashboardComponent);
|
|
1345
|
+
if (dashboardComponent.dimensions) {
|
|
1346
|
+
_setCalculatedDimensions(dashboardComponent);
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
break;
|
|
1350
|
+
}
|
|
1351
|
+
case "setFilters": {
|
|
1352
|
+
event.data.error ? rejectPromise(
|
|
1353
|
+
dashboardComponent,
|
|
1354
|
+
event.data.requestId,
|
|
1355
|
+
event.data
|
|
1356
|
+
) : resolvePromise(
|
|
1357
|
+
dashboardComponent,
|
|
1358
|
+
event.data.requestId,
|
|
1359
|
+
event.data
|
|
1360
|
+
);
|
|
1361
|
+
break;
|
|
1362
|
+
}
|
|
1363
|
+
case "setPreview": {
|
|
1364
|
+
event.data.error ? rejectPromise(
|
|
1365
|
+
dashboardComponent,
|
|
1366
|
+
event.data.requestId,
|
|
1367
|
+
event.data
|
|
1368
|
+
) : resolvePromise(
|
|
1369
|
+
dashboardComponent,
|
|
1370
|
+
event.data.requestId,
|
|
1371
|
+
event.data
|
|
1372
|
+
);
|
|
1373
|
+
break;
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
};
|
|
1377
|
+
window.addEventListener("message", window.__luzmoMessageHandler, false);
|
|
1378
|
+
};
|
|
1379
|
+
|
|
1380
|
+
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-styles.ts
|
|
1381
|
+
var import_lit = require("lit");
|
|
1382
|
+
var dashboardStyles = import_lit.css`
|
|
1383
|
+
@-webkit-keyframes spin {
|
|
1384
|
+
0% {
|
|
1385
|
+
-webkit-transform: rotate(0deg);
|
|
1386
|
+
transform: rotate(0deg);
|
|
1387
|
+
}
|
|
1388
|
+
100% {
|
|
1389
|
+
-webkit-transform: rotate(360deg);
|
|
1390
|
+
transform: rotate(360deg);
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
@keyframes spin {
|
|
1395
|
+
0% {
|
|
1396
|
+
-webkit-transform: rotate(0deg);
|
|
1397
|
+
transform: rotate(0deg);
|
|
1398
|
+
}
|
|
1399
|
+
100% {
|
|
1400
|
+
-webkit-transform: rotate(360deg);
|
|
1401
|
+
transform: rotate(360deg);
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
:host {
|
|
1405
|
+
position: relative;
|
|
1406
|
+
width: 100%;
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
.luzmo-embed-dashboard {
|
|
1410
|
+
background: transparent;
|
|
1411
|
+
padding: 0;
|
|
1412
|
+
border: 0;
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
.luzmo-container-loader {
|
|
1416
|
+
width: 100%;
|
|
1417
|
+
position: relative;
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
.luzmo-lc {
|
|
1421
|
+
margin: 0 auto;
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
.luzmo-loading-message {
|
|
1425
|
+
width: 100%;
|
|
1426
|
+
height: 20px;
|
|
1427
|
+
text-align: center;
|
|
1428
|
+
margin-bottom: 16px;
|
|
1429
|
+
font-family: Helvetica, Arial, sans-serif;
|
|
1430
|
+
font-size: 14px;
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
.luzmo-loading-circle {
|
|
1434
|
+
box-sizing: border-box;
|
|
1435
|
+
margin: 16px auto;
|
|
1436
|
+
position: relative;
|
|
1437
|
+
text-indent: -9999em;
|
|
1438
|
+
animation: spin 0.6s infinite linear;
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
.luzmo-loading-circle,
|
|
1442
|
+
.luzmo-loading-circle:after {
|
|
1443
|
+
border-radius: 50%;
|
|
1444
|
+
width: 32px;
|
|
1445
|
+
height: 32px;
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
.itemEmbedding:after {
|
|
1449
|
+
width: 24px;
|
|
1450
|
+
height: 24px;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
.luzmo-error {
|
|
1454
|
+
background: transparent;
|
|
1455
|
+
padding: 48px 0;
|
|
1456
|
+
margin: 0 auto;
|
|
1457
|
+
width: 80%;
|
|
1458
|
+
border: 0;
|
|
1459
|
+
text-align: center;
|
|
1460
|
+
min-height: 192px;
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
.dashboard-error {
|
|
1464
|
+
font-size: 30px;
|
|
1465
|
+
background: transparent;
|
|
1466
|
+
padding: 48px 0;
|
|
1467
|
+
margin: 0 auto;
|
|
1468
|
+
width: 80%;
|
|
1469
|
+
border: 0;
|
|
1470
|
+
text-align: center;
|
|
1471
|
+
min-height: 192px;
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
.luzmo-loader {
|
|
1475
|
+
top: 0;
|
|
1476
|
+
left: 0;
|
|
1477
|
+
width: 100%;
|
|
1478
|
+
min-height: 400px;
|
|
1479
|
+
position: absolute;
|
|
1480
|
+
transition-duration: 0.3s;
|
|
1481
|
+
}
|
|
1482
|
+
`;
|
|
1483
|
+
|
|
1484
|
+
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
|
|
1485
|
+
var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
1486
|
+
constructor(inputParameters) {
|
|
1487
|
+
super();
|
|
1488
|
+
this.language = "auto";
|
|
1489
|
+
this.screenMode = "auto";
|
|
1490
|
+
this.switchScreenModeOnResize = true;
|
|
1491
|
+
this.editMode = "view";
|
|
1492
|
+
this.experimental = false;
|
|
1493
|
+
this.iframeStyle = {};
|
|
1494
|
+
this._containerStyle = {};
|
|
1495
|
+
this._loaderStyle = {};
|
|
1496
|
+
this._lcStyle = {};
|
|
1497
|
+
this._loadingCircleStyle = {};
|
|
1498
|
+
this._containerLoaderStyle = {};
|
|
1499
|
+
this._loaderMsg = "";
|
|
1500
|
+
this._itemEmbedding = false;
|
|
1501
|
+
this.browserError = false;
|
|
1502
|
+
this.browserErrorMsg = "";
|
|
1503
|
+
this.dashboardError = false;
|
|
1504
|
+
this.browserNotSupported = [];
|
|
1505
|
+
this.VERSION = version + "-wc-luzmo";
|
|
1506
|
+
this.isLibraryLoaded = false;
|
|
1507
|
+
this.attributesMap = {
|
|
1508
|
+
dashboardId: "dashboard-id",
|
|
1509
|
+
dashboardSlug: "dashboard-slug",
|
|
1510
|
+
itemId: "item-id",
|
|
1511
|
+
language: "language",
|
|
1512
|
+
qeVersion: "qe-version",
|
|
1513
|
+
screenMode: "screen-mode",
|
|
1514
|
+
switchScreenModeOnResize: "switch-screen-mode-on-resize",
|
|
1515
|
+
authKey: "auth-key",
|
|
1516
|
+
authToken: "auth-token",
|
|
1517
|
+
editMode: "edit-mode",
|
|
1518
|
+
mainColor: "main-color",
|
|
1519
|
+
accentColor: "accent-color",
|
|
1520
|
+
loaderBackground: "loader-background",
|
|
1521
|
+
loaderFontColor: "loader-font-color",
|
|
1522
|
+
loaderSpinnerColor: "loader-spinner-color",
|
|
1523
|
+
loaderSpinnerBackground: "loader-spinner-background",
|
|
1524
|
+
appServer: "app-server",
|
|
1525
|
+
apiHost: "api-host",
|
|
1526
|
+
itemDimensions: "item-dimensions",
|
|
1527
|
+
timezoneId: "timezone-id"
|
|
1528
|
+
};
|
|
1529
|
+
this.loaderSize = 32;
|
|
1530
|
+
this.borderWidth = 3;
|
|
1531
|
+
this.minHeight = 400;
|
|
1532
|
+
this._containerId = uuidv4();
|
|
1533
|
+
this._iframeId = `luzmo-dashboard-${this._containerId}`;
|
|
1534
|
+
this.iframeLoaded = false;
|
|
1535
|
+
this.promises = {};
|
|
1536
|
+
this.setInputParameters(inputParameters);
|
|
1537
|
+
this.params = this._setOptions();
|
|
1538
|
+
this._onResize = () => {
|
|
1539
|
+
if (this.shadowRoot?.querySelector(".dashboard-container")) {
|
|
1540
|
+
this.containerWidth = this.container.clientWidth;
|
|
1541
|
+
if (this.params.switchScreenModeOnResize && this.params.screenMode === "auto") {
|
|
1542
|
+
for (const d of EXTENTS) {
|
|
1543
|
+
if (d.width[0] <= window.innerWidth && window.innerWidth <= d.width[1]) {
|
|
1544
|
+
this.currentScreenMode = d.mode;
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
if (this.iframeLoaded) {
|
|
1549
|
+
this._calculateDimAfterDashboardLoaded();
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
};
|
|
1553
|
+
this._resizeObserver = new ResizeObserver((entries) => {
|
|
1554
|
+
window.requestAnimationFrame(() => {
|
|
1555
|
+
if (!Array.isArray(entries) || entries.length === 0) {
|
|
1556
|
+
return;
|
|
1557
|
+
}
|
|
1558
|
+
this._onResize();
|
|
1559
|
+
});
|
|
1560
|
+
});
|
|
1561
|
+
}
|
|
1562
|
+
loadLibrary(appServer) {
|
|
1563
|
+
if (remotesMap[appServer]) {
|
|
1564
|
+
return Promise.resolve(remotesMap[appServer].module);
|
|
1565
|
+
}
|
|
1566
|
+
remotesMap[appServer] = { url: appServer?.startsWith("http://localhost") ? `${removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`, format: "esm", from: "vite", module: void 0 };
|
|
1567
|
+
return __federationMethodGetRemote(appServer, "./DashboardApp").then((module2) => {
|
|
1568
|
+
const wrappedModule = __federationMethodWrapDefault(module2, true);
|
|
1569
|
+
remotesMap[appServer].module = wrappedModule;
|
|
1570
|
+
return wrappedModule;
|
|
1571
|
+
});
|
|
1572
|
+
}
|
|
1573
|
+
setInputParameters(inputParameters) {
|
|
1574
|
+
if (!inputParameters) {
|
|
1575
|
+
return;
|
|
1576
|
+
}
|
|
1577
|
+
const params = [
|
|
1578
|
+
"dashboardId",
|
|
1579
|
+
"dashboardSlug",
|
|
1580
|
+
"itemId",
|
|
1581
|
+
"language",
|
|
1582
|
+
"qeVersion",
|
|
1583
|
+
"screenMode",
|
|
1584
|
+
"switchScreenModeOnResize",
|
|
1585
|
+
"accentColor",
|
|
1586
|
+
"mainColor",
|
|
1587
|
+
"authToken",
|
|
1588
|
+
"authKey",
|
|
1589
|
+
"editMode",
|
|
1590
|
+
"loaderBackground",
|
|
1591
|
+
"loaderFontColor",
|
|
1592
|
+
"loaderSpinnerColor",
|
|
1593
|
+
"loaderSpinnerBackground",
|
|
1594
|
+
"timezoneId",
|
|
1595
|
+
"itemDimensions",
|
|
1596
|
+
"apiHost"
|
|
1597
|
+
];
|
|
1598
|
+
for (const key of params) {
|
|
1599
|
+
const value = inputParameters[key];
|
|
1600
|
+
if (value) {
|
|
1601
|
+
this[key] = value;
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
if (inputParameters.experimental) {
|
|
1605
|
+
this.experimental = inputParameters.experimental;
|
|
1606
|
+
}
|
|
1607
|
+
if (inputParameters.appServer) {
|
|
1608
|
+
this.appServer = addTrailingSlash(inputParameters.appServer);
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
// Set resize event listener
|
|
1612
|
+
connectedCallback() {
|
|
1613
|
+
super.connectedCallback();
|
|
1614
|
+
}
|
|
1615
|
+
// Set resize event listener
|
|
1616
|
+
disconnectedCallback() {
|
|
1617
|
+
super.disconnectedCallback();
|
|
1618
|
+
this._resizeObserver.disconnect();
|
|
1619
|
+
for (const promiseKey of Object.keys(this.promises)) {
|
|
1620
|
+
this.promises[promiseKey].reject(
|
|
1621
|
+
new Error("Dashboard component was removed")
|
|
1622
|
+
);
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
firstUpdated() {
|
|
1626
|
+
this._loaderMsg = getLoader(this)?.loadingMsg;
|
|
1627
|
+
this._loaderStyles();
|
|
1628
|
+
luzmo_service_default._components.push(this);
|
|
1629
|
+
this.initComponent();
|
|
1630
|
+
}
|
|
1631
|
+
initComponent() {
|
|
1632
|
+
this.params = this._setOptions();
|
|
1633
|
+
if (this.getIsViewMode()) {
|
|
1634
|
+
this.loadLibrary(this.params.appServer).then(async () => {
|
|
1635
|
+
this.isLibraryLoaded = true;
|
|
1636
|
+
await this.updateComplete;
|
|
1637
|
+
const oldReference = this.renderRoot.querySelector("dashboard-component");
|
|
1638
|
+
this.dashboardReference = oldReference.cloneNode(true);
|
|
1639
|
+
oldReference.replaceWith(this.dashboardReference);
|
|
1640
|
+
this.dashboardReference.addEventListener("load", (payload) => {
|
|
1641
|
+
setTimeout(() => {
|
|
1642
|
+
this.containerWidth = this.dashboardReference.offsetWidth;
|
|
1643
|
+
this.dimensions = payload.detail.dimensions;
|
|
1644
|
+
_setCalculatedDimensions(this);
|
|
1645
|
+
this.dispatchEvent(new CustomEvent("load", payload.detail));
|
|
1646
|
+
});
|
|
1647
|
+
});
|
|
1648
|
+
this.dashboardReference.addEventListener("itemsRendered", (payload) => this.dispatchEvent(new CustomEvent("itemsRendered", payload.detail)));
|
|
1649
|
+
this.dashboardReference.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload.detail)));
|
|
1650
|
+
this.dashboardReference.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload.detail)));
|
|
1651
|
+
this.dashboardReference.addEventListener("dashboardAction", (payload) => this.dispatchEvent(new CustomEvent("dashboardAction", payload.detail)));
|
|
1652
|
+
this.dashboardReference.addEventListener("export", (payload) => this.dispatchEvent(new CustomEvent("exported", payload.detail)));
|
|
1653
|
+
this.setAllAttributes();
|
|
1654
|
+
});
|
|
1655
|
+
} else {
|
|
1656
|
+
this.containerWidth = this.container?.clientWidth;
|
|
1657
|
+
_extendAndValidate(this);
|
|
1658
|
+
_browserCheck(this);
|
|
1659
|
+
this._setupLoader();
|
|
1660
|
+
if (!this.params.error) {
|
|
1661
|
+
this._loaderStyles();
|
|
1662
|
+
_setEventHandler();
|
|
1663
|
+
this._iframeUrl = createIframeUrl(this);
|
|
1664
|
+
this.iframe?.setAttribute("src", this._iframeUrl);
|
|
1665
|
+
this.iframeStyle = calculateIframeStyles(this);
|
|
1666
|
+
}
|
|
1667
|
+
if (this.container) {
|
|
1668
|
+
this._resizeObserver.observe(this.container);
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
setAllAttributes() {
|
|
1673
|
+
if (this.dashboardReference) {
|
|
1674
|
+
for (const key in this.attributesMap) {
|
|
1675
|
+
if (!["authKey", "authToken", "apiHost", "itemDimensions"].includes(key) && this.params[key]) {
|
|
1676
|
+
this.dashboardReference.setAttribute(this.attributesMap[key], this.params[key]);
|
|
1677
|
+
}
|
|
1678
|
+
if (this.params.itemDimensions) {
|
|
1679
|
+
this.dashboardReference.setAttribute("item-dimensions", JSON.stringify(this.params.itemDimensions));
|
|
1680
|
+
}
|
|
1681
|
+
if (this.params.apiHost) {
|
|
1682
|
+
this.dashboardReference.setAttribute("api-host", removeTrailingSlash(this.params.apiHost));
|
|
1683
|
+
}
|
|
1684
|
+
if (this.params.key) {
|
|
1685
|
+
this.dashboardReference.setAttribute("auth-key", this.params.key);
|
|
1686
|
+
}
|
|
1687
|
+
if (this.params.token) {
|
|
1688
|
+
this.dashboardReference.setAttribute("auth-token", this.params.token);
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
// Reload dashboard when triggerproperty changes
|
|
1694
|
+
updated(changedProperties) {
|
|
1695
|
+
const triggerProperties = /* @__PURE__ */ new Set([
|
|
1696
|
+
"dashboardId",
|
|
1697
|
+
"dashboardSlug",
|
|
1698
|
+
"itemId",
|
|
1699
|
+
"language",
|
|
1700
|
+
"qeVersion",
|
|
1701
|
+
"editMode",
|
|
1702
|
+
"screenMode",
|
|
1703
|
+
"switchScreenModeOnResize",
|
|
1704
|
+
"authToken",
|
|
1705
|
+
"authKey",
|
|
1706
|
+
"appServer",
|
|
1707
|
+
"timezoneId",
|
|
1708
|
+
"itemDimensions"
|
|
1709
|
+
]);
|
|
1710
|
+
if (this.getIsViewMode()) {
|
|
1711
|
+
if (this.dashboardReference) {
|
|
1712
|
+
for (const [propertyName] of changedProperties.entries()) {
|
|
1713
|
+
if (propertyName === "appSever") {
|
|
1714
|
+
this.loadLibrary(changedProperties[propertyName]).then(async () => {
|
|
1715
|
+
this.isLibraryLoaded = true;
|
|
1716
|
+
await this.updateComplete;
|
|
1717
|
+
this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
|
|
1718
|
+
this.setAllAttributes();
|
|
1719
|
+
});
|
|
1720
|
+
} else if (this.attributesMap[propertyName]) {
|
|
1721
|
+
const mappedAttributeName = this.attributesMap[propertyName] ?? propertyName;
|
|
1722
|
+
const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() || this[propertyName];
|
|
1723
|
+
this.dashboardReference.setAttribute(mappedAttributeName, attributeValue);
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
} else {
|
|
1728
|
+
for (const [propertyName] of changedProperties.entries()) {
|
|
1729
|
+
if (triggerProperties.has(propertyName) && propertyName !== "editMode") {
|
|
1730
|
+
this.iframeLoaded = false;
|
|
1731
|
+
if (this._loadTimeoutHandle) {
|
|
1732
|
+
clearTimeout(this._loadTimeoutHandle);
|
|
1733
|
+
}
|
|
1734
|
+
this._loadTimeoutHandle = setTimeout(() => {
|
|
1735
|
+
console.error(
|
|
1736
|
+
"Failed to load dashboard, appServer is likely down or unreachable."
|
|
1737
|
+
);
|
|
1738
|
+
}, 15 * 1e3);
|
|
1739
|
+
this.params = this._setOptions();
|
|
1740
|
+
_extendAndValidate(this);
|
|
1741
|
+
this._setupLoader();
|
|
1742
|
+
this._loaderStyles();
|
|
1743
|
+
this._iframeUrl = createIframeUrl(this);
|
|
1744
|
+
if (this.iframe) {
|
|
1745
|
+
this._updateIframeUrl();
|
|
1746
|
+
}
|
|
1747
|
+
this.iframeStyle = calculateIframeStyles(this);
|
|
1748
|
+
} else if (triggerProperties.has(propertyName) && propertyName === "editMode") {
|
|
1749
|
+
if (this.iframeLoaded) {
|
|
1750
|
+
this.setEditMode(this.editMode);
|
|
1751
|
+
}
|
|
1752
|
+
this.params = this._setOptions();
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
// Set params
|
|
1758
|
+
_setOptions() {
|
|
1759
|
+
const defaultParameters = {
|
|
1760
|
+
dashboardId: this.dashboardId,
|
|
1761
|
+
dashboardSlug: this.dashboardSlug
|
|
1762
|
+
};
|
|
1763
|
+
if (this.itemId) {
|
|
1764
|
+
defaultParameters.itemId = this.itemId;
|
|
1765
|
+
this._itemEmbedding = true;
|
|
1766
|
+
} else {
|
|
1767
|
+
this._itemEmbedding = false;
|
|
1768
|
+
}
|
|
1769
|
+
if (this.language) {
|
|
1770
|
+
defaultParameters.language = this.language;
|
|
1771
|
+
}
|
|
1772
|
+
if (this.qeVersion) {
|
|
1773
|
+
defaultParameters.qeVersion = this.qeVersion;
|
|
1774
|
+
}
|
|
1775
|
+
if (this.screenMode) {
|
|
1776
|
+
defaultParameters.screenMode = this.screenMode;
|
|
1777
|
+
}
|
|
1778
|
+
defaultParameters.switchScreenModeOnResize = this.switchScreenModeOnResize;
|
|
1779
|
+
if (this.authToken) {
|
|
1780
|
+
defaultParameters.token = this.authToken;
|
|
1781
|
+
}
|
|
1782
|
+
if (this.authKey) {
|
|
1783
|
+
defaultParameters.key = this.authKey;
|
|
1784
|
+
}
|
|
1785
|
+
if (this.editMode) {
|
|
1786
|
+
defaultParameters.editMode = this.editMode;
|
|
1787
|
+
}
|
|
1788
|
+
if (this.mainColor) {
|
|
1789
|
+
defaultParameters.mainColor = this.mainColor;
|
|
1790
|
+
}
|
|
1791
|
+
if (this.accentColor) {
|
|
1792
|
+
defaultParameters.accentColor = this.accentColor;
|
|
1793
|
+
}
|
|
1794
|
+
if (this.loaderBackground) {
|
|
1795
|
+
defaultParameters.loaderBackground = this.loaderBackground;
|
|
1796
|
+
}
|
|
1797
|
+
if (this.loaderFontColor) {
|
|
1798
|
+
defaultParameters.loaderFontColor = this.loaderFontColor;
|
|
1799
|
+
}
|
|
1800
|
+
if (this.loaderSpinnerColor) {
|
|
1801
|
+
defaultParameters.loaderSpinnerColor = this.loaderSpinnerColor;
|
|
1802
|
+
}
|
|
1803
|
+
if (this.loaderSpinnerBackground) {
|
|
1804
|
+
defaultParameters.loaderSpinnerBackground = this.loaderSpinnerBackground;
|
|
1805
|
+
}
|
|
1806
|
+
if (this.timezoneId) {
|
|
1807
|
+
defaultParameters.timezoneId = this.timezoneId;
|
|
1808
|
+
}
|
|
1809
|
+
if (this.itemDimensions) {
|
|
1810
|
+
defaultParameters.itemDimensions = this.itemDimensions;
|
|
1811
|
+
}
|
|
1812
|
+
if (this.appServer) {
|
|
1813
|
+
this.appServer = this.getIsViewMode() ? removeTrailingSlash(this.appServer) : addTrailingSlash(this.appServer);
|
|
1814
|
+
defaultParameters.appServer = this.appServer;
|
|
1815
|
+
} else {
|
|
1816
|
+
this.appServer = addTrailingSlash(
|
|
1817
|
+
DEFAULT_PARAMETERS.appServer
|
|
1818
|
+
);
|
|
1819
|
+
defaultParameters.appServer = this.appServer;
|
|
1820
|
+
}
|
|
1821
|
+
if (this.apiHost) {
|
|
1822
|
+
this.apiHost = this.getIsViewMode() ? removeTrailingSlash(this.apiHost) : addTrailingSlash(this.apiHost);
|
|
1823
|
+
defaultParameters.apiHost = this.apiHost;
|
|
1824
|
+
} else {
|
|
1825
|
+
this.apiHost = this.appServer.includes("luzmo.com") ? this.appServer.replace("app", "api") : this.appServer;
|
|
1826
|
+
defaultParameters.apiHost = this.apiHost;
|
|
1827
|
+
}
|
|
1828
|
+
return defaultParameters;
|
|
1829
|
+
}
|
|
1830
|
+
_updateIframeUrl() {
|
|
1831
|
+
updateIframeUrl(this.iframe, this._iframeUrl);
|
|
1832
|
+
}
|
|
1833
|
+
// Setup loader / browser error
|
|
1834
|
+
_setupLoader() {
|
|
1835
|
+
const data = getLoader(this);
|
|
1836
|
+
this._loaderMsg = data.loadingMsg;
|
|
1837
|
+
if (data.errorMsg) {
|
|
1838
|
+
this.browserError = true;
|
|
1839
|
+
this.browserErrorMsg = data.errorMsg;
|
|
1840
|
+
this._displayError();
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
_displayError() {
|
|
1844
|
+
if (this.dashboardError) {
|
|
1845
|
+
this._loaderStyles();
|
|
1846
|
+
this.iframeStyle.opacity = 1;
|
|
1847
|
+
}
|
|
1848
|
+
if (this.browserError) {
|
|
1849
|
+
this._containerStyle.display = "none";
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
_calculateDimAfterDashboardLoaded() {
|
|
1853
|
+
this.dashboardError = false;
|
|
1854
|
+
this._loaderStyles();
|
|
1855
|
+
_setCalculatedDimensions(this);
|
|
1856
|
+
}
|
|
1857
|
+
// Set loader styles
|
|
1858
|
+
_loaderStyles() {
|
|
1859
|
+
this._containerStyle = containerStyles(this);
|
|
1860
|
+
this._loaderStyle = loaderStyles(this);
|
|
1861
|
+
this._loadingCircleStyle = plStyles(this);
|
|
1862
|
+
this._containerLoaderStyle = containerLoaderStyles(this);
|
|
1863
|
+
this._lcStyle = lcStyles(this);
|
|
1864
|
+
}
|
|
1865
|
+
static get styles() {
|
|
1866
|
+
return [dashboardStyles];
|
|
1867
|
+
}
|
|
1868
|
+
render() {
|
|
1869
|
+
let toBeRenderedHTML = import_lit2.html``;
|
|
1870
|
+
const loader = import_lit2.html`
|
|
1871
|
+
<div
|
|
1872
|
+
class="luzmo-container-loader"
|
|
1873
|
+
id="luzmo-container-loader-${this._containerId}"
|
|
1874
|
+
style=${(0, import_style_map.styleMap)(
|
|
1875
|
+
this._containerLoaderStyle
|
|
1876
|
+
)}
|
|
1877
|
+
>
|
|
1878
|
+
<div
|
|
1879
|
+
class="luzmo-loader"
|
|
1880
|
+
id="luzmo-loader-${this._containerId}"
|
|
1881
|
+
style=${(0, import_style_map.styleMap)(this._loaderStyle)}
|
|
1882
|
+
>
|
|
1883
|
+
<div
|
|
1884
|
+
class="luzmo-lc"
|
|
1885
|
+
style=${(0, import_style_map.styleMap)(this._lcStyle)}
|
|
1886
|
+
>
|
|
1887
|
+
<div
|
|
1888
|
+
class="luzmo-loading-circle"
|
|
1889
|
+
style=${(0, import_style_map.styleMap)(
|
|
1890
|
+
this._loadingCircleStyle
|
|
1891
|
+
)}
|
|
1892
|
+
></div>
|
|
1893
|
+
${this._itemEmbedding ? "" : import_lit2.html`
|
|
1894
|
+
<div
|
|
1895
|
+
class="luzmo-loading-message"
|
|
1896
|
+
style=${(0, import_style_map.styleMap)({ color: this.loaderFontColor })}
|
|
1897
|
+
>
|
|
1898
|
+
${this._loaderMsg}
|
|
1899
|
+
</div>
|
|
1900
|
+
`}
|
|
1901
|
+
</div>
|
|
1902
|
+
</div>
|
|
1903
|
+
</div>
|
|
1904
|
+
`;
|
|
1905
|
+
if (this.getIsViewMode()) {
|
|
1906
|
+
toBeRenderedHTML = this.isLibraryLoaded ? import_lit2.html`
|
|
1907
|
+
${this.dashboardId || this.dashboardSlug ? import_lit2.html`<dashboard-component dashboard-id="${this.params.dashboardId}" app-server="${this.params.appServer}" api-host="${this.params.apiHost}"></dashboard-component>` : import_lit2.html`
|
|
1908
|
+
<div id="luzmo-error-${this._containerId}">
|
|
1909
|
+
<h3 class="luzmo-error">${this.browserErrorMsg}</h3>
|
|
1910
|
+
</div>
|
|
1911
|
+
`}
|
|
1912
|
+
` : import_lit2.html`${loader}`;
|
|
1913
|
+
} else {
|
|
1914
|
+
toBeRenderedHTML = import_lit2.html`
|
|
1915
|
+
${this.dashboardId || this.dashboardSlug ? import_lit2.html`
|
|
1916
|
+
${loader}
|
|
1917
|
+
<iframe
|
|
1918
|
+
class="luzmo-embed-dashboard"
|
|
1919
|
+
id="${this._iframeId}"
|
|
1920
|
+
name="${this._iframeId}"
|
|
1921
|
+
style=${(0, import_style_map.styleMap)(this.iframeStyle)}
|
|
1922
|
+
src="${this._iframeUrl}"
|
|
1923
|
+
frameborder="0"
|
|
1924
|
+
></iframe>
|
|
1925
|
+
` : import_lit2.html`<!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId -->`}
|
|
1926
|
+
${this.browserError ? import_lit2.html`
|
|
1927
|
+
<div id="luzmo-error-${this._containerId}">
|
|
1928
|
+
<h3 class="luzmo-error">${this.browserErrorMsg}</h3>
|
|
1929
|
+
</div>
|
|
1930
|
+
` : ""}
|
|
1931
|
+
`;
|
|
1932
|
+
}
|
|
1933
|
+
return import_lit2.html`
|
|
1934
|
+
<div
|
|
1935
|
+
class="dashboard-container"
|
|
1936
|
+
style=${(0, import_style_map.styleMap)(Object.assign({}, this._containerStyle, {
|
|
1937
|
+
width: this.iframeStyle.width ?? "100%",
|
|
1938
|
+
height: this.iframeStyle.height ?? "100%"
|
|
1939
|
+
}))}
|
|
1940
|
+
>
|
|
1941
|
+
${toBeRenderedHTML}
|
|
1942
|
+
</div>
|
|
1943
|
+
`;
|
|
1944
|
+
}
|
|
1945
|
+
getDashboards() {
|
|
1946
|
+
return new Promise(
|
|
1947
|
+
(resolve) => resolve(luzmo_service_default._components)
|
|
1948
|
+
);
|
|
1949
|
+
}
|
|
1950
|
+
// Public methods
|
|
1951
|
+
getData(itemId) {
|
|
1952
|
+
if (this.getIsViewMode() && this.dashboardReference) {
|
|
1953
|
+
return this.dashboardReference.getData(itemId);
|
|
1954
|
+
}
|
|
1955
|
+
if (!this.getIsViewMode()) {
|
|
1956
|
+
return getData(this, this.iframe, itemId);
|
|
1957
|
+
}
|
|
1958
|
+
return Promise.reject();
|
|
1959
|
+
}
|
|
1960
|
+
getFilters() {
|
|
1961
|
+
if (this.getIsViewMode() && this.dashboardReference) {
|
|
1962
|
+
return this.dashboardReference.getFilters();
|
|
1963
|
+
}
|
|
1964
|
+
if (!this.getIsViewMode()) {
|
|
1965
|
+
return getFilters(this, this.iframe);
|
|
1966
|
+
}
|
|
1967
|
+
return Promise.reject();
|
|
1968
|
+
}
|
|
1969
|
+
setFilters(itemId, filters) {
|
|
1970
|
+
if (this.getIsViewMode() && this.dashboardReference) {
|
|
1971
|
+
return this.dashboardReference.setFilters(itemId, filters);
|
|
1972
|
+
}
|
|
1973
|
+
if (!this.getIsViewMode()) {
|
|
1974
|
+
return setFilters(this, this.iframe, itemId, filters);
|
|
1975
|
+
}
|
|
1976
|
+
return Promise.reject();
|
|
1977
|
+
}
|
|
1978
|
+
setAuthorization(key, token) {
|
|
1979
|
+
if (this.getIsViewMode() && this.dashboardReference) {
|
|
1980
|
+
return this.dashboardReference.setAuthorization(key, token);
|
|
1981
|
+
}
|
|
1982
|
+
if (!this.getIsViewMode()) {
|
|
1983
|
+
return setAuthorization(this, this.iframe, key, token);
|
|
1984
|
+
}
|
|
1985
|
+
return Promise.reject();
|
|
1986
|
+
}
|
|
1987
|
+
refreshData(itemId) {
|
|
1988
|
+
if (this.getIsViewMode() && this.dashboardReference) {
|
|
1989
|
+
return this.dashboardReference.refreshData(itemId);
|
|
1990
|
+
}
|
|
1991
|
+
if (!this.getIsViewMode()) {
|
|
1992
|
+
return itemId ? refreshData(this, this.iframe, itemId) : refreshData(this, this.iframe);
|
|
1993
|
+
}
|
|
1994
|
+
return Promise.reject();
|
|
1995
|
+
}
|
|
1996
|
+
reloadDashboard() {
|
|
1997
|
+
if (this.getIsViewMode() && this.dashboardReference) {
|
|
1998
|
+
return this.dashboardReference.reloadDashboard();
|
|
1999
|
+
}
|
|
2000
|
+
if (!this.getIsViewMode()) {
|
|
2001
|
+
return reloadDashboard(this, this.iframe);
|
|
2002
|
+
}
|
|
2003
|
+
return Promise.reject();
|
|
2004
|
+
}
|
|
2005
|
+
exportDashboard(format) {
|
|
2006
|
+
if (this.getIsViewMode() && this.dashboardReference) {
|
|
2007
|
+
return this.dashboardReference.exportDashboard(format);
|
|
2008
|
+
}
|
|
2009
|
+
if (!this.getIsViewMode()) {
|
|
2010
|
+
return format ? exportDashboard(this, this.iframe, format) : exportDashboard(this, this.iframe);
|
|
2011
|
+
}
|
|
2012
|
+
return Promise.reject();
|
|
2013
|
+
}
|
|
2014
|
+
getAccessibleDashboards() {
|
|
2015
|
+
if (!this.getIsViewMode()) {
|
|
2016
|
+
return getAccessibleDashboards(this, this.iframe);
|
|
2017
|
+
}
|
|
2018
|
+
if (this.getIsViewMode() && this.dashboardReference) {
|
|
2019
|
+
return this.dashboardReference.getAccessibleDashboards();
|
|
2020
|
+
}
|
|
2021
|
+
return Promise.reject();
|
|
2022
|
+
}
|
|
2023
|
+
addFilters(itemId, filters) {
|
|
2024
|
+
return this.dashboardReference.addFilters(itemId, filters);
|
|
2025
|
+
}
|
|
2026
|
+
setEditMode(editMode) {
|
|
2027
|
+
if (this.dashboardReference && editMode === "view") {
|
|
2028
|
+
this.editMode = "view";
|
|
2029
|
+
this.params.editMode = "view";
|
|
2030
|
+
this.initComponent();
|
|
2031
|
+
return Promise.resolve({
|
|
2032
|
+
type: "setEditMode",
|
|
2033
|
+
editMode
|
|
2034
|
+
});
|
|
2035
|
+
}
|
|
2036
|
+
if (this.dashboardReference && ["editFull", "editLimited"].includes(editMode)) {
|
|
2037
|
+
this.editMode = editMode;
|
|
2038
|
+
this.params.editMode = editMode;
|
|
2039
|
+
this.initComponent();
|
|
2040
|
+
return Promise.resolve({
|
|
2041
|
+
type: "setEditMode",
|
|
2042
|
+
editMode
|
|
2043
|
+
});
|
|
2044
|
+
}
|
|
2045
|
+
if (this.getIsViewMode() && this.dashboardReference) {
|
|
2046
|
+
return this.dashboardReference.setEditMode(editMode);
|
|
2047
|
+
}
|
|
2048
|
+
if (!this.getIsViewMode()) {
|
|
2049
|
+
return setEditMode(this, this.iframe, editMode);
|
|
2050
|
+
}
|
|
2051
|
+
return Promise.reject();
|
|
2052
|
+
}
|
|
2053
|
+
setPreview(preview) {
|
|
2054
|
+
if (this.getIsViewMode() && this.dashboardReference) {
|
|
2055
|
+
return this.dashboardReference.setPreview(preview);
|
|
2056
|
+
}
|
|
2057
|
+
return setPreview(this, this.iframe, preview);
|
|
2058
|
+
}
|
|
2059
|
+
getIsViewMode() {
|
|
2060
|
+
if (this.experimental && this.params.editMode === "view" || this.params.editMode === void 0) {
|
|
2061
|
+
return true;
|
|
2062
|
+
}
|
|
2063
|
+
return false;
|
|
2064
|
+
}
|
|
2065
|
+
};
|
|
2066
|
+
__decorateClass([
|
|
2067
|
+
(0, import_decorators.query)(".dashboard-container")
|
|
2068
|
+
], LuzmoDashboard.prototype, "container", 2);
|
|
2069
|
+
__decorateClass([
|
|
2070
|
+
(0, import_decorators.query)("iframe")
|
|
2071
|
+
], LuzmoDashboard.prototype, "iframe", 2);
|
|
2072
|
+
__decorateClass([
|
|
2073
|
+
(0, import_decorators.property)()
|
|
2074
|
+
], LuzmoDashboard.prototype, "dashboardId", 2);
|
|
2075
|
+
__decorateClass([
|
|
2076
|
+
(0, import_decorators.property)()
|
|
2077
|
+
], LuzmoDashboard.prototype, "dashboardSlug", 2);
|
|
2078
|
+
__decorateClass([
|
|
2079
|
+
(0, import_decorators.property)()
|
|
2080
|
+
], LuzmoDashboard.prototype, "itemId", 2);
|
|
2081
|
+
__decorateClass([
|
|
2082
|
+
(0, import_decorators.property)()
|
|
2083
|
+
], LuzmoDashboard.prototype, "language", 2);
|
|
2084
|
+
__decorateClass([
|
|
2085
|
+
(0, import_decorators.property)()
|
|
2086
|
+
], LuzmoDashboard.prototype, "qeVersion", 2);
|
|
2087
|
+
__decorateClass([
|
|
2088
|
+
(0, import_decorators.property)()
|
|
2089
|
+
], LuzmoDashboard.prototype, "screenMode", 2);
|
|
2090
|
+
__decorateClass([
|
|
2091
|
+
(0, import_decorators.property)({
|
|
2092
|
+
converter: {
|
|
2093
|
+
fromAttribute: (value) => value === "true",
|
|
2094
|
+
toAttribute: String
|
|
2095
|
+
}
|
|
2096
|
+
})
|
|
2097
|
+
], LuzmoDashboard.prototype, "switchScreenModeOnResize", 2);
|
|
2098
|
+
__decorateClass([
|
|
2099
|
+
(0, import_decorators.property)()
|
|
2100
|
+
], LuzmoDashboard.prototype, "editMode", 2);
|
|
2101
|
+
__decorateClass([
|
|
2102
|
+
(0, import_decorators.property)()
|
|
2103
|
+
], LuzmoDashboard.prototype, "mainColor", 2);
|
|
2104
|
+
__decorateClass([
|
|
2105
|
+
(0, import_decorators.property)()
|
|
2106
|
+
], LuzmoDashboard.prototype, "accentColor", 2);
|
|
2107
|
+
__decorateClass([
|
|
2108
|
+
(0, import_decorators.property)()
|
|
2109
|
+
], LuzmoDashboard.prototype, "authToken", 2);
|
|
2110
|
+
__decorateClass([
|
|
2111
|
+
(0, import_decorators.property)()
|
|
2112
|
+
], LuzmoDashboard.prototype, "authKey", 2);
|
|
2113
|
+
__decorateClass([
|
|
2114
|
+
(0, import_decorators.property)()
|
|
2115
|
+
], LuzmoDashboard.prototype, "loaderBackground", 2);
|
|
2116
|
+
__decorateClass([
|
|
2117
|
+
(0, import_decorators.property)()
|
|
2118
|
+
], LuzmoDashboard.prototype, "loaderFontColor", 2);
|
|
2119
|
+
__decorateClass([
|
|
2120
|
+
(0, import_decorators.property)()
|
|
2121
|
+
], LuzmoDashboard.prototype, "loaderSpinnerColor", 2);
|
|
2122
|
+
__decorateClass([
|
|
2123
|
+
(0, import_decorators.property)()
|
|
2124
|
+
], LuzmoDashboard.prototype, "loaderSpinnerBackground", 2);
|
|
2125
|
+
__decorateClass([
|
|
2126
|
+
(0, import_decorators.property)()
|
|
2127
|
+
], LuzmoDashboard.prototype, "appServer", 2);
|
|
2128
|
+
__decorateClass([
|
|
2129
|
+
(0, import_decorators.property)()
|
|
2130
|
+
], LuzmoDashboard.prototype, "timezoneId", 2);
|
|
2131
|
+
__decorateClass([
|
|
2132
|
+
(0, import_decorators.property)()
|
|
2133
|
+
], LuzmoDashboard.prototype, "apiHost", 2);
|
|
2134
|
+
__decorateClass([
|
|
2135
|
+
(0, import_decorators.property)({ type: Object })
|
|
2136
|
+
], LuzmoDashboard.prototype, "itemDimensions", 2);
|
|
2137
|
+
__decorateClass([
|
|
2138
|
+
(0, import_decorators.property)()
|
|
2139
|
+
], LuzmoDashboard.prototype, "experimental", 2);
|
|
2140
|
+
__decorateClass([
|
|
2141
|
+
(0, import_decorators.property)({ attribute: false })
|
|
2142
|
+
], LuzmoDashboard.prototype, "_containerId", 2);
|
|
2143
|
+
__decorateClass([
|
|
2144
|
+
(0, import_decorators.property)({ attribute: false })
|
|
2145
|
+
], LuzmoDashboard.prototype, "_iframeId", 2);
|
|
2146
|
+
__decorateClass([
|
|
2147
|
+
(0, import_decorators.property)({ attribute: false })
|
|
2148
|
+
], LuzmoDashboard.prototype, "params", 2);
|
|
2149
|
+
__decorateClass([
|
|
2150
|
+
(0, import_decorators.property)({ attribute: false })
|
|
2151
|
+
], LuzmoDashboard.prototype, "_iframeUrl", 2);
|
|
2152
|
+
__decorateClass([
|
|
2153
|
+
(0, import_decorators.property)({ attribute: false })
|
|
2154
|
+
], LuzmoDashboard.prototype, "iframeLoaded", 2);
|
|
2155
|
+
__decorateClass([
|
|
2156
|
+
(0, import_decorators.property)({ attribute: false })
|
|
2157
|
+
], LuzmoDashboard.prototype, "promises", 2);
|
|
2158
|
+
__decorateClass([
|
|
2159
|
+
(0, import_decorators.property)({ attribute: false })
|
|
2160
|
+
], LuzmoDashboard.prototype, "iframeStyle", 2);
|
|
2161
|
+
__decorateClass([
|
|
2162
|
+
(0, import_decorators.property)({ attribute: false })
|
|
2163
|
+
], LuzmoDashboard.prototype, "_containerStyle", 2);
|
|
2164
|
+
__decorateClass([
|
|
2165
|
+
(0, import_decorators.property)({ attribute: false })
|
|
2166
|
+
], LuzmoDashboard.prototype, "_loaderStyle", 2);
|
|
2167
|
+
__decorateClass([
|
|
2168
|
+
(0, import_decorators.property)({ attribute: false })
|
|
2169
|
+
], LuzmoDashboard.prototype, "_lcStyle", 2);
|
|
2170
|
+
__decorateClass([
|
|
2171
|
+
(0, import_decorators.property)({ attribute: false })
|
|
2172
|
+
], LuzmoDashboard.prototype, "_loadingCircleStyle", 2);
|
|
2173
|
+
__decorateClass([
|
|
2174
|
+
(0, import_decorators.property)({ attribute: false })
|
|
2175
|
+
], LuzmoDashboard.prototype, "_containerLoaderStyle", 2);
|
|
2176
|
+
__decorateClass([
|
|
2177
|
+
(0, import_decorators.property)({ attribute: false })
|
|
2178
|
+
], LuzmoDashboard.prototype, "_loaderMsg", 2);
|
|
2179
|
+
__decorateClass([
|
|
2180
|
+
(0, import_decorators.property)({ attribute: false })
|
|
2181
|
+
], LuzmoDashboard.prototype, "containerWidth", 2);
|
|
2182
|
+
__decorateClass([
|
|
2183
|
+
(0, import_decorators.property)({ attribute: false })
|
|
2184
|
+
], LuzmoDashboard.prototype, "dimensions", 2);
|
|
2185
|
+
__decorateClass([
|
|
2186
|
+
(0, import_decorators.property)({ attribute: false })
|
|
2187
|
+
], LuzmoDashboard.prototype, "currentScreenMode", 2);
|
|
2188
|
+
__decorateClass([
|
|
2189
|
+
(0, import_decorators.property)({ attribute: false })
|
|
2190
|
+
], LuzmoDashboard.prototype, "_itemEmbedding", 2);
|
|
2191
|
+
__decorateClass([
|
|
2192
|
+
(0, import_decorators.property)({ attribute: false })
|
|
2193
|
+
], LuzmoDashboard.prototype, "browserError", 2);
|
|
2194
|
+
__decorateClass([
|
|
2195
|
+
(0, import_decorators.property)({ attribute: false })
|
|
2196
|
+
], LuzmoDashboard.prototype, "browserErrorMsg", 2);
|
|
2197
|
+
__decorateClass([
|
|
2198
|
+
(0, import_decorators.property)({ attribute: false })
|
|
2199
|
+
], LuzmoDashboard.prototype, "dashboardError", 2);
|
|
2200
|
+
__decorateClass([
|
|
2201
|
+
(0, import_decorators.property)({ attribute: false })
|
|
2202
|
+
], LuzmoDashboard.prototype, "browserNotSupported", 2);
|
|
2203
|
+
__decorateClass([
|
|
2204
|
+
(0, import_decorators.property)({ attribute: false })
|
|
2205
|
+
], LuzmoDashboard.prototype, "VERSION", 2);
|
|
2206
|
+
__decorateClass([
|
|
2207
|
+
(0, import_decorators.state)()
|
|
2208
|
+
], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
|
|
2209
|
+
__decorateClass([
|
|
2210
|
+
(0, import_decorators.state)()
|
|
2211
|
+
], LuzmoDashboard.prototype, "dashboardReference", 2);
|
|
2212
|
+
LuzmoDashboard = __decorateClass([
|
|
2213
|
+
(0, import_decorators.customElement)("luzmo-dashboard")
|
|
2214
|
+
], LuzmoDashboard);
|
|
2215
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2216
|
+
0 && (module.exports = {
|
|
2217
|
+
LuzmoDashboard
|
|
2218
|
+
});
|