@luzmo/embed 5.0.10 → 5.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/index.cjs +85 -76
- package/index.d.ts +1 -0
- package/index.js +86 -75
- package/index.libs.d.ts +1 -0
- package/lib/dashboard-component/dashboard-base.d.ts +98 -0
- package/lib/dashboard-component/dashboard-component.d.ts +2 -93
- package/lib/dashboard-component/dashboard-web-component.d.ts +3 -0
- package/luzmo-embed.libs.js +3079 -0
- package/luzmo-embed.min.js +1544 -1557
- package/package.json +2 -2
- package/src/index.d.ts +2 -0
- package/src/lib/dashboard-component/dashboard-base.d.ts +98 -0
- package/src/lib/dashboard-component/dashboard-component.d.ts +3 -0
- package/src/lib/dashboard-component/dashboard-styles.d.ts +1 -0
- package/src/lib/helper/event-bus-handler.d.ts +1 -0
- package/src/lib/luzmo-service.d.ts +6 -0
package/luzmo-embed.min.js
CHANGED
|
@@ -42,1479 +42,1527 @@ 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: () =>
|
|
46
|
-
LuzmoDashboardWebComponent: () => LuzmoDashboardWebComponent
|
|
45
|
+
LuzmoDashboard: () => LuzmoDashboard2
|
|
47
46
|
});
|
|
48
47
|
module.exports = __toCommonJS(src_exports2);
|
|
49
48
|
|
|
50
|
-
//
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
//
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
-
|
|
98
|
-
|
|
76
|
+
toString() {
|
|
77
|
+
return this.cssText;
|
|
99
78
|
}
|
|
100
79
|
};
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
|
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
|
-
//
|
|
157
|
-
var
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
var
|
|
164
|
-
|
|
165
|
-
|
|
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
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
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
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
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
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
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
|
-
|
|
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
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
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
|
-
|
|
288
|
-
|
|
289
|
-
return
|
|
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
|
-
|
|
292
|
-
|
|
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
|
-
|
|
296
|
-
|
|
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
|
-
|
|
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
|
-
|
|
354
|
-
|
|
226
|
+
removeController(t5) {
|
|
227
|
+
this._$EO?.delete(t5);
|
|
355
228
|
}
|
|
356
|
-
|
|
357
|
-
|
|
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
|
-
|
|
360
|
-
|
|
235
|
+
createRenderRoot() {
|
|
236
|
+
const t5 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
237
|
+
return S(t5, this.constructor.elementStyles), t5;
|
|
361
238
|
}
|
|
362
|
-
|
|
363
|
-
|
|
239
|
+
connectedCallback() {
|
|
240
|
+
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach((t5) => t5.hostConnected?.());
|
|
364
241
|
}
|
|
365
|
-
|
|
366
|
-
searchString.push(`ldrspbg=${loaderSpinnerBackground}`);
|
|
242
|
+
enableUpdating(t5) {
|
|
367
243
|
}
|
|
368
|
-
|
|
369
|
-
|
|
244
|
+
disconnectedCallback() {
|
|
245
|
+
this._$EO?.forEach((t5) => t5.hostDisconnected?.());
|
|
370
246
|
}
|
|
371
|
-
|
|
372
|
-
|
|
247
|
+
attributeChangedCallback(t5, s4, i6) {
|
|
248
|
+
this._$AK(t5, i6);
|
|
373
249
|
}
|
|
374
|
-
|
|
375
|
-
|
|
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
|
-
|
|
378
|
-
|
|
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
|
-
|
|
381
|
-
|
|
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
|
-
|
|
384
|
-
|
|
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
|
-
|
|
387
|
-
|
|
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
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
//
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
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
|
-
|
|
433
|
-
}
|
|
434
|
-
function
|
|
435
|
-
|
|
436
|
-
|
|
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
|
-
|
|
461
|
-
|
|
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
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
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
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
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
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
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
|
-
|
|
509
|
-
|
|
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
|
-
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
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/
|
|
536
|
-
var
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
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
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
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.";
|
|
446
|
+
}
|
|
447
|
+
if (hasError) {
|
|
448
|
+
_handleError(errorMessage);
|
|
738
449
|
}
|
|
739
|
-
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
740
450
|
};
|
|
741
451
|
|
|
742
|
-
// libs/embed-libs/shared-embed/src/lib/
|
|
743
|
-
var
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
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
|
|
756
479
|
};
|
|
757
480
|
|
|
758
|
-
// libs/embed-libs/shared-embed/src/lib/
|
|
759
|
-
var
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
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."
|
|
766
502
|
}
|
|
767
|
-
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
768
503
|
};
|
|
504
|
+
var translations_default = TRANSLATIONS;
|
|
769
505
|
|
|
770
|
-
// libs/embed-libs/shared-embed/src/lib/
|
|
771
|
-
var
|
|
772
|
-
if (
|
|
773
|
-
|
|
774
|
-
{
|
|
775
|
-
action: "setAuthorization",
|
|
776
|
-
key,
|
|
777
|
-
token,
|
|
778
|
-
_version: dashboardComponent.VERSION
|
|
779
|
-
},
|
|
780
|
-
"*"
|
|
781
|
-
);
|
|
782
|
-
return Promise.resolve();
|
|
506
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/utils.ts
|
|
507
|
+
var addTrailingSlash = (serverUrl) => {
|
|
508
|
+
if (!serverUrl) {
|
|
509
|
+
return "";
|
|
783
510
|
}
|
|
784
|
-
return
|
|
511
|
+
return serverUrl.endsWith("/") ? serverUrl : `${serverUrl}/`;
|
|
785
512
|
};
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
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
|
-
});
|
|
513
|
+
var removeTrailingSlash = (serverUrl) => {
|
|
514
|
+
if (!serverUrl) {
|
|
515
|
+
return "";
|
|
814
516
|
}
|
|
815
|
-
return
|
|
517
|
+
return serverUrl.endsWith("/") ? serverUrl.slice(0, -1) : serverUrl;
|
|
816
518
|
};
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
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
|
-
});
|
|
844
|
-
}
|
|
845
|
-
return Promise.reject();
|
|
846
|
-
};
|
|
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
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
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
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
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;
|
|
544
|
+
}
|
|
545
|
+
if (!securableAccessRights.flagUse && groupAccess.flagUse) {
|
|
546
|
+
securableAccessRights.flagUse = groupAccess.flagUse;
|
|
547
|
+
}
|
|
548
|
+
if (!securableAccessRights.flagModify && groupAccess.flagModify) {
|
|
549
|
+
securableAccessRights.flagModify = groupAccess.flagModify;
|
|
550
|
+
}
|
|
551
|
+
if (!securableAccessRights.flagOwn && groupAccess.flagOwn) {
|
|
552
|
+
securableAccessRights.flagOwn = groupAccess.flagOwn;
|
|
915
553
|
}
|
|
916
554
|
}
|
|
917
|
-
|
|
918
|
-
if (
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
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;
|
|
924
569
|
}
|
|
925
570
|
}
|
|
926
|
-
|
|
927
|
-
|
|
571
|
+
return securableAccessRights;
|
|
572
|
+
};
|
|
573
|
+
const localize = (item, locale) => {
|
|
574
|
+
if (item === null || item === void 0) {
|
|
575
|
+
return "";
|
|
928
576
|
}
|
|
929
|
-
if (
|
|
930
|
-
|
|
931
|
-
|
|
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
|
-
}
|
|
978
|
-
}
|
|
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
|
-
}
|
|
577
|
+
if (typeof item !== "object" || Object.keys(item).length === 0) {
|
|
578
|
+
if (typeof item === "object" && Object.keys(item).length === 0) {
|
|
579
|
+
return "";
|
|
1005
580
|
}
|
|
581
|
+
return item;
|
|
1006
582
|
}
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
currentHeight = lowestModeExtent.height;
|
|
583
|
+
let localizedItem;
|
|
584
|
+
localizedItem = locale && item[locale] ? item[locale] : item[Object.keys(item)[0]];
|
|
585
|
+
if (localizedItem === void 0 || localizedItem === null) {
|
|
586
|
+
localizedItem = "";
|
|
1012
587
|
}
|
|
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
|
|
588
|
+
return localizedItem;
|
|
1019
589
|
};
|
|
1020
|
-
const
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
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
|
-
|
|
1038
|
-
dashboardComponent.iframeStyle = style;
|
|
625
|
+
return treatedDashboards;
|
|
1039
626
|
};
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
const
|
|
1044
|
-
|
|
1045
|
-
);
|
|
1046
|
-
const
|
|
1047
|
-
|
|
1048
|
-
"
|
|
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
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
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
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
errorMessages.push(`${key} needs to be of type string.`);
|
|
1090
|
-
}
|
|
641
|
+
const urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex);
|
|
642
|
+
if (!urlSchemeParseResults) {
|
|
643
|
+
return sanitizedUrl;
|
|
1091
644
|
}
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
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;
|
|
1096
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);
|
|
1097
702
|
}
|
|
1098
|
-
if (
|
|
1099
|
-
|
|
1100
|
-
errorMessages.push(
|
|
1101
|
-
`"screenMode" needs should be one of these types: ${validTypesString}`
|
|
1102
|
-
);
|
|
1103
|
-
dashboardContent.params.screenMode = "auto";
|
|
703
|
+
if (qeVersion) {
|
|
704
|
+
searchString.push(`qe_version=${qeVersion}`);
|
|
1104
705
|
}
|
|
1105
|
-
if (
|
|
1106
|
-
|
|
706
|
+
if (loaderBackground) {
|
|
707
|
+
searchString.push(`ldrbg=${loaderBackground}`);
|
|
1107
708
|
}
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
delete dashboardContent.params[key];
|
|
1111
|
-
errorMessages.push(`${key} needs to be of type object or empty.`);
|
|
1112
|
-
}
|
|
709
|
+
if (loaderFontColor) {
|
|
710
|
+
searchString.push(`ldrftclr=${loaderFontColor}`);
|
|
1113
711
|
}
|
|
1114
|
-
if (
|
|
1115
|
-
|
|
1116
|
-
dashboardContent.params.switchScreenModeOnResize = true;
|
|
712
|
+
if (loaderSpinnerColor) {
|
|
713
|
+
searchString.push(`ldrspclr=${loaderSpinnerColor}`);
|
|
1117
714
|
}
|
|
1118
|
-
if (
|
|
1119
|
-
|
|
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
|
-
}
|
|
715
|
+
if (loaderSpinnerBackground) {
|
|
716
|
+
searchString.push(`ldrspbg=${loaderSpinnerBackground}`);
|
|
1132
717
|
}
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
DEFAULT_PARAMETERS
|
|
1136
|
-
);
|
|
1137
|
-
if (dashboardContent.params.screenMode && dashboardContent.params.screenMode !== "auto") {
|
|
1138
|
-
dashboardContent.params.switchScreenModeOnResize = false;
|
|
718
|
+
if (mainColor) {
|
|
719
|
+
searchString.push(`mainColor=${mainColor}`);
|
|
1139
720
|
}
|
|
1140
|
-
if (
|
|
1141
|
-
|
|
1142
|
-
`${dashboardContent.params.itemDimensions.width}`.replace("px", ""),
|
|
1143
|
-
10
|
|
1144
|
-
) || "auto";
|
|
721
|
+
if (accentColor) {
|
|
722
|
+
searchString.push(`accentColor=${accentColor}`);
|
|
1145
723
|
}
|
|
1146
|
-
if (
|
|
1147
|
-
|
|
1148
|
-
`${dashboardContent.params.itemDimensions.height}`.replace("px", ""),
|
|
1149
|
-
10
|
|
1150
|
-
) || "auto";
|
|
724
|
+
if (screenMode && screenMode !== "auto") {
|
|
725
|
+
searchString.push("screenMode=" + screenMode);
|
|
1151
726
|
}
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
727
|
+
if (timezoneId) {
|
|
728
|
+
searchString.push("timezoneId=" + timezoneId);
|
|
729
|
+
}
|
|
730
|
+
if (itemEmbedding && itemDimensions && itemDimensions.width) {
|
|
731
|
+
searchString.push("width=" + itemDimensions.width);
|
|
732
|
+
}
|
|
733
|
+
if (itemEmbedding && itemDimensions && itemDimensions.height) {
|
|
734
|
+
searchString.push("height=" + itemDimensions.height);
|
|
1155
735
|
}
|
|
736
|
+
if (editMode) {
|
|
737
|
+
searchString.push("editMode=" + editMode);
|
|
738
|
+
}
|
|
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);
|
|
1156
747
|
};
|
|
1157
748
|
|
|
1158
|
-
// libs/embed-libs/shared-embed/src/lib/
|
|
1159
|
-
var
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
const
|
|
1168
|
-
|
|
1169
|
-
script.addEventListener("load", fn);
|
|
1170
|
-
script.src = resolvedUrl;
|
|
1171
|
-
document.querySelectorAll("head")[0].append(script);
|
|
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
|
+
}
|
|
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: "" };
|
|
1172
760
|
};
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
if (
|
|
1177
|
-
|
|
761
|
+
|
|
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];
|
|
1178
767
|
}
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
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
|
-
});
|
|
768
|
+
}
|
|
769
|
+
function rejectPromise(dashboardComponent, requestId, data) {
|
|
770
|
+
if (dashboardComponent.promises[requestId]) {
|
|
771
|
+
dashboardComponent.promises[requestId].reject(data);
|
|
772
|
+
delete dashboardComponent.promises[requestId];
|
|
1211
773
|
}
|
|
1212
774
|
}
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
775
|
+
|
|
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;
|
|
1219
781
|
}
|
|
1220
|
-
return
|
|
782
|
+
return styles;
|
|
1221
783
|
}
|
|
1222
|
-
|
|
1223
|
-
|
|
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
|
+
};
|
|
1224
792
|
}
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
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
|
+
};
|
|
1236
809
|
}
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
810
|
+
return {
|
|
811
|
+
background
|
|
812
|
+
};
|
|
813
|
+
}
|
|
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";
|
|
1245
857
|
}
|
|
1246
|
-
|
|
1247
|
-
|
|
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;
|
|
873
|
+
}
|
|
874
|
+
function generateBorderStyle(borderWidth, color) {
|
|
875
|
+
return `${borderWidth}px solid ${color}`;
|
|
876
|
+
}
|
|
877
|
+
|
|
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
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
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
|
-
//
|
|
1278
|
-
var
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
914
|
+
// libs/embed-libs/shared-embed/src/lib/methods/get-accessible-dashboards.ts
|
|
915
|
+
var getAccessibleDashboards = (dashboardComponent) => {
|
|
916
|
+
if ((dashboardComponent.currentAuthKey ?? dashboardComponent.authKey) && (dashboardComponent.currentAuthToken ?? dashboardComponent.authToken)) {
|
|
917
|
+
const fetchUser = new Promise((resolve, reject) => {
|
|
918
|
+
void (() => {
|
|
919
|
+
try {
|
|
920
|
+
const responsePromise = window.fetch(
|
|
921
|
+
`${String(dashboardComponent.params.apiHost)}0.1.0/authorization`,
|
|
922
|
+
{
|
|
923
|
+
method: "POST",
|
|
924
|
+
mode: "cors",
|
|
925
|
+
cache: "no-cache",
|
|
926
|
+
headers: { "Content-Type": "application/json" },
|
|
927
|
+
redirect: "follow",
|
|
928
|
+
body: JSON.stringify({
|
|
929
|
+
action: "get",
|
|
930
|
+
version: "0.1.0",
|
|
931
|
+
key: dashboardComponent.currentAuthKey ?? dashboardComponent.authKey,
|
|
932
|
+
token: dashboardComponent.currentAuthToken ?? dashboardComponent.authToken,
|
|
933
|
+
find: {
|
|
934
|
+
where: { id: dashboardComponent.authKey },
|
|
935
|
+
attributes: ["id", "integration_id"],
|
|
936
|
+
include: [
|
|
937
|
+
{
|
|
938
|
+
model: "User",
|
|
939
|
+
attributes: ["id", "name", "locale_id"],
|
|
940
|
+
include: [{ model: "Group" }]
|
|
941
|
+
}
|
|
942
|
+
]
|
|
943
|
+
}
|
|
944
|
+
})
|
|
945
|
+
}
|
|
946
|
+
);
|
|
947
|
+
responsePromise.then((response) => response.json()).then((data) => {
|
|
948
|
+
if (!data || !data.rows || data.rows.length === 0 || !data.rows[0].user) {
|
|
949
|
+
reject("Authorization failed, please check authKey and authToken. If the problem persists, please contact support@luzmo.com.");
|
|
950
|
+
} else {
|
|
951
|
+
data.rows[0].user.userGroups = data.rows[0].user.groups.map(
|
|
952
|
+
(group) => group.id
|
|
953
|
+
);
|
|
954
|
+
delete data.rows[0].user.groups;
|
|
955
|
+
resolve({
|
|
956
|
+
integrationId: data.rows[0].integration_id,
|
|
957
|
+
user: data.rows[0].user
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
});
|
|
961
|
+
} catch (error) {
|
|
962
|
+
reject(error);
|
|
963
|
+
}
|
|
964
|
+
})();
|
|
965
|
+
});
|
|
966
|
+
return new Promise((resolve, reject) => void (() => {
|
|
1305
967
|
try {
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
968
|
+
fetchUser.then((authorizationData) => {
|
|
969
|
+
const responsePromise = window.fetch(
|
|
970
|
+
`${String(dashboardComponent.params.apiHost)}0.1.0/securable`,
|
|
971
|
+
{
|
|
972
|
+
method: "POST",
|
|
973
|
+
mode: "cors",
|
|
974
|
+
cache: "no-cache",
|
|
975
|
+
headers: { "Content-Type": "application/json" },
|
|
976
|
+
redirect: "follow",
|
|
977
|
+
body: JSON.stringify({
|
|
978
|
+
action: "get",
|
|
979
|
+
version: "0.1.0",
|
|
980
|
+
key: dashboardComponent.currentAuthKey ?? dashboardComponent.authKey,
|
|
981
|
+
token: dashboardComponent.currentAuthToken ?? dashboardComponent.authToken,
|
|
982
|
+
find: {
|
|
983
|
+
where: { type: "dashboard", is_variant: false },
|
|
984
|
+
attributes: ["id", "name", "modified_at"],
|
|
985
|
+
order: [["modified_at", "desc"]],
|
|
986
|
+
include: [
|
|
987
|
+
{ model: "Tag", attributes: ["tag"] },
|
|
988
|
+
{ model: "User", attributes: ["id", "name"] },
|
|
989
|
+
{
|
|
990
|
+
model: "Group",
|
|
991
|
+
attributes: ["id", "name", "public"]
|
|
992
|
+
},
|
|
993
|
+
{ model: "Integration", attributes: ["id", "name"] }
|
|
994
|
+
]
|
|
995
|
+
}
|
|
996
|
+
})
|
|
997
|
+
}
|
|
998
|
+
);
|
|
999
|
+
responsePromise.then((response) => response.json()).then((data) => {
|
|
1000
|
+
const dashboardList = data.rows.length > 0 ? formatDashboardList(
|
|
1001
|
+
data.rows,
|
|
1002
|
+
authorizationData.integrationId,
|
|
1003
|
+
authorizationData.user,
|
|
1004
|
+
dashboardComponent
|
|
1005
|
+
) : [];
|
|
1006
|
+
resolve(dashboardList);
|
|
1007
|
+
});
|
|
1008
|
+
}).catch((error) => {
|
|
1009
|
+
reject(error);
|
|
1010
|
+
});
|
|
1011
|
+
} catch (error) {
|
|
1012
|
+
reject(error);
|
|
1013
|
+
}
|
|
1014
|
+
})());
|
|
1015
|
+
}
|
|
1016
|
+
throw new Error("No authKey or authToken found in the luzmo-dashboard component.");
|
|
1017
|
+
};
|
|
1018
|
+
|
|
1019
|
+
// libs/embed-libs/shared-embed/src/lib/methods/get-data.ts
|
|
1020
|
+
var getData = (dashboardComponent, iframe, itemId) => {
|
|
1021
|
+
if (iframe?.contentWindow) {
|
|
1022
|
+
const requestId = uuidv4();
|
|
1023
|
+
iframe.contentWindow.postMessage(
|
|
1024
|
+
{
|
|
1025
|
+
action: "getData",
|
|
1026
|
+
id: itemId,
|
|
1027
|
+
_version: dashboardComponent.VERSION,
|
|
1028
|
+
requestId
|
|
1029
|
+
},
|
|
1030
|
+
"*"
|
|
1031
|
+
);
|
|
1032
|
+
return new Promise((resolve, reject) => {
|
|
1033
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
1034
|
+
setTimeout(() => {
|
|
1035
|
+
if (dashboardComponent.promises[requestId]) {
|
|
1036
|
+
const errorMessage = "getData request timed out.";
|
|
1037
|
+
dashboardComponent.promises[requestId].reject(
|
|
1038
|
+
new Error(errorMessage)
|
|
1039
|
+
);
|
|
1040
|
+
delete dashboardComponent.promises[requestId];
|
|
1041
|
+
}
|
|
1042
|
+
}, 2e3);
|
|
1043
|
+
});
|
|
1044
|
+
}
|
|
1045
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
1046
|
+
};
|
|
1047
|
+
|
|
1048
|
+
// libs/embed-libs/shared-embed/src/lib/methods/get-filters.ts
|
|
1049
|
+
var getFilters = (dashboardComponent, iframe) => {
|
|
1050
|
+
if (iframe?.contentWindow) {
|
|
1051
|
+
const requestId = uuidv4();
|
|
1052
|
+
iframe.contentWindow.postMessage(
|
|
1053
|
+
{ action: "getFilters", _version: dashboardComponent.VERSION, requestId },
|
|
1054
|
+
"*"
|
|
1055
|
+
);
|
|
1056
|
+
return new Promise((resolve, reject) => {
|
|
1057
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
1058
|
+
setTimeout(() => {
|
|
1059
|
+
if (dashboardComponent.promises[requestId]) {
|
|
1060
|
+
const errorMessage = "getFilters request timed out.";
|
|
1061
|
+
dashboardComponent.promises[requestId].reject(
|
|
1062
|
+
new Error(errorMessage)
|
|
1063
|
+
);
|
|
1064
|
+
delete dashboardComponent.promises[requestId];
|
|
1065
|
+
}
|
|
1066
|
+
}, 2e3);
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
1070
|
+
};
|
|
1071
|
+
|
|
1072
|
+
// libs/embed-libs/shared-embed/src/lib/methods/refresh-data.ts
|
|
1073
|
+
var refreshData = (dashboardComponent, iframe, itemId) => {
|
|
1074
|
+
if (iframe) {
|
|
1075
|
+
iframe.contentWindow.postMessage(
|
|
1076
|
+
{
|
|
1077
|
+
action: "refreshData",
|
|
1078
|
+
id: itemId ?? null,
|
|
1079
|
+
_version: dashboardComponent.VERSION
|
|
1080
|
+
},
|
|
1081
|
+
"*"
|
|
1082
|
+
);
|
|
1083
|
+
return Promise.resolve();
|
|
1084
|
+
}
|
|
1085
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
1086
|
+
};
|
|
1087
|
+
|
|
1088
|
+
// libs/embed-libs/shared-embed/src/lib/methods/reload-dashboard.ts
|
|
1089
|
+
var reloadDashboard = (dashboardComponent, iframe) => {
|
|
1090
|
+
if (iframe) {
|
|
1091
|
+
iframe.contentWindow.postMessage(
|
|
1092
|
+
{ action: "reloadDashboard", _version: dashboardComponent.VERSION },
|
|
1093
|
+
"*"
|
|
1094
|
+
);
|
|
1095
|
+
return Promise.resolve();
|
|
1096
|
+
}
|
|
1097
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
1098
|
+
};
|
|
1099
|
+
|
|
1100
|
+
// libs/embed-libs/shared-embed/src/lib/methods/set-authorization.ts
|
|
1101
|
+
var setAuthorization = (dashboardComponent, iframe, key, token) => {
|
|
1102
|
+
if (iframe) {
|
|
1103
|
+
iframe.contentWindow.postMessage(
|
|
1104
|
+
{
|
|
1105
|
+
action: "setAuthorization",
|
|
1106
|
+
key,
|
|
1107
|
+
token,
|
|
1108
|
+
_version: dashboardComponent.VERSION
|
|
1109
|
+
},
|
|
1110
|
+
"*"
|
|
1111
|
+
);
|
|
1112
|
+
return Promise.resolve();
|
|
1113
|
+
}
|
|
1114
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
1115
|
+
};
|
|
1116
|
+
|
|
1117
|
+
// libs/embed-libs/shared-embed/src/lib/methods/set-edit-mode.ts
|
|
1118
|
+
var setEditMode = (dashboardComponent, iframe, editMode) => {
|
|
1119
|
+
if (iframe && iframe.contentWindow) {
|
|
1120
|
+
const requestId = uuidv4();
|
|
1121
|
+
if (dashboardComponent.params.editMode === editMode) {
|
|
1122
|
+
return Promise.reject(
|
|
1123
|
+
new Error("editMode parameter is currently already set to " + editMode)
|
|
1124
|
+
);
|
|
1125
|
+
} else if (editMode !== "editFull" && editMode !== "editLimited" && editMode !== "view") {
|
|
1126
|
+
return Promise.reject(
|
|
1127
|
+
new Error(
|
|
1128
|
+
"The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'."
|
|
1129
|
+
)
|
|
1130
|
+
);
|
|
1131
|
+
}
|
|
1132
|
+
iframe.contentWindow.postMessage(
|
|
1133
|
+
{
|
|
1134
|
+
action: "setEditMode",
|
|
1135
|
+
editMode,
|
|
1136
|
+
_version: dashboardComponent.VERSION,
|
|
1137
|
+
requestId
|
|
1138
|
+
},
|
|
1139
|
+
"*"
|
|
1140
|
+
);
|
|
1141
|
+
return new Promise((resolve, reject) => {
|
|
1142
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
1146
|
+
};
|
|
1147
|
+
|
|
1148
|
+
// libs/embed-libs/shared-embed/src/lib/methods/set-filters.ts
|
|
1149
|
+
var setFilters = (dashboardComponent, iframe, itemId, filters) => {
|
|
1150
|
+
if (iframe) {
|
|
1151
|
+
const requestId = uuidv4();
|
|
1152
|
+
iframe.contentWindow.postMessage(
|
|
1153
|
+
{
|
|
1154
|
+
action: "setFilters",
|
|
1155
|
+
itemId,
|
|
1156
|
+
filters,
|
|
1157
|
+
_version: dashboardComponent.VERSION,
|
|
1158
|
+
requestId
|
|
1159
|
+
},
|
|
1160
|
+
"*"
|
|
1161
|
+
);
|
|
1162
|
+
return new Promise((resolve, reject) => {
|
|
1163
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
1164
|
+
setTimeout(() => {
|
|
1165
|
+
if (dashboardComponent.promises[requestId]) {
|
|
1166
|
+
const errorMessage = "setFilters request timed out.";
|
|
1167
|
+
dashboardComponent.promises[requestId].reject(
|
|
1168
|
+
new Error(errorMessage)
|
|
1169
|
+
);
|
|
1170
|
+
delete dashboardComponent.promises[requestId];
|
|
1171
|
+
}
|
|
1172
|
+
}, 2e3);
|
|
1173
|
+
});
|
|
1174
|
+
}
|
|
1175
|
+
return Promise.reject();
|
|
1176
|
+
};
|
|
1177
|
+
|
|
1178
|
+
// libs/embed-libs/shared-embed/src/lib/methods/set-preview.ts
|
|
1179
|
+
var setPreview = (dashboardComponent, iframe, preview) => {
|
|
1180
|
+
if (iframe) {
|
|
1181
|
+
const requestId = uuidv4();
|
|
1182
|
+
iframe.contentWindow.postMessage(
|
|
1183
|
+
{
|
|
1184
|
+
action: "setPreview",
|
|
1185
|
+
preview,
|
|
1186
|
+
requestId,
|
|
1187
|
+
_version: dashboardComponent.VERSION
|
|
1188
|
+
},
|
|
1189
|
+
"*"
|
|
1190
|
+
);
|
|
1191
|
+
return new Promise((resolve, reject) => {
|
|
1192
|
+
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
1193
|
+
setTimeout(() => {
|
|
1194
|
+
if (dashboardComponent.promises[requestId]) {
|
|
1195
|
+
const errorMessage = "setPreview request timed out.";
|
|
1196
|
+
dashboardComponent.promises[requestId].reject(
|
|
1197
|
+
new Error(errorMessage)
|
|
1198
|
+
);
|
|
1199
|
+
delete dashboardComponent.promises[requestId];
|
|
1200
|
+
}
|
|
1201
|
+
}, 2e3);
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
1205
|
+
};
|
|
1206
|
+
|
|
1207
|
+
// libs/embed-libs/shared-embed/src/lib/service/calculate-dimensions.ts
|
|
1208
|
+
var _setCalculatedDimensions = (dashboardComponent) => {
|
|
1209
|
+
if (!dashboardComponent.dimensions) {
|
|
1210
|
+
dashboardComponent.params.error = true;
|
|
1211
|
+
_handleError("Got no valid dimensions.", dashboardComponent.params);
|
|
1212
|
+
return;
|
|
1213
|
+
}
|
|
1214
|
+
const dashboardDimensionKeys = Object.keys(
|
|
1215
|
+
dashboardComponent.dimensions
|
|
1216
|
+
);
|
|
1217
|
+
const availableScreenModeExtents = [];
|
|
1218
|
+
let currentMode;
|
|
1219
|
+
let currentWidth = 0;
|
|
1220
|
+
let currentHeight = 0;
|
|
1221
|
+
if (!dashboardComponent.params.switchScreenModeOnResize && dashboardComponent.currentScreenMode) {
|
|
1222
|
+
dashboardComponent.params.screenMode = dashboardComponent.currentScreenMode;
|
|
1223
|
+
}
|
|
1224
|
+
if (dashboardComponent.dimensions && dashboardDimensionKeys?.[0] === "fixed") {
|
|
1225
|
+
currentMode = "fixed";
|
|
1226
|
+
currentWidth = dashboardComponent.dimensions.fixed[0];
|
|
1227
|
+
currentHeight = dashboardComponent.dimensions.fixed[1];
|
|
1228
|
+
} else {
|
|
1229
|
+
const screenModes = [
|
|
1230
|
+
"mobile",
|
|
1231
|
+
"tablet",
|
|
1232
|
+
"desktop",
|
|
1233
|
+
"largeScreen"
|
|
1234
|
+
];
|
|
1235
|
+
if (dashboardComponent.params.itemEmbedding) {
|
|
1236
|
+
const [firstMatch] = dashboardDimensionKeys;
|
|
1237
|
+
let match = cloneDeep(firstMatch);
|
|
1238
|
+
for (const screenMode of screenModes) {
|
|
1239
|
+
const found = dashboardDimensionKeys.find((key) => key === screenMode);
|
|
1240
|
+
if (found) {
|
|
1241
|
+
match = cloneDeep(found);
|
|
1242
|
+
} else {
|
|
1243
|
+
dashboardComponent.dimensions[screenMode] = dashboardComponent.dimensions[match];
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
for (const key of dashboardDimensionKeys) {
|
|
1248
|
+
if (screenModes.includes(key)) {
|
|
1249
|
+
const screenMode = EXTENTS.find((extent) => extent.mode === key);
|
|
1250
|
+
availableScreenModeExtents.push({
|
|
1251
|
+
...screenMode,
|
|
1252
|
+
height: dashboardComponent.dimensions[key][1] || 50
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
if (!availableScreenModeExtents.map((screenModeExtent) => screenModeExtent.mode).includes(dashboardComponent.params.screenMode)) {
|
|
1257
|
+
dashboardComponent.params.screenMode = "auto";
|
|
1258
|
+
}
|
|
1259
|
+
if (dashboardComponent.params.screenMode === "auto") {
|
|
1260
|
+
availableScreenModeExtents.sort(
|
|
1261
|
+
(a3, b3) => screenModes.indexOf(a3.mode) - screenModes.indexOf(b3.mode)
|
|
1262
|
+
);
|
|
1263
|
+
for (const screenModeExtent of availableScreenModeExtents) {
|
|
1264
|
+
const [screenModeExtentMinWidth, screenModeExtentMaxWidth] = screenModeExtent.width;
|
|
1265
|
+
if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
|
|
1266
|
+
if (screenModeExtentMinWidth < dashboardComponent.params.itemDimensions.width) {
|
|
1267
|
+
currentMode = screenModeExtent.mode;
|
|
1268
|
+
currentWidth = Number.parseInt(
|
|
1269
|
+
dashboardComponent.params.itemDimensions.width,
|
|
1270
|
+
10
|
|
1271
|
+
);
|
|
1272
|
+
currentHeight = dashboardComponent.dimensions[currentMode][1];
|
|
1273
|
+
}
|
|
1274
|
+
} else {
|
|
1275
|
+
if (screenModeExtentMinWidth < dashboardComponent.containerWidth) {
|
|
1276
|
+
currentMode = screenModeExtent.mode;
|
|
1277
|
+
if (dashboardComponent.params.itemEmbedding) {
|
|
1278
|
+
currentWidth = dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto" ? Number.parseInt(
|
|
1279
|
+
dashboardComponent.params.itemDimensions.width,
|
|
1280
|
+
10
|
|
1281
|
+
) : Math.min(
|
|
1282
|
+
dashboardComponent.containerWidth,
|
|
1283
|
+
screenModeExtentMaxWidth
|
|
1284
|
+
);
|
|
1285
|
+
currentHeight = dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto" ? Number.parseInt(
|
|
1286
|
+
dashboardComponent.params.itemDimensions.height,
|
|
1287
|
+
10
|
|
1288
|
+
) : dashboardComponent.dimensions[currentMode][1];
|
|
1289
|
+
if (dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
|
|
1290
|
+
currentWidth = Number.parseInt(
|
|
1291
|
+
dashboardComponent.params.itemDimensions.width,
|
|
1292
|
+
10
|
|
1293
|
+
);
|
|
1294
|
+
currentHeight = dashboardComponent.dimensions[currentMode][1];
|
|
1295
|
+
}
|
|
1296
|
+
} else {
|
|
1297
|
+
currentWidth = Math.max(
|
|
1298
|
+
Math.min(
|
|
1299
|
+
screenModeExtentMaxWidth,
|
|
1300
|
+
dashboardComponent.containerWidth
|
|
1301
|
+
),
|
|
1302
|
+
screenModeExtentMinWidth
|
|
1303
|
+
);
|
|
1304
|
+
currentHeight = screenModeExtent.height;
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
} else {
|
|
1310
|
+
const {
|
|
1311
|
+
height: chosenModeHeight,
|
|
1312
|
+
width: [chosenModeMinWidth, chosenModeMaxWidth]
|
|
1313
|
+
} = availableScreenModeExtents.find(
|
|
1314
|
+
(d3) => d3.mode === dashboardComponent.params.screenMode
|
|
1315
|
+
);
|
|
1316
|
+
currentMode = dashboardComponent.params.screenMode;
|
|
1317
|
+
currentWidth = Math.max(
|
|
1318
|
+
Math.min(chosenModeMaxWidth, dashboardComponent.containerWidth),
|
|
1319
|
+
chosenModeMinWidth
|
|
1320
|
+
);
|
|
1321
|
+
currentHeight = chosenModeHeight;
|
|
1322
|
+
if (dashboardComponent.params.itemEmbedding) {
|
|
1323
|
+
if (dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto") {
|
|
1324
|
+
currentWidth = Number.parseInt(
|
|
1325
|
+
dashboardComponent.params.itemDimensions.width,
|
|
1326
|
+
10
|
|
1327
|
+
);
|
|
1328
|
+
}
|
|
1329
|
+
if (dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto") {
|
|
1330
|
+
currentHeight = Number.parseInt(
|
|
1331
|
+
dashboardComponent.params.itemDimensions.height,
|
|
1332
|
+
10
|
|
1333
|
+
);
|
|
1334
|
+
}
|
|
1309
1335
|
}
|
|
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
1336
|
}
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1337
|
+
if (!currentMode && availableScreenModeExtents.length > 0) {
|
|
1338
|
+
const [lowestModeExtent] = availableScreenModeExtents;
|
|
1339
|
+
currentMode = lowestModeExtent.mode;
|
|
1340
|
+
currentWidth = lowestModeExtent.width[0];
|
|
1341
|
+
currentHeight = lowestModeExtent.height;
|
|
1370
1342
|
}
|
|
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();
|
|
1389
|
-
}
|
|
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));
|
|
1392
|
-
}
|
|
1393
|
-
addController(t5) {
|
|
1394
|
-
(this._$EO ??= /* @__PURE__ */ new Set()).add(t5), void 0 !== this.renderRoot && this.isConnected && t5.hostConnected?.();
|
|
1395
|
-
}
|
|
1396
|
-
removeController(t5) {
|
|
1397
|
-
this._$EO?.delete(t5);
|
|
1398
|
-
}
|
|
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);
|
|
1404
|
-
}
|
|
1405
|
-
createRenderRoot() {
|
|
1406
|
-
const t5 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
1407
|
-
return S(t5, this.constructor.elementStyles), t5;
|
|
1408
|
-
}
|
|
1409
|
-
connectedCallback() {
|
|
1410
|
-
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach((t5) => t5.hostConnected?.());
|
|
1411
|
-
}
|
|
1412
|
-
enableUpdating(t5) {
|
|
1413
1343
|
}
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1344
|
+
dashboardComponent.currentScreenMode = currentMode;
|
|
1345
|
+
const style = {
|
|
1346
|
+
height: currentHeight === 0 ? "100%" : `${String(currentHeight)}px`,
|
|
1347
|
+
width: currentWidth === 0 ? "100%" : `${String(currentWidth)}px`,
|
|
1348
|
+
opacity: 1
|
|
1349
|
+
};
|
|
1350
|
+
const dashboardEditModes = ["editFull", "editLimited"];
|
|
1351
|
+
if (dashboardEditModes.includes(dashboardComponent.params.editMode)) {
|
|
1352
|
+
style.height = "100%";
|
|
1353
|
+
style.width = "100%";
|
|
1354
|
+
} else if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions) {
|
|
1355
|
+
style.height = dashboardComponent.params.itemDimensions.height === "auto" ? style.height : `${String(dashboardComponent.params.itemDimensions.height).replace(
|
|
1356
|
+
"px",
|
|
1357
|
+
""
|
|
1358
|
+
)}px`;
|
|
1359
|
+
style.width = dashboardComponent.params.itemDimensions.width === "auto" ? style.width : `${String(dashboardComponent.params.itemDimensions.width).replace(
|
|
1360
|
+
"px",
|
|
1361
|
+
""
|
|
1362
|
+
)}px`;
|
|
1363
|
+
} else {
|
|
1364
|
+
style.height = currentHeight === 0 ? "100%" : `${String(currentHeight)}px`;
|
|
1365
|
+
style.width = currentWidth === 0 ? "100%" : `${String(currentWidth)}px`;
|
|
1419
1366
|
}
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1367
|
+
dashboardComponent.currentScreenMode = currentMode;
|
|
1368
|
+
dashboardComponent.iframeStyle = style;
|
|
1369
|
+
};
|
|
1370
|
+
|
|
1371
|
+
// libs/embed-libs/shared-embed/src/lib/service/extend-and-validate.ts
|
|
1372
|
+
var _extendAndValidate = (dashboardContent) => {
|
|
1373
|
+
const defaultKeys = Object.keys(
|
|
1374
|
+
DEFAULT_PARAMETERS
|
|
1375
|
+
);
|
|
1376
|
+
const errorMessages = [];
|
|
1377
|
+
const requiredStringParams = [
|
|
1378
|
+
"appServer",
|
|
1379
|
+
"language",
|
|
1380
|
+
"apiHost"
|
|
1381
|
+
];
|
|
1382
|
+
const requiredStringOrEmptyParams = [
|
|
1383
|
+
"key",
|
|
1384
|
+
"token",
|
|
1385
|
+
"screenMode",
|
|
1386
|
+
"timezoneId",
|
|
1387
|
+
"itemId",
|
|
1388
|
+
"container",
|
|
1389
|
+
"loaderBackground",
|
|
1390
|
+
"loaderFontColor",
|
|
1391
|
+
"loaderSpinnerColor",
|
|
1392
|
+
"loaderSpinnerBackground"
|
|
1393
|
+
];
|
|
1394
|
+
const objectParams = ["itemDimensions"];
|
|
1395
|
+
const screenModes = [
|
|
1396
|
+
"mobile",
|
|
1397
|
+
"tablet",
|
|
1398
|
+
"desktop",
|
|
1399
|
+
"largeScreen",
|
|
1400
|
+
"fixed",
|
|
1401
|
+
"auto"
|
|
1402
|
+
];
|
|
1403
|
+
for (const key of defaultKeys) {
|
|
1404
|
+
if (dashboardContent.params[key] === null) {
|
|
1405
|
+
delete dashboardContent.params[key];
|
|
1425
1406
|
}
|
|
1426
1407
|
}
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1408
|
+
dashboardContent.params = defaultsDeep(
|
|
1409
|
+
dashboardContent.params,
|
|
1410
|
+
DEFAULT_PARAMETERS
|
|
1411
|
+
);
|
|
1412
|
+
if ((!dashboardContent.params.dashboardId || typeof dashboardContent.params.dashboardId !== "string") && (!dashboardContent.params.dashboardSlug || typeof dashboardContent.params.dashboardSlug !== "string")) {
|
|
1413
|
+
delete dashboardContent.params.dashboardId;
|
|
1414
|
+
delete dashboardContent.params.dashboardSlug;
|
|
1433
1415
|
}
|
|
1434
|
-
|
|
1435
|
-
if (
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
this.P(t5, s4, i6);
|
|
1416
|
+
for (const key of requiredStringParams) {
|
|
1417
|
+
if (typeof dashboardContent.params[key] !== "string") {
|
|
1418
|
+
delete dashboardContent.params[key];
|
|
1419
|
+
errorMessages.push(`${key} needs to be of type string.`);
|
|
1439
1420
|
}
|
|
1440
|
-
false === this.isUpdatePending && (this._$ES = this._$ET());
|
|
1441
|
-
}
|
|
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);
|
|
1444
1421
|
}
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
} catch (t6) {
|
|
1450
|
-
Promise.reject(t6);
|
|
1422
|
+
for (const key of requiredStringOrEmptyParams) {
|
|
1423
|
+
if (typeof dashboardContent.params[key] !== "string" && dashboardContent.params[key] !== null && dashboardContent.params[key] !== void 0) {
|
|
1424
|
+
delete dashboardContent.params[key];
|
|
1425
|
+
errorMessages.push(`${key} needs to be of type string or empty.`);
|
|
1451
1426
|
}
|
|
1452
|
-
const t5 = this.scheduleUpdate();
|
|
1453
|
-
return null != t5 && await t5, !this.isUpdatePending;
|
|
1454
1427
|
}
|
|
1455
|
-
|
|
1456
|
-
|
|
1428
|
+
if (dashboardContent.params.screenMode && !screenModes.includes(dashboardContent.params.screenMode)) {
|
|
1429
|
+
const validTypesString = screenModes.map((mode) => `"${mode}"`).join(", ");
|
|
1430
|
+
errorMessages.push(
|
|
1431
|
+
`"screenMode" needs should be one of these types: ${validTypesString}`
|
|
1432
|
+
);
|
|
1433
|
+
dashboardContent.params.screenMode = "auto";
|
|
1457
1434
|
}
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
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);
|
|
1471
|
-
}
|
|
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;
|
|
1435
|
+
if (dashboardContent.params.itemId) {
|
|
1436
|
+
dashboardContent.params.itemEmbedding = true;
|
|
1437
|
+
}
|
|
1438
|
+
for (const key of objectParams) {
|
|
1439
|
+
if (typeof dashboardContent.params[key] !== "object" && dashboardContent.params[key] !== null) {
|
|
1440
|
+
delete dashboardContent.params[key];
|
|
1441
|
+
errorMessages.push(`${key} needs to be of type object or empty.`);
|
|
1478
1442
|
}
|
|
1479
|
-
t5 && this._$AE(s4);
|
|
1480
1443
|
}
|
|
1481
|
-
|
|
1444
|
+
if (typeof dashboardContent.params.switchScreenModeOnResize !== "boolean") {
|
|
1445
|
+
errorMessages.push("switchScreenModeOnResize needs to be of type boolean.");
|
|
1446
|
+
dashboardContent.params.switchScreenModeOnResize = true;
|
|
1482
1447
|
}
|
|
1483
|
-
|
|
1484
|
-
|
|
1448
|
+
if (dashboardContent.params.itemDimensions) {
|
|
1449
|
+
const itemDimensionsKeys = [
|
|
1450
|
+
"width",
|
|
1451
|
+
"height"
|
|
1452
|
+
];
|
|
1453
|
+
for (const key of itemDimensionsKeys) {
|
|
1454
|
+
if (!["string", "number"].includes(
|
|
1455
|
+
typeof dashboardContent.params.itemDimensions[key]
|
|
1456
|
+
) && dashboardContent.params.itemDimensions[key] !== null) {
|
|
1457
|
+
errorMessages.push(
|
|
1458
|
+
`itemDimensions ${key} needs to be of type string, number or empty.`
|
|
1459
|
+
);
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1485
1462
|
}
|
|
1486
|
-
|
|
1487
|
-
|
|
1463
|
+
dashboardContent.params = defaultsDeep(
|
|
1464
|
+
dashboardContent.params,
|
|
1465
|
+
DEFAULT_PARAMETERS
|
|
1466
|
+
);
|
|
1467
|
+
if (dashboardContent.params.screenMode && dashboardContent.params.screenMode !== "auto") {
|
|
1468
|
+
dashboardContent.params.switchScreenModeOnResize = false;
|
|
1488
1469
|
}
|
|
1489
|
-
|
|
1490
|
-
|
|
1470
|
+
if (dashboardContent.params.itemDimensions.width !== "auto") {
|
|
1471
|
+
dashboardContent.params.itemDimensions.width = Number.parseInt(
|
|
1472
|
+
`${dashboardContent.params.itemDimensions.width}`.replace("px", ""),
|
|
1473
|
+
10
|
|
1474
|
+
) || "auto";
|
|
1491
1475
|
}
|
|
1492
|
-
|
|
1493
|
-
|
|
1476
|
+
if (dashboardContent.params.itemDimensions.height !== "auto") {
|
|
1477
|
+
dashboardContent.params.itemDimensions.height = Number.parseInt(
|
|
1478
|
+
`${dashboardContent.params.itemDimensions.height}`.replace("px", ""),
|
|
1479
|
+
10
|
|
1480
|
+
) || "auto";
|
|
1494
1481
|
}
|
|
1495
|
-
|
|
1496
|
-
|
|
1482
|
+
dashboardContent.params.itemEmbedding = !!dashboardContent.params.itemId;
|
|
1483
|
+
if (dashboardContent.params.error || errorMessages.length > 0) {
|
|
1484
|
+
_handleError(errorMessages.join("\n"), dashboardContent.params);
|
|
1497
1485
|
}
|
|
1498
|
-
|
|
1499
|
-
|
|
1486
|
+
};
|
|
1487
|
+
|
|
1488
|
+
// libs/embed-libs/shared-embed/src/lib/constants/class-constants.ts
|
|
1489
|
+
var luzmoEmbedContainerClass = "luzmo-embed-container";
|
|
1490
|
+
|
|
1491
|
+
// libs/embed-libs/shared-embed/src/lib/helpers/remote-federation.ts
|
|
1492
|
+
var remotesMap = {
|
|
1493
|
+
// "remote_app": { url: "http://localhost:4201/remoteEntry.mjs", format: "esm", from: "vite" },
|
|
1494
|
+
};
|
|
1495
|
+
var loadJS = async (url, fn) => {
|
|
1496
|
+
const resolvedUrl = typeof url === "function" ? await url() : url;
|
|
1497
|
+
const script = document.createElement("script");
|
|
1498
|
+
script.type = "text/javascript";
|
|
1499
|
+
script.addEventListener("load", fn);
|
|
1500
|
+
script.src = resolvedUrl;
|
|
1501
|
+
document.querySelectorAll("head")[0].append(script);
|
|
1502
|
+
};
|
|
1503
|
+
var wrapShareModule = (remoteFrom) => ({});
|
|
1504
|
+
async function __federationMethodEnsure(remoteId) {
|
|
1505
|
+
const remote = remotesMap[remoteId];
|
|
1506
|
+
if (remote.inited) {
|
|
1507
|
+
return remote.lib;
|
|
1500
1508
|
}
|
|
1501
|
-
|
|
1509
|
+
if (remote.format === "var") {
|
|
1510
|
+
return new Promise((resolve) => {
|
|
1511
|
+
const callback = () => {
|
|
1512
|
+
if (!remote.inited) {
|
|
1513
|
+
remote.lib = window[remoteId];
|
|
1514
|
+
remote.lib.init(wrapShareModule(remote.from));
|
|
1515
|
+
remote.inited = true;
|
|
1516
|
+
}
|
|
1517
|
+
resolve(remote.lib);
|
|
1518
|
+
};
|
|
1519
|
+
return loadJS(remote.url, callback);
|
|
1520
|
+
});
|
|
1521
|
+
} else if (["esm", "systemjs"].includes(remote.format)) {
|
|
1522
|
+
return new Promise((resolve, reject) => {
|
|
1523
|
+
const getUrl = typeof remote.url === "function" ? remote.url : () => Promise.resolve(remote.url);
|
|
1524
|
+
getUrl().then((url) => {
|
|
1525
|
+
import(
|
|
1526
|
+
/* @vite-ignore */
|
|
1527
|
+
/* webpackIgnore: true */
|
|
1528
|
+
url
|
|
1529
|
+
).then((lib) => {
|
|
1530
|
+
if (!remote.inited) {
|
|
1531
|
+
const shareScope = wrapShareModule(remote.from);
|
|
1532
|
+
lib.init(shareScope);
|
|
1533
|
+
remote.lib = lib;
|
|
1534
|
+
remote.lib.init(shareScope);
|
|
1535
|
+
remote.inited = true;
|
|
1536
|
+
}
|
|
1537
|
+
resolve(remote.lib);
|
|
1538
|
+
}).catch(reject);
|
|
1539
|
+
});
|
|
1540
|
+
});
|
|
1502
1541
|
}
|
|
1503
|
-
|
|
1542
|
+
}
|
|
1543
|
+
function __federationMethodWrapDefault(module2, need) {
|
|
1544
|
+
if (!(module2 == null ? void 0 : module2.default) && need) {
|
|
1545
|
+
const obj = /* @__PURE__ */ Object.create(null);
|
|
1546
|
+
obj.default = module2;
|
|
1547
|
+
obj.__esModule = true;
|
|
1548
|
+
return obj;
|
|
1504
1549
|
}
|
|
1505
|
-
|
|
1506
|
-
|
|
1550
|
+
return module2;
|
|
1551
|
+
}
|
|
1552
|
+
async function __federationMethodGetRemote(remoteName, componentName) {
|
|
1553
|
+
return __federationMethodEnsure(remoteName).then((remote) => remote.get(componentName).then((factory) => factory()));
|
|
1554
|
+
}
|
|
1507
1555
|
|
|
1508
1556
|
// node_modules/lit-html/lit-html.js
|
|
1509
|
-
var
|
|
1510
|
-
var i3 =
|
|
1557
|
+
var t3 = globalThis;
|
|
1558
|
+
var i3 = t3.trustedTypes;
|
|
1511
1559
|
var s2 = i3 ? i3.createPolicy("lit-html", { createHTML: (t5) => t5 }) : void 0;
|
|
1512
|
-
var
|
|
1560
|
+
var e5 = "$lit$";
|
|
1513
1561
|
var h2 = `lit$${(Math.random() + "").slice(9)}$`;
|
|
1514
|
-
var
|
|
1515
|
-
var
|
|
1516
|
-
var
|
|
1517
|
-
var l2 = () =>
|
|
1562
|
+
var o4 = "?" + h2;
|
|
1563
|
+
var n4 = `<${o4}>`;
|
|
1564
|
+
var r5 = document;
|
|
1565
|
+
var l2 = () => r5.createComment("");
|
|
1518
1566
|
var c3 = (t5) => null === t5 || "object" != typeof t5 && "function" != typeof t5;
|
|
1519
1567
|
var a2 = Array.isArray;
|
|
1520
1568
|
var u2 = (t5) => a2(t5) || "function" == typeof t5?.[Symbol.iterator];
|
|
@@ -1533,7 +1581,7 @@ var b2 = y2(2);
|
|
|
1533
1581
|
var w = Symbol.for("lit-noChange");
|
|
1534
1582
|
var T = Symbol.for("lit-nothing");
|
|
1535
1583
|
var A = /* @__PURE__ */ new WeakMap();
|
|
1536
|
-
var E =
|
|
1584
|
+
var E = r5.createTreeWalker(r5, 129);
|
|
1537
1585
|
function C(t5, i6) {
|
|
1538
1586
|
if (!Array.isArray(t5) || !t5.hasOwnProperty("raw"))
|
|
1539
1587
|
throw Error("invalid template strings array");
|
|
@@ -1548,7 +1596,7 @@ var P = (t5, i6) => {
|
|
|
1548
1596
|
for (; y3 < s5.length && (c4.lastIndex = y3, u3 = c4.exec(s5), null !== u3); )
|
|
1549
1597
|
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
1598
|
const x2 = c4 === m && t5[i7 + 1].startsWith("/>") ? " " : "";
|
|
1551
|
-
l3 += c4 === f2 ? s5 +
|
|
1599
|
+
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
1600
|
}
|
|
1553
1601
|
return [C(t5, l3 + (t5[s4] || "<?>") + (2 === i6 ? "</svg>" : "")), o6];
|
|
1554
1602
|
};
|
|
@@ -1566,7 +1614,7 @@ var V = class _V {
|
|
|
1566
1614
|
if (1 === r7.nodeType) {
|
|
1567
1615
|
if (r7.hasAttributes())
|
|
1568
1616
|
for (const t6 of r7.getAttributeNames())
|
|
1569
|
-
if (t6.endsWith(
|
|
1617
|
+
if (t6.endsWith(e5)) {
|
|
1570
1618
|
const i6 = v2[a3++], s5 = r7.getAttribute(t6).split(h2), e7 = /([.?@])?(.*)/.exec(i6);
|
|
1571
1619
|
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
1620
|
} else
|
|
@@ -1581,7 +1629,7 @@ var V = class _V {
|
|
|
1581
1629
|
}
|
|
1582
1630
|
}
|
|
1583
1631
|
} else if (8 === r7.nodeType)
|
|
1584
|
-
if (r7.data ===
|
|
1632
|
+
if (r7.data === o4)
|
|
1585
1633
|
d3.push({ type: 2, index: c4 });
|
|
1586
1634
|
else {
|
|
1587
1635
|
let t6 = -1;
|
|
@@ -1592,7 +1640,7 @@ var V = class _V {
|
|
|
1592
1640
|
}
|
|
1593
1641
|
}
|
|
1594
1642
|
static createElement(t5, i6) {
|
|
1595
|
-
const s4 =
|
|
1643
|
+
const s4 = r5.createElement("template");
|
|
1596
1644
|
return s4.innerHTML = t5, s4;
|
|
1597
1645
|
}
|
|
1598
1646
|
};
|
|
@@ -1614,7 +1662,7 @@ var S2 = class {
|
|
|
1614
1662
|
return this._$AM._$AU;
|
|
1615
1663
|
}
|
|
1616
1664
|
u(t5) {
|
|
1617
|
-
const { el: { content: i6 }, parts: s4 } = this._$AD, e7 = (t5?.creationScope ??
|
|
1665
|
+
const { el: { content: i6 }, parts: s4 } = this._$AD, e7 = (t5?.creationScope ?? r5).importNode(i6, true);
|
|
1618
1666
|
E.currentNode = e7;
|
|
1619
1667
|
let h3 = E.nextNode(), o6 = 0, n6 = 0, l3 = s4[0];
|
|
1620
1668
|
for (; void 0 !== l3; ) {
|
|
@@ -1624,7 +1672,7 @@ var S2 = class {
|
|
|
1624
1672
|
}
|
|
1625
1673
|
o6 !== l3?.index && (h3 = E.nextNode(), o6++);
|
|
1626
1674
|
}
|
|
1627
|
-
return E.currentNode =
|
|
1675
|
+
return E.currentNode = r5, e7;
|
|
1628
1676
|
}
|
|
1629
1677
|
p(t5) {
|
|
1630
1678
|
let i6 = 0;
|
|
@@ -1660,7 +1708,7 @@ var M = class _M {
|
|
|
1660
1708
|
this._$AH !== t5 && (this._$AR(), this._$AH = this.S(t5));
|
|
1661
1709
|
}
|
|
1662
1710
|
_(t5) {
|
|
1663
|
-
this._$AH !== T && c3(this._$AH) ? this._$AA.nextSibling.data = t5 : this.T(
|
|
1711
|
+
this._$AH !== T && c3(this._$AH) ? this._$AA.nextSibling.data = t5 : this.T(r5.createTextNode(t5)), this._$AH = t5;
|
|
1664
1712
|
}
|
|
1665
1713
|
$(t5) {
|
|
1666
1714
|
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 +1809,8 @@ var L = class {
|
|
|
1761
1809
|
N(this, t5);
|
|
1762
1810
|
}
|
|
1763
1811
|
};
|
|
1764
|
-
var Z =
|
|
1765
|
-
Z?.(V, M), (
|
|
1812
|
+
var Z = t3.litHtmlPolyfillSupport;
|
|
1813
|
+
Z?.(V, M), (t3.litHtmlVersions ??= []).push("3.1.2");
|
|
1766
1814
|
var j = (t5, i6, s4) => {
|
|
1767
1815
|
const e7 = s4?.renderBefore ?? i6;
|
|
1768
1816
|
let h3 = e7._$litPart$;
|
|
@@ -1797,79 +1845,10 @@ var s3 = class extends b {
|
|
|
1797
1845
|
}
|
|
1798
1846
|
};
|
|
1799
1847
|
s3._$litElement$ = true, s3["finalized", "finalized"] = true, globalThis.litElementHydrateSupport?.({ LitElement: s3 });
|
|
1800
|
-
var
|
|
1801
|
-
|
|
1848
|
+
var r6 = globalThis.litElementPolyfillSupport;
|
|
1849
|
+
r6?.({ LitElement: s3 });
|
|
1802
1850
|
(globalThis.litElementVersions ??= []).push("4.0.4");
|
|
1803
1851
|
|
|
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
1852
|
// node_modules/lit-html/directive.js
|
|
1874
1853
|
var t4 = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 };
|
|
1875
1854
|
var e6 = (t5) => (...e7) => ({ _$litDirective$: t5, values: e7 });
|
|
@@ -1923,7 +1902,7 @@ var o5 = e6(class extends i4 {
|
|
|
1923
1902
|
});
|
|
1924
1903
|
|
|
1925
1904
|
// libs/embed-libs/embed/package.json
|
|
1926
|
-
var version = "5.0.
|
|
1905
|
+
var version = "5.0.12";
|
|
1927
1906
|
|
|
1928
1907
|
// libs/embed-libs/embed/src/lib/luzmo-service.ts
|
|
1929
1908
|
var LuzmoService = class {
|
|
@@ -2200,7 +2179,7 @@ var dashboardStyles = i`
|
|
|
2200
2179
|
}
|
|
2201
2180
|
`;
|
|
2202
2181
|
|
|
2203
|
-
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-
|
|
2182
|
+
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-base.ts
|
|
2204
2183
|
var LuzmoDashboard = class extends s3 {
|
|
2205
2184
|
constructor(inputParameters) {
|
|
2206
2185
|
super();
|
|
@@ -2223,6 +2202,8 @@ var LuzmoDashboard = class extends s3 {
|
|
|
2223
2202
|
this.browserNotSupported = [];
|
|
2224
2203
|
this.VERSION = version + "-wc-luzmo";
|
|
2225
2204
|
this.isLibraryLoaded = false;
|
|
2205
|
+
this.currentAuthKey = null;
|
|
2206
|
+
this.currentAuthToken = null;
|
|
2226
2207
|
this.attributesMap = {
|
|
2227
2208
|
dashboardId: "dashboard-id",
|
|
2228
2209
|
dashboardSlug: "dashboard-slug",
|
|
@@ -2287,7 +2268,12 @@ var LuzmoDashboard = class extends s3 {
|
|
|
2287
2268
|
if (remotesMap[appServer]) {
|
|
2288
2269
|
return Promise.resolve(remotesMap[appServer].module);
|
|
2289
2270
|
}
|
|
2290
|
-
remotesMap[appServer] = {
|
|
2271
|
+
remotesMap[appServer] = {
|
|
2272
|
+
url: appServer?.startsWith("http://localhost") ? `${removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`,
|
|
2273
|
+
format: "esm",
|
|
2274
|
+
from: "vite",
|
|
2275
|
+
module: void 0
|
|
2276
|
+
};
|
|
2291
2277
|
return __federationMethodGetRemote(appServer, "./DashboardApp").then((module2) => {
|
|
2292
2278
|
const wrappedModule = __federationMethodWrapDefault(module2, true);
|
|
2293
2279
|
remotesMap[appServer].module = wrappedModule;
|
|
@@ -2365,11 +2351,10 @@ var LuzmoDashboard = class extends s3 {
|
|
|
2365
2351
|
this.dashboardReference = oldReference.cloneNode(true);
|
|
2366
2352
|
oldReference.replaceWith(this.dashboardReference);
|
|
2367
2353
|
this.dashboardReference.addEventListener("load", (payload) => {
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
});
|
|
2354
|
+
this.containerWidth = this.dashboardReference.offsetWidth;
|
|
2355
|
+
this.dimensions = payload.detail.dimensions;
|
|
2356
|
+
_setCalculatedDimensions(this);
|
|
2357
|
+
window.dispatchEvent(new Event("resize"));
|
|
2373
2358
|
this.dispatchEvent(new CustomEvent("load", payload));
|
|
2374
2359
|
});
|
|
2375
2360
|
this.dashboardReference.addEventListener("itemsRendered", (payload) => this.dispatchEvent(new CustomEvent("itemsRendered", payload)));
|
|
@@ -2549,6 +2534,8 @@ var LuzmoDashboard = class extends s3 {
|
|
|
2549
2534
|
this.apiHost = this.appServer.includes("luzmo.com") ? this.appServer.replace("app", "api") : this.appServer;
|
|
2550
2535
|
defaultParameters.apiHost = this.apiHost;
|
|
2551
2536
|
}
|
|
2537
|
+
this.currentAuthKey = this.authKey;
|
|
2538
|
+
this.currentAuthToken = this.authToken;
|
|
2552
2539
|
return defaultParameters;
|
|
2553
2540
|
}
|
|
2554
2541
|
_updateIframeUrl() {
|
|
@@ -2590,68 +2577,70 @@ var LuzmoDashboard = class extends s3 {
|
|
|
2590
2577
|
return [dashboardStyles];
|
|
2591
2578
|
}
|
|
2592
2579
|
render() {
|
|
2593
|
-
let toBeRenderedHTML
|
|
2580
|
+
let toBeRenderedHTML;
|
|
2594
2581
|
const loader = x`
|
|
2595
2582
|
<div
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2583
|
+
class="luzmo-container-loader"
|
|
2584
|
+
id="luzmo-container-loader-${this._containerId}"
|
|
2585
|
+
style=${o5(
|
|
2599
2586
|
this._containerLoaderStyle
|
|
2600
2587
|
)}
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2588
|
+
>
|
|
2589
|
+
<div
|
|
2590
|
+
class="luzmo-loader"
|
|
2591
|
+
id="luzmo-loader-${this._containerId}"
|
|
2592
|
+
style=${o5(this._loaderStyle)}
|
|
2593
|
+
>
|
|
2594
|
+
<div
|
|
2595
|
+
class="luzmo-lc"
|
|
2596
|
+
style=${o5(this._lcStyle)}
|
|
2597
|
+
>
|
|
2598
|
+
<div
|
|
2599
|
+
class="luzmo-loading-circle"
|
|
2600
|
+
style=${o5(
|
|
2614
2601
|
this._loadingCircleStyle
|
|
2615
2602
|
)}
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
</div>
|
|
2624
|
-
`}
|
|
2603
|
+
></div>
|
|
2604
|
+
${this._itemEmbedding ? "" : x`
|
|
2605
|
+
<div
|
|
2606
|
+
class="luzmo-loading-message"
|
|
2607
|
+
style=${o5({ color: this.loaderFontColor })}
|
|
2608
|
+
>
|
|
2609
|
+
${this._loaderMsg}
|
|
2625
2610
|
</div>
|
|
2626
|
-
|
|
2627
|
-
|
|
2611
|
+
`}
|
|
2612
|
+
</div>
|
|
2613
|
+
</div>
|
|
2614
|
+
</div>
|
|
2628
2615
|
`;
|
|
2629
2616
|
if (this.getIsViewMode()) {
|
|
2630
2617
|
toBeRenderedHTML = this.isLibraryLoaded ? x`
|
|
2631
|
-
${this.dashboardId || this.dashboardSlug ? x
|
|
2618
|
+
${this.dashboardId || this.dashboardSlug ? x`
|
|
2619
|
+
<dashboard-component dashboard-id="${this.params.dashboardId}" app-server="${this.params.appServer}"
|
|
2620
|
+
api-host="${this.params.apiHost}"></dashboard-component>` : x`
|
|
2632
2621
|
<div id="luzmo-error-${this._containerId}">
|
|
2633
|
-
|
|
2634
|
-
|
|
2622
|
+
<h3 class="luzmo-error">${this.browserErrorMsg}</h3>
|
|
2623
|
+
</div>
|
|
2635
2624
|
`}
|
|
2636
2625
|
` : x`${loader}`;
|
|
2637
2626
|
} else {
|
|
2638
2627
|
toBeRenderedHTML = x`
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2628
|
+
${this.dashboardId || this.dashboardSlug ? x`
|
|
2629
|
+
${loader}
|
|
2630
|
+
<iframe
|
|
2631
|
+
class="luzmo-embed-dashboard"
|
|
2632
|
+
id="${this._iframeId}"
|
|
2633
|
+
name="${this._iframeId}"
|
|
2634
|
+
style=${o5(this.iframeStyle)}
|
|
2635
|
+
src="${this._iframeUrl}"
|
|
2636
|
+
frameborder="0"
|
|
2637
|
+
></iframe>
|
|
2638
|
+
` : x`<!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId -->`}
|
|
2650
2639
|
${this.browserError ? x`
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2640
|
+
<div id="luzmo-error-${this._containerId}">
|
|
2641
|
+
<h3 class="luzmo-error">${this.browserErrorMsg}</h3>
|
|
2642
|
+
</div>
|
|
2643
|
+
` : ""}
|
|
2655
2644
|
`;
|
|
2656
2645
|
}
|
|
2657
2646
|
return x`
|
|
@@ -2703,6 +2692,8 @@ var LuzmoDashboard = class extends s3 {
|
|
|
2703
2692
|
return Promise.reject();
|
|
2704
2693
|
}
|
|
2705
2694
|
setAuthorization(key, token) {
|
|
2695
|
+
this.currentAuthKey = key;
|
|
2696
|
+
this.currentAuthToken = token;
|
|
2706
2697
|
if (this.getIsViewMode() && this.dashboardReference) {
|
|
2707
2698
|
return this.dashboardReference.setAuthorization(key, token);
|
|
2708
2699
|
}
|
|
@@ -2739,13 +2730,7 @@ var LuzmoDashboard = class extends s3 {
|
|
|
2739
2730
|
return Promise.reject();
|
|
2740
2731
|
}
|
|
2741
2732
|
getAccessibleDashboards() {
|
|
2742
|
-
|
|
2743
|
-
return getAccessibleDashboards(this, this.iframe);
|
|
2744
|
-
}
|
|
2745
|
-
if (this.getIsViewMode() && this.dashboardReference) {
|
|
2746
|
-
return this.dashboardReference.getAccessibleDashboards();
|
|
2747
|
-
}
|
|
2748
|
-
return Promise.reject();
|
|
2733
|
+
return getAccessibleDashboards(this);
|
|
2749
2734
|
}
|
|
2750
2735
|
addFilters(itemId, filters) {
|
|
2751
2736
|
return this.dashboardReference.addFilters(itemId, filters);
|
|
@@ -2784,41 +2769,38 @@ var LuzmoDashboard = class extends s3 {
|
|
|
2784
2769
|
return setPreview(this, this.iframe, preview);
|
|
2785
2770
|
}
|
|
2786
2771
|
getIsViewMode() {
|
|
2787
|
-
|
|
2788
|
-
return true;
|
|
2789
|
-
}
|
|
2790
|
-
return false;
|
|
2772
|
+
return this.experimental && this.params.editMode === "view" || this.params.editMode === void 0;
|
|
2791
2773
|
}
|
|
2792
2774
|
};
|
|
2793
2775
|
__decorateClass([
|
|
2794
|
-
|
|
2776
|
+
e4(".dashboard-container")
|
|
2795
2777
|
], LuzmoDashboard.prototype, "container", 2);
|
|
2796
2778
|
__decorateClass([
|
|
2797
|
-
|
|
2779
|
+
e4(`.${luzmoEmbedContainerClass}`)
|
|
2798
2780
|
], LuzmoDashboard.prototype, "luzmoEmbedContainer", 2);
|
|
2799
2781
|
__decorateClass([
|
|
2800
|
-
|
|
2782
|
+
e4("iframe")
|
|
2801
2783
|
], LuzmoDashboard.prototype, "iframe", 2);
|
|
2802
2784
|
__decorateClass([
|
|
2803
|
-
|
|
2785
|
+
n3()
|
|
2804
2786
|
], LuzmoDashboard.prototype, "dashboardId", 2);
|
|
2805
2787
|
__decorateClass([
|
|
2806
|
-
|
|
2788
|
+
n3()
|
|
2807
2789
|
], LuzmoDashboard.prototype, "dashboardSlug", 2);
|
|
2808
2790
|
__decorateClass([
|
|
2809
|
-
|
|
2791
|
+
n3()
|
|
2810
2792
|
], LuzmoDashboard.prototype, "itemId", 2);
|
|
2811
2793
|
__decorateClass([
|
|
2812
|
-
|
|
2794
|
+
n3()
|
|
2813
2795
|
], LuzmoDashboard.prototype, "language", 2);
|
|
2814
2796
|
__decorateClass([
|
|
2815
|
-
|
|
2797
|
+
n3()
|
|
2816
2798
|
], LuzmoDashboard.prototype, "qeVersion", 2);
|
|
2817
2799
|
__decorateClass([
|
|
2818
|
-
|
|
2800
|
+
n3()
|
|
2819
2801
|
], LuzmoDashboard.prototype, "screenMode", 2);
|
|
2820
2802
|
__decorateClass([
|
|
2821
|
-
|
|
2803
|
+
n3({
|
|
2822
2804
|
converter: {
|
|
2823
2805
|
fromAttribute: (value) => value === "true",
|
|
2824
2806
|
toAttribute: String
|
|
@@ -2826,46 +2808,46 @@ __decorateClass([
|
|
|
2826
2808
|
})
|
|
2827
2809
|
], LuzmoDashboard.prototype, "switchScreenModeOnResize", 2);
|
|
2828
2810
|
__decorateClass([
|
|
2829
|
-
|
|
2811
|
+
n3()
|
|
2830
2812
|
], LuzmoDashboard.prototype, "editMode", 2);
|
|
2831
2813
|
__decorateClass([
|
|
2832
|
-
|
|
2814
|
+
n3()
|
|
2833
2815
|
], LuzmoDashboard.prototype, "mainColor", 2);
|
|
2834
2816
|
__decorateClass([
|
|
2835
|
-
|
|
2817
|
+
n3()
|
|
2836
2818
|
], LuzmoDashboard.prototype, "accentColor", 2);
|
|
2837
2819
|
__decorateClass([
|
|
2838
|
-
|
|
2820
|
+
n3()
|
|
2839
2821
|
], LuzmoDashboard.prototype, "authToken", 2);
|
|
2840
2822
|
__decorateClass([
|
|
2841
|
-
|
|
2823
|
+
n3()
|
|
2842
2824
|
], LuzmoDashboard.prototype, "authKey", 2);
|
|
2843
2825
|
__decorateClass([
|
|
2844
|
-
|
|
2826
|
+
n3()
|
|
2845
2827
|
], LuzmoDashboard.prototype, "loaderBackground", 2);
|
|
2846
2828
|
__decorateClass([
|
|
2847
|
-
|
|
2829
|
+
n3()
|
|
2848
2830
|
], LuzmoDashboard.prototype, "loaderFontColor", 2);
|
|
2849
2831
|
__decorateClass([
|
|
2850
|
-
|
|
2832
|
+
n3()
|
|
2851
2833
|
], LuzmoDashboard.prototype, "loaderSpinnerColor", 2);
|
|
2852
2834
|
__decorateClass([
|
|
2853
|
-
|
|
2835
|
+
n3()
|
|
2854
2836
|
], LuzmoDashboard.prototype, "loaderSpinnerBackground", 2);
|
|
2855
2837
|
__decorateClass([
|
|
2856
|
-
|
|
2838
|
+
n3()
|
|
2857
2839
|
], LuzmoDashboard.prototype, "appServer", 2);
|
|
2858
2840
|
__decorateClass([
|
|
2859
|
-
|
|
2841
|
+
n3()
|
|
2860
2842
|
], LuzmoDashboard.prototype, "timezoneId", 2);
|
|
2861
2843
|
__decorateClass([
|
|
2862
|
-
|
|
2844
|
+
n3()
|
|
2863
2845
|
], LuzmoDashboard.prototype, "apiHost", 2);
|
|
2864
2846
|
__decorateClass([
|
|
2865
|
-
|
|
2847
|
+
n3({ type: Object })
|
|
2866
2848
|
], LuzmoDashboard.prototype, "itemDimensions", 2);
|
|
2867
2849
|
__decorateClass([
|
|
2868
|
-
|
|
2850
|
+
n3({
|
|
2869
2851
|
converter: {
|
|
2870
2852
|
fromAttribute: (value) => value === "true",
|
|
2871
2853
|
toAttribute: String
|
|
@@ -2873,189 +2855,194 @@ __decorateClass([
|
|
|
2873
2855
|
})
|
|
2874
2856
|
], LuzmoDashboard.prototype, "experimental", 2);
|
|
2875
2857
|
__decorateClass([
|
|
2876
|
-
|
|
2858
|
+
n3({ attribute: false })
|
|
2877
2859
|
], LuzmoDashboard.prototype, "_containerId", 2);
|
|
2878
2860
|
__decorateClass([
|
|
2879
|
-
|
|
2861
|
+
n3({ attribute: false })
|
|
2880
2862
|
], LuzmoDashboard.prototype, "_iframeId", 2);
|
|
2881
2863
|
__decorateClass([
|
|
2882
|
-
|
|
2864
|
+
n3({ attribute: false })
|
|
2883
2865
|
], LuzmoDashboard.prototype, "params", 2);
|
|
2884
2866
|
__decorateClass([
|
|
2885
|
-
|
|
2867
|
+
n3({ attribute: false })
|
|
2886
2868
|
], LuzmoDashboard.prototype, "_iframeUrl", 2);
|
|
2887
2869
|
__decorateClass([
|
|
2888
|
-
|
|
2870
|
+
n3({ attribute: false })
|
|
2889
2871
|
], LuzmoDashboard.prototype, "iframeLoaded", 2);
|
|
2890
2872
|
__decorateClass([
|
|
2891
|
-
|
|
2873
|
+
n3({ attribute: false })
|
|
2892
2874
|
], LuzmoDashboard.prototype, "promises", 2);
|
|
2893
2875
|
__decorateClass([
|
|
2894
|
-
|
|
2876
|
+
n3({ attribute: false })
|
|
2895
2877
|
], LuzmoDashboard.prototype, "iframeStyle", 2);
|
|
2896
2878
|
__decorateClass([
|
|
2897
|
-
|
|
2879
|
+
n3({ attribute: false })
|
|
2898
2880
|
], LuzmoDashboard.prototype, "_containerStyle", 2);
|
|
2899
2881
|
__decorateClass([
|
|
2900
|
-
|
|
2882
|
+
n3({ attribute: false })
|
|
2901
2883
|
], LuzmoDashboard.prototype, "_loaderStyle", 2);
|
|
2902
2884
|
__decorateClass([
|
|
2903
|
-
|
|
2885
|
+
n3({ attribute: false })
|
|
2904
2886
|
], LuzmoDashboard.prototype, "_lcStyle", 2);
|
|
2905
2887
|
__decorateClass([
|
|
2906
|
-
|
|
2888
|
+
n3({ attribute: false })
|
|
2907
2889
|
], LuzmoDashboard.prototype, "_loadingCircleStyle", 2);
|
|
2908
2890
|
__decorateClass([
|
|
2909
|
-
|
|
2891
|
+
n3({ attribute: false })
|
|
2910
2892
|
], LuzmoDashboard.prototype, "_containerLoaderStyle", 2);
|
|
2911
2893
|
__decorateClass([
|
|
2912
|
-
|
|
2894
|
+
n3({ attribute: false })
|
|
2913
2895
|
], LuzmoDashboard.prototype, "_loaderMsg", 2);
|
|
2914
2896
|
__decorateClass([
|
|
2915
|
-
|
|
2897
|
+
n3({ attribute: false })
|
|
2916
2898
|
], LuzmoDashboard.prototype, "containerWidth", 2);
|
|
2917
2899
|
__decorateClass([
|
|
2918
|
-
|
|
2900
|
+
n3({ attribute: false })
|
|
2919
2901
|
], LuzmoDashboard.prototype, "dimensions", 2);
|
|
2920
2902
|
__decorateClass([
|
|
2921
|
-
|
|
2903
|
+
n3({ attribute: false })
|
|
2922
2904
|
], LuzmoDashboard.prototype, "currentScreenMode", 2);
|
|
2923
2905
|
__decorateClass([
|
|
2924
|
-
|
|
2906
|
+
n3({ attribute: false })
|
|
2925
2907
|
], LuzmoDashboard.prototype, "_itemEmbedding", 2);
|
|
2926
2908
|
__decorateClass([
|
|
2927
|
-
|
|
2909
|
+
n3({ attribute: false })
|
|
2928
2910
|
], LuzmoDashboard.prototype, "browserError", 2);
|
|
2929
2911
|
__decorateClass([
|
|
2930
|
-
|
|
2912
|
+
n3({ attribute: false })
|
|
2931
2913
|
], LuzmoDashboard.prototype, "browserErrorMsg", 2);
|
|
2932
2914
|
__decorateClass([
|
|
2933
|
-
|
|
2915
|
+
n3({ attribute: false })
|
|
2934
2916
|
], LuzmoDashboard.prototype, "dashboardError", 2);
|
|
2935
2917
|
__decorateClass([
|
|
2936
|
-
|
|
2918
|
+
n3({ attribute: false })
|
|
2937
2919
|
], LuzmoDashboard.prototype, "browserNotSupported", 2);
|
|
2938
2920
|
__decorateClass([
|
|
2939
|
-
|
|
2921
|
+
n3()
|
|
2940
2922
|
], LuzmoDashboard.prototype, "VERSION", 2);
|
|
2941
2923
|
__decorateClass([
|
|
2942
|
-
|
|
2924
|
+
r4()
|
|
2943
2925
|
], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
|
|
2944
2926
|
__decorateClass([
|
|
2945
|
-
|
|
2927
|
+
r4()
|
|
2946
2928
|
], LuzmoDashboard.prototype, "dashboardReference", 2);
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
], LuzmoDashboard);
|
|
2950
|
-
|
|
2929
|
+
__decorateClass([
|
|
2930
|
+
r4()
|
|
2931
|
+
], LuzmoDashboard.prototype, "currentAuthKey", 2);
|
|
2932
|
+
__decorateClass([
|
|
2933
|
+
r4()
|
|
2934
|
+
], LuzmoDashboard.prototype, "currentAuthToken", 2);
|
|
2935
|
+
|
|
2936
|
+
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
|
|
2937
|
+
var LuzmoDashboard2 = class extends LuzmoDashboard {
|
|
2951
2938
|
};
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
],
|
|
2939
|
+
LuzmoDashboard2 = __decorateClass([
|
|
2940
|
+
t("luzmo-dashboard")
|
|
2941
|
+
], LuzmoDashboard2);
|
|
2955
2942
|
/*! Bundled license information:
|
|
2956
2943
|
|
|
2957
|
-
@lit/reactive-element/
|
|
2944
|
+
@lit/reactive-element/decorators/custom-element.js:
|
|
2958
2945
|
(**
|
|
2959
2946
|
* @license
|
|
2960
|
-
* Copyright
|
|
2947
|
+
* Copyright 2017 Google LLC
|
|
2961
2948
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2962
2949
|
*)
|
|
2963
2950
|
|
|
2964
|
-
@lit/reactive-element/
|
|
2951
|
+
@lit/reactive-element/css-tag.js:
|
|
2965
2952
|
(**
|
|
2966
2953
|
* @license
|
|
2967
|
-
* Copyright
|
|
2954
|
+
* Copyright 2019 Google LLC
|
|
2968
2955
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2969
2956
|
*)
|
|
2970
2957
|
|
|
2971
|
-
lit-
|
|
2958
|
+
@lit/reactive-element/reactive-element.js:
|
|
2972
2959
|
(**
|
|
2973
2960
|
* @license
|
|
2974
2961
|
* Copyright 2017 Google LLC
|
|
2975
2962
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2976
2963
|
*)
|
|
2977
2964
|
|
|
2978
|
-
lit-element/
|
|
2965
|
+
@lit/reactive-element/decorators/property.js:
|
|
2979
2966
|
(**
|
|
2980
2967
|
* @license
|
|
2981
2968
|
* Copyright 2017 Google LLC
|
|
2982
2969
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2983
2970
|
*)
|
|
2984
2971
|
|
|
2985
|
-
lit-
|
|
2972
|
+
@lit/reactive-element/decorators/state.js:
|
|
2986
2973
|
(**
|
|
2987
2974
|
* @license
|
|
2988
|
-
* Copyright
|
|
2975
|
+
* Copyright 2017 Google LLC
|
|
2989
2976
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2990
2977
|
*)
|
|
2991
2978
|
|
|
2992
|
-
@lit/reactive-element/decorators/
|
|
2979
|
+
@lit/reactive-element/decorators/event-options.js:
|
|
2993
2980
|
(**
|
|
2994
2981
|
* @license
|
|
2995
2982
|
* Copyright 2017 Google LLC
|
|
2996
2983
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2997
2984
|
*)
|
|
2998
2985
|
|
|
2999
|
-
@lit/reactive-element/decorators/
|
|
2986
|
+
@lit/reactive-element/decorators/base.js:
|
|
3000
2987
|
(**
|
|
3001
2988
|
* @license
|
|
3002
2989
|
* Copyright 2017 Google LLC
|
|
3003
2990
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
3004
2991
|
*)
|
|
3005
2992
|
|
|
3006
|
-
@lit/reactive-element/decorators/
|
|
2993
|
+
@lit/reactive-element/decorators/query.js:
|
|
3007
2994
|
(**
|
|
3008
2995
|
* @license
|
|
3009
2996
|
* Copyright 2017 Google LLC
|
|
3010
2997
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
3011
2998
|
*)
|
|
3012
2999
|
|
|
3013
|
-
@lit/reactive-element/decorators/
|
|
3000
|
+
@lit/reactive-element/decorators/query-all.js:
|
|
3014
3001
|
(**
|
|
3015
3002
|
* @license
|
|
3016
3003
|
* Copyright 2017 Google LLC
|
|
3017
3004
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
3018
3005
|
*)
|
|
3019
3006
|
|
|
3020
|
-
@lit/reactive-element/decorators/
|
|
3007
|
+
@lit/reactive-element/decorators/query-async.js:
|
|
3021
3008
|
(**
|
|
3022
3009
|
* @license
|
|
3023
3010
|
* Copyright 2017 Google LLC
|
|
3024
3011
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
3025
3012
|
*)
|
|
3026
3013
|
|
|
3027
|
-
@lit/reactive-element/decorators/query.js:
|
|
3014
|
+
@lit/reactive-element/decorators/query-assigned-elements.js:
|
|
3028
3015
|
(**
|
|
3029
3016
|
* @license
|
|
3030
|
-
* Copyright
|
|
3017
|
+
* Copyright 2021 Google LLC
|
|
3031
3018
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
3032
3019
|
*)
|
|
3033
3020
|
|
|
3034
|
-
@lit/reactive-element/decorators/query-
|
|
3021
|
+
@lit/reactive-element/decorators/query-assigned-nodes.js:
|
|
3035
3022
|
(**
|
|
3036
3023
|
* @license
|
|
3037
3024
|
* Copyright 2017 Google LLC
|
|
3038
3025
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
3039
3026
|
*)
|
|
3040
3027
|
|
|
3041
|
-
|
|
3028
|
+
lit-html/lit-html.js:
|
|
3042
3029
|
(**
|
|
3043
3030
|
* @license
|
|
3044
3031
|
* Copyright 2017 Google LLC
|
|
3045
3032
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
3046
3033
|
*)
|
|
3047
3034
|
|
|
3048
|
-
|
|
3035
|
+
lit-element/lit-element.js:
|
|
3049
3036
|
(**
|
|
3050
3037
|
* @license
|
|
3051
|
-
* Copyright
|
|
3038
|
+
* Copyright 2017 Google LLC
|
|
3052
3039
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
3053
3040
|
*)
|
|
3054
3041
|
|
|
3055
|
-
|
|
3042
|
+
lit-html/is-server.js:
|
|
3056
3043
|
(**
|
|
3057
3044
|
* @license
|
|
3058
|
-
* Copyright
|
|
3045
|
+
* Copyright 2022 Google LLC
|
|
3059
3046
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
3060
3047
|
*)
|
|
3061
3048
|
|