@telia-ace/knowledge-widget-adapters 1.1.8 → 1.2.0-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.
- package/{email-form-component-ea52694a.js → email-form-component-bb0863b7.js} +1 -1
- package/{email-form-component-92d01580.mjs → email-form-component-c4f2dd9c.mjs} +1 -1
- package/{free-text-component-c7208b8d.js → free-text-component-c14c86de.js} +1 -1
- package/{free-text-component-89364f48.mjs → free-text-component-d819debd.mjs} +1 -1
- package/{index-9359a2fb.js → index-5ef7548a.js} +3 -3
- package/{index-2fbbe95d.mjs → index-738dad5e.mjs} +44 -42
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/package.json +6 -6
|
@@ -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-5ef7548a.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-
|
|
6
|
+
import { F as p } from "./index-738dad5e.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-
|
|
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-5ef7548a.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-738dad5e.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"),
|
|
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"),I=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"),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 q(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"email.form",render:Promise.resolve().then(()=>require("./email-form-component-bb0863b7.js")),onEvaluate:n=>j(t,n),onValidate:n=>y(t,n),onSubmit:n=>A(t,n),onComplete:n=>b(t,n)})})}const M=(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 D(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(),M(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 M(i,a,d),s}})})}function F(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"custom.freetext",render:Promise.resolve().then(()=>require("./free-text-component-c14c86de.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: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 _(this.adapters,e)}static getInstance(e,n="contactMethods"){return $.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,k.lazy(()=>i)))})}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:i,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=(r={})=>{const s={...t,...r},{id:a,title:d,clientName:l,symbol:f,inline:P,onClick:
|
|
17
|
+
`,H=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(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=(r={})=>{const s={...t,...r},{id:a,title:d,clientName:l,symbol:f,inline:P,onClick:v=()=>{},description:g,htmlParseInstruction:R,className:G,disabled:J,guideId:Q,dispatch:E=()=>{},expanded:L}=s,X=P?{onKeyDown:h=>{h.key&&h.key==="Enter"&&(v(h,s),h.defaultPrevented||!L&&E("expand",a))},onClick:h=>{v(h,s),h.defaultPrevented||!L&&E("expand",a)}}:{onClick:h=>v(h,s),routeName:"contact-method",params:$.createParams({contactCategory:n,guideId:Q,guideCategory:i,phrase:o,contactMethod:a,uriName:$.formatUrl(d)})};return u.jsxs(ee,{title:d,"aria-label":d,className:G,disabled:J,description:g,"data-client-name":l,...r,...X,children:[f&&u.jsx(m.SymbolBadge,{symbol:f}),g?u.jsxs("div",{className:"humany-contact-link-rich-content",children:[u.jsx(T,{children:d}),u.jsx(O,{html:g,htmlParseInstruction:R})]}):u.jsx(T,{children:d})]})};return t.expanded?u.jsx(k.Suspense,{fallback:null,children:u.jsx(e,{...t,renderDefault:c})}):c()},U=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
|
`},ne=p(m.ItemList)`
|
|
96
96
|
${t=>W(t)}
|
|
97
|
-
`,oe=({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(ne,{header:s,className:$.appendClassNames(o,"humany-contact-list"),items:t,renderItem:c?l=>u.jsx("li",{role:t.length===1?"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?"none":void 0,"data-contact-method":l.id,onClick:()=>{d.dispatch("tracking:contact-list-item-clicked",l)},children:u.jsx(H,{...l,action:r,dispatch:i,guideId:n})},l.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 i;for(let o=0;o<n.length;o++)if(i=B(t.properties[n[o]],e),i)return i;return!1},ie=({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,f=o||i||(()=>{});return u.jsx(C.FormComponent,{className:t,schema:s,layout:a,data:d,autoFocus:r,onChange:(P,
|
|
97
|
+
`,oe=({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(ne,{header:s,className:$.appendClassNames(o,"humany-contact-list"),items:t,renderItem:c?l=>u.jsx("li",{role:t.length===1?"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?"none":void 0,"data-contact-method":l.id,onClick:()=>{d.dispatch("tracking:contact-list-item-clicked",l)},children:u.jsx(H,{...l,action:r,dispatch:i,guideId:n})},l.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 i;for(let o=0;o<n.length;o++)if(i=B(t.properties[n[o]],e),i)return i;return!1},ie=({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,f=o||i||(()=>{});return u.jsx(C.FormComponent,{className:t,schema:s,layout:a,data:d,autoFocus:r,onChange:(P,v)=>{const g={schema:s,layout:a,data:v,meta:l};P.toString()==="submit"?f("submit",{id:n,form:g}):B(s,P).evaluate?f("evaluate",{id:n,form:g}):f("validate",{id:n,form:g})}})}return null},re=t=>{const[e,n]=k.useState(null),i=m.useContainer();return k.useEffect(()=>{let o;return i.getAsync("componentResolver").then(c=>{o=c.registerResolver(t,r=>n(r))}),()=>{o&&o()}},[t]),e};function K(t){t.getAsync("contactMethods").then(e=>{e.create({clientName:"custom.webservice",render:"email.form",onValidate:n=>y(t,n),onComplete:n=>b(t,n),onSubmit:n=>A(t,n,i=>({...i,ConfirmationText:i.ResponseHtml}))})})}const se=(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 ae extends I.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=ie;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=A;exports.useContactMethod=re;exports.validate=y;exports.webServicePlugin=K;
|
|
@@ -2,18 +2,18 @@ var q = Object.defineProperty;
|
|
|
2
2
|
var B = (t, e, n) => e in t ? q(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
3
|
var $ = (t, e, n) => (B(t, typeof e != "symbol" ? e + "" : e, n), n);
|
|
4
4
|
import { FormBuilder as K, FormReader as w, FormComponent as G } from "@telia-ace/widget-forms";
|
|
5
|
-
import { ComponentPlatform as
|
|
5
|
+
import { ComponentPlatform as A, Plugin as U } from "@telia-ace/knowledge-widget-core";
|
|
6
6
|
import { lock as W, createParams as J, formatUrl as Q, appendClassNames as X } from "@telia-ace/widget-utilities";
|
|
7
7
|
import { lazy as Y, Suspense as Z, useState as _, useEffect as ee } from "react";
|
|
8
|
-
import { jsx as m, jsxs as
|
|
8
|
+
import { jsx as m, jsxs as S } from "react/jsx-runtime";
|
|
9
9
|
import { css as C } from "@emotion/react";
|
|
10
10
|
import f from "@emotion/styled";
|
|
11
|
-
import { Paragraph as te, headingElement as
|
|
11
|
+
import { Paragraph as te, headingElement as D, Html as ne, genericHtml as oe, borderTabStyle as R, linkTabStyle as ie, StyledText as re, Link as se, useComponent as ae, useRouteData as ce, Typography as le, SymbolBadge as de, ItemList as me, itemList as he, useContainer as T } 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
15
|
), { router: c, matchingClient: r } = i, { params: s } = c.getRouteData();
|
|
16
|
-
return r.customRequest(
|
|
16
|
+
return e.guideId = e.body.guideId || s.guideId, r.customRequest(
|
|
17
17
|
`contactmethods/${e.id}${n ? "/validatedwithpayload" : ""}`,
|
|
18
18
|
"POST",
|
|
19
19
|
{
|
|
@@ -23,28 +23,30 @@ const P = (t, e, n = !1) => t.getManyAsync("matchingClient", "router").then((i)
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
);
|
|
26
|
-
}),
|
|
26
|
+
}), L = (t, e, n) => P(t, e).then((i) => n ? n(i) : i).then(({ ConfirmationText: i }) => i), y = (t, e) => P(t, e, !0).then(
|
|
27
27
|
(n) => ({
|
|
28
28
|
valid: n.Validation.IsValid,
|
|
29
29
|
errors: n.Validation.Errors,
|
|
30
30
|
errorTypes: n.Validation.ErrorTypes
|
|
31
31
|
})
|
|
32
|
-
),
|
|
32
|
+
), F = (t, e) => P(t, e, !0).then(
|
|
33
33
|
(n) => K.fromLegacyForm(
|
|
34
34
|
e.id,
|
|
35
35
|
n.ContactMethod.Form
|
|
36
36
|
).get()
|
|
37
37
|
), b = (t, e) => t.getAsync("matchingClient").then((n) => {
|
|
38
|
-
n.completeContactMethod(e.id
|
|
38
|
+
n.completeContactMethod(e.id, {
|
|
39
|
+
guideId: e.guideId
|
|
40
|
+
});
|
|
39
41
|
});
|
|
40
42
|
function ue(t) {
|
|
41
43
|
t.getAsync("contactMethods").then((e) => {
|
|
42
44
|
e.create({
|
|
43
45
|
clientName: "email.form",
|
|
44
|
-
render: import("./email-form-component-
|
|
45
|
-
onEvaluate: (n) =>
|
|
46
|
+
render: import("./email-form-component-c4f2dd9c.mjs"),
|
|
47
|
+
onEvaluate: (n) => F(t, n),
|
|
46
48
|
onValidate: (n) => y(t, n),
|
|
47
|
-
onSubmit: (n) =>
|
|
49
|
+
onSubmit: (n) => L(t, n),
|
|
48
50
|
onComplete: (n) => b(t, n)
|
|
49
51
|
});
|
|
50
52
|
});
|
|
@@ -81,7 +83,7 @@ function fe(t) {
|
|
|
81
83
|
t.getAsync("contactMethods").then((e) => {
|
|
82
84
|
e.create({
|
|
83
85
|
clientName: "custom.freetext",
|
|
84
|
-
render: import("./free-text-component-
|
|
86
|
+
render: import("./free-text-component-d819debd.mjs")
|
|
85
87
|
});
|
|
86
88
|
});
|
|
87
89
|
}
|
|
@@ -174,7 +176,7 @@ class k {
|
|
|
174
176
|
}
|
|
175
177
|
}
|
|
176
178
|
static create(e) {
|
|
177
|
-
return
|
|
179
|
+
return A.getInstance(e).then((n) => new k(e, n));
|
|
178
180
|
}
|
|
179
181
|
handleAdapters(e) {
|
|
180
182
|
return be(this.adapters, e);
|
|
@@ -182,7 +184,7 @@ class k {
|
|
|
182
184
|
static getInstance(e, n = "contactMethods") {
|
|
183
185
|
return W(e)(() => e.getAsync(n).then((i) => {
|
|
184
186
|
let o = i;
|
|
185
|
-
return o ||
|
|
187
|
+
return o || A.getInstance(e).then((c) => (o = new k(
|
|
186
188
|
e,
|
|
187
189
|
c
|
|
188
190
|
), e.registerAsync(n, () => o), o));
|
|
@@ -238,7 +240,7 @@ class k {
|
|
|
238
240
|
const { clientName: n, render: i } = e;
|
|
239
241
|
return this.adapters.set(n, {
|
|
240
242
|
onValidate: (o) => y(this.container, o),
|
|
241
|
-
onEvaluate: (o) =>
|
|
243
|
+
onEvaluate: (o) => F(this.container, o),
|
|
242
244
|
onComplete: (o) => b(this.container, o),
|
|
243
245
|
...e
|
|
244
246
|
}), this.container.getAsync("componentResolver").then((o) => {
|
|
@@ -257,7 +259,7 @@ class k {
|
|
|
257
259
|
f(te)`
|
|
258
260
|
${(t) => {
|
|
259
261
|
var e;
|
|
260
|
-
return
|
|
262
|
+
return D(t)(
|
|
261
263
|
"h1",
|
|
262
264
|
C`
|
|
263
265
|
font-weight: normal;
|
|
@@ -271,7 +273,7 @@ const ve = f(ne)`
|
|
|
271
273
|
font-weight: 300;
|
|
272
274
|
line-height: 1.5em;
|
|
273
275
|
button:focus-visible {
|
|
274
|
-
${
|
|
276
|
+
${R};
|
|
275
277
|
}
|
|
276
278
|
|
|
277
279
|
a:focus-visible {
|
|
@@ -306,15 +308,15 @@ const ve = f(ne)`
|
|
|
306
308
|
className: z,
|
|
307
309
|
disabled: j,
|
|
308
310
|
guideId: O,
|
|
309
|
-
dispatch:
|
|
311
|
+
dispatch: I = () => {
|
|
310
312
|
},
|
|
311
|
-
expanded:
|
|
313
|
+
expanded: x
|
|
312
314
|
} = s, H = v ? {
|
|
313
315
|
onKeyDown: (h) => {
|
|
314
|
-
h.key && h.key === "Enter" && (g(h, s), h.defaultPrevented || !
|
|
316
|
+
h.key && h.key === "Enter" && (g(h, s), h.defaultPrevented || !x && I("expand", a));
|
|
315
317
|
},
|
|
316
318
|
onClick: (h) => {
|
|
317
|
-
g(h, s), h.defaultPrevented || !
|
|
319
|
+
g(h, s), h.defaultPrevented || !x && I("expand", a);
|
|
318
320
|
}
|
|
319
321
|
} : {
|
|
320
322
|
onClick: (h) => g(h, s),
|
|
@@ -328,7 +330,7 @@ const ve = f(ne)`
|
|
|
328
330
|
uriName: Q(d)
|
|
329
331
|
})
|
|
330
332
|
};
|
|
331
|
-
return /* @__PURE__ */
|
|
333
|
+
return /* @__PURE__ */ S(
|
|
332
334
|
ke,
|
|
333
335
|
{
|
|
334
336
|
title: d,
|
|
@@ -341,8 +343,8 @@ const ve = f(ne)`
|
|
|
341
343
|
...H,
|
|
342
344
|
children: [
|
|
343
345
|
p && /* @__PURE__ */ m(de, { symbol: p }),
|
|
344
|
-
u ? /* @__PURE__ */
|
|
345
|
-
/* @__PURE__ */ m(
|
|
346
|
+
u ? /* @__PURE__ */ S("div", { className: "humany-contact-link-rich-content", children: [
|
|
347
|
+
/* @__PURE__ */ m(V, { children: d }),
|
|
346
348
|
/* @__PURE__ */ m(
|
|
347
349
|
ve,
|
|
348
350
|
{
|
|
@@ -350,7 +352,7 @@ const ve = f(ne)`
|
|
|
350
352
|
htmlParseInstruction: N
|
|
351
353
|
}
|
|
352
354
|
)
|
|
353
|
-
] }) : /* @__PURE__ */ m(
|
|
355
|
+
] }) : /* @__PURE__ */ m(V, { children: d })
|
|
354
356
|
]
|
|
355
357
|
}
|
|
356
358
|
);
|
|
@@ -378,7 +380,7 @@ const ve = f(ne)`
|
|
|
378
380
|
color: ${(a = t.theme.colors) == null ? void 0 : a.text};
|
|
379
381
|
}
|
|
380
382
|
`;
|
|
381
|
-
},
|
|
383
|
+
}, V = f(re)`
|
|
382
384
|
line-height: ${(t) => {
|
|
383
385
|
var e;
|
|
384
386
|
return (e = t.theme.fonts) == null ? void 0 : e.large;
|
|
@@ -387,7 +389,7 @@ const ve = f(ne)`
|
|
|
387
389
|
${(t) => $e(t)}
|
|
388
390
|
|
|
389
391
|
&:focus-visible {
|
|
390
|
-
${
|
|
392
|
+
${R};
|
|
391
393
|
}
|
|
392
394
|
`, we = f.div`
|
|
393
395
|
text-align: center;
|
|
@@ -404,7 +406,7 @@ const ve = f(ne)`
|
|
|
404
406
|
> div {
|
|
405
407
|
padding: ${(e = t.theme.sizes) == null ? void 0 : e.large};
|
|
406
408
|
|
|
407
|
-
${
|
|
409
|
+
${D(t)(
|
|
408
410
|
"h1",
|
|
409
411
|
C`
|
|
410
412
|
margin: 0;
|
|
@@ -451,7 +453,7 @@ const ve = f(ne)`
|
|
|
451
453
|
`;
|
|
452
454
|
}, Ne = f(me)`
|
|
453
455
|
${(t) => Pe(t)}
|
|
454
|
-
`,
|
|
456
|
+
`, Fe = ({
|
|
455
457
|
contactMethods: t,
|
|
456
458
|
children: e,
|
|
457
459
|
guideId: n,
|
|
@@ -462,7 +464,7 @@ const ve = f(ne)`
|
|
|
462
464
|
},
|
|
463
465
|
header: s = ""
|
|
464
466
|
}) => {
|
|
465
|
-
const a =
|
|
467
|
+
const a = T(), { events: d } = a.get("$widget");
|
|
466
468
|
return t.length ? /* @__PURE__ */ m(
|
|
467
469
|
Ne,
|
|
468
470
|
{
|
|
@@ -500,7 +502,7 @@ const ve = f(ne)`
|
|
|
500
502
|
children: e
|
|
501
503
|
}
|
|
502
504
|
) : null;
|
|
503
|
-
},
|
|
505
|
+
}, M = (t, e) => {
|
|
504
506
|
if (t.actionKey === e)
|
|
505
507
|
return t;
|
|
506
508
|
if (!t.properties)
|
|
@@ -508,10 +510,10 @@ const ve = f(ne)`
|
|
|
508
510
|
const n = Object.keys(t.properties);
|
|
509
511
|
let i;
|
|
510
512
|
for (let o = 0; o < n.length; o++)
|
|
511
|
-
if (i =
|
|
513
|
+
if (i = M(t.properties[n[o]], e), i)
|
|
512
514
|
return i;
|
|
513
515
|
return !1;
|
|
514
|
-
},
|
|
516
|
+
}, Me = ({
|
|
515
517
|
className: t,
|
|
516
518
|
body: { form: e },
|
|
517
519
|
id: n,
|
|
@@ -533,14 +535,14 @@ const ve = f(ne)`
|
|
|
533
535
|
autoFocus: r,
|
|
534
536
|
onChange: (v, g) => {
|
|
535
537
|
const u = { schema: s, layout: a, data: g, meta: l };
|
|
536
|
-
v.toString() === "submit" ? p("submit", { id: n, form: u }) :
|
|
538
|
+
v.toString() === "submit" ? p("submit", { id: n, form: u }) : M(s, v).evaluate ? p("evaluate", { id: n, form: u }) : p("validate", { id: n, form: u });
|
|
537
539
|
}
|
|
538
540
|
}
|
|
539
541
|
);
|
|
540
542
|
}
|
|
541
543
|
return null;
|
|
542
544
|
}, ze = (t) => {
|
|
543
|
-
const [e, n] = _(null), i =
|
|
545
|
+
const [e, n] = _(null), i = T();
|
|
544
546
|
return ee(() => {
|
|
545
547
|
let o;
|
|
546
548
|
return i.getAsync("componentResolver").then((c) => {
|
|
@@ -553,14 +555,14 @@ const ve = f(ne)`
|
|
|
553
555
|
};
|
|
554
556
|
}, [t]), e;
|
|
555
557
|
};
|
|
556
|
-
function
|
|
558
|
+
function Ie(t) {
|
|
557
559
|
t.getAsync("contactMethods").then((e) => {
|
|
558
560
|
e.create({
|
|
559
561
|
clientName: "custom.webservice",
|
|
560
562
|
render: "email.form",
|
|
561
563
|
onValidate: (n) => y(t, n),
|
|
562
564
|
onComplete: (n) => b(t, n),
|
|
563
|
-
onSubmit: (n) =>
|
|
565
|
+
onSubmit: (n) => L(t, n, (i) => ({
|
|
564
566
|
...i,
|
|
565
567
|
ConfirmationText: i.ResponseHtml
|
|
566
568
|
}))
|
|
@@ -590,29 +592,29 @@ const je = (t, e, n) => t.getAsync("contactMethods").then((i) => {
|
|
|
590
592
|
class Oe extends U {
|
|
591
593
|
constructor(e, n) {
|
|
592
594
|
super(e, n), this.widget.implementation.configure((o) => {
|
|
593
|
-
o.plugin(ue).plugin(pe).plugin(fe).plugin(ye).plugin(
|
|
595
|
+
o.plugin(ue).plugin(pe).plugin(fe).plugin(ye).plugin(Ie).plugin(ge);
|
|
594
596
|
});
|
|
595
597
|
}
|
|
596
598
|
}
|
|
597
599
|
export {
|
|
598
|
-
|
|
600
|
+
Fe as C,
|
|
599
601
|
ve as D,
|
|
600
|
-
|
|
602
|
+
Me as F,
|
|
601
603
|
Pe as a,
|
|
602
604
|
$e as b,
|
|
603
605
|
pe as c,
|
|
604
606
|
Ce as d,
|
|
605
607
|
k as e,
|
|
606
608
|
b as f,
|
|
607
|
-
|
|
609
|
+
F as g,
|
|
608
610
|
ue as h,
|
|
609
611
|
fe as i,
|
|
610
612
|
je as j,
|
|
611
613
|
Oe as k,
|
|
612
614
|
ge as l,
|
|
613
615
|
ye as p,
|
|
614
|
-
|
|
616
|
+
L as s,
|
|
615
617
|
ze as u,
|
|
616
618
|
y as v,
|
|
617
|
-
|
|
619
|
+
Ie as w
|
|
618
620
|
};
|
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-5ef7548a.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-738dad5e.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
|
|
3
|
+
"version": "1.2.0-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
|
|
15
|
-
"@telia-ace/knowledge-widget-ui": "^1.1
|
|
16
|
-
"@telia-ace/widget-forms": "^1.1
|
|
17
|
-
"@telia-ace/widget-routing": "^1.1
|
|
18
|
-
"@telia-ace/widget-utilities": "^1.1
|
|
14
|
+
"@telia-ace/knowledge-widget-core": "^1.2.0-rc.1",
|
|
15
|
+
"@telia-ace/knowledge-widget-ui": "^1.2.0-rc.1",
|
|
16
|
+
"@telia-ace/widget-forms": "^1.2.0-rc.1",
|
|
17
|
+
"@telia-ace/widget-routing": "^1.2.0-rc.1",
|
|
18
|
+
"@telia-ace/widget-utilities": "^1.2.0-rc.1",
|
|
19
19
|
"@webprovisions/platform": "^1.1.4"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|