@telia-ace/conversational-hub-bot-provider 0.0.10 → 0.0.12
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/{contact-method-fdaa9cb6.mjs → contact-method-77354cf2.mjs} +1 -1
- package/{contact-method-4bdb3910.js → contact-method-e5c435a7.js} +1 -1
- package/{index-4baf1700.mjs → index-ad9aa727.mjs} +28 -26
- package/{index-d19a1921.js → index-b42c4c70.js} +16 -16
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/package.json +6 -4
|
@@ -2,7 +2,7 @@ var it = Object.defineProperty;
|
|
|
2
2
|
var nt = (t, e, o) => e in t ? it(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
|
|
3
3
|
var _ = (t, e, o) => (nt(t, typeof e != "symbol" ? e + "" : e, o), o);
|
|
4
4
|
import { jsx as u, jsxs as z, Fragment as st } from "react/jsx-runtime";
|
|
5
|
-
import { C as rt, u as re, a as Ee, b as at, c as ct, d as lt, e as dt, f as mt, g as G, F as ue, W as ge, l as ft, h as ht, L as Oe, I as ne, n as p, i as $e, j as Le, k as qe, m as Z, o as J, p as X, q as $, T as je, B as we, r as ke, s as ut, S as j, t as se, v as Fe, w as ye, x as gt, y as V, z as Be, P as De, A as Ge, H as yt, D as pt, E as bt, G as Ne } from "./index-
|
|
5
|
+
import { C as rt, u as re, a as Ee, b as at, c as ct, d as lt, e as dt, f as mt, g as G, F as ue, W as ge, l as ft, h as ht, L as Oe, I as ne, n as p, i as $e, j as Le, k as qe, m as Z, o as J, p as X, q as $, T as je, B as we, r as ke, s as ut, S as j, t as se, v as Fe, w as ye, x as gt, y as V, z as Be, P as De, A as Ge, H as yt, D as pt, E as bt, G as Ne } from "./index-ad9aa727.mjs";
|
|
6
6
|
import { useContext as Pe, useState as D, useEffect as q, forwardRef as ae, useCallback as H, useMemo as vt, useRef as He, useImperativeHandle as $t, Suspense as wt } from "react";
|
|
7
7
|
import "react-dom";
|
|
8
8
|
function W(t = {}) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var ke=Object.defineProperty;var Ne=(t,e,o)=>e in t?ke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var P=(t,e,o)=>(Ne(t,typeof e!="symbol"?e+"":e,o),o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),n=require("./index-d19a1921.js"),b=require("react");require("react-dom");function H(t={}){const{phrase:e="",category:o,guideCategory:s,contactCategory:i,take:r,connectionKey:c,accordion:a,id:l,uriName:d,sorting:g,tag:f,tagId:y,tagTitle:v,...p}=t,m={};return Object.keys(p).forEach(h=>{typeof t[h]=="string"&&(m[h]=t[h])}),typeof e=="string"&&e.length&&(m.phrase=e),e===null&&(m.phrase=e),typeof s=="string"&&s!=="0"&&(m.guideCategory=s),typeof s=="number"&&s!==0&&(m.guideCategory=s),typeof s=="object"&&s!==null&&(typeof s.id=="string"&&s.id!=="0"&&(m.guideCategory=s.id),typeof s.id=="number"&&s.id!==0&&(m.guideCategory=s.id)),typeof i=="string"&&i!=="0"&&(m.contactCategory=i),typeof i=="number"&&i!==0&&(m.contactCategory=i),typeof i=="object"&&i!==null&&(typeof i.id=="string"&&i.id!=="0"&&(m.contactCategory=i.id),typeof i.id=="number"&&i.id!==0&&(m.contactCategory=i.id)),typeof o=="string"&&o!=="0"&&(m.category=o),typeof o=="number"&&o!==0&&(m.category=o),typeof o=="object"&&o!==null&&(typeof o.id=="string"&&o.id!=="0"&&(m.category=o.id),typeof o.id=="number"&&o.id!==0&&(m.category=o.id)),l&&(m.id=l),d&&(+m.category||+m.guideCategory||+m.guide||+m.contactCategory||+m.contactMethod)&&(m.uriName=d),c&&(m.connectionKey=c),r&&(m.take=r),g&&(m.sorting=g),typeof a=="string"&&a.length>0&&(m.accordion=a),typeof f=="string"&&f!=="0"&&(m.tag=f),typeof f=="number"&&f!==0&&(m.tag=f),Array.isArray(f)&&f.length&&(m.tag=f),(typeof y=="string"||typeof y=="number")&&(m.tagId=y),typeof v=="string"&&(m.tagTitle=v),typeof m.tag=="string"&&(m.tag=m.tag.split(",")),m}const ee=t=>{if(!t)return"";const e=[{from:/[äæǽ]+/gi,to:"ae"},{from:/[öœ]+/gi,to:"oe"},{from:/[ü]+/gi,to:"ue"},{from:/[Ä]+/gi,to:"Ae"},{from:/[Ü]+/gi,to:"Ue"},{from:/[Ö]+/gi,to:"Oe"},{from:/[ÀÁÂÃÄÅǺĀĂĄǍΑΆẢẠẦẪẨẬẰẮẴẲẶА]+/gi,to:"A"},{from:/[àáâãåǻāăąǎªαάảạầấẫẩậằắẵẳặа]+/gi,to:"a"},{from:/[Б]+/gi,to:"B"},{from:/[б]+/gi,to:"b"},{from:/[ÇĆĈĊČ]+/gi,to:"C"},{from:/[çćĉċč]+/gi,to:"c"},{from:/[Д]+/gi,to:"D"},{from:/[д]+/gi,to:"d"},{from:/[ÐĎĐΔ]+/gi,to:"Dj"},{from:/[ðďđδ]+/gi,to:"dj"},{from:/[ÈÉÊËĒĔĖĘĚΕΈẼẺẸỀẾỄỂỆЕЭ]+/gi,to:"E"},{from:/[èéêëēĕėęěέεẽẻẹềếễểệеэ]+/gi,to:"e"},{from:/[Ф]+/gi,to:"F"},{from:/[ф]+/gi,to:"f"},{from:/[ĜĞĠĢΓГҐ]+/gi,to:"G"},{from:/[ĝğġģγгґ]+/gi,to:"g"},{from:/[ĤĦ]+/gi,to:"H"},{from:/[ĥħ]+/gi,to:"h"},{from:/[ÌÍÎÏĨĪĬǏĮİΗΉΊΙΪỈỊИЫ]+/gi,to:"I"},{from:/[ìíîïĩīĭǐįıηήίιϊỉịиыї]+/gi,to:"i"},{from:/[Ĵ]+/gi,to:"J"},{from:/[ĵ]+/gi,to:"j"},{from:/[ĶΚК]+/gi,to:"K"},{from:/[ķκк]+/gi,to:"k"},{from:/[ĹĻĽĿŁΛЛ]+/gi,to:"L"},{from:/[ĺļľŀłλл]+/gi,to:"l"},{from:/[М]+/gi,to:"M"},{from:/[м]+/gi,to:"m"},{from:/[ÑŃŅŇΝН]+/gi,to:"N"},{from:/[ñńņňʼnνн]+/gi,to:"n"},{from:/[ÒÓÔÕŌŎǑŐƠØǾΟΌΩΏỎỌỒỐỖỔỘỜỚỠỞỢО]+/gi,to:"O"},{from:/[òóôõōŏǒőơøǿºοόωώỏọồốỗổộờớỡởợо]+/gi,to:"o"},{from:/[П]+/gi,to:"P"},{from:/[п]+/gi,to:"p"},{from:/[ŔŖŘΡР]+/gi,to:"R"},{from:/[ŕŗřρр]+/gi,to:"r"},{from:/[ŚŜŞȘŠΣС]+/gi,to:"S"},{from:/[śŝşșšſσςс]+/gi,to:"s"},{from:/[ȚŢŤŦτТ]+/gi,to:"T"},{from:/[țţťŧт]+/gi,to:"t"},{from:/[ÙÚÛŨŪŬŮŰŲƯǓǕǗǙǛŨỦỤỪỨỮỬỰУ]+/gi,to:"U"},{from:/[ùúûũūŭůűųưǔǖǘǚǜυύϋủụừứữửựу]+/gi,to:"u"},{from:/[ÝŸŶΥΎΫỲỸỶỴЙ]+/gi,to:"Y"},{from:/[ýÿŷỳỹỷỵй]+/gi,to:"y"},{from:/[В]+/gi,to:"V"},{from:/[в]+/gi,to:"v"},{from:/[Ŵ]+/gi,to:"W"},{from:/[ŵ]+/gi,to:"w"},{from:/[ŹŻŽΖЗ]+/gi,to:"Z"},{from:/[źżžζз]+/gi,to:"z"},{from:/[ÆǼ]+/gi,to:"AE"},{from:/[ß]+/gi,to:"ss"},{from:/[IJ]+/gi,to:"IJ"},{from:/[ij]+/gi,to:"ij"},{from:/[Œ]+/gi,to:"OE"},{from:/[ƒ]+/gi,to:"f"},{from:/[ξ]+/gi,to:"ks"},{from:/[π]+/gi,to:"p"},{from:/[β]+/gi,to:"v"},{from:/[μ]+/gi,to:"m"},{from:/[ψ]+/gi,to:"ps"},{from:/[Ё]+/gi,to:"Yo"},{from:/[ё]+/gi,to:"yo"},{from:/[Є]+/gi,to:"Ye"},{from:/[є]+/gi,to:"ye"},{from:/[Ї]+/gi,to:"Yi"},{from:/[Ж]+/gi,to:"Zh"},{from:/[ж]+/gi,to:"zh"},{from:/[Х]+/gi,to:"Kh"},{from:/[х]+/gi,to:"kh"},{from:/[Ц]+/gi,to:"Ts"},{from:/[ц]+/gi,to:"ts"},{from:/[Ч]+/gi,to:"Ch"},{from:/[ч]+/gi,to:"ch"},{from:/[Ш]+/gi,to:"Sh"},{from:/[ш]+/gi,to:"sh"},{from:/[Щ]+/gi,to:"Shch"},{from:/[щ]+/gi,to:"shch"},{from:/[ЪъЬь]+/gi,to:""},{from:/[Ю]+/gi,to:"Yu"},{from:/[ю]+/gi,to:"yu"},{from:/[Я]+/gi,to:"Ya"},{from:/[я]+/gi,to:"ya"}],o=/[^a-zA-Z0-9]+/g,s=/[-]$/;let i=t;for(const r in e)e.hasOwnProperty(r)&&e[r].from.test(t)&&(i=i.replace(e[r].from,e[r].to));return i=i.replace(o,"-"),i=i.replace(s,""),i=i.toLowerCase(),i||"humany"},je=(t,e)=>{if(!t||!e)return!0;let o=e.parentNode,s=!1;for(;o!==null;)o===t&&(s=!0),o=o.parentNode;return s},te=(t={})=>(Object.keys(t).forEach(e=>{(t[e]===null||typeof t[e]>"u")&&delete t[e]}),t),_=(t,e)=>{let o=!0;return Object.keys(t).length!==Object.keys(e).length||Object.keys(t).some(i=>!Object.keys(e).some(c=>i===c))?!1:(Object.keys(t).forEach(i=>{if(o){const r=typeof t[i]>"u"?"":t[i],c=typeof e[i]>"u"?"":e[i];o=r.toString()===c.toString()}}),o)},fe=()=>b.useContext(n.ComponentNodeContext),Me=(t,e)=>{const o=fe(),s=n.useContainer(),[i,r]=b.useState(void 0),c=n.useIsMounted(),a=t||o.type||"";return b.useEffect(()=>{if(a){let l;return(e||s).getAsync("componentResolver").then(d=>{if(c.current){const g=d.getComponent(a);r(g)}l=d.registerResolver(a,g=>{c.current&&r(g)})}),()=>{l&&l()}}},[c,a,e,s]),i},ze=()=>b.useContext(n.ConversationContext),Te=()=>{const t=n.useComponentPlatform(),e=fe(),[o,s]=b.useState([]),[i,r]=b.useState();return b.useEffect(()=>{if(t&&e){const c=new n.ComponentQuery(t).withId(e.id),a=t.actions(c,e.type||n.uuid());r(a),o!==null&&(o.forEach(l=>{a.dispatch(l.key,l.data).then(d=>l.resolve(d)).catch(d=>l.reject(d))}),s(null))}},[t,e.id]),(c,a)=>o!==null?new Promise((l,d)=>{o.push({key:c,data:a,resolve:l,reject:d})}):i.dispatch(c,a)},Re=()=>{const[t,e]=b.useState(!1);return b.useEffect(()=>{const o=()=>{e(!1)},s=i=>{i.keyCode===9&&e(!0)};return window.addEventListener("keydown",s),window.addEventListener("click",o),()=>{window.removeEventListener("keydown",s),window.removeEventListener("click",o)}},[]),t},ie=t=>{const e=n.useContainer(),o=n.useRouter(),[s,i]=b.useState({name:"",params:{}}),r=n.useIsMounted();return b.useEffect(()=>{const c=(t||e).get("$widget");if(!c)return;const{events:a}=c;return a.subscribe("router:change",(d,{next:{routeData:g}})=>{if(r.current){const{name:f,params:y}=g;te(y),i({name:f,params:y})}})},[r,t,e]),b.useEffect(()=>{if(o&&o.history&&r.current){const c=o.getRouteData(),{name:a,params:l}=c;te(l),i({name:a,params:l})}},[o,r]),s};var ue=(t=>(t.HH_MM="hh:mm",t.YYYY_MM_DD="yyyy-mm-dd",t.YYYY_MM_DD_HH_MM="yyyy-mm-dd hh:mm",t))(ue||{});const he=({className:t="",format:e="hh:mm",timestamp:o})=>u.jsx("span",{className:n.appendClassNames(t,"humany-timestamp"),children:Ie(o,e)}),se=t=>`0${t}`.slice(-2);function Ie(t,e){const o=new Date(t),s=o.toTimeString().split(" ")[0].split(":"),i=s.length>1?`${s[0]}:${s[1]}`:s[0],r=o.getFullYear(),c=o.getMonth()+1,a=o.getDate(),l=`${r}-${se(c)}-${se(a)}`;return e==="yyyy-mm-dd"?l:e==="hh:mm"?i:`${l} ${i}`}var K=(t=>(t.guide="guide",t.link="link",t.default="default",t))(K||{});const re=t=>Promise.resolve().then(()=>require("./index-373df3a5.js")).then(({ServiceClient:e,ServiceProxy:o})=>t.get("settings").then(s=>{const{name:i,events:r}=t.get("$widget"),{data:{projection:c="",site:a="current",forceHttps:l=!1}}=s,d=new o(c,{credentials:"same-origin"}),g=new e(d,{funnel:i.replace("_contact-method","").replace("_contact",""),site:Ee(a,l)},null,t);return r.subscribe("widget:settings-updated",(f,{data:y})=>{y&&y.projection!==c&&g.proxy.setBaseUrl(y.projection)}),g})),Ee=(t,e)=>()=>{const o=i=>{const r=document.createElement("a");return r.href=i,r};let s=window.location;return t==="referrer"&&document.referrer&&(s=o(document.referrer)),[e?"https:":"","//",s.host,s.pathname].join("")},B=t=>{if(t){const{Type:e,Content:o}=t;if(e&&o)return{type:e,content:o}}},oe=t=>t.map(e=>{const o={id:e.Id.toString(),title:e.Name,symbol:B(e.DefaultIcon),activeSymbol:e.ActiveIcon&&B(e.ActiveIcon),description:e.Description||e.Attributes&&e.Attributes.description||"",matches:e.GuidesCount};return e.Children&&e.Children.length&&(o.items=oe(e.Children)),o}),A=(t,e)=>t.filter(({Type:o})=>o===e).map(({Id:o,Title:s,Body:i})=>({id:o.toString(),title:s,body:i})),W=t=>t.map(({Id:e,Title:o,DefaultIcon:s,ListNotices:i,Notices:r})=>({id:e.toString(),title:o,symbol:B(s),defaultHeaderOptions:{visible:!!i.length},notifications:(i||[]).concat(r||[]).map(({Id:c,Title:a,Body:l,Type:d,Modified:g})=>({id:c.toString(),title:a,body:l,modified:g,expandable:d==="listNotice"}))})),Z=({Id:t,Title:e,DefaultIcon:o,Exits:[s],ExitType:i,ConfirmationText:r,ExpandFormAutomatically:c,Form:a,Description:l},d)=>{const{Adapter:g}=s||{Adapter:{}},{ClientName:f="",Settings:y={},CustomClientName:v=""}=g,p={id:t.toString(),title:e,description:l,symbol:B(o),clientName:f==="custom.adapter"?v:f,expanded:!0,inline:!0,body:{}};if(f.indexOf("phone")>-1||f.indexOf("freetext")>-1){const{displayTextBeforeClick:m,textBeforeClick:h}=y;m==="true"&&(p.expanded=!1,p.title=h),f.indexOf("phone.text")>-1?p.body.phoneNumber=y.phoneNumber:p.body.freetext=y.freetext}return(f.indexOf("chat.popup")>-1||f.indexOf("link")>-1||f==="custom.adapter"&&i==="custom")&&(p.body=y,p.body.confirmationFallback=r),f.indexOf("ace")>-1&&(p.body=y),a&&a.HasValueComponents&&(d?p.body.form=n.FormBuilder.fromLegacyForm(t.toString(),a,d).get():p.body.form=n.FormBuilder.fromLegacyForm(t.toString(),a).get(),c||(p.expanded=p.inline=!1)),p},D=(t=[])=>t.map(({Id:e,Title:o,TotalMatches:s,Symbol:i,DefaultIcon:r,ActiveIcon:c})=>({id:e.toString(),title:o,matches:s,symbol:B(r||i),defaultIcon:B(r),activeIcon:B(c)})),J=t=>t.map(({Id:e,Title:o,Tags:s,FirstPublishedDate:i,Modified:r})=>({id:e.toString(),title:o,tags:D(s),published:i,modified:r})),Ae=(t,e)=>{switch(t){case R.MatchByCategory:case R.Match:{const o={guides:[],matches:0,topNotifications:[],middleNotifications:[],bottomNotifications:[],notificationLists:[],tags:[],byCategory:[]},{Matches:s,TotalMatches:i,Notices:r,NoticeLists:c,Tags:a,ByCategory:l}=e;return o.guides=J(s),o.matches=i,o.byCategory=(l||[]).map(({Id:d,Matches:g,TotalMatches:f})=>({id:d,guides:J(g),matches:f})),o.tags=D(a),o.notificationLists=W(c||[]),o.topNotifications=A(r||[],"noticeRowTop"),o.middleNotifications=A(r||[],"noticeRowMiddle"),o.bottomNotifications=A(r||[],"footerNotice"),o}case R.Categories:{const{Children:o,GuidesCountTotal:s}=e;return{categories:oe(o||[]),matches:s}}case R.Guide:{const{Id:o,Title:s,Body:i,Related:r,Options:c,ConnectionId:a,ContactMethods:l,EnableFeedback:d,HandoverExists:g,FirstPublishedDate:f,Modified:y,ModifiedByDisplayName:v,FirstPublishedByDisplayName:p,Categories:m,Tags:h,SeoMetaDescription:x,SeoAllowIndex:C,Perspectives:N,PerspectiveKey:w,Translations:j}=e,$=w||Object.values(N).find(M=>M===a)||N.Default||null,q={guide:{id:o.toString(),title:s,body:i,modified:y,published:f,modifiedBy:v,publishedBy:p,connection:a,categories:m,hasHandover:g,allowFeedback:d,seoMetaDescription:x,seoAllowIndex:C,perspectives:N,perspective:$,translations:Object.keys(j||{}).reduce((M,I)=>(M[I]=j[I].toString(),M),{})},related:J(r||[]),dialog:[],contactMethods:(l||[]).map(M=>Z(M)),tags:D(h)};return(c||[]).forEach(({CanAccess:M,Description:I,ConnectionId:L,Properties:S})=>{if(!M)return;const z={id:o.toString(),title:I,connection:L,connectionKey:S.ConnectionKey,type:K.default,parent:{id:o.toString(),title:s,tags:D(h)}};if(S.Type==="Guide"||S.Type==="Link")switch(S.Id&&(z.id=S.Id.toString()),S.Uri&&(z.href=S.Uri),S.Target&&(z.target=S.Target),S.Type){case"Guide":z.type=K.guide;break;case"Link":z.type=K.link;break}q.dialog.push(z)}),q}case R.Contacts:{const{Children:o,Matches:s,Notices:i,NoticeLists:r}=e;return{contactMethods:(s||[]).map(a=>Z(a)),categories:oe(o||[]),topNotifications:A(i||[],"noticeRowTop"),middleNotifications:A(i||[],"noticeRowMiddle"),bottomNotifications:A(i||[],"footerNotice"),notificationLists:W(r||[])}}case R.ContactMethod:{const{ContactMethod:o}=e;return Z(o||{})}case R.Tags:case R.TagsOnGuides:return D(e||[]);case R.Notifications:{const{Notices:o,NoticeLists:s}=e;return{topNotifications:A(o||[],"noticeRowTop"),middleNotifications:A(o||[],"noticeRowMiddle"),bottomNotifications:A(o||[],"footerNotice"),notificationLists:W(s||[])}}default:return{}}};var ge=(t=>(t.Guide="guide",t.Guides="guides",t.GuidesByCategory="guides-by-category",t.RowNotifications="row-notices",t.NotificationLists="notification-lists",t.GuideCategories="guide-categories",t.ContactMethodCategories="contact-method-categories",t.ContactMethod="contact-method",t.ContactMethods="contact-methods",t.Tags="tags",t.TagsOnGuides="tagsonguides",t))(ge||{}),R=(t=>(t.Match="match",t.Categories="categories",t.Guide="guide",t.Contacts="contacts",t.ContactMethod="contact-method",t.MatchByCategory="match-by-category",t.Tags="tags",t.TagsOnGuides="tagsonguides",t.Notifications="notifications",t))(R||{});const ae=t=>{switch(t){case"guides":return"match";case"guides-by-category":return"match-by-category";case"guide":return"guide";case"guide-categories":return"categories";case"contact-method-categories":case"contact-methods":return"contacts";case"contact-method":return"contact-method";case"tags":return"tags";case"tagsonguides":return"tagsonguides";case"notification-lists":case"row-notices":return"notifications";default:throw"error"}},Le=async t=>{const{invoke:e}=t.get("$widget");return await e("renderState")===n.WidgetRenderState.hidden};class G{constructor(e,o){P(this,"queries",new Map);P(this,"lastTake",0);P(this,"events");P(this,"getUnresolvedQueries",()=>{let e=0;return this.queries.forEach((o,s)=>{o.some(r=>!r.resolved)&&(e=1)}),e});this.container=e,this.matchingClient=o,this.events=e.get("$widget").events,this.events.subscribe("widget:settings-updated",()=>this.queries=new Map),this.events.subscribe("widget:render-state-changed",(s,{next:i,previous:r})=>{r===n.WidgetRenderState.hidden&&i===n.WidgetRenderState.open&&this.fetchAllUnresolvedQueries()})}static getInstance(e,o="dataClient"){return n.lock(this)(()=>e.getAsync(o).then(async s=>{let i=await e.getAsync("matchingClient");i||(i=await re(e),e.registerAsync("matchingClient",()=>i));let r=s;return r||(r=new G(e,i),e.registerAsync(o,()=>r)),r}))}fetch(e,o,s){return new Promise((i,r)=>{o.take&&(this.lastTake=+(o.take||0)),te(o);const c=ae(e);let a=this.queries.get(c)||[],l=a.find(d=>_(d.params,o))||null;if(l&&(s!=null&&s.noCache)){const d=a.findIndex(g=>_(g.params,o));a=[...a.slice(0,d),...a.slice(d+1)],l=null}if(l){const d=a.indexOf(l);if(l.resolved?(this.events.dispatch("data-client:fetched",{params:o,type:c,response:l.data,unresolvedQueries:this.getUnresolvedQueries()}),this.track(l.data,c,l.error),l.data&&l.error?r({error:l.error}):i(l.data)):l.resolvers.push({resolve:i,reject:r}),a.splice(d,1),a.push(l),this.queries.set(c,a),!l.loading&&!l.resolved)return this.runQuery(c,o)}else return a.push({params:o,resolved:!1,loading:!0,data:{},resolvers:[{resolve:i,reject:r}]}),this.queries.set(c,a),this.runQuery(c,o)}).then(i=>n.deepClone(i))}read(e,o){const{select:s}=o,i=ae(e);return(this.queries.get(i)||[]).reduce((a,l)=>{if(typeof s=="function"){const d=s(l.data);d&&a.push(d)}else a.push(l.data);return a},[])}feedback(e,o,s){return this.matchingClient.giveFeedback(e,o,s)}setLoadingStatus(e,o,s){const i=this.queries.get(e)||[],r=i.find(c=>_(c.params,o));r&&(r.loading=s),this.queries.set(e,i)}async runQuery(e,o){const{searchPhrase:s="",categories:i="0",contactMethodCategoryId:r="0",contactMethodId:c="0",tagId:a=void 0,take:l=5,connection:d="",guideId:g,expandCategories:f="descendants",currentCategory:y,sorting:v="popularity-descending",guideIds:p=[]}=o,m=s.toString().trim();if(await Le(this.container))return Promise.resolve();switch(e){case"match":{const h=x=>{const[C,N]=x.split("-");return{type:new Map([["popularity","popularity"],["alphabetic","title"],["modified","lastModified"],["published","firstPublished"]]).get(C),direction:N}};return p.length?this.matchingClient.customRequest("guides","POST",{configuration:{ids:p,take:+l}}).then(x=>x&&this.handleResponse(x,e,o)):this.matchingClient.match(m,{categories:i==="0"?[]:Array.isArray(i)?i:[+i],take:+l,tags:a,sorting:h(v),ids:p}).then(x=>x&&this.handleResponse(x,e,o))}case"match-by-category":return this.matchingClient.match(m,{groupByCategory:!0,categories:i==="0"?[]:Array.isArray(i)?i:[+i],take:+l,tags:a}).then(h=>h&&this.handleResponse(h,e,o));case"guide":return this.matchingClient.getGuide(g,{connectionId:d}).then(h=>{h&&this.handleResponse(h,e,o)}).catch(h=>{const x={message:"Something went wrong.",status:h.status||400};x.status===404&&(x.message="The guide could not be found."),this.handleResponse({},e,o,x)});case"categories":return this.matchingClient.getCategories({phrase:m,expand:f,tags:a}).then(h=>h&&this.handleResponse(h,e,o));case"contacts":return g?this.matchingClient.contactMethods(+g,{phrase:m}).then(h=>h&&this.handleResponse(h,e,o)):this.matchingClient.contacts(+r,{phrase:m}).then(h=>h&&this.handleResponse(h,e,o));case"contact-method":return this.matchingClient.getContactMethod(+c,{guideId:g,currentCategory:y}).then(h=>h&&this.handleResponse(h,e,o));case"tags":return this.matchingClient.customRequest("tags","GET",{configuration:{take:999999,phrase:m,categories:i==="0"?[]:Array.isArray(i)?i:[+i]}}).then(h=>h&&this.handleResponse(h,e,o));case"tagsonguides":return this.matchingClient.customRequest("tagsonguides","GET",{configuration:{take:999999,phrase:m,categories:i==="0"?[]:Array.isArray(i)?i:[+i],tags:a}}).then(h=>h&&this.handleResponse(h,e,o));case"notifications":return this.matchingClient.customRequest("notices","GET",{configuration:{phrase:m,categories:i==="0"?[]:Array.isArray(i)?i:[+i]}}).then(h=>h&&this.handleResponse(h,e,o))}}handleResponse(e={},o,s,i){const r=this.queries.get(o)||[],c=r.find(a=>_(a.params,s));if(c){const a=i||Ae(o,e);this.track(a,o,i),c.resolvers.forEach(d=>{i?d.reject({error:a}):d.resolve(a)});const l=r.indexOf(c);l>-1&&r.splice(l,1),r.push({...c,error:i,resolvers:[],data:a,resolved:!0}),this.setLoadingStatus(o,s,!1),this.queries.set(o,r),i||this.events.dispatch("data-client:fetched",{type:o,params:s,response:a,unresolvedQueries:this.getUnresolvedQueries()})}}fetchAllUnresolvedQueries(){for(const[e,o]of this.queries)o.filter(s=>!s.resolved).forEach(s=>{this.runQuery(e,s.params)})}track(e={},o,s){const i=this.container.get("$widget");i&&!s?i.events.dispatch("tracking:service-client-response",{type:o,data:e}):i&&i.events.dispatch("tracking:service-client-error",{type:o,error:s})}static create(e){return e.getAsync("matchingClient").then(async o=>{if(o)return new G(e,o);const s=await re(e);return e.registerAsync("matchingClient",()=>s),new G(e,s)})}getClient(){return this.matchingClient}}const Be=({title:t="",className:e,id:o,parent:s,connection:i,type:r,target:c,href:a,children:l,connectionKey:d})=>{const g={},{name:f,params:y}=ie();switch(r){case"default":case"guide":const{id:v,title:p}=s;let m=d||i;v!==o&&!d&&(m=void 0),g.routeName=f,g.params=H({...y,guide:o,connection:m,uriName:ee(o===v?p:t)});break;case"link":g.href=a,g.target=c;break}return u.jsx(n.Link,{className:n.appendClassNames(e,"humany-dialog-link"),...g,children:l||u.jsxs(u.Fragment,{children:[r==="link"&&u.jsx(n.Icon,{faIcon:"link"}),u.jsx("span",{children:t})]})})};b.forwardRef(({className:t,dialog:e,...o},s)=>e.length?u.jsx(Oe,{className:n.appendClassNames(t,"humany-dialog"),items:e,renderItem:i=>u.jsx("li",{"data-dialog":i.connection,children:u.jsx(Be,{...i})},i.connection),...o,ref:s}):null);const Oe=n.newStyled(n.List)`
|
|
1
|
+
"use strict";var ke=Object.defineProperty;var Ne=(t,e,o)=>e in t?ke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var P=(t,e,o)=>(Ne(t,typeof e!="symbol"?e+"":e,o),o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),n=require("./index-b42c4c70.js"),b=require("react");require("react-dom");function H(t={}){const{phrase:e="",category:o,guideCategory:s,contactCategory:i,take:r,connectionKey:c,accordion:a,id:l,uriName:d,sorting:g,tag:f,tagId:y,tagTitle:v,...p}=t,m={};return Object.keys(p).forEach(h=>{typeof t[h]=="string"&&(m[h]=t[h])}),typeof e=="string"&&e.length&&(m.phrase=e),e===null&&(m.phrase=e),typeof s=="string"&&s!=="0"&&(m.guideCategory=s),typeof s=="number"&&s!==0&&(m.guideCategory=s),typeof s=="object"&&s!==null&&(typeof s.id=="string"&&s.id!=="0"&&(m.guideCategory=s.id),typeof s.id=="number"&&s.id!==0&&(m.guideCategory=s.id)),typeof i=="string"&&i!=="0"&&(m.contactCategory=i),typeof i=="number"&&i!==0&&(m.contactCategory=i),typeof i=="object"&&i!==null&&(typeof i.id=="string"&&i.id!=="0"&&(m.contactCategory=i.id),typeof i.id=="number"&&i.id!==0&&(m.contactCategory=i.id)),typeof o=="string"&&o!=="0"&&(m.category=o),typeof o=="number"&&o!==0&&(m.category=o),typeof o=="object"&&o!==null&&(typeof o.id=="string"&&o.id!=="0"&&(m.category=o.id),typeof o.id=="number"&&o.id!==0&&(m.category=o.id)),l&&(m.id=l),d&&(+m.category||+m.guideCategory||+m.guide||+m.contactCategory||+m.contactMethod)&&(m.uriName=d),c&&(m.connectionKey=c),r&&(m.take=r),g&&(m.sorting=g),typeof a=="string"&&a.length>0&&(m.accordion=a),typeof f=="string"&&f!=="0"&&(m.tag=f),typeof f=="number"&&f!==0&&(m.tag=f),Array.isArray(f)&&f.length&&(m.tag=f),(typeof y=="string"||typeof y=="number")&&(m.tagId=y),typeof v=="string"&&(m.tagTitle=v),typeof m.tag=="string"&&(m.tag=m.tag.split(",")),m}const ee=t=>{if(!t)return"";const e=[{from:/[äæǽ]+/gi,to:"ae"},{from:/[öœ]+/gi,to:"oe"},{from:/[ü]+/gi,to:"ue"},{from:/[Ä]+/gi,to:"Ae"},{from:/[Ü]+/gi,to:"Ue"},{from:/[Ö]+/gi,to:"Oe"},{from:/[ÀÁÂÃÄÅǺĀĂĄǍΑΆẢẠẦẪẨẬẰẮẴẲẶА]+/gi,to:"A"},{from:/[àáâãåǻāăąǎªαάảạầấẫẩậằắẵẳặа]+/gi,to:"a"},{from:/[Б]+/gi,to:"B"},{from:/[б]+/gi,to:"b"},{from:/[ÇĆĈĊČ]+/gi,to:"C"},{from:/[çćĉċč]+/gi,to:"c"},{from:/[Д]+/gi,to:"D"},{from:/[д]+/gi,to:"d"},{from:/[ÐĎĐΔ]+/gi,to:"Dj"},{from:/[ðďđδ]+/gi,to:"dj"},{from:/[ÈÉÊËĒĔĖĘĚΕΈẼẺẸỀẾỄỂỆЕЭ]+/gi,to:"E"},{from:/[èéêëēĕėęěέεẽẻẹềếễểệеэ]+/gi,to:"e"},{from:/[Ф]+/gi,to:"F"},{from:/[ф]+/gi,to:"f"},{from:/[ĜĞĠĢΓГҐ]+/gi,to:"G"},{from:/[ĝğġģγгґ]+/gi,to:"g"},{from:/[ĤĦ]+/gi,to:"H"},{from:/[ĥħ]+/gi,to:"h"},{from:/[ÌÍÎÏĨĪĬǏĮİΗΉΊΙΪỈỊИЫ]+/gi,to:"I"},{from:/[ìíîïĩīĭǐįıηήίιϊỉịиыї]+/gi,to:"i"},{from:/[Ĵ]+/gi,to:"J"},{from:/[ĵ]+/gi,to:"j"},{from:/[ĶΚК]+/gi,to:"K"},{from:/[ķκк]+/gi,to:"k"},{from:/[ĹĻĽĿŁΛЛ]+/gi,to:"L"},{from:/[ĺļľŀłλл]+/gi,to:"l"},{from:/[М]+/gi,to:"M"},{from:/[м]+/gi,to:"m"},{from:/[ÑŃŅŇΝН]+/gi,to:"N"},{from:/[ñńņňʼnνн]+/gi,to:"n"},{from:/[ÒÓÔÕŌŎǑŐƠØǾΟΌΩΏỎỌỒỐỖỔỘỜỚỠỞỢО]+/gi,to:"O"},{from:/[òóôõōŏǒőơøǿºοόωώỏọồốỗổộờớỡởợо]+/gi,to:"o"},{from:/[П]+/gi,to:"P"},{from:/[п]+/gi,to:"p"},{from:/[ŔŖŘΡР]+/gi,to:"R"},{from:/[ŕŗřρр]+/gi,to:"r"},{from:/[ŚŜŞȘŠΣС]+/gi,to:"S"},{from:/[śŝşșšſσςс]+/gi,to:"s"},{from:/[ȚŢŤŦτТ]+/gi,to:"T"},{from:/[țţťŧт]+/gi,to:"t"},{from:/[ÙÚÛŨŪŬŮŰŲƯǓǕǗǙǛŨỦỤỪỨỮỬỰУ]+/gi,to:"U"},{from:/[ùúûũūŭůűųưǔǖǘǚǜυύϋủụừứữửựу]+/gi,to:"u"},{from:/[ÝŸŶΥΎΫỲỸỶỴЙ]+/gi,to:"Y"},{from:/[ýÿŷỳỹỷỵй]+/gi,to:"y"},{from:/[В]+/gi,to:"V"},{from:/[в]+/gi,to:"v"},{from:/[Ŵ]+/gi,to:"W"},{from:/[ŵ]+/gi,to:"w"},{from:/[ŹŻŽΖЗ]+/gi,to:"Z"},{from:/[źżžζз]+/gi,to:"z"},{from:/[ÆǼ]+/gi,to:"AE"},{from:/[ß]+/gi,to:"ss"},{from:/[IJ]+/gi,to:"IJ"},{from:/[ij]+/gi,to:"ij"},{from:/[Œ]+/gi,to:"OE"},{from:/[ƒ]+/gi,to:"f"},{from:/[ξ]+/gi,to:"ks"},{from:/[π]+/gi,to:"p"},{from:/[β]+/gi,to:"v"},{from:/[μ]+/gi,to:"m"},{from:/[ψ]+/gi,to:"ps"},{from:/[Ё]+/gi,to:"Yo"},{from:/[ё]+/gi,to:"yo"},{from:/[Є]+/gi,to:"Ye"},{from:/[є]+/gi,to:"ye"},{from:/[Ї]+/gi,to:"Yi"},{from:/[Ж]+/gi,to:"Zh"},{from:/[ж]+/gi,to:"zh"},{from:/[Х]+/gi,to:"Kh"},{from:/[х]+/gi,to:"kh"},{from:/[Ц]+/gi,to:"Ts"},{from:/[ц]+/gi,to:"ts"},{from:/[Ч]+/gi,to:"Ch"},{from:/[ч]+/gi,to:"ch"},{from:/[Ш]+/gi,to:"Sh"},{from:/[ш]+/gi,to:"sh"},{from:/[Щ]+/gi,to:"Shch"},{from:/[щ]+/gi,to:"shch"},{from:/[ЪъЬь]+/gi,to:""},{from:/[Ю]+/gi,to:"Yu"},{from:/[ю]+/gi,to:"yu"},{from:/[Я]+/gi,to:"Ya"},{from:/[я]+/gi,to:"ya"}],o=/[^a-zA-Z0-9]+/g,s=/[-]$/;let i=t;for(const r in e)e.hasOwnProperty(r)&&e[r].from.test(t)&&(i=i.replace(e[r].from,e[r].to));return i=i.replace(o,"-"),i=i.replace(s,""),i=i.toLowerCase(),i||"humany"},je=(t,e)=>{if(!t||!e)return!0;let o=e.parentNode,s=!1;for(;o!==null;)o===t&&(s=!0),o=o.parentNode;return s},te=(t={})=>(Object.keys(t).forEach(e=>{(t[e]===null||typeof t[e]>"u")&&delete t[e]}),t),_=(t,e)=>{let o=!0;return Object.keys(t).length!==Object.keys(e).length||Object.keys(t).some(i=>!Object.keys(e).some(c=>i===c))?!1:(Object.keys(t).forEach(i=>{if(o){const r=typeof t[i]>"u"?"":t[i],c=typeof e[i]>"u"?"":e[i];o=r.toString()===c.toString()}}),o)},fe=()=>b.useContext(n.ComponentNodeContext),Me=(t,e)=>{const o=fe(),s=n.useContainer(),[i,r]=b.useState(void 0),c=n.useIsMounted(),a=t||o.type||"";return b.useEffect(()=>{if(a){let l;return(e||s).getAsync("componentResolver").then(d=>{if(c.current){const g=d.getComponent(a);r(g)}l=d.registerResolver(a,g=>{c.current&&r(g)})}),()=>{l&&l()}}},[c,a,e,s]),i},ze=()=>b.useContext(n.ConversationContext),Te=()=>{const t=n.useComponentPlatform(),e=fe(),[o,s]=b.useState([]),[i,r]=b.useState();return b.useEffect(()=>{if(t&&e){const c=new n.ComponentQuery(t).withId(e.id),a=t.actions(c,e.type||n.uuid());r(a),o!==null&&(o.forEach(l=>{a.dispatch(l.key,l.data).then(d=>l.resolve(d)).catch(d=>l.reject(d))}),s(null))}},[t,e.id]),(c,a)=>o!==null?new Promise((l,d)=>{o.push({key:c,data:a,resolve:l,reject:d})}):i.dispatch(c,a)},Re=()=>{const[t,e]=b.useState(!1);return b.useEffect(()=>{const o=()=>{e(!1)},s=i=>{i.keyCode===9&&e(!0)};return window.addEventListener("keydown",s),window.addEventListener("click",o),()=>{window.removeEventListener("keydown",s),window.removeEventListener("click",o)}},[]),t},ie=t=>{const e=n.useContainer(),o=n.useRouter(),[s,i]=b.useState({name:"",params:{}}),r=n.useIsMounted();return b.useEffect(()=>{const c=(t||e).get("$widget");if(!c)return;const{events:a}=c;return a.subscribe("router:change",(d,{next:{routeData:g}})=>{if(r.current){const{name:f,params:y}=g;te(y),i({name:f,params:y})}})},[r,t,e]),b.useEffect(()=>{if(o&&o.history&&r.current){const c=o.getRouteData(),{name:a,params:l}=c;te(l),i({name:a,params:l})}},[o,r]),s};var ue=(t=>(t.HH_MM="hh:mm",t.YYYY_MM_DD="yyyy-mm-dd",t.YYYY_MM_DD_HH_MM="yyyy-mm-dd hh:mm",t))(ue||{});const he=({className:t="",format:e="hh:mm",timestamp:o})=>u.jsx("span",{className:n.appendClassNames(t,"humany-timestamp"),children:Ie(o,e)}),se=t=>`0${t}`.slice(-2);function Ie(t,e){const o=new Date(t),s=o.toTimeString().split(" ")[0].split(":"),i=s.length>1?`${s[0]}:${s[1]}`:s[0],r=o.getFullYear(),c=o.getMonth()+1,a=o.getDate(),l=`${r}-${se(c)}-${se(a)}`;return e==="yyyy-mm-dd"?l:e==="hh:mm"?i:`${l} ${i}`}var K=(t=>(t.guide="guide",t.link="link",t.default="default",t))(K||{});const re=t=>Promise.resolve().then(()=>require("./index-373df3a5.js")).then(({ServiceClient:e,ServiceProxy:o})=>t.get("settings").then(s=>{const{name:i,events:r}=t.get("$widget"),{data:{projection:c="",site:a="current",forceHttps:l=!1}}=s,d=new o(c,{credentials:"same-origin"}),g=new e(d,{funnel:i.replace("_contact-method","").replace("_contact",""),site:Ee(a,l)},null,t);return r.subscribe("widget:settings-updated",(f,{data:y})=>{y&&y.projection!==c&&g.proxy.setBaseUrl(y.projection)}),g})),Ee=(t,e)=>()=>{const o=i=>{const r=document.createElement("a");return r.href=i,r};let s=window.location;return t==="referrer"&&document.referrer&&(s=o(document.referrer)),[e?"https:":"","//",s.host,s.pathname].join("")},B=t=>{if(t){const{Type:e,Content:o}=t;if(e&&o)return{type:e,content:o}}},oe=t=>t.map(e=>{const o={id:e.Id.toString(),title:e.Name,symbol:B(e.DefaultIcon),activeSymbol:e.ActiveIcon&&B(e.ActiveIcon),description:e.Description||e.Attributes&&e.Attributes.description||"",matches:e.GuidesCount};return e.Children&&e.Children.length&&(o.items=oe(e.Children)),o}),A=(t,e)=>t.filter(({Type:o})=>o===e).map(({Id:o,Title:s,Body:i})=>({id:o.toString(),title:s,body:i})),W=t=>t.map(({Id:e,Title:o,DefaultIcon:s,ListNotices:i,Notices:r})=>({id:e.toString(),title:o,symbol:B(s),defaultHeaderOptions:{visible:!!i.length},notifications:(i||[]).concat(r||[]).map(({Id:c,Title:a,Body:l,Type:d,Modified:g})=>({id:c.toString(),title:a,body:l,modified:g,expandable:d==="listNotice"}))})),Z=({Id:t,Title:e,DefaultIcon:o,Exits:[s],ExitType:i,ConfirmationText:r,ExpandFormAutomatically:c,Form:a,Description:l},d)=>{const{Adapter:g}=s||{Adapter:{}},{ClientName:f="",Settings:y={},CustomClientName:v=""}=g,p={id:t.toString(),title:e,description:l,symbol:B(o),clientName:f==="custom.adapter"?v:f,expanded:!0,inline:!0,body:{}};if(f.indexOf("phone")>-1||f.indexOf("freetext")>-1){const{displayTextBeforeClick:m,textBeforeClick:h}=y;m==="true"&&(p.expanded=!1,p.title=h),f.indexOf("phone.text")>-1?p.body.phoneNumber=y.phoneNumber:p.body.freetext=y.freetext}return(f.indexOf("chat.popup")>-1||f.indexOf("link")>-1||f==="custom.adapter"&&i==="custom")&&(p.body=y,p.body.confirmationFallback=r),f.indexOf("ace")>-1&&(p.body=y),a&&a.HasValueComponents&&(d?p.body.form=n.FormBuilder.fromLegacyForm(t.toString(),a,d).get():p.body.form=n.FormBuilder.fromLegacyForm(t.toString(),a).get(),c||(p.expanded=p.inline=!1)),p},D=(t=[])=>t.map(({Id:e,Title:o,TotalMatches:s,Symbol:i,DefaultIcon:r,ActiveIcon:c})=>({id:e.toString(),title:o,matches:s,symbol:B(r||i),defaultIcon:B(r),activeIcon:B(c)})),J=t=>t.map(({Id:e,Title:o,Tags:s,FirstPublishedDate:i,Modified:r})=>({id:e.toString(),title:o,tags:D(s),published:i,modified:r})),Ae=(t,e)=>{switch(t){case R.MatchByCategory:case R.Match:{const o={guides:[],matches:0,topNotifications:[],middleNotifications:[],bottomNotifications:[],notificationLists:[],tags:[],byCategory:[]},{Matches:s,TotalMatches:i,Notices:r,NoticeLists:c,Tags:a,ByCategory:l}=e;return o.guides=J(s),o.matches=i,o.byCategory=(l||[]).map(({Id:d,Matches:g,TotalMatches:f})=>({id:d,guides:J(g),matches:f})),o.tags=D(a),o.notificationLists=W(c||[]),o.topNotifications=A(r||[],"noticeRowTop"),o.middleNotifications=A(r||[],"noticeRowMiddle"),o.bottomNotifications=A(r||[],"footerNotice"),o}case R.Categories:{const{Children:o,GuidesCountTotal:s}=e;return{categories:oe(o||[]),matches:s}}case R.Guide:{const{Id:o,Title:s,Body:i,Related:r,Options:c,ConnectionId:a,ContactMethods:l,EnableFeedback:d,HandoverExists:g,FirstPublishedDate:f,Modified:y,ModifiedByDisplayName:v,FirstPublishedByDisplayName:p,Categories:m,Tags:h,SeoMetaDescription:x,SeoAllowIndex:C,Perspectives:N,PerspectiveKey:w,Translations:j}=e,$=w||Object.values(N).find(M=>M===a)||N.Default||null,q={guide:{id:o.toString(),title:s,body:i,modified:y,published:f,modifiedBy:v,publishedBy:p,connection:a,categories:m,hasHandover:g,allowFeedback:d,seoMetaDescription:x,seoAllowIndex:C,perspectives:N,perspective:$,translations:Object.keys(j||{}).reduce((M,I)=>(M[I]=j[I].toString(),M),{})},related:J(r||[]),dialog:[],contactMethods:(l||[]).map(M=>Z(M)),tags:D(h)};return(c||[]).forEach(({CanAccess:M,Description:I,ConnectionId:L,Properties:S})=>{if(!M)return;const z={id:o.toString(),title:I,connection:L,connectionKey:S.ConnectionKey,type:K.default,parent:{id:o.toString(),title:s,tags:D(h)}};if(S.Type==="Guide"||S.Type==="Link")switch(S.Id&&(z.id=S.Id.toString()),S.Uri&&(z.href=S.Uri),S.Target&&(z.target=S.Target),S.Type){case"Guide":z.type=K.guide;break;case"Link":z.type=K.link;break}q.dialog.push(z)}),q}case R.Contacts:{const{Children:o,Matches:s,Notices:i,NoticeLists:r}=e;return{contactMethods:(s||[]).map(a=>Z(a)),categories:oe(o||[]),topNotifications:A(i||[],"noticeRowTop"),middleNotifications:A(i||[],"noticeRowMiddle"),bottomNotifications:A(i||[],"footerNotice"),notificationLists:W(r||[])}}case R.ContactMethod:{const{ContactMethod:o}=e;return Z(o||{})}case R.Tags:case R.TagsOnGuides:return D(e||[]);case R.Notifications:{const{Notices:o,NoticeLists:s}=e;return{topNotifications:A(o||[],"noticeRowTop"),middleNotifications:A(o||[],"noticeRowMiddle"),bottomNotifications:A(o||[],"footerNotice"),notificationLists:W(s||[])}}default:return{}}};var ge=(t=>(t.Guide="guide",t.Guides="guides",t.GuidesByCategory="guides-by-category",t.RowNotifications="row-notices",t.NotificationLists="notification-lists",t.GuideCategories="guide-categories",t.ContactMethodCategories="contact-method-categories",t.ContactMethod="contact-method",t.ContactMethods="contact-methods",t.Tags="tags",t.TagsOnGuides="tagsonguides",t))(ge||{}),R=(t=>(t.Match="match",t.Categories="categories",t.Guide="guide",t.Contacts="contacts",t.ContactMethod="contact-method",t.MatchByCategory="match-by-category",t.Tags="tags",t.TagsOnGuides="tagsonguides",t.Notifications="notifications",t))(R||{});const ae=t=>{switch(t){case"guides":return"match";case"guides-by-category":return"match-by-category";case"guide":return"guide";case"guide-categories":return"categories";case"contact-method-categories":case"contact-methods":return"contacts";case"contact-method":return"contact-method";case"tags":return"tags";case"tagsonguides":return"tagsonguides";case"notification-lists":case"row-notices":return"notifications";default:throw"error"}},Le=async t=>{const{invoke:e}=t.get("$widget");return await e("renderState")===n.WidgetRenderState.hidden};class G{constructor(e,o){P(this,"queries",new Map);P(this,"lastTake",0);P(this,"events");P(this,"getUnresolvedQueries",()=>{let e=0;return this.queries.forEach((o,s)=>{o.some(r=>!r.resolved)&&(e=1)}),e});this.container=e,this.matchingClient=o,this.events=e.get("$widget").events,this.events.subscribe("widget:settings-updated",()=>this.queries=new Map),this.events.subscribe("widget:render-state-changed",(s,{next:i,previous:r})=>{r===n.WidgetRenderState.hidden&&i===n.WidgetRenderState.open&&this.fetchAllUnresolvedQueries()})}static getInstance(e,o="dataClient"){return n.lock(this)(()=>e.getAsync(o).then(async s=>{let i=await e.getAsync("matchingClient");i||(i=await re(e),e.registerAsync("matchingClient",()=>i));let r=s;return r||(r=new G(e,i),e.registerAsync(o,()=>r)),r}))}fetch(e,o,s){return new Promise((i,r)=>{o.take&&(this.lastTake=+(o.take||0)),te(o);const c=ae(e);let a=this.queries.get(c)||[],l=a.find(d=>_(d.params,o))||null;if(l&&(s!=null&&s.noCache)){const d=a.findIndex(g=>_(g.params,o));a=[...a.slice(0,d),...a.slice(d+1)],l=null}if(l){const d=a.indexOf(l);if(l.resolved?(this.events.dispatch("data-client:fetched",{params:o,type:c,response:l.data,unresolvedQueries:this.getUnresolvedQueries()}),this.track(l.data,c,l.error),l.data&&l.error?r({error:l.error}):i(l.data)):l.resolvers.push({resolve:i,reject:r}),a.splice(d,1),a.push(l),this.queries.set(c,a),!l.loading&&!l.resolved)return this.runQuery(c,o)}else return a.push({params:o,resolved:!1,loading:!0,data:{},resolvers:[{resolve:i,reject:r}]}),this.queries.set(c,a),this.runQuery(c,o)}).then(i=>n.deepClone(i))}read(e,o){const{select:s}=o,i=ae(e);return(this.queries.get(i)||[]).reduce((a,l)=>{if(typeof s=="function"){const d=s(l.data);d&&a.push(d)}else a.push(l.data);return a},[])}feedback(e,o,s){return this.matchingClient.giveFeedback(e,o,s)}setLoadingStatus(e,o,s){const i=this.queries.get(e)||[],r=i.find(c=>_(c.params,o));r&&(r.loading=s),this.queries.set(e,i)}async runQuery(e,o){const{searchPhrase:s="",categories:i="0",contactMethodCategoryId:r="0",contactMethodId:c="0",tagId:a=void 0,take:l=5,connection:d="",guideId:g,expandCategories:f="descendants",currentCategory:y,sorting:v="popularity-descending",guideIds:p=[]}=o,m=s.toString().trim();if(await Le(this.container))return Promise.resolve();switch(e){case"match":{const h=x=>{const[C,N]=x.split("-");return{type:new Map([["popularity","popularity"],["alphabetic","title"],["modified","lastModified"],["published","firstPublished"]]).get(C),direction:N}};return p.length?this.matchingClient.customRequest("guides","POST",{configuration:{ids:p,take:+l}}).then(x=>x&&this.handleResponse(x,e,o)):this.matchingClient.match(m,{categories:i==="0"?[]:Array.isArray(i)?i:[+i],take:+l,tags:a,sorting:h(v),ids:p}).then(x=>x&&this.handleResponse(x,e,o))}case"match-by-category":return this.matchingClient.match(m,{groupByCategory:!0,categories:i==="0"?[]:Array.isArray(i)?i:[+i],take:+l,tags:a}).then(h=>h&&this.handleResponse(h,e,o));case"guide":return this.matchingClient.getGuide(g,{connectionId:d}).then(h=>{h&&this.handleResponse(h,e,o)}).catch(h=>{const x={message:"Something went wrong.",status:h.status||400};x.status===404&&(x.message="The guide could not be found."),this.handleResponse({},e,o,x)});case"categories":return this.matchingClient.getCategories({phrase:m,expand:f,tags:a}).then(h=>h&&this.handleResponse(h,e,o));case"contacts":return g?this.matchingClient.contactMethods(+g,{phrase:m}).then(h=>h&&this.handleResponse(h,e,o)):this.matchingClient.contacts(+r,{phrase:m}).then(h=>h&&this.handleResponse(h,e,o));case"contact-method":return this.matchingClient.getContactMethod(+c,{guideId:g,currentCategory:y}).then(h=>h&&this.handleResponse(h,e,o));case"tags":return this.matchingClient.customRequest("tags","GET",{configuration:{take:999999,phrase:m,categories:i==="0"?[]:Array.isArray(i)?i:[+i]}}).then(h=>h&&this.handleResponse(h,e,o));case"tagsonguides":return this.matchingClient.customRequest("tagsonguides","GET",{configuration:{take:999999,phrase:m,categories:i==="0"?[]:Array.isArray(i)?i:[+i],tags:a}}).then(h=>h&&this.handleResponse(h,e,o));case"notifications":return this.matchingClient.customRequest("notices","GET",{configuration:{phrase:m,categories:i==="0"?[]:Array.isArray(i)?i:[+i]}}).then(h=>h&&this.handleResponse(h,e,o))}}handleResponse(e={},o,s,i){const r=this.queries.get(o)||[],c=r.find(a=>_(a.params,s));if(c){const a=i||Ae(o,e);this.track(a,o,i),c.resolvers.forEach(d=>{i?d.reject({error:a}):d.resolve(a)});const l=r.indexOf(c);l>-1&&r.splice(l,1),r.push({...c,error:i,resolvers:[],data:a,resolved:!0}),this.setLoadingStatus(o,s,!1),this.queries.set(o,r),i||this.events.dispatch("data-client:fetched",{type:o,params:s,response:a,unresolvedQueries:this.getUnresolvedQueries()})}}fetchAllUnresolvedQueries(){for(const[e,o]of this.queries)o.filter(s=>!s.resolved).forEach(s=>{this.runQuery(e,s.params)})}track(e={},o,s){const i=this.container.get("$widget");i&&!s?i.events.dispatch("tracking:service-client-response",{type:o,data:e}):i&&i.events.dispatch("tracking:service-client-error",{type:o,error:s})}static create(e){return e.getAsync("matchingClient").then(async o=>{if(o)return new G(e,o);const s=await re(e);return e.registerAsync("matchingClient",()=>s),new G(e,s)})}getClient(){return this.matchingClient}}const Be=({title:t="",className:e,id:o,parent:s,connection:i,type:r,target:c,href:a,children:l,connectionKey:d})=>{const g={},{name:f,params:y}=ie();switch(r){case"default":case"guide":const{id:v,title:p}=s;let m=d||i;v!==o&&!d&&(m=void 0),g.routeName=f,g.params=H({...y,guide:o,connection:m,uriName:ee(o===v?p:t)});break;case"link":g.href=a,g.target=c;break}return u.jsx(n.Link,{className:n.appendClassNames(e,"humany-dialog-link"),...g,children:l||u.jsxs(u.Fragment,{children:[r==="link"&&u.jsx(n.Icon,{faIcon:"link"}),u.jsx("span",{children:t})]})})};b.forwardRef(({className:t,dialog:e,...o},s)=>e.length?u.jsx(Oe,{className:n.appendClassNames(t,"humany-dialog"),items:e,renderItem:i=>u.jsx("li",{"data-dialog":i.connection,children:u.jsx(Be,{...i})},i.connection),...o,ref:s}):null);const Oe=n.newStyled(n.List)`
|
|
2
2
|
${n.list}
|
|
3
3
|
a {
|
|
4
4
|
min-width: 150px;
|
|
@@ -4587,7 +4587,7 @@ const Hc = qe({
|
|
|
4587
4587
|
qe(
|
|
4588
4588
|
{}
|
|
4589
4589
|
);
|
|
4590
|
-
const zc = qe(null),
|
|
4590
|
+
const zc = qe(null), Td = qe(null), lt = () => nn(Vc), Bc = (t) => {
|
|
4591
4591
|
const e = nn(Hc), n = _o(), [r, i] = he();
|
|
4592
4592
|
return oe(() => {
|
|
4593
4593
|
if ((t || e.id) && n) {
|
|
@@ -4782,7 +4782,7 @@ const zc = qe(null), Od = qe(null), lt = () => nn(Vc), Bc = (t) => {
|
|
|
4782
4782
|
font-family: ${(n = t.theme.fonts) == null ? void 0 : n.type};
|
|
4783
4783
|
font-size: ${(r = t.theme.fonts) == null ? void 0 : r.normal};
|
|
4784
4784
|
`;
|
|
4785
|
-
},
|
|
4785
|
+
}, Pd = (t) => {
|
|
4786
4786
|
var s;
|
|
4787
4787
|
const { primaryColor: e, secondaryColor: n, active: r, theme: i, disabled: o } = t;
|
|
4788
4788
|
return J`
|
|
@@ -4830,7 +4830,7 @@ const zc = qe(null), Od = qe(null), lt = () => nn(Vc), Bc = (t) => {
|
|
|
4830
4830
|
}, Gc = (t) => J`
|
|
4831
4831
|
${Ne(t)}
|
|
4832
4832
|
text-decoration: underline;
|
|
4833
|
-
`,
|
|
4833
|
+
`, Rd = (t) => {
|
|
4834
4834
|
var e;
|
|
4835
4835
|
return J`
|
|
4836
4836
|
${Ne(t)}
|
|
@@ -4897,7 +4897,7 @@ const zc = qe(null), Od = qe(null), lt = () => nn(Vc), Bc = (t) => {
|
|
|
4897
4897
|
margin: 0;
|
|
4898
4898
|
}
|
|
4899
4899
|
`;
|
|
4900
|
-
},
|
|
4900
|
+
}, Ad = (t) => {
|
|
4901
4901
|
var e, n, r, i;
|
|
4902
4902
|
return J`
|
|
4903
4903
|
> div {
|
|
@@ -4933,7 +4933,7 @@ const zc = qe(null), Od = qe(null), lt = () => nn(Vc), Bc = (t) => {
|
|
|
4933
4933
|
`
|
|
4934
4934
|
)}
|
|
4935
4935
|
`;
|
|
4936
|
-
},
|
|
4936
|
+
}, _d = (t) => {
|
|
4937
4937
|
var e, n, r, i, o, s;
|
|
4938
4938
|
return J`
|
|
4939
4939
|
font-size: ${(e = t.theme.fonts) == null ? void 0 : e.normal};
|
|
@@ -5999,7 +5999,7 @@ const nl = $.div`
|
|
|
5999
5999
|
]
|
|
6000
6000
|
}
|
|
6001
6001
|
)
|
|
6002
|
-
),
|
|
6002
|
+
), Ld = be(
|
|
6003
6003
|
({
|
|
6004
6004
|
header: t,
|
|
6005
6005
|
customHeader: e,
|
|
@@ -8282,7 +8282,7 @@ const su = be(
|
|
|
8282
8282
|
${(t) => Do(t)}
|
|
8283
8283
|
${(t) => t.css && t.css}
|
|
8284
8284
|
outline: none;
|
|
8285
|
-
`,
|
|
8285
|
+
`, Dd = ({
|
|
8286
8286
|
className: t,
|
|
8287
8287
|
trigger: e,
|
|
8288
8288
|
header: n = "",
|
|
@@ -8440,7 +8440,7 @@ $.div`
|
|
|
8440
8440
|
font-weight: bold;
|
|
8441
8441
|
}
|
|
8442
8442
|
`;
|
|
8443
|
-
const
|
|
8443
|
+
const Md = be(
|
|
8444
8444
|
({ className: t, description: e, text: n, children: r, ...i }, o) => /* @__PURE__ */ q(
|
|
8445
8445
|
zr,
|
|
8446
8446
|
{
|
|
@@ -10305,7 +10305,7 @@ const hd = ({
|
|
|
10305
10305
|
})),
|
|
10306
10306
|
meta: n
|
|
10307
10307
|
};
|
|
10308
|
-
},
|
|
10308
|
+
}, jd = (t, {
|
|
10309
10309
|
submit: e,
|
|
10310
10310
|
errors: n,
|
|
10311
10311
|
meta: r
|
|
@@ -10495,7 +10495,7 @@ class vd {
|
|
|
10495
10495
|
});
|
|
10496
10496
|
}
|
|
10497
10497
|
}
|
|
10498
|
-
const gd = "@telia-ace/conversational-hub-bot-provider", yd = "0.0.
|
|
10498
|
+
const gd = "@telia-ace/conversational-hub-bot-provider", yd = "0.0.12", bd = "./index.js", wd = "./index.d.ts", xd = {
|
|
10499
10499
|
".": {
|
|
10500
10500
|
import: "./index.mjs",
|
|
10501
10501
|
require: "./index.js"
|
|
@@ -10503,16 +10503,17 @@ const gd = "@telia-ace/conversational-hub-bot-provider", yd = "0.0.10", bd = "./
|
|
|
10503
10503
|
}, Ed = {
|
|
10504
10504
|
"@telia-ace/widget-conversation": "*",
|
|
10505
10505
|
"@webprovisions/platform": "^1.1.4",
|
|
10506
|
-
"@emotion/react": "11.11.1",
|
|
10507
10506
|
"@telia-ace/knowledge-widget-core": "*",
|
|
10508
10507
|
"@telia-ace/widget-utilities": "*",
|
|
10509
10508
|
"@telia-ace/widget-services": "*",
|
|
10510
10509
|
"@telia-ace/widget-core": "*",
|
|
10511
|
-
"@emotion/styled": "11.11.0",
|
|
10512
10510
|
"@telia-ace/knowledge-data-client": "*",
|
|
10513
10511
|
"@telia-ace/knowledge-widget-adapters": "*",
|
|
10514
10512
|
"@telia-ace/knowledge-widget-ui": "*",
|
|
10515
|
-
"@telia-ace/widget-forms": "*"
|
|
10513
|
+
"@telia-ace/widget-forms": "*"
|
|
10514
|
+
}, Cd = {
|
|
10515
|
+
"@emotion/react": "11.11.1",
|
|
10516
|
+
"@emotion/styled": "11.11.0",
|
|
10516
10517
|
react: "18.2.0"
|
|
10517
10518
|
}, Ke = {
|
|
10518
10519
|
name: gd,
|
|
@@ -10520,15 +10521,16 @@ const gd = "@telia-ace/conversational-hub-bot-provider", yd = "0.0.10", bd = "./
|
|
|
10520
10521
|
main: bd,
|
|
10521
10522
|
types: wd,
|
|
10522
10523
|
exports: xd,
|
|
10523
|
-
dependencies: Ed
|
|
10524
|
-
|
|
10524
|
+
dependencies: Ed,
|
|
10525
|
+
peerDependencies: Cd
|
|
10526
|
+
}, Vd = async (t) => {
|
|
10525
10527
|
var O, b, j, T, _;
|
|
10526
10528
|
const e = "chub-plugin", n = t.get("$widget"), r = (_ = (T = (j = (b = (O = n == null ? void 0 : n.container) == null ? void 0 : O.get("$settings")) == null ? void 0 : b.components) == null ? void 0 : j.conversation) == null ? void 0 : T.properties) == null ? void 0 : _.conversationalHubPluginSettings;
|
|
10527
10529
|
let i, o, s, a = (r == null ? void 0 : r.connectionAttempts) ?? 5, c, u, l;
|
|
10528
10530
|
ce.info((Ke == null ? void 0 : Ke.name) + " version: " + (Ke == null ? void 0 : Ke.version)), cd(
|
|
10529
10531
|
t,
|
|
10530
10532
|
en.ContactMethod,
|
|
10531
|
-
import("./contact-method-
|
|
10533
|
+
import("./contact-method-77354cf2.mjs")
|
|
10532
10534
|
);
|
|
10533
10535
|
const d = await st(
|
|
10534
10536
|
t,
|
|
@@ -10648,23 +10650,23 @@ const gd = "@telia-ace/conversational-hub-bot-provider", yd = "0.0.10", bd = "./
|
|
|
10648
10650
|
}
|
|
10649
10651
|
};
|
|
10650
10652
|
export {
|
|
10651
|
-
|
|
10653
|
+
_d as A,
|
|
10652
10654
|
ze as B,
|
|
10653
10655
|
Hc as C,
|
|
10654
10656
|
Gc as D,
|
|
10655
10657
|
Rr as E,
|
|
10656
10658
|
He as F,
|
|
10657
|
-
|
|
10659
|
+
jd as G,
|
|
10658
10660
|
Io as H,
|
|
10659
10661
|
rl as I,
|
|
10660
|
-
|
|
10662
|
+
Vd as J,
|
|
10661
10663
|
zr as L,
|
|
10662
10664
|
ol as P,
|
|
10663
10665
|
kt as S,
|
|
10664
10666
|
Nr as T,
|
|
10665
10667
|
ro as W,
|
|
10666
10668
|
Ao as a,
|
|
10667
|
-
|
|
10669
|
+
Td as b,
|
|
10668
10670
|
_o as c,
|
|
10669
10671
|
Qi as d,
|
|
10670
10672
|
Re as e,
|
|
@@ -10673,19 +10675,19 @@ export {
|
|
|
10673
10675
|
eo as h,
|
|
10674
10676
|
Ar as i,
|
|
10675
10677
|
Tr as j,
|
|
10676
|
-
|
|
10678
|
+
Pd as k,
|
|
10677
10679
|
Et as l,
|
|
10678
|
-
|
|
10680
|
+
Ld as m,
|
|
10679
10681
|
$ as n,
|
|
10680
|
-
|
|
10682
|
+
Ad as o,
|
|
10681
10683
|
wt as p,
|
|
10682
10684
|
J as q,
|
|
10683
|
-
|
|
10684
|
-
|
|
10685
|
+
Rd as r,
|
|
10686
|
+
Dd as s,
|
|
10685
10687
|
xt as t,
|
|
10686
10688
|
lt as u,
|
|
10687
10689
|
Ae as v,
|
|
10688
|
-
|
|
10690
|
+
Md as w,
|
|
10689
10691
|
Fc as x,
|
|
10690
10692
|
Ne as y,
|
|
10691
10693
|
ko as z
|