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

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,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-e5030373.js");require("react");require("@telia-ace/widget-forms");require("@telia-ace/knowledge-widget-core");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-9ee2a010.js");require("react");require("@telia-ace/widget-forms");require("@telia-ace/knowledge-widget-core");const h=u(n.Html)`
2
2
  ${n.genericHtml}
3
3
 
4
4
  ${e=>{var t;return n.headingElement(e)("h1",l.css`
@@ -3,7 +3,7 @@ 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-42994c22.mjs";
6
+ import { F as p } from "./index-ae2b05e4.mjs";
7
7
  import "react";
8
8
  import "@telia-ace/widget-forms";
9
9
  import "@telia-ace/knowledge-widget-core";
@@ -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-e5030373.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)`
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
2
  ${n.genericHtml};
3
3
  `;exports.default=c;
@@ -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-42994c22.mjs";
5
+ import { D as a } from "./index-ae2b05e4.mjs";
6
6
  import "@telia-ace/widget-forms";
7
7
  import "react";
8
8
  import "@telia-ace/knowledge-widget-core";
@@ -1,4 +1,4 @@
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}})}),M=(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})),j=(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-c6fab51f.js")),onEvaluate:n=>j(t,n),onValidate:n=>y(t,n),onSubmit:n=>M(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-91478595.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=>j(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)`
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
2
  ${t=>{var e;return m.headingElement(t)("h1",w.css`
3
3
  font-weight: normal;
4
4
  font-size: ${(e=t.theme.fonts)==null?void 0:e.medium};
@@ -14,7 +14,7 @@
14
14
  a:focus-visible {
15
15
  ${m.linkTabStyle};
16
16
  }
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:I,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:I})]}):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`
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};
20
20
  ${t.description?"":"align-items: center;"}
@@ -46,52 +46,52 @@
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
48
  `,W=t=>{var e,n,r;return w.css`
49
- ${m.itemList(t)}
49
+ ${m.itemList(t)}
50
50
 
51
- > div {
52
- padding: ${(e=t.theme.sizes)==null?void 0:e.large};
51
+ > div {
52
+ padding: ${(e=t.theme.sizes)==null?void 0:e.large};
53
53
 
54
- ${m.headingElement(t)("h1",w.css`
55
- margin: 0;
56
- `)}
57
- }
54
+ ${m.headingElement(t)("h1",w.css`
55
+ margin: 0;
56
+ `)}
57
+ }
58
58
 
59
- > ul {
60
- &:not(:first-child) {
61
- border-top: ${t.theme.border};
62
- }
59
+ > ul {
60
+ &:not(:first-child) {
61
+ border-top: ${t.theme.border};
62
+ }
63
63
 
64
- > li {
65
- margin: 0;
66
- white-space: normal;
64
+ > li {
65
+ margin: 0;
66
+ white-space: normal;
67
67
 
68
- > a {
69
- overflow: hidden;
70
- }
68
+ > a {
69
+ overflow: hidden;
70
+ }
71
71
 
72
- &:first-child > a {
73
- border-radius: ${`${t.theme.borderRadius} ${t.theme.borderRadius} 0 0`};
74
- }
72
+ &:first-child > a {
73
+ border-radius: ${`${t.theme.borderRadius} ${t.theme.borderRadius} 0 0`};
74
+ }
75
75
 
76
- &:last-child:not(:first-child) > a {
77
- border-radius: ${`0 0 ${t.theme.borderRadius} ${t.theme.borderRadius}`};
78
- }
76
+ &:last-child:not(:first-child) > a {
77
+ border-radius: ${`0 0 ${t.theme.borderRadius} ${t.theme.borderRadius}`};
78
+ }
79
79
 
80
- &:not(:last-child) {
81
- border-bottom: ${t.theme.border};
82
- }
80
+ &:not(:last-child) {
81
+ border-bottom: ${t.theme.border};
82
+ }
83
83
 
84
- > div {
85
- padding: ${(n=t.theme.sizes)==null?void 0:n.large};
86
- }
87
- }
84
+ > div {
85
+ padding: ${(n=t.theme.sizes)==null?void 0:n.large};
86
+ }
88
87
  }
88
+ }
89
89
 
90
- @media (hover: hover) {
91
- a:hover {
92
- background-color: ${(r=t.theme.colors)==null?void 0:r.accent};
93
- }
90
+ @media (hover: hover) {
91
+ a:hover {
92
+ background-color: ${(r=t.theme.colors)==null?void 0:r.accent};
94
93
  }
94
+ }
95
95
  `},ne=p(m.ItemList)`
96
- ${t=>W(t)}
97
- `,oe=({contactMethods:t,children:e,guideId:n,dispatch:r,className:o="",itemRenderer:c,action:i=()=>{},header:s=""})=>t.length?u.jsx(ne,{header:s,className:$.appendClassNames(o,"humany-contact-list"),items:t,renderItem:c?a=>u.jsx("li",{"data-contact-method":a.id,children:c(a,{action:i,dispatch:r,guideId:n})},a.id):a=>u.jsx("li",{"data-contact-method":a.id,children:u.jsx(H,{...a,action:i,dispatch:r,guideId:n})},a.id),children:e}):null,B=(t,e)=>{if(t.actionKey===e)return t;if(!t.properties)return null;const n=Object.keys(t.properties);let r;for(let o=0;o<n.length;o++)if(r=B(t.properties[n[o]],e),r)return r;return!1},re=({className:t,body:{form:e},id:n,action:r,dispatch:o,disabled:c,autoFocus:i})=>{if(e&&!c){const{schema:s,layout:a,data:l,meta:d}=e,f=o||r||(()=>{});return u.jsx(C.FormComponent,{className:t,schema:s,layout:a,data:l,autoFocus:i,onChange:(P,v)=>{const g={schema:s,layout:a,data:v,meta:d};P.toString()==="submit"?f("submit",{id:n,form:g}):B(s,P).evaluate?f("evaluate",{id:n,form:g}):f("validate",{id:n,form:g})}})}return null},ie=t=>{const[e,n]=k.useState(null),r=m.useContainer();return k.useEffect(()=>{let o;return r.getAsync("componentResolver").then(c=>{o=c.registerResolver(t,i=>n(i))}),()=>{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=>M(t,n,r=>({...r,ConfirmationText:r.ResponseHtml}))})})}const se=(t,e,n)=>t.getAsync("contactMethods").then(r=>{r.create({clientName:e,render:"email.form",handleClick:()=>(o,c)=>{const{body:{form:i,guideId:s,confirmationFallback:a,...l}}=c;i||(o.preventDefault(),n(l))},onValidate:o=>y(t,o),onComplete:o=>b(t,o),onSubmit:o=>{const{body:{form:c,guideId:i,confirmationFallback:s,...a}}=o,{values:l}=new C.FormReader(c).export();return Promise.resolve(n(a,l)).then(d=>d||s)}})});class ae extends S.Plugin{constructor(e,n){super(e,n),this.widget.implementation.configure(o=>{o.plugin(q).plugin(D).plugin(F).plugin(z).plugin(K).plugin(V)})}}exports.ContactList=oe;exports.ContactMethod=H;exports.ContactMethodPlatform=x;exports.DefaultContactMethodsPlugin=ae;exports.Description=O;exports.Form=re;exports.chatPopupPlugin=D;exports.complete=b;exports.contactItemList=W;exports.contactLink=U;exports.createSubmitAdapter=se;exports.emailPlugin=q;exports.evaluate=j;exports.freeTextPlugin=F;exports.linkPlugin=V;exports.phonePlugin=z;exports.submit=M;exports.useContactMethod=ie;exports.validate=y;exports.webServicePlugin=K;
96
+ ${t=>W(t)}
97
+ `,oe=({contactMethods:t,children:e,guideId:n,dispatch:r,className:o="",itemRenderer:c,action:i=()=>{},header:s=""})=>t.length?u.jsx(ne,{header:s,className:$.appendClassNames(o,"humany-contact-list"),items:t,renderItem:c?a=>u.jsx("li",{role:t.length===1?"none":void 0,"data-contact-method":a.id,children:c(a,{action:i,dispatch:r,guideId:n})},a.id):a=>u.jsx("li",{role:t.length===1?"none":void 0,"data-contact-method":a.id,children:u.jsx(H,{...a,action:i,dispatch:r,guideId:n})},a.id),children:e}):null,B=(t,e)=>{if(t.actionKey===e)return t;if(!t.properties)return null;const n=Object.keys(t.properties);let r;for(let o=0;o<n.length;o++)if(r=B(t.properties[n[o]],e),r)return r;return!1},re=({className:t,body:{form:e},id:n,action:r,dispatch:o,disabled:c,autoFocus:i})=>{if(e&&!c){const{schema:s,layout:a,data:l,meta:d}=e,f=o||r||(()=>{});return u.jsx(C.FormComponent,{className:t,schema:s,layout:a,data:l,autoFocus:i,onChange:(P,v)=>{const g={schema:s,layout:a,data:v,meta:d};P.toString()==="submit"?f("submit",{id:n,form:g}):B(s,P).evaluate?f("evaluate",{id:n,form:g}):f("validate",{id:n,form:g})}})}return null},ie=t=>{const[e,n]=k.useState(null),r=m.useContainer();return k.useEffect(()=>{let o;return r.getAsync("componentResolver").then(c=>{o=c.registerResolver(t,i=>n(i))}),()=>{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=>j(t,n,r=>({...r,ConfirmationText:r.ResponseHtml}))})})}const se=(t,e,n)=>t.getAsync("contactMethods").then(r=>{r.create({clientName:e,render:"email.form",handleClick:()=>(o,c)=>{const{body:{form:i,guideId:s,confirmationFallback:a,...l}}=c;i||(o.preventDefault(),n(l))},onValidate:o=>y(t,o),onComplete:o=>b(t,o),onSubmit:o=>{const{body:{form:c,guideId:i,confirmationFallback:s,...a}}=o,{values:l}=new C.FormReader(c).export();return Promise.resolve(n(a,l)).then(d=>d||s)}})});class ae extends S.Plugin{constructor(e,n){super(e,n),this.widget.implementation.configure(o=>{o.plugin(q).plugin(D).plugin(F).plugin(z).plugin(K).plugin(V)})}}exports.ContactList=oe;exports.ContactMethod=H;exports.ContactMethodPlatform=x;exports.DefaultContactMethodsPlugin=ae;exports.Description=O;exports.Form=re;exports.chatPopupPlugin=D;exports.complete=b;exports.contactItemList=W;exports.contactLink=U;exports.createSubmitAdapter=se;exports.emailPlugin=q;exports.evaluate=I;exports.freeTextPlugin=F;exports.linkPlugin=V;exports.phonePlugin=z;exports.submit=j;exports.useContactMethod=ie;exports.validate=y;exports.webServicePlugin=K;
@@ -34,7 +34,7 @@ function ue(t) {
34
34
  t.getAsync("contactMethods").then((e) => {
35
35
  e.create({
36
36
  clientName: "email.form",
37
- render: import("./email-form-component-ed964e9d.mjs"),
37
+ render: import("./email-form-component-d3be8d3d.mjs"),
38
38
  onEvaluate: (n) => T(t, n),
39
39
  onValidate: (n) => y(t, n),
40
40
  onSubmit: (n) => R(t, n),
@@ -42,7 +42,7 @@ function ue(t) {
42
42
  });
43
43
  });
44
44
  }
45
- const M = (t, e, n) => {
45
+ const E = (t, e, n) => {
46
46
  const { url: r, width: o, height: c } = e, i = n || {}, a = document.createElement("a");
47
47
  return a.href = r, a.search.replace("?", "").split("&").forEach((s) => {
48
48
  const [l, d] = s.split("=");
@@ -58,14 +58,14 @@ function pe(t) {
58
58
  const { title: r, body: o } = n, { form: c, guideId: i, confirmationFallback: a, ...s } = o;
59
59
  return c ? () => {
60
60
  } : (l) => {
61
- l.preventDefault(), M(r, s);
61
+ l.preventDefault(), E(r, s);
62
62
  };
63
63
  },
64
64
  onValidate: (n) => y(t, n),
65
65
  onComplete: (n) => b(t, n),
66
66
  onSubmit: (n) => {
67
67
  const { title: r, body: o } = n, { form: c, guideId: i, confirmationFallback: a, ...s } = o, l = new w(c).export().values;
68
- return M(r, s, l), a;
68
+ return E(r, s, l), a;
69
69
  }
70
70
  });
71
71
  });
@@ -74,7 +74,7 @@ function fe(t) {
74
74
  t.getAsync("contactMethods").then((e) => {
75
75
  e.create({
76
76
  clientName: "custom.freetext",
77
- render: import("./free-text-component-7b456d3b.mjs")
77
+ render: import("./free-text-component-ce54e4bb.mjs")
78
78
  });
79
79
  });
80
80
  }
@@ -335,7 +335,7 @@ const ve = f(te)`
335
335
  children: [
336
336
  p && /* @__PURE__ */ m(le, { symbol: p }),
337
337
  u ? /* @__PURE__ */ I("div", { className: "humany-contact-link-rich-content", children: [
338
- /* @__PURE__ */ m(E, { children: l }),
338
+ /* @__PURE__ */ m(M, { children: l }),
339
339
  /* @__PURE__ */ m(
340
340
  ve,
341
341
  {
@@ -343,7 +343,7 @@ const ve = f(te)`
343
343
  htmlParseInstruction: N
344
344
  }
345
345
  )
346
- ] }) : /* @__PURE__ */ m(E, { children: l })
346
+ ] }) : /* @__PURE__ */ m(M, { children: l })
347
347
  ]
348
348
  }
349
349
  );
@@ -371,7 +371,7 @@ const ve = f(te)`
371
371
  color: ${(s = t.theme.colors) == null ? void 0 : s.text};
372
372
  }
373
373
  `;
374
- }, E = f(re)`
374
+ }, M = f(re)`
375
375
  line-height: ${(t) => {
376
376
  var e;
377
377
  return (e = t.theme.fonts) == null ? void 0 : e.large;
@@ -392,58 +392,58 @@ const ve = f(te)`
392
392
  `, Pe = (t) => {
393
393
  var e, n, r;
394
394
  return C`
395
- ${me(t)}
395
+ ${me(t)}
396
396
 
397
- > div {
398
- padding: ${(e = t.theme.sizes) == null ? void 0 : e.large};
397
+ > div {
398
+ padding: ${(e = t.theme.sizes) == null ? void 0 : e.large};
399
399
 
400
- ${V(t)(
400
+ ${V(t)(
401
401
  "h1",
402
402
  C`
403
- margin: 0;
404
- `
403
+ margin: 0;
404
+ `
405
405
  )}
406
- }
406
+ }
407
407
 
408
- > ul {
409
- &:not(:first-child) {
410
- border-top: ${t.theme.border};
411
- }
408
+ > ul {
409
+ &:not(:first-child) {
410
+ border-top: ${t.theme.border};
411
+ }
412
412
 
413
- > li {
414
- margin: 0;
415
- white-space: normal;
413
+ > li {
414
+ margin: 0;
415
+ white-space: normal;
416
416
 
417
- > a {
418
- overflow: hidden;
419
- }
417
+ > a {
418
+ overflow: hidden;
419
+ }
420
420
 
421
- &:first-child > a {
422
- border-radius: ${`${t.theme.borderRadius} ${t.theme.borderRadius} 0 0`};
423
- }
421
+ &:first-child > a {
422
+ border-radius: ${`${t.theme.borderRadius} ${t.theme.borderRadius} 0 0`};
423
+ }
424
424
 
425
- &:last-child:not(:first-child) > a {
426
- border-radius: ${`0 0 ${t.theme.borderRadius} ${t.theme.borderRadius}`};
427
- }
425
+ &:last-child:not(:first-child) > a {
426
+ border-radius: ${`0 0 ${t.theme.borderRadius} ${t.theme.borderRadius}`};
427
+ }
428
428
 
429
- &:not(:last-child) {
430
- border-bottom: ${t.theme.border};
431
- }
429
+ &:not(:last-child) {
430
+ border-bottom: ${t.theme.border};
431
+ }
432
432
 
433
- > div {
434
- padding: ${(n = t.theme.sizes) == null ? void 0 : n.large};
435
- }
436
- }
433
+ > div {
434
+ padding: ${(n = t.theme.sizes) == null ? void 0 : n.large};
435
+ }
437
436
  }
437
+ }
438
438
 
439
- @media (hover: hover) {
440
- a:hover {
441
- background-color: ${(r = t.theme.colors) == null ? void 0 : r.accent};
442
- }
439
+ @media (hover: hover) {
440
+ a:hover {
441
+ background-color: ${(r = t.theme.colors) == null ? void 0 : r.accent};
443
442
  }
443
+ }
444
444
  `;
445
445
  }, Ne = f(de)`
446
- ${(t) => Pe(t)}
446
+ ${(t) => Pe(t)}
447
447
  `, Le = ({
448
448
  contactMethods: t,
449
449
  children: e,
@@ -460,15 +460,31 @@ const ve = f(te)`
460
460
  header: a,
461
461
  className: Q(o, "humany-contact-list"),
462
462
  items: t,
463
- renderItem: c ? (s) => /* @__PURE__ */ m("li", { "data-contact-method": s.id, children: c(s, { action: i, dispatch: r, guideId: n }) }, s.id) : (s) => /* @__PURE__ */ m("li", { "data-contact-method": s.id, children: /* @__PURE__ */ m(
464
- Ce,
463
+ renderItem: c ? (s) => /* @__PURE__ */ m(
464
+ "li",
465
465
  {
466
- ...s,
467
- action: i,
468
- dispatch: r,
469
- guideId: n
470
- }
471
- ) }, s.id),
466
+ role: t.length === 1 ? "none" : void 0,
467
+ "data-contact-method": s.id,
468
+ children: c(s, { action: i, dispatch: r, guideId: n })
469
+ },
470
+ s.id
471
+ ) : (s) => /* @__PURE__ */ m(
472
+ "li",
473
+ {
474
+ role: t.length === 1 ? "none" : void 0,
475
+ "data-contact-method": s.id,
476
+ children: /* @__PURE__ */ m(
477
+ Ce,
478
+ {
479
+ ...s,
480
+ action: i,
481
+ dispatch: r,
482
+ guideId: n
483
+ }
484
+ )
485
+ },
486
+ s.id
487
+ ),
472
488
  children: e
473
489
  }
474
490
  ) : null, L = (t, e) => {
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-e5030373.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-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;
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-42994c22.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-ae2b05e4.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.1",
3
+ "version": "1.1.2-rc.1",
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.1",
15
- "@telia-ace/knowledge-widget-ui": "^1.1.1",
16
- "@telia-ace/widget-forms": "^1.1.1",
17
- "@telia-ace/widget-routing": "^1.1.1",
18
- "@telia-ace/widget-utilities": "^1.1.1",
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",
19
19
  "@webprovisions/platform": "^1.1.4"
20
20
  },
21
21
  "peerDependencies": {