@telia-ace/knowledge-data-client-flamingo 1.0.21 → 1.0.23
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/dist/index.js +465 -1256
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var ce = Object.defineProperty, de = Object.defineProperties;
|
|
2
|
+
var le = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var V = Object.getOwnPropertySymbols;
|
|
4
|
+
var ge = Object.prototype.hasOwnProperty, ue = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Y = (n, e, t) => e in n ? ce(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, Z = (n, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var t of
|
|
10
|
-
|
|
7
|
+
ge.call(e, t) && Y(n, t, e[t]);
|
|
8
|
+
if (V)
|
|
9
|
+
for (var t of V(e))
|
|
10
|
+
ue.call(e, t) && Y(n, t, e[t]);
|
|
11
11
|
return n;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
14
|
-
var
|
|
12
|
+
}, J = (n, e) => de(n, le(e));
|
|
13
|
+
var x = (n, e, t) => new Promise((s, i) => {
|
|
14
|
+
var o = (c) => {
|
|
15
15
|
try {
|
|
16
|
-
|
|
17
|
-
} catch (
|
|
18
|
-
|
|
16
|
+
r(t.next(c));
|
|
17
|
+
} catch (d) {
|
|
18
|
+
i(d);
|
|
19
19
|
}
|
|
20
20
|
}, a = (c) => {
|
|
21
21
|
try {
|
|
22
|
-
|
|
23
|
-
} catch (
|
|
24
|
-
|
|
22
|
+
r(t.throw(c));
|
|
23
|
+
} catch (d) {
|
|
24
|
+
i(d);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, r = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(o, a);
|
|
27
|
+
r((t = t.apply(n, e)).next());
|
|
28
28
|
});
|
|
29
|
-
const
|
|
30
|
-
const
|
|
29
|
+
const D = (n, e, t, ...s) => {
|
|
30
|
+
const i = `[${n.get("$environment").name || "webprovisions"}] ${t}`;
|
|
31
31
|
switch (e) {
|
|
32
32
|
case "info":
|
|
33
|
-
console.info(
|
|
33
|
+
console.info(i, ...s);
|
|
34
34
|
break;
|
|
35
35
|
case "warning":
|
|
36
|
-
console.warn(
|
|
36
|
+
console.warn(i, ...s);
|
|
37
37
|
break;
|
|
38
38
|
case "error":
|
|
39
|
-
console.error(
|
|
39
|
+
console.error(i, ...s);
|
|
40
40
|
break;
|
|
41
41
|
}
|
|
42
|
-
},
|
|
42
|
+
}, he = (n) => {
|
|
43
43
|
const e = n.container || n;
|
|
44
44
|
return {
|
|
45
|
-
info: (t, ...
|
|
46
|
-
warn: (t, ...
|
|
47
|
-
error: (t, ...
|
|
45
|
+
info: (t, ...s) => D(e, "info", t, ...s),
|
|
46
|
+
warn: (t, ...s) => D(e, "warning", t, ...s),
|
|
47
|
+
error: (t, ...s) => D(e, "error", t, ...s)
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
|
-
var
|
|
51
|
-
const
|
|
50
|
+
var R = /* @__PURE__ */ ((n) => (n.Implementation = "implementation", n.Widget = "widget", n))(R || {}), w = /* @__PURE__ */ ((n) => (n.Pre = "pre", n.Post = "post", n))(w || {});
|
|
51
|
+
const me = (n, e, t, s) => {
|
|
52
52
|
try {
|
|
53
|
-
const
|
|
53
|
+
const i = new e(t, s);
|
|
54
54
|
return {
|
|
55
55
|
name: n,
|
|
56
|
-
invoke: (
|
|
57
|
-
let
|
|
58
|
-
return
|
|
56
|
+
invoke: (o, a) => {
|
|
57
|
+
let r;
|
|
58
|
+
return i[o] && (r = i[o].call(i, a)), Promise.resolve(r);
|
|
59
59
|
},
|
|
60
|
-
getInstance: () =>
|
|
60
|
+
getInstance: () => i
|
|
61
61
|
};
|
|
62
|
-
} catch (
|
|
63
|
-
if (
|
|
62
|
+
} catch (i) {
|
|
63
|
+
if (i.message && i.message.indexOf("is not a constructor") >= 0)
|
|
64
64
|
return {
|
|
65
65
|
name: n,
|
|
66
|
-
invoke: (
|
|
66
|
+
invoke: (o) => {
|
|
67
67
|
let a;
|
|
68
|
-
return
|
|
68
|
+
return o === "initialize" && (a = e(t, s)), Promise.resolve(a);
|
|
69
69
|
},
|
|
70
70
|
getInstance: () => e
|
|
71
71
|
};
|
|
72
|
-
throw
|
|
72
|
+
throw i;
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
-
function
|
|
75
|
+
function X(n, e) {
|
|
76
76
|
return typeof n == "undefined" ? e : n;
|
|
77
77
|
}
|
|
78
|
-
let
|
|
79
|
-
constructor(
|
|
80
|
-
this.part =
|
|
78
|
+
let fe = class {
|
|
79
|
+
constructor(n = {}) {
|
|
80
|
+
this.part = n;
|
|
81
81
|
}
|
|
82
|
-
createCommand(e, t
|
|
82
|
+
createCommand(n, e, t) {
|
|
83
83
|
let s;
|
|
84
|
-
typeof
|
|
85
|
-
scope:
|
|
86
|
-
stage:
|
|
84
|
+
typeof e == "function" ? s = {
|
|
85
|
+
scope: R.Widget,
|
|
86
|
+
stage: w.Post,
|
|
87
87
|
defaultArgs: void 0,
|
|
88
|
-
handlerResolver:
|
|
88
|
+
handlerResolver: e
|
|
89
89
|
} : s = {
|
|
90
|
-
scope:
|
|
91
|
-
stage:
|
|
92
|
-
defaultArgs:
|
|
93
|
-
handlerResolver:
|
|
90
|
+
scope: X(e.scope, R.Widget),
|
|
91
|
+
stage: X(e.stage, w.Post),
|
|
92
|
+
defaultArgs: e.defaultArgs,
|
|
93
|
+
handlerResolver: t
|
|
94
94
|
};
|
|
95
|
-
let
|
|
96
|
-
const
|
|
97
|
-
return
|
|
98
|
-
|
|
95
|
+
let i = this.part;
|
|
96
|
+
const o = n.split(".");
|
|
97
|
+
return o.forEach((a, r) => {
|
|
98
|
+
r === o.length - 1 ? i[a] || (i[a] = () => s) : i = this.part[a] = this.part[a] || {};
|
|
99
99
|
}), this;
|
|
100
100
|
}
|
|
101
101
|
get() {
|
|
102
102
|
return this.part;
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
|
-
const
|
|
106
|
-
const e = new
|
|
105
|
+
const se = (n) => {
|
|
106
|
+
const e = new fe({});
|
|
107
107
|
return n(e), e.get();
|
|
108
108
|
};
|
|
109
|
-
|
|
109
|
+
se((n) => {
|
|
110
110
|
n.createCommand(
|
|
111
111
|
"types.register",
|
|
112
|
-
{ scope:
|
|
113
|
-
(e) => (t,
|
|
114
|
-
e.container.get("$types")[t] =
|
|
112
|
+
{ scope: R.Implementation, stage: w.Pre },
|
|
113
|
+
(e) => (t, s) => {
|
|
114
|
+
e.container.get("$types")[t] = s;
|
|
115
115
|
}
|
|
116
116
|
).createCommand(
|
|
117
117
|
"type",
|
|
118
|
-
{ stage:
|
|
118
|
+
{ stage: w.Pre },
|
|
119
119
|
(e) => (t) => {
|
|
120
120
|
e.container.register("$type", t);
|
|
121
121
|
}
|
|
122
122
|
).createCommand(
|
|
123
123
|
"settings",
|
|
124
|
-
{ stage:
|
|
124
|
+
{ stage: w.Pre, defaultArgs: [null] },
|
|
125
125
|
(e) => (t) => {
|
|
126
126
|
e.events.dispatch(
|
|
127
127
|
"settings:change",
|
|
@@ -131,51 +131,51 @@ Me((n) => {
|
|
|
131
131
|
}
|
|
132
132
|
).createCommand(
|
|
133
133
|
"plugin",
|
|
134
|
-
{ stage:
|
|
135
|
-
(e) => (t,
|
|
136
|
-
const { container:
|
|
137
|
-
let a = null,
|
|
138
|
-
typeof t == "string" && (a = t,
|
|
139
|
-
const
|
|
140
|
-
const { transformPluginSettings:
|
|
134
|
+
{ stage: w.Pre },
|
|
135
|
+
(e) => (t, s, i) => {
|
|
136
|
+
const { container: o } = e;
|
|
137
|
+
let a = null, r = t, c = s;
|
|
138
|
+
typeof t == "string" && (a = t, r = s, c = i);
|
|
139
|
+
const d = (g) => {
|
|
140
|
+
const { transformPluginSettings: m } = e.container.get("$environmentOptions"), u = m ? m(
|
|
141
141
|
c || {},
|
|
142
142
|
a,
|
|
143
143
|
e.container,
|
|
144
|
-
|
|
145
|
-
) :
|
|
144
|
+
r
|
|
145
|
+
) : s;
|
|
146
146
|
try {
|
|
147
|
-
const
|
|
147
|
+
const h = me(
|
|
148
148
|
a,
|
|
149
|
-
o,
|
|
150
149
|
r,
|
|
150
|
+
o,
|
|
151
151
|
u
|
|
152
152
|
);
|
|
153
|
-
|
|
154
|
-
} catch (
|
|
155
|
-
|
|
153
|
+
o.get("$plugins").push(h), g && h.invoke("initialize", null);
|
|
154
|
+
} catch (h) {
|
|
155
|
+
he(e).warn("Error when initializing plugin", h);
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
|
-
e.container.get("$instance") ?
|
|
158
|
+
e.container.get("$instance") ? d(!0) : e.events.subscribeOnce("widget:instance-created", () => d(!1));
|
|
159
159
|
}
|
|
160
160
|
).createCommand(
|
|
161
161
|
"container.register",
|
|
162
|
-
(e) => (t,
|
|
163
|
-
e.container.register(t,
|
|
162
|
+
(e) => (t, s) => {
|
|
163
|
+
e.container.register(t, s);
|
|
164
164
|
}
|
|
165
165
|
).createCommand(
|
|
166
166
|
"container.registerAsync",
|
|
167
|
-
(e) => (t,
|
|
168
|
-
e.container.registerAsync(t,
|
|
167
|
+
(e) => (t, s) => {
|
|
168
|
+
e.container.registerAsync(t, s);
|
|
169
169
|
}
|
|
170
170
|
).createCommand(
|
|
171
171
|
"container.registerFactory",
|
|
172
|
-
(e) => (t,
|
|
173
|
-
e.container.registerFactory(t,
|
|
172
|
+
(e) => (t, s) => {
|
|
173
|
+
e.container.registerFactory(t, s);
|
|
174
174
|
}
|
|
175
175
|
).createCommand(
|
|
176
176
|
"container.touch",
|
|
177
|
-
(e) => (t,
|
|
178
|
-
e.container.touch(t,
|
|
177
|
+
(e) => (t, s) => {
|
|
178
|
+
e.container.touch(t, s);
|
|
179
179
|
}
|
|
180
180
|
).createCommand(
|
|
181
181
|
"csp",
|
|
@@ -185,577 +185,114 @@ Me((n) => {
|
|
|
185
185
|
}
|
|
186
186
|
);
|
|
187
187
|
});
|
|
188
|
-
|
|
188
|
+
se((n) => {
|
|
189
189
|
n.createCommand(
|
|
190
190
|
"ready",
|
|
191
|
-
{ scope:
|
|
191
|
+
{ scope: R.Implementation, stage: w.Pre },
|
|
192
192
|
(e) => (t) => {
|
|
193
|
-
const { container:
|
|
194
|
-
|
|
195
|
-
t(
|
|
193
|
+
const { container: s } = e, i = s.owner;
|
|
194
|
+
s.get("bootstrapping").ready ? t(i) : i.events.subscribeOnce("bootstrap:ready", () => {
|
|
195
|
+
t(i);
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
198
|
);
|
|
199
|
-
})
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
const X = (n, e, t, ...i) => {
|
|
204
|
-
const s = `[${n.get("$environment").name || "webprovisions"}] ${t}`;
|
|
199
|
+
});
|
|
200
|
+
const U = (n, e, t, ...s) => {
|
|
201
|
+
const i = `[${n.get("$environment").name || "webprovisions"}] ${t}`;
|
|
205
202
|
switch (e) {
|
|
206
203
|
case "info":
|
|
207
|
-
console.info(
|
|
204
|
+
console.info(i, ...s);
|
|
208
205
|
break;
|
|
209
206
|
case "warning":
|
|
210
|
-
console.warn(
|
|
207
|
+
console.warn(i, ...s);
|
|
211
208
|
break;
|
|
212
209
|
case "error":
|
|
213
|
-
console.error(
|
|
210
|
+
console.error(i, ...s);
|
|
214
211
|
break;
|
|
215
212
|
}
|
|
216
|
-
},
|
|
213
|
+
}, pe = (n) => {
|
|
217
214
|
const e = n.container || n;
|
|
218
215
|
return {
|
|
219
|
-
info: (t, ...
|
|
220
|
-
warn: (t, ...
|
|
221
|
-
error: (t, ...
|
|
216
|
+
info: (t, ...s) => U(e, "info", t, ...s),
|
|
217
|
+
warn: (t, ...s) => U(e, "warning", t, ...s),
|
|
218
|
+
error: (t, ...s) => U(e, "error", t, ...s)
|
|
222
219
|
};
|
|
223
|
-
}, m = _(), re = (() => {
|
|
224
|
-
let n = 0;
|
|
225
|
-
return () => ++n;
|
|
226
|
-
})(), oe = (n, e, t) => {
|
|
227
|
-
const i = m(n).touchQueue.get(e);
|
|
228
|
-
i && i.forEach((s) => {
|
|
229
|
-
s(t, n);
|
|
230
|
-
});
|
|
231
|
-
};
|
|
232
|
-
class Je {
|
|
233
|
-
constructor(e, t, i, s) {
|
|
234
|
-
this.key = e, this.factory = t, this.parent = i, this.container = s, this.id = re(), this.resolved = !1, this.constructed = !1, this.async = !0;
|
|
235
|
-
}
|
|
236
|
-
resolve() {
|
|
237
|
-
if (!this.constructed) {
|
|
238
|
-
const e = this.factory(this.parent, this.container);
|
|
239
|
-
return this.constructed = !0, this.value = Promise.resolve(e).then((t) => (this.resolved = !0, oe(this.container, this.key, t), t));
|
|
240
|
-
}
|
|
241
|
-
return this.value;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
class Xe {
|
|
245
|
-
constructor(e, t, i, s) {
|
|
246
|
-
this.key = e, this.value = t, this.parent = i, this.container = s, this.id = re(), this.async = !1, this.resolved = !1, this.constructed = !0, this.resolve = () => (this.resolved = !0, oe(this.container, this.key, this.value), this.value);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
class et {
|
|
250
|
-
constructor(e, t, i, s) {
|
|
251
|
-
this.key = e, this.value = t, this.parent = i, this.container = s, this.id = re(), this.async = !1, this.resolved = !1, this.constructed = !1, this.resolve = () => {
|
|
252
|
-
this.resolved = !0, this.constructed = !0;
|
|
253
|
-
const r = this.value(this.parent, this.container);
|
|
254
|
-
return oe(this.container, this.key, this.value), r;
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
class ae {
|
|
259
|
-
/**
|
|
260
|
-
* Creates a new instance of `Container`.
|
|
261
|
-
* @param owner The object owning this inctance.
|
|
262
|
-
* @param name Optional name for the container.
|
|
263
|
-
* @param parent Parent container this should be a child of.
|
|
264
|
-
*/
|
|
265
|
-
constructor(e, t, i) {
|
|
266
|
-
this.owner = e, this.name = t, this.parent = i, m(this).resolvers = /* @__PURE__ */ new Map(), m(this).touchQueue = /* @__PURE__ */ new Map(), m(this).children = [];
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Deletes an existing resolver by its unique id.
|
|
270
|
-
* @param id Resolver id.
|
|
271
|
-
*/
|
|
272
|
-
delete(e) {
|
|
273
|
-
const t = m(this).resolvers, i = Array.from(t.values()).find((s) => s.id === e);
|
|
274
|
-
return i ? (m(this).touchQueue.delete(i.key), Promise.resolve(t.delete(i.key))) : this.parent ? this.parent.delete(e) : Promise.resolve(!1);
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Clears the `Container` and any child containers by deleteing all registered resolvers.
|
|
278
|
-
*/
|
|
279
|
-
clear() {
|
|
280
|
-
const e = m(this).resolvers, t = Array.from(e.values());
|
|
281
|
-
return Promise.all(t.map((i) => {
|
|
282
|
-
if (i.constructed)
|
|
283
|
-
return Promise.resolve(i.resolve()).then((s) => {
|
|
284
|
-
if (s !== null && typeof s == "object" && typeof s.dispose == "function")
|
|
285
|
-
return s.dispose.call(s, this, i);
|
|
286
|
-
});
|
|
287
|
-
})).then(() => {
|
|
288
|
-
t.forEach((i) => this.delete(i.id)), m(this).children.forEach((i) => i.clear());
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Detaches this `Container` instance from its parent, allowing it to be garbage-collected.
|
|
293
|
-
*/
|
|
294
|
-
detach() {
|
|
295
|
-
if (this.parent) {
|
|
296
|
-
const e = m(this.parent).children, t = e.indexOf(this);
|
|
297
|
-
t > -1 && (e.splice(t, 1), delete this.parent);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* Provides a way of touching a value in the `Container` without forcing it to be resolved.
|
|
302
|
-
* @param key Key of the resolved value to touch.
|
|
303
|
-
* @param handler Handler function for touching the resolved value.
|
|
304
|
-
*/
|
|
305
|
-
touch(e, t) {
|
|
306
|
-
const i = m(this).resolvers.get(e);
|
|
307
|
-
if (i && i.constructed)
|
|
308
|
-
Promise.resolve(i.resolve()).then((s) => {
|
|
309
|
-
t(s, this);
|
|
310
|
-
});
|
|
311
|
-
else {
|
|
312
|
-
const s = m(this).touchQueue;
|
|
313
|
-
let r = s.get(e);
|
|
314
|
-
r || (r = [], s.set(e, r)), r.push(t);
|
|
315
|
-
}
|
|
316
|
-
return this.parent && !i ? this.parent.touch(e, t) : Promise.resolve();
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Registers an asynchronous resolver.
|
|
320
|
-
* @param key Key of the resolver.
|
|
321
|
-
* @param factory Value factory.
|
|
322
|
-
*/
|
|
323
|
-
registerAsync(e, t) {
|
|
324
|
-
const i = m(this).resolvers.get(e);
|
|
325
|
-
i && !i.async && process.env.NODE_ENV !== "production" && v(this).warn(`Mismatching resolver type. You are registering an async resolver with a key ('${e}') previously used by a non-async resolver.`);
|
|
326
|
-
const s = new Je(e, t, i, this);
|
|
327
|
-
return m(this).resolvers.set(e, s), s.id;
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Registers a factory resolver for constructing the value to be resolved.
|
|
331
|
-
* @param key Key of the resolver.
|
|
332
|
-
* @param factory Value factory.
|
|
333
|
-
*/
|
|
334
|
-
registerFactory(e, t) {
|
|
335
|
-
const i = m(this).resolvers.get(e);
|
|
336
|
-
i && i.async && process.env.NODE_ENV !== "production" && v(this).warn(`Mismatching resolver type. You are registering a non-async resolver with a key ('${e}') previously used by an async resolver.`);
|
|
337
|
-
const s = new et(e, t, i, this);
|
|
338
|
-
return m(this).resolvers.set(e, s), s.id;
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* Registers an synchronous resolver.
|
|
342
|
-
* @param key Key of the resolver.
|
|
343
|
-
* @param value Value.
|
|
344
|
-
*/
|
|
345
|
-
register(e, t) {
|
|
346
|
-
const i = m(this).resolvers.get(e);
|
|
347
|
-
i && i.async && process.env.NODE_ENV !== "production" && v(this).warn(`Mismatching resolver type. You are registering a non-async resolver with a key ('${e}') previously used by an async resolver.`);
|
|
348
|
-
const s = new Xe(e, t, i, this);
|
|
349
|
-
return m(this).resolvers.set(e, s), s.id;
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* Gets the value for a synchronous resolver.
|
|
353
|
-
* @param key Key of resolver to get.
|
|
354
|
-
*/
|
|
355
|
-
get(e) {
|
|
356
|
-
const t = m(this).resolvers.get(e);
|
|
357
|
-
if (t)
|
|
358
|
-
return t.async && process.env.NODE_ENV !== "production" && v(this).warn(`You are retrieving an async value (with key '${e}') by the non-async function 'container.get(key)'. This will not be supported in future versions. Use 'container.getAsync(key) instead.'`), t.resolve();
|
|
359
|
-
if (this.parent)
|
|
360
|
-
return this.parent.get(e);
|
|
361
|
-
}
|
|
362
|
-
/**
|
|
363
|
-
* Gets the value for a asynchronous resolver.
|
|
364
|
-
* @param key Key of resolver to get.
|
|
365
|
-
*/
|
|
366
|
-
getAsync(e) {
|
|
367
|
-
const t = m(this).resolvers.get(e);
|
|
368
|
-
if (t) {
|
|
369
|
-
if (!t.async)
|
|
370
|
-
throw process.env.NODE_ENV !== "production" && v(this).warn(`You are retrieving a non-async value (with key '${e}') by the async function 'container.getAsync(key)'.Use 'container.get(key) instead.'`), "Mismatching resolver type";
|
|
371
|
-
return t.resolve();
|
|
372
|
-
}
|
|
373
|
-
return this.parent ? this.parent.getAsync(e) : Promise.resolve(void 0);
|
|
374
|
-
}
|
|
375
|
-
getMany(...e) {
|
|
376
|
-
const t = {};
|
|
377
|
-
return e.forEach((i) => t[i] = this.get(i)), t;
|
|
378
|
-
}
|
|
379
|
-
getManyAsync(...e) {
|
|
380
|
-
const t = {};
|
|
381
|
-
return Promise.all(e.map((i) => this.getAsync(i).then((s) => t[i] = s))).then(() => t);
|
|
382
|
-
}
|
|
383
|
-
createChild(e, t) {
|
|
384
|
-
const i = new ae(e, t, this);
|
|
385
|
-
return m(this).children.push(i), i;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
class ve {
|
|
389
|
-
/**
|
|
390
|
-
*
|
|
391
|
-
* @param type Type of event.
|
|
392
|
-
* @param target The target of the event, which will handle the default behavour.
|
|
393
|
-
* @param cancelable Whether the event is cancelable by calling preventDefault().
|
|
394
|
-
* @param bubbles Whether the event will bubble up the parent hierarchy.
|
|
395
|
-
*/
|
|
396
|
-
constructor(e, t, i = !1, s = !1) {
|
|
397
|
-
this.type = e, this.target = t, this.cancelable = !!i, this.bubbles = !!s, this.defaultPrevented = !1;
|
|
398
|
-
}
|
|
399
|
-
/**
|
|
400
|
-
* Cancels the default behaviour (if the event is cancelable).
|
|
401
|
-
*/
|
|
402
|
-
preventDefault() {
|
|
403
|
-
this.cancelable && (this.defaultPrevented = !0);
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
const $ = _(), ye = (n, e) => [].concat(
|
|
407
|
-
$(n).listenerLookup.get(e.toLowerCase()) || [],
|
|
408
|
-
$(n).listenerLookup.get("*") || []
|
|
409
|
-
), be = (n, e, t, i) => {
|
|
410
|
-
let s, r;
|
|
411
|
-
return e instanceof ve ? (s = e, r = e.type) : (s = new ve(e, n.target, !!t.cancelable, !!t.bubbles), r = e), { event: s, type: r, async: i };
|
|
412
|
-
};
|
|
413
|
-
let tt = class Re {
|
|
414
|
-
/**
|
|
415
|
-
* Creates a new Event Manager instance.
|
|
416
|
-
* @param target The target of events dispatched from this Event Manager instance.
|
|
417
|
-
* @param parent Parent Event Manager instance.
|
|
418
|
-
*/
|
|
419
|
-
constructor(e, t) {
|
|
420
|
-
this.target = e, this.parent = t, $(this).listenerLookup = /* @__PURE__ */ new Map(), $(this).children = [];
|
|
421
|
-
}
|
|
422
|
-
/**
|
|
423
|
-
* Clears registered event listeners in this `EventManager` as well as in any children.
|
|
424
|
-
*/
|
|
425
|
-
clear() {
|
|
426
|
-
$(this).listenerLookup.clear(), $(this).children.forEach((e) => e.clear());
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* Detaches this `EventManager` instance from its parent, allowing it to be garbage-collected.
|
|
430
|
-
*/
|
|
431
|
-
detach() {
|
|
432
|
-
if (this.parent) {
|
|
433
|
-
const e = $(this.parent).children, t = e.indexOf(this);
|
|
434
|
-
t > -1 && e.splice(t, 1);
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
/**
|
|
438
|
-
* Creates an event subscription by registering an listener for an event type.
|
|
439
|
-
* @param type Event type to subscribe to.
|
|
440
|
-
* @param listener Listener for the event.
|
|
441
|
-
*/
|
|
442
|
-
subscribe(e, t, i) {
|
|
443
|
-
const s = $(this).listenerLookup, r = e.toLowerCase();
|
|
444
|
-
return s.has(r) || s.set(r, []), s.get(r).push(t), () => this.unsubscribe(e, t);
|
|
445
|
-
}
|
|
446
|
-
/**
|
|
447
|
-
* Similar to `subscribe()` but immediately removes the subscription after the first call.
|
|
448
|
-
* @param type Event type to subscribe to.
|
|
449
|
-
* @param listener Listener for the event.
|
|
450
|
-
*/
|
|
451
|
-
subscribeOnce(e, t) {
|
|
452
|
-
const i = this.subscribe(e, (s, r) => (i(), t(s, r)));
|
|
453
|
-
}
|
|
454
|
-
/**
|
|
455
|
-
* Removes a listener for the specified event type.
|
|
456
|
-
* @param type Event type to remove subscription for.
|
|
457
|
-
* @param listener Event listener to remove.
|
|
458
|
-
*/
|
|
459
|
-
unsubscribe(e, t) {
|
|
460
|
-
const i = $(this).listenerLookup.get(e.toLowerCase());
|
|
461
|
-
if (i) {
|
|
462
|
-
const s = i.indexOf(t);
|
|
463
|
-
s > -1 && i.splice(s, 1);
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
/**
|
|
467
|
-
* Dispatches an asynchonous event to registered event listeners.
|
|
468
|
-
* @param eventOrType Event type or Event object to dispatch.
|
|
469
|
-
* @param data Optional data to be passed to event listeners.
|
|
470
|
-
* @param options Optional event options used if first parameter is an event type.
|
|
471
|
-
*/
|
|
472
|
-
dispatchAsync(e, t, i = {}) {
|
|
473
|
-
const { event: s, type: r } = be(this, e, i, !0), a = ye(this, r);
|
|
474
|
-
let o = 0;
|
|
475
|
-
const c = a.length;
|
|
476
|
-
let h = Promise.resolve();
|
|
477
|
-
for (o = 0; o < c; o++)
|
|
478
|
-
((d) => {
|
|
479
|
-
h = h.then((g) => g ? Promise.resolve(!0) : Promise.resolve(d(s, t)).then(() => s.defaultPrevented));
|
|
480
|
-
})(a[o]);
|
|
481
|
-
return h.then((d) => !d && s.bubbles && this.parent ? this.parent.dispatchAsync(s, t) : d);
|
|
482
|
-
}
|
|
483
|
-
/**
|
|
484
|
-
* Dispatches an event to registered event listeners.
|
|
485
|
-
* @param eventOrType Event type or Event object to dispatch.
|
|
486
|
-
* @param data Optional data to be passed to event listeners.
|
|
487
|
-
* @param options Optional event options used if first parameter is an event type.
|
|
488
|
-
*/
|
|
489
|
-
dispatch(e, t, i = {}) {
|
|
490
|
-
const { event: s, type: r } = be(this, e, i, !1), a = ye(this, r);
|
|
491
|
-
let o = 0;
|
|
492
|
-
const c = a.length;
|
|
493
|
-
let h = !1;
|
|
494
|
-
for (o = 0; o < c; o++)
|
|
495
|
-
if (a[o](s, t), s.defaultPrevented) {
|
|
496
|
-
h = !0;
|
|
497
|
-
break;
|
|
498
|
-
}
|
|
499
|
-
return !h && s.bubbles && this.parent && (h = this.parent.dispatch(s, t)), h;
|
|
500
|
-
}
|
|
501
|
-
/**
|
|
502
|
-
* Creates a child instance to the current Event manager.
|
|
503
|
-
*/
|
|
504
|
-
createChild(e) {
|
|
505
|
-
const t = new Re(e, this);
|
|
506
|
-
return $(this).children.push(t), t;
|
|
507
|
-
}
|
|
508
|
-
};
|
|
509
|
-
const U = (n, e, t) => {
|
|
510
|
-
const i = n.get("$plugins").map((s) => {
|
|
511
|
-
try {
|
|
512
|
-
return s.invoke(e, t);
|
|
513
|
-
} catch (r) {
|
|
514
|
-
v(n).error("An error occured when invoking a plugin.", s, r);
|
|
515
|
-
}
|
|
516
|
-
});
|
|
517
|
-
return Promise.all(i);
|
|
518
|
-
};
|
|
519
|
-
let nt = class {
|
|
520
|
-
constructor(e) {
|
|
521
|
-
this.widget = e.get("$widget"), this.events = this.widget.events, this.container = this.widget.container, this.initialized = null, this.activated = null, this.initialize = this.initialize.bind(this), this.activate = this.activate.bind(this), this.deactivate = this.deactivate.bind(this), this.invoke = this.invoke.bind(this), this.createInstance();
|
|
522
|
-
}
|
|
523
|
-
createInstance() {
|
|
524
|
-
if (!this.widget.container.get("$instance")) {
|
|
525
|
-
const e = this.widget.container.get("$types"), t = this.widget.container.get("$type");
|
|
526
|
-
!t && v(this).error("Unable to create widget. No type is specified.");
|
|
527
|
-
const i = e[t];
|
|
528
|
-
!i && v(this).error(`Unable to create widget. Type '${t}' is not registered.`), this.widget.events.dispatch("widget:create-instance", {}, { bubbles: !0 });
|
|
529
|
-
try {
|
|
530
|
-
this.widget.container.register(
|
|
531
|
-
"$instance",
|
|
532
|
-
new i(this.container)
|
|
533
|
-
);
|
|
534
|
-
} catch (s) {
|
|
535
|
-
v(this).error("Unable to create widget type.", s);
|
|
536
|
-
}
|
|
537
|
-
this.widget.events.dispatch("widget:instance-created", {}, { bubbles: !0 });
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
/**
|
|
541
|
-
* The initialization is performed before the widget is activated but after it's configured
|
|
542
|
-
* and thus all required services are available. This hook is a good place to bind events that
|
|
543
|
-
* should trigger activation (e.g. click on "trigger links" or routing events)
|
|
544
|
-
* @param {object} data Custom initialization data passed to the widget.
|
|
545
|
-
*/
|
|
546
|
-
initialize(e) {
|
|
547
|
-
return this.initialized = this.initialized || (() => {
|
|
548
|
-
const t = this.container.get("$instance"), i = t.initialize || (() => {
|
|
549
|
-
});
|
|
550
|
-
return this.initialized = Promise.resolve(i.call(t, e)).then(() => U(this.container, "initialize", e)).then(() => {
|
|
551
|
-
});
|
|
552
|
-
})();
|
|
553
|
-
}
|
|
554
|
-
/**
|
|
555
|
-
* The activation is where the widget is actually created and rendered.
|
|
556
|
-
* Activation can be initialized from the outside or from an event originated
|
|
557
|
-
* in the "initialize" hook.
|
|
558
|
-
* @param {object} data Custom activation data passed to the widget.
|
|
559
|
-
*/
|
|
560
|
-
activate(e) {
|
|
561
|
-
return (this.initialized || this.initialize()).then(() => {
|
|
562
|
-
this.activated = this.activated || (() => U(this.container, "activate").then(() => {
|
|
563
|
-
const t = this.container.get("$instance");
|
|
564
|
-
return this.activated = t.activate(e);
|
|
565
|
-
}))();
|
|
566
|
-
});
|
|
567
|
-
}
|
|
568
|
-
deactivate() {
|
|
569
|
-
const e = this.container.get("$instance"), t = e.deactivate || (() => {
|
|
570
|
-
});
|
|
571
|
-
return U(this.container, "deactivate").then(() => Promise.resolve(t.call(e))).then(() => {
|
|
572
|
-
this.initialized = null, this.activated = null;
|
|
573
|
-
}).then(() => {
|
|
574
|
-
});
|
|
575
|
-
}
|
|
576
|
-
/**
|
|
577
|
-
* Invokes a command on the widget component.
|
|
578
|
-
* @param command Name of command
|
|
579
|
-
* @param args Command arguments
|
|
580
|
-
*/
|
|
581
|
-
invoke(e, ...t) {
|
|
582
|
-
return U(this.container, "invoke", { command: e, args: t }).then(() => {
|
|
583
|
-
const i = this.container.get("$instance");
|
|
584
|
-
if (i[e])
|
|
585
|
-
return i[e].apply(i, t);
|
|
586
|
-
const s = i.invoke;
|
|
587
|
-
if (s)
|
|
588
|
-
return s.call(i, e, ...t);
|
|
589
|
-
});
|
|
590
|
-
}
|
|
591
220
|
};
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
return !0;
|
|
595
|
-
if (typeof e == "string") {
|
|
596
|
-
const t = e.split(",");
|
|
597
|
-
for (let i = 0, s = t.length; i < s; i++) {
|
|
598
|
-
const r = t[i].trim();
|
|
599
|
-
if (r === n || r === "*")
|
|
600
|
-
return !0;
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
return e instanceof Array ? e.indexOf(n) > -1 : !1;
|
|
604
|
-
}, it = (n, e) => {
|
|
605
|
-
if (typeof e == "function")
|
|
606
|
-
return e(n);
|
|
607
|
-
const t = typeof e == "string" ? ot(e) : e;
|
|
608
|
-
return !(!R(n.implementation.tenant || "", t.tenant || "") || !R(n.implementation.name, t.implementation || "") || !R(n.name, t.widget || "") || !R(n.container.get("$type"), t.type || ""));
|
|
609
|
-
}, st = (n, e) => {
|
|
610
|
-
if (typeof e == "function")
|
|
611
|
-
return e(n);
|
|
612
|
-
const t = typeof e == "string" ? at(e) : e;
|
|
613
|
-
return !(!R(n.tenant || "", t.tenant || "") || !R(n.name, t.implementation || ""));
|
|
614
|
-
}, _e = (n) => (e) => it(e, n), rt = (n) => (e) => st(e, n), E = (n) => n instanceof Array && n.length === 1 ? n[0] : n, ot = (n) => {
|
|
615
|
-
const e = {}, t = n.split(":");
|
|
616
|
-
return t.length === 1 ? e.widget = E(t[0].split(",")) : t.length === 2 ? (e.implementation = E(t[0].split(",")), e.widget = E(t[1].split(","))) : (e.tenant = E(t[0].split(",")), e.implementation = E(t[1].split(",")), e.widget = E(t[2].split(","))), e;
|
|
617
|
-
}, at = (n) => {
|
|
618
|
-
const e = {}, t = n.split(":");
|
|
619
|
-
return t.length === 1 ? e.implementation = E(t[0].split(",")) : (e.tenant = E(t[0].split(",")), e.implementation = E(t[1].split(","))), e;
|
|
620
|
-
}, H = _(), we = (n, e, t) => n.filter((i) => i.stage === e && _e(i.selector)(t));
|
|
621
|
-
function ct(n) {
|
|
622
|
-
const e = n.container.get("$environment");
|
|
623
|
-
let t = H(e).configurationCache;
|
|
624
|
-
t && (t = t.filter((i) => i[0] !== n), H(e).configurationCache = t);
|
|
625
|
-
}
|
|
626
|
-
var V = /* @__PURE__ */ ((n) => (n.Implementation = "implementation", n.Widget = "widget", n))(V || {}), A = /* @__PURE__ */ ((n) => (n.Pre = "pre", n.Post = "post", n))(A || {});
|
|
627
|
-
const Se = (n, e, t) => (Object.keys(e).forEach((i) => {
|
|
628
|
-
const s = e[i];
|
|
629
|
-
if (typeof s == "function") {
|
|
630
|
-
const r = s();
|
|
631
|
-
typeof r.defaultArgs != "undefined" && t(r, ...r.defaultArgs), n[i] = (...a) => {
|
|
632
|
-
const o = Object.assign(
|
|
633
|
-
{},
|
|
634
|
-
r,
|
|
635
|
-
{ handlerResolver: r.handlerResolver.bind({}) }
|
|
636
|
-
);
|
|
637
|
-
return t(o, ...a), n;
|
|
638
|
-
};
|
|
639
|
-
} else
|
|
640
|
-
n[i] = Se(
|
|
641
|
-
{},
|
|
642
|
-
s,
|
|
643
|
-
t
|
|
644
|
-
);
|
|
645
|
-
}), n), ht = (n, e) => {
|
|
646
|
-
switch (e) {
|
|
647
|
-
case "implementation":
|
|
648
|
-
return n.implementation;
|
|
649
|
-
case "widget":
|
|
650
|
-
return n;
|
|
651
|
-
}
|
|
652
|
-
}, ke = (n, e, t, i) => (i.forEach((s) => {
|
|
653
|
-
Se(
|
|
654
|
-
n,
|
|
655
|
-
s,
|
|
656
|
-
(r, ...a) => {
|
|
657
|
-
const o = {
|
|
658
|
-
selector: e,
|
|
659
|
-
stage: r.stage,
|
|
660
|
-
handler: (c) => {
|
|
661
|
-
const h = ht(c, r.scope), d = { container: h.container, events: h.events }, g = r.handlerResolver, u = g(d);
|
|
662
|
-
let p = H(t.environment).configurationCache;
|
|
663
|
-
return p || (p = H(t.environment).configurationCache = []), p.find((b) => b.indexOf(h) > -1 && b.indexOf(g) > -1) ? Promise.resolve() : (p.push([h, g]), Promise.resolve(u(...a)));
|
|
664
|
-
}
|
|
665
|
-
};
|
|
666
|
-
t.instructions.push(o);
|
|
667
|
-
}
|
|
668
|
-
);
|
|
669
|
-
}), n);
|
|
670
|
-
function lt(n, e) {
|
|
671
|
-
function t(i) {
|
|
672
|
-
return ke(
|
|
673
|
-
{},
|
|
674
|
-
i,
|
|
675
|
-
n,
|
|
676
|
-
e
|
|
677
|
-
);
|
|
678
|
-
}
|
|
679
|
-
return ke(
|
|
680
|
-
t,
|
|
681
|
-
"*",
|
|
682
|
-
n,
|
|
683
|
-
e
|
|
684
|
-
);
|
|
685
|
-
}
|
|
686
|
-
const dt = (n, e, t, i) => {
|
|
221
|
+
var T = /* @__PURE__ */ ((n) => (n.Implementation = "implementation", n.Widget = "widget", n))(T || {}), N = /* @__PURE__ */ ((n) => (n.Pre = "pre", n.Post = "post", n))(N || {});
|
|
222
|
+
const ye = (n, e, t, s) => {
|
|
687
223
|
try {
|
|
688
|
-
const
|
|
224
|
+
const i = new e(t, s);
|
|
689
225
|
return {
|
|
690
226
|
name: n,
|
|
691
|
-
invoke: (
|
|
692
|
-
let
|
|
693
|
-
return
|
|
227
|
+
invoke: (o, a) => {
|
|
228
|
+
let r;
|
|
229
|
+
return i[o] && (r = i[o].call(i, a)), Promise.resolve(r);
|
|
694
230
|
},
|
|
695
|
-
getInstance: () =>
|
|
231
|
+
getInstance: () => i
|
|
696
232
|
};
|
|
697
|
-
} catch (
|
|
698
|
-
if (
|
|
233
|
+
} catch (i) {
|
|
234
|
+
if (i.message && i.message.indexOf("is not a constructor") >= 0)
|
|
699
235
|
return {
|
|
700
236
|
name: n,
|
|
701
|
-
invoke: (
|
|
237
|
+
invoke: (o) => {
|
|
702
238
|
let a;
|
|
703
|
-
return
|
|
239
|
+
return o === "initialize" && (a = e(t, s)), Promise.resolve(a);
|
|
704
240
|
},
|
|
705
241
|
getInstance: () => e
|
|
706
242
|
};
|
|
707
|
-
throw
|
|
243
|
+
throw i;
|
|
708
244
|
}
|
|
709
245
|
};
|
|
710
|
-
function
|
|
246
|
+
function ee(n, e) {
|
|
711
247
|
return typeof n == "undefined" ? e : n;
|
|
712
248
|
}
|
|
713
|
-
|
|
249
|
+
class ve {
|
|
714
250
|
constructor(e = {}) {
|
|
715
251
|
this.part = e;
|
|
716
252
|
}
|
|
717
|
-
createCommand(e, t,
|
|
718
|
-
let
|
|
719
|
-
typeof t == "function" ?
|
|
720
|
-
scope:
|
|
721
|
-
stage:
|
|
253
|
+
createCommand(e, t, s) {
|
|
254
|
+
let i;
|
|
255
|
+
typeof t == "function" ? i = {
|
|
256
|
+
scope: T.Widget,
|
|
257
|
+
stage: N.Post,
|
|
722
258
|
defaultArgs: void 0,
|
|
723
259
|
handlerResolver: t
|
|
724
|
-
} :
|
|
725
|
-
scope:
|
|
726
|
-
stage:
|
|
260
|
+
} : i = {
|
|
261
|
+
scope: ee(t.scope, T.Widget),
|
|
262
|
+
stage: ee(t.stage, N.Post),
|
|
727
263
|
defaultArgs: t.defaultArgs,
|
|
728
|
-
handlerResolver:
|
|
264
|
+
handlerResolver: s
|
|
729
265
|
};
|
|
730
|
-
let
|
|
266
|
+
let o = this.part;
|
|
731
267
|
const a = e.split(".");
|
|
732
|
-
return a.forEach((
|
|
733
|
-
c === a.length - 1 ? r
|
|
268
|
+
return a.forEach((r, c) => {
|
|
269
|
+
c === a.length - 1 ? o[r] || (o[r] = () => i) : o = this.part[r] = this.part[r] || {};
|
|
734
270
|
}), this;
|
|
735
271
|
}
|
|
736
272
|
get() {
|
|
737
273
|
return this.part;
|
|
738
274
|
}
|
|
739
|
-
}
|
|
740
|
-
const
|
|
741
|
-
const e = new
|
|
275
|
+
}
|
|
276
|
+
const ie = (n) => {
|
|
277
|
+
const e = new ve({});
|
|
742
278
|
return n(e), e.get();
|
|
743
|
-
}
|
|
279
|
+
};
|
|
280
|
+
ie((n) => {
|
|
744
281
|
n.createCommand(
|
|
745
282
|
"types.register",
|
|
746
|
-
{ scope:
|
|
747
|
-
(e) => (t,
|
|
748
|
-
e.container.get("$types")[t] =
|
|
283
|
+
{ scope: T.Implementation, stage: N.Pre },
|
|
284
|
+
(e) => (t, s) => {
|
|
285
|
+
e.container.get("$types")[t] = s;
|
|
749
286
|
}
|
|
750
287
|
).createCommand(
|
|
751
288
|
"type",
|
|
752
|
-
{ stage:
|
|
289
|
+
{ stage: N.Pre },
|
|
753
290
|
(e) => (t) => {
|
|
754
291
|
e.container.register("$type", t);
|
|
755
292
|
}
|
|
756
293
|
).createCommand(
|
|
757
294
|
"settings",
|
|
758
|
-
{ stage:
|
|
295
|
+
{ stage: N.Pre, defaultArgs: [null] },
|
|
759
296
|
(e) => (t) => {
|
|
760
297
|
e.events.dispatch(
|
|
761
298
|
"settings:change",
|
|
@@ -765,51 +302,51 @@ const Le = (n) => {
|
|
|
765
302
|
}
|
|
766
303
|
).createCommand(
|
|
767
304
|
"plugin",
|
|
768
|
-
{ stage:
|
|
769
|
-
(e) => (t,
|
|
770
|
-
const { container:
|
|
771
|
-
let a = null,
|
|
772
|
-
typeof t == "string" && (a = t,
|
|
773
|
-
const
|
|
774
|
-
const { transformPluginSettings:
|
|
305
|
+
{ stage: N.Pre },
|
|
306
|
+
(e) => (t, s, i) => {
|
|
307
|
+
const { container: o } = e;
|
|
308
|
+
let a = null, r = t, c = s;
|
|
309
|
+
typeof t == "string" && (a = t, r = s, c = i);
|
|
310
|
+
const d = (g) => {
|
|
311
|
+
const { transformPluginSettings: m } = e.container.get("$environmentOptions"), u = m ? m(
|
|
775
312
|
c || {},
|
|
776
313
|
a,
|
|
777
314
|
e.container,
|
|
778
|
-
|
|
779
|
-
) :
|
|
315
|
+
r
|
|
316
|
+
) : s;
|
|
780
317
|
try {
|
|
781
|
-
const
|
|
318
|
+
const h = ye(
|
|
782
319
|
a,
|
|
783
|
-
o,
|
|
784
320
|
r,
|
|
321
|
+
o,
|
|
785
322
|
u
|
|
786
323
|
);
|
|
787
|
-
|
|
788
|
-
} catch (
|
|
789
|
-
|
|
324
|
+
o.get("$plugins").push(h), g && h.invoke("initialize", null);
|
|
325
|
+
} catch (h) {
|
|
326
|
+
pe(e).warn("Error when initializing plugin", h);
|
|
790
327
|
}
|
|
791
328
|
};
|
|
792
|
-
e.container.get("$instance") ?
|
|
329
|
+
e.container.get("$instance") ? d(!0) : e.events.subscribeOnce("widget:instance-created", () => d(!1));
|
|
793
330
|
}
|
|
794
331
|
).createCommand(
|
|
795
332
|
"container.register",
|
|
796
|
-
(e) => (t,
|
|
797
|
-
e.container.register(t,
|
|
333
|
+
(e) => (t, s) => {
|
|
334
|
+
e.container.register(t, s);
|
|
798
335
|
}
|
|
799
336
|
).createCommand(
|
|
800
337
|
"container.registerAsync",
|
|
801
|
-
(e) => (t,
|
|
802
|
-
e.container.registerAsync(t,
|
|
338
|
+
(e) => (t, s) => {
|
|
339
|
+
e.container.registerAsync(t, s);
|
|
803
340
|
}
|
|
804
341
|
).createCommand(
|
|
805
342
|
"container.registerFactory",
|
|
806
|
-
(e) => (t,
|
|
807
|
-
e.container.registerFactory(t,
|
|
343
|
+
(e) => (t, s) => {
|
|
344
|
+
e.container.registerFactory(t, s);
|
|
808
345
|
}
|
|
809
346
|
).createCommand(
|
|
810
347
|
"container.touch",
|
|
811
|
-
(e) => (t,
|
|
812
|
-
e.container.touch(t,
|
|
348
|
+
(e) => (t, s) => {
|
|
349
|
+
e.container.touch(t, s);
|
|
813
350
|
}
|
|
814
351
|
).createCommand(
|
|
815
352
|
"csp",
|
|
@@ -818,527 +355,199 @@ const Le = (n) => {
|
|
|
818
355
|
e.container.register("csp", t);
|
|
819
356
|
}
|
|
820
357
|
);
|
|
821
|
-
})
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
e
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
class ft {
|
|
830
|
-
constructor() {
|
|
831
|
-
this.tasks = [], this.current = Promise.resolve(), this.next = this.next.bind(this);
|
|
832
|
-
}
|
|
833
|
-
add(e, t, i, s) {
|
|
834
|
-
this.tasks.push({ task: e, resolve: t, reject: i, done: s }), this.next();
|
|
835
|
-
}
|
|
836
|
-
next() {
|
|
837
|
-
this.current = this.current.then(() => {
|
|
838
|
-
const e = this.tasks.shift();
|
|
839
|
-
if (e) {
|
|
840
|
-
const t = Promise.resolve(e.task());
|
|
841
|
-
return Promise.resolve(t).then(this.next).then(() => t.then((i) => {
|
|
842
|
-
e.done(), e.resolve(i);
|
|
843
|
-
})).catch((i) => (e.done(), e.reject(i), this.next()));
|
|
844
|
-
}
|
|
845
|
-
return Promise.resolve();
|
|
846
|
-
});
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
const B = /* @__PURE__ */ new WeakMap();
|
|
850
|
-
function vt(n) {
|
|
851
|
-
return B.has(n) || B.set(n, new ft()), (e) => new Promise((t, i) => {
|
|
852
|
-
const s = B.get(n);
|
|
853
|
-
s.add(e, t, i, () => {
|
|
854
|
-
s.tasks.length || B.delete(n);
|
|
855
|
-
});
|
|
856
|
-
});
|
|
857
|
-
}
|
|
858
|
-
const $e = (n) => typeof n != "undefined", L = (n, e) => {
|
|
859
|
-
n.events.dispatch("widget:state-change", { state: e }, { bubbles: !0 }), n.state = e, n.events.dispatch("widget:state-changed", {}, { bubbles: !0 });
|
|
860
|
-
}, y = _(), yt = (n) => {
|
|
861
|
-
const { container: e, events: t } = n;
|
|
862
|
-
e.get("$controller") || (e.register("$controller", new nt(e)), t.dispatch("widget:controller-created", {}, { bubbles: !0 }));
|
|
863
|
-
};
|
|
864
|
-
let bt = class {
|
|
865
|
-
/**
|
|
866
|
-
* Creates a new `Widget` instance.
|
|
867
|
-
* @param name Name of widget.
|
|
868
|
-
* @param implementation The implementation this instance belongs to.
|
|
869
|
-
* @param configuration Configuration for the widget.
|
|
870
|
-
*/
|
|
871
|
-
constructor(e, t, i) {
|
|
872
|
-
this.state = "deactivated", this.name = e, this.implementation = t, this.container = t.container.createChild(this, e), this.events = t.events.createChild(this), y(this).subscriptions = [], i && t.configure((s) => {
|
|
873
|
-
const r = s(e);
|
|
874
|
-
$e(i.type) && r.type(i.type), $e(i.settings) && r.settings(i.settings), i.plugins && Object.keys(i.plugins).forEach((a) => {
|
|
875
|
-
var o;
|
|
876
|
-
const c = (o = i.plugins) == null ? void 0 : o[a];
|
|
877
|
-
r.plugin(a, c);
|
|
878
|
-
});
|
|
879
|
-
}), this.load = this.load.bind(this), this.activate = this.activate.bind(this), this.invoke = this.invoke.bind(this), this.deactivate = this.deactivate.bind(this);
|
|
880
|
-
}
|
|
881
|
-
/**
|
|
882
|
-
* Initializes the widget, if not already initialized, and applies any
|
|
883
|
-
* pending configuration.
|
|
884
|
-
*/
|
|
885
|
-
load() {
|
|
886
|
-
return vt(this)(() => {
|
|
887
|
-
y(this).deactivatedPromise = null;
|
|
888
|
-
const e = this.state === "deactivated";
|
|
889
|
-
e && (L(
|
|
890
|
-
this,
|
|
891
|
-
"activating"
|
|
892
|
-
/* Activating */
|
|
893
|
-
), this.container.register("$widget", this), this.container.register("$controller", null), this.container.register("$plugins", []), this.container.register("$type", null), this.container.register("$instance", null)), L(
|
|
894
|
-
this,
|
|
895
|
-
"loading"
|
|
896
|
-
/* Loading */
|
|
897
|
-
);
|
|
898
|
-
const t = this.implementation.instructions, i = we(t, A.Pre, this);
|
|
899
|
-
return Promise.all(i.map((s) => s.handler(this))).then(() => {
|
|
900
|
-
yt(this);
|
|
901
|
-
const s = we(t, A.Post, this);
|
|
902
|
-
return Promise.all(s.map((r) => r.handler(this))).then(() => {
|
|
903
|
-
e && this.container.get("$controller").initialize();
|
|
358
|
+
});
|
|
359
|
+
ie((n) => {
|
|
360
|
+
n.createCommand("components", (e) => (t) => {
|
|
361
|
+
e.events.subscribeOnce(
|
|
362
|
+
"components:platform-created",
|
|
363
|
+
(s, { platform: i }) => {
|
|
364
|
+
t.handlers && t.handlers.forEach(([o, a]) => {
|
|
365
|
+
i.addComponentHandler(o, a);
|
|
904
366
|
});
|
|
905
|
-
}).then(() => (L(
|
|
906
|
-
this,
|
|
907
|
-
"activated"
|
|
908
|
-
/* Activated */
|
|
909
|
-
), this));
|
|
910
|
-
});
|
|
911
|
-
}
|
|
912
|
-
/**
|
|
913
|
-
* Activates the widget and makes it ready for receiving commands.
|
|
914
|
-
* @param data Activation data
|
|
915
|
-
*/
|
|
916
|
-
activate(e) {
|
|
917
|
-
y(this).subscriptions.push(
|
|
918
|
-
this.implementation.events.subscribe("implementation:configured", () => {
|
|
919
|
-
[
|
|
920
|
-
"activated",
|
|
921
|
-
"activating",
|
|
922
|
-
"loading"
|
|
923
|
-
/* Loading */
|
|
924
|
-
].indexOf(this.state) > -1 && this.load();
|
|
925
|
-
})
|
|
926
|
-
);
|
|
927
|
-
const t = y(this).activatedPromise;
|
|
928
|
-
return t ? (process.env.NODE_ENV !== "production" && v(this).warn(`Widget '${this.name}' has already been activated. The passed arguments for this activation will be discarded.`, e), t) : y(this).activatedPromise = this.load().then(() => this.container.get("$controller").activate(e));
|
|
929
|
-
}
|
|
930
|
-
/**
|
|
931
|
-
* Invokes a command on a widget. If the widget isn't activate the invocation
|
|
932
|
-
* will be suspended until activation.
|
|
933
|
-
* @param command Command to invoke.
|
|
934
|
-
* @param args Command arguments.
|
|
935
|
-
*/
|
|
936
|
-
invoke(e, ...t) {
|
|
937
|
-
const i = y(this).activatedPromise, s = (r, ...a) => i.then(this.load).then(() => this.container.get("$controller").invoke(r, ...a));
|
|
938
|
-
return i ? s(e, ...t) : (process.env.NODE_ENV !== "production" && v(this).warn("You are invoking a command on a deactivated widget. The invocation will be queued until the widget is activated.", this), new Promise((r) => {
|
|
939
|
-
const a = this.events.subscribe("widget:state-changed", () => {
|
|
940
|
-
this.state === "activated" && (a(), r(s(e, ...t)));
|
|
941
|
-
});
|
|
942
|
-
}));
|
|
943
|
-
}
|
|
944
|
-
/**
|
|
945
|
-
* Deactivates the widget by clearing the `Container` and removing any event subscriptions in the
|
|
946
|
-
* `EventManager`.
|
|
947
|
-
*/
|
|
948
|
-
deactivate() {
|
|
949
|
-
return y(this).deactivatedPromise || (this.state === "deactivated" ? Promise.resolve() : (L(
|
|
950
|
-
this,
|
|
951
|
-
"deactivating"
|
|
952
|
-
/* Deactivating */
|
|
953
|
-
), y(this).deactivatedPromise = this.container.get("$controller").deactivate().then(() => (y(this).activatedPromise = null, y(this).subscriptions.forEach((t) => t()), y(this).subscriptions = [], this.container.clear().then(() => {
|
|
954
|
-
this.events.clear(), ct(this), L(
|
|
955
|
-
this,
|
|
956
|
-
"deactivated"
|
|
957
|
-
/* Deactivated */
|
|
958
|
-
);
|
|
959
|
-
})))));
|
|
960
|
-
}
|
|
961
|
-
};
|
|
962
|
-
const Pe = _();
|
|
963
|
-
class wt {
|
|
964
|
-
/**
|
|
965
|
-
* Creates a new Implementation instance.
|
|
966
|
-
* @param configuration Configuration for the implementation.
|
|
967
|
-
* @param environment The parent environment.
|
|
968
|
-
* @param configurationApiExtensions Optional configuration API extensions.
|
|
969
|
-
*/
|
|
970
|
-
constructor(e, t, i = []) {
|
|
971
|
-
this.instructions = [], this.widgets = /* @__PURE__ */ new Map(), this.name = e.name, this.tenant = e.tenant, this.environment = t, this.container = t.container.createChild(this, this.name), this.events = t.events.createChild(this), this.container.register("$types", {}), Pe(this).configurationApiExtensions = i;
|
|
972
|
-
}
|
|
973
|
-
/**
|
|
974
|
-
* Loads all widgets in the implementation.
|
|
975
|
-
*/
|
|
976
|
-
load() {
|
|
977
|
-
const e = Array.from(this.widgets.values());
|
|
978
|
-
return Promise.all(e.map((t) => t.load())).then(() => e);
|
|
979
|
-
}
|
|
980
|
-
/**
|
|
981
|
-
* Configures the implementation by adding a configuration callback.
|
|
982
|
-
* @param configFn Callback function for configuration.
|
|
983
|
-
*/
|
|
984
|
-
configure(e) {
|
|
985
|
-
return mt(e, this, Pe(this).configurationApiExtensions), this.events.dispatch(
|
|
986
|
-
"implementation:configured",
|
|
987
|
-
{ implementation: this },
|
|
988
|
-
{ bubbles: !0 }
|
|
989
|
-
), this;
|
|
990
|
-
}
|
|
991
|
-
/**
|
|
992
|
-
* Creates a widget on the implementation and returns its `WidgetData`.
|
|
993
|
-
* @param name Widget name.
|
|
994
|
-
* @param configuration Widget configuration.
|
|
995
|
-
*/
|
|
996
|
-
createWidget(e, t) {
|
|
997
|
-
const i = new bt(e, this, t);
|
|
998
|
-
return this.widgets.set(i.name, i), i;
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
function kt(n, e, t) {
|
|
1002
|
-
const i = new wt(n, e, t);
|
|
1003
|
-
return n.widgets && Object.keys(n.widgets).forEach((s) => {
|
|
1004
|
-
var r;
|
|
1005
|
-
const a = (r = n.widgets) == null ? void 0 : r[s];
|
|
1006
|
-
i.createWidget(s, a);
|
|
1007
|
-
}), i;
|
|
1008
|
-
}
|
|
1009
|
-
let Ee = class je {
|
|
1010
|
-
constructor(e, t) {
|
|
1011
|
-
this.selectorFactory = t, typeof e == "function" ? this.resolver = e : this.resolver = () => e;
|
|
1012
|
-
}
|
|
1013
|
-
append(e) {
|
|
1014
|
-
const t = typeof e == "function" ? e : () => e;
|
|
1015
|
-
return new je(
|
|
1016
|
-
() => this.all().concat(t()),
|
|
1017
|
-
this.selectorFactory
|
|
1018
|
-
);
|
|
1019
|
-
}
|
|
1020
|
-
all() {
|
|
1021
|
-
return this.resolver().concat([]);
|
|
1022
|
-
}
|
|
1023
|
-
query(e) {
|
|
1024
|
-
return this.all().filter(this.selectorFactory(e));
|
|
1025
|
-
}
|
|
1026
|
-
find(e) {
|
|
1027
|
-
const t = this.query(e);
|
|
1028
|
-
if (t.length)
|
|
1029
|
-
return t[0];
|
|
1030
|
-
}
|
|
1031
|
-
};
|
|
1032
|
-
const ce = "#____version____#", ee = _(), Ct = (n) => n.tenant ? `${n.name}:${n.tenant}` : n.name, qe = class {
|
|
1033
|
-
constructor(e, t = [], i = {}) {
|
|
1034
|
-
this.widgets = new Ee(
|
|
1035
|
-
() => {
|
|
1036
|
-
let s = [];
|
|
1037
|
-
return this.implementations.all().forEach((r) => {
|
|
1038
|
-
s = s.concat(Array.from(r.widgets.values()));
|
|
1039
|
-
}), s;
|
|
1040
|
-
},
|
|
1041
|
-
_e
|
|
1042
|
-
), this.implementations = new Ee([], rt), this.name = e, this.container = new ae(this, e), this.events = new tt(this), this.container.register("$version", ce), this.container.register("$environment", this), this.container.register("$environmentOptions", i), ee(this).configurationApiExtensions = t;
|
|
1043
|
-
}
|
|
1044
|
-
/**
|
|
1045
|
-
* Creates an implementation based on the provided configuration.
|
|
1046
|
-
* @param config Implementation configuration.
|
|
1047
|
-
*/
|
|
1048
|
-
createImplementation(e) {
|
|
1049
|
-
const t = Ct(e);
|
|
1050
|
-
let i = this.implementations.find(t);
|
|
1051
|
-
if (i)
|
|
1052
|
-
return process.env.NODE_ENV !== "production" && v(i).warn(`Implementation "${t}" already exist on current environment.`), i;
|
|
1053
|
-
const s = ee(this).configurationApiExtensions;
|
|
1054
|
-
return i = kt(
|
|
1055
|
-
e,
|
|
1056
|
-
this,
|
|
1057
|
-
s
|
|
1058
|
-
), this.implementations = this.implementations.append([i]), this.events.dispatch("implementation:created", { implementation: i }), i;
|
|
1059
|
-
}
|
|
1060
|
-
/**
|
|
1061
|
-
* Patches the Environment instance configuration.
|
|
1062
|
-
* @param configuration Environment configuration.
|
|
1063
|
-
*/
|
|
1064
|
-
patch(e = {}) {
|
|
1065
|
-
const { name: t, configurationApiExtensions: i } = e;
|
|
1066
|
-
typeof t != "undefined" && t !== null && (this.name = t), i && i.forEach(
|
|
1067
|
-
(s) => {
|
|
1068
|
-
ee(this).configurationApiExtensions.push(s);
|
|
1069
367
|
}
|
|
1070
368
|
);
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
*/
|
|
1076
|
-
static create(e = {}) {
|
|
1077
|
-
return new qe(
|
|
1078
|
-
e.name || "",
|
|
1079
|
-
e.configurationApiExtensions,
|
|
1080
|
-
e.options
|
|
1081
|
-
);
|
|
1082
|
-
}
|
|
1083
|
-
};
|
|
1084
|
-
let De = qe;
|
|
1085
|
-
De.version = ce;
|
|
1086
|
-
const Y = (n, e, ...t) => typeof e == "string" ? n(`[humany] ${e}`, ...t) : n(e, ...t), j = class {
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
var L = /* @__PURE__ */ ((n) => (n.open = "open", n.closed = "closed", n.hidden = "hidden", n))(L || {});
|
|
372
|
+
const j = (n, e, ...t) => typeof e == "string" ? n(`[humany] ${e}`, ...t) : n(e, ...t), M = class {
|
|
1087
373
|
constructor() {
|
|
1088
|
-
this.keys = [], this.log = (
|
|
374
|
+
this.keys = [], this.log = (n, ...e) => this.lookup(n, () => M.log(...e)), this.warn = (n, ...e) => this.lookup(n, () => M.warn(...e)), this.error = (n, ...e) => this.lookup(n, () => M.error(...e)), this.info = (n, ...e) => this.lookup(n, () => M.info(...e));
|
|
1089
375
|
}
|
|
1090
|
-
lookup(
|
|
1091
|
-
this.keys.indexOf(
|
|
376
|
+
lookup(n, e) {
|
|
377
|
+
this.keys.indexOf(n) === -1 && (this.keys.push(n), e());
|
|
1092
378
|
}
|
|
1093
379
|
};
|
|
1094
|
-
let
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
const
|
|
1100
|
-
let e = {}, t,
|
|
380
|
+
let S = M;
|
|
381
|
+
S.log = (...n) => j(console.log, ...n);
|
|
382
|
+
S.warn = (...n) => j(console.warn, ...n);
|
|
383
|
+
S.error = (...n) => j(console.error, ...n);
|
|
384
|
+
S.info = (...n) => j(console.info, ...n);
|
|
385
|
+
const oe = (n) => {
|
|
386
|
+
let e = {}, t, s;
|
|
1101
387
|
if (typeof n != "object" || n === null)
|
|
1102
388
|
return n;
|
|
1103
389
|
e = Array.isArray(n) ? [] : {};
|
|
1104
|
-
for (
|
|
1105
|
-
t = n[
|
|
390
|
+
for (s in n)
|
|
391
|
+
t = n[s], e[s] = typeof t == "object" && t !== null ? oe(t) : t;
|
|
1106
392
|
return e;
|
|
1107
|
-
},
|
|
1108
|
-
class
|
|
393
|
+
}, Ce = oe;
|
|
394
|
+
class be {
|
|
1109
395
|
constructor(e, t) {
|
|
1110
396
|
this.lockWarningTime = e, this.lockErrorTime = t, this.tasks = [], this.current = Promise.resolve(), this.next = this.next.bind(this);
|
|
1111
397
|
}
|
|
1112
|
-
add(e, t,
|
|
1113
|
-
this.tasks.push({ task: e, resolve: t, reject:
|
|
398
|
+
add(e, t, s, i) {
|
|
399
|
+
this.tasks.push({ task: e, resolve: t, reject: s, done: i }), this.next();
|
|
1114
400
|
}
|
|
1115
401
|
next() {
|
|
1116
402
|
this.current = this.current.then(() => {
|
|
1117
403
|
const e = this.tasks.shift();
|
|
1118
404
|
if (e) {
|
|
1119
405
|
let t;
|
|
1120
|
-
const
|
|
1121
|
-
process.env.NODE_ENV !== "production" &&
|
|
406
|
+
const s = setTimeout(() => {
|
|
407
|
+
process.env.NODE_ENV !== "production" && S.warn(
|
|
1122
408
|
`A lock has exceeded ${this.lockWarningTime} ms. Waiting additional ${this.lockErrorTime} ms before rejecting the task.`,
|
|
1123
409
|
e
|
|
1124
410
|
), t = setTimeout(() => {
|
|
1125
411
|
e.reject("lock timeout exceeded");
|
|
1126
412
|
}, this.lockErrorTime);
|
|
1127
|
-
}, this.lockWarningTime),
|
|
1128
|
-
return Promise.resolve(
|
|
1129
|
-
() =>
|
|
1130
|
-
e.done(), e.resolve(
|
|
413
|
+
}, this.lockWarningTime), i = Promise.resolve(e.task()).then((o) => (clearTimeout(s), clearTimeout(t), o));
|
|
414
|
+
return Promise.resolve(i).then(this.next).then(
|
|
415
|
+
() => i.then((o) => {
|
|
416
|
+
e.done(), e.resolve(o);
|
|
1131
417
|
})
|
|
1132
|
-
).catch((
|
|
418
|
+
).catch((o) => (e.done(), e.reject(o), this.next()));
|
|
1133
419
|
}
|
|
1134
420
|
return Promise.resolve();
|
|
1135
421
|
});
|
|
1136
422
|
}
|
|
1137
423
|
}
|
|
1138
|
-
const
|
|
1139
|
-
function
|
|
1140
|
-
return
|
|
1141
|
-
const a =
|
|
1142
|
-
a.add(
|
|
1143
|
-
a.tasks.length ||
|
|
424
|
+
const q = /* @__PURE__ */ new WeakMap();
|
|
425
|
+
function we(n, e = 5e3, t = 1e3) {
|
|
426
|
+
return q.has(n) || q.set(n, new be(e, t)), (s) => new Promise((i, o) => {
|
|
427
|
+
const a = q.get(n);
|
|
428
|
+
a.add(s, i, o, () => {
|
|
429
|
+
a.tasks.length || q.delete(n);
|
|
1144
430
|
});
|
|
1145
431
|
});
|
|
1146
432
|
}
|
|
1147
|
-
const
|
|
433
|
+
const ke = (n = {}) => (Object.keys(n).forEach((e) => {
|
|
1148
434
|
(n[e] === null || typeof n[e] == "undefined") && delete n[e];
|
|
1149
|
-
}), n),
|
|
435
|
+
}), n), Ne = ke, G = (n, e) => {
|
|
1150
436
|
let t = !0;
|
|
1151
|
-
return Object.keys(n).length !== Object.keys(e).length || Object.keys(n).some((
|
|
437
|
+
return Object.keys(n).length !== Object.keys(e).length || Object.keys(n).some((s) => !Object.keys(e).some((i) => s === i)) ? !1 : (Object.keys(n).forEach((s) => {
|
|
1152
438
|
if (t) {
|
|
1153
|
-
const
|
|
1154
|
-
t =
|
|
439
|
+
const i = typeof n[s] == "undefined" ? "" : n[s], o = typeof e[s] == "undefined" ? "" : e[s];
|
|
440
|
+
t = i.toString() === o.toString();
|
|
1155
441
|
}
|
|
1156
442
|
}), t);
|
|
1157
|
-
}
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
for (var t of Ae(e))
|
|
1163
|
-
It.call(e, t) && Ne(n, t, e[t]);
|
|
1164
|
-
return n;
|
|
1165
|
-
};
|
|
1166
|
-
Le((n) => {
|
|
1167
|
-
n.createCommand("components", (e) => (t) => {
|
|
1168
|
-
e.events.subscribeOnce("components:platform-created", (i, { platform: s }) => {
|
|
1169
|
-
t.handlers && t.handlers.forEach(([r, a]) => {
|
|
1170
|
-
s.addComponentHandler(r, a);
|
|
1171
|
-
});
|
|
1172
|
-
});
|
|
1173
|
-
});
|
|
1174
|
-
});
|
|
1175
|
-
const Mt = "#____version____#", Te = class extends De {
|
|
1176
|
-
constructor(n, e = []) {
|
|
1177
|
-
super(n, e, {
|
|
1178
|
-
transformPluginSettings: (t, i, s) => {
|
|
1179
|
-
const r = s.get("$settings"), a = r.plugins && i ? r.plugins[i] || {} : {};
|
|
1180
|
-
return xe(xe({}, a), t);
|
|
1181
|
-
}
|
|
1182
|
-
});
|
|
1183
|
-
}
|
|
1184
|
-
createImplementation(n) {
|
|
1185
|
-
const e = super.createImplementation(n);
|
|
1186
|
-
return e.bindings = n.bindings, e;
|
|
1187
|
-
}
|
|
1188
|
-
/**
|
|
1189
|
-
* Performs navigation for widgets matching the specified selector by invoking a
|
|
1190
|
-
* 'navigate' command.
|
|
1191
|
-
* @param selector Widget selector matching the widget(s) to perform navigation on.
|
|
1192
|
-
* @param route Route name.
|
|
1193
|
-
* @param params Route params.
|
|
1194
|
-
*/
|
|
1195
|
-
navigate(n, e, t) {
|
|
1196
|
-
this.widgets.query(n).forEach((i) => i.invoke("navigate", { route: e, params: t }));
|
|
1197
|
-
}
|
|
1198
|
-
/**
|
|
1199
|
-
* Creates a runtime based on provided configuration.
|
|
1200
|
-
* @param configuration Runtime configuration.
|
|
1201
|
-
*/
|
|
1202
|
-
static create(n = {}) {
|
|
1203
|
-
const e = [Ze].concat(
|
|
1204
|
-
n.configurationApiExtensions || []
|
|
1205
|
-
);
|
|
1206
|
-
return new Te("humany", e);
|
|
1207
|
-
}
|
|
1208
|
-
/**
|
|
1209
|
-
* Creates a widget runtime based on provided configuration and retains configuration handlers
|
|
1210
|
-
* registered on global context. Use this factory to fully support the default embed script.
|
|
1211
|
-
* Will return any existing widget runtime if available.
|
|
1212
|
-
* @param configuration Runtime configuration.
|
|
1213
|
-
* @param global Object to read configuration handlers from (default: window).
|
|
1214
|
-
*/
|
|
1215
|
-
static createFromGlobal(n, e = {}) {
|
|
1216
|
-
if (this.isRuntime(n))
|
|
1217
|
-
return n.patch(e), n;
|
|
1218
|
-
const t = [], i = n && n._c;
|
|
1219
|
-
i && i.forEach((r) => t.push(r));
|
|
1220
|
-
const s = this.create(e);
|
|
1221
|
-
return s.container.register("$runtimecfg", t), s;
|
|
1222
|
-
}
|
|
1223
|
-
/**
|
|
1224
|
-
* Determines whether the specified object is a valid widget runtime.
|
|
1225
|
-
* @param obj Object to compare.
|
|
1226
|
-
*/
|
|
1227
|
-
static isRuntime(n) {
|
|
1228
|
-
return !!(n && typeof n == "object" && n.container && typeof n.container.get == "function" && n.container.get("$environment") === n && n.container.owner === n);
|
|
1229
|
-
}
|
|
1230
|
-
};
|
|
1231
|
-
let Rt = Te;
|
|
1232
|
-
Rt.version = `${Mt} (${ce})`;
|
|
1233
|
-
var Q = /* @__PURE__ */ ((n) => (n.open = "open", n.closed = "closed", n.hidden = "hidden", n))(Q || {});
|
|
1234
|
-
const Oe = (n) => import("./index-d70f1e69.js").then(
|
|
1235
|
-
({ ServiceClient: e, ServiceProxy: t }) => n.get("settings").then((i) => {
|
|
1236
|
-
const { name: s, events: r } = n.get("$widget"), {
|
|
1237
|
-
data: { projection: a = "", site: o = "current", forceHttps: c = !1 }
|
|
1238
|
-
} = i, h = new t(a, {
|
|
443
|
+
}, te = (n) => import("./index-d70f1e69.js").then(
|
|
444
|
+
({ ServiceClient: e, ServiceProxy: t }) => n.get("settings").then((s) => {
|
|
445
|
+
const { name: i, events: o } = n.get("$widget"), {
|
|
446
|
+
data: { projection: a = "", site: r = "current", forceHttps: c = !1 }
|
|
447
|
+
} = s, d = new t(a, {
|
|
1239
448
|
credentials: "same-origin"
|
|
1240
|
-
}),
|
|
1241
|
-
|
|
449
|
+
}), g = new e(
|
|
450
|
+
d,
|
|
1242
451
|
{
|
|
1243
|
-
funnel:
|
|
1244
|
-
site:
|
|
452
|
+
funnel: i.replace("_contact-method", "").replace("_contact", ""),
|
|
453
|
+
site: Ae(r, c)
|
|
1245
454
|
},
|
|
1246
455
|
null,
|
|
1247
456
|
n
|
|
1248
457
|
);
|
|
1249
|
-
return
|
|
1250
|
-
u && u.projection !== a &&
|
|
1251
|
-
}),
|
|
458
|
+
return o.subscribe("widget:settings-updated", (m, { data: u }) => {
|
|
459
|
+
u && u.projection !== a && g.proxy.setBaseUrl(u.projection);
|
|
460
|
+
}), g;
|
|
1252
461
|
})
|
|
1253
|
-
),
|
|
1254
|
-
const t = (
|
|
1255
|
-
const
|
|
1256
|
-
return
|
|
462
|
+
), Ae = (n, e) => () => {
|
|
463
|
+
const t = (i) => {
|
|
464
|
+
const o = document.createElement("a");
|
|
465
|
+
return o.href = i, o;
|
|
1257
466
|
};
|
|
1258
|
-
let
|
|
1259
|
-
return n === "referrer" && document.referrer && (
|
|
467
|
+
let s = window.location;
|
|
468
|
+
return n === "referrer" && document.referrer && (s = t(document.referrer)), [
|
|
1260
469
|
e ? "https:" : "",
|
|
1261
470
|
"//",
|
|
1262
|
-
|
|
1263
|
-
|
|
471
|
+
s.host,
|
|
472
|
+
s.pathname
|
|
1264
473
|
].join("");
|
|
1265
|
-
},
|
|
474
|
+
}, A = (n) => {
|
|
1266
475
|
if (n) {
|
|
1267
476
|
const { Type: e, Content: t } = n;
|
|
1268
477
|
if (e && t)
|
|
1269
478
|
return { type: e, content: t };
|
|
1270
479
|
}
|
|
1271
|
-
},
|
|
480
|
+
}, W = (n) => n.map((e) => {
|
|
1272
481
|
const t = {
|
|
1273
482
|
id: e.Id.toString(),
|
|
1274
483
|
title: e.Name,
|
|
1275
|
-
symbol:
|
|
1276
|
-
activeSymbol: e.ActiveIcon &&
|
|
484
|
+
symbol: A(e.DefaultIcon),
|
|
485
|
+
activeSymbol: e.ActiveIcon && A(e.ActiveIcon),
|
|
1277
486
|
description: e.Description || e.Attributes && e.Attributes.description || "",
|
|
1278
487
|
matches: e.GuidesCount
|
|
1279
488
|
};
|
|
1280
|
-
return e.Children && e.Children.length && (t.items =
|
|
1281
|
-
}),
|
|
489
|
+
return e.Children && e.Children.length && (t.items = W(e.Children)), t;
|
|
490
|
+
}), C = (n, e) => n.filter(({ Type: t }) => t === e).map(({ Id: t, Title: s, Body: i }) => ({
|
|
1282
491
|
id: t.toString(),
|
|
1283
|
-
title:
|
|
1284
|
-
body:
|
|
1285
|
-
})),
|
|
492
|
+
title: s,
|
|
493
|
+
body: i
|
|
494
|
+
})), H = (n) => n.map(({ Id: e, Title: t, DefaultIcon: s, ListNotices: i, Notices: o }) => ({
|
|
1286
495
|
id: e.toString(),
|
|
1287
496
|
title: t,
|
|
1288
|
-
symbol:
|
|
497
|
+
symbol: A(s),
|
|
1289
498
|
defaultHeaderOptions: {
|
|
1290
|
-
visible: !!
|
|
499
|
+
visible: !!i.length
|
|
1291
500
|
},
|
|
1292
|
-
notifications: (
|
|
501
|
+
notifications: (i || []).concat(o || []).map(({ Id: a, Title: r, Body: c, Type: d, Modified: g }) => ({
|
|
1293
502
|
id: a.toString(),
|
|
1294
|
-
title:
|
|
503
|
+
title: r,
|
|
1295
504
|
body: c,
|
|
1296
|
-
modified:
|
|
1297
|
-
expandable:
|
|
505
|
+
modified: g,
|
|
506
|
+
expandable: d === "listNotice"
|
|
1298
507
|
}))
|
|
1299
|
-
})),
|
|
508
|
+
})), _ = ({
|
|
1300
509
|
Id: n,
|
|
1301
510
|
Title: e,
|
|
1302
511
|
DefaultIcon: t,
|
|
1303
|
-
Exits: [
|
|
1304
|
-
ExitType:
|
|
1305
|
-
ConfirmationText:
|
|
512
|
+
Exits: [s],
|
|
513
|
+
ExitType: i,
|
|
514
|
+
ConfirmationText: o,
|
|
1306
515
|
Description: a
|
|
1307
|
-
},
|
|
1308
|
-
const { Adapter: c } =
|
|
516
|
+
}, r) => {
|
|
517
|
+
const { Adapter: c } = s || { Adapter: {} }, { ClientName: d = "", Settings: g = {}, CustomClientName: m = "" } = c, u = {
|
|
1309
518
|
id: n.toString(),
|
|
1310
519
|
title: e,
|
|
1311
520
|
description: a,
|
|
1312
|
-
symbol:
|
|
1313
|
-
clientName:
|
|
521
|
+
symbol: A(t),
|
|
522
|
+
clientName: d === "custom.adapter" ? m : d,
|
|
1314
523
|
expanded: !0,
|
|
1315
524
|
inline: !0,
|
|
1316
525
|
body: {}
|
|
1317
526
|
};
|
|
1318
|
-
if (
|
|
1319
|
-
const { displayTextBeforeClick:
|
|
1320
|
-
|
|
527
|
+
if (d.indexOf("phone") > -1 || d.indexOf("freetext") > -1) {
|
|
528
|
+
const { displayTextBeforeClick: h, textBeforeClick: k } = g;
|
|
529
|
+
h === "true" && (u.expanded = !1, u.title = k), d.indexOf("phone.text") > -1 ? u.body.phoneNumber = g.phoneNumber : u.body.freetext = g.freetext;
|
|
1321
530
|
}
|
|
1322
|
-
return (
|
|
1323
|
-
},
|
|
1324
|
-
({ Id: e, Title: t, TotalMatches:
|
|
531
|
+
return (d.indexOf("chat.popup") > -1 || d.indexOf("link") > -1 || d === "custom.adapter" && i === "custom") && (u.body = g, u.body.confirmationFallback = o), d.indexOf("ace") > -1 && (u.body = g), u;
|
|
532
|
+
}, P = (n = []) => n.map(
|
|
533
|
+
({ Id: e, Title: t, TotalMatches: s, Symbol: i, DefaultIcon: o, ActiveIcon: a }) => ({
|
|
1325
534
|
id: e.toString(),
|
|
1326
535
|
title: t,
|
|
1327
|
-
matches:
|
|
1328
|
-
symbol:
|
|
1329
|
-
defaultIcon:
|
|
1330
|
-
activeIcon:
|
|
536
|
+
matches: s,
|
|
537
|
+
symbol: A(o || i),
|
|
538
|
+
defaultIcon: A(o),
|
|
539
|
+
activeIcon: A(a)
|
|
1331
540
|
})
|
|
1332
|
-
),
|
|
541
|
+
), F = (n) => n.map(({ Id: e, Title: t, Tags: s, FirstPublishedDate: i, Modified: o }) => ({
|
|
1333
542
|
id: e.toString(),
|
|
1334
543
|
title: t,
|
|
1335
|
-
tags:
|
|
1336
|
-
published:
|
|
1337
|
-
modified:
|
|
1338
|
-
})),
|
|
544
|
+
tags: P(s),
|
|
545
|
+
published: i,
|
|
546
|
+
modified: o
|
|
547
|
+
})), Ie = (n, e) => {
|
|
1339
548
|
switch (n) {
|
|
1340
|
-
case
|
|
1341
|
-
case
|
|
549
|
+
case v.MatchByCategory:
|
|
550
|
+
case v.Match: {
|
|
1342
551
|
const t = {
|
|
1343
552
|
guides: [],
|
|
1344
553
|
matches: 0,
|
|
@@ -1349,96 +558,96 @@ const Oe = (n) => import("./index-d70f1e69.js").then(
|
|
|
1349
558
|
tags: [],
|
|
1350
559
|
byCategory: []
|
|
1351
560
|
}, {
|
|
1352
|
-
Matches:
|
|
1353
|
-
TotalMatches:
|
|
1354
|
-
Notices:
|
|
561
|
+
Matches: s,
|
|
562
|
+
TotalMatches: i,
|
|
563
|
+
Notices: o,
|
|
1355
564
|
NoticeLists: a,
|
|
1356
|
-
Tags:
|
|
565
|
+
Tags: r,
|
|
1357
566
|
ByCategory: c
|
|
1358
567
|
} = e;
|
|
1359
|
-
return t.guides =
|
|
1360
|
-
({ Id:
|
|
1361
|
-
id:
|
|
1362
|
-
guides:
|
|
1363
|
-
matches:
|
|
568
|
+
return t.guides = F(s), t.matches = i, t.byCategory = (c || []).map(
|
|
569
|
+
({ Id: d, Matches: g, TotalMatches: m }) => ({
|
|
570
|
+
id: d,
|
|
571
|
+
guides: F(g),
|
|
572
|
+
matches: m
|
|
1364
573
|
})
|
|
1365
|
-
), t.tags =
|
|
574
|
+
), t.tags = P(r), t.notificationLists = H(a || []), t.topNotifications = C(o || [], "noticeRowTop"), t.middleNotifications = C(o || [], "noticeRowMiddle"), t.bottomNotifications = C(o || [], "footerNotice"), t;
|
|
1366
575
|
}
|
|
1367
|
-
case
|
|
1368
|
-
const { Children: t, GuidesCountTotal:
|
|
576
|
+
case v.Categories: {
|
|
577
|
+
const { Children: t, GuidesCountTotal: s } = e;
|
|
1369
578
|
return {
|
|
1370
|
-
categories:
|
|
1371
|
-
matches:
|
|
579
|
+
categories: W(t || []),
|
|
580
|
+
matches: s
|
|
1372
581
|
};
|
|
1373
582
|
}
|
|
1374
|
-
case
|
|
583
|
+
case v.Guide: {
|
|
1375
584
|
const {
|
|
1376
585
|
Id: t,
|
|
1377
|
-
Title:
|
|
1378
|
-
Body:
|
|
1379
|
-
Related:
|
|
586
|
+
Title: s,
|
|
587
|
+
Body: i,
|
|
588
|
+
Related: o,
|
|
1380
589
|
Options: a,
|
|
1381
|
-
ConnectionId:
|
|
590
|
+
ConnectionId: r,
|
|
1382
591
|
ContactMethods: c,
|
|
1383
|
-
EnableFeedback:
|
|
1384
|
-
HandoverExists:
|
|
1385
|
-
FirstPublishedDate:
|
|
592
|
+
EnableFeedback: d,
|
|
593
|
+
HandoverExists: g,
|
|
594
|
+
FirstPublishedDate: m,
|
|
1386
595
|
Modified: u,
|
|
1387
|
-
ModifiedByDisplayName:
|
|
1388
|
-
FirstPublishedByDisplayName:
|
|
1389
|
-
Categories:
|
|
596
|
+
ModifiedByDisplayName: h,
|
|
597
|
+
FirstPublishedByDisplayName: k,
|
|
598
|
+
Categories: p,
|
|
1390
599
|
Tags: l,
|
|
1391
600
|
SeoMetaDescription: f,
|
|
1392
|
-
SeoAllowIndex:
|
|
1393
|
-
Perspectives:
|
|
1394
|
-
PerspectiveKey:
|
|
1395
|
-
Translations:
|
|
1396
|
-
} = e,
|
|
1397
|
-
(
|
|
1398
|
-
) ||
|
|
601
|
+
SeoAllowIndex: B,
|
|
602
|
+
Perspectives: E,
|
|
603
|
+
PerspectiveKey: z,
|
|
604
|
+
Translations: K
|
|
605
|
+
} = e, re = z || Object.values(E).find(
|
|
606
|
+
(b) => b === r
|
|
607
|
+
) || E.Default || null, Q = {
|
|
1399
608
|
guide: {
|
|
1400
609
|
id: t.toString(),
|
|
1401
|
-
title:
|
|
1402
|
-
body:
|
|
610
|
+
title: s,
|
|
611
|
+
body: i,
|
|
1403
612
|
modified: u,
|
|
1404
|
-
published:
|
|
1405
|
-
modifiedBy:
|
|
1406
|
-
publishedBy:
|
|
1407
|
-
connection:
|
|
1408
|
-
categories:
|
|
1409
|
-
hasHandover:
|
|
1410
|
-
allowFeedback:
|
|
613
|
+
published: m,
|
|
614
|
+
modifiedBy: h,
|
|
615
|
+
publishedBy: k,
|
|
616
|
+
connection: r,
|
|
617
|
+
categories: p,
|
|
618
|
+
hasHandover: g,
|
|
619
|
+
allowFeedback: d,
|
|
1411
620
|
seoMetaDescription: f,
|
|
1412
|
-
seoAllowIndex:
|
|
1413
|
-
perspectives:
|
|
1414
|
-
perspective:
|
|
1415
|
-
translations: Object.keys(
|
|
621
|
+
seoAllowIndex: B,
|
|
622
|
+
perspectives: E,
|
|
623
|
+
perspective: re,
|
|
624
|
+
translations: Object.keys(K || {}).reduce((b, $) => (b[$] = K[$].toString(), b), {})
|
|
1416
625
|
},
|
|
1417
|
-
related:
|
|
626
|
+
related: F(o || []),
|
|
1418
627
|
dialog: [],
|
|
1419
628
|
contactMethods: (c || []).map(
|
|
1420
|
-
(
|
|
629
|
+
(b) => _(b)
|
|
1421
630
|
),
|
|
1422
|
-
tags:
|
|
631
|
+
tags: P(l)
|
|
1423
632
|
};
|
|
1424
633
|
return (a || []).forEach(
|
|
1425
|
-
({ CanAccess:
|
|
1426
|
-
if (!
|
|
634
|
+
({ CanAccess: b, Description: $, ConnectionId: ae, Properties: y }) => {
|
|
635
|
+
if (!b)
|
|
1427
636
|
return;
|
|
1428
637
|
const I = {
|
|
1429
638
|
id: t.toString(),
|
|
1430
|
-
title:
|
|
1431
|
-
connection:
|
|
1432
|
-
connectionKey:
|
|
639
|
+
title: $,
|
|
640
|
+
connection: ae,
|
|
641
|
+
connectionKey: y.ConnectionKey,
|
|
1433
642
|
type: "default",
|
|
1434
643
|
parent: {
|
|
1435
644
|
id: t.toString(),
|
|
1436
|
-
title:
|
|
1437
|
-
tags:
|
|
645
|
+
title: s,
|
|
646
|
+
tags: P(l)
|
|
1438
647
|
}
|
|
1439
648
|
};
|
|
1440
|
-
if (
|
|
1441
|
-
switch (
|
|
649
|
+
if (y.Type === "Guide" || y.Type === "Link")
|
|
650
|
+
switch (y.Id && (I.id = y.Id.toString()), y.Uri && (I.href = y.Uri), y.Target && (I.target = y.Target), y.Type) {
|
|
1442
651
|
case "Guide":
|
|
1443
652
|
I.type = "guide";
|
|
1444
653
|
break;
|
|
@@ -1446,50 +655,50 @@ const Oe = (n) => import("./index-d70f1e69.js").then(
|
|
|
1446
655
|
I.type = "link";
|
|
1447
656
|
break;
|
|
1448
657
|
}
|
|
1449
|
-
|
|
658
|
+
Q.dialog.push(I);
|
|
1450
659
|
}
|
|
1451
|
-
),
|
|
660
|
+
), Q;
|
|
1452
661
|
}
|
|
1453
|
-
case
|
|
662
|
+
case v.Contacts: {
|
|
1454
663
|
const {
|
|
1455
664
|
Children: t,
|
|
1456
|
-
Matches:
|
|
1457
|
-
Notices:
|
|
1458
|
-
NoticeLists:
|
|
665
|
+
Matches: s,
|
|
666
|
+
Notices: i,
|
|
667
|
+
NoticeLists: o
|
|
1459
668
|
} = e;
|
|
1460
669
|
return {
|
|
1461
|
-
contactMethods: (
|
|
1462
|
-
(
|
|
670
|
+
contactMethods: (s || []).map(
|
|
671
|
+
(r) => _(r)
|
|
1463
672
|
),
|
|
1464
|
-
categories:
|
|
1465
|
-
topNotifications:
|
|
1466
|
-
middleNotifications:
|
|
1467
|
-
bottomNotifications:
|
|
1468
|
-
notificationLists:
|
|
673
|
+
categories: W(t || []),
|
|
674
|
+
topNotifications: C(i || [], "noticeRowTop"),
|
|
675
|
+
middleNotifications: C(i || [], "noticeRowMiddle"),
|
|
676
|
+
bottomNotifications: C(i || [], "footerNotice"),
|
|
677
|
+
notificationLists: H(o || [])
|
|
1469
678
|
};
|
|
1470
679
|
}
|
|
1471
|
-
case
|
|
680
|
+
case v.ContactMethod: {
|
|
1472
681
|
const { ContactMethod: t } = e;
|
|
1473
|
-
return
|
|
682
|
+
return _(t || {});
|
|
1474
683
|
}
|
|
1475
|
-
case
|
|
1476
|
-
case
|
|
1477
|
-
return
|
|
1478
|
-
case
|
|
1479
|
-
const { Notices: t, NoticeLists:
|
|
684
|
+
case v.Tags:
|
|
685
|
+
case v.TagsOnGuides:
|
|
686
|
+
return P(e || []);
|
|
687
|
+
case v.Notifications: {
|
|
688
|
+
const { Notices: t, NoticeLists: s } = e;
|
|
1480
689
|
return {
|
|
1481
|
-
topNotifications:
|
|
1482
|
-
middleNotifications:
|
|
1483
|
-
bottomNotifications:
|
|
1484
|
-
notificationLists:
|
|
690
|
+
topNotifications: C(t || [], "noticeRowTop"),
|
|
691
|
+
middleNotifications: C(t || [], "noticeRowMiddle"),
|
|
692
|
+
bottomNotifications: C(t || [], "footerNotice"),
|
|
693
|
+
notificationLists: H(s || [])
|
|
1485
694
|
};
|
|
1486
695
|
}
|
|
1487
696
|
default:
|
|
1488
697
|
return {};
|
|
1489
698
|
}
|
|
1490
699
|
};
|
|
1491
|
-
var
|
|
1492
|
-
const
|
|
700
|
+
var xe = /* @__PURE__ */ ((n) => (n.Guide = "guide", n.Guides = "guides", n.GuidesByCategory = "guides-by-category", n.RowNotifications = "row-notices", n.NotificationLists = "notification-lists", n.GuideCategories = "guide-categories", n.ContactMethodCategories = "contact-method-categories", n.ContactMethod = "contact-method", n.ContactMethods = "contact-methods", n.Tags = "tags", n.TagsOnGuides = "tagsonguides", n))(xe || {}), v = /* @__PURE__ */ ((n) => (n.Match = "match", n.Categories = "categories", n.Guide = "guide", n.Contacts = "contacts", n.ContactMethod = "contact-method", n.MatchByCategory = "match-by-category", n.Tags = "tags", n.TagsOnGuides = "tagsonguides", n.Notifications = "notifications", n))(v || {}), Ee = /* @__PURE__ */ ((n) => (n.Positive = "Positive", n.Negative = "Negative", n))(Ee || {}), Me = /* @__PURE__ */ ((n) => (n.POPULARITY_DESCENDING = "popularity-descending", n.ALPHABETIC_ASCENDING = "alphabetic-ascending", n.ALPHABETIC_DESCENDING = "alphabetic-descending", n.MODIFIED_ASCENDING = "modified-ascending", n.MODIFIED_DESCENDING = "modified-descending", n.PUBLISHED_ASCENDING = "published-ascending", n.PUBLISHED_DESCENDING = "published-descending", n))(Me || {});
|
|
701
|
+
const ne = (n) => {
|
|
1493
702
|
switch (n) {
|
|
1494
703
|
case "guides":
|
|
1495
704
|
return "match";
|
|
@@ -1514,141 +723,141 @@ const Ie = (n) => {
|
|
|
1514
723
|
default:
|
|
1515
724
|
throw "error";
|
|
1516
725
|
}
|
|
1517
|
-
},
|
|
726
|
+
}, Pe = (n) => x(void 0, null, function* () {
|
|
1518
727
|
const { invoke: e } = n.get("$widget");
|
|
1519
|
-
return (yield e("renderState")) ===
|
|
728
|
+
return (yield e("renderState")) === L.hidden;
|
|
1520
729
|
});
|
|
1521
|
-
class
|
|
730
|
+
class O {
|
|
1522
731
|
constructor(e, t) {
|
|
1523
732
|
this.container = e, this.matchingClient = t, this.queries = /* @__PURE__ */ new Map(), this.getUnresolvedQueries = () => {
|
|
1524
|
-
let
|
|
1525
|
-
return this.queries.forEach((
|
|
1526
|
-
|
|
1527
|
-
}),
|
|
733
|
+
let s = 0;
|
|
734
|
+
return this.queries.forEach((i, o) => {
|
|
735
|
+
i.some((r) => !r.resolved) && (s = 1);
|
|
736
|
+
}), s;
|
|
1528
737
|
}, this.events = e.get("$widget").events, this.events.subscribe(
|
|
1529
738
|
"widget:settings-updated",
|
|
1530
739
|
() => this.queries = /* @__PURE__ */ new Map()
|
|
1531
740
|
), this.events.subscribe(
|
|
1532
741
|
"widget:render-state-changed",
|
|
1533
|
-
(
|
|
1534
|
-
|
|
742
|
+
(s, { next: i, previous: o }) => {
|
|
743
|
+
o === L.hidden && i === L.open && this.fetchAllUnresolvedQueries();
|
|
1535
744
|
}
|
|
1536
745
|
);
|
|
1537
746
|
}
|
|
1538
747
|
static getInstance(e, t = "dataClient") {
|
|
1539
|
-
return
|
|
1540
|
-
let
|
|
1541
|
-
|
|
1542
|
-
let
|
|
1543
|
-
return
|
|
748
|
+
return we(this)(() => e.getAsync(t).then((s) => x(this, null, function* () {
|
|
749
|
+
let i = yield e.getAsync("matchingClient");
|
|
750
|
+
i || (i = yield te(e), e.registerAsync("matchingClient", () => i));
|
|
751
|
+
let o = s;
|
|
752
|
+
return o || (o = new O(e, i), e.registerAsync(t, () => o)), o;
|
|
1544
753
|
})));
|
|
1545
754
|
}
|
|
1546
|
-
fetch(e, t,
|
|
1547
|
-
return new Promise((
|
|
1548
|
-
t.take,
|
|
1549
|
-
const a =
|
|
1550
|
-
let
|
|
1551
|
-
if (c && (
|
|
1552
|
-
const
|
|
1553
|
-
(
|
|
755
|
+
fetch(e, t, s) {
|
|
756
|
+
return new Promise((i, o) => {
|
|
757
|
+
t.take, Ne(t);
|
|
758
|
+
const a = ne(e);
|
|
759
|
+
let r = this.queries.get(a) || [], c = r.find((d) => G(d.params, t)) || null;
|
|
760
|
+
if (c && (s != null && s.noCache)) {
|
|
761
|
+
const d = r.findIndex(
|
|
762
|
+
(g) => G(g.params, t)
|
|
1554
763
|
);
|
|
1555
|
-
|
|
764
|
+
r = [...r.slice(0, d), ...r.slice(d + 1)], c = null;
|
|
1556
765
|
}
|
|
1557
766
|
if (c) {
|
|
1558
|
-
const
|
|
767
|
+
const d = r.indexOf(c);
|
|
1559
768
|
if (c.resolved ? (this.events.dispatch("data-client:fetched", {
|
|
1560
769
|
params: t,
|
|
1561
770
|
type: a,
|
|
1562
771
|
response: c.data,
|
|
1563
772
|
unresolvedQueries: this.getUnresolvedQueries()
|
|
1564
|
-
}), this.track(c.data, a, c.error), c.data && c.error ?
|
|
773
|
+
}), this.track(c.data, a, c.error), c.data && c.error ? o({ error: c.error }) : i(c.data)) : c.resolvers.push({ resolve: i, reject: o }), r.splice(d, 1), r.push(c), this.queries.set(a, r), !c.loading && !c.resolved)
|
|
1565
774
|
return this.runQuery(a, t);
|
|
1566
775
|
} else
|
|
1567
|
-
return
|
|
776
|
+
return r.push({
|
|
1568
777
|
params: t,
|
|
1569
778
|
resolved: !1,
|
|
1570
779
|
loading: !0,
|
|
1571
780
|
data: {},
|
|
1572
|
-
resolvers: [{ resolve:
|
|
1573
|
-
}), this.queries.set(a,
|
|
1574
|
-
}).then((
|
|
781
|
+
resolvers: [{ resolve: i, reject: o }]
|
|
782
|
+
}), this.queries.set(a, r), this.runQuery(a, t);
|
|
783
|
+
}).then((i) => Ce(i));
|
|
1575
784
|
}
|
|
1576
785
|
// query the cached data
|
|
1577
786
|
read(e, t) {
|
|
1578
|
-
const { select:
|
|
1579
|
-
return (this.queries.get(
|
|
1580
|
-
if (typeof
|
|
1581
|
-
const
|
|
1582
|
-
|
|
787
|
+
const { select: s } = t, i = ne(e);
|
|
788
|
+
return (this.queries.get(i) || []).reduce((r, c) => {
|
|
789
|
+
if (typeof s == "function") {
|
|
790
|
+
const d = s(c.data);
|
|
791
|
+
d && r.push(d);
|
|
1583
792
|
} else
|
|
1584
|
-
|
|
1585
|
-
return
|
|
793
|
+
r.push(c.data);
|
|
794
|
+
return r;
|
|
1586
795
|
}, []);
|
|
1587
796
|
}
|
|
1588
|
-
feedback(e, t,
|
|
1589
|
-
return this.matchingClient.giveFeedback(e, t,
|
|
797
|
+
feedback(e, t, s) {
|
|
798
|
+
return this.matchingClient.giveFeedback(e, t, s);
|
|
1590
799
|
}
|
|
1591
|
-
setLoadingStatus(e, t,
|
|
1592
|
-
const
|
|
1593
|
-
|
|
800
|
+
setLoadingStatus(e, t, s) {
|
|
801
|
+
const i = this.queries.get(e) || [], o = i.find((a) => G(a.params, t));
|
|
802
|
+
o && (o.loading = s), this.queries.set(e, i);
|
|
1594
803
|
}
|
|
1595
804
|
runQuery(e, t) {
|
|
1596
|
-
return
|
|
805
|
+
return x(this, null, function* () {
|
|
1597
806
|
const {
|
|
1598
|
-
searchPhrase:
|
|
1599
|
-
categories:
|
|
1600
|
-
contactMethodCategoryId:
|
|
807
|
+
searchPhrase: s = "",
|
|
808
|
+
categories: i = "0",
|
|
809
|
+
contactMethodCategoryId: o = "0",
|
|
1601
810
|
contactMethodId: a = "0",
|
|
1602
|
-
tagId:
|
|
811
|
+
tagId: r = void 0,
|
|
1603
812
|
take: c = 5,
|
|
1604
|
-
connection:
|
|
1605
|
-
guideId:
|
|
1606
|
-
expandCategories:
|
|
813
|
+
connection: d = "",
|
|
814
|
+
guideId: g,
|
|
815
|
+
expandCategories: m = "descendants",
|
|
1607
816
|
currentCategory: u,
|
|
1608
|
-
sorting:
|
|
1609
|
-
guideIds:
|
|
1610
|
-
} = t,
|
|
1611
|
-
if (yield
|
|
817
|
+
sorting: h = "popularity-descending",
|
|
818
|
+
guideIds: k = []
|
|
819
|
+
} = t, p = s.toString().trim();
|
|
820
|
+
if (yield Pe(this.container))
|
|
1612
821
|
return Promise.resolve();
|
|
1613
822
|
switch (e) {
|
|
1614
823
|
case "match": {
|
|
1615
824
|
const l = (f) => {
|
|
1616
|
-
const [
|
|
825
|
+
const [B, E] = f.split("-");
|
|
1617
826
|
return {
|
|
1618
827
|
type: (/* @__PURE__ */ new Map([
|
|
1619
828
|
["popularity", "popularity"],
|
|
1620
829
|
["alphabetic", "title"],
|
|
1621
830
|
["modified", "lastModified"],
|
|
1622
831
|
["published", "firstPublished"]
|
|
1623
|
-
])).get(
|
|
1624
|
-
direction:
|
|
832
|
+
])).get(B),
|
|
833
|
+
direction: E
|
|
1625
834
|
};
|
|
1626
835
|
};
|
|
1627
|
-
return
|
|
1628
|
-
configuration: { ids:
|
|
836
|
+
return k.length ? this.matchingClient.customRequest("guides", "POST", {
|
|
837
|
+
configuration: { ids: k, take: +c }
|
|
1629
838
|
}).then(
|
|
1630
839
|
(f) => f && this.handleResponse(f, e, t)
|
|
1631
|
-
) : this.matchingClient.match(
|
|
1632
|
-
categories:
|
|
840
|
+
) : this.matchingClient.match(p, {
|
|
841
|
+
categories: i === "0" ? [] : Array.isArray(i) ? i : [+i],
|
|
1633
842
|
take: +c,
|
|
1634
|
-
tags:
|
|
1635
|
-
sorting: l(
|
|
1636
|
-
ids:
|
|
843
|
+
tags: r,
|
|
844
|
+
sorting: l(h),
|
|
845
|
+
ids: k
|
|
1637
846
|
}).then(
|
|
1638
847
|
(f) => f && this.handleResponse(f, e, t)
|
|
1639
848
|
);
|
|
1640
849
|
}
|
|
1641
850
|
case "match-by-category":
|
|
1642
|
-
return this.matchingClient.match(
|
|
851
|
+
return this.matchingClient.match(p, {
|
|
1643
852
|
groupByCategory: !0,
|
|
1644
|
-
categories:
|
|
853
|
+
categories: i === "0" ? [] : Array.isArray(i) ? i : [+i],
|
|
1645
854
|
take: +c,
|
|
1646
|
-
tags:
|
|
855
|
+
tags: r
|
|
1647
856
|
}).then(
|
|
1648
857
|
(l) => l && this.handleResponse(l, e, t)
|
|
1649
858
|
);
|
|
1650
859
|
case "guide":
|
|
1651
|
-
return this.matchingClient.getGuide(
|
|
860
|
+
return this.matchingClient.getGuide(g, { connectionId: d }).then((l) => {
|
|
1652
861
|
l && this.handleResponse(l, e, t);
|
|
1653
862
|
}).catch((l) => {
|
|
1654
863
|
const f = {
|
|
@@ -1659,28 +868,28 @@ class D {
|
|
|
1659
868
|
});
|
|
1660
869
|
case "categories":
|
|
1661
870
|
return this.matchingClient.getCategories({
|
|
1662
|
-
phrase:
|
|
1663
|
-
expand:
|
|
1664
|
-
tags:
|
|
871
|
+
phrase: p,
|
|
872
|
+
expand: m,
|
|
873
|
+
tags: r
|
|
1665
874
|
}).then(
|
|
1666
875
|
(l) => l && this.handleResponse(l, e, t)
|
|
1667
876
|
);
|
|
1668
877
|
case "contacts":
|
|
1669
|
-
return
|
|
878
|
+
return g ? this.matchingClient.contactMethods(+g, { phrase: p }).then(
|
|
1670
879
|
(l) => l && this.handleResponse(l, e, t)
|
|
1671
|
-
) : this.matchingClient.contacts(+
|
|
880
|
+
) : this.matchingClient.contacts(+o, { phrase: p }).then(
|
|
1672
881
|
(l) => l && this.handleResponse(l, e, t)
|
|
1673
882
|
);
|
|
1674
883
|
case "contact-method":
|
|
1675
|
-
return this.matchingClient.getContactMethod(+a, { guideId:
|
|
884
|
+
return this.matchingClient.getContactMethod(+a, { guideId: g, currentCategory: u }).then(
|
|
1676
885
|
(l) => l && this.handleResponse(l, e, t)
|
|
1677
886
|
);
|
|
1678
887
|
case "tags":
|
|
1679
888
|
return this.matchingClient.customRequest("tags", "GET", {
|
|
1680
889
|
configuration: {
|
|
1681
890
|
take: 999999,
|
|
1682
|
-
phrase:
|
|
1683
|
-
categories:
|
|
891
|
+
phrase: p,
|
|
892
|
+
categories: i === "0" ? [] : Array.isArray(i) ? i : [+i]
|
|
1684
893
|
}
|
|
1685
894
|
}).then(
|
|
1686
895
|
(l) => l && this.handleResponse(l, e, t)
|
|
@@ -1689,9 +898,9 @@ class D {
|
|
|
1689
898
|
return this.matchingClient.customRequest("tagsonguides", "GET", {
|
|
1690
899
|
configuration: {
|
|
1691
900
|
take: 999999,
|
|
1692
|
-
phrase:
|
|
1693
|
-
categories:
|
|
1694
|
-
tags:
|
|
901
|
+
phrase: p,
|
|
902
|
+
categories: i === "0" ? [] : Array.isArray(i) ? i : [+i],
|
|
903
|
+
tags: r
|
|
1695
904
|
}
|
|
1696
905
|
}).then(
|
|
1697
906
|
(l) => l && this.handleResponse(l, e, t)
|
|
@@ -1699,8 +908,8 @@ class D {
|
|
|
1699
908
|
case "notifications":
|
|
1700
909
|
return this.matchingClient.customRequest("notices", "GET", {
|
|
1701
910
|
configuration: {
|
|
1702
|
-
phrase:
|
|
1703
|
-
categories:
|
|
911
|
+
phrase: p,
|
|
912
|
+
categories: i === "0" ? [] : Array.isArray(i) ? i : [+i]
|
|
1704
913
|
}
|
|
1705
914
|
}).then(
|
|
1706
915
|
(l) => l && this.handleResponse(l, e, t)
|
|
@@ -1708,66 +917,66 @@ class D {
|
|
|
1708
917
|
}
|
|
1709
918
|
});
|
|
1710
919
|
}
|
|
1711
|
-
handleResponse(e = {}, t,
|
|
1712
|
-
const
|
|
920
|
+
handleResponse(e = {}, t, s, i) {
|
|
921
|
+
const o = this.queries.get(t) || [], a = o.find((r) => G(r.params, s));
|
|
1713
922
|
if (a) {
|
|
1714
|
-
const
|
|
1715
|
-
this.track(
|
|
1716
|
-
|
|
923
|
+
const r = i || Ie(t, e);
|
|
924
|
+
this.track(r, t, i), a.resolvers.forEach((d) => {
|
|
925
|
+
i ? d.reject({ error: r }) : d.resolve(r);
|
|
1717
926
|
});
|
|
1718
|
-
const c =
|
|
1719
|
-
c > -1 &&
|
|
1720
|
-
error:
|
|
927
|
+
const c = o.indexOf(a);
|
|
928
|
+
c > -1 && o.splice(c, 1), o.push(J(Z({}, a), {
|
|
929
|
+
error: i,
|
|
1721
930
|
resolvers: [],
|
|
1722
|
-
data:
|
|
931
|
+
data: r,
|
|
1723
932
|
resolved: !0
|
|
1724
|
-
})), this.setLoadingStatus(t,
|
|
933
|
+
})), this.setLoadingStatus(t, s, !1), this.queries.set(t, o), i || this.events.dispatch("data-client:fetched", {
|
|
1725
934
|
type: t,
|
|
1726
|
-
params:
|
|
1727
|
-
response:
|
|
935
|
+
params: s,
|
|
936
|
+
response: r,
|
|
1728
937
|
unresolvedQueries: this.getUnresolvedQueries()
|
|
1729
938
|
});
|
|
1730
939
|
}
|
|
1731
940
|
}
|
|
1732
941
|
fetchAllUnresolvedQueries() {
|
|
1733
942
|
for (const [e, t] of this.queries)
|
|
1734
|
-
t.filter((
|
|
1735
|
-
this.runQuery(e,
|
|
943
|
+
t.filter((s) => !s.resolved).forEach((s) => {
|
|
944
|
+
this.runQuery(e, s.params);
|
|
1736
945
|
});
|
|
1737
946
|
}
|
|
1738
|
-
track(e = {}, t,
|
|
1739
|
-
const
|
|
1740
|
-
|
|
947
|
+
track(e = {}, t, s) {
|
|
948
|
+
const i = this.container.get("$widget");
|
|
949
|
+
i && !s ? i.events.dispatch("tracking:service-client-response", {
|
|
1741
950
|
type: t,
|
|
1742
951
|
data: e
|
|
1743
|
-
}) :
|
|
952
|
+
}) : i && i.events.dispatch("tracking:service-client-error", {
|
|
1744
953
|
type: t,
|
|
1745
|
-
error:
|
|
954
|
+
error: s
|
|
1746
955
|
});
|
|
1747
956
|
}
|
|
1748
957
|
static create(e) {
|
|
1749
|
-
return e.getAsync("matchingClient").then((t) =>
|
|
958
|
+
return e.getAsync("matchingClient").then((t) => x(this, null, function* () {
|
|
1750
959
|
if (t)
|
|
1751
|
-
return new
|
|
1752
|
-
const
|
|
1753
|
-
return e.registerAsync("matchingClient", () =>
|
|
960
|
+
return new O(e, t);
|
|
961
|
+
const s = yield te(e);
|
|
962
|
+
return e.registerAsync("matchingClient", () => s), new O(e, s);
|
|
1754
963
|
}));
|
|
1755
964
|
}
|
|
1756
965
|
getClient() {
|
|
1757
966
|
return this.matchingClient;
|
|
1758
967
|
}
|
|
1759
968
|
}
|
|
1760
|
-
const
|
|
1761
|
-
n.registerAsync("dataClient", () =>
|
|
969
|
+
const Re = (n) => x(void 0, null, function* () {
|
|
970
|
+
n.registerAsync("dataClient", () => O.create(n));
|
|
1762
971
|
});
|
|
1763
972
|
export {
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
973
|
+
O as DataClient,
|
|
974
|
+
xe as DataType,
|
|
975
|
+
Ee as FeedbackType,
|
|
976
|
+
Re as KnowledgeDataClientPlugin,
|
|
977
|
+
v as ServiceClientQueryType,
|
|
978
|
+
Me as SortingType,
|
|
979
|
+
ne as determineServiceClientQueryType,
|
|
980
|
+
Ie as formatLegacyData
|
|
1772
981
|
};
|
|
1773
982
|
//# sourceMappingURL=index.js.map
|