@telia-ace/knowledge-widget-adapters 1.1.2-rc.1 → 1.1.2-rc.2

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.
@@ -4,7 +4,7 @@ export { FreeTextPlugin } from './free-text';
4
4
  export { LinkPlugin } from './link';
5
5
  export { PhonePlugin } from './phone';
6
6
  export { default as ContactMethodPlatform } from './platform';
7
- export type { Click as ContactMethodClick, ReactComponentImport } from './platform';
7
+ export type { Click as ContactMethodClick, ReactComponentImport, } from './platform';
8
8
  export { contactItemList, contactLink, ContactList, ContactMethod, Form as DefaultForm, useContactMethod, } from './ui';
9
9
  export type { ContactMethodType } from './ui';
10
10
  export { WebServicePlugin } from './web-service';
@@ -1,7 +1,7 @@
1
1
  export { default as Confirmation } from './confirmation';
2
2
  export { contactItemList, default as ContactList } from './contact-list';
3
3
  export { contactLink, default as ContactMethod } from './contact-method';
4
- export type { ContactMethodType, Props as ContactMethodProps } from './contact-method';
4
+ export type { ContactMethodType, Props as ContactMethodProps, } from './contact-method';
5
5
  export { default as Description } from './description';
6
6
  export { default as Form } from './form';
7
7
  export { default as useContactMethod } from './use-contact-method';
@@ -1,8 +1,8 @@
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-9ee2a010.js");require("react");require("@telia-ace/widget-forms");require("@telia-ace/knowledge-widget-core");const h=u(n.Html)`
2
- ${n.genericHtml}
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-dd63627f.js");require("react");require("@telia-ace/widget-forms");require("@telia-ace/knowledge-widget-core");const h=u(n.Html)`
2
+ ${n.genericHtml}
3
3
 
4
- ${e=>{var t;return n.headingElement(e)("h1",l.css`
5
- font-weight: normal;
6
- font-size: ${(t=e.theme.fonts)==null?void 0:t.medium};
7
- `)}}
4
+ ${e=>{var t;return n.headingElement(e)("h1",l.css`
5
+ font-weight: normal;
6
+ font-size: ${(t=e.theme.fonts)==null?void 0:t.medium};
7
+ `)}}
8
8
  `,f=e=>{const{className:t,renderDefault:s=()=>{},body:{form:a},confirmation:r,htmlParseInstruction:m,disabled:c}=e;return r?i.jsx(h,{className:o.appendClassNames(t,"humany-contact-method-confirmation","humany-contact-method-email"),html:r,htmlParseInstruction:m}):a&&!c?i.jsx(d.Form,{...e,className:o.appendClassNames(t,"humany-contact-method-email")}):s()};exports.default=f;
@@ -3,21 +3,21 @@ import { css as l } from "@emotion/react";
3
3
  import c from "@emotion/styled";
4
4
  import { Html as f, genericHtml as d, headingElement as h } from "@telia-ace/knowledge-widget-ui";
5
5
  import { appendClassNames as r } from "@telia-ace/widget-utilities";
6
- import { F as p } from "./index-ae2b05e4.mjs";
6
+ import { F as p } from "./index-d3757267.mjs";
7
7
  import "react";
8
8
  import "@telia-ace/widget-forms";
9
9
  import "@telia-ace/knowledge-widget-core";
10
10
  const u = c(f)`
11
- ${d}
11
+ ${d}
12
12
 
13
- ${(t) => {
13
+ ${(t) => {
14
14
  var m;
15
15
  return h(t)(
16
16
  "h1",
17
17
  l`
18
- font-weight: normal;
19
- font-size: ${(m = t.theme.fonts) == null ? void 0 : m.medium};
20
- `
18
+ font-weight: normal;
19
+ font-size: ${(m = t.theme.fonts) == null ? void 0 : m.medium};
20
+ `
21
21
  );
22
22
  }}
23
23
  `, E = (t) => {
@@ -2,7 +2,7 @@ import { jsxs as p, jsx as r } from "react/jsx-runtime";
2
2
  import i from "@emotion/styled";
3
3
  import { Html as l, genericHtml as s } from "@telia-ace/knowledge-widget-ui";
4
4
  import { appendClassNames as n } from "@telia-ace/widget-utilities";
5
- import { D as a } from "./index-ae2b05e4.mjs";
5
+ import { D as a } from "./index-d3757267.mjs";
6
6
  import "@telia-ace/widget-forms";
7
7
  import "react";
8
8
  import "@telia-ace/knowledge-widget-core";
@@ -12,11 +12,23 @@ const D = ({
12
12
  description: t,
13
13
  body: { freetext: m },
14
14
  htmlParseInstruction: o
15
- }) => m ? /* @__PURE__ */ p("div", { className: n(e, "humany-contact-method-free-text"), children: [
16
- /* @__PURE__ */ r(d, { html: m, htmlParseInstruction: o }),
17
- t && /* @__PURE__ */ r(a, { html: t, htmlParseInstruction: o })
18
- ] }) : null, d = i(l)`
19
- ${s};
15
+ }) => m ? /* @__PURE__ */ p(
16
+ "div",
17
+ {
18
+ className: n(e, "humany-contact-method-free-text"),
19
+ children: [
20
+ /* @__PURE__ */ r(d, { html: m, htmlParseInstruction: o }),
21
+ t && /* @__PURE__ */ r(
22
+ a,
23
+ {
24
+ html: t,
25
+ htmlParseInstruction: o
26
+ }
27
+ )
28
+ ]
29
+ }
30
+ ) : null, d = i(l)`
31
+ ${s};
20
32
  `;
21
33
  export {
22
34
  D as default
@@ -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"),u=require("@telia-ace/widget-utilities"),o=require("./index-9ee2a010.js");require("@telia-ace/widget-forms");require("react");require("@telia-ace/knowledge-widget-core");require("@emotion/react");const c=({className:s,description:t,body:{freetext:r},htmlParseInstruction:i})=>r?e.jsxs("div",{className:u.appendClassNames(s,"humany-contact-method-free-text"),children:[e.jsx(d,{html:r,htmlParseInstruction:i}),t&&e.jsx(o.Description,{html:t,htmlParseInstruction:i})]}):null,d=l(n.Html)`
2
- ${n.genericHtml};
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"),u=require("@telia-ace/widget-utilities"),o=require("./index-dd63627f.js");require("@telia-ace/widget-forms");require("react");require("@telia-ace/knowledge-widget-core");require("@emotion/react");const c=({className:s,description:t,body:{freetext:r},htmlParseInstruction:i})=>r?e.jsxs("div",{className:u.appendClassNames(s,"humany-contact-method-free-text"),children:[e.jsx(d,{html:r,htmlParseInstruction:i}),t&&e.jsx(o.Description,{html:t,htmlParseInstruction:i})]}):null,d=l(n.Html)`
2
+ ${n.genericHtml};
3
3
  `;exports.default=c;
@@ -10,7 +10,9 @@ import { css as C } from "@emotion/react";
10
10
  import f from "@emotion/styled";
11
11
  import { Paragraph as ee, headingElement as V, Html as te, genericHtml as ne, borderTabStyle as D, linkTabStyle as oe, StyledText as re, Link as ie, useComponent as ae, useRouteData as se, Typography as ce, SymbolBadge as le, ItemList as de, itemList as me, useContainer as he } from "@telia-ace/knowledge-widget-ui";
12
12
  const P = (t, e, n = !1) => t.getManyAsync("matchingClient", "router").then((r) => {
13
- const { formData: o } = new w(e.body.form).export(n), { router: c, matchingClient: i } = r, { params: a } = c.getRouteData();
13
+ const { formData: o } = new w(e.body.form).export(
14
+ n
15
+ ), { router: c, matchingClient: i } = r, { params: a } = c.getRouteData();
14
16
  return i.customRequest(
15
17
  `contactmethods/${e.id}${n ? "/validatedwithpayload" : ""}`,
16
18
  "POST",
@@ -21,12 +23,17 @@ const P = (t, e, n = !1) => t.getManyAsync("matchingClient", "router").then((r)
21
23
  }
22
24
  }
23
25
  );
24
- }), R = (t, e, n) => P(t, e).then((r) => n ? n(r) : r).then(({ ConfirmationText: r }) => r), y = (t, e) => P(t, e, !0).then((n) => ({
25
- valid: n.Validation.IsValid,
26
- errors: n.Validation.Errors,
27
- errorTypes: n.Validation.ErrorTypes
28
- })), T = (t, e) => P(t, e, !0).then(
29
- (n) => B.fromLegacyForm(e.id, n.ContactMethod.Form).get()
26
+ }), R = (t, e, n) => P(t, e).then((r) => n ? n(r) : r).then(({ ConfirmationText: r }) => r), y = (t, e) => P(t, e, !0).then(
27
+ (n) => ({
28
+ valid: n.Validation.IsValid,
29
+ errors: n.Validation.Errors,
30
+ errorTypes: n.Validation.ErrorTypes
31
+ })
32
+ ), T = (t, e) => P(t, e, !0).then(
33
+ (n) => B.fromLegacyForm(
34
+ e.id,
35
+ n.ContactMethod.Form
36
+ ).get()
30
37
  ), b = (t, e) => t.getAsync("matchingClient").then((n) => {
31
38
  n.completeContactMethod(e.id);
32
39
  });
@@ -34,7 +41,7 @@ function ue(t) {
34
41
  t.getAsync("contactMethods").then((e) => {
35
42
  e.create({
36
43
  clientName: "email.form",
37
- render: import("./email-form-component-d3be8d3d.mjs"),
44
+ render: import("./email-form-component-b8869d13.mjs"),
38
45
  onEvaluate: (n) => T(t, n),
39
46
  onValidate: (n) => y(t, n),
40
47
  onSubmit: (n) => R(t, n),
@@ -74,7 +81,7 @@ function fe(t) {
74
81
  t.getAsync("contactMethods").then((e) => {
75
82
  e.create({
76
83
  clientName: "custom.freetext",
77
- render: import("./free-text-component-ce54e4bb.mjs")
84
+ render: import("./free-text-component-35d4babb.mjs")
78
85
  });
79
86
  });
80
87
  }
@@ -248,28 +255,28 @@ class k {
248
255
  }
249
256
  }
250
257
  f(ee)`
251
- ${(t) => {
258
+ ${(t) => {
252
259
  var e;
253
260
  return V(t)(
254
261
  "h1",
255
262
  C`
256
- font-weight: normal;
257
- font-size: ${(e = t.theme.fonts) == null ? void 0 : e.medium};
258
- `
263
+ font-weight: normal;
264
+ font-size: ${(e = t.theme.fonts) == null ? void 0 : e.medium};
265
+ `
259
266
  );
260
267
  }}
261
268
  `;
262
269
  const ve = f(te)`
263
- ${ne}
264
- font-weight: 300;
265
- line-height: 1.5em;
266
- button:focus-visible {
267
- ${D};
268
- }
270
+ ${ne}
271
+ font-weight: 300;
272
+ line-height: 1.5em;
273
+ button:focus-visible {
274
+ ${D};
275
+ }
269
276
 
270
- a:focus-visible {
271
- ${oe};
272
- }
277
+ a:focus-visible {
278
+ ${oe};
279
+ }
273
280
  `, Ce = (t) => {
274
281
  const e = ae(t.clientName), {
275
282
  params: { contactCategory: n, guideCategory: r, phrase: o }
@@ -1,19 +1,19 @@
1
- "use strict";var Y=Object.defineProperty;var Z=(t,e,n)=>e in t?Y(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var N=(t,e,n)=>(Z(t,typeof e!="symbol"?e+"":e,n),n);const C=require("@telia-ace/widget-forms"),S=require("@telia-ace/knowledge-widget-core"),$=require("@telia-ace/widget-utilities"),k=require("react"),u=require("react/jsx-runtime"),w=require("@emotion/react"),p=require("@emotion/styled"),m=require("@telia-ace/knowledge-widget-ui"),A=(t,e,n=!1)=>t.getManyAsync("matchingClient","router").then(r=>{const{formData:o}=new C.FormReader(e.body.form).export(n),{router:c,matchingClient:i}=r,{params:s}=c.getRouteData();return i.customRequest(`contactmethods/${e.id}${n?"/validatedwithpayload":""}`,"POST",{body:o,configuration:{guideId:e.body.guideId||s.guideId}})}),j=(t,e,n)=>A(t,e).then(r=>n?n(r):r).then(({ConfirmationText:r})=>r),y=(t,e)=>A(t,e,!0).then(n=>({valid:n.Validation.IsValid,errors:n.Validation.Errors,errorTypes:n.Validation.ErrorTypes})),I=(t,e)=>A(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)});function q(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"email.form",render:Promise.resolve().then(()=>require("./email-form-component-34047911.js")),onEvaluate:n=>I(t,n),onValidate:n=>y(t,n),onSubmit:n=>j(t,n),onComplete:n=>b(t,n)})})}const L=(t,e,n)=>{const{url:r,width:o,height:c}=e,i=n||{},s=document.createElement("a");return s.href=r,s.search.replace("?","").split("&").forEach(a=>{const[l,d]=a.split("=");typeof d<"u"&&(i[l]=d)}),s.search=Object.keys(i).map(a=>`${a}=${i[a]}`).join("&"),window.open(s.href,t,`width=${o},height=${c}`),""};function D(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"chat.popup",render:"email.form",handleClick:n=>{const{title:r,body:o}=n,{form:c,guideId:i,confirmationFallback:s,...a}=o;return c?()=>{}:l=>{l.preventDefault(),L(r,a)}},onValidate:n=>y(t,n),onComplete:n=>b(t,n),onSubmit:n=>{const{title:r,body:o}=n,{form:c,guideId:i,confirmationFallback:s,...a}=o,l=new C.FormReader(c).export().values;return L(r,a,l),s}})})}function F(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"custom.freetext",render:Promise.resolve().then(()=>require("./free-text-component-345d5990.js"))})})}function V(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"custom.link",render:Promise.resolve().then(()=>require("./link-component-6fbdc8fb.js"))})})}function z(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"phone.text",render:Promise.resolve().then(()=>require("./phone-component-ebf50e0d.js"))})})}const _=async(t,e)=>{const n=t.get(e.clientName);let{description:r,disabled:o,onClick:c}=e;if(n){const{handleClick:i,handleDescription:s,handleDisabled:a}=n;typeof i=="function"&&(c=await Promise.resolve(i(e))),typeof s=="function"&&(r=await Promise.resolve(s(e))),typeof a=="function"&&(o=await Promise.resolve(a(e)))}return Promise.resolve({...e,description:r,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(i,s)=>{const{contactMethods:a}=i;if(a){const l=Promise.all(a.map(d=>this.handleAdapters(d)));await Promise.resolve(l).then(d=>{i.contactMethods=d})}return s(i)});const o=n.components().ofType("guide").select();o.actions.watch("guide.fetched",async(i,s)=>{const{contactMethods:a}=i;if(a){const l=Promise.all(a.map(d=>this.handleAdapters(d)));await Promise.resolve(l).then(d=>{i.contactMethods=d})}return s(i)}),o.actions.watch("guide.handover",async(i,s)=>{const{handoverContactMethods:a}=i;if(a){const l=Promise.all(a.map(d=>this.handleAdapters(d)));await Promise.resolve(l).then(d=>{i.handoverContactMethods=d})}return s(i)}),n.components().ofType("contact-method").select().actions.watch("contact-method.fetched",async(i,s)=>{const{contactMethod:a}=i;return a?this.handleAdapters(a).then(l=>s({...i,contactMethod:l})):s(i)})}}static create(e){return S.ComponentPlatform.getInstance(e).then(n=>new x(e,n))}handleAdapters(e){return _(this.adapters,e)}static getInstance(e,n="contactMethods"){return $.lock(e)(()=>e.getAsync(n).then(r=>{let o=r;return o||S.ComponentPlatform.getInstance(e).then(c=>(o=new x(e,c),e.registerAsync(n,()=>o),o))}))}track(e={},n){const{events:r}=this.container.get("$widget");r.dispatch("tracking:service-client-response",{type:n,data:e})}complete(e){const{id:n,title:r,clientName:o,expanded:c,body:i}=e;this.track({contactMethod:{id:n,title:r,expanded:c,type:o},hasGuide:!!i.guideId},"contact-method-complete");const s=this.adapters.get(o);if(s&&s.onComplete)return s.onComplete(e)}evaluate(e){const{clientName:n}=e,r=this.adapters.get(n);return r&&r.onEvaluate?Promise.resolve(r.onEvaluate(e)):Promise.resolve(e.body.form)}validate(e){const{id:n,title:r,clientName:o}=e,c=this.adapters.get(o);return c&&c.onValidate?Promise.resolve(c.onValidate(e)).then(i=>{this.track({contactMethod:{id:n,title:r,type:o},isValid:i.valid},"contact-method-validate");const{events:s}=this.container.get("$widget");return s.dispatch("form:validated",{isValid:i.valid}),i}):Promise.resolve({valid:!0})}submit(e){const{clientName:n}=e,r=this.adapters.get(n);return r&&r.onSubmit?Promise.resolve(r.onSubmit(e)).then(o=>(this.complete(e),o)):Promise.resolve("")}create(e){const{clientName:n,render:r}=e;return this.adapters.set(n,{onValidate:o=>y(this.container,o),onEvaluate:o=>I(this.container,o),onComplete:o=>b(this.container,o),...e}),this.container.getAsync("componentResolver").then(o=>{typeof r=="string"?this.subs.push(o.registerAlias(n,r)):this.subs.push(o.registerComponent(n,k.lazy(()=>r)))})}dispose(){this.subs.forEach(e=>e())}}p(m.Paragraph)`
2
- ${t=>{var e;return m.headingElement(t)("h1",w.css`
3
- font-weight: normal;
4
- font-size: ${(e=t.theme.fonts)==null?void 0:e.medium};
5
- `)}}
1
+ "use strict";var Y=Object.defineProperty;var Z=(t,e,n)=>e in t?Y(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var N=(t,e,n)=>(Z(t,typeof e!="symbol"?e+"":e,n),n);const C=require("@telia-ace/widget-forms"),S=require("@telia-ace/knowledge-widget-core"),$=require("@telia-ace/widget-utilities"),k=require("react"),u=require("react/jsx-runtime"),w=require("@emotion/react"),p=require("@emotion/styled"),m=require("@telia-ace/knowledge-widget-ui"),A=(t,e,n=!1)=>t.getManyAsync("matchingClient","router").then(r=>{const{formData:o}=new C.FormReader(e.body.form).export(n),{router:c,matchingClient:i}=r,{params:s}=c.getRouteData();return i.customRequest(`contactmethods/${e.id}${n?"/validatedwithpayload":""}`,"POST",{body:o,configuration:{guideId:e.body.guideId||s.guideId}})}),j=(t,e,n)=>A(t,e).then(r=>n?n(r):r).then(({ConfirmationText:r})=>r),y=(t,e)=>A(t,e,!0).then(n=>({valid:n.Validation.IsValid,errors:n.Validation.Errors,errorTypes:n.Validation.ErrorTypes})),I=(t,e)=>A(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)});function q(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"email.form",render:Promise.resolve().then(()=>require("./email-form-component-2894c6fc.js")),onEvaluate:n=>I(t,n),onValidate:n=>y(t,n),onSubmit:n=>j(t,n),onComplete:n=>b(t,n)})})}const L=(t,e,n)=>{const{url:r,width:o,height:c}=e,i=n||{},s=document.createElement("a");return s.href=r,s.search.replace("?","").split("&").forEach(a=>{const[l,d]=a.split("=");typeof d<"u"&&(i[l]=d)}),s.search=Object.keys(i).map(a=>`${a}=${i[a]}`).join("&"),window.open(s.href,t,`width=${o},height=${c}`),""};function D(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"chat.popup",render:"email.form",handleClick:n=>{const{title:r,body:o}=n,{form:c,guideId:i,confirmationFallback:s,...a}=o;return c?()=>{}:l=>{l.preventDefault(),L(r,a)}},onValidate:n=>y(t,n),onComplete:n=>b(t,n),onSubmit:n=>{const{title:r,body:o}=n,{form:c,guideId:i,confirmationFallback:s,...a}=o,l=new C.FormReader(c).export().values;return L(r,a,l),s}})})}function F(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"custom.freetext",render:Promise.resolve().then(()=>require("./free-text-component-4177eff1.js"))})})}function V(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"custom.link",render:Promise.resolve().then(()=>require("./link-component-6fbdc8fb.js"))})})}function z(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"phone.text",render:Promise.resolve().then(()=>require("./phone-component-ebf50e0d.js"))})})}const _=async(t,e)=>{const n=t.get(e.clientName);let{description:r,disabled:o,onClick:c}=e;if(n){const{handleClick:i,handleDescription:s,handleDisabled:a}=n;typeof i=="function"&&(c=await Promise.resolve(i(e))),typeof s=="function"&&(r=await Promise.resolve(s(e))),typeof a=="function"&&(o=await Promise.resolve(a(e)))}return Promise.resolve({...e,description:r,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(i,s)=>{const{contactMethods:a}=i;if(a){const l=Promise.all(a.map(d=>this.handleAdapters(d)));await Promise.resolve(l).then(d=>{i.contactMethods=d})}return s(i)});const o=n.components().ofType("guide").select();o.actions.watch("guide.fetched",async(i,s)=>{const{contactMethods:a}=i;if(a){const l=Promise.all(a.map(d=>this.handleAdapters(d)));await Promise.resolve(l).then(d=>{i.contactMethods=d})}return s(i)}),o.actions.watch("guide.handover",async(i,s)=>{const{handoverContactMethods:a}=i;if(a){const l=Promise.all(a.map(d=>this.handleAdapters(d)));await Promise.resolve(l).then(d=>{i.handoverContactMethods=d})}return s(i)}),n.components().ofType("contact-method").select().actions.watch("contact-method.fetched",async(i,s)=>{const{contactMethod:a}=i;return a?this.handleAdapters(a).then(l=>s({...i,contactMethod:l})):s(i)})}}static create(e){return S.ComponentPlatform.getInstance(e).then(n=>new x(e,n))}handleAdapters(e){return _(this.adapters,e)}static getInstance(e,n="contactMethods"){return $.lock(e)(()=>e.getAsync(n).then(r=>{let o=r;return o||S.ComponentPlatform.getInstance(e).then(c=>(o=new x(e,c),e.registerAsync(n,()=>o),o))}))}track(e={},n){const{events:r}=this.container.get("$widget");r.dispatch("tracking:service-client-response",{type:n,data:e})}complete(e){const{id:n,title:r,clientName:o,expanded:c,body:i}=e;this.track({contactMethod:{id:n,title:r,expanded:c,type:o},hasGuide:!!i.guideId},"contact-method-complete");const s=this.adapters.get(o);if(s&&s.onComplete)return s.onComplete(e)}evaluate(e){const{clientName:n}=e,r=this.adapters.get(n);return r&&r.onEvaluate?Promise.resolve(r.onEvaluate(e)):Promise.resolve(e.body.form)}validate(e){const{id:n,title:r,clientName:o}=e,c=this.adapters.get(o);return c&&c.onValidate?Promise.resolve(c.onValidate(e)).then(i=>{this.track({contactMethod:{id:n,title:r,type:o},isValid:i.valid},"contact-method-validate");const{events:s}=this.container.get("$widget");return s.dispatch("form:validated",{isValid:i.valid}),i}):Promise.resolve({valid:!0})}submit(e){const{clientName:n}=e,r=this.adapters.get(n);return r&&r.onSubmit?Promise.resolve(r.onSubmit(e)).then(o=>(this.complete(e),o)):Promise.resolve("")}create(e){const{clientName:n,render:r}=e;return this.adapters.set(n,{onValidate:o=>y(this.container,o),onEvaluate:o=>I(this.container,o),onComplete:o=>b(this.container,o),...e}),this.container.getAsync("componentResolver").then(o=>{typeof r=="string"?this.subs.push(o.registerAlias(n,r)):this.subs.push(o.registerComponent(n,k.lazy(()=>r)))})}dispose(){this.subs.forEach(e=>e())}}p(m.Paragraph)`
2
+ ${t=>{var e;return m.headingElement(t)("h1",w.css`
3
+ font-weight: normal;
4
+ font-size: ${(e=t.theme.fonts)==null?void 0:e.medium};
5
+ `)}}
6
6
  `;const O=p(m.Html)`
7
- ${m.genericHtml}
8
- font-weight: 300;
9
- line-height: 1.5em;
10
- button:focus-visible {
11
- ${m.borderTabStyle};
12
- }
7
+ ${m.genericHtml}
8
+ font-weight: 300;
9
+ line-height: 1.5em;
10
+ button:focus-visible {
11
+ ${m.borderTabStyle};
12
+ }
13
13
 
14
- a:focus-visible {
15
- ${m.linkTabStyle};
16
- }
14
+ a:focus-visible {
15
+ ${m.linkTabStyle};
16
+ }
17
17
  `,H=t=>{const e=m.useComponent(t.clientName),{params:{contactCategory:n,guideCategory:r,phrase:o}}=m.useRouteData();if(typeof e>"u")return null;if(e===null)return process.env.NODE_ENV!=="production"?u.jsx(te,{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=(i={})=>{const s={...t,...i},{id:a,title:l,clientName:d,symbol:f,inline:P,onClick:v=()=>{},description:g,htmlParseInstruction:M,className:G,disabled:J,guideId:Q,dispatch:R=()=>{},expanded:E}=s,X=P?{onKeyDown:h=>{h.key&&h.key==="Enter"&&(v(h,s),h.defaultPrevented||!E&&R("expand",a))},onClick:h=>{v(h,s),h.defaultPrevented||!E&&R("expand",a)}}:{onClick:h=>v(h,s),routeName:"contact-method",params:$.createParams({contactCategory:n,guideId:Q,guideCategory:r,phrase:o,contactMethod:a,uriName:$.formatUrl(l)})};return u.jsxs(ee,{title:l,"aria-label":l,className:G,disabled:J,description:g,"data-client-name":d,...i,...X,children:[f&&u.jsx(m.SymbolBadge,{symbol:f}),g?u.jsxs("div",{className:"humany-contact-link-rich-content",children:[u.jsx(T,{children:l}),u.jsx(O,{html:g,htmlParseInstruction:M})]}):u.jsx(T,{children:l})]})};return t.expanded?u.jsx(k.Suspense,{fallback:null,children:u.jsx(e,{...t,renderDefault:c})}):c()},U=t=>{var e,n,r,o,c,i,s,a;return w.css`
18
18
  display: flex;
19
19
  padding: ${(e=t.theme.sizes)==null?void 0:e.large};
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-9ee2a010.js");require("@telia-ace/widget-forms");require("@telia-ace/knowledge-widget-core");require("@telia-ace/widget-utilities");require("react");require("react/jsx-runtime");require("@emotion/react");require("@emotion/styled");require("@telia-ace/knowledge-widget-ui");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-dd63627f.js");require("@telia-ace/widget-forms");require("@telia-ace/knowledge-widget-core");require("@telia-ace/widget-utilities");require("react");require("react/jsx-runtime");require("@emotion/react");require("@emotion/styled");require("@telia-ace/knowledge-widget-ui");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 r, C as p, d as c, e as d, k as P, F as f, h as g, i as C, l as h, p as b, w as F, a as L, b as M, j as k, f as v, g as S, s as x, v as D, u as E } from "./index-ae2b05e4.mjs";
1
+ import { c as r, C as p, d as c, e as d, k as P, F as f, h as g, i as C, l as h, p as b, w as F, a as L, b as M, j as k, f as v, g as S, s as x, v as D, u as E } from "./index-d3757267.mjs";
2
2
  import "@telia-ace/widget-forms";
3
3
  import "@telia-ace/knowledge-widget-core";
4
4
  import "@telia-ace/widget-utilities";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/knowledge-widget-adapters",
3
- "version": "1.1.2-rc.1",
3
+ "version": "1.1.2-rc.2",
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.31",
14
- "@telia-ace/knowledge-widget-core": "^1.1.2-rc.1",
15
- "@telia-ace/knowledge-widget-ui": "^1.1.2-rc.1",
16
- "@telia-ace/widget-forms": "^1.1.2-rc.1",
17
- "@telia-ace/widget-routing": "^1.1.2-rc.1",
18
- "@telia-ace/widget-utilities": "^1.1.2-rc.1",
14
+ "@telia-ace/knowledge-widget-core": "^1.1.2-rc.2",
15
+ "@telia-ace/knowledge-widget-ui": "^1.1.2-rc.2",
16
+ "@telia-ace/widget-forms": "^1.1.2-rc.2",
17
+ "@telia-ace/widget-routing": "^1.1.2-rc.2",
18
+ "@telia-ace/widget-utilities": "^1.1.2-rc.2",
19
19
  "@webprovisions/platform": "^1.1.4"
20
20
  },
21
21
  "peerDependencies": {