@telia-ace/widget-types-grid 1.0.30-experimental.10 → 1.0.30-experimental.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1140 -23
- package/dist/index.js.map +1 -1
- package/dist/{render.0c0b70f9.js → render.4f979aa1.js} +14 -12
- package/dist/{render.0c0b70f9.js.map → render.4f979aa1.js.map} +1 -1
- package/package.json +8 -8
- package/dist/index.c6989014.js +0 -1465
- package/dist/index.c6989014.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,26 +1,1143 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
var St = Object.defineProperty, At = Object.defineProperties;
|
|
2
|
+
var Dt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var H = Object.getOwnPropertySymbols;
|
|
4
|
+
var lt = Object.prototype.hasOwnProperty, ut = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var ct = (e, t, n) => t in e ? St(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, f = (e, t) => {
|
|
6
|
+
for (var n in t || (t = {}))
|
|
7
|
+
lt.call(t, n) && ct(e, n, t[n]);
|
|
8
|
+
if (H)
|
|
9
|
+
for (var n of H(t))
|
|
10
|
+
ut.call(t, n) && ct(e, n, t[n]);
|
|
11
|
+
return e;
|
|
12
|
+
}, C = (e, t) => At(e, Dt(t));
|
|
13
|
+
var N = (e, t) => {
|
|
14
|
+
var n = {};
|
|
15
|
+
for (var s in e)
|
|
16
|
+
lt.call(e, s) && t.indexOf(s) < 0 && (n[s] = e[s]);
|
|
17
|
+
if (e != null && H)
|
|
18
|
+
for (var s of H(e))
|
|
19
|
+
t.indexOf(s) < 0 && ut.call(e, s) && (n[s] = e[s]);
|
|
20
|
+
return n;
|
|
21
|
+
};
|
|
22
|
+
var dt = (e, t, n) => new Promise((s, o) => {
|
|
23
|
+
var i = (a) => {
|
|
24
|
+
try {
|
|
25
|
+
c(n.next(a));
|
|
26
|
+
} catch (u) {
|
|
27
|
+
o(u);
|
|
28
|
+
}
|
|
29
|
+
}, r = (a) => {
|
|
30
|
+
try {
|
|
31
|
+
c(n.throw(a));
|
|
32
|
+
} catch (u) {
|
|
33
|
+
o(u);
|
|
34
|
+
}
|
|
35
|
+
}, c = (a) => a.done ? s(a.value) : Promise.resolve(a.value).then(i, r);
|
|
36
|
+
c((n = n.apply(e, t)).next());
|
|
37
|
+
});
|
|
38
|
+
import { Grid as ft, useRouteData as Mt, useRouter as Nt, useProperties as gt, useContext as st, useContainer as W, useComponentNode as ot, useScroll as yt, transitionComposer as Pt, paddedBorderTabStyle as Lt, useComponent as _t, useComponentDescriptor as kt, filterCssPropsStyle as Rt, Typography as Vt, useComponentPlatform as bt, useIsMounted as It, useColumns as Tt, useLayout as zt, ComponentNodeContext as Bt, ComponentPropertyContext as jt, filterCssProps as Wt } from "@telia-ace/widget-ui";
|
|
39
|
+
import p, { useState as B, forwardRef as wt, useMemo as Ft, Suspense as Gt, useEffect as j } from "react";
|
|
40
|
+
import { css as vt, ThemeProvider as Ht, useTheme as qt } from "@emotion/react";
|
|
41
|
+
import { asDescriptor as U, ComponentPlatform as Et, createComponentModel as Kt, ComponentQuery as Ut, WidgetRenderState as O } from "@telia-ace/widget-core";
|
|
42
|
+
import k from "@emotion/styled";
|
|
43
|
+
import { appendClassNames as Y, notifyDataLoaded as Yt, lock as X, removeNullAndUndefinedValues as ht, uuid as Qt } from "@telia-ace/widget-utilities";
|
|
44
|
+
import { TransitionGroup as Zt, Transition as Jt } from "react-transition-group";
|
|
45
|
+
import { Switch as Xt, Route as tt } from "react-router";
|
|
46
|
+
import { spread as te } from "@open-wc/lit-helpers";
|
|
47
|
+
import { nothing as ee, css as ne, LitElement as se } from "lit";
|
|
48
|
+
import { property as Ct, state as Q, customElement as oe } from "lit/decorators.js";
|
|
49
|
+
import { html as ie, unsafeStatic as re } from "lit/static-html.js";
|
|
50
|
+
import { onWidgetUrl as ae } from "@telia-ace/widget-routing";
|
|
51
|
+
import { readStorage as P, StorageMedium as v, createStorageWriter as I, StorageCategory as T, StorageScope as ce } from "@telia-ace/widget-services";
|
|
52
|
+
import { supportBootstrapping as le } from "@webprovisions/bootstrapping";
|
|
53
|
+
import { WidgetState as ue, WidgetType as de } from "@webprovisions/platform";
|
|
54
|
+
var nt = /* @__PURE__ */ ((e) => (e.back = "back", e.forth = "forth", e))(nt || {});
|
|
55
|
+
const he = (e, t, n) => typeof n[e] == "number" && typeof n[t] == "number" && n[e] > n[t] ? "back" : "forth", pe = ({ views: e, location: t, render: n }) => /* @__PURE__ */ p.createElement(
|
|
56
|
+
Xt,
|
|
57
|
+
{
|
|
58
|
+
location: t && C(f({}, t), {
|
|
59
|
+
pathname: t.pathname.split("?")[0]
|
|
60
|
+
})
|
|
61
|
+
},
|
|
62
|
+
[
|
|
63
|
+
...Object.keys(e).filter((s) => !!e[s].path),
|
|
64
|
+
...Object.keys(e).filter((s) => !e[s].path)
|
|
65
|
+
].map((s) => {
|
|
66
|
+
const { path: o } = e[s];
|
|
67
|
+
return o ? Array.isArray(o) ? o.map((i) => /* @__PURE__ */ p.createElement(tt, { key: s, exact: !0, path: i, render: () => n(s) })) : /* @__PURE__ */ p.createElement(tt, { key: s, exact: !0, path: o, render: () => n(s) }) : /* @__PURE__ */ p.createElement(tt, { key: s, render: () => n(s) });
|
|
68
|
+
})
|
|
69
|
+
), Ot = pe, me = k.div`
|
|
70
|
+
position: relative;
|
|
71
|
+
width: 100%;
|
|
72
|
+
flex: 1;
|
|
73
|
+
`, fe = k(ft)`
|
|
74
|
+
position: absolute;
|
|
75
|
+
left: 0;
|
|
76
|
+
right: 0;
|
|
77
|
+
${(e) => !!e.animationCss && e.animationCss}
|
|
78
|
+
${(e) => !!e.scrollableCss && e.scrollableCss}
|
|
79
|
+
`, ge = {
|
|
80
|
+
index: 1,
|
|
81
|
+
search: 2,
|
|
82
|
+
browse: 3,
|
|
83
|
+
guide: 4,
|
|
84
|
+
contact: 5,
|
|
85
|
+
"contact-method": 6,
|
|
86
|
+
conversation: 7
|
|
87
|
+
}, ye = (n) => {
|
|
88
|
+
var s = n, { className: e = "" } = s, t = N(s, ["className"]);
|
|
89
|
+
const [o, i] = B("index"), [r, c] = B(nt.forth), a = Mt(), u = Nt(), d = gt(), l = st(), h = W(), m = ot(), { gap: g = "0" } = l, G = d, { columns: b = 1, animation: y = "none", scrollable: E = !1 } = G, $ = N(G, ["columns", "animation", "scrollable"]), [F, L] = yt(E);
|
|
90
|
+
if (!m || !u)
|
|
91
|
+
return null;
|
|
92
|
+
const { location: at } = u;
|
|
93
|
+
a.name !== o && a.name !== "" && y && (c(he(o, a.name, ge)), i(a.name));
|
|
94
|
+
const { views: S } = h.get("$settings");
|
|
95
|
+
if (!Object.keys(S).length)
|
|
96
|
+
return null;
|
|
97
|
+
const A = (w, M, V) => {
|
|
98
|
+
const x = J(M, V), z = m.getChildren(w)[0];
|
|
99
|
+
return /* @__PURE__ */ p.createElement(
|
|
100
|
+
fe,
|
|
101
|
+
C(f(C(f(f({}, t), $), {
|
|
102
|
+
scrollableCss: F,
|
|
103
|
+
ref: L,
|
|
104
|
+
columns: b,
|
|
105
|
+
gap: g
|
|
106
|
+
}), x), {
|
|
107
|
+
className: Y(e, "humany-view")
|
|
108
|
+
}),
|
|
109
|
+
/* @__PURE__ */ p.createElement(it, { id: z.id, branch: "default" })
|
|
110
|
+
);
|
|
111
|
+
}, J = (w, M) => {
|
|
112
|
+
if (y === "slide" || y === "fade")
|
|
113
|
+
return {
|
|
114
|
+
animationCss: Pt.composeViewTransition(
|
|
115
|
+
w,
|
|
116
|
+
y,
|
|
117
|
+
M
|
|
118
|
+
),
|
|
119
|
+
["data-state"]: w
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
return /* @__PURE__ */ p.createElement(me, { className: "humany-animated-view" }, /* @__PURE__ */ p.createElement(
|
|
123
|
+
Zt,
|
|
124
|
+
{
|
|
125
|
+
component: null,
|
|
126
|
+
childFactory: (w) => p.cloneElement(w, { direction: r })
|
|
127
|
+
},
|
|
128
|
+
/* @__PURE__ */ p.createElement(
|
|
129
|
+
Jt,
|
|
130
|
+
{
|
|
131
|
+
key: o,
|
|
132
|
+
timeout: { enter: 500, exit: 500 },
|
|
133
|
+
onEnter: (w) => w == null ? void 0 : w.clientHeight,
|
|
134
|
+
unmountOnExit: !0,
|
|
135
|
+
direction: nt.forth
|
|
136
|
+
},
|
|
137
|
+
(w, { direction: M }) => /* @__PURE__ */ p.createElement(
|
|
138
|
+
Ot,
|
|
139
|
+
{
|
|
140
|
+
views: S,
|
|
141
|
+
location: at,
|
|
142
|
+
render: (V) => A(V, w, M)
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
)
|
|
146
|
+
));
|
|
147
|
+
}, be = ye, we = k(ft)`
|
|
148
|
+
${(e) => !!e.scrollableCss && e.scrollableCss}
|
|
149
|
+
`, ve = (n) => {
|
|
150
|
+
var s = n, { className: e = "" } = s, t = N(s, ["className"]);
|
|
151
|
+
const o = gt(), i = st(), r = W(), c = ot(), { views: a } = r.get("$settings"), { gap: u = "0" } = i, y = o, { columns: d = 1, animation: l = "none", scrollable: h = !1 } = y, m = N(y, ["columns", "animation", "scrollable"]), [g, b] = yt(h);
|
|
152
|
+
return c ? /* @__PURE__ */ p.createElement(
|
|
153
|
+
we,
|
|
154
|
+
C(f(f({}, t), m), {
|
|
155
|
+
scrollableCss: g,
|
|
156
|
+
ref: b,
|
|
157
|
+
columns: d,
|
|
158
|
+
gap: u,
|
|
159
|
+
className: Y(e, "humany-view")
|
|
160
|
+
}),
|
|
161
|
+
/* @__PURE__ */ p.createElement(
|
|
162
|
+
Ot,
|
|
163
|
+
{
|
|
164
|
+
views: a,
|
|
165
|
+
render: (E) => {
|
|
166
|
+
const $ = c.getChildren(E)[0];
|
|
167
|
+
return /* @__PURE__ */ p.createElement(it, { id: $.id, node: $, branch: "default" });
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
)
|
|
171
|
+
) : null;
|
|
172
|
+
}, Ee = ve, Z = (e) => {
|
|
173
|
+
var t, n;
|
|
174
|
+
return vt`
|
|
175
|
+
outline: none;
|
|
176
|
+
box-sizing: border-box;
|
|
177
|
+
* {
|
|
178
|
+
box-sizing: border-box;
|
|
179
|
+
outline: none;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
grid-column: ${e["data-indent"] ? `${e["data-indent"] + 1} / ${e["data-indent"] + (e["data-width"] || 0) + 1}` : `span ${e["data-width"]}`};
|
|
183
|
+
|
|
184
|
+
${((t = e.theme.fonts) == null ? void 0 : t.type) && `
|
|
185
|
+
font-family: ${e.theme.fonts.type};
|
|
186
|
+
|
|
187
|
+
input, textarea {
|
|
188
|
+
font-family: ${e.theme.fonts.type};
|
|
189
|
+
}
|
|
190
|
+
`}
|
|
191
|
+
|
|
192
|
+
${((n = e.theme.fonts) == null ? void 0 : n.base) && `
|
|
193
|
+
font-size: ${e.theme.fonts.base};
|
|
194
|
+
`}
|
|
195
|
+
|
|
196
|
+
&:focus-visible {
|
|
197
|
+
${Lt(e)};
|
|
198
|
+
}
|
|
199
|
+
`;
|
|
200
|
+
}, Ce = k(Ee)`
|
|
201
|
+
${(e) => Z(e)}
|
|
202
|
+
`, Oe = k(be)`
|
|
203
|
+
${(e) => Z(e)}
|
|
204
|
+
`, xe = k.div`
|
|
205
|
+
text-align: center;
|
|
206
|
+
${(e) => {
|
|
207
|
+
var t, n, s;
|
|
208
|
+
return typeof ((t = e.theme.colors) == null ? void 0 : t.warning) != "undefined" && vt`
|
|
209
|
+
color: ${(n = e.theme.colors) == null ? void 0 : n.warning};
|
|
210
|
+
border: 2px dashed ${(s = e.theme.colors) == null ? void 0 : s.warning};
|
|
211
|
+
`;
|
|
212
|
+
}}
|
|
213
|
+
${(e) => typeof e.theme.borderRadius != "undefined" && `border-radius: ${e.theme.borderRadius};`}
|
|
214
|
+
${(e) => Z(e)}
|
|
215
|
+
`, $e = wt(
|
|
216
|
+
(o, s) => {
|
|
217
|
+
var i = o, { className: e = "", children: t } = i, n = N(i, ["className", "children"]);
|
|
218
|
+
const r = _t(), { name: c, type: a, id: u } = kt(), d = Ft(() => r ? k(r)`
|
|
219
|
+
${Z}
|
|
220
|
+
${Rt}
|
|
221
|
+
` : null, [r]);
|
|
222
|
+
return typeof r == "undefined" ? null : r === null || d === null ? process.env.NODE_ENV !== "production" ? /* @__PURE__ */ p.createElement(
|
|
223
|
+
xe,
|
|
224
|
+
C(f({}, n), {
|
|
225
|
+
title: `type: ${a}, definition-id: ${c}, instance-id: ${u}`,
|
|
226
|
+
className: Y(e, "humany-non-resolved-component")
|
|
227
|
+
}),
|
|
228
|
+
/* @__PURE__ */ p.createElement(Vt, { variant: "h5" }, "Non Resolved Component Type")
|
|
229
|
+
) : null : /* @__PURE__ */ p.createElement(Gt, { fallback: null }, /* @__PURE__ */ p.createElement(
|
|
230
|
+
d,
|
|
231
|
+
C(f({
|
|
232
|
+
ref: s
|
|
233
|
+
}, n), {
|
|
234
|
+
className: Y(
|
|
235
|
+
e,
|
|
236
|
+
"humany-component",
|
|
237
|
+
`humany-component-${c}`
|
|
238
|
+
)
|
|
239
|
+
}),
|
|
240
|
+
t
|
|
241
|
+
));
|
|
242
|
+
}
|
|
243
|
+
), Se = $e, Ae = (e) => {
|
|
244
|
+
const t = ot(e), n = bt(), [s, o] = B({}), i = It();
|
|
245
|
+
return j(() => {
|
|
246
|
+
t && i.current && o(t.attributes.properties);
|
|
247
|
+
}, [t, e, i]), j(() => {
|
|
248
|
+
if (n) {
|
|
249
|
+
const r = n.events.subscribe(
|
|
250
|
+
"components:properties-changed",
|
|
251
|
+
(c, a) => {
|
|
252
|
+
t === a.node && i.current && o(a.node.attributes.properties);
|
|
253
|
+
}
|
|
254
|
+
);
|
|
255
|
+
return () => {
|
|
256
|
+
r();
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
}, [n, i, e, t]), s;
|
|
260
|
+
}, De = (e, t) => t ? !0 : typeof e == "string" ? e === "full" : e > 0, Me = wt(
|
|
261
|
+
(u, a) => {
|
|
262
|
+
var d = u, { className: e = "", id: t, branch: n, node: s, ariaLabel: o, tabIndex: i, context: r } = d, c = N(d, ["className", "id", "branch", "node", "ariaLabel", "tabIndex", "context"]);
|
|
263
|
+
const l = bt(), h = W(), [m, g] = B(), b = Tt(), y = st(t), E = Ae(t), { size: $ = "none", indent: F = 0 } = zt(t), L = De($, s);
|
|
264
|
+
if (j(() => {
|
|
265
|
+
if (l) {
|
|
266
|
+
if (t && !s) {
|
|
267
|
+
const x = l.nodes.get(t);
|
|
268
|
+
if (x && (g(U(x, n)), L)) {
|
|
269
|
+
const z = x.mount(h);
|
|
270
|
+
return () => {
|
|
271
|
+
z();
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
} else if (s) {
|
|
275
|
+
g(U(s, n));
|
|
276
|
+
const x = s.mount(h);
|
|
277
|
+
return () => {
|
|
278
|
+
x();
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}, [l, t, s, L]), !m || !L)
|
|
283
|
+
return null;
|
|
284
|
+
const V = f(f({}, y), r || {}), {
|
|
285
|
+
cardinal: S,
|
|
286
|
+
fonts: A = {},
|
|
287
|
+
accessibility: J = {}
|
|
288
|
+
} = V, G = N(V, [
|
|
289
|
+
"cardinal",
|
|
290
|
+
"fonts",
|
|
291
|
+
"accessibility"
|
|
292
|
+
]), w = {
|
|
293
|
+
type: A.type,
|
|
294
|
+
base: A.base || "16px",
|
|
295
|
+
small: A.small || "0.8em",
|
|
296
|
+
normal: A.normal || "1em",
|
|
297
|
+
medium: A.medium || "1.2em",
|
|
298
|
+
large: A.large || "1.6em",
|
|
299
|
+
huge: A.huge || "2.5em"
|
|
300
|
+
}, M = C(f({}, G), {
|
|
301
|
+
fonts: w,
|
|
302
|
+
accessibility: f({}, J)
|
|
303
|
+
});
|
|
304
|
+
return typeof S == "number" && (M.sizes = {
|
|
305
|
+
cardinal: S,
|
|
306
|
+
small: `${S}px`,
|
|
307
|
+
normal: `${S * 3}px`,
|
|
308
|
+
medium: `${S * 5}px`,
|
|
309
|
+
large: `${S * 8}px`
|
|
310
|
+
}), /* @__PURE__ */ p.createElement(Ht, { theme: M }, /* @__PURE__ */ p.createElement(Bt.Provider, { value: m }, /* @__PURE__ */ p.createElement(jt.Provider, { value: E }, (() => {
|
|
311
|
+
const x = f({
|
|
312
|
+
"data-width": $ === "full" ? b : Math.min($, b),
|
|
313
|
+
"data-indent": F,
|
|
314
|
+
"data-name": m.name,
|
|
315
|
+
"data-node-id": m.id,
|
|
316
|
+
"data-component-type": m.type,
|
|
317
|
+
"aria-label": o,
|
|
318
|
+
tabIndex: i,
|
|
319
|
+
id: m.id,
|
|
320
|
+
role: E && E.role
|
|
321
|
+
}, c);
|
|
322
|
+
switch (m.type) {
|
|
323
|
+
case "view":
|
|
324
|
+
return typeof E.animation == "string" && E.animation !== "none" ? /* @__PURE__ */ p.createElement(Oe, C(f({}, x), { className: e })) : /* @__PURE__ */ p.createElement(Ce, C(f({}, x), { className: e }));
|
|
325
|
+
default: {
|
|
326
|
+
const z = Wt(E);
|
|
327
|
+
return /* @__PURE__ */ p.createElement(
|
|
328
|
+
Se,
|
|
329
|
+
C(f(f({
|
|
330
|
+
ref: a
|
|
331
|
+
}, x), z), {
|
|
332
|
+
className: e
|
|
333
|
+
})
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
})())));
|
|
338
|
+
}
|
|
339
|
+
), it = Me, Ne = ({ builder: e }) => {
|
|
340
|
+
const t = W(), [n, s] = B(null);
|
|
341
|
+
return j(() => {
|
|
342
|
+
t.getAsync("components").then((o) => e(o).then((i) => {
|
|
343
|
+
s(i);
|
|
344
|
+
}));
|
|
345
|
+
}, []), j(() => () => {
|
|
346
|
+
n && t.getAsync("components").then((o) => {
|
|
347
|
+
o.nodes.detached = o.nodes.detached.filter(
|
|
348
|
+
(i) => i.id !== n.id
|
|
349
|
+
);
|
|
350
|
+
});
|
|
351
|
+
}, [n]), n ? /* @__PURE__ */ p.createElement(it, { id: n.id, node: n, branch: "default" }) : null;
|
|
352
|
+
}, Pe = Ne, Le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
353
|
+
__proto__: null,
|
|
354
|
+
default: Pe
|
|
355
|
+
}, Symbol.toStringTag, { value: "Module" })), _e = p.lazy(() => Promise.resolve().then(() => Le)), ke = ({ showSearch: e = !1 }) => {
|
|
356
|
+
const t = qt(), n = W();
|
|
357
|
+
return /* @__PURE__ */ p.createElement(p.Suspense, { fallback: null }, /* @__PURE__ */ p.createElement(
|
|
358
|
+
_e,
|
|
359
|
+
{
|
|
360
|
+
builder: (s) => n.get("settings").then((o) => {
|
|
361
|
+
var u;
|
|
362
|
+
const { properties: i, context: r } = Object.keys(o.components).reduce(
|
|
363
|
+
(d, l) => (o.components[l].type === "not-found" && (d.properties = o.components[l].properties, d.context = o.components[l].context), d),
|
|
364
|
+
{ properties: {}, context: {} }
|
|
365
|
+
);
|
|
366
|
+
i.showSearch = e;
|
|
367
|
+
const c = s.createNode("area", { detached: !0 });
|
|
368
|
+
if (c.name = "not-found-area", c.writeLayout({
|
|
369
|
+
size: "full"
|
|
370
|
+
}), e) {
|
|
371
|
+
const d = Object.keys(o.components).reduce(
|
|
372
|
+
(h, m) => o.components[m].type === "search" ? o.components[m].properties : h,
|
|
373
|
+
{}
|
|
374
|
+
), l = s.createNode("search", { detached: !0 });
|
|
375
|
+
l.writeLayout({ size: "full" }), l.writeProperties(f({
|
|
376
|
+
"css-margin-bottom": ((u = t == null ? void 0 : t.sizes) == null ? void 0 : u.normal) || "15px"
|
|
377
|
+
}, d)), c.appendChild(l);
|
|
378
|
+
}
|
|
379
|
+
const a = s.createNode("not-found", { detached: !0 });
|
|
380
|
+
return a.writeLayout({ size: "full" }), a.writeProperties(i), a.writeContext(r), c.appendChild(a), c;
|
|
381
|
+
})
|
|
382
|
+
}
|
|
383
|
+
));
|
|
384
|
+
}, vn = ke, Re = (e) => {
|
|
385
|
+
class t extends e {
|
|
386
|
+
requestInstance(s) {
|
|
387
|
+
const o = new CustomEvent("request-instance", {
|
|
388
|
+
detail: { key: s },
|
|
389
|
+
bubbles: !0,
|
|
390
|
+
composed: !0,
|
|
391
|
+
cancelable: !0
|
|
392
|
+
});
|
|
393
|
+
return this.dispatchEvent(o), o.detail.instance;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
return t;
|
|
397
|
+
};
|
|
398
|
+
var Ve = Object.defineProperty, Ie = Object.getOwnPropertyDescriptor, R = (e, t, n, s) => {
|
|
399
|
+
for (var o = s > 1 ? void 0 : s ? Ie(t, n) : t, i = e.length - 1, r; i >= 0; i--)
|
|
400
|
+
(r = e[i]) && (o = (s ? r(t, n, o) : r(o)) || o);
|
|
401
|
+
return s && o && Ve(t, n, o), o;
|
|
402
|
+
};
|
|
403
|
+
const Te = (e) => `w-${e}`, pt = (e = "none", t = 1) => e === "full" ? t : Math.min(e, t);
|
|
404
|
+
let D = class extends Re(se) {
|
|
405
|
+
constructor() {
|
|
406
|
+
super(...arguments), this.listeners = [], this.branch = "default", this._descriptor = null, this._properties = {}, this._context = {}, this._layout = {};
|
|
407
|
+
}
|
|
408
|
+
connectedCallback() {
|
|
409
|
+
super.connectedCallback(), this.container = this.requestInstance("container"), this.container && Promise.all([
|
|
410
|
+
Et.getInstance(this.container),
|
|
411
|
+
this.container.getAsync("componentResolver")
|
|
412
|
+
]).then((e) => {
|
|
413
|
+
const t = e[0], n = e[1], s = t.nodes.get(this.nodeId || "");
|
|
414
|
+
if (s) {
|
|
415
|
+
this._descriptor = U(s, this.branch), this._properties = s.attributes.properties, this._context = s.attributes.context, this._layout = s.attributes.layout;
|
|
416
|
+
const o = this.style.getPropertyValue("--columns") ? +this.style.getPropertyValue("--columns") : 1, i = pt(this._layout.size, o), r = typeof this._layout.indent != "undefined" ? `${this._layout.indent + 1} / ${this._layout.indent + (i || 0) + 1}` : `span ${i}`;
|
|
417
|
+
this.style.setProperty("--gridColumn", r), this.listeners.push(
|
|
418
|
+
t.events.subscribe(
|
|
419
|
+
"components:properties-changed",
|
|
420
|
+
(d, l) => {
|
|
421
|
+
var h;
|
|
422
|
+
this.nodeId === ((h = l.node) == null ? void 0 : h.id) && (this._properties = l.node.attributes.properties);
|
|
423
|
+
}
|
|
424
|
+
)
|
|
425
|
+
), this.listeners.push(
|
|
426
|
+
t.events.subscribe("components:context-changed", (d, l) => {
|
|
427
|
+
var h;
|
|
428
|
+
this.nodeId === ((h = l.node) == null ? void 0 : h.id) && (this._context = l.node.attributes.context);
|
|
429
|
+
})
|
|
430
|
+
), this.listeners.push(
|
|
431
|
+
t.events.subscribe("components:layout-changed", (d, l) => {
|
|
432
|
+
var h;
|
|
433
|
+
this.nodeId === ((h = l.node) == null ? void 0 : h.id) && (this._layout = l.node.attributes.layout);
|
|
434
|
+
})
|
|
435
|
+
);
|
|
436
|
+
const c = s.mount(this.container);
|
|
437
|
+
if (this.listeners.push(c), !n) {
|
|
438
|
+
console.warn(
|
|
439
|
+
"Could not find resolver. Make sure it is registered on the container."
|
|
440
|
+
);
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
const a = Te(this._descriptor.type);
|
|
444
|
+
if (customElements.get(a))
|
|
445
|
+
return;
|
|
446
|
+
const u = n.getComponent(this._descriptor.type);
|
|
447
|
+
if (!u) {
|
|
448
|
+
console.warn("Component is missing or using incorrect import.");
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
return u().then((d) => {
|
|
452
|
+
customElements.get(a) || customElements.define(a, d.default);
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
disconnectedCallback() {
|
|
458
|
+
this.listeners.forEach((e) => {
|
|
459
|
+
e();
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
mapProps() {
|
|
463
|
+
var t;
|
|
464
|
+
const e = this.style.getPropertyValue("--columns") ? +this.style.getPropertyValue("--columns") : 1;
|
|
465
|
+
return Object.entries(this._properties).reduce(
|
|
466
|
+
(n, [s, o]) => (typeof o == "object" ? n[`.${s}`] = o : n[s] = o, n),
|
|
467
|
+
{
|
|
468
|
+
"data-width": pt(this._layout.size, e),
|
|
469
|
+
"data-indent": (t = this._layout.indent) != null ? t : 0,
|
|
470
|
+
id: this._descriptor.id,
|
|
471
|
+
"data-name": this._descriptor.name,
|
|
472
|
+
"data-component-type": this._descriptor.type,
|
|
473
|
+
"data-node-id": this.nodeId
|
|
474
|
+
}
|
|
475
|
+
);
|
|
476
|
+
}
|
|
477
|
+
render() {
|
|
478
|
+
if (!this._descriptor)
|
|
479
|
+
return ee;
|
|
480
|
+
const e = `w-${this._descriptor.type}`, t = this.mapProps();
|
|
481
|
+
return ie`
|
|
482
|
+
<${re(e)}
|
|
483
|
+
${te(t)}
|
|
484
|
+
.layout=${this._layout}
|
|
485
|
+
.context=${this._context}
|
|
486
|
+
/>
|
|
487
|
+
`;
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
D.styles = [
|
|
491
|
+
ne`
|
|
492
|
+
:host {
|
|
493
|
+
outline: none;
|
|
494
|
+
box-sizing: border-box;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
* {
|
|
498
|
+
box-sizing: border-box;
|
|
499
|
+
outline: none;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
grid-column: var(--gridColumn);
|
|
503
|
+
`
|
|
504
|
+
];
|
|
505
|
+
R([
|
|
506
|
+
Ct({ type: String })
|
|
507
|
+
], D.prototype, "nodeId", 2);
|
|
508
|
+
R([
|
|
509
|
+
Ct({ type: String })
|
|
510
|
+
], D.prototype, "branch", 2);
|
|
511
|
+
R([
|
|
512
|
+
Q()
|
|
513
|
+
], D.prototype, "_descriptor", 2);
|
|
514
|
+
R([
|
|
515
|
+
Q()
|
|
516
|
+
], D.prototype, "_properties", 2);
|
|
517
|
+
R([
|
|
518
|
+
Q()
|
|
519
|
+
], D.prototype, "_context", 2);
|
|
520
|
+
R([
|
|
521
|
+
Q()
|
|
522
|
+
], D.prototype, "_layout", 2);
|
|
523
|
+
D = R([
|
|
524
|
+
oe("widget-component")
|
|
525
|
+
], D);
|
|
526
|
+
const ze = (e) => `w-${e}`, En = (e, t, n) => dt(void 0, null, function* () {
|
|
527
|
+
const s = n.nodes.get(e);
|
|
528
|
+
if (!t) {
|
|
529
|
+
console.warn("Could not find resolver. Make sure it is registered on the container.");
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
if (!s) {
|
|
533
|
+
console.warn(`Unable to find node with id: ${e}`);
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
const o = U(s);
|
|
537
|
+
if (!(o != null && o.type)) {
|
|
538
|
+
console.warn(`Could not get descriptor for: ${s.name}`);
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
const i = ze(o.type);
|
|
542
|
+
if (customElements.get(i))
|
|
543
|
+
return;
|
|
544
|
+
const r = t.getComponent(o.type);
|
|
545
|
+
if (!r) {
|
|
546
|
+
console.warn("Component is missing or using incorrect import.");
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
const c = yield r();
|
|
550
|
+
if (!customElements.get(i))
|
|
551
|
+
try {
|
|
552
|
+
customElements.define(i, c.default);
|
|
553
|
+
} catch (a) {
|
|
554
|
+
console.log("error", a);
|
|
555
|
+
}
|
|
556
|
+
return customElements.whenDefined(i).then(() => ({
|
|
557
|
+
nodeId: e,
|
|
558
|
+
tag: i
|
|
559
|
+
}));
|
|
560
|
+
}), Be = (e) => {
|
|
561
|
+
if (e) {
|
|
562
|
+
const { type: t, content: n } = e;
|
|
563
|
+
switch (t) {
|
|
564
|
+
case "FontAwesome":
|
|
565
|
+
return `<i class="humany-icon fa fa-${n}"></i>`;
|
|
566
|
+
case "Uri":
|
|
567
|
+
return `<i class="humany-icon humany-custom-icon" style="background: url(${n}) no-repeat center center;background-size: contain;"></i>`;
|
|
568
|
+
default:
|
|
569
|
+
return "";
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
}, je = (e) => {
|
|
573
|
+
const t = (o, i) => {
|
|
574
|
+
!o || (i ? o.classList.add("humany-tabbing") : o.classList.remove("humany-tabbing"));
|
|
575
|
+
}, n = (o) => {
|
|
576
|
+
o.key === "Tab" ? t(e, !0) : o.key === "Enter" && document.activeElement && document.activeElement.classList.contains("humany-trigger") || t(e, !1);
|
|
577
|
+
}, s = (o) => {
|
|
578
|
+
document.activeElement && document.activeElement.classList.contains("humany-trigger") && document.activeElement.classList.contains("humany-tabbing") || t(e, !1);
|
|
579
|
+
};
|
|
580
|
+
return document.addEventListener("keydown", n), document.addEventListener("click", s), () => {
|
|
581
|
+
document.removeEventListener("keydown", n), document.removeEventListener("click", s);
|
|
582
|
+
};
|
|
583
|
+
};
|
|
584
|
+
function We(e, t) {
|
|
585
|
+
const { symbol: n, widgetName: s, label: o = "", ariaLabel: i = "", tooltip: r = "" } = t;
|
|
586
|
+
e.classList.add("humany-trigger"), e.classList.add(`humany_${s}`), o.length && e.classList.add("humany-has-text"), i.length && !e.getAttribute("aria-label") && e.setAttribute("aria-label", i), i.length && !e.getAttribute("tabindex") && e.setAttribute("tabindex", "0"), r.length && !e.getAttribute("title") && e.setAttribute("title", r);
|
|
587
|
+
const c = Be(n) || "";
|
|
588
|
+
return e.innerHTML = `${c}
|
|
589
|
+
<span class="humany-close">
|
|
590
|
+
<svg width="18" height="9" viewBox="0 0 18 9" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
591
|
+
<path d="M9 9C8.81794 9.00045 8.63759 8.96634 8.46939 8.89965C8.3012 8.83295 8.14851 8.735 8.02015 8.61145L0.194523 1.12367C0.068294 0.99862 -0.00155266 0.831133 2.61958e-05 0.657285C0.00160506 0.483436 0.0744832 0.317136 0.202964 0.194202C0.331445 0.0712675 0.505249 0.00153576 0.686941 2.50649e-05C0.868634 -0.00148563 1.04368 0.0653456 1.17437 0.186125L9 7.6739L16.8256 0.186125C16.9563 0.0653456 17.1314 -0.00148563 17.3131 2.50649e-05C17.4948 0.00153576 17.6686 0.0712675 17.797 0.194202C17.9255 0.317136 17.9984 0.483436 18 0.657285C18.0016 0.831133 17.9317 0.99862 17.8055 1.12367L9.97985 8.61145C9.85149 8.735 9.6988 8.83295 9.53061 8.89965C9.36241 8.96634 9.18206 9.00045 9 9Z" fill="white"/>
|
|
592
|
+
</svg>
|
|
593
|
+
</span>
|
|
594
|
+
<span class="humany-loader">
|
|
595
|
+
<svg viewBox="25 25 50 50">
|
|
596
|
+
<circle
|
|
597
|
+
cx="50"
|
|
598
|
+
cy="50"
|
|
599
|
+
r="20"
|
|
600
|
+
fill="none"
|
|
601
|
+
stroke="#000"
|
|
602
|
+
stroke-width="2"
|
|
603
|
+
stroke-miterlimit="10" />
|
|
604
|
+
</svg>
|
|
605
|
+
</span>
|
|
606
|
+
${o.length ? `<span>${o}</span>` : ""}`, setTimeout(() => e && e.classList.add("humany-rendered")), je(e);
|
|
607
|
+
}
|
|
608
|
+
function Fe(e, t) {
|
|
609
|
+
e instanceof HTMLElement ? (t && e.setAttribute("title", t), e.classList.remove("humany-active"), e.classList.remove("humany-loading")) : e instanceof Array && e.forEach((n) => {
|
|
610
|
+
t && n.setAttribute("title", t), n.classList.remove("humany-active"), n.classList.remove("humany-loading");
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
function Ge(e) {
|
|
614
|
+
e instanceof HTMLElement ? (e.classList.remove("humany-active"), e.classList.add("humany-loading")) : e instanceof Array && e.forEach((t) => {
|
|
615
|
+
t.classList.remove("humany-active"), t.classList.add("humany-loading");
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
function xt(e, t) {
|
|
619
|
+
e instanceof HTMLElement ? (t && e.setAttribute("title", t), e.classList.add("humany-active"), e.classList.remove("humany-loading")) : e instanceof Array && e.forEach((n) => {
|
|
620
|
+
t && n.setAttribute("title", t), n.classList.add("humany-active"), n.classList.remove("humany-loading");
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
var _ = /* @__PURE__ */ ((e) => (e.Inline = "inline", e.Link = "link", e.Badge = "badge", e.Unsupported = "unsupported", e))(_ || {});
|
|
624
|
+
const He = (e, t) => e && t ? "both" : e ? "widgetDOM" : t ? "triggerDOM" : "none", $t = (e) => e ? typeof e == "boolean" && e ? "link" : typeof e == "object" && !Array.isArray(e) ? "badge" : "unsupported" : "inline", qe = (e, t, n, s, o = !1) => {
|
|
625
|
+
var u, d;
|
|
626
|
+
const i = He(
|
|
627
|
+
t,
|
|
628
|
+
n
|
|
629
|
+
), r = $t(s), c = {
|
|
630
|
+
widgetDOMElement: t ? t.cloneNode(!0) : void 0,
|
|
631
|
+
triggerDOMElement: n ? n.cloneNode(!0) : void 0
|
|
632
|
+
}, a = {
|
|
633
|
+
triggerType: r,
|
|
634
|
+
cachedOriginals: c,
|
|
635
|
+
widgetDOMElement: document.createElement("div")
|
|
636
|
+
};
|
|
637
|
+
switch (i) {
|
|
638
|
+
case "both": {
|
|
639
|
+
a.widgetDOMElement = t || document.createElement("div"), r !== "inline" && (a.triggerDOMElement = n);
|
|
640
|
+
break;
|
|
641
|
+
}
|
|
642
|
+
case "widgetDOM": {
|
|
643
|
+
if (a.widgetDOMElement = t || document.createElement("div"), r !== "inline") {
|
|
644
|
+
const l = document.body.appendChild(document.createElement("a"));
|
|
645
|
+
r === "link" && (l.innerText = e), a.triggerDOMElement = l;
|
|
646
|
+
}
|
|
647
|
+
break;
|
|
648
|
+
}
|
|
649
|
+
case "triggerDOM": {
|
|
650
|
+
const l = document.createElement("div");
|
|
651
|
+
a.widgetDOMElement = l, r === "inline" ? (l.id = (n == null ? void 0 : n.id) || "", o ? (l.style.display = "none", (u = n == null ? void 0 : n.parentNode) == null || u.appendChild(l), a.callback = () => {
|
|
652
|
+
var h;
|
|
653
|
+
(h = n == null ? void 0 : n.parentNode) == null || h.replaceChild(
|
|
654
|
+
l,
|
|
655
|
+
n
|
|
656
|
+
), l.style.display = (n == null ? void 0 : n.style.display) || "block";
|
|
657
|
+
}) : (d = n == null ? void 0 : n.parentNode) == null || d.replaceChild(
|
|
658
|
+
l,
|
|
659
|
+
n
|
|
660
|
+
), a.cachedOriginals.widgetDOMElement = n, a.cachedOriginals.triggerDOMElement = void 0) : (a.widgetDOMElement = document.body.appendChild(l), a.triggerDOMElement = n);
|
|
661
|
+
break;
|
|
662
|
+
}
|
|
663
|
+
case "none": {
|
|
664
|
+
const l = document.body.appendChild(document.createElement("div"));
|
|
665
|
+
if (a.widgetDOMElement = l, r !== "inline") {
|
|
666
|
+
const h = document.body.appendChild(document.createElement("a"));
|
|
667
|
+
r === "link" && (h.innerText = e), a.triggerDOMElement = h;
|
|
668
|
+
}
|
|
669
|
+
break;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
return a;
|
|
673
|
+
}, Ke = "modals";
|
|
674
|
+
class Ue {
|
|
675
|
+
constructor(t, n) {
|
|
676
|
+
this.options = n, this.unsubscribe = [], this.container = t.createChild(this), this.container.register("widgetDOMElement", this.options.widgetDOMElement), this.container.register("triggerDOMElement", this.options.triggerDOMElement);
|
|
677
|
+
const s = this.container.get("$widget");
|
|
678
|
+
this.options.widgetDOMElement.classList.add("humany-widget"), this.options.widgetDOMElement.classList.add(`humany_${s.name}`);
|
|
679
|
+
const o = t.get("widgetDOMElements") || [];
|
|
680
|
+
t.register("widgetDOMElements", [
|
|
681
|
+
...o,
|
|
682
|
+
this.options.widgetDOMElement
|
|
683
|
+
]);
|
|
684
|
+
}
|
|
685
|
+
render() {
|
|
686
|
+
const { widgetDOMElement: t, triggerDOMElement: n } = this.options, s = this.container.get("$widget");
|
|
687
|
+
return t.getAttribute("data-rendered") === "true" ? Promise.resolve() : (n && this.options.triggerType === _.Badge && Ge(n), import("./render.4f979aa1.js").then((o) => o.default(s.name, this.container, t)).then(() => {
|
|
688
|
+
if (t.setAttribute("data-rendered", "true"), n && this.options.triggerType === _.Badge) {
|
|
689
|
+
const i = this.options.triggerOptions.openTooltip;
|
|
690
|
+
xt(n, i);
|
|
691
|
+
}
|
|
692
|
+
Yt(this.container, t);
|
|
693
|
+
const o = this.container.get("$environment").widgets.all();
|
|
694
|
+
P(
|
|
695
|
+
this.container,
|
|
696
|
+
Ke,
|
|
697
|
+
v.Session
|
|
698
|
+
).then((i) => {
|
|
699
|
+
i && i.forEach((r) => {
|
|
700
|
+
o.find(
|
|
701
|
+
(c) => c.name === r.name && c.state === "activated"
|
|
702
|
+
) && s.events.dispatch("widget:modal-opened", r);
|
|
703
|
+
});
|
|
704
|
+
});
|
|
705
|
+
}));
|
|
706
|
+
}
|
|
707
|
+
renderBadge(t) {
|
|
708
|
+
const { triggerDOMElement: n } = this.options;
|
|
709
|
+
if (!n)
|
|
710
|
+
return;
|
|
711
|
+
n.getAttribute("role") || n.setAttribute("role", "button");
|
|
712
|
+
const { name: s } = this.container.get("$widget"), { label: o, symbol: i, ariaLabel: r, closedTooltip: c, openTooltip: a } = t, u = { closedTooltip: c, openTooltip: a };
|
|
713
|
+
this.options.triggerOptions = u;
|
|
714
|
+
const d = We(n, {
|
|
715
|
+
label: o,
|
|
716
|
+
symbol: i,
|
|
717
|
+
ariaLabel: r,
|
|
718
|
+
widgetName: s,
|
|
719
|
+
tooltip: c
|
|
720
|
+
});
|
|
721
|
+
this.unsubscribe.push(d);
|
|
722
|
+
}
|
|
723
|
+
dispose() {
|
|
724
|
+
return import("./unmount.b0816844.js").then((t) => {
|
|
725
|
+
var o, i, r, c;
|
|
726
|
+
const { triggerDOMElement: n, widgetDOMElement: s } = this.options;
|
|
727
|
+
t.default(s), this.options.cachedOriginals.widgetDOMElement && s && ((o = s.parentNode) == null || o.replaceChild(
|
|
728
|
+
this.options.cachedOriginals.widgetDOMElement,
|
|
729
|
+
s
|
|
730
|
+
)), this.options.cachedOriginals.triggerDOMElement && n && ((i = n.parentNode) == null || i.replaceChild(
|
|
731
|
+
this.options.cachedOriginals.triggerDOMElement,
|
|
732
|
+
n
|
|
733
|
+
)), this.unsubscribe.forEach((a) => {
|
|
734
|
+
a();
|
|
735
|
+
}), (r = s.parentNode) == null || r.removeChild(s), (c = n == null ? void 0 : n.parentNode) == null || c.removeChild(n);
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
const q = "changesets", Ye = (e) => {
|
|
740
|
+
const t = { tags: e.tags };
|
|
741
|
+
return e.context && typeof e.context != "function" && (t.context = e.context), e.properties && typeof e.properties != "function" && (t.properties = e.properties), e.layout && typeof e.layout != "function" && (t.layout = e.layout), t;
|
|
742
|
+
};
|
|
743
|
+
class rt {
|
|
744
|
+
constructor(t, n) {
|
|
745
|
+
this.container = t, this.storageWriter = n;
|
|
746
|
+
}
|
|
747
|
+
static create(t) {
|
|
748
|
+
return I(t, q, T.Necessary, {
|
|
749
|
+
medium: v.Local
|
|
750
|
+
}).then((n) => new rt(t, n));
|
|
751
|
+
}
|
|
752
|
+
write(t, n, s, o) {
|
|
753
|
+
return X(this)(() => P(
|
|
754
|
+
this.container,
|
|
755
|
+
q,
|
|
756
|
+
v.Local
|
|
757
|
+
).then((i = {}) => {
|
|
758
|
+
const { keys: r = [], items: c = {} } = i, a = r.indexOf(t);
|
|
759
|
+
return a > -1 && r.splice(a, 1), r.push(t), c[t] = {
|
|
760
|
+
options: o,
|
|
761
|
+
attributes: Ye(s),
|
|
762
|
+
rules: n.rules
|
|
763
|
+
}, this.storageWriter({ keys: r, items: c });
|
|
764
|
+
}));
|
|
765
|
+
}
|
|
766
|
+
remove(t) {
|
|
767
|
+
return X(this)(() => P(
|
|
768
|
+
this.container,
|
|
769
|
+
q,
|
|
770
|
+
v.Local
|
|
771
|
+
).then((n = {}) => {
|
|
772
|
+
const { keys: s = [], items: o = {} } = n, i = s.indexOf(t);
|
|
773
|
+
if (i > -1)
|
|
774
|
+
return s.splice(i, 1), delete o[t], this.storageWriter(n);
|
|
775
|
+
}));
|
|
776
|
+
}
|
|
777
|
+
load(t) {
|
|
778
|
+
return X(this)(() => P(
|
|
779
|
+
this.container,
|
|
780
|
+
q,
|
|
781
|
+
v.Local
|
|
782
|
+
).then((n = {}) => {
|
|
783
|
+
const { keys: s = [], items: o = {} } = n;
|
|
784
|
+
s.forEach((i) => {
|
|
785
|
+
const r = o[i];
|
|
786
|
+
if (r) {
|
|
787
|
+
const { rules: c, attributes: a, options: u } = r;
|
|
788
|
+
t.write({
|
|
789
|
+
attributes: a,
|
|
790
|
+
options: u,
|
|
791
|
+
target: new Ut(t, c)
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
});
|
|
795
|
+
}));
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
const Qe = (e) => {
|
|
799
|
+
const { container: t } = e;
|
|
800
|
+
return rt.create(t).then((n) => {
|
|
801
|
+
const s = t.get("$settings"), o = { localStorage: n }, i = new Et(e, o), r = Kt(i, s);
|
|
802
|
+
return e.events.subscribe("widget:state-change", (c, a) => {
|
|
803
|
+
a.state === ue.Deactivating && r();
|
|
804
|
+
}), i;
|
|
805
|
+
});
|
|
806
|
+
}, Ze = (e) => import("@telia-ace/widget-routing").then(({ RoutingService: t, HistoryMode: n }) => e.get("settings").then((s) => {
|
|
807
|
+
const {
|
|
808
|
+
routing: { initialPath: o = "/", mode: i = n.scopedHash, basePath: r },
|
|
809
|
+
views: c
|
|
810
|
+
} = s;
|
|
811
|
+
return new t(e, {
|
|
812
|
+
initialPath: o,
|
|
813
|
+
mode: i,
|
|
814
|
+
routes: Object.keys(c).map((u) => ({
|
|
815
|
+
name: u,
|
|
816
|
+
path: c[u].path
|
|
817
|
+
})),
|
|
818
|
+
basePath: r
|
|
819
|
+
});
|
|
820
|
+
})), Je = (e) => import("@telia-ace/widget-services").then(({ StorageProvider: t }) => new t()), Xe = (e) => import("@telia-ace/widget-core").then(({ ActionResolver: t }) => new t(e)), tn = (e) => import("@telia-ace/widget-core").then(({ ComponentResolver: t }) => new t(e)), en = (e) => import("@telia-ace/widget-core").then(({ ComponentPlatform: t, createComponentModel: n }) => Qe(e.get("$widget"))), et = "$settings", K = "open", mt = "activeStickyWidget";
|
|
821
|
+
class Cn extends de {
|
|
822
|
+
constructor(t) {
|
|
823
|
+
super(t), this.outlets = /* @__PURE__ */ new Map(), this.activated = void 0, this.subs = [], this.handleBootstrapping = (n) => {
|
|
824
|
+
const s = {
|
|
825
|
+
triggerDOMElement: n.sourceDOMElement,
|
|
826
|
+
withRenderState: "storage"
|
|
827
|
+
};
|
|
828
|
+
this.container.get("settings").then((o) => {
|
|
829
|
+
const { activate: i } = o;
|
|
830
|
+
(typeof i == "undefined" || i === null || i === !0) && (this.activated = (this.activated || this.widget.activate()).then(
|
|
831
|
+
() => this.attach(s)
|
|
832
|
+
));
|
|
833
|
+
});
|
|
834
|
+
}, this.container.registerAsync("storage", () => Je(this.container)), this.container.registerFactory("settings", () => P(
|
|
835
|
+
this.container,
|
|
836
|
+
et,
|
|
837
|
+
v.Local
|
|
838
|
+
).then((n = {}) => f(f({}, this.container.get("$settings")), n))), le(this, "load", this.handleBootstrapping), this.container.registerAsync(
|
|
839
|
+
"componentResolver",
|
|
840
|
+
() => tn(this.container)
|
|
841
|
+
), this.container.registerAsync("router", () => Ze(this.container)), this.container.registerAsync("actionResolver", () => Xe(this.container)), this.container.register("matchMedia", window.matchMedia), this.container.registerAsync("components", () => en(this.container));
|
|
842
|
+
}
|
|
843
|
+
initialize() {
|
|
844
|
+
const t = this.container.getManyAsync(
|
|
845
|
+
"actionResolver",
|
|
846
|
+
"router",
|
|
847
|
+
"components"
|
|
848
|
+
);
|
|
849
|
+
return Promise.all([t, this.container.get("settings")]).then(
|
|
850
|
+
([{ actionResolver: n, router: s, components: o }, i]) => {
|
|
851
|
+
var a;
|
|
852
|
+
n.subscribe(
|
|
853
|
+
this.widget.name,
|
|
854
|
+
(u, d, l) => this.onAction(d, l)
|
|
855
|
+
);
|
|
856
|
+
const r = (u) => {
|
|
857
|
+
o.nodes.query({ type: "view" }).forEach((d) => {
|
|
858
|
+
o.setSwitch(d, u);
|
|
859
|
+
});
|
|
860
|
+
}, c = ((a = s.getInitialRoute()) == null ? void 0 : a.name) || "index";
|
|
861
|
+
return r(c), this.events.subscribe("widget:data-loaded", (u, { element: d }) => {
|
|
862
|
+
this.widget.container.get("seoConfiguration") && this.events.dispatch("widget:preloaded-replaced", {
|
|
863
|
+
element: d
|
|
864
|
+
});
|
|
865
|
+
}), this.events.subscribe(
|
|
866
|
+
"router:change",
|
|
867
|
+
(u, { previous: d = { routeData: {} }, next: l = { routeData: {} } }) => {
|
|
868
|
+
const { routeData: h } = d, { routeData: m } = l, g = Object.keys(i.views).reduce((b, y) => typeof i.views[y].path == "undefined" ? y : b, "");
|
|
869
|
+
!m.name && g ? r(g) : r(m.name), ht(h && h.params), ht(m && m.params), this.container.getAsync("actionResolver").then((b) => {
|
|
870
|
+
b.action(this.widget.name, "routeChange", {
|
|
871
|
+
next: m,
|
|
872
|
+
previous: h
|
|
873
|
+
});
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
), s.initialize();
|
|
877
|
+
}
|
|
878
|
+
);
|
|
879
|
+
}
|
|
880
|
+
attach(t = {}) {
|
|
881
|
+
return this.container.get("settings").then(({ trigger: n }) => {
|
|
882
|
+
var h, m;
|
|
883
|
+
const {
|
|
884
|
+
widgetDOMElement: s,
|
|
885
|
+
key: o = Qt(),
|
|
886
|
+
triggerDOMElement: i,
|
|
887
|
+
withRenderState: r
|
|
888
|
+
} = t, a = $t(n) === _.Inline && ((i == null ? void 0 : i.childElementCount) || 0) > 0, u = qe(
|
|
889
|
+
this.widget.name,
|
|
890
|
+
s,
|
|
891
|
+
i,
|
|
892
|
+
n,
|
|
893
|
+
a
|
|
894
|
+
);
|
|
895
|
+
this.outlets.size < 1 && !r && this.setRenderState("unset");
|
|
896
|
+
const d = () => {
|
|
897
|
+
const g = () => b.querySelectorAll("[data-loading=true]").length === 0, [b] = this.widget.container.get("widgetDOMElements"), y = (F, L) => {
|
|
898
|
+
g() && (u.callback && u.callback(), L.disconnect());
|
|
899
|
+
}, E = {
|
|
900
|
+
attributes: !0,
|
|
901
|
+
subtree: !0,
|
|
902
|
+
childList: !0
|
|
903
|
+
};
|
|
904
|
+
g() && u.callback && u.callback(), new MutationObserver(y).observe(b, E);
|
|
905
|
+
};
|
|
906
|
+
a && this.widget.container.getAsync("dataClient").then(({ events: g }) => {
|
|
907
|
+
g.subscribe("data-client:fetched", (b, y) => {
|
|
908
|
+
y.unresolvedQueries === 0 && d();
|
|
909
|
+
});
|
|
910
|
+
});
|
|
911
|
+
const l = this.getOrCreateViewOutlet(o, u);
|
|
912
|
+
if (this.outlets.set(o, l), this.widget.events.dispatch("widget:attached", {}, { bubbles: !0 }), u.triggerType === _.Badge && n && ((h = u.triggerDOMElement) == null || h.setAttribute("aria-expanded", "false"), l == null || l.renderBadge(n)), u.triggerType !== _.Inline && ((m = u.triggerDOMElement) == null || m.addEventListener("click", (g) => {
|
|
913
|
+
g.preventDefault(), this.container.get("settings").then(({ trigger: b }) => {
|
|
914
|
+
l.render().then(() => this.renderState()).then((y) => b && b.action && b.action === "hide" ? y === O.open ? this.hide() : this.open() : y === O.open ? this.close() : this.open());
|
|
915
|
+
});
|
|
916
|
+
})), this.outlets.size > 1)
|
|
917
|
+
return this.renderState().then((g) => {
|
|
918
|
+
this.triggerStateIfApplicable(g);
|
|
919
|
+
});
|
|
920
|
+
if (r)
|
|
921
|
+
return r === "storage" ? this.renderState().then((g) => {
|
|
922
|
+
if (u.triggerType === _.Inline) {
|
|
923
|
+
this.triggerStateIfApplicable("open");
|
|
924
|
+
return;
|
|
925
|
+
}
|
|
926
|
+
this.triggerStateIfApplicable(g);
|
|
927
|
+
}) : this.triggerStateIfApplicable(r);
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
detach(t) {
|
|
931
|
+
if (t) {
|
|
932
|
+
if (this.outlets.has(t)) {
|
|
933
|
+
const n = this.outlets.get(t);
|
|
934
|
+
n == null || n.dispose(), this.outlets.delete(t);
|
|
935
|
+
return;
|
|
936
|
+
}
|
|
937
|
+
process.env.NODE_ENV !== "production" && console.warn(`detach(): Could not find View Outlet with key ${t}`);
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
this.outlets.forEach((n) => {
|
|
941
|
+
n.dispose();
|
|
942
|
+
}), this.outlets.clear();
|
|
943
|
+
}
|
|
944
|
+
triggerStateIfApplicable(t) {
|
|
945
|
+
return this.container.getAsync("router").then((n) => {
|
|
946
|
+
switch (t) {
|
|
947
|
+
case "closed":
|
|
948
|
+
this.close();
|
|
949
|
+
break;
|
|
950
|
+
case "open":
|
|
951
|
+
this.open();
|
|
952
|
+
break;
|
|
953
|
+
case "hidden":
|
|
954
|
+
this.hide(), n.start();
|
|
955
|
+
break;
|
|
956
|
+
default:
|
|
957
|
+
return;
|
|
958
|
+
}
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
getOrCreateViewOutlet(t, n) {
|
|
962
|
+
return this.outlets.has(t) ? this.outlets.get(t) : new Ue(this.container, n);
|
|
963
|
+
}
|
|
964
|
+
render(t = {}) {
|
|
965
|
+
if (process.env.NODE_ENV !== "production" && console.warn("widget.render() is deprecated. Use widget.attach() instead."), t.open) {
|
|
966
|
+
const n = C(f({}, t), {
|
|
967
|
+
withRenderState: "open"
|
|
968
|
+
});
|
|
969
|
+
return this.attach(n);
|
|
970
|
+
}
|
|
971
|
+
return this.attach(t);
|
|
972
|
+
}
|
|
973
|
+
activate(t) {
|
|
974
|
+
t != null && t.override && this.setSettings(() => t.override), t != null && t.apiNotificationPriorityBy && this.container.register("apiNotificationPriorityBy", t.apiNotificationPriorityBy);
|
|
975
|
+
}
|
|
976
|
+
setSettings(t) {
|
|
977
|
+
return Promise.all([
|
|
978
|
+
this.container.get("settings"),
|
|
979
|
+
I(this.container, et, T.Necessary, {
|
|
980
|
+
medium: v.Local
|
|
981
|
+
})
|
|
982
|
+
]).then(([n, s]) => Promise.resolve(t(n)).then((o) => s(o).then(() => {
|
|
983
|
+
const i = f(f({}, n), o);
|
|
984
|
+
return this.widget.events.dispatch("widget:settings-updated", i), i;
|
|
985
|
+
})));
|
|
986
|
+
}
|
|
987
|
+
clearSettings() {
|
|
988
|
+
return I(
|
|
989
|
+
this.container,
|
|
990
|
+
et,
|
|
991
|
+
T.Necessary,
|
|
992
|
+
{ medium: v.Local }
|
|
993
|
+
).then((t) => t()).then(() => this.container.get("settings")).then((t) => {
|
|
994
|
+
this.widget.events.dispatch("widget:settings-updated", t);
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
action({ action: t, value: n }) {
|
|
998
|
+
return this.container.getAsync("actionResolver").then((s) => {
|
|
999
|
+
s.action(this.widget.name, t, n);
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
1002
|
+
renderState() {
|
|
1003
|
+
if (ae(this.container))
|
|
1004
|
+
return Promise.resolve(O.open);
|
|
1005
|
+
const t = () => P(
|
|
1006
|
+
this.container,
|
|
1007
|
+
K,
|
|
1008
|
+
v.Session
|
|
1009
|
+
).then((s = O.closed) => s), n = () => P(
|
|
1010
|
+
this.container,
|
|
1011
|
+
K,
|
|
1012
|
+
v.Session
|
|
1013
|
+
).then((s = O.closed) => s);
|
|
1014
|
+
return this.container.getAsync("router").then((s) => s.isSticky() ? n().then((o) => o === O.open ? o : t()) : t());
|
|
1015
|
+
}
|
|
1016
|
+
hide() {
|
|
1017
|
+
return this.outlets.size < 1 ? (process.env.NODE_ENV !== "production" && console.warn(
|
|
1018
|
+
"hide(): No-op as no view outlets are registered. Invoke the attach() command first."
|
|
1019
|
+
), Promise.resolve()) : (this.outlets.forEach((t) => t.render()), this.action({ action: "hide" }).then(() => {
|
|
1020
|
+
this.setTriggerState(!1);
|
|
1021
|
+
}));
|
|
1022
|
+
}
|
|
1023
|
+
open() {
|
|
1024
|
+
return this.outlets.size < 1 ? (process.env.NODE_ENV !== "production" && console.warn(
|
|
1025
|
+
"open(): No-op as no view outlets are registered. Invoke the attach() command first."
|
|
1026
|
+
), Promise.resolve()) : (this.outlets.forEach((t) => t.render()), this.action({ action: "open" }).then(() => (this.widget.events.dispatch("tracking:widget-rendered", {}), this.onOpen())));
|
|
1027
|
+
}
|
|
1028
|
+
close() {
|
|
1029
|
+
return this.outlets.size < 1 ? (process.env.NODE_ENV !== "production" && console.warn(
|
|
1030
|
+
"close(): No-op as no view outlets are registered. Invoke the attach() command first."
|
|
1031
|
+
), Promise.resolve()) : this.action({ action: "close" }).then(() => this.onClose());
|
|
1032
|
+
}
|
|
1033
|
+
show() {
|
|
1034
|
+
return process.env.NODE_ENV !== "production" && console.warn(
|
|
1035
|
+
"show(): Command is deprecated and will be removed in the future. Use open() instead."
|
|
1036
|
+
), this.open();
|
|
1037
|
+
}
|
|
1038
|
+
onAction(t, n) {
|
|
1039
|
+
switch (t) {
|
|
1040
|
+
case "close":
|
|
1041
|
+
case "open":
|
|
1042
|
+
case "hide":
|
|
1043
|
+
const s = t === "open" ? O.open : t === "close" ? O.closed : O.hidden;
|
|
1044
|
+
return this.setRenderState(s).then(() => {
|
|
1045
|
+
this.setTriggerState(s === O.open), s !== O.hidden ? s === O.open ? this.onOpen() : this.onClose() : this.outlets.forEach(
|
|
1046
|
+
(o) => {
|
|
1047
|
+
var i;
|
|
1048
|
+
return (i = o.options.triggerDOMElement) == null ? void 0 : i.setAttribute("aria-expanded", "false");
|
|
1049
|
+
}
|
|
1050
|
+
);
|
|
1051
|
+
});
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
setRenderState(t) {
|
|
1055
|
+
const { invoke: n, events: s } = this.container.get("$widget");
|
|
1056
|
+
return Promise.all([
|
|
1057
|
+
I(this.container, K, T.Necessary, {
|
|
1058
|
+
medium: v.Session
|
|
1059
|
+
}),
|
|
1060
|
+
I(this.container, K, T.Necessary, {
|
|
1061
|
+
medium: v.Local,
|
|
1062
|
+
duration: { minutes: 5 }
|
|
1063
|
+
}),
|
|
1064
|
+
this.container.getAsync("router"),
|
|
1065
|
+
n("renderState")
|
|
1066
|
+
]).then(([o, i, r, c]) => {
|
|
1067
|
+
t === "unset" || !t ? (i(), o()) : (r.isSticky() && i(t), o(t)), s.dispatch("widget:render-state-changed", {
|
|
1068
|
+
previous: c,
|
|
1069
|
+
next: t
|
|
1070
|
+
});
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
onOpen() {
|
|
1074
|
+
return this.container.getAsync("router").then((t) => (this.outlets.forEach(
|
|
1075
|
+
(n) => {
|
|
1076
|
+
var s;
|
|
1077
|
+
return (s = n.options.triggerDOMElement) == null ? void 0 : s.setAttribute("aria-expanded", "true");
|
|
1078
|
+
}
|
|
1079
|
+
), t.start()));
|
|
1080
|
+
}
|
|
1081
|
+
onClose() {
|
|
1082
|
+
const t = this.container.getManyAsync("router", "components");
|
|
1083
|
+
return (() => this.container.get("settings").then((s) => {
|
|
1084
|
+
const { activate: o } = this.container.get("$settings");
|
|
1085
|
+
return s.activate !== o ? this.setSettings(() => Promise.resolve({ activate: o })) : Promise.resolve();
|
|
1086
|
+
}))().then(() => t).then(
|
|
1087
|
+
({
|
|
1088
|
+
router: s,
|
|
1089
|
+
components: o
|
|
1090
|
+
}) => {
|
|
1091
|
+
const i = o.nodes.visible;
|
|
1092
|
+
return this.outlets.forEach(
|
|
1093
|
+
(r) => {
|
|
1094
|
+
var c;
|
|
1095
|
+
return (c = r.options.triggerDOMElement) == null ? void 0 : c.setAttribute("aria-expanded", "false");
|
|
1096
|
+
}
|
|
1097
|
+
), i.filter(
|
|
1098
|
+
(r) => r.attributes.properties.animation && r.attributes.properties.animation !== "none"
|
|
1099
|
+
).length ? new Promise((r) => {
|
|
1100
|
+
setTimeout(() => {
|
|
1101
|
+
r(s);
|
|
1102
|
+
}, 200);
|
|
1103
|
+
}) : Promise.resolve(s);
|
|
1104
|
+
}
|
|
1105
|
+
).then((s) => s.stop());
|
|
1106
|
+
}
|
|
1107
|
+
setTriggerState(t) {
|
|
1108
|
+
this.outlets.forEach((n) => {
|
|
1109
|
+
const {
|
|
1110
|
+
options: { triggerDOMElement: s, triggerOptions: o }
|
|
1111
|
+
} = n, { openTooltip: i, closedTooltip: r } = o || {};
|
|
1112
|
+
s && (t ? xt(s, i) : Fe(s, r));
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
deactivate() {
|
|
1116
|
+
this.subs.forEach((n) => n());
|
|
1117
|
+
const t = [];
|
|
1118
|
+
return this.outlets.forEach((n) => t.push(n.dispose())), P(
|
|
1119
|
+
this.container,
|
|
1120
|
+
mt,
|
|
1121
|
+
v.Local
|
|
1122
|
+
).then((n) => n === this.widget.name ? I(
|
|
1123
|
+
this.container,
|
|
1124
|
+
mt,
|
|
1125
|
+
T.Necessary,
|
|
1126
|
+
{
|
|
1127
|
+
medium: v.Local,
|
|
1128
|
+
scope: ce.Implementation
|
|
1129
|
+
}
|
|
1130
|
+
).then((s) => s()).then(() => Promise.all(t)) : Promise.all(t));
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
16
1133
|
export {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1134
|
+
it as Component,
|
|
1135
|
+
Pe as DetachedComponent,
|
|
1136
|
+
Cn as GridWidget,
|
|
1137
|
+
vn as NotFound,
|
|
1138
|
+
Cn as Widget,
|
|
1139
|
+
D as WidgetComponent,
|
|
1140
|
+
Z as genericComponentStyling,
|
|
1141
|
+
En as resolveComponent
|
|
25
1142
|
};
|
|
26
1143
|
//# sourceMappingURL=index.js.map
|