@telia-ace/knowledge-widget-plugins 1.1.2-rc.1 → 1.1.2-rc.3

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.
Files changed (2) hide show
  1. package/index.mjs +33 -20
  2. package/package.json +5 -5
package/index.mjs CHANGED
@@ -104,23 +104,24 @@ const G = async (n, e) => {
104
104
  ).then((f) => f(i));
105
105
  }
106
106
  })), { events: o } = n.get("$widget");
107
- return o.subscribe("widget:render-state-changed", async (a, i) => {
108
- if (a.target.state === "activated" && i.next === "open") {
109
- const { hideBackOnSingleContactMethod: c } = e;
110
- let t;
111
- const r = n.get("$widget"), { name: u, implementation: f } = r;
112
- if (u.endsWith("_contact") ? t = f.widgets.get(u.replace("_contact", "")) : u.endsWith("_contact-method") || (t = r), t) {
113
- let d = null;
114
- const l = await S(
115
- t.container,
116
- A
117
- ), m = (await t.container.getAsync(
118
- "components"
119
- )).components().ofType("widget-header").select();
120
- typeof l == "boolean" ? d = l : c && await s(t, d), (c || typeof d == "boolean") && (d && m.actions.dispatch("show-back", !1), m.actions.watch("show-back", (h, g) => g(d && h ? !1 : h)));
107
+ return o.subscribe(
108
+ "widget:render-state-changed",
109
+ async (a, i) => {
110
+ if (a.target.state === "activated" && i.next === "open") {
111
+ const { hideBackOnSingleContactMethod: c } = e;
112
+ let t;
113
+ const r = n.get("$widget"), { name: u, implementation: f } = r;
114
+ if (u.endsWith("_contact") ? t = f.widgets.get(u.replace("_contact", "")) : u.endsWith("_contact-method") || (t = r), t) {
115
+ let d = null;
116
+ const l = await S(
117
+ t.container,
118
+ A
119
+ ), m = (await t.container.getAsync("components")).components().ofType("widget-header").select();
120
+ typeof l == "boolean" ? d = l : c && await s(t, d), (c || typeof d == "boolean") && (d && m.actions.dispatch("show-back", !1), m.actions.watch("show-back", (h, g) => g(d && h ? !1 : h)));
121
+ }
121
122
  }
122
123
  }
123
- }), [];
124
+ ), [];
124
125
  }, K = (n) => n.reduce((e, s) => {
125
126
  if (e)
126
127
  return e;
@@ -133,7 +134,9 @@ const G = async (n, e) => {
133
134
  return e;
134
135
  const [o] = Array.from((s == null ? void 0 : s.getElementsByTagName("input")) || []);
135
136
  return !!(o && o === document.activeElement);
136
- }, !1), U = () => Array.from(document.querySelectorAll('[data-component-type="guide-list"]')).reduce((n, e) => (Array.from(e.getElementsByTagName("a")).forEach((o) => n.push(o)), n), []), _ = async (n, e) => {
137
+ }, !1), U = () => Array.from(
138
+ document.querySelectorAll('[data-component-type="guide-list"]')
139
+ ).reduce((n, e) => (Array.from(e.getElementsByTagName("a")).forEach((o) => n.push(o)), n), []), _ = async (n, e) => {
137
140
  const { searchToGuideListArrowKeyNavigation: s = !1 } = e;
138
141
  return s ? n.getAsync("components").then((o) => {
139
142
  const {
@@ -149,7 +152,11 @@ const G = async (n, e) => {
149
152
  const k = document.getElementById(x);
150
153
  k && r.push(k);
151
154
  });
152
- const u = K(r), f = R(r), d = U(), l = d.indexOf(
155
+ const u = K(
156
+ r
157
+ ), f = R(
158
+ r
159
+ ), d = U(), l = d.indexOf(
153
160
  document.activeElement
154
161
  );
155
162
  (t.key === "ArrowDown" || t.key === "ArrowUp") && (f || l > -1) && t.preventDefault(), t.key === "ArrowDown" && f && !u ? d[0].focus() : t.key === "ArrowUp" && l === 0 ? (m = (p = r[0]) == null ? void 0 : p.getElementsByTagName("input")[0]) == null || m.focus() : t.key === "ArrowUp" && l > -1 ? (h = d[l - 1]) == null || h.focus() : t.key === "ArrowDown" && l > -1 && ((g = d[l + 1]) == null || g.focus());
@@ -163,14 +170,20 @@ class J extends y {
163
170
  }
164
171
  async initialize() {
165
172
  this.listeners = await Promise.all([
166
- Promise.resolve(I(this.container, this.settings)),
167
- Promise.resolve(G(this.container, this.settings)),
173
+ Promise.resolve(
174
+ I(this.container, this.settings)
175
+ ),
176
+ Promise.resolve(
177
+ G(this.container, this.settings)
178
+ ),
168
179
  Promise.resolve(
169
180
  _(this.container, this.settings)
170
181
  )
171
182
  ]).then((e) => {
172
183
  const s = [];
173
- return e.forEach((o) => o.forEach((a) => s.push(a))), s.forEach(({ parent: o, type: a, handler: i }) => {
184
+ return e.forEach(
185
+ (o) => o.forEach((a) => s.push(a))
186
+ ), s.forEach(({ parent: o, type: a, handler: i }) => {
174
187
  o.addEventListener(a, i);
175
188
  }), s;
176
189
  });
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@telia-ace/knowledge-widget-plugins",
3
- "version": "1.1.2-rc.1",
3
+ "version": "1.1.2-rc.3",
4
4
  "dependencies": {
5
- "@telia-ace/knowledge-data-client": "^1.1.2-rc.1",
6
- "@telia-ace/widget-services": "^1.1.2-rc.1",
5
+ "@telia-ace/knowledge-data-client": "^1.1.2-rc.3",
6
+ "@telia-ace/widget-services": "^1.1.2-rc.3",
7
7
  "@webprovisions/platform": "^1.1.4",
8
- "@telia-ace/knowledge-widget-core": "^1.1.2-rc.1",
9
- "@telia-ace/knowledge-resource-loader": "^1.1.2-rc.1"
8
+ "@telia-ace/knowledge-widget-core": "^1.1.2-rc.3",
9
+ "@telia-ace/knowledge-resource-loader": "^1.1.2-rc.3"
10
10
  },
11
11
  "peerDependencies": {
12
12
  "@emotion/react": "11.11.1"