@luzmo/embed 6.0.0-beta.0 → 6.0.0-beta.2
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/index.cjs +6 -3
- package/index.d.ts +2 -1
- package/index.js +6 -2
- package/luzmo-embed.min.js +1383 -1312
- package/package.json +2 -2
- package/src/index.d.ts +2 -1
package/luzmo-embed.min.js
CHANGED
|
@@ -43,856 +43,867 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
43
43
|
var src_exports2 = {};
|
|
44
44
|
__export(src_exports2, {
|
|
45
45
|
LuzmoEmbedDashboard: () => LuzmoEmbedDashboard,
|
|
46
|
-
LuzmoEmbedVizItem: () => LuzmoEmbedVizItem
|
|
46
|
+
LuzmoEmbedVizItem: () => LuzmoEmbedVizItem,
|
|
47
|
+
filterUtils: () => filterUtils
|
|
47
48
|
});
|
|
48
49
|
module.exports = __toCommonJS(src_exports2);
|
|
49
50
|
|
|
50
|
-
//
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/error.ts
|
|
52
|
+
var _handleError = (errorMessage, parameters) => {
|
|
53
|
+
let message = "The dashboard component encountered an error";
|
|
54
|
+
if (typeof parameters?.dashboardId === "string") {
|
|
55
|
+
message += ` for dashboard with id ${parameters.dashboardId}`;
|
|
56
|
+
}
|
|
57
|
+
if (typeof parameters?.dashboardSlug === "string") {
|
|
58
|
+
message += ` for dashboard with slug ${parameters.dashboardSlug}`;
|
|
59
|
+
}
|
|
60
|
+
if (typeof parameters?.container === "string") {
|
|
61
|
+
message += ` in container ${parameters.container}`;
|
|
62
|
+
}
|
|
63
|
+
if (errorMessage) {
|
|
64
|
+
message += `:
|
|
65
|
+
${errorMessage}`;
|
|
66
|
+
console.warn(message);
|
|
67
|
+
}
|
|
55
68
|
};
|
|
56
69
|
|
|
57
|
-
//
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/browser-check.ts
|
|
71
|
+
var _browserCheck = (dashboardComponent) => {
|
|
72
|
+
let hasError = false;
|
|
73
|
+
let errorMessage = "";
|
|
74
|
+
const document_ = document.body || document.documentElement;
|
|
75
|
+
const style = document_.style;
|
|
76
|
+
const browserCheck = {
|
|
77
|
+
svg: !!("createElementNS" in document && document.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGRect),
|
|
78
|
+
flexbox: style.webkitFlexWrap === "" || style.flexWrap === "",
|
|
79
|
+
postMessage: !!window.postMessage
|
|
80
|
+
};
|
|
81
|
+
const browserCheckKeys = ["svg", "flexbox", "postMessage"];
|
|
82
|
+
for (const key of browserCheckKeys) {
|
|
83
|
+
if (!browserCheck[key]) {
|
|
84
|
+
hasError = true;
|
|
85
|
+
dashboardComponent.browserNotSupported = dashboardComponent.browserNotSupported || [];
|
|
86
|
+
dashboardComponent.browserNotSupported.push(key);
|
|
87
|
+
errorMessage += `Your browser does not support: ${key}
|
|
88
|
+
`;
|
|
74
89
|
}
|
|
75
|
-
return t5;
|
|
76
90
|
}
|
|
77
|
-
|
|
78
|
-
|
|
91
|
+
const ua = window.navigator.userAgent;
|
|
92
|
+
const msie = ua.includes("MSIE");
|
|
93
|
+
const trident = ua.includes("Trident/");
|
|
94
|
+
if (msie || trident) {
|
|
95
|
+
hasError = true;
|
|
96
|
+
errorMessage = "IE is not supported.";
|
|
97
|
+
}
|
|
98
|
+
if (hasError) {
|
|
99
|
+
_handleError(errorMessage);
|
|
79
100
|
}
|
|
80
101
|
};
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
|
|
103
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/default-parameters.ts
|
|
104
|
+
var DEFAULT_PARAMETERS = {
|
|
105
|
+
appServer: "https://app.luzmo.com/",
|
|
106
|
+
apiHost: "https://api.luzmo.com/",
|
|
107
|
+
dashboardId: null,
|
|
108
|
+
dashboardSlug: null,
|
|
109
|
+
container: null,
|
|
110
|
+
key: null,
|
|
111
|
+
token: null,
|
|
112
|
+
language: "auto",
|
|
113
|
+
qeVersion: null,
|
|
114
|
+
editMode: null,
|
|
115
|
+
screenMode: null,
|
|
116
|
+
switchScreenModeOnResize: true,
|
|
117
|
+
itemId: null,
|
|
118
|
+
mainColor: "",
|
|
119
|
+
accentColor: "",
|
|
120
|
+
itemDimensions: {
|
|
121
|
+
width: "auto",
|
|
122
|
+
height: "auto"
|
|
123
|
+
},
|
|
124
|
+
loaderBackground: "#f9f9f9",
|
|
125
|
+
loaderFontColor: "#5a5a5a",
|
|
126
|
+
loaderSpinnerColor: "rgba(255, 165, 0, 0.7)",
|
|
127
|
+
loaderSpinnerBackground: "rgba(169, 169, 169, 0.14)",
|
|
128
|
+
timezoneId: null,
|
|
129
|
+
contextId: null
|
|
100
130
|
};
|
|
101
|
-
var c = e ? (t5) => t5 : (t5) => t5 instanceof CSSStyleSheet ? ((t6) => {
|
|
102
|
-
let e7 = "";
|
|
103
|
-
for (const s4 of t6.cssRules)
|
|
104
|
-
e7 += s4.cssText;
|
|
105
|
-
return r(e7);
|
|
106
|
-
})(t5) : t5;
|
|
107
131
|
|
|
108
|
-
//
|
|
109
|
-
var
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
i6 = null !== t5;
|
|
130
|
-
break;
|
|
131
|
-
case Number:
|
|
132
|
-
i6 = null === t5 ? null : Number(t5);
|
|
133
|
-
break;
|
|
134
|
-
case Object:
|
|
135
|
-
case Array:
|
|
136
|
-
try {
|
|
137
|
-
i6 = JSON.parse(t5);
|
|
138
|
-
} catch (t6) {
|
|
139
|
-
i6 = null;
|
|
140
|
-
}
|
|
132
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/extents.ts
|
|
133
|
+
var EXTENTS = [
|
|
134
|
+
{ mode: "mobile", width: [150, 767] },
|
|
135
|
+
{ mode: "tablet", width: [768, 1199] },
|
|
136
|
+
{ mode: "desktop", width: [1200, 1599] },
|
|
137
|
+
{ mode: "largeScreen", width: [1600, 9999] },
|
|
138
|
+
{ mode: "fixed", width: [] }
|
|
139
|
+
];
|
|
140
|
+
|
|
141
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/translations.ts
|
|
142
|
+
var TRANSLATIONS = {
|
|
143
|
+
initializing: { en: "Initializing...", nl: "Laden...", fr: "Chargement..." },
|
|
144
|
+
errorDashboard: {
|
|
145
|
+
en: "Oops, we could not load this dashboard!",
|
|
146
|
+
nl: "Oeps, we konden het dashboard niet laden.",
|
|
147
|
+
fr: "Le chargement a echou\xE9."
|
|
148
|
+
},
|
|
149
|
+
errorItem: {
|
|
150
|
+
en: "Oops, we could not load this item!",
|
|
151
|
+
nl: "Oeps, we konden de grafiek niet laden.",
|
|
152
|
+
fr: "Le chargement a echou\xE9."
|
|
141
153
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
this._$Ei(), (this.l ??= []).push(t5);
|
|
154
|
+
};
|
|
155
|
+
var translations_default = TRANSLATIONS;
|
|
156
|
+
|
|
157
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/utils.ts
|
|
158
|
+
var addTrailingSlash = (serverUrl) => {
|
|
159
|
+
if (!serverUrl) {
|
|
160
|
+
return "";
|
|
150
161
|
}
|
|
151
|
-
|
|
152
|
-
|
|
162
|
+
return serverUrl.endsWith("/") ? serverUrl : `${serverUrl}/`;
|
|
163
|
+
};
|
|
164
|
+
var removeTrailingSlash = (serverUrl) => {
|
|
165
|
+
if (!serverUrl) {
|
|
166
|
+
return "";
|
|
153
167
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
168
|
+
return serverUrl.endsWith("/") ? serverUrl.slice(0, -1) : serverUrl;
|
|
169
|
+
};
|
|
170
|
+
var formatDashboardList = (dashboards, integrationId, user, dashboardComponent) => {
|
|
171
|
+
const combineRights = (securable, user2) => {
|
|
172
|
+
const matchingUser = securable.users.find((u3) => u3.id === user2.id);
|
|
173
|
+
const securableAccessRights = matchingUser && matchingUser.userAccessRight ? {
|
|
174
|
+
flagRead: matchingUser.userAccessRight.flagRead,
|
|
175
|
+
flagUse: matchingUser.userAccessRight.flagUse,
|
|
176
|
+
flagModify: matchingUser.userAccessRight.flagModify,
|
|
177
|
+
flagOwn: matchingUser.userAccessRight.flagOwn
|
|
178
|
+
} : {
|
|
179
|
+
flagRead: false,
|
|
180
|
+
flagUse: false,
|
|
181
|
+
flagModify: false,
|
|
182
|
+
flagOwn: false
|
|
183
|
+
};
|
|
184
|
+
const groups = securable.groups.filter(
|
|
185
|
+
(group) => user2.userGroups.includes(group.id) || group.public === true
|
|
186
|
+
);
|
|
187
|
+
const groupsAccess = groups.map((group) => {
|
|
188
|
+
if (group.groupAccessRight) {
|
|
189
|
+
return group.groupAccessRight;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
for (const groupAccess of groupsAccess) {
|
|
193
|
+
if (!securableAccessRights.flagRead && groupAccess.flagRead) {
|
|
194
|
+
securableAccessRights.flagRead = groupAccess.flagRead;
|
|
195
|
+
}
|
|
196
|
+
if (!securableAccessRights.flagUse && groupAccess.flagUse) {
|
|
197
|
+
securableAccessRights.flagUse = groupAccess.flagUse;
|
|
198
|
+
}
|
|
199
|
+
if (!securableAccessRights.flagModify && groupAccess.flagModify) {
|
|
200
|
+
securableAccessRights.flagModify = groupAccess.flagModify;
|
|
201
|
+
}
|
|
202
|
+
if (!securableAccessRights.flagOwn && groupAccess.flagOwn) {
|
|
203
|
+
securableAccessRights.flagOwn = groupAccess.flagOwn;
|
|
204
|
+
}
|
|
158
205
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
return this.elementProperties.get(t5) ?? y;
|
|
175
|
-
}
|
|
176
|
-
static _$Ei() {
|
|
177
|
-
if (this.hasOwnProperty(d("elementProperties")))
|
|
178
|
-
return;
|
|
179
|
-
const t5 = n2(this);
|
|
180
|
-
t5.finalize(), void 0 !== t5.l && (this.l = [...t5.l]), this.elementProperties = new Map(t5.elementProperties);
|
|
181
|
-
}
|
|
182
|
-
static finalize() {
|
|
183
|
-
if (this.hasOwnProperty(d("finalized")))
|
|
184
|
-
return;
|
|
185
|
-
if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d("properties"))) {
|
|
186
|
-
const t6 = this.properties, s4 = [...h(t6), ...o2(t6)];
|
|
187
|
-
for (const i6 of s4)
|
|
188
|
-
this.createProperty(i6, t6[i6]);
|
|
206
|
+
const integrationsAccess = securable.integrations?.length > 0 ? securable.integrations.map((integration) => {
|
|
207
|
+
if (integration.integrationAccessRight) {
|
|
208
|
+
return integration.integrationAccessRight;
|
|
209
|
+
}
|
|
210
|
+
}) : [];
|
|
211
|
+
for (const integrationAccess of integrationsAccess) {
|
|
212
|
+
if (!securableAccessRights.flagRead && integrationAccess.flagRead) {
|
|
213
|
+
securableAccessRights.flagRead = integrationAccess.flagRead;
|
|
214
|
+
}
|
|
215
|
+
if (!securableAccessRights.flagUse && integrationAccess.flagUse) {
|
|
216
|
+
securableAccessRights.flagUse = integrationAccess.flagUse;
|
|
217
|
+
}
|
|
218
|
+
if (!securableAccessRights.flagModify && integrationAccess.flagModify) {
|
|
219
|
+
securableAccessRights.flagModify = integrationAccess.flagModify;
|
|
220
|
+
}
|
|
189
221
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
this.elementProperties.set(t6, i6);
|
|
222
|
+
return securableAccessRights;
|
|
223
|
+
};
|
|
224
|
+
const localize = (item, locale) => {
|
|
225
|
+
if (item === null || item === void 0) {
|
|
226
|
+
return "";
|
|
196
227
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
228
|
+
if (typeof item !== "object" || Object.keys(item).length === 0) {
|
|
229
|
+
if (typeof item === "object" && Object.keys(item).length === 0) {
|
|
230
|
+
return "";
|
|
231
|
+
}
|
|
232
|
+
return item;
|
|
201
233
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
234
|
+
let localizedItem;
|
|
235
|
+
localizedItem = locale && item[locale] ? item[locale] : item[Object.keys(item)[0]];
|
|
236
|
+
if (localizedItem === void 0 || localizedItem === null) {
|
|
237
|
+
localizedItem = "";
|
|
238
|
+
}
|
|
239
|
+
return localizedItem;
|
|
240
|
+
};
|
|
241
|
+
const treatedDashboards = [];
|
|
242
|
+
for (const dashboard of dashboards) {
|
|
243
|
+
const treatedDashboard = {
|
|
244
|
+
accessibleBy: [],
|
|
245
|
+
accessRights: combineRights(dashboard, user),
|
|
246
|
+
id: dashboard.id,
|
|
247
|
+
modifiedAt: dashboard.modified_at,
|
|
248
|
+
name: localize(dashboard.name, dashboardComponent.language),
|
|
249
|
+
slug: null,
|
|
250
|
+
tags: dashboard.tags.map((t5) => t5.tag).sort((t1, t22) => t1.localeCompare(t22))
|
|
251
|
+
};
|
|
252
|
+
const currentIntegration = dashboard.integrations.find(
|
|
253
|
+
(i6) => i6.id === integrationId
|
|
254
|
+
);
|
|
255
|
+
if (currentIntegration?.integrationAccessRight?.slug) {
|
|
256
|
+
treatedDashboard.slug = currentIntegration.integrationAccessRight.slug;
|
|
257
|
+
}
|
|
258
|
+
const users = dashboard.users.map((u3) => ({
|
|
259
|
+
model: "User",
|
|
260
|
+
id: u3.id,
|
|
261
|
+
name: localize(u3.name, user.locale_id)
|
|
262
|
+
}));
|
|
263
|
+
const groups = dashboard.groups.map((g2) => ({
|
|
264
|
+
model: "Group",
|
|
265
|
+
id: g2.id,
|
|
266
|
+
name: localize(g2.name, user.locale_id) || {}
|
|
267
|
+
}));
|
|
268
|
+
const integrations = dashboard.integrations.map((i6) => ({
|
|
269
|
+
model: "Integration",
|
|
270
|
+
id: i6.id,
|
|
271
|
+
name: localize(i6.name, user.locale_id) || {}
|
|
272
|
+
}));
|
|
273
|
+
treatedDashboard.accessibleBy = [...users, ...groups, ...integrations];
|
|
274
|
+
treatedDashboards.push(treatedDashboard);
|
|
213
275
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
276
|
+
return treatedDashboards;
|
|
277
|
+
};
|
|
278
|
+
var VERSION = "0.0.0-unknown-luzmo";
|
|
279
|
+
var sanitizeUrl = (url) => {
|
|
280
|
+
const invalidPrototcolRegex = /^(%20|\s)*(javascript|data)/im;
|
|
281
|
+
const ctrlCharactersRegex = /[^\u0020-\u007E]/gim;
|
|
282
|
+
const urlSchemeRegex = /^([^:]+):/gm;
|
|
283
|
+
const relativeFirstCharacters = /* @__PURE__ */ new Set([".", "/"]);
|
|
284
|
+
const isRelativeUrlWithoutProtocol = (relativeUrl) => relativeFirstCharacters.has(relativeUrl[0]);
|
|
285
|
+
if (!url) {
|
|
286
|
+
return "about:blank";
|
|
217
287
|
}
|
|
218
|
-
|
|
219
|
-
|
|
288
|
+
const sanitizedUrl = url.replaceAll(ctrlCharactersRegex, "").trim();
|
|
289
|
+
if (isRelativeUrlWithoutProtocol(sanitizedUrl)) {
|
|
290
|
+
return sanitizedUrl;
|
|
220
291
|
}
|
|
221
|
-
|
|
222
|
-
|
|
292
|
+
const urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex);
|
|
293
|
+
if (!urlSchemeParseResults) {
|
|
294
|
+
return sanitizedUrl;
|
|
223
295
|
}
|
|
224
|
-
|
|
225
|
-
|
|
296
|
+
const urlScheme = urlSchemeParseResults[0];
|
|
297
|
+
if (invalidPrototcolRegex.test(urlScheme)) {
|
|
298
|
+
return "about:blank";
|
|
226
299
|
}
|
|
227
|
-
|
|
228
|
-
|
|
300
|
+
return sanitizedUrl;
|
|
301
|
+
};
|
|
302
|
+
var cloneDeep = (obj) => JSON.parse(JSON.stringify(obj));
|
|
303
|
+
var isObject = (o6) => o6 && typeof o6 === "object";
|
|
304
|
+
var defaultsDeep = (target, defaults) => {
|
|
305
|
+
Object.entries(defaults).forEach(([k2, v2]) => {
|
|
306
|
+
if (k2 in target) {
|
|
307
|
+
if (target[k2] === void 0) {
|
|
308
|
+
target[k2] = v2;
|
|
309
|
+
} else {
|
|
310
|
+
target[k2] = isObject(v2) ? defaultsDeep(
|
|
311
|
+
target[k2],
|
|
312
|
+
v2
|
|
313
|
+
) : target[k2];
|
|
314
|
+
}
|
|
315
|
+
} else {
|
|
316
|
+
target[k2] = v2;
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
return target;
|
|
320
|
+
};
|
|
321
|
+
var uuidv4 = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g, function(c4) {
|
|
322
|
+
const r7 = Math.random() * 16 | 0;
|
|
323
|
+
const v2 = c4 == "x" ? r7 : r7 & 3 | 8;
|
|
324
|
+
return v2.toString(16);
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/iframe-url.ts
|
|
328
|
+
var createIframeUrl = (dashboardContent) => {
|
|
329
|
+
const searchString = [];
|
|
330
|
+
const {
|
|
331
|
+
appServer,
|
|
332
|
+
language,
|
|
333
|
+
qeVersion,
|
|
334
|
+
loaderBackground,
|
|
335
|
+
loaderSpinnerColor,
|
|
336
|
+
loaderSpinnerBackground,
|
|
337
|
+
loaderFontColor,
|
|
338
|
+
screenMode,
|
|
339
|
+
key,
|
|
340
|
+
token,
|
|
341
|
+
timezoneId,
|
|
342
|
+
itemEmbedding,
|
|
343
|
+
itemDimensions,
|
|
344
|
+
dashboardId,
|
|
345
|
+
dashboardSlug,
|
|
346
|
+
itemId,
|
|
347
|
+
mainColor,
|
|
348
|
+
accentColor,
|
|
349
|
+
editMode
|
|
350
|
+
} = dashboardContent.params;
|
|
351
|
+
if (language && language !== "auto") {
|
|
352
|
+
searchString.push("language=" + language);
|
|
229
353
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
for (const i6 of s4.keys())
|
|
233
|
-
this.hasOwnProperty(i6) && (t5.set(i6, this[i6]), delete this[i6]);
|
|
234
|
-
t5.size > 0 && (this._$Ep = t5);
|
|
354
|
+
if (qeVersion) {
|
|
355
|
+
searchString.push(`qe_version=${qeVersion}`);
|
|
235
356
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
return S(t5, this.constructor.elementStyles), t5;
|
|
357
|
+
if (loaderBackground) {
|
|
358
|
+
searchString.push(`ldrbg=${loaderBackground}`);
|
|
239
359
|
}
|
|
240
|
-
|
|
241
|
-
|
|
360
|
+
if (loaderFontColor) {
|
|
361
|
+
searchString.push(`ldrftclr=${loaderFontColor}`);
|
|
242
362
|
}
|
|
243
|
-
|
|
363
|
+
if (loaderSpinnerColor) {
|
|
364
|
+
searchString.push(`ldrspclr=${loaderSpinnerColor}`);
|
|
244
365
|
}
|
|
245
|
-
|
|
246
|
-
|
|
366
|
+
if (loaderSpinnerBackground) {
|
|
367
|
+
searchString.push(`ldrspbg=${loaderSpinnerBackground}`);
|
|
247
368
|
}
|
|
248
|
-
|
|
249
|
-
|
|
369
|
+
if (mainColor) {
|
|
370
|
+
searchString.push(`mainColor=${mainColor}`);
|
|
250
371
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
if (void 0 !== e7 && true === i6.reflect) {
|
|
254
|
-
const r7 = (void 0 !== i6.converter?.toAttribute ? i6.converter : u).toAttribute(s4, i6.type);
|
|
255
|
-
this._$Em = t5, null == r7 ? this.removeAttribute(e7) : this.setAttribute(e7, r7), this._$Em = null;
|
|
256
|
-
}
|
|
372
|
+
if (accentColor) {
|
|
373
|
+
searchString.push(`accentColor=${accentColor}`);
|
|
257
374
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
if (void 0 !== e7 && this._$Em !== e7) {
|
|
261
|
-
const t6 = i6.getPropertyOptions(e7), r7 = "function" == typeof t6.converter ? { fromAttribute: t6.converter } : void 0 !== t6.converter?.fromAttribute ? t6.converter : u;
|
|
262
|
-
this._$Em = e7, this[e7] = r7.fromAttribute(s4, t6.type), this._$Em = null;
|
|
263
|
-
}
|
|
375
|
+
if (screenMode && screenMode !== "auto") {
|
|
376
|
+
searchString.push("screenMode=" + screenMode);
|
|
264
377
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
if (i6 ??= this.constructor.getPropertyOptions(t5), !(i6.hasChanged ?? f)(this[t5], s4))
|
|
268
|
-
return;
|
|
269
|
-
this.P(t5, s4, i6);
|
|
270
|
-
}
|
|
271
|
-
false === this.isUpdatePending && (this._$ES = this._$ET());
|
|
378
|
+
if (timezoneId) {
|
|
379
|
+
searchString.push("timezoneId=" + timezoneId);
|
|
272
380
|
}
|
|
273
|
-
|
|
274
|
-
|
|
381
|
+
if (itemEmbedding && itemDimensions && itemDimensions.width) {
|
|
382
|
+
searchString.push("width=" + itemDimensions.width);
|
|
275
383
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
try {
|
|
279
|
-
await this._$ES;
|
|
280
|
-
} catch (t6) {
|
|
281
|
-
Promise.reject(t6);
|
|
282
|
-
}
|
|
283
|
-
const t5 = this.scheduleUpdate();
|
|
284
|
-
return null != t5 && await t5, !this.isUpdatePending;
|
|
384
|
+
if (itemEmbedding && itemDimensions && itemDimensions.height) {
|
|
385
|
+
searchString.push("height=" + itemDimensions.height);
|
|
285
386
|
}
|
|
286
|
-
|
|
287
|
-
|
|
387
|
+
if (editMode) {
|
|
388
|
+
searchString.push("editMode=" + editMode);
|
|
288
389
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
t5 = this.shouldUpdate(s4), t5 ? (this.willUpdate(s4), this._$EO?.forEach((t6) => t6.hostUpdate?.()), this.update(s4)) : this._$EU();
|
|
307
|
-
} catch (s5) {
|
|
308
|
-
throw t5 = false, this._$EU(), s5;
|
|
390
|
+
const keyTokenUrlAnchor = key && token ? "#" + key + ":" + token : "";
|
|
391
|
+
searchString.push("version=" + (dashboardContent.libVersion || VERSION));
|
|
392
|
+
const iframeUrl = itemEmbedding ? `${appServer}i/${dashboardId || dashboardSlug}/${itemId}?${encodeURIComponent(
|
|
393
|
+
searchString.join("&")
|
|
394
|
+
)}${keyTokenUrlAnchor}` : `${appServer}i/${dashboardId || dashboardSlug}?${encodeURIComponent(
|
|
395
|
+
searchString.join("&")
|
|
396
|
+
)}${keyTokenUrlAnchor}`;
|
|
397
|
+
return sanitizeUrl(iframeUrl);
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/get-loader.ts
|
|
401
|
+
var getLoader = (dashboardComponent) => {
|
|
402
|
+
let errorMsg;
|
|
403
|
+
if (dashboardComponent.params.error || dashboardComponent.browserNotSupported.length > 0) {
|
|
404
|
+
dashboardComponent.params.error = true;
|
|
405
|
+
if (dashboardComponent.browserNotSupported) {
|
|
406
|
+
errorMsg = "Browser is not supported.";
|
|
309
407
|
}
|
|
310
|
-
t5 && this._$AE(s4);
|
|
311
|
-
}
|
|
312
|
-
willUpdate(t5) {
|
|
313
|
-
}
|
|
314
|
-
_$AE(t5) {
|
|
315
|
-
this._$EO?.forEach((t6) => t6.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t5)), this.updated(t5);
|
|
316
|
-
}
|
|
317
|
-
_$EU() {
|
|
318
|
-
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false;
|
|
319
|
-
}
|
|
320
|
-
get updateComplete() {
|
|
321
|
-
return this.getUpdateComplete();
|
|
322
|
-
}
|
|
323
|
-
getUpdateComplete() {
|
|
324
|
-
return this._$ES;
|
|
325
|
-
}
|
|
326
|
-
shouldUpdate(t5) {
|
|
327
|
-
return true;
|
|
328
|
-
}
|
|
329
|
-
update(t5) {
|
|
330
|
-
this._$Ej &&= this._$Ej.forEach((t6) => this._$EC(t6, this[t6])), this._$EU();
|
|
331
|
-
}
|
|
332
|
-
updated(t5) {
|
|
333
|
-
}
|
|
334
|
-
firstUpdated(t5) {
|
|
335
408
|
}
|
|
409
|
+
const loadingMsg = translations_default.initializing[dashboardComponent.params.language] || translations_default.initializing.en;
|
|
410
|
+
return dashboardComponent.browserNotSupported || dashboardComponent.params.error ? { loadingMsg, errorMsg } : { loadingMsg, errorMsg: "" };
|
|
336
411
|
};
|
|
337
|
-
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");
|
|
338
412
|
|
|
339
|
-
//
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
if (void 0 === s4 && globalThis.litPropertyMetadata.set(i6, s4 = /* @__PURE__ */ new Map()), s4.set(r7.name, t5), "accessor" === n6) {
|
|
345
|
-
const { name: o6 } = r7;
|
|
346
|
-
return { set(r8) {
|
|
347
|
-
const n7 = e7.get.call(this);
|
|
348
|
-
e7.set.call(this, r8), this.requestUpdate(o6, n7, t5);
|
|
349
|
-
}, init(e8) {
|
|
350
|
-
return void 0 !== e8 && this.P(o6, void 0, t5), e8;
|
|
351
|
-
} };
|
|
413
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/promise-dispatch.ts
|
|
414
|
+
function resolvePromise(dashboardComponent, requestId, data) {
|
|
415
|
+
if (dashboardComponent.promises[requestId]) {
|
|
416
|
+
dashboardComponent.promises[requestId].resolve(data);
|
|
417
|
+
delete dashboardComponent.promises[requestId];
|
|
352
418
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
};
|
|
419
|
+
}
|
|
420
|
+
function rejectPromise(dashboardComponent, requestId, data) {
|
|
421
|
+
if (dashboardComponent.promises[requestId]) {
|
|
422
|
+
dashboardComponent.promises[requestId].reject(data);
|
|
423
|
+
delete dashboardComponent.promises[requestId];
|
|
359
424
|
}
|
|
360
|
-
throw Error("Unsupported decorator location: " + n6);
|
|
361
|
-
};
|
|
362
|
-
function n3(t5) {
|
|
363
|
-
return (e7, o6) => "object" == typeof o6 ? r3(t5, e7, o6) : ((t6, e8, o7) => {
|
|
364
|
-
const r7 = e8.hasOwnProperty(o7);
|
|
365
|
-
return e8.constructor.createProperty(o7, r7 ? { ...t6, wrapped: true } : t6), r7 ? Object.getOwnPropertyDescriptor(e8, o7) : void 0;
|
|
366
|
-
})(t5, e7, o6);
|
|
367
425
|
}
|
|
368
426
|
|
|
369
|
-
//
|
|
370
|
-
function
|
|
371
|
-
|
|
427
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/styles.ts
|
|
428
|
+
function containerStyles(dashboardComponent) {
|
|
429
|
+
const styles = {};
|
|
430
|
+
if (dashboardComponent.params.loaderBackground && !dashboardComponent.iframeLoaded) {
|
|
431
|
+
styles.background = dashboardComponent.params.loaderBackground;
|
|
432
|
+
}
|
|
433
|
+
return styles;
|
|
372
434
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
const o6 = (t5) => t5.renderRoot?.querySelector(e7) ?? null;
|
|
381
|
-
if (r7) {
|
|
382
|
-
const { get: e8, set: r8 } = "object" == typeof s4 ? n6 : i6 ?? (() => {
|
|
383
|
-
const t5 = Symbol();
|
|
384
|
-
return { get() {
|
|
385
|
-
return this[t5];
|
|
386
|
-
}, set(e9) {
|
|
387
|
-
this[t5] = e9;
|
|
388
|
-
} };
|
|
389
|
-
})();
|
|
390
|
-
return e3(n6, s4, { get() {
|
|
391
|
-
let t5 = e8.call(this);
|
|
392
|
-
return void 0 === t5 && (t5 = o6(this), (null !== t5 || this.hasUpdated) && r8.call(this, t5)), t5;
|
|
393
|
-
} });
|
|
394
|
-
}
|
|
395
|
-
return e3(n6, s4, { get() {
|
|
396
|
-
return o6(this);
|
|
397
|
-
} });
|
|
435
|
+
function containerLoaderStyles(dashboardComponent) {
|
|
436
|
+
const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
437
|
+
const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
|
|
438
|
+
const display = dashboardComponent.iframeLoaded ? "none" : "";
|
|
439
|
+
return {
|
|
440
|
+
display,
|
|
441
|
+
height: `${chartHeightDefined ? height : dashboardComponent.minHeight}px`
|
|
398
442
|
};
|
|
399
443
|
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
444
|
+
function loaderStyles(dashboardComponent) {
|
|
445
|
+
const background = dashboardComponent.params.loaderBackground || DEFAULT_PARAMETERS.loaderBackground;
|
|
446
|
+
if (dashboardComponent.params.itemEmbedding) {
|
|
447
|
+
dashboardComponent.loaderSize = 24;
|
|
448
|
+
dashboardComponent.borderWidth = 4;
|
|
449
|
+
dashboardComponent.minHeight = 200;
|
|
450
|
+
const width = dashboardComponent.params.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
|
|
451
|
+
const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
452
|
+
const chartWidthDefined = width !== "auto";
|
|
453
|
+
const chartHeightDefined = height !== "auto";
|
|
454
|
+
return {
|
|
455
|
+
background,
|
|
456
|
+
width: chartWidthDefined ? `${width}px` : "100%",
|
|
457
|
+
height: `${chartHeightDefined ? height : "200"}px`,
|
|
458
|
+
"min-height": chartHeightDefined ? "" : "200px"
|
|
459
|
+
};
|
|
406
460
|
}
|
|
407
|
-
|
|
408
|
-
|
|
461
|
+
return {
|
|
462
|
+
background
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
function plStyles(dashboardComponent) {
|
|
466
|
+
const {
|
|
467
|
+
loaderSpinnerColor: defaultSpinnerColor,
|
|
468
|
+
loaderSpinnerBackground: defaultSpinnerBackground
|
|
469
|
+
} = DEFAULT_PARAMETERS;
|
|
470
|
+
const spinnerColorBorder = generateBorderStyle(
|
|
471
|
+
dashboardComponent.borderWidth,
|
|
472
|
+
dashboardComponent.params.loaderSpinnerColor || defaultSpinnerColor
|
|
473
|
+
);
|
|
474
|
+
const spinnerBackgroundBorder = generateBorderStyle(
|
|
475
|
+
dashboardComponent.borderWidth,
|
|
476
|
+
dashboardComponent.params.loaderSpinnerBackground || defaultSpinnerBackground
|
|
477
|
+
);
|
|
478
|
+
const size = `${dashboardComponent.loaderSize}px`;
|
|
479
|
+
return {
|
|
480
|
+
"border-top": spinnerColorBorder,
|
|
481
|
+
"border-right": spinnerColorBorder,
|
|
482
|
+
"border-bottom": spinnerBackgroundBorder,
|
|
483
|
+
"border-left": spinnerBackgroundBorder,
|
|
484
|
+
width: size,
|
|
485
|
+
height: size
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
function lcStyles(dashboardComponent) {
|
|
489
|
+
const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
490
|
+
const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
|
|
491
|
+
const getPaddingStr = (value) => `${(value - dashboardComponent.loaderSize - 32) / 2}px`;
|
|
492
|
+
const verticalPadding = dashboardComponent.params.itemId ? chartHeightDefined ? getPaddingStr(Number.parseInt(`${height}`, 10)) : getPaddingStr(dashboardComponent.minHeight) : "128px";
|
|
493
|
+
return {
|
|
494
|
+
padding: `${verticalPadding} 16px`
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
function calculateIframeStyles(dashboardComponent) {
|
|
498
|
+
const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
499
|
+
const width = dashboardComponent.params.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
|
|
500
|
+
if (dashboardComponent.params.itemEmbedding && height !== "auto") {
|
|
501
|
+
dashboardComponent.iframeHeight = `${height}px`;
|
|
502
|
+
} else if (dashboardComponent.params.itemEmbedding) {
|
|
503
|
+
dashboardComponent.iframeHeight = "200px";
|
|
504
|
+
} else if (["editFull", "editLimited"].includes(dashboardComponent.params.editMode)) {
|
|
505
|
+
dashboardComponent.iframeHeight = "100%";
|
|
506
|
+
} else {
|
|
507
|
+
dashboardComponent.iframeHeight = "400px";
|
|
409
508
|
}
|
|
410
|
-
|
|
411
|
-
|
|
509
|
+
dashboardComponent.iframeWidth = dashboardComponent.params.itemEmbedding && width !== "auto" ? `${width}px` : "100%";
|
|
510
|
+
const styles = {
|
|
511
|
+
height: dashboardComponent.iframeHeight,
|
|
512
|
+
width: dashboardComponent.iframeWidth
|
|
513
|
+
};
|
|
514
|
+
if (dashboardComponent.iframeLoaded) {
|
|
515
|
+
styles.opacity = 1;
|
|
516
|
+
} else if (dashboardComponent.error) {
|
|
517
|
+
styles.opacity = 1;
|
|
518
|
+
styles.width = "100%";
|
|
519
|
+
styles.height = "400px";
|
|
520
|
+
} else {
|
|
521
|
+
styles.opacity = 0;
|
|
412
522
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
523
|
+
return styles;
|
|
524
|
+
}
|
|
525
|
+
function generateBorderStyle(borderWidth, color) {
|
|
526
|
+
return `${borderWidth}px solid ${color}`;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/update-iframe-url.ts
|
|
530
|
+
var updateIframeUrl = (iframe, iframeUrl) => {
|
|
531
|
+
if (iframe?.contentWindow) {
|
|
532
|
+
iframe.contentWindow.location.replace(iframeUrl);
|
|
417
533
|
}
|
|
418
534
|
};
|
|
419
535
|
|
|
420
|
-
// libs/embed-libs/shared-embed/src/lib/helpers/
|
|
421
|
-
var
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
postMessage: !!window.postMessage
|
|
430
|
-
};
|
|
431
|
-
const browserCheckKeys = ["svg", "flexbox", "postMessage"];
|
|
432
|
-
for (const key of browserCheckKeys) {
|
|
433
|
-
if (!browserCheck[key]) {
|
|
434
|
-
hasError = true;
|
|
435
|
-
dashboardComponent.browserNotSupported = dashboardComponent.browserNotSupported || [];
|
|
436
|
-
dashboardComponent.browserNotSupported.push(key);
|
|
437
|
-
errorMessage += `Your browser does not support: ${key}
|
|
438
|
-
`;
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
const ua = window.navigator.userAgent;
|
|
442
|
-
const msie = ua.includes("MSIE");
|
|
443
|
-
const trident = ua.includes("Trident/");
|
|
444
|
-
if (msie || trident) {
|
|
445
|
-
hasError = true;
|
|
446
|
-
errorMessage = "IE is not supported.";
|
|
447
|
-
}
|
|
448
|
-
if (hasError) {
|
|
449
|
-
_handleError(errorMessage);
|
|
450
|
-
}
|
|
451
|
-
};
|
|
452
|
-
|
|
453
|
-
// libs/embed-libs/shared-embed/src/lib/helpers/default-parameters.ts
|
|
454
|
-
var DEFAULT_PARAMETERS = {
|
|
455
|
-
appServer: "https://app.luzmo.com/",
|
|
456
|
-
apiHost: "https://api.luzmo.com/",
|
|
457
|
-
dashboardId: null,
|
|
458
|
-
dashboardSlug: null,
|
|
459
|
-
container: null,
|
|
460
|
-
key: null,
|
|
461
|
-
token: null,
|
|
462
|
-
language: "auto",
|
|
463
|
-
qeVersion: null,
|
|
464
|
-
editMode: null,
|
|
465
|
-
screenMode: null,
|
|
466
|
-
switchScreenModeOnResize: true,
|
|
467
|
-
itemId: null,
|
|
468
|
-
mainColor: "",
|
|
469
|
-
accentColor: "",
|
|
470
|
-
itemDimensions: {
|
|
471
|
-
width: "auto",
|
|
472
|
-
height: "auto"
|
|
536
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/set-filter-utils.ts
|
|
537
|
+
var filterUtils = {
|
|
538
|
+
merge(...filters) {
|
|
539
|
+
return filters.reduce((acc, filter) => {
|
|
540
|
+
acc.and.push(...filter.and);
|
|
541
|
+
return acc;
|
|
542
|
+
}, {
|
|
543
|
+
and: []
|
|
544
|
+
});
|
|
473
545
|
},
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
{ mode: "largeScreen", width: [1600, 9999] },
|
|
488
|
-
{ mode: "fixed", width: [] }
|
|
489
|
-
];
|
|
490
|
-
|
|
491
|
-
// libs/embed-libs/shared-embed/src/lib/helpers/translations.ts
|
|
492
|
-
var TRANSLATIONS = {
|
|
493
|
-
initializing: { en: "Initializing...", nl: "Laden...", fr: "Chargement..." },
|
|
494
|
-
errorDashboard: {
|
|
495
|
-
en: "Oops, we could not load this dashboard!",
|
|
496
|
-
nl: "Oeps, we konden het dashboard niet laden.",
|
|
497
|
-
fr: "Le chargement a echou\xE9."
|
|
546
|
+
isIn(slot, values, otherOptions) {
|
|
547
|
+
return {
|
|
548
|
+
and: [{
|
|
549
|
+
expression: "? in ?",
|
|
550
|
+
parameters: [
|
|
551
|
+
{
|
|
552
|
+
slot,
|
|
553
|
+
...otherOptions
|
|
554
|
+
},
|
|
555
|
+
values
|
|
556
|
+
]
|
|
557
|
+
}]
|
|
558
|
+
};
|
|
498
559
|
},
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
560
|
+
between(slot, values, otherOptions) {
|
|
561
|
+
return {
|
|
562
|
+
and: [{
|
|
563
|
+
expression: "? between ?",
|
|
564
|
+
parameters: [
|
|
565
|
+
{
|
|
566
|
+
slot,
|
|
567
|
+
...otherOptions
|
|
568
|
+
},
|
|
569
|
+
[values[0], values[1]]
|
|
570
|
+
]
|
|
571
|
+
}]
|
|
572
|
+
};
|
|
573
|
+
},
|
|
574
|
+
range(slot, values, otherOptions) {
|
|
575
|
+
const expressions = otherOptions?.expressions ?? ["? >= ?", "? < ?"];
|
|
576
|
+
return {
|
|
577
|
+
and: [{
|
|
578
|
+
expression: expressions[0],
|
|
579
|
+
parameters: [
|
|
580
|
+
{
|
|
581
|
+
slot,
|
|
582
|
+
...otherOptions
|
|
583
|
+
},
|
|
584
|
+
[values[0]]
|
|
585
|
+
]
|
|
586
|
+
}, {
|
|
587
|
+
expression: expressions[1],
|
|
588
|
+
parameters: [
|
|
589
|
+
{
|
|
590
|
+
slot,
|
|
591
|
+
...otherOptions
|
|
592
|
+
},
|
|
593
|
+
[values[1]]
|
|
594
|
+
]
|
|
595
|
+
}]
|
|
596
|
+
};
|
|
503
597
|
}
|
|
504
598
|
};
|
|
505
|
-
var translations_default = TRANSLATIONS;
|
|
506
599
|
|
|
507
|
-
// libs/embed-libs/shared-embed/src/lib/
|
|
508
|
-
var
|
|
509
|
-
|
|
510
|
-
|
|
600
|
+
// libs/embed-libs/shared-embed/src/lib/methods/export-dashboard.ts
|
|
601
|
+
var exportDashboard = (dashboardComponent, iframe, format) => {
|
|
602
|
+
const requestId = uuidv4();
|
|
603
|
+
if (iframe?.contentWindow) {
|
|
604
|
+
iframe.contentWindow.postMessage(
|
|
605
|
+
{
|
|
606
|
+
action: "exportDashboard",
|
|
607
|
+
format: format || "png",
|
|
608
|
+
_version: dashboardComponent.libVersion,
|
|
609
|
+
requestId
|
|
610
|
+
},
|
|
611
|
+
"*"
|
|
612
|
+
);
|
|
613
|
+
return new Promise((resolve, reject) => {
|
|
614
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
615
|
+
setTimeout(() => {
|
|
616
|
+
if (dashboardComponent.promises[requestId]) {
|
|
617
|
+
const errorMessage = "exportDashboard request timed out.";
|
|
618
|
+
dashboardComponent.promises[requestId].reject(
|
|
619
|
+
new Error(errorMessage)
|
|
620
|
+
);
|
|
621
|
+
delete dashboardComponent.promises[requestId];
|
|
622
|
+
}
|
|
623
|
+
}, 12e5);
|
|
624
|
+
});
|
|
511
625
|
}
|
|
512
|
-
return
|
|
626
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
513
627
|
};
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
628
|
+
|
|
629
|
+
// libs/embed-libs/shared-embed/src/lib/methods/get-accessible-dashboards.ts
|
|
630
|
+
var getAccessibleDashboards = (dashboardComponent) => {
|
|
631
|
+
if ((dashboardComponent.currentAuthKey ?? dashboardComponent.authKey) && (dashboardComponent.currentAuthToken ?? dashboardComponent.authToken)) {
|
|
632
|
+
const fetchUser = new Promise((resolve, reject) => {
|
|
633
|
+
void (() => {
|
|
634
|
+
try {
|
|
635
|
+
const responsePromise = window.fetch(
|
|
636
|
+
// With experimental=true URLs remove the trailing slash, since the web component expects them to not have it.
|
|
637
|
+
// Fixes incorrect url with experimental=true
|
|
638
|
+
`${addTrailingSlash(dashboardComponent.params.apiHost)}0.1.0/authorization`,
|
|
639
|
+
{
|
|
640
|
+
method: "POST",
|
|
641
|
+
mode: "cors",
|
|
642
|
+
cache: "no-cache",
|
|
643
|
+
headers: { "Content-Type": "application/json" },
|
|
644
|
+
redirect: "follow",
|
|
645
|
+
body: JSON.stringify({
|
|
646
|
+
action: "get",
|
|
647
|
+
version: "0.1.0",
|
|
648
|
+
key: dashboardComponent.currentAuthKey ?? dashboardComponent.authKey,
|
|
649
|
+
token: dashboardComponent.currentAuthToken ?? dashboardComponent.authToken,
|
|
650
|
+
find: {
|
|
651
|
+
where: { id: dashboardComponent.authKey },
|
|
652
|
+
attributes: ["id", "integration_id"],
|
|
653
|
+
include: [
|
|
654
|
+
{
|
|
655
|
+
model: "User",
|
|
656
|
+
attributes: ["id", "name", "locale_id"],
|
|
657
|
+
include: [{ model: "Group" }]
|
|
658
|
+
}
|
|
659
|
+
]
|
|
660
|
+
}
|
|
661
|
+
})
|
|
662
|
+
}
|
|
663
|
+
);
|
|
664
|
+
responsePromise.then((response) => response.json()).then((data) => {
|
|
665
|
+
if (!data || !data.rows || data.rows.length === 0 || !data.rows[0].user) {
|
|
666
|
+
reject("Authorization failed, please check authKey and authToken. If the problem persists, please contact support@luzmo.com.");
|
|
667
|
+
} else {
|
|
668
|
+
data.rows[0].user.userGroups = data.rows[0].user.groups.map(
|
|
669
|
+
(group) => group.id
|
|
670
|
+
);
|
|
671
|
+
delete data.rows[0].user.groups;
|
|
672
|
+
resolve({
|
|
673
|
+
integrationId: data.rows[0].integration_id,
|
|
674
|
+
user: data.rows[0].user
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
});
|
|
678
|
+
} catch (error) {
|
|
679
|
+
reject(error);
|
|
680
|
+
}
|
|
681
|
+
})();
|
|
682
|
+
});
|
|
683
|
+
return new Promise((resolve, reject) => void (() => {
|
|
684
|
+
try {
|
|
685
|
+
fetchUser.then((authorizationData) => {
|
|
686
|
+
const responsePromise = window.fetch(
|
|
687
|
+
// With experimental=true URLs remove the trailing slash, since the web component expects them to not have it.
|
|
688
|
+
// Fixes incorrect url with experimental=true
|
|
689
|
+
`${addTrailingSlash(dashboardComponent.params.apiHost)}0.1.0/securable`,
|
|
690
|
+
{
|
|
691
|
+
method: "POST",
|
|
692
|
+
mode: "cors",
|
|
693
|
+
cache: "no-cache",
|
|
694
|
+
headers: { "Content-Type": "application/json" },
|
|
695
|
+
redirect: "follow",
|
|
696
|
+
body: JSON.stringify({
|
|
697
|
+
action: "get",
|
|
698
|
+
version: "0.1.0",
|
|
699
|
+
key: dashboardComponent.currentAuthKey ?? dashboardComponent.authKey,
|
|
700
|
+
token: dashboardComponent.currentAuthToken ?? dashboardComponent.authToken,
|
|
701
|
+
find: {
|
|
702
|
+
where: { type: "dashboard", is_variant: false },
|
|
703
|
+
attributes: ["id", "name", "modified_at"],
|
|
704
|
+
order: [["modified_at", "desc"]],
|
|
705
|
+
include: [
|
|
706
|
+
{ model: "Tag", attributes: ["tag"] },
|
|
707
|
+
{ model: "User", attributes: ["id", "name"] },
|
|
708
|
+
{
|
|
709
|
+
model: "Group",
|
|
710
|
+
attributes: ["id", "name", "public"]
|
|
711
|
+
},
|
|
712
|
+
{ model: "Integration", attributes: ["id", "name"] }
|
|
713
|
+
]
|
|
714
|
+
}
|
|
715
|
+
})
|
|
716
|
+
}
|
|
717
|
+
);
|
|
718
|
+
responsePromise.then((response) => response.json()).then((data) => {
|
|
719
|
+
const dashboardList = data.rows.length > 0 ? formatDashboardList(
|
|
720
|
+
data.rows,
|
|
721
|
+
authorizationData.integrationId,
|
|
722
|
+
authorizationData.user,
|
|
723
|
+
dashboardComponent
|
|
724
|
+
) : [];
|
|
725
|
+
resolve(dashboardList);
|
|
726
|
+
});
|
|
727
|
+
}).catch((error) => {
|
|
728
|
+
reject(error);
|
|
729
|
+
});
|
|
730
|
+
} catch (error) {
|
|
731
|
+
reject(error);
|
|
732
|
+
}
|
|
733
|
+
})());
|
|
517
734
|
}
|
|
518
|
-
|
|
735
|
+
throw new Error("No authKey or authToken found in the luzmo-dashboard component.");
|
|
519
736
|
};
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
};
|
|
534
|
-
const groups = securable.groups.filter(
|
|
535
|
-
(group) => user2.userGroups.includes(group.id) || group.public === true
|
|
737
|
+
|
|
738
|
+
// libs/embed-libs/shared-embed/src/lib/methods/get-data.ts
|
|
739
|
+
var getData = (dashboardComponent, iframe, itemId) => {
|
|
740
|
+
if (iframe?.contentWindow) {
|
|
741
|
+
const requestId = uuidv4();
|
|
742
|
+
iframe.contentWindow.postMessage(
|
|
743
|
+
{
|
|
744
|
+
action: "getData",
|
|
745
|
+
id: itemId,
|
|
746
|
+
_version: dashboardComponent.libVersion,
|
|
747
|
+
requestId
|
|
748
|
+
},
|
|
749
|
+
"*"
|
|
536
750
|
);
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
751
|
+
return new Promise((resolve, reject) => {
|
|
752
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
753
|
+
setTimeout(() => {
|
|
754
|
+
if (dashboardComponent.promises[requestId]) {
|
|
755
|
+
const errorMessage = "getData request timed out.";
|
|
756
|
+
dashboardComponent.promises[requestId].reject(
|
|
757
|
+
new Error(errorMessage)
|
|
758
|
+
);
|
|
759
|
+
delete dashboardComponent.promises[requestId];
|
|
760
|
+
}
|
|
761
|
+
}, 2e3);
|
|
541
762
|
});
|
|
542
|
-
for (const groupAccess of groupsAccess) {
|
|
543
|
-
if (!securableAccessRights.flagRead && groupAccess.flagRead) {
|
|
544
|
-
securableAccessRights.flagRead = groupAccess.flagRead;
|
|
545
|
-
}
|
|
546
|
-
if (!securableAccessRights.flagUse && groupAccess.flagUse) {
|
|
547
|
-
securableAccessRights.flagUse = groupAccess.flagUse;
|
|
548
|
-
}
|
|
549
|
-
if (!securableAccessRights.flagModify && groupAccess.flagModify) {
|
|
550
|
-
securableAccessRights.flagModify = groupAccess.flagModify;
|
|
551
|
-
}
|
|
552
|
-
if (!securableAccessRights.flagOwn && groupAccess.flagOwn) {
|
|
553
|
-
securableAccessRights.flagOwn = groupAccess.flagOwn;
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
const integrationsAccess = securable.integrations?.length > 0 ? securable.integrations.map((integration) => {
|
|
557
|
-
if (integration.integrationAccessRight) {
|
|
558
|
-
return integration.integrationAccessRight;
|
|
559
|
-
}
|
|
560
|
-
}) : [];
|
|
561
|
-
for (const integrationAccess of integrationsAccess) {
|
|
562
|
-
if (!securableAccessRights.flagRead && integrationAccess.flagRead) {
|
|
563
|
-
securableAccessRights.flagRead = integrationAccess.flagRead;
|
|
564
|
-
}
|
|
565
|
-
if (!securableAccessRights.flagUse && integrationAccess.flagUse) {
|
|
566
|
-
securableAccessRights.flagUse = integrationAccess.flagUse;
|
|
567
|
-
}
|
|
568
|
-
if (!securableAccessRights.flagModify && integrationAccess.flagModify) {
|
|
569
|
-
securableAccessRights.flagModify = integrationAccess.flagModify;
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
return securableAccessRights;
|
|
573
|
-
};
|
|
574
|
-
const localize = (item, locale) => {
|
|
575
|
-
if (item === null || item === void 0) {
|
|
576
|
-
return "";
|
|
577
|
-
}
|
|
578
|
-
if (typeof item !== "object" || Object.keys(item).length === 0) {
|
|
579
|
-
if (typeof item === "object" && Object.keys(item).length === 0) {
|
|
580
|
-
return "";
|
|
581
|
-
}
|
|
582
|
-
return item;
|
|
583
|
-
}
|
|
584
|
-
let localizedItem;
|
|
585
|
-
localizedItem = locale && item[locale] ? item[locale] : item[Object.keys(item)[0]];
|
|
586
|
-
if (localizedItem === void 0 || localizedItem === null) {
|
|
587
|
-
localizedItem = "";
|
|
588
|
-
}
|
|
589
|
-
return localizedItem;
|
|
590
|
-
};
|
|
591
|
-
const treatedDashboards = [];
|
|
592
|
-
for (const dashboard of dashboards) {
|
|
593
|
-
const treatedDashboard = {
|
|
594
|
-
accessibleBy: [],
|
|
595
|
-
accessRights: combineRights(dashboard, user),
|
|
596
|
-
id: dashboard.id,
|
|
597
|
-
modifiedAt: dashboard.modified_at,
|
|
598
|
-
name: localize(dashboard.name, dashboardComponent.language),
|
|
599
|
-
slug: null,
|
|
600
|
-
tags: dashboard.tags.map((t5) => t5.tag).sort((t1, t22) => t1.localeCompare(t22))
|
|
601
|
-
};
|
|
602
|
-
const currentIntegration = dashboard.integrations.find(
|
|
603
|
-
(i6) => i6.id === integrationId
|
|
604
|
-
);
|
|
605
|
-
if (currentIntegration?.integrationAccessRight?.slug) {
|
|
606
|
-
treatedDashboard.slug = currentIntegration.integrationAccessRight.slug;
|
|
607
|
-
}
|
|
608
|
-
const users = dashboard.users.map((u3) => ({
|
|
609
|
-
model: "User",
|
|
610
|
-
id: u3.id,
|
|
611
|
-
name: localize(u3.name, user.locale_id)
|
|
612
|
-
}));
|
|
613
|
-
const groups = dashboard.groups.map((g2) => ({
|
|
614
|
-
model: "Group",
|
|
615
|
-
id: g2.id,
|
|
616
|
-
name: localize(g2.name, user.locale_id) || {}
|
|
617
|
-
}));
|
|
618
|
-
const integrations = dashboard.integrations.map((i6) => ({
|
|
619
|
-
model: "Integration",
|
|
620
|
-
id: i6.id,
|
|
621
|
-
name: localize(i6.name, user.locale_id) || {}
|
|
622
|
-
}));
|
|
623
|
-
treatedDashboard.accessibleBy = [...users, ...groups, ...integrations];
|
|
624
|
-
treatedDashboards.push(treatedDashboard);
|
|
625
763
|
}
|
|
626
|
-
return
|
|
764
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
627
765
|
};
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
766
|
+
|
|
767
|
+
// libs/embed-libs/shared-embed/src/lib/methods/get-filters.ts
|
|
768
|
+
var getFilters = (dashboardComponent, iframe) => {
|
|
769
|
+
if (iframe?.contentWindow) {
|
|
770
|
+
const requestId = uuidv4();
|
|
771
|
+
iframe.contentWindow.postMessage(
|
|
772
|
+
{ action: "getFilters", _version: dashboardComponent.libVersion, requestId },
|
|
773
|
+
"*"
|
|
774
|
+
);
|
|
775
|
+
return new Promise((resolve, reject) => {
|
|
776
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
777
|
+
setTimeout(() => {
|
|
778
|
+
if (dashboardComponent.promises[requestId]) {
|
|
779
|
+
const errorMessage = "getFilters request timed out.";
|
|
780
|
+
dashboardComponent.promises[requestId].reject(
|
|
781
|
+
new Error(errorMessage)
|
|
782
|
+
);
|
|
783
|
+
delete dashboardComponent.promises[requestId];
|
|
784
|
+
}
|
|
785
|
+
}, 2e3);
|
|
786
|
+
});
|
|
637
787
|
}
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
788
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
789
|
+
};
|
|
790
|
+
|
|
791
|
+
// libs/embed-libs/shared-embed/src/lib/methods/refresh-data.ts
|
|
792
|
+
var refreshData = (dashboardComponent, iframe, itemId) => {
|
|
793
|
+
if (iframe) {
|
|
794
|
+
iframe.contentWindow.postMessage(
|
|
795
|
+
{
|
|
796
|
+
action: "refreshData",
|
|
797
|
+
id: itemId ?? null,
|
|
798
|
+
_version: dashboardComponent.libVersion
|
|
799
|
+
},
|
|
800
|
+
"*"
|
|
801
|
+
);
|
|
802
|
+
return Promise.resolve();
|
|
641
803
|
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
804
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
805
|
+
};
|
|
806
|
+
|
|
807
|
+
// libs/embed-libs/shared-embed/src/lib/methods/reload-dashboard.ts
|
|
808
|
+
var reloadDashboard = (dashboardComponent, iframe) => {
|
|
809
|
+
if (iframe) {
|
|
810
|
+
iframe.contentWindow.postMessage(
|
|
811
|
+
{ action: "reloadDashboard", _version: dashboardComponent.libVersion },
|
|
812
|
+
"*"
|
|
813
|
+
);
|
|
814
|
+
return Promise.resolve();
|
|
645
815
|
}
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
816
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
817
|
+
};
|
|
818
|
+
|
|
819
|
+
// libs/embed-libs/shared-embed/src/lib/methods/set-authorization.ts
|
|
820
|
+
var setAuthorization = (dashboardComponent, iframe, key, token) => {
|
|
821
|
+
if (iframe) {
|
|
822
|
+
iframe.contentWindow.postMessage(
|
|
823
|
+
{
|
|
824
|
+
action: "setAuthorization",
|
|
825
|
+
key,
|
|
826
|
+
token,
|
|
827
|
+
_version: dashboardComponent.libVersion
|
|
828
|
+
},
|
|
829
|
+
"*"
|
|
830
|
+
);
|
|
831
|
+
return Promise.resolve();
|
|
649
832
|
}
|
|
650
|
-
return
|
|
833
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
651
834
|
};
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
var
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
835
|
+
|
|
836
|
+
// libs/embed-libs/shared-embed/src/lib/methods/set-edit-mode.ts
|
|
837
|
+
var setEditMode = (dashboardComponent, iframe, editMode) => {
|
|
838
|
+
if (iframe && iframe.contentWindow) {
|
|
839
|
+
const requestId = uuidv4();
|
|
840
|
+
if (dashboardComponent.params.editMode === editMode) {
|
|
841
|
+
return Promise.reject(
|
|
842
|
+
new Error("editMode parameter is currently already set to " + editMode)
|
|
843
|
+
);
|
|
844
|
+
} else if (editMode !== "editFull" && editMode !== "editLimited" && editMode !== "view") {
|
|
845
|
+
return Promise.reject(
|
|
846
|
+
new Error(
|
|
847
|
+
"The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'."
|
|
848
|
+
)
|
|
849
|
+
);
|
|
667
850
|
}
|
|
668
|
-
|
|
669
|
-
|
|
851
|
+
iframe.contentWindow.postMessage(
|
|
852
|
+
{
|
|
853
|
+
action: "setEditMode",
|
|
854
|
+
editMode,
|
|
855
|
+
_version: dashboardComponent.libVersion,
|
|
856
|
+
requestId
|
|
857
|
+
},
|
|
858
|
+
"*"
|
|
859
|
+
);
|
|
860
|
+
return new Promise((resolve, reject) => {
|
|
861
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
670
865
|
};
|
|
671
|
-
var uuidv4 = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g, function(c4) {
|
|
672
|
-
const r7 = Math.random() * 16 | 0;
|
|
673
|
-
const v2 = c4 == "x" ? r7 : r7 & 3 | 8;
|
|
674
|
-
return v2.toString(16);
|
|
675
|
-
});
|
|
676
866
|
|
|
677
|
-
// libs/embed-libs/shared-embed/src/lib/
|
|
678
|
-
var
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
}
|
|
704
|
-
if (qeVersion) {
|
|
705
|
-
searchString.push(`qe_version=${qeVersion}`);
|
|
706
|
-
}
|
|
707
|
-
if (loaderBackground) {
|
|
708
|
-
searchString.push(`ldrbg=${loaderBackground}`);
|
|
709
|
-
}
|
|
710
|
-
if (loaderFontColor) {
|
|
711
|
-
searchString.push(`ldrftclr=${loaderFontColor}`);
|
|
712
|
-
}
|
|
713
|
-
if (loaderSpinnerColor) {
|
|
714
|
-
searchString.push(`ldrspclr=${loaderSpinnerColor}`);
|
|
715
|
-
}
|
|
716
|
-
if (loaderSpinnerBackground) {
|
|
717
|
-
searchString.push(`ldrspbg=${loaderSpinnerBackground}`);
|
|
718
|
-
}
|
|
719
|
-
if (mainColor) {
|
|
720
|
-
searchString.push(`mainColor=${mainColor}`);
|
|
721
|
-
}
|
|
722
|
-
if (accentColor) {
|
|
723
|
-
searchString.push(`accentColor=${accentColor}`);
|
|
724
|
-
}
|
|
725
|
-
if (screenMode && screenMode !== "auto") {
|
|
726
|
-
searchString.push("screenMode=" + screenMode);
|
|
727
|
-
}
|
|
728
|
-
if (timezoneId) {
|
|
729
|
-
searchString.push("timezoneId=" + timezoneId);
|
|
730
|
-
}
|
|
731
|
-
if (itemEmbedding && itemDimensions && itemDimensions.width) {
|
|
732
|
-
searchString.push("width=" + itemDimensions.width);
|
|
733
|
-
}
|
|
734
|
-
if (itemEmbedding && itemDimensions && itemDimensions.height) {
|
|
735
|
-
searchString.push("height=" + itemDimensions.height);
|
|
736
|
-
}
|
|
737
|
-
if (editMode) {
|
|
738
|
-
searchString.push("editMode=" + editMode);
|
|
739
|
-
}
|
|
740
|
-
const keyTokenUrlAnchor = key && token ? "#" + key + ":" + token : "";
|
|
741
|
-
searchString.push("version=" + (dashboardContent.libVersion || VERSION));
|
|
742
|
-
const iframeUrl = itemEmbedding ? `${appServer}i/${dashboardId || dashboardSlug}/${itemId}?${encodeURIComponent(
|
|
743
|
-
searchString.join("&")
|
|
744
|
-
)}${keyTokenUrlAnchor}` : `${appServer}i/${dashboardId || dashboardSlug}?${encodeURIComponent(
|
|
745
|
-
searchString.join("&")
|
|
746
|
-
)}${keyTokenUrlAnchor}`;
|
|
747
|
-
return sanitizeUrl(iframeUrl);
|
|
748
|
-
};
|
|
749
|
-
|
|
750
|
-
// libs/embed-libs/shared-embed/src/lib/helpers/get-loader.ts
|
|
751
|
-
var getLoader = (dashboardComponent) => {
|
|
752
|
-
let errorMsg;
|
|
753
|
-
if (dashboardComponent.params.error || dashboardComponent.browserNotSupported.length > 0) {
|
|
754
|
-
dashboardComponent.params.error = true;
|
|
755
|
-
if (dashboardComponent.browserNotSupported) {
|
|
756
|
-
errorMsg = "Browser is not supported.";
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
const loadingMsg = translations_default.initializing[dashboardComponent.params.language] || translations_default.initializing.en;
|
|
760
|
-
return dashboardComponent.browserNotSupported || dashboardComponent.params.error ? { loadingMsg, errorMsg } : { loadingMsg, errorMsg: "" };
|
|
761
|
-
};
|
|
762
|
-
|
|
763
|
-
// libs/embed-libs/shared-embed/src/lib/helpers/promise-dispatch.ts
|
|
764
|
-
function resolvePromise(dashboardComponent, requestId, data) {
|
|
765
|
-
if (dashboardComponent.promises[requestId]) {
|
|
766
|
-
dashboardComponent.promises[requestId].resolve(data);
|
|
767
|
-
delete dashboardComponent.promises[requestId];
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
function rejectPromise(dashboardComponent, requestId, data) {
|
|
771
|
-
if (dashboardComponent.promises[requestId]) {
|
|
772
|
-
dashboardComponent.promises[requestId].reject(data);
|
|
773
|
-
delete dashboardComponent.promises[requestId];
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
// libs/embed-libs/shared-embed/src/lib/helpers/styles.ts
|
|
778
|
-
function containerStyles(dashboardComponent) {
|
|
779
|
-
const styles = {};
|
|
780
|
-
if (dashboardComponent.params.loaderBackground && !dashboardComponent.iframeLoaded) {
|
|
781
|
-
styles.background = dashboardComponent.params.loaderBackground;
|
|
782
|
-
}
|
|
783
|
-
return styles;
|
|
784
|
-
}
|
|
785
|
-
function containerLoaderStyles(dashboardComponent) {
|
|
786
|
-
const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
787
|
-
const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
|
|
788
|
-
const display = dashboardComponent.iframeLoaded ? "none" : "";
|
|
789
|
-
return {
|
|
790
|
-
display,
|
|
791
|
-
height: `${chartHeightDefined ? height : dashboardComponent.minHeight}px`
|
|
792
|
-
};
|
|
793
|
-
}
|
|
794
|
-
function loaderStyles(dashboardComponent) {
|
|
795
|
-
const background = dashboardComponent.params.loaderBackground || DEFAULT_PARAMETERS.loaderBackground;
|
|
796
|
-
if (dashboardComponent.params.itemEmbedding) {
|
|
797
|
-
dashboardComponent.loaderSize = 24;
|
|
798
|
-
dashboardComponent.borderWidth = 4;
|
|
799
|
-
dashboardComponent.minHeight = 200;
|
|
800
|
-
const width = dashboardComponent.params.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
|
|
801
|
-
const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
802
|
-
const chartWidthDefined = width !== "auto";
|
|
803
|
-
const chartHeightDefined = height !== "auto";
|
|
804
|
-
return {
|
|
805
|
-
background,
|
|
806
|
-
width: chartWidthDefined ? `${width}px` : "100%",
|
|
807
|
-
height: `${chartHeightDefined ? height : "200"}px`,
|
|
808
|
-
"min-height": chartHeightDefined ? "" : "200px"
|
|
809
|
-
};
|
|
810
|
-
}
|
|
811
|
-
return {
|
|
812
|
-
background
|
|
813
|
-
};
|
|
814
|
-
}
|
|
815
|
-
function plStyles(dashboardComponent) {
|
|
816
|
-
const {
|
|
817
|
-
loaderSpinnerColor: defaultSpinnerColor,
|
|
818
|
-
loaderSpinnerBackground: defaultSpinnerBackground
|
|
819
|
-
} = DEFAULT_PARAMETERS;
|
|
820
|
-
const spinnerColorBorder = generateBorderStyle(
|
|
821
|
-
dashboardComponent.borderWidth,
|
|
822
|
-
dashboardComponent.params.loaderSpinnerColor || defaultSpinnerColor
|
|
823
|
-
);
|
|
824
|
-
const spinnerBackgroundBorder = generateBorderStyle(
|
|
825
|
-
dashboardComponent.borderWidth,
|
|
826
|
-
dashboardComponent.params.loaderSpinnerBackground || defaultSpinnerBackground
|
|
827
|
-
);
|
|
828
|
-
const size = `${dashboardComponent.loaderSize}px`;
|
|
829
|
-
return {
|
|
830
|
-
"border-top": spinnerColorBorder,
|
|
831
|
-
"border-right": spinnerColorBorder,
|
|
832
|
-
"border-bottom": spinnerBackgroundBorder,
|
|
833
|
-
"border-left": spinnerBackgroundBorder,
|
|
834
|
-
width: size,
|
|
835
|
-
height: size
|
|
836
|
-
};
|
|
837
|
-
}
|
|
838
|
-
function lcStyles(dashboardComponent) {
|
|
839
|
-
const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
840
|
-
const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
|
|
841
|
-
const getPaddingStr = (value) => `${(value - dashboardComponent.loaderSize - 32) / 2}px`;
|
|
842
|
-
const verticalPadding = dashboardComponent.params.itemId ? chartHeightDefined ? getPaddingStr(Number.parseInt(`${height}`, 10)) : getPaddingStr(dashboardComponent.minHeight) : "128px";
|
|
843
|
-
return {
|
|
844
|
-
padding: `${verticalPadding} 16px`
|
|
845
|
-
};
|
|
846
|
-
}
|
|
847
|
-
function calculateIframeStyles(dashboardComponent) {
|
|
848
|
-
const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
849
|
-
const width = dashboardComponent.params.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
|
|
850
|
-
if (dashboardComponent.params.itemEmbedding && height !== "auto") {
|
|
851
|
-
dashboardComponent.iframeHeight = `${height}px`;
|
|
852
|
-
} else if (dashboardComponent.params.itemEmbedding) {
|
|
853
|
-
dashboardComponent.iframeHeight = "200px";
|
|
854
|
-
} else if (["editFull", "editLimited"].includes(dashboardComponent.params.editMode)) {
|
|
855
|
-
dashboardComponent.iframeHeight = "100%";
|
|
856
|
-
} else {
|
|
857
|
-
dashboardComponent.iframeHeight = "400px";
|
|
858
|
-
}
|
|
859
|
-
dashboardComponent.iframeWidth = dashboardComponent.params.itemEmbedding && width !== "auto" ? `${width}px` : "100%";
|
|
860
|
-
const styles = {
|
|
861
|
-
height: dashboardComponent.iframeHeight,
|
|
862
|
-
width: dashboardComponent.iframeWidth
|
|
863
|
-
};
|
|
864
|
-
if (dashboardComponent.iframeLoaded) {
|
|
865
|
-
styles.opacity = 1;
|
|
866
|
-
} else if (dashboardComponent.error) {
|
|
867
|
-
styles.opacity = 1;
|
|
868
|
-
styles.width = "100%";
|
|
869
|
-
styles.height = "400px";
|
|
870
|
-
} else {
|
|
871
|
-
styles.opacity = 0;
|
|
872
|
-
}
|
|
873
|
-
return styles;
|
|
874
|
-
}
|
|
875
|
-
function generateBorderStyle(borderWidth, color) {
|
|
876
|
-
return `${borderWidth}px solid ${color}`;
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
// libs/embed-libs/shared-embed/src/lib/helpers/update-iframe-url.ts
|
|
880
|
-
var updateIframeUrl = (iframe, iframeUrl) => {
|
|
881
|
-
if (iframe?.contentWindow) {
|
|
882
|
-
iframe.contentWindow.location.replace(iframeUrl);
|
|
867
|
+
// libs/embed-libs/shared-embed/src/lib/methods/set-filters.ts
|
|
868
|
+
var setFilters = (dashboardComponent, iframe, itemId, filters) => {
|
|
869
|
+
if (iframe) {
|
|
870
|
+
const requestId = uuidv4();
|
|
871
|
+
iframe.contentWindow.postMessage(
|
|
872
|
+
{
|
|
873
|
+
action: "setFilters",
|
|
874
|
+
itemId,
|
|
875
|
+
filters,
|
|
876
|
+
_version: dashboardComponent.libVersion,
|
|
877
|
+
requestId
|
|
878
|
+
},
|
|
879
|
+
"*"
|
|
880
|
+
);
|
|
881
|
+
return new Promise((resolve, reject) => {
|
|
882
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
883
|
+
setTimeout(() => {
|
|
884
|
+
if (dashboardComponent.promises[requestId]) {
|
|
885
|
+
const errorMessage = "setFilters request timed out.";
|
|
886
|
+
dashboardComponent.promises[requestId].reject(
|
|
887
|
+
new Error(errorMessage)
|
|
888
|
+
);
|
|
889
|
+
delete dashboardComponent.promises[requestId];
|
|
890
|
+
}
|
|
891
|
+
}, 2e3);
|
|
892
|
+
});
|
|
883
893
|
}
|
|
894
|
+
return Promise.reject();
|
|
884
895
|
};
|
|
885
896
|
|
|
886
|
-
// libs/embed-libs/shared-embed/src/lib/methods/
|
|
887
|
-
var
|
|
888
|
-
|
|
889
|
-
|
|
897
|
+
// libs/embed-libs/shared-embed/src/lib/methods/set-preview.ts
|
|
898
|
+
var setPreview = (dashboardComponent, iframe, preview) => {
|
|
899
|
+
if (iframe) {
|
|
900
|
+
const requestId = uuidv4();
|
|
890
901
|
iframe.contentWindow.postMessage(
|
|
891
902
|
{
|
|
892
|
-
action: "
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
903
|
+
action: "setPreview",
|
|
904
|
+
preview,
|
|
905
|
+
requestId,
|
|
906
|
+
_version: dashboardComponent.libVersion
|
|
896
907
|
},
|
|
897
908
|
"*"
|
|
898
909
|
);
|
|
@@ -900,560 +911,263 @@ var exportDashboard = (dashboardComponent, iframe, format) => {
|
|
|
900
911
|
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
901
912
|
setTimeout(() => {
|
|
902
913
|
if (dashboardComponent.promises[requestId]) {
|
|
903
|
-
const errorMessage = "
|
|
914
|
+
const errorMessage = "setPreview request timed out.";
|
|
904
915
|
dashboardComponent.promises[requestId].reject(
|
|
905
916
|
new Error(errorMessage)
|
|
906
917
|
);
|
|
907
918
|
delete dashboardComponent.promises[requestId];
|
|
908
919
|
}
|
|
909
|
-
},
|
|
920
|
+
}, 2e3);
|
|
910
921
|
});
|
|
911
922
|
}
|
|
912
923
|
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
913
924
|
};
|
|
914
925
|
|
|
915
|
-
// libs/embed-libs/shared-embed/src/lib/
|
|
916
|
-
var
|
|
917
|
-
if (
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
);
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
926
|
+
// libs/embed-libs/shared-embed/src/lib/service/calculate-dimensions.ts
|
|
927
|
+
var _setCalculatedDimensions = (dashboardComponent) => {
|
|
928
|
+
if (!dashboardComponent.dimensions) {
|
|
929
|
+
dashboardComponent.params.error = true;
|
|
930
|
+
_handleError("Got no valid dimensions.", dashboardComponent.params);
|
|
931
|
+
return;
|
|
932
|
+
}
|
|
933
|
+
const dashboardDimensionKeys = Object.keys(
|
|
934
|
+
dashboardComponent.dimensions
|
|
935
|
+
);
|
|
936
|
+
const availableScreenModeExtents = [];
|
|
937
|
+
let currentMode;
|
|
938
|
+
let currentWidth = 0;
|
|
939
|
+
let currentHeight = 0;
|
|
940
|
+
if (!dashboardComponent.params.switchScreenModeOnResize && dashboardComponent.currentScreenMode) {
|
|
941
|
+
dashboardComponent.params.screenMode = dashboardComponent.currentScreenMode;
|
|
942
|
+
}
|
|
943
|
+
if (dashboardComponent.dimensions && dashboardDimensionKeys?.[0] === "fixed") {
|
|
944
|
+
currentMode = "fixed";
|
|
945
|
+
currentWidth = dashboardComponent.dimensions.fixed[0];
|
|
946
|
+
currentHeight = dashboardComponent.dimensions.fixed[1];
|
|
947
|
+
} else {
|
|
948
|
+
const screenModes = [
|
|
949
|
+
"mobile",
|
|
950
|
+
"tablet",
|
|
951
|
+
"desktop",
|
|
952
|
+
"largeScreen"
|
|
953
|
+
];
|
|
954
|
+
if (dashboardComponent.params.itemEmbedding) {
|
|
955
|
+
const [firstMatch] = dashboardDimensionKeys;
|
|
956
|
+
let match = cloneDeep(firstMatch);
|
|
957
|
+
for (const screenMode of screenModes) {
|
|
958
|
+
const found = dashboardDimensionKeys.find((key) => key === screenMode);
|
|
959
|
+
if (found) {
|
|
960
|
+
match = cloneDeep(found);
|
|
961
|
+
} else {
|
|
962
|
+
dashboardComponent.dimensions[screenMode] = dashboardComponent.dimensions[match];
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
for (const key of dashboardDimensionKeys) {
|
|
967
|
+
if (screenModes.includes(key)) {
|
|
968
|
+
const screenMode = EXTENTS.find((extent) => extent.mode === key);
|
|
969
|
+
availableScreenModeExtents.push({
|
|
970
|
+
...screenMode,
|
|
971
|
+
height: dashboardComponent.dimensions[key][1] || 50
|
|
972
|
+
});
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
if (!availableScreenModeExtents.map((screenModeExtent) => screenModeExtent.mode).includes(dashboardComponent.params.screenMode)) {
|
|
976
|
+
dashboardComponent.params.screenMode = "auto";
|
|
977
|
+
}
|
|
978
|
+
if (dashboardComponent.params.screenMode === "auto") {
|
|
979
|
+
availableScreenModeExtents.sort(
|
|
980
|
+
(a3, b3) => screenModes.indexOf(a3.mode) - screenModes.indexOf(b3.mode)
|
|
981
|
+
);
|
|
982
|
+
for (const screenModeExtent of availableScreenModeExtents) {
|
|
983
|
+
const [screenModeExtentMinWidth, screenModeExtentMaxWidth] = screenModeExtent.width;
|
|
984
|
+
if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
|
|
985
|
+
if (screenModeExtentMinWidth < dashboardComponent.params.itemDimensions.width) {
|
|
986
|
+
currentMode = screenModeExtent.mode;
|
|
987
|
+
currentWidth = Number.parseInt(
|
|
988
|
+
dashboardComponent.params.itemDimensions.width,
|
|
989
|
+
10
|
|
990
|
+
);
|
|
991
|
+
currentHeight = dashboardComponent.dimensions[currentMode][1];
|
|
992
|
+
}
|
|
993
|
+
} else {
|
|
994
|
+
if (screenModeExtentMinWidth < dashboardComponent.containerWidth) {
|
|
995
|
+
currentMode = screenModeExtent.mode;
|
|
996
|
+
if (dashboardComponent.params.itemEmbedding) {
|
|
997
|
+
currentWidth = dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto" ? Number.parseInt(
|
|
998
|
+
dashboardComponent.params.itemDimensions.width,
|
|
999
|
+
10
|
|
1000
|
+
) : Math.min(
|
|
1001
|
+
dashboardComponent.containerWidth,
|
|
1002
|
+
screenModeExtentMaxWidth
|
|
1003
|
+
);
|
|
1004
|
+
currentHeight = dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto" ? Number.parseInt(
|
|
1005
|
+
dashboardComponent.params.itemDimensions.height,
|
|
1006
|
+
10
|
|
1007
|
+
) : dashboardComponent.dimensions[currentMode][1];
|
|
1008
|
+
if (dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
|
|
1009
|
+
currentWidth = Number.parseInt(
|
|
1010
|
+
dashboardComponent.params.itemDimensions.width,
|
|
1011
|
+
10
|
|
1012
|
+
);
|
|
1013
|
+
currentHeight = dashboardComponent.dimensions[currentMode][1];
|
|
1014
|
+
}
|
|
953
1015
|
} else {
|
|
954
|
-
|
|
955
|
-
(
|
|
1016
|
+
currentWidth = Math.max(
|
|
1017
|
+
Math.min(
|
|
1018
|
+
screenModeExtentMaxWidth,
|
|
1019
|
+
dashboardComponent.containerWidth
|
|
1020
|
+
),
|
|
1021
|
+
screenModeExtentMinWidth
|
|
956
1022
|
);
|
|
957
|
-
|
|
958
|
-
resolve({
|
|
959
|
-
integrationId: data.rows[0].integration_id,
|
|
960
|
-
user: data.rows[0].user
|
|
961
|
-
});
|
|
1023
|
+
currentHeight = screenModeExtent.height;
|
|
962
1024
|
}
|
|
963
|
-
}
|
|
964
|
-
} catch (error) {
|
|
965
|
-
reject(error);
|
|
1025
|
+
}
|
|
966
1026
|
}
|
|
967
|
-
})();
|
|
968
|
-
});
|
|
969
|
-
return new Promise((resolve, reject) => void (() => {
|
|
970
|
-
try {
|
|
971
|
-
fetchUser.then((authorizationData) => {
|
|
972
|
-
const responsePromise = window.fetch(
|
|
973
|
-
// With experimental=true URLs remove the trailing slash, since the web component expects them to not have it.
|
|
974
|
-
// Fixes incorrect url with experimental=true
|
|
975
|
-
`${addTrailingSlash(dashboardComponent.params.apiHost)}0.1.0/securable`,
|
|
976
|
-
{
|
|
977
|
-
method: "POST",
|
|
978
|
-
mode: "cors",
|
|
979
|
-
cache: "no-cache",
|
|
980
|
-
headers: { "Content-Type": "application/json" },
|
|
981
|
-
redirect: "follow",
|
|
982
|
-
body: JSON.stringify({
|
|
983
|
-
action: "get",
|
|
984
|
-
version: "0.1.0",
|
|
985
|
-
key: dashboardComponent.currentAuthKey ?? dashboardComponent.authKey,
|
|
986
|
-
token: dashboardComponent.currentAuthToken ?? dashboardComponent.authToken,
|
|
987
|
-
find: {
|
|
988
|
-
where: { type: "dashboard", is_variant: false },
|
|
989
|
-
attributes: ["id", "name", "modified_at"],
|
|
990
|
-
order: [["modified_at", "desc"]],
|
|
991
|
-
include: [
|
|
992
|
-
{ model: "Tag", attributes: ["tag"] },
|
|
993
|
-
{ model: "User", attributes: ["id", "name"] },
|
|
994
|
-
{
|
|
995
|
-
model: "Group",
|
|
996
|
-
attributes: ["id", "name", "public"]
|
|
997
|
-
},
|
|
998
|
-
{ model: "Integration", attributes: ["id", "name"] }
|
|
999
|
-
]
|
|
1000
|
-
}
|
|
1001
|
-
})
|
|
1002
|
-
}
|
|
1003
|
-
);
|
|
1004
|
-
responsePromise.then((response) => response.json()).then((data) => {
|
|
1005
|
-
const dashboardList = data.rows.length > 0 ? formatDashboardList(
|
|
1006
|
-
data.rows,
|
|
1007
|
-
authorizationData.integrationId,
|
|
1008
|
-
authorizationData.user,
|
|
1009
|
-
dashboardComponent
|
|
1010
|
-
) : [];
|
|
1011
|
-
resolve(dashboardList);
|
|
1012
|
-
});
|
|
1013
|
-
}).catch((error) => {
|
|
1014
|
-
reject(error);
|
|
1015
|
-
});
|
|
1016
|
-
} catch (error) {
|
|
1017
|
-
reject(error);
|
|
1018
1027
|
}
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
return new Promise((resolve, reject) => {
|
|
1038
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
1039
|
-
setTimeout(() => {
|
|
1040
|
-
if (dashboardComponent.promises[requestId]) {
|
|
1041
|
-
const errorMessage = "getData request timed out.";
|
|
1042
|
-
dashboardComponent.promises[requestId].reject(
|
|
1043
|
-
new Error(errorMessage)
|
|
1028
|
+
} else {
|
|
1029
|
+
const {
|
|
1030
|
+
height: chosenModeHeight,
|
|
1031
|
+
width: [chosenModeMinWidth, chosenModeMaxWidth]
|
|
1032
|
+
} = availableScreenModeExtents.find(
|
|
1033
|
+
(d3) => d3.mode === dashboardComponent.params.screenMode
|
|
1034
|
+
);
|
|
1035
|
+
currentMode = dashboardComponent.params.screenMode;
|
|
1036
|
+
currentWidth = Math.max(
|
|
1037
|
+
Math.min(chosenModeMaxWidth, dashboardComponent.containerWidth),
|
|
1038
|
+
chosenModeMinWidth
|
|
1039
|
+
);
|
|
1040
|
+
currentHeight = chosenModeHeight;
|
|
1041
|
+
if (dashboardComponent.params.itemEmbedding) {
|
|
1042
|
+
if (dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto") {
|
|
1043
|
+
currentWidth = Number.parseInt(
|
|
1044
|
+
dashboardComponent.params.itemDimensions.width,
|
|
1045
|
+
10
|
|
1044
1046
|
);
|
|
1045
|
-
delete dashboardComponent.promises[requestId];
|
|
1046
1047
|
}
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
};
|
|
1052
|
-
|
|
1053
|
-
// libs/embed-libs/shared-embed/src/lib/methods/get-filters.ts
|
|
1054
|
-
var getFilters = (dashboardComponent, iframe) => {
|
|
1055
|
-
if (iframe?.contentWindow) {
|
|
1056
|
-
const requestId = uuidv4();
|
|
1057
|
-
iframe.contentWindow.postMessage(
|
|
1058
|
-
{ action: "getFilters", _version: dashboardComponent.libVersion, requestId },
|
|
1059
|
-
"*"
|
|
1060
|
-
);
|
|
1061
|
-
return new Promise((resolve, reject) => {
|
|
1062
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
1063
|
-
setTimeout(() => {
|
|
1064
|
-
if (dashboardComponent.promises[requestId]) {
|
|
1065
|
-
const errorMessage = "getFilters request timed out.";
|
|
1066
|
-
dashboardComponent.promises[requestId].reject(
|
|
1067
|
-
new Error(errorMessage)
|
|
1048
|
+
if (dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto") {
|
|
1049
|
+
currentHeight = Number.parseInt(
|
|
1050
|
+
dashboardComponent.params.itemDimensions.height,
|
|
1051
|
+
10
|
|
1068
1052
|
);
|
|
1069
|
-
delete dashboardComponent.promises[requestId];
|
|
1070
1053
|
}
|
|
1071
|
-
}
|
|
1072
|
-
}
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
if (!currentMode && availableScreenModeExtents.length > 0) {
|
|
1057
|
+
const [lowestModeExtent] = availableScreenModeExtents;
|
|
1058
|
+
currentMode = lowestModeExtent.mode;
|
|
1059
|
+
currentWidth = lowestModeExtent.width[0];
|
|
1060
|
+
currentHeight = lowestModeExtent.height;
|
|
1061
|
+
}
|
|
1073
1062
|
}
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
"
|
|
1087
|
-
|
|
1088
|
-
|
|
1063
|
+
dashboardComponent.currentScreenMode = currentMode;
|
|
1064
|
+
const style = {
|
|
1065
|
+
height: currentHeight === 0 ? "100%" : `${String(currentHeight)}px`,
|
|
1066
|
+
width: currentWidth === 0 ? "100%" : `${String(currentWidth)}px`,
|
|
1067
|
+
opacity: 1
|
|
1068
|
+
};
|
|
1069
|
+
const dashboardEditModes = ["editFull", "editLimited"];
|
|
1070
|
+
if (dashboardEditModes.includes(dashboardComponent.params.editMode)) {
|
|
1071
|
+
style.height = "100%";
|
|
1072
|
+
style.width = "100%";
|
|
1073
|
+
} else if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions) {
|
|
1074
|
+
style.height = dashboardComponent.params.itemDimensions.height === "auto" ? style.height : `${String(dashboardComponent.params.itemDimensions.height).replace(
|
|
1075
|
+
"px",
|
|
1076
|
+
""
|
|
1077
|
+
)}px`;
|
|
1078
|
+
style.width = dashboardComponent.params.itemDimensions.width === "auto" ? style.width : `${String(dashboardComponent.params.itemDimensions.width).replace(
|
|
1079
|
+
"px",
|
|
1080
|
+
""
|
|
1081
|
+
)}px`;
|
|
1082
|
+
} else {
|
|
1083
|
+
style.height = currentHeight === 0 ? "100%" : `${String(currentHeight)}px`;
|
|
1084
|
+
style.width = currentWidth === 0 ? "100%" : `${String(currentWidth)}px`;
|
|
1089
1085
|
}
|
|
1090
|
-
|
|
1086
|
+
dashboardComponent.currentScreenMode = currentMode;
|
|
1087
|
+
dashboardComponent.iframeStyle = style;
|
|
1091
1088
|
};
|
|
1092
1089
|
|
|
1093
|
-
// libs/embed-libs/shared-embed/src/lib/
|
|
1094
|
-
var
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1090
|
+
// libs/embed-libs/shared-embed/src/lib/service/extend-and-validate.ts
|
|
1091
|
+
var _extendAndValidate = (dashboardContent) => {
|
|
1092
|
+
const defaultKeys = Object.keys(
|
|
1093
|
+
DEFAULT_PARAMETERS
|
|
1094
|
+
);
|
|
1095
|
+
const errorMessages = [];
|
|
1096
|
+
const requiredStringParams = [
|
|
1097
|
+
"appServer",
|
|
1098
|
+
"language",
|
|
1099
|
+
"apiHost"
|
|
1100
|
+
];
|
|
1101
|
+
const requiredStringOrEmptyParams = [
|
|
1102
|
+
"key",
|
|
1103
|
+
"token",
|
|
1104
|
+
"screenMode",
|
|
1105
|
+
"timezoneId",
|
|
1106
|
+
"itemId",
|
|
1107
|
+
"container",
|
|
1108
|
+
"loaderBackground",
|
|
1109
|
+
"loaderFontColor",
|
|
1110
|
+
"loaderSpinnerColor",
|
|
1111
|
+
"loaderSpinnerBackground"
|
|
1112
|
+
];
|
|
1113
|
+
const objectParams = ["itemDimensions"];
|
|
1114
|
+
const screenModes = [
|
|
1115
|
+
"mobile",
|
|
1116
|
+
"tablet",
|
|
1117
|
+
"desktop",
|
|
1118
|
+
"largeScreen",
|
|
1119
|
+
"fixed",
|
|
1120
|
+
"auto"
|
|
1121
|
+
];
|
|
1122
|
+
for (const key of defaultKeys) {
|
|
1123
|
+
if (dashboardContent.params[key] === null) {
|
|
1124
|
+
delete dashboardContent.params[key];
|
|
1125
|
+
}
|
|
1101
1126
|
}
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
{
|
|
1110
|
-
action: "setAuthorization",
|
|
1111
|
-
key,
|
|
1112
|
-
token,
|
|
1113
|
-
_version: dashboardComponent.libVersion
|
|
1114
|
-
},
|
|
1115
|
-
"*"
|
|
1116
|
-
);
|
|
1117
|
-
return Promise.resolve();
|
|
1127
|
+
dashboardContent.params = defaultsDeep(
|
|
1128
|
+
dashboardContent.params,
|
|
1129
|
+
DEFAULT_PARAMETERS
|
|
1130
|
+
);
|
|
1131
|
+
if ((!dashboardContent.params.dashboardId || typeof dashboardContent.params.dashboardId !== "string") && (!dashboardContent.params.dashboardSlug || typeof dashboardContent.params.dashboardSlug !== "string")) {
|
|
1132
|
+
delete dashboardContent.params.dashboardId;
|
|
1133
|
+
delete dashboardContent.params.dashboardSlug;
|
|
1118
1134
|
}
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
var setEditMode = (dashboardComponent, iframe, editMode) => {
|
|
1124
|
-
if (iframe && iframe.contentWindow) {
|
|
1125
|
-
const requestId = uuidv4();
|
|
1126
|
-
if (dashboardComponent.params.editMode === editMode) {
|
|
1127
|
-
return Promise.reject(
|
|
1128
|
-
new Error("editMode parameter is currently already set to " + editMode)
|
|
1129
|
-
);
|
|
1130
|
-
} else if (editMode !== "editFull" && editMode !== "editLimited" && editMode !== "view") {
|
|
1131
|
-
return Promise.reject(
|
|
1132
|
-
new Error(
|
|
1133
|
-
"The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'."
|
|
1134
|
-
)
|
|
1135
|
-
);
|
|
1135
|
+
for (const key of requiredStringParams) {
|
|
1136
|
+
if (typeof dashboardContent.params[key] !== "string") {
|
|
1137
|
+
delete dashboardContent.params[key];
|
|
1138
|
+
errorMessages.push(`${key} needs to be of type string.`);
|
|
1136
1139
|
}
|
|
1137
|
-
iframe.contentWindow.postMessage(
|
|
1138
|
-
{
|
|
1139
|
-
action: "setEditMode",
|
|
1140
|
-
editMode,
|
|
1141
|
-
_version: dashboardComponent.libVersion,
|
|
1142
|
-
requestId
|
|
1143
|
-
},
|
|
1144
|
-
"*"
|
|
1145
|
-
);
|
|
1146
|
-
return new Promise((resolve, reject) => {
|
|
1147
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
1148
|
-
});
|
|
1149
1140
|
}
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
if (iframe) {
|
|
1156
|
-
const requestId = uuidv4();
|
|
1157
|
-
iframe.contentWindow.postMessage(
|
|
1158
|
-
{
|
|
1159
|
-
action: "setFilters",
|
|
1160
|
-
itemId,
|
|
1161
|
-
filters,
|
|
1162
|
-
_version: dashboardComponent.libVersion,
|
|
1163
|
-
requestId
|
|
1164
|
-
},
|
|
1165
|
-
"*"
|
|
1166
|
-
);
|
|
1167
|
-
return new Promise((resolve, reject) => {
|
|
1168
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
1169
|
-
setTimeout(() => {
|
|
1170
|
-
if (dashboardComponent.promises[requestId]) {
|
|
1171
|
-
const errorMessage = "setFilters request timed out.";
|
|
1172
|
-
dashboardComponent.promises[requestId].reject(
|
|
1173
|
-
new Error(errorMessage)
|
|
1174
|
-
);
|
|
1175
|
-
delete dashboardComponent.promises[requestId];
|
|
1176
|
-
}
|
|
1177
|
-
}, 2e3);
|
|
1178
|
-
});
|
|
1141
|
+
for (const key of requiredStringOrEmptyParams) {
|
|
1142
|
+
if (typeof dashboardContent.params[key] !== "string" && dashboardContent.params[key] !== null && dashboardContent.params[key] !== void 0) {
|
|
1143
|
+
delete dashboardContent.params[key];
|
|
1144
|
+
errorMessages.push(`${key} needs to be of type string or empty.`);
|
|
1145
|
+
}
|
|
1179
1146
|
}
|
|
1180
|
-
|
|
1181
|
-
};
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
var setPreview = (dashboardComponent, iframe, preview) => {
|
|
1185
|
-
if (iframe) {
|
|
1186
|
-
const requestId = uuidv4();
|
|
1187
|
-
iframe.contentWindow.postMessage(
|
|
1188
|
-
{
|
|
1189
|
-
action: "setPreview",
|
|
1190
|
-
preview,
|
|
1191
|
-
requestId,
|
|
1192
|
-
_version: dashboardComponent.libVersion
|
|
1193
|
-
},
|
|
1194
|
-
"*"
|
|
1147
|
+
if (dashboardContent.params.screenMode && !screenModes.includes(dashboardContent.params.screenMode)) {
|
|
1148
|
+
const validTypesString = screenModes.map((mode) => `"${mode}"`).join(", ");
|
|
1149
|
+
errorMessages.push(
|
|
1150
|
+
`"screenMode" needs should be one of these types: ${validTypesString}`
|
|
1195
1151
|
);
|
|
1196
|
-
|
|
1197
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
1198
|
-
setTimeout(() => {
|
|
1199
|
-
if (dashboardComponent.promises[requestId]) {
|
|
1200
|
-
const errorMessage = "setPreview request timed out.";
|
|
1201
|
-
dashboardComponent.promises[requestId].reject(
|
|
1202
|
-
new Error(errorMessage)
|
|
1203
|
-
);
|
|
1204
|
-
delete dashboardComponent.promises[requestId];
|
|
1205
|
-
}
|
|
1206
|
-
}, 2e3);
|
|
1207
|
-
});
|
|
1152
|
+
dashboardContent.params.screenMode = "auto";
|
|
1208
1153
|
}
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
// libs/embed-libs/shared-embed/src/lib/service/calculate-dimensions.ts
|
|
1213
|
-
var _setCalculatedDimensions = (dashboardComponent) => {
|
|
1214
|
-
if (!dashboardComponent.dimensions) {
|
|
1215
|
-
dashboardComponent.params.error = true;
|
|
1216
|
-
_handleError("Got no valid dimensions.", dashboardComponent.params);
|
|
1217
|
-
return;
|
|
1154
|
+
if (dashboardContent.params.itemId) {
|
|
1155
|
+
dashboardContent.params.itemEmbedding = true;
|
|
1218
1156
|
}
|
|
1219
|
-
const
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
let currentWidth = 0;
|
|
1225
|
-
let currentHeight = 0;
|
|
1226
|
-
if (!dashboardComponent.params.switchScreenModeOnResize && dashboardComponent.currentScreenMode) {
|
|
1227
|
-
dashboardComponent.params.screenMode = dashboardComponent.currentScreenMode;
|
|
1157
|
+
for (const key of objectParams) {
|
|
1158
|
+
if (typeof dashboardContent.params[key] !== "object" && dashboardContent.params[key] !== null) {
|
|
1159
|
+
delete dashboardContent.params[key];
|
|
1160
|
+
errorMessages.push(`${key} needs to be of type object or empty.`);
|
|
1161
|
+
}
|
|
1228
1162
|
}
|
|
1229
|
-
if (
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
const
|
|
1235
|
-
"
|
|
1236
|
-
"
|
|
1237
|
-
"desktop",
|
|
1238
|
-
"largeScreen"
|
|
1239
|
-
];
|
|
1240
|
-
if (dashboardComponent.params.itemEmbedding) {
|
|
1241
|
-
const [firstMatch] = dashboardDimensionKeys;
|
|
1242
|
-
let match = cloneDeep(firstMatch);
|
|
1243
|
-
for (const screenMode of screenModes) {
|
|
1244
|
-
const found = dashboardDimensionKeys.find((key) => key === screenMode);
|
|
1245
|
-
if (found) {
|
|
1246
|
-
match = cloneDeep(found);
|
|
1247
|
-
} else {
|
|
1248
|
-
dashboardComponent.dimensions[screenMode] = dashboardComponent.dimensions[match];
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
|
-
for (const key of dashboardDimensionKeys) {
|
|
1253
|
-
if (screenModes.includes(key)) {
|
|
1254
|
-
const screenMode = EXTENTS.find((extent) => extent.mode === key);
|
|
1255
|
-
availableScreenModeExtents.push({
|
|
1256
|
-
...screenMode,
|
|
1257
|
-
height: dashboardComponent.dimensions[key][1] || 50
|
|
1258
|
-
});
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1261
|
-
if (!availableScreenModeExtents.map((screenModeExtent) => screenModeExtent.mode).includes(dashboardComponent.params.screenMode)) {
|
|
1262
|
-
dashboardComponent.params.screenMode = "auto";
|
|
1263
|
-
}
|
|
1264
|
-
if (dashboardComponent.params.screenMode === "auto") {
|
|
1265
|
-
availableScreenModeExtents.sort(
|
|
1266
|
-
(a3, b3) => screenModes.indexOf(a3.mode) - screenModes.indexOf(b3.mode)
|
|
1267
|
-
);
|
|
1268
|
-
for (const screenModeExtent of availableScreenModeExtents) {
|
|
1269
|
-
const [screenModeExtentMinWidth, screenModeExtentMaxWidth] = screenModeExtent.width;
|
|
1270
|
-
if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
|
|
1271
|
-
if (screenModeExtentMinWidth < dashboardComponent.params.itemDimensions.width) {
|
|
1272
|
-
currentMode = screenModeExtent.mode;
|
|
1273
|
-
currentWidth = Number.parseInt(
|
|
1274
|
-
dashboardComponent.params.itemDimensions.width,
|
|
1275
|
-
10
|
|
1276
|
-
);
|
|
1277
|
-
currentHeight = dashboardComponent.dimensions[currentMode][1];
|
|
1278
|
-
}
|
|
1279
|
-
} else {
|
|
1280
|
-
if (screenModeExtentMinWidth < dashboardComponent.containerWidth) {
|
|
1281
|
-
currentMode = screenModeExtent.mode;
|
|
1282
|
-
if (dashboardComponent.params.itemEmbedding) {
|
|
1283
|
-
currentWidth = dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto" ? Number.parseInt(
|
|
1284
|
-
dashboardComponent.params.itemDimensions.width,
|
|
1285
|
-
10
|
|
1286
|
-
) : Math.min(
|
|
1287
|
-
dashboardComponent.containerWidth,
|
|
1288
|
-
screenModeExtentMaxWidth
|
|
1289
|
-
);
|
|
1290
|
-
currentHeight = dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto" ? Number.parseInt(
|
|
1291
|
-
dashboardComponent.params.itemDimensions.height,
|
|
1292
|
-
10
|
|
1293
|
-
) : dashboardComponent.dimensions[currentMode][1];
|
|
1294
|
-
if (dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
|
|
1295
|
-
currentWidth = Number.parseInt(
|
|
1296
|
-
dashboardComponent.params.itemDimensions.width,
|
|
1297
|
-
10
|
|
1298
|
-
);
|
|
1299
|
-
currentHeight = dashboardComponent.dimensions[currentMode][1];
|
|
1300
|
-
}
|
|
1301
|
-
} else {
|
|
1302
|
-
currentWidth = Math.max(
|
|
1303
|
-
Math.min(
|
|
1304
|
-
screenModeExtentMaxWidth,
|
|
1305
|
-
dashboardComponent.containerWidth
|
|
1306
|
-
),
|
|
1307
|
-
screenModeExtentMinWidth
|
|
1308
|
-
);
|
|
1309
|
-
currentHeight = screenModeExtent.height;
|
|
1310
|
-
}
|
|
1311
|
-
}
|
|
1312
|
-
}
|
|
1313
|
-
}
|
|
1314
|
-
} else {
|
|
1315
|
-
const {
|
|
1316
|
-
height: chosenModeHeight,
|
|
1317
|
-
width: [chosenModeMinWidth, chosenModeMaxWidth]
|
|
1318
|
-
} = availableScreenModeExtents.find(
|
|
1319
|
-
(d3) => d3.mode === dashboardComponent.params.screenMode
|
|
1320
|
-
);
|
|
1321
|
-
currentMode = dashboardComponent.params.screenMode;
|
|
1322
|
-
currentWidth = Math.max(
|
|
1323
|
-
Math.min(chosenModeMaxWidth, dashboardComponent.containerWidth),
|
|
1324
|
-
chosenModeMinWidth
|
|
1325
|
-
);
|
|
1326
|
-
currentHeight = chosenModeHeight;
|
|
1327
|
-
if (dashboardComponent.params.itemEmbedding) {
|
|
1328
|
-
if (dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto") {
|
|
1329
|
-
currentWidth = Number.parseInt(
|
|
1330
|
-
dashboardComponent.params.itemDimensions.width,
|
|
1331
|
-
10
|
|
1332
|
-
);
|
|
1333
|
-
}
|
|
1334
|
-
if (dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto") {
|
|
1335
|
-
currentHeight = Number.parseInt(
|
|
1336
|
-
dashboardComponent.params.itemDimensions.height,
|
|
1337
|
-
10
|
|
1338
|
-
);
|
|
1339
|
-
}
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
if (!currentMode && availableScreenModeExtents.length > 0) {
|
|
1343
|
-
const [lowestModeExtent] = availableScreenModeExtents;
|
|
1344
|
-
currentMode = lowestModeExtent.mode;
|
|
1345
|
-
currentWidth = lowestModeExtent.width[0];
|
|
1346
|
-
currentHeight = lowestModeExtent.height;
|
|
1347
|
-
}
|
|
1348
|
-
}
|
|
1349
|
-
dashboardComponent.currentScreenMode = currentMode;
|
|
1350
|
-
const style = {
|
|
1351
|
-
height: currentHeight === 0 ? "100%" : `${String(currentHeight)}px`,
|
|
1352
|
-
width: currentWidth === 0 ? "100%" : `${String(currentWidth)}px`,
|
|
1353
|
-
opacity: 1
|
|
1354
|
-
};
|
|
1355
|
-
const dashboardEditModes = ["editFull", "editLimited"];
|
|
1356
|
-
if (dashboardEditModes.includes(dashboardComponent.params.editMode)) {
|
|
1357
|
-
style.height = "100%";
|
|
1358
|
-
style.width = "100%";
|
|
1359
|
-
} else if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions) {
|
|
1360
|
-
style.height = dashboardComponent.params.itemDimensions.height === "auto" ? style.height : `${String(dashboardComponent.params.itemDimensions.height).replace(
|
|
1361
|
-
"px",
|
|
1362
|
-
""
|
|
1363
|
-
)}px`;
|
|
1364
|
-
style.width = dashboardComponent.params.itemDimensions.width === "auto" ? style.width : `${String(dashboardComponent.params.itemDimensions.width).replace(
|
|
1365
|
-
"px",
|
|
1366
|
-
""
|
|
1367
|
-
)}px`;
|
|
1368
|
-
} else {
|
|
1369
|
-
style.height = currentHeight === 0 ? "100%" : `${String(currentHeight)}px`;
|
|
1370
|
-
style.width = currentWidth === 0 ? "100%" : `${String(currentWidth)}px`;
|
|
1371
|
-
}
|
|
1372
|
-
dashboardComponent.currentScreenMode = currentMode;
|
|
1373
|
-
dashboardComponent.iframeStyle = style;
|
|
1374
|
-
};
|
|
1375
|
-
|
|
1376
|
-
// libs/embed-libs/shared-embed/src/lib/service/extend-and-validate.ts
|
|
1377
|
-
var _extendAndValidate = (dashboardContent) => {
|
|
1378
|
-
const defaultKeys = Object.keys(
|
|
1379
|
-
DEFAULT_PARAMETERS
|
|
1380
|
-
);
|
|
1381
|
-
const errorMessages = [];
|
|
1382
|
-
const requiredStringParams = [
|
|
1383
|
-
"appServer",
|
|
1384
|
-
"language",
|
|
1385
|
-
"apiHost"
|
|
1386
|
-
];
|
|
1387
|
-
const requiredStringOrEmptyParams = [
|
|
1388
|
-
"key",
|
|
1389
|
-
"token",
|
|
1390
|
-
"screenMode",
|
|
1391
|
-
"timezoneId",
|
|
1392
|
-
"itemId",
|
|
1393
|
-
"container",
|
|
1394
|
-
"loaderBackground",
|
|
1395
|
-
"loaderFontColor",
|
|
1396
|
-
"loaderSpinnerColor",
|
|
1397
|
-
"loaderSpinnerBackground"
|
|
1398
|
-
];
|
|
1399
|
-
const objectParams = ["itemDimensions"];
|
|
1400
|
-
const screenModes = [
|
|
1401
|
-
"mobile",
|
|
1402
|
-
"tablet",
|
|
1403
|
-
"desktop",
|
|
1404
|
-
"largeScreen",
|
|
1405
|
-
"fixed",
|
|
1406
|
-
"auto"
|
|
1407
|
-
];
|
|
1408
|
-
for (const key of defaultKeys) {
|
|
1409
|
-
if (dashboardContent.params[key] === null) {
|
|
1410
|
-
delete dashboardContent.params[key];
|
|
1411
|
-
}
|
|
1412
|
-
}
|
|
1413
|
-
dashboardContent.params = defaultsDeep(
|
|
1414
|
-
dashboardContent.params,
|
|
1415
|
-
DEFAULT_PARAMETERS
|
|
1416
|
-
);
|
|
1417
|
-
if ((!dashboardContent.params.dashboardId || typeof dashboardContent.params.dashboardId !== "string") && (!dashboardContent.params.dashboardSlug || typeof dashboardContent.params.dashboardSlug !== "string")) {
|
|
1418
|
-
delete dashboardContent.params.dashboardId;
|
|
1419
|
-
delete dashboardContent.params.dashboardSlug;
|
|
1420
|
-
}
|
|
1421
|
-
for (const key of requiredStringParams) {
|
|
1422
|
-
if (typeof dashboardContent.params[key] !== "string") {
|
|
1423
|
-
delete dashboardContent.params[key];
|
|
1424
|
-
errorMessages.push(`${key} needs to be of type string.`);
|
|
1425
|
-
}
|
|
1426
|
-
}
|
|
1427
|
-
for (const key of requiredStringOrEmptyParams) {
|
|
1428
|
-
if (typeof dashboardContent.params[key] !== "string" && dashboardContent.params[key] !== null && dashboardContent.params[key] !== void 0) {
|
|
1429
|
-
delete dashboardContent.params[key];
|
|
1430
|
-
errorMessages.push(`${key} needs to be of type string or empty.`);
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
if (dashboardContent.params.screenMode && !screenModes.includes(dashboardContent.params.screenMode)) {
|
|
1434
|
-
const validTypesString = screenModes.map((mode) => `"${mode}"`).join(", ");
|
|
1435
|
-
errorMessages.push(
|
|
1436
|
-
`"screenMode" needs should be one of these types: ${validTypesString}`
|
|
1437
|
-
);
|
|
1438
|
-
dashboardContent.params.screenMode = "auto";
|
|
1439
|
-
}
|
|
1440
|
-
if (dashboardContent.params.itemId) {
|
|
1441
|
-
dashboardContent.params.itemEmbedding = true;
|
|
1442
|
-
}
|
|
1443
|
-
for (const key of objectParams) {
|
|
1444
|
-
if (typeof dashboardContent.params[key] !== "object" && dashboardContent.params[key] !== null) {
|
|
1445
|
-
delete dashboardContent.params[key];
|
|
1446
|
-
errorMessages.push(`${key} needs to be of type object or empty.`);
|
|
1447
|
-
}
|
|
1448
|
-
}
|
|
1449
|
-
if (typeof dashboardContent.params.switchScreenModeOnResize !== "boolean") {
|
|
1450
|
-
errorMessages.push("switchScreenModeOnResize needs to be of type boolean.");
|
|
1451
|
-
dashboardContent.params.switchScreenModeOnResize = true;
|
|
1452
|
-
}
|
|
1453
|
-
if (dashboardContent.params.itemDimensions) {
|
|
1454
|
-
const itemDimensionsKeys = [
|
|
1455
|
-
"width",
|
|
1456
|
-
"height"
|
|
1163
|
+
if (typeof dashboardContent.params.switchScreenModeOnResize !== "boolean") {
|
|
1164
|
+
errorMessages.push("switchScreenModeOnResize needs to be of type boolean.");
|
|
1165
|
+
dashboardContent.params.switchScreenModeOnResize = true;
|
|
1166
|
+
}
|
|
1167
|
+
if (dashboardContent.params.itemDimensions) {
|
|
1168
|
+
const itemDimensionsKeys = [
|
|
1169
|
+
"width",
|
|
1170
|
+
"height"
|
|
1457
1171
|
];
|
|
1458
1172
|
for (const key of itemDimensionsKeys) {
|
|
1459
1173
|
if (!["string", "number"].includes(
|
|
@@ -5412,31 +5126,35 @@ var z = /* @__PURE__ */ Object.freeze({
|
|
|
5412
5126
|
|
|
5413
5127
|
// libs/embed-libs/shared-embed/src/lib/models/viz-item.model.ts
|
|
5414
5128
|
var slotsNameParser = z.enum([
|
|
5415
|
-
"
|
|
5129
|
+
"x-,axis",
|
|
5130
|
+
"y-,axis",
|
|
5131
|
+
"category",
|
|
5416
5132
|
"measure",
|
|
5133
|
+
"coordinates",
|
|
5417
5134
|
"legend",
|
|
5418
|
-
"x-axis",
|
|
5419
|
-
"evolution",
|
|
5420
|
-
"row",
|
|
5421
|
-
"column",
|
|
5422
|
-
"columns",
|
|
5423
|
-
"category",
|
|
5424
|
-
"target",
|
|
5425
|
-
"color",
|
|
5426
5135
|
"geo",
|
|
5427
|
-
"
|
|
5428
|
-
"
|
|
5429
|
-
"
|
|
5136
|
+
"image",
|
|
5137
|
+
"color",
|
|
5138
|
+
"levels",
|
|
5139
|
+
"slidermetric",
|
|
5140
|
+
"dimension",
|
|
5430
5141
|
"destination",
|
|
5142
|
+
"source",
|
|
5143
|
+
"time",
|
|
5144
|
+
"identifier",
|
|
5145
|
+
"target",
|
|
5431
5146
|
"size",
|
|
5432
5147
|
"name",
|
|
5433
|
-
"
|
|
5148
|
+
"columns",
|
|
5149
|
+
"column",
|
|
5150
|
+
"row",
|
|
5151
|
+
"evolution",
|
|
5152
|
+
"close",
|
|
5434
5153
|
"open",
|
|
5435
|
-
"high",
|
|
5436
5154
|
"low",
|
|
5437
|
-
"
|
|
5438
|
-
"
|
|
5439
|
-
"
|
|
5155
|
+
"high",
|
|
5156
|
+
"order",
|
|
5157
|
+
"route"
|
|
5440
5158
|
]);
|
|
5441
5159
|
var slotParser = z.object({
|
|
5442
5160
|
name: slotsNameParser,
|
|
@@ -5446,6 +5164,7 @@ var slotParser = z.object({
|
|
|
5446
5164
|
format: z.string().optional(),
|
|
5447
5165
|
label: z.union([z.string(), z.record(z.string())]).optional(),
|
|
5448
5166
|
column: z.string().uuid().optional(),
|
|
5167
|
+
formula: z.string().uuid().optional(),
|
|
5449
5168
|
set: z.string().uuid().optional(),
|
|
5450
5169
|
aggregationFunc: z.string().optional(),
|
|
5451
5170
|
subtype: z.string().optional(),
|
|
@@ -5527,7 +5246,8 @@ var vizItemOptionsParser = z.object({
|
|
|
5527
5246
|
tileProvider: z.record(z.any()).optional(),
|
|
5528
5247
|
vectorTileProvider: z.record(z.any()).optional(),
|
|
5529
5248
|
sources: z.record(z.any()).optional(),
|
|
5530
|
-
display: z.union([z.record(z.any()), z.object({ title: z.boolean() })]).optional()
|
|
5249
|
+
display: z.union([z.record(z.any()), z.object({ title: z.boolean() })]).optional(),
|
|
5250
|
+
timezoneId: z.string().optional()
|
|
5531
5251
|
});
|
|
5532
5252
|
var canFilterParser = z.union([z.array(z.string()), z.literal("all")]);
|
|
5533
5253
|
var libraryTypeToWebComponentTypeMapping = {
|
|
@@ -5629,6 +5349,357 @@ async function loadLibrary(appServer, componentName = "DashboardApp") {
|
|
|
5629
5349
|
return wrappedModule;
|
|
5630
5350
|
}
|
|
5631
5351
|
|
|
5352
|
+
// node_modules/@lit/reactive-element/decorators/custom-element.js
|
|
5353
|
+
var t = (t5) => (e7, o6) => {
|
|
5354
|
+
void 0 !== o6 ? o6.addInitializer(() => {
|
|
5355
|
+
customElements.define(t5, e7);
|
|
5356
|
+
}) : customElements.define(t5, e7);
|
|
5357
|
+
};
|
|
5358
|
+
|
|
5359
|
+
// node_modules/@lit/reactive-element/css-tag.js
|
|
5360
|
+
var t2 = globalThis;
|
|
5361
|
+
var e = t2.ShadowRoot && (void 0 === t2.ShadyCSS || t2.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype;
|
|
5362
|
+
var s = Symbol();
|
|
5363
|
+
var o = /* @__PURE__ */ new WeakMap();
|
|
5364
|
+
var n = class {
|
|
5365
|
+
constructor(t5, e7, o6) {
|
|
5366
|
+
if (this._$cssResult$ = true, o6 !== s)
|
|
5367
|
+
throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
5368
|
+
this.cssText = t5, this.t = e7;
|
|
5369
|
+
}
|
|
5370
|
+
get styleSheet() {
|
|
5371
|
+
let t5 = this.o;
|
|
5372
|
+
const s4 = this.t;
|
|
5373
|
+
if (e && void 0 === t5) {
|
|
5374
|
+
const e7 = void 0 !== s4 && 1 === s4.length;
|
|
5375
|
+
e7 && (t5 = o.get(s4)), void 0 === t5 && ((this.o = t5 = new CSSStyleSheet()).replaceSync(this.cssText), e7 && o.set(s4, t5));
|
|
5376
|
+
}
|
|
5377
|
+
return t5;
|
|
5378
|
+
}
|
|
5379
|
+
toString() {
|
|
5380
|
+
return this.cssText;
|
|
5381
|
+
}
|
|
5382
|
+
};
|
|
5383
|
+
var r = (t5) => new n("string" == typeof t5 ? t5 : t5 + "", void 0, s);
|
|
5384
|
+
var i = (t5, ...e7) => {
|
|
5385
|
+
const o6 = 1 === t5.length ? t5[0] : e7.reduce((e8, s4, o7) => e8 + ((t6) => {
|
|
5386
|
+
if (true === t6._$cssResult$)
|
|
5387
|
+
return t6.cssText;
|
|
5388
|
+
if ("number" == typeof t6)
|
|
5389
|
+
return t6;
|
|
5390
|
+
throw Error("Value passed to 'css' function must be a 'css' function result: " + t6 + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
5391
|
+
})(s4) + t5[o7 + 1], t5[0]);
|
|
5392
|
+
return new n(o6, t5, s);
|
|
5393
|
+
};
|
|
5394
|
+
var S = (s4, o6) => {
|
|
5395
|
+
if (e)
|
|
5396
|
+
s4.adoptedStyleSheets = o6.map((t5) => t5 instanceof CSSStyleSheet ? t5 : t5.styleSheet);
|
|
5397
|
+
else
|
|
5398
|
+
for (const e7 of o6) {
|
|
5399
|
+
const o7 = document.createElement("style"), n6 = t2.litNonce;
|
|
5400
|
+
void 0 !== n6 && o7.setAttribute("nonce", n6), o7.textContent = e7.cssText, s4.appendChild(o7);
|
|
5401
|
+
}
|
|
5402
|
+
};
|
|
5403
|
+
var c = e ? (t5) => t5 : (t5) => t5 instanceof CSSStyleSheet ? ((t6) => {
|
|
5404
|
+
let e7 = "";
|
|
5405
|
+
for (const s4 of t6.cssRules)
|
|
5406
|
+
e7 += s4.cssText;
|
|
5407
|
+
return r(e7);
|
|
5408
|
+
})(t5) : t5;
|
|
5409
|
+
|
|
5410
|
+
// node_modules/@lit/reactive-element/reactive-element.js
|
|
5411
|
+
var { is: i2, defineProperty: e2, getOwnPropertyDescriptor: r2, getOwnPropertyNames: h, getOwnPropertySymbols: o2, getPrototypeOf: n2 } = Object;
|
|
5412
|
+
var a = globalThis;
|
|
5413
|
+
var c2 = a.trustedTypes;
|
|
5414
|
+
var l = c2 ? c2.emptyScript : "";
|
|
5415
|
+
var p = a.reactiveElementPolyfillSupport;
|
|
5416
|
+
var d = (t5, s4) => t5;
|
|
5417
|
+
var u = { toAttribute(t5, s4) {
|
|
5418
|
+
switch (s4) {
|
|
5419
|
+
case Boolean:
|
|
5420
|
+
t5 = t5 ? l : null;
|
|
5421
|
+
break;
|
|
5422
|
+
case Object:
|
|
5423
|
+
case Array:
|
|
5424
|
+
t5 = null == t5 ? t5 : JSON.stringify(t5);
|
|
5425
|
+
}
|
|
5426
|
+
return t5;
|
|
5427
|
+
}, fromAttribute(t5, s4) {
|
|
5428
|
+
let i6 = t5;
|
|
5429
|
+
switch (s4) {
|
|
5430
|
+
case Boolean:
|
|
5431
|
+
i6 = null !== t5;
|
|
5432
|
+
break;
|
|
5433
|
+
case Number:
|
|
5434
|
+
i6 = null === t5 ? null : Number(t5);
|
|
5435
|
+
break;
|
|
5436
|
+
case Object:
|
|
5437
|
+
case Array:
|
|
5438
|
+
try {
|
|
5439
|
+
i6 = JSON.parse(t5);
|
|
5440
|
+
} catch (t6) {
|
|
5441
|
+
i6 = null;
|
|
5442
|
+
}
|
|
5443
|
+
}
|
|
5444
|
+
return i6;
|
|
5445
|
+
} };
|
|
5446
|
+
var f = (t5, s4) => !i2(t5, s4);
|
|
5447
|
+
var y = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f };
|
|
5448
|
+
Symbol.metadata ??= Symbol("metadata"), a.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
5449
|
+
var b = class extends HTMLElement {
|
|
5450
|
+
static addInitializer(t5) {
|
|
5451
|
+
this._$Ei(), (this.l ??= []).push(t5);
|
|
5452
|
+
}
|
|
5453
|
+
static get observedAttributes() {
|
|
5454
|
+
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
5455
|
+
}
|
|
5456
|
+
static createProperty(t5, s4 = y) {
|
|
5457
|
+
if (s4.state && (s4.attribute = false), this._$Ei(), this.elementProperties.set(t5, s4), !s4.noAccessor) {
|
|
5458
|
+
const i6 = Symbol(), r7 = this.getPropertyDescriptor(t5, i6, s4);
|
|
5459
|
+
void 0 !== r7 && e2(this.prototype, t5, r7);
|
|
5460
|
+
}
|
|
5461
|
+
}
|
|
5462
|
+
static getPropertyDescriptor(t5, s4, i6) {
|
|
5463
|
+
const { get: e7, set: h3 } = r2(this.prototype, t5) ?? { get() {
|
|
5464
|
+
return this[s4];
|
|
5465
|
+
}, set(t6) {
|
|
5466
|
+
this[s4] = t6;
|
|
5467
|
+
} };
|
|
5468
|
+
return { get() {
|
|
5469
|
+
return e7?.call(this);
|
|
5470
|
+
}, set(s5) {
|
|
5471
|
+
const r7 = e7?.call(this);
|
|
5472
|
+
h3.call(this, s5), this.requestUpdate(t5, r7, i6);
|
|
5473
|
+
}, configurable: true, enumerable: true };
|
|
5474
|
+
}
|
|
5475
|
+
static getPropertyOptions(t5) {
|
|
5476
|
+
return this.elementProperties.get(t5) ?? y;
|
|
5477
|
+
}
|
|
5478
|
+
static _$Ei() {
|
|
5479
|
+
if (this.hasOwnProperty(d("elementProperties")))
|
|
5480
|
+
return;
|
|
5481
|
+
const t5 = n2(this);
|
|
5482
|
+
t5.finalize(), void 0 !== t5.l && (this.l = [...t5.l]), this.elementProperties = new Map(t5.elementProperties);
|
|
5483
|
+
}
|
|
5484
|
+
static finalize() {
|
|
5485
|
+
if (this.hasOwnProperty(d("finalized")))
|
|
5486
|
+
return;
|
|
5487
|
+
if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d("properties"))) {
|
|
5488
|
+
const t6 = this.properties, s4 = [...h(t6), ...o2(t6)];
|
|
5489
|
+
for (const i6 of s4)
|
|
5490
|
+
this.createProperty(i6, t6[i6]);
|
|
5491
|
+
}
|
|
5492
|
+
const t5 = this[Symbol.metadata];
|
|
5493
|
+
if (null !== t5) {
|
|
5494
|
+
const s4 = litPropertyMetadata.get(t5);
|
|
5495
|
+
if (void 0 !== s4)
|
|
5496
|
+
for (const [t6, i6] of s4)
|
|
5497
|
+
this.elementProperties.set(t6, i6);
|
|
5498
|
+
}
|
|
5499
|
+
this._$Eh = /* @__PURE__ */ new Map();
|
|
5500
|
+
for (const [t6, s4] of this.elementProperties) {
|
|
5501
|
+
const i6 = this._$Eu(t6, s4);
|
|
5502
|
+
void 0 !== i6 && this._$Eh.set(i6, t6);
|
|
5503
|
+
}
|
|
5504
|
+
this.elementStyles = this.finalizeStyles(this.styles);
|
|
5505
|
+
}
|
|
5506
|
+
static finalizeStyles(s4) {
|
|
5507
|
+
const i6 = [];
|
|
5508
|
+
if (Array.isArray(s4)) {
|
|
5509
|
+
const e7 = new Set(s4.flat(1 / 0).reverse());
|
|
5510
|
+
for (const s5 of e7)
|
|
5511
|
+
i6.unshift(c(s5));
|
|
5512
|
+
} else
|
|
5513
|
+
void 0 !== s4 && i6.push(c(s4));
|
|
5514
|
+
return i6;
|
|
5515
|
+
}
|
|
5516
|
+
static _$Eu(t5, s4) {
|
|
5517
|
+
const i6 = s4.attribute;
|
|
5518
|
+
return false === i6 ? void 0 : "string" == typeof i6 ? i6 : "string" == typeof t5 ? t5.toLowerCase() : void 0;
|
|
5519
|
+
}
|
|
5520
|
+
constructor() {
|
|
5521
|
+
super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
|
|
5522
|
+
}
|
|
5523
|
+
_$Ev() {
|
|
5524
|
+
this._$ES = new Promise((t5) => this.enableUpdating = t5), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((t5) => t5(this));
|
|
5525
|
+
}
|
|
5526
|
+
addController(t5) {
|
|
5527
|
+
(this._$EO ??= /* @__PURE__ */ new Set()).add(t5), void 0 !== this.renderRoot && this.isConnected && t5.hostConnected?.();
|
|
5528
|
+
}
|
|
5529
|
+
removeController(t5) {
|
|
5530
|
+
this._$EO?.delete(t5);
|
|
5531
|
+
}
|
|
5532
|
+
_$E_() {
|
|
5533
|
+
const t5 = /* @__PURE__ */ new Map(), s4 = this.constructor.elementProperties;
|
|
5534
|
+
for (const i6 of s4.keys())
|
|
5535
|
+
this.hasOwnProperty(i6) && (t5.set(i6, this[i6]), delete this[i6]);
|
|
5536
|
+
t5.size > 0 && (this._$Ep = t5);
|
|
5537
|
+
}
|
|
5538
|
+
createRenderRoot() {
|
|
5539
|
+
const t5 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
5540
|
+
return S(t5, this.constructor.elementStyles), t5;
|
|
5541
|
+
}
|
|
5542
|
+
connectedCallback() {
|
|
5543
|
+
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach((t5) => t5.hostConnected?.());
|
|
5544
|
+
}
|
|
5545
|
+
enableUpdating(t5) {
|
|
5546
|
+
}
|
|
5547
|
+
disconnectedCallback() {
|
|
5548
|
+
this._$EO?.forEach((t5) => t5.hostDisconnected?.());
|
|
5549
|
+
}
|
|
5550
|
+
attributeChangedCallback(t5, s4, i6) {
|
|
5551
|
+
this._$AK(t5, i6);
|
|
5552
|
+
}
|
|
5553
|
+
_$EC(t5, s4) {
|
|
5554
|
+
const i6 = this.constructor.elementProperties.get(t5), e7 = this.constructor._$Eu(t5, i6);
|
|
5555
|
+
if (void 0 !== e7 && true === i6.reflect) {
|
|
5556
|
+
const r7 = (void 0 !== i6.converter?.toAttribute ? i6.converter : u).toAttribute(s4, i6.type);
|
|
5557
|
+
this._$Em = t5, null == r7 ? this.removeAttribute(e7) : this.setAttribute(e7, r7), this._$Em = null;
|
|
5558
|
+
}
|
|
5559
|
+
}
|
|
5560
|
+
_$AK(t5, s4) {
|
|
5561
|
+
const i6 = this.constructor, e7 = i6._$Eh.get(t5);
|
|
5562
|
+
if (void 0 !== e7 && this._$Em !== e7) {
|
|
5563
|
+
const t6 = i6.getPropertyOptions(e7), r7 = "function" == typeof t6.converter ? { fromAttribute: t6.converter } : void 0 !== t6.converter?.fromAttribute ? t6.converter : u;
|
|
5564
|
+
this._$Em = e7, this[e7] = r7.fromAttribute(s4, t6.type), this._$Em = null;
|
|
5565
|
+
}
|
|
5566
|
+
}
|
|
5567
|
+
requestUpdate(t5, s4, i6) {
|
|
5568
|
+
if (void 0 !== t5) {
|
|
5569
|
+
if (i6 ??= this.constructor.getPropertyOptions(t5), !(i6.hasChanged ?? f)(this[t5], s4))
|
|
5570
|
+
return;
|
|
5571
|
+
this.P(t5, s4, i6);
|
|
5572
|
+
}
|
|
5573
|
+
false === this.isUpdatePending && (this._$ES = this._$ET());
|
|
5574
|
+
}
|
|
5575
|
+
P(t5, s4, i6) {
|
|
5576
|
+
this._$AL.has(t5) || this._$AL.set(t5, s4), true === i6.reflect && this._$Em !== t5 && (this._$Ej ??= /* @__PURE__ */ new Set()).add(t5);
|
|
5577
|
+
}
|
|
5578
|
+
async _$ET() {
|
|
5579
|
+
this.isUpdatePending = true;
|
|
5580
|
+
try {
|
|
5581
|
+
await this._$ES;
|
|
5582
|
+
} catch (t6) {
|
|
5583
|
+
Promise.reject(t6);
|
|
5584
|
+
}
|
|
5585
|
+
const t5 = this.scheduleUpdate();
|
|
5586
|
+
return null != t5 && await t5, !this.isUpdatePending;
|
|
5587
|
+
}
|
|
5588
|
+
scheduleUpdate() {
|
|
5589
|
+
return this.performUpdate();
|
|
5590
|
+
}
|
|
5591
|
+
performUpdate() {
|
|
5592
|
+
if (!this.isUpdatePending)
|
|
5593
|
+
return;
|
|
5594
|
+
if (!this.hasUpdated) {
|
|
5595
|
+
if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
|
|
5596
|
+
for (const [t7, s5] of this._$Ep)
|
|
5597
|
+
this[t7] = s5;
|
|
5598
|
+
this._$Ep = void 0;
|
|
5599
|
+
}
|
|
5600
|
+
const t6 = this.constructor.elementProperties;
|
|
5601
|
+
if (t6.size > 0)
|
|
5602
|
+
for (const [s5, i6] of t6)
|
|
5603
|
+
true !== i6.wrapped || this._$AL.has(s5) || void 0 === this[s5] || this.P(s5, this[s5], i6);
|
|
5604
|
+
}
|
|
5605
|
+
let t5 = false;
|
|
5606
|
+
const s4 = this._$AL;
|
|
5607
|
+
try {
|
|
5608
|
+
t5 = this.shouldUpdate(s4), t5 ? (this.willUpdate(s4), this._$EO?.forEach((t6) => t6.hostUpdate?.()), this.update(s4)) : this._$EU();
|
|
5609
|
+
} catch (s5) {
|
|
5610
|
+
throw t5 = false, this._$EU(), s5;
|
|
5611
|
+
}
|
|
5612
|
+
t5 && this._$AE(s4);
|
|
5613
|
+
}
|
|
5614
|
+
willUpdate(t5) {
|
|
5615
|
+
}
|
|
5616
|
+
_$AE(t5) {
|
|
5617
|
+
this._$EO?.forEach((t6) => t6.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t5)), this.updated(t5);
|
|
5618
|
+
}
|
|
5619
|
+
_$EU() {
|
|
5620
|
+
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false;
|
|
5621
|
+
}
|
|
5622
|
+
get updateComplete() {
|
|
5623
|
+
return this.getUpdateComplete();
|
|
5624
|
+
}
|
|
5625
|
+
getUpdateComplete() {
|
|
5626
|
+
return this._$ES;
|
|
5627
|
+
}
|
|
5628
|
+
shouldUpdate(t5) {
|
|
5629
|
+
return true;
|
|
5630
|
+
}
|
|
5631
|
+
update(t5) {
|
|
5632
|
+
this._$Ej &&= this._$Ej.forEach((t6) => this._$EC(t6, this[t6])), this._$EU();
|
|
5633
|
+
}
|
|
5634
|
+
updated(t5) {
|
|
5635
|
+
}
|
|
5636
|
+
firstUpdated(t5) {
|
|
5637
|
+
}
|
|
5638
|
+
};
|
|
5639
|
+
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");
|
|
5640
|
+
|
|
5641
|
+
// node_modules/@lit/reactive-element/decorators/property.js
|
|
5642
|
+
var o3 = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f };
|
|
5643
|
+
var r3 = (t5 = o3, e7, r7) => {
|
|
5644
|
+
const { kind: n6, metadata: i6 } = r7;
|
|
5645
|
+
let s4 = globalThis.litPropertyMetadata.get(i6);
|
|
5646
|
+
if (void 0 === s4 && globalThis.litPropertyMetadata.set(i6, s4 = /* @__PURE__ */ new Map()), s4.set(r7.name, t5), "accessor" === n6) {
|
|
5647
|
+
const { name: o6 } = r7;
|
|
5648
|
+
return { set(r8) {
|
|
5649
|
+
const n7 = e7.get.call(this);
|
|
5650
|
+
e7.set.call(this, r8), this.requestUpdate(o6, n7, t5);
|
|
5651
|
+
}, init(e8) {
|
|
5652
|
+
return void 0 !== e8 && this.P(o6, void 0, t5), e8;
|
|
5653
|
+
} };
|
|
5654
|
+
}
|
|
5655
|
+
if ("setter" === n6) {
|
|
5656
|
+
const { name: o6 } = r7;
|
|
5657
|
+
return function(r8) {
|
|
5658
|
+
const n7 = this[o6];
|
|
5659
|
+
e7.call(this, r8), this.requestUpdate(o6, n7, t5);
|
|
5660
|
+
};
|
|
5661
|
+
}
|
|
5662
|
+
throw Error("Unsupported decorator location: " + n6);
|
|
5663
|
+
};
|
|
5664
|
+
function n3(t5) {
|
|
5665
|
+
return (e7, o6) => "object" == typeof o6 ? r3(t5, e7, o6) : ((t6, e8, o7) => {
|
|
5666
|
+
const r7 = e8.hasOwnProperty(o7);
|
|
5667
|
+
return e8.constructor.createProperty(o7, r7 ? { ...t6, wrapped: true } : t6), r7 ? Object.getOwnPropertyDescriptor(e8, o7) : void 0;
|
|
5668
|
+
})(t5, e7, o6);
|
|
5669
|
+
}
|
|
5670
|
+
|
|
5671
|
+
// node_modules/@lit/reactive-element/decorators/state.js
|
|
5672
|
+
function r4(r7) {
|
|
5673
|
+
return n3({ ...r7, state: true, attribute: false });
|
|
5674
|
+
}
|
|
5675
|
+
|
|
5676
|
+
// node_modules/@lit/reactive-element/decorators/base.js
|
|
5677
|
+
var e3 = (e7, t5, c4) => (c4.configurable = true, c4.enumerable = true, Reflect.decorate && "object" != typeof t5 && Object.defineProperty(e7, t5, c4), c4);
|
|
5678
|
+
|
|
5679
|
+
// node_modules/@lit/reactive-element/decorators/query.js
|
|
5680
|
+
function e4(e7, r7) {
|
|
5681
|
+
return (n6, s4, i6) => {
|
|
5682
|
+
const o6 = (t5) => t5.renderRoot?.querySelector(e7) ?? null;
|
|
5683
|
+
if (r7) {
|
|
5684
|
+
const { get: e8, set: r8 } = "object" == typeof s4 ? n6 : i6 ?? (() => {
|
|
5685
|
+
const t5 = Symbol();
|
|
5686
|
+
return { get() {
|
|
5687
|
+
return this[t5];
|
|
5688
|
+
}, set(e9) {
|
|
5689
|
+
this[t5] = e9;
|
|
5690
|
+
} };
|
|
5691
|
+
})();
|
|
5692
|
+
return e3(n6, s4, { get() {
|
|
5693
|
+
let t5 = e8.call(this);
|
|
5694
|
+
return void 0 === t5 && (t5 = o6(this), (null !== t5 || this.hasUpdated) && r8.call(this, t5)), t5;
|
|
5695
|
+
} });
|
|
5696
|
+
}
|
|
5697
|
+
return e3(n6, s4, { get() {
|
|
5698
|
+
return o6(this);
|
|
5699
|
+
} });
|
|
5700
|
+
};
|
|
5701
|
+
}
|
|
5702
|
+
|
|
5632
5703
|
// node_modules/lit-html/lit-html.js
|
|
5633
5704
|
var t3 = globalThis;
|
|
5634
5705
|
var i3 = t3.trustedTypes;
|
|
@@ -5978,7 +6049,7 @@ var o5 = e6(class extends i4 {
|
|
|
5978
6049
|
});
|
|
5979
6050
|
|
|
5980
6051
|
// libs/embed-libs/embed/package.json
|
|
5981
|
-
var version = "6.0.0-beta.
|
|
6052
|
+
var version = "6.0.0-beta.2";
|
|
5982
6053
|
|
|
5983
6054
|
// libs/embed-libs/embed/src/lib/luzmo-service.ts
|
|
5984
6055
|
var LuzmoService = class {
|