@telia-ace/knowledge-data-client-flamingo 1.1.110-rc.2 → 1.1.110

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.
Files changed (3) hide show
  1. package/index.js +1 -1
  2. package/index.mjs +175 -175
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=(i,e,t,...n)=>{const s=`[${i.get("$environment").name||"webprovisions"}] ${t}`;switch(e){case"info":console.info(s,...n);break;case"warning":console.warn(s,...n);break;case"error":console.error(s,...n);break}},ie=i=>{const e=i.container||i;return{info:(t,...n)=>j(e,"info",t,...n),warn:(t,...n)=>j(e,"warning",t,...n),error:(t,...n)=>j(e,"error",t,...n)}};var T=(i=>(i.Implementation="implementation",i.Widget="widget",i))(T||{}),k=(i=>(i.Pre="pre",i.Post="post",i))(k||{});const se=(i,e,t,n)=>{try{const s=new e(t,n);return{name:i,invoke:(o,a)=>{let r;return s[o]&&(r=s[o].call(s,a)),Promise.resolve(r)},getInstance:()=>s}}catch(s){if(s.message&&s.message.indexOf("is not a constructor")>=0)return{name:i,invoke:o=>{let a;return o==="initialize"&&(a=e(t,n)),Promise.resolve(a)},getInstance:()=>e};throw s}};function W(i,e){return typeof i>"u"?e:i}class ne{constructor(e={}){this.part=e}createCommand(e,t,n){let s;typeof t=="function"?s={scope:T.Widget,stage:k.Post,defaultArgs:void 0,handlerResolver:t}:s={scope:W(t.scope,T.Widget),stage:W(t.stage,k.Post),defaultArgs:t.defaultArgs,handlerResolver:n};let o=this.part;const a=e.split(".");return a.forEach((r,c)=>{c===a.length-1?o[r]||(o[r]=()=>s):o=this.part[r]=this.part[r]||{}}),this}get(){return this.part}}const z=i=>{const e=new ne({});return i(e),e.get()};z(i=>{i.createCommand("types.register",{scope:T.Implementation,stage:k.Pre},e=>(t,n)=>{e.container.get("$types")[t]=n}).createCommand("type",{stage:k.Pre},e=>t=>{e.container.register("$type",t)}).createCommand("settings",{stage:k.Pre,defaultArgs:[null]},e=>t=>{e.events.dispatch("settings:change",t,{bubbles:!0}),e.container.register("$settings",t)}).createCommand("plugin",{stage:k.Pre},e=>(t,n,s)=>{const{container:o}=e;let a=null,r=t,c=n;typeof t=="string"&&(a=t,r=n,c=s);const d=u=>{const{transformPluginSettings:f}=e.container.get("$environmentOptions"),h=f?f(c||{},a,e.container,r):n;try{const p=se(a,r,o,h);o.get("$plugins").push(p),u&&p.invoke("initialize",null)}catch(p){ie(e).warn("Error when initializing plugin",p)}};e.container.get("$instance")?d(!0):e.events.subscribeOnce("widget:instance-created",()=>d(!1))}).createCommand("container.register",e=>(t,n)=>{e.container.register(t,n)}).createCommand("container.registerAsync",e=>(t,n)=>{e.container.registerAsync(t,n)}).createCommand("container.registerFactory",e=>(t,n)=>{e.container.registerFactory(t,n)}).createCommand("container.touch",e=>(t,n)=>{e.container.touch(t,n)}).createCommand("csp",{},e=>t=>{e.container.register("csp",t)})});const G=(i,e,...t)=>typeof e=="string"?i(`[humany] ${e}`,...t):i(e,...t),M=class{constructor(){this.keys=[],this.log=(i,...e)=>this.lookup(i,()=>M.log(...e)),this.warn=(i,...e)=>this.lookup(i,()=>M.warn(...e)),this.error=(i,...e)=>this.lookup(i,()=>M.error(...e)),this.info=(i,...e)=>this.lookup(i,()=>M.info(...e))}lookup(i,e){this.keys.indexOf(i)===-1&&(this.keys.push(i),e())}};let S=M;S.log=(...i)=>G(console.log,...i);S.warn=(...i)=>G(console.warn,...i);S.error=(...i)=>G(console.error,...i);S.info=(...i)=>G(console.info,...i);const V=i=>{let e={},t,n;if(typeof i!="object"||i===null)return i;e=Array.isArray(i)?[]:{};for(n in i)t=i[n],e[n]=typeof t=="object"&&t!==null?V(t):t;return e};class oe{constructor(e,t){this.lockWarningTime=e,this.lockErrorTime=t,this.tasks=[],this.current=Promise.resolve(),this.next=this.next.bind(this)}add(e,t,n,s){this.tasks.push({task:e,resolve:t,reject:n,done:s}),this.next()}next(){this.current=this.current.then(()=>{const e=this.tasks.shift();if(e){let t;const n=setTimeout(()=>{process.env.NODE_ENV!=="production"&&S.warn(`A lock has exceeded ${this.lockWarningTime} ms. Waiting additional ${this.lockErrorTime} ms before rejecting the task.`,e),t=setTimeout(()=>{e.reject("lock timeout exceeded")},this.lockErrorTime)},this.lockWarningTime),s=Promise.resolve(e.task()).then(o=>(clearTimeout(n),clearTimeout(t),o));return Promise.resolve(s).then(this.next).then(()=>s.then(o=>{e.done(),e.resolve(o)})).catch(o=>(e.done(),e.reject(o),this.next()))}return Promise.resolve()})}}const P=new WeakMap;function re(i,e=5e3,t=1e3){return P.has(i)||P.set(i,new oe(e,t)),n=>new Promise((s,o)=>{const a=P.get(i);a.add(n,s,o,()=>{a.tasks.length||P.delete(i)})})}const ae=(i={})=>(Object.keys(i).forEach(e=>{(i[e]===null||typeof i[e]>"u")&&delete i[e]}),i),R=(i,e)=>{let t=!0;return Object.keys(i).length!==Object.keys(e).length||Object.keys(i).some(n=>!Object.keys(e).some(s=>n===s))?!1:(Object.keys(i).forEach(n=>{if(t){const s=typeof i[n]>"u"?"":i[n],o=typeof e[n]>"u"?"":e[n];t=s.toString()===o.toString()}}),t)};z(i=>{i.createCommand("components",e=>t=>{e.events.subscribeOnce("components:platform-created",(n,{platform:s})=>{t.handlers&&t.handlers.forEach(([o,a])=>{s.addComponentHandler(o,a)})})})});var q=(i=>(i.open="open",i.closed="closed",i.hidden="hidden",i))(q||{});const K=i=>Promise.resolve().then(()=>require("./index-B9t-W0wz.js")).then(({ServiceClient:e,ServiceProxy:t})=>i.get("settings").then(n=>{const{name:s,events:o}=i.get("$widget"),{data:{projection:a="",site:r="current",forceHttps:c=!1}}=n,d=new t(a,{credentials:"same-origin"}),u=new e(d,{funnel:s.replace("_contact-method","").replace("_contact",""),site:ce(r,c)},null,i);return o.subscribe("widget:settings-updated",(f,{data:h})=>{h&&h.projection!==a&&u.proxy.setBaseUrl(h.projection)}),u})),ce=(i,e)=>()=>{const t=s=>{const o=document.createElement("a");return o.href=s,o};let n=window.location;return i==="referrer"&&document.referrer&&(n=t(document.referrer)),[e?"https:":"","//",n.host,n.pathname].join("")},N=i=>{if(i){const{Type:e,Content:t}=i;if(e&&t)return{type:e,content:t}}},U=i=>i.map(e=>{const t={id:e.Id.toString(),title:e.Name,symbol:N(e.DefaultIcon),activeSymbol:e.ActiveIcon&&N(e.ActiveIcon),description:e.Description||e.Attributes&&e.Attributes.description||"",matches:e.GuidesCount};return e.Children&&e.Children.length&&(t.items=U(e.Children)),t}),v=(i,e)=>i.filter(({Type:t})=>t===e).map(({Id:t,Title:n,Body:s})=>({id:t.toString(),title:n,body:s})),D=i=>i.map(({Id:e,Title:t,DefaultIcon:n,ListNotices:s,Notices:o})=>({id:e.toString(),title:t,symbol:N(n),defaultHeaderOptions:{visible:!!s.length},notifications:(s||[]).concat(o||[]).map(({Id:a,Title:r,Body:c,Type:d,Modified:u})=>({id:a.toString(),title:r,body:c,modified:u,expandable:d==="listNotice"}))})),B=({Id:i,Title:e,DefaultIcon:t,Exits:[n],ExitType:s,ConfirmationText:o,Description:a},r)=>{const{Adapter:c}=n||{Adapter:{}},{ClientName:d="",Settings:u={},CustomClientName:f=""}=c,h={id:i.toString(),title:e,description:a,symbol:N(t),clientName:d==="custom.adapter"?f:d,expanded:!0,inline:!0,body:{}};if(d.indexOf("phone")>-1||d.indexOf("freetext")>-1){const{displayTextBeforeClick:p,textBeforeClick:w}=u;p==="true"&&(h.expanded=!1,h.title=w),d.indexOf("phone.text")>-1?h.body.phoneNumber=u.phoneNumber:h.body.freetext=u.freetext}return(d.indexOf("chat.popup")>-1||d.indexOf("link")>-1||d==="custom.adapter"&&s==="custom")&&(h.body=u,h.body.confirmationFallback=o),d.indexOf("ace")>-1&&(h.body=u),h},E=(i=[])=>i.map(({Id:e,Title:t,TotalMatches:n,Symbol:s,DefaultIcon:o,ActiveIcon:a})=>({id:e.toString(),title:t,matches:n,symbol:N(o||s),defaultIcon:N(o),activeIcon:N(a)})),$=i=>i.map(({Id:e,Title:t,Tags:n,FirstPublishedDate:s,Modified:o})=>({id:e.toString(),title:t,tags:E(n),published:s,modified:o})),Y=(i,e)=>{switch(i){case m.MatchByCategory:case m.Match:{const t={guides:[],matches:0,topNotifications:[],middleNotifications:[],bottomNotifications:[],notificationLists:[],tags:[],byCategory:[]},{Matches:n,TotalMatches:s,Notices:o,NoticeLists:a,Tags:r,ByCategory:c}=e;return t.guides=$(n),t.matches=s,t.byCategory=(c||[]).map(({Id:d,Matches:u,TotalMatches:f})=>({id:d,guides:$(u),matches:f})),t.tags=E(r),t.notificationLists=D(a||[]),t.topNotifications=v(o||[],"noticeRowTop"),t.middleNotifications=v(o||[],"noticeRowMiddle"),t.bottomNotifications=v(o||[],"footerNotice"),t}case m.Categories:{const{Children:t,GuidesCountTotal:n}=e;return{categories:U(t||[]),matches:n}}case m.Guide:{const{Id:t,Title:n,Body:s,Related:o,Options:a,ConnectionId:r,ContactMethods:c,EnableFeedback:d,HandoverExists:u,FirstPublishedDate:f,Modified:h,ModifiedByDisplayName:p,FirstPublishedByDisplayName:w,Categories:y,Tags:l,SeoMetaDescription:g,SeoAllowIndex:L,Perspectives:x,PerspectiveKey:F,Translations:H}=e,ee=F||Object.values(x).find(b=>b===r)||x.Default||null,Q={guide:{id:t.toString(),title:n,body:s,modified:h,published:f,modifiedBy:p,publishedBy:w,connection:r,categories:y,hasHandover:u,allowFeedback:d,seoMetaDescription:g,seoAllowIndex:L,perspectives:x,perspective:ee,translations:Object.keys(H||{}).reduce((b,O)=>(b[O]=H[O].toString(),b),{})},related:$(o||[]),dialog:[],contactMethods:(c||[]).map(b=>B(b)),tags:E(l)};return(a||[]).forEach(({CanAccess:b,Description:O,ConnectionId:te,Properties:C})=>{if(!b)return;const A={id:t.toString(),title:O,connection:te,connectionKey:C.ConnectionKey,type:"default",parent:{id:t.toString(),title:n,tags:E(l)}};if(C.Type==="Guide"||C.Type==="Link")switch(C.Id&&(A.id=C.Id.toString()),C.Uri&&(A.href=C.Uri),C.Target&&(A.target=C.Target),C.Type){case"Guide":A.type="guide";break;case"Link":A.type="link";break}Q.dialog.push(A)}),Q}case m.Contacts:{const{Children:t,Matches:n,Notices:s,NoticeLists:o}=e;return{contactMethods:(n||[]).map(r=>B(r)),categories:U(t||[]),topNotifications:v(s||[],"noticeRowTop"),middleNotifications:v(s||[],"noticeRowMiddle"),bottomNotifications:v(s||[],"footerNotice"),notificationLists:D(o||[])}}case m.ContactMethod:{const{ContactMethod:t}=e;return B(t||{})}case m.Tags:case m.TagsOnGuides:return E(e||[]);case m.Notifications:{const{Notices:t,NoticeLists:n}=e;return{topNotifications:v(t||[],"noticeRowTop"),middleNotifications:v(t||[],"noticeRowMiddle"),bottomNotifications:v(t||[],"footerNotice"),notificationLists:D(n||[])}}default:return{}}};var J=(i=>(i.Guide="guide",i.Guides="guides",i.GuidesByCategory="guides-by-category",i.RowNotifications="row-notices",i.NotificationLists="notification-lists",i.GuideCategories="guide-categories",i.ContactMethodCategories="contact-method-categories",i.ContactMethod="contact-method",i.ContactMethods="contact-methods",i.Tags="tags",i.TagsOnGuides="tagsonguides",i))(J||{}),m=(i=>(i.Match="match",i.Categories="categories",i.Guide="guide",i.Contacts="contacts",i.ContactMethod="contact-method",i.MatchByCategory="match-by-category",i.Tags="tags",i.TagsOnGuides="tagsonguides",i.Notifications="notifications",i))(m||{}),X=(i=>(i.Positive="Positive",i.Negative="Negative",i))(X||{}),Z=(i=>(i.POPULARITY_DESCENDING="popularity-descending",i.ALPHABETIC_ASCENDING="alphabetic-ascending",i.ALPHABETIC_DESCENDING="alphabetic-descending",i.MODIFIED_ASCENDING="modified-ascending",i.MODIFIED_DESCENDING="modified-descending",i.PUBLISHED_ASCENDING="published-ascending",i.PUBLISHED_DESCENDING="published-descending",i))(Z||{});const _=i=>{switch(i){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"}},de=async i=>{const{invoke:e}=i.get("$widget");return await e("renderState")===q.hidden};class I{constructor(e,t){this.container=e,this.matchingClient=t,this.queries=new Map,this.getUnresolvedQueries=()=>{let n=0;return this.queries.forEach((s,o)=>{s.some(r=>!r.resolved)&&(n=1)}),n},this.events=e.get("$widget").events,this.events.subscribe("widget:settings-updated",()=>this.queries=new Map),this.events.subscribe("widget:render-state-changed",(n,{next:s,previous:o})=>{o===q.hidden&&s===q.open&&this.fetchAllUnresolvedQueries()})}static getInstance(e,t="dataClient"){return re(this)(()=>e.getAsync(t).then(async n=>{let s=await e.getAsync("matchingClient");s||(s=await K(e),e.registerAsync("matchingClient",()=>s));let o=n;return o||(o=new I(e,s),e.registerAsync(t,()=>o)),o}))}fetch(e,t,n){return new Promise((s,o)=>{t.take,ae(t);const a=_(e);let r=this.queries.get(a)||[],c=r.find(d=>R(d.params,t))||null;if(c&&(n!=null&&n.noCache)){const d=r.findIndex(u=>R(u.params,t));r=[...r.slice(0,d),...r.slice(d+1)],c=null}if(c){const d=r.indexOf(c);if(c.resolved?(this.events.dispatch("data-client:fetched",{params:t,type:a,response:c.data,unresolvedQueries:this.getUnresolvedQueries()}),this.track(c.data,a,c.error),c.data&&c.error?o({error:c.error}):s(c.data)):c.resolvers.push({resolve:s,reject:o}),r.splice(d,1),r.push(c),this.queries.set(a,r),!c.loading&&!c.resolved)return this.runQuery(a,t)}else return r.push({params:t,resolved:!1,loading:!0,data:{},resolvers:[{resolve:s,reject:o}]}),this.queries.set(a,r),this.runQuery(a,t)}).then(s=>V(s))}read(e,t){const{select:n}=t,s=_(e);return(this.queries.get(s)||[]).reduce((r,c)=>{if(typeof n=="function"){const d=n(c.data);d&&r.push(d)}else r.push(c.data);return r},[])}feedback(e,t,n){return this.matchingClient.giveFeedback(e,t,n)}setLoadingStatus(e,t,n){const s=this.queries.get(e)||[],o=s.find(a=>R(a.params,t));o&&(o.loading=n),this.queries.set(e,s)}async runQuery(e,t){const{searchPhrase:n="",categories:s="0",contactMethodCategoryId:o="0",contactMethodId:a="0",tagId:r=void 0,take:c=5,connection:d="",guideId:u,expandCategories:f="descendants",currentCategory:h,sorting:p="popularity-descending",guideIds:w=[]}=t,y=n.toString().trim();if(await de(this.container))return Promise.resolve();switch(e){case"match":{const l=g=>{const[L,x]=g.split("-");return{type:new Map([["popularity","popularity"],["alphabetic","title"],["modified","lastModified"],["published","firstPublished"]]).get(L),direction:x}};return w.length?this.matchingClient.customRequest("guides","POST",{configuration:{ids:w,take:+c}}).then(g=>g&&this.handleResponse(g,e,t)):this.matchingClient.match(y,{categories:s==="0"?[]:Array.isArray(s)?s:[+s],take:+c,tags:r,sorting:l(p),ids:w}).then(g=>g&&this.handleResponse(g,e,t))}case"match-by-category":return this.matchingClient.match(y,{groupByCategory:!0,categories:s==="0"?[]:Array.isArray(s)?s:[+s],take:+c,tags:r}).then(l=>l&&this.handleResponse(l,e,t));case"guide":return this.matchingClient.getGuide(u,{connectionId:d}).then(l=>{l&&this.handleResponse(l,e,t)}).catch(l=>{const g={message:"Something went wrong.",status:l.status||400};g.status===404&&(g.message="The guide could not be found."),this.handleResponse({},e,t,g)});case"categories":return this.matchingClient.getCategories({phrase:y,expand:f,tags:r}).then(l=>l&&this.handleResponse(l,e,t));case"contacts":return u?this.matchingClient.contactMethods(+u,{phrase:y}).then(l=>l&&this.handleResponse(l,e,t)):this.matchingClient.contacts(+o,{phrase:y}).then(l=>l&&this.handleResponse(l,e,t));case"contact-method":return this.matchingClient.getContactMethod(+a,{guideId:u,currentCategory:h}).then(l=>l&&this.handleResponse(l,e,t));case"tags":return this.matchingClient.customRequest("tags","GET",{configuration:{take:999999,phrase:y,categories:s==="0"?[]:Array.isArray(s)?s:[+s]}}).then(l=>l&&this.handleResponse(l,e,t));case"tagsonguides":return this.matchingClient.customRequest("tagsonguides","GET",{configuration:{take:999999,phrase:y,categories:s==="0"?[]:Array.isArray(s)?s:[+s],tags:r}}).then(l=>l&&this.handleResponse(l,e,t));case"notifications":return this.matchingClient.customRequest("notices","GET",{configuration:{phrase:y,categories:s==="0"?[]:Array.isArray(s)?s:[+s]}}).then(l=>l&&this.handleResponse(l,e,t))}}handleResponse(e={},t,n,s){const o=this.queries.get(t)||[],a=o.find(r=>R(r.params,n));if(a){const r=s||Y(t,e);this.track(r,t,s),a.resolvers.forEach(d=>{s?d.reject({error:r}):d.resolve(r)});const c=o.indexOf(a);c>-1&&o.splice(c,1),o.push({...a,error:s,resolvers:[],data:r,resolved:!0}),this.setLoadingStatus(t,n,!1),this.queries.set(t,o),s||this.events.dispatch("data-client:fetched",{type:t,params:n,response:r,unresolvedQueries:this.getUnresolvedQueries()})}}fetchAllUnresolvedQueries(){for(const[e,t]of this.queries)t.filter(n=>!n.resolved).forEach(n=>{this.runQuery(e,n.params)})}track(e={},t,n){const s=this.container.get("$widget");s&&!n?s.events.dispatch("tracking:service-client-response",{type:t,data:e}):s&&s.events.dispatch("tracking:service-client-error",{type:t,error:n})}static create(e){return e.getAsync("matchingClient").then(async t=>{if(t)return new I(e,t);const n=await K(e);return e.registerAsync("matchingClient",()=>n),new I(e,n)})}getClient(){return this.matchingClient}}const le=async i=>{i.registerAsync("dataClient",()=>I.create(i))};exports.DataClient=I;exports.DataType=J;exports.FeedbackType=X;exports.KnowledgeDataClientPlugin=le;exports.ServiceClientQueryType=m;exports.SortingType=Z;exports.determineServiceClientQueryType=_;exports.formatLegacyData=Y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=(s,e,t,...n)=>{const i=`[${s.get("$environment").name||"webprovisions"}] ${t}`;switch(e){case"info":console.info(i,...n);break;case"warning":console.warn(i,...n);break;case"error":console.error(i,...n);break}},se=s=>{const e=s.container||s;return{info:(t,...n)=>j(e,"info",t,...n),warn:(t,...n)=>j(e,"warning",t,...n),error:(t,...n)=>j(e,"error",t,...n)}};var T=(s=>(s.Implementation="implementation",s.Widget="widget",s))(T||{}),k=(s=>(s.Pre="pre",s.Post="post",s))(k||{});const ie=(s,e,t,n)=>{try{const i=new e(t,n);return{name:s,invoke:(o,a)=>{let r;return i[o]&&(r=i[o].call(i,a)),Promise.resolve(r)},getInstance:()=>i}}catch(i){if(i.message&&i.message.indexOf("is not a constructor")>=0)return{name:s,invoke:o=>{let a;return o==="initialize"&&(a=e(t,n)),Promise.resolve(a)},getInstance:()=>e};throw i}};function W(s,e){return typeof s>"u"?e:s}class ne{constructor(e={}){this.part=e}createCommand(e,t,n){let i;typeof t=="function"?i={scope:T.Widget,stage:k.Post,defaultArgs:void 0,handlerResolver:t}:i={scope:W(t.scope,T.Widget),stage:W(t.stage,k.Post),defaultArgs:t.defaultArgs,handlerResolver:n};let o=this.part;const a=e.split(".");return a.forEach((r,c)=>{c===a.length-1?o[r]||(o[r]=()=>i):o=this.part[r]=this.part[r]||{}}),this}get(){return this.part}}const z=s=>{const e=new ne({});return s(e),e.get()};z(s=>{s.createCommand("types.register",{scope:T.Implementation,stage:k.Pre},e=>(t,n)=>{e.container.get("$types")[t]=n}).createCommand("type",{stage:k.Pre},e=>t=>{e.container.register("$type",t)}).createCommand("settings",{stage:k.Pre,defaultArgs:[null]},e=>t=>{e.events.dispatch("settings:change",t,{bubbles:!0}),e.container.register("$settings",t)}).createCommand("plugin",{stage:k.Pre},e=>(t,n,i)=>{const{container:o}=e;let a=null,r=t,c=n;typeof t=="string"&&(a=t,r=n,c=i);const d=u=>{const{transformPluginSettings:f}=e.container.get("$environmentOptions"),h=f?f(c||{},a,e.container,r):n;try{const p=ie(a,r,o,h);o.get("$plugins").push(p),u&&p.invoke("initialize",null)}catch(p){se(e).warn("Error when initializing plugin",p)}};e.container.get("$instance")?d(!0):e.events.subscribeOnce("widget:instance-created",()=>d(!1))}).createCommand("container.register",e=>(t,n)=>{e.container.register(t,n)}).createCommand("container.registerAsync",e=>(t,n)=>{e.container.registerAsync(t,n)}).createCommand("container.registerFactory",e=>(t,n)=>{e.container.registerFactory(t,n)}).createCommand("container.touch",e=>(t,n)=>{e.container.touch(t,n)}).createCommand("csp",{},e=>t=>{e.container.register("csp",t)})});const G=(s,e,...t)=>typeof e=="string"?s(`[humany] ${e}`,...t):s(e,...t),M=class{constructor(){this.keys=[],this.log=(s,...e)=>this.lookup(s,()=>M.log(...e)),this.warn=(s,...e)=>this.lookup(s,()=>M.warn(...e)),this.error=(s,...e)=>this.lookup(s,()=>M.error(...e)),this.info=(s,...e)=>this.lookup(s,()=>M.info(...e))}lookup(s,e){this.keys.indexOf(s)===-1&&(this.keys.push(s),e())}};let S=M;S.log=(...s)=>G(console.log,...s);S.warn=(...s)=>G(console.warn,...s);S.error=(...s)=>G(console.error,...s);S.info=(...s)=>G(console.info,...s);const V=s=>{let e={},t,n;if(typeof s!="object"||s===null)return s;e=Array.isArray(s)?[]:{};for(n in s)t=s[n],e[n]=typeof t=="object"&&t!==null?V(t):t;return e};class oe{constructor(e,t){this.lockWarningTime=e,this.lockErrorTime=t,this.tasks=[],this.current=Promise.resolve(),this.next=this.next.bind(this)}add(e,t,n,i){this.tasks.push({task:e,resolve:t,reject:n,done:i}),this.next()}next(){this.current=this.current.then(()=>{const e=this.tasks.shift();if(e){let t;const n=setTimeout(()=>{process.env.NODE_ENV!=="production"&&S.warn(`A lock has exceeded ${this.lockWarningTime} ms. Waiting additional ${this.lockErrorTime} ms before rejecting the task.`,e),t=setTimeout(()=>{e.reject("lock timeout exceeded")},this.lockErrorTime)},this.lockWarningTime),i=Promise.resolve(e.task()).then(o=>(clearTimeout(n),clearTimeout(t),o));return Promise.resolve(i).then(this.next).then(()=>i.then(o=>{e.done(),e.resolve(o)})).catch(o=>(e.done(),e.reject(o),this.next()))}return Promise.resolve()})}}const P=new WeakMap;function re(s,e=5e3,t=1e3){return P.has(s)||P.set(s,new oe(e,t)),n=>new Promise((i,o)=>{const a=P.get(s);a.add(n,i,o,()=>{a.tasks.length||P.delete(s)})})}const ae=(s={})=>(Object.keys(s).forEach(e=>{(s[e]===null||typeof s[e]>"u")&&delete s[e]}),s),R=(s,e)=>{let t=!0;return Object.keys(s).length!==Object.keys(e).length||Object.keys(s).some(n=>!Object.keys(e).some(i=>n===i))?!1:(Object.keys(s).forEach(n=>{if(t){const i=typeof s[n]>"u"?"":s[n],o=typeof e[n]>"u"?"":e[n];t=i.toString()===o.toString()}}),t)};z(s=>{s.createCommand("components",e=>t=>{e.events.subscribeOnce("components:platform-created",(n,{platform:i})=>{t.handlers&&t.handlers.forEach(([o,a])=>{i.addComponentHandler(o,a)})})})});var q=(s=>(s.open="open",s.closed="closed",s.hidden="hidden",s))(q||{});const K=s=>Promise.resolve().then(()=>require("./index-B9t-W0wz.js")).then(({ServiceClient:e,ServiceProxy:t})=>s.get("settings").then(n=>{const{name:i,events:o}=s.get("$widget"),{data:{projection:a="",site:r="current",forceHttps:c=!1}}=n,d=new t(a,{credentials:"same-origin"}),u=new e(d,{funnel:i.replace("_contact-method","").replace("_contact",""),site:ce(r,c)},null,s);return o.subscribe("widget:settings-updated",(f,{data:h})=>{h&&h.projection!==a&&u.proxy.setBaseUrl(h.projection)}),u})),ce=(s,e)=>()=>{const t=i=>{const o=document.createElement("a");return o.href=i,o};let n=window.location;return s==="referrer"&&document.referrer&&(n=t(document.referrer)),[e?"https:":"","//",n.host,n.pathname].join("")},N=s=>{if(s){const{Type:e,Content:t}=s;if(e&&t)return{type:e,content:t}}},U=s=>s.map(e=>{const t={id:e.Id.toString(),title:e.Name,symbol:N(e.DefaultIcon),activeSymbol:e.ActiveIcon&&N(e.ActiveIcon),description:e.Description||e.Attributes&&e.Attributes.description||"",matches:e.GuidesCount};return e.Children&&e.Children.length&&(t.items=U(e.Children)),t}),b=(s,e)=>s.filter(({Type:t})=>t===e).map(({Id:t,Title:n,Body:i})=>({id:t.toString(),title:n,body:i})),D=s=>s.map(({Id:e,Title:t,DefaultIcon:n,ListNotices:i,Notices:o})=>({id:e.toString(),title:t,symbol:N(n),defaultHeaderOptions:{visible:!!i.length},notifications:(i||[]).concat(o||[]).map(({Id:a,Title:r,Body:c,Type:d,Modified:u})=>({id:a.toString(),title:r,body:c,modified:u,expandable:d==="listNotice"}))})),B=({Id:s,Title:e,DefaultIcon:t,Exits:[n],ExitType:i,ConfirmationText:o,Description:a},r)=>{const{Adapter:c}=n||{Adapter:{}},{ClientName:d="",Settings:u={},CustomClientName:f=""}=c,h={id:s.toString(),title:e,description:a,symbol:N(t),clientName:d==="custom.adapter"?f:d,expanded:!0,inline:!0,body:{}};if(d.indexOf("phone")>-1||d.indexOf("freetext")>-1){const{displayTextBeforeClick:p,textBeforeClick:w}=u;p==="true"&&(h.expanded=!1,h.title=w),d.indexOf("phone.text")>-1?h.body.phoneNumber=u.phoneNumber:h.body.freetext=u.freetext}return(d.indexOf("chat.popup")>-1||d.indexOf("link")>-1||d==="custom.adapter"&&i==="custom")&&(h.body=u,h.body.confirmationFallback=o),d.indexOf("ace")>-1&&(h.body=u),h},E=(s=[])=>s.map(({Id:e,Title:t,TotalMatches:n,Symbol:i,DefaultIcon:o,ActiveIcon:a})=>({id:e.toString(),title:t,matches:n,symbol:N(o||i),defaultIcon:N(o),activeIcon:N(a)})),$=s=>s.map(({Id:e,Title:t,Tags:n,FirstPublishedDate:i,Modified:o})=>({id:e.toString(),title:t,tags:E(n),published:i,modified:o})),Y=(s,e)=>{switch(s){case m.MatchByCategory:case m.Match:{const t={guides:[],matches:0,topNotifications:[],middleNotifications:[],bottomNotifications:[],notificationLists:[],tags:[],byCategory:[]},{Matches:n,TotalMatches:i,Notices:o,NoticeLists:a,Tags:r,ByCategory:c}=e;return t.guides=$(n),t.matches=i,t.byCategory=(c||[]).map(({Id:d,Matches:u,TotalMatches:f})=>({id:d,guides:$(u),matches:f})),t.tags=E(r),t.notificationLists=D(a||[]),t.topNotifications=b(o||[],"noticeRowTop"),t.middleNotifications=b(o||[],"noticeRowMiddle"),t.bottomNotifications=b(o||[],"footerNotice"),t}case m.Categories:{const{Children:t,GuidesCountTotal:n}=e;return{categories:U(t||[]),matches:n}}case m.Guide:{const{Id:t,Title:n,Body:i,Related:o,Options:a,ConnectionId:r,ContactMethods:c,EnableFeedback:d,HandoverExists:u,FirstPublishedDate:f,Modified:h,ModifiedByDisplayName:p,FirstPublishedByDisplayName:w,Categories:y,Tags:l,SeoMetaDescription:g,SeoAllowIndex:L,Perspectives:x,PerspectiveKey:F,Translations:H}=e,ee=F||Object.values(x).find(v=>v===r)||x.Default||null,Q={guide:{id:t.toString(),title:n,body:i,modified:h,published:f,modifiedBy:p,publishedBy:w,connection:r,categories:y,hasHandover:u,allowFeedback:d,seoMetaDescription:g,seoAllowIndex:L,perspectives:x,perspective:ee,translations:Object.keys(H||{}).reduce((v,O)=>(v[O]=H[O].toString(),v),{})},related:$(o||[]),dialog:[],contactMethods:(c||[]).map(v=>B(v)),tags:E(l)};return(a||[]).forEach(({CanAccess:v,Description:O,ConnectionId:te,Properties:C})=>{if(!v)return;const A={id:t.toString(),title:O,connection:te,connectionKey:C.ConnectionKey,type:"default",parent:{id:t.toString(),title:n,tags:E(l)}};if(C.Type==="Guide"||C.Type==="Link")switch(C.Id&&(A.id=C.Id.toString()),C.Uri&&(A.href=C.Uri),C.Target&&(A.target=C.Target),C.Type){case"Guide":A.type="guide";break;case"Link":A.type="link";break}Q.dialog.push(A)}),Q}case m.Contacts:{const{Children:t,Matches:n,Notices:i,NoticeLists:o}=e;return{contactMethods:(n||[]).map(r=>B(r)),categories:U(t||[]),topNotifications:b(i||[],"noticeRowTop"),middleNotifications:b(i||[],"noticeRowMiddle"),bottomNotifications:b(i||[],"footerNotice"),notificationLists:D(o||[])}}case m.ContactMethod:{const{ContactMethod:t}=e;return B(t||{})}case m.Tags:case m.TagsOnGuides:return E(e||[]);case m.Notifications:{const{Notices:t,NoticeLists:n}=e;return{topNotifications:b(t||[],"noticeRowTop"),middleNotifications:b(t||[],"noticeRowMiddle"),bottomNotifications:b(t||[],"footerNotice"),notificationLists:D(n||[])}}default:return{}}};var J=(s=>(s.Guide="guide",s.Guides="guides",s.GuidesByCategory="guides-by-category",s.RowNotifications="row-notices",s.NotificationLists="notification-lists",s.GuideCategories="guide-categories",s.ContactMethodCategories="contact-method-categories",s.ContactMethod="contact-method",s.ContactMethods="contact-methods",s.Tags="tags",s.TagsOnGuides="tagsonguides",s))(J||{}),m=(s=>(s.Match="match",s.Categories="categories",s.Guide="guide",s.Contacts="contacts",s.ContactMethod="contact-method",s.MatchByCategory="match-by-category",s.Tags="tags",s.TagsOnGuides="tagsonguides",s.Notifications="notifications",s))(m||{}),X=(s=>(s.Positive="Positive",s.Negative="Negative",s))(X||{}),Z=(s=>(s.POPULARITY_DESCENDING="popularity-descending",s.ALPHABETIC_ASCENDING="alphabetic-ascending",s.ALPHABETIC_DESCENDING="alphabetic-descending",s.MODIFIED_ASCENDING="modified-ascending",s.MODIFIED_DESCENDING="modified-descending",s.PUBLISHED_ASCENDING="published-ascending",s.PUBLISHED_DESCENDING="published-descending",s))(Z||{});const _=s=>{switch(s){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"}},de=async s=>{const{invoke:e}=s.get("$widget");return await e("renderState")===q.hidden};class I{constructor(e,t){this.container=e,this.matchingClient=t,this.queries=new Map,this.getUnresolvedQueries=()=>{let n=0;return this.queries.forEach((i,o)=>{i.some(r=>!r.resolved)&&(n=1)}),n},this.events=e.get("$widget").events,this.events.subscribe("widget:settings-updated",()=>this.queries=new Map),this.events.subscribe("widget:render-state-changed",(n,{next:i,previous:o})=>{o===q.hidden&&i===q.open&&this.fetchAllUnresolvedQueries()})}static getInstance(e,t="dataClient"){return re(this)(()=>e.getAsync(t).then(async n=>{let i=await e.getAsync("matchingClient");i||(i=await K(e),e.registerAsync("matchingClient",()=>i));let o=n;return o||(o=new I(e,i),e.registerAsync(t,()=>o)),o}))}fetch(e,t,n){return new Promise((i,o)=>{t.take,ae(t);const a=_(e);let r=this.queries.get(a)||[],c=r.find(d=>R(d.params,t))||null;if(c&&(n!=null&&n.noCache)){const d=r.findIndex(u=>R(u.params,t));r=[...r.slice(0,d),...r.slice(d+1)],c=null}if(c){const d=r.indexOf(c);if(c.resolved?(this.events.dispatch("data-client:fetched",{params:t,type:a,response:c.data,unresolvedQueries:this.getUnresolvedQueries()}),this.track(c.data,a,c.error),c.data&&c.error?o({error:c.error}):i(c.data)):c.resolvers.push({resolve:i,reject:o}),r.splice(d,1),r.push(c),this.queries.set(a,r),!c.loading&&!c.resolved)return this.runQuery(a,t)}else return r.push({params:t,resolved:!1,loading:!0,data:{},resolvers:[{resolve:i,reject:o}]}),this.queries.set(a,r),this.runQuery(a,t)}).then(i=>V(i))}read(e,t){const{select:n}=t,i=_(e);return(this.queries.get(i)||[]).reduce((r,c)=>{if(typeof n=="function"){const d=n(c.data);d&&r.push(d)}else r.push(c.data);return r},[])}feedback(e,t,n){return this.matchingClient.giveFeedback(e,t,n)}setLoadingStatus(e,t,n){const i=this.queries.get(e)||[],o=i.find(a=>R(a.params,t));o&&(o.loading=n),this.queries.set(e,i)}async runQuery(e,t){const{searchPhrase:n="",categories:i="0",contactMethodCategoryId:o="0",contactMethodId:a="0",tagId:r=void 0,take:c=5,connection:d="",guideId:u,expandCategories:f="descendants",currentCategory:h,sorting:p="popularity-descending",guideIds:w=[]}=t,y=n.toString().trim();if(await de(this.container))return Promise.resolve();switch(e){case"match":{const l=g=>{const[L,x]=g.split("-");return{type:new Map([["popularity","popularity"],["alphabetic","title"],["modified","lastModified"],["published","firstPublished"]]).get(L),direction:x}};return w.length?this.matchingClient.customRequest("guides","POST",{configuration:{ids:w,take:+c}}).then(g=>g&&this.handleResponse(g,e,t)):this.matchingClient.match(y,{categories:i==="0"?[]:Array.isArray(i)?i:[+i],take:+c,tags:r,sorting:l(p),ids:w}).then(g=>g&&this.handleResponse(g,e,t))}case"match-by-category":return this.matchingClient.match(y,{groupByCategory:!0,categories:i==="0"?[]:Array.isArray(i)?i:[+i],take:+c,tags:r}).then(l=>l&&this.handleResponse(l,e,t));case"guide":return this.matchingClient.getGuide(u,{connectionId:d}).then(l=>{l&&this.handleResponse(l,e,t)}).catch(l=>{const g={message:"Something went wrong.",status:l.status||400};g.status===404&&(g.message="The guide could not be found."),this.handleResponse({},e,t,g)});case"categories":return this.matchingClient.getCategories({phrase:y,expand:f,tags:r}).then(l=>l&&this.handleResponse(l,e,t));case"contacts":return u?this.matchingClient.contactMethods(+u,{phrase:y}).then(l=>l&&this.handleResponse(l,e,t)):this.matchingClient.contacts(+o,{phrase:y}).then(l=>l&&this.handleResponse(l,e,t));case"contact-method":return this.matchingClient.getContactMethod(+a,{guideId:u,currentCategory:h}).then(l=>l&&this.handleResponse(l,e,t));case"tags":return this.matchingClient.customRequest("tags","GET",{configuration:{take:999999,phrase:y,categories:i==="0"?[]:Array.isArray(i)?i:[+i]}}).then(l=>l&&this.handleResponse(l,e,t));case"tagsonguides":return this.matchingClient.customRequest("tagsonguides","GET",{configuration:{take:999999,phrase:y,categories:i==="0"?[]:Array.isArray(i)?i:[+i],tags:r}}).then(l=>l&&this.handleResponse(l,e,t));case"notifications":return this.matchingClient.customRequest("notices","GET",{configuration:{phrase:y,categories:i==="0"?[]:Array.isArray(i)?i:[+i]}}).then(l=>l&&this.handleResponse(l,e,t))}}handleResponse(e={},t,n,i){const o=this.queries.get(t)||[],a=o.find(r=>R(r.params,n));if(a){const r=i||Y(t,e);this.track(r,t,i),a.resolvers.forEach(d=>{i?d.reject({error:r}):d.resolve(r)});const c=o.indexOf(a);c>-1&&o.splice(c,1),o.push({...a,error:i,resolvers:[],data:r,resolved:!0}),this.setLoadingStatus(t,n,!1),this.queries.set(t,o),i||this.events.dispatch("data-client:fetched",{type:t,params:n,response:r,unresolvedQueries:this.getUnresolvedQueries()})}}fetchAllUnresolvedQueries(){for(const[e,t]of this.queries)t.filter(n=>!n.resolved).forEach(n=>{this.runQuery(e,n.params)})}track(e={},t,n){const i=this.container.get("$widget");i&&!n?i.events.dispatch("tracking:service-client-response",{type:t,data:e}):i&&i.events.dispatch("tracking:service-client-error",{type:t,error:n})}static create(e){return e.getAsync("matchingClient").then(async t=>{if(t)return new I(e,t);const n=await K(e);return e.registerAsync("matchingClient",()=>n),new I(e,n)})}getClient(){return this.matchingClient}}const le=async s=>{s.registerAsync("dataClient",()=>I.create(s))};exports.DataClient=I;exports.DataType=J;exports.FeedbackType=X;exports.KnowledgeDataClientPlugin=le;exports.ServiceClientQueryType=m;exports.SortingType=Z;exports.determineServiceClientQueryType=_;exports.formatLegacyData=Y;
package/index.mjs CHANGED
@@ -1,47 +1,47 @@
1
- const j = (s, e, t, ...n) => {
2
- const i = `[${s.get("$environment").name || "webprovisions"}] ${t}`;
1
+ const j = (s, e, t, ...i) => {
2
+ const n = `[${s.get("$environment").name || "webprovisions"}] ${t}`;
3
3
  switch (e) {
4
4
  case "info":
5
- console.info(i, ...n);
5
+ console.info(n, ...i);
6
6
  break;
7
7
  case "warning":
8
- console.warn(i, ...n);
8
+ console.warn(n, ...i);
9
9
  break;
10
10
  case "error":
11
- console.error(i, ...n);
11
+ console.error(n, ...i);
12
12
  break;
13
13
  }
14
14
  }, X = (s) => {
15
15
  const e = s.container || s;
16
16
  return {
17
- info: (t, ...n) => j(e, "info", t, ...n),
18
- warn: (t, ...n) => j(e, "warning", t, ...n),
19
- error: (t, ...n) => j(e, "error", t, ...n)
17
+ info: (t, ...i) => j(e, "info", t, ...i),
18
+ warn: (t, ...i) => j(e, "warning", t, ...i),
19
+ error: (t, ...i) => j(e, "error", t, ...i)
20
20
  };
21
21
  };
22
22
  var G = /* @__PURE__ */ ((s) => (s.Implementation = "implementation", s.Widget = "widget", s))(G || {}), k = /* @__PURE__ */ ((s) => (s.Pre = "pre", s.Post = "post", s))(k || {});
23
- const Z = (s, e, t, n) => {
23
+ const Z = (s, e, t, i) => {
24
24
  try {
25
- const i = new e(t, n);
25
+ const n = new e(t, i);
26
26
  return {
27
27
  name: s,
28
28
  invoke: (o, c) => {
29
29
  let r;
30
- return i[o] && (r = i[o].call(i, c)), Promise.resolve(r);
30
+ return n[o] && (r = n[o].call(n, c)), Promise.resolve(r);
31
31
  },
32
- getInstance: () => i
32
+ getInstance: () => n
33
33
  };
34
- } catch (i) {
35
- if (i.message && i.message.indexOf("is not a constructor") >= 0)
34
+ } catch (n) {
35
+ if (n.message && n.message.indexOf("is not a constructor") >= 0)
36
36
  return {
37
37
  name: s,
38
38
  invoke: (o) => {
39
39
  let c;
40
- return o === "initialize" && (c = e(t, n)), Promise.resolve(c);
40
+ return o === "initialize" && (c = e(t, i)), Promise.resolve(c);
41
41
  },
42
42
  getInstance: () => e
43
43
  };
44
- throw i;
44
+ throw n;
45
45
  }
46
46
  };
47
47
  function W(s, e) {
@@ -51,23 +51,23 @@ class ee {
51
51
  constructor(e = {}) {
52
52
  this.part = e;
53
53
  }
54
- createCommand(e, t, n) {
55
- let i;
56
- typeof t == "function" ? i = {
54
+ createCommand(e, t, i) {
55
+ let n;
56
+ typeof t == "function" ? n = {
57
57
  scope: G.Widget,
58
58
  stage: k.Post,
59
59
  defaultArgs: void 0,
60
60
  handlerResolver: t
61
- } : i = {
61
+ } : n = {
62
62
  scope: W(t.scope, G.Widget),
63
63
  stage: W(t.stage, k.Post),
64
64
  defaultArgs: t.defaultArgs,
65
- handlerResolver: n
65
+ handlerResolver: i
66
66
  };
67
67
  let o = this.part;
68
68
  const c = e.split(".");
69
69
  return c.forEach((r, a) => {
70
- a === c.length - 1 ? o[r] || (o[r] = () => i) : o = this.part[r] = this.part[r] || {};
70
+ a === c.length - 1 ? o[r] || (o[r] = () => n) : o = this.part[r] = this.part[r] || {};
71
71
  }), this;
72
72
  }
73
73
  get() {
@@ -82,8 +82,8 @@ z((s) => {
82
82
  s.createCommand(
83
83
  "types.register",
84
84
  { scope: G.Implementation, stage: k.Pre },
85
- (e) => (t, n) => {
86
- e.container.get("$types")[t] = n;
85
+ (e) => (t, i) => {
86
+ e.container.get("$types")[t] = i;
87
87
  }
88
88
  ).createCommand(
89
89
  "type",
@@ -104,25 +104,25 @@ z((s) => {
104
104
  ).createCommand(
105
105
  "plugin",
106
106
  { stage: k.Pre },
107
- (e) => (t, n, i) => {
107
+ (e) => (t, i, n) => {
108
108
  const { container: o } = e;
109
- let c = null, r = t, a = n;
110
- typeof t == "string" && (c = t, r = n, a = i);
111
- const d = (h) => {
112
- const { transformPluginSettings: f } = e.container.get("$environmentOptions"), u = f ? f(
109
+ let c = null, r = t, a = i;
110
+ typeof t == "string" && (c = t, r = i, a = n);
111
+ const d = (u) => {
112
+ const { transformPluginSettings: f } = e.container.get("$environmentOptions"), h = f ? f(
113
113
  a || {},
114
114
  c,
115
115
  e.container,
116
116
  r
117
- ) : n;
117
+ ) : i;
118
118
  try {
119
119
  const m = Z(
120
120
  c,
121
121
  r,
122
122
  o,
123
- u
123
+ h
124
124
  );
125
- o.get("$plugins").push(m), h && m.invoke("initialize", null);
125
+ o.get("$plugins").push(m), u && m.invoke("initialize", null);
126
126
  } catch (m) {
127
127
  X(e).warn("Error when initializing plugin", m);
128
128
  }
@@ -131,23 +131,23 @@ z((s) => {
131
131
  }
132
132
  ).createCommand(
133
133
  "container.register",
134
- (e) => (t, n) => {
135
- e.container.register(t, n);
134
+ (e) => (t, i) => {
135
+ e.container.register(t, i);
136
136
  }
137
137
  ).createCommand(
138
138
  "container.registerAsync",
139
- (e) => (t, n) => {
140
- e.container.registerAsync(t, n);
139
+ (e) => (t, i) => {
140
+ e.container.registerAsync(t, i);
141
141
  }
142
142
  ).createCommand(
143
143
  "container.registerFactory",
144
- (e) => (t, n) => {
145
- e.container.registerFactory(t, n);
144
+ (e) => (t, i) => {
145
+ e.container.registerFactory(t, i);
146
146
  }
147
147
  ).createCommand(
148
148
  "container.touch",
149
- (e) => (t, n) => {
150
- e.container.touch(t, n);
149
+ (e) => (t, i) => {
150
+ e.container.touch(t, i);
151
151
  }
152
152
  ).createCommand(
153
153
  "csp",
@@ -171,36 +171,36 @@ O.warn = (...s) => T(console.warn, ...s);
171
171
  O.error = (...s) => T(console.error, ...s);
172
172
  O.info = (...s) => T(console.info, ...s);
173
173
  const V = (s) => {
174
- let e = {}, t, n;
174
+ let e = {}, t, i;
175
175
  if (typeof s != "object" || s === null)
176
176
  return s;
177
177
  e = Array.isArray(s) ? [] : {};
178
- for (n in s)
179
- t = s[n], e[n] = typeof t == "object" && t !== null ? V(t) : t;
178
+ for (i in s)
179
+ t = s[i], e[i] = typeof t == "object" && t !== null ? V(t) : t;
180
180
  return e;
181
181
  };
182
182
  class te {
183
183
  constructor(e, t) {
184
184
  this.lockWarningTime = e, this.lockErrorTime = t, this.tasks = [], this.current = Promise.resolve(), this.next = this.next.bind(this);
185
185
  }
186
- add(e, t, n, i) {
187
- this.tasks.push({ task: e, resolve: t, reject: n, done: i }), this.next();
186
+ add(e, t, i, n) {
187
+ this.tasks.push({ task: e, resolve: t, reject: i, done: n }), this.next();
188
188
  }
189
189
  next() {
190
190
  this.current = this.current.then(() => {
191
191
  const e = this.tasks.shift();
192
192
  if (e) {
193
193
  let t;
194
- const n = setTimeout(() => {
194
+ const i = setTimeout(() => {
195
195
  process.env.NODE_ENV !== "production" && O.warn(
196
196
  `A lock has exceeded ${this.lockWarningTime} ms. Waiting additional ${this.lockErrorTime} ms before rejecting the task.`,
197
197
  e
198
198
  ), t = setTimeout(() => {
199
199
  e.reject("lock timeout exceeded");
200
200
  }, this.lockErrorTime);
201
- }, this.lockWarningTime), i = Promise.resolve(e.task()).then((o) => (clearTimeout(n), clearTimeout(t), o));
202
- return Promise.resolve(i).then(this.next).then(
203
- () => i.then((o) => {
201
+ }, this.lockWarningTime), n = Promise.resolve(e.task()).then((o) => (clearTimeout(i), clearTimeout(t), o));
202
+ return Promise.resolve(n).then(this.next).then(
203
+ () => n.then((o) => {
204
204
  e.done(), e.resolve(o);
205
205
  })
206
206
  ).catch((o) => (e.done(), e.reject(o), this.next()));
@@ -211,21 +211,21 @@ class te {
211
211
  }
212
212
  const S = /* @__PURE__ */ new WeakMap();
213
213
  function se(s, e = 5e3, t = 1e3) {
214
- return S.has(s) || S.set(s, new te(e, t)), (n) => new Promise((i, o) => {
214
+ return S.has(s) || S.set(s, new te(e, t)), (i) => new Promise((n, o) => {
215
215
  const c = S.get(s);
216
- c.add(n, i, o, () => {
216
+ c.add(i, n, o, () => {
217
217
  c.tasks.length || S.delete(s);
218
218
  });
219
219
  });
220
220
  }
221
- const ie = (s = {}) => (Object.keys(s).forEach((e) => {
221
+ const ne = (s = {}) => (Object.keys(s).forEach((e) => {
222
222
  (s[e] === null || typeof s[e] > "u") && delete s[e];
223
223
  }), s), P = (s, e) => {
224
224
  let t = !0;
225
- return Object.keys(s).length !== Object.keys(e).length || Object.keys(s).some((n) => !Object.keys(e).some((i) => n === i)) ? !1 : (Object.keys(s).forEach((n) => {
225
+ return Object.keys(s).length !== Object.keys(e).length || Object.keys(s).some((i) => !Object.keys(e).some((n) => i === n)) ? !1 : (Object.keys(s).forEach((i) => {
226
226
  if (t) {
227
- const i = typeof s[n] > "u" ? "" : s[n], o = typeof e[n] > "u" ? "" : e[n];
228
- t = i.toString() === o.toString();
227
+ const n = typeof s[i] > "u" ? "" : s[i], o = typeof e[i] > "u" ? "" : e[i];
228
+ t = n.toString() === o.toString();
229
229
  }
230
230
  }), t);
231
231
  };
@@ -233,9 +233,9 @@ z((s) => {
233
233
  s.createCommand("components", (e) => (t) => {
234
234
  e.events.subscribeOnce(
235
235
  "components:platform-created",
236
- (n, { platform: i }) => {
236
+ (i, { platform: n }) => {
237
237
  t.handlers && t.handlers.forEach(([o, c]) => {
238
- i.addComponentHandler(o, c);
238
+ n.addComponentHandler(o, c);
239
239
  });
240
240
  }
241
241
  );
@@ -243,35 +243,35 @@ z((s) => {
243
243
  });
244
244
  var q = /* @__PURE__ */ ((s) => (s.open = "open", s.closed = "closed", s.hidden = "hidden", s))(q || {});
245
245
  const Q = (s) => import("./index-BpmTFodb.mjs").then(
246
- ({ ServiceClient: e, ServiceProxy: t }) => s.get("settings").then((n) => {
247
- const { name: i, events: o } = s.get("$widget"), {
246
+ ({ ServiceClient: e, ServiceProxy: t }) => s.get("settings").then((i) => {
247
+ const { name: n, events: o } = s.get("$widget"), {
248
248
  data: { projection: c = "", site: r = "current", forceHttps: a = !1 }
249
- } = n, d = new t(c, {
249
+ } = i, d = new t(c, {
250
250
  credentials: "same-origin"
251
- }), h = new e(
251
+ }), u = new e(
252
252
  d,
253
253
  {
254
- funnel: i.replace("_contact-method", "").replace("_contact", ""),
255
- site: ne(r, a)
254
+ funnel: n.replace("_contact-method", "").replace("_contact", ""),
255
+ site: ie(r, a)
256
256
  },
257
257
  null,
258
258
  s
259
259
  );
260
- return o.subscribe("widget:settings-updated", (f, { data: u }) => {
261
- u && u.projection !== c && h.proxy.setBaseUrl(u.projection);
262
- }), h;
260
+ return o.subscribe("widget:settings-updated", (f, { data: h }) => {
261
+ h && h.projection !== c && u.proxy.setBaseUrl(h.projection);
262
+ }), u;
263
263
  })
264
- ), ne = (s, e) => () => {
265
- const t = (i) => {
264
+ ), ie = (s, e) => () => {
265
+ const t = (n) => {
266
266
  const o = document.createElement("a");
267
- return o.href = i, o;
267
+ return o.href = n, o;
268
268
  };
269
- let n = window.location;
270
- return s === "referrer" && document.referrer && (n = t(document.referrer)), [
269
+ let i = window.location;
270
+ return s === "referrer" && document.referrer && (i = t(document.referrer)), [
271
271
  e ? "https:" : "",
272
272
  "//",
273
- n.host,
274
- n.pathname
273
+ i.host,
274
+ i.pathname
275
275
  ].join("");
276
276
  }, N = (s) => {
277
277
  if (s) {
@@ -289,34 +289,34 @@ const Q = (s) => import("./index-BpmTFodb.mjs").then(
289
289
  matches: e.GuidesCount
290
290
  };
291
291
  return e.Children && e.Children.length && (t.items = U(e.Children)), t;
292
- }), b = (s, e) => s.filter(({ Type: t }) => t === e).map(({ Id: t, Title: n, Body: i }) => ({
292
+ }), b = (s, e) => s.filter(({ Type: t }) => t === e).map(({ Id: t, Title: i, Body: n }) => ({
293
293
  id: t.toString(),
294
- title: n,
295
- body: i
296
- })), B = (s) => s.map(({ Id: e, Title: t, DefaultIcon: n, ListNotices: i, Notices: o }) => ({
294
+ title: i,
295
+ body: n
296
+ })), B = (s) => s.map(({ Id: e, Title: t, DefaultIcon: i, ListNotices: n, Notices: o }) => ({
297
297
  id: e.toString(),
298
298
  title: t,
299
- symbol: N(n),
299
+ symbol: N(i),
300
300
  defaultHeaderOptions: {
301
- visible: !!i.length
301
+ visible: !!n.length
302
302
  },
303
- notifications: (i || []).concat(o || []).map(({ Id: c, Title: r, Body: a, Type: d, Modified: h }) => ({
303
+ notifications: (n || []).concat(o || []).map(({ Id: c, Title: r, Body: a, Type: d, Modified: u }) => ({
304
304
  id: c.toString(),
305
305
  title: r,
306
306
  body: a,
307
- modified: h,
307
+ modified: u,
308
308
  expandable: d === "listNotice"
309
309
  }))
310
310
  })), $ = ({
311
311
  Id: s,
312
312
  Title: e,
313
313
  DefaultIcon: t,
314
- Exits: [n],
315
- ExitType: i,
314
+ Exits: [i],
315
+ ExitType: n,
316
316
  ConfirmationText: o,
317
317
  Description: c
318
318
  }, r) => {
319
- const { Adapter: a } = n || { Adapter: {} }, { ClientName: d = "", Settings: h = {}, CustomClientName: f = "" } = a, u = {
319
+ const { Adapter: a } = i || { Adapter: {} }, { ClientName: d = "", Settings: u = {}, CustomClientName: f = "" } = a, h = {
320
320
  id: s.toString(),
321
321
  title: e,
322
322
  description: c,
@@ -327,24 +327,24 @@ const Q = (s) => import("./index-BpmTFodb.mjs").then(
327
327
  body: {}
328
328
  };
329
329
  if (d.indexOf("phone") > -1 || d.indexOf("freetext") > -1) {
330
- const { displayTextBeforeClick: m, textBeforeClick: w } = h;
331
- m === "true" && (u.expanded = !1, u.title = w), d.indexOf("phone.text") > -1 ? u.body.phoneNumber = h.phoneNumber : u.body.freetext = h.freetext;
330
+ const { displayTextBeforeClick: m, textBeforeClick: w } = u;
331
+ m === "true" && (h.expanded = !1, h.title = w), d.indexOf("phone.text") > -1 ? h.body.phoneNumber = u.phoneNumber : h.body.freetext = u.freetext;
332
332
  }
333
- return (d.indexOf("chat.popup") > -1 || d.indexOf("link") > -1 || d === "custom.adapter" && i === "custom") && (u.body = h, u.body.confirmationFallback = o), d.indexOf("ace") > -1 && (u.body = h), u;
333
+ return (d.indexOf("chat.popup") > -1 || d.indexOf("link") > -1 || d === "custom.adapter" && n === "custom") && (h.body = u, h.body.confirmationFallback = o), d.indexOf("ace") > -1 && (h.body = u), h;
334
334
  }, M = (s = []) => s.map(
335
- ({ Id: e, Title: t, TotalMatches: n, Symbol: i, DefaultIcon: o, ActiveIcon: c }) => ({
335
+ ({ Id: e, Title: t, TotalMatches: i, Symbol: n, DefaultIcon: o, ActiveIcon: c }) => ({
336
336
  id: e.toString(),
337
337
  title: t,
338
- matches: n,
339
- symbol: N(o || i),
338
+ matches: i,
339
+ symbol: N(o || n),
340
340
  defaultIcon: N(o),
341
341
  activeIcon: N(c)
342
342
  })
343
- ), D = (s) => s.map(({ Id: e, Title: t, Tags: n, FirstPublishedDate: i, Modified: o }) => ({
343
+ ), D = (s) => s.map(({ Id: e, Title: t, Tags: i, FirstPublishedDate: n, Modified: o }) => ({
344
344
  id: e.toString(),
345
345
  title: t,
346
- tags: M(n),
347
- published: i,
346
+ tags: M(i),
347
+ published: n,
348
348
  modified: o
349
349
  })), oe = (s, e) => {
350
350
  switch (s) {
@@ -360,41 +360,41 @@ const Q = (s) => import("./index-BpmTFodb.mjs").then(
360
360
  tags: [],
361
361
  byCategory: []
362
362
  }, {
363
- Matches: n,
364
- TotalMatches: i,
363
+ Matches: i,
364
+ TotalMatches: n,
365
365
  Notices: o,
366
366
  NoticeLists: c,
367
367
  Tags: r,
368
368
  ByCategory: a
369
369
  } = e;
370
- return t.guides = D(n), t.matches = i, t.byCategory = (a || []).map(
371
- ({ Id: d, Matches: h, TotalMatches: f }) => ({
370
+ return t.guides = D(i), t.matches = n, t.byCategory = (a || []).map(
371
+ ({ Id: d, Matches: u, TotalMatches: f }) => ({
372
372
  id: d,
373
- guides: D(h),
373
+ guides: D(u),
374
374
  matches: f
375
375
  })
376
376
  ), t.tags = M(r), t.notificationLists = B(c || []), t.topNotifications = b(o || [], "noticeRowTop"), t.middleNotifications = b(o || [], "noticeRowMiddle"), t.bottomNotifications = b(o || [], "footerNotice"), t;
377
377
  }
378
378
  case C.Categories: {
379
- const { Children: t, GuidesCountTotal: n } = e;
379
+ const { Children: t, GuidesCountTotal: i } = e;
380
380
  return {
381
381
  categories: U(t || []),
382
- matches: n
382
+ matches: i
383
383
  };
384
384
  }
385
385
  case C.Guide: {
386
386
  const {
387
387
  Id: t,
388
- Title: n,
389
- Body: i,
388
+ Title: i,
389
+ Body: n,
390
390
  Related: o,
391
391
  Options: c,
392
392
  ConnectionId: r,
393
393
  ContactMethods: a,
394
394
  EnableFeedback: d,
395
- HandoverExists: h,
395
+ HandoverExists: u,
396
396
  FirstPublishedDate: f,
397
- Modified: u,
397
+ Modified: h,
398
398
  ModifiedByDisplayName: m,
399
399
  FirstPublishedByDisplayName: w,
400
400
  Categories: p,
@@ -409,15 +409,15 @@ const Q = (s) => import("./index-BpmTFodb.mjs").then(
409
409
  ) || I.Default || null, F = {
410
410
  guide: {
411
411
  id: t.toString(),
412
- title: n,
413
- body: i,
414
- modified: u,
412
+ title: i,
413
+ body: n,
414
+ modified: h,
415
415
  published: f,
416
416
  modifiedBy: m,
417
417
  publishedBy: w,
418
418
  connection: r,
419
419
  categories: p,
420
- hasHandover: h,
420
+ hasHandover: u,
421
421
  allowFeedback: d,
422
422
  seoMetaDescription: g,
423
423
  seoAllowIndex: L,
@@ -444,7 +444,7 @@ const Q = (s) => import("./index-BpmTFodb.mjs").then(
444
444
  type: "default",
445
445
  parent: {
446
446
  id: t.toString(),
447
- title: n,
447
+ title: i,
448
448
  tags: M(l)
449
449
  }
450
450
  };
@@ -464,18 +464,18 @@ const Q = (s) => import("./index-BpmTFodb.mjs").then(
464
464
  case C.Contacts: {
465
465
  const {
466
466
  Children: t,
467
- Matches: n,
468
- Notices: i,
467
+ Matches: i,
468
+ Notices: n,
469
469
  NoticeLists: o
470
470
  } = e;
471
471
  return {
472
- contactMethods: (n || []).map(
472
+ contactMethods: (i || []).map(
473
473
  (r) => $(r)
474
474
  ),
475
475
  categories: U(t || []),
476
- topNotifications: b(i || [], "noticeRowTop"),
477
- middleNotifications: b(i || [], "noticeRowMiddle"),
478
- bottomNotifications: b(i || [], "footerNotice"),
476
+ topNotifications: b(n || [], "noticeRowTop"),
477
+ middleNotifications: b(n || [], "noticeRowMiddle"),
478
+ bottomNotifications: b(n || [], "footerNotice"),
479
479
  notificationLists: B(o || [])
480
480
  };
481
481
  }
@@ -487,12 +487,12 @@ const Q = (s) => import("./index-BpmTFodb.mjs").then(
487
487
  case C.TagsOnGuides:
488
488
  return M(e || []);
489
489
  case C.Notifications: {
490
- const { Notices: t, NoticeLists: n } = e;
490
+ const { Notices: t, NoticeLists: i } = e;
491
491
  return {
492
492
  topNotifications: b(t || [], "noticeRowTop"),
493
493
  middleNotifications: b(t || [], "noticeRowMiddle"),
494
494
  bottomNotifications: b(t || [], "footerNotice"),
495
- notificationLists: B(n || [])
495
+ notificationLists: B(i || [])
496
496
  };
497
497
  }
498
498
  default:
@@ -532,36 +532,36 @@ const K = (s) => {
532
532
  class E {
533
533
  constructor(e, t) {
534
534
  this.container = e, this.matchingClient = t, this.queries = /* @__PURE__ */ new Map(), this.getUnresolvedQueries = () => {
535
- let n = 0;
536
- return this.queries.forEach((i, o) => {
537
- i.some((r) => !r.resolved) && (n = 1);
538
- }), n;
535
+ let i = 0;
536
+ return this.queries.forEach((n, o) => {
537
+ n.some((r) => !r.resolved) && (i = 1);
538
+ }), i;
539
539
  }, this.events = e.get("$widget").events, this.events.subscribe(
540
540
  "widget:settings-updated",
541
541
  () => this.queries = /* @__PURE__ */ new Map()
542
542
  ), this.events.subscribe(
543
543
  "widget:render-state-changed",
544
- (n, { next: i, previous: o }) => {
545
- o === q.hidden && i === q.open && this.fetchAllUnresolvedQueries();
544
+ (i, { next: n, previous: o }) => {
545
+ o === q.hidden && n === q.open && this.fetchAllUnresolvedQueries();
546
546
  }
547
547
  );
548
548
  }
549
549
  static getInstance(e, t = "dataClient") {
550
- return se(this)(() => e.getAsync(t).then(async (n) => {
551
- let i = await e.getAsync("matchingClient");
552
- i || (i = await Q(e), e.registerAsync("matchingClient", () => i));
553
- let o = n;
554
- return o || (o = new E(e, i), e.registerAsync(t, () => o)), o;
550
+ return se(this)(() => e.getAsync(t).then(async (i) => {
551
+ let n = await e.getAsync("matchingClient");
552
+ n || (n = await Q(e), e.registerAsync("matchingClient", () => n));
553
+ let o = i;
554
+ return o || (o = new E(e, n), e.registerAsync(t, () => o)), o;
555
555
  }));
556
556
  }
557
- fetch(e, t, n) {
558
- return new Promise((i, o) => {
559
- t.take, ie(t);
557
+ fetch(e, t, i) {
558
+ return new Promise((n, o) => {
559
+ t.take, ne(t);
560
560
  const c = K(e);
561
561
  let r = this.queries.get(c) || [], a = r.find((d) => P(d.params, t)) || null;
562
- if (a && (n != null && n.noCache)) {
562
+ if (a && (i != null && i.noCache)) {
563
563
  const d = r.findIndex(
564
- (h) => P(h.params, t)
564
+ (u) => P(u.params, t)
565
565
  );
566
566
  r = [...r.slice(0, d), ...r.slice(d + 1)], a = null;
567
567
  }
@@ -572,7 +572,7 @@ class E {
572
572
  type: c,
573
573
  response: a.data,
574
574
  unresolvedQueries: this.getUnresolvedQueries()
575
- }), this.track(a.data, c, a.error), a.data && a.error ? o({ error: a.error }) : i(a.data)) : a.resolvers.push({ resolve: i, reject: o }), r.splice(d, 1), r.push(a), this.queries.set(c, r), !a.loading && !a.resolved)
575
+ }), this.track(a.data, c, a.error), a.data && a.error ? o({ error: a.error }) : n(a.data)) : a.resolvers.push({ resolve: n, reject: o }), r.splice(d, 1), r.push(a), this.queries.set(c, r), !a.loading && !a.resolved)
576
576
  return this.runQuery(c, t);
577
577
  } else
578
578
  return r.push({
@@ -580,44 +580,44 @@ class E {
580
580
  resolved: !1,
581
581
  loading: !0,
582
582
  data: {},
583
- resolvers: [{ resolve: i, reject: o }]
583
+ resolvers: [{ resolve: n, reject: o }]
584
584
  }), this.queries.set(c, r), this.runQuery(c, t);
585
- }).then((i) => V(i));
585
+ }).then((n) => V(n));
586
586
  }
587
587
  // query the cached data
588
588
  read(e, t) {
589
- const { select: n } = t, i = K(e);
590
- return (this.queries.get(i) || []).reduce((r, a) => {
591
- if (typeof n == "function") {
592
- const d = n(a.data);
589
+ const { select: i } = t, n = K(e);
590
+ return (this.queries.get(n) || []).reduce((r, a) => {
591
+ if (typeof i == "function") {
592
+ const d = i(a.data);
593
593
  d && r.push(d);
594
594
  } else
595
595
  r.push(a.data);
596
596
  return r;
597
597
  }, []);
598
598
  }
599
- feedback(e, t, n) {
600
- return this.matchingClient.giveFeedback(e, t, n);
599
+ feedback(e, t, i) {
600
+ return this.matchingClient.giveFeedback(e, t, i);
601
601
  }
602
- setLoadingStatus(e, t, n) {
603
- const i = this.queries.get(e) || [], o = i.find((c) => P(c.params, t));
604
- o && (o.loading = n), this.queries.set(e, i);
602
+ setLoadingStatus(e, t, i) {
603
+ const n = this.queries.get(e) || [], o = n.find((c) => P(c.params, t));
604
+ o && (o.loading = i), this.queries.set(e, n);
605
605
  }
606
606
  async runQuery(e, t) {
607
607
  const {
608
- searchPhrase: n = "",
609
- categories: i = "0",
608
+ searchPhrase: i = "",
609
+ categories: n = "0",
610
610
  contactMethodCategoryId: o = "0",
611
611
  contactMethodId: c = "0",
612
612
  tagId: r = void 0,
613
613
  take: a = 5,
614
614
  connection: d = "",
615
- guideId: h,
615
+ guideId: u,
616
616
  expandCategories: f = "descendants",
617
- currentCategory: u,
617
+ currentCategory: h,
618
618
  sorting: m = "popularity-descending",
619
619
  guideIds: w = []
620
- } = t, p = n.toString().trim();
620
+ } = t, p = i.toString().trim();
621
621
  if (await de(this.container))
622
622
  return Promise.resolve();
623
623
  switch (e) {
@@ -639,7 +639,7 @@ class E {
639
639
  }).then(
640
640
  (g) => g && this.handleResponse(g, e, t)
641
641
  ) : this.matchingClient.match(p, {
642
- categories: i === "0" ? [] : Array.isArray(i) ? i : [+i],
642
+ categories: n === "0" ? [] : Array.isArray(n) ? n : [+n],
643
643
  take: +a,
644
644
  tags: r,
645
645
  sorting: l(m),
@@ -651,14 +651,14 @@ class E {
651
651
  case "match-by-category":
652
652
  return this.matchingClient.match(p, {
653
653
  groupByCategory: !0,
654
- categories: i === "0" ? [] : Array.isArray(i) ? i : [+i],
654
+ categories: n === "0" ? [] : Array.isArray(n) ? n : [+n],
655
655
  take: +a,
656
656
  tags: r
657
657
  }).then(
658
658
  (l) => l && this.handleResponse(l, e, t)
659
659
  );
660
660
  case "guide":
661
- return this.matchingClient.getGuide(h, { connectionId: d }).then((l) => {
661
+ return this.matchingClient.getGuide(u, { connectionId: d }).then((l) => {
662
662
  l && this.handleResponse(l, e, t);
663
663
  }).catch((l) => {
664
664
  const g = {
@@ -676,13 +676,13 @@ class E {
676
676
  (l) => l && this.handleResponse(l, e, t)
677
677
  );
678
678
  case "contacts":
679
- return h ? this.matchingClient.contactMethods(+h, { phrase: p }).then(
679
+ return u ? this.matchingClient.contactMethods(+u, { phrase: p }).then(
680
680
  (l) => l && this.handleResponse(l, e, t)
681
681
  ) : this.matchingClient.contacts(+o, { phrase: p }).then(
682
682
  (l) => l && this.handleResponse(l, e, t)
683
683
  );
684
684
  case "contact-method":
685
- return this.matchingClient.getContactMethod(+c, { guideId: h, currentCategory: u }).then(
685
+ return this.matchingClient.getContactMethod(+c, { guideId: u, currentCategory: h }).then(
686
686
  (l) => l && this.handleResponse(l, e, t)
687
687
  );
688
688
  case "tags":
@@ -690,7 +690,7 @@ class E {
690
690
  configuration: {
691
691
  take: 999999,
692
692
  phrase: p,
693
- categories: i === "0" ? [] : Array.isArray(i) ? i : [+i]
693
+ categories: n === "0" ? [] : Array.isArray(n) ? n : [+n]
694
694
  }
695
695
  }).then(
696
696
  (l) => l && this.handleResponse(l, e, t)
@@ -700,7 +700,7 @@ class E {
700
700
  configuration: {
701
701
  take: 999999,
702
702
  phrase: p,
703
- categories: i === "0" ? [] : Array.isArray(i) ? i : [+i],
703
+ categories: n === "0" ? [] : Array.isArray(n) ? n : [+n],
704
704
  tags: r
705
705
  }
706
706
  }).then(
@@ -710,30 +710,30 @@ class E {
710
710
  return this.matchingClient.customRequest("notices", "GET", {
711
711
  configuration: {
712
712
  phrase: p,
713
- categories: i === "0" ? [] : Array.isArray(i) ? i : [+i]
713
+ categories: n === "0" ? [] : Array.isArray(n) ? n : [+n]
714
714
  }
715
715
  }).then(
716
716
  (l) => l && this.handleResponse(l, e, t)
717
717
  );
718
718
  }
719
719
  }
720
- handleResponse(e = {}, t, n, i) {
721
- const o = this.queries.get(t) || [], c = o.find((r) => P(r.params, n));
720
+ handleResponse(e = {}, t, i, n) {
721
+ const o = this.queries.get(t) || [], c = o.find((r) => P(r.params, i));
722
722
  if (c) {
723
- const r = i || oe(t, e);
724
- this.track(r, t, i), c.resolvers.forEach((d) => {
725
- i ? d.reject({ error: r }) : d.resolve(r);
723
+ const r = n || oe(t, e);
724
+ this.track(r, t, n), c.resolvers.forEach((d) => {
725
+ n ? d.reject({ error: r }) : d.resolve(r);
726
726
  });
727
727
  const a = o.indexOf(c);
728
728
  a > -1 && o.splice(a, 1), o.push({
729
729
  ...c,
730
- error: i,
730
+ error: n,
731
731
  resolvers: [],
732
732
  data: r,
733
733
  resolved: !0
734
- }), this.setLoadingStatus(t, n, !1), this.queries.set(t, o), i || this.events.dispatch("data-client:fetched", {
734
+ }), this.setLoadingStatus(t, i, !1), this.queries.set(t, o), n || this.events.dispatch("data-client:fetched", {
735
735
  type: t,
736
- params: n,
736
+ params: i,
737
737
  response: r,
738
738
  unresolvedQueries: this.getUnresolvedQueries()
739
739
  });
@@ -741,26 +741,26 @@ class E {
741
741
  }
742
742
  fetchAllUnresolvedQueries() {
743
743
  for (const [e, t] of this.queries)
744
- t.filter((n) => !n.resolved).forEach((n) => {
745
- this.runQuery(e, n.params);
744
+ t.filter((i) => !i.resolved).forEach((i) => {
745
+ this.runQuery(e, i.params);
746
746
  });
747
747
  }
748
- track(e = {}, t, n) {
749
- const i = this.container.get("$widget");
750
- i && !n ? i.events.dispatch("tracking:service-client-response", {
748
+ track(e = {}, t, i) {
749
+ const n = this.container.get("$widget");
750
+ n && !i ? n.events.dispatch("tracking:service-client-response", {
751
751
  type: t,
752
752
  data: e
753
- }) : i && i.events.dispatch("tracking:service-client-error", {
753
+ }) : n && n.events.dispatch("tracking:service-client-error", {
754
754
  type: t,
755
- error: n
755
+ error: i
756
756
  });
757
757
  }
758
758
  static create(e) {
759
759
  return e.getAsync("matchingClient").then(async (t) => {
760
760
  if (t)
761
761
  return new E(e, t);
762
- const n = await Q(e);
763
- return e.registerAsync("matchingClient", () => n), new E(e, n);
762
+ const i = await Q(e);
763
+ return e.registerAsync("matchingClient", () => i), new E(e, i);
764
764
  });
765
765
  }
766
766
  getClient() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/knowledge-data-client-flamingo",
3
- "version": "1.1.110-rc.2",
3
+ "version": "1.1.110",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },