@telia-ace/widget-types-grid 1.0.15 → 1.0.18
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 +623 -1170
- package/dist/index.js.map +1 -1
- package/dist/render.8763910e.js +59 -0
- package/dist/render.8763910e.js.map +1 -0
- package/dist/unmount.b0816844.js +6 -0
- package/dist/unmount.b0816844.js.map +1 -0
- package/package.json +13 -9
- package/dist/render.js +0 -95
- package/dist/render.js.map +0 -1
- package/dist/unmount.js +0 -4
- package/dist/unmount.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,101 +1,70 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
import { asDescriptor, ComponentPlatform, createComponentModel, ComponentQuery, WidgetRenderState } from "@telia-ace/widget-core";
|
|
33
|
-
import { Grid, useRouteData, useRouter, useProperties, useContext, useContainer, useComponentNode, useScroll, transitionComposer, paddedBorderTabStyle, useComponent, useComponentDescriptor, filterCssPropsStyle, useComponentPlatform, useIsMounted, useColumns, useLayout, ComponentNodeContext, ComponentPropertyContext, filterCssProps } from "@telia-ace/widget-ui";
|
|
34
|
-
import React, { useState, forwardRef, useMemo, Suspense, useEffect, useContext as useContext$1 } from "react";
|
|
35
|
-
import styled, { css, ThemeContext, ThemeProvider } from "styled-components";
|
|
36
|
-
import { appendClassNames, notifyDataLoaded, lock, removeNullAndUndefinedValues, uuid } from "@telia-ace/widget-utilities";
|
|
37
|
-
import { TransitionGroup, Transition } from "react-transition-group";
|
|
38
|
-
import { Switch as Switch$1, Route } from "react-router";
|
|
39
|
-
import { onWidgetUrl } from "@telia-ace/widget-routing";
|
|
40
|
-
import { readStorage, StorageMedium, createStorageWriter, StorageCategory, StorageScope } from "@telia-ace/widget-services";
|
|
41
|
-
import { supportBootstrapping } from "@webprovisions/bootstrapping";
|
|
42
|
-
import { WidgetState, WidgetType } from "@webprovisions/platform";
|
|
43
|
-
var SlideDirection = /* @__PURE__ */ ((SlideDirection2) => {
|
|
44
|
-
SlideDirection2["back"] = "back";
|
|
45
|
-
SlideDirection2["forth"] = "forth";
|
|
46
|
-
return SlideDirection2;
|
|
47
|
-
})(SlideDirection || {});
|
|
48
|
-
const determineSlideDirection = (currentRouteName, nextRouteName, routeRanking) => {
|
|
49
|
-
if (typeof routeRanking[currentRouteName] === "number" && typeof routeRanking[nextRouteName] === "number" && routeRanking[currentRouteName] > routeRanking[nextRouteName]) {
|
|
50
|
-
return "back";
|
|
51
|
-
}
|
|
52
|
-
return "forth";
|
|
53
|
-
};
|
|
54
|
-
const Switch = ({ views, location, render }) => {
|
|
55
|
-
return /* @__PURE__ */ React.createElement(Switch$1, {
|
|
56
|
-
location: location ? __spreadProps(__spreadValues({}, location), {
|
|
57
|
-
pathname: location.pathname.split("?")[0]
|
|
58
|
-
}) : location
|
|
59
|
-
}, [
|
|
60
|
-
...Object.keys(views).filter((key) => !!views[key].path),
|
|
61
|
-
...Object.keys(views).filter((key) => !views[key].path)
|
|
62
|
-
].map((name) => {
|
|
63
|
-
const { path } = views[name];
|
|
64
|
-
if (!path) {
|
|
65
|
-
return /* @__PURE__ */ React.createElement(Route, {
|
|
66
|
-
key: name,
|
|
67
|
-
render: () => render(name)
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
if (Array.isArray(path)) {
|
|
71
|
-
return path.map((path2) => /* @__PURE__ */ React.createElement(Route, {
|
|
72
|
-
key: name,
|
|
73
|
-
exact: true,
|
|
74
|
-
path: path2,
|
|
75
|
-
render: () => render(name)
|
|
76
|
-
}));
|
|
77
|
-
}
|
|
78
|
-
return /* @__PURE__ */ React.createElement(Route, {
|
|
79
|
-
key: name,
|
|
80
|
-
exact: true,
|
|
81
|
-
path,
|
|
82
|
-
render: () => render(name)
|
|
83
|
-
});
|
|
84
|
-
}));
|
|
1
|
+
var Oe = Object.defineProperty, Se = Object.defineProperties;
|
|
2
|
+
var xe = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var W = Object.getOwnPropertySymbols;
|
|
4
|
+
var ce = Object.prototype.hasOwnProperty, le = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var ae = (t, e, n) => e in t ? Oe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, f = (t, e) => {
|
|
6
|
+
for (var n in e || (e = {}))
|
|
7
|
+
ce.call(e, n) && ae(t, n, e[n]);
|
|
8
|
+
if (W)
|
|
9
|
+
for (var n of W(e))
|
|
10
|
+
le.call(e, n) && ae(t, n, e[n]);
|
|
11
|
+
return t;
|
|
12
|
+
}, E = (t, e) => Se(t, xe(e));
|
|
13
|
+
var M = (t, e) => {
|
|
14
|
+
var n = {};
|
|
15
|
+
for (var i in t)
|
|
16
|
+
ce.call(t, i) && e.indexOf(i) < 0 && (n[i] = t[i]);
|
|
17
|
+
if (t != null && W)
|
|
18
|
+
for (var i of W(t))
|
|
19
|
+
e.indexOf(i) < 0 && le.call(t, i) && (n[i] = t[i]);
|
|
20
|
+
return n;
|
|
85
21
|
};
|
|
86
|
-
|
|
22
|
+
import { asDescriptor as ue, ComponentPlatform as Ae, createComponentModel as De, ComponentQuery as Me, WidgetRenderState as C } from "@telia-ace/widget-core";
|
|
23
|
+
import { Grid as pe, useRouteData as Ne, useRouter as Le, useProperties as me, useContext as te, useContainer as j, useComponentNode as ne, useScroll as fe, transitionComposer as $e, paddedBorderTabStyle as ke, useComponent as Pe, useComponentDescriptor as Re, filterCssPropsStyle as Ve, Typography as _e, useComponentPlatform as ge, useIsMounted as Ie, useColumns as ze, useLayout as Te, ComponentNodeContext as Be, ComponentPropertyContext as je, filterCssProps as Ge } from "@telia-ace/widget-ui";
|
|
24
|
+
import d, { useState as T, forwardRef as ye, useMemo as He, Suspense as We, useEffect as B, useContext as Fe } from "react";
|
|
25
|
+
import R, { css as be, ThemeContext as we, ThemeProvider as Ke } from "styled-components";
|
|
26
|
+
import { appendClassNames as U, notifyDataLoaded as Ue, lock as Z, removeNullAndUndefinedValues as he, uuid as Ye } from "@telia-ace/widget-utilities";
|
|
27
|
+
import { TransitionGroup as qe, Transition as Qe } from "react-transition-group";
|
|
28
|
+
import { Switch as Ze, Route as J } from "react-router";
|
|
29
|
+
import { onWidgetUrl as Je } from "@telia-ace/widget-routing";
|
|
30
|
+
import { readStorage as N, StorageMedium as v, createStorageWriter as _, StorageCategory as I, StorageScope as Xe } from "@telia-ace/widget-services";
|
|
31
|
+
import { supportBootstrapping as et } from "@webprovisions/bootstrapping";
|
|
32
|
+
import { WidgetState as tt, WidgetType as nt } from "@webprovisions/platform";
|
|
33
|
+
var ee = /* @__PURE__ */ ((t) => (t.back = "back", t.forth = "forth", t))(ee || {});
|
|
34
|
+
const it = (t, e, n) => typeof n[t] == "number" && typeof n[e] == "number" && n[t] > n[e] ? "back" : "forth", ve = ({ views: t, location: e, render: n }) => /* @__PURE__ */ d.createElement(Ze, {
|
|
35
|
+
location: e && E(f({}, e), {
|
|
36
|
+
pathname: e.pathname.split("?")[0]
|
|
37
|
+
})
|
|
38
|
+
}, [
|
|
39
|
+
...Object.keys(t).filter((i) => !!t[i].path),
|
|
40
|
+
...Object.keys(t).filter((i) => !t[i].path)
|
|
41
|
+
].map((i) => {
|
|
42
|
+
const { path: s } = t[i];
|
|
43
|
+
return s ? Array.isArray(s) ? s.map((o) => /* @__PURE__ */ d.createElement(J, {
|
|
44
|
+
key: i,
|
|
45
|
+
exact: !0,
|
|
46
|
+
path: o,
|
|
47
|
+
render: () => n(i)
|
|
48
|
+
})) : /* @__PURE__ */ d.createElement(J, {
|
|
49
|
+
key: i,
|
|
50
|
+
exact: !0,
|
|
51
|
+
path: s,
|
|
52
|
+
render: () => n(i)
|
|
53
|
+
}) : /* @__PURE__ */ d.createElement(J, {
|
|
54
|
+
key: i,
|
|
55
|
+
render: () => n(i)
|
|
56
|
+
});
|
|
57
|
+
})), st = R.div`
|
|
87
58
|
position: relative;
|
|
88
59
|
width: 100%;
|
|
89
60
|
flex: 1;
|
|
90
|
-
|
|
91
|
-
const StyledView$2 = styled(Grid)`
|
|
61
|
+
`, ot = R(pe)`
|
|
92
62
|
position: absolute;
|
|
93
63
|
left: 0;
|
|
94
64
|
right: 0;
|
|
95
|
-
${(
|
|
96
|
-
${(
|
|
97
|
-
|
|
98
|
-
const routeHierarchy = {
|
|
65
|
+
${(t) => !!t.animationCss && t.animationCss}
|
|
66
|
+
${(t) => !!t.scrollableCss && t.scrollableCss}
|
|
67
|
+
`, rt = {
|
|
99
68
|
index: 1,
|
|
100
69
|
search: 2,
|
|
101
70
|
browse: 3,
|
|
@@ -103,234 +72,169 @@ const routeHierarchy = {
|
|
|
103
72
|
contact: 5,
|
|
104
73
|
"contact-method": 6,
|
|
105
74
|
conversation: 7
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const [transitionDirection, setTransitionDirection] = useState(SlideDirection.forth);
|
|
111
|
-
const nextRoute = useRouteData();
|
|
112
|
-
const router = useRouter();
|
|
113
|
-
const properties = useProperties();
|
|
114
|
-
const context = useContext();
|
|
115
|
-
const container = useContainer();
|
|
116
|
-
const node = useComponentNode();
|
|
117
|
-
const { gap = "0" } = context;
|
|
118
|
-
const _a2 = properties, { columns = 1, animation = "none", scrollable = false } = _a2, areaProperties = __objRest(_a2, ["columns", "animation", "scrollable"]);
|
|
119
|
-
const [scrollableCss, elem] = useScroll(scrollable);
|
|
120
|
-
if (!node || !router) {
|
|
75
|
+
}, at = (n) => {
|
|
76
|
+
var i = n, { className: t = "" } = i, e = M(i, ["className"]);
|
|
77
|
+
const [s, o] = T("index"), [r, c] = T(ee.forth), a = Ne(), l = Le(), h = me(), u = te(), p = j(), g = ne(), { gap: m = "0" } = u, O = h, { columns: b = 1, animation: y = "none", scrollable: S = !1 } = O, L = M(O, ["columns", "animation", "scrollable"]), [x, $] = fe(S);
|
|
78
|
+
if (!g || !l)
|
|
121
79
|
return null;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
setRouteName(nextRoute.name);
|
|
127
|
-
}
|
|
128
|
-
const { views } = container.get("$settings");
|
|
129
|
-
if (!Object.keys(views).length) {
|
|
80
|
+
const { location: q } = l;
|
|
81
|
+
a.name !== s && a.name !== "" && y && (c(it(s, a.name, rt)), o(a.name));
|
|
82
|
+
const { views: V } = p.get("$settings");
|
|
83
|
+
if (!Object.keys(V).length)
|
|
130
84
|
return null;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}),
|
|
141
|
-
|
|
142
|
-
}), /* @__PURE__ */ React.createElement(Component, {
|
|
143
|
-
id: childNode.id,
|
|
85
|
+
const oe = (w, k, z) => {
|
|
86
|
+
const G = D(k, z), H = g.getChildren(w)[0];
|
|
87
|
+
return /* @__PURE__ */ d.createElement(ot, E(f(E(f(f({}, e), L), {
|
|
88
|
+
scrollableCss: x,
|
|
89
|
+
ref: $,
|
|
90
|
+
columns: b,
|
|
91
|
+
gap: m
|
|
92
|
+
}), G), {
|
|
93
|
+
className: U(t, "humany-view")
|
|
94
|
+
}), /* @__PURE__ */ d.createElement(ie, {
|
|
95
|
+
id: H.id,
|
|
144
96
|
branch: "default"
|
|
145
97
|
}));
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (animation === "slide" || animation === "fade") {
|
|
98
|
+
}, D = (w, k) => {
|
|
99
|
+
if (y === "slide" || y === "fade")
|
|
149
100
|
return {
|
|
150
|
-
animationCss:
|
|
151
|
-
["data-state"]:
|
|
101
|
+
animationCss: $e.composeViewTransition(w, y, k),
|
|
102
|
+
["data-state"]: w
|
|
152
103
|
};
|
|
153
|
-
}
|
|
154
|
-
return;
|
|
155
104
|
};
|
|
156
|
-
return /* @__PURE__ */
|
|
105
|
+
return /* @__PURE__ */ d.createElement(st, {
|
|
157
106
|
className: "humany-animated-view"
|
|
158
|
-
}, /* @__PURE__ */
|
|
107
|
+
}, /* @__PURE__ */ d.createElement(qe, {
|
|
159
108
|
component: null,
|
|
160
|
-
childFactory: (
|
|
161
|
-
}, /* @__PURE__ */
|
|
162
|
-
key:
|
|
109
|
+
childFactory: (w) => d.cloneElement(w, { direction: r })
|
|
110
|
+
}, /* @__PURE__ */ d.createElement(Qe, {
|
|
111
|
+
key: s,
|
|
163
112
|
timeout: { enter: 500, exit: 500 },
|
|
164
|
-
onEnter: (
|
|
165
|
-
unmountOnExit:
|
|
166
|
-
direction:
|
|
167
|
-
}, (
|
|
168
|
-
views,
|
|
169
|
-
location,
|
|
170
|
-
render: (
|
|
113
|
+
onEnter: (w) => w == null ? void 0 : w.clientHeight,
|
|
114
|
+
unmountOnExit: !0,
|
|
115
|
+
direction: ee.forth
|
|
116
|
+
}, (w, { direction: k }) => /* @__PURE__ */ d.createElement(ve, {
|
|
117
|
+
views: V,
|
|
118
|
+
location: q,
|
|
119
|
+
render: (z) => oe(z, w, k)
|
|
171
120
|
}))));
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
scrollableCss,
|
|
191
|
-
ref: elem,
|
|
192
|
-
columns,
|
|
193
|
-
gap,
|
|
194
|
-
className: appendClassNames(className, "humany-view")
|
|
195
|
-
}), /* @__PURE__ */ React.createElement(Switch, {
|
|
196
|
-
views,
|
|
197
|
-
render: (name) => {
|
|
198
|
-
const childNode = node.getChildren(name)[0];
|
|
199
|
-
return /* @__PURE__ */ React.createElement(Component, {
|
|
200
|
-
id: childNode.id,
|
|
201
|
-
node: childNode,
|
|
121
|
+
}, ct = R(pe)`
|
|
122
|
+
${(t) => !!t.scrollableCss && t.scrollableCss}
|
|
123
|
+
`, lt = (n) => {
|
|
124
|
+
var i = n, { className: t = "" } = i, e = M(i, ["className"]);
|
|
125
|
+
const s = me(), o = te(), r = j(), c = ne(), { views: a } = r.get("$settings"), { gap: l = "0" } = o, y = s, { columns: h = 1, animation: u = "none", scrollable: p = !1 } = y, g = M(y, ["columns", "animation", "scrollable"]), [m, b] = fe(p);
|
|
126
|
+
return c ? /* @__PURE__ */ d.createElement(ct, E(f(f({}, e), g), {
|
|
127
|
+
scrollableCss: m,
|
|
128
|
+
ref: b,
|
|
129
|
+
columns: h,
|
|
130
|
+
gap: l,
|
|
131
|
+
className: U(t, "humany-view")
|
|
132
|
+
}), /* @__PURE__ */ d.createElement(ve, {
|
|
133
|
+
views: a,
|
|
134
|
+
render: (S) => {
|
|
135
|
+
const L = c.getChildren(S)[0];
|
|
136
|
+
return /* @__PURE__ */ d.createElement(ie, {
|
|
137
|
+
id: L.id,
|
|
138
|
+
node: L,
|
|
202
139
|
branch: "default"
|
|
203
140
|
});
|
|
204
141
|
}
|
|
205
|
-
}));
|
|
206
|
-
}
|
|
207
|
-
const styling = css`
|
|
142
|
+
})) : null;
|
|
143
|
+
}, Y = be`
|
|
208
144
|
outline: none;
|
|
209
145
|
box-sizing: border-box;
|
|
210
146
|
* {
|
|
211
|
-
${(
|
|
212
|
-
var
|
|
213
|
-
return !((
|
|
147
|
+
${(t) => {
|
|
148
|
+
var e;
|
|
149
|
+
return !((e = t.theme.accessibility) != null && e.isTabbing) && "outline: none;";
|
|
214
150
|
}}
|
|
215
151
|
box-sizing: border-box;
|
|
216
152
|
}
|
|
217
153
|
|
|
218
|
-
grid-column: ${(
|
|
154
|
+
grid-column: ${(t) => t["data-indent"] ? `${t["data-indent"] + 1} / ${t["data-indent"] + t["data-width"] + 1}` : `span ${t["data-width"]}`};
|
|
219
155
|
|
|
220
|
-
${(
|
|
221
|
-
var
|
|
222
|
-
return ((
|
|
223
|
-
font-family: ${
|
|
156
|
+
${(t) => {
|
|
157
|
+
var e;
|
|
158
|
+
return ((e = t.theme.fonts) == null ? void 0 : e.type) && `
|
|
159
|
+
font-family: ${t.theme.fonts.type};
|
|
224
160
|
|
|
225
161
|
input, textarea {
|
|
226
|
-
font-family: ${
|
|
162
|
+
font-family: ${t.theme.fonts.type};
|
|
227
163
|
}
|
|
228
164
|
`;
|
|
229
165
|
}}
|
|
230
166
|
|
|
231
|
-
${(
|
|
232
|
-
var
|
|
233
|
-
return ((
|
|
234
|
-
font-size: ${
|
|
167
|
+
${(t) => {
|
|
168
|
+
var e;
|
|
169
|
+
return ((e = t.theme.fonts) == null ? void 0 : e.base) && `
|
|
170
|
+
font-size: ${t.theme.fonts.base};
|
|
235
171
|
`;
|
|
236
172
|
}}
|
|
237
173
|
|
|
238
174
|
&:focus {
|
|
239
|
-
${(
|
|
240
|
-
var
|
|
241
|
-
return ((
|
|
175
|
+
${(t) => {
|
|
176
|
+
var e;
|
|
177
|
+
return ((e = t.theme.accessibility) == null ? void 0 : e.isTabbing) && ke;
|
|
242
178
|
}};
|
|
243
179
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
${styling}
|
|
250
|
-
`;
|
|
251
|
-
styled.div`
|
|
180
|
+
`, ut = R(lt)`
|
|
181
|
+
${Y}
|
|
182
|
+
`, ht = R(at)`
|
|
183
|
+
${Y}
|
|
184
|
+
`, dt = R.div`
|
|
252
185
|
text-align: center;
|
|
253
|
-
${(
|
|
254
|
-
var
|
|
255
|
-
return typeof ((
|
|
256
|
-
color: ${(
|
|
257
|
-
border: 2px dashed ${(
|
|
186
|
+
${(t) => {
|
|
187
|
+
var e, n, i;
|
|
188
|
+
return typeof ((e = t.theme.colors) == null ? void 0 : e.warning) != "undefined" && be`
|
|
189
|
+
color: ${(n = t.theme.colors) == null ? void 0 : n.warning};
|
|
190
|
+
border: 2px dashed ${(i = t.theme.colors) == null ? void 0 : i.warning};
|
|
258
191
|
`;
|
|
259
192
|
}}
|
|
260
|
-
${(
|
|
261
|
-
${
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
return null;
|
|
275
|
-
}, [ResolvedComponent]);
|
|
276
|
-
if (typeof ResolvedComponent === "undefined") {
|
|
277
|
-
return null;
|
|
278
|
-
}
|
|
279
|
-
if (ResolvedComponent === null || StyledResolvableComponent === null) {
|
|
280
|
-
return null;
|
|
281
|
-
}
|
|
282
|
-
return /* @__PURE__ */ React.createElement(Suspense, {
|
|
193
|
+
${(t) => typeof t.theme.borderRadius != "undefined" && `border-radius: ${t.theme.borderRadius};`}
|
|
194
|
+
${Y}
|
|
195
|
+
`, pt = ye((s, i) => {
|
|
196
|
+
var o = s, { className: t = "", children: e } = o, n = M(o, ["className", "children"]);
|
|
197
|
+
const r = Pe(), { name: c, type: a, id: l } = Re(), h = He(() => r ? R(r)`
|
|
198
|
+
${Y}
|
|
199
|
+
${Ve}
|
|
200
|
+
` : null, [r]);
|
|
201
|
+
return typeof r == "undefined" ? null : r === null || h === null ? process.env.NODE_ENV !== "production" ? /* @__PURE__ */ d.createElement(dt, E(f({}, n), {
|
|
202
|
+
title: `type: ${a}, definition-id: ${c}, instance-id: ${l}`,
|
|
203
|
+
className: U(t, "humany-non-resolved-component")
|
|
204
|
+
}), /* @__PURE__ */ d.createElement(_e, {
|
|
205
|
+
variant: "h5"
|
|
206
|
+
}, "Non Resolved Component Type")) : null : /* @__PURE__ */ d.createElement(We, {
|
|
283
207
|
fallback: null
|
|
284
|
-
}, /* @__PURE__ */
|
|
285
|
-
ref
|
|
286
|
-
},
|
|
287
|
-
className:
|
|
288
|
-
}),
|
|
289
|
-
})
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
setProperties(node.attributes.properties);
|
|
298
|
-
}
|
|
299
|
-
}, [node, id, isMounted]);
|
|
300
|
-
useEffect(() => {
|
|
301
|
-
if (components) {
|
|
302
|
-
const unsubscribe = components.events.subscribe("components:properties-changed", (event, data) => {
|
|
303
|
-
if (node === data.node && isMounted.current) {
|
|
304
|
-
setProperties(data.node.attributes.properties);
|
|
305
|
-
}
|
|
208
|
+
}, /* @__PURE__ */ d.createElement(h, E(f({
|
|
209
|
+
ref: i
|
|
210
|
+
}, n), {
|
|
211
|
+
className: U(t, "humany-component", `humany-component-${c}`)
|
|
212
|
+
}), e));
|
|
213
|
+
}), mt = (t) => {
|
|
214
|
+
const e = ne(t), n = ge(), [i, s] = T({}), o = Ie();
|
|
215
|
+
return B(() => {
|
|
216
|
+
e && o.current && s(e.attributes.properties);
|
|
217
|
+
}, [e, t, o]), B(() => {
|
|
218
|
+
if (n) {
|
|
219
|
+
const r = n.events.subscribe("components:properties-changed", (c, a) => {
|
|
220
|
+
e === a.node && o.current && s(a.node.attributes.properties);
|
|
306
221
|
});
|
|
307
222
|
return () => {
|
|
308
|
-
|
|
223
|
+
r();
|
|
309
224
|
};
|
|
310
225
|
}
|
|
311
|
-
}, [
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
}
|
|
323
|
-
const Component = forwardRef((_g, ref) => {
|
|
324
|
-
var _h = _g, {
|
|
325
|
-
className = "",
|
|
326
|
-
isTabbing = false,
|
|
327
|
-
id,
|
|
328
|
-
branch,
|
|
329
|
-
node,
|
|
330
|
-
ariaLabel,
|
|
331
|
-
tabIndex,
|
|
332
|
-
context: extraContext
|
|
333
|
-
} = _h, other = __objRest(_h, [
|
|
226
|
+
}, [n, o, t, e]), i;
|
|
227
|
+
}, ft = (t, e) => e ? !0 : typeof t == "string" ? t === "full" : t > 0, ie = ye((h, l) => {
|
|
228
|
+
var u = h, {
|
|
229
|
+
className: t = "",
|
|
230
|
+
isTabbing: e = !1,
|
|
231
|
+
id: n,
|
|
232
|
+
branch: i,
|
|
233
|
+
node: s,
|
|
234
|
+
ariaLabel: o,
|
|
235
|
+
tabIndex: r,
|
|
236
|
+
context: c
|
|
237
|
+
} = u, a = M(u, [
|
|
334
238
|
"className",
|
|
335
239
|
"isTabbing",
|
|
336
240
|
"id",
|
|
@@ -340,255 +244,160 @@ const Component = forwardRef((_g, ref) => {
|
|
|
340
244
|
"tabIndex",
|
|
341
245
|
"context"
|
|
342
246
|
]);
|
|
343
|
-
var
|
|
344
|
-
const
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
if (components) {
|
|
355
|
-
if (id && !node) {
|
|
356
|
-
const componentNode = components.nodes.get(id);
|
|
357
|
-
if (componentNode) {
|
|
358
|
-
setDescriptor(asDescriptor(componentNode, branch));
|
|
359
|
-
if (visible) {
|
|
360
|
-
const unmount = componentNode.mount(container);
|
|
361
|
-
return () => {
|
|
362
|
-
unmount();
|
|
363
|
-
};
|
|
364
|
-
}
|
|
247
|
+
var re;
|
|
248
|
+
const p = ge(), g = j(), [m, b] = T(), y = d.useContext(we) || {}, S = ze(), L = te(n), x = mt(n), { size: $ = "none", indent: q = 0 } = Te(n), V = ft($, s);
|
|
249
|
+
if (B(() => {
|
|
250
|
+
if (p) {
|
|
251
|
+
if (n && !s) {
|
|
252
|
+
const A = p.nodes.get(n);
|
|
253
|
+
if (A && (b(ue(A, i)), V)) {
|
|
254
|
+
const Q = A.mount(g);
|
|
255
|
+
return () => {
|
|
256
|
+
Q();
|
|
257
|
+
};
|
|
365
258
|
}
|
|
366
|
-
} else if (
|
|
367
|
-
|
|
368
|
-
const
|
|
259
|
+
} else if (s) {
|
|
260
|
+
b(ue(s, i));
|
|
261
|
+
const A = s.mount(g);
|
|
369
262
|
return () => {
|
|
370
|
-
|
|
263
|
+
A();
|
|
371
264
|
};
|
|
372
265
|
}
|
|
373
266
|
}
|
|
374
|
-
}, [
|
|
375
|
-
if (!descriptor || !visible) {
|
|
267
|
+
}, [p, n, s, V]), !m || !V)
|
|
376
268
|
return null;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
accessibility = {}
|
|
383
|
-
} = _a, restContext = __objRest(_a, [
|
|
269
|
+
const H = f(f({}, L), c || {}), {
|
|
270
|
+
cardinal: D,
|
|
271
|
+
fonts: O = {},
|
|
272
|
+
accessibility: w = {}
|
|
273
|
+
} = H, k = M(H, [
|
|
384
274
|
"cardinal",
|
|
385
275
|
"fonts",
|
|
386
276
|
"accessibility"
|
|
387
|
-
])
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
accessibility: __spreadProps(__spreadValues({}, accessibility), {
|
|
400
|
-
isTabbing: ((_b = themeContext.accessibility) == null ? void 0 : _b.isTabbing) || isTabbing
|
|
277
|
+
]), z = {
|
|
278
|
+
type: O.type,
|
|
279
|
+
base: O.base || "16px",
|
|
280
|
+
small: O.small || "0.8em",
|
|
281
|
+
normal: O.normal || "1em",
|
|
282
|
+
medium: O.medium || "1.2em",
|
|
283
|
+
large: O.large || "1.6em",
|
|
284
|
+
huge: O.huge || "2.5em"
|
|
285
|
+
}, G = E(f({}, k), {
|
|
286
|
+
fonts: z,
|
|
287
|
+
accessibility: E(f({}, w), {
|
|
288
|
+
isTabbing: ((re = y.accessibility) == null ? void 0 : re.isTabbing) || e
|
|
401
289
|
})
|
|
402
290
|
});
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
value: descriptor
|
|
416
|
-
}, /* @__PURE__ */ React.createElement(ComponentPropertyContext.Provider, {
|
|
417
|
-
value: properties
|
|
291
|
+
return typeof D == "number" && (G.sizes = {
|
|
292
|
+
cardinal: D,
|
|
293
|
+
small: `${D}px`,
|
|
294
|
+
normal: `${D * 3}px`,
|
|
295
|
+
medium: `${D * 5}px`,
|
|
296
|
+
large: `${D * 8}px`
|
|
297
|
+
}), /* @__PURE__ */ d.createElement(Ke, {
|
|
298
|
+
theme: G
|
|
299
|
+
}, /* @__PURE__ */ d.createElement(Be.Provider, {
|
|
300
|
+
value: m
|
|
301
|
+
}, /* @__PURE__ */ d.createElement(je.Provider, {
|
|
302
|
+
value: x
|
|
418
303
|
}, (() => {
|
|
419
|
-
const
|
|
420
|
-
"data-width":
|
|
421
|
-
"data-indent":
|
|
422
|
-
"data-name":
|
|
423
|
-
"data-node-id":
|
|
424
|
-
"data-component-type":
|
|
425
|
-
"aria-label":
|
|
426
|
-
tabIndex,
|
|
427
|
-
id:
|
|
428
|
-
role:
|
|
429
|
-
},
|
|
430
|
-
switch (
|
|
431
|
-
case "view":
|
|
432
|
-
return typeof
|
|
433
|
-
className
|
|
434
|
-
})) : /* @__PURE__ */
|
|
435
|
-
className
|
|
304
|
+
const A = f({
|
|
305
|
+
"data-width": $ === "full" ? S : Math.min($, S),
|
|
306
|
+
"data-indent": q,
|
|
307
|
+
"data-name": m.name,
|
|
308
|
+
"data-node-id": m.id,
|
|
309
|
+
"data-component-type": m.type,
|
|
310
|
+
"aria-label": o,
|
|
311
|
+
tabIndex: r,
|
|
312
|
+
id: m.id,
|
|
313
|
+
role: x && x.role
|
|
314
|
+
}, a);
|
|
315
|
+
switch (m.type) {
|
|
316
|
+
case "view":
|
|
317
|
+
return typeof x.animation == "string" && x.animation !== "none" ? /* @__PURE__ */ d.createElement(ht, E(f({}, A), {
|
|
318
|
+
className: t
|
|
319
|
+
})) : /* @__PURE__ */ d.createElement(ut, E(f({}, A), {
|
|
320
|
+
className: t
|
|
436
321
|
}));
|
|
437
|
-
}
|
|
438
322
|
default: {
|
|
439
|
-
const
|
|
440
|
-
return /* @__PURE__ */
|
|
441
|
-
ref
|
|
442
|
-
},
|
|
443
|
-
className
|
|
323
|
+
const Q = Ge(x);
|
|
324
|
+
return /* @__PURE__ */ d.createElement(pt, E(f(f({
|
|
325
|
+
ref: l
|
|
326
|
+
}, A), Q), {
|
|
327
|
+
className: t
|
|
444
328
|
}));
|
|
445
329
|
}
|
|
446
330
|
}
|
|
447
331
|
})())));
|
|
448
|
-
})
|
|
449
|
-
const
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
332
|
+
}), gt = ({ builder: t }) => {
|
|
333
|
+
const e = j(), [n, i] = T(null);
|
|
334
|
+
return B(() => {
|
|
335
|
+
e.getAsync("components").then((s) => t(s).then((o) => {
|
|
336
|
+
i(o);
|
|
337
|
+
}));
|
|
338
|
+
}, []), B(() => () => {
|
|
339
|
+
n && e.getAsync("components").then((s) => {
|
|
340
|
+
s.nodes.detached = s.nodes.detached.filter((o) => o.id !== n.id);
|
|
457
341
|
});
|
|
458
|
-
}, [])
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
if (node) {
|
|
462
|
-
container.getAsync("components").then((components) => {
|
|
463
|
-
components.nodes.detached = components.nodes.detached.filter((n) => n.id !== node.id);
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
};
|
|
467
|
-
}, [node]);
|
|
468
|
-
if (!node) {
|
|
469
|
-
return null;
|
|
470
|
-
}
|
|
471
|
-
return /* @__PURE__ */ React.createElement(Component, {
|
|
472
|
-
id: node.id,
|
|
473
|
-
node,
|
|
342
|
+
}, [n]), n ? /* @__PURE__ */ d.createElement(ie, {
|
|
343
|
+
id: n.id,
|
|
344
|
+
node: n,
|
|
474
345
|
branch: "default"
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
var detachedComponent = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
346
|
+
}) : null;
|
|
347
|
+
}, yt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
478
348
|
__proto__: null,
|
|
479
|
-
|
|
480
|
-
}, Symbol.toStringTag, { value: "Module" }))
|
|
481
|
-
const
|
|
482
|
-
return
|
|
483
|
-
}));
|
|
484
|
-
const NotFound = ({ showSearch = false }) => {
|
|
485
|
-
const themeContext = useContext$1(ThemeContext);
|
|
486
|
-
const container = useContainer();
|
|
487
|
-
return /* @__PURE__ */ React.createElement(React.Suspense, {
|
|
349
|
+
default: gt
|
|
350
|
+
}, Symbol.toStringTag, { value: "Module" })), bt = d.lazy(() => Promise.resolve().then(() => yt)), qt = ({ showSearch: t = !1 }) => {
|
|
351
|
+
const e = Fe(we), n = j();
|
|
352
|
+
return /* @__PURE__ */ d.createElement(d.Suspense, {
|
|
488
353
|
fallback: null
|
|
489
|
-
}, /* @__PURE__ */
|
|
490
|
-
builder: (
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
if (showSearch) {
|
|
507
|
-
const searchComponentProps = Object.keys(settings.components).reduce((acc, key) => {
|
|
508
|
-
if (settings.components[key].type === "search") {
|
|
509
|
-
return settings.components[key].properties;
|
|
510
|
-
}
|
|
511
|
-
return acc;
|
|
512
|
-
}, {});
|
|
513
|
-
const searchNode = components.createNode("search", { detached: true });
|
|
514
|
-
searchNode.writeLayout({ size: "full" });
|
|
515
|
-
searchNode.writeProperties(__spreadValues({
|
|
516
|
-
"css-margin-bottom": ((_a = themeContext == null ? void 0 : themeContext.sizes) == null ? void 0 : _a.normal) || "15px"
|
|
517
|
-
}, searchComponentProps));
|
|
518
|
-
node.appendChild(searchNode);
|
|
519
|
-
}
|
|
520
|
-
const notFoundNode = components.createNode("not-found", { detached: true });
|
|
521
|
-
notFoundNode.writeLayout({ size: "full" });
|
|
522
|
-
notFoundNode.writeProperties(properties);
|
|
523
|
-
notFoundNode.writeContext(context);
|
|
524
|
-
node.appendChild(notFoundNode);
|
|
525
|
-
return node;
|
|
526
|
-
});
|
|
527
|
-
}
|
|
354
|
+
}, /* @__PURE__ */ d.createElement(bt, {
|
|
355
|
+
builder: (i) => n.get("settings").then((s) => {
|
|
356
|
+
var l;
|
|
357
|
+
const { properties: o, context: r } = Object.keys(s.components).reduce((h, u) => (s.components[u].type === "not-found" && (h.properties = s.components[u].properties, h.context = s.components[u].context), h), { properties: {}, context: {} });
|
|
358
|
+
o.showSearch = t;
|
|
359
|
+
const c = i.createNode("area", { detached: !0 });
|
|
360
|
+
if (c.name = "not-found-area", c.writeLayout({
|
|
361
|
+
size: "full"
|
|
362
|
+
}), t) {
|
|
363
|
+
const h = Object.keys(s.components).reduce((p, g) => s.components[g].type === "search" ? s.components[g].properties : p, {}), u = i.createNode("search", { detached: !0 });
|
|
364
|
+
u.writeLayout({ size: "full" }), u.writeProperties(f({
|
|
365
|
+
"css-margin-bottom": ((l = e == null ? void 0 : e.sizes) == null ? void 0 : l.normal) || "15px"
|
|
366
|
+
}, h)), c.appendChild(u);
|
|
367
|
+
}
|
|
368
|
+
const a = i.createNode("not-found", { detached: !0 });
|
|
369
|
+
return a.writeLayout({ size: "full" }), a.writeProperties(o), a.writeContext(r), c.appendChild(a), c;
|
|
370
|
+
})
|
|
528
371
|
}));
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
switch (type) {
|
|
372
|
+
}, wt = (t) => {
|
|
373
|
+
if (t) {
|
|
374
|
+
const { type: e, content: n } = t;
|
|
375
|
+
switch (e) {
|
|
534
376
|
case "FontAwesome":
|
|
535
|
-
return `<i class="humany-icon fa fa-${
|
|
377
|
+
return `<i class="humany-icon fa fa-${n}"></i>`;
|
|
536
378
|
case "Uri":
|
|
537
|
-
return `<i class="humany-icon humany-custom-icon" style="background: url(${
|
|
379
|
+
return `<i class="humany-icon humany-custom-icon" style="background: url(${n}) no-repeat center center;background-size: contain;"></i>`;
|
|
538
380
|
default:
|
|
539
381
|
return "";
|
|
540
382
|
}
|
|
541
383
|
}
|
|
542
|
-
}
|
|
543
|
-
const
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
element.classList.add("humany-tabbing");
|
|
550
|
-
} else {
|
|
551
|
-
element.classList.remove("humany-tabbing");
|
|
552
|
-
}
|
|
553
|
-
};
|
|
554
|
-
const handleKeydown = (e) => {
|
|
555
|
-
if (e.key === "Tab") {
|
|
556
|
-
toggleTabbing(triggerDOMElement, true);
|
|
557
|
-
} else if (!(e.key === "Enter" && document.activeElement && document.activeElement.classList.contains("humany-trigger"))) {
|
|
558
|
-
toggleTabbing(triggerDOMElement, false);
|
|
559
|
-
}
|
|
560
|
-
};
|
|
561
|
-
const handleClick = (e) => {
|
|
562
|
-
if (document.activeElement && document.activeElement.classList.contains("humany-trigger") && document.activeElement.classList.contains("humany-tabbing")) {
|
|
563
|
-
return;
|
|
564
|
-
}
|
|
565
|
-
toggleTabbing(triggerDOMElement, false);
|
|
384
|
+
}, vt = (t) => {
|
|
385
|
+
const e = (s, o) => {
|
|
386
|
+
!s || (o ? s.classList.add("humany-tabbing") : s.classList.remove("humany-tabbing"));
|
|
387
|
+
}, n = (s) => {
|
|
388
|
+
s.key === "Tab" ? e(t, !0) : s.key === "Enter" && document.activeElement && document.activeElement.classList.contains("humany-trigger") || e(t, !1);
|
|
389
|
+
}, i = (s) => {
|
|
390
|
+
document.activeElement && document.activeElement.classList.contains("humany-trigger") && document.activeElement.classList.contains("humany-tabbing") || e(t, !1);
|
|
566
391
|
};
|
|
567
|
-
document.addEventListener("keydown",
|
|
568
|
-
|
|
569
|
-
return () => {
|
|
570
|
-
document.removeEventListener("keydown", handleKeydown);
|
|
571
|
-
document.removeEventListener("click", handleClick);
|
|
392
|
+
return document.addEventListener("keydown", n), document.addEventListener("click", i), () => {
|
|
393
|
+
document.removeEventListener("keydown", n), document.removeEventListener("click", i);
|
|
572
394
|
};
|
|
573
395
|
};
|
|
574
|
-
function
|
|
575
|
-
const { symbol, widgetName, label = "", ariaLabel = "", tooltip = "" } =
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
element.classList.add("humany-has-text");
|
|
580
|
-
}
|
|
581
|
-
if (ariaLabel.length && !element.getAttribute("aria-label")) {
|
|
582
|
-
element.setAttribute("aria-label", ariaLabel);
|
|
583
|
-
}
|
|
584
|
-
if (ariaLabel.length && !element.getAttribute("tabindex")) {
|
|
585
|
-
element.setAttribute("tabindex", "0");
|
|
586
|
-
}
|
|
587
|
-
if (tooltip.length && !element.getAttribute("title")) {
|
|
588
|
-
element.setAttribute("title", tooltip);
|
|
589
|
-
}
|
|
590
|
-
const symbolHtml = renderSymbol(symbol) || "";
|
|
591
|
-
element.innerHTML = `${symbolHtml}
|
|
396
|
+
function Et(t, e) {
|
|
397
|
+
const { symbol: n, widgetName: i, label: s = "", ariaLabel: o = "", tooltip: r = "" } = e;
|
|
398
|
+
t.classList.add("humany-trigger"), t.classList.add(`humany_${i}`), s.length && t.classList.add("humany-has-text"), o.length && !t.getAttribute("aria-label") && t.setAttribute("aria-label", o), o.length && !t.getAttribute("tabindex") && t.setAttribute("tabindex", "0"), r.length && !t.getAttribute("title") && t.setAttribute("title", r);
|
|
399
|
+
const c = wt(n) || "";
|
|
400
|
+
return t.innerHTML = `${c}
|
|
592
401
|
<span class="humany-close">
|
|
593
402
|
<svg width="18" height="9" viewBox="0 0 18 9" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
594
403
|
<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"/>
|
|
@@ -606,594 +415,303 @@ function createTriggerElement(element, options) {
|
|
|
606
415
|
stroke-miterlimit="10" />
|
|
607
416
|
</svg>
|
|
608
417
|
</span>
|
|
609
|
-
${
|
|
610
|
-
setTimeout(() => element && element.classList.add("humany-rendered"));
|
|
611
|
-
return triggerTabHandler(element);
|
|
418
|
+
${s.length ? `<span>${s}</span>` : ""}`, setTimeout(() => t && t.classList.add("humany-rendered")), vt(t);
|
|
612
419
|
}
|
|
613
|
-
function
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
}
|
|
618
|
-
elements.classList.remove("humany-active");
|
|
619
|
-
elements.classList.remove("humany-loading");
|
|
620
|
-
} else if (elements instanceof Array) {
|
|
621
|
-
elements.forEach((e) => {
|
|
622
|
-
if (title) {
|
|
623
|
-
e.setAttribute("title", title);
|
|
624
|
-
}
|
|
625
|
-
e.classList.remove("humany-active");
|
|
626
|
-
e.classList.remove("humany-loading");
|
|
627
|
-
});
|
|
628
|
-
}
|
|
420
|
+
function Ct(t, e) {
|
|
421
|
+
t instanceof HTMLElement ? (e && t.setAttribute("title", e), t.classList.remove("humany-active"), t.classList.remove("humany-loading")) : t instanceof Array && t.forEach((n) => {
|
|
422
|
+
e && n.setAttribute("title", e), n.classList.remove("humany-active"), n.classList.remove("humany-loading");
|
|
423
|
+
});
|
|
629
424
|
}
|
|
630
|
-
function
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
} else if (elements instanceof Array) {
|
|
635
|
-
elements.forEach((e) => {
|
|
636
|
-
e.classList.remove("humany-active");
|
|
637
|
-
e.classList.add("humany-loading");
|
|
638
|
-
});
|
|
639
|
-
}
|
|
425
|
+
function Ot(t) {
|
|
426
|
+
t instanceof HTMLElement ? (t.classList.remove("humany-active"), t.classList.add("humany-loading")) : t instanceof Array && t.forEach((e) => {
|
|
427
|
+
e.classList.remove("humany-active"), e.classList.add("humany-loading");
|
|
428
|
+
});
|
|
640
429
|
}
|
|
641
|
-
function
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
}
|
|
646
|
-
elements.classList.add("humany-active");
|
|
647
|
-
elements.classList.remove("humany-loading");
|
|
648
|
-
} else if (elements instanceof Array) {
|
|
649
|
-
elements.forEach((e) => {
|
|
650
|
-
if (title) {
|
|
651
|
-
e.setAttribute("title", title);
|
|
652
|
-
}
|
|
653
|
-
e.classList.add("humany-active");
|
|
654
|
-
e.classList.remove("humany-loading");
|
|
655
|
-
});
|
|
656
|
-
}
|
|
430
|
+
function Ee(t, e) {
|
|
431
|
+
t instanceof HTMLElement ? (e && t.setAttribute("title", e), t.classList.add("humany-active"), t.classList.remove("humany-loading")) : t instanceof Array && t.forEach((n) => {
|
|
432
|
+
e && n.setAttribute("title", e), n.classList.add("humany-active"), n.classList.remove("humany-loading");
|
|
433
|
+
});
|
|
657
434
|
}
|
|
658
|
-
var
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
return "both";
|
|
668
|
-
}
|
|
669
|
-
if (widgetDOMElement) {
|
|
670
|
-
return "widgetDOM";
|
|
671
|
-
}
|
|
672
|
-
if (triggerDOMElement) {
|
|
673
|
-
return "triggerDOM";
|
|
674
|
-
}
|
|
675
|
-
return "none";
|
|
676
|
-
};
|
|
677
|
-
const determineTriggerType = (triggerDefinition) => {
|
|
678
|
-
if (!triggerDefinition) {
|
|
679
|
-
return "inline";
|
|
680
|
-
}
|
|
681
|
-
if (typeof triggerDefinition === "boolean" && triggerDefinition) {
|
|
682
|
-
return "link";
|
|
683
|
-
}
|
|
684
|
-
if (typeof triggerDefinition === "object" && !Array.isArray(triggerDefinition)) {
|
|
685
|
-
return "badge";
|
|
686
|
-
}
|
|
687
|
-
return "unsupported";
|
|
688
|
-
};
|
|
689
|
-
const prepareDOMElements = (name, providedWidgetElement, providedTriggerElement, triggerDefinition, waitWithReplace = false) => {
|
|
690
|
-
var _a, _b;
|
|
691
|
-
const providedElements = determineProvidedElements(providedWidgetElement, providedTriggerElement);
|
|
692
|
-
const triggerType = determineTriggerType(triggerDefinition);
|
|
693
|
-
const cachedOriginals = {
|
|
694
|
-
widgetDOMElement: providedWidgetElement ? providedWidgetElement.cloneNode(true) : void 0,
|
|
695
|
-
triggerDOMElement: providedTriggerElement ? providedTriggerElement.cloneNode(true) : void 0
|
|
696
|
-
};
|
|
697
|
-
const output = {
|
|
698
|
-
triggerType,
|
|
699
|
-
cachedOriginals,
|
|
435
|
+
var P = /* @__PURE__ */ ((t) => (t.Inline = "inline", t.Link = "link", t.Badge = "badge", t.Unsupported = "unsupported", t))(P || {});
|
|
436
|
+
const St = (t, e) => t && e ? "both" : t ? "widgetDOM" : e ? "triggerDOM" : "none", Ce = (t) => t ? typeof t == "boolean" && t ? "link" : typeof t == "object" && !Array.isArray(t) ? "badge" : "unsupported" : "inline", xt = (t, e, n, i, s = !1) => {
|
|
437
|
+
var l, h;
|
|
438
|
+
const o = St(e, n), r = Ce(i), c = {
|
|
439
|
+
widgetDOMElement: e ? e.cloneNode(!0) : void 0,
|
|
440
|
+
triggerDOMElement: n ? n.cloneNode(!0) : void 0
|
|
441
|
+
}, a = {
|
|
442
|
+
triggerType: r,
|
|
443
|
+
cachedOriginals: c,
|
|
700
444
|
widgetDOMElement: document.createElement("div")
|
|
701
445
|
};
|
|
702
|
-
switch (
|
|
446
|
+
switch (o) {
|
|
703
447
|
case "both": {
|
|
704
|
-
|
|
705
|
-
if (triggerType !== "inline") {
|
|
706
|
-
output.triggerDOMElement = providedTriggerElement;
|
|
707
|
-
}
|
|
448
|
+
a.widgetDOMElement = e || document.createElement("div"), r !== "inline" && (a.triggerDOMElement = n);
|
|
708
449
|
break;
|
|
709
450
|
}
|
|
710
451
|
case "widgetDOM": {
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
if (triggerType === "link") {
|
|
715
|
-
triggerElement.innerText = name;
|
|
716
|
-
}
|
|
717
|
-
output.triggerDOMElement = triggerElement;
|
|
452
|
+
if (a.widgetDOMElement = e || document.createElement("div"), r !== "inline") {
|
|
453
|
+
const u = document.body.appendChild(document.createElement("a"));
|
|
454
|
+
r === "link" && (u.innerText = t), a.triggerDOMElement = u;
|
|
718
455
|
}
|
|
719
456
|
break;
|
|
720
457
|
}
|
|
721
458
|
case "triggerDOM": {
|
|
722
|
-
const
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
widgetElement.style.display = "none";
|
|
728
|
-
(_a = providedTriggerElement == null ? void 0 : providedTriggerElement.parentNode) == null ? void 0 : _a.appendChild(widgetElement);
|
|
729
|
-
output.callback = () => {
|
|
730
|
-
var _a2;
|
|
731
|
-
(_a2 = providedTriggerElement == null ? void 0 : providedTriggerElement.parentNode) == null ? void 0 : _a2.replaceChild(widgetElement, providedTriggerElement);
|
|
732
|
-
widgetElement.style.display = (providedTriggerElement == null ? void 0 : providedTriggerElement.style.display) || "block";
|
|
733
|
-
};
|
|
734
|
-
} else {
|
|
735
|
-
(_b = providedTriggerElement == null ? void 0 : providedTriggerElement.parentNode) == null ? void 0 : _b.replaceChild(widgetElement, providedTriggerElement);
|
|
736
|
-
}
|
|
737
|
-
output.cachedOriginals.widgetDOMElement = providedTriggerElement;
|
|
738
|
-
output.cachedOriginals.triggerDOMElement = void 0;
|
|
739
|
-
} else {
|
|
740
|
-
output.widgetDOMElement = document.body.appendChild(widgetElement);
|
|
741
|
-
output.triggerDOMElement = providedTriggerElement;
|
|
742
|
-
}
|
|
459
|
+
const u = document.createElement("div");
|
|
460
|
+
a.widgetDOMElement = u, r === "inline" ? (u.id = (n == null ? void 0 : n.id) || "", s ? (u.style.display = "none", (l = n == null ? void 0 : n.parentNode) == null || l.appendChild(u), a.callback = () => {
|
|
461
|
+
var p;
|
|
462
|
+
(p = n == null ? void 0 : n.parentNode) == null || p.replaceChild(u, n), u.style.display = (n == null ? void 0 : n.style.display) || "block";
|
|
463
|
+
}) : (h = n == null ? void 0 : n.parentNode) == null || h.replaceChild(u, n), a.cachedOriginals.widgetDOMElement = n, a.cachedOriginals.triggerDOMElement = void 0) : (a.widgetDOMElement = document.body.appendChild(u), a.triggerDOMElement = n);
|
|
743
464
|
break;
|
|
744
465
|
}
|
|
745
466
|
case "none": {
|
|
746
|
-
const
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
if (triggerType === "link") {
|
|
751
|
-
triggerElement.innerText = name;
|
|
752
|
-
}
|
|
753
|
-
output.triggerDOMElement = triggerElement;
|
|
467
|
+
const u = document.body.appendChild(document.createElement("div"));
|
|
468
|
+
if (a.widgetDOMElement = u, r !== "inline") {
|
|
469
|
+
const p = document.body.appendChild(document.createElement("a"));
|
|
470
|
+
r === "link" && (p.innerText = t), a.triggerDOMElement = p;
|
|
754
471
|
}
|
|
755
472
|
break;
|
|
756
473
|
}
|
|
757
474
|
}
|
|
758
|
-
return
|
|
759
|
-
};
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
this.
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
const widget = this.container.get("$widget");
|
|
769
|
-
this.options.widgetDOMElement.classList.add("humany-widget");
|
|
770
|
-
this.options.widgetDOMElement.classList.add(`humany_${widget.name}`);
|
|
771
|
-
const widgetDOMElements = container.get("widgetDOMElements") || [];
|
|
772
|
-
container.register("widgetDOMElements", [
|
|
773
|
-
...widgetDOMElements,
|
|
475
|
+
return a;
|
|
476
|
+
}, At = "modals";
|
|
477
|
+
class Dt {
|
|
478
|
+
constructor(e, n) {
|
|
479
|
+
this.options = n, this.unsubscribe = [], this.container = e.createChild(this), this.container.register("widgetDOMElement", this.options.widgetDOMElement), this.container.register("triggerDOMElement", this.options.triggerDOMElement);
|
|
480
|
+
const i = this.container.get("$widget");
|
|
481
|
+
this.options.widgetDOMElement.classList.add("humany-widget"), this.options.widgetDOMElement.classList.add(`humany_${i.name}`);
|
|
482
|
+
const s = e.get("widgetDOMElements") || [];
|
|
483
|
+
e.register("widgetDOMElements", [
|
|
484
|
+
...s,
|
|
774
485
|
this.options.widgetDOMElement
|
|
775
486
|
]);
|
|
776
487
|
}
|
|
777
488
|
render() {
|
|
778
|
-
const { widgetDOMElement, triggerDOMElement } = this.options;
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
if (triggerDOMElement && this.options.triggerType === TriggerType.Badge) {
|
|
784
|
-
setLoading(triggerDOMElement);
|
|
785
|
-
}
|
|
786
|
-
return import("./render.js").then((module) => module.default(this.container, widgetDOMElement)).then(() => {
|
|
787
|
-
widgetDOMElement.setAttribute("data-rendered", "true");
|
|
788
|
-
if (triggerDOMElement && this.options.triggerType === TriggerType.Badge) {
|
|
789
|
-
const tooltip = this.options.triggerOptions.openTooltip;
|
|
790
|
-
setActive(triggerDOMElement, tooltip);
|
|
489
|
+
const { widgetDOMElement: e, triggerDOMElement: n } = this.options, i = this.container.get("$widget");
|
|
490
|
+
return e.getAttribute("data-rendered") === "true" ? Promise.resolve() : (n && this.options.triggerType === P.Badge && Ot(n), import("./render.8763910e.js").then((s) => s.default(this.container, e)).then(() => {
|
|
491
|
+
if (e.setAttribute("data-rendered", "true"), n && this.options.triggerType === P.Badge) {
|
|
492
|
+
const o = this.options.triggerOptions.openTooltip;
|
|
493
|
+
Ee(n, o);
|
|
791
494
|
}
|
|
792
|
-
|
|
793
|
-
const
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
widget.events.dispatch("widget:modal-opened", modal);
|
|
799
|
-
}
|
|
800
|
-
});
|
|
801
|
-
}
|
|
495
|
+
Ue(this.container, e);
|
|
496
|
+
const s = this.container.get("$environment").widgets.all();
|
|
497
|
+
N(this.container, At, v.Session).then((o) => {
|
|
498
|
+
o && o.forEach((r) => {
|
|
499
|
+
s.find((c) => c.name === r.name && c.state === "activated") && i.events.dispatch("widget:modal-opened", r);
|
|
500
|
+
});
|
|
802
501
|
});
|
|
803
|
-
});
|
|
502
|
+
}));
|
|
804
503
|
}
|
|
805
|
-
renderBadge(
|
|
806
|
-
const { triggerDOMElement } = this.options;
|
|
807
|
-
if (!
|
|
504
|
+
renderBadge(e) {
|
|
505
|
+
const { triggerDOMElement: n } = this.options;
|
|
506
|
+
if (!n)
|
|
808
507
|
return;
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
label,
|
|
819
|
-
symbol,
|
|
820
|
-
ariaLabel,
|
|
821
|
-
widgetName: name,
|
|
822
|
-
tooltip: closedTooltip
|
|
508
|
+
n.getAttribute("role") || n.setAttribute("role", "button");
|
|
509
|
+
const { name: i } = this.container.get("$widget"), { label: s, symbol: o, ariaLabel: r, closedTooltip: c, openTooltip: a } = e, l = { closedTooltip: c, openTooltip: a };
|
|
510
|
+
this.options.triggerOptions = l;
|
|
511
|
+
const h = Et(n, {
|
|
512
|
+
label: s,
|
|
513
|
+
symbol: o,
|
|
514
|
+
ariaLabel: r,
|
|
515
|
+
widgetName: i,
|
|
516
|
+
tooltip: c
|
|
823
517
|
});
|
|
824
|
-
this.unsubscribe.push(
|
|
518
|
+
this.unsubscribe.push(h);
|
|
825
519
|
}
|
|
826
520
|
dispose() {
|
|
827
|
-
return import("./unmount.js").then((
|
|
828
|
-
var
|
|
829
|
-
const { triggerDOMElement, widgetDOMElement } = this.options;
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
(_a = widgetDOMElement.parentNode) == null ? void 0 : _a.replaceChild(this.options.cachedOriginals.widgetDOMElement, widgetDOMElement);
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
if (this.options.cachedOriginals.triggerDOMElement) {
|
|
837
|
-
if (triggerDOMElement) {
|
|
838
|
-
(_b = triggerDOMElement.parentNode) == null ? void 0 : _b.replaceChild(this.options.cachedOriginals.triggerDOMElement, triggerDOMElement);
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
this.unsubscribe.forEach((unsubscribe) => {
|
|
842
|
-
unsubscribe();
|
|
843
|
-
});
|
|
844
|
-
(_c = widgetDOMElement.parentNode) == null ? void 0 : _c.removeChild(widgetDOMElement);
|
|
845
|
-
(_d = triggerDOMElement == null ? void 0 : triggerDOMElement.parentNode) == null ? void 0 : _d.removeChild(triggerDOMElement);
|
|
521
|
+
return import("./unmount.b0816844.js").then((e) => {
|
|
522
|
+
var s, o, r, c;
|
|
523
|
+
const { triggerDOMElement: n, widgetDOMElement: i } = this.options;
|
|
524
|
+
e.default(i), this.options.cachedOriginals.widgetDOMElement && i && ((s = i.parentNode) == null || s.replaceChild(this.options.cachedOriginals.widgetDOMElement, i)), this.options.cachedOriginals.triggerDOMElement && n && ((o = n.parentNode) == null || o.replaceChild(this.options.cachedOriginals.triggerDOMElement, n)), this.unsubscribe.forEach((a) => {
|
|
525
|
+
a();
|
|
526
|
+
}), (r = i.parentNode) == null || r.removeChild(i), (c = n == null ? void 0 : n.parentNode) == null || c.removeChild(n);
|
|
846
527
|
});
|
|
847
528
|
}
|
|
848
529
|
}
|
|
849
|
-
const
|
|
850
|
-
const
|
|
851
|
-
|
|
852
|
-
if (settings.context && typeof settings.context !== "function") {
|
|
853
|
-
attributes.context = settings.context;
|
|
854
|
-
}
|
|
855
|
-
if (settings.properties && typeof settings.properties !== "function") {
|
|
856
|
-
attributes.properties = settings.properties;
|
|
857
|
-
}
|
|
858
|
-
if (settings.layout && typeof settings.layout !== "function") {
|
|
859
|
-
attributes.layout = settings.layout;
|
|
860
|
-
}
|
|
861
|
-
return attributes;
|
|
530
|
+
const F = "changesets", Mt = (t) => {
|
|
531
|
+
const e = { tags: t.tags };
|
|
532
|
+
return t.context && typeof t.context != "function" && (e.context = t.context), t.properties && typeof t.properties != "function" && (e.properties = t.properties), t.layout && typeof t.layout != "function" && (e.layout = t.layout), e;
|
|
862
533
|
};
|
|
863
|
-
class
|
|
864
|
-
constructor(
|
|
865
|
-
this.container =
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
534
|
+
class se {
|
|
535
|
+
constructor(e, n) {
|
|
536
|
+
this.container = e, this.storageWriter = n;
|
|
537
|
+
}
|
|
538
|
+
static create(e) {
|
|
539
|
+
return _(e, F, I.Necessary, {
|
|
540
|
+
medium: v.Local
|
|
541
|
+
}).then((n) => new se(e, n));
|
|
542
|
+
}
|
|
543
|
+
write(e, n, i, s) {
|
|
544
|
+
return Z(this)(() => N(this.container, F, v.Local).then((o = {}) => {
|
|
545
|
+
const { keys: r = [], items: c = {} } = o, a = r.indexOf(e);
|
|
546
|
+
return a > -1 && r.splice(a, 1), r.push(e), c[e] = {
|
|
547
|
+
options: s,
|
|
548
|
+
attributes: Mt(i),
|
|
549
|
+
rules: n.rules
|
|
550
|
+
}, this.storageWriter({ keys: r, items: c });
|
|
551
|
+
}));
|
|
872
552
|
}
|
|
873
|
-
|
|
874
|
-
return
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
keys.splice(existingIndex, 1);
|
|
880
|
-
}
|
|
881
|
-
keys.push(key);
|
|
882
|
-
items[key] = {
|
|
883
|
-
options,
|
|
884
|
-
attributes: convertSettingsToAttributes(attributes),
|
|
885
|
-
rules: target.rules
|
|
886
|
-
};
|
|
887
|
-
return this.storageWriter({ keys, items });
|
|
888
|
-
});
|
|
889
|
-
});
|
|
553
|
+
remove(e) {
|
|
554
|
+
return Z(this)(() => N(this.container, F, v.Local).then((n = {}) => {
|
|
555
|
+
const { keys: i = [], items: s = {} } = n, o = i.indexOf(e);
|
|
556
|
+
if (o > -1)
|
|
557
|
+
return i.splice(o, 1), delete s[e], this.storageWriter(n);
|
|
558
|
+
}));
|
|
890
559
|
}
|
|
891
|
-
|
|
892
|
-
return
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
const
|
|
896
|
-
if (
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
560
|
+
load(e) {
|
|
561
|
+
return Z(this)(() => N(this.container, F, v.Local).then((n = {}) => {
|
|
562
|
+
const { keys: i = [], items: s = {} } = n;
|
|
563
|
+
i.forEach((o) => {
|
|
564
|
+
const r = s[o];
|
|
565
|
+
if (r) {
|
|
566
|
+
const { rules: c, attributes: a, options: l } = r;
|
|
567
|
+
e.write({
|
|
568
|
+
attributes: a,
|
|
569
|
+
options: l,
|
|
570
|
+
target: new Me(e, c)
|
|
571
|
+
});
|
|
900
572
|
}
|
|
901
573
|
});
|
|
902
|
-
});
|
|
903
|
-
}
|
|
904
|
-
load(platform) {
|
|
905
|
-
return lock(this)(() => {
|
|
906
|
-
return readStorage(this.container, STORAGE_KEY, StorageMedium.Local).then((bag = {}) => {
|
|
907
|
-
const { keys = [], items = {} } = bag;
|
|
908
|
-
keys.forEach((key) => {
|
|
909
|
-
const item = items[key];
|
|
910
|
-
if (item) {
|
|
911
|
-
const { rules, attributes, options } = item;
|
|
912
|
-
platform.write({
|
|
913
|
-
attributes,
|
|
914
|
-
options,
|
|
915
|
-
target: new ComponentQuery(platform, rules)
|
|
916
|
-
});
|
|
917
|
-
}
|
|
918
|
-
});
|
|
919
|
-
});
|
|
920
|
-
});
|
|
574
|
+
}));
|
|
921
575
|
}
|
|
922
576
|
}
|
|
923
|
-
const
|
|
924
|
-
const { container } =
|
|
925
|
-
return
|
|
926
|
-
const
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
widget.events.subscribe("widget:state-change", (event, data) => {
|
|
931
|
-
if (data.state === WidgetState.Deactivating) {
|
|
932
|
-
destructComponentModel();
|
|
933
|
-
}
|
|
934
|
-
});
|
|
935
|
-
return platform;
|
|
577
|
+
const Nt = (t) => {
|
|
578
|
+
const { container: e } = t;
|
|
579
|
+
return se.create(e).then((n) => {
|
|
580
|
+
const i = e.get("$settings"), s = { localStorage: n }, o = new Ae(t, s), r = De(o, i);
|
|
581
|
+
return t.events.subscribe("widget:state-change", (c, a) => {
|
|
582
|
+
a.state === tt.Deactivating && r();
|
|
583
|
+
}), o;
|
|
936
584
|
});
|
|
937
|
-
}
|
|
938
|
-
const
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
const link = document.createElement("a");
|
|
942
|
-
link.href = href;
|
|
943
|
-
return link;
|
|
944
|
-
};
|
|
945
|
-
let location = window.location;
|
|
946
|
-
if (site === "referrer" && document.referrer) {
|
|
947
|
-
location = parseLocation(document.referrer);
|
|
948
|
-
}
|
|
949
|
-
return [forceHttps ? "https:" : "", "//", location.host, location.pathname].join("");
|
|
585
|
+
}, Lt = (t, e) => () => {
|
|
586
|
+
const n = (s) => {
|
|
587
|
+
const o = document.createElement("a");
|
|
588
|
+
return o.href = s, o;
|
|
950
589
|
};
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
basePath
|
|
967
|
-
});
|
|
968
|
-
return routingService;
|
|
969
|
-
});
|
|
590
|
+
let i = window.location;
|
|
591
|
+
return t === "referrer" && document.referrer && (i = n(document.referrer)), [e ? "https:" : "", "//", i.host, i.pathname].join("");
|
|
592
|
+
}, $t = (t) => import("@telia-ace/widget-routing").then(({ RoutingService: e, HistoryMode: n }) => t.get("settings").then((i) => {
|
|
593
|
+
const {
|
|
594
|
+
routing: { initialPath: s = "/", mode: o = n.scopedHash, basePath: r },
|
|
595
|
+
views: c
|
|
596
|
+
} = i;
|
|
597
|
+
return new e(t, {
|
|
598
|
+
initialPath: s,
|
|
599
|
+
mode: o,
|
|
600
|
+
routes: Object.keys(c).map((l) => ({
|
|
601
|
+
name: l,
|
|
602
|
+
path: c[l].path
|
|
603
|
+
})),
|
|
604
|
+
basePath: r
|
|
970
605
|
});
|
|
971
|
-
}
|
|
972
|
-
const
|
|
973
|
-
|
|
974
|
-
|
|
606
|
+
})), kt = (t) => import("@telia-ace/widget-services").then(({ StorageProvider: e }) => new e()), Pt = (t) => import("@telia-ace/knowledge-serviceclient").then(({ ServiceClient: e, ServiceProxy: n }) => t.get("settings").then((i) => {
|
|
607
|
+
const { name: s, events: o } = t.get("$widget"), {
|
|
608
|
+
data: { projection: r = "", site: c = "current", forceHttps: a = !1 }
|
|
609
|
+
} = i, l = new n(r, { credentials: "same-origin" }), h = new e(l, {
|
|
610
|
+
funnel: s.replace("_contact-method", "").replace("_contact", ""),
|
|
611
|
+
site: Lt(c, a)
|
|
975
612
|
});
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
const client = new ServiceClient(proxy, {
|
|
986
|
-
funnel: name.replace("_contact-method", "").replace("_contact", ""),
|
|
987
|
-
site: createSiteProvider(site, forceHttps)
|
|
988
|
-
});
|
|
989
|
-
events.subscribe("widget:settings-updated", (event, { data }) => {
|
|
990
|
-
if (data && data.projection !== projection) {
|
|
991
|
-
client.proxy.setBaseUrl(data.projection);
|
|
992
|
-
}
|
|
993
|
-
});
|
|
994
|
-
return client;
|
|
995
|
-
});
|
|
996
|
-
});
|
|
997
|
-
};
|
|
998
|
-
const createActionResolver = (container) => {
|
|
999
|
-
return import("@telia-ace/widget-core").then(({ ActionResolver }) => {
|
|
1000
|
-
return new ActionResolver(container);
|
|
1001
|
-
});
|
|
1002
|
-
};
|
|
1003
|
-
const createComponentResolver = (container) => {
|
|
1004
|
-
return import("@telia-ace/widget-core").then(({ ComponentResolver }) => {
|
|
1005
|
-
return new ComponentResolver(container);
|
|
1006
|
-
});
|
|
1007
|
-
};
|
|
1008
|
-
const createComponentPlatform = (container) => {
|
|
1009
|
-
return import("@telia-ace/widget-core").then(({ ComponentPlatform: ComponentPlatform2, createComponentModel: createComponentModel2 }) => {
|
|
1010
|
-
return createPlatform(container.get("$widget"));
|
|
1011
|
-
});
|
|
1012
|
-
};
|
|
1013
|
-
const SETTINGS_STORAGE_KEY = "$settings";
|
|
1014
|
-
const OPEN_STORAGE_KEY = "open";
|
|
1015
|
-
const STICKY_WIDGET_STORAGE_KEY = "activeStickyWidget";
|
|
1016
|
-
class Widget extends WidgetType {
|
|
1017
|
-
constructor(container) {
|
|
1018
|
-
super(container);
|
|
1019
|
-
this.outlets = /* @__PURE__ */ new Map();
|
|
1020
|
-
this.activated = void 0;
|
|
1021
|
-
this.subs = [];
|
|
1022
|
-
this.handleBootstrapping = (activationData) => {
|
|
1023
|
-
const options = {
|
|
1024
|
-
triggerDOMElement: activationData.sourceDOMElement,
|
|
613
|
+
return o.subscribe("widget:settings-updated", (u, { data: p }) => {
|
|
614
|
+
p && p.projection !== r && h.proxy.setBaseUrl(p.projection);
|
|
615
|
+
}), h;
|
|
616
|
+
})), Rt = (t) => import("@telia-ace/widget-core").then(({ ActionResolver: e }) => new e(t)), Vt = (t) => import("@telia-ace/widget-core").then(({ ComponentResolver: e }) => new e(t)), _t = (t) => import("@telia-ace/widget-core").then(({ ComponentPlatform: e, createComponentModel: n }) => Nt(t.get("$widget"))), X = "$settings", K = "open", de = "activeStickyWidget";
|
|
617
|
+
class Qt extends nt {
|
|
618
|
+
constructor(e) {
|
|
619
|
+
super(e), this.outlets = /* @__PURE__ */ new Map(), this.activated = void 0, this.subs = [], this.handleBootstrapping = (n) => {
|
|
620
|
+
const i = {
|
|
621
|
+
triggerDOMElement: n.sourceDOMElement,
|
|
1025
622
|
withRenderState: "storage"
|
|
1026
623
|
};
|
|
1027
|
-
this.container.get("settings").then((
|
|
1028
|
-
const { activate } =
|
|
1029
|
-
|
|
1030
|
-
if (shouldActivate) {
|
|
1031
|
-
this.activated = (this.activated || this.widget.activate()).then(() => this.attach(options));
|
|
1032
|
-
}
|
|
1033
|
-
});
|
|
1034
|
-
};
|
|
1035
|
-
this.container.registerAsync("storage", () => createStorageService(this.container));
|
|
1036
|
-
this.container.registerFactory("settings", () => {
|
|
1037
|
-
return readStorage(this.container, SETTINGS_STORAGE_KEY, StorageMedium.Local).then((settings = {}) => {
|
|
1038
|
-
return __spreadValues(__spreadValues({}, this.container.get("$settings")), settings);
|
|
624
|
+
this.container.get("settings").then((s) => {
|
|
625
|
+
const { activate: o } = s;
|
|
626
|
+
(typeof o == "undefined" || o === null || o === !0) && (this.activated = (this.activated || this.widget.activate()).then(() => this.attach(i)));
|
|
1039
627
|
});
|
|
1040
|
-
});
|
|
1041
|
-
supportBootstrapping(this, "load", this.handleBootstrapping);
|
|
1042
|
-
this.container.registerAsync("componentResolver", () => createComponentResolver(this.container));
|
|
1043
|
-
this.container.registerAsync("matchingClient", () => createServiceClient(this.container));
|
|
1044
|
-
this.container.registerAsync("router", () => createRoutingService(this.container));
|
|
1045
|
-
this.container.registerAsync("actionResolver", () => createActionResolver(this.container));
|
|
1046
|
-
this.container.register("matchMedia", window.matchMedia);
|
|
1047
|
-
this.container.registerAsync("components", () => createComponentPlatform(this.container));
|
|
628
|
+
}, this.container.registerAsync("storage", () => kt(this.container)), this.container.registerFactory("settings", () => N(this.container, X, v.Local).then((n = {}) => f(f({}, this.container.get("$settings")), n))), et(this, "load", this.handleBootstrapping), this.container.registerAsync("componentResolver", () => Vt(this.container)), this.container.registerAsync("matchingClient", () => Pt(this.container)), this.container.registerAsync("router", () => $t(this.container)), this.container.registerAsync("actionResolver", () => Rt(this.container)), this.container.register("matchMedia", window.matchMedia), this.container.registerAsync("components", () => _t(this.container));
|
|
1048
629
|
}
|
|
1049
630
|
initialize() {
|
|
1050
|
-
const
|
|
1051
|
-
return Promise.all([
|
|
1052
|
-
var
|
|
1053
|
-
|
|
1054
|
-
const
|
|
1055
|
-
|
|
1056
|
-
|
|
631
|
+
const e = this.container.getManyAsync("actionResolver", "router", "components");
|
|
632
|
+
return Promise.all([e, this.container.get("settings")]).then(([{ actionResolver: n, router: i, components: s }, o]) => {
|
|
633
|
+
var a;
|
|
634
|
+
n.subscribe(this.widget.name, (l, h, u) => this.onAction(h, u));
|
|
635
|
+
const r = (l) => {
|
|
636
|
+
s.nodes.query({ type: "view" }).forEach((h) => {
|
|
637
|
+
s.setSwitch(h, l);
|
|
1057
638
|
});
|
|
1058
|
-
};
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
const { routeData: prevData } = previous;
|
|
1070
|
-
const { routeData: nextData } = next;
|
|
1071
|
-
const notFoundView = Object.keys(settings.views).reduce((acc, key) => {
|
|
1072
|
-
const view = settings.views[key];
|
|
1073
|
-
if (typeof view.path === "undefined") {
|
|
1074
|
-
return key;
|
|
1075
|
-
}
|
|
1076
|
-
return acc;
|
|
1077
|
-
}, "");
|
|
1078
|
-
if (!nextData.name && notFoundView) {
|
|
1079
|
-
switchViewNodes(notFoundView);
|
|
1080
|
-
} else {
|
|
1081
|
-
switchViewNodes(nextData.name);
|
|
1082
|
-
}
|
|
1083
|
-
removeNullAndUndefinedValues(prevData && prevData.params);
|
|
1084
|
-
removeNullAndUndefinedValues(nextData && nextData.params);
|
|
1085
|
-
this.container.getAsync("actionResolver").then((actionResolver2) => {
|
|
1086
|
-
actionResolver2.action(this.widget.name, "routeChange", {
|
|
1087
|
-
next: nextData,
|
|
1088
|
-
previous: prevData
|
|
639
|
+
}, c = ((a = i.getInitialRoute()) == null ? void 0 : a.name) || "index";
|
|
640
|
+
return r(c), this.events.subscribe("widget:data-loaded", (l, { element: h }) => {
|
|
641
|
+
this.widget.container.get("seoConfiguration") && this.events.dispatch("widget:preloaded-replaced", {
|
|
642
|
+
element: h
|
|
643
|
+
});
|
|
644
|
+
}), this.events.subscribe("router:change", (l, { previous: h = { routeData: {} }, next: u = { routeData: {} } }) => {
|
|
645
|
+
const { routeData: p } = h, { routeData: g } = u, m = Object.keys(o.views).reduce((b, y) => typeof o.views[y].path == "undefined" ? y : b, "");
|
|
646
|
+
!g.name && m ? r(m) : r(g.name), he(p && p.params), he(g && g.params), this.container.getAsync("actionResolver").then((b) => {
|
|
647
|
+
b.action(this.widget.name, "routeChange", {
|
|
648
|
+
next: g,
|
|
649
|
+
previous: p
|
|
1089
650
|
});
|
|
1090
651
|
});
|
|
1091
|
-
});
|
|
1092
|
-
return router.initialize();
|
|
652
|
+
}), i.initialize();
|
|
1093
653
|
});
|
|
1094
654
|
}
|
|
1095
|
-
attach(
|
|
1096
|
-
return this.container.get("settings").then(({ trigger }) => {
|
|
1097
|
-
var
|
|
655
|
+
attach(e = {}) {
|
|
656
|
+
return this.container.get("settings").then(({ trigger: n }) => {
|
|
657
|
+
var p, g;
|
|
1098
658
|
const {
|
|
1099
|
-
widgetDOMElement,
|
|
1100
|
-
key =
|
|
1101
|
-
triggerDOMElement,
|
|
1102
|
-
withRenderState
|
|
1103
|
-
} =
|
|
1104
|
-
|
|
1105
|
-
const
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
const isReady = () => widgetDOMElement2.querySelectorAll("[data-loading=true]").length === 0;
|
|
1112
|
-
const [widgetDOMElement2] = this.widget.container.get("widgetDOMElements");
|
|
1113
|
-
const watcher = (mutations, observer2) => {
|
|
1114
|
-
if (isReady()) {
|
|
1115
|
-
if (outletOptions.callback) {
|
|
1116
|
-
outletOptions.callback();
|
|
1117
|
-
}
|
|
1118
|
-
observer2.disconnect();
|
|
1119
|
-
}
|
|
1120
|
-
};
|
|
1121
|
-
const options = {
|
|
1122
|
-
attributes: true,
|
|
1123
|
-
subtree: true
|
|
659
|
+
widgetDOMElement: i,
|
|
660
|
+
key: s = Ye(),
|
|
661
|
+
triggerDOMElement: o,
|
|
662
|
+
withRenderState: r
|
|
663
|
+
} = e, a = Ce(n) === P.Inline && ((o == null ? void 0 : o.childElementCount) || 0) > 0, l = xt(this.widget.name, i, o, n, a);
|
|
664
|
+
this.outlets.size < 1 && !r && this.setRenderState("unset");
|
|
665
|
+
const h = () => {
|
|
666
|
+
const m = () => b.querySelectorAll("[data-loading=true]").length === 0, [b] = this.widget.container.get("widgetDOMElements"), y = (x, $) => {
|
|
667
|
+
m() && (l.callback && l.callback(), $.disconnect());
|
|
668
|
+
}, S = {
|
|
669
|
+
attributes: !0,
|
|
670
|
+
subtree: !0
|
|
1124
671
|
};
|
|
1125
|
-
|
|
1126
|
-
outletOptions.callback && outletOptions.callback();
|
|
1127
|
-
}
|
|
1128
|
-
const observer = new MutationObserver(watcher);
|
|
1129
|
-
observer.observe(widgetDOMElement2, options);
|
|
672
|
+
m() && l.callback && l.callback(), new MutationObserver(y).observe(b, S);
|
|
1130
673
|
};
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
if (data.unresolvedQueries === 0) {
|
|
1135
|
-
swap();
|
|
1136
|
-
}
|
|
1137
|
-
});
|
|
674
|
+
a && this.widget.container.getAsync("dataClient").then(({ events: m }) => {
|
|
675
|
+
m.subscribe("data-client:fetched", (b, y) => {
|
|
676
|
+
y.unresolvedQueries === 0 && h();
|
|
1138
677
|
});
|
|
1139
|
-
}
|
|
1140
|
-
const
|
|
1141
|
-
this.outlets.set(
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
(_a = outletOptions.triggerDOMElement) == null ? void 0 : _a.setAttribute("aria-expanded", "false");
|
|
1145
|
-
outlet == null ? void 0 : outlet.renderBadge(trigger);
|
|
1146
|
-
}
|
|
1147
|
-
if (outletOptions.triggerType !== TriggerType.Inline) {
|
|
1148
|
-
(_b = outletOptions.triggerDOMElement) == null ? void 0 : _b.addEventListener("click", (event) => {
|
|
1149
|
-
event.preventDefault();
|
|
1150
|
-
this.container.get("settings").then(({ trigger: updatedTrigger }) => {
|
|
1151
|
-
outlet.render().then(() => this.renderState()).then((renderState) => {
|
|
1152
|
-
if (updatedTrigger && updatedTrigger.action && updatedTrigger.action === "hide") {
|
|
1153
|
-
return renderState === WidgetRenderState.open ? this.hide() : this.open();
|
|
1154
|
-
}
|
|
1155
|
-
return renderState === WidgetRenderState.open ? this.close() : this.open();
|
|
1156
|
-
});
|
|
1157
|
-
});
|
|
678
|
+
});
|
|
679
|
+
const u = this.getOrCreateViewOutlet(s, l);
|
|
680
|
+
if (this.outlets.set(s, u), this.widget.events.dispatch("widget:attached", {}, { bubbles: !0 }), l.triggerType === P.Badge && n && ((p = l.triggerDOMElement) == null || p.setAttribute("aria-expanded", "false"), u == null || u.renderBadge(n)), l.triggerType !== P.Inline && ((g = l.triggerDOMElement) == null || g.addEventListener("click", (m) => {
|
|
681
|
+
m.preventDefault(), this.container.get("settings").then(({ trigger: b }) => {
|
|
682
|
+
u.render().then(() => this.renderState()).then((y) => b && b.action && b.action === "hide" ? y === C.open ? this.hide() : this.open() : y === C.open ? this.close() : this.open());
|
|
1158
683
|
});
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
this.triggerStateIfApplicable(state);
|
|
684
|
+
})), this.outlets.size > 1)
|
|
685
|
+
return this.renderState().then((m) => {
|
|
686
|
+
this.triggerStateIfApplicable(m);
|
|
1163
687
|
});
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
this.triggerStateIfApplicable(state);
|
|
1173
|
-
});
|
|
1174
|
-
}
|
|
1175
|
-
return this.triggerStateIfApplicable(withRenderState);
|
|
1176
|
-
}
|
|
688
|
+
if (r)
|
|
689
|
+
return r === "storage" ? this.renderState().then((m) => {
|
|
690
|
+
if (l.triggerType === P.Inline) {
|
|
691
|
+
this.triggerStateIfApplicable("open");
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
this.triggerStateIfApplicable(m);
|
|
695
|
+
}) : this.triggerStateIfApplicable(r);
|
|
1177
696
|
});
|
|
1178
697
|
}
|
|
1179
|
-
detach(
|
|
1180
|
-
if (
|
|
1181
|
-
if (this.outlets.has(
|
|
1182
|
-
const
|
|
1183
|
-
|
|
1184
|
-
this.outlets.delete(key);
|
|
698
|
+
detach(e) {
|
|
699
|
+
if (e) {
|
|
700
|
+
if (this.outlets.has(e)) {
|
|
701
|
+
const n = this.outlets.get(e);
|
|
702
|
+
n == null || n.dispose(), this.outlets.delete(e);
|
|
1185
703
|
return;
|
|
1186
704
|
}
|
|
705
|
+
process.env.NODE_ENV !== "production" && console.warn(`detach(): Could not find View Outlet with key ${e}`);
|
|
1187
706
|
return;
|
|
1188
707
|
}
|
|
1189
|
-
this.outlets.forEach((
|
|
1190
|
-
|
|
1191
|
-
});
|
|
1192
|
-
this.outlets.clear();
|
|
708
|
+
this.outlets.forEach((n) => {
|
|
709
|
+
n.dispose();
|
|
710
|
+
}), this.outlets.clear();
|
|
1193
711
|
}
|
|
1194
|
-
triggerStateIfApplicable(
|
|
1195
|
-
return this.container.getAsync("router").then((
|
|
1196
|
-
switch (
|
|
712
|
+
triggerStateIfApplicable(e) {
|
|
713
|
+
return this.container.getAsync("router").then((n) => {
|
|
714
|
+
switch (e) {
|
|
1197
715
|
case "closed":
|
|
1198
716
|
this.close();
|
|
1199
717
|
break;
|
|
@@ -1201,216 +719,151 @@ class Widget extends WidgetType {
|
|
|
1201
719
|
this.open();
|
|
1202
720
|
break;
|
|
1203
721
|
case "hidden":
|
|
1204
|
-
this.hide();
|
|
1205
|
-
router.start();
|
|
722
|
+
this.hide(), n.start();
|
|
1206
723
|
break;
|
|
1207
724
|
default:
|
|
1208
725
|
return;
|
|
1209
726
|
}
|
|
1210
727
|
});
|
|
1211
728
|
}
|
|
1212
|
-
getOrCreateViewOutlet(
|
|
1213
|
-
return this.outlets.has(
|
|
729
|
+
getOrCreateViewOutlet(e, n) {
|
|
730
|
+
return this.outlets.has(e) ? this.outlets.get(e) : new Dt(this.container, n);
|
|
1214
731
|
}
|
|
1215
|
-
render(
|
|
1216
|
-
if (
|
|
1217
|
-
const
|
|
732
|
+
render(e = {}) {
|
|
733
|
+
if (process.env.NODE_ENV !== "production" && console.warn("widget.render() is deprecated. Use widget.attach() instead."), e.open) {
|
|
734
|
+
const n = E(f({}, e), {
|
|
1218
735
|
withRenderState: "open"
|
|
1219
736
|
});
|
|
1220
|
-
return this.attach(
|
|
737
|
+
return this.attach(n);
|
|
1221
738
|
}
|
|
1222
|
-
return this.attach(
|
|
739
|
+
return this.attach(e);
|
|
1223
740
|
}
|
|
1224
|
-
activate(
|
|
1225
|
-
|
|
1226
|
-
this.setSettings(() => data.override);
|
|
1227
|
-
}
|
|
1228
|
-
if (data == null ? void 0 : data.apiNotificationPriorityBy) {
|
|
1229
|
-
this.container.register("apiNotificationPriorityBy", data.apiNotificationPriorityBy);
|
|
1230
|
-
}
|
|
741
|
+
activate(e) {
|
|
742
|
+
e != null && e.override && this.setSettings(() => e.override), e != null && e.apiNotificationPriorityBy && this.container.register("apiNotificationPriorityBy", e.apiNotificationPriorityBy);
|
|
1231
743
|
}
|
|
1232
|
-
setSettings(
|
|
744
|
+
setSettings(e) {
|
|
1233
745
|
return Promise.all([
|
|
1234
746
|
this.container.get("settings"),
|
|
1235
|
-
|
|
1236
|
-
medium:
|
|
747
|
+
_(this.container, X, I.Necessary, {
|
|
748
|
+
medium: v.Local
|
|
1237
749
|
})
|
|
1238
|
-
]).then(([
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
this.widget.events.dispatch("widget:settings-updated", updated);
|
|
1243
|
-
return updated;
|
|
1244
|
-
});
|
|
1245
|
-
});
|
|
1246
|
-
});
|
|
750
|
+
]).then(([n, i]) => Promise.resolve(e(n)).then((s) => i(s).then(() => {
|
|
751
|
+
const o = f(f({}, n), s);
|
|
752
|
+
return this.widget.events.dispatch("widget:settings-updated", o), o;
|
|
753
|
+
})));
|
|
1247
754
|
}
|
|
1248
755
|
clearSettings() {
|
|
1249
|
-
return
|
|
1250
|
-
this.widget.events.dispatch("widget:settings-updated",
|
|
756
|
+
return _(this.container, X, I.Necessary, { medium: v.Local }).then((e) => e()).then(() => this.container.get("settings")).then((e) => {
|
|
757
|
+
this.widget.events.dispatch("widget:settings-updated", e);
|
|
1251
758
|
});
|
|
1252
759
|
}
|
|
1253
|
-
action({ action, value }) {
|
|
1254
|
-
return this.container.getAsync("actionResolver").then((
|
|
1255
|
-
|
|
760
|
+
action({ action: e, value: n }) {
|
|
761
|
+
return this.container.getAsync("actionResolver").then((i) => {
|
|
762
|
+
i.action(this.widget.name, e, n);
|
|
1256
763
|
});
|
|
1257
764
|
}
|
|
1258
765
|
renderState() {
|
|
1259
|
-
if (
|
|
1260
|
-
return Promise.resolve(
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
const readLocalOpen = () => readStorage(this.container, OPEN_STORAGE_KEY, StorageMedium.Session).then((value = WidgetRenderState.closed) => value);
|
|
1264
|
-
return this.container.getAsync("router").then((routing) => {
|
|
1265
|
-
if (routing.isSticky()) {
|
|
1266
|
-
return readLocalOpen().then((localOpen) => {
|
|
1267
|
-
return localOpen === WidgetRenderState.open ? localOpen : readSessionOpen();
|
|
1268
|
-
});
|
|
1269
|
-
}
|
|
1270
|
-
return readSessionOpen();
|
|
1271
|
-
});
|
|
766
|
+
if (Je(this.container))
|
|
767
|
+
return Promise.resolve(C.open);
|
|
768
|
+
const e = () => N(this.container, K, v.Session).then((i = C.closed) => i), n = () => N(this.container, K, v.Session).then((i = C.closed) => i);
|
|
769
|
+
return this.container.getAsync("router").then((i) => i.isSticky() ? n().then((s) => s === C.open ? s : e()) : e());
|
|
1272
770
|
}
|
|
1273
771
|
hide() {
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
}
|
|
1277
|
-
this.outlets.forEach((outlet) => outlet.render());
|
|
1278
|
-
return this.action({ action: "hide" }).then(() => {
|
|
1279
|
-
this.setTriggerState(false);
|
|
1280
|
-
});
|
|
772
|
+
return this.outlets.size < 1 ? (process.env.NODE_ENV !== "production" && console.warn("hide(): No-op as no view outlets are registered. Invoke the attach() command first."), Promise.resolve()) : (this.outlets.forEach((e) => e.render()), this.action({ action: "hide" }).then(() => {
|
|
773
|
+
this.setTriggerState(!1);
|
|
774
|
+
}));
|
|
1281
775
|
}
|
|
1282
776
|
open() {
|
|
1283
|
-
|
|
1284
|
-
return Promise.resolve();
|
|
1285
|
-
}
|
|
1286
|
-
this.outlets.forEach((outlet) => outlet.render());
|
|
1287
|
-
return this.action({ action: "open" }).then(() => {
|
|
1288
|
-
this.widget.events.dispatch("tracking:widget-rendered", {});
|
|
1289
|
-
return this.onOpen();
|
|
1290
|
-
});
|
|
777
|
+
return this.outlets.size < 1 ? (process.env.NODE_ENV !== "production" && console.warn("open(): No-op as no view outlets are registered. Invoke the attach() command first."), Promise.resolve()) : (this.outlets.forEach((e) => e.render()), this.action({ action: "open" }).then(() => (this.widget.events.dispatch("tracking:widget-rendered", {}), this.onOpen())));
|
|
1291
778
|
}
|
|
1292
779
|
close() {
|
|
1293
|
-
|
|
1294
|
-
return Promise.resolve();
|
|
1295
|
-
}
|
|
1296
|
-
return this.action({ action: "close" }).then(() => this.onClose());
|
|
780
|
+
return this.outlets.size < 1 ? (process.env.NODE_ENV !== "production" && console.warn("close(): No-op as no view outlets are registered. Invoke the attach() command first."), Promise.resolve()) : this.action({ action: "close" }).then(() => this.onClose());
|
|
1297
781
|
}
|
|
1298
782
|
show() {
|
|
1299
|
-
return this.open();
|
|
783
|
+
return process.env.NODE_ENV !== "production" && console.warn("show(): Command is deprecated and will be removed in the future. Use open() instead."), this.open();
|
|
1300
784
|
}
|
|
1301
|
-
onAction(
|
|
1302
|
-
switch (
|
|
785
|
+
onAction(e, n) {
|
|
786
|
+
switch (e) {
|
|
1303
787
|
case "close":
|
|
1304
788
|
case "open":
|
|
1305
789
|
case "hide":
|
|
1306
|
-
const
|
|
1307
|
-
return this.setRenderState(
|
|
1308
|
-
this.setTriggerState(
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
}
|
|
1312
|
-
this.outlets.forEach((outlet) => {
|
|
1313
|
-
var _a;
|
|
1314
|
-
return (_a = outlet.options.triggerDOMElement) == null ? void 0 : _a.setAttribute("aria-expanded", "false");
|
|
1315
|
-
});
|
|
1316
|
-
}
|
|
790
|
+
const i = e === "open" ? C.open : e === "close" ? C.closed : C.hidden;
|
|
791
|
+
return this.setRenderState(i).then(() => {
|
|
792
|
+
this.setTriggerState(i === C.open), i !== C.hidden ? i === C.open ? this.onOpen() : this.onClose() : this.outlets.forEach((s) => {
|
|
793
|
+
var o;
|
|
794
|
+
return (o = s.options.triggerDOMElement) == null ? void 0 : o.setAttribute("aria-expanded", "false");
|
|
795
|
+
});
|
|
1317
796
|
});
|
|
1318
797
|
}
|
|
1319
798
|
}
|
|
1320
|
-
setRenderState(
|
|
1321
|
-
const { invoke, events } = this.container.get("$widget");
|
|
799
|
+
setRenderState(e) {
|
|
800
|
+
const { invoke: n, events: i } = this.container.get("$widget");
|
|
1322
801
|
return Promise.all([
|
|
1323
|
-
|
|
1324
|
-
medium:
|
|
802
|
+
_(this.container, K, I.Necessary, {
|
|
803
|
+
medium: v.Session
|
|
1325
804
|
}),
|
|
1326
|
-
|
|
1327
|
-
medium:
|
|
805
|
+
_(this.container, K, I.Necessary, {
|
|
806
|
+
medium: v.Local,
|
|
1328
807
|
duration: { minutes: 5 }
|
|
1329
808
|
}),
|
|
1330
809
|
this.container.getAsync("router"),
|
|
1331
|
-
|
|
1332
|
-
]).then(([
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
} else {
|
|
1337
|
-
if (routing.isSticky()) {
|
|
1338
|
-
writeLocalOpen(newState);
|
|
1339
|
-
}
|
|
1340
|
-
writeSessionOpen(newState);
|
|
1341
|
-
}
|
|
1342
|
-
events.dispatch("widget:render-state-changed", {
|
|
1343
|
-
previous: previousRenderState,
|
|
1344
|
-
next: newState
|
|
810
|
+
n("renderState")
|
|
811
|
+
]).then(([s, o, r, c]) => {
|
|
812
|
+
e === "unset" || !e ? (o(), s()) : (r.isSticky() && o(e), s(e)), i.dispatch("widget:render-state-changed", {
|
|
813
|
+
previous: c,
|
|
814
|
+
next: e
|
|
1345
815
|
});
|
|
1346
816
|
});
|
|
1347
817
|
}
|
|
1348
818
|
onOpen() {
|
|
1349
|
-
return this.container.getAsync("router").then((
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
});
|
|
1354
|
-
return router.start();
|
|
1355
|
-
});
|
|
819
|
+
return this.container.getAsync("router").then((e) => (this.outlets.forEach((n) => {
|
|
820
|
+
var i;
|
|
821
|
+
return (i = n.options.triggerDOMElement) == null ? void 0 : i.setAttribute("aria-expanded", "true");
|
|
822
|
+
}), e.start()));
|
|
1356
823
|
}
|
|
1357
824
|
onClose() {
|
|
1358
|
-
const
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
return Promise.resolve();
|
|
1366
|
-
});
|
|
1367
|
-
};
|
|
1368
|
-
return resetActivateProp().then(() => {
|
|
1369
|
-
return services;
|
|
1370
|
-
}).then(({
|
|
1371
|
-
router,
|
|
1372
|
-
components
|
|
825
|
+
const e = this.container.getManyAsync("router", "components");
|
|
826
|
+
return (() => this.container.get("settings").then((i) => {
|
|
827
|
+
const { activate: s } = this.container.get("$settings");
|
|
828
|
+
return i.activate !== s ? this.setSettings(() => Promise.resolve({ activate: s })) : Promise.resolve();
|
|
829
|
+
}))().then(() => e).then(({
|
|
830
|
+
router: i,
|
|
831
|
+
components: s
|
|
1373
832
|
}) => {
|
|
1374
|
-
const
|
|
1375
|
-
this.outlets.forEach((
|
|
1376
|
-
var
|
|
1377
|
-
return (
|
|
1378
|
-
})
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
}).then((router) => router.stop());
|
|
1388
|
-
}
|
|
1389
|
-
setTriggerState(open) {
|
|
1390
|
-
this.outlets.forEach((outlet) => {
|
|
833
|
+
const o = s.nodes.visible;
|
|
834
|
+
return this.outlets.forEach((r) => {
|
|
835
|
+
var c;
|
|
836
|
+
return (c = r.options.triggerDOMElement) == null ? void 0 : c.setAttribute("aria-expanded", "false");
|
|
837
|
+
}), o.filter((r) => r.attributes.properties.animation && r.attributes.properties.animation !== "none").length ? new Promise((r) => {
|
|
838
|
+
setTimeout(() => {
|
|
839
|
+
r(i);
|
|
840
|
+
}, 200);
|
|
841
|
+
}) : Promise.resolve(i);
|
|
842
|
+
}).then((i) => i.stop());
|
|
843
|
+
}
|
|
844
|
+
setTriggerState(e) {
|
|
845
|
+
this.outlets.forEach((n) => {
|
|
1391
846
|
const {
|
|
1392
|
-
options: { triggerDOMElement, triggerOptions }
|
|
1393
|
-
} =
|
|
1394
|
-
|
|
1395
|
-
if (triggerDOMElement) {
|
|
1396
|
-
open ? setActive(triggerDOMElement, openTooltip) : setInactive(triggerDOMElement, closedTooltip);
|
|
1397
|
-
}
|
|
847
|
+
options: { triggerDOMElement: i, triggerOptions: s }
|
|
848
|
+
} = n, { openTooltip: o, closedTooltip: r } = s || {};
|
|
849
|
+
i && (e ? Ee(i, o) : Ct(i, r));
|
|
1398
850
|
});
|
|
1399
851
|
}
|
|
1400
852
|
deactivate() {
|
|
1401
|
-
this.subs.forEach((
|
|
1402
|
-
const
|
|
1403
|
-
this.outlets.forEach((
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
medium: StorageMedium.Local,
|
|
1408
|
-
scope: StorageScope.Implementation
|
|
1409
|
-
}).then((write) => write()).then(() => Promise.all(promises));
|
|
1410
|
-
}
|
|
1411
|
-
return Promise.all(promises);
|
|
1412
|
-
});
|
|
853
|
+
this.subs.forEach((n) => n());
|
|
854
|
+
const e = [];
|
|
855
|
+
return this.outlets.forEach((n) => e.push(n.dispose())), N(this.container, de, v.Local).then((n) => n === this.widget.name ? _(this.container, de, I.Necessary, {
|
|
856
|
+
medium: v.Local,
|
|
857
|
+
scope: Xe.Implementation
|
|
858
|
+
}).then((i) => i()).then(() => Promise.all(e)) : Promise.all(e));
|
|
1413
859
|
}
|
|
1414
860
|
}
|
|
1415
|
-
export {
|
|
861
|
+
export {
|
|
862
|
+
ie as Component,
|
|
863
|
+
gt as DetachedComponent,
|
|
864
|
+
Qt as GridWidget,
|
|
865
|
+
qt as NotFound,
|
|
866
|
+
Qt as Widget,
|
|
867
|
+
Y as genericComponentStyling
|
|
868
|
+
};
|
|
1416
869
|
//# sourceMappingURL=index.js.map
|