@telia-ace/knowledge-data-client-flamingo 1.1.139-rc.13 → 1.1.139-rc.14

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 +35 -32
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -1 +1 @@
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 q=(s=>(s.Implementation="implementation",s.Widget="widget",s))(q||{}),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 K(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:q.Widget,stage:k.Post,defaultArgs:void 0,handlerResolver:t}:i={scope:K(t.scope,q.Widget),stage:K(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:q.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 P=(s,e,...t)=>typeof e=="string"?s(`[humany] ${e}`,...t):s(e,...t),M=class E{constructor(){this.keys=[],this.log=(e,...t)=>this.lookup(e,()=>E.log(...t)),this.warn=(e,...t)=>this.lookup(e,()=>E.warn(...t)),this.error=(e,...t)=>this.lookup(e,()=>E.error(...t)),this.info=(e,...t)=>this.lookup(e,()=>E.info(...t))}lookup(e,t){this.keys.indexOf(e)===-1&&(this.keys.push(e),t())}};M.log=(...s)=>P(console.log,...s),M.warn=(...s)=>P(console.warn,...s),M.error=(...s)=>P(console.error,...s),M.info=(...s)=>P(console.info,...s);let oe=M;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 re{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"&&oe.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 R=new WeakMap;function ae(s,e=5e3,t=1e3){return R.has(s)||R.set(s,new re(e,t)),n=>new Promise((i,o)=>{const a=R.get(s);a.add(n,i,o,()=>{a.tasks.length||R.delete(s)})})}const ce=(s={})=>(Object.keys(s).forEach(e=>{(s[e]===null||typeof s[e]>"u")&&delete s[e]}),s),T=(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 G=(s=>(s.open="open",s.closed="closed",s.hidden="hidden",s))(G||{});const _=s=>Promise.resolve().then(()=>require("./index-WiNloX2z.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:de(r,c)},null,s);return o.subscribe("widget:settings-updated",(f,{data:h})=>{h&&h.projection!==a&&u.proxy.setBaseUrl(h.projection)}),u})),de=(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}),v=(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},S=(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:S(n),published:i,modified:o})),X=(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=S(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: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:Q}=e,ee=F||Object.values(x).find(b=>b===r)||x.Default||null,W={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(Q||{}).reduce((b,O)=>(b[O]=Q[O].toString(),b),{})},related:$(o||[]),dialog:[],contactMethods:(c||[]).map(b=>B(b)),tags:S(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:S(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}W.dialog.push(A)}),W}case m.Contacts:{const{Children:t,Matches:n,Notices:i,NoticeLists:o}=e;return{contactMethods:(n||[]).map(r=>B(r)),categories:U(t||[]),topNotifications:v(i||[],"noticeRowTop"),middleNotifications:v(i||[],"noticeRowMiddle"),bottomNotifications:v(i||[],"footerNotice"),notificationLists:D(o||[])}}case m.ContactMethod:{const{ContactMethod:t}=e;return B(t||{})}case m.Tags:case m.TagsOnGuides:return S(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 Y=(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))(Y||{}),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||{}),J=(s=>(s.Positive="Positive",s.Negative="Negative",s))(J||{}),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 H=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"}},le=async s=>{const{invoke:e}=s.get("$widget");return await e("renderState")===G.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===G.hidden&&i===G.open&&this.fetchAllUnresolvedQueries()})}static getInstance(e,t="dataClient"){return ae(this)(()=>e.getAsync(t).then(async n=>{let i=await e.getAsync("matchingClient");i||(i=await _(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,ce(t);const a=H(e);let r=this.queries.get(a)||[],c=r.find(d=>T(d.params,t))||null;if(c&&(n!=null&&n.noCache)){const d=r.findIndex(u=>T(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=H(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=>T(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 le(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=>T(r.params,n));if(a){const r=i||X(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 _(e);return e.registerAsync("matchingClient",()=>n),new I(e,n)})}getClient(){return this.matchingClient}}const ue=async s=>{s.registerAsync("dataClient",()=>I.create(s))};exports.DataClient=I;exports.DataType=Y;exports.FeedbackType=J;exports.KnowledgeDataClientPlugin=ue;exports.ServiceClientQueryType=m;exports.SortingType=Z;exports.determineServiceClientQueryType=H;exports.formatLegacyData=X;
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 K(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:K(t.scope,T.Widget),stage:K(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),S=class M{constructor(){this.keys=[],this.log=(e,...t)=>this.lookup(e,()=>M.log(...t)),this.warn=(e,...t)=>this.lookup(e,()=>M.warn(...t)),this.error=(e,...t)=>this.lookup(e,()=>M.error(...t)),this.info=(e,...t)=>this.lookup(e,()=>M.info(...t))}lookup(e,t){this.keys.indexOf(e)===-1&&(this.keys.push(e),t())}};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);let oe=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 re{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"&&oe.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 ae(s,e=5e3,t=1e3){return P.has(s)||P.set(s,new re(e,t)),n=>new Promise((i,o)=>{const a=P.get(s);a.add(n,i,o,()=>{a.tasks.length||P.delete(s)})})}const ce=(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 _=s=>Promise.resolve().then(()=>require("./index-WiNloX2z.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:de(r,c)},null,s);return o.subscribe("widget:settings-updated",(f,{data:h})=>{h&&h.projection!==a&&u.proxy.setBaseUrl(h.projection)}),u})),de=(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}),v=(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})),X=(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=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: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:Q}=e,ee=F||Object.values(x).find(b=>b===r)||x.Default||null,W={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(Q||{}).reduce((b,O)=>(b[O]=Q[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}W.dialog.push(A)}),W}case m.Contacts:{const{Children:t,Matches:n,Notices:i,NoticeLists:o}=e;return{contactMethods:(n||[]).map(r=>B(r)),categories:U(t||[]),topNotifications:v(i||[],"noticeRowTop"),middleNotifications:v(i||[],"noticeRowMiddle"),bottomNotifications:v(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:v(t||[],"noticeRowTop"),middleNotifications:v(t||[],"noticeRowMiddle"),bottomNotifications:v(t||[],"footerNotice"),notificationLists:D(n||[])}}default:return{}}};var Y=(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))(Y||{}),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||{}),J=(s=>(s.Positive="Positive",s.Negative="Negative",s))(J||{}),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 H=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"}},le=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 ae(this)(()=>e.getAsync(t).then(async n=>{let i=await e.getAsync("matchingClient");i||(i=await _(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,ce(t);const a=H(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=H(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 le(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||X(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 _(e);return e.registerAsync("matchingClient",()=>n),new I(e,n)})}getClient(){return this.matchingClient}}const ue=async s=>{s.registerAsync("dataClient",()=>I.create(s))};exports.DataClient=I;exports.DataType=Y;exports.FeedbackType=J;exports.KnowledgeDataClientPlugin=ue;exports.ServiceClientQueryType=m;exports.SortingType=Z;exports.determineServiceClientQueryType=H;exports.formatLegacyData=X;
package/index.mjs CHANGED
@@ -19,7 +19,7 @@ const j = (s, e, t, ...n) => {
19
19
  error: (t, ...n) => j(e, "error", t, ...n)
20
20
  };
21
21
  };
22
- var q = /* @__PURE__ */ ((s) => (s.Implementation = "implementation", s.Widget = "widget", s))(q || {}), k = /* @__PURE__ */ ((s) => (s.Pre = "pre", s.Post = "post", s))(k || {});
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
23
  const Z = (s, e, t, n) => {
24
24
  try {
25
25
  const i = new e(t, n);
@@ -54,12 +54,12 @@ class ee {
54
54
  createCommand(e, t, n) {
55
55
  let i;
56
56
  typeof t == "function" ? i = {
57
- scope: q.Widget,
57
+ scope: G.Widget,
58
58
  stage: k.Post,
59
59
  defaultArgs: void 0,
60
60
  handlerResolver: t
61
61
  } : i = {
62
- scope: _(t.scope, q.Widget),
62
+ scope: _(t.scope, G.Widget),
63
63
  stage: _(t.stage, k.Post),
64
64
  defaultArgs: t.defaultArgs,
65
65
  handlerResolver: n
@@ -81,7 +81,7 @@ const z = (s) => {
81
81
  z((s) => {
82
82
  s.createCommand(
83
83
  "types.register",
84
- { scope: q.Implementation, stage: k.Pre },
84
+ { scope: G.Implementation, stage: k.Pre },
85
85
  (e) => (t, n) => {
86
86
  e.container.get("$types")[t] = n;
87
87
  }
@@ -157,16 +157,19 @@ z((s) => {
157
157
  }
158
158
  );
159
159
  });
160
- const S = (s, e, ...t) => typeof e == "string" ? s(`[humany] ${e}`, ...t) : s(e, ...t), x = class M {
160
+ const T = (s, e, ...t) => typeof e == "string" ? s(`[humany] ${e}`, ...t) : s(e, ...t), O = class x {
161
161
  constructor() {
162
- this.keys = [], this.log = (e, ...t) => this.lookup(e, () => M.log(...t)), this.warn = (e, ...t) => this.lookup(e, () => M.warn(...t)), this.error = (e, ...t) => this.lookup(e, () => M.error(...t)), this.info = (e, ...t) => this.lookup(e, () => M.info(...t));
162
+ this.keys = [], this.log = (e, ...t) => this.lookup(e, () => x.log(...t)), this.warn = (e, ...t) => this.lookup(e, () => x.warn(...t)), this.error = (e, ...t) => this.lookup(e, () => x.error(...t)), this.info = (e, ...t) => this.lookup(e, () => x.info(...t));
163
163
  }
164
164
  lookup(e, t) {
165
165
  this.keys.indexOf(e) === -1 && (this.keys.push(e), t());
166
166
  }
167
167
  };
168
- x.log = (...s) => S(console.log, ...s), x.warn = (...s) => S(console.warn, ...s), x.error = (...s) => S(console.error, ...s), x.info = (...s) => S(console.info, ...s);
169
- let te = x;
168
+ O.log = (...s) => T(console.log, ...s);
169
+ O.warn = (...s) => T(console.warn, ...s);
170
+ O.error = (...s) => T(console.error, ...s);
171
+ O.info = (...s) => T(console.info, ...s);
172
+ let te = O;
170
173
  const V = (s) => {
171
174
  let e = {}, t, n;
172
175
  if (typeof s != "object" || s === null)
@@ -206,18 +209,18 @@ class se {
206
209
  });
207
210
  }
208
211
  }
209
- const P = /* @__PURE__ */ new WeakMap();
212
+ const S = /* @__PURE__ */ new WeakMap();
210
213
  function ie(s, e = 5e3, t = 1e3) {
211
- return P.has(s) || P.set(s, new se(e, t)), (n) => new Promise((i, o) => {
212
- const c = P.get(s);
214
+ return S.has(s) || S.set(s, new se(e, t)), (n) => new Promise((i, o) => {
215
+ const c = S.get(s);
213
216
  c.add(n, i, o, () => {
214
- c.tasks.length || P.delete(s);
217
+ c.tasks.length || S.delete(s);
215
218
  });
216
219
  });
217
220
  }
218
221
  const ne = (s = {}) => (Object.keys(s).forEach((e) => {
219
222
  (s[e] === null || typeof s[e] > "u") && delete s[e];
220
- }), s), G = (s, e) => {
223
+ }), s), P = (s, e) => {
221
224
  let t = !0;
222
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) => {
223
226
  if (t) {
@@ -238,7 +241,7 @@ z((s) => {
238
241
  );
239
242
  });
240
243
  });
241
- var T = /* @__PURE__ */ ((s) => (s.open = "open", s.closed = "closed", s.hidden = "hidden", s))(T || {});
244
+ var q = /* @__PURE__ */ ((s) => (s.open = "open", s.closed = "closed", s.hidden = "hidden", s))(q || {});
242
245
  const K = (s) => import("./index-l7aSOU1E.mjs").then(
243
246
  ({ ServiceClient: e, ServiceProxy: t }) => s.get("settings").then((n) => {
244
247
  const { name: i, events: o } = s.get("$widget"), {
@@ -328,7 +331,7 @@ const K = (s) => import("./index-l7aSOU1E.mjs").then(
328
331
  m === "true" && (u.expanded = !1, u.title = w), d.indexOf("phone.text") > -1 ? u.body.phoneNumber = h.phoneNumber : u.body.freetext = h.freetext;
329
332
  }
330
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;
331
- }, E = (s = []) => s.map(
334
+ }, M = (s = []) => s.map(
332
335
  ({ Id: e, Title: t, TotalMatches: n, Symbol: i, DefaultIcon: o, ActiveIcon: c }) => ({
333
336
  id: e.toString(),
334
337
  title: t,
@@ -340,7 +343,7 @@ const K = (s) => import("./index-l7aSOU1E.mjs").then(
340
343
  ), D = (s) => s.map(({ Id: e, Title: t, Tags: n, FirstPublishedDate: i, Modified: o }) => ({
341
344
  id: e.toString(),
342
345
  title: t,
343
- tags: E(n),
346
+ tags: M(n),
344
347
  published: i,
345
348
  modified: o
346
349
  })), re = (s, e) => {
@@ -370,7 +373,7 @@ const K = (s) => import("./index-l7aSOU1E.mjs").then(
370
373
  guides: D(h),
371
374
  matches: f
372
375
  })
373
- ), t.tags = E(r), t.notificationLists = B(c || []), t.topNotifications = b(o || [], "noticeRowTop"), t.middleNotifications = b(o || [], "noticeRowMiddle"), t.bottomNotifications = b(o || [], "footerNotice"), t;
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;
374
377
  }
375
378
  case C.Categories: {
376
379
  const { Children: t, GuidesCountTotal: n } = e;
@@ -427,7 +430,7 @@ const K = (s) => import("./index-l7aSOU1E.mjs").then(
427
430
  contactMethods: (a || []).map(
428
431
  (v) => $(v)
429
432
  ),
430
- tags: E(l)
433
+ tags: M(l)
431
434
  };
432
435
  return (c || []).forEach(
433
436
  ({ CanAccess: v, Description: R, ConnectionId: Y, Properties: y }) => {
@@ -442,7 +445,7 @@ const K = (s) => import("./index-l7aSOU1E.mjs").then(
442
445
  parent: {
443
446
  id: t.toString(),
444
447
  title: n,
445
- tags: E(l)
448
+ tags: M(l)
446
449
  }
447
450
  };
448
451
  if (y.Type === "Guide" || y.Type === "Link")
@@ -482,7 +485,7 @@ const K = (s) => import("./index-l7aSOU1E.mjs").then(
482
485
  }
483
486
  case C.Tags:
484
487
  case C.TagsOnGuides:
485
- return E(e || []);
488
+ return M(e || []);
486
489
  case C.Notifications: {
487
490
  const { Notices: t, NoticeLists: n } = e;
488
491
  return {
@@ -524,9 +527,9 @@ const Q = (s) => {
524
527
  }
525
528
  }, le = async (s) => {
526
529
  const { invoke: e } = s.get("$widget");
527
- return await e("renderState") === T.hidden;
530
+ return await e("renderState") === q.hidden;
528
531
  };
529
- class O {
532
+ class E {
530
533
  constructor(e, t) {
531
534
  this.container = e, this.matchingClient = t, this.queries = /* @__PURE__ */ new Map(), this.getUnresolvedQueries = () => {
532
535
  let n = 0;
@@ -539,7 +542,7 @@ class O {
539
542
  ), this.events.subscribe(
540
543
  "widget:render-state-changed",
541
544
  (n, { next: i, previous: o }) => {
542
- o === T.hidden && i === T.open && this.fetchAllUnresolvedQueries();
545
+ o === q.hidden && i === q.open && this.fetchAllUnresolvedQueries();
543
546
  }
544
547
  );
545
548
  }
@@ -548,17 +551,17 @@ class O {
548
551
  let i = await e.getAsync("matchingClient");
549
552
  i || (i = await K(e), e.registerAsync("matchingClient", () => i));
550
553
  let o = n;
551
- return o || (o = new O(e, i), e.registerAsync(t, () => o)), o;
554
+ return o || (o = new E(e, i), e.registerAsync(t, () => o)), o;
552
555
  }));
553
556
  }
554
557
  fetch(e, t, n) {
555
558
  return new Promise((i, o) => {
556
559
  t.take, ne(t);
557
560
  const c = Q(e);
558
- let r = this.queries.get(c) || [], a = r.find((d) => G(d.params, t)) || null;
561
+ let r = this.queries.get(c) || [], a = r.find((d) => P(d.params, t)) || null;
559
562
  if (a && (n != null && n.noCache)) {
560
563
  const d = r.findIndex(
561
- (h) => G(h.params, t)
564
+ (h) => P(h.params, t)
562
565
  );
563
566
  r = [...r.slice(0, d), ...r.slice(d + 1)], a = null;
564
567
  }
@@ -597,7 +600,7 @@ class O {
597
600
  return this.matchingClient.giveFeedback(e, t, n);
598
601
  }
599
602
  setLoadingStatus(e, t, n) {
600
- const i = this.queries.get(e) || [], o = i.find((c) => G(c.params, t));
603
+ const i = this.queries.get(e) || [], o = i.find((c) => P(c.params, t));
601
604
  o && (o.loading = n), this.queries.set(e, i);
602
605
  }
603
606
  async runQuery(e, t) {
@@ -715,7 +718,7 @@ class O {
715
718
  }
716
719
  }
717
720
  handleResponse(e = {}, t, n, i) {
718
- const o = this.queries.get(t) || [], c = o.find((r) => G(r.params, n));
721
+ const o = this.queries.get(t) || [], c = o.find((r) => P(r.params, n));
719
722
  if (c) {
720
723
  const r = i || re(t, e);
721
724
  this.track(r, t, i), c.resolvers.forEach((d) => {
@@ -755,9 +758,9 @@ class O {
755
758
  static create(e) {
756
759
  return e.getAsync("matchingClient").then(async (t) => {
757
760
  if (t)
758
- return new O(e, t);
761
+ return new E(e, t);
759
762
  const n = await K(e);
760
- return e.registerAsync("matchingClient", () => n), new O(e, n);
763
+ return e.registerAsync("matchingClient", () => n), new E(e, n);
761
764
  });
762
765
  }
763
766
  getClient() {
@@ -765,10 +768,10 @@ class O {
765
768
  }
766
769
  }
767
770
  const he = async (s) => {
768
- s.registerAsync("dataClient", () => O.create(s));
771
+ s.registerAsync("dataClient", () => E.create(s));
769
772
  };
770
773
  export {
771
- O as DataClient,
774
+ E as DataClient,
772
775
  ce as DataType,
773
776
  ae as FeedbackType,
774
777
  he as KnowledgeDataClientPlugin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/knowledge-data-client-flamingo",
3
- "version": "1.1.139-rc.13",
3
+ "version": "1.1.139-rc.14",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },