@luzmo/embed 5.0.10 → 5.0.11

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.
@@ -42,1479 +42,1547 @@ var __decorateClass = (decorators, target, key, kind) => {
42
42
  // libs/embed-libs/embed/src/index.ts
43
43
  var src_exports2 = {};
44
44
  __export(src_exports2, {
45
- LuzmoDashboard: () => LuzmoDashboard,
46
- LuzmoDashboardWebComponent: () => LuzmoDashboardWebComponent
45
+ LuzmoDashboard: () => LuzmoDashboard2
47
46
  });
48
47
  module.exports = __toCommonJS(src_exports2);
49
48
 
50
- // libs/embed-libs/shared-embed/src/lib/helpers/error.ts
51
- var _handleError = (errorMessage, parameters) => {
52
- let message = "The dashboard component encountered an error";
53
- if (typeof parameters?.dashboardId === "string") {
54
- message += ` for dashboard with id ${parameters.dashboardId}`;
55
- }
56
- if (typeof parameters?.dashboardSlug === "string") {
57
- message += ` for dashboard with slug ${parameters.dashboardSlug}`;
58
- }
59
- if (typeof parameters?.container === "string") {
60
- message += ` in container ${parameters.container}`;
61
- }
62
- if (errorMessage) {
63
- message += `:
64
- ${errorMessage}`;
65
- console.error(message);
66
- }
49
+ // node_modules/@lit/reactive-element/decorators/custom-element.js
50
+ var t = (t5) => (e7, o6) => {
51
+ void 0 !== o6 ? o6.addInitializer(() => {
52
+ customElements.define(t5, e7);
53
+ }) : customElements.define(t5, e7);
67
54
  };
68
55
 
69
- // libs/embed-libs/shared-embed/src/lib/helpers/browser-check.ts
70
- var _browserCheck = (dashboardComponent) => {
71
- let hasError = false;
72
- let errorMessage = "";
73
- const document_ = document.body || document.documentElement;
74
- const style = document_.style;
75
- const browserCheck = {
76
- svg: !!("createElementNS" in document && document.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGRect),
77
- flexbox: style.webkitFlexWrap === "" || style.flexWrap === "",
78
- postMessage: !!window.postMessage
79
- };
80
- const browserCheckKeys = ["svg", "flexbox", "postMessage"];
81
- for (const key of browserCheckKeys) {
82
- if (!browserCheck[key]) {
83
- hasError = true;
84
- dashboardComponent.browserNotSupported = dashboardComponent.browserNotSupported || [];
85
- dashboardComponent.browserNotSupported.push(key);
86
- errorMessage += `Your browser does not support: ${key}
87
- `;
88
- }
56
+ // node_modules/@lit/reactive-element/css-tag.js
57
+ var t2 = globalThis;
58
+ var e = t2.ShadowRoot && (void 0 === t2.ShadyCSS || t2.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype;
59
+ var s = Symbol();
60
+ var o = /* @__PURE__ */ new WeakMap();
61
+ var n = class {
62
+ constructor(t5, e7, o6) {
63
+ if (this._$cssResult$ = true, o6 !== s)
64
+ throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
65
+ this.cssText = t5, this.t = e7;
89
66
  }
90
- const ua = window.navigator.userAgent;
91
- const msie = ua.includes("MSIE");
92
- const trident = ua.includes("Trident/");
93
- if (msie || trident) {
94
- hasError = true;
95
- errorMessage = "IE is not supported.";
67
+ get styleSheet() {
68
+ let t5 = this.o;
69
+ const s4 = this.t;
70
+ if (e && void 0 === t5) {
71
+ const e7 = void 0 !== s4 && 1 === s4.length;
72
+ e7 && (t5 = o.get(s4)), void 0 === t5 && ((this.o = t5 = new CSSStyleSheet()).replaceSync(this.cssText), e7 && o.set(s4, t5));
73
+ }
74
+ return t5;
96
75
  }
97
- if (hasError) {
98
- _handleError(errorMessage);
76
+ toString() {
77
+ return this.cssText;
99
78
  }
100
79
  };
101
-
102
- // libs/embed-libs/shared-embed/src/lib/helpers/default-parameters.ts
103
- var DEFAULT_PARAMETERS = {
104
- appServer: "https://app.luzmo.com/",
105
- apiHost: "https://api.luzmo.com/",
106
- dashboardId: null,
107
- dashboardSlug: null,
108
- container: null,
109
- key: null,
110
- token: null,
111
- language: "auto",
112
- qeVersion: null,
113
- editMode: null,
114
- screenMode: null,
115
- switchScreenModeOnResize: true,
116
- itemId: null,
117
- mainColor: "",
118
- accentColor: "",
119
- itemDimensions: {
120
- width: "auto",
121
- height: "auto"
122
- },
123
- loaderBackground: "#f9f9f9",
124
- loaderFontColor: "#5a5a5a",
125
- loaderSpinnerColor: "rgba(255, 165, 0, 0.7)",
126
- loaderSpinnerBackground: "rgba(169, 169, 169, 0.14)",
127
- timezoneId: null,
128
- contextId: null
80
+ var r = (t5) => new n("string" == typeof t5 ? t5 : t5 + "", void 0, s);
81
+ var i = (t5, ...e7) => {
82
+ const o6 = 1 === t5.length ? t5[0] : e7.reduce((e8, s4, o7) => e8 + ((t6) => {
83
+ if (true === t6._$cssResult$)
84
+ return t6.cssText;
85
+ if ("number" == typeof t6)
86
+ return t6;
87
+ 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.");
88
+ })(s4) + t5[o7 + 1], t5[0]);
89
+ return new n(o6, t5, s);
129
90
  };
130
-
131
- // libs/embed-libs/shared-embed/src/lib/helpers/extents.ts
132
- var EXTENTS = [
133
- { mode: "mobile", width: [150, 767] },
134
- { mode: "tablet", width: [768, 1199] },
135
- { mode: "desktop", width: [1200, 1599] },
136
- { mode: "largeScreen", width: [1600, 9999] },
137
- { mode: "fixed", width: [] }
138
- ];
139
-
140
- // libs/embed-libs/shared-embed/src/lib/helpers/translations.ts
141
- var TRANSLATIONS = {
142
- initializing: { en: "Initializing...", nl: "Laden...", fr: "Chargement..." },
143
- errorDashboard: {
144
- en: "Oops, we could not load this dashboard!",
145
- nl: "Oeps, we konden het dashboard niet laden.",
146
- fr: "Le chargement a echou\xE9."
147
- },
148
- errorItem: {
149
- en: "Oops, we could not load this item!",
150
- nl: "Oeps, we konden de grafiek niet laden.",
151
- fr: "Le chargement a echou\xE9."
152
- }
91
+ var S = (s4, o6) => {
92
+ if (e)
93
+ s4.adoptedStyleSheets = o6.map((t5) => t5 instanceof CSSStyleSheet ? t5 : t5.styleSheet);
94
+ else
95
+ for (const e7 of o6) {
96
+ const o7 = document.createElement("style"), n6 = t2.litNonce;
97
+ void 0 !== n6 && o7.setAttribute("nonce", n6), o7.textContent = e7.cssText, s4.appendChild(o7);
98
+ }
153
99
  };
154
- var translations_default = TRANSLATIONS;
100
+ var c = e ? (t5) => t5 : (t5) => t5 instanceof CSSStyleSheet ? ((t6) => {
101
+ let e7 = "";
102
+ for (const s4 of t6.cssRules)
103
+ e7 += s4.cssText;
104
+ return r(e7);
105
+ })(t5) : t5;
155
106
 
156
- // libs/embed-libs/shared-embed/src/lib/helpers/utils.ts
157
- var addTrailingSlash = (serverUrl) => {
158
- if (!serverUrl) {
159
- return "";
160
- }
161
- return serverUrl.endsWith("/") ? serverUrl : `${serverUrl}/`;
162
- };
163
- var removeTrailingSlash = (serverUrl) => {
164
- if (!serverUrl) {
165
- return "";
107
+ // node_modules/@lit/reactive-element/reactive-element.js
108
+ var { is: i2, defineProperty: e2, getOwnPropertyDescriptor: r2, getOwnPropertyNames: h, getOwnPropertySymbols: o2, getPrototypeOf: n2 } = Object;
109
+ var a = globalThis;
110
+ var c2 = a.trustedTypes;
111
+ var l = c2 ? c2.emptyScript : "";
112
+ var p = a.reactiveElementPolyfillSupport;
113
+ var d = (t5, s4) => t5;
114
+ var u = { toAttribute(t5, s4) {
115
+ switch (s4) {
116
+ case Boolean:
117
+ t5 = t5 ? l : null;
118
+ break;
119
+ case Object:
120
+ case Array:
121
+ t5 = null == t5 ? t5 : JSON.stringify(t5);
166
122
  }
167
- return serverUrl.endsWith("/") ? serverUrl.slice(0, -1) : serverUrl;
168
- };
169
- var formatDashboardList = (dashboards, integrationId, user, dashboardComponent) => {
170
- const combineRights = (securable, user2) => {
171
- const matchingUser = securable.users.find((u3) => u3.id === user2.id);
172
- const securableAccessRights = matchingUser && matchingUser.userAccessRight ? {
173
- flagRead: matchingUser.userAccessRight.flagRead,
174
- flagUse: matchingUser.userAccessRight.flagUse,
175
- flagModify: matchingUser.userAccessRight.flagModify,
176
- flagOwn: matchingUser.userAccessRight.flagOwn
177
- } : {
178
- flagRead: false,
179
- flagUse: false,
180
- flagModify: false,
181
- flagOwn: false
182
- };
183
- const groups = securable.groups.filter(
184
- (group) => user2.userGroups.includes(group.id) || group.public === true
185
- );
186
- const groupsAccess = groups.map((group) => {
187
- if (group.groupAccessRight) {
188
- return group.groupAccessRight;
189
- }
190
- });
191
- for (const groupAccess of groupsAccess) {
192
- if (!securableAccessRights.flagRead && groupAccess.flagRead) {
193
- securableAccessRights.flagRead = groupAccess.flagRead;
194
- }
195
- if (!securableAccessRights.flagUse && groupAccess.flagUse) {
196
- securableAccessRights.flagUse = groupAccess.flagUse;
197
- }
198
- if (!securableAccessRights.flagModify && groupAccess.flagModify) {
199
- securableAccessRights.flagModify = groupAccess.flagModify;
200
- }
201
- if (!securableAccessRights.flagOwn && groupAccess.flagOwn) {
202
- securableAccessRights.flagOwn = groupAccess.flagOwn;
203
- }
204
- }
205
- const integrationsAccess = securable.integrations?.length > 0 ? securable.integrations.map((integration) => {
206
- if (integration.integrationAccessRight) {
207
- return integration.integrationAccessRight;
208
- }
209
- }) : [];
210
- for (const integrationAccess of integrationsAccess) {
211
- if (!securableAccessRights.flagRead && integrationAccess.flagRead) {
212
- securableAccessRights.flagRead = integrationAccess.flagRead;
213
- }
214
- if (!securableAccessRights.flagUse && integrationAccess.flagUse) {
215
- securableAccessRights.flagUse = integrationAccess.flagUse;
216
- }
217
- if (!securableAccessRights.flagModify && integrationAccess.flagModify) {
218
- securableAccessRights.flagModify = integrationAccess.flagModify;
123
+ return t5;
124
+ }, fromAttribute(t5, s4) {
125
+ let i6 = t5;
126
+ switch (s4) {
127
+ case Boolean:
128
+ i6 = null !== t5;
129
+ break;
130
+ case Number:
131
+ i6 = null === t5 ? null : Number(t5);
132
+ break;
133
+ case Object:
134
+ case Array:
135
+ try {
136
+ i6 = JSON.parse(t5);
137
+ } catch (t6) {
138
+ i6 = null;
219
139
  }
140
+ }
141
+ return i6;
142
+ } };
143
+ var f = (t5, s4) => !i2(t5, s4);
144
+ var y = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f };
145
+ Symbol.metadata ??= Symbol("metadata"), a.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
146
+ var b = class extends HTMLElement {
147
+ static addInitializer(t5) {
148
+ this._$Ei(), (this.l ??= []).push(t5);
149
+ }
150
+ static get observedAttributes() {
151
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
152
+ }
153
+ static createProperty(t5, s4 = y) {
154
+ if (s4.state && (s4.attribute = false), this._$Ei(), this.elementProperties.set(t5, s4), !s4.noAccessor) {
155
+ const i6 = Symbol(), r7 = this.getPropertyDescriptor(t5, i6, s4);
156
+ void 0 !== r7 && e2(this.prototype, t5, r7);
220
157
  }
221
- return securableAccessRights;
222
- };
223
- const localize = (item, locale) => {
224
- if (item === null || item === void 0) {
225
- return "";
226
- }
227
- if (typeof item !== "object" || Object.keys(item).length === 0) {
228
- if (typeof item === "object" && Object.keys(item).length === 0) {
229
- return "";
230
- }
231
- return item;
158
+ }
159
+ static getPropertyDescriptor(t5, s4, i6) {
160
+ const { get: e7, set: h3 } = r2(this.prototype, t5) ?? { get() {
161
+ return this[s4];
162
+ }, set(t6) {
163
+ this[s4] = t6;
164
+ } };
165
+ return { get() {
166
+ return e7?.call(this);
167
+ }, set(s5) {
168
+ const r7 = e7?.call(this);
169
+ h3.call(this, s5), this.requestUpdate(t5, r7, i6);
170
+ }, configurable: true, enumerable: true };
171
+ }
172
+ static getPropertyOptions(t5) {
173
+ return this.elementProperties.get(t5) ?? y;
174
+ }
175
+ static _$Ei() {
176
+ if (this.hasOwnProperty(d("elementProperties")))
177
+ return;
178
+ const t5 = n2(this);
179
+ t5.finalize(), void 0 !== t5.l && (this.l = [...t5.l]), this.elementProperties = new Map(t5.elementProperties);
180
+ }
181
+ static finalize() {
182
+ if (this.hasOwnProperty(d("finalized")))
183
+ return;
184
+ if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d("properties"))) {
185
+ const t6 = this.properties, s4 = [...h(t6), ...o2(t6)];
186
+ for (const i6 of s4)
187
+ this.createProperty(i6, t6[i6]);
232
188
  }
233
- let localizedItem;
234
- localizedItem = locale && item[locale] ? item[locale] : item[Object.keys(item)[0]];
235
- if (localizedItem === void 0 || localizedItem === null) {
236
- localizedItem = "";
189
+ const t5 = this[Symbol.metadata];
190
+ if (null !== t5) {
191
+ const s4 = litPropertyMetadata.get(t5);
192
+ if (void 0 !== s4)
193
+ for (const [t6, i6] of s4)
194
+ this.elementProperties.set(t6, i6);
237
195
  }
238
- return localizedItem;
239
- };
240
- const treatedDashboards = [];
241
- for (const dashboard of dashboards) {
242
- const treatedDashboard = {
243
- accessibleBy: [],
244
- accessRights: combineRights(dashboard, user),
245
- id: dashboard.id,
246
- modifiedAt: dashboard.modified_at,
247
- name: localize(dashboard.name, dashboardComponent.language),
248
- slug: null,
249
- tags: dashboard.tags.map((t5) => t5.tag).sort((t1, t22) => t1.localeCompare(t22))
250
- };
251
- const currentIntegration = dashboard.integrations.find(
252
- (i6) => i6.id === integrationId
253
- );
254
- if (currentIntegration?.integrationAccessRight?.slug) {
255
- treatedDashboard.slug = currentIntegration.integrationAccessRight.slug;
196
+ this._$Eh = /* @__PURE__ */ new Map();
197
+ for (const [t6, s4] of this.elementProperties) {
198
+ const i6 = this._$Eu(t6, s4);
199
+ void 0 !== i6 && this._$Eh.set(i6, t6);
256
200
  }
257
- const users = dashboard.users.map((u3) => ({
258
- model: "User",
259
- id: u3.id,
260
- name: localize(u3.name, user.locale_id)
261
- }));
262
- const groups = dashboard.groups.map((g2) => ({
263
- model: "Group",
264
- id: g2.id,
265
- name: localize(g2.name, user.locale_id) || {}
266
- }));
267
- const integrations = dashboard.integrations.map((i6) => ({
268
- model: "Integration",
269
- id: i6.id,
270
- name: localize(i6.name, user.locale_id) || {}
271
- }));
272
- treatedDashboard.accessibleBy = [...users, ...groups, ...integrations];
273
- treatedDashboards.push(treatedDashboard);
201
+ this.elementStyles = this.finalizeStyles(this.styles);
274
202
  }
275
- return treatedDashboards;
276
- };
277
- var VERSION = "0.0.0-shared-luzmo";
278
- var sanitizeUrl = (url) => {
279
- const invalidPrototcolRegex = /^(%20|\s)*(javascript|data)/im;
280
- const ctrlCharactersRegex = /[^\u0020-\u007E]/gim;
281
- const urlSchemeRegex = /^([^:]+):/gm;
282
- const relativeFirstCharacters = /* @__PURE__ */ new Set([".", "/"]);
283
- const isRelativeUrlWithoutProtocol = (relativeUrl) => relativeFirstCharacters.has(relativeUrl[0]);
284
- if (!url) {
285
- return "about:blank";
203
+ static finalizeStyles(s4) {
204
+ const i6 = [];
205
+ if (Array.isArray(s4)) {
206
+ const e7 = new Set(s4.flat(1 / 0).reverse());
207
+ for (const s5 of e7)
208
+ i6.unshift(c(s5));
209
+ } else
210
+ void 0 !== s4 && i6.push(c(s4));
211
+ return i6;
286
212
  }
287
- const sanitizedUrl = url.replaceAll(ctrlCharactersRegex, "").trim();
288
- if (isRelativeUrlWithoutProtocol(sanitizedUrl)) {
289
- return sanitizedUrl;
213
+ static _$Eu(t5, s4) {
214
+ const i6 = s4.attribute;
215
+ return false === i6 ? void 0 : "string" == typeof i6 ? i6 : "string" == typeof t5 ? t5.toLowerCase() : void 0;
290
216
  }
291
- const urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex);
292
- if (!urlSchemeParseResults) {
293
- return sanitizedUrl;
217
+ constructor() {
218
+ super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
294
219
  }
295
- const urlScheme = urlSchemeParseResults[0];
296
- if (invalidPrototcolRegex.test(urlScheme)) {
297
- return "about:blank";
220
+ _$Ev() {
221
+ this._$ES = new Promise((t5) => this.enableUpdating = t5), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((t5) => t5(this));
298
222
  }
299
- return sanitizedUrl;
300
- };
301
- var cloneDeep = (obj) => JSON.parse(JSON.stringify(obj));
302
- var isObject = (o6) => o6 && typeof o6 === "object";
303
- var defaultsDeep = (target, defaults) => {
304
- Object.entries(defaults).forEach(([k2, v2]) => {
305
- if (k2 in target) {
306
- if (target[k2] === void 0) {
307
- target[k2] = v2;
308
- } else {
309
- target[k2] = isObject(v2) ? defaultsDeep(
310
- target[k2],
311
- v2
312
- ) : target[k2];
313
- }
314
- } else {
315
- target[k2] = v2;
316
- }
317
- });
318
- return target;
319
- };
320
- var uuidv4 = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g, function(c4) {
321
- const r7 = Math.random() * 16 | 0;
322
- const v2 = c4 == "x" ? r7 : r7 & 3 | 8;
323
- return v2.toString(16);
324
- });
325
-
326
- // libs/embed-libs/shared-embed/src/lib/helpers/iframe-url.ts
327
- var createIframeUrl = (dashboardContent) => {
328
- const searchString = [];
329
- const {
330
- appServer,
331
- language,
332
- qeVersion,
333
- loaderBackground,
334
- loaderSpinnerColor,
335
- loaderSpinnerBackground,
336
- loaderFontColor,
337
- screenMode,
338
- key,
339
- token,
340
- timezoneId,
341
- itemEmbedding,
342
- itemDimensions,
343
- dashboardId,
344
- dashboardSlug,
345
- itemId,
346
- mainColor,
347
- accentColor,
348
- editMode
349
- } = dashboardContent.params;
350
- if (language && language !== "auto") {
351
- searchString.push("language=" + language);
223
+ addController(t5) {
224
+ (this._$EO ??= /* @__PURE__ */ new Set()).add(t5), void 0 !== this.renderRoot && this.isConnected && t5.hostConnected?.();
352
225
  }
353
- if (qeVersion) {
354
- searchString.push(`qe_version=${qeVersion}`);
226
+ removeController(t5) {
227
+ this._$EO?.delete(t5);
355
228
  }
356
- if (loaderBackground) {
357
- searchString.push(`ldrbg=${loaderBackground}`);
229
+ _$E_() {
230
+ const t5 = /* @__PURE__ */ new Map(), s4 = this.constructor.elementProperties;
231
+ for (const i6 of s4.keys())
232
+ this.hasOwnProperty(i6) && (t5.set(i6, this[i6]), delete this[i6]);
233
+ t5.size > 0 && (this._$Ep = t5);
358
234
  }
359
- if (loaderFontColor) {
360
- searchString.push(`ldrftclr=${loaderFontColor}`);
235
+ createRenderRoot() {
236
+ const t5 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
237
+ return S(t5, this.constructor.elementStyles), t5;
361
238
  }
362
- if (loaderSpinnerColor) {
363
- searchString.push(`ldrspclr=${loaderSpinnerColor}`);
239
+ connectedCallback() {
240
+ this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach((t5) => t5.hostConnected?.());
364
241
  }
365
- if (loaderSpinnerBackground) {
366
- searchString.push(`ldrspbg=${loaderSpinnerBackground}`);
242
+ enableUpdating(t5) {
367
243
  }
368
- if (mainColor) {
369
- searchString.push(`mainColor=${mainColor}`);
244
+ disconnectedCallback() {
245
+ this._$EO?.forEach((t5) => t5.hostDisconnected?.());
370
246
  }
371
- if (accentColor) {
372
- searchString.push(`accentColor=${accentColor}`);
247
+ attributeChangedCallback(t5, s4, i6) {
248
+ this._$AK(t5, i6);
373
249
  }
374
- if (screenMode && screenMode !== "auto") {
375
- searchString.push("screenMode=" + screenMode);
250
+ _$EC(t5, s4) {
251
+ const i6 = this.constructor.elementProperties.get(t5), e7 = this.constructor._$Eu(t5, i6);
252
+ if (void 0 !== e7 && true === i6.reflect) {
253
+ const r7 = (void 0 !== i6.converter?.toAttribute ? i6.converter : u).toAttribute(s4, i6.type);
254
+ this._$Em = t5, null == r7 ? this.removeAttribute(e7) : this.setAttribute(e7, r7), this._$Em = null;
255
+ }
376
256
  }
377
- if (timezoneId) {
378
- searchString.push("timezoneId=" + timezoneId);
257
+ _$AK(t5, s4) {
258
+ const i6 = this.constructor, e7 = i6._$Eh.get(t5);
259
+ if (void 0 !== e7 && this._$Em !== e7) {
260
+ const t6 = i6.getPropertyOptions(e7), r7 = "function" == typeof t6.converter ? { fromAttribute: t6.converter } : void 0 !== t6.converter?.fromAttribute ? t6.converter : u;
261
+ this._$Em = e7, this[e7] = r7.fromAttribute(s4, t6.type), this._$Em = null;
262
+ }
379
263
  }
380
- if (itemEmbedding && itemDimensions && itemDimensions.width) {
381
- searchString.push("width=" + itemDimensions.width);
264
+ requestUpdate(t5, s4, i6) {
265
+ if (void 0 !== t5) {
266
+ if (i6 ??= this.constructor.getPropertyOptions(t5), !(i6.hasChanged ?? f)(this[t5], s4))
267
+ return;
268
+ this.P(t5, s4, i6);
269
+ }
270
+ false === this.isUpdatePending && (this._$ES = this._$ET());
382
271
  }
383
- if (itemEmbedding && itemDimensions && itemDimensions.height) {
384
- searchString.push("height=" + itemDimensions.height);
272
+ P(t5, s4, i6) {
273
+ this._$AL.has(t5) || this._$AL.set(t5, s4), true === i6.reflect && this._$Em !== t5 && (this._$Ej ??= /* @__PURE__ */ new Set()).add(t5);
385
274
  }
386
- if (editMode) {
387
- searchString.push("editMode=" + editMode);
275
+ async _$ET() {
276
+ this.isUpdatePending = true;
277
+ try {
278
+ await this._$ES;
279
+ } catch (t6) {
280
+ Promise.reject(t6);
281
+ }
282
+ const t5 = this.scheduleUpdate();
283
+ return null != t5 && await t5, !this.isUpdatePending;
388
284
  }
389
- const keyTokenUrlAnchor = key && token ? "#" + key + ":" + token : "";
390
- searchString.push("version=" + (dashboardContent.VERSION || VERSION));
391
- const iframeUrl = itemEmbedding ? `${appServer}i/${dashboardId || dashboardSlug}/${itemId}?${encodeURIComponent(
392
- searchString.join("&")
393
- )}${keyTokenUrlAnchor}` : `${appServer}i/${dashboardId || dashboardSlug}?${encodeURIComponent(
394
- searchString.join("&")
395
- )}${keyTokenUrlAnchor}`;
396
- return sanitizeUrl(iframeUrl);
397
- };
398
-
399
- // libs/embed-libs/shared-embed/src/lib/helpers/get-loader.ts
400
- var getLoader = (dashboardComponent) => {
401
- let errorMsg;
402
- if (dashboardComponent.params.error || dashboardComponent.browserNotSupported.length > 0) {
403
- dashboardComponent.params.error = true;
404
- if (dashboardComponent.browserNotSupported) {
405
- errorMsg = "Browser is not supported.";
285
+ scheduleUpdate() {
286
+ return this.performUpdate();
287
+ }
288
+ performUpdate() {
289
+ if (!this.isUpdatePending)
290
+ return;
291
+ if (!this.hasUpdated) {
292
+ if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
293
+ for (const [t7, s5] of this._$Ep)
294
+ this[t7] = s5;
295
+ this._$Ep = void 0;
296
+ }
297
+ const t6 = this.constructor.elementProperties;
298
+ if (t6.size > 0)
299
+ for (const [s5, i6] of t6)
300
+ true !== i6.wrapped || this._$AL.has(s5) || void 0 === this[s5] || this.P(s5, this[s5], i6);
301
+ }
302
+ let t5 = false;
303
+ const s4 = this._$AL;
304
+ try {
305
+ t5 = this.shouldUpdate(s4), t5 ? (this.willUpdate(s4), this._$EO?.forEach((t6) => t6.hostUpdate?.()), this.update(s4)) : this._$EU();
306
+ } catch (s5) {
307
+ throw t5 = false, this._$EU(), s5;
406
308
  }
309
+ t5 && this._$AE(s4);
407
310
  }
408
- const loadingMsg = translations_default.initializing[dashboardComponent.params.language] || translations_default.initializing.en;
409
- return dashboardComponent.browserNotSupported || dashboardComponent.params.error ? { loadingMsg, errorMsg } : { loadingMsg, errorMsg: "" };
410
- };
411
-
412
- // libs/embed-libs/shared-embed/src/lib/helpers/promise-dispatch.ts
413
- function resolvePromise(dashboardComponent, requestId, data) {
414
- if (dashboardComponent.promises[requestId]) {
415
- dashboardComponent.promises[requestId].resolve(data);
416
- delete dashboardComponent.promises[requestId];
311
+ willUpdate(t5) {
417
312
  }
418
- }
419
- function rejectPromise(dashboardComponent, requestId, data) {
420
- if (dashboardComponent.promises[requestId]) {
421
- dashboardComponent.promises[requestId].reject(data);
422
- delete dashboardComponent.promises[requestId];
313
+ _$AE(t5) {
314
+ this._$EO?.forEach((t6) => t6.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t5)), this.updated(t5);
423
315
  }
424
- }
316
+ _$EU() {
317
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false;
318
+ }
319
+ get updateComplete() {
320
+ return this.getUpdateComplete();
321
+ }
322
+ getUpdateComplete() {
323
+ return this._$ES;
324
+ }
325
+ shouldUpdate(t5) {
326
+ return true;
327
+ }
328
+ update(t5) {
329
+ this._$Ej &&= this._$Ej.forEach((t6) => this._$EC(t6, this[t6])), this._$EU();
330
+ }
331
+ updated(t5) {
332
+ }
333
+ firstUpdated(t5) {
334
+ }
335
+ };
336
+ 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");
425
337
 
426
- // libs/embed-libs/shared-embed/src/lib/helpers/styles.ts
427
- function containerStyles(dashboardComponent) {
428
- const styles = {};
429
- if (dashboardComponent.params.loaderBackground && !dashboardComponent.iframeLoaded) {
430
- styles.background = dashboardComponent.params.loaderBackground;
338
+ // node_modules/@lit/reactive-element/decorators/property.js
339
+ var o3 = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f };
340
+ var r3 = (t5 = o3, e7, r7) => {
341
+ const { kind: n6, metadata: i6 } = r7;
342
+ let s4 = globalThis.litPropertyMetadata.get(i6);
343
+ if (void 0 === s4 && globalThis.litPropertyMetadata.set(i6, s4 = /* @__PURE__ */ new Map()), s4.set(r7.name, t5), "accessor" === n6) {
344
+ const { name: o6 } = r7;
345
+ return { set(r8) {
346
+ const n7 = e7.get.call(this);
347
+ e7.set.call(this, r8), this.requestUpdate(o6, n7, t5);
348
+ }, init(e8) {
349
+ return void 0 !== e8 && this.P(o6, void 0, t5), e8;
350
+ } };
431
351
  }
432
- return styles;
433
- }
434
- function containerLoaderStyles(dashboardComponent) {
435
- const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
436
- const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
437
- const display = dashboardComponent.iframeLoaded ? "none" : "";
438
- return {
439
- display,
440
- height: `${chartHeightDefined ? height : dashboardComponent.minHeight}px`
441
- };
442
- }
443
- function loaderStyles(dashboardComponent) {
444
- const background = dashboardComponent.params.loaderBackground || DEFAULT_PARAMETERS.loaderBackground;
445
- if (dashboardComponent.params.itemEmbedding) {
446
- dashboardComponent.loaderSize = 24;
447
- dashboardComponent.borderWidth = 4;
448
- dashboardComponent.minHeight = 200;
449
- const width = dashboardComponent.params.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
450
- const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
451
- const chartWidthDefined = width !== "auto";
452
- const chartHeightDefined = height !== "auto";
453
- return {
454
- background,
455
- width: chartWidthDefined ? `${width}px` : "100%",
456
- height: `${chartHeightDefined ? height : "200"}px`,
457
- "min-height": chartHeightDefined ? "" : "200px"
352
+ if ("setter" === n6) {
353
+ const { name: o6 } = r7;
354
+ return function(r8) {
355
+ const n7 = this[o6];
356
+ e7.call(this, r8), this.requestUpdate(o6, n7, t5);
458
357
  };
459
358
  }
460
- return {
461
- background
462
- };
359
+ throw Error("Unsupported decorator location: " + n6);
360
+ };
361
+ function n3(t5) {
362
+ return (e7, o6) => "object" == typeof o6 ? r3(t5, e7, o6) : ((t6, e8, o7) => {
363
+ const r7 = e8.hasOwnProperty(o7);
364
+ return e8.constructor.createProperty(o7, r7 ? { ...t6, wrapped: true } : t6), r7 ? Object.getOwnPropertyDescriptor(e8, o7) : void 0;
365
+ })(t5, e7, o6);
463
366
  }
464
- function plStyles(dashboardComponent) {
465
- const {
466
- loaderSpinnerColor: defaultSpinnerColor,
467
- loaderSpinnerBackground: defaultSpinnerBackground
468
- } = DEFAULT_PARAMETERS;
469
- const spinnerColorBorder = generateBorderStyle(
470
- dashboardComponent.borderWidth,
471
- dashboardComponent.params.loaderSpinnerColor || defaultSpinnerColor
472
- );
473
- const spinnerBackgroundBorder = generateBorderStyle(
474
- dashboardComponent.borderWidth,
475
- dashboardComponent.params.loaderSpinnerBackground || defaultSpinnerBackground
476
- );
477
- const size = `${dashboardComponent.loaderSize}px`;
478
- return {
479
- "border-top": spinnerColorBorder,
480
- "border-right": spinnerColorBorder,
481
- "border-bottom": spinnerBackgroundBorder,
482
- "border-left": spinnerBackgroundBorder,
483
- width: size,
484
- height: size
485
- };
367
+
368
+ // node_modules/@lit/reactive-element/decorators/state.js
369
+ function r4(r7) {
370
+ return n3({ ...r7, state: true, attribute: false });
486
371
  }
487
- function lcStyles(dashboardComponent) {
488
- const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
489
- const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
490
- const getPaddingStr = (value) => `${(value - dashboardComponent.loaderSize - 32) / 2}px`;
491
- const verticalPadding = dashboardComponent.params.itemId ? chartHeightDefined ? getPaddingStr(Number.parseInt(`${height}`, 10)) : getPaddingStr(dashboardComponent.minHeight) : "128px";
492
- return {
493
- padding: `${verticalPadding} 16px`
372
+
373
+ // node_modules/@lit/reactive-element/decorators/base.js
374
+ var e3 = (e7, t5, c4) => (c4.configurable = true, c4.enumerable = true, Reflect.decorate && "object" != typeof t5 && Object.defineProperty(e7, t5, c4), c4);
375
+
376
+ // node_modules/@lit/reactive-element/decorators/query.js
377
+ function e4(e7, r7) {
378
+ return (n6, s4, i6) => {
379
+ const o6 = (t5) => t5.renderRoot?.querySelector(e7) ?? null;
380
+ if (r7) {
381
+ const { get: e8, set: r8 } = "object" == typeof s4 ? n6 : i6 ?? (() => {
382
+ const t5 = Symbol();
383
+ return { get() {
384
+ return this[t5];
385
+ }, set(e9) {
386
+ this[t5] = e9;
387
+ } };
388
+ })();
389
+ return e3(n6, s4, { get() {
390
+ let t5 = e8.call(this);
391
+ return void 0 === t5 && (t5 = o6(this), (null !== t5 || this.hasUpdated) && r8.call(this, t5)), t5;
392
+ } });
393
+ }
394
+ return e3(n6, s4, { get() {
395
+ return o6(this);
396
+ } });
494
397
  };
495
398
  }
496
- function calculateIframeStyles(dashboardComponent) {
497
- const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
498
- const width = dashboardComponent.params.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
499
- if (dashboardComponent.params.itemEmbedding && height !== "auto") {
500
- dashboardComponent.iframeHeight = `${height}px`;
501
- } else if (dashboardComponent.params.itemEmbedding) {
502
- dashboardComponent.iframeHeight = "200px";
503
- } else if (["editFull", "editLimited"].includes(dashboardComponent.params.editMode)) {
504
- dashboardComponent.iframeHeight = "100%";
505
- } else {
506
- dashboardComponent.iframeHeight = "400px";
399
+
400
+ // libs/embed-libs/shared-embed/src/lib/helpers/error.ts
401
+ var _handleError = (errorMessage, parameters) => {
402
+ let message = "The dashboard component encountered an error";
403
+ if (typeof parameters?.dashboardId === "string") {
404
+ message += ` for dashboard with id ${parameters.dashboardId}`;
507
405
  }
508
- dashboardComponent.iframeWidth = dashboardComponent.params.itemEmbedding && width !== "auto" ? `${width}px` : "100%";
509
- const styles = {
510
- height: dashboardComponent.iframeHeight,
511
- width: dashboardComponent.iframeWidth
512
- };
513
- if (dashboardComponent.iframeLoaded) {
514
- styles.opacity = 1;
515
- } else if (dashboardComponent.error) {
516
- styles.opacity = 1;
517
- styles.width = "100%";
518
- styles.height = "400px";
519
- } else {
520
- styles.opacity = 0;
406
+ if (typeof parameters?.dashboardSlug === "string") {
407
+ message += ` for dashboard with slug ${parameters.dashboardSlug}`;
521
408
  }
522
- return styles;
523
- }
524
- function generateBorderStyle(borderWidth, color) {
525
- return `${borderWidth}px solid ${color}`;
526
- }
527
-
528
- // libs/embed-libs/shared-embed/src/lib/helpers/update-iframe-url.ts
529
- var updateIframeUrl = (iframe, iframeUrl) => {
530
- if (iframe?.contentWindow) {
531
- iframe.contentWindow.location.replace(iframeUrl);
409
+ if (typeof parameters?.container === "string") {
410
+ message += ` in container ${parameters.container}`;
411
+ }
412
+ if (errorMessage) {
413
+ message += `:
414
+ ${errorMessage}`;
415
+ console.error(message);
532
416
  }
533
417
  };
534
418
 
535
- // libs/embed-libs/shared-embed/src/lib/methods/export-dashboard.ts
536
- var exportDashboard = (dashboardComponent, iframe, format) => {
537
- const requestId = uuidv4();
538
- if (iframe?.contentWindow) {
539
- iframe.contentWindow.postMessage(
540
- {
541
- action: "exportDashboard",
542
- format: format || "png",
543
- _version: dashboardComponent.VERSION,
544
- requestId
545
- },
546
- "*"
547
- );
548
- return new Promise((resolve, reject) => {
549
- dashboardComponent.promises[requestId] = { resolve, reject };
550
- setTimeout(() => {
551
- if (dashboardComponent.promises[requestId]) {
552
- const errorMessage = "exportDashboard request timed out.";
553
- dashboardComponent.promises[requestId].reject(
554
- new Error(errorMessage)
555
- );
556
- delete dashboardComponent.promises[requestId];
557
- }
558
- }, 12e5);
559
- });
560
- }
561
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
562
- };
563
-
564
- // libs/embed-libs/shared-embed/src/lib/methods/get-accessible-dashboards.ts
565
- var getAccessibleDashboards = (dashboardComponent, iframe) => {
566
- if ((dashboardComponent.dashboardId || dashboardComponent.dashboardSlug) && iframe?.contentWindow) {
567
- const requestId = uuidv4();
568
- iframe.contentWindow.postMessage(
569
- {
570
- action: "getAccessibleDashboards",
571
- _version: dashboardComponent.VERSION,
572
- requestId
573
- },
574
- "*"
575
- );
576
- return new Promise((resolve, reject) => {
577
- dashboardComponent.promises[requestId] = { resolve, reject };
578
- setTimeout(() => {
579
- if (dashboardComponent.promises[requestId]) {
580
- const errorMessage = "getAccessibleDashboards request timed out.";
581
- dashboardComponent.promises[requestId].reject(
582
- new Error(errorMessage)
583
- );
584
- delete dashboardComponent.promises[requestId];
585
- }
586
- }, 2e3);
587
- });
588
- }
589
- const fetchUser = new Promise((resolve, reject) => {
590
- void (() => {
591
- try {
592
- const responsePromise = window.fetch(
593
- `${String(dashboardComponent.params.apiHost)}0.1.0/authorization`,
594
- {
595
- method: "POST",
596
- mode: "cors",
597
- cache: "no-cache",
598
- headers: { "Content-Type": "application/json" },
599
- redirect: "follow",
600
- body: JSON.stringify({
601
- action: "get",
602
- version: "0.1.0",
603
- key: dashboardComponent.authKey,
604
- token: dashboardComponent.authToken,
605
- find: {
606
- where: { id: dashboardComponent.authKey },
607
- attributes: ["id", "integration_id"],
608
- include: [
609
- {
610
- model: "User",
611
- attributes: ["id", "name", "locale_id"],
612
- include: [{ model: "Group" }]
613
- }
614
- ]
615
- }
616
- })
617
- }
618
- );
619
- responsePromise.then((response) => response.json()).then((data) => {
620
- if (!data || !data.rows || data.rows.length === 0 || !data.rows[0].user || !data.rows[0].integration_id) {
621
- reject();
622
- } else {
623
- data.rows[0].user.userGroups = data.rows[0].user.groups.map(
624
- (group) => group.id
625
- );
626
- delete data.rows[0].user.groups;
627
- resolve({
628
- integrationId: data.rows[0].integration_id,
629
- user: data.rows[0].user
630
- });
631
- }
632
- });
633
- } catch (error) {
634
- reject(error);
635
- }
636
- })();
637
- });
638
- return new Promise((resolve, reject) => void (() => {
639
- try {
640
- fetchUser.then((authorizationData) => {
641
- const responsePromise = window.fetch(
642
- `${String(dashboardComponent.params.apiHost)}0.1.0/securable`,
643
- {
644
- method: "POST",
645
- mode: "cors",
646
- cache: "no-cache",
647
- headers: { "Content-Type": "application/json" },
648
- redirect: "follow",
649
- body: JSON.stringify({
650
- action: "get",
651
- version: "0.1.0",
652
- key: dashboardComponent.authKey,
653
- token: dashboardComponent.authToken,
654
- find: {
655
- where: { type: "dashboard", is_variant: false },
656
- attributes: ["id", "name", "modified_at"],
657
- order: [["modified_at", "desc"]],
658
- include: [
659
- { model: "Tag", attributes: ["tag"] },
660
- { model: "User", attributes: ["id", "name"] },
661
- {
662
- model: "Group",
663
- attributes: ["id", "name", "public"]
664
- },
665
- { model: "Integration", attributes: ["id", "name"] }
666
- ]
667
- }
668
- })
669
- }
670
- );
671
- responsePromise.then((response) => response.json()).then((data) => {
672
- const dashboardList = data.rows.length > 0 ? formatDashboardList(
673
- data.rows,
674
- authorizationData.integrationId,
675
- authorizationData.user,
676
- dashboardComponent
677
- ) : [];
678
- resolve(dashboardList);
679
- });
680
- }).catch((error) => {
681
- reject(error);
682
- });
683
- } catch (error) {
684
- reject(error);
419
+ // libs/embed-libs/shared-embed/src/lib/helpers/browser-check.ts
420
+ var _browserCheck = (dashboardComponent) => {
421
+ let hasError = false;
422
+ let errorMessage = "";
423
+ const document_ = document.body || document.documentElement;
424
+ const style = document_.style;
425
+ const browserCheck = {
426
+ svg: !!("createElementNS" in document && document.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGRect),
427
+ flexbox: style.webkitFlexWrap === "" || style.flexWrap === "",
428
+ postMessage: !!window.postMessage
429
+ };
430
+ const browserCheckKeys = ["svg", "flexbox", "postMessage"];
431
+ for (const key of browserCheckKeys) {
432
+ if (!browserCheck[key]) {
433
+ hasError = true;
434
+ dashboardComponent.browserNotSupported = dashboardComponent.browserNotSupported || [];
435
+ dashboardComponent.browserNotSupported.push(key);
436
+ errorMessage += `Your browser does not support: ${key}
437
+ `;
685
438
  }
686
- })());
687
- };
688
-
689
- // libs/embed-libs/shared-embed/src/lib/methods/get-data.ts
690
- var getData = (dashboardComponent, iframe, itemId) => {
691
- if (iframe?.contentWindow) {
692
- const requestId = uuidv4();
693
- iframe.contentWindow.postMessage(
694
- {
695
- action: "getData",
696
- id: itemId,
697
- _version: dashboardComponent.VERSION,
698
- requestId
699
- },
700
- "*"
701
- );
702
- return new Promise((resolve, reject) => {
703
- dashboardComponent.promises[requestId] = { resolve, reject };
704
- setTimeout(() => {
705
- if (dashboardComponent.promises[requestId]) {
706
- const errorMessage = "getData request timed out.";
707
- dashboardComponent.promises[requestId].reject(
708
- new Error(errorMessage)
709
- );
710
- delete dashboardComponent.promises[requestId];
711
- }
712
- }, 2e3);
713
- });
714
439
  }
715
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
716
- };
717
-
718
- // libs/embed-libs/shared-embed/src/lib/methods/get-filters.ts
719
- var getFilters = (dashboardComponent, iframe) => {
720
- if (iframe?.contentWindow) {
721
- const requestId = uuidv4();
722
- iframe.contentWindow.postMessage(
723
- { action: "getFilters", _version: dashboardComponent.VERSION, requestId },
724
- "*"
725
- );
726
- return new Promise((resolve, reject) => {
727
- dashboardComponent.promises[requestId] = { resolve, reject };
728
- setTimeout(() => {
729
- if (dashboardComponent.promises[requestId]) {
730
- const errorMessage = "getFilters request timed out.";
731
- dashboardComponent.promises[requestId].reject(
732
- new Error(errorMessage)
733
- );
734
- delete dashboardComponent.promises[requestId];
735
- }
736
- }, 2e3);
737
- });
440
+ const ua = window.navigator.userAgent;
441
+ const msie = ua.includes("MSIE");
442
+ const trident = ua.includes("Trident/");
443
+ if (msie || trident) {
444
+ hasError = true;
445
+ errorMessage = "IE is not supported.";
738
446
  }
739
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
740
- };
741
-
742
- // libs/embed-libs/shared-embed/src/lib/methods/refresh-data.ts
743
- var refreshData = (dashboardComponent, iframe, itemId) => {
744
- if (iframe) {
745
- iframe.contentWindow.postMessage(
746
- {
747
- action: "refreshData",
748
- id: itemId ?? null,
749
- _version: dashboardComponent.VERSION
750
- },
751
- "*"
752
- );
753
- return Promise.resolve();
447
+ if (hasError) {
448
+ _handleError(errorMessage);
754
449
  }
755
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
756
450
  };
757
451
 
758
- // libs/embed-libs/shared-embed/src/lib/methods/reload-dashboard.ts
759
- var reloadDashboard = (dashboardComponent, iframe) => {
760
- if (iframe) {
761
- iframe.contentWindow.postMessage(
762
- { action: "reloadDashboard", _version: dashboardComponent.VERSION },
763
- "*"
764
- );
765
- return Promise.resolve();
766
- }
767
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
452
+ // libs/embed-libs/shared-embed/src/lib/helpers/default-parameters.ts
453
+ var DEFAULT_PARAMETERS = {
454
+ appServer: "https://app.luzmo.com/",
455
+ apiHost: "https://api.luzmo.com/",
456
+ dashboardId: null,
457
+ dashboardSlug: null,
458
+ container: null,
459
+ key: null,
460
+ token: null,
461
+ language: "auto",
462
+ qeVersion: null,
463
+ editMode: null,
464
+ screenMode: null,
465
+ switchScreenModeOnResize: true,
466
+ itemId: null,
467
+ mainColor: "",
468
+ accentColor: "",
469
+ itemDimensions: {
470
+ width: "auto",
471
+ height: "auto"
472
+ },
473
+ loaderBackground: "#f9f9f9",
474
+ loaderFontColor: "#5a5a5a",
475
+ loaderSpinnerColor: "rgba(255, 165, 0, 0.7)",
476
+ loaderSpinnerBackground: "rgba(169, 169, 169, 0.14)",
477
+ timezoneId: null,
478
+ contextId: null
768
479
  };
769
480
 
770
- // libs/embed-libs/shared-embed/src/lib/methods/set-authorization.ts
771
- var setAuthorization = (dashboardComponent, iframe, key, token) => {
772
- if (iframe) {
773
- iframe.contentWindow.postMessage(
774
- {
775
- action: "setAuthorization",
776
- key,
777
- token,
778
- _version: dashboardComponent.VERSION
779
- },
780
- "*"
781
- );
782
- return Promise.resolve();
481
+ // libs/embed-libs/shared-embed/src/lib/helpers/extents.ts
482
+ var EXTENTS = [
483
+ { mode: "mobile", width: [150, 767] },
484
+ { mode: "tablet", width: [768, 1199] },
485
+ { mode: "desktop", width: [1200, 1599] },
486
+ { mode: "largeScreen", width: [1600, 9999] },
487
+ { mode: "fixed", width: [] }
488
+ ];
489
+
490
+ // libs/embed-libs/shared-embed/src/lib/helpers/translations.ts
491
+ var TRANSLATIONS = {
492
+ initializing: { en: "Initializing...", nl: "Laden...", fr: "Chargement..." },
493
+ errorDashboard: {
494
+ en: "Oops, we could not load this dashboard!",
495
+ nl: "Oeps, we konden het dashboard niet laden.",
496
+ fr: "Le chargement a echou\xE9."
497
+ },
498
+ errorItem: {
499
+ en: "Oops, we could not load this item!",
500
+ nl: "Oeps, we konden de grafiek niet laden.",
501
+ fr: "Le chargement a echou\xE9."
783
502
  }
784
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
785
503
  };
504
+ var translations_default = TRANSLATIONS;
786
505
 
787
- // libs/embed-libs/shared-embed/src/lib/methods/set-edit-mode.ts
788
- var setEditMode = (dashboardComponent, iframe, editMode) => {
789
- if (iframe && iframe.contentWindow) {
790
- const requestId = uuidv4();
791
- if (dashboardComponent.params.editMode === editMode) {
792
- return Promise.reject(
793
- new Error("editMode parameter is currently already set to " + editMode)
794
- );
795
- } else if (editMode !== "editFull" && editMode !== "editLimited" && editMode !== "view") {
796
- return Promise.reject(
797
- new Error(
798
- "The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'."
799
- )
800
- );
801
- }
802
- iframe.contentWindow.postMessage(
803
- {
804
- action: "setEditMode",
805
- editMode,
806
- _version: dashboardComponent.VERSION,
807
- requestId
808
- },
809
- "*"
810
- );
811
- return new Promise((resolve, reject) => {
812
- dashboardComponent.promises[requestId] = { resolve, reject };
813
- });
506
+ // libs/embed-libs/shared-embed/src/lib/helpers/utils.ts
507
+ var addTrailingSlash = (serverUrl) => {
508
+ if (!serverUrl) {
509
+ return "";
814
510
  }
815
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
511
+ return serverUrl.endsWith("/") ? serverUrl : `${serverUrl}/`;
816
512
  };
817
-
818
- // libs/embed-libs/shared-embed/src/lib/methods/set-filters.ts
819
- var setFilters = (dashboardComponent, iframe, itemId, filters) => {
820
- if (iframe) {
821
- const requestId = uuidv4();
822
- iframe.contentWindow.postMessage(
823
- {
824
- action: "setFilters",
825
- itemId,
826
- filters,
827
- _version: dashboardComponent.VERSION,
828
- requestId
829
- },
830
- "*"
831
- );
832
- return new Promise((resolve, reject) => {
833
- dashboardComponent.promises[requestId] = { resolve, reject };
834
- setTimeout(() => {
835
- if (dashboardComponent.promises[requestId]) {
836
- const errorMessage = "setFilters request timed out.";
837
- dashboardComponent.promises[requestId].reject(
838
- new Error(errorMessage)
839
- );
840
- delete dashboardComponent.promises[requestId];
841
- }
842
- }, 2e3);
843
- });
513
+ var removeTrailingSlash = (serverUrl) => {
514
+ if (!serverUrl) {
515
+ return "";
844
516
  }
845
- return Promise.reject();
517
+ return serverUrl.endsWith("/") ? serverUrl.slice(0, -1) : serverUrl;
846
518
  };
847
-
848
- // libs/embed-libs/shared-embed/src/lib/methods/set-preview.ts
849
- var setPreview = (dashboardComponent, iframe, preview) => {
850
- if (iframe) {
851
- const requestId = uuidv4();
852
- iframe.contentWindow.postMessage(
853
- {
854
- action: "setPreview",
855
- preview,
856
- requestId,
857
- _version: dashboardComponent.VERSION
858
- },
859
- "*"
519
+ var formatDashboardList = (dashboards, integrationId, user, dashboardComponent) => {
520
+ const combineRights = (securable, user2) => {
521
+ const matchingUser = securable.users.find((u3) => u3.id === user2.id);
522
+ const securableAccessRights = matchingUser && matchingUser.userAccessRight ? {
523
+ flagRead: matchingUser.userAccessRight.flagRead,
524
+ flagUse: matchingUser.userAccessRight.flagUse,
525
+ flagModify: matchingUser.userAccessRight.flagModify,
526
+ flagOwn: matchingUser.userAccessRight.flagOwn
527
+ } : {
528
+ flagRead: false,
529
+ flagUse: false,
530
+ flagModify: false,
531
+ flagOwn: false
532
+ };
533
+ const groups = securable.groups.filter(
534
+ (group) => user2.userGroups.includes(group.id) || group.public === true
860
535
  );
861
- return new Promise((resolve, reject) => {
862
- dashboardComponent.promises[requestId] = { resolve, reject };
863
- setTimeout(() => {
864
- if (dashboardComponent.promises[requestId]) {
865
- const errorMessage = "setPreview request timed out.";
866
- dashboardComponent.promises[requestId].reject(
867
- new Error(errorMessage)
868
- );
869
- delete dashboardComponent.promises[requestId];
870
- }
871
- }, 2e3);
536
+ const groupsAccess = groups.map((group) => {
537
+ if (group.groupAccessRight) {
538
+ return group.groupAccessRight;
539
+ }
872
540
  });
873
- }
874
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
875
- };
876
-
877
- // libs/embed-libs/shared-embed/src/lib/service/calculate-dimensions.ts
878
- var _setCalculatedDimensions = (dashboardComponent) => {
879
- if (!dashboardComponent.dimensions) {
880
- dashboardComponent.params.error = true;
881
- _handleError("Got no valid dimensions.", dashboardComponent.params);
882
- return;
883
- }
884
- const dashboardDimensionKeys = Object.keys(
885
- dashboardComponent.dimensions
886
- );
887
- const availableScreenModeExtents = [];
888
- let currentMode;
889
- let currentWidth = 0;
890
- let currentHeight = 0;
891
- if (!dashboardComponent.params.switchScreenModeOnResize && dashboardComponent.currentScreenMode) {
892
- dashboardComponent.params.screenMode = dashboardComponent.currentScreenMode;
893
- }
894
- if (dashboardComponent.dimensions && dashboardDimensionKeys?.[0] === "fixed") {
895
- currentMode = "fixed";
896
- currentWidth = dashboardComponent.dimensions.fixed[0];
897
- currentHeight = dashboardComponent.dimensions.fixed[1];
898
- } else {
899
- const screenModes = [
900
- "mobile",
901
- "tablet",
902
- "desktop",
903
- "largeScreen"
904
- ];
905
- if (dashboardComponent.params.itemEmbedding) {
906
- const [firstMatch] = dashboardDimensionKeys;
907
- let match = cloneDeep(firstMatch);
908
- for (const screenMode of screenModes) {
909
- const found = dashboardDimensionKeys.find((key) => key === screenMode);
910
- if (found) {
911
- match = cloneDeep(found);
912
- } else {
913
- dashboardComponent.dimensions[screenMode] = dashboardComponent.dimensions[match];
914
- }
541
+ for (const groupAccess of groupsAccess) {
542
+ if (!securableAccessRights.flagRead && groupAccess.flagRead) {
543
+ securableAccessRights.flagRead = groupAccess.flagRead;
915
544
  }
916
- }
917
- for (const key of dashboardDimensionKeys) {
918
- if (screenModes.includes(key)) {
919
- const screenMode = EXTENTS.find((extent) => extent.mode === key);
920
- availableScreenModeExtents.push({
921
- ...screenMode,
922
- height: dashboardComponent.dimensions[key][1] || 50
923
- });
545
+ if (!securableAccessRights.flagUse && groupAccess.flagUse) {
546
+ securableAccessRights.flagUse = groupAccess.flagUse;
924
547
  }
925
- }
926
- if (!availableScreenModeExtents.map((screenModeExtent) => screenModeExtent.mode).includes(dashboardComponent.params.screenMode)) {
927
- dashboardComponent.params.screenMode = "auto";
928
- }
929
- if (dashboardComponent.params.screenMode === "auto") {
930
- availableScreenModeExtents.sort(
931
- (a3, b3) => screenModes.indexOf(a3.mode) - screenModes.indexOf(b3.mode)
932
- );
933
- for (const screenModeExtent of availableScreenModeExtents) {
934
- const [screenModeExtentMinWidth, screenModeExtentMaxWidth] = screenModeExtent.width;
935
- if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
936
- if (screenModeExtentMinWidth < dashboardComponent.params.itemDimensions.width) {
937
- currentMode = screenModeExtent.mode;
938
- currentWidth = Number.parseInt(
939
- dashboardComponent.params.itemDimensions.width,
940
- 10
941
- );
942
- currentHeight = dashboardComponent.dimensions[currentMode][1];
943
- }
944
- } else {
945
- if (screenModeExtentMinWidth < dashboardComponent.containerWidth) {
946
- currentMode = screenModeExtent.mode;
947
- if (dashboardComponent.params.itemEmbedding) {
948
- currentWidth = dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto" ? Number.parseInt(
949
- dashboardComponent.params.itemDimensions.width,
950
- 10
951
- ) : Math.min(
952
- dashboardComponent.containerWidth,
953
- screenModeExtentMaxWidth
954
- );
955
- currentHeight = dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto" ? Number.parseInt(
956
- dashboardComponent.params.itemDimensions.height,
957
- 10
958
- ) : dashboardComponent.dimensions[currentMode][1];
959
- if (dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
960
- currentWidth = Number.parseInt(
961
- dashboardComponent.params.itemDimensions.width,
962
- 10
963
- );
964
- currentHeight = dashboardComponent.dimensions[currentMode][1];
965
- }
966
- } else {
967
- currentWidth = Math.max(
968
- Math.min(
969
- screenModeExtentMaxWidth,
970
- dashboardComponent.containerWidth
971
- ),
972
- screenModeExtentMinWidth
973
- );
974
- currentHeight = screenModeExtent.height;
975
- }
976
- }
977
- }
548
+ if (!securableAccessRights.flagModify && groupAccess.flagModify) {
549
+ securableAccessRights.flagModify = groupAccess.flagModify;
978
550
  }
979
- } else {
980
- const {
981
- height: chosenModeHeight,
982
- width: [chosenModeMinWidth, chosenModeMaxWidth]
983
- } = availableScreenModeExtents.find(
984
- (d3) => d3.mode === dashboardComponent.params.screenMode
985
- );
986
- currentMode = dashboardComponent.params.screenMode;
987
- currentWidth = Math.max(
988
- Math.min(chosenModeMaxWidth, dashboardComponent.containerWidth),
989
- chosenModeMinWidth
990
- );
991
- currentHeight = chosenModeHeight;
992
- if (dashboardComponent.params.itemEmbedding) {
993
- if (dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto") {
994
- currentWidth = Number.parseInt(
995
- dashboardComponent.params.itemDimensions.width,
996
- 10
997
- );
998
- }
999
- if (dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto") {
1000
- currentHeight = Number.parseInt(
1001
- dashboardComponent.params.itemDimensions.height,
1002
- 10
1003
- );
1004
- }
551
+ if (!securableAccessRights.flagOwn && groupAccess.flagOwn) {
552
+ securableAccessRights.flagOwn = groupAccess.flagOwn;
1005
553
  }
1006
554
  }
1007
- if (!currentMode && availableScreenModeExtents.length > 0) {
1008
- const [lowestModeExtent] = availableScreenModeExtents;
1009
- currentMode = lowestModeExtent.mode;
1010
- currentWidth = lowestModeExtent.width[0];
1011
- currentHeight = lowestModeExtent.height;
555
+ const integrationsAccess = securable.integrations?.length > 0 ? securable.integrations.map((integration) => {
556
+ if (integration.integrationAccessRight) {
557
+ return integration.integrationAccessRight;
558
+ }
559
+ }) : [];
560
+ for (const integrationAccess of integrationsAccess) {
561
+ if (!securableAccessRights.flagRead && integrationAccess.flagRead) {
562
+ securableAccessRights.flagRead = integrationAccess.flagRead;
563
+ }
564
+ if (!securableAccessRights.flagUse && integrationAccess.flagUse) {
565
+ securableAccessRights.flagUse = integrationAccess.flagUse;
566
+ }
567
+ if (!securableAccessRights.flagModify && integrationAccess.flagModify) {
568
+ securableAccessRights.flagModify = integrationAccess.flagModify;
569
+ }
1012
570
  }
1013
- }
1014
- dashboardComponent.currentScreenMode = currentMode;
1015
- const style = {
1016
- height: currentHeight === 0 ? "100%" : `${String(currentHeight)}px`,
1017
- width: currentWidth === 0 ? "100%" : `${String(currentWidth)}px`,
1018
- opacity: 1
571
+ return securableAccessRights;
1019
572
  };
1020
- const dashboardEditModes = ["editFull", "editLimited"];
1021
- if (dashboardEditModes.includes(dashboardComponent.params.editMode)) {
1022
- style.height = "100%";
1023
- style.width = "100%";
1024
- } else if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions) {
1025
- style.height = dashboardComponent.params.itemDimensions.height === "auto" ? style.height : `${String(dashboardComponent.params.itemDimensions.height).replace(
1026
- "px",
1027
- ""
1028
- )}px`;
1029
- style.width = dashboardComponent.params.itemDimensions.width === "auto" ? style.width : `${String(dashboardComponent.params.itemDimensions.width).replace(
1030
- "px",
1031
- ""
1032
- )}px`;
1033
- } else {
1034
- style.height = currentHeight === 0 ? "100%" : `${String(currentHeight)}px`;
1035
- style.width = currentWidth === 0 ? "100%" : `${String(currentWidth)}px`;
573
+ const localize = (item, locale) => {
574
+ if (item === null || item === void 0) {
575
+ return "";
576
+ }
577
+ if (typeof item !== "object" || Object.keys(item).length === 0) {
578
+ if (typeof item === "object" && Object.keys(item).length === 0) {
579
+ return "";
580
+ }
581
+ return item;
582
+ }
583
+ let localizedItem;
584
+ localizedItem = locale && item[locale] ? item[locale] : item[Object.keys(item)[0]];
585
+ if (localizedItem === void 0 || localizedItem === null) {
586
+ localizedItem = "";
587
+ }
588
+ return localizedItem;
589
+ };
590
+ const treatedDashboards = [];
591
+ for (const dashboard of dashboards) {
592
+ const treatedDashboard = {
593
+ accessibleBy: [],
594
+ accessRights: combineRights(dashboard, user),
595
+ id: dashboard.id,
596
+ modifiedAt: dashboard.modified_at,
597
+ name: localize(dashboard.name, dashboardComponent.language),
598
+ slug: null,
599
+ tags: dashboard.tags.map((t5) => t5.tag).sort((t1, t22) => t1.localeCompare(t22))
600
+ };
601
+ const currentIntegration = dashboard.integrations.find(
602
+ (i6) => i6.id === integrationId
603
+ );
604
+ if (currentIntegration?.integrationAccessRight?.slug) {
605
+ treatedDashboard.slug = currentIntegration.integrationAccessRight.slug;
606
+ }
607
+ const users = dashboard.users.map((u3) => ({
608
+ model: "User",
609
+ id: u3.id,
610
+ name: localize(u3.name, user.locale_id)
611
+ }));
612
+ const groups = dashboard.groups.map((g2) => ({
613
+ model: "Group",
614
+ id: g2.id,
615
+ name: localize(g2.name, user.locale_id) || {}
616
+ }));
617
+ const integrations = dashboard.integrations.map((i6) => ({
618
+ model: "Integration",
619
+ id: i6.id,
620
+ name: localize(i6.name, user.locale_id) || {}
621
+ }));
622
+ treatedDashboard.accessibleBy = [...users, ...groups, ...integrations];
623
+ treatedDashboards.push(treatedDashboard);
1036
624
  }
1037
- dashboardComponent.currentScreenMode = currentMode;
1038
- dashboardComponent.iframeStyle = style;
625
+ return treatedDashboards;
1039
626
  };
1040
-
1041
- // libs/embed-libs/shared-embed/src/lib/service/extend-and-validate.ts
1042
- var _extendAndValidate = (dashboardContent) => {
1043
- const defaultKeys = Object.keys(
1044
- DEFAULT_PARAMETERS
1045
- );
1046
- const errorMessages = [];
1047
- const requiredStringParams = [
1048
- "appServer",
1049
- "language",
1050
- "apiHost"
1051
- ];
1052
- const requiredStringOrEmptyParams = [
1053
- "key",
1054
- "token",
1055
- "screenMode",
1056
- "timezoneId",
1057
- "itemId",
1058
- "container",
1059
- "loaderBackground",
1060
- "loaderFontColor",
1061
- "loaderSpinnerColor",
1062
- "loaderSpinnerBackground"
1063
- ];
1064
- const objectParams = ["itemDimensions"];
1065
- const screenModes = [
1066
- "mobile",
1067
- "tablet",
1068
- "desktop",
1069
- "largeScreen",
1070
- "fixed",
1071
- "auto"
1072
- ];
1073
- for (const key of defaultKeys) {
1074
- if (dashboardContent.params[key] === null) {
1075
- delete dashboardContent.params[key];
1076
- }
627
+ var VERSION = "0.0.0-shared-luzmo";
628
+ var sanitizeUrl = (url) => {
629
+ const invalidPrototcolRegex = /^(%20|\s)*(javascript|data)/im;
630
+ const ctrlCharactersRegex = /[^\u0020-\u007E]/gim;
631
+ const urlSchemeRegex = /^([^:]+):/gm;
632
+ const relativeFirstCharacters = /* @__PURE__ */ new Set([".", "/"]);
633
+ const isRelativeUrlWithoutProtocol = (relativeUrl) => relativeFirstCharacters.has(relativeUrl[0]);
634
+ if (!url) {
635
+ return "about:blank";
1077
636
  }
1078
- dashboardContent.params = defaultsDeep(
1079
- dashboardContent.params,
1080
- DEFAULT_PARAMETERS
1081
- );
1082
- if ((!dashboardContent.params.dashboardId || typeof dashboardContent.params.dashboardId !== "string") && (!dashboardContent.params.dashboardSlug || typeof dashboardContent.params.dashboardSlug !== "string")) {
1083
- delete dashboardContent.params.dashboardId;
1084
- delete dashboardContent.params.dashboardSlug;
637
+ const sanitizedUrl = url.replaceAll(ctrlCharactersRegex, "").trim();
638
+ if (isRelativeUrlWithoutProtocol(sanitizedUrl)) {
639
+ return sanitizedUrl;
1085
640
  }
1086
- for (const key of requiredStringParams) {
1087
- if (typeof dashboardContent.params[key] !== "string") {
1088
- delete dashboardContent.params[key];
1089
- errorMessages.push(`${key} needs to be of type string.`);
641
+ const urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex);
642
+ if (!urlSchemeParseResults) {
643
+ return sanitizedUrl;
644
+ }
645
+ const urlScheme = urlSchemeParseResults[0];
646
+ if (invalidPrototcolRegex.test(urlScheme)) {
647
+ return "about:blank";
648
+ }
649
+ return sanitizedUrl;
650
+ };
651
+ var cloneDeep = (obj) => JSON.parse(JSON.stringify(obj));
652
+ var isObject = (o6) => o6 && typeof o6 === "object";
653
+ var defaultsDeep = (target, defaults) => {
654
+ Object.entries(defaults).forEach(([k2, v2]) => {
655
+ if (k2 in target) {
656
+ if (target[k2] === void 0) {
657
+ target[k2] = v2;
658
+ } else {
659
+ target[k2] = isObject(v2) ? defaultsDeep(
660
+ target[k2],
661
+ v2
662
+ ) : target[k2];
663
+ }
664
+ } else {
665
+ target[k2] = v2;
1090
666
  }
667
+ });
668
+ return target;
669
+ };
670
+ var uuidv4 = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g, function(c4) {
671
+ const r7 = Math.random() * 16 | 0;
672
+ const v2 = c4 == "x" ? r7 : r7 & 3 | 8;
673
+ return v2.toString(16);
674
+ });
675
+
676
+ // libs/embed-libs/shared-embed/src/lib/helpers/iframe-url.ts
677
+ var createIframeUrl = (dashboardContent) => {
678
+ const searchString = [];
679
+ const {
680
+ appServer,
681
+ language,
682
+ qeVersion,
683
+ loaderBackground,
684
+ loaderSpinnerColor,
685
+ loaderSpinnerBackground,
686
+ loaderFontColor,
687
+ screenMode,
688
+ key,
689
+ token,
690
+ timezoneId,
691
+ itemEmbedding,
692
+ itemDimensions,
693
+ dashboardId,
694
+ dashboardSlug,
695
+ itemId,
696
+ mainColor,
697
+ accentColor,
698
+ editMode
699
+ } = dashboardContent.params;
700
+ if (language && language !== "auto") {
701
+ searchString.push("language=" + language);
702
+ }
703
+ if (qeVersion) {
704
+ searchString.push(`qe_version=${qeVersion}`);
705
+ }
706
+ if (loaderBackground) {
707
+ searchString.push(`ldrbg=${loaderBackground}`);
708
+ }
709
+ if (loaderFontColor) {
710
+ searchString.push(`ldrftclr=${loaderFontColor}`);
1091
711
  }
1092
- for (const key of requiredStringOrEmptyParams) {
1093
- if (typeof dashboardContent.params[key] !== "string" && dashboardContent.params[key] !== null && dashboardContent.params[key] !== void 0) {
1094
- delete dashboardContent.params[key];
1095
- errorMessages.push(`${key} needs to be of type string or empty.`);
1096
- }
712
+ if (loaderSpinnerColor) {
713
+ searchString.push(`ldrspclr=${loaderSpinnerColor}`);
1097
714
  }
1098
- if (dashboardContent.params.screenMode && !screenModes.includes(dashboardContent.params.screenMode)) {
1099
- const validTypesString = screenModes.map((mode) => `"${mode}"`).join(", ");
1100
- errorMessages.push(
1101
- `"screenMode" needs should be one of these types: ${validTypesString}`
1102
- );
1103
- dashboardContent.params.screenMode = "auto";
715
+ if (loaderSpinnerBackground) {
716
+ searchString.push(`ldrspbg=${loaderSpinnerBackground}`);
1104
717
  }
1105
- if (dashboardContent.params.itemId) {
1106
- dashboardContent.params.itemEmbedding = true;
718
+ if (mainColor) {
719
+ searchString.push(`mainColor=${mainColor}`);
1107
720
  }
1108
- for (const key of objectParams) {
1109
- if (typeof dashboardContent.params[key] !== "object" && dashboardContent.params[key] !== null) {
1110
- delete dashboardContent.params[key];
1111
- errorMessages.push(`${key} needs to be of type object or empty.`);
1112
- }
721
+ if (accentColor) {
722
+ searchString.push(`accentColor=${accentColor}`);
1113
723
  }
1114
- if (typeof dashboardContent.params.switchScreenModeOnResize !== "boolean") {
1115
- errorMessages.push("switchScreenModeOnResize needs to be of type boolean.");
1116
- dashboardContent.params.switchScreenModeOnResize = true;
724
+ if (screenMode && screenMode !== "auto") {
725
+ searchString.push("screenMode=" + screenMode);
1117
726
  }
1118
- if (dashboardContent.params.itemDimensions) {
1119
- const itemDimensionsKeys = [
1120
- "width",
1121
- "height"
1122
- ];
1123
- for (const key of itemDimensionsKeys) {
1124
- if (!["string", "number"].includes(
1125
- typeof dashboardContent.params.itemDimensions[key]
1126
- ) && dashboardContent.params.itemDimensions[key] !== null) {
1127
- errorMessages.push(
1128
- `itemDimensions ${key} needs to be of type string, number or empty.`
1129
- );
1130
- }
1131
- }
727
+ if (timezoneId) {
728
+ searchString.push("timezoneId=" + timezoneId);
1132
729
  }
1133
- dashboardContent.params = defaultsDeep(
1134
- dashboardContent.params,
1135
- DEFAULT_PARAMETERS
1136
- );
1137
- if (dashboardContent.params.screenMode && dashboardContent.params.screenMode !== "auto") {
1138
- dashboardContent.params.switchScreenModeOnResize = false;
730
+ if (itemEmbedding && itemDimensions && itemDimensions.width) {
731
+ searchString.push("width=" + itemDimensions.width);
1139
732
  }
1140
- if (dashboardContent.params.itemDimensions.width !== "auto") {
1141
- dashboardContent.params.itemDimensions.width = Number.parseInt(
1142
- `${dashboardContent.params.itemDimensions.width}`.replace("px", ""),
1143
- 10
1144
- ) || "auto";
733
+ if (itemEmbedding && itemDimensions && itemDimensions.height) {
734
+ searchString.push("height=" + itemDimensions.height);
1145
735
  }
1146
- if (dashboardContent.params.itemDimensions.height !== "auto") {
1147
- dashboardContent.params.itemDimensions.height = Number.parseInt(
1148
- `${dashboardContent.params.itemDimensions.height}`.replace("px", ""),
1149
- 10
1150
- ) || "auto";
736
+ if (editMode) {
737
+ searchString.push("editMode=" + editMode);
1151
738
  }
1152
- dashboardContent.params.itemEmbedding = !!dashboardContent.params.itemId;
1153
- if (dashboardContent.params.error || errorMessages.length > 0) {
1154
- _handleError(errorMessages.join("\n"), dashboardContent.params);
739
+ const keyTokenUrlAnchor = key && token ? "#" + key + ":" + token : "";
740
+ searchString.push("version=" + (dashboardContent.VERSION || VERSION));
741
+ const iframeUrl = itemEmbedding ? `${appServer}i/${dashboardId || dashboardSlug}/${itemId}?${encodeURIComponent(
742
+ searchString.join("&")
743
+ )}${keyTokenUrlAnchor}` : `${appServer}i/${dashboardId || dashboardSlug}?${encodeURIComponent(
744
+ searchString.join("&")
745
+ )}${keyTokenUrlAnchor}`;
746
+ return sanitizeUrl(iframeUrl);
747
+ };
748
+
749
+ // libs/embed-libs/shared-embed/src/lib/helpers/get-loader.ts
750
+ var getLoader = (dashboardComponent) => {
751
+ let errorMsg;
752
+ if (dashboardComponent.params.error || dashboardComponent.browserNotSupported.length > 0) {
753
+ dashboardComponent.params.error = true;
754
+ if (dashboardComponent.browserNotSupported) {
755
+ errorMsg = "Browser is not supported.";
756
+ }
1155
757
  }
758
+ const loadingMsg = translations_default.initializing[dashboardComponent.params.language] || translations_default.initializing.en;
759
+ return dashboardComponent.browserNotSupported || dashboardComponent.params.error ? { loadingMsg, errorMsg } : { loadingMsg, errorMsg: "" };
1156
760
  };
1157
761
 
1158
- // libs/embed-libs/shared-embed/src/lib/constants/class-constants.ts
1159
- var luzmoEmbedContainerClass = "luzmo-embed-container";
762
+ // libs/embed-libs/shared-embed/src/lib/helpers/promise-dispatch.ts
763
+ function resolvePromise(dashboardComponent, requestId, data) {
764
+ if (dashboardComponent.promises[requestId]) {
765
+ dashboardComponent.promises[requestId].resolve(data);
766
+ delete dashboardComponent.promises[requestId];
767
+ }
768
+ }
769
+ function rejectPromise(dashboardComponent, requestId, data) {
770
+ if (dashboardComponent.promises[requestId]) {
771
+ dashboardComponent.promises[requestId].reject(data);
772
+ delete dashboardComponent.promises[requestId];
773
+ }
774
+ }
1160
775
 
1161
- // libs/embed-libs/shared-embed/src/lib/helpers/remote-federation.ts
1162
- var remotesMap = {
1163
- // "remote_app": { url: "http://localhost:4201/remoteEntry.mjs", format: "esm", from: "vite" },
1164
- };
1165
- var loadJS = async (url, fn) => {
1166
- const resolvedUrl = typeof url === "function" ? await url() : url;
1167
- const script = document.createElement("script");
1168
- script.type = "text/javascript";
1169
- script.addEventListener("load", fn);
1170
- script.src = resolvedUrl;
1171
- document.querySelectorAll("head")[0].append(script);
1172
- };
1173
- var wrapShareModule = (remoteFrom) => ({});
1174
- async function __federationMethodEnsure(remoteId) {
1175
- const remote = remotesMap[remoteId];
1176
- if (remote.inited) {
1177
- return remote.lib;
776
+ // libs/embed-libs/shared-embed/src/lib/helpers/styles.ts
777
+ function containerStyles(dashboardComponent) {
778
+ const styles = {};
779
+ if (dashboardComponent.params.loaderBackground && !dashboardComponent.iframeLoaded) {
780
+ styles.background = dashboardComponent.params.loaderBackground;
1178
781
  }
1179
- if (remote.format === "var") {
1180
- return new Promise((resolve) => {
1181
- const callback = () => {
1182
- if (!remote.inited) {
1183
- remote.lib = window[remoteId];
1184
- remote.lib.init(wrapShareModule(remote.from));
1185
- remote.inited = true;
1186
- }
1187
- resolve(remote.lib);
1188
- };
1189
- return loadJS(remote.url, callback);
1190
- });
1191
- } else if (["esm", "systemjs"].includes(remote.format)) {
1192
- return new Promise((resolve, reject) => {
1193
- const getUrl = typeof remote.url === "function" ? remote.url : () => Promise.resolve(remote.url);
1194
- getUrl().then((url) => {
1195
- import(
1196
- /* @vite-ignore */
1197
- /* webpackIgnore: true */
1198
- url
1199
- ).then((lib) => {
1200
- if (!remote.inited) {
1201
- const shareScope = wrapShareModule(remote.from);
1202
- lib.init(shareScope);
1203
- remote.lib = lib;
1204
- remote.lib.init(shareScope);
1205
- remote.inited = true;
1206
- }
1207
- resolve(remote.lib);
1208
- }).catch(reject);
1209
- });
1210
- });
782
+ return styles;
783
+ }
784
+ function containerLoaderStyles(dashboardComponent) {
785
+ const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
786
+ const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
787
+ const display = dashboardComponent.iframeLoaded ? "none" : "";
788
+ return {
789
+ display,
790
+ height: `${chartHeightDefined ? height : dashboardComponent.minHeight}px`
791
+ };
792
+ }
793
+ function loaderStyles(dashboardComponent) {
794
+ const background = dashboardComponent.params.loaderBackground || DEFAULT_PARAMETERS.loaderBackground;
795
+ if (dashboardComponent.params.itemEmbedding) {
796
+ dashboardComponent.loaderSize = 24;
797
+ dashboardComponent.borderWidth = 4;
798
+ dashboardComponent.minHeight = 200;
799
+ const width = dashboardComponent.params.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
800
+ const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
801
+ const chartWidthDefined = width !== "auto";
802
+ const chartHeightDefined = height !== "auto";
803
+ return {
804
+ background,
805
+ width: chartWidthDefined ? `${width}px` : "100%",
806
+ height: `${chartHeightDefined ? height : "200"}px`,
807
+ "min-height": chartHeightDefined ? "" : "200px"
808
+ };
1211
809
  }
810
+ return {
811
+ background
812
+ };
1212
813
  }
1213
- function __federationMethodWrapDefault(module2, need) {
1214
- if (!(module2 == null ? void 0 : module2.default) && need) {
1215
- const obj = /* @__PURE__ */ Object.create(null);
1216
- obj.default = module2;
1217
- obj.__esModule = true;
1218
- return obj;
814
+ function plStyles(dashboardComponent) {
815
+ const {
816
+ loaderSpinnerColor: defaultSpinnerColor,
817
+ loaderSpinnerBackground: defaultSpinnerBackground
818
+ } = DEFAULT_PARAMETERS;
819
+ const spinnerColorBorder = generateBorderStyle(
820
+ dashboardComponent.borderWidth,
821
+ dashboardComponent.params.loaderSpinnerColor || defaultSpinnerColor
822
+ );
823
+ const spinnerBackgroundBorder = generateBorderStyle(
824
+ dashboardComponent.borderWidth,
825
+ dashboardComponent.params.loaderSpinnerBackground || defaultSpinnerBackground
826
+ );
827
+ const size = `${dashboardComponent.loaderSize}px`;
828
+ return {
829
+ "border-top": spinnerColorBorder,
830
+ "border-right": spinnerColorBorder,
831
+ "border-bottom": spinnerBackgroundBorder,
832
+ "border-left": spinnerBackgroundBorder,
833
+ width: size,
834
+ height: size
835
+ };
836
+ }
837
+ function lcStyles(dashboardComponent) {
838
+ const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
839
+ const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
840
+ const getPaddingStr = (value) => `${(value - dashboardComponent.loaderSize - 32) / 2}px`;
841
+ const verticalPadding = dashboardComponent.params.itemId ? chartHeightDefined ? getPaddingStr(Number.parseInt(`${height}`, 10)) : getPaddingStr(dashboardComponent.minHeight) : "128px";
842
+ return {
843
+ padding: `${verticalPadding} 16px`
844
+ };
845
+ }
846
+ function calculateIframeStyles(dashboardComponent) {
847
+ const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
848
+ const width = dashboardComponent.params.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
849
+ if (dashboardComponent.params.itemEmbedding && height !== "auto") {
850
+ dashboardComponent.iframeHeight = `${height}px`;
851
+ } else if (dashboardComponent.params.itemEmbedding) {
852
+ dashboardComponent.iframeHeight = "200px";
853
+ } else if (["editFull", "editLimited"].includes(dashboardComponent.params.editMode)) {
854
+ dashboardComponent.iframeHeight = "100%";
855
+ } else {
856
+ dashboardComponent.iframeHeight = "400px";
1219
857
  }
1220
- return module2;
858
+ dashboardComponent.iframeWidth = dashboardComponent.params.itemEmbedding && width !== "auto" ? `${width}px` : "100%";
859
+ const styles = {
860
+ height: dashboardComponent.iframeHeight,
861
+ width: dashboardComponent.iframeWidth
862
+ };
863
+ if (dashboardComponent.iframeLoaded) {
864
+ styles.opacity = 1;
865
+ } else if (dashboardComponent.error) {
866
+ styles.opacity = 1;
867
+ styles.width = "100%";
868
+ styles.height = "400px";
869
+ } else {
870
+ styles.opacity = 0;
871
+ }
872
+ return styles;
1221
873
  }
1222
- async function __federationMethodGetRemote(remoteName, componentName) {
1223
- return __federationMethodEnsure(remoteName).then((remote) => remote.get(componentName).then((factory) => factory()));
874
+ function generateBorderStyle(borderWidth, color) {
875
+ return `${borderWidth}px solid ${color}`;
1224
876
  }
1225
877
 
1226
- // node_modules/@lit/reactive-element/css-tag.js
1227
- var t = globalThis;
1228
- var e = t.ShadowRoot && (void 0 === t.ShadyCSS || t.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype;
1229
- var s = Symbol();
1230
- var o = /* @__PURE__ */ new WeakMap();
1231
- var n = class {
1232
- constructor(t5, e7, o6) {
1233
- if (this._$cssResult$ = true, o6 !== s)
1234
- throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
1235
- this.cssText = t5, this.t = e7;
1236
- }
1237
- get styleSheet() {
1238
- let t5 = this.o;
1239
- const s4 = this.t;
1240
- if (e && void 0 === t5) {
1241
- const e7 = void 0 !== s4 && 1 === s4.length;
1242
- e7 && (t5 = o.get(s4)), void 0 === t5 && ((this.o = t5 = new CSSStyleSheet()).replaceSync(this.cssText), e7 && o.set(s4, t5));
1243
- }
1244
- return t5;
1245
- }
1246
- toString() {
1247
- return this.cssText;
878
+ // libs/embed-libs/shared-embed/src/lib/helpers/update-iframe-url.ts
879
+ var updateIframeUrl = (iframe, iframeUrl) => {
880
+ if (iframe?.contentWindow) {
881
+ iframe.contentWindow.location.replace(iframeUrl);
1248
882
  }
1249
883
  };
1250
- var r = (t5) => new n("string" == typeof t5 ? t5 : t5 + "", void 0, s);
1251
- var i = (t5, ...e7) => {
1252
- const o6 = 1 === t5.length ? t5[0] : e7.reduce((e8, s4, o7) => e8 + ((t6) => {
1253
- if (true === t6._$cssResult$)
1254
- return t6.cssText;
1255
- if ("number" == typeof t6)
1256
- return t6;
1257
- 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.");
1258
- })(s4) + t5[o7 + 1], t5[0]);
1259
- return new n(o6, t5, s);
1260
- };
1261
- var S = (s4, o6) => {
1262
- if (e)
1263
- s4.adoptedStyleSheets = o6.map((t5) => t5 instanceof CSSStyleSheet ? t5 : t5.styleSheet);
1264
- else
1265
- for (const e7 of o6) {
1266
- const o7 = document.createElement("style"), n6 = t.litNonce;
1267
- void 0 !== n6 && o7.setAttribute("nonce", n6), o7.textContent = e7.cssText, s4.appendChild(o7);
1268
- }
884
+
885
+ // libs/embed-libs/shared-embed/src/lib/methods/export-dashboard.ts
886
+ var exportDashboard = (dashboardComponent, iframe, format) => {
887
+ const requestId = uuidv4();
888
+ if (iframe?.contentWindow) {
889
+ iframe.contentWindow.postMessage(
890
+ {
891
+ action: "exportDashboard",
892
+ format: format || "png",
893
+ _version: dashboardComponent.VERSION,
894
+ requestId
895
+ },
896
+ "*"
897
+ );
898
+ return new Promise((resolve, reject) => {
899
+ dashboardComponent.promises[requestId] = { resolve, reject };
900
+ setTimeout(() => {
901
+ if (dashboardComponent.promises[requestId]) {
902
+ const errorMessage = "exportDashboard request timed out.";
903
+ dashboardComponent.promises[requestId].reject(
904
+ new Error(errorMessage)
905
+ );
906
+ delete dashboardComponent.promises[requestId];
907
+ }
908
+ }, 12e5);
909
+ });
910
+ }
911
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
1269
912
  };
1270
- var c = e ? (t5) => t5 : (t5) => t5 instanceof CSSStyleSheet ? ((t6) => {
1271
- let e7 = "";
1272
- for (const s4 of t6.cssRules)
1273
- e7 += s4.cssText;
1274
- return r(e7);
1275
- })(t5) : t5;
1276
913
 
1277
- // node_modules/@lit/reactive-element/reactive-element.js
1278
- var { is: i2, defineProperty: e2, getOwnPropertyDescriptor: r2, getOwnPropertyNames: h, getOwnPropertySymbols: o2, getPrototypeOf: n2 } = Object;
1279
- var a = globalThis;
1280
- var c2 = a.trustedTypes;
1281
- var l = c2 ? c2.emptyScript : "";
1282
- var p = a.reactiveElementPolyfillSupport;
1283
- var d = (t5, s4) => t5;
1284
- var u = { toAttribute(t5, s4) {
1285
- switch (s4) {
1286
- case Boolean:
1287
- t5 = t5 ? l : null;
1288
- break;
1289
- case Object:
1290
- case Array:
1291
- t5 = null == t5 ? t5 : JSON.stringify(t5);
914
+ // libs/embed-libs/shared-embed/src/lib/methods/get-accessible-dashboards.ts
915
+ var getAccessibleDashboards = (dashboardComponent, iframe) => {
916
+ if ((dashboardComponent.dashboardId || dashboardComponent.dashboardSlug) && iframe?.contentWindow) {
917
+ const requestId = uuidv4();
918
+ iframe.contentWindow.postMessage(
919
+ {
920
+ action: "getAccessibleDashboards",
921
+ _version: dashboardComponent.VERSION,
922
+ requestId
923
+ },
924
+ "*"
925
+ );
926
+ return new Promise((resolve, reject) => {
927
+ dashboardComponent.promises[requestId] = { resolve, reject };
928
+ setTimeout(() => {
929
+ if (dashboardComponent.promises[requestId]) {
930
+ const errorMessage = "getAccessibleDashboards request timed out.";
931
+ dashboardComponent.promises[requestId].reject(
932
+ new Error(errorMessage)
933
+ );
934
+ delete dashboardComponent.promises[requestId];
935
+ }
936
+ }, 2e3);
937
+ });
1292
938
  }
1293
- return t5;
1294
- }, fromAttribute(t5, s4) {
1295
- let i6 = t5;
1296
- switch (s4) {
1297
- case Boolean:
1298
- i6 = null !== t5;
1299
- break;
1300
- case Number:
1301
- i6 = null === t5 ? null : Number(t5);
1302
- break;
1303
- case Object:
1304
- case Array:
939
+ const fetchUser = new Promise((resolve, reject) => {
940
+ void (() => {
1305
941
  try {
1306
- i6 = JSON.parse(t5);
1307
- } catch (t6) {
1308
- i6 = null;
942
+ const responsePromise = window.fetch(
943
+ `${String(dashboardComponent.params.apiHost)}0.1.0/authorization`,
944
+ {
945
+ method: "POST",
946
+ mode: "cors",
947
+ cache: "no-cache",
948
+ headers: { "Content-Type": "application/json" },
949
+ redirect: "follow",
950
+ body: JSON.stringify({
951
+ action: "get",
952
+ version: "0.1.0",
953
+ key: dashboardComponent.authKey,
954
+ token: dashboardComponent.authToken,
955
+ find: {
956
+ where: { id: dashboardComponent.authKey },
957
+ attributes: ["id", "integration_id"],
958
+ include: [
959
+ {
960
+ model: "User",
961
+ attributes: ["id", "name", "locale_id"],
962
+ include: [{ model: "Group" }]
963
+ }
964
+ ]
965
+ }
966
+ })
967
+ }
968
+ );
969
+ responsePromise.then((response) => response.json()).then((data) => {
970
+ if (!data || !data.rows || data.rows.length === 0 || !data.rows[0].user || !data.rows[0].integration_id) {
971
+ reject();
972
+ } else {
973
+ data.rows[0].user.userGroups = data.rows[0].user.groups.map(
974
+ (group) => group.id
975
+ );
976
+ delete data.rows[0].user.groups;
977
+ resolve({
978
+ integrationId: data.rows[0].integration_id,
979
+ user: data.rows[0].user
980
+ });
981
+ }
982
+ });
983
+ } catch (error) {
984
+ reject(error);
1309
985
  }
1310
- }
1311
- return i6;
1312
- } };
1313
- var f = (t5, s4) => !i2(t5, s4);
1314
- var y = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f };
1315
- Symbol.metadata ??= Symbol("metadata"), a.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
1316
- var b = class extends HTMLElement {
1317
- static addInitializer(t5) {
1318
- this._$Ei(), (this.l ??= []).push(t5);
1319
- }
1320
- static get observedAttributes() {
1321
- return this.finalize(), this._$Eh && [...this._$Eh.keys()];
1322
- }
1323
- static createProperty(t5, s4 = y) {
1324
- if (s4.state && (s4.attribute = false), this._$Ei(), this.elementProperties.set(t5, s4), !s4.noAccessor) {
1325
- const i6 = Symbol(), r7 = this.getPropertyDescriptor(t5, i6, s4);
1326
- void 0 !== r7 && e2(this.prototype, t5, r7);
1327
- }
1328
- }
1329
- static getPropertyDescriptor(t5, s4, i6) {
1330
- const { get: e7, set: h3 } = r2(this.prototype, t5) ?? { get() {
1331
- return this[s4];
1332
- }, set(t6) {
1333
- this[s4] = t6;
1334
- } };
1335
- return { get() {
1336
- return e7?.call(this);
1337
- }, set(s5) {
1338
- const r7 = e7?.call(this);
1339
- h3.call(this, s5), this.requestUpdate(t5, r7, i6);
1340
- }, configurable: true, enumerable: true };
1341
- }
1342
- static getPropertyOptions(t5) {
1343
- return this.elementProperties.get(t5) ?? y;
1344
- }
1345
- static _$Ei() {
1346
- if (this.hasOwnProperty(d("elementProperties")))
1347
- return;
1348
- const t5 = n2(this);
1349
- t5.finalize(), void 0 !== t5.l && (this.l = [...t5.l]), this.elementProperties = new Map(t5.elementProperties);
1350
- }
1351
- static finalize() {
1352
- if (this.hasOwnProperty(d("finalized")))
1353
- return;
1354
- if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d("properties"))) {
1355
- const t6 = this.properties, s4 = [...h(t6), ...o2(t6)];
1356
- for (const i6 of s4)
1357
- this.createProperty(i6, t6[i6]);
1358
- }
1359
- const t5 = this[Symbol.metadata];
1360
- if (null !== t5) {
1361
- const s4 = litPropertyMetadata.get(t5);
1362
- if (void 0 !== s4)
1363
- for (const [t6, i6] of s4)
1364
- this.elementProperties.set(t6, i6);
1365
- }
1366
- this._$Eh = /* @__PURE__ */ new Map();
1367
- for (const [t6, s4] of this.elementProperties) {
1368
- const i6 = this._$Eu(t6, s4);
1369
- void 0 !== i6 && this._$Eh.set(i6, t6);
986
+ })();
987
+ });
988
+ return new Promise((resolve, reject) => void (() => {
989
+ try {
990
+ fetchUser.then((authorizationData) => {
991
+ const responsePromise = window.fetch(
992
+ `${String(dashboardComponent.params.apiHost)}0.1.0/securable`,
993
+ {
994
+ method: "POST",
995
+ mode: "cors",
996
+ cache: "no-cache",
997
+ headers: { "Content-Type": "application/json" },
998
+ redirect: "follow",
999
+ body: JSON.stringify({
1000
+ action: "get",
1001
+ version: "0.1.0",
1002
+ key: dashboardComponent.authKey,
1003
+ token: dashboardComponent.authToken,
1004
+ find: {
1005
+ where: { type: "dashboard", is_variant: false },
1006
+ attributes: ["id", "name", "modified_at"],
1007
+ order: [["modified_at", "desc"]],
1008
+ include: [
1009
+ { model: "Tag", attributes: ["tag"] },
1010
+ { model: "User", attributes: ["id", "name"] },
1011
+ {
1012
+ model: "Group",
1013
+ attributes: ["id", "name", "public"]
1014
+ },
1015
+ { model: "Integration", attributes: ["id", "name"] }
1016
+ ]
1017
+ }
1018
+ })
1019
+ }
1020
+ );
1021
+ responsePromise.then((response) => response.json()).then((data) => {
1022
+ const dashboardList = data.rows.length > 0 ? formatDashboardList(
1023
+ data.rows,
1024
+ authorizationData.integrationId,
1025
+ authorizationData.user,
1026
+ dashboardComponent
1027
+ ) : [];
1028
+ resolve(dashboardList);
1029
+ });
1030
+ }).catch((error) => {
1031
+ reject(error);
1032
+ });
1033
+ } catch (error) {
1034
+ reject(error);
1370
1035
  }
1371
- this.elementStyles = this.finalizeStyles(this.styles);
1372
- }
1373
- static finalizeStyles(s4) {
1374
- const i6 = [];
1375
- if (Array.isArray(s4)) {
1376
- const e7 = new Set(s4.flat(1 / 0).reverse());
1377
- for (const s5 of e7)
1378
- i6.unshift(c(s5));
1379
- } else
1380
- void 0 !== s4 && i6.push(c(s4));
1381
- return i6;
1382
- }
1383
- static _$Eu(t5, s4) {
1384
- const i6 = s4.attribute;
1385
- return false === i6 ? void 0 : "string" == typeof i6 ? i6 : "string" == typeof t5 ? t5.toLowerCase() : void 0;
1386
- }
1387
- constructor() {
1388
- super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
1036
+ })());
1037
+ };
1038
+
1039
+ // libs/embed-libs/shared-embed/src/lib/methods/get-data.ts
1040
+ var getData = (dashboardComponent, iframe, itemId) => {
1041
+ if (iframe?.contentWindow) {
1042
+ const requestId = uuidv4();
1043
+ iframe.contentWindow.postMessage(
1044
+ {
1045
+ action: "getData",
1046
+ id: itemId,
1047
+ _version: dashboardComponent.VERSION,
1048
+ requestId
1049
+ },
1050
+ "*"
1051
+ );
1052
+ return new Promise((resolve, reject) => {
1053
+ dashboardComponent.promises[requestId] = { resolve, reject };
1054
+ setTimeout(() => {
1055
+ if (dashboardComponent.promises[requestId]) {
1056
+ const errorMessage = "getData request timed out.";
1057
+ dashboardComponent.promises[requestId].reject(
1058
+ new Error(errorMessage)
1059
+ );
1060
+ delete dashboardComponent.promises[requestId];
1061
+ }
1062
+ }, 2e3);
1063
+ });
1389
1064
  }
1390
- _$Ev() {
1391
- this._$ES = new Promise((t5) => this.enableUpdating = t5), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((t5) => t5(this));
1065
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
1066
+ };
1067
+
1068
+ // libs/embed-libs/shared-embed/src/lib/methods/get-filters.ts
1069
+ var getFilters = (dashboardComponent, iframe) => {
1070
+ if (iframe?.contentWindow) {
1071
+ const requestId = uuidv4();
1072
+ iframe.contentWindow.postMessage(
1073
+ { action: "getFilters", _version: dashboardComponent.VERSION, requestId },
1074
+ "*"
1075
+ );
1076
+ return new Promise((resolve, reject) => {
1077
+ dashboardComponent.promises[requestId] = { resolve, reject };
1078
+ setTimeout(() => {
1079
+ if (dashboardComponent.promises[requestId]) {
1080
+ const errorMessage = "getFilters request timed out.";
1081
+ dashboardComponent.promises[requestId].reject(
1082
+ new Error(errorMessage)
1083
+ );
1084
+ delete dashboardComponent.promises[requestId];
1085
+ }
1086
+ }, 2e3);
1087
+ });
1392
1088
  }
1393
- addController(t5) {
1394
- (this._$EO ??= /* @__PURE__ */ new Set()).add(t5), void 0 !== this.renderRoot && this.isConnected && t5.hostConnected?.();
1089
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
1090
+ };
1091
+
1092
+ // libs/embed-libs/shared-embed/src/lib/methods/refresh-data.ts
1093
+ var refreshData = (dashboardComponent, iframe, itemId) => {
1094
+ if (iframe) {
1095
+ iframe.contentWindow.postMessage(
1096
+ {
1097
+ action: "refreshData",
1098
+ id: itemId ?? null,
1099
+ _version: dashboardComponent.VERSION
1100
+ },
1101
+ "*"
1102
+ );
1103
+ return Promise.resolve();
1395
1104
  }
1396
- removeController(t5) {
1397
- this._$EO?.delete(t5);
1105
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
1106
+ };
1107
+
1108
+ // libs/embed-libs/shared-embed/src/lib/methods/reload-dashboard.ts
1109
+ var reloadDashboard = (dashboardComponent, iframe) => {
1110
+ if (iframe) {
1111
+ iframe.contentWindow.postMessage(
1112
+ { action: "reloadDashboard", _version: dashboardComponent.VERSION },
1113
+ "*"
1114
+ );
1115
+ return Promise.resolve();
1398
1116
  }
1399
- _$E_() {
1400
- const t5 = /* @__PURE__ */ new Map(), s4 = this.constructor.elementProperties;
1401
- for (const i6 of s4.keys())
1402
- this.hasOwnProperty(i6) && (t5.set(i6, this[i6]), delete this[i6]);
1403
- t5.size > 0 && (this._$Ep = t5);
1117
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
1118
+ };
1119
+
1120
+ // libs/embed-libs/shared-embed/src/lib/methods/set-authorization.ts
1121
+ var setAuthorization = (dashboardComponent, iframe, key, token) => {
1122
+ if (iframe) {
1123
+ iframe.contentWindow.postMessage(
1124
+ {
1125
+ action: "setAuthorization",
1126
+ key,
1127
+ token,
1128
+ _version: dashboardComponent.VERSION
1129
+ },
1130
+ "*"
1131
+ );
1132
+ return Promise.resolve();
1404
1133
  }
1405
- createRenderRoot() {
1406
- const t5 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
1407
- return S(t5, this.constructor.elementStyles), t5;
1134
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
1135
+ };
1136
+
1137
+ // libs/embed-libs/shared-embed/src/lib/methods/set-edit-mode.ts
1138
+ var setEditMode = (dashboardComponent, iframe, editMode) => {
1139
+ if (iframe && iframe.contentWindow) {
1140
+ const requestId = uuidv4();
1141
+ if (dashboardComponent.params.editMode === editMode) {
1142
+ return Promise.reject(
1143
+ new Error("editMode parameter is currently already set to " + editMode)
1144
+ );
1145
+ } else if (editMode !== "editFull" && editMode !== "editLimited" && editMode !== "view") {
1146
+ return Promise.reject(
1147
+ new Error(
1148
+ "The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'."
1149
+ )
1150
+ );
1151
+ }
1152
+ iframe.contentWindow.postMessage(
1153
+ {
1154
+ action: "setEditMode",
1155
+ editMode,
1156
+ _version: dashboardComponent.VERSION,
1157
+ requestId
1158
+ },
1159
+ "*"
1160
+ );
1161
+ return new Promise((resolve, reject) => {
1162
+ dashboardComponent.promises[requestId] = { resolve, reject };
1163
+ });
1408
1164
  }
1409
- connectedCallback() {
1410
- this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach((t5) => t5.hostConnected?.());
1165
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
1166
+ };
1167
+
1168
+ // libs/embed-libs/shared-embed/src/lib/methods/set-filters.ts
1169
+ var setFilters = (dashboardComponent, iframe, itemId, filters) => {
1170
+ if (iframe) {
1171
+ const requestId = uuidv4();
1172
+ iframe.contentWindow.postMessage(
1173
+ {
1174
+ action: "setFilters",
1175
+ itemId,
1176
+ filters,
1177
+ _version: dashboardComponent.VERSION,
1178
+ requestId
1179
+ },
1180
+ "*"
1181
+ );
1182
+ return new Promise((resolve, reject) => {
1183
+ dashboardComponent.promises[requestId] = { resolve, reject };
1184
+ setTimeout(() => {
1185
+ if (dashboardComponent.promises[requestId]) {
1186
+ const errorMessage = "setFilters request timed out.";
1187
+ dashboardComponent.promises[requestId].reject(
1188
+ new Error(errorMessage)
1189
+ );
1190
+ delete dashboardComponent.promises[requestId];
1191
+ }
1192
+ }, 2e3);
1193
+ });
1411
1194
  }
1412
- enableUpdating(t5) {
1195
+ return Promise.reject();
1196
+ };
1197
+
1198
+ // libs/embed-libs/shared-embed/src/lib/methods/set-preview.ts
1199
+ var setPreview = (dashboardComponent, iframe, preview) => {
1200
+ if (iframe) {
1201
+ const requestId = uuidv4();
1202
+ iframe.contentWindow.postMessage(
1203
+ {
1204
+ action: "setPreview",
1205
+ preview,
1206
+ requestId,
1207
+ _version: dashboardComponent.VERSION
1208
+ },
1209
+ "*"
1210
+ );
1211
+ return new Promise((resolve, reject) => {
1212
+ dashboardComponent.promises[requestId] = { resolve, reject };
1213
+ setTimeout(() => {
1214
+ if (dashboardComponent.promises[requestId]) {
1215
+ const errorMessage = "setPreview request timed out.";
1216
+ dashboardComponent.promises[requestId].reject(
1217
+ new Error(errorMessage)
1218
+ );
1219
+ delete dashboardComponent.promises[requestId];
1220
+ }
1221
+ }, 2e3);
1222
+ });
1413
1223
  }
1414
- disconnectedCallback() {
1415
- this._$EO?.forEach((t5) => t5.hostDisconnected?.());
1224
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
1225
+ };
1226
+
1227
+ // libs/embed-libs/shared-embed/src/lib/service/calculate-dimensions.ts
1228
+ var _setCalculatedDimensions = (dashboardComponent) => {
1229
+ if (!dashboardComponent.dimensions) {
1230
+ dashboardComponent.params.error = true;
1231
+ _handleError("Got no valid dimensions.", dashboardComponent.params);
1232
+ return;
1416
1233
  }
1417
- attributeChangedCallback(t5, s4, i6) {
1418
- this._$AK(t5, i6);
1234
+ const dashboardDimensionKeys = Object.keys(
1235
+ dashboardComponent.dimensions
1236
+ );
1237
+ const availableScreenModeExtents = [];
1238
+ let currentMode;
1239
+ let currentWidth = 0;
1240
+ let currentHeight = 0;
1241
+ if (!dashboardComponent.params.switchScreenModeOnResize && dashboardComponent.currentScreenMode) {
1242
+ dashboardComponent.params.screenMode = dashboardComponent.currentScreenMode;
1419
1243
  }
1420
- _$EC(t5, s4) {
1421
- const i6 = this.constructor.elementProperties.get(t5), e7 = this.constructor._$Eu(t5, i6);
1422
- if (void 0 !== e7 && true === i6.reflect) {
1423
- const r7 = (void 0 !== i6.converter?.toAttribute ? i6.converter : u).toAttribute(s4, i6.type);
1424
- this._$Em = t5, null == r7 ? this.removeAttribute(e7) : this.setAttribute(e7, r7), this._$Em = null;
1244
+ if (dashboardComponent.dimensions && dashboardDimensionKeys?.[0] === "fixed") {
1245
+ currentMode = "fixed";
1246
+ currentWidth = dashboardComponent.dimensions.fixed[0];
1247
+ currentHeight = dashboardComponent.dimensions.fixed[1];
1248
+ } else {
1249
+ const screenModes = [
1250
+ "mobile",
1251
+ "tablet",
1252
+ "desktop",
1253
+ "largeScreen"
1254
+ ];
1255
+ if (dashboardComponent.params.itemEmbedding) {
1256
+ const [firstMatch] = dashboardDimensionKeys;
1257
+ let match = cloneDeep(firstMatch);
1258
+ for (const screenMode of screenModes) {
1259
+ const found = dashboardDimensionKeys.find((key) => key === screenMode);
1260
+ if (found) {
1261
+ match = cloneDeep(found);
1262
+ } else {
1263
+ dashboardComponent.dimensions[screenMode] = dashboardComponent.dimensions[match];
1264
+ }
1265
+ }
1425
1266
  }
1426
- }
1427
- _$AK(t5, s4) {
1428
- const i6 = this.constructor, e7 = i6._$Eh.get(t5);
1429
- if (void 0 !== e7 && this._$Em !== e7) {
1430
- const t6 = i6.getPropertyOptions(e7), r7 = "function" == typeof t6.converter ? { fromAttribute: t6.converter } : void 0 !== t6.converter?.fromAttribute ? t6.converter : u;
1431
- this._$Em = e7, this[e7] = r7.fromAttribute(s4, t6.type), this._$Em = null;
1267
+ for (const key of dashboardDimensionKeys) {
1268
+ if (screenModes.includes(key)) {
1269
+ const screenMode = EXTENTS.find((extent) => extent.mode === key);
1270
+ availableScreenModeExtents.push({
1271
+ ...screenMode,
1272
+ height: dashboardComponent.dimensions[key][1] || 50
1273
+ });
1274
+ }
1432
1275
  }
1433
- }
1434
- requestUpdate(t5, s4, i6) {
1435
- if (void 0 !== t5) {
1436
- if (i6 ??= this.constructor.getPropertyOptions(t5), !(i6.hasChanged ?? f)(this[t5], s4))
1437
- return;
1438
- this.P(t5, s4, i6);
1276
+ if (!availableScreenModeExtents.map((screenModeExtent) => screenModeExtent.mode).includes(dashboardComponent.params.screenMode)) {
1277
+ dashboardComponent.params.screenMode = "auto";
1278
+ }
1279
+ if (dashboardComponent.params.screenMode === "auto") {
1280
+ availableScreenModeExtents.sort(
1281
+ (a3, b3) => screenModes.indexOf(a3.mode) - screenModes.indexOf(b3.mode)
1282
+ );
1283
+ for (const screenModeExtent of availableScreenModeExtents) {
1284
+ const [screenModeExtentMinWidth, screenModeExtentMaxWidth] = screenModeExtent.width;
1285
+ if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
1286
+ if (screenModeExtentMinWidth < dashboardComponent.params.itemDimensions.width) {
1287
+ currentMode = screenModeExtent.mode;
1288
+ currentWidth = Number.parseInt(
1289
+ dashboardComponent.params.itemDimensions.width,
1290
+ 10
1291
+ );
1292
+ currentHeight = dashboardComponent.dimensions[currentMode][1];
1293
+ }
1294
+ } else {
1295
+ if (screenModeExtentMinWidth < dashboardComponent.containerWidth) {
1296
+ currentMode = screenModeExtent.mode;
1297
+ if (dashboardComponent.params.itemEmbedding) {
1298
+ currentWidth = dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto" ? Number.parseInt(
1299
+ dashboardComponent.params.itemDimensions.width,
1300
+ 10
1301
+ ) : Math.min(
1302
+ dashboardComponent.containerWidth,
1303
+ screenModeExtentMaxWidth
1304
+ );
1305
+ currentHeight = dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto" ? Number.parseInt(
1306
+ dashboardComponent.params.itemDimensions.height,
1307
+ 10
1308
+ ) : dashboardComponent.dimensions[currentMode][1];
1309
+ if (dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
1310
+ currentWidth = Number.parseInt(
1311
+ dashboardComponent.params.itemDimensions.width,
1312
+ 10
1313
+ );
1314
+ currentHeight = dashboardComponent.dimensions[currentMode][1];
1315
+ }
1316
+ } else {
1317
+ currentWidth = Math.max(
1318
+ Math.min(
1319
+ screenModeExtentMaxWidth,
1320
+ dashboardComponent.containerWidth
1321
+ ),
1322
+ screenModeExtentMinWidth
1323
+ );
1324
+ currentHeight = screenModeExtent.height;
1325
+ }
1326
+ }
1327
+ }
1328
+ }
1329
+ } else {
1330
+ const {
1331
+ height: chosenModeHeight,
1332
+ width: [chosenModeMinWidth, chosenModeMaxWidth]
1333
+ } = availableScreenModeExtents.find(
1334
+ (d3) => d3.mode === dashboardComponent.params.screenMode
1335
+ );
1336
+ currentMode = dashboardComponent.params.screenMode;
1337
+ currentWidth = Math.max(
1338
+ Math.min(chosenModeMaxWidth, dashboardComponent.containerWidth),
1339
+ chosenModeMinWidth
1340
+ );
1341
+ currentHeight = chosenModeHeight;
1342
+ if (dashboardComponent.params.itemEmbedding) {
1343
+ if (dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto") {
1344
+ currentWidth = Number.parseInt(
1345
+ dashboardComponent.params.itemDimensions.width,
1346
+ 10
1347
+ );
1348
+ }
1349
+ if (dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto") {
1350
+ currentHeight = Number.parseInt(
1351
+ dashboardComponent.params.itemDimensions.height,
1352
+ 10
1353
+ );
1354
+ }
1355
+ }
1356
+ }
1357
+ if (!currentMode && availableScreenModeExtents.length > 0) {
1358
+ const [lowestModeExtent] = availableScreenModeExtents;
1359
+ currentMode = lowestModeExtent.mode;
1360
+ currentWidth = lowestModeExtent.width[0];
1361
+ currentHeight = lowestModeExtent.height;
1439
1362
  }
1440
- false === this.isUpdatePending && (this._$ES = this._$ET());
1441
1363
  }
1442
- P(t5, s4, i6) {
1443
- this._$AL.has(t5) || this._$AL.set(t5, s4), true === i6.reflect && this._$Em !== t5 && (this._$Ej ??= /* @__PURE__ */ new Set()).add(t5);
1364
+ dashboardComponent.currentScreenMode = currentMode;
1365
+ const style = {
1366
+ height: currentHeight === 0 ? "100%" : `${String(currentHeight)}px`,
1367
+ width: currentWidth === 0 ? "100%" : `${String(currentWidth)}px`,
1368
+ opacity: 1
1369
+ };
1370
+ const dashboardEditModes = ["editFull", "editLimited"];
1371
+ if (dashboardEditModes.includes(dashboardComponent.params.editMode)) {
1372
+ style.height = "100%";
1373
+ style.width = "100%";
1374
+ } else if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions) {
1375
+ style.height = dashboardComponent.params.itemDimensions.height === "auto" ? style.height : `${String(dashboardComponent.params.itemDimensions.height).replace(
1376
+ "px",
1377
+ ""
1378
+ )}px`;
1379
+ style.width = dashboardComponent.params.itemDimensions.width === "auto" ? style.width : `${String(dashboardComponent.params.itemDimensions.width).replace(
1380
+ "px",
1381
+ ""
1382
+ )}px`;
1383
+ } else {
1384
+ style.height = currentHeight === 0 ? "100%" : `${String(currentHeight)}px`;
1385
+ style.width = currentWidth === 0 ? "100%" : `${String(currentWidth)}px`;
1444
1386
  }
1445
- async _$ET() {
1446
- this.isUpdatePending = true;
1447
- try {
1448
- await this._$ES;
1449
- } catch (t6) {
1450
- Promise.reject(t6);
1387
+ dashboardComponent.currentScreenMode = currentMode;
1388
+ dashboardComponent.iframeStyle = style;
1389
+ };
1390
+
1391
+ // libs/embed-libs/shared-embed/src/lib/service/extend-and-validate.ts
1392
+ var _extendAndValidate = (dashboardContent) => {
1393
+ const defaultKeys = Object.keys(
1394
+ DEFAULT_PARAMETERS
1395
+ );
1396
+ const errorMessages = [];
1397
+ const requiredStringParams = [
1398
+ "appServer",
1399
+ "language",
1400
+ "apiHost"
1401
+ ];
1402
+ const requiredStringOrEmptyParams = [
1403
+ "key",
1404
+ "token",
1405
+ "screenMode",
1406
+ "timezoneId",
1407
+ "itemId",
1408
+ "container",
1409
+ "loaderBackground",
1410
+ "loaderFontColor",
1411
+ "loaderSpinnerColor",
1412
+ "loaderSpinnerBackground"
1413
+ ];
1414
+ const objectParams = ["itemDimensions"];
1415
+ const screenModes = [
1416
+ "mobile",
1417
+ "tablet",
1418
+ "desktop",
1419
+ "largeScreen",
1420
+ "fixed",
1421
+ "auto"
1422
+ ];
1423
+ for (const key of defaultKeys) {
1424
+ if (dashboardContent.params[key] === null) {
1425
+ delete dashboardContent.params[key];
1451
1426
  }
1452
- const t5 = this.scheduleUpdate();
1453
- return null != t5 && await t5, !this.isUpdatePending;
1454
1427
  }
1455
- scheduleUpdate() {
1456
- return this.performUpdate();
1428
+ dashboardContent.params = defaultsDeep(
1429
+ dashboardContent.params,
1430
+ DEFAULT_PARAMETERS
1431
+ );
1432
+ if ((!dashboardContent.params.dashboardId || typeof dashboardContent.params.dashboardId !== "string") && (!dashboardContent.params.dashboardSlug || typeof dashboardContent.params.dashboardSlug !== "string")) {
1433
+ delete dashboardContent.params.dashboardId;
1434
+ delete dashboardContent.params.dashboardSlug;
1457
1435
  }
1458
- performUpdate() {
1459
- if (!this.isUpdatePending)
1460
- return;
1461
- if (!this.hasUpdated) {
1462
- if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
1463
- for (const [t7, s5] of this._$Ep)
1464
- this[t7] = s5;
1465
- this._$Ep = void 0;
1466
- }
1467
- const t6 = this.constructor.elementProperties;
1468
- if (t6.size > 0)
1469
- for (const [s5, i6] of t6)
1470
- true !== i6.wrapped || this._$AL.has(s5) || void 0 === this[s5] || this.P(s5, this[s5], i6);
1436
+ for (const key of requiredStringParams) {
1437
+ if (typeof dashboardContent.params[key] !== "string") {
1438
+ delete dashboardContent.params[key];
1439
+ errorMessages.push(`${key} needs to be of type string.`);
1471
1440
  }
1472
- let t5 = false;
1473
- const s4 = this._$AL;
1474
- try {
1475
- t5 = this.shouldUpdate(s4), t5 ? (this.willUpdate(s4), this._$EO?.forEach((t6) => t6.hostUpdate?.()), this.update(s4)) : this._$EU();
1476
- } catch (s5) {
1477
- throw t5 = false, this._$EU(), s5;
1441
+ }
1442
+ for (const key of requiredStringOrEmptyParams) {
1443
+ if (typeof dashboardContent.params[key] !== "string" && dashboardContent.params[key] !== null && dashboardContent.params[key] !== void 0) {
1444
+ delete dashboardContent.params[key];
1445
+ errorMessages.push(`${key} needs to be of type string or empty.`);
1478
1446
  }
1479
- t5 && this._$AE(s4);
1480
1447
  }
1481
- willUpdate(t5) {
1448
+ if (dashboardContent.params.screenMode && !screenModes.includes(dashboardContent.params.screenMode)) {
1449
+ const validTypesString = screenModes.map((mode) => `"${mode}"`).join(", ");
1450
+ errorMessages.push(
1451
+ `"screenMode" needs should be one of these types: ${validTypesString}`
1452
+ );
1453
+ dashboardContent.params.screenMode = "auto";
1482
1454
  }
1483
- _$AE(t5) {
1484
- this._$EO?.forEach((t6) => t6.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t5)), this.updated(t5);
1455
+ if (dashboardContent.params.itemId) {
1456
+ dashboardContent.params.itemEmbedding = true;
1485
1457
  }
1486
- _$EU() {
1487
- this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false;
1458
+ for (const key of objectParams) {
1459
+ if (typeof dashboardContent.params[key] !== "object" && dashboardContent.params[key] !== null) {
1460
+ delete dashboardContent.params[key];
1461
+ errorMessages.push(`${key} needs to be of type object or empty.`);
1462
+ }
1488
1463
  }
1489
- get updateComplete() {
1490
- return this.getUpdateComplete();
1464
+ if (typeof dashboardContent.params.switchScreenModeOnResize !== "boolean") {
1465
+ errorMessages.push("switchScreenModeOnResize needs to be of type boolean.");
1466
+ dashboardContent.params.switchScreenModeOnResize = true;
1491
1467
  }
1492
- getUpdateComplete() {
1493
- return this._$ES;
1468
+ if (dashboardContent.params.itemDimensions) {
1469
+ const itemDimensionsKeys = [
1470
+ "width",
1471
+ "height"
1472
+ ];
1473
+ for (const key of itemDimensionsKeys) {
1474
+ if (!["string", "number"].includes(
1475
+ typeof dashboardContent.params.itemDimensions[key]
1476
+ ) && dashboardContent.params.itemDimensions[key] !== null) {
1477
+ errorMessages.push(
1478
+ `itemDimensions ${key} needs to be of type string, number or empty.`
1479
+ );
1480
+ }
1481
+ }
1494
1482
  }
1495
- shouldUpdate(t5) {
1496
- return true;
1483
+ dashboardContent.params = defaultsDeep(
1484
+ dashboardContent.params,
1485
+ DEFAULT_PARAMETERS
1486
+ );
1487
+ if (dashboardContent.params.screenMode && dashboardContent.params.screenMode !== "auto") {
1488
+ dashboardContent.params.switchScreenModeOnResize = false;
1497
1489
  }
1498
- update(t5) {
1499
- this._$Ej &&= this._$Ej.forEach((t6) => this._$EC(t6, this[t6])), this._$EU();
1490
+ if (dashboardContent.params.itemDimensions.width !== "auto") {
1491
+ dashboardContent.params.itemDimensions.width = Number.parseInt(
1492
+ `${dashboardContent.params.itemDimensions.width}`.replace("px", ""),
1493
+ 10
1494
+ ) || "auto";
1500
1495
  }
1501
- updated(t5) {
1496
+ if (dashboardContent.params.itemDimensions.height !== "auto") {
1497
+ dashboardContent.params.itemDimensions.height = Number.parseInt(
1498
+ `${dashboardContent.params.itemDimensions.height}`.replace("px", ""),
1499
+ 10
1500
+ ) || "auto";
1502
1501
  }
1503
- firstUpdated(t5) {
1502
+ dashboardContent.params.itemEmbedding = !!dashboardContent.params.itemId;
1503
+ if (dashboardContent.params.error || errorMessages.length > 0) {
1504
+ _handleError(errorMessages.join("\n"), dashboardContent.params);
1504
1505
  }
1505
1506
  };
1506
- 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");
1507
+
1508
+ // libs/embed-libs/shared-embed/src/lib/constants/class-constants.ts
1509
+ var luzmoEmbedContainerClass = "luzmo-embed-container";
1510
+
1511
+ // libs/embed-libs/shared-embed/src/lib/helpers/remote-federation.ts
1512
+ var remotesMap = {
1513
+ // "remote_app": { url: "http://localhost:4201/remoteEntry.mjs", format: "esm", from: "vite" },
1514
+ };
1515
+ var loadJS = async (url, fn) => {
1516
+ const resolvedUrl = typeof url === "function" ? await url() : url;
1517
+ const script = document.createElement("script");
1518
+ script.type = "text/javascript";
1519
+ script.addEventListener("load", fn);
1520
+ script.src = resolvedUrl;
1521
+ document.querySelectorAll("head")[0].append(script);
1522
+ };
1523
+ var wrapShareModule = (remoteFrom) => ({});
1524
+ async function __federationMethodEnsure(remoteId) {
1525
+ const remote = remotesMap[remoteId];
1526
+ if (remote.inited) {
1527
+ return remote.lib;
1528
+ }
1529
+ if (remote.format === "var") {
1530
+ return new Promise((resolve) => {
1531
+ const callback = () => {
1532
+ if (!remote.inited) {
1533
+ remote.lib = window[remoteId];
1534
+ remote.lib.init(wrapShareModule(remote.from));
1535
+ remote.inited = true;
1536
+ }
1537
+ resolve(remote.lib);
1538
+ };
1539
+ return loadJS(remote.url, callback);
1540
+ });
1541
+ } else if (["esm", "systemjs"].includes(remote.format)) {
1542
+ return new Promise((resolve, reject) => {
1543
+ const getUrl = typeof remote.url === "function" ? remote.url : () => Promise.resolve(remote.url);
1544
+ getUrl().then((url) => {
1545
+ import(
1546
+ /* @vite-ignore */
1547
+ /* webpackIgnore: true */
1548
+ url
1549
+ ).then((lib) => {
1550
+ if (!remote.inited) {
1551
+ const shareScope = wrapShareModule(remote.from);
1552
+ lib.init(shareScope);
1553
+ remote.lib = lib;
1554
+ remote.lib.init(shareScope);
1555
+ remote.inited = true;
1556
+ }
1557
+ resolve(remote.lib);
1558
+ }).catch(reject);
1559
+ });
1560
+ });
1561
+ }
1562
+ }
1563
+ function __federationMethodWrapDefault(module2, need) {
1564
+ if (!(module2 == null ? void 0 : module2.default) && need) {
1565
+ const obj = /* @__PURE__ */ Object.create(null);
1566
+ obj.default = module2;
1567
+ obj.__esModule = true;
1568
+ return obj;
1569
+ }
1570
+ return module2;
1571
+ }
1572
+ async function __federationMethodGetRemote(remoteName, componentName) {
1573
+ return __federationMethodEnsure(remoteName).then((remote) => remote.get(componentName).then((factory) => factory()));
1574
+ }
1507
1575
 
1508
1576
  // node_modules/lit-html/lit-html.js
1509
- var t2 = globalThis;
1510
- var i3 = t2.trustedTypes;
1577
+ var t3 = globalThis;
1578
+ var i3 = t3.trustedTypes;
1511
1579
  var s2 = i3 ? i3.createPolicy("lit-html", { createHTML: (t5) => t5 }) : void 0;
1512
- var e3 = "$lit$";
1580
+ var e5 = "$lit$";
1513
1581
  var h2 = `lit$${(Math.random() + "").slice(9)}$`;
1514
- var o3 = "?" + h2;
1515
- var n3 = `<${o3}>`;
1516
- var r3 = document;
1517
- var l2 = () => r3.createComment("");
1582
+ var o4 = "?" + h2;
1583
+ var n4 = `<${o4}>`;
1584
+ var r5 = document;
1585
+ var l2 = () => r5.createComment("");
1518
1586
  var c3 = (t5) => null === t5 || "object" != typeof t5 && "function" != typeof t5;
1519
1587
  var a2 = Array.isArray;
1520
1588
  var u2 = (t5) => a2(t5) || "function" == typeof t5?.[Symbol.iterator];
@@ -1533,7 +1601,7 @@ var b2 = y2(2);
1533
1601
  var w = Symbol.for("lit-noChange");
1534
1602
  var T = Symbol.for("lit-nothing");
1535
1603
  var A = /* @__PURE__ */ new WeakMap();
1536
- var E = r3.createTreeWalker(r3, 129);
1604
+ var E = r5.createTreeWalker(r5, 129);
1537
1605
  function C(t5, i6) {
1538
1606
  if (!Array.isArray(t5) || !t5.hasOwnProperty("raw"))
1539
1607
  throw Error("invalid template strings array");
@@ -1548,7 +1616,7 @@ var P = (t5, i6) => {
1548
1616
  for (; y3 < s5.length && (c4.lastIndex = y3, u3 = c4.exec(s5), null !== u3); )
1549
1617
  y3 = c4.lastIndex, c4 === f2 ? "!--" === u3[1] ? c4 = v : void 0 !== u3[1] ? c4 = _ : void 0 !== u3[2] ? ($.test(u3[2]) && (r7 = RegExp("</" + u3[2], "g")), c4 = m) : void 0 !== u3[3] && (c4 = m) : c4 === m ? ">" === u3[0] ? (c4 = r7 ?? f2, d3 = -1) : void 0 === u3[1] ? d3 = -2 : (d3 = c4.lastIndex - u3[2].length, a3 = u3[1], c4 = void 0 === u3[3] ? m : '"' === u3[3] ? g : p2) : c4 === g || c4 === p2 ? c4 = m : c4 === v || c4 === _ ? c4 = f2 : (c4 = m, r7 = void 0);
1550
1618
  const x2 = c4 === m && t5[i7 + 1].startsWith("/>") ? " " : "";
1551
- l3 += c4 === f2 ? s5 + n3 : d3 >= 0 ? (o6.push(a3), s5.slice(0, d3) + e3 + s5.slice(d3) + h2 + x2) : s5 + h2 + (-2 === d3 ? i7 : x2);
1619
+ l3 += c4 === f2 ? s5 + n4 : d3 >= 0 ? (o6.push(a3), s5.slice(0, d3) + e5 + s5.slice(d3) + h2 + x2) : s5 + h2 + (-2 === d3 ? i7 : x2);
1552
1620
  }
1553
1621
  return [C(t5, l3 + (t5[s4] || "<?>") + (2 === i6 ? "</svg>" : "")), o6];
1554
1622
  };
@@ -1566,7 +1634,7 @@ var V = class _V {
1566
1634
  if (1 === r7.nodeType) {
1567
1635
  if (r7.hasAttributes())
1568
1636
  for (const t6 of r7.getAttributeNames())
1569
- if (t6.endsWith(e3)) {
1637
+ if (t6.endsWith(e5)) {
1570
1638
  const i6 = v2[a3++], s5 = r7.getAttribute(t6).split(h2), e7 = /([.?@])?(.*)/.exec(i6);
1571
1639
  d3.push({ type: 1, index: c4, name: e7[2], strings: s5, ctor: "." === e7[1] ? k : "?" === e7[1] ? H : "@" === e7[1] ? I : R }), r7.removeAttribute(t6);
1572
1640
  } else
@@ -1581,7 +1649,7 @@ var V = class _V {
1581
1649
  }
1582
1650
  }
1583
1651
  } else if (8 === r7.nodeType)
1584
- if (r7.data === o3)
1652
+ if (r7.data === o4)
1585
1653
  d3.push({ type: 2, index: c4 });
1586
1654
  else {
1587
1655
  let t6 = -1;
@@ -1592,7 +1660,7 @@ var V = class _V {
1592
1660
  }
1593
1661
  }
1594
1662
  static createElement(t5, i6) {
1595
- const s4 = r3.createElement("template");
1663
+ const s4 = r5.createElement("template");
1596
1664
  return s4.innerHTML = t5, s4;
1597
1665
  }
1598
1666
  };
@@ -1614,7 +1682,7 @@ var S2 = class {
1614
1682
  return this._$AM._$AU;
1615
1683
  }
1616
1684
  u(t5) {
1617
- const { el: { content: i6 }, parts: s4 } = this._$AD, e7 = (t5?.creationScope ?? r3).importNode(i6, true);
1685
+ const { el: { content: i6 }, parts: s4 } = this._$AD, e7 = (t5?.creationScope ?? r5).importNode(i6, true);
1618
1686
  E.currentNode = e7;
1619
1687
  let h3 = E.nextNode(), o6 = 0, n6 = 0, l3 = s4[0];
1620
1688
  for (; void 0 !== l3; ) {
@@ -1624,7 +1692,7 @@ var S2 = class {
1624
1692
  }
1625
1693
  o6 !== l3?.index && (h3 = E.nextNode(), o6++);
1626
1694
  }
1627
- return E.currentNode = r3, e7;
1695
+ return E.currentNode = r5, e7;
1628
1696
  }
1629
1697
  p(t5) {
1630
1698
  let i6 = 0;
@@ -1660,7 +1728,7 @@ var M = class _M {
1660
1728
  this._$AH !== t5 && (this._$AR(), this._$AH = this.S(t5));
1661
1729
  }
1662
1730
  _(t5) {
1663
- this._$AH !== T && c3(this._$AH) ? this._$AA.nextSibling.data = t5 : this.T(r3.createTextNode(t5)), this._$AH = t5;
1731
+ this._$AH !== T && c3(this._$AH) ? this._$AA.nextSibling.data = t5 : this.T(r5.createTextNode(t5)), this._$AH = t5;
1664
1732
  }
1665
1733
  $(t5) {
1666
1734
  const { values: i6, _$litType$: s4 } = t5, e7 = "number" == typeof s4 ? this._$AC(t5) : (void 0 === s4.el && (s4.el = V.createElement(C(s4.h, s4.h[0]), this.options)), s4);
@@ -1761,8 +1829,8 @@ var L = class {
1761
1829
  N(this, t5);
1762
1830
  }
1763
1831
  };
1764
- var Z = t2.litHtmlPolyfillSupport;
1765
- Z?.(V, M), (t2.litHtmlVersions ??= []).push("3.1.2");
1832
+ var Z = t3.litHtmlPolyfillSupport;
1833
+ Z?.(V, M), (t3.litHtmlVersions ??= []).push("3.1.2");
1766
1834
  var j = (t5, i6, s4) => {
1767
1835
  const e7 = s4?.renderBefore ?? i6;
1768
1836
  let h3 = e7._$litPart$;
@@ -1797,79 +1865,10 @@ var s3 = class extends b {
1797
1865
  }
1798
1866
  };
1799
1867
  s3._$litElement$ = true, s3["finalized", "finalized"] = true, globalThis.litElementHydrateSupport?.({ LitElement: s3 });
1800
- var r4 = globalThis.litElementPolyfillSupport;
1801
- r4?.({ LitElement: s3 });
1868
+ var r6 = globalThis.litElementPolyfillSupport;
1869
+ r6?.({ LitElement: s3 });
1802
1870
  (globalThis.litElementVersions ??= []).push("4.0.4");
1803
1871
 
1804
- // node_modules/@lit/reactive-element/decorators/custom-element.js
1805
- var t3 = (t5) => (e7, o6) => {
1806
- void 0 !== o6 ? o6.addInitializer(() => {
1807
- customElements.define(t5, e7);
1808
- }) : customElements.define(t5, e7);
1809
- };
1810
-
1811
- // node_modules/@lit/reactive-element/decorators/property.js
1812
- var o4 = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f };
1813
- var r5 = (t5 = o4, e7, r7) => {
1814
- const { kind: n6, metadata: i6 } = r7;
1815
- let s4 = globalThis.litPropertyMetadata.get(i6);
1816
- if (void 0 === s4 && globalThis.litPropertyMetadata.set(i6, s4 = /* @__PURE__ */ new Map()), s4.set(r7.name, t5), "accessor" === n6) {
1817
- const { name: o6 } = r7;
1818
- return { set(r8) {
1819
- const n7 = e7.get.call(this);
1820
- e7.set.call(this, r8), this.requestUpdate(o6, n7, t5);
1821
- }, init(e8) {
1822
- return void 0 !== e8 && this.P(o6, void 0, t5), e8;
1823
- } };
1824
- }
1825
- if ("setter" === n6) {
1826
- const { name: o6 } = r7;
1827
- return function(r8) {
1828
- const n7 = this[o6];
1829
- e7.call(this, r8), this.requestUpdate(o6, n7, t5);
1830
- };
1831
- }
1832
- throw Error("Unsupported decorator location: " + n6);
1833
- };
1834
- function n4(t5) {
1835
- return (e7, o6) => "object" == typeof o6 ? r5(t5, e7, o6) : ((t6, e8, o7) => {
1836
- const r7 = e8.hasOwnProperty(o7);
1837
- return e8.constructor.createProperty(o7, r7 ? { ...t6, wrapped: true } : t6), r7 ? Object.getOwnPropertyDescriptor(e8, o7) : void 0;
1838
- })(t5, e7, o6);
1839
- }
1840
-
1841
- // node_modules/@lit/reactive-element/decorators/state.js
1842
- function r6(r7) {
1843
- return n4({ ...r7, state: true, attribute: false });
1844
- }
1845
-
1846
- // node_modules/@lit/reactive-element/decorators/base.js
1847
- var e4 = (e7, t5, c4) => (c4.configurable = true, c4.enumerable = true, Reflect.decorate && "object" != typeof t5 && Object.defineProperty(e7, t5, c4), c4);
1848
-
1849
- // node_modules/@lit/reactive-element/decorators/query.js
1850
- function e5(e7, r7) {
1851
- return (n6, s4, i6) => {
1852
- const o6 = (t5) => t5.renderRoot?.querySelector(e7) ?? null;
1853
- if (r7) {
1854
- const { get: e8, set: r8 } = "object" == typeof s4 ? n6 : i6 ?? (() => {
1855
- const t5 = Symbol();
1856
- return { get() {
1857
- return this[t5];
1858
- }, set(e9) {
1859
- this[t5] = e9;
1860
- } };
1861
- })();
1862
- return e4(n6, s4, { get() {
1863
- let t5 = e8.call(this);
1864
- return void 0 === t5 && (t5 = o6(this), (null !== t5 || this.hasUpdated) && r8.call(this, t5)), t5;
1865
- } });
1866
- }
1867
- return e4(n6, s4, { get() {
1868
- return o6(this);
1869
- } });
1870
- };
1871
- }
1872
-
1873
1872
  // node_modules/lit-html/directive.js
1874
1873
  var t4 = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 };
1875
1874
  var e6 = (t5) => (...e7) => ({ _$litDirective$: t5, values: e7 });
@@ -1923,7 +1922,7 @@ var o5 = e6(class extends i4 {
1923
1922
  });
1924
1923
 
1925
1924
  // libs/embed-libs/embed/package.json
1926
- var version = "5.0.10";
1925
+ var version = "5.0.11";
1927
1926
 
1928
1927
  // libs/embed-libs/embed/src/lib/luzmo-service.ts
1929
1928
  var LuzmoService = class {
@@ -2200,7 +2199,7 @@ var dashboardStyles = i`
2200
2199
  }
2201
2200
  `;
2202
2201
 
2203
- // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
2202
+ // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-base.ts
2204
2203
  var LuzmoDashboard = class extends s3 {
2205
2204
  constructor(inputParameters) {
2206
2205
  super();
@@ -2287,7 +2286,12 @@ var LuzmoDashboard = class extends s3 {
2287
2286
  if (remotesMap[appServer]) {
2288
2287
  return Promise.resolve(remotesMap[appServer].module);
2289
2288
  }
2290
- remotesMap[appServer] = { url: appServer?.startsWith("http://localhost") ? `${removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`, format: "esm", from: "vite", module: void 0 };
2289
+ remotesMap[appServer] = {
2290
+ url: appServer?.startsWith("http://localhost") ? `${removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`,
2291
+ format: "esm",
2292
+ from: "vite",
2293
+ module: void 0
2294
+ };
2291
2295
  return __federationMethodGetRemote(appServer, "./DashboardApp").then((module2) => {
2292
2296
  const wrappedModule = __federationMethodWrapDefault(module2, true);
2293
2297
  remotesMap[appServer].module = wrappedModule;
@@ -2590,68 +2594,70 @@ var LuzmoDashboard = class extends s3 {
2590
2594
  return [dashboardStyles];
2591
2595
  }
2592
2596
  render() {
2593
- let toBeRenderedHTML = x``;
2597
+ let toBeRenderedHTML;
2594
2598
  const loader = x`
2595
2599
  <div
2596
- class="luzmo-container-loader"
2597
- id="luzmo-container-loader-${this._containerId}"
2598
- style=${o5(
2600
+ class="luzmo-container-loader"
2601
+ id="luzmo-container-loader-${this._containerId}"
2602
+ style=${o5(
2599
2603
  this._containerLoaderStyle
2600
2604
  )}
2601
- >
2602
- <div
2603
- class="luzmo-loader"
2604
- id="luzmo-loader-${this._containerId}"
2605
- style=${o5(this._loaderStyle)}
2606
- >
2607
- <div
2608
- class="luzmo-lc"
2609
- style=${o5(this._lcStyle)}
2610
- >
2611
- <div
2612
- class="luzmo-loading-circle"
2613
- style=${o5(
2605
+ >
2606
+ <div
2607
+ class="luzmo-loader"
2608
+ id="luzmo-loader-${this._containerId}"
2609
+ style=${o5(this._loaderStyle)}
2610
+ >
2611
+ <div
2612
+ class="luzmo-lc"
2613
+ style=${o5(this._lcStyle)}
2614
+ >
2615
+ <div
2616
+ class="luzmo-loading-circle"
2617
+ style=${o5(
2614
2618
  this._loadingCircleStyle
2615
2619
  )}
2616
- ></div>
2617
- ${this._itemEmbedding ? "" : x`
2618
- <div
2619
- class="luzmo-loading-message"
2620
- style=${o5({ color: this.loaderFontColor })}
2621
- >
2622
- ${this._loaderMsg}
2623
- </div>
2624
- `}
2620
+ ></div>
2621
+ ${this._itemEmbedding ? "" : x`
2622
+ <div
2623
+ class="luzmo-loading-message"
2624
+ style=${o5({ color: this.loaderFontColor })}
2625
+ >
2626
+ ${this._loaderMsg}
2625
2627
  </div>
2626
- </div>
2627
- </div>
2628
+ `}
2629
+ </div>
2630
+ </div>
2631
+ </div>
2628
2632
  `;
2629
2633
  if (this.getIsViewMode()) {
2630
2634
  toBeRenderedHTML = this.isLibraryLoaded ? x`
2631
- ${this.dashboardId || this.dashboardSlug ? x`<dashboard-component dashboard-id="${this.params.dashboardId}" app-server="${this.params.appServer}" api-host="${this.params.apiHost}"></dashboard-component>` : x`
2635
+ ${this.dashboardId || this.dashboardSlug ? x`
2636
+ <dashboard-component dashboard-id="${this.params.dashboardId}" app-server="${this.params.appServer}"
2637
+ api-host="${this.params.apiHost}"></dashboard-component>` : x`
2632
2638
  <div id="luzmo-error-${this._containerId}">
2633
- <h3 class="luzmo-error">${this.browserErrorMsg}</h3>
2634
- </div>
2639
+ <h3 class="luzmo-error">${this.browserErrorMsg}</h3>
2640
+ </div>
2635
2641
  `}
2636
2642
  ` : x`${loader}`;
2637
2643
  } else {
2638
2644
  toBeRenderedHTML = x`
2639
- ${this.dashboardId || this.dashboardSlug ? x`
2640
- ${loader}
2641
- <iframe
2642
- class="luzmo-embed-dashboard"
2643
- id="${this._iframeId}"
2644
- name="${this._iframeId}"
2645
- style=${o5(this.iframeStyle)}
2646
- src="${this._iframeUrl}"
2647
- frameborder="0"
2648
- ></iframe>
2649
- ` : x`<!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId -->`}
2645
+ ${this.dashboardId || this.dashboardSlug ? x`
2646
+ ${loader}
2647
+ <iframe
2648
+ class="luzmo-embed-dashboard"
2649
+ id="${this._iframeId}"
2650
+ name="${this._iframeId}"
2651
+ style=${o5(this.iframeStyle)}
2652
+ src="${this._iframeUrl}"
2653
+ frameborder="0"
2654
+ ></iframe>
2655
+ ` : x`<!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId -->`}
2650
2656
  ${this.browserError ? x`
2651
- <div id="luzmo-error-${this._containerId}">
2652
- <h3 class="luzmo-error">${this.browserErrorMsg}</h3>
2653
- </div>
2654
- ` : ""}
2657
+ <div id="luzmo-error-${this._containerId}">
2658
+ <h3 class="luzmo-error">${this.browserErrorMsg}</h3>
2659
+ </div>
2660
+ ` : ""}
2655
2661
  `;
2656
2662
  }
2657
2663
  return x`
@@ -2784,41 +2790,38 @@ var LuzmoDashboard = class extends s3 {
2784
2790
  return setPreview(this, this.iframe, preview);
2785
2791
  }
2786
2792
  getIsViewMode() {
2787
- if (this.experimental && this.params.editMode === "view" || this.params.editMode === void 0) {
2788
- return true;
2789
- }
2790
- return false;
2793
+ return this.experimental && this.params.editMode === "view" || this.params.editMode === void 0;
2791
2794
  }
2792
2795
  };
2793
2796
  __decorateClass([
2794
- e5(".dashboard-container")
2797
+ e4(".dashboard-container")
2795
2798
  ], LuzmoDashboard.prototype, "container", 2);
2796
2799
  __decorateClass([
2797
- e5(`.${luzmoEmbedContainerClass}`)
2800
+ e4(`.${luzmoEmbedContainerClass}`)
2798
2801
  ], LuzmoDashboard.prototype, "luzmoEmbedContainer", 2);
2799
2802
  __decorateClass([
2800
- e5("iframe")
2803
+ e4("iframe")
2801
2804
  ], LuzmoDashboard.prototype, "iframe", 2);
2802
2805
  __decorateClass([
2803
- n4()
2806
+ n3()
2804
2807
  ], LuzmoDashboard.prototype, "dashboardId", 2);
2805
2808
  __decorateClass([
2806
- n4()
2809
+ n3()
2807
2810
  ], LuzmoDashboard.prototype, "dashboardSlug", 2);
2808
2811
  __decorateClass([
2809
- n4()
2812
+ n3()
2810
2813
  ], LuzmoDashboard.prototype, "itemId", 2);
2811
2814
  __decorateClass([
2812
- n4()
2815
+ n3()
2813
2816
  ], LuzmoDashboard.prototype, "language", 2);
2814
2817
  __decorateClass([
2815
- n4()
2818
+ n3()
2816
2819
  ], LuzmoDashboard.prototype, "qeVersion", 2);
2817
2820
  __decorateClass([
2818
- n4()
2821
+ n3()
2819
2822
  ], LuzmoDashboard.prototype, "screenMode", 2);
2820
2823
  __decorateClass([
2821
- n4({
2824
+ n3({
2822
2825
  converter: {
2823
2826
  fromAttribute: (value) => value === "true",
2824
2827
  toAttribute: String
@@ -2826,46 +2829,46 @@ __decorateClass([
2826
2829
  })
2827
2830
  ], LuzmoDashboard.prototype, "switchScreenModeOnResize", 2);
2828
2831
  __decorateClass([
2829
- n4()
2832
+ n3()
2830
2833
  ], LuzmoDashboard.prototype, "editMode", 2);
2831
2834
  __decorateClass([
2832
- n4()
2835
+ n3()
2833
2836
  ], LuzmoDashboard.prototype, "mainColor", 2);
2834
2837
  __decorateClass([
2835
- n4()
2838
+ n3()
2836
2839
  ], LuzmoDashboard.prototype, "accentColor", 2);
2837
2840
  __decorateClass([
2838
- n4()
2841
+ n3()
2839
2842
  ], LuzmoDashboard.prototype, "authToken", 2);
2840
2843
  __decorateClass([
2841
- n4()
2844
+ n3()
2842
2845
  ], LuzmoDashboard.prototype, "authKey", 2);
2843
2846
  __decorateClass([
2844
- n4()
2847
+ n3()
2845
2848
  ], LuzmoDashboard.prototype, "loaderBackground", 2);
2846
2849
  __decorateClass([
2847
- n4()
2850
+ n3()
2848
2851
  ], LuzmoDashboard.prototype, "loaderFontColor", 2);
2849
2852
  __decorateClass([
2850
- n4()
2853
+ n3()
2851
2854
  ], LuzmoDashboard.prototype, "loaderSpinnerColor", 2);
2852
2855
  __decorateClass([
2853
- n4()
2856
+ n3()
2854
2857
  ], LuzmoDashboard.prototype, "loaderSpinnerBackground", 2);
2855
2858
  __decorateClass([
2856
- n4()
2859
+ n3()
2857
2860
  ], LuzmoDashboard.prototype, "appServer", 2);
2858
2861
  __decorateClass([
2859
- n4()
2862
+ n3()
2860
2863
  ], LuzmoDashboard.prototype, "timezoneId", 2);
2861
2864
  __decorateClass([
2862
- n4()
2865
+ n3()
2863
2866
  ], LuzmoDashboard.prototype, "apiHost", 2);
2864
2867
  __decorateClass([
2865
- n4({ type: Object })
2868
+ n3({ type: Object })
2866
2869
  ], LuzmoDashboard.prototype, "itemDimensions", 2);
2867
2870
  __decorateClass([
2868
- n4({
2871
+ n3({
2869
2872
  converter: {
2870
2873
  fromAttribute: (value) => value === "true",
2871
2874
  toAttribute: String
@@ -2873,189 +2876,188 @@ __decorateClass([
2873
2876
  })
2874
2877
  ], LuzmoDashboard.prototype, "experimental", 2);
2875
2878
  __decorateClass([
2876
- n4({ attribute: false })
2879
+ n3({ attribute: false })
2877
2880
  ], LuzmoDashboard.prototype, "_containerId", 2);
2878
2881
  __decorateClass([
2879
- n4({ attribute: false })
2882
+ n3({ attribute: false })
2880
2883
  ], LuzmoDashboard.prototype, "_iframeId", 2);
2881
2884
  __decorateClass([
2882
- n4({ attribute: false })
2885
+ n3({ attribute: false })
2883
2886
  ], LuzmoDashboard.prototype, "params", 2);
2884
2887
  __decorateClass([
2885
- n4({ attribute: false })
2888
+ n3({ attribute: false })
2886
2889
  ], LuzmoDashboard.prototype, "_iframeUrl", 2);
2887
2890
  __decorateClass([
2888
- n4({ attribute: false })
2891
+ n3({ attribute: false })
2889
2892
  ], LuzmoDashboard.prototype, "iframeLoaded", 2);
2890
2893
  __decorateClass([
2891
- n4({ attribute: false })
2894
+ n3({ attribute: false })
2892
2895
  ], LuzmoDashboard.prototype, "promises", 2);
2893
2896
  __decorateClass([
2894
- n4({ attribute: false })
2897
+ n3({ attribute: false })
2895
2898
  ], LuzmoDashboard.prototype, "iframeStyle", 2);
2896
2899
  __decorateClass([
2897
- n4({ attribute: false })
2900
+ n3({ attribute: false })
2898
2901
  ], LuzmoDashboard.prototype, "_containerStyle", 2);
2899
2902
  __decorateClass([
2900
- n4({ attribute: false })
2903
+ n3({ attribute: false })
2901
2904
  ], LuzmoDashboard.prototype, "_loaderStyle", 2);
2902
2905
  __decorateClass([
2903
- n4({ attribute: false })
2906
+ n3({ attribute: false })
2904
2907
  ], LuzmoDashboard.prototype, "_lcStyle", 2);
2905
2908
  __decorateClass([
2906
- n4({ attribute: false })
2909
+ n3({ attribute: false })
2907
2910
  ], LuzmoDashboard.prototype, "_loadingCircleStyle", 2);
2908
2911
  __decorateClass([
2909
- n4({ attribute: false })
2912
+ n3({ attribute: false })
2910
2913
  ], LuzmoDashboard.prototype, "_containerLoaderStyle", 2);
2911
2914
  __decorateClass([
2912
- n4({ attribute: false })
2915
+ n3({ attribute: false })
2913
2916
  ], LuzmoDashboard.prototype, "_loaderMsg", 2);
2914
2917
  __decorateClass([
2915
- n4({ attribute: false })
2918
+ n3({ attribute: false })
2916
2919
  ], LuzmoDashboard.prototype, "containerWidth", 2);
2917
2920
  __decorateClass([
2918
- n4({ attribute: false })
2921
+ n3({ attribute: false })
2919
2922
  ], LuzmoDashboard.prototype, "dimensions", 2);
2920
2923
  __decorateClass([
2921
- n4({ attribute: false })
2924
+ n3({ attribute: false })
2922
2925
  ], LuzmoDashboard.prototype, "currentScreenMode", 2);
2923
2926
  __decorateClass([
2924
- n4({ attribute: false })
2927
+ n3({ attribute: false })
2925
2928
  ], LuzmoDashboard.prototype, "_itemEmbedding", 2);
2926
2929
  __decorateClass([
2927
- n4({ attribute: false })
2930
+ n3({ attribute: false })
2928
2931
  ], LuzmoDashboard.prototype, "browserError", 2);
2929
2932
  __decorateClass([
2930
- n4({ attribute: false })
2933
+ n3({ attribute: false })
2931
2934
  ], LuzmoDashboard.prototype, "browserErrorMsg", 2);
2932
2935
  __decorateClass([
2933
- n4({ attribute: false })
2936
+ n3({ attribute: false })
2934
2937
  ], LuzmoDashboard.prototype, "dashboardError", 2);
2935
2938
  __decorateClass([
2936
- n4({ attribute: false })
2939
+ n3({ attribute: false })
2937
2940
  ], LuzmoDashboard.prototype, "browserNotSupported", 2);
2938
2941
  __decorateClass([
2939
- n4()
2942
+ n3()
2940
2943
  ], LuzmoDashboard.prototype, "VERSION", 2);
2941
2944
  __decorateClass([
2942
- r6()
2945
+ r4()
2943
2946
  ], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
2944
2947
  __decorateClass([
2945
- r6()
2948
+ r4()
2946
2949
  ], LuzmoDashboard.prototype, "dashboardReference", 2);
2947
- LuzmoDashboard = __decorateClass([
2948
- t3("luzmo-dashboard")
2949
- ], LuzmoDashboard);
2950
- var LuzmoDashboardWebComponent = class extends LuzmoDashboard {
2950
+
2951
+ // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
2952
+ var LuzmoDashboard2 = class extends LuzmoDashboard {
2951
2953
  };
2952
- LuzmoDashboardWebComponent = __decorateClass([
2953
- t3("luzmo-dashboard-web-component")
2954
- ], LuzmoDashboardWebComponent);
2954
+ LuzmoDashboard2 = __decorateClass([
2955
+ t("luzmo-dashboard")
2956
+ ], LuzmoDashboard2);
2955
2957
  /*! Bundled license information:
2956
2958
 
2957
- @lit/reactive-element/css-tag.js:
2959
+ @lit/reactive-element/decorators/custom-element.js:
2958
2960
  (**
2959
2961
  * @license
2960
- * Copyright 2019 Google LLC
2962
+ * Copyright 2017 Google LLC
2961
2963
  * SPDX-License-Identifier: BSD-3-Clause
2962
2964
  *)
2963
2965
 
2964
- @lit/reactive-element/reactive-element.js:
2966
+ @lit/reactive-element/css-tag.js:
2965
2967
  (**
2966
2968
  * @license
2967
- * Copyright 2017 Google LLC
2969
+ * Copyright 2019 Google LLC
2968
2970
  * SPDX-License-Identifier: BSD-3-Clause
2969
2971
  *)
2970
2972
 
2971
- lit-html/lit-html.js:
2973
+ @lit/reactive-element/reactive-element.js:
2972
2974
  (**
2973
2975
  * @license
2974
2976
  * Copyright 2017 Google LLC
2975
2977
  * SPDX-License-Identifier: BSD-3-Clause
2976
2978
  *)
2977
2979
 
2978
- lit-element/lit-element.js:
2980
+ @lit/reactive-element/decorators/property.js:
2979
2981
  (**
2980
2982
  * @license
2981
2983
  * Copyright 2017 Google LLC
2982
2984
  * SPDX-License-Identifier: BSD-3-Clause
2983
2985
  *)
2984
2986
 
2985
- lit-html/is-server.js:
2987
+ @lit/reactive-element/decorators/state.js:
2986
2988
  (**
2987
2989
  * @license
2988
- * Copyright 2022 Google LLC
2990
+ * Copyright 2017 Google LLC
2989
2991
  * SPDX-License-Identifier: BSD-3-Clause
2990
2992
  *)
2991
2993
 
2992
- @lit/reactive-element/decorators/custom-element.js:
2994
+ @lit/reactive-element/decorators/event-options.js:
2993
2995
  (**
2994
2996
  * @license
2995
2997
  * Copyright 2017 Google LLC
2996
2998
  * SPDX-License-Identifier: BSD-3-Clause
2997
2999
  *)
2998
3000
 
2999
- @lit/reactive-element/decorators/property.js:
3001
+ @lit/reactive-element/decorators/base.js:
3000
3002
  (**
3001
3003
  * @license
3002
3004
  * Copyright 2017 Google LLC
3003
3005
  * SPDX-License-Identifier: BSD-3-Clause
3004
3006
  *)
3005
3007
 
3006
- @lit/reactive-element/decorators/state.js:
3008
+ @lit/reactive-element/decorators/query.js:
3007
3009
  (**
3008
3010
  * @license
3009
3011
  * Copyright 2017 Google LLC
3010
3012
  * SPDX-License-Identifier: BSD-3-Clause
3011
3013
  *)
3012
3014
 
3013
- @lit/reactive-element/decorators/event-options.js:
3015
+ @lit/reactive-element/decorators/query-all.js:
3014
3016
  (**
3015
3017
  * @license
3016
3018
  * Copyright 2017 Google LLC
3017
3019
  * SPDX-License-Identifier: BSD-3-Clause
3018
3020
  *)
3019
3021
 
3020
- @lit/reactive-element/decorators/base.js:
3022
+ @lit/reactive-element/decorators/query-async.js:
3021
3023
  (**
3022
3024
  * @license
3023
3025
  * Copyright 2017 Google LLC
3024
3026
  * SPDX-License-Identifier: BSD-3-Clause
3025
3027
  *)
3026
3028
 
3027
- @lit/reactive-element/decorators/query.js:
3029
+ @lit/reactive-element/decorators/query-assigned-elements.js:
3028
3030
  (**
3029
3031
  * @license
3030
- * Copyright 2017 Google LLC
3032
+ * Copyright 2021 Google LLC
3031
3033
  * SPDX-License-Identifier: BSD-3-Clause
3032
3034
  *)
3033
3035
 
3034
- @lit/reactive-element/decorators/query-all.js:
3036
+ @lit/reactive-element/decorators/query-assigned-nodes.js:
3035
3037
  (**
3036
3038
  * @license
3037
3039
  * Copyright 2017 Google LLC
3038
3040
  * SPDX-License-Identifier: BSD-3-Clause
3039
3041
  *)
3040
3042
 
3041
- @lit/reactive-element/decorators/query-async.js:
3043
+ lit-html/lit-html.js:
3042
3044
  (**
3043
3045
  * @license
3044
3046
  * Copyright 2017 Google LLC
3045
3047
  * SPDX-License-Identifier: BSD-3-Clause
3046
3048
  *)
3047
3049
 
3048
- @lit/reactive-element/decorators/query-assigned-elements.js:
3050
+ lit-element/lit-element.js:
3049
3051
  (**
3050
3052
  * @license
3051
- * Copyright 2021 Google LLC
3053
+ * Copyright 2017 Google LLC
3052
3054
  * SPDX-License-Identifier: BSD-3-Clause
3053
3055
  *)
3054
3056
 
3055
- @lit/reactive-element/decorators/query-assigned-nodes.js:
3057
+ lit-html/is-server.js:
3056
3058
  (**
3057
3059
  * @license
3058
- * Copyright 2017 Google LLC
3060
+ * Copyright 2022 Google LLC
3059
3061
  * SPDX-License-Identifier: BSD-3-Clause
3060
3062
  *)
3061
3063