@telia-ace/knowledge-widget-adapters 1.3.59 → 1.3.60-rc.0

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.
@@ -1,3 +1,2 @@
1
1
  import { Container } from '@webprovisions/platform';
2
-
3
2
  export default function chatPopupPlugin(container: Container): void;
@@ -1,5 +1,4 @@
1
1
  import { default as React } from 'react';
2
2
  import { ContactMethodProps } from '../ui';
3
-
4
3
  declare const EmailFormComponent: React.FC<ContactMethodProps>;
5
4
  export default EmailFormComponent;
@@ -1,7 +1,6 @@
1
1
  import { SubmissionApiResult } from '@telia-ace/knowledge-serviceclient';
2
2
  import { Container } from '@webprovisions/platform';
3
3
  import { ContactMethodType } from '../ui';
4
-
5
4
  export declare const submit: (container: Container, contactMethod: ContactMethodType, transform?: (response: any) => SubmissionApiResult) => Promise<string>;
6
5
  export declare const validate: (container: Container, contactMethod: ContactMethodType) => Promise<{
7
6
  valid: boolean;
@@ -12,6 +11,6 @@ export declare const validate: (container: Container, contactMethod: ContactMeth
12
11
  [key: string]: string;
13
12
  };
14
13
  }>;
15
- export declare const evaluate: (container: Container, contactMethod: ContactMethodType) => Promise<import('../../../../../forms/src/index.ts').Form>;
14
+ export declare const evaluate: (container: Container, contactMethod: ContactMethodType) => Promise<import('@telia-ace/widget-forms').Form>;
16
15
  export declare const complete: (container: Container, contactMethod: ContactMethodType) => Promise<void>;
17
16
  export default function emailPlugin(container: Container): void;
@@ -1,5 +1,4 @@
1
1
  import { default as React } from 'react';
2
2
  import { ContactMethodProps } from '../ui';
3
-
4
3
  declare const FreeTextComponent: React.FC<ContactMethodProps>;
5
4
  export default FreeTextComponent;
@@ -1,3 +1,2 @@
1
1
  import { Container } from '@webprovisions/platform';
2
-
3
2
  export default function freeTextPlugin(container: Container): void;
@@ -1,3 +1,2 @@
1
1
  import { Container } from '@webprovisions/platform';
2
-
3
2
  export default function linkPlugin(container: Container): void;
@@ -1,3 +1,2 @@
1
1
  import { Container } from '@webprovisions/platform';
2
-
3
2
  export default function phonePlugin(container: Container): void;
@@ -1,9 +1,8 @@
1
- import { ComponentPlatform } from '../../../core/src/index.ts';
2
- import { Form } from '../../../../forms/src/index.ts';
1
+ import { ComponentPlatform } from '@telia-ace/knowledge-widget-core';
2
+ import { Form } from '@telia-ace/widget-forms';
3
3
  import { Container } from '@webprovisions/platform';
4
4
  import { default as React } from 'react';
5
5
  import { ContactMethodProps } from './ui';
6
-
7
6
  export type ReactComponentImport = Promise<{
8
7
  default: React.FunctionComponent<any>;
9
8
  }>;
@@ -38,22 +37,7 @@ declare class ContactMethodPlatform {
38
37
  private adapters;
39
38
  private subs;
40
39
  static create(container: Container): Promise<ContactMethodPlatform>;
41
- handleAdapters(cm: ContactMethodProps): Promise<Merge<import('./ui').ContactMethodType, {
42
- className?: string;
43
- onClick?: (event: React.MouseEvent, properties: ContactMethodProps) => void;
44
- renderDefault?: (extraProps?: Partial<ContactMethodProps>) => any;
45
- htmlParseInstruction?: import('../../../../ui/src/index.ts').HtmlParseInstruction;
46
- href?: string;
47
- target?: string;
48
- disabled?: boolean;
49
- action?: (action: string, value: any) => void;
50
- dispatch?: import('../../../../ui/src/index.ts').DispatchAction;
51
- symbol?: import('../../../core/src/index.ts').Symbol;
52
- description?: string;
53
- confirmation?: string;
54
- guideId?: string;
55
- autoFocus?: boolean;
56
- }>>;
40
+ handleAdapters(cm: ContactMethodProps): Promise<ContactMethodProps>;
57
41
  constructor(container: Container, componentPlatform: ComponentPlatform);
58
42
  static getInstance(container: Container, key?: string): Promise<ContactMethodPlatform>;
59
43
  private track;
@@ -1,5 +1,4 @@
1
1
  import { default as React } from 'react';
2
-
3
2
  export type Props = {
4
3
  html: string;
5
4
  };
@@ -1,8 +1,7 @@
1
1
  import { Theme } from '@emotion/react';
2
- import { DispatchAction } from '../../../../ui/src/index.ts';
2
+ import { DispatchAction } from '@telia-ace/knowledge-widget-ui';
3
3
  import { default as React, ReactNode } from 'react';
4
4
  import { ContactMethodType } from './contact-method';
5
-
6
5
  export declare const contactItemList: (p: {
7
6
  theme: Theme;
8
7
  }) => import('@emotion/react').SerializedStyles;
@@ -1,8 +1,7 @@
1
1
  import { Theme } from '@emotion/react';
2
- import { Symbol } from '../../../../core/src/index.ts';
3
- import { DispatchAction, HtmlParseInstruction } from '../../../../ui/src/index.ts';
2
+ import { Symbol } from '@telia-ace/knowledge-widget-core';
3
+ import { DispatchAction, HtmlParseInstruction } from '@telia-ace/knowledge-widget-ui';
4
4
  import { default as React } from 'react';
5
-
6
5
  export type ContactMethodType = {
7
6
  id: string;
8
7
  title: string;
@@ -1,5 +1,4 @@
1
1
  import { default as React } from 'react';
2
2
  import { ContactMethodProps } from '.';
3
-
4
3
  declare const Form: React.FC<ContactMethodProps>;
5
4
  export default Form;
@@ -1,3 +1,2 @@
1
1
  import { Container } from '@webprovisions/platform';
2
-
3
2
  export default function webServicePlugin(container: Container): void;
@@ -1,5 +1,4 @@
1
1
  import { Container } from '@webprovisions/platform';
2
-
3
2
  export type Callback = (settings: {
4
3
  [key: string]: any;
5
4
  }, data?: {
@@ -1,6 +1,5 @@
1
- import { Plugin } from '../../core/src/index.ts';
1
+ import { Plugin } from '@telia-ace/knowledge-widget-core';
2
2
  import { Container } from '@webprovisions/platform';
3
-
4
3
  /**
5
4
  * Registers default Humany contact methods.
6
5
  */
@@ -3,7 +3,7 @@ import { css as l } from "@emotion/react";
3
3
  import c from "@emotion/styled";
4
4
  import { genericHtml as f, headingElement as d, Html as h } from "@telia-ace/knowledge-widget-ui";
5
5
  import { appendClassNames as r } from "@telia-ace/widget-utilities";
6
- import { F as u } from "./index-D4XSiXsg.mjs";
6
+ import { F as u } from "./index-DwVpNWYp.mjs";
7
7
  import "react";
8
8
  const p = c(h)`
9
9
  ${f}
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),l=require("@emotion/react"),u=require("@emotion/styled"),n=require("@telia-ace/knowledge-widget-ui"),o=require("@telia-ace/widget-utilities"),d=require("./index-BFS2vrQq.js");require("react");const h=u(n.Html)`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),l=require("@emotion/react"),u=require("@emotion/styled"),n=require("@telia-ace/knowledge-widget-ui"),o=require("@telia-ace/widget-utilities"),d=require("./index-MfKSEgfo.js");require("react");const h=u(n.Html)`
2
2
  ${n.genericHtml}
3
3
 
4
4
  ${e=>{var t;return n.headingElement(e)("h1",l.css`
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("@emotion/styled"),n=require("@telia-ace/knowledge-widget-ui"),o=require("@telia-ace/widget-utilities"),u=require("./index-BFS2vrQq.js");require("@telia-ace/widget-forms");require("react");const c=({className:s,description:t,body:{freetext:r},htmlParseInstruction:i})=>r?e.jsxs("div",{className:o.appendClassNames(s,"humany-contact-method-free-text"),children:[e.jsx(d,{html:r,htmlParseInstruction:i}),t&&e.jsx(u.Description,{html:t,htmlParseInstruction:i})]}):null,d=l(n.Html)`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("@emotion/styled"),n=require("@telia-ace/knowledge-widget-ui"),o=require("@telia-ace/widget-utilities"),u=require("./index-MfKSEgfo.js");require("@telia-ace/widget-forms");require("react");const c=({className:s,description:t,body:{freetext:r},htmlParseInstruction:i})=>r?e.jsxs("div",{className:o.appendClassNames(s,"humany-contact-method-free-text"),children:[e.jsx(d,{html:r,htmlParseInstruction:i}),t&&e.jsx(u.Description,{html:t,htmlParseInstruction:i})]}):null,d=l(n.Html)`
2
2
  ${n.genericHtml};
3
3
  `;exports.default=c;
@@ -2,7 +2,7 @@ import { jsxs as l, jsx as r } from "react/jsx-runtime";
2
2
  import p from "@emotion/styled";
3
3
  import { genericHtml as s, Html as i } from "@telia-ace/knowledge-widget-ui";
4
4
  import { appendClassNames as n } from "@telia-ace/widget-utilities";
5
- import { D as a } from "./index-D4XSiXsg.mjs";
5
+ import { D as a } from "./index-DwVpNWYp.mjs";
6
6
  import "@telia-ace/widget-forms";
7
7
  import "react";
8
8
  const j = ({
@@ -1,31 +1,31 @@
1
1
  var B = Object.defineProperty;
2
2
  var J = (t, e, n) => e in t ? B(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var $ = (t, e, n) => J(t, typeof e != "symbol" ? e + "" : e, n);
3
+ var y = (t, e, n) => J(t, typeof e != "symbol" ? e + "" : e, n);
4
4
  import { FormBuilder as K, FormReader as w, FormComponent as G } from "@telia-ace/widget-forms";
5
5
  import { ComponentPlatform as A, Plugin as U } from "@telia-ace/knowledge-widget-core";
6
6
  import { lock as W, createParams as Q, formatUrl as X, appendClassNames as Y } from "@telia-ace/widget-utilities";
7
7
  import { lazy as Z, Suspense as _, useState as ee, useEffect as te } from "react";
8
8
  import { jsx as m, jsxs as E } from "react/jsx-runtime";
9
- import { css as C } from "@emotion/react";
9
+ import { css as $ } from "@emotion/react";
10
10
  import f from "@emotion/styled";
11
- import { headingElement as D, Paragraph as ne, genericHtml as oe, borderTabStyle as L, linkTabStyle as ie, Html as re, StyledText as se, Link as ae, useComponent as ce, useRouteData as le, Typography as de, SymbolBadge as me, ItemList as he, itemList as ue, useContainer as R } from "@telia-ace/knowledge-widget-ui";
11
+ import { headingElement as D, Paragraph as ne, genericHtml as oe, borderTabStyle as L, linkTabStyle as ie, Html as re, StyledText as ae, Link as se, useComponent as ce, useRouteData as le, Typography as de, SymbolBadge as me, ItemList as he, itemList as ue, useContainer as R } from "@telia-ace/knowledge-widget-ui";
12
12
  const P = (t, e, n = !1) => t.getManyAsync("matchingClient", "router").then((i) => {
13
13
  const { formData: o } = new w(e.body.form).export(
14
14
  n
15
- ), { router: c, matchingClient: r } = i, { params: s } = c.getRouteData();
16
- e.guideId = e.body.guideId || s.guideId;
17
- const a = JSON.parse(o.get("components")) ?? {};
18
- return a.site ?? (a.site = r.getConfiguration().site), o.set("components", JSON.stringify(a)), r.customRequest(
15
+ ), { router: c, matchingClient: r } = i, { params: a } = c.getRouteData();
16
+ e.guideId = e.body.guideId || a.guideId;
17
+ const s = JSON.parse(o.get("components")) ?? {};
18
+ return s.site ?? (s.site = r.getConfiguration().site), o.set("components", JSON.stringify(s)), r.customRequest(
19
19
  `contactmethods/${e.id}${n ? "/validatedwithpayload" : ""}`,
20
20
  "POST",
21
21
  {
22
22
  body: o,
23
23
  configuration: {
24
- guideId: e.body.guideId || s.guideId
24
+ guideId: e.body.guideId || a.guideId
25
25
  }
26
26
  }
27
27
  );
28
- }), F = (t, e, n) => P(t, e).then((i) => n ? n(i) : i).then(({ ConfirmationText: i }) => i), y = (t, e) => P(t, e, !0).then(
28
+ }), F = (t, e, n) => P(t, e).then((i) => n ? n(i) : i).then(({ ConfirmationText: i }) => i), b = (t, e) => P(t, e, !0).then(
29
29
  (n) => ({
30
30
  valid: n.Validation.IsValid,
31
31
  errors: n.Validation.Errors,
@@ -36,7 +36,7 @@ const P = (t, e, n = !1) => t.getManyAsync("matchingClient", "router").then((i)
36
36
  e.id,
37
37
  n.ContactMethod.Form
38
38
  ).get()
39
- ), b = (t, e) => t.getAsync("matchingClient").then((n) => {
39
+ ), v = (t, e) => t.getAsync("matchingClient").then((n) => {
40
40
  n.completeContactMethod(e.id, {
41
41
  guideId: e.guideId
42
42
  });
@@ -45,20 +45,20 @@ function pe(t) {
45
45
  t.getAsync("contactMethods").then((e) => {
46
46
  e.create({
47
47
  clientName: "email.form",
48
- render: import("./email-form-component-BCofw5KQ.mjs"),
48
+ render: import("./email-form-component-D-bk1JRD.mjs"),
49
49
  onEvaluate: (n) => M(t, n),
50
- onValidate: (n) => y(t, n),
50
+ onValidate: (n) => b(t, n),
51
51
  onSubmit: (n) => F(t, n),
52
- onComplete: (n) => b(t, n)
52
+ onComplete: (n) => v(t, n)
53
53
  });
54
54
  });
55
55
  }
56
56
  const T = (t, e, n) => {
57
- const { url: i, width: o, height: c } = e, r = n || {}, s = document.createElement("a");
58
- return s.href = i, s.search.replace("?", "").split("&").forEach((a) => {
59
- const [d, l] = a.split("=");
57
+ const { url: i, width: o, height: c } = e, r = n || {}, a = document.createElement("a");
58
+ return a.href = i, a.search.replace("?", "").split("&").forEach((s) => {
59
+ const [d, l] = s.split("=");
60
60
  typeof l < "u" && (r[d] = l);
61
- }), s.search = Object.keys(r).map((a) => `${a}=${r[a]}`).join("&"), window.open(s.href, t, `width=${o},height=${c}`), "";
61
+ }), a.search = Object.keys(r).map((s) => `${s}=${r[s]}`).join("&"), window.open(a.href, t, `width=${o},height=${c}`), "";
62
62
  };
63
63
  function fe(t) {
64
64
  t.getAsync("contactMethods").then((e) => {
@@ -66,17 +66,17 @@ function fe(t) {
66
66
  clientName: "chat.popup",
67
67
  render: "email.form",
68
68
  handleClick: (n) => {
69
- const { title: i, body: o } = n, { form: c, guideId: r, confirmationFallback: s, ...a } = o;
69
+ const { title: i, body: o } = n, { form: c, guideId: r, confirmationFallback: a, ...s } = o;
70
70
  return c ? () => {
71
71
  } : (d) => {
72
- d.preventDefault(), T(i, a);
72
+ d.preventDefault(), T(i, s);
73
73
  };
74
74
  },
75
- onValidate: (n) => y(t, n),
76
- onComplete: (n) => b(t, n),
75
+ onValidate: (n) => b(t, n),
76
+ onComplete: (n) => v(t, n),
77
77
  onSubmit: (n) => {
78
- const { title: i, body: o } = n, { form: c, guideId: r, confirmationFallback: s, ...a } = o, d = new w(c).export().values;
79
- return T(i, a, d), s;
78
+ const { title: i, body: o } = n, { form: c, guideId: r, confirmationFallback: a, ...s } = o, d = new w(c).export().values;
79
+ return T(i, s, d), a;
80
80
  }
81
81
  });
82
82
  });
@@ -85,7 +85,7 @@ function ge(t) {
85
85
  t.getAsync("contactMethods").then((e) => {
86
86
  e.create({
87
87
  clientName: "custom.freetext",
88
- render: import("./free-text-component-C8xYyKPg.mjs")
88
+ render: import("./free-text-component-DW453smr.mjs")
89
89
  });
90
90
  });
91
91
  }
@@ -109,8 +109,8 @@ const ve = async (t, e) => {
109
109
  const n = t.get(e.clientName);
110
110
  let { description: i, disabled: o, onClick: c } = e;
111
111
  if (n) {
112
- const { handleClick: r, handleDescription: s, handleDisabled: a } = n;
113
- typeof r == "function" && (c = await Promise.resolve(r(e))), typeof s == "function" && (i = await Promise.resolve(s(e))), typeof a == "function" && (o = await Promise.resolve(a(e)));
112
+ const { handleClick: r, handleDescription: a, handleDisabled: s } = n;
113
+ typeof r == "function" && (c = await Promise.resolve(r(e))), typeof a == "function" && (i = await Promise.resolve(a(e))), typeof s == "function" && (o = await Promise.resolve(s(e)));
114
114
  }
115
115
  return Promise.resolve({
116
116
  ...e,
@@ -121,16 +121,18 @@ const ve = async (t, e) => {
121
121
  };
122
122
  class k {
123
123
  constructor(e, n) {
124
- $(this, "adapters", /* @__PURE__ */ new Map());
125
- $(this, "subs", []);
124
+ y(this, "container");
125
+ y(this, "componentPlatform");
126
+ y(this, "adapters", /* @__PURE__ */ new Map());
127
+ y(this, "subs", []);
126
128
  if (this.container = e, this.componentPlatform = n, n) {
127
129
  n.components().ofType("contact-list").select().actions.watch(
128
130
  "contact-list.fetched",
129
- async (r, s) => {
130
- const { contactMethods: a } = r;
131
- if (a) {
131
+ async (r, a) => {
132
+ const { contactMethods: s } = r;
133
+ if (s) {
132
134
  const d = Promise.all(
133
- a.map(
135
+ s.map(
134
136
  (l) => this.handleAdapters(l)
135
137
  )
136
138
  );
@@ -138,15 +140,15 @@ class k {
138
140
  r.contactMethods = l;
139
141
  });
140
142
  }
141
- return s(r);
143
+ return a(r);
142
144
  }
143
145
  );
144
146
  const o = n.components().ofType("guide").select();
145
- o.actions.watch("guide.fetched", async (r, s) => {
146
- const { contactMethods: a } = r;
147
- if (a) {
147
+ o.actions.watch("guide.fetched", async (r, a) => {
148
+ const { contactMethods: s } = r;
149
+ if (s) {
148
150
  const d = Promise.all(
149
- a.map(
151
+ s.map(
150
152
  (l) => this.handleAdapters(l)
151
153
  )
152
154
  );
@@ -154,12 +156,12 @@ class k {
154
156
  r.contactMethods = l;
155
157
  });
156
158
  }
157
- return s(r);
158
- }), o.actions.watch("guide.handover", async (r, s) => {
159
- const { handoverContactMethods: a } = r;
160
- if (a) {
159
+ return a(r);
160
+ }), o.actions.watch("guide.handover", async (r, a) => {
161
+ const { handoverContactMethods: s } = r;
162
+ if (s) {
161
163
  const d = Promise.all(
162
- a.map(
164
+ s.map(
163
165
  (l) => this.handleAdapters(l)
164
166
  )
165
167
  );
@@ -167,12 +169,12 @@ class k {
167
169
  r.handoverContactMethods = l;
168
170
  });
169
171
  }
170
- return s(r);
172
+ return a(r);
171
173
  }), n.components().ofType("contact-method").select().actions.watch(
172
174
  "contact-method.fetched",
173
- async (r, s) => {
174
- const { contactMethod: a } = r;
175
- return a ? this.handleAdapters(a).then((d) => s({ ...r, contactMethod: d })) : s(r);
175
+ async (r, a) => {
176
+ const { contactMethod: s } = r;
177
+ return s ? this.handleAdapters(s).then((d) => a({ ...r, contactMethod: d })) : a(r);
176
178
  }
177
179
  );
178
180
  }
@@ -209,9 +211,9 @@ class k {
209
211
  "contact-method-complete"
210
212
  /* ContactMethodComplete */
211
213
  );
212
- const s = this.adapters.get(o);
213
- if (s && s.onComplete)
214
- return s.onComplete(e);
214
+ const a = this.adapters.get(o);
215
+ if (a && a.onComplete)
216
+ return a.onComplete(e);
215
217
  }
216
218
  evaluate(e) {
217
219
  const { clientName: n } = e, i = this.adapters.get(n);
@@ -229,8 +231,8 @@ class k {
229
231
  "contact-method-validate"
230
232
  /* ContactMethodValidate */
231
233
  );
232
- const { events: s } = this.container.get("$widget");
233
- return s.dispatch("form:validated", { isValid: r.valid }), r;
234
+ const { events: a } = this.container.get("$widget");
235
+ return a.dispatch("form:validated", { isValid: r.valid }), r;
234
236
  }
235
237
  ) : Promise.resolve({ valid: !0 });
236
238
  }
@@ -241,9 +243,9 @@ class k {
241
243
  create(e) {
242
244
  const { clientName: n, render: i } = e;
243
245
  return this.adapters.set(n, {
244
- onValidate: (o) => y(this.container, o),
246
+ onValidate: (o) => b(this.container, o),
245
247
  onEvaluate: (o) => M(this.container, o),
246
- onComplete: (o) => b(this.container, o),
248
+ onComplete: (o) => v(this.container, o),
247
249
  ...e
248
250
  }), this.container.getAsync("componentResolver").then((o) => {
249
251
  typeof i == "string" ? this.subs.push(o.registerAlias(n, i)) : this.subs.push(
@@ -263,7 +265,7 @@ f(ne)`
263
265
  var e;
264
266
  return D(t)(
265
267
  "h1",
266
- C`
268
+ $`
267
269
  font-weight: normal;
268
270
  font-size: ${(e = t.theme.fonts) == null ? void 0 : e.medium};
269
271
  `
@@ -297,12 +299,12 @@ const Ce = f(re)`
297
299
  }
298
300
  ) : null;
299
301
  const c = (r = {}) => {
300
- const s = { ...t, ...r }, {
301
- id: a,
302
+ const a = { ...t, ...r }, {
303
+ id: s,
302
304
  title: d,
303
305
  clientName: l,
304
306
  symbol: p,
305
- inline: v,
307
+ inline: C,
306
308
  onClick: g = () => {
307
309
  },
308
310
  description: u,
@@ -313,22 +315,22 @@ const Ce = f(re)`
313
315
  dispatch: x = () => {
314
316
  },
315
317
  expanded: I
316
- } = s, q = v ? {
318
+ } = a, q = C ? {
317
319
  onKeyDown: (h) => {
318
- h.key && h.key === "Enter" && (g(h, s), h.defaultPrevented || !I && x("expand", a));
320
+ h.key && h.key === "Enter" && (g(h, a), h.defaultPrevented || !I && x("expand", s));
319
321
  },
320
322
  onClick: (h) => {
321
- g(h, s), h.defaultPrevented || !I && x("expand", a);
323
+ g(h, a), h.defaultPrevented || !I && x("expand", s);
322
324
  }
323
325
  } : {
324
- onClick: (h) => g(h, s),
326
+ onClick: (h) => g(h, a),
325
327
  routeName: "contact-method",
326
328
  params: Q({
327
329
  contactCategory: n,
328
330
  guideId: H,
329
331
  guideCategory: i,
330
332
  phrase: o,
331
- contactMethod: a,
333
+ contactMethod: s,
332
334
  uriName: X(d)
333
335
  })
334
336
  };
@@ -366,8 +368,8 @@ const Ce = f(re)`
366
368
  };
367
369
  return t.expanded ? /* @__PURE__ */ m(_, { fallback: null, children: /* @__PURE__ */ m(e, { ...t, renderDefault: c }) }) : c();
368
370
  }, ke = (t) => {
369
- var e, n, i, o, c, r, s, a;
370
- return C`
371
+ var e, n, i, o, c, r, a, s;
372
+ return $`
371
373
  display: flex;
372
374
  padding: ${(e = t.theme.sizes) == null ? void 0 : e.large};
373
375
  ${t.description ? "" : "align-items: center;"}
@@ -381,18 +383,18 @@ const Ce = f(re)`
381
383
  margin: 0 ${(o = t.theme.sizes) == null ? void 0 : o.large} 0 0;
382
384
  min-height: ${(c = t.theme.fonts) == null ? void 0 : c.large};
383
385
  min-width: ${(r = t.theme.fonts) == null ? void 0 : r.large};
384
- line-height: ${(s = t.theme.fonts) == null ? void 0 : s.large};
386
+ line-height: ${(a = t.theme.fonts) == null ? void 0 : a.large};
385
387
  display: inline-block;
386
388
  vertical-align: bottom;
387
- color: ${(a = t.theme.colors) == null ? void 0 : a.text};
389
+ color: ${(s = t.theme.colors) == null ? void 0 : s.text};
388
390
  }
389
391
  `;
390
- }, V = f(se)`
392
+ }, V = f(ae)`
391
393
  line-height: ${(t) => {
392
394
  var e;
393
395
  return (e = t.theme.fonts) == null ? void 0 : e.large;
394
396
  }};
395
- `, we = f(ae)`
397
+ `, we = f(se)`
396
398
  ${(t) => ke(t)}
397
399
 
398
400
  &:focus-visible {
@@ -407,7 +409,7 @@ const Ce = f(re)`
407
409
  }}
408
410
  `, Ne = (t) => {
409
411
  var e, n, i;
410
- return C`
412
+ return $`
411
413
  ${ue(t)}
412
414
 
413
415
  > div {
@@ -415,7 +417,7 @@ const Ce = f(re)`
415
417
 
416
418
  ${D(t)(
417
419
  "h1",
418
- C`
420
+ $`
419
421
  margin: 0;
420
422
  `
421
423
  )}
@@ -469,13 +471,13 @@ const Ce = f(re)`
469
471
  itemRenderer: c,
470
472
  action: r = () => {
471
473
  },
472
- header: s = ""
474
+ header: a = ""
473
475
  }) => {
474
- const a = R(), { events: d } = a.get("$widget");
476
+ const s = R(), { events: d } = s.get("$widget");
475
477
  return t.length ? /* @__PURE__ */ m(
476
478
  xe,
477
479
  {
478
- header: s,
480
+ header: a,
479
481
  className: Y(o, "humany-contact-list"),
480
482
  items: t,
481
483
  renderItem: c ? (l) => /* @__PURE__ */ m(
@@ -530,19 +532,19 @@ const Ce = f(re)`
530
532
  autoFocus: r
531
533
  }) => {
532
534
  if (e && !c) {
533
- const { schema: s, layout: a, data: d, meta: l } = e, p = o || i || (() => {
535
+ const { schema: a, layout: s, data: d, meta: l } = e, p = o || i || (() => {
534
536
  });
535
537
  return /* @__PURE__ */ m(
536
538
  G,
537
539
  {
538
540
  className: t,
539
- schema: s,
540
- layout: a,
541
+ schema: a,
542
+ layout: s,
541
543
  data: d,
542
544
  autoFocus: r,
543
- onChange: (v, g) => {
544
- const u = { schema: s, layout: a, data: g, meta: l };
545
- v.toString() === "submit" ? p("submit", { id: n, form: u }) : z(s, v).evaluate ? p("evaluate", { id: n, form: u }) : p("validate", { id: n, form: u });
545
+ onChange: (C, g) => {
546
+ const u = { schema: a, layout: s, data: g, meta: l };
547
+ C.toString() === "submit" ? p("submit", { id: n, form: u }) : z(a, C).evaluate ? p("evaluate", { id: n, form: u }) : p("validate", { id: n, form: u });
546
548
  }
547
549
  }
548
550
  );
@@ -567,8 +569,8 @@ function Ie(t) {
567
569
  e.create({
568
570
  clientName: "custom.webservice",
569
571
  render: "email.form",
570
- onValidate: (n) => y(t, n),
571
- onComplete: (n) => b(t, n),
572
+ onValidate: (n) => b(t, n),
573
+ onComplete: (n) => v(t, n),
572
574
  onSubmit: (n) => F(t, n, (i) => ({
573
575
  ...i,
574
576
  ConfirmationText: i.ResponseHtml
@@ -582,17 +584,17 @@ const Oe = (t, e, n) => t.getAsync("contactMethods").then((i) => {
582
584
  render: "email.form",
583
585
  handleClick: () => (o, c) => {
584
586
  const {
585
- body: { form: r, guideId: s, confirmationFallback: a, ...d }
587
+ body: { form: r, guideId: a, confirmationFallback: s, ...d }
586
588
  } = c;
587
589
  r || (o.preventDefault(), n(d));
588
590
  },
589
- onValidate: (o) => y(t, o),
590
- onComplete: (o) => b(t, o),
591
+ onValidate: (o) => b(t, o),
592
+ onComplete: (o) => v(t, o),
591
593
  onSubmit: (o) => {
592
594
  const {
593
- body: { form: c, guideId: r, confirmationFallback: s, ...a }
595
+ body: { form: c, guideId: r, confirmationFallback: a, ...s }
594
596
  } = o, { values: d } = new w(c).export();
595
- return Promise.resolve(n(a, d)).then((l) => l || s);
597
+ return Promise.resolve(n(s, d)).then((l) => l || a);
596
598
  }
597
599
  });
598
600
  });
@@ -616,12 +618,12 @@ export {
616
618
  Ne as g,
617
619
  ke as h,
618
620
  Oe as i,
619
- b as j,
621
+ v as j,
620
622
  M as k,
621
623
  ye as l,
622
624
  be as p,
623
625
  F as s,
624
626
  je as u,
625
- y as v,
627
+ b as v,
626
628
  Ie as w
627
629
  };
@@ -1,5 +1,5 @@
1
- "use strict";var Z=Object.defineProperty;var _=(t,e,n)=>e in t?Z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var N=(t,e,n)=>_(t,typeof e!="symbol"?e+"":e,n);const C=require("@telia-ace/widget-forms"),S=require("@telia-ace/knowledge-widget-core"),k=require("@telia-ace/widget-utilities"),P=require("react"),u=require("react/jsx-runtime"),w=require("@emotion/react"),f=require("@emotion/styled"),m=require("@telia-ace/knowledge-widget-ui"),I=(t,e,n=!1)=>t.getManyAsync("matchingClient","router").then(i=>{const{formData:o}=new C.FormReader(e.body.form).export(n),{router:c,matchingClient:r}=i,{params:s}=c.getRouteData();e.guideId=e.body.guideId||s.guideId;const a=JSON.parse(o.get("components"))??{};return a.site??(a.site=r.getConfiguration().site),o.set("components",JSON.stringify(a)),r.customRequest(`contactmethods/${e.id}${n?"/validatedwithpayload":""}`,"POST",{body:o,configuration:{guideId:e.body.guideId||s.guideId}})}),A=(t,e,n)=>I(t,e).then(i=>n?n(i):i).then(({ConfirmationText:i})=>i),y=(t,e)=>I(t,e,!0).then(n=>({valid:n.Validation.IsValid,errors:n.Validation.Errors,errorTypes:n.Validation.ErrorTypes})),j=(t,e)=>I(t,e,!0).then(n=>C.FormBuilder.fromLegacyForm(e.id,n.ContactMethod.Form).get()),b=(t,e)=>t.getAsync("matchingClient").then(n=>{n.completeContactMethod(e.id,{guideId:e.guideId})});function F(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"email.form",render:Promise.resolve().then(()=>require("./email-form-component-CIl0FWR3.js")),onEvaluate:n=>j(t,n),onValidate:n=>y(t,n),onSubmit:n=>A(t,n),onComplete:n=>b(t,n)})})}const q=(t,e,n)=>{const{url:i,width:o,height:c}=e,r=n||{},s=document.createElement("a");return s.href=i,s.search.replace("?","").split("&").forEach(a=>{const[d,l]=a.split("=");typeof l<"u"&&(r[d]=l)}),s.search=Object.keys(r).map(a=>`${a}=${r[a]}`).join("&"),window.open(s.href,t,`width=${o},height=${c}`),""};function M(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"chat.popup",render:"email.form",handleClick:n=>{const{title:i,body:o}=n,{form:c,guideId:r,confirmationFallback:s,...a}=o;return c?()=>{}:d=>{d.preventDefault(),q(i,a)}},onValidate:n=>y(t,n),onComplete:n=>b(t,n),onSubmit:n=>{const{title:i,body:o}=n,{form:c,guideId:r,confirmationFallback:s,...a}=o,d=new C.FormReader(c).export().values;return q(i,a,d),s}})})}function V(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"custom.freetext",render:Promise.resolve().then(()=>require("./free-text-component-D0fNPPU2.js"))})})}function z(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"custom.link",render:Promise.resolve().then(()=>require("./link-component-C9N5NmxE.js"))})})}function O(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"phone.text",render:Promise.resolve().then(()=>require("./phone-component-Cs-2D-oo.js"))})})}const ee=async(t,e)=>{const n=t.get(e.clientName);let{description:i,disabled:o,onClick:c}=e;if(n){const{handleClick:r,handleDescription:s,handleDisabled:a}=n;typeof r=="function"&&(c=await Promise.resolve(r(e))),typeof s=="function"&&(i=await Promise.resolve(s(e))),typeof a=="function"&&(o=await Promise.resolve(a(e)))}return Promise.resolve({...e,description:i,disabled:o,onClick:c})};class x{constructor(e,n){N(this,"adapters",new Map);N(this,"subs",[]);if(this.container=e,this.componentPlatform=n,n){n.components().ofType("contact-list").select().actions.watch("contact-list.fetched",async(r,s)=>{const{contactMethods:a}=r;if(a){const d=Promise.all(a.map(l=>this.handleAdapters(l)));await Promise.resolve(d).then(l=>{r.contactMethods=l})}return s(r)});const o=n.components().ofType("guide").select();o.actions.watch("guide.fetched",async(r,s)=>{const{contactMethods:a}=r;if(a){const d=Promise.all(a.map(l=>this.handleAdapters(l)));await Promise.resolve(d).then(l=>{r.contactMethods=l})}return s(r)}),o.actions.watch("guide.handover",async(r,s)=>{const{handoverContactMethods:a}=r;if(a){const d=Promise.all(a.map(l=>this.handleAdapters(l)));await Promise.resolve(d).then(l=>{r.handoverContactMethods=l})}return s(r)}),n.components().ofType("contact-method").select().actions.watch("contact-method.fetched",async(r,s)=>{const{contactMethod:a}=r;return a?this.handleAdapters(a).then(d=>s({...r,contactMethod:d})):s(r)})}}static create(e){return S.ComponentPlatform.getInstance(e).then(n=>new x(e,n))}handleAdapters(e){return ee(this.adapters,e)}static getInstance(e,n="contactMethods"){return k.lock(e)(()=>e.getAsync(n).then(i=>{let o=i;return o||S.ComponentPlatform.getInstance(e).then(c=>(o=new x(e,c),e.registerAsync(n,()=>o),o))}))}track(e={},n){const{events:i}=this.container.get("$widget");i.dispatch("tracking:service-client-response",{type:n,data:e})}complete(e){const{id:n,title:i,clientName:o,expanded:c,body:r}=e;this.track({contactMethod:{id:n,title:i,expanded:c,type:o},hasGuide:!!r.guideId},"contact-method-complete");const s=this.adapters.get(o);if(s&&s.onComplete)return s.onComplete(e)}evaluate(e){const{clientName:n}=e,i=this.adapters.get(n);return i&&i.onEvaluate?Promise.resolve(i.onEvaluate(e)):Promise.resolve(e.body.form)}validate(e){const{id:n,title:i,clientName:o}=e,c=this.adapters.get(o);return c&&c.onValidate?Promise.resolve(c.onValidate(e)).then(r=>{this.track({contactMethod:{id:n,title:i,type:o},isValid:r.valid},"contact-method-validate");const{events:s}=this.container.get("$widget");return s.dispatch("form:validated",{isValid:r.valid}),r}):Promise.resolve({valid:!0})}submit(e){const{clientName:n}=e,i=this.adapters.get(n);return i&&i.onSubmit?Promise.resolve(i.onSubmit(e)).then(o=>(this.complete(e),o)):Promise.resolve("")}create(e){const{clientName:n,render:i}=e;return this.adapters.set(n,{onValidate:o=>y(this.container,o),onEvaluate:o=>j(this.container,o),onComplete:o=>b(this.container,o),...e}),this.container.getAsync("componentResolver").then(o=>{typeof i=="string"?this.subs.push(o.registerAlias(n,i)):this.subs.push(o.registerComponent(n,P.lazy(()=>i)))})}dispose(){this.subs.forEach(e=>e())}}f(m.Paragraph)`
2
- ${t=>{var e;return m.headingElement(t)("h1",w.css`
1
+ "use strict";var Z=Object.defineProperty;var _=(t,e,n)=>e in t?Z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var C=(t,e,n)=>_(t,typeof e!="symbol"?e+"":e,n);const $=require("@telia-ace/widget-forms"),S=require("@telia-ace/knowledge-widget-core"),k=require("@telia-ace/widget-utilities"),w=require("react"),u=require("react/jsx-runtime"),x=require("@emotion/react"),f=require("@emotion/styled"),m=require("@telia-ace/knowledge-widget-ui"),I=(t,e,n=!1)=>t.getManyAsync("matchingClient","router").then(i=>{const{formData:o}=new $.FormReader(e.body.form).export(n),{router:c,matchingClient:r}=i,{params:s}=c.getRouteData();e.guideId=e.body.guideId||s.guideId;const a=JSON.parse(o.get("components"))??{};return a.site??(a.site=r.getConfiguration().site),o.set("components",JSON.stringify(a)),r.customRequest(`contactmethods/${e.id}${n?"/validatedwithpayload":""}`,"POST",{body:o,configuration:{guideId:e.body.guideId||s.guideId}})}),A=(t,e,n)=>I(t,e).then(i=>n?n(i):i).then(({ConfirmationText:i})=>i),y=(t,e)=>I(t,e,!0).then(n=>({valid:n.Validation.IsValid,errors:n.Validation.Errors,errorTypes:n.Validation.ErrorTypes})),j=(t,e)=>I(t,e,!0).then(n=>$.FormBuilder.fromLegacyForm(e.id,n.ContactMethod.Form).get()),b=(t,e)=>t.getAsync("matchingClient").then(n=>{n.completeContactMethod(e.id,{guideId:e.guideId})});function F(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"email.form",render:Promise.resolve().then(()=>require("./email-form-component-tdBqgLrA.js")),onEvaluate:n=>j(t,n),onValidate:n=>y(t,n),onSubmit:n=>A(t,n),onComplete:n=>b(t,n)})})}const q=(t,e,n)=>{const{url:i,width:o,height:c}=e,r=n||{},s=document.createElement("a");return s.href=i,s.search.replace("?","").split("&").forEach(a=>{const[d,l]=a.split("=");typeof l<"u"&&(r[d]=l)}),s.search=Object.keys(r).map(a=>`${a}=${r[a]}`).join("&"),window.open(s.href,t,`width=${o},height=${c}`),""};function M(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"chat.popup",render:"email.form",handleClick:n=>{const{title:i,body:o}=n,{form:c,guideId:r,confirmationFallback:s,...a}=o;return c?()=>{}:d=>{d.preventDefault(),q(i,a)}},onValidate:n=>y(t,n),onComplete:n=>b(t,n),onSubmit:n=>{const{title:i,body:o}=n,{form:c,guideId:r,confirmationFallback:s,...a}=o,d=new $.FormReader(c).export().values;return q(i,a,d),s}})})}function V(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"custom.freetext",render:Promise.resolve().then(()=>require("./free-text-component-BbVdZzOc.js"))})})}function z(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"custom.link",render:Promise.resolve().then(()=>require("./link-component-C9N5NmxE.js"))})})}function O(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"phone.text",render:Promise.resolve().then(()=>require("./phone-component-Cs-2D-oo.js"))})})}const ee=async(t,e)=>{const n=t.get(e.clientName);let{description:i,disabled:o,onClick:c}=e;if(n){const{handleClick:r,handleDescription:s,handleDisabled:a}=n;typeof r=="function"&&(c=await Promise.resolve(r(e))),typeof s=="function"&&(i=await Promise.resolve(s(e))),typeof a=="function"&&(o=await Promise.resolve(a(e)))}return Promise.resolve({...e,description:i,disabled:o,onClick:c})};class N{constructor(e,n){C(this,"container");C(this,"componentPlatform");C(this,"adapters",new Map);C(this,"subs",[]);if(this.container=e,this.componentPlatform=n,n){n.components().ofType("contact-list").select().actions.watch("contact-list.fetched",async(r,s)=>{const{contactMethods:a}=r;if(a){const d=Promise.all(a.map(l=>this.handleAdapters(l)));await Promise.resolve(d).then(l=>{r.contactMethods=l})}return s(r)});const o=n.components().ofType("guide").select();o.actions.watch("guide.fetched",async(r,s)=>{const{contactMethods:a}=r;if(a){const d=Promise.all(a.map(l=>this.handleAdapters(l)));await Promise.resolve(d).then(l=>{r.contactMethods=l})}return s(r)}),o.actions.watch("guide.handover",async(r,s)=>{const{handoverContactMethods:a}=r;if(a){const d=Promise.all(a.map(l=>this.handleAdapters(l)));await Promise.resolve(d).then(l=>{r.handoverContactMethods=l})}return s(r)}),n.components().ofType("contact-method").select().actions.watch("contact-method.fetched",async(r,s)=>{const{contactMethod:a}=r;return a?this.handleAdapters(a).then(d=>s({...r,contactMethod:d})):s(r)})}}static create(e){return S.ComponentPlatform.getInstance(e).then(n=>new N(e,n))}handleAdapters(e){return ee(this.adapters,e)}static getInstance(e,n="contactMethods"){return k.lock(e)(()=>e.getAsync(n).then(i=>{let o=i;return o||S.ComponentPlatform.getInstance(e).then(c=>(o=new N(e,c),e.registerAsync(n,()=>o),o))}))}track(e={},n){const{events:i}=this.container.get("$widget");i.dispatch("tracking:service-client-response",{type:n,data:e})}complete(e){const{id:n,title:i,clientName:o,expanded:c,body:r}=e;this.track({contactMethod:{id:n,title:i,expanded:c,type:o},hasGuide:!!r.guideId},"contact-method-complete");const s=this.adapters.get(o);if(s&&s.onComplete)return s.onComplete(e)}evaluate(e){const{clientName:n}=e,i=this.adapters.get(n);return i&&i.onEvaluate?Promise.resolve(i.onEvaluate(e)):Promise.resolve(e.body.form)}validate(e){const{id:n,title:i,clientName:o}=e,c=this.adapters.get(o);return c&&c.onValidate?Promise.resolve(c.onValidate(e)).then(r=>{this.track({contactMethod:{id:n,title:i,type:o},isValid:r.valid},"contact-method-validate");const{events:s}=this.container.get("$widget");return s.dispatch("form:validated",{isValid:r.valid}),r}):Promise.resolve({valid:!0})}submit(e){const{clientName:n}=e,i=this.adapters.get(n);return i&&i.onSubmit?Promise.resolve(i.onSubmit(e)).then(o=>(this.complete(e),o)):Promise.resolve("")}create(e){const{clientName:n,render:i}=e;return this.adapters.set(n,{onValidate:o=>y(this.container,o),onEvaluate:o=>j(this.container,o),onComplete:o=>b(this.container,o),...e}),this.container.getAsync("componentResolver").then(o=>{typeof i=="string"?this.subs.push(o.registerAlias(n,i)):this.subs.push(o.registerComponent(n,w.lazy(()=>i)))})}dispose(){this.subs.forEach(e=>e())}}f(m.Paragraph)`
2
+ ${t=>{var e;return m.headingElement(t)("h1",x.css`
3
3
  font-weight: normal;
4
4
  font-size: ${(e=t.theme.fonts)==null?void 0:e.medium};
5
5
  `)}}
@@ -14,7 +14,7 @@
14
14
  a:focus-visible {
15
15
  ${m.linkTabStyle};
16
16
  }
17
- `,U=t=>{const e=m.useComponent(t.clientName),{params:{contactCategory:n,guideCategory:i,phrase:o}}=m.useRouteData();if(typeof e>"u")return null;if(e===null)return process.env.NODE_ENV!=="production"?u.jsx(ne,{title:`client-name: ${t.clientName}, id: ${t.id}`,className:"humany-non-resolved-contact-method",children:u.jsx(m.Typography,{variant:"h5",children:"Non resolved Contact Method type"})}):null;const c=(r={})=>{const s={...t,...r},{id:a,title:d,clientName:l,symbol:p,inline:$,onClick:v=()=>{},description:g,htmlParseInstruction:T,className:G,disabled:Q,guideId:X,dispatch:E=()=>{},expanded:L}=s,Y=$?{onKeyDown:h=>{h.key&&h.key==="Enter"&&(v(h,s),h.defaultPrevented||!L&&E("expand",a))},onClick:h=>{v(h,s),h.defaultPrevented||!L&&E("expand",a)}}:{onClick:h=>v(h,s),routeName:"contact-method",params:k.createParams({contactCategory:n,guideId:X,guideCategory:i,phrase:o,contactMethod:a,uriName:k.formatUrl(d)})};let R;if(l==="phone.text"||l==="ace.phone"||l==="ace.callback"){const h=document.createElement("div");h.innerHTML=g,R=h.innerText}return u.jsxs(te,{title:d,"aria-label":l==="phone.text"||l==="ace.phone"||l==="ace.callback"?`${d} ${R}`:d,className:G,disabled:Q,description:g,"data-client-name":l,...r,...Y,children:[p&&u.jsx(m.SymbolBadge,{symbol:p}),g?u.jsxs("div",{className:"humany-contact-link-rich-content",children:[u.jsx(D,{children:d}),u.jsx(H,{html:g,htmlParseInstruction:T})]}):u.jsx(D,{children:d})]})};return t.expanded?u.jsx(P.Suspense,{fallback:null,children:u.jsx(e,{...t,renderDefault:c})}):c()},W=t=>{var e,n,i,o,c,r,s,a;return w.css`
17
+ `,U=t=>{const e=m.useComponent(t.clientName),{params:{contactCategory:n,guideCategory:i,phrase:o}}=m.useRouteData();if(typeof e>"u")return null;if(e===null)return process.env.NODE_ENV!=="production"?u.jsx(ne,{title:`client-name: ${t.clientName}, id: ${t.id}`,className:"humany-non-resolved-contact-method",children:u.jsx(m.Typography,{variant:"h5",children:"Non resolved Contact Method type"})}):null;const c=(r={})=>{const s={...t,...r},{id:a,title:d,clientName:l,symbol:p,inline:P,onClick:v=()=>{},description:g,htmlParseInstruction:T,className:G,disabled:Q,guideId:X,dispatch:E=()=>{},expanded:L}=s,Y=P?{onKeyDown:h=>{h.key&&h.key==="Enter"&&(v(h,s),h.defaultPrevented||!L&&E("expand",a))},onClick:h=>{v(h,s),h.defaultPrevented||!L&&E("expand",a)}}:{onClick:h=>v(h,s),routeName:"contact-method",params:k.createParams({contactCategory:n,guideId:X,guideCategory:i,phrase:o,contactMethod:a,uriName:k.formatUrl(d)})};let R;if(l==="phone.text"||l==="ace.phone"||l==="ace.callback"){const h=document.createElement("div");h.innerHTML=g,R=h.innerText}return u.jsxs(te,{title:d,"aria-label":l==="phone.text"||l==="ace.phone"||l==="ace.callback"?`${d} ${R}`:d,className:G,disabled:Q,description:g,"data-client-name":l,...r,...Y,children:[p&&u.jsx(m.SymbolBadge,{symbol:p}),g?u.jsxs("div",{className:"humany-contact-link-rich-content",children:[u.jsx(D,{children:d}),u.jsx(H,{html:g,htmlParseInstruction:T})]}):u.jsx(D,{children:d})]})};return t.expanded?u.jsx(w.Suspense,{fallback:null,children:u.jsx(e,{...t,renderDefault:c})}):c()},W=t=>{var e,n,i,o,c,r,s,a;return x.css`
18
18
  display: flex;
19
19
  padding: ${(e=t.theme.sizes)==null?void 0:e.large};
20
20
  ${t.description?"":"align-items: center;"}
@@ -45,13 +45,13 @@
45
45
  text-align: center;
46
46
  display: block;
47
47
  ${t=>{var e,n;return typeof((e=t.theme.colors)==null?void 0:e.warning)<"u"&&`color: ${(n=t.theme.colors)==null?void 0:n.warning};`}}
48
- `,B=t=>{var e,n,i;return w.css`
48
+ `,B=t=>{var e,n,i;return x.css`
49
49
  ${m.itemList(t)}
50
50
 
51
51
  > div {
52
52
  padding: ${(e=t.theme.sizes)==null?void 0:e.large};
53
53
 
54
- ${m.headingElement(t)("h1",w.css`
54
+ ${m.headingElement(t)("h1",x.css`
55
55
  margin: 0;
56
56
  `)}
57
57
  }
@@ -94,4 +94,4 @@
94
94
  }
95
95
  `},oe=f(m.ItemList)`
96
96
  ${t=>B(t)}
97
- `,ie=({contactMethods:t,children:e,guideId:n,dispatch:i,className:o="",itemRenderer:c,action:r=()=>{},header:s=""})=>{const a=m.useContainer(),{events:d}=a.get("$widget");return t.length?u.jsx(oe,{header:s,className:k.appendClassNames(o,"humany-contact-list"),items:t,renderItem:c?l=>u.jsx("li",{role:t.length===1&&t[0].expanded?"none":void 0,"data-contact-method":l.id,children:c(l,{action:r,dispatch:i,guideId:n})},l.id):l=>u.jsx("li",{role:t.length===1&&t[0].expanded?"none":void 0,"data-contact-method":l.id,onClick:()=>{d.dispatch("tracking:contact-list-item-clicked",l)},children:u.jsx(U,{...l,action:r,dispatch:i,guideId:n})},l.id),children:e}):null},J=(t,e)=>{if(t.actionKey===e)return t;if(!t.properties)return null;const n=Object.keys(t.properties);let i;for(let o=0;o<n.length;o++)if(i=J(t.properties[n[o]],e),i)return i;return!1},re=({className:t,body:{form:e},id:n,action:i,dispatch:o,disabled:c,autoFocus:r})=>{if(e&&!c){const{schema:s,layout:a,data:d,meta:l}=e,p=o||i||(()=>{});return u.jsx(C.FormComponent,{className:t,schema:s,layout:a,data:d,autoFocus:r,onChange:($,v)=>{const g={schema:s,layout:a,data:v,meta:l};$.toString()==="submit"?p("submit",{id:n,form:g}):J(s,$).evaluate?p("evaluate",{id:n,form:g}):p("validate",{id:n,form:g})}})}return null},se=t=>{const[e,n]=P.useState(null),i=m.useContainer();return P.useEffect(()=>{let o;return i.getAsync("componentResolver").then(c=>{o=c.registerResolver(t,r=>n(r))}),()=>{o&&o()}},[t]),e};function K(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"custom.webservice",render:"email.form",onValidate:n=>y(t,n),onComplete:n=>b(t,n),onSubmit:n=>A(t,n,i=>({...i,ConfirmationText:i.ResponseHtml}))})})}const ae=(t,e,n)=>t.getAsync("contactMethods").then(i=>{i.create({clientName:e,render:"email.form",handleClick:()=>(o,c)=>{const{body:{form:r,guideId:s,confirmationFallback:a,...d}}=c;r||(o.preventDefault(),n(d))},onValidate:o=>y(t,o),onComplete:o=>b(t,o),onSubmit:o=>{const{body:{form:c,guideId:r,confirmationFallback:s,...a}}=o,{values:d}=new C.FormReader(c).export();return Promise.resolve(n(a,d)).then(l=>l||s)}})});class ce extends S.Plugin{constructor(e,n){super(e,n),this.widget.implementation.configure(o=>{o.plugin(F).plugin(M).plugin(V).plugin(O).plugin(K).plugin(z)})}}exports.ContactList=ie;exports.ContactMethod=U;exports.ContactMethodPlatform=x;exports.DefaultContactMethodsPlugin=ce;exports.Description=H;exports.Form=re;exports.chatPopupPlugin=M;exports.complete=b;exports.contactItemList=B;exports.contactLink=W;exports.createSubmitAdapter=ae;exports.emailPlugin=F;exports.evaluate=j;exports.freeTextPlugin=V;exports.linkPlugin=z;exports.phonePlugin=O;exports.submit=A;exports.useContactMethod=se;exports.validate=y;exports.webServicePlugin=K;
97
+ `,ie=({contactMethods:t,children:e,guideId:n,dispatch:i,className:o="",itemRenderer:c,action:r=()=>{},header:s=""})=>{const a=m.useContainer(),{events:d}=a.get("$widget");return t.length?u.jsx(oe,{header:s,className:k.appendClassNames(o,"humany-contact-list"),items:t,renderItem:c?l=>u.jsx("li",{role:t.length===1&&t[0].expanded?"none":void 0,"data-contact-method":l.id,children:c(l,{action:r,dispatch:i,guideId:n})},l.id):l=>u.jsx("li",{role:t.length===1&&t[0].expanded?"none":void 0,"data-contact-method":l.id,onClick:()=>{d.dispatch("tracking:contact-list-item-clicked",l)},children:u.jsx(U,{...l,action:r,dispatch:i,guideId:n})},l.id),children:e}):null},J=(t,e)=>{if(t.actionKey===e)return t;if(!t.properties)return null;const n=Object.keys(t.properties);let i;for(let o=0;o<n.length;o++)if(i=J(t.properties[n[o]],e),i)return i;return!1},re=({className:t,body:{form:e},id:n,action:i,dispatch:o,disabled:c,autoFocus:r})=>{if(e&&!c){const{schema:s,layout:a,data:d,meta:l}=e,p=o||i||(()=>{});return u.jsx($.FormComponent,{className:t,schema:s,layout:a,data:d,autoFocus:r,onChange:(P,v)=>{const g={schema:s,layout:a,data:v,meta:l};P.toString()==="submit"?p("submit",{id:n,form:g}):J(s,P).evaluate?p("evaluate",{id:n,form:g}):p("validate",{id:n,form:g})}})}return null},se=t=>{const[e,n]=w.useState(null),i=m.useContainer();return w.useEffect(()=>{let o;return i.getAsync("componentResolver").then(c=>{o=c.registerResolver(t,r=>n(r))}),()=>{o&&o()}},[t]),e};function K(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"custom.webservice",render:"email.form",onValidate:n=>y(t,n),onComplete:n=>b(t,n),onSubmit:n=>A(t,n,i=>({...i,ConfirmationText:i.ResponseHtml}))})})}const ae=(t,e,n)=>t.getAsync("contactMethods").then(i=>{i.create({clientName:e,render:"email.form",handleClick:()=>(o,c)=>{const{body:{form:r,guideId:s,confirmationFallback:a,...d}}=c;r||(o.preventDefault(),n(d))},onValidate:o=>y(t,o),onComplete:o=>b(t,o),onSubmit:o=>{const{body:{form:c,guideId:r,confirmationFallback:s,...a}}=o,{values:d}=new $.FormReader(c).export();return Promise.resolve(n(a,d)).then(l=>l||s)}})});class ce extends S.Plugin{constructor(e,n){super(e,n),this.widget.implementation.configure(o=>{o.plugin(F).plugin(M).plugin(V).plugin(O).plugin(K).plugin(z)})}}exports.ContactList=ie;exports.ContactMethod=U;exports.ContactMethodPlatform=N;exports.DefaultContactMethodsPlugin=ce;exports.Description=H;exports.Form=re;exports.chatPopupPlugin=M;exports.complete=b;exports.contactItemList=B;exports.contactLink=W;exports.createSubmitAdapter=ae;exports.emailPlugin=F;exports.evaluate=j;exports.freeTextPlugin=V;exports.linkPlugin=z;exports.phonePlugin=O;exports.submit=A;exports.useContactMethod=se;exports.validate=y;exports.webServicePlugin=K;
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-BFS2vrQq.js");exports.ChatPopupPlugin=t.chatPopupPlugin;exports.ContactList=t.ContactList;exports.ContactMethod=t.ContactMethod;exports.ContactMethodPlatform=t.ContactMethodPlatform;exports.DefaultContactMethodsPlugin=t.DefaultContactMethodsPlugin;exports.DefaultForm=t.Form;exports.EmailFormPlugin=t.emailPlugin;exports.FreeTextPlugin=t.freeTextPlugin;exports.LinkPlugin=t.linkPlugin;exports.PhonePlugin=t.phonePlugin;exports.WebServicePlugin=t.webServicePlugin;exports.contactItemList=t.contactItemList;exports.contactLink=t.contactLink;exports.createSubmitAdapter=t.createSubmitAdapter;exports.defaultComplete=t.complete;exports.defaultEvaluate=t.evaluate;exports.defaultSubmit=t.submit;exports.defaultValidate=t.validate;exports.useContactMethod=t.useContactMethod;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-MfKSEgfo.js");exports.ChatPopupPlugin=t.chatPopupPlugin;exports.ContactList=t.ContactList;exports.ContactMethod=t.ContactMethod;exports.ContactMethodPlatform=t.ContactMethodPlatform;exports.DefaultContactMethodsPlugin=t.DefaultContactMethodsPlugin;exports.DefaultForm=t.Form;exports.EmailFormPlugin=t.emailPlugin;exports.FreeTextPlugin=t.freeTextPlugin;exports.LinkPlugin=t.linkPlugin;exports.PhonePlugin=t.phonePlugin;exports.WebServicePlugin=t.webServicePlugin;exports.contactItemList=t.contactItemList;exports.contactLink=t.contactLink;exports.createSubmitAdapter=t.createSubmitAdapter;exports.defaultComplete=t.complete;exports.defaultEvaluate=t.evaluate;exports.defaultSubmit=t.submit;exports.defaultValidate=t.validate;exports.useContactMethod=t.useContactMethod;
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { c as e, C as s, a as l, b as o, d as u, F as i, e as n, f as c, l as d, p as P, w as f, g as m, h as r, i as g, j as C, k as h, s as p, v as b, u as F } from "./index-D4XSiXsg.mjs";
1
+ import { c as e, C as s, a as l, b as o, d as u, F as i, e as n, f as c, l as d, p as P, w as f, g as m, h as r, i as g, j as C, k as h, s as p, v as b, u as F } from "./index-DwVpNWYp.mjs";
2
2
  export {
3
3
  e as ChatPopupPlugin,
4
4
  s as ContactList,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/knowledge-widget-adapters",
3
- "version": "1.3.59",
3
+ "version": "1.3.60-rc.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -11,11 +11,11 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@telia-ace/knowledge-serviceclient": "^1.0.32",
14
- "@telia-ace/knowledge-widget-core": "^1.3.59",
15
- "@telia-ace/knowledge-widget-ui": "^1.3.59",
16
- "@telia-ace/widget-forms": "^1.3.59",
17
- "@telia-ace/widget-routing": "^1.3.59",
18
- "@telia-ace/widget-utilities": "^1.3.59",
14
+ "@telia-ace/knowledge-widget-core": "^1.3.60-rc.0",
15
+ "@telia-ace/knowledge-widget-ui": "^1.3.60-rc.0",
16
+ "@telia-ace/widget-forms": "^1.3.60-rc.0",
17
+ "@telia-ace/widget-routing": "^1.3.60-rc.0",
18
+ "@telia-ace/widget-utilities": "^1.3.60-rc.0",
19
19
  "@webprovisions/platform": "^1.1.4"
20
20
  },
21
21
  "peerDependencies": {