@luzmo/embed 6.2.2 → 6.2.4-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/index.cjs +1620 -0
- package/index.js +1589 -0
- package/luzmo-embed.min.js +3676 -0
- package/package.json +2 -2
- package/src/index.d.ts +8 -0
- package/src/lib/dashboard-component/dashboard-base.d.ts +99 -0
- package/src/lib/dashboard-component/dashboard-component.d.ts +8 -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/helper/json-schema-utils.d.ts +64 -0
- package/src/lib/luzmo-iq-components/luzmo-iq-answer.d.ts +22 -0
- package/src/lib/luzmo-iq-components/luzmo-iq-chat.d.ts +24 -0
- package/src/lib/luzmo-service.d.ts +6 -0
- package/src/lib/viz-item/viz-item-component.d.ts +4 -0
- package/src/lib/viz-item/viz-item.base.d.ts +71 -0
- package/.prettierignore +0 -4
- package/esbuild.config.cjs +0 -13
- package/eslint.config.cjs +0 -8
- package/jest.config.ts +0 -11
- package/project.json +0 -39
- package/src/index.ts +0 -42
- package/src/lib/dashboard-component/dashboard-base.ts +0 -828
- package/src/lib/dashboard-component/dashboard-component.spec.ts +0 -27
- package/src/lib/dashboard-component/dashboard-component.ts +0 -12
- package/src/lib/dashboard-component/dashboard-styles.ts +0 -117
- package/src/lib/helper/event-bus-handler.ts +0 -195
- package/src/lib/helper/json-schema-utils.ts +0 -129
- package/src/lib/luzmo-iq-components/luzmo-iq-answer.ts +0 -106
- package/src/lib/luzmo-iq-components/luzmo-iq-chat.ts +0 -106
- package/src/lib/luzmo-service.ts +0 -7
- package/src/lib/viz-item/viz-item-component.ts +0 -9
- package/src/lib/viz-item/viz-item.base.ts +0 -227
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.json +0 -27
- package/tsconfig.lib.json +0 -10
- package/tsconfig.spec.json +0 -9
|
@@ -0,0 +1,3676 @@
|
|
|
1
|
+
(function(g,f){if(typeof define=="function"&&define.amd){define(f)}else if(typeof exports=="object" && typeof module<"u"){module.exports=f()}else{var m=f();for(var i in m) g[i]=m[i]}}(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : this,function(){var exports={};var __exports=exports;var module={exports};
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
21
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
22
|
+
for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
|
|
23
|
+
if (decorator = decorators[i4])
|
|
24
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
25
|
+
if (kind && result)
|
|
26
|
+
__defProp(target, key, result);
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// libs/embed-libs/embed/src/index.ts
|
|
31
|
+
var src_exports2 = {};
|
|
32
|
+
__export(src_exports2, {
|
|
33
|
+
LuzmoEmbedDashboard: () => LuzmoEmbedDashboard,
|
|
34
|
+
LuzmoEmbedVizItem: () => LuzmoEmbedVizItem,
|
|
35
|
+
LuzmoIQEmbedAnswerComponent: () => LuzmoIQEmbedAnswerComponent,
|
|
36
|
+
LuzmoIQEmbedChatComponent: () => LuzmoIQEmbedChatComponent,
|
|
37
|
+
addJSONSchemas: () => addJSONSchemas,
|
|
38
|
+
fetchJSONSchema: () => fetchJSONSchema,
|
|
39
|
+
getCachedJSONSchema: () => getCachedJSONSchema,
|
|
40
|
+
getCachedJSONSchemas: () => getCachedJSONSchemas,
|
|
41
|
+
getJSONSchemaUrl: () => getJSONSchemaUrl,
|
|
42
|
+
luzmoRefParserOptions: () => luzmoRefParserOptions,
|
|
43
|
+
selectedDataUtils: () => selectedDataUtils
|
|
44
|
+
});
|
|
45
|
+
module.exports = __toCommonJS(src_exports2);
|
|
46
|
+
|
|
47
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/error.ts
|
|
48
|
+
var _handleError = (errorMessage, parameters) => {
|
|
49
|
+
let message = "The dashboard component encountered an error";
|
|
50
|
+
if (typeof parameters?.dashboardId === "string") {
|
|
51
|
+
message += ` for dashboard with id ${parameters.dashboardId}`;
|
|
52
|
+
}
|
|
53
|
+
if (typeof parameters?.dashboardSlug === "string") {
|
|
54
|
+
message += ` for dashboard with slug ${parameters.dashboardSlug}`;
|
|
55
|
+
}
|
|
56
|
+
if (typeof parameters?.container === "string") {
|
|
57
|
+
message += ` in container ${parameters.container}`;
|
|
58
|
+
}
|
|
59
|
+
if (errorMessage) {
|
|
60
|
+
message += `:
|
|
61
|
+
${errorMessage}`;
|
|
62
|
+
console.warn(message);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/browser-check.ts
|
|
67
|
+
var _browserCheck = (dashboardComponent) => {
|
|
68
|
+
let hasError = false;
|
|
69
|
+
let errorMessage = "";
|
|
70
|
+
const document_ = document.body || document.documentElement;
|
|
71
|
+
const style = document_.style;
|
|
72
|
+
const browserCheck = {
|
|
73
|
+
svg: !!("createElementNS" in document && document.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGRect),
|
|
74
|
+
flexbox: style.webkitFlexWrap === "" || style.flexWrap === "",
|
|
75
|
+
postMessage: !!window.postMessage
|
|
76
|
+
};
|
|
77
|
+
const browserCheckKeys = ["svg", "flexbox", "postMessage"];
|
|
78
|
+
for (const key of browserCheckKeys) {
|
|
79
|
+
if (!browserCheck[key]) {
|
|
80
|
+
hasError = true;
|
|
81
|
+
dashboardComponent.browserNotSupported = dashboardComponent.browserNotSupported || [];
|
|
82
|
+
dashboardComponent.browserNotSupported.push(key);
|
|
83
|
+
errorMessage += `Your browser does not support: ${key}
|
|
84
|
+
`;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const ua = window.navigator.userAgent;
|
|
88
|
+
const msie = ua.includes("MSIE");
|
|
89
|
+
const trident = ua.includes("Trident/");
|
|
90
|
+
if (msie || trident) {
|
|
91
|
+
hasError = true;
|
|
92
|
+
errorMessage = "IE is not supported.";
|
|
93
|
+
}
|
|
94
|
+
if (hasError) {
|
|
95
|
+
_handleError(errorMessage);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/default-parameters.ts
|
|
100
|
+
var DEFAULT_PARAMETERS = {
|
|
101
|
+
appServer: "https://app.luzmo.com/",
|
|
102
|
+
apiHost: "https://api.luzmo.com/",
|
|
103
|
+
dashboardId: null,
|
|
104
|
+
dashboardSlug: null,
|
|
105
|
+
container: null,
|
|
106
|
+
key: null,
|
|
107
|
+
token: null,
|
|
108
|
+
language: "auto",
|
|
109
|
+
qeVersion: null,
|
|
110
|
+
editMode: null,
|
|
111
|
+
screenMode: null,
|
|
112
|
+
switchScreenModeOnResize: true,
|
|
113
|
+
itemId: null,
|
|
114
|
+
theme: "",
|
|
115
|
+
mainColor: "",
|
|
116
|
+
accentColor: "",
|
|
117
|
+
itemDimensions: {
|
|
118
|
+
width: "auto",
|
|
119
|
+
height: "auto"
|
|
120
|
+
},
|
|
121
|
+
loaderBackground: "#f9f9f9",
|
|
122
|
+
loaderFontColor: "#5a5a5a",
|
|
123
|
+
loaderSpinnerColor: "rgba(255, 165, 0, 0.7)",
|
|
124
|
+
loaderSpinnerBackground: "rgba(169, 169, 169, 0.14)",
|
|
125
|
+
timezoneId: null,
|
|
126
|
+
contextId: null
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/extents.ts
|
|
130
|
+
var EXTENTS = [
|
|
131
|
+
{ mode: "mobile", width: [150, 767] },
|
|
132
|
+
{ mode: "tablet", width: [768, 1199] },
|
|
133
|
+
{ mode: "desktop", width: [1200, 1599] },
|
|
134
|
+
{ mode: "largeScreen", width: [1600, 9999] },
|
|
135
|
+
{ mode: "fixed", width: [] }
|
|
136
|
+
];
|
|
137
|
+
|
|
138
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/translations.ts
|
|
139
|
+
var TRANSLATIONS = {
|
|
140
|
+
initializing: {
|
|
141
|
+
en: "Initializing...",
|
|
142
|
+
nl: "Laden...",
|
|
143
|
+
fr: "Chargement...",
|
|
144
|
+
de: "Initialisiere...",
|
|
145
|
+
es: "Inicializando..."
|
|
146
|
+
},
|
|
147
|
+
errorDashboard: {
|
|
148
|
+
en: "Oops, we could not load this dashboard!",
|
|
149
|
+
nl: "Oeps, we konden het dashboard niet laden.",
|
|
150
|
+
fr: "Le chargement a echou\xE9.",
|
|
151
|
+
de: "Hoppla, wir konnten dieses Dashboard nicht laden!",
|
|
152
|
+
es: "\xA1Ups! No pudimos cargar este tablero."
|
|
153
|
+
},
|
|
154
|
+
errorItem: {
|
|
155
|
+
en: "Oops, we could not load this item!",
|
|
156
|
+
nl: "Oeps, we konden de grafiek niet laden.",
|
|
157
|
+
fr: "Le chargement a echou\xE9.",
|
|
158
|
+
de: "Hoppla, wir konnten dieses Diagramm nicht laden!",
|
|
159
|
+
es: "\xA1Ups! No pudimos cargar este elemento."
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
var translations_default = TRANSLATIONS;
|
|
163
|
+
|
|
164
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/utils.ts
|
|
165
|
+
var addTrailingSlash = (serverUrl) => {
|
|
166
|
+
if (!serverUrl) {
|
|
167
|
+
return "";
|
|
168
|
+
}
|
|
169
|
+
return serverUrl.endsWith("/") ? serverUrl : `${serverUrl}/`;
|
|
170
|
+
};
|
|
171
|
+
var removeTrailingSlash = (serverUrl) => {
|
|
172
|
+
if (!serverUrl) {
|
|
173
|
+
return "";
|
|
174
|
+
}
|
|
175
|
+
return serverUrl.endsWith("/") ? serverUrl.slice(0, -1) : serverUrl;
|
|
176
|
+
};
|
|
177
|
+
var formatDashboardList = (dashboards, integrationId, user, dashboardComponent) => {
|
|
178
|
+
const combineRights = (securable, user2) => {
|
|
179
|
+
const matchingUser = securable.users.find((u2) => u2.id === user2.id);
|
|
180
|
+
const securableAccessRights = matchingUser && matchingUser.userAccessRight ? {
|
|
181
|
+
flagRead: matchingUser.userAccessRight.flagRead,
|
|
182
|
+
flagUse: matchingUser.userAccessRight.flagUse,
|
|
183
|
+
flagModify: matchingUser.userAccessRight.flagModify,
|
|
184
|
+
flagOwn: matchingUser.userAccessRight.flagOwn
|
|
185
|
+
} : {
|
|
186
|
+
flagRead: false,
|
|
187
|
+
flagUse: false,
|
|
188
|
+
flagModify: false,
|
|
189
|
+
flagOwn: false
|
|
190
|
+
};
|
|
191
|
+
const groups = securable.groups.filter(
|
|
192
|
+
(group) => user2.userGroups.includes(group.id) || group.public === true
|
|
193
|
+
);
|
|
194
|
+
const groupsAccess = groups.map((group) => {
|
|
195
|
+
if (group.groupAccessRight) {
|
|
196
|
+
return group.groupAccessRight;
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
for (const groupAccess of groupsAccess) {
|
|
200
|
+
if (!securableAccessRights.flagRead && groupAccess.flagRead) {
|
|
201
|
+
securableAccessRights.flagRead = groupAccess.flagRead;
|
|
202
|
+
}
|
|
203
|
+
if (!securableAccessRights.flagUse && groupAccess.flagUse) {
|
|
204
|
+
securableAccessRights.flagUse = groupAccess.flagUse;
|
|
205
|
+
}
|
|
206
|
+
if (!securableAccessRights.flagModify && groupAccess.flagModify) {
|
|
207
|
+
securableAccessRights.flagModify = groupAccess.flagModify;
|
|
208
|
+
}
|
|
209
|
+
if (!securableAccessRights.flagOwn && groupAccess.flagOwn) {
|
|
210
|
+
securableAccessRights.flagOwn = groupAccess.flagOwn;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
const integrationsAccess = securable.integrations?.length > 0 ? securable.integrations.map((integration) => {
|
|
214
|
+
if (integration.integrationAccessRight) {
|
|
215
|
+
return integration.integrationAccessRight;
|
|
216
|
+
}
|
|
217
|
+
}) : [];
|
|
218
|
+
for (const integrationAccess of integrationsAccess) {
|
|
219
|
+
if (!securableAccessRights.flagRead && integrationAccess.flagRead) {
|
|
220
|
+
securableAccessRights.flagRead = integrationAccess.flagRead;
|
|
221
|
+
}
|
|
222
|
+
if (!securableAccessRights.flagUse && integrationAccess.flagUse) {
|
|
223
|
+
securableAccessRights.flagUse = integrationAccess.flagUse;
|
|
224
|
+
}
|
|
225
|
+
if (!securableAccessRights.flagModify && integrationAccess.flagModify) {
|
|
226
|
+
securableAccessRights.flagModify = integrationAccess.flagModify;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return securableAccessRights;
|
|
230
|
+
};
|
|
231
|
+
const localize = (item, locale) => {
|
|
232
|
+
if (item === null || item === void 0) {
|
|
233
|
+
return "";
|
|
234
|
+
}
|
|
235
|
+
if (typeof item !== "object" || Object.keys(item).length === 0) {
|
|
236
|
+
if (typeof item === "object" && Object.keys(item).length === 0) {
|
|
237
|
+
return "";
|
|
238
|
+
}
|
|
239
|
+
return item;
|
|
240
|
+
}
|
|
241
|
+
let localizedItem;
|
|
242
|
+
localizedItem = locale && item[locale] ? item[locale] : item[Object.keys(item)[0]];
|
|
243
|
+
if (localizedItem === void 0 || localizedItem === null) {
|
|
244
|
+
localizedItem = "";
|
|
245
|
+
}
|
|
246
|
+
return localizedItem;
|
|
247
|
+
};
|
|
248
|
+
const treatedDashboards = [];
|
|
249
|
+
for (const dashboard of dashboards) {
|
|
250
|
+
const treatedDashboard = {
|
|
251
|
+
accessibleBy: [],
|
|
252
|
+
accessRights: combineRights(dashboard, user),
|
|
253
|
+
id: dashboard.id,
|
|
254
|
+
modifiedAt: dashboard.modified_at,
|
|
255
|
+
name: localize(dashboard.name, dashboardComponent.language),
|
|
256
|
+
slug: null,
|
|
257
|
+
tags: dashboard.tags.map((t3) => t3.tag).sort((t1, t22) => t1.localeCompare(t22))
|
|
258
|
+
};
|
|
259
|
+
const currentIntegration = dashboard.integrations.find(
|
|
260
|
+
(i4) => i4.id === integrationId
|
|
261
|
+
);
|
|
262
|
+
if (currentIntegration?.integrationAccessRight?.slug) {
|
|
263
|
+
treatedDashboard.slug = currentIntegration.integrationAccessRight.slug;
|
|
264
|
+
}
|
|
265
|
+
const users = dashboard.users.map((u2) => ({
|
|
266
|
+
model: "User",
|
|
267
|
+
id: u2.id,
|
|
268
|
+
name: localize(u2.name, user.locale_id)
|
|
269
|
+
}));
|
|
270
|
+
const groups = dashboard.groups.map((g2) => ({
|
|
271
|
+
model: "Group",
|
|
272
|
+
id: g2.id,
|
|
273
|
+
name: localize(g2.name, user.locale_id) || {}
|
|
274
|
+
}));
|
|
275
|
+
const integrations = dashboard.integrations.map((i4) => ({
|
|
276
|
+
model: "Integration",
|
|
277
|
+
id: i4.id,
|
|
278
|
+
name: localize(i4.name, user.locale_id) || {}
|
|
279
|
+
}));
|
|
280
|
+
treatedDashboard.accessibleBy = [...users, ...groups, ...integrations];
|
|
281
|
+
treatedDashboards.push(treatedDashboard);
|
|
282
|
+
}
|
|
283
|
+
return treatedDashboards;
|
|
284
|
+
};
|
|
285
|
+
var VERSION = "0.0.0-unknown-luzmo";
|
|
286
|
+
var sanitizeUrl = (url) => {
|
|
287
|
+
const invalidPrototcolRegex = /^(%20|\s)*(javascript|data)/im;
|
|
288
|
+
const ctrlCharactersRegex = /[^\u0020-\u007E]/gim;
|
|
289
|
+
const urlSchemeRegex = /^([^:]+):/gm;
|
|
290
|
+
const relativeFirstCharacters = /* @__PURE__ */ new Set([".", "/"]);
|
|
291
|
+
const isRelativeUrlWithoutProtocol = (relativeUrl) => relativeFirstCharacters.has(relativeUrl[0]);
|
|
292
|
+
if (!url) {
|
|
293
|
+
return "about:blank";
|
|
294
|
+
}
|
|
295
|
+
const sanitizedUrl = url.replaceAll(ctrlCharactersRegex, "").trim();
|
|
296
|
+
if (isRelativeUrlWithoutProtocol(sanitizedUrl)) {
|
|
297
|
+
return sanitizedUrl;
|
|
298
|
+
}
|
|
299
|
+
const urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex);
|
|
300
|
+
if (!urlSchemeParseResults) {
|
|
301
|
+
return sanitizedUrl;
|
|
302
|
+
}
|
|
303
|
+
const urlScheme = urlSchemeParseResults[0];
|
|
304
|
+
if (invalidPrototcolRegex.test(urlScheme)) {
|
|
305
|
+
return "about:blank";
|
|
306
|
+
}
|
|
307
|
+
return sanitizedUrl;
|
|
308
|
+
};
|
|
309
|
+
var cloneDeep = (obj) => JSON.parse(JSON.stringify(obj));
|
|
310
|
+
var isObject = (o4) => o4 && typeof o4 === "object";
|
|
311
|
+
var defaultsDeep = (target, defaults) => {
|
|
312
|
+
Object.entries(defaults).forEach(([k2, v2]) => {
|
|
313
|
+
if (k2 in target) {
|
|
314
|
+
if (target[k2] === void 0) {
|
|
315
|
+
target[k2] = v2;
|
|
316
|
+
} else {
|
|
317
|
+
target[k2] = isObject(v2) ? defaultsDeep(
|
|
318
|
+
target[k2],
|
|
319
|
+
v2
|
|
320
|
+
) : target[k2];
|
|
321
|
+
}
|
|
322
|
+
} else {
|
|
323
|
+
target[k2] = v2;
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
return target;
|
|
327
|
+
};
|
|
328
|
+
var uuidv4 = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g, function(c4) {
|
|
329
|
+
const r5 = Math.random() * 16 | 0;
|
|
330
|
+
const v2 = c4 == "x" ? r5 : r5 & 3 | 8;
|
|
331
|
+
return v2.toString(16);
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/iframe-url.ts
|
|
335
|
+
var createIframeUrl = (dashboardContent) => {
|
|
336
|
+
const searchString = [];
|
|
337
|
+
const {
|
|
338
|
+
appServer,
|
|
339
|
+
language,
|
|
340
|
+
qeVersion,
|
|
341
|
+
loaderBackground,
|
|
342
|
+
loaderSpinnerColor,
|
|
343
|
+
loaderSpinnerBackground,
|
|
344
|
+
loaderFontColor,
|
|
345
|
+
screenMode,
|
|
346
|
+
key,
|
|
347
|
+
token,
|
|
348
|
+
timezoneId,
|
|
349
|
+
itemEmbedding,
|
|
350
|
+
itemDimensions,
|
|
351
|
+
dashboardId,
|
|
352
|
+
dashboardSlug,
|
|
353
|
+
itemId,
|
|
354
|
+
theme,
|
|
355
|
+
mainColor,
|
|
356
|
+
accentColor,
|
|
357
|
+
editMode
|
|
358
|
+
} = dashboardContent.params;
|
|
359
|
+
if (language && language !== "auto") {
|
|
360
|
+
searchString.push("language=" + language);
|
|
361
|
+
}
|
|
362
|
+
if (qeVersion) {
|
|
363
|
+
searchString.push(`qe_version=${qeVersion}`);
|
|
364
|
+
}
|
|
365
|
+
if (loaderBackground) {
|
|
366
|
+
searchString.push(`ldrbg=${loaderBackground}`);
|
|
367
|
+
}
|
|
368
|
+
if (loaderFontColor) {
|
|
369
|
+
searchString.push(`ldrftclr=${loaderFontColor}`);
|
|
370
|
+
}
|
|
371
|
+
if (loaderSpinnerColor) {
|
|
372
|
+
searchString.push(`ldrspclr=${loaderSpinnerColor}`);
|
|
373
|
+
}
|
|
374
|
+
if (loaderSpinnerBackground) {
|
|
375
|
+
searchString.push(`ldrspbg=${loaderSpinnerBackground}`);
|
|
376
|
+
}
|
|
377
|
+
if (theme) {
|
|
378
|
+
searchString.push(`theme=${theme}`);
|
|
379
|
+
}
|
|
380
|
+
if (mainColor) {
|
|
381
|
+
searchString.push(`mainColor=${mainColor}`);
|
|
382
|
+
}
|
|
383
|
+
if (accentColor) {
|
|
384
|
+
searchString.push(`accentColor=${accentColor}`);
|
|
385
|
+
}
|
|
386
|
+
if (screenMode && screenMode !== "auto") {
|
|
387
|
+
searchString.push("screenMode=" + screenMode);
|
|
388
|
+
}
|
|
389
|
+
if (timezoneId) {
|
|
390
|
+
searchString.push("timezoneId=" + timezoneId);
|
|
391
|
+
}
|
|
392
|
+
if (itemEmbedding && itemDimensions && itemDimensions.width) {
|
|
393
|
+
searchString.push("width=" + itemDimensions.width);
|
|
394
|
+
}
|
|
395
|
+
if (itemEmbedding && itemDimensions && itemDimensions.height) {
|
|
396
|
+
searchString.push("height=" + itemDimensions.height);
|
|
397
|
+
}
|
|
398
|
+
if (editMode) {
|
|
399
|
+
searchString.push("editMode=" + editMode);
|
|
400
|
+
}
|
|
401
|
+
const keyTokenUrlAnchor = key && token ? "#" + key + ":" + token : "";
|
|
402
|
+
searchString.push("version=" + (dashboardContent.libVersion || VERSION));
|
|
403
|
+
const iframeUrl = itemEmbedding ? `${appServer}i/${dashboardId || dashboardSlug}/${itemId}?${encodeURIComponent(
|
|
404
|
+
searchString.join("&")
|
|
405
|
+
)}${keyTokenUrlAnchor}` : `${appServer}i/${dashboardId || dashboardSlug}?${encodeURIComponent(
|
|
406
|
+
searchString.join("&")
|
|
407
|
+
)}${keyTokenUrlAnchor}`;
|
|
408
|
+
return sanitizeUrl(iframeUrl);
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/get-loader.ts
|
|
412
|
+
var getLoader = (dashboardComponent) => {
|
|
413
|
+
let errorMsg;
|
|
414
|
+
if (dashboardComponent.params.error || dashboardComponent.browserNotSupported.length > 0) {
|
|
415
|
+
dashboardComponent.params.error = true;
|
|
416
|
+
if (dashboardComponent.browserNotSupported) {
|
|
417
|
+
errorMsg = "Browser is not supported.";
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
const loadingMsg = translations_default.initializing[dashboardComponent.params.language] || translations_default.initializing.en;
|
|
421
|
+
return dashboardComponent.browserNotSupported || dashboardComponent.params.error ? { loadingMsg, errorMsg } : { loadingMsg, errorMsg: "" };
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/promise-dispatch.ts
|
|
425
|
+
function resolvePromise(dashboardComponent, requestId, data) {
|
|
426
|
+
if (dashboardComponent.promises[requestId]) {
|
|
427
|
+
dashboardComponent.promises[requestId].resolve(data);
|
|
428
|
+
delete dashboardComponent.promises[requestId];
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
function rejectPromise(dashboardComponent, requestId, data) {
|
|
432
|
+
if (dashboardComponent.promises[requestId]) {
|
|
433
|
+
dashboardComponent.promises[requestId].reject(data);
|
|
434
|
+
delete dashboardComponent.promises[requestId];
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/styles.ts
|
|
439
|
+
function containerStyles(dashboardComponent) {
|
|
440
|
+
const styles = {};
|
|
441
|
+
if (dashboardComponent.params.loaderBackground && !dashboardComponent.iframeLoaded) {
|
|
442
|
+
styles.background = dashboardComponent.params.loaderBackground;
|
|
443
|
+
}
|
|
444
|
+
return styles;
|
|
445
|
+
}
|
|
446
|
+
function containerLoaderStyles(dashboardComponent) {
|
|
447
|
+
const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
448
|
+
const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
|
|
449
|
+
const display = dashboardComponent.iframeLoaded ? "none" : "";
|
|
450
|
+
return {
|
|
451
|
+
display,
|
|
452
|
+
height: `${chartHeightDefined ? height : dashboardComponent.minHeight}px`
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
function loaderStyles(dashboardComponent) {
|
|
456
|
+
const background = dashboardComponent.params.loaderBackground || DEFAULT_PARAMETERS.loaderBackground;
|
|
457
|
+
if (dashboardComponent.params.itemEmbedding) {
|
|
458
|
+
dashboardComponent.loaderSize = 24;
|
|
459
|
+
dashboardComponent.borderWidth = 4;
|
|
460
|
+
dashboardComponent.minHeight = 200;
|
|
461
|
+
const width = dashboardComponent.params.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
|
|
462
|
+
const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
463
|
+
const chartWidthDefined = width !== "auto";
|
|
464
|
+
const chartHeightDefined = height !== "auto";
|
|
465
|
+
return {
|
|
466
|
+
background,
|
|
467
|
+
width: chartWidthDefined ? `${width}px` : "100%",
|
|
468
|
+
height: `${chartHeightDefined ? height : "200"}px`,
|
|
469
|
+
"min-height": chartHeightDefined ? "" : "200px"
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
return {
|
|
473
|
+
background
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
function plStyles(dashboardComponent) {
|
|
477
|
+
const {
|
|
478
|
+
loaderSpinnerColor: defaultSpinnerColor,
|
|
479
|
+
loaderSpinnerBackground: defaultSpinnerBackground
|
|
480
|
+
} = DEFAULT_PARAMETERS;
|
|
481
|
+
const spinnerColorBorder = generateBorderStyle(
|
|
482
|
+
dashboardComponent.borderWidth,
|
|
483
|
+
dashboardComponent.params.loaderSpinnerColor || defaultSpinnerColor
|
|
484
|
+
);
|
|
485
|
+
const spinnerBackgroundBorder = generateBorderStyle(
|
|
486
|
+
dashboardComponent.borderWidth,
|
|
487
|
+
dashboardComponent.params.loaderSpinnerBackground || defaultSpinnerBackground
|
|
488
|
+
);
|
|
489
|
+
const size = `${dashboardComponent.loaderSize}px`;
|
|
490
|
+
return {
|
|
491
|
+
"border-top": spinnerColorBorder,
|
|
492
|
+
"border-right": spinnerColorBorder,
|
|
493
|
+
"border-bottom": spinnerBackgroundBorder,
|
|
494
|
+
"border-left": spinnerBackgroundBorder,
|
|
495
|
+
width: size,
|
|
496
|
+
height: size
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
function lcStyles(dashboardComponent) {
|
|
500
|
+
const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
501
|
+
const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
|
|
502
|
+
const getPaddingStr = (value) => `${(value - dashboardComponent.loaderSize - 32) / 2}px`;
|
|
503
|
+
const verticalPadding = dashboardComponent.params.itemId ? chartHeightDefined ? getPaddingStr(Number.parseInt(`${height}`, 10)) : getPaddingStr(dashboardComponent.minHeight) : "128px";
|
|
504
|
+
return {
|
|
505
|
+
padding: `${verticalPadding} 16px`
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
function calculateIframeStyles(dashboardComponent) {
|
|
509
|
+
const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
510
|
+
const width = dashboardComponent.params.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
|
|
511
|
+
if (dashboardComponent.params.itemEmbedding && height !== "auto") {
|
|
512
|
+
dashboardComponent.iframeHeight = `${height}px`;
|
|
513
|
+
} else if (dashboardComponent.params.itemEmbedding) {
|
|
514
|
+
dashboardComponent.iframeHeight = "200px";
|
|
515
|
+
} else if (["editFull", "editLimited"].includes(dashboardComponent.params.editMode)) {
|
|
516
|
+
dashboardComponent.iframeHeight = "100%";
|
|
517
|
+
} else {
|
|
518
|
+
dashboardComponent.iframeHeight = "400px";
|
|
519
|
+
}
|
|
520
|
+
dashboardComponent.iframeWidth = dashboardComponent.params.itemEmbedding && width !== "auto" ? `${width}px` : "100%";
|
|
521
|
+
const styles = {
|
|
522
|
+
height: dashboardComponent.iframeHeight,
|
|
523
|
+
width: dashboardComponent.iframeWidth
|
|
524
|
+
};
|
|
525
|
+
if (dashboardComponent.iframeLoaded) {
|
|
526
|
+
styles.opacity = 1;
|
|
527
|
+
} else if (dashboardComponent.error) {
|
|
528
|
+
styles.opacity = 1;
|
|
529
|
+
styles.width = "100%";
|
|
530
|
+
styles.height = "400px";
|
|
531
|
+
} else {
|
|
532
|
+
styles.opacity = 0;
|
|
533
|
+
}
|
|
534
|
+
return styles;
|
|
535
|
+
}
|
|
536
|
+
function generateBorderStyle(borderWidth, color) {
|
|
537
|
+
return `${borderWidth}px solid ${color}`;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/update-iframe-url.ts
|
|
541
|
+
var updateIframeUrl = (iframe, iframeUrl) => {
|
|
542
|
+
if (iframe?.contentWindow) {
|
|
543
|
+
iframe.contentWindow.location.replace(iframeUrl);
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/set-selected-data-utils.ts
|
|
548
|
+
var selectedDataUtils = {
|
|
549
|
+
merge(...filters) {
|
|
550
|
+
return filters.reduce((acc, filter) => {
|
|
551
|
+
acc.and.push(...filter.and);
|
|
552
|
+
return acc;
|
|
553
|
+
}, {
|
|
554
|
+
and: []
|
|
555
|
+
});
|
|
556
|
+
},
|
|
557
|
+
isIn(slot, values, otherOptions) {
|
|
558
|
+
return {
|
|
559
|
+
and: [{
|
|
560
|
+
expression: "? in ?",
|
|
561
|
+
parameters: [
|
|
562
|
+
{
|
|
563
|
+
slot,
|
|
564
|
+
...otherOptions
|
|
565
|
+
},
|
|
566
|
+
values
|
|
567
|
+
]
|
|
568
|
+
}]
|
|
569
|
+
};
|
|
570
|
+
},
|
|
571
|
+
between(slot, values, otherOptions) {
|
|
572
|
+
return {
|
|
573
|
+
and: [{
|
|
574
|
+
expression: "? between ?",
|
|
575
|
+
parameters: [
|
|
576
|
+
{
|
|
577
|
+
slot,
|
|
578
|
+
...otherOptions
|
|
579
|
+
},
|
|
580
|
+
[values[0], values[1]]
|
|
581
|
+
]
|
|
582
|
+
}]
|
|
583
|
+
};
|
|
584
|
+
},
|
|
585
|
+
range(slot, values, otherOptions) {
|
|
586
|
+
const expressions = otherOptions?.expressions ?? ["? >= ?", "? < ?"];
|
|
587
|
+
return {
|
|
588
|
+
and: [{
|
|
589
|
+
expression: expressions[0],
|
|
590
|
+
parameters: [
|
|
591
|
+
{
|
|
592
|
+
slot,
|
|
593
|
+
...otherOptions
|
|
594
|
+
},
|
|
595
|
+
[values[0]]
|
|
596
|
+
]
|
|
597
|
+
}, {
|
|
598
|
+
expression: expressions[1],
|
|
599
|
+
parameters: [
|
|
600
|
+
{
|
|
601
|
+
slot,
|
|
602
|
+
...otherOptions
|
|
603
|
+
},
|
|
604
|
+
[values[1]]
|
|
605
|
+
]
|
|
606
|
+
}]
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
};
|
|
610
|
+
|
|
611
|
+
// libs/embed-libs/shared-embed/src/lib/methods/export-dashboard.ts
|
|
612
|
+
var exportDashboard = (dashboardComponent, iframe, format) => {
|
|
613
|
+
const requestId = uuidv4();
|
|
614
|
+
if (iframe?.contentWindow) {
|
|
615
|
+
iframe.contentWindow.postMessage(
|
|
616
|
+
{
|
|
617
|
+
action: "exportDashboard",
|
|
618
|
+
format: format || "png",
|
|
619
|
+
_version: dashboardComponent.libVersion,
|
|
620
|
+
requestId
|
|
621
|
+
},
|
|
622
|
+
"*"
|
|
623
|
+
);
|
|
624
|
+
return new Promise((resolve, reject) => {
|
|
625
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
626
|
+
setTimeout(() => {
|
|
627
|
+
if (dashboardComponent.promises[requestId]) {
|
|
628
|
+
const errorMessage = "exportDashboard request timed out.";
|
|
629
|
+
dashboardComponent.promises[requestId].reject(
|
|
630
|
+
new Error(errorMessage)
|
|
631
|
+
);
|
|
632
|
+
delete dashboardComponent.promises[requestId];
|
|
633
|
+
}
|
|
634
|
+
}, 12e5);
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
638
|
+
};
|
|
639
|
+
|
|
640
|
+
// libs/embed-libs/shared-embed/src/lib/methods/get-accessible-dashboards.ts
|
|
641
|
+
var getAccessibleDashboards = async (dashboardComponent) => {
|
|
642
|
+
await dashboardComponent.updateComplete;
|
|
643
|
+
if ((dashboardComponent.currentAuthKey ?? dashboardComponent.authKey) && (dashboardComponent.currentAuthToken ?? dashboardComponent.authToken)) {
|
|
644
|
+
const fetchUser = new Promise((resolve, reject) => {
|
|
645
|
+
void (() => {
|
|
646
|
+
try {
|
|
647
|
+
const responsePromise = window.fetch(
|
|
648
|
+
// With experimental=true URLs remove the trailing slash, since the web component expects them to not have it.
|
|
649
|
+
// Fixes incorrect url with experimental=true
|
|
650
|
+
`${addTrailingSlash(dashboardComponent.params.apiHost)}0.1.0/authorization`,
|
|
651
|
+
{
|
|
652
|
+
method: "POST",
|
|
653
|
+
mode: "cors",
|
|
654
|
+
cache: "no-cache",
|
|
655
|
+
headers: { "Content-Type": "application/json" },
|
|
656
|
+
redirect: "follow",
|
|
657
|
+
body: JSON.stringify({
|
|
658
|
+
action: "get",
|
|
659
|
+
version: "0.1.0",
|
|
660
|
+
key: dashboardComponent.currentAuthKey ?? dashboardComponent.authKey,
|
|
661
|
+
token: dashboardComponent.currentAuthToken ?? dashboardComponent.authToken,
|
|
662
|
+
find: {
|
|
663
|
+
where: { id: dashboardComponent.authKey },
|
|
664
|
+
attributes: ["id", "integration_id"],
|
|
665
|
+
include: [
|
|
666
|
+
{
|
|
667
|
+
model: "User",
|
|
668
|
+
attributes: ["id", "name", "locale_id"],
|
|
669
|
+
include: [{ model: "Group" }]
|
|
670
|
+
}
|
|
671
|
+
]
|
|
672
|
+
}
|
|
673
|
+
})
|
|
674
|
+
}
|
|
675
|
+
);
|
|
676
|
+
responsePromise.then((response) => response.json()).then((data) => {
|
|
677
|
+
if (!data || !data.rows || data.rows.length === 0 || !data.rows[0].user) {
|
|
678
|
+
reject("Authorization failed, please check authKey and authToken. If the problem persists, please contact support@luzmo.com.");
|
|
679
|
+
} else {
|
|
680
|
+
data.rows[0].user.userGroups = data.rows[0].user.groups.map(
|
|
681
|
+
(group) => group.id
|
|
682
|
+
);
|
|
683
|
+
delete data.rows[0].user.groups;
|
|
684
|
+
resolve({
|
|
685
|
+
integrationId: data.rows[0].integration_id,
|
|
686
|
+
user: data.rows[0].user
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
});
|
|
690
|
+
} catch (error) {
|
|
691
|
+
reject(error);
|
|
692
|
+
}
|
|
693
|
+
})();
|
|
694
|
+
});
|
|
695
|
+
return new Promise((resolve, reject) => void (() => {
|
|
696
|
+
try {
|
|
697
|
+
fetchUser.then((authorizationData) => {
|
|
698
|
+
const responsePromise = window.fetch(
|
|
699
|
+
// With experimental=true URLs remove the trailing slash, since the web component expects them to not have it.
|
|
700
|
+
// Fixes incorrect url with experimental=true
|
|
701
|
+
`${addTrailingSlash(dashboardComponent.params.apiHost)}0.1.0/securable`,
|
|
702
|
+
{
|
|
703
|
+
method: "POST",
|
|
704
|
+
mode: "cors",
|
|
705
|
+
cache: "no-cache",
|
|
706
|
+
headers: { "Content-Type": "application/json" },
|
|
707
|
+
redirect: "follow",
|
|
708
|
+
body: JSON.stringify({
|
|
709
|
+
action: "get",
|
|
710
|
+
version: "0.1.0",
|
|
711
|
+
key: dashboardComponent.currentAuthKey ?? dashboardComponent.authKey,
|
|
712
|
+
token: dashboardComponent.currentAuthToken ?? dashboardComponent.authToken,
|
|
713
|
+
find: {
|
|
714
|
+
where: { type: "dashboard", is_variant: false },
|
|
715
|
+
attributes: ["id", "name", "modified_at"],
|
|
716
|
+
order: [["modified_at", "desc"]],
|
|
717
|
+
include: [
|
|
718
|
+
{ model: "Tag", attributes: ["tag"] },
|
|
719
|
+
{ model: "User", attributes: ["id", "name"] },
|
|
720
|
+
{
|
|
721
|
+
model: "Group",
|
|
722
|
+
attributes: ["id", "name", "public"]
|
|
723
|
+
},
|
|
724
|
+
{ model: "Integration", attributes: ["id", "name"] }
|
|
725
|
+
]
|
|
726
|
+
}
|
|
727
|
+
})
|
|
728
|
+
}
|
|
729
|
+
);
|
|
730
|
+
responsePromise.then((response) => response.json()).then((data) => {
|
|
731
|
+
const dashboardList = data.rows.length > 0 ? formatDashboardList(
|
|
732
|
+
data.rows,
|
|
733
|
+
authorizationData.integrationId,
|
|
734
|
+
authorizationData.user,
|
|
735
|
+
dashboardComponent
|
|
736
|
+
) : [];
|
|
737
|
+
resolve(dashboardList);
|
|
738
|
+
});
|
|
739
|
+
}).catch((error) => {
|
|
740
|
+
reject(error);
|
|
741
|
+
});
|
|
742
|
+
} catch (error) {
|
|
743
|
+
reject(error);
|
|
744
|
+
}
|
|
745
|
+
})());
|
|
746
|
+
}
|
|
747
|
+
throw new Error("No authKey or authToken found in the luzmo-dashboard component.");
|
|
748
|
+
};
|
|
749
|
+
|
|
750
|
+
// libs/embed-libs/shared-embed/src/lib/methods/get-data.ts
|
|
751
|
+
var getData = (dashboardComponent, iframe, itemId) => {
|
|
752
|
+
if (iframe?.contentWindow) {
|
|
753
|
+
const requestId = uuidv4();
|
|
754
|
+
iframe.contentWindow.postMessage(
|
|
755
|
+
{
|
|
756
|
+
action: "getData",
|
|
757
|
+
id: itemId,
|
|
758
|
+
_version: dashboardComponent.libVersion,
|
|
759
|
+
requestId
|
|
760
|
+
},
|
|
761
|
+
"*"
|
|
762
|
+
);
|
|
763
|
+
return new Promise((resolve, reject) => {
|
|
764
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
765
|
+
setTimeout(() => {
|
|
766
|
+
if (dashboardComponent.promises[requestId]) {
|
|
767
|
+
const errorMessage = "getData request timed out.";
|
|
768
|
+
dashboardComponent.promises[requestId].reject(
|
|
769
|
+
new Error(errorMessage)
|
|
770
|
+
);
|
|
771
|
+
delete dashboardComponent.promises[requestId];
|
|
772
|
+
}
|
|
773
|
+
}, 2e3);
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
777
|
+
};
|
|
778
|
+
|
|
779
|
+
// libs/embed-libs/shared-embed/src/lib/methods/get-filters.ts
|
|
780
|
+
var getFilters = (dashboardComponent, iframe) => {
|
|
781
|
+
if (iframe?.contentWindow) {
|
|
782
|
+
const requestId = uuidv4();
|
|
783
|
+
iframe.contentWindow.postMessage(
|
|
784
|
+
{ action: "getFilters", _version: dashboardComponent.libVersion, requestId },
|
|
785
|
+
"*"
|
|
786
|
+
);
|
|
787
|
+
return new Promise((resolve, reject) => {
|
|
788
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
789
|
+
setTimeout(() => {
|
|
790
|
+
if (dashboardComponent.promises[requestId]) {
|
|
791
|
+
const errorMessage = "getFilters request timed out.";
|
|
792
|
+
dashboardComponent.promises[requestId].reject(
|
|
793
|
+
new Error(errorMessage)
|
|
794
|
+
);
|
|
795
|
+
delete dashboardComponent.promises[requestId];
|
|
796
|
+
}
|
|
797
|
+
}, 2e3);
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
// libs/embed-libs/shared-embed/src/lib/methods/refresh-data.ts
|
|
804
|
+
var refreshData = (dashboardComponent, iframe, itemId) => {
|
|
805
|
+
if (iframe) {
|
|
806
|
+
iframe.contentWindow.postMessage(
|
|
807
|
+
{
|
|
808
|
+
action: "refreshData",
|
|
809
|
+
id: itemId ?? null,
|
|
810
|
+
_version: dashboardComponent.libVersion
|
|
811
|
+
},
|
|
812
|
+
"*"
|
|
813
|
+
);
|
|
814
|
+
return Promise.resolve();
|
|
815
|
+
}
|
|
816
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
817
|
+
};
|
|
818
|
+
|
|
819
|
+
// libs/embed-libs/shared-embed/src/lib/methods/reload-dashboard.ts
|
|
820
|
+
var reloadDashboard = (dashboardComponent, iframe) => {
|
|
821
|
+
if (iframe) {
|
|
822
|
+
iframe.contentWindow.postMessage(
|
|
823
|
+
{ action: "reloadDashboard", _version: dashboardComponent.libVersion },
|
|
824
|
+
"*"
|
|
825
|
+
);
|
|
826
|
+
return Promise.resolve();
|
|
827
|
+
}
|
|
828
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
829
|
+
};
|
|
830
|
+
|
|
831
|
+
// libs/embed-libs/shared-embed/src/lib/methods/set-authorization.ts
|
|
832
|
+
var setAuthorization = (dashboardComponent, iframe, key, token) => {
|
|
833
|
+
if (iframe) {
|
|
834
|
+
iframe.contentWindow.postMessage(
|
|
835
|
+
{
|
|
836
|
+
action: "setAuthorization",
|
|
837
|
+
key,
|
|
838
|
+
token,
|
|
839
|
+
_version: dashboardComponent.libVersion
|
|
840
|
+
},
|
|
841
|
+
"*"
|
|
842
|
+
);
|
|
843
|
+
return Promise.resolve();
|
|
844
|
+
}
|
|
845
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
846
|
+
};
|
|
847
|
+
|
|
848
|
+
// libs/embed-libs/shared-embed/src/lib/methods/set-edit-mode.ts
|
|
849
|
+
var setEditMode = (dashboardComponent, iframe, editMode) => {
|
|
850
|
+
if (iframe && iframe.contentWindow) {
|
|
851
|
+
const requestId = uuidv4();
|
|
852
|
+
if (dashboardComponent.params.editMode === editMode) {
|
|
853
|
+
return Promise.reject(
|
|
854
|
+
new Error("editMode parameter is currently already set to " + editMode)
|
|
855
|
+
);
|
|
856
|
+
} else if (editMode !== "editFull" && editMode !== "editLimited" && editMode !== "view") {
|
|
857
|
+
return Promise.reject(
|
|
858
|
+
new Error(
|
|
859
|
+
"The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'."
|
|
860
|
+
)
|
|
861
|
+
);
|
|
862
|
+
}
|
|
863
|
+
iframe.contentWindow.postMessage(
|
|
864
|
+
{
|
|
865
|
+
action: "setEditMode",
|
|
866
|
+
editMode,
|
|
867
|
+
_version: dashboardComponent.libVersion,
|
|
868
|
+
requestId
|
|
869
|
+
},
|
|
870
|
+
"*"
|
|
871
|
+
);
|
|
872
|
+
return new Promise((resolve, reject) => {
|
|
873
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
877
|
+
};
|
|
878
|
+
|
|
879
|
+
// libs/embed-libs/shared-embed/src/lib/methods/set-selected-data.ts
|
|
880
|
+
var setSelectedData = (dashboardComponent, iframe, itemId, filters) => {
|
|
881
|
+
if (iframe) {
|
|
882
|
+
const requestId = uuidv4();
|
|
883
|
+
iframe.contentWindow.postMessage(
|
|
884
|
+
{
|
|
885
|
+
action: "setSelectedData",
|
|
886
|
+
itemId,
|
|
887
|
+
filters,
|
|
888
|
+
_version: dashboardComponent.libVersion,
|
|
889
|
+
requestId
|
|
890
|
+
},
|
|
891
|
+
"*"
|
|
892
|
+
);
|
|
893
|
+
return new Promise((resolve, reject) => {
|
|
894
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
895
|
+
setTimeout(() => {
|
|
896
|
+
if (dashboardComponent.promises[requestId]) {
|
|
897
|
+
const errorMessage = "setSelectedData request timed out.";
|
|
898
|
+
dashboardComponent.promises[requestId].reject(
|
|
899
|
+
new Error(errorMessage)
|
|
900
|
+
);
|
|
901
|
+
delete dashboardComponent.promises[requestId];
|
|
902
|
+
}
|
|
903
|
+
}, 2e3);
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
return Promise.reject();
|
|
907
|
+
};
|
|
908
|
+
|
|
909
|
+
// libs/embed-libs/shared-embed/src/lib/methods/set-preview.ts
|
|
910
|
+
var setPreview = (dashboardComponent, iframe, preview) => {
|
|
911
|
+
if (iframe) {
|
|
912
|
+
const requestId = uuidv4();
|
|
913
|
+
iframe.contentWindow.postMessage(
|
|
914
|
+
{
|
|
915
|
+
action: "setPreview",
|
|
916
|
+
preview,
|
|
917
|
+
requestId,
|
|
918
|
+
_version: dashboardComponent.libVersion
|
|
919
|
+
},
|
|
920
|
+
"*"
|
|
921
|
+
);
|
|
922
|
+
return new Promise((resolve, reject) => {
|
|
923
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
924
|
+
setTimeout(() => {
|
|
925
|
+
if (dashboardComponent.promises[requestId]) {
|
|
926
|
+
const errorMessage = "setPreview request timed out.";
|
|
927
|
+
dashboardComponent.promises[requestId].reject(
|
|
928
|
+
new Error(errorMessage)
|
|
929
|
+
);
|
|
930
|
+
delete dashboardComponent.promises[requestId];
|
|
931
|
+
}
|
|
932
|
+
}, 2e3);
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
936
|
+
};
|
|
937
|
+
|
|
938
|
+
// libs/embed-libs/shared-embed/src/lib/service/calculate-dimensions.ts
|
|
939
|
+
var _setCalculatedDimensions = (dashboardComponent) => {
|
|
940
|
+
if (!dashboardComponent.dimensions) {
|
|
941
|
+
dashboardComponent.params.error = true;
|
|
942
|
+
_handleError("Got no valid dimensions.", dashboardComponent.params);
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
945
|
+
const dashboardDimensionKeys = Object.keys(
|
|
946
|
+
dashboardComponent.dimensions
|
|
947
|
+
);
|
|
948
|
+
const availableScreenModeExtents = [];
|
|
949
|
+
let currentMode;
|
|
950
|
+
let currentWidth = 0;
|
|
951
|
+
let currentHeight = 0;
|
|
952
|
+
if (!dashboardComponent.params.switchScreenModeOnResize && dashboardComponent.currentScreenMode) {
|
|
953
|
+
dashboardComponent.params.screenMode = dashboardComponent.currentScreenMode;
|
|
954
|
+
}
|
|
955
|
+
if (dashboardComponent.dimensions && dashboardDimensionKeys?.[0] === "fixed") {
|
|
956
|
+
currentMode = "fixed";
|
|
957
|
+
currentWidth = dashboardComponent.dimensions.fixed[0];
|
|
958
|
+
currentHeight = dashboardComponent.dimensions.fixed[1];
|
|
959
|
+
} else {
|
|
960
|
+
const screenModes = [
|
|
961
|
+
"mobile",
|
|
962
|
+
"tablet",
|
|
963
|
+
"desktop",
|
|
964
|
+
"largeScreen"
|
|
965
|
+
];
|
|
966
|
+
if (dashboardComponent.params.itemEmbedding) {
|
|
967
|
+
const [firstMatch] = dashboardDimensionKeys;
|
|
968
|
+
let match = cloneDeep(firstMatch);
|
|
969
|
+
for (const screenMode of screenModes) {
|
|
970
|
+
const found = dashboardDimensionKeys.find((key) => key === screenMode);
|
|
971
|
+
if (found) {
|
|
972
|
+
match = cloneDeep(found);
|
|
973
|
+
} else {
|
|
974
|
+
dashboardComponent.dimensions[screenMode] = dashboardComponent.dimensions[match];
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
for (const key of dashboardDimensionKeys) {
|
|
979
|
+
if (screenModes.includes(key)) {
|
|
980
|
+
const screenMode = EXTENTS.find((extent) => extent.mode === key);
|
|
981
|
+
availableScreenModeExtents.push({
|
|
982
|
+
...screenMode,
|
|
983
|
+
height: dashboardComponent.dimensions[key][1] || 50
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
if (!availableScreenModeExtents.map((screenModeExtent) => screenModeExtent.mode).includes(dashboardComponent.params.screenMode)) {
|
|
988
|
+
dashboardComponent.params.screenMode = "auto";
|
|
989
|
+
}
|
|
990
|
+
if (dashboardComponent.params.screenMode === "auto") {
|
|
991
|
+
availableScreenModeExtents.sort(
|
|
992
|
+
(a2, b2) => screenModes.indexOf(a2.mode) - screenModes.indexOf(b2.mode)
|
|
993
|
+
);
|
|
994
|
+
for (const screenModeExtent of availableScreenModeExtents) {
|
|
995
|
+
const [screenModeExtentMinWidth, screenModeExtentMaxWidth] = screenModeExtent.width;
|
|
996
|
+
if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
|
|
997
|
+
if (screenModeExtentMinWidth < dashboardComponent.params.itemDimensions.width) {
|
|
998
|
+
currentMode = screenModeExtent.mode;
|
|
999
|
+
currentWidth = Number.parseInt(
|
|
1000
|
+
dashboardComponent.params.itemDimensions.width,
|
|
1001
|
+
10
|
|
1002
|
+
);
|
|
1003
|
+
currentHeight = dashboardComponent.dimensions[currentMode][1];
|
|
1004
|
+
}
|
|
1005
|
+
} else {
|
|
1006
|
+
if (screenModeExtentMinWidth < dashboardComponent.containerWidth) {
|
|
1007
|
+
currentMode = screenModeExtent.mode;
|
|
1008
|
+
if (dashboardComponent.params.itemEmbedding) {
|
|
1009
|
+
currentWidth = dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto" ? Number.parseInt(
|
|
1010
|
+
dashboardComponent.params.itemDimensions.width,
|
|
1011
|
+
10
|
|
1012
|
+
) : Math.min(
|
|
1013
|
+
dashboardComponent.containerWidth,
|
|
1014
|
+
screenModeExtentMaxWidth
|
|
1015
|
+
);
|
|
1016
|
+
currentHeight = dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto" ? Number.parseInt(
|
|
1017
|
+
dashboardComponent.params.itemDimensions.height,
|
|
1018
|
+
10
|
|
1019
|
+
) : dashboardComponent.dimensions[currentMode][1];
|
|
1020
|
+
if (dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
|
|
1021
|
+
currentWidth = Number.parseInt(
|
|
1022
|
+
dashboardComponent.params.itemDimensions.width,
|
|
1023
|
+
10
|
|
1024
|
+
);
|
|
1025
|
+
currentHeight = dashboardComponent.dimensions[currentMode][1];
|
|
1026
|
+
}
|
|
1027
|
+
} else {
|
|
1028
|
+
currentWidth = Math.max(
|
|
1029
|
+
Math.min(
|
|
1030
|
+
screenModeExtentMaxWidth,
|
|
1031
|
+
dashboardComponent.containerWidth
|
|
1032
|
+
),
|
|
1033
|
+
screenModeExtentMinWidth
|
|
1034
|
+
);
|
|
1035
|
+
currentHeight = screenModeExtent.height;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
} else {
|
|
1041
|
+
const {
|
|
1042
|
+
height: chosenModeHeight,
|
|
1043
|
+
width: [chosenModeMinWidth, chosenModeMaxWidth]
|
|
1044
|
+
} = availableScreenModeExtents.find(
|
|
1045
|
+
(d2) => d2.mode === dashboardComponent.params.screenMode
|
|
1046
|
+
);
|
|
1047
|
+
currentMode = dashboardComponent.params.screenMode;
|
|
1048
|
+
currentWidth = Math.max(
|
|
1049
|
+
Math.min(chosenModeMaxWidth, dashboardComponent.containerWidth),
|
|
1050
|
+
chosenModeMinWidth
|
|
1051
|
+
);
|
|
1052
|
+
currentHeight = chosenModeHeight;
|
|
1053
|
+
if (dashboardComponent.params.itemEmbedding) {
|
|
1054
|
+
if (dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto") {
|
|
1055
|
+
currentWidth = Number.parseInt(
|
|
1056
|
+
dashboardComponent.params.itemDimensions.width,
|
|
1057
|
+
10
|
|
1058
|
+
);
|
|
1059
|
+
}
|
|
1060
|
+
if (dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto") {
|
|
1061
|
+
currentHeight = Number.parseInt(
|
|
1062
|
+
dashboardComponent.params.itemDimensions.height,
|
|
1063
|
+
10
|
|
1064
|
+
);
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
if (!currentMode && availableScreenModeExtents.length > 0) {
|
|
1069
|
+
const [lowestModeExtent] = availableScreenModeExtents;
|
|
1070
|
+
currentMode = lowestModeExtent.mode;
|
|
1071
|
+
currentWidth = lowestModeExtent.width[0];
|
|
1072
|
+
currentHeight = lowestModeExtent.height;
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
dashboardComponent.currentScreenMode = currentMode;
|
|
1076
|
+
const style = {
|
|
1077
|
+
height: currentHeight === 0 ? "100%" : `${String(currentHeight)}px`,
|
|
1078
|
+
width: currentWidth === 0 ? "100%" : `${String(currentWidth)}px`,
|
|
1079
|
+
opacity: 1
|
|
1080
|
+
};
|
|
1081
|
+
const dashboardEditModes = ["editFull", "editLimited"];
|
|
1082
|
+
if (dashboardEditModes.includes(dashboardComponent.params.editMode)) {
|
|
1083
|
+
style.height = "100%";
|
|
1084
|
+
style.width = "100%";
|
|
1085
|
+
} else if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions) {
|
|
1086
|
+
style.height = dashboardComponent.params.itemDimensions.height === "auto" ? style.height : `${String(dashboardComponent.params.itemDimensions.height).replace(
|
|
1087
|
+
"px",
|
|
1088
|
+
""
|
|
1089
|
+
)}px`;
|
|
1090
|
+
style.width = dashboardComponent.params.itemDimensions.width === "auto" ? style.width : `${String(dashboardComponent.params.itemDimensions.width).replace(
|
|
1091
|
+
"px",
|
|
1092
|
+
""
|
|
1093
|
+
)}px`;
|
|
1094
|
+
} else {
|
|
1095
|
+
style.height = currentHeight === 0 ? "100%" : `${String(currentHeight)}px`;
|
|
1096
|
+
style.width = currentWidth === 0 ? "100%" : `${String(currentWidth)}px`;
|
|
1097
|
+
}
|
|
1098
|
+
dashboardComponent.currentScreenMode = currentMode;
|
|
1099
|
+
dashboardComponent.iframeStyle = style;
|
|
1100
|
+
};
|
|
1101
|
+
|
|
1102
|
+
// libs/embed-libs/shared-embed/src/lib/service/extend-and-validate.ts
|
|
1103
|
+
var _extendAndValidate = (dashboardContent) => {
|
|
1104
|
+
const defaultKeys = Object.keys(
|
|
1105
|
+
DEFAULT_PARAMETERS
|
|
1106
|
+
);
|
|
1107
|
+
const errorMessages = [];
|
|
1108
|
+
const requiredStringParams = [
|
|
1109
|
+
"appServer",
|
|
1110
|
+
"language",
|
|
1111
|
+
"apiHost"
|
|
1112
|
+
];
|
|
1113
|
+
const requiredStringOrEmptyParams = [
|
|
1114
|
+
"key",
|
|
1115
|
+
"token",
|
|
1116
|
+
"screenMode",
|
|
1117
|
+
"timezoneId",
|
|
1118
|
+
"itemId",
|
|
1119
|
+
"container",
|
|
1120
|
+
"loaderBackground",
|
|
1121
|
+
"loaderFontColor",
|
|
1122
|
+
"loaderSpinnerColor",
|
|
1123
|
+
"loaderSpinnerBackground"
|
|
1124
|
+
];
|
|
1125
|
+
const objectParams = ["itemDimensions"];
|
|
1126
|
+
const screenModes = [
|
|
1127
|
+
"mobile",
|
|
1128
|
+
"tablet",
|
|
1129
|
+
"desktop",
|
|
1130
|
+
"largeScreen",
|
|
1131
|
+
"fixed",
|
|
1132
|
+
"auto"
|
|
1133
|
+
];
|
|
1134
|
+
for (const key of defaultKeys) {
|
|
1135
|
+
if (dashboardContent.params[key] === null) {
|
|
1136
|
+
delete dashboardContent.params[key];
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
dashboardContent.params = defaultsDeep(
|
|
1140
|
+
dashboardContent.params,
|
|
1141
|
+
DEFAULT_PARAMETERS
|
|
1142
|
+
);
|
|
1143
|
+
if ((!dashboardContent.params.dashboardId || typeof dashboardContent.params.dashboardId !== "string") && (!dashboardContent.params.dashboardSlug || typeof dashboardContent.params.dashboardSlug !== "string")) {
|
|
1144
|
+
delete dashboardContent.params.dashboardId;
|
|
1145
|
+
delete dashboardContent.params.dashboardSlug;
|
|
1146
|
+
}
|
|
1147
|
+
for (const key of requiredStringParams) {
|
|
1148
|
+
if (typeof dashboardContent.params[key] !== "string") {
|
|
1149
|
+
delete dashboardContent.params[key];
|
|
1150
|
+
errorMessages.push(`${key} needs to be of type string.`);
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
for (const key of requiredStringOrEmptyParams) {
|
|
1154
|
+
if (typeof dashboardContent.params[key] !== "string" && dashboardContent.params[key] !== null && dashboardContent.params[key] !== void 0) {
|
|
1155
|
+
delete dashboardContent.params[key];
|
|
1156
|
+
errorMessages.push(`${key} needs to be of type string or empty.`);
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
if (dashboardContent.params.screenMode && !screenModes.includes(dashboardContent.params.screenMode)) {
|
|
1160
|
+
const validTypesString = screenModes.map((mode) => `"${mode}"`).join(", ");
|
|
1161
|
+
errorMessages.push(
|
|
1162
|
+
`"screenMode" needs should be one of these types: ${validTypesString}`
|
|
1163
|
+
);
|
|
1164
|
+
dashboardContent.params.screenMode = "auto";
|
|
1165
|
+
}
|
|
1166
|
+
if (dashboardContent.params.itemId) {
|
|
1167
|
+
dashboardContent.params.itemEmbedding = true;
|
|
1168
|
+
}
|
|
1169
|
+
for (const key of objectParams) {
|
|
1170
|
+
if (typeof dashboardContent.params[key] !== "object" && dashboardContent.params[key] !== null) {
|
|
1171
|
+
delete dashboardContent.params[key];
|
|
1172
|
+
errorMessages.push(`${key} needs to be of type object or empty.`);
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
if (typeof dashboardContent.params.switchScreenModeOnResize !== "boolean") {
|
|
1176
|
+
errorMessages.push("switchScreenModeOnResize needs to be of type boolean.");
|
|
1177
|
+
dashboardContent.params.switchScreenModeOnResize = true;
|
|
1178
|
+
}
|
|
1179
|
+
if (dashboardContent.params.itemDimensions) {
|
|
1180
|
+
const itemDimensionsKeys = [
|
|
1181
|
+
"width",
|
|
1182
|
+
"height"
|
|
1183
|
+
];
|
|
1184
|
+
for (const key of itemDimensionsKeys) {
|
|
1185
|
+
if (!["string", "number"].includes(
|
|
1186
|
+
typeof dashboardContent.params.itemDimensions[key]
|
|
1187
|
+
) && dashboardContent.params.itemDimensions[key] !== null) {
|
|
1188
|
+
errorMessages.push(
|
|
1189
|
+
`itemDimensions ${key} needs to be of type string, number or empty.`
|
|
1190
|
+
);
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
dashboardContent.params = defaultsDeep(
|
|
1195
|
+
dashboardContent.params,
|
|
1196
|
+
DEFAULT_PARAMETERS
|
|
1197
|
+
);
|
|
1198
|
+
if (dashboardContent.params.screenMode && dashboardContent.params.screenMode !== "auto") {
|
|
1199
|
+
dashboardContent.params.switchScreenModeOnResize = false;
|
|
1200
|
+
}
|
|
1201
|
+
if (dashboardContent.params.itemDimensions.width !== "auto") {
|
|
1202
|
+
dashboardContent.params.itemDimensions.width = Number.parseInt(
|
|
1203
|
+
`${dashboardContent.params.itemDimensions.width}`.replace("px", ""),
|
|
1204
|
+
10
|
|
1205
|
+
) || "auto";
|
|
1206
|
+
}
|
|
1207
|
+
if (dashboardContent.params.itemDimensions.height !== "auto") {
|
|
1208
|
+
dashboardContent.params.itemDimensions.height = Number.parseInt(
|
|
1209
|
+
`${dashboardContent.params.itemDimensions.height}`.replace("px", ""),
|
|
1210
|
+
10
|
|
1211
|
+
) || "auto";
|
|
1212
|
+
}
|
|
1213
|
+
dashboardContent.params.itemEmbedding = !!dashboardContent.params.itemId;
|
|
1214
|
+
if (dashboardContent.params.error || errorMessages.length > 0) {
|
|
1215
|
+
_handleError(errorMessages.join("\n"), dashboardContent.params);
|
|
1216
|
+
}
|
|
1217
|
+
};
|
|
1218
|
+
|
|
1219
|
+
// libs/embed-libs/shared-embed/src/lib/models/viz-item.model.ts
|
|
1220
|
+
var libraryTypeToWebComponentTypeMapping = {
|
|
1221
|
+
type: "type",
|
|
1222
|
+
slots: "slots",
|
|
1223
|
+
options: "options",
|
|
1224
|
+
appServer: "app-server",
|
|
1225
|
+
apiHost: "api-host",
|
|
1226
|
+
authKey: "auth-key",
|
|
1227
|
+
authToken: "auth-token",
|
|
1228
|
+
contextId: "context-id",
|
|
1229
|
+
canFilter: "can-filter",
|
|
1230
|
+
filters: "filters",
|
|
1231
|
+
dashboardId: "dashboard-id",
|
|
1232
|
+
itemId: "item-id",
|
|
1233
|
+
dashboardContentsVersion: "dashboard-contents-version",
|
|
1234
|
+
libVersion: "lib-version"
|
|
1235
|
+
};
|
|
1236
|
+
|
|
1237
|
+
// libs/embed-libs/shared-embed/src/lib/constants/class-constants.ts
|
|
1238
|
+
var luzmoEmbedContainerClass = "luzmo-embed-container";
|
|
1239
|
+
|
|
1240
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/remote-federation.ts
|
|
1241
|
+
var remotesMap = {
|
|
1242
|
+
// "remote_app": { url: "http://localhost:4201/remoteEntry.mjs", format: "esm", from: "vite" },
|
|
1243
|
+
};
|
|
1244
|
+
var loadJS = async (url, fn) => {
|
|
1245
|
+
const resolvedUrl = typeof url === "function" ? await url() : url;
|
|
1246
|
+
const script = document.createElement("script");
|
|
1247
|
+
script.type = "text/javascript";
|
|
1248
|
+
script.addEventListener("load", fn);
|
|
1249
|
+
script.src = resolvedUrl;
|
|
1250
|
+
document.querySelectorAll("head")[0].append(script);
|
|
1251
|
+
};
|
|
1252
|
+
var wrapShareModule = (remoteFrom) => ({});
|
|
1253
|
+
async function __federationMethodEnsure(remoteId) {
|
|
1254
|
+
const remote = remotesMap[remoteId];
|
|
1255
|
+
if (remote.inited) {
|
|
1256
|
+
return remote.lib;
|
|
1257
|
+
}
|
|
1258
|
+
if (remote.format === "var") {
|
|
1259
|
+
return new Promise((resolve) => {
|
|
1260
|
+
const callback = () => {
|
|
1261
|
+
if (!remote.inited) {
|
|
1262
|
+
remote.lib = window[remoteId];
|
|
1263
|
+
remote.lib.init(wrapShareModule(remote.from));
|
|
1264
|
+
remote.inited = true;
|
|
1265
|
+
}
|
|
1266
|
+
resolve(remote.lib);
|
|
1267
|
+
};
|
|
1268
|
+
return loadJS(remote.url, callback);
|
|
1269
|
+
});
|
|
1270
|
+
} else if (["esm", "systemjs"].includes(remote.format)) {
|
|
1271
|
+
return new Promise((resolve, reject) => {
|
|
1272
|
+
const getUrl = typeof remote.url === "function" ? remote.url : () => Promise.resolve(remote.url);
|
|
1273
|
+
getUrl().then((url) => {
|
|
1274
|
+
import(
|
|
1275
|
+
/* @vite-ignore */
|
|
1276
|
+
/* webpackIgnore: true */
|
|
1277
|
+
url
|
|
1278
|
+
).then((lib) => {
|
|
1279
|
+
if (!remote.inited) {
|
|
1280
|
+
const shareScope = wrapShareModule(remote.from);
|
|
1281
|
+
lib.init(shareScope);
|
|
1282
|
+
remote.lib = lib;
|
|
1283
|
+
remote.lib.init(shareScope);
|
|
1284
|
+
remote.inited = true;
|
|
1285
|
+
}
|
|
1286
|
+
resolve(remote.lib);
|
|
1287
|
+
}).catch(reject);
|
|
1288
|
+
});
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
function __federationMethodWrapDefault(module2, need) {
|
|
1293
|
+
if (!(module2 == null ? void 0 : module2.default) && need) {
|
|
1294
|
+
const obj = /* @__PURE__ */ Object.create(null);
|
|
1295
|
+
obj.default = module2;
|
|
1296
|
+
obj.__esModule = true;
|
|
1297
|
+
return obj;
|
|
1298
|
+
}
|
|
1299
|
+
return module2;
|
|
1300
|
+
}
|
|
1301
|
+
async function __federationMethodGetRemote(remoteName, componentName) {
|
|
1302
|
+
return __federationMethodEnsure(remoteName).then((remote) => remote.get(componentName).then((factory) => factory()));
|
|
1303
|
+
}
|
|
1304
|
+
async function loadLibrary(appServer, componentName = "DashboardApp") {
|
|
1305
|
+
const remotesMapIndex = appServer + componentName;
|
|
1306
|
+
if (remotesMap[remotesMapIndex]) {
|
|
1307
|
+
return remotesMap[remotesMapIndex].module;
|
|
1308
|
+
}
|
|
1309
|
+
let url = `${removeTrailingSlash(appServer)}/remoteEntry.mjs`;
|
|
1310
|
+
if (!appServer.startsWith("http://localhost")) {
|
|
1311
|
+
if (componentName === "DashboardApp") {
|
|
1312
|
+
url = `${removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`;
|
|
1313
|
+
} else if (componentName === "Component") {
|
|
1314
|
+
url = `${removeTrailingSlash(appServer)}/iq-components/remoteEntry.mjs`;
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
remotesMap[remotesMapIndex] = {
|
|
1318
|
+
url,
|
|
1319
|
+
format: "esm",
|
|
1320
|
+
from: "vite",
|
|
1321
|
+
module: void 0
|
|
1322
|
+
};
|
|
1323
|
+
const module2 = await __federationMethodGetRemote(remotesMapIndex, `./${componentName}`);
|
|
1324
|
+
const wrappedModule = __federationMethodWrapDefault(module2, true);
|
|
1325
|
+
remotesMap[remotesMapIndex].module = wrappedModule;
|
|
1326
|
+
return wrappedModule;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
// node_modules/@lit/reactive-element/css-tag.js
|
|
1330
|
+
var t = globalThis;
|
|
1331
|
+
var e = t.ShadowRoot && (void 0 === t.ShadyCSS || t.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype;
|
|
1332
|
+
var s = Symbol();
|
|
1333
|
+
var o = /* @__PURE__ */ new WeakMap();
|
|
1334
|
+
var n = class {
|
|
1335
|
+
constructor(t3, e6, o4) {
|
|
1336
|
+
if (this._$cssResult$ = true, o4 !== s)
|
|
1337
|
+
throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
1338
|
+
this.cssText = t3, this.t = e6;
|
|
1339
|
+
}
|
|
1340
|
+
get styleSheet() {
|
|
1341
|
+
let t3 = this.o;
|
|
1342
|
+
const s2 = this.t;
|
|
1343
|
+
if (e && void 0 === t3) {
|
|
1344
|
+
const e6 = void 0 !== s2 && 1 === s2.length;
|
|
1345
|
+
e6 && (t3 = o.get(s2)), void 0 === t3 && ((this.o = t3 = new CSSStyleSheet()).replaceSync(this.cssText), e6 && o.set(s2, t3));
|
|
1346
|
+
}
|
|
1347
|
+
return t3;
|
|
1348
|
+
}
|
|
1349
|
+
toString() {
|
|
1350
|
+
return this.cssText;
|
|
1351
|
+
}
|
|
1352
|
+
};
|
|
1353
|
+
var r = (t3) => new n("string" == typeof t3 ? t3 : t3 + "", void 0, s);
|
|
1354
|
+
var i = (t3, ...e6) => {
|
|
1355
|
+
const o4 = 1 === t3.length ? t3[0] : e6.reduce((e7, s2, o5) => e7 + ((t4) => {
|
|
1356
|
+
if (true === t4._$cssResult$)
|
|
1357
|
+
return t4.cssText;
|
|
1358
|
+
if ("number" == typeof t4)
|
|
1359
|
+
return t4;
|
|
1360
|
+
throw Error("Value passed to 'css' function must be a 'css' function result: " + t4 + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
1361
|
+
})(s2) + t3[o5 + 1], t3[0]);
|
|
1362
|
+
return new n(o4, t3, s);
|
|
1363
|
+
};
|
|
1364
|
+
var S = (s2, o4) => {
|
|
1365
|
+
if (e)
|
|
1366
|
+
s2.adoptedStyleSheets = o4.map((t3) => t3 instanceof CSSStyleSheet ? t3 : t3.styleSheet);
|
|
1367
|
+
else
|
|
1368
|
+
for (const e6 of o4) {
|
|
1369
|
+
const o5 = document.createElement("style"), n5 = t.litNonce;
|
|
1370
|
+
void 0 !== n5 && o5.setAttribute("nonce", n5), o5.textContent = e6.cssText, s2.appendChild(o5);
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1373
|
+
var c = e ? (t3) => t3 : (t3) => t3 instanceof CSSStyleSheet ? ((t4) => {
|
|
1374
|
+
let e6 = "";
|
|
1375
|
+
for (const s2 of t4.cssRules)
|
|
1376
|
+
e6 += s2.cssText;
|
|
1377
|
+
return r(e6);
|
|
1378
|
+
})(t3) : t3;
|
|
1379
|
+
|
|
1380
|
+
// node_modules/@lit/reactive-element/reactive-element.js
|
|
1381
|
+
var { is: i2, defineProperty: e2, getOwnPropertyDescriptor: r2, getOwnPropertyNames: h, getOwnPropertySymbols: o2, getPrototypeOf: n2 } = Object;
|
|
1382
|
+
var a = globalThis;
|
|
1383
|
+
var c2 = a.trustedTypes;
|
|
1384
|
+
var l = c2 ? c2.emptyScript : "";
|
|
1385
|
+
var p = a.reactiveElementPolyfillSupport;
|
|
1386
|
+
var d = (t3, s2) => t3;
|
|
1387
|
+
var u = { toAttribute(t3, s2) {
|
|
1388
|
+
switch (s2) {
|
|
1389
|
+
case Boolean:
|
|
1390
|
+
t3 = t3 ? l : null;
|
|
1391
|
+
break;
|
|
1392
|
+
case Object:
|
|
1393
|
+
case Array:
|
|
1394
|
+
t3 = null == t3 ? t3 : JSON.stringify(t3);
|
|
1395
|
+
}
|
|
1396
|
+
return t3;
|
|
1397
|
+
}, fromAttribute(t3, s2) {
|
|
1398
|
+
let i4 = t3;
|
|
1399
|
+
switch (s2) {
|
|
1400
|
+
case Boolean:
|
|
1401
|
+
i4 = null !== t3;
|
|
1402
|
+
break;
|
|
1403
|
+
case Number:
|
|
1404
|
+
i4 = null === t3 ? null : Number(t3);
|
|
1405
|
+
break;
|
|
1406
|
+
case Object:
|
|
1407
|
+
case Array:
|
|
1408
|
+
try {
|
|
1409
|
+
i4 = JSON.parse(t3);
|
|
1410
|
+
} catch (t4) {
|
|
1411
|
+
i4 = null;
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
return i4;
|
|
1415
|
+
} };
|
|
1416
|
+
var f = (t3, s2) => !i2(t3, s2);
|
|
1417
|
+
var y = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f };
|
|
1418
|
+
Symbol.metadata ??= Symbol("metadata"), a.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
1419
|
+
var b = class extends HTMLElement {
|
|
1420
|
+
static addInitializer(t3) {
|
|
1421
|
+
this._$Ei(), (this.l ??= []).push(t3);
|
|
1422
|
+
}
|
|
1423
|
+
static get observedAttributes() {
|
|
1424
|
+
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
1425
|
+
}
|
|
1426
|
+
static createProperty(t3, s2 = y) {
|
|
1427
|
+
if (s2.state && (s2.attribute = false), this._$Ei(), this.elementProperties.set(t3, s2), !s2.noAccessor) {
|
|
1428
|
+
const i4 = Symbol(), r5 = this.getPropertyDescriptor(t3, i4, s2);
|
|
1429
|
+
void 0 !== r5 && e2(this.prototype, t3, r5);
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
static getPropertyDescriptor(t3, s2, i4) {
|
|
1433
|
+
const { get: e6, set: h4 } = r2(this.prototype, t3) ?? { get() {
|
|
1434
|
+
return this[s2];
|
|
1435
|
+
}, set(t4) {
|
|
1436
|
+
this[s2] = t4;
|
|
1437
|
+
} };
|
|
1438
|
+
return { get() {
|
|
1439
|
+
return e6?.call(this);
|
|
1440
|
+
}, set(s3) {
|
|
1441
|
+
const r5 = e6?.call(this);
|
|
1442
|
+
h4.call(this, s3), this.requestUpdate(t3, r5, i4);
|
|
1443
|
+
}, configurable: true, enumerable: true };
|
|
1444
|
+
}
|
|
1445
|
+
static getPropertyOptions(t3) {
|
|
1446
|
+
return this.elementProperties.get(t3) ?? y;
|
|
1447
|
+
}
|
|
1448
|
+
static _$Ei() {
|
|
1449
|
+
if (this.hasOwnProperty(d("elementProperties")))
|
|
1450
|
+
return;
|
|
1451
|
+
const t3 = n2(this);
|
|
1452
|
+
t3.finalize(), void 0 !== t3.l && (this.l = [...t3.l]), this.elementProperties = new Map(t3.elementProperties);
|
|
1453
|
+
}
|
|
1454
|
+
static finalize() {
|
|
1455
|
+
if (this.hasOwnProperty(d("finalized")))
|
|
1456
|
+
return;
|
|
1457
|
+
if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d("properties"))) {
|
|
1458
|
+
const t4 = this.properties, s2 = [...h(t4), ...o2(t4)];
|
|
1459
|
+
for (const i4 of s2)
|
|
1460
|
+
this.createProperty(i4, t4[i4]);
|
|
1461
|
+
}
|
|
1462
|
+
const t3 = this[Symbol.metadata];
|
|
1463
|
+
if (null !== t3) {
|
|
1464
|
+
const s2 = litPropertyMetadata.get(t3);
|
|
1465
|
+
if (void 0 !== s2)
|
|
1466
|
+
for (const [t4, i4] of s2)
|
|
1467
|
+
this.elementProperties.set(t4, i4);
|
|
1468
|
+
}
|
|
1469
|
+
this._$Eh = /* @__PURE__ */ new Map();
|
|
1470
|
+
for (const [t4, s2] of this.elementProperties) {
|
|
1471
|
+
const i4 = this._$Eu(t4, s2);
|
|
1472
|
+
void 0 !== i4 && this._$Eh.set(i4, t4);
|
|
1473
|
+
}
|
|
1474
|
+
this.elementStyles = this.finalizeStyles(this.styles);
|
|
1475
|
+
}
|
|
1476
|
+
static finalizeStyles(s2) {
|
|
1477
|
+
const i4 = [];
|
|
1478
|
+
if (Array.isArray(s2)) {
|
|
1479
|
+
const e6 = new Set(s2.flat(1 / 0).reverse());
|
|
1480
|
+
for (const s3 of e6)
|
|
1481
|
+
i4.unshift(c(s3));
|
|
1482
|
+
} else
|
|
1483
|
+
void 0 !== s2 && i4.push(c(s2));
|
|
1484
|
+
return i4;
|
|
1485
|
+
}
|
|
1486
|
+
static _$Eu(t3, s2) {
|
|
1487
|
+
const i4 = s2.attribute;
|
|
1488
|
+
return false === i4 ? void 0 : "string" == typeof i4 ? i4 : "string" == typeof t3 ? t3.toLowerCase() : void 0;
|
|
1489
|
+
}
|
|
1490
|
+
constructor() {
|
|
1491
|
+
super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
|
|
1492
|
+
}
|
|
1493
|
+
_$Ev() {
|
|
1494
|
+
this._$ES = new Promise((t3) => this.enableUpdating = t3), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((t3) => t3(this));
|
|
1495
|
+
}
|
|
1496
|
+
addController(t3) {
|
|
1497
|
+
(this._$EO ??= /* @__PURE__ */ new Set()).add(t3), void 0 !== this.renderRoot && this.isConnected && t3.hostConnected?.();
|
|
1498
|
+
}
|
|
1499
|
+
removeController(t3) {
|
|
1500
|
+
this._$EO?.delete(t3);
|
|
1501
|
+
}
|
|
1502
|
+
_$E_() {
|
|
1503
|
+
const t3 = /* @__PURE__ */ new Map(), s2 = this.constructor.elementProperties;
|
|
1504
|
+
for (const i4 of s2.keys())
|
|
1505
|
+
this.hasOwnProperty(i4) && (t3.set(i4, this[i4]), delete this[i4]);
|
|
1506
|
+
t3.size > 0 && (this._$Ep = t3);
|
|
1507
|
+
}
|
|
1508
|
+
createRenderRoot() {
|
|
1509
|
+
const t3 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
1510
|
+
return S(t3, this.constructor.elementStyles), t3;
|
|
1511
|
+
}
|
|
1512
|
+
connectedCallback() {
|
|
1513
|
+
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach((t3) => t3.hostConnected?.());
|
|
1514
|
+
}
|
|
1515
|
+
enableUpdating(t3) {
|
|
1516
|
+
}
|
|
1517
|
+
disconnectedCallback() {
|
|
1518
|
+
this._$EO?.forEach((t3) => t3.hostDisconnected?.());
|
|
1519
|
+
}
|
|
1520
|
+
attributeChangedCallback(t3, s2, i4) {
|
|
1521
|
+
this._$AK(t3, i4);
|
|
1522
|
+
}
|
|
1523
|
+
_$EC(t3, s2) {
|
|
1524
|
+
const i4 = this.constructor.elementProperties.get(t3), e6 = this.constructor._$Eu(t3, i4);
|
|
1525
|
+
if (void 0 !== e6 && true === i4.reflect) {
|
|
1526
|
+
const r5 = (void 0 !== i4.converter?.toAttribute ? i4.converter : u).toAttribute(s2, i4.type);
|
|
1527
|
+
this._$Em = t3, null == r5 ? this.removeAttribute(e6) : this.setAttribute(e6, r5), this._$Em = null;
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
_$AK(t3, s2) {
|
|
1531
|
+
const i4 = this.constructor, e6 = i4._$Eh.get(t3);
|
|
1532
|
+
if (void 0 !== e6 && this._$Em !== e6) {
|
|
1533
|
+
const t4 = i4.getPropertyOptions(e6), r5 = "function" == typeof t4.converter ? { fromAttribute: t4.converter } : void 0 !== t4.converter?.fromAttribute ? t4.converter : u;
|
|
1534
|
+
this._$Em = e6, this[e6] = r5.fromAttribute(s2, t4.type), this._$Em = null;
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
requestUpdate(t3, s2, i4) {
|
|
1538
|
+
if (void 0 !== t3) {
|
|
1539
|
+
if (i4 ??= this.constructor.getPropertyOptions(t3), !(i4.hasChanged ?? f)(this[t3], s2))
|
|
1540
|
+
return;
|
|
1541
|
+
this.P(t3, s2, i4);
|
|
1542
|
+
}
|
|
1543
|
+
false === this.isUpdatePending && (this._$ES = this._$ET());
|
|
1544
|
+
}
|
|
1545
|
+
P(t3, s2, i4) {
|
|
1546
|
+
this._$AL.has(t3) || this._$AL.set(t3, s2), true === i4.reflect && this._$Em !== t3 && (this._$Ej ??= /* @__PURE__ */ new Set()).add(t3);
|
|
1547
|
+
}
|
|
1548
|
+
async _$ET() {
|
|
1549
|
+
this.isUpdatePending = true;
|
|
1550
|
+
try {
|
|
1551
|
+
await this._$ES;
|
|
1552
|
+
} catch (t4) {
|
|
1553
|
+
Promise.reject(t4);
|
|
1554
|
+
}
|
|
1555
|
+
const t3 = this.scheduleUpdate();
|
|
1556
|
+
return null != t3 && await t3, !this.isUpdatePending;
|
|
1557
|
+
}
|
|
1558
|
+
scheduleUpdate() {
|
|
1559
|
+
return this.performUpdate();
|
|
1560
|
+
}
|
|
1561
|
+
performUpdate() {
|
|
1562
|
+
if (!this.isUpdatePending)
|
|
1563
|
+
return;
|
|
1564
|
+
if (!this.hasUpdated) {
|
|
1565
|
+
if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
|
|
1566
|
+
for (const [t5, s3] of this._$Ep)
|
|
1567
|
+
this[t5] = s3;
|
|
1568
|
+
this._$Ep = void 0;
|
|
1569
|
+
}
|
|
1570
|
+
const t4 = this.constructor.elementProperties;
|
|
1571
|
+
if (t4.size > 0)
|
|
1572
|
+
for (const [s3, i4] of t4)
|
|
1573
|
+
true !== i4.wrapped || this._$AL.has(s3) || void 0 === this[s3] || this.P(s3, this[s3], i4);
|
|
1574
|
+
}
|
|
1575
|
+
let t3 = false;
|
|
1576
|
+
const s2 = this._$AL;
|
|
1577
|
+
try {
|
|
1578
|
+
t3 = this.shouldUpdate(s2), t3 ? (this.willUpdate(s2), this._$EO?.forEach((t4) => t4.hostUpdate?.()), this.update(s2)) : this._$EU();
|
|
1579
|
+
} catch (s3) {
|
|
1580
|
+
throw t3 = false, this._$EU(), s3;
|
|
1581
|
+
}
|
|
1582
|
+
t3 && this._$AE(s2);
|
|
1583
|
+
}
|
|
1584
|
+
willUpdate(t3) {
|
|
1585
|
+
}
|
|
1586
|
+
_$AE(t3) {
|
|
1587
|
+
this._$EO?.forEach((t4) => t4.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t3)), this.updated(t3);
|
|
1588
|
+
}
|
|
1589
|
+
_$EU() {
|
|
1590
|
+
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false;
|
|
1591
|
+
}
|
|
1592
|
+
get updateComplete() {
|
|
1593
|
+
return this.getUpdateComplete();
|
|
1594
|
+
}
|
|
1595
|
+
getUpdateComplete() {
|
|
1596
|
+
return this._$ES;
|
|
1597
|
+
}
|
|
1598
|
+
shouldUpdate(t3) {
|
|
1599
|
+
return true;
|
|
1600
|
+
}
|
|
1601
|
+
update(t3) {
|
|
1602
|
+
this._$Ej &&= this._$Ej.forEach((t4) => this._$EC(t4, this[t4])), this._$EU();
|
|
1603
|
+
}
|
|
1604
|
+
updated(t3) {
|
|
1605
|
+
}
|
|
1606
|
+
firstUpdated(t3) {
|
|
1607
|
+
}
|
|
1608
|
+
};
|
|
1609
|
+
b.elementStyles = [], b.shadowRootOptions = { mode: "open" }, b[d("elementProperties")] = /* @__PURE__ */ new Map(), b[d("finalized")] = /* @__PURE__ */ new Map(), p?.({ ReactiveElement: b }), (a.reactiveElementVersions ??= []).push("2.0.4");
|
|
1610
|
+
|
|
1611
|
+
// node_modules/lit-html/lit-html.js
|
|
1612
|
+
var n3 = globalThis;
|
|
1613
|
+
var c3 = n3.trustedTypes;
|
|
1614
|
+
var h2 = c3 ? c3.createPolicy("lit-html", { createHTML: (t3) => t3 }) : void 0;
|
|
1615
|
+
var f2 = "$lit$";
|
|
1616
|
+
var v = `lit$${Math.random().toFixed(9).slice(2)}$`;
|
|
1617
|
+
var m = "?" + v;
|
|
1618
|
+
var _ = `<${m}>`;
|
|
1619
|
+
var w = document;
|
|
1620
|
+
var lt = () => w.createComment("");
|
|
1621
|
+
var st = (t3) => null === t3 || "object" != typeof t3 && "function" != typeof t3;
|
|
1622
|
+
var g = Array.isArray;
|
|
1623
|
+
var $ = (t3) => g(t3) || "function" == typeof t3?.[Symbol.iterator];
|
|
1624
|
+
var x = "[ \n\f\r]";
|
|
1625
|
+
var T = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g;
|
|
1626
|
+
var E = /-->/g;
|
|
1627
|
+
var k = />/g;
|
|
1628
|
+
var O = RegExp(`>|${x}(?:([^\\s"'>=/]+)(${x}*=${x}*(?:[^
|
|
1629
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g");
|
|
1630
|
+
var S2 = /'/g;
|
|
1631
|
+
var j = /"/g;
|
|
1632
|
+
var M = /^(?:script|style|textarea|title)$/i;
|
|
1633
|
+
var P = (t3) => (i4, ...s2) => ({ _$litType$: t3, strings: i4, values: s2 });
|
|
1634
|
+
var ke = P(1);
|
|
1635
|
+
var Oe = P(2);
|
|
1636
|
+
var Se = P(3);
|
|
1637
|
+
var R = Symbol.for("lit-noChange");
|
|
1638
|
+
var D = Symbol.for("lit-nothing");
|
|
1639
|
+
var V = /* @__PURE__ */ new WeakMap();
|
|
1640
|
+
var I = w.createTreeWalker(w, 129);
|
|
1641
|
+
function N(t3, i4) {
|
|
1642
|
+
if (!g(t3) || !t3.hasOwnProperty("raw"))
|
|
1643
|
+
throw Error("invalid template strings array");
|
|
1644
|
+
return void 0 !== h2 ? h2.createHTML(i4) : i4;
|
|
1645
|
+
}
|
|
1646
|
+
var U = (t3, i4) => {
|
|
1647
|
+
const s2 = t3.length - 1, e6 = [];
|
|
1648
|
+
let h4, o4 = 2 === i4 ? "<svg>" : 3 === i4 ? "<math>" : "", n5 = T;
|
|
1649
|
+
for (let i5 = 0; i5 < s2; i5++) {
|
|
1650
|
+
const s3 = t3[i5];
|
|
1651
|
+
let r5, l2, c4 = -1, a2 = 0;
|
|
1652
|
+
for (; a2 < s3.length && (n5.lastIndex = a2, l2 = n5.exec(s3), null !== l2); )
|
|
1653
|
+
a2 = n5.lastIndex, n5 === T ? "!--" === l2[1] ? n5 = E : void 0 !== l2[1] ? n5 = k : void 0 !== l2[2] ? (M.test(l2[2]) && (h4 = RegExp("</" + l2[2], "g")), n5 = O) : void 0 !== l2[3] && (n5 = O) : n5 === O ? ">" === l2[0] ? (n5 = h4 ?? T, c4 = -1) : void 0 === l2[1] ? c4 = -2 : (c4 = n5.lastIndex - l2[2].length, r5 = l2[1], n5 = void 0 === l2[3] ? O : '"' === l2[3] ? j : S2) : n5 === j || n5 === S2 ? n5 = O : n5 === E || n5 === k ? n5 = T : (n5 = O, h4 = void 0);
|
|
1654
|
+
const u2 = n5 === O && t3[i5 + 1].startsWith("/>") ? " " : "";
|
|
1655
|
+
o4 += n5 === T ? s3 + _ : c4 >= 0 ? (e6.push(r5), s3.slice(0, c4) + f2 + s3.slice(c4) + v + u2) : s3 + v + (-2 === c4 ? i5 : u2);
|
|
1656
|
+
}
|
|
1657
|
+
return [N(t3, o4 + (t3[s2] || "<?>") + (2 === i4 ? "</svg>" : 3 === i4 ? "</math>" : "")), e6];
|
|
1658
|
+
};
|
|
1659
|
+
var B = class _B {
|
|
1660
|
+
constructor({ strings: t3, _$litType$: i4 }, s2) {
|
|
1661
|
+
let e6;
|
|
1662
|
+
this.parts = [];
|
|
1663
|
+
let h4 = 0, o4 = 0;
|
|
1664
|
+
const n5 = t3.length - 1, r5 = this.parts, [l2, a2] = U(t3, i4);
|
|
1665
|
+
if (this.el = _B.createElement(l2, s2), I.currentNode = this.el.content, 2 === i4 || 3 === i4) {
|
|
1666
|
+
const t4 = this.el.content.firstChild;
|
|
1667
|
+
t4.replaceWith(...t4.childNodes);
|
|
1668
|
+
}
|
|
1669
|
+
for (; null !== (e6 = I.nextNode()) && r5.length < n5; ) {
|
|
1670
|
+
if (1 === e6.nodeType) {
|
|
1671
|
+
if (e6.hasAttributes())
|
|
1672
|
+
for (const t4 of e6.getAttributeNames())
|
|
1673
|
+
if (t4.endsWith(f2)) {
|
|
1674
|
+
const i5 = a2[o4++], s3 = e6.getAttribute(t4).split(v), n6 = /([.?@])?(.*)/.exec(i5);
|
|
1675
|
+
r5.push({ type: 1, index: h4, name: n6[2], strings: s3, ctor: "." === n6[1] ? Y : "?" === n6[1] ? Z : "@" === n6[1] ? q : G }), e6.removeAttribute(t4);
|
|
1676
|
+
} else
|
|
1677
|
+
t4.startsWith(v) && (r5.push({ type: 6, index: h4 }), e6.removeAttribute(t4));
|
|
1678
|
+
if (M.test(e6.tagName)) {
|
|
1679
|
+
const t4 = e6.textContent.split(v), i5 = t4.length - 1;
|
|
1680
|
+
if (i5 > 0) {
|
|
1681
|
+
e6.textContent = c3 ? c3.emptyScript : "";
|
|
1682
|
+
for (let s3 = 0; s3 < i5; s3++)
|
|
1683
|
+
e6.append(t4[s3], lt()), I.nextNode(), r5.push({ type: 2, index: ++h4 });
|
|
1684
|
+
e6.append(t4[i5], lt());
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
} else if (8 === e6.nodeType)
|
|
1688
|
+
if (e6.data === m)
|
|
1689
|
+
r5.push({ type: 2, index: h4 });
|
|
1690
|
+
else {
|
|
1691
|
+
let t4 = -1;
|
|
1692
|
+
for (; -1 !== (t4 = e6.data.indexOf(v, t4 + 1)); )
|
|
1693
|
+
r5.push({ type: 7, index: h4 }), t4 += v.length - 1;
|
|
1694
|
+
}
|
|
1695
|
+
h4++;
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
static createElement(t3, i4) {
|
|
1699
|
+
const s2 = w.createElement("template");
|
|
1700
|
+
return s2.innerHTML = t3, s2;
|
|
1701
|
+
}
|
|
1702
|
+
};
|
|
1703
|
+
function z(t3, i4, s2 = t3, e6) {
|
|
1704
|
+
if (i4 === R)
|
|
1705
|
+
return i4;
|
|
1706
|
+
let h4 = void 0 !== e6 ? s2.o?.[e6] : s2.l;
|
|
1707
|
+
const o4 = st(i4) ? void 0 : i4._$litDirective$;
|
|
1708
|
+
return h4?.constructor !== o4 && (h4?._$AO?.(false), void 0 === o4 ? h4 = void 0 : (h4 = new o4(t3), h4._$AT(t3, s2, e6)), void 0 !== e6 ? (s2.o ??= [])[e6] = h4 : s2.l = h4), void 0 !== h4 && (i4 = z(t3, h4._$AS(t3, i4.values), h4, e6)), i4;
|
|
1709
|
+
}
|
|
1710
|
+
var F = class {
|
|
1711
|
+
constructor(t3, i4) {
|
|
1712
|
+
this._$AV = [], this._$AN = void 0, this._$AD = t3, this._$AM = i4;
|
|
1713
|
+
}
|
|
1714
|
+
get parentNode() {
|
|
1715
|
+
return this._$AM.parentNode;
|
|
1716
|
+
}
|
|
1717
|
+
get _$AU() {
|
|
1718
|
+
return this._$AM._$AU;
|
|
1719
|
+
}
|
|
1720
|
+
u(t3) {
|
|
1721
|
+
const { el: { content: i4 }, parts: s2 } = this._$AD, e6 = (t3?.creationScope ?? w).importNode(i4, true);
|
|
1722
|
+
I.currentNode = e6;
|
|
1723
|
+
let h4 = I.nextNode(), o4 = 0, n5 = 0, r5 = s2[0];
|
|
1724
|
+
for (; void 0 !== r5; ) {
|
|
1725
|
+
if (o4 === r5.index) {
|
|
1726
|
+
let i5;
|
|
1727
|
+
2 === r5.type ? i5 = new et(h4, h4.nextSibling, this, t3) : 1 === r5.type ? i5 = new r5.ctor(h4, r5.name, r5.strings, this, t3) : 6 === r5.type && (i5 = new K(h4, this, t3)), this._$AV.push(i5), r5 = s2[++n5];
|
|
1728
|
+
}
|
|
1729
|
+
o4 !== r5?.index && (h4 = I.nextNode(), o4++);
|
|
1730
|
+
}
|
|
1731
|
+
return I.currentNode = w, e6;
|
|
1732
|
+
}
|
|
1733
|
+
p(t3) {
|
|
1734
|
+
let i4 = 0;
|
|
1735
|
+
for (const s2 of this._$AV)
|
|
1736
|
+
void 0 !== s2 && (void 0 !== s2.strings ? (s2._$AI(t3, s2, i4), i4 += s2.strings.length - 2) : s2._$AI(t3[i4])), i4++;
|
|
1737
|
+
}
|
|
1738
|
+
};
|
|
1739
|
+
var et = class _et {
|
|
1740
|
+
get _$AU() {
|
|
1741
|
+
return this._$AM?._$AU ?? this.v;
|
|
1742
|
+
}
|
|
1743
|
+
constructor(t3, i4, s2, e6) {
|
|
1744
|
+
this.type = 2, this._$AH = D, this._$AN = void 0, this._$AA = t3, this._$AB = i4, this._$AM = s2, this.options = e6, this.v = e6?.isConnected ?? true;
|
|
1745
|
+
}
|
|
1746
|
+
get parentNode() {
|
|
1747
|
+
let t3 = this._$AA.parentNode;
|
|
1748
|
+
const i4 = this._$AM;
|
|
1749
|
+
return void 0 !== i4 && 11 === t3?.nodeType && (t3 = i4.parentNode), t3;
|
|
1750
|
+
}
|
|
1751
|
+
get startNode() {
|
|
1752
|
+
return this._$AA;
|
|
1753
|
+
}
|
|
1754
|
+
get endNode() {
|
|
1755
|
+
return this._$AB;
|
|
1756
|
+
}
|
|
1757
|
+
_$AI(t3, i4 = this) {
|
|
1758
|
+
t3 = z(this, t3, i4), st(t3) ? t3 === D || null == t3 || "" === t3 ? (this._$AH !== D && this._$AR(), this._$AH = D) : t3 !== this._$AH && t3 !== R && this._(t3) : void 0 !== t3._$litType$ ? this.$(t3) : void 0 !== t3.nodeType ? this.T(t3) : $(t3) ? this.k(t3) : this._(t3);
|
|
1759
|
+
}
|
|
1760
|
+
O(t3) {
|
|
1761
|
+
return this._$AA.parentNode.insertBefore(t3, this._$AB);
|
|
1762
|
+
}
|
|
1763
|
+
T(t3) {
|
|
1764
|
+
this._$AH !== t3 && (this._$AR(), this._$AH = this.O(t3));
|
|
1765
|
+
}
|
|
1766
|
+
_(t3) {
|
|
1767
|
+
this._$AH !== D && st(this._$AH) ? this._$AA.nextSibling.data = t3 : this.T(w.createTextNode(t3)), this._$AH = t3;
|
|
1768
|
+
}
|
|
1769
|
+
$(t3) {
|
|
1770
|
+
const { values: i4, _$litType$: s2 } = t3, e6 = "number" == typeof s2 ? this._$AC(t3) : (void 0 === s2.el && (s2.el = B.createElement(N(s2.h, s2.h[0]), this.options)), s2);
|
|
1771
|
+
if (this._$AH?._$AD === e6)
|
|
1772
|
+
this._$AH.p(i4);
|
|
1773
|
+
else {
|
|
1774
|
+
const t4 = new F(e6, this), s3 = t4.u(this.options);
|
|
1775
|
+
t4.p(i4), this.T(s3), this._$AH = t4;
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
_$AC(t3) {
|
|
1779
|
+
let i4 = V.get(t3.strings);
|
|
1780
|
+
return void 0 === i4 && V.set(t3.strings, i4 = new B(t3)), i4;
|
|
1781
|
+
}
|
|
1782
|
+
k(t3) {
|
|
1783
|
+
g(this._$AH) || (this._$AH = [], this._$AR());
|
|
1784
|
+
const i4 = this._$AH;
|
|
1785
|
+
let s2, e6 = 0;
|
|
1786
|
+
for (const h4 of t3)
|
|
1787
|
+
e6 === i4.length ? i4.push(s2 = new _et(this.O(lt()), this.O(lt()), this, this.options)) : s2 = i4[e6], s2._$AI(h4), e6++;
|
|
1788
|
+
e6 < i4.length && (this._$AR(s2 && s2._$AB.nextSibling, e6), i4.length = e6);
|
|
1789
|
+
}
|
|
1790
|
+
_$AR(t3 = this._$AA.nextSibling, i4) {
|
|
1791
|
+
for (this._$AP?.(false, true, i4); t3 && t3 !== this._$AB; ) {
|
|
1792
|
+
const i5 = t3.nextSibling;
|
|
1793
|
+
t3.remove(), t3 = i5;
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
setConnected(t3) {
|
|
1797
|
+
void 0 === this._$AM && (this.v = t3, this._$AP?.(t3));
|
|
1798
|
+
}
|
|
1799
|
+
};
|
|
1800
|
+
var G = class {
|
|
1801
|
+
get tagName() {
|
|
1802
|
+
return this.element.tagName;
|
|
1803
|
+
}
|
|
1804
|
+
get _$AU() {
|
|
1805
|
+
return this._$AM._$AU;
|
|
1806
|
+
}
|
|
1807
|
+
constructor(t3, i4, s2, e6, h4) {
|
|
1808
|
+
this.type = 1, this._$AH = D, this._$AN = void 0, this.element = t3, this.name = i4, this._$AM = e6, this.options = h4, s2.length > 2 || "" !== s2[0] || "" !== s2[1] ? (this._$AH = Array(s2.length - 1).fill(new String()), this.strings = s2) : this._$AH = D;
|
|
1809
|
+
}
|
|
1810
|
+
_$AI(t3, i4 = this, s2, e6) {
|
|
1811
|
+
const h4 = this.strings;
|
|
1812
|
+
let o4 = false;
|
|
1813
|
+
if (void 0 === h4)
|
|
1814
|
+
t3 = z(this, t3, i4, 0), o4 = !st(t3) || t3 !== this._$AH && t3 !== R, o4 && (this._$AH = t3);
|
|
1815
|
+
else {
|
|
1816
|
+
const e7 = t3;
|
|
1817
|
+
let n5, r5;
|
|
1818
|
+
for (t3 = h4[0], n5 = 0; n5 < h4.length - 1; n5++)
|
|
1819
|
+
r5 = z(this, e7[s2 + n5], i4, n5), r5 === R && (r5 = this._$AH[n5]), o4 ||= !st(r5) || r5 !== this._$AH[n5], r5 === D ? t3 = D : t3 !== D && (t3 += (r5 ?? "") + h4[n5 + 1]), this._$AH[n5] = r5;
|
|
1820
|
+
}
|
|
1821
|
+
o4 && !e6 && this.j(t3);
|
|
1822
|
+
}
|
|
1823
|
+
j(t3) {
|
|
1824
|
+
t3 === D ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t3 ?? "");
|
|
1825
|
+
}
|
|
1826
|
+
};
|
|
1827
|
+
var Y = class extends G {
|
|
1828
|
+
constructor() {
|
|
1829
|
+
super(...arguments), this.type = 3;
|
|
1830
|
+
}
|
|
1831
|
+
j(t3) {
|
|
1832
|
+
this.element[this.name] = t3 === D ? void 0 : t3;
|
|
1833
|
+
}
|
|
1834
|
+
};
|
|
1835
|
+
var Z = class extends G {
|
|
1836
|
+
constructor() {
|
|
1837
|
+
super(...arguments), this.type = 4;
|
|
1838
|
+
}
|
|
1839
|
+
j(t3) {
|
|
1840
|
+
this.element.toggleAttribute(this.name, !!t3 && t3 !== D);
|
|
1841
|
+
}
|
|
1842
|
+
};
|
|
1843
|
+
var q = class extends G {
|
|
1844
|
+
constructor(t3, i4, s2, e6, h4) {
|
|
1845
|
+
super(t3, i4, s2, e6, h4), this.type = 5;
|
|
1846
|
+
}
|
|
1847
|
+
_$AI(t3, i4 = this) {
|
|
1848
|
+
if ((t3 = z(this, t3, i4, 0) ?? D) === R)
|
|
1849
|
+
return;
|
|
1850
|
+
const s2 = this._$AH, e6 = t3 === D && s2 !== D || t3.capture !== s2.capture || t3.once !== s2.once || t3.passive !== s2.passive, h4 = t3 !== D && (s2 === D || e6);
|
|
1851
|
+
e6 && this.element.removeEventListener(this.name, this, s2), h4 && this.element.addEventListener(this.name, this, t3), this._$AH = t3;
|
|
1852
|
+
}
|
|
1853
|
+
handleEvent(t3) {
|
|
1854
|
+
"function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t3) : this._$AH.handleEvent(t3);
|
|
1855
|
+
}
|
|
1856
|
+
};
|
|
1857
|
+
var K = class {
|
|
1858
|
+
constructor(t3, i4, s2) {
|
|
1859
|
+
this.element = t3, this.type = 6, this._$AN = void 0, this._$AM = i4, this.options = s2;
|
|
1860
|
+
}
|
|
1861
|
+
get _$AU() {
|
|
1862
|
+
return this._$AM._$AU;
|
|
1863
|
+
}
|
|
1864
|
+
_$AI(t3) {
|
|
1865
|
+
z(this, t3);
|
|
1866
|
+
}
|
|
1867
|
+
};
|
|
1868
|
+
var Re = n3.litHtmlPolyfillSupport;
|
|
1869
|
+
Re?.(B, et), (n3.litHtmlVersions ??= []).push("3.2.0");
|
|
1870
|
+
var Q = (t3, i4, s2) => {
|
|
1871
|
+
const e6 = s2?.renderBefore ?? i4;
|
|
1872
|
+
let h4 = e6._$litPart$;
|
|
1873
|
+
if (void 0 === h4) {
|
|
1874
|
+
const t4 = s2?.renderBefore ?? null;
|
|
1875
|
+
e6._$litPart$ = h4 = new et(i4.insertBefore(lt(), t4), t4, void 0, s2 ?? {});
|
|
1876
|
+
}
|
|
1877
|
+
return h4._$AI(t3), h4;
|
|
1878
|
+
};
|
|
1879
|
+
|
|
1880
|
+
// node_modules/lit-element/lit-element.js
|
|
1881
|
+
var h3 = class extends b {
|
|
1882
|
+
constructor() {
|
|
1883
|
+
super(...arguments), this.renderOptions = { host: this }, this.o = void 0;
|
|
1884
|
+
}
|
|
1885
|
+
createRenderRoot() {
|
|
1886
|
+
const t3 = super.createRenderRoot();
|
|
1887
|
+
return this.renderOptions.renderBefore ??= t3.firstChild, t3;
|
|
1888
|
+
}
|
|
1889
|
+
update(t3) {
|
|
1890
|
+
const e6 = this.render();
|
|
1891
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t3), this.o = Q(e6, this.renderRoot, this.renderOptions);
|
|
1892
|
+
}
|
|
1893
|
+
connectedCallback() {
|
|
1894
|
+
super.connectedCallback(), this.o?.setConnected(true);
|
|
1895
|
+
}
|
|
1896
|
+
disconnectedCallback() {
|
|
1897
|
+
super.disconnectedCallback(), this.o?.setConnected(false);
|
|
1898
|
+
}
|
|
1899
|
+
render() {
|
|
1900
|
+
return R;
|
|
1901
|
+
}
|
|
1902
|
+
};
|
|
1903
|
+
h3._$litElement$ = true, h3["finalized"] = true, globalThis.litElementHydrateSupport?.({ LitElement: h3 });
|
|
1904
|
+
var f3 = globalThis.litElementPolyfillSupport;
|
|
1905
|
+
f3?.({ LitElement: h3 });
|
|
1906
|
+
(globalThis.litElementVersions ??= []).push("4.1.0");
|
|
1907
|
+
|
|
1908
|
+
// node_modules/@lit/reactive-element/decorators/property.js
|
|
1909
|
+
var o3 = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f };
|
|
1910
|
+
var r3 = (t3 = o3, e6, r5) => {
|
|
1911
|
+
const { kind: n5, metadata: i4 } = r5;
|
|
1912
|
+
let s2 = globalThis.litPropertyMetadata.get(i4);
|
|
1913
|
+
if (void 0 === s2 && globalThis.litPropertyMetadata.set(i4, s2 = /* @__PURE__ */ new Map()), s2.set(r5.name, t3), "accessor" === n5) {
|
|
1914
|
+
const { name: o4 } = r5;
|
|
1915
|
+
return { set(r6) {
|
|
1916
|
+
const n6 = e6.get.call(this);
|
|
1917
|
+
e6.set.call(this, r6), this.requestUpdate(o4, n6, t3);
|
|
1918
|
+
}, init(e7) {
|
|
1919
|
+
return void 0 !== e7 && this.P(o4, void 0, t3), e7;
|
|
1920
|
+
} };
|
|
1921
|
+
}
|
|
1922
|
+
if ("setter" === n5) {
|
|
1923
|
+
const { name: o4 } = r5;
|
|
1924
|
+
return function(r6) {
|
|
1925
|
+
const n6 = this[o4];
|
|
1926
|
+
e6.call(this, r6), this.requestUpdate(o4, n6, t3);
|
|
1927
|
+
};
|
|
1928
|
+
}
|
|
1929
|
+
throw Error("Unsupported decorator location: " + n5);
|
|
1930
|
+
};
|
|
1931
|
+
function n4(t3) {
|
|
1932
|
+
return (e6, o4) => "object" == typeof o4 ? r3(t3, e6, o4) : ((t4, e7, o5) => {
|
|
1933
|
+
const r5 = e7.hasOwnProperty(o5);
|
|
1934
|
+
return e7.constructor.createProperty(o5, r5 ? { ...t4, wrapped: true } : t4), r5 ? Object.getOwnPropertyDescriptor(e7, o5) : void 0;
|
|
1935
|
+
})(t3, e6, o4);
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
// node_modules/@lit/reactive-element/decorators/state.js
|
|
1939
|
+
function r4(r5) {
|
|
1940
|
+
return n4({ ...r5, state: true, attribute: false });
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
// node_modules/@lit/reactive-element/decorators/base.js
|
|
1944
|
+
var e3 = (e6, t3, c4) => (c4.configurable = true, c4.enumerable = true, Reflect.decorate && "object" != typeof t3 && Object.defineProperty(e6, t3, c4), c4);
|
|
1945
|
+
|
|
1946
|
+
// node_modules/@lit/reactive-element/decorators/query.js
|
|
1947
|
+
function e4(e6, r5) {
|
|
1948
|
+
return (n5, s2, i4) => {
|
|
1949
|
+
const o4 = (t3) => t3.renderRoot?.querySelector(e6) ?? null;
|
|
1950
|
+
if (r5) {
|
|
1951
|
+
const { get: e7, set: r6 } = "object" == typeof s2 ? n5 : i4 ?? (() => {
|
|
1952
|
+
const t3 = Symbol();
|
|
1953
|
+
return { get() {
|
|
1954
|
+
return this[t3];
|
|
1955
|
+
}, set(e8) {
|
|
1956
|
+
this[t3] = e8;
|
|
1957
|
+
} };
|
|
1958
|
+
})();
|
|
1959
|
+
return e3(n5, s2, { get() {
|
|
1960
|
+
let t3 = e7.call(this);
|
|
1961
|
+
return void 0 === t3 && (t3 = o4(this), (null !== t3 || this.hasUpdated) && r6.call(this, t3)), t3;
|
|
1962
|
+
} });
|
|
1963
|
+
}
|
|
1964
|
+
return e3(n5, s2, { get() {
|
|
1965
|
+
return o4(this);
|
|
1966
|
+
} });
|
|
1967
|
+
};
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
// node_modules/lit-html/directive.js
|
|
1971
|
+
var t2 = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 };
|
|
1972
|
+
var e5 = (t3) => (...e6) => ({ _$litDirective$: t3, values: e6 });
|
|
1973
|
+
var i3 = class {
|
|
1974
|
+
constructor(t3) {
|
|
1975
|
+
}
|
|
1976
|
+
get _$AU() {
|
|
1977
|
+
return this._$AM._$AU;
|
|
1978
|
+
}
|
|
1979
|
+
_$AT(t3, e6, i4) {
|
|
1980
|
+
this.t = t3, this._$AM = e6, this.i = i4;
|
|
1981
|
+
}
|
|
1982
|
+
_$AS(t3, e6) {
|
|
1983
|
+
return this.update(t3, e6);
|
|
1984
|
+
}
|
|
1985
|
+
update(t3, e6) {
|
|
1986
|
+
return this.render(...e6);
|
|
1987
|
+
}
|
|
1988
|
+
};
|
|
1989
|
+
|
|
1990
|
+
// node_modules/lit-html/directives/style-map.js
|
|
1991
|
+
var ee = "important";
|
|
1992
|
+
var ie = " !" + ee;
|
|
1993
|
+
var se = e5(class extends i3 {
|
|
1994
|
+
constructor(e6) {
|
|
1995
|
+
if (super(e6), e6.type !== t2.ATTRIBUTE || "style" !== e6.name || e6.strings?.length > 2)
|
|
1996
|
+
throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.");
|
|
1997
|
+
}
|
|
1998
|
+
render(t3) {
|
|
1999
|
+
return Object.keys(t3).reduce((e6, r5) => {
|
|
2000
|
+
const s2 = t3[r5];
|
|
2001
|
+
return null == s2 ? e6 : e6 + `${r5 = r5.includes("-") ? r5 : r5.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase()}:${s2};`;
|
|
2002
|
+
}, "");
|
|
2003
|
+
}
|
|
2004
|
+
update(t3, [e6]) {
|
|
2005
|
+
const { style: r5 } = t3.element;
|
|
2006
|
+
if (void 0 === this.ft)
|
|
2007
|
+
return this.ft = new Set(Object.keys(e6)), this.render(e6);
|
|
2008
|
+
for (const t4 of this.ft)
|
|
2009
|
+
null == e6[t4] && (this.ft.delete(t4), t4.includes("-") ? r5.removeProperty(t4) : r5[t4] = null);
|
|
2010
|
+
for (const t4 in e6) {
|
|
2011
|
+
const s2 = e6[t4];
|
|
2012
|
+
if (null != s2) {
|
|
2013
|
+
this.ft.add(t4);
|
|
2014
|
+
const e7 = "string" == typeof s2 && s2.endsWith(ie);
|
|
2015
|
+
t4.includes("-") || e7 ? r5.setProperty(t4, e7 ? s2.slice(0, -11) : s2, e7 ? ee : "") : r5[t4] = s2;
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
return R;
|
|
2019
|
+
}
|
|
2020
|
+
});
|
|
2021
|
+
|
|
2022
|
+
// libs/embed-libs/embed/package.json
|
|
2023
|
+
var version = "6.2.4-beta.1";
|
|
2024
|
+
|
|
2025
|
+
// libs/embed-libs/embed/src/lib/luzmo-service.ts
|
|
2026
|
+
var LuzmoService = class {
|
|
2027
|
+
constructor() {
|
|
2028
|
+
this._components = [];
|
|
2029
|
+
}
|
|
2030
|
+
};
|
|
2031
|
+
var luzmo_service_default = new LuzmoService();
|
|
2032
|
+
|
|
2033
|
+
// libs/embed-libs/embed/src/lib/helper/event-bus-handler.ts
|
|
2034
|
+
var _setEventHandler = () => {
|
|
2035
|
+
if (typeof window.__luzmoMessageHandler === "function") {
|
|
2036
|
+
return;
|
|
2037
|
+
}
|
|
2038
|
+
window.__luzmoMessageHandler = (event) => {
|
|
2039
|
+
const dashboardComponent = luzmo_service_default._components.find(
|
|
2040
|
+
(c4) => event.data.name === c4._iframeId
|
|
2041
|
+
);
|
|
2042
|
+
if (!dashboardComponent) {
|
|
2043
|
+
return;
|
|
2044
|
+
}
|
|
2045
|
+
switch (event.data?.type) {
|
|
2046
|
+
case "load": {
|
|
2047
|
+
dashboardComponent.dispatchEvent(
|
|
2048
|
+
new CustomEvent("load", { detail: { data: event.data } })
|
|
2049
|
+
);
|
|
2050
|
+
if (dashboardComponent._loadTimeoutHandle) {
|
|
2051
|
+
clearTimeout(dashboardComponent._loadTimeoutHandle);
|
|
2052
|
+
dashboardComponent._loadTimeoutHandle = void 0;
|
|
2053
|
+
}
|
|
2054
|
+
dashboardComponent.iframeLoaded = true;
|
|
2055
|
+
dashboardComponent.dimensions = event.data.dimensions;
|
|
2056
|
+
dashboardComponent._calculateDimAfterDashboardLoaded();
|
|
2057
|
+
break;
|
|
2058
|
+
}
|
|
2059
|
+
case "error": {
|
|
2060
|
+
dashboardComponent.dashboardError = true;
|
|
2061
|
+
if (dashboardComponent._loadTimeoutHandle) {
|
|
2062
|
+
clearTimeout(dashboardComponent._loadTimeoutHandle);
|
|
2063
|
+
dashboardComponent._loadTimeoutHandle = void 0;
|
|
2064
|
+
}
|
|
2065
|
+
dashboardComponent.iframeLoaded = true;
|
|
2066
|
+
dashboardComponent._displayError();
|
|
2067
|
+
console.error("Dashboard error:", event.data.errorMsg ?? event.data.error?.msg);
|
|
2068
|
+
break;
|
|
2069
|
+
}
|
|
2070
|
+
case "data": {
|
|
2071
|
+
resolvePromise(
|
|
2072
|
+
dashboardComponent,
|
|
2073
|
+
event.data.requestId,
|
|
2074
|
+
event.data.data
|
|
2075
|
+
);
|
|
2076
|
+
break;
|
|
2077
|
+
}
|
|
2078
|
+
case "filters": {
|
|
2079
|
+
resolvePromise(
|
|
2080
|
+
dashboardComponent,
|
|
2081
|
+
event.data.requestId,
|
|
2082
|
+
event.data.filters
|
|
2083
|
+
);
|
|
2084
|
+
break;
|
|
2085
|
+
}
|
|
2086
|
+
case "getAccessibleDashboards": {
|
|
2087
|
+
resolvePromise(
|
|
2088
|
+
dashboardComponent,
|
|
2089
|
+
event.data.requestId,
|
|
2090
|
+
event.data.accessibleDashboards
|
|
2091
|
+
);
|
|
2092
|
+
break;
|
|
2093
|
+
}
|
|
2094
|
+
case "dashboardAction": {
|
|
2095
|
+
dashboardComponent.dispatchEvent(
|
|
2096
|
+
new CustomEvent("dashboardAction", { detail: { data: event.data } })
|
|
2097
|
+
);
|
|
2098
|
+
break;
|
|
2099
|
+
}
|
|
2100
|
+
case "export": {
|
|
2101
|
+
if (event.data.error) {
|
|
2102
|
+
rejectPromise(
|
|
2103
|
+
dashboardComponent,
|
|
2104
|
+
event.data.requestId,
|
|
2105
|
+
event.data
|
|
2106
|
+
);
|
|
2107
|
+
} else {
|
|
2108
|
+
dashboardComponent.dispatchEvent(
|
|
2109
|
+
new CustomEvent("exported", { detail: { data: event.data } })
|
|
2110
|
+
);
|
|
2111
|
+
resolvePromise(
|
|
2112
|
+
dashboardComponent,
|
|
2113
|
+
event.data.requestId,
|
|
2114
|
+
event.data
|
|
2115
|
+
);
|
|
2116
|
+
}
|
|
2117
|
+
break;
|
|
2118
|
+
}
|
|
2119
|
+
case "changedFilters": {
|
|
2120
|
+
dashboardComponent.dispatchEvent(
|
|
2121
|
+
new CustomEvent("changedFilters", { detail: { data: event.data } })
|
|
2122
|
+
);
|
|
2123
|
+
break;
|
|
2124
|
+
}
|
|
2125
|
+
case "customEvent": {
|
|
2126
|
+
dashboardComponent.dispatchEvent(
|
|
2127
|
+
new CustomEvent("customEvent", { detail: { data: event.data } })
|
|
2128
|
+
);
|
|
2129
|
+
break;
|
|
2130
|
+
}
|
|
2131
|
+
case "chartsRendered":
|
|
2132
|
+
case "itemsRendered": {
|
|
2133
|
+
event.data.type = "itemsRendered";
|
|
2134
|
+
dashboardComponent.dispatchEvent(
|
|
2135
|
+
new CustomEvent("itemsRendered", { detail: { data: event.data } })
|
|
2136
|
+
);
|
|
2137
|
+
break;
|
|
2138
|
+
}
|
|
2139
|
+
case "setEditMode": {
|
|
2140
|
+
if (event.data.error) {
|
|
2141
|
+
rejectPromise(
|
|
2142
|
+
dashboardComponent,
|
|
2143
|
+
event.data.requestId,
|
|
2144
|
+
event.data
|
|
2145
|
+
);
|
|
2146
|
+
} else {
|
|
2147
|
+
resolvePromise(
|
|
2148
|
+
dashboardComponent,
|
|
2149
|
+
event.data.requestId,
|
|
2150
|
+
event.data
|
|
2151
|
+
);
|
|
2152
|
+
dashboardComponent.params.editMode = event.data.editMode;
|
|
2153
|
+
dashboardComponent._containerStyle = containerStyles(dashboardComponent);
|
|
2154
|
+
if (dashboardComponent.dimensions) {
|
|
2155
|
+
_setCalculatedDimensions(dashboardComponent);
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
break;
|
|
2159
|
+
}
|
|
2160
|
+
case "calculatedDimensions": {
|
|
2161
|
+
dashboardComponent.dimensions = event.data.dimensions;
|
|
2162
|
+
_setCalculatedDimensions(dashboardComponent);
|
|
2163
|
+
break;
|
|
2164
|
+
}
|
|
2165
|
+
case "setSelectedData":
|
|
2166
|
+
case "setFilters": {
|
|
2167
|
+
if (event.data.error) {
|
|
2168
|
+
rejectPromise(
|
|
2169
|
+
dashboardComponent,
|
|
2170
|
+
event.data.requestId,
|
|
2171
|
+
event.data
|
|
2172
|
+
);
|
|
2173
|
+
} else {
|
|
2174
|
+
resolvePromise(
|
|
2175
|
+
dashboardComponent,
|
|
2176
|
+
event.data.requestId,
|
|
2177
|
+
event.data
|
|
2178
|
+
);
|
|
2179
|
+
}
|
|
2180
|
+
break;
|
|
2181
|
+
}
|
|
2182
|
+
case "setPreview": {
|
|
2183
|
+
if (event.data.error) {
|
|
2184
|
+
rejectPromise(
|
|
2185
|
+
dashboardComponent,
|
|
2186
|
+
event.data.requestId,
|
|
2187
|
+
event.data
|
|
2188
|
+
);
|
|
2189
|
+
} else {
|
|
2190
|
+
resolvePromise(
|
|
2191
|
+
dashboardComponent,
|
|
2192
|
+
event.data.requestId,
|
|
2193
|
+
event.data
|
|
2194
|
+
);
|
|
2195
|
+
}
|
|
2196
|
+
break;
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
};
|
|
2200
|
+
window.addEventListener("message", window.__luzmoMessageHandler, false);
|
|
2201
|
+
};
|
|
2202
|
+
|
|
2203
|
+
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-styles.ts
|
|
2204
|
+
var dashboardStyles = i`
|
|
2205
|
+
:host {
|
|
2206
|
+
display: block;
|
|
2207
|
+
height: 100%;
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
@-webkit-keyframes spin {
|
|
2211
|
+
0% {
|
|
2212
|
+
-webkit-transform: rotate(0deg);
|
|
2213
|
+
transform: rotate(0deg);
|
|
2214
|
+
}
|
|
2215
|
+
100% {
|
|
2216
|
+
-webkit-transform: rotate(360deg);
|
|
2217
|
+
transform: rotate(360deg);
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2220
|
+
|
|
2221
|
+
@keyframes spin {
|
|
2222
|
+
0% {
|
|
2223
|
+
-webkit-transform: rotate(0deg);
|
|
2224
|
+
transform: rotate(0deg);
|
|
2225
|
+
}
|
|
2226
|
+
100% {
|
|
2227
|
+
-webkit-transform: rotate(360deg);
|
|
2228
|
+
transform: rotate(360deg);
|
|
2229
|
+
}
|
|
2230
|
+
}
|
|
2231
|
+
:host {
|
|
2232
|
+
position: relative;
|
|
2233
|
+
width: 100%;
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2236
|
+
.luzmo-embed-dashboard {
|
|
2237
|
+
background: transparent;
|
|
2238
|
+
padding: 0;
|
|
2239
|
+
border: 0;
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
.luzmo-embed-dashboard-ede {
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
.luzmo-embed-container-ede {
|
|
2246
|
+
width: 100%;
|
|
2247
|
+
height: 100%;
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2250
|
+
.luzmo-container-loader {
|
|
2251
|
+
width: 100%;
|
|
2252
|
+
position: relative;
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
.luzmo-lc {
|
|
2256
|
+
margin: 0 auto;
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
|
+
.luzmo-loading-message {
|
|
2260
|
+
width: 100%;
|
|
2261
|
+
height: 20px;
|
|
2262
|
+
text-align: center;
|
|
2263
|
+
margin-bottom: 16px;
|
|
2264
|
+
font-family: Helvetica, Arial, sans-serif;
|
|
2265
|
+
font-size: 14px;
|
|
2266
|
+
}
|
|
2267
|
+
|
|
2268
|
+
.luzmo-loading-circle {
|
|
2269
|
+
box-sizing: border-box;
|
|
2270
|
+
margin: 16px auto;
|
|
2271
|
+
position: relative;
|
|
2272
|
+
text-indent: -9999em;
|
|
2273
|
+
animation: spin 0.6s infinite linear;
|
|
2274
|
+
}
|
|
2275
|
+
|
|
2276
|
+
.luzmo-loading-circle,
|
|
2277
|
+
.luzmo-loading-circle:after {
|
|
2278
|
+
border-radius: 50%;
|
|
2279
|
+
width: 32px;
|
|
2280
|
+
height: 32px;
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
.itemEmbedding:after {
|
|
2284
|
+
width: 24px;
|
|
2285
|
+
height: 24px;
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
.luzmo-error {
|
|
2289
|
+
background: transparent;
|
|
2290
|
+
padding: 48px 0;
|
|
2291
|
+
margin: 0 auto;
|
|
2292
|
+
width: 80%;
|
|
2293
|
+
border: 0;
|
|
2294
|
+
text-align: center;
|
|
2295
|
+
min-height: 192px;
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
.dashboard-error {
|
|
2299
|
+
font-size: 30px;
|
|
2300
|
+
background: transparent;
|
|
2301
|
+
padding: 48px 0;
|
|
2302
|
+
margin: 0 auto;
|
|
2303
|
+
width: 80%;
|
|
2304
|
+
border: 0;
|
|
2305
|
+
text-align: center;
|
|
2306
|
+
min-height: 192px;
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
.luzmo-loader {
|
|
2310
|
+
top: 0;
|
|
2311
|
+
left: 0;
|
|
2312
|
+
width: 100%;
|
|
2313
|
+
min-height: 400px;
|
|
2314
|
+
position: absolute;
|
|
2315
|
+
transition-duration: 0.3s;
|
|
2316
|
+
}
|
|
2317
|
+
`;
|
|
2318
|
+
|
|
2319
|
+
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-base.ts
|
|
2320
|
+
var LuzmoDashboard = class extends h3 {
|
|
2321
|
+
constructor() {
|
|
2322
|
+
super();
|
|
2323
|
+
this.language = "auto";
|
|
2324
|
+
this.screenMode = "auto";
|
|
2325
|
+
this.switchScreenModeOnResize = true;
|
|
2326
|
+
this.editMode = "view";
|
|
2327
|
+
this.experimental = false;
|
|
2328
|
+
this.iframeStyle = {};
|
|
2329
|
+
this._containerStyle = {};
|
|
2330
|
+
this._loaderStyle = {};
|
|
2331
|
+
this._lcStyle = {};
|
|
2332
|
+
this._loadingCircleStyle = {};
|
|
2333
|
+
this._containerLoaderStyle = {};
|
|
2334
|
+
this._loaderMsg = "";
|
|
2335
|
+
this._itemEmbedding = false;
|
|
2336
|
+
this.browserError = false;
|
|
2337
|
+
this.browserErrorMsg = "";
|
|
2338
|
+
this.dashboardError = false;
|
|
2339
|
+
this.browserNotSupported = [];
|
|
2340
|
+
this.libVersion = version + "-wc-luzmo";
|
|
2341
|
+
this.isLibraryLoaded = false;
|
|
2342
|
+
this.currentAuthKey = null;
|
|
2343
|
+
this.currentAuthToken = null;
|
|
2344
|
+
this.isInitCalled = false;
|
|
2345
|
+
this.attributesMap = {
|
|
2346
|
+
dashboardId: "dashboard-id",
|
|
2347
|
+
dashboardSlug: "dashboard-slug",
|
|
2348
|
+
itemId: "item-id",
|
|
2349
|
+
language: "language",
|
|
2350
|
+
qeVersion: "qe-version",
|
|
2351
|
+
screenMode: "screen-mode",
|
|
2352
|
+
switchScreenModeOnResize: "switch-screen-mode-on-resize",
|
|
2353
|
+
authKey: "auth-key",
|
|
2354
|
+
authToken: "auth-token",
|
|
2355
|
+
editMode: "edit-mode",
|
|
2356
|
+
theme: "theme",
|
|
2357
|
+
mainColor: "main-color",
|
|
2358
|
+
accentColor: "accent-color",
|
|
2359
|
+
loaderBackground: "loader-background",
|
|
2360
|
+
loaderFontColor: "loader-font-color",
|
|
2361
|
+
loaderSpinnerColor: "loader-spinner-color",
|
|
2362
|
+
loaderSpinnerBackground: "loader-spinner-background",
|
|
2363
|
+
appServer: "app-server",
|
|
2364
|
+
apiHost: "api-host",
|
|
2365
|
+
itemDimensions: "item-dimensions",
|
|
2366
|
+
timezoneId: "timezone-id"
|
|
2367
|
+
};
|
|
2368
|
+
this.loaderSize = 32;
|
|
2369
|
+
this.borderWidth = 3;
|
|
2370
|
+
this.minHeight = 400;
|
|
2371
|
+
this._containerId = uuidv4();
|
|
2372
|
+
this._iframeId = `luzmo-dashboard-${this._containerId}`;
|
|
2373
|
+
this.iframeLoaded = false;
|
|
2374
|
+
this.promises = {};
|
|
2375
|
+
this.params = this._setOptions();
|
|
2376
|
+
this._onResize = () => {
|
|
2377
|
+
if (this.shadowRoot?.querySelector(".dashboard-container")) {
|
|
2378
|
+
this.containerWidth = this.luzmoEmbedContainer.offsetWidth;
|
|
2379
|
+
if (this.params.switchScreenModeOnResize && this.params.screenMode === "auto") {
|
|
2380
|
+
for (const d2 of EXTENTS) {
|
|
2381
|
+
if (d2.width[0] <= window.innerWidth && window.innerWidth <= d2.width[1]) {
|
|
2382
|
+
this.currentScreenMode = d2.mode;
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
}
|
|
2386
|
+
if (this.iframeLoaded) {
|
|
2387
|
+
this._calculateDimAfterDashboardLoaded();
|
|
2388
|
+
} else {
|
|
2389
|
+
if (this.dimensions) {
|
|
2390
|
+
this.containerWidth = this.luzmoEmbedContainer.offsetWidth;
|
|
2391
|
+
_setCalculatedDimensions(this);
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
};
|
|
2396
|
+
this._resizeObserver = new ResizeObserver((entries) => {
|
|
2397
|
+
window.requestAnimationFrame(() => {
|
|
2398
|
+
if (!Array.isArray(entries) || entries.length === 0) {
|
|
2399
|
+
return;
|
|
2400
|
+
}
|
|
2401
|
+
this._onResize();
|
|
2402
|
+
});
|
|
2403
|
+
});
|
|
2404
|
+
}
|
|
2405
|
+
// Set resize event listener
|
|
2406
|
+
connectedCallback() {
|
|
2407
|
+
super.connectedCallback();
|
|
2408
|
+
}
|
|
2409
|
+
// Set resize event listener
|
|
2410
|
+
disconnectedCallback() {
|
|
2411
|
+
super.disconnectedCallback();
|
|
2412
|
+
this._resizeObserver.disconnect();
|
|
2413
|
+
for (const promiseKey of Object.keys(this.promises)) {
|
|
2414
|
+
this.promises[promiseKey].reject(
|
|
2415
|
+
new Error("Dashboard component was removed")
|
|
2416
|
+
);
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2419
|
+
firstUpdated() {
|
|
2420
|
+
this._loaderMsg = getLoader(this)?.loadingMsg;
|
|
2421
|
+
this._loaderStyles();
|
|
2422
|
+
luzmo_service_default._components.push(this);
|
|
2423
|
+
if (this.luzmoEmbedContainer) {
|
|
2424
|
+
this._resizeObserver.observe(this.luzmoEmbedContainer);
|
|
2425
|
+
}
|
|
2426
|
+
}
|
|
2427
|
+
initComponent() {
|
|
2428
|
+
this.params = this._setOptions();
|
|
2429
|
+
if (this.getIsViewMode()) {
|
|
2430
|
+
loadLibrary(this.params.appServer).then(async () => {
|
|
2431
|
+
this.isLibraryLoaded = true;
|
|
2432
|
+
await this.updateComplete;
|
|
2433
|
+
const oldReference = this.renderRoot.querySelector("dashboard-component");
|
|
2434
|
+
this.dashboardReference = oldReference.cloneNode(true);
|
|
2435
|
+
oldReference.replaceWith(this.dashboardReference);
|
|
2436
|
+
this.dashboardReference.addEventListener("load", (payload) => {
|
|
2437
|
+
this.containerWidth = this.dashboardReference.offsetWidth;
|
|
2438
|
+
this.dimensions = payload.detail.dimensions;
|
|
2439
|
+
_setCalculatedDimensions(this);
|
|
2440
|
+
window.dispatchEvent(new Event("resize"));
|
|
2441
|
+
this.dispatchEvent(new CustomEvent("load", payload));
|
|
2442
|
+
});
|
|
2443
|
+
this.dashboardReference.addEventListener("itemsRendered", (payload) => this.dispatchEvent(new CustomEvent("itemsRendered", payload)));
|
|
2444
|
+
this.dashboardReference.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
|
|
2445
|
+
this.dashboardReference.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
|
|
2446
|
+
this.dashboardReference.addEventListener("dashboardAction", (payload) => this.dispatchEvent(new CustomEvent("dashboardAction", payload)));
|
|
2447
|
+
this.dashboardReference.addEventListener("export", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
|
|
2448
|
+
this.setAllAttributes();
|
|
2449
|
+
});
|
|
2450
|
+
} else {
|
|
2451
|
+
this.containerWidth = this.container?.clientWidth;
|
|
2452
|
+
_extendAndValidate(this);
|
|
2453
|
+
_browserCheck(this);
|
|
2454
|
+
this._setupLoader();
|
|
2455
|
+
if (!this.params.error) {
|
|
2456
|
+
this._loaderStyles();
|
|
2457
|
+
_setEventHandler();
|
|
2458
|
+
this._iframeUrl = createIframeUrl(this);
|
|
2459
|
+
this.iframe?.setAttribute("src", this._iframeUrl);
|
|
2460
|
+
this.iframeStyle = calculateIframeStyles(this);
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
setAllAttributes() {
|
|
2465
|
+
if (this.dashboardReference) {
|
|
2466
|
+
for (const key in this.attributesMap) {
|
|
2467
|
+
if (!["authKey", "authToken", "apiHost", "itemDimensions"].includes(key) && this.params[key]) {
|
|
2468
|
+
this.dashboardReference.setAttribute(this.attributesMap[key], this.params[key]);
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
if (this.params.itemDimensions) {
|
|
2472
|
+
this.dashboardReference.setAttribute("item-dimensions", JSON.stringify(this.params.itemDimensions));
|
|
2473
|
+
}
|
|
2474
|
+
if (this.params.apiHost) {
|
|
2475
|
+
this.dashboardReference.setAttribute("api-host", removeTrailingSlash(this.params.apiHost));
|
|
2476
|
+
}
|
|
2477
|
+
if (this.params.key) {
|
|
2478
|
+
this.dashboardReference.setAttribute("auth-key", this.params.key);
|
|
2479
|
+
}
|
|
2480
|
+
if (this.params.token) {
|
|
2481
|
+
this.dashboardReference.setAttribute("auth-token", this.params.token);
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
2485
|
+
// Reload dashboard when triggerproperty changes
|
|
2486
|
+
updated(changedProperties) {
|
|
2487
|
+
const triggerProperties = /* @__PURE__ */ new Set([
|
|
2488
|
+
"dashboardId",
|
|
2489
|
+
"dashboardSlug",
|
|
2490
|
+
"itemId",
|
|
2491
|
+
"language",
|
|
2492
|
+
"qeVersion",
|
|
2493
|
+
"theme",
|
|
2494
|
+
"editMode",
|
|
2495
|
+
"screenMode",
|
|
2496
|
+
"switchScreenModeOnResize",
|
|
2497
|
+
"authToken",
|
|
2498
|
+
"authKey",
|
|
2499
|
+
"appServer",
|
|
2500
|
+
"apiHost",
|
|
2501
|
+
"timezoneId",
|
|
2502
|
+
"itemDimensions"
|
|
2503
|
+
]);
|
|
2504
|
+
const conditionsToCheck = ["dashboardId", "dashboardSlug", "itemId"];
|
|
2505
|
+
let callInitComponent = false;
|
|
2506
|
+
for (const condition of conditionsToCheck) {
|
|
2507
|
+
callInitComponent = callInitComponent || changedProperties.get(condition) === void 0 && this[condition] !== void 0;
|
|
2508
|
+
}
|
|
2509
|
+
if (callInitComponent && !this.isInitCalled) {
|
|
2510
|
+
this.initComponent();
|
|
2511
|
+
this.isInitCalled = true;
|
|
2512
|
+
return;
|
|
2513
|
+
}
|
|
2514
|
+
if (this.getIsViewMode()) {
|
|
2515
|
+
if (this.dashboardReference) {
|
|
2516
|
+
for (const [propertyName] of changedProperties.entries()) {
|
|
2517
|
+
if (propertyName === "appSever") {
|
|
2518
|
+
loadLibrary(changedProperties[propertyName]).then(async () => {
|
|
2519
|
+
this.isLibraryLoaded = true;
|
|
2520
|
+
await this.updateComplete;
|
|
2521
|
+
this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
|
|
2522
|
+
this.setAllAttributes();
|
|
2523
|
+
});
|
|
2524
|
+
} else if (this.attributesMap[propertyName]) {
|
|
2525
|
+
const mappedAttributeName = this.attributesMap[propertyName] ?? propertyName;
|
|
2526
|
+
const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() || this[propertyName];
|
|
2527
|
+
this.dashboardReference.setAttribute(mappedAttributeName, attributeValue);
|
|
2528
|
+
}
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
} else {
|
|
2532
|
+
for (const [propertyName] of changedProperties.entries()) {
|
|
2533
|
+
if (triggerProperties.has(propertyName) && propertyName !== "editMode") {
|
|
2534
|
+
this.iframeLoaded = false;
|
|
2535
|
+
if (this._loadTimeoutHandle) {
|
|
2536
|
+
clearTimeout(this._loadTimeoutHandle);
|
|
2537
|
+
}
|
|
2538
|
+
this._loadTimeoutHandle = setTimeout(() => {
|
|
2539
|
+
console.warn(
|
|
2540
|
+
"Failed to load dashboard, appServer is likely down or unreachable."
|
|
2541
|
+
);
|
|
2542
|
+
}, 15 * 1e3);
|
|
2543
|
+
this.params = this._setOptions();
|
|
2544
|
+
_extendAndValidate(this);
|
|
2545
|
+
this._setupLoader();
|
|
2546
|
+
this._loaderStyles();
|
|
2547
|
+
this._iframeUrl = createIframeUrl(this);
|
|
2548
|
+
if (this.iframe) {
|
|
2549
|
+
this._updateIframeUrl();
|
|
2550
|
+
}
|
|
2551
|
+
this.iframeStyle = calculateIframeStyles(this);
|
|
2552
|
+
} else if (triggerProperties.has(propertyName) && propertyName === "editMode") {
|
|
2553
|
+
if (this.iframeLoaded) {
|
|
2554
|
+
this.setEditMode(this.editMode);
|
|
2555
|
+
}
|
|
2556
|
+
this.params = this._setOptions();
|
|
2557
|
+
}
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
// Set params
|
|
2562
|
+
_setOptions() {
|
|
2563
|
+
const defaultParameters = {
|
|
2564
|
+
dashboardId: this.dashboardId,
|
|
2565
|
+
dashboardSlug: this.dashboardSlug
|
|
2566
|
+
};
|
|
2567
|
+
if (this.itemId) {
|
|
2568
|
+
defaultParameters.itemId = this.itemId;
|
|
2569
|
+
this._itemEmbedding = true;
|
|
2570
|
+
} else {
|
|
2571
|
+
this._itemEmbedding = false;
|
|
2572
|
+
}
|
|
2573
|
+
if (this.language) {
|
|
2574
|
+
defaultParameters.language = this.language;
|
|
2575
|
+
}
|
|
2576
|
+
if (this.qeVersion) {
|
|
2577
|
+
defaultParameters.qeVersion = this.qeVersion;
|
|
2578
|
+
}
|
|
2579
|
+
if (this.screenMode) {
|
|
2580
|
+
defaultParameters.screenMode = this.screenMode;
|
|
2581
|
+
}
|
|
2582
|
+
defaultParameters.switchScreenModeOnResize = this.switchScreenModeOnResize;
|
|
2583
|
+
if (this.authToken) {
|
|
2584
|
+
defaultParameters.token = this.authToken;
|
|
2585
|
+
}
|
|
2586
|
+
if (this.authKey) {
|
|
2587
|
+
defaultParameters.key = this.authKey;
|
|
2588
|
+
}
|
|
2589
|
+
if (this.editMode) {
|
|
2590
|
+
defaultParameters.editMode = this.editMode;
|
|
2591
|
+
}
|
|
2592
|
+
if (this.theme) {
|
|
2593
|
+
defaultParameters.theme = this.theme;
|
|
2594
|
+
}
|
|
2595
|
+
if (this.mainColor) {
|
|
2596
|
+
defaultParameters.mainColor = this.mainColor;
|
|
2597
|
+
}
|
|
2598
|
+
if (this.accentColor) {
|
|
2599
|
+
defaultParameters.accentColor = this.accentColor;
|
|
2600
|
+
}
|
|
2601
|
+
if (this.loaderBackground) {
|
|
2602
|
+
defaultParameters.loaderBackground = this.loaderBackground;
|
|
2603
|
+
}
|
|
2604
|
+
if (this.loaderFontColor) {
|
|
2605
|
+
defaultParameters.loaderFontColor = this.loaderFontColor;
|
|
2606
|
+
}
|
|
2607
|
+
if (this.loaderSpinnerColor) {
|
|
2608
|
+
defaultParameters.loaderSpinnerColor = this.loaderSpinnerColor;
|
|
2609
|
+
}
|
|
2610
|
+
if (this.loaderSpinnerBackground) {
|
|
2611
|
+
defaultParameters.loaderSpinnerBackground = this.loaderSpinnerBackground;
|
|
2612
|
+
}
|
|
2613
|
+
if (this.timezoneId) {
|
|
2614
|
+
defaultParameters.timezoneId = this.timezoneId;
|
|
2615
|
+
}
|
|
2616
|
+
if (this.itemDimensions) {
|
|
2617
|
+
defaultParameters.itemDimensions = this.itemDimensions;
|
|
2618
|
+
}
|
|
2619
|
+
if (this.appServer) {
|
|
2620
|
+
this.appServer = this.getIsViewMode() ? removeTrailingSlash(this.appServer) : addTrailingSlash(this.appServer);
|
|
2621
|
+
defaultParameters.appServer = this.appServer;
|
|
2622
|
+
} else {
|
|
2623
|
+
this.appServer = addTrailingSlash(
|
|
2624
|
+
DEFAULT_PARAMETERS.appServer
|
|
2625
|
+
);
|
|
2626
|
+
defaultParameters.appServer = this.appServer;
|
|
2627
|
+
}
|
|
2628
|
+
if (this.apiHost) {
|
|
2629
|
+
this.apiHost = this.getIsViewMode() ? removeTrailingSlash(this.apiHost) : addTrailingSlash(this.apiHost);
|
|
2630
|
+
defaultParameters.apiHost = this.apiHost;
|
|
2631
|
+
} else {
|
|
2632
|
+
this.apiHost = this.appServer.includes("luzmo.com") ? this.appServer.replace("app", "api") : this.appServer;
|
|
2633
|
+
defaultParameters.apiHost = this.apiHost;
|
|
2634
|
+
}
|
|
2635
|
+
this.currentAuthKey = this.authKey;
|
|
2636
|
+
this.currentAuthToken = this.authToken;
|
|
2637
|
+
return defaultParameters;
|
|
2638
|
+
}
|
|
2639
|
+
_updateIframeUrl() {
|
|
2640
|
+
updateIframeUrl(this.iframe, this._iframeUrl);
|
|
2641
|
+
}
|
|
2642
|
+
// Setup loader / browser error
|
|
2643
|
+
_setupLoader() {
|
|
2644
|
+
const data = getLoader(this);
|
|
2645
|
+
this._loaderMsg = data.loadingMsg;
|
|
2646
|
+
if (data.errorMsg) {
|
|
2647
|
+
this.browserError = true;
|
|
2648
|
+
this.browserErrorMsg = data.errorMsg;
|
|
2649
|
+
this._displayError();
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
_displayError() {
|
|
2653
|
+
if (this.dashboardError) {
|
|
2654
|
+
this._loaderStyles();
|
|
2655
|
+
this.iframeStyle.opacity = 1;
|
|
2656
|
+
}
|
|
2657
|
+
if (this.browserError) {
|
|
2658
|
+
this._containerStyle.display = "none";
|
|
2659
|
+
}
|
|
2660
|
+
}
|
|
2661
|
+
_calculateDimAfterDashboardLoaded() {
|
|
2662
|
+
this.dashboardError = false;
|
|
2663
|
+
this._loaderStyles();
|
|
2664
|
+
_setCalculatedDimensions(this);
|
|
2665
|
+
}
|
|
2666
|
+
// Set loader styles
|
|
2667
|
+
_loaderStyles() {
|
|
2668
|
+
this._containerStyle = containerStyles(this);
|
|
2669
|
+
this._loaderStyle = loaderStyles(this);
|
|
2670
|
+
this._loadingCircleStyle = plStyles(this);
|
|
2671
|
+
this._containerLoaderStyle = containerLoaderStyles(this);
|
|
2672
|
+
this._lcStyle = lcStyles(this);
|
|
2673
|
+
}
|
|
2674
|
+
static get styles() {
|
|
2675
|
+
return [dashboardStyles];
|
|
2676
|
+
}
|
|
2677
|
+
render() {
|
|
2678
|
+
let toBeRenderedHTML;
|
|
2679
|
+
const loader = ke`
|
|
2680
|
+
<div
|
|
2681
|
+
class="luzmo-container-loader"
|
|
2682
|
+
id="luzmo-container-loader-${this._containerId}"
|
|
2683
|
+
style=${se(
|
|
2684
|
+
this._containerLoaderStyle
|
|
2685
|
+
)}
|
|
2686
|
+
>
|
|
2687
|
+
<div
|
|
2688
|
+
class="luzmo-loader"
|
|
2689
|
+
id="luzmo-loader-${this._containerId}"
|
|
2690
|
+
style=${se(this._loaderStyle)}
|
|
2691
|
+
>
|
|
2692
|
+
<div
|
|
2693
|
+
class="luzmo-lc"
|
|
2694
|
+
style=${se(this._lcStyle)}
|
|
2695
|
+
>
|
|
2696
|
+
<div
|
|
2697
|
+
class="luzmo-loading-circle"
|
|
2698
|
+
style=${se(
|
|
2699
|
+
this._loadingCircleStyle
|
|
2700
|
+
)}
|
|
2701
|
+
></div>
|
|
2702
|
+
${this._itemEmbedding ? "" : ke`
|
|
2703
|
+
<div
|
|
2704
|
+
class="luzmo-loading-message"
|
|
2705
|
+
style=${se({ color: this.loaderFontColor })}
|
|
2706
|
+
>
|
|
2707
|
+
${this._loaderMsg}
|
|
2708
|
+
</div>
|
|
2709
|
+
`}
|
|
2710
|
+
</div>
|
|
2711
|
+
</div>
|
|
2712
|
+
</div>
|
|
2713
|
+
`;
|
|
2714
|
+
if (this.getIsViewMode()) {
|
|
2715
|
+
toBeRenderedHTML = this.isLibraryLoaded ? ke`
|
|
2716
|
+
${this.dashboardId || this.dashboardSlug ? ke`
|
|
2717
|
+
<dashboard-component dashboard-id="${this.params.dashboardId}" app-server="${this.params.appServer}"
|
|
2718
|
+
api-host="${this.params.apiHost}"></dashboard-component>
|
|
2719
|
+
` : ke`
|
|
2720
|
+
<div id="luzmo-error-${this._containerId}">
|
|
2721
|
+
<h3 class="luzmo-error">${this.browserErrorMsg}</h3>
|
|
2722
|
+
</div>
|
|
2723
|
+
`}
|
|
2724
|
+
` : ke`${loader}`;
|
|
2725
|
+
} else {
|
|
2726
|
+
toBeRenderedHTML = ke`
|
|
2727
|
+
${this.dashboardId || this.dashboardSlug ? ke`
|
|
2728
|
+
${loader}
|
|
2729
|
+
<iframe
|
|
2730
|
+
class="luzmo-embed-dashboard ${this.getIsViewMode() ? "" : `luzmo-embed-dashboard-ede`}"
|
|
2731
|
+
id="${this._iframeId}"
|
|
2732
|
+
name="${this._iframeId}"
|
|
2733
|
+
style=${se(this.iframeStyle)}
|
|
2734
|
+
src="${this._iframeUrl}"
|
|
2735
|
+
frameborder="0"
|
|
2736
|
+
></iframe>
|
|
2737
|
+
` : ke`<!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId -->`}
|
|
2738
|
+
${this.browserError ? ke`
|
|
2739
|
+
<div id="luzmo-error-${this._containerId}">
|
|
2740
|
+
<h3 class="luzmo-error">${this.browserErrorMsg}</h3>
|
|
2741
|
+
</div>
|
|
2742
|
+
` : ""}
|
|
2743
|
+
`;
|
|
2744
|
+
}
|
|
2745
|
+
return ke`
|
|
2746
|
+
<div class="${luzmoEmbedContainerClass} ${this.getIsViewMode() ? "" : `${luzmoEmbedContainerClass}-ede`}">
|
|
2747
|
+
<div
|
|
2748
|
+
class="dashboard-container"
|
|
2749
|
+
style=${se(Object.assign({}, this._containerStyle, {
|
|
2750
|
+
width: this.iframeStyle.width ?? "100%",
|
|
2751
|
+
height: this.iframeStyle.height ?? "100%"
|
|
2752
|
+
}))}
|
|
2753
|
+
>
|
|
2754
|
+
${toBeRenderedHTML}
|
|
2755
|
+
</div>
|
|
2756
|
+
</div>
|
|
2757
|
+
|
|
2758
|
+
`;
|
|
2759
|
+
}
|
|
2760
|
+
getDashboards() {
|
|
2761
|
+
return new Promise(
|
|
2762
|
+
(resolve) => resolve(luzmo_service_default._components)
|
|
2763
|
+
);
|
|
2764
|
+
}
|
|
2765
|
+
// Public methods
|
|
2766
|
+
getData(itemId) {
|
|
2767
|
+
if (this.getIsViewMode() && this.dashboardReference) {
|
|
2768
|
+
return this.dashboardReference.getData(itemId);
|
|
2769
|
+
}
|
|
2770
|
+
if (!this.getIsViewMode()) {
|
|
2771
|
+
return getData(this, this.iframe, itemId);
|
|
2772
|
+
}
|
|
2773
|
+
return Promise.reject();
|
|
2774
|
+
}
|
|
2775
|
+
getFilters() {
|
|
2776
|
+
if (this.getIsViewMode() && this.dashboardReference) {
|
|
2777
|
+
return this.dashboardReference.getFilters();
|
|
2778
|
+
}
|
|
2779
|
+
if (!this.getIsViewMode()) {
|
|
2780
|
+
return getFilters(this, this.iframe);
|
|
2781
|
+
}
|
|
2782
|
+
return Promise.reject();
|
|
2783
|
+
}
|
|
2784
|
+
setSelectedData(itemId, filters) {
|
|
2785
|
+
if (this.getIsViewMode() && this.dashboardReference) {
|
|
2786
|
+
return this.dashboardReference.setSelectedData(itemId, filters);
|
|
2787
|
+
}
|
|
2788
|
+
if (!this.getIsViewMode()) {
|
|
2789
|
+
return setSelectedData(this, this.iframe, itemId, filters);
|
|
2790
|
+
}
|
|
2791
|
+
return Promise.reject();
|
|
2792
|
+
}
|
|
2793
|
+
setAuthorization(key, token) {
|
|
2794
|
+
this.currentAuthKey = key;
|
|
2795
|
+
this.currentAuthToken = token;
|
|
2796
|
+
if (this.getIsViewMode() && this.dashboardReference) {
|
|
2797
|
+
return this.dashboardReference.setAuthorization(key, token);
|
|
2798
|
+
}
|
|
2799
|
+
if (!this.getIsViewMode()) {
|
|
2800
|
+
return setAuthorization(this, this.iframe, key, token);
|
|
2801
|
+
}
|
|
2802
|
+
return Promise.reject();
|
|
2803
|
+
}
|
|
2804
|
+
refreshData(itemId) {
|
|
2805
|
+
if (this.getIsViewMode() && this.dashboardReference) {
|
|
2806
|
+
return this.dashboardReference.refreshData(itemId);
|
|
2807
|
+
}
|
|
2808
|
+
if (!this.getIsViewMode()) {
|
|
2809
|
+
return itemId ? refreshData(this, this.iframe, itemId) : refreshData(this, this.iframe);
|
|
2810
|
+
}
|
|
2811
|
+
return Promise.reject();
|
|
2812
|
+
}
|
|
2813
|
+
reloadDashboard() {
|
|
2814
|
+
if (this.getIsViewMode() && this.dashboardReference) {
|
|
2815
|
+
return this.dashboardReference.reloadDashboard();
|
|
2816
|
+
}
|
|
2817
|
+
if (!this.getIsViewMode()) {
|
|
2818
|
+
return reloadDashboard(this, this.iframe);
|
|
2819
|
+
}
|
|
2820
|
+
return Promise.reject();
|
|
2821
|
+
}
|
|
2822
|
+
exportDashboard(format) {
|
|
2823
|
+
if (this.getIsViewMode() && this.dashboardReference) {
|
|
2824
|
+
return this.dashboardReference.exportDashboard(format);
|
|
2825
|
+
}
|
|
2826
|
+
if (!this.getIsViewMode()) {
|
|
2827
|
+
return format ? exportDashboard(this, this.iframe, format) : exportDashboard(this, this.iframe);
|
|
2828
|
+
}
|
|
2829
|
+
return Promise.reject();
|
|
2830
|
+
}
|
|
2831
|
+
getAccessibleDashboards() {
|
|
2832
|
+
return getAccessibleDashboards(this);
|
|
2833
|
+
}
|
|
2834
|
+
addFilters(itemId, filters) {
|
|
2835
|
+
return this.dashboardReference.addFilters(itemId, filters);
|
|
2836
|
+
}
|
|
2837
|
+
setEditMode(editMode) {
|
|
2838
|
+
if (this.dashboardReference && editMode === "view") {
|
|
2839
|
+
this.editMode = "view";
|
|
2840
|
+
this.params.editMode = "view";
|
|
2841
|
+
this.initComponent();
|
|
2842
|
+
return Promise.resolve({
|
|
2843
|
+
type: "setEditMode",
|
|
2844
|
+
editMode
|
|
2845
|
+
});
|
|
2846
|
+
}
|
|
2847
|
+
if (this.dashboardReference && ["editFull", "editLimited"].includes(editMode)) {
|
|
2848
|
+
this.editMode = editMode;
|
|
2849
|
+
this.params.editMode = editMode;
|
|
2850
|
+
this.initComponent();
|
|
2851
|
+
return Promise.resolve({
|
|
2852
|
+
type: "setEditMode",
|
|
2853
|
+
editMode
|
|
2854
|
+
});
|
|
2855
|
+
}
|
|
2856
|
+
if (this.getIsViewMode() && this.dashboardReference) {
|
|
2857
|
+
return this.dashboardReference.setEditMode(editMode);
|
|
2858
|
+
}
|
|
2859
|
+
if (!this.getIsViewMode()) {
|
|
2860
|
+
return setEditMode(this, this.iframe, editMode);
|
|
2861
|
+
}
|
|
2862
|
+
return Promise.reject();
|
|
2863
|
+
}
|
|
2864
|
+
setPreview(preview) {
|
|
2865
|
+
if (this.getIsViewMode() && this.dashboardReference) {
|
|
2866
|
+
return this.dashboardReference.setPreview(preview);
|
|
2867
|
+
}
|
|
2868
|
+
return setPreview(this, this.iframe, preview);
|
|
2869
|
+
}
|
|
2870
|
+
getIsViewMode() {
|
|
2871
|
+
return this.experimental && this.params.editMode === "view" || this.params.editMode === void 0;
|
|
2872
|
+
}
|
|
2873
|
+
};
|
|
2874
|
+
__decorateClass([
|
|
2875
|
+
e4(".dashboard-container")
|
|
2876
|
+
], LuzmoDashboard.prototype, "container", 2);
|
|
2877
|
+
__decorateClass([
|
|
2878
|
+
e4(`.${luzmoEmbedContainerClass}`)
|
|
2879
|
+
], LuzmoDashboard.prototype, "luzmoEmbedContainer", 2);
|
|
2880
|
+
__decorateClass([
|
|
2881
|
+
e4("iframe")
|
|
2882
|
+
], LuzmoDashboard.prototype, "iframe", 2);
|
|
2883
|
+
__decorateClass([
|
|
2884
|
+
n4()
|
|
2885
|
+
], LuzmoDashboard.prototype, "dashboardId", 2);
|
|
2886
|
+
__decorateClass([
|
|
2887
|
+
n4()
|
|
2888
|
+
], LuzmoDashboard.prototype, "dashboardSlug", 2);
|
|
2889
|
+
__decorateClass([
|
|
2890
|
+
n4()
|
|
2891
|
+
], LuzmoDashboard.prototype, "itemId", 2);
|
|
2892
|
+
__decorateClass([
|
|
2893
|
+
n4()
|
|
2894
|
+
], LuzmoDashboard.prototype, "language", 2);
|
|
2895
|
+
__decorateClass([
|
|
2896
|
+
n4()
|
|
2897
|
+
], LuzmoDashboard.prototype, "qeVersion", 2);
|
|
2898
|
+
__decorateClass([
|
|
2899
|
+
n4()
|
|
2900
|
+
], LuzmoDashboard.prototype, "screenMode", 2);
|
|
2901
|
+
__decorateClass([
|
|
2902
|
+
n4({
|
|
2903
|
+
converter: {
|
|
2904
|
+
fromAttribute: (value) => value === "true",
|
|
2905
|
+
toAttribute: String
|
|
2906
|
+
}
|
|
2907
|
+
})
|
|
2908
|
+
], LuzmoDashboard.prototype, "switchScreenModeOnResize", 2);
|
|
2909
|
+
__decorateClass([
|
|
2910
|
+
n4()
|
|
2911
|
+
], LuzmoDashboard.prototype, "editMode", 2);
|
|
2912
|
+
__decorateClass([
|
|
2913
|
+
n4()
|
|
2914
|
+
], LuzmoDashboard.prototype, "theme", 2);
|
|
2915
|
+
__decorateClass([
|
|
2916
|
+
n4()
|
|
2917
|
+
], LuzmoDashboard.prototype, "mainColor", 2);
|
|
2918
|
+
__decorateClass([
|
|
2919
|
+
n4()
|
|
2920
|
+
], LuzmoDashboard.prototype, "accentColor", 2);
|
|
2921
|
+
__decorateClass([
|
|
2922
|
+
n4()
|
|
2923
|
+
], LuzmoDashboard.prototype, "authToken", 2);
|
|
2924
|
+
__decorateClass([
|
|
2925
|
+
n4()
|
|
2926
|
+
], LuzmoDashboard.prototype, "authKey", 2);
|
|
2927
|
+
__decorateClass([
|
|
2928
|
+
n4()
|
|
2929
|
+
], LuzmoDashboard.prototype, "loaderBackground", 2);
|
|
2930
|
+
__decorateClass([
|
|
2931
|
+
n4()
|
|
2932
|
+
], LuzmoDashboard.prototype, "loaderFontColor", 2);
|
|
2933
|
+
__decorateClass([
|
|
2934
|
+
n4()
|
|
2935
|
+
], LuzmoDashboard.prototype, "loaderSpinnerColor", 2);
|
|
2936
|
+
__decorateClass([
|
|
2937
|
+
n4()
|
|
2938
|
+
], LuzmoDashboard.prototype, "loaderSpinnerBackground", 2);
|
|
2939
|
+
__decorateClass([
|
|
2940
|
+
n4()
|
|
2941
|
+
], LuzmoDashboard.prototype, "appServer", 2);
|
|
2942
|
+
__decorateClass([
|
|
2943
|
+
n4()
|
|
2944
|
+
], LuzmoDashboard.prototype, "timezoneId", 2);
|
|
2945
|
+
__decorateClass([
|
|
2946
|
+
n4()
|
|
2947
|
+
], LuzmoDashboard.prototype, "apiHost", 2);
|
|
2948
|
+
__decorateClass([
|
|
2949
|
+
n4({ type: Object })
|
|
2950
|
+
], LuzmoDashboard.prototype, "itemDimensions", 2);
|
|
2951
|
+
__decorateClass([
|
|
2952
|
+
n4({
|
|
2953
|
+
converter: {
|
|
2954
|
+
fromAttribute: (value) => value === "true",
|
|
2955
|
+
toAttribute: String
|
|
2956
|
+
}
|
|
2957
|
+
})
|
|
2958
|
+
], LuzmoDashboard.prototype, "experimental", 2);
|
|
2959
|
+
__decorateClass([
|
|
2960
|
+
n4({ attribute: false })
|
|
2961
|
+
], LuzmoDashboard.prototype, "_containerId", 2);
|
|
2962
|
+
__decorateClass([
|
|
2963
|
+
n4({ attribute: false })
|
|
2964
|
+
], LuzmoDashboard.prototype, "_iframeId", 2);
|
|
2965
|
+
__decorateClass([
|
|
2966
|
+
n4({ attribute: false })
|
|
2967
|
+
], LuzmoDashboard.prototype, "params", 2);
|
|
2968
|
+
__decorateClass([
|
|
2969
|
+
n4({ attribute: false })
|
|
2970
|
+
], LuzmoDashboard.prototype, "_iframeUrl", 2);
|
|
2971
|
+
__decorateClass([
|
|
2972
|
+
n4({ attribute: false })
|
|
2973
|
+
], LuzmoDashboard.prototype, "iframeLoaded", 2);
|
|
2974
|
+
__decorateClass([
|
|
2975
|
+
n4({ attribute: false })
|
|
2976
|
+
], LuzmoDashboard.prototype, "promises", 2);
|
|
2977
|
+
__decorateClass([
|
|
2978
|
+
n4({ attribute: false })
|
|
2979
|
+
], LuzmoDashboard.prototype, "iframeStyle", 2);
|
|
2980
|
+
__decorateClass([
|
|
2981
|
+
n4({ attribute: false })
|
|
2982
|
+
], LuzmoDashboard.prototype, "_containerStyle", 2);
|
|
2983
|
+
__decorateClass([
|
|
2984
|
+
n4({ attribute: false })
|
|
2985
|
+
], LuzmoDashboard.prototype, "_loaderStyle", 2);
|
|
2986
|
+
__decorateClass([
|
|
2987
|
+
n4({ attribute: false })
|
|
2988
|
+
], LuzmoDashboard.prototype, "_lcStyle", 2);
|
|
2989
|
+
__decorateClass([
|
|
2990
|
+
n4({ attribute: false })
|
|
2991
|
+
], LuzmoDashboard.prototype, "_loadingCircleStyle", 2);
|
|
2992
|
+
__decorateClass([
|
|
2993
|
+
n4({ attribute: false })
|
|
2994
|
+
], LuzmoDashboard.prototype, "_containerLoaderStyle", 2);
|
|
2995
|
+
__decorateClass([
|
|
2996
|
+
n4({ attribute: false })
|
|
2997
|
+
], LuzmoDashboard.prototype, "_loaderMsg", 2);
|
|
2998
|
+
__decorateClass([
|
|
2999
|
+
n4({ attribute: false })
|
|
3000
|
+
], LuzmoDashboard.prototype, "containerWidth", 2);
|
|
3001
|
+
__decorateClass([
|
|
3002
|
+
n4({ attribute: false })
|
|
3003
|
+
], LuzmoDashboard.prototype, "dimensions", 2);
|
|
3004
|
+
__decorateClass([
|
|
3005
|
+
n4({ attribute: false })
|
|
3006
|
+
], LuzmoDashboard.prototype, "currentScreenMode", 2);
|
|
3007
|
+
__decorateClass([
|
|
3008
|
+
n4({ attribute: false })
|
|
3009
|
+
], LuzmoDashboard.prototype, "_itemEmbedding", 2);
|
|
3010
|
+
__decorateClass([
|
|
3011
|
+
n4({ attribute: false })
|
|
3012
|
+
], LuzmoDashboard.prototype, "browserError", 2);
|
|
3013
|
+
__decorateClass([
|
|
3014
|
+
n4({ attribute: false })
|
|
3015
|
+
], LuzmoDashboard.prototype, "browserErrorMsg", 2);
|
|
3016
|
+
__decorateClass([
|
|
3017
|
+
n4({ attribute: false })
|
|
3018
|
+
], LuzmoDashboard.prototype, "dashboardError", 2);
|
|
3019
|
+
__decorateClass([
|
|
3020
|
+
n4({ attribute: false })
|
|
3021
|
+
], LuzmoDashboard.prototype, "browserNotSupported", 2);
|
|
3022
|
+
__decorateClass([
|
|
3023
|
+
n4()
|
|
3024
|
+
], LuzmoDashboard.prototype, "libVersion", 2);
|
|
3025
|
+
__decorateClass([
|
|
3026
|
+
r4()
|
|
3027
|
+
], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
|
|
3028
|
+
__decorateClass([
|
|
3029
|
+
r4()
|
|
3030
|
+
], LuzmoDashboard.prototype, "dashboardReference", 2);
|
|
3031
|
+
__decorateClass([
|
|
3032
|
+
r4()
|
|
3033
|
+
], LuzmoDashboard.prototype, "currentAuthKey", 2);
|
|
3034
|
+
__decorateClass([
|
|
3035
|
+
r4()
|
|
3036
|
+
], LuzmoDashboard.prototype, "currentAuthToken", 2);
|
|
3037
|
+
__decorateClass([
|
|
3038
|
+
r4()
|
|
3039
|
+
], LuzmoDashboard.prototype, "isInitCalled", 2);
|
|
3040
|
+
|
|
3041
|
+
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
|
|
3042
|
+
var LuzmoEmbedDashboard = class extends LuzmoDashboard {
|
|
3043
|
+
};
|
|
3044
|
+
if (!customElements.get("luzmo-embed-dashboard")) {
|
|
3045
|
+
customElements.define("luzmo-embed-dashboard", LuzmoEmbedDashboard);
|
|
3046
|
+
}
|
|
3047
|
+
|
|
3048
|
+
// libs/embed-libs/embed/src/lib/viz-item/viz-item.base.ts
|
|
3049
|
+
var dashboardContentsVersion = "0.1.92";
|
|
3050
|
+
var LuzmoBaseVizItem = class extends h3 {
|
|
3051
|
+
constructor() {
|
|
3052
|
+
super(...arguments);
|
|
3053
|
+
this.appServer = "https://app.luzmo.com";
|
|
3054
|
+
this.apiHost = "https://api.luzmo.com";
|
|
3055
|
+
this.slots = [];
|
|
3056
|
+
this.version = version + "-wc-luzmo";
|
|
3057
|
+
this.dashboardContentsVersion = dashboardContentsVersion;
|
|
3058
|
+
this.libVersion = version + "-wc-luzmo";
|
|
3059
|
+
this.postInitCallQueue = [];
|
|
3060
|
+
}
|
|
3061
|
+
static {
|
|
3062
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
3063
|
+
this.styles = i`
|
|
3064
|
+
:host {
|
|
3065
|
+
display: block;
|
|
3066
|
+
width: 100%;
|
|
3067
|
+
height: 100%;
|
|
3068
|
+
}
|
|
3069
|
+
|
|
3070
|
+
luzmo-embed-viz-item {
|
|
3071
|
+
width: 100%;
|
|
3072
|
+
height: 1000%;
|
|
3073
|
+
display: block;
|
|
3074
|
+
}
|
|
3075
|
+
`;
|
|
3076
|
+
}
|
|
3077
|
+
createRenderRoot() {
|
|
3078
|
+
if (!this.style.display) {
|
|
3079
|
+
this.style.display = "block";
|
|
3080
|
+
}
|
|
3081
|
+
if (!this.style.height) {
|
|
3082
|
+
this.style.height = "100%";
|
|
3083
|
+
}
|
|
3084
|
+
if (!this.style.width) {
|
|
3085
|
+
this.style.width = "100%";
|
|
3086
|
+
}
|
|
3087
|
+
return this;
|
|
3088
|
+
}
|
|
3089
|
+
canInitializeVizItem() {
|
|
3090
|
+
return !!(this.type || this.dashboardId && this.itemId);
|
|
3091
|
+
}
|
|
3092
|
+
getFilters() {
|
|
3093
|
+
return this.chartElement.getFilters();
|
|
3094
|
+
}
|
|
3095
|
+
export() {
|
|
3096
|
+
return this.chartElement.export();
|
|
3097
|
+
}
|
|
3098
|
+
getData() {
|
|
3099
|
+
return this.chartElement.getData();
|
|
3100
|
+
}
|
|
3101
|
+
refreshData() {
|
|
3102
|
+
return this.chartElement.refreshData();
|
|
3103
|
+
}
|
|
3104
|
+
setSelectedData(selectedDataInput) {
|
|
3105
|
+
return this.chartElement.setSelectedData(void 0, selectedDataInput);
|
|
3106
|
+
}
|
|
3107
|
+
setAuthorization(key, token) {
|
|
3108
|
+
return this.chartElement.setAuthorization(key, token);
|
|
3109
|
+
}
|
|
3110
|
+
attributeChangedCallback(name, _old, value) {
|
|
3111
|
+
super.attributeChangedCallback(name, _old, value);
|
|
3112
|
+
if (name === "selecteddata") {
|
|
3113
|
+
if (this.chartElement) {
|
|
3114
|
+
this.setSelectedData(JSON.parse(value ?? "{}"));
|
|
3115
|
+
} else {
|
|
3116
|
+
this.postInitCallQueue.push([this.setSelectedData, [JSON.parse(value ?? "{}")]]);
|
|
3117
|
+
}
|
|
3118
|
+
}
|
|
3119
|
+
}
|
|
3120
|
+
async firstUpdated(_changedProperties) {
|
|
3121
|
+
super.firstUpdated(_changedProperties);
|
|
3122
|
+
if (this.canInitializeVizItem()) {
|
|
3123
|
+
await loadLibrary(this.appServer, "DashboardApp");
|
|
3124
|
+
this.createAndAppendElement();
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
3127
|
+
createAndAppendElement() {
|
|
3128
|
+
if (!this.chartElement) {
|
|
3129
|
+
this.chartElement = document.createElement("chart-component");
|
|
3130
|
+
this.chartElement.setAttribute("embedding-mode", "chart");
|
|
3131
|
+
this.chartElement.style.height = "100%";
|
|
3132
|
+
this.chartElement.style.width = "100%";
|
|
3133
|
+
this.chartElement.style.display = "block";
|
|
3134
|
+
this.chartElement.addEventListener("load", (payload) => this.dispatchEvent(new CustomEvent("load", payload)));
|
|
3135
|
+
this.chartElement.addEventListener("rendered", (payload) => {
|
|
3136
|
+
if (this.postInitCallQueue?.length > 0) {
|
|
3137
|
+
for (const functionToCall of this.postInitCallQueue) {
|
|
3138
|
+
functionToCall[0].bind(this)(...functionToCall[1]);
|
|
3139
|
+
}
|
|
3140
|
+
} else {
|
|
3141
|
+
if (this.selectedData) {
|
|
3142
|
+
this.setSelectedData(this.selectedData);
|
|
3143
|
+
}
|
|
3144
|
+
}
|
|
3145
|
+
this.dispatchEvent(new CustomEvent("rendered", payload));
|
|
3146
|
+
});
|
|
3147
|
+
this.chartElement.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
|
|
3148
|
+
this.chartElement.addEventListener("exported", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
|
|
3149
|
+
this.chartElement.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
|
|
3150
|
+
this.updateVizItemProperties();
|
|
3151
|
+
this.renderRoot.append(this.chartElement);
|
|
3152
|
+
}
|
|
3153
|
+
}
|
|
3154
|
+
updateVizItemProperties() {
|
|
3155
|
+
if (this.chartElement) {
|
|
3156
|
+
for (const key in libraryTypeToWebComponentTypeMapping) {
|
|
3157
|
+
const value = this[key];
|
|
3158
|
+
if (value) {
|
|
3159
|
+
const attributeValue = ["appServer", "apiHost"].includes(key) ? removeTrailingSlash(value) : value;
|
|
3160
|
+
this.chartElement.setAttribute(
|
|
3161
|
+
libraryTypeToWebComponentTypeMapping[key],
|
|
3162
|
+
typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
|
|
3163
|
+
);
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
}
|
|
3167
|
+
}
|
|
3168
|
+
async updated(changedProperties) {
|
|
3169
|
+
if (this.chartElement) {
|
|
3170
|
+
for (const [propertyName] of changedProperties.entries()) {
|
|
3171
|
+
const mappedAttributeName = libraryTypeToWebComponentTypeMapping[propertyName] ?? propertyName;
|
|
3172
|
+
const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
|
|
3173
|
+
this.chartElement.setAttribute(mappedAttributeName, attributeValue);
|
|
3174
|
+
}
|
|
3175
|
+
} else {
|
|
3176
|
+
if (this.canInitializeVizItem()) {
|
|
3177
|
+
await loadLibrary(this.appServer, "DashboardApp");
|
|
3178
|
+
this.createAndAppendElement();
|
|
3179
|
+
}
|
|
3180
|
+
}
|
|
3181
|
+
}
|
|
3182
|
+
render() {
|
|
3183
|
+
return ke` `;
|
|
3184
|
+
}
|
|
3185
|
+
};
|
|
3186
|
+
__decorateClass([
|
|
3187
|
+
n4()
|
|
3188
|
+
], LuzmoBaseVizItem.prototype, "appServer", 2);
|
|
3189
|
+
__decorateClass([
|
|
3190
|
+
n4()
|
|
3191
|
+
], LuzmoBaseVizItem.prototype, "apiHost", 2);
|
|
3192
|
+
__decorateClass([
|
|
3193
|
+
n4({ type: Array })
|
|
3194
|
+
], LuzmoBaseVizItem.prototype, "slots", 2);
|
|
3195
|
+
__decorateClass([
|
|
3196
|
+
n4({ type: Object })
|
|
3197
|
+
], LuzmoBaseVizItem.prototype, "options", 2);
|
|
3198
|
+
__decorateClass([
|
|
3199
|
+
n4()
|
|
3200
|
+
], LuzmoBaseVizItem.prototype, "type", 2);
|
|
3201
|
+
__decorateClass([
|
|
3202
|
+
n4()
|
|
3203
|
+
], LuzmoBaseVizItem.prototype, "authKey", 2);
|
|
3204
|
+
__decorateClass([
|
|
3205
|
+
n4()
|
|
3206
|
+
], LuzmoBaseVizItem.prototype, "authToken", 2);
|
|
3207
|
+
__decorateClass([
|
|
3208
|
+
n4()
|
|
3209
|
+
], LuzmoBaseVizItem.prototype, "version", 2);
|
|
3210
|
+
__decorateClass([
|
|
3211
|
+
n4()
|
|
3212
|
+
], LuzmoBaseVizItem.prototype, "contextId", 2);
|
|
3213
|
+
__decorateClass([
|
|
3214
|
+
n4({
|
|
3215
|
+
converter: (value) => {
|
|
3216
|
+
try {
|
|
3217
|
+
return JSON.parse(value);
|
|
3218
|
+
} catch {
|
|
3219
|
+
return value;
|
|
3220
|
+
}
|
|
3221
|
+
}
|
|
3222
|
+
})
|
|
3223
|
+
], LuzmoBaseVizItem.prototype, "canFilter", 2);
|
|
3224
|
+
__decorateClass([
|
|
3225
|
+
n4({ type: Array })
|
|
3226
|
+
], LuzmoBaseVizItem.prototype, "filters", 2);
|
|
3227
|
+
__decorateClass([
|
|
3228
|
+
n4()
|
|
3229
|
+
], LuzmoBaseVizItem.prototype, "dashboardId", 2);
|
|
3230
|
+
__decorateClass([
|
|
3231
|
+
n4()
|
|
3232
|
+
], LuzmoBaseVizItem.prototype, "itemId", 2);
|
|
3233
|
+
__decorateClass([
|
|
3234
|
+
n4({ type: Object })
|
|
3235
|
+
], LuzmoBaseVizItem.prototype, "selectedData", 2);
|
|
3236
|
+
__decorateClass([
|
|
3237
|
+
n4()
|
|
3238
|
+
], LuzmoBaseVizItem.prototype, "dashboardContentsVersion", 2);
|
|
3239
|
+
__decorateClass([
|
|
3240
|
+
n4()
|
|
3241
|
+
], LuzmoBaseVizItem.prototype, "libVersion", 2);
|
|
3242
|
+
|
|
3243
|
+
// libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
|
|
3244
|
+
var LuzmoEmbedVizItem = class extends LuzmoBaseVizItem {
|
|
3245
|
+
};
|
|
3246
|
+
if (!customElements.get("luzmo-embed-viz-item")) {
|
|
3247
|
+
customElements.define("luzmo-embed-viz-item", LuzmoEmbedVizItem);
|
|
3248
|
+
}
|
|
3249
|
+
|
|
3250
|
+
// libs/embed-libs/embed/src/lib/luzmo-iq-components/luzmo-iq-chat.ts
|
|
3251
|
+
var inputMap = {
|
|
3252
|
+
aiEndpoint: "ai-endpoint",
|
|
3253
|
+
appServer: "app-server",
|
|
3254
|
+
apiHost: "api-host",
|
|
3255
|
+
options: "options",
|
|
3256
|
+
initialSuggestionsDatasetId: "initialSuggestionsDatasetId",
|
|
3257
|
+
authKey: "auth-key",
|
|
3258
|
+
authToken: "auth-token",
|
|
3259
|
+
version: "version",
|
|
3260
|
+
libVersion: "lib-version",
|
|
3261
|
+
aydHost: "ayd-host"
|
|
3262
|
+
};
|
|
3263
|
+
var LuzmoIQEmbedChatComponent = class extends h3 {
|
|
3264
|
+
constructor() {
|
|
3265
|
+
super(...arguments);
|
|
3266
|
+
this.appServer = "https://app.luzmo.com";
|
|
3267
|
+
this.apiHost = "https://api.luzmo.com";
|
|
3268
|
+
this.version = version + "-wc-luzmo";
|
|
3269
|
+
this.libVersion = version + "-wc-luzmo";
|
|
3270
|
+
this.remoteEntryServer = "http://localhost:4202/";
|
|
3271
|
+
this.aydHost = "https://ayd.luzmo.com/";
|
|
3272
|
+
}
|
|
3273
|
+
static {
|
|
3274
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
3275
|
+
this.styles = i`
|
|
3276
|
+
:host {
|
|
3277
|
+
display: block;
|
|
3278
|
+
width: 100%;
|
|
3279
|
+
height: 100%;
|
|
3280
|
+
}
|
|
3281
|
+
`;
|
|
3282
|
+
}
|
|
3283
|
+
createRenderRoot() {
|
|
3284
|
+
return this;
|
|
3285
|
+
}
|
|
3286
|
+
async firstUpdated(_changedProperties) {
|
|
3287
|
+
super.firstUpdated(_changedProperties);
|
|
3288
|
+
await loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
|
|
3289
|
+
this.createAndAppendElement();
|
|
3290
|
+
}
|
|
3291
|
+
createAndAppendElement() {
|
|
3292
|
+
if (!this.chartElement) {
|
|
3293
|
+
this.chartElement = document.createElement("luzmo-iq-chat-component");
|
|
3294
|
+
this.chartElement.addEventListener("load", (payload) => this.dispatchEvent(new CustomEvent("load", payload)));
|
|
3295
|
+
this.updateVizItemProperties();
|
|
3296
|
+
this.renderRoot.append(this.chartElement);
|
|
3297
|
+
}
|
|
3298
|
+
}
|
|
3299
|
+
updateVizItemProperties() {
|
|
3300
|
+
if (this.chartElement) {
|
|
3301
|
+
for (const key in inputMap) {
|
|
3302
|
+
const value = this[key];
|
|
3303
|
+
if (value) {
|
|
3304
|
+
const attributeValue = ["appServer", "apiHost", "aydHost"].includes(key) ? removeTrailingSlash(value) : value;
|
|
3305
|
+
this.chartElement.setAttribute(
|
|
3306
|
+
inputMap[key],
|
|
3307
|
+
typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
|
|
3308
|
+
);
|
|
3309
|
+
}
|
|
3310
|
+
}
|
|
3311
|
+
}
|
|
3312
|
+
}
|
|
3313
|
+
async updated(changedProperties) {
|
|
3314
|
+
if (this.chartElement) {
|
|
3315
|
+
for (const [propertyName] of changedProperties.entries()) {
|
|
3316
|
+
const mappedAttributeName = inputMap[propertyName] ?? propertyName;
|
|
3317
|
+
const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
|
|
3318
|
+
this.chartElement.setAttribute(mappedAttributeName, attributeValue);
|
|
3319
|
+
}
|
|
3320
|
+
} else {
|
|
3321
|
+
await loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
|
|
3322
|
+
this.createAndAppendElement();
|
|
3323
|
+
}
|
|
3324
|
+
}
|
|
3325
|
+
render() {
|
|
3326
|
+
return ke``;
|
|
3327
|
+
}
|
|
3328
|
+
connectedCallback() {
|
|
3329
|
+
super.connectedCallback();
|
|
3330
|
+
const embedChat = document.querySelector("luzmo-iq-embed-chat");
|
|
3331
|
+
if (!embedChat) {
|
|
3332
|
+
return;
|
|
3333
|
+
}
|
|
3334
|
+
const observer = new MutationObserver(() => {
|
|
3335
|
+
const customChatWidgetContentSlot = embedChat.querySelector('*[slot="custom-chat-widget-content"]');
|
|
3336
|
+
if (!customChatWidgetContentSlot) {
|
|
3337
|
+
return;
|
|
3338
|
+
}
|
|
3339
|
+
const chatElement = embedChat.querySelector("luzmo-iq-chat-component");
|
|
3340
|
+
if (chatElement) {
|
|
3341
|
+
chatElement.append(customChatWidgetContentSlot);
|
|
3342
|
+
observer.disconnect();
|
|
3343
|
+
}
|
|
3344
|
+
});
|
|
3345
|
+
observer.observe(embedChat, { childList: true, subtree: true });
|
|
3346
|
+
}
|
|
3347
|
+
};
|
|
3348
|
+
__decorateClass([
|
|
3349
|
+
n4()
|
|
3350
|
+
], LuzmoIQEmbedChatComponent.prototype, "appServer", 2);
|
|
3351
|
+
__decorateClass([
|
|
3352
|
+
n4()
|
|
3353
|
+
], LuzmoIQEmbedChatComponent.prototype, "apiHost", 2);
|
|
3354
|
+
__decorateClass([
|
|
3355
|
+
n4({ type: Object })
|
|
3356
|
+
], LuzmoIQEmbedChatComponent.prototype, "options", 2);
|
|
3357
|
+
__decorateClass([
|
|
3358
|
+
n4({ type: String })
|
|
3359
|
+
], LuzmoIQEmbedChatComponent.prototype, "initialSuggestionsDatasetId", 2);
|
|
3360
|
+
__decorateClass([
|
|
3361
|
+
n4()
|
|
3362
|
+
], LuzmoIQEmbedChatComponent.prototype, "aiEndpoint", 2);
|
|
3363
|
+
__decorateClass([
|
|
3364
|
+
n4()
|
|
3365
|
+
], LuzmoIQEmbedChatComponent.prototype, "authKey", 2);
|
|
3366
|
+
__decorateClass([
|
|
3367
|
+
n4()
|
|
3368
|
+
], LuzmoIQEmbedChatComponent.prototype, "authToken", 2);
|
|
3369
|
+
__decorateClass([
|
|
3370
|
+
n4()
|
|
3371
|
+
], LuzmoIQEmbedChatComponent.prototype, "version", 2);
|
|
3372
|
+
__decorateClass([
|
|
3373
|
+
n4()
|
|
3374
|
+
], LuzmoIQEmbedChatComponent.prototype, "libVersion", 2);
|
|
3375
|
+
__decorateClass([
|
|
3376
|
+
n4()
|
|
3377
|
+
], LuzmoIQEmbedChatComponent.prototype, "remoteEntryServer", 2);
|
|
3378
|
+
__decorateClass([
|
|
3379
|
+
n4()
|
|
3380
|
+
], LuzmoIQEmbedChatComponent.prototype, "aydHost", 2);
|
|
3381
|
+
if (!customElements.get("luzmo-iq-embed-chat")) {
|
|
3382
|
+
customElements.define("luzmo-iq-embed-chat", LuzmoIQEmbedChatComponent);
|
|
3383
|
+
}
|
|
3384
|
+
|
|
3385
|
+
// libs/embed-libs/embed/src/lib/luzmo-iq-components/luzmo-iq-answer.ts
|
|
3386
|
+
var inputMap2 = {
|
|
3387
|
+
aiEndPoint: "ai-end-point",
|
|
3388
|
+
appServer: "app-server",
|
|
3389
|
+
apiHost: "api-host",
|
|
3390
|
+
options: "options",
|
|
3391
|
+
authKey: "auth-key",
|
|
3392
|
+
authToken: "auth-token",
|
|
3393
|
+
version: "version",
|
|
3394
|
+
libVersion: "lib-version",
|
|
3395
|
+
messages: "messages"
|
|
3396
|
+
};
|
|
3397
|
+
var LuzmoIQEmbedAnswerComponent = class extends h3 {
|
|
3398
|
+
constructor() {
|
|
3399
|
+
super(...arguments);
|
|
3400
|
+
this.appServer = "https://app.luzmo.com";
|
|
3401
|
+
this.apiHost = "https://api.luzmo.com";
|
|
3402
|
+
this.version = version + "-wc-luzmo";
|
|
3403
|
+
this.libVersion = version + "-wc-luzmo";
|
|
3404
|
+
this.remoteEntryServer = "http://localhost:4202";
|
|
3405
|
+
}
|
|
3406
|
+
static {
|
|
3407
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
3408
|
+
this.styles = i`
|
|
3409
|
+
:host {
|
|
3410
|
+
display: block;
|
|
3411
|
+
width: 100%;
|
|
3412
|
+
height: 100%;
|
|
3413
|
+
}
|
|
3414
|
+
`;
|
|
3415
|
+
}
|
|
3416
|
+
createRenderRoot() {
|
|
3417
|
+
return this;
|
|
3418
|
+
}
|
|
3419
|
+
async firstUpdated(_changedProperties) {
|
|
3420
|
+
super.firstUpdated(_changedProperties);
|
|
3421
|
+
await loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
|
|
3422
|
+
this.createAndAppendElement();
|
|
3423
|
+
}
|
|
3424
|
+
createAndAppendElement() {
|
|
3425
|
+
if (!this.chartElement) {
|
|
3426
|
+
this.chartElement = document.createElement("luzmo-iq-answer-component");
|
|
3427
|
+
this.chartElement.addEventListener("addQuestion", (payload) => this.dispatchEvent(new CustomEvent("addQuestion", payload)));
|
|
3428
|
+
this.chartElement.addEventListener("addAnswer", (payload) => this.dispatchEvent(new CustomEvent("addAnswer", payload)));
|
|
3429
|
+
this.updateVizItemProperties();
|
|
3430
|
+
this.renderRoot.append(this.chartElement);
|
|
3431
|
+
}
|
|
3432
|
+
}
|
|
3433
|
+
updateVizItemProperties() {
|
|
3434
|
+
if (this.chartElement) {
|
|
3435
|
+
for (const key in inputMap2) {
|
|
3436
|
+
const value = this[key];
|
|
3437
|
+
if (value) {
|
|
3438
|
+
const attributeValue = ["appServer", "apiHost"].includes(key) ? removeTrailingSlash(value) : value;
|
|
3439
|
+
this.chartElement.setAttribute(
|
|
3440
|
+
inputMap2[key],
|
|
3441
|
+
typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
|
|
3442
|
+
);
|
|
3443
|
+
}
|
|
3444
|
+
}
|
|
3445
|
+
}
|
|
3446
|
+
}
|
|
3447
|
+
async updated(changedProperties) {
|
|
3448
|
+
if (this.chartElement) {
|
|
3449
|
+
for (const [propertyName] of changedProperties.entries()) {
|
|
3450
|
+
const mappedAttributeName = inputMap2[propertyName] ?? propertyName;
|
|
3451
|
+
const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
|
|
3452
|
+
this.chartElement.setAttribute(mappedAttributeName, attributeValue);
|
|
3453
|
+
}
|
|
3454
|
+
} else {
|
|
3455
|
+
await loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
|
|
3456
|
+
this.createAndAppendElement();
|
|
3457
|
+
}
|
|
3458
|
+
}
|
|
3459
|
+
render() {
|
|
3460
|
+
return ke` `;
|
|
3461
|
+
}
|
|
3462
|
+
};
|
|
3463
|
+
__decorateClass([
|
|
3464
|
+
n4()
|
|
3465
|
+
], LuzmoIQEmbedAnswerComponent.prototype, "appServer", 2);
|
|
3466
|
+
__decorateClass([
|
|
3467
|
+
n4()
|
|
3468
|
+
], LuzmoIQEmbedAnswerComponent.prototype, "apiHost", 2);
|
|
3469
|
+
__decorateClass([
|
|
3470
|
+
n4({ type: Object })
|
|
3471
|
+
], LuzmoIQEmbedAnswerComponent.prototype, "options", 2);
|
|
3472
|
+
__decorateClass([
|
|
3473
|
+
n4()
|
|
3474
|
+
], LuzmoIQEmbedAnswerComponent.prototype, "aiEndPoint", 2);
|
|
3475
|
+
__decorateClass([
|
|
3476
|
+
n4()
|
|
3477
|
+
], LuzmoIQEmbedAnswerComponent.prototype, "authKey", 2);
|
|
3478
|
+
__decorateClass([
|
|
3479
|
+
n4()
|
|
3480
|
+
], LuzmoIQEmbedAnswerComponent.prototype, "authToken", 2);
|
|
3481
|
+
__decorateClass([
|
|
3482
|
+
n4()
|
|
3483
|
+
], LuzmoIQEmbedAnswerComponent.prototype, "messages", 2);
|
|
3484
|
+
__decorateClass([
|
|
3485
|
+
n4()
|
|
3486
|
+
], LuzmoIQEmbedAnswerComponent.prototype, "version", 2);
|
|
3487
|
+
__decorateClass([
|
|
3488
|
+
n4()
|
|
3489
|
+
], LuzmoIQEmbedAnswerComponent.prototype, "libVersion", 2);
|
|
3490
|
+
__decorateClass([
|
|
3491
|
+
n4()
|
|
3492
|
+
], LuzmoIQEmbedAnswerComponent.prototype, "remoteEntryServer", 2);
|
|
3493
|
+
if (!customElements.get("luzmo-iq-embed-answer")) {
|
|
3494
|
+
customElements.define("luzmo-iq-embed-answer", LuzmoIQEmbedAnswerComponent);
|
|
3495
|
+
}
|
|
3496
|
+
|
|
3497
|
+
// libs/embed-libs/embed/src/lib/helper/json-schema-utils.ts
|
|
3498
|
+
var cachedSchemas = {};
|
|
3499
|
+
function addJSONSchemas(schemas) {
|
|
3500
|
+
if (schemas.some((schema) => !schema.$id)) {
|
|
3501
|
+
throw new Error("To add schemas they all must have an $id property.");
|
|
3502
|
+
}
|
|
3503
|
+
schemas.forEach((schema) => {
|
|
3504
|
+
cachedSchemas[schema.$id] = schema;
|
|
3505
|
+
});
|
|
3506
|
+
}
|
|
3507
|
+
function getCachedJSONSchema(schemaUrl) {
|
|
3508
|
+
return cachedSchemas[schemaUrl];
|
|
3509
|
+
}
|
|
3510
|
+
function getCachedJSONSchemas() {
|
|
3511
|
+
return cachedSchemas;
|
|
3512
|
+
}
|
|
3513
|
+
function getJSONSchemaUrl(schemaName) {
|
|
3514
|
+
return `https://developer.luzmo.com/assets/json-schemas/${dashboardContentsVersion}/${schemaName}.schema.json`;
|
|
3515
|
+
}
|
|
3516
|
+
async function fetchJSONSchema(schemaName) {
|
|
3517
|
+
const schemaUrl = getJSONSchemaUrl(schemaName);
|
|
3518
|
+
if (getCachedJSONSchema(schemaUrl)) {
|
|
3519
|
+
return getCachedJSONSchema(schemaUrl);
|
|
3520
|
+
}
|
|
3521
|
+
try {
|
|
3522
|
+
const response = await fetch(schemaUrl, { credentials: "omit" });
|
|
3523
|
+
if (!response.ok) {
|
|
3524
|
+
throw new Error(`Failed to fetch schema ${schemaUrl}, response status: ${response.status}`);
|
|
3525
|
+
}
|
|
3526
|
+
const schema = await response.json();
|
|
3527
|
+
addJSONSchemas([schema]);
|
|
3528
|
+
return schema;
|
|
3529
|
+
} catch (error) {
|
|
3530
|
+
console.error(error);
|
|
3531
|
+
}
|
|
3532
|
+
}
|
|
3533
|
+
var luzmoRefParserResolver = {
|
|
3534
|
+
order: 101,
|
|
3535
|
+
// 101 would make it run after the file resolver, but before the HTTP resolver
|
|
3536
|
+
canRead: (file) => {
|
|
3537
|
+
const isLuzmoUrl = file.url.startsWith("https://developer.luzmo.com");
|
|
3538
|
+
if (isLuzmoUrl) {
|
|
3539
|
+
return !!getCachedJSONSchema(file.url);
|
|
3540
|
+
}
|
|
3541
|
+
return false;
|
|
3542
|
+
},
|
|
3543
|
+
read: (file, callback) => {
|
|
3544
|
+
callback(null, getCachedJSONSchema(file.url));
|
|
3545
|
+
}
|
|
3546
|
+
};
|
|
3547
|
+
var luzmoRefParserOptions = {
|
|
3548
|
+
mutateInputSchema: false,
|
|
3549
|
+
resolve: {
|
|
3550
|
+
luzmo: luzmoRefParserResolver,
|
|
3551
|
+
external: true
|
|
3552
|
+
}
|
|
3553
|
+
};
|
|
3554
|
+
/*! Bundled license information:
|
|
3555
|
+
|
|
3556
|
+
@lit/reactive-element/css-tag.js:
|
|
3557
|
+
(**
|
|
3558
|
+
* @license
|
|
3559
|
+
* Copyright 2019 Google LLC
|
|
3560
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3561
|
+
*)
|
|
3562
|
+
|
|
3563
|
+
@lit/reactive-element/reactive-element.js:
|
|
3564
|
+
(**
|
|
3565
|
+
* @license
|
|
3566
|
+
* Copyright 2017 Google LLC
|
|
3567
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3568
|
+
*)
|
|
3569
|
+
|
|
3570
|
+
lit-html/lit-html.js:
|
|
3571
|
+
(**
|
|
3572
|
+
* @license
|
|
3573
|
+
* Copyright 2017 Google LLC
|
|
3574
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3575
|
+
*)
|
|
3576
|
+
|
|
3577
|
+
lit-element/lit-element.js:
|
|
3578
|
+
(**
|
|
3579
|
+
* @license
|
|
3580
|
+
* Copyright 2017 Google LLC
|
|
3581
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3582
|
+
*)
|
|
3583
|
+
|
|
3584
|
+
lit-html/is-server.js:
|
|
3585
|
+
(**
|
|
3586
|
+
* @license
|
|
3587
|
+
* Copyright 2022 Google LLC
|
|
3588
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3589
|
+
*)
|
|
3590
|
+
|
|
3591
|
+
@lit/reactive-element/decorators/custom-element.js:
|
|
3592
|
+
(**
|
|
3593
|
+
* @license
|
|
3594
|
+
* Copyright 2017 Google LLC
|
|
3595
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3596
|
+
*)
|
|
3597
|
+
|
|
3598
|
+
@lit/reactive-element/decorators/property.js:
|
|
3599
|
+
(**
|
|
3600
|
+
* @license
|
|
3601
|
+
* Copyright 2017 Google LLC
|
|
3602
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3603
|
+
*)
|
|
3604
|
+
|
|
3605
|
+
@lit/reactive-element/decorators/state.js:
|
|
3606
|
+
(**
|
|
3607
|
+
* @license
|
|
3608
|
+
* Copyright 2017 Google LLC
|
|
3609
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3610
|
+
*)
|
|
3611
|
+
|
|
3612
|
+
@lit/reactive-element/decorators/event-options.js:
|
|
3613
|
+
(**
|
|
3614
|
+
* @license
|
|
3615
|
+
* Copyright 2017 Google LLC
|
|
3616
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3617
|
+
*)
|
|
3618
|
+
|
|
3619
|
+
@lit/reactive-element/decorators/base.js:
|
|
3620
|
+
(**
|
|
3621
|
+
* @license
|
|
3622
|
+
* Copyright 2017 Google LLC
|
|
3623
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3624
|
+
*)
|
|
3625
|
+
|
|
3626
|
+
@lit/reactive-element/decorators/query.js:
|
|
3627
|
+
(**
|
|
3628
|
+
* @license
|
|
3629
|
+
* Copyright 2017 Google LLC
|
|
3630
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3631
|
+
*)
|
|
3632
|
+
|
|
3633
|
+
@lit/reactive-element/decorators/query-all.js:
|
|
3634
|
+
(**
|
|
3635
|
+
* @license
|
|
3636
|
+
* Copyright 2017 Google LLC
|
|
3637
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3638
|
+
*)
|
|
3639
|
+
|
|
3640
|
+
@lit/reactive-element/decorators/query-async.js:
|
|
3641
|
+
(**
|
|
3642
|
+
* @license
|
|
3643
|
+
* Copyright 2017 Google LLC
|
|
3644
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3645
|
+
*)
|
|
3646
|
+
|
|
3647
|
+
@lit/reactive-element/decorators/query-assigned-elements.js:
|
|
3648
|
+
(**
|
|
3649
|
+
* @license
|
|
3650
|
+
* Copyright 2021 Google LLC
|
|
3651
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3652
|
+
*)
|
|
3653
|
+
|
|
3654
|
+
@lit/reactive-element/decorators/query-assigned-nodes.js:
|
|
3655
|
+
(**
|
|
3656
|
+
* @license
|
|
3657
|
+
* Copyright 2017 Google LLC
|
|
3658
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3659
|
+
*)
|
|
3660
|
+
|
|
3661
|
+
lit-html/directive.js:
|
|
3662
|
+
(**
|
|
3663
|
+
* @license
|
|
3664
|
+
* Copyright 2017 Google LLC
|
|
3665
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3666
|
+
*)
|
|
3667
|
+
|
|
3668
|
+
lit-html/directives/style-map.js:
|
|
3669
|
+
(**
|
|
3670
|
+
* @license
|
|
3671
|
+
* Copyright 2018 Google LLC
|
|
3672
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3673
|
+
*)
|
|
3674
|
+
*/
|
|
3675
|
+
|
|
3676
|
+
if(__exports != exports)module.exports = exports;return module.exports}));
|