@telia-ace/knowledge-widget-adapters 1.3.2-rc.1 → 1.3.2-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{email-form-component-f46b3bb0.mjs → email-form-component-b618db4a.mjs} +1 -1
- package/{email-form-component-fa5e2e0a.js → email-form-component-d156932f.js} +1 -1
- package/{free-text-component-624690b5.js → free-text-component-6da84bfa.js} +1 -1
- package/{free-text-component-cc720ae9.mjs → free-text-component-a4724ece.mjs} +1 -1
- package/{index-d7e40097.js → index-3c56a15f.js} +3 -3
- package/{index-830b6315.mjs → index-4b2ec2f4.mjs} +64 -64
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/package.json +6 -6
|
@@ -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-
|
|
6
|
+
import { F as p } from "./index-4b2ec2f4.mjs";
|
|
7
7
|
import "react";
|
|
8
8
|
import "@telia-ace/widget-forms";
|
|
9
9
|
import "@telia-ace/knowledge-widget-core";
|
|
@@ -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-
|
|
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-3c56a15f.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`
|
|
@@ -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-
|
|
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-3c56a15f.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-
|
|
5
|
+
import { D as a } from "./index-4b2ec2f4.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 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),n);const C=require("@telia-ace/widget-forms"),I=require("@telia-ace/knowledge-widget-core"),
|
|
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),n);const C=require("@telia-ace/widget-forms"),I=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"),S=(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();return e.guideId=e.body.guideId||s.guideId,r.customRequest(`contactmethods/${e.id}${n?"/validatedwithpayload":""}`,"POST",{body:o,configuration:{guideId:e.body.guideId||s.guideId}})}),A=(t,e,n)=>S(t,e).then(i=>n?n(i):i).then(({ConfirmationText:i})=>i),y=(t,e)=>S(t,e,!0).then(n=>({valid:n.Validation.IsValid,errors:n.Validation.Errors,errorTypes:n.Validation.ErrorTypes})),j=(t,e)=>S(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-d156932f.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-6da84bfa.js"))})})}function z(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"custom.link",render:Promise.resolve().then(()=>require("./link-component-6fbdc8fb.js"))})})}function H(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"phone.text",render:Promise.resolve().then(()=>require("./phone-component-ebf50e0d.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 I.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||I.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
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
|
-
`,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:
|
|
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:J,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:J,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(O,{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`
|
|
18
18
|
display: flex;
|
|
19
19
|
padding: ${(e=t.theme.sizes)==null?void 0:e.large};
|
|
20
20
|
${t.description?"":"align-items: center;"}
|
|
@@ -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:
|
|
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},K=(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=K(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}):K(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 G(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 I.Plugin{constructor(e,n){super(e,n),this.widget.implementation.configure(o=>{o.plugin(F).plugin(M).plugin(V).plugin(H).plugin(G).plugin(z)})}}exports.ContactList=ie;exports.ContactMethod=U;exports.ContactMethodPlatform=x;exports.DefaultContactMethodsPlugin=ce;exports.Description=O;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=H;exports.submit=A;exports.useContactMethod=se;exports.validate=y;exports.webServicePlugin=G;
|
|
@@ -8,18 +8,18 @@ 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
9
|
import { css as C } from "@emotion/react";
|
|
10
10
|
import f from "@emotion/styled";
|
|
11
|
-
import { Paragraph as ne, headingElement as D, Html as oe, genericHtml as ie, borderTabStyle as L, linkTabStyle as re, StyledText as
|
|
11
|
+
import { Paragraph as ne, headingElement as D, Html as oe, genericHtml as ie, borderTabStyle as L, linkTabStyle 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:
|
|
16
|
-
return e.guideId = e.body.guideId ||
|
|
15
|
+
), { router: c, matchingClient: r } = i, { params: a } = c.getRouteData();
|
|
16
|
+
return e.guideId = e.body.guideId || a.guideId, r.customRequest(
|
|
17
17
|
`contactmethods/${e.id}${n ? "/validatedwithpayload" : ""}`,
|
|
18
18
|
"POST",
|
|
19
19
|
{
|
|
20
20
|
body: o,
|
|
21
21
|
configuration: {
|
|
22
|
-
guideId: e.body.guideId ||
|
|
22
|
+
guideId: e.body.guideId || a.guideId
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
);
|
|
@@ -43,7 +43,7 @@ function pe(t) {
|
|
|
43
43
|
t.getAsync("contactMethods").then((e) => {
|
|
44
44
|
e.create({
|
|
45
45
|
clientName: "email.form",
|
|
46
|
-
render: import("./email-form-component-
|
|
46
|
+
render: import("./email-form-component-b618db4a.mjs"),
|
|
47
47
|
onEvaluate: (n) => M(t, n),
|
|
48
48
|
onValidate: (n) => y(t, n),
|
|
49
49
|
onSubmit: (n) => F(t, n),
|
|
@@ -52,11 +52,11 @@ function pe(t) {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
const T = (t, e, n) => {
|
|
55
|
-
const { url: i, width: o, height: c } = e, r = n || {},
|
|
56
|
-
return
|
|
57
|
-
const [d, l] =
|
|
55
|
+
const { url: i, width: o, height: c } = e, r = n || {}, a = document.createElement("a");
|
|
56
|
+
return a.href = i, a.search.replace("?", "").split("&").forEach((s) => {
|
|
57
|
+
const [d, l] = s.split("=");
|
|
58
58
|
typeof l < "u" && (r[d] = l);
|
|
59
|
-
}),
|
|
59
|
+
}), a.search = Object.keys(r).map((s) => `${s}=${r[s]}`).join("&"), window.open(a.href, t, `width=${o},height=${c}`), "";
|
|
60
60
|
};
|
|
61
61
|
function fe(t) {
|
|
62
62
|
t.getAsync("contactMethods").then((e) => {
|
|
@@ -64,17 +64,17 @@ function fe(t) {
|
|
|
64
64
|
clientName: "chat.popup",
|
|
65
65
|
render: "email.form",
|
|
66
66
|
handleClick: (n) => {
|
|
67
|
-
const { title: i, body: o } = n, { form: c, guideId: r, confirmationFallback:
|
|
67
|
+
const { title: i, body: o } = n, { form: c, guideId: r, confirmationFallback: a, ...s } = o;
|
|
68
68
|
return c ? () => {
|
|
69
69
|
} : (d) => {
|
|
70
|
-
d.preventDefault(), T(i,
|
|
70
|
+
d.preventDefault(), T(i, s);
|
|
71
71
|
};
|
|
72
72
|
},
|
|
73
73
|
onValidate: (n) => y(t, n),
|
|
74
74
|
onComplete: (n) => b(t, n),
|
|
75
75
|
onSubmit: (n) => {
|
|
76
|
-
const { title: i, body: o } = n, { form: c, guideId: r, confirmationFallback:
|
|
77
|
-
return T(i,
|
|
76
|
+
const { title: i, body: o } = n, { form: c, guideId: r, confirmationFallback: a, ...s } = o, d = new w(c).export().values;
|
|
77
|
+
return T(i, s, d), a;
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
80
|
});
|
|
@@ -83,7 +83,7 @@ function ge(t) {
|
|
|
83
83
|
t.getAsync("contactMethods").then((e) => {
|
|
84
84
|
e.create({
|
|
85
85
|
clientName: "custom.freetext",
|
|
86
|
-
render: import("./free-text-component-
|
|
86
|
+
render: import("./free-text-component-a4724ece.mjs")
|
|
87
87
|
});
|
|
88
88
|
});
|
|
89
89
|
}
|
|
@@ -107,8 +107,8 @@ const ve = async (t, e) => {
|
|
|
107
107
|
const n = t.get(e.clientName);
|
|
108
108
|
let { description: i, disabled: o, onClick: c } = e;
|
|
109
109
|
if (n) {
|
|
110
|
-
const { handleClick: r, handleDescription:
|
|
111
|
-
typeof r == "function" && (c = await Promise.resolve(r(e))), typeof
|
|
110
|
+
const { handleClick: r, handleDescription: a, handleDisabled: s } = n;
|
|
111
|
+
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)));
|
|
112
112
|
}
|
|
113
113
|
return Promise.resolve({
|
|
114
114
|
...e,
|
|
@@ -124,11 +124,11 @@ class k {
|
|
|
124
124
|
if (this.container = e, this.componentPlatform = n, n) {
|
|
125
125
|
n.components().ofType("contact-list").select().actions.watch(
|
|
126
126
|
"contact-list.fetched",
|
|
127
|
-
async (r,
|
|
128
|
-
const { contactMethods:
|
|
129
|
-
if (
|
|
127
|
+
async (r, a) => {
|
|
128
|
+
const { contactMethods: s } = r;
|
|
129
|
+
if (s) {
|
|
130
130
|
const d = Promise.all(
|
|
131
|
-
|
|
131
|
+
s.map(
|
|
132
132
|
(l) => this.handleAdapters(l)
|
|
133
133
|
)
|
|
134
134
|
);
|
|
@@ -136,15 +136,15 @@ class k {
|
|
|
136
136
|
r.contactMethods = l;
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
|
-
return
|
|
139
|
+
return a(r);
|
|
140
140
|
}
|
|
141
141
|
);
|
|
142
142
|
const o = n.components().ofType("guide").select();
|
|
143
|
-
o.actions.watch("guide.fetched", async (r,
|
|
144
|
-
const { contactMethods:
|
|
145
|
-
if (
|
|
143
|
+
o.actions.watch("guide.fetched", async (r, a) => {
|
|
144
|
+
const { contactMethods: s } = r;
|
|
145
|
+
if (s) {
|
|
146
146
|
const d = Promise.all(
|
|
147
|
-
|
|
147
|
+
s.map(
|
|
148
148
|
(l) => this.handleAdapters(l)
|
|
149
149
|
)
|
|
150
150
|
);
|
|
@@ -152,12 +152,12 @@ class k {
|
|
|
152
152
|
r.contactMethods = l;
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
|
-
return
|
|
156
|
-
}), o.actions.watch("guide.handover", async (r,
|
|
157
|
-
const { handoverContactMethods:
|
|
158
|
-
if (
|
|
155
|
+
return a(r);
|
|
156
|
+
}), o.actions.watch("guide.handover", async (r, a) => {
|
|
157
|
+
const { handoverContactMethods: s } = r;
|
|
158
|
+
if (s) {
|
|
159
159
|
const d = Promise.all(
|
|
160
|
-
|
|
160
|
+
s.map(
|
|
161
161
|
(l) => this.handleAdapters(l)
|
|
162
162
|
)
|
|
163
163
|
);
|
|
@@ -165,12 +165,12 @@ class k {
|
|
|
165
165
|
r.handoverContactMethods = l;
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
|
-
return
|
|
168
|
+
return a(r);
|
|
169
169
|
}), n.components().ofType("contact-method").select().actions.watch(
|
|
170
170
|
"contact-method.fetched",
|
|
171
|
-
async (r,
|
|
172
|
-
const { contactMethod:
|
|
173
|
-
return
|
|
171
|
+
async (r, a) => {
|
|
172
|
+
const { contactMethod: s } = r;
|
|
173
|
+
return s ? this.handleAdapters(s).then((d) => a({ ...r, contactMethod: d })) : a(r);
|
|
174
174
|
}
|
|
175
175
|
);
|
|
176
176
|
}
|
|
@@ -207,9 +207,9 @@ class k {
|
|
|
207
207
|
"contact-method-complete"
|
|
208
208
|
/* ContactMethodComplete */
|
|
209
209
|
);
|
|
210
|
-
const
|
|
211
|
-
if (
|
|
212
|
-
return
|
|
210
|
+
const a = this.adapters.get(o);
|
|
211
|
+
if (a && a.onComplete)
|
|
212
|
+
return a.onComplete(e);
|
|
213
213
|
}
|
|
214
214
|
evaluate(e) {
|
|
215
215
|
const { clientName: n } = e, i = this.adapters.get(n);
|
|
@@ -227,8 +227,8 @@ class k {
|
|
|
227
227
|
"contact-method-validate"
|
|
228
228
|
/* ContactMethodValidate */
|
|
229
229
|
);
|
|
230
|
-
const { events:
|
|
231
|
-
return
|
|
230
|
+
const { events: a } = this.container.get("$widget");
|
|
231
|
+
return a.dispatch("form:validated", { isValid: r.valid }), r;
|
|
232
232
|
}
|
|
233
233
|
) : Promise.resolve({ valid: !0 });
|
|
234
234
|
}
|
|
@@ -295,8 +295,8 @@ const Ce = f(oe)`
|
|
|
295
295
|
}
|
|
296
296
|
) : null;
|
|
297
297
|
const c = (r = {}) => {
|
|
298
|
-
const
|
|
299
|
-
id:
|
|
298
|
+
const a = { ...t, ...r }, {
|
|
299
|
+
id: s,
|
|
300
300
|
title: d,
|
|
301
301
|
clientName: l,
|
|
302
302
|
symbol: p,
|
|
@@ -311,27 +311,27 @@ const Ce = f(oe)`
|
|
|
311
311
|
dispatch: N = () => {
|
|
312
312
|
},
|
|
313
313
|
expanded: I
|
|
314
|
-
} =
|
|
314
|
+
} = a, q = v ? {
|
|
315
315
|
onKeyDown: (h) => {
|
|
316
|
-
h.key && h.key === "Enter" && (g(h,
|
|
316
|
+
h.key && h.key === "Enter" && (g(h, a), h.defaultPrevented || !I && N("expand", s));
|
|
317
317
|
},
|
|
318
318
|
onClick: (h) => {
|
|
319
|
-
g(h,
|
|
319
|
+
g(h, a), h.defaultPrevented || !I && N("expand", s);
|
|
320
320
|
}
|
|
321
321
|
} : {
|
|
322
|
-
onClick: (h) => g(h,
|
|
322
|
+
onClick: (h) => g(h, a),
|
|
323
323
|
routeName: "contact-method",
|
|
324
324
|
params: Q({
|
|
325
325
|
contactCategory: n,
|
|
326
326
|
guideId: O,
|
|
327
327
|
guideCategory: i,
|
|
328
328
|
phrase: o,
|
|
329
|
-
contactMethod:
|
|
329
|
+
contactMethod: s,
|
|
330
330
|
uriName: X(d)
|
|
331
331
|
})
|
|
332
332
|
};
|
|
333
333
|
let A;
|
|
334
|
-
if (l === "phone.text") {
|
|
334
|
+
if (l === "phone.text" || l === "ace.phone" || l === "ace.callback") {
|
|
335
335
|
const h = document.createElement("div");
|
|
336
336
|
h.innerHTML = u, A = h.innerText;
|
|
337
337
|
}
|
|
@@ -339,7 +339,7 @@ const Ce = f(oe)`
|
|
|
339
339
|
we,
|
|
340
340
|
{
|
|
341
341
|
title: d,
|
|
342
|
-
"aria-label": l === "phone.text" ? `${d} ${A}` : d,
|
|
342
|
+
"aria-label": l === "phone.text" || l === "ace.phone" || l === "ace.callback" ? `${d} ${A}` : d,
|
|
343
343
|
className: j,
|
|
344
344
|
disabled: H,
|
|
345
345
|
description: u,
|
|
@@ -364,7 +364,7 @@ const Ce = f(oe)`
|
|
|
364
364
|
};
|
|
365
365
|
return t.expanded ? /* @__PURE__ */ m(_, { fallback: null, children: /* @__PURE__ */ m(e, { ...t, renderDefault: c }) }) : c();
|
|
366
366
|
}, ke = (t) => {
|
|
367
|
-
var e, n, i, o, c, r,
|
|
367
|
+
var e, n, i, o, c, r, a, s;
|
|
368
368
|
return C`
|
|
369
369
|
display: flex;
|
|
370
370
|
padding: ${(e = t.theme.sizes) == null ? void 0 : e.large};
|
|
@@ -379,18 +379,18 @@ const Ce = f(oe)`
|
|
|
379
379
|
margin: 0 ${(o = t.theme.sizes) == null ? void 0 : o.large} 0 0;
|
|
380
380
|
min-height: ${(c = t.theme.fonts) == null ? void 0 : c.large};
|
|
381
381
|
min-width: ${(r = t.theme.fonts) == null ? void 0 : r.large};
|
|
382
|
-
line-height: ${(
|
|
382
|
+
line-height: ${(a = t.theme.fonts) == null ? void 0 : a.large};
|
|
383
383
|
display: inline-block;
|
|
384
384
|
vertical-align: bottom;
|
|
385
|
-
color: ${(
|
|
385
|
+
color: ${(s = t.theme.colors) == null ? void 0 : s.text};
|
|
386
386
|
}
|
|
387
387
|
`;
|
|
388
|
-
}, V = f(
|
|
388
|
+
}, V = f(ae)`
|
|
389
389
|
line-height: ${(t) => {
|
|
390
390
|
var e;
|
|
391
391
|
return (e = t.theme.fonts) == null ? void 0 : e.large;
|
|
392
392
|
}};
|
|
393
|
-
`, we = f(
|
|
393
|
+
`, we = f(se)`
|
|
394
394
|
${(t) => ke(t)}
|
|
395
395
|
|
|
396
396
|
&:focus-visible {
|
|
@@ -467,13 +467,13 @@ const Ce = f(oe)`
|
|
|
467
467
|
itemRenderer: c,
|
|
468
468
|
action: r = () => {
|
|
469
469
|
},
|
|
470
|
-
header:
|
|
470
|
+
header: a = ""
|
|
471
471
|
}) => {
|
|
472
|
-
const
|
|
472
|
+
const s = R(), { events: d } = s.get("$widget");
|
|
473
473
|
return t.length ? /* @__PURE__ */ m(
|
|
474
474
|
Ne,
|
|
475
475
|
{
|
|
476
|
-
header:
|
|
476
|
+
header: a,
|
|
477
477
|
className: Y(o, "humany-contact-list"),
|
|
478
478
|
items: t,
|
|
479
479
|
renderItem: c ? (l) => /* @__PURE__ */ m(
|
|
@@ -528,19 +528,19 @@ const Ce = f(oe)`
|
|
|
528
528
|
autoFocus: r
|
|
529
529
|
}) => {
|
|
530
530
|
if (e && !c) {
|
|
531
|
-
const { schema:
|
|
531
|
+
const { schema: a, layout: s, data: d, meta: l } = e, p = o || i || (() => {
|
|
532
532
|
});
|
|
533
533
|
return /* @__PURE__ */ m(
|
|
534
534
|
U,
|
|
535
535
|
{
|
|
536
536
|
className: t,
|
|
537
|
-
schema:
|
|
538
|
-
layout:
|
|
537
|
+
schema: a,
|
|
538
|
+
layout: s,
|
|
539
539
|
data: d,
|
|
540
540
|
autoFocus: r,
|
|
541
541
|
onChange: (v, g) => {
|
|
542
|
-
const u = { schema:
|
|
543
|
-
v.toString() === "submit" ? p("submit", { id: n, form: u }) : z(
|
|
542
|
+
const u = { schema: a, layout: s, data: g, meta: l };
|
|
543
|
+
v.toString() === "submit" ? p("submit", { id: n, form: u }) : z(a, v).evaluate ? p("evaluate", { id: n, form: u }) : p("validate", { id: n, form: u });
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
546
|
);
|
|
@@ -580,7 +580,7 @@ const He = (t, e, n) => t.getAsync("contactMethods").then((i) => {
|
|
|
580
580
|
render: "email.form",
|
|
581
581
|
handleClick: () => (o, c) => {
|
|
582
582
|
const {
|
|
583
|
-
body: { form: r, guideId:
|
|
583
|
+
body: { form: r, guideId: a, confirmationFallback: s, ...d }
|
|
584
584
|
} = c;
|
|
585
585
|
r || (o.preventDefault(), n(d));
|
|
586
586
|
},
|
|
@@ -588,9 +588,9 @@ const He = (t, e, n) => t.getAsync("contactMethods").then((i) => {
|
|
|
588
588
|
onComplete: (o) => b(t, o),
|
|
589
589
|
onSubmit: (o) => {
|
|
590
590
|
const {
|
|
591
|
-
body: { form: c, guideId: r, confirmationFallback:
|
|
591
|
+
body: { form: c, guideId: r, confirmationFallback: a, ...s }
|
|
592
592
|
} = o, { values: d } = new w(c).export();
|
|
593
|
-
return Promise.resolve(n(
|
|
593
|
+
return Promise.resolve(n(s, d)).then((l) => l || a);
|
|
594
594
|
}
|
|
595
595
|
});
|
|
596
596
|
});
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-3c56a15f.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-
|
|
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-4b2ec2f4.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.3.2-rc.
|
|
3
|
+
"version": "1.3.2-rc.3",
|
|
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.3.2-rc.
|
|
15
|
-
"@telia-ace/knowledge-widget-ui": "^1.3.2-rc.
|
|
16
|
-
"@telia-ace/widget-forms": "^1.3.2-rc.
|
|
17
|
-
"@telia-ace/widget-routing": "^1.3.2-rc.
|
|
18
|
-
"@telia-ace/widget-utilities": "^1.3.2-rc.
|
|
14
|
+
"@telia-ace/knowledge-widget-core": "^1.3.2-rc.3",
|
|
15
|
+
"@telia-ace/knowledge-widget-ui": "^1.3.2-rc.3",
|
|
16
|
+
"@telia-ace/widget-forms": "^1.3.2-rc.3",
|
|
17
|
+
"@telia-ace/widget-routing": "^1.3.2-rc.3",
|
|
18
|
+
"@telia-ace/widget-utilities": "^1.3.2-rc.3",
|
|
19
19
|
"@webprovisions/platform": "^1.1.4"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|