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