@telia-ace/widget-utilities 1.3.41-rc.1 → 1.3.41-rc.2

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.
@@ -11,5 +11,5 @@ type ChildParentStructure = {
11
11
  };
12
12
  export declare function categoryTrail(id: string, items: Item[], ids?: string[], structure?: ChildParentStructure): string[];
13
13
  export declare const getCategoryTrailAsObjects: (trail: string[], categories: Item[]) => Map<string, Item>;
14
- export declare const buildCategoryTrail: (routeName: string, categoryIds: string | string[], container: Container, dataType?: 'guide-categories' | 'contact-method-categories') => Promise<any[]>;
14
+ export declare const buildCategoryTrail: (routeName: string, categoryIds: string | string[], container: Container, dataType?: "guide-categories" | "contact-method-categories") => Promise<any[]>;
15
15
  export {};
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function W(o){const t=[];return o.forEach(e=>{t.indexOf(e)===-1&&t.push(e)}),t}function w(o="",t=""){const e=o.split(" ").concat(t.split(" "));return W(e).join(" ").trim()}function z(o,t){if(o){if(typeof t=="string")return t;if(Array.isArray(t)){let e="";return t.forEach(r=>e=w(e,r)),e}}}function I(...o){let t="";return o.length&&o.forEach(e=>{typeof e=="string"?t=w(t,e):Array.isArray(e)?t=w(t,z(...e)):typeof e<"u"&&e!==null&&process.env.NODE_ENV!=="production"&&x.warn("appendClassNames: arguments either haveto be a string or [boolean, ...string[]]. Passed args:",...o)}),t}const B=(o,t)=>{let e,r=[];return i=>(clearTimeout(e),new Promise((n,a)=>{r.push([i,n,a]),e=setTimeout(()=>{let f=t();r.forEach(([c,g,m])=>{f=c(f)}),r=[],n(f)},o)}))};function T(o){const t={};if(typeof o=="number"||typeof o=="string")return o;for(const e in o)if(o.hasOwnProperty(e)){const r=o[e],i=e.substring(0,1).toLowerCase()+e.substring(1);if(Object.prototype.toString.call(r)==="[object Array]"){t[i]=[];for(let n=0,a=r.length;n<a;n++)t[i].push(T(r[n]))}else r!==null&&typeof r=="object"?t[i]=T(r):t[i]=r}return t}function O(o={}){const{phrase:t="",category:e,guideCategory:r,contactCategory:i,take:n,connectionKey:a,accordion:f,id:c,uriName:g,sorting:m,tag:u,tagId:l,tagTitle:h,...D}=o,s={};return Object.keys(D).forEach(v=>{typeof o[v]=="string"&&(s[v]=o[v])}),typeof t=="string"&&t.length&&(s.phrase=t),t===null&&(s.phrase=t),typeof r=="string"&&r!=="0"&&(s.guideCategory=r),typeof r=="number"&&r!==0&&(s.guideCategory=r),typeof r=="object"&&r!==null&&(typeof r.id=="string"&&r.id!=="0"&&(s.guideCategory=r.id),typeof r.id=="number"&&r.id!==0&&(s.guideCategory=r.id)),typeof i=="string"&&i!=="0"&&(s.contactCategory=i),typeof i=="number"&&i!==0&&(s.contactCategory=i),typeof i=="object"&&i!==null&&(typeof i.id=="string"&&i.id!=="0"&&(s.contactCategory=i.id),typeof i.id=="number"&&i.id!==0&&(s.contactCategory=i.id)),typeof e=="string"&&e!=="0"&&(s.category=e),typeof e=="number"&&e!==0&&(s.category=e),typeof e=="object"&&e!==null&&(typeof e.id=="string"&&e.id!=="0"&&(s.category=e.id),typeof e.id=="number"&&e.id!==0&&(s.category=e.id)),c&&(s.id=c),g&&(+s.category||+s.guideCategory||+s.guide||+s.contactCategory||+s.contactMethod)&&(s.uriName=g),a&&(s.connectionKey=a),n&&(s.take=n),m&&(s.sorting=m),typeof f=="string"&&f.length>0&&(s.accordion=f),typeof u=="string"&&u!=="0"&&(s.tag=u),typeof u=="number"&&u!==0&&(s.tag=u),Array.isArray(u)&&u.length&&(s.tag=u),(typeof l=="string"||typeof l=="number")&&(s.tagId=l),typeof h=="string"&&(s.tagTitle=h),typeof s.tag=="string"&&(s.tag=s.tag.split(",")),s}function*N(o){if(o)for(let t=0;t<o.length;t++){const e=o[t];yield e,e.items&&(yield*N(e.items))}}const E=(o,t)=>{const e=N(t);let r=e.next(),i=null;for(;!r.done;)r.value.id===o&&(i=r.value),r=e.next();return i},$=o=>{if(!o)return"";const t=[{from:/[äæǽ]+/gi,to:"ae"},{from:/[öœ]+/gi,to:"oe"},{from:/[ü]+/gi,to:"ue"},{from:/[Ä]+/gi,to:"Ae"},{from:/[Ü]+/gi,to:"Ue"},{from:/[Ö]+/gi,to:"Oe"},{from:/[ÀÁÂÃÄÅǺĀĂĄǍΑΆẢẠẦẪẨẬẰẮẴẲẶА]+/gi,to:"A"},{from:/[àáâãåǻāăąǎªαάảạầấẫẩậằắẵẳặа]+/gi,to:"a"},{from:/[Б]+/gi,to:"B"},{from:/[б]+/gi,to:"b"},{from:/[ÇĆĈĊČ]+/gi,to:"C"},{from:/[çćĉċč]+/gi,to:"c"},{from:/[Д]+/gi,to:"D"},{from:/[д]+/gi,to:"d"},{from:/[ÐĎĐΔ]+/gi,to:"Dj"},{from:/[ðďđδ]+/gi,to:"dj"},{from:/[ÈÉÊËĒĔĖĘĚΕΈẼẺẸỀẾỄỂỆЕЭ]+/gi,to:"E"},{from:/[èéêëēĕėęěέεẽẻẹềếễểệеэ]+/gi,to:"e"},{from:/[Ф]+/gi,to:"F"},{from:/[ф]+/gi,to:"f"},{from:/[ĜĞĠĢΓГҐ]+/gi,to:"G"},{from:/[ĝğġģγгґ]+/gi,to:"g"},{from:/[ĤĦ]+/gi,to:"H"},{from:/[ĥħ]+/gi,to:"h"},{from:/[ÌÍÎÏĨĪĬǏĮİΗΉΊΙΪỈỊИЫ]+/gi,to:"I"},{from:/[ìíîïĩīĭǐįıηήίιϊỉịиыї]+/gi,to:"i"},{from:/[Ĵ]+/gi,to:"J"},{from:/[ĵ]+/gi,to:"j"},{from:/[ĶΚК]+/gi,to:"K"},{from:/[ķκк]+/gi,to:"k"},{from:/[ĹĻĽĿŁΛЛ]+/gi,to:"L"},{from:/[ĺļľŀłλл]+/gi,to:"l"},{from:/[М]+/gi,to:"M"},{from:/[м]+/gi,to:"m"},{from:/[ÑŃŅŇΝН]+/gi,to:"N"},{from:/[ñńņňʼnνн]+/gi,to:"n"},{from:/[ÒÓÔÕŌŎǑŐƠØǾΟΌΩΏỎỌỒỐỖỔỘỜỚỠỞỢО]+/gi,to:"O"},{from:/[òóôõōŏǒőơøǿºοόωώỏọồốỗổộờớỡởợо]+/gi,to:"o"},{from:/[П]+/gi,to:"P"},{from:/[п]+/gi,to:"p"},{from:/[ŔŖŘΡР]+/gi,to:"R"},{from:/[ŕŗřρр]+/gi,to:"r"},{from:/[ŚŜŞȘŠΣС]+/gi,to:"S"},{from:/[śŝşșšſσςс]+/gi,to:"s"},{from:/[ȚŢŤŦτТ]+/gi,to:"T"},{from:/[țţťŧт]+/gi,to:"t"},{from:/[ÙÚÛŨŪŬŮŰŲƯǓǕǗǙǛŨỦỤỪỨỮỬỰУ]+/gi,to:"U"},{from:/[ùúûũūŭůűųưǔǖǘǚǜυύϋủụừứữửựу]+/gi,to:"u"},{from:/[ÝŸŶΥΎΫỲỸỶỴЙ]+/gi,to:"Y"},{from:/[ýÿŷỳỹỷỵй]+/gi,to:"y"},{from:/[В]+/gi,to:"V"},{from:/[в]+/gi,to:"v"},{from:/[Ŵ]+/gi,to:"W"},{from:/[ŵ]+/gi,to:"w"},{from:/[ŹŻŽΖЗ]+/gi,to:"Z"},{from:/[źżžζз]+/gi,to:"z"},{from:/[ÆǼ]+/gi,to:"AE"},{from:/[ß]+/gi,to:"ss"},{from:/[IJ]+/gi,to:"IJ"},{from:/[ij]+/gi,to:"ij"},{from:/[Œ]+/gi,to:"OE"},{from:/[ƒ]+/gi,to:"f"},{from:/[ξ]+/gi,to:"ks"},{from:/[π]+/gi,to:"p"},{from:/[β]+/gi,to:"v"},{from:/[μ]+/gi,to:"m"},{from:/[ψ]+/gi,to:"ps"},{from:/[Ё]+/gi,to:"Yo"},{from:/[ё]+/gi,to:"yo"},{from:/[Є]+/gi,to:"Ye"},{from:/[є]+/gi,to:"ye"},{from:/[Ї]+/gi,to:"Yi"},{from:/[Ж]+/gi,to:"Zh"},{from:/[ж]+/gi,to:"zh"},{from:/[Х]+/gi,to:"Kh"},{from:/[х]+/gi,to:"kh"},{from:/[Ц]+/gi,to:"Ts"},{from:/[ц]+/gi,to:"ts"},{from:/[Ч]+/gi,to:"Ch"},{from:/[ч]+/gi,to:"ch"},{from:/[Ш]+/gi,to:"Sh"},{from:/[ш]+/gi,to:"sh"},{from:/[Щ]+/gi,to:"Shch"},{from:/[щ]+/gi,to:"shch"},{from:/[ЪъЬь]+/gi,to:""},{from:/[Ю]+/gi,to:"Yu"},{from:/[ю]+/gi,to:"yu"},{from:/[Я]+/gi,to:"Ya"},{from:/[я]+/gi,to:"ya"}],e=/[^a-zA-Z0-9]+/g,r=/[-]$/;let i=o;for(const n in t)t.hasOwnProperty(n)&&t[n].from.test(o)&&(i=i.replace(t[n].from,t[n].to));return i=i.replace(e,"-"),i=i.replace(r,""),i=i.toLowerCase(),i||"humany"};function S(o,t={},e){return o.forEach(r=>{e&&(t[+r.id]=e),r.items&&S(r.items,t,r.id)}),t}function q(o,t,e=[o],r=S(t)){const i=a=>{const f=r[+a];f&&(e.unshift(f),i(f))},n=r[+o];return n&&(e.unshift(n),i(n)),e}const P=(o,t)=>typeof o>"u"||typeof t>"u"?new Map:new Map(o.map(e=>{const r=E(e,t);return[e,r]})),M=(o,t,e,r="guide-categories")=>e.getAsync("dataClient").then(i=>i.fetch(r,{expandCategories:"descendants"}).then(({categories:n})=>{const a=f=>{const c=q(f,n),g=P(c,n),m=[];return c.forEach(u=>{const l=g.get(u);l&&m.push({routeName:o,title:l.title,symbol:l.symbol,id:l.id,routeParams:O(r==="contact-method-categories"?{contactCategory:l.id,uriName:$(l.title)}:{guideCategory:l.id,uriName:$(l.title)})})}),m};return Array.isArray(t)?t.reduce((f,c)=>{const g=a(c);return g.length>0&&f.push(g),f},[]):a(t)})),U=o=>{let t;o.split(",")[0].indexOf("base64")!==-1?t=atob(o.split(",")[1]):t=decodeURI(o.split(",")[1]);const e=o.split(",")[0].split(":")[1].split(";")[0],r=[];for(let i=0;i<t.length;i++)r[i]=t.charCodeAt(i);return new Blob([new Uint8Array(r)],{type:e})};function V(...o){return process.env.NODE_ENV!=="production"&&console&&console.warn(...o)}const A=(o,t,...e)=>typeof t=="string"?o(`[humany] ${t}`,...e):o(t,...e),y=class p{constructor(){this.keys=[],this.log=(t,...e)=>this.lookup(t,()=>p.log(...e)),this.warn=(t,...e)=>this.lookup(t,()=>p.warn(...e)),this.error=(t,...e)=>this.lookup(t,()=>p.error(...e)),this.info=(t,...e)=>this.lookup(t,()=>p.info(...e))}lookup(t,e){this.keys.indexOf(t)===-1&&(this.keys.push(t),e())}};y.log=(...o)=>A(console.log,...o);y.warn=(...o)=>A(console.warn,...o);y.error=(...o)=>A(console.error,...o);y.info=(...o)=>A(console.info,...o);let x=y;const C=o=>{let t={},e,r;if(typeof o!="object"||o===null)return o;t=Array.isArray(o)?[]:{};for(r in o)e=o[r],t[r]=typeof e=="object"&&e!==null?C(e):e;return t},F=o=>{var e;if(!o)return null;const t=localStorage.getItem(`humany_${L(o.tenant+o.name)}`);if(t){const{activeStickyWidget:r}=JSON.parse(t);if(r&&r.value){const i=o.widgets.get(r.value);if(i)if(r.value.endsWith("_contact-method")){const n=o.widgets.get(r.value.slice(0,-7));(e=n==null?void 0:n.events)==null||e.subscribe("widget:attached",()=>{i.activate(),i.invoke("attach"),i.invoke("open")})}else{const n=document.createElement("a");n.setAttribute("href",`//${o.bindings[0]}/${r.value}`),document.body.appendChild(n)}}}},Y=(o,t=!1)=>{const e=new Date(o);let r=`${e.getMonth()+1}`,i=`${e.getDate()}`;const n=e.getFullYear();if(r.length<2&&(r=`0${r}`),i.length<2&&(i=`0${i}`),t){let a=`${e.getHours()}`,f=`${e.getMinutes()}`;return a.length<2&&(a=`0${a}`),f.length<2&&(f=`0${f}`),`${[n,r,i].join("-")} ${[a,f].join(":")}`}return[n,r,i].join("-")};function K(o){const t=document.cookie;if(t.length>0){let e=t.indexOf(`${o}=`);if(e!==-1){e=e+o.length+1;let r=t.indexOf(";",e);return r===-1&&(r=t.length),unescape(t.substring(e,r))}}return null}function L(o){let t=0;if(o.length===0)return t.toString();for(let e=0;e<o.length;e++){const r=o.charCodeAt(e);t=(t<<5)-t+r,t=t&t}return t.toString()}const Z=(o,t)=>{if(!o||!t)return!0;let e=t.parentNode,r=!1;for(;e!==null;)e===o&&(r=!0),e=e.parentNode;return r};function _(o){return o.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/\s+/g,"-").toLowerCase()}class J{constructor(t,e){this.lockWarningTime=t,this.lockErrorTime=e,this.tasks=[],this.current=Promise.resolve(),this.next=this.next.bind(this)}add(t,e,r,i){this.tasks.push({task:t,resolve:e,reject:r,done:i}),this.next()}next(){this.current=this.current.then(()=>{const t=this.tasks.shift();if(t){let e;const r=setTimeout(()=>{process.env.NODE_ENV!=="production"&&x.warn(`A lock has exceeded ${this.lockWarningTime} ms. Waiting additional ${this.lockErrorTime} ms before rejecting the task.`,t),e=setTimeout(()=>{t.reject("lock timeout exceeded")},this.lockErrorTime)},this.lockWarningTime),i=Promise.resolve(t.task()).then(n=>(clearTimeout(r),clearTimeout(e),n));return Promise.resolve(i).then(this.next).then(()=>i.then(n=>{t.done(),t.resolve(n)})).catch(n=>(t.done(),t.reject(n),this.next()))}return Promise.resolve()})}}const b=new WeakMap;function Q(o,t=5e3,e=1e3){return b.has(o)||b.set(o,new J(t,e)),r=>new Promise((i,n)=>{const a=b.get(o);a.add(r,i,n,()=>{a.tasks.length||b.delete(o)})})}const k=o=>!!o&&typeof o=="object"&&!Array.isArray(o),H=(o,...t)=>{const e=C(o),r=C(t);return j(e,...r)},j=(o,...t)=>{if(!t.length)return o;const e=t.shift();if(k(o)&&k(e))for(const r in e)k(e[r])?(o[r]||Object.assign(o,{[r]:{}}),j(o[r],e[r])):Object.assign(o,{[r]:e[r]});return j(o,...t)},R=(o,t)=>{const e=()=>t.querySelectorAll("[data-loading=true]").length>0,i=(()=>{let a=!1;return()=>{if(a)return;o.get("$widget").events.dispatch("widget:data-loaded",{element:t}),a=!0}})();if(!e())return i();new MutationObserver((a,f)=>{a.find(g=>g.type==="attributes"&&g.attributeName==="data-loading")&&!e()&&(f.disconnect(),i())}).observe(t,{attributes:!0,childList:!0,subtree:!0})},G=(o,t)=>{o.get("$widget").container.getAsync("components").then(r=>{r.events.subscribeOnce("components:component-model-initialized",()=>{let i=r.nodes.visible.reduce((f,c)=>(!c.name||!c.type||c.type==="view"||c.type==="root"||c.attributes.layout.size==="none"||t.querySelector(`[data-name="${c.name}"]`)||f.push(c.name),f),[]),n=!1;new MutationObserver((f,c)=>{f.forEach(g=>{if(g.addedNodes){const m=Array.from(g.addedNodes).reduce((u,l)=>{const h=l.getAttribute&&l.getAttribute("data-name");return h&&i.indexOf(h)>-1&&u.push(h),u},[]);i=i.filter(u=>m.indexOf(u)===-1),!n&&i.length===0&&(n=!0,R(o,t),c.disconnect())}})}).observe(t,{attributes:!1,characterData:!1,childList:!0,subtree:!0,attributeOldValue:!1,characterDataOldValue:!1})})})},X=(o={})=>(Object.keys(o).forEach(t=>{(o[t]===null||typeof o[t]>"u")&&delete o[t]}),o);function tt(o,t,e){let r="";if(e){const i=new Date;i.setTime(i.getTime()+e*24*60*60*1e3),r=`; expires=${i.toUTCString()}`}document.cookie=`${o}=${t}${r}; path=/`}const et=(o,t)=>{let e=!0;return Object.keys(o).length!==Object.keys(t).length||Object.keys(o).some(i=>!Object.keys(t).some(a=>i===a))?!1:(Object.keys(o).forEach(i=>{if(e){const n=typeof o[i]>"u"?"":o[i],a=typeof t[i]>"u"?"":t[i];e=n.toString()===a.toString()}}),e)},d=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);function ot(){return d()+d()+"-"+d()+"-"+d()+"-"+d()+"-"+d()+d()+d()}class rt{constructor(t){this.queue=[],this.queueAttemptCalls=0,this.callCount=5,this.add=e=>{this.queue.push(e),this.queueAttempt=setInterval(this.processQueue,1e3)},this.processQueue=()=>{if(this.queue.length>0){const e=[];this.queue.forEach((r,i)=>{const n=r();typeof n=="function"&&(n(),e.push(i))}),this.queue=this.queue.filter((r,i)=>!(e.indexOf(i)>-1)),this.queueAttempt&&clearInterval(this.queueAttempt)}this.queueAttemptCalls>this.callCount&&(clearInterval(this.queueAttempt),this.queueAttemptCalls=0),this.queueAttemptCalls=this.queueAttemptCalls+1},t&&t.callCount&&(this.callCount=t.callCount)}}exports.Logger=x;exports.WaitFor=rt;exports.appendClassNames=I;exports.buildCategoryTrail=M;exports.camilize=T;exports.categoryTrail=q;exports.createBatch=B;exports.createParams=O;exports.dataURItoBlob=U;exports.debugLog=V;exports.deepClone=C;exports.findAndActivateStoredWidgets=F;exports.findCategoryById=E;exports.formatDate=Y;exports.formatUrl=$;exports.getCategoryTrailAsObjects=P;exports.getCookie=K;exports.hash=L;exports.htmlParentContains=Z;exports.kebabCase=_;exports.lock=Q;exports.mergeDeep=H;exports.notifyDataLoaded=G;exports.removeNullAndUndefinedValues=X;exports.setCookie=tt;exports.shallowCompare=et;exports.uuid=ot;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function W(o){const t=[];return o.forEach(e=>{t.indexOf(e)===-1&&t.push(e)}),t}function w(o="",t=""){const e=o.split(" ").concat(t.split(" "));return W(e).join(" ").trim()}function z(o,t){if(o){if(typeof t=="string")return t;if(Array.isArray(t)){let e="";return t.forEach(r=>e=w(e,r)),e}}}function I(...o){let t="";return o.length&&o.forEach(e=>{typeof e=="string"?t=w(t,e):Array.isArray(e)?t=w(t,z(...e)):typeof e<"u"&&e!==null&&process.env.NODE_ENV!=="production"&&y.warn("appendClassNames: arguments either haveto be a string or [boolean, ...string[]]. Passed args:",...o)}),t}const B=(o,t)=>{let e,r=[];return i=>(clearTimeout(e),new Promise((n,a)=>{r.push([i,n,a]),e=setTimeout(()=>{let f=t();r.forEach(([c,g,d])=>{f=c(f)}),r=[],n(f)},o)}))};function T(o){const t={};if(typeof o=="number"||typeof o=="string")return o;for(const e in o)if(o.hasOwnProperty(e)){const r=o[e],i=e.substring(0,1).toLowerCase()+e.substring(1);if(Object.prototype.toString.call(r)==="[object Array]"){t[i]=[];for(let n=0,a=r.length;n<a;n++)t[i].push(T(r[n]))}else r!==null&&typeof r=="object"?t[i]=T(r):t[i]=r}return t}function O(o={}){const{phrase:t="",category:e,guideCategory:r,contactCategory:i,take:n,connectionKey:a,accordion:f,id:c,uriName:g,sorting:d,tag:u,tagId:l,tagTitle:p,...D}=o,s={};return Object.keys(D).forEach(v=>{typeof o[v]=="string"&&(s[v]=o[v])}),typeof t=="string"&&t.length&&(s.phrase=t),t===null&&(s.phrase=t),typeof r=="string"&&r!=="0"&&(s.guideCategory=r),typeof r=="number"&&r!==0&&(s.guideCategory=r),typeof r=="object"&&r!==null&&(typeof r.id=="string"&&r.id!=="0"&&(s.guideCategory=r.id),typeof r.id=="number"&&r.id!==0&&(s.guideCategory=r.id)),typeof i=="string"&&i!=="0"&&(s.contactCategory=i),typeof i=="number"&&i!==0&&(s.contactCategory=i),typeof i=="object"&&i!==null&&(typeof i.id=="string"&&i.id!=="0"&&(s.contactCategory=i.id),typeof i.id=="number"&&i.id!==0&&(s.contactCategory=i.id)),typeof e=="string"&&e!=="0"&&(s.category=e),typeof e=="number"&&e!==0&&(s.category=e),typeof e=="object"&&e!==null&&(typeof e.id=="string"&&e.id!=="0"&&(s.category=e.id),typeof e.id=="number"&&e.id!==0&&(s.category=e.id)),c&&(s.id=c),g&&(+s.category||+s.guideCategory||+s.guide||+s.contactCategory||+s.contactMethod)&&(s.uriName=g),a&&(s.connectionKey=a),n&&(s.take=n),d&&(s.sorting=d),typeof f=="string"&&f.length>0&&(s.accordion=f),typeof u=="string"&&u!=="0"&&(s.tag=u),typeof u=="number"&&u!==0&&(s.tag=u),Array.isArray(u)&&u.length&&(s.tag=u),(typeof l=="string"||typeof l=="number")&&(s.tagId=l),typeof p=="string"&&(s.tagTitle=p),typeof s.tag=="string"&&(s.tag=s.tag.split(",")),s}function*x(o){if(o)for(let t=0;t<o.length;t++){const e=o[t];yield e,e.items&&(yield*x(e.items))}}const N=(o,t)=>{const e=x(t);let r=e.next(),i=null;for(;!r.done;)r.value.id===o&&(i=r.value),r=e.next();return i},$=o=>{if(!o)return"";const t=[{from:/[äæǽ]+/gi,to:"ae"},{from:/[öœ]+/gi,to:"oe"},{from:/[ü]+/gi,to:"ue"},{from:/[Ä]+/gi,to:"Ae"},{from:/[Ü]+/gi,to:"Ue"},{from:/[Ö]+/gi,to:"Oe"},{from:/[ÀÁÂÃÄÅǺĀĂĄǍΑΆẢẠẦẪẨẬẰẮẴẲẶА]+/gi,to:"A"},{from:/[àáâãåǻāăąǎªαάảạầấẫẩậằắẵẳặа]+/gi,to:"a"},{from:/[Б]+/gi,to:"B"},{from:/[б]+/gi,to:"b"},{from:/[ÇĆĈĊČ]+/gi,to:"C"},{from:/[çćĉċč]+/gi,to:"c"},{from:/[Д]+/gi,to:"D"},{from:/[д]+/gi,to:"d"},{from:/[ÐĎĐΔ]+/gi,to:"Dj"},{from:/[ðďđδ]+/gi,to:"dj"},{from:/[ÈÉÊËĒĔĖĘĚΕΈẼẺẸỀẾỄỂỆЕЭ]+/gi,to:"E"},{from:/[èéêëēĕėęěέεẽẻẹềếễểệеэ]+/gi,to:"e"},{from:/[Ф]+/gi,to:"F"},{from:/[ф]+/gi,to:"f"},{from:/[ĜĞĠĢΓГҐ]+/gi,to:"G"},{from:/[ĝğġģγгґ]+/gi,to:"g"},{from:/[ĤĦ]+/gi,to:"H"},{from:/[ĥħ]+/gi,to:"h"},{from:/[ÌÍÎÏĨĪĬǏĮİΗΉΊΙΪỈỊИЫ]+/gi,to:"I"},{from:/[ìíîïĩīĭǐįıηήίιϊỉịиыї]+/gi,to:"i"},{from:/[Ĵ]+/gi,to:"J"},{from:/[ĵ]+/gi,to:"j"},{from:/[ĶΚК]+/gi,to:"K"},{from:/[ķκк]+/gi,to:"k"},{from:/[ĹĻĽĿŁΛЛ]+/gi,to:"L"},{from:/[ĺļľŀłλл]+/gi,to:"l"},{from:/[М]+/gi,to:"M"},{from:/[м]+/gi,to:"m"},{from:/[ÑŃŅŇΝН]+/gi,to:"N"},{from:/[ñńņňʼnνн]+/gi,to:"n"},{from:/[ÒÓÔÕŌŎǑŐƠØǾΟΌΩΏỎỌỒỐỖỔỘỜỚỠỞỢО]+/gi,to:"O"},{from:/[òóôõōŏǒőơøǿºοόωώỏọồốỗổộờớỡởợо]+/gi,to:"o"},{from:/[П]+/gi,to:"P"},{from:/[п]+/gi,to:"p"},{from:/[ŔŖŘΡР]+/gi,to:"R"},{from:/[ŕŗřρр]+/gi,to:"r"},{from:/[ŚŜŞȘŠΣС]+/gi,to:"S"},{from:/[śŝşșšſσςс]+/gi,to:"s"},{from:/[ȚŢŤŦτТ]+/gi,to:"T"},{from:/[țţťŧт]+/gi,to:"t"},{from:/[ÙÚÛŨŪŬŮŰŲƯǓǕǗǙǛŨỦỤỪỨỮỬỰУ]+/gi,to:"U"},{from:/[ùúûũūŭůűųưǔǖǘǚǜυύϋủụừứữửựу]+/gi,to:"u"},{from:/[ÝŸŶΥΎΫỲỸỶỴЙ]+/gi,to:"Y"},{from:/[ýÿŷỳỹỷỵй]+/gi,to:"y"},{from:/[В]+/gi,to:"V"},{from:/[в]+/gi,to:"v"},{from:/[Ŵ]+/gi,to:"W"},{from:/[ŵ]+/gi,to:"w"},{from:/[ŹŻŽΖЗ]+/gi,to:"Z"},{from:/[źżžζз]+/gi,to:"z"},{from:/[ÆǼ]+/gi,to:"AE"},{from:/[ß]+/gi,to:"ss"},{from:/[IJ]+/gi,to:"IJ"},{from:/[ij]+/gi,to:"ij"},{from:/[Œ]+/gi,to:"OE"},{from:/[ƒ]+/gi,to:"f"},{from:/[ξ]+/gi,to:"ks"},{from:/[π]+/gi,to:"p"},{from:/[β]+/gi,to:"v"},{from:/[μ]+/gi,to:"m"},{from:/[ψ]+/gi,to:"ps"},{from:/[Ё]+/gi,to:"Yo"},{from:/[ё]+/gi,to:"yo"},{from:/[Є]+/gi,to:"Ye"},{from:/[є]+/gi,to:"ye"},{from:/[Ї]+/gi,to:"Yi"},{from:/[Ж]+/gi,to:"Zh"},{from:/[ж]+/gi,to:"zh"},{from:/[Х]+/gi,to:"Kh"},{from:/[х]+/gi,to:"kh"},{from:/[Ц]+/gi,to:"Ts"},{from:/[ц]+/gi,to:"ts"},{from:/[Ч]+/gi,to:"Ch"},{from:/[ч]+/gi,to:"ch"},{from:/[Ш]+/gi,to:"Sh"},{from:/[ш]+/gi,to:"sh"},{from:/[Щ]+/gi,to:"Shch"},{from:/[щ]+/gi,to:"shch"},{from:/[ЪъЬь]+/gi,to:""},{from:/[Ю]+/gi,to:"Yu"},{from:/[ю]+/gi,to:"yu"},{from:/[Я]+/gi,to:"Ya"},{from:/[я]+/gi,to:"ya"}],e=/[^a-zA-Z0-9]+/g,r=/[-]$/;let i=o;for(const n in t)t.hasOwnProperty(n)&&t[n].from.test(o)&&(i=i.replace(t[n].from,t[n].to));return i=i.replace(e,"-"),i=i.replace(r,""),i=i.toLowerCase(),i||"humany"};function E(o,t={},e){return o.forEach(r=>{e&&(t[+r.id]=e),r.items&&E(r.items,t,r.id)}),t}function S(o,t,e=[o],r=E(t)){const i=a=>{const f=r[+a];f&&(e.unshift(f),i(f))},n=r[+o];return n&&(e.unshift(n),i(n)),e}const q=(o,t)=>typeof o>"u"||typeof t>"u"?new Map:new Map(o.map(e=>{const r=N(e,t);return[e,r]})),L=(o,t,e,r="guide-categories")=>e.getAsync("dataClient").then(i=>i.fetch(r,{expandCategories:"descendants"}).then(({categories:n})=>{const a=f=>{const c=S(f,n),g=q(c,n),d=[];return c.forEach(u=>{const l=g.get(u);l&&d.push({routeName:o,title:l.title,symbol:l.symbol,id:l.id,routeParams:O(r==="contact-method-categories"?{contactCategory:l.id,uriName:$(l.title)}:{guideCategory:l.id,uriName:$(l.title)})})}),d};return Array.isArray(t)?t.reduce((f,c)=>{const g=a(c);return g.length>0&&f.push(g),f},[]):a(t)})),M=o=>{let t;o.split(",")[0].indexOf("base64")!==-1?t=atob(o.split(",")[1]):t=decodeURI(o.split(",")[1]);const e=o.split(",")[0].split(":")[1].split(";")[0],r=[];for(let i=0;i<t.length;i++)r[i]=t.charCodeAt(i);return new Blob([new Uint8Array(r)],{type:e})};function U(...o){return process.env.NODE_ENV!=="production"&&console&&console.warn(...o)}const b=(o,t,...e)=>typeof t=="string"?o(`[humany] ${t}`,...e):o(t,...e),m=class m{constructor(){this.keys=[],this.log=(t,...e)=>this.lookup(t,()=>m.log(...e)),this.warn=(t,...e)=>this.lookup(t,()=>m.warn(...e)),this.error=(t,...e)=>this.lookup(t,()=>m.error(...e)),this.info=(t,...e)=>this.lookup(t,()=>m.info(...e))}lookup(t,e){this.keys.indexOf(t)===-1&&(this.keys.push(t),e())}};m.log=(...t)=>b(console.log,...t),m.warn=(...t)=>b(console.warn,...t),m.error=(...t)=>b(console.error,...t),m.info=(...t)=>b(console.info,...t);let y=m;const A=o=>{let t={},e,r;if(typeof o!="object"||o===null)return o;t=Array.isArray(o)?[]:{};for(r in o)e=o[r],t[r]=typeof e=="object"&&e!==null?A(e):e;return t},V=o=>{var e;if(!o)return null;const t=localStorage.getItem(`humany_${P(o.tenant+o.name)}`);if(t){const{activeStickyWidget:r}=JSON.parse(t);if(r&&r.value){const i=o.widgets.get(r.value);if(i)if(r.value.endsWith("_contact-method")){const n=o.widgets.get(r.value.slice(0,-7));(e=n==null?void 0:n.events)==null||e.subscribe("widget:attached",()=>{i.activate(),i.invoke("attach"),i.invoke("open")})}else{const n=document.createElement("a");n.setAttribute("href",`//${o.bindings[0]}/${r.value}`),document.body.appendChild(n)}}}},F=(o,t=!1)=>{const e=new Date(o);let r=`${e.getMonth()+1}`,i=`${e.getDate()}`;const n=e.getFullYear();if(r.length<2&&(r=`0${r}`),i.length<2&&(i=`0${i}`),t){let a=`${e.getHours()}`,f=`${e.getMinutes()}`;return a.length<2&&(a=`0${a}`),f.length<2&&(f=`0${f}`),`${[n,r,i].join("-")} ${[a,f].join(":")}`}return[n,r,i].join("-")};function Y(o){const t=document.cookie;if(t.length>0){let e=t.indexOf(`${o}=`);if(e!==-1){e=e+o.length+1;let r=t.indexOf(";",e);return r===-1&&(r=t.length),unescape(t.substring(e,r))}}return null}function P(o){let t=0;if(o.length===0)return t.toString();for(let e=0;e<o.length;e++){const r=o.charCodeAt(e);t=(t<<5)-t+r,t=t&t}return t.toString()}const K=(o,t)=>{if(!o||!t)return!0;let e=t.parentNode,r=!1;for(;e!==null;)e===o&&(r=!0),e=e.parentNode;return r};function Z(o){return o.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/\s+/g,"-").toLowerCase()}class J{constructor(t,e){this.lockWarningTime=t,this.lockErrorTime=e,this.tasks=[],this.current=Promise.resolve(),this.next=this.next.bind(this)}add(t,e,r,i){this.tasks.push({task:t,resolve:e,reject:r,done:i}),this.next()}next(){this.current=this.current.then(()=>{const t=this.tasks.shift();if(t){let e;const r=setTimeout(()=>{process.env.NODE_ENV!=="production"&&y.warn(`A lock has exceeded ${this.lockWarningTime} ms. Waiting additional ${this.lockErrorTime} ms before rejecting the task.`,t),e=setTimeout(()=>{t.reject("lock timeout exceeded")},this.lockErrorTime)},this.lockWarningTime),i=Promise.resolve(t.task()).then(n=>(clearTimeout(r),clearTimeout(e),n));return Promise.resolve(i).then(this.next).then(()=>i.then(n=>{t.done(),t.resolve(n)})).catch(n=>(t.done(),t.reject(n),this.next()))}return Promise.resolve()})}}const C=new WeakMap;function Q(o,t=5e3,e=1e3){return C.has(o)||C.set(o,new J(t,e)),r=>new Promise((i,n)=>{const a=C.get(o);a.add(r,i,n,()=>{a.tasks.length||C.delete(o)})})}const k=o=>!!o&&typeof o=="object"&&!Array.isArray(o),H=(o,...t)=>{const e=A(o),r=A(t);return j(e,...r)},j=(o,...t)=>{if(!t.length)return o;const e=t.shift();if(k(o)&&k(e))for(const r in e)k(e[r])?(o[r]||Object.assign(o,{[r]:{}}),j(o[r],e[r])):Object.assign(o,{[r]:e[r]});return j(o,...t)},R=(o,t)=>{const e=()=>t.querySelectorAll("[data-loading=true]").length>0,i=(()=>{let a=!1;return()=>{if(a)return;o.get("$widget").events.dispatch("widget:data-loaded",{element:t}),a=!0}})();if(!e())return i();new MutationObserver((a,f)=>{a.find(g=>g.type==="attributes"&&g.attributeName==="data-loading")&&!e()&&(f.disconnect(),i())}).observe(t,{attributes:!0,childList:!0,subtree:!0})},G=(o,t)=>{o.get("$widget").container.getAsync("components").then(r=>{r.events.subscribeOnce("components:component-model-initialized",()=>{let i=r.nodes.visible.reduce((f,c)=>(!c.name||!c.type||c.type==="view"||c.type==="root"||c.attributes.layout.size==="none"||t.querySelector(`[data-name="${c.name}"]`)||f.push(c.name),f),[]),n=!1;new MutationObserver((f,c)=>{f.forEach(g=>{if(g.addedNodes){const d=Array.from(g.addedNodes).reduce((u,l)=>{const p=l.getAttribute&&l.getAttribute("data-name");return p&&i.indexOf(p)>-1&&u.push(p),u},[]);i=i.filter(u=>d.indexOf(u)===-1),!n&&i.length===0&&(n=!0,R(o,t),c.disconnect())}})}).observe(t,{attributes:!1,characterData:!1,childList:!0,subtree:!0,attributeOldValue:!1,characterDataOldValue:!1})})})},X=(o={})=>(Object.keys(o).forEach(t=>{(o[t]===null||typeof o[t]>"u")&&delete o[t]}),o);function _(o,t,e){let r="";if(e){const i=new Date;i.setTime(i.getTime()+e*24*60*60*1e3),r=`; expires=${i.toUTCString()}`}document.cookie=`${o}=${t}${r}; path=/`}const tt=(o,t)=>{let e=!0;return Object.keys(o).length!==Object.keys(t).length||Object.keys(o).some(i=>!Object.keys(t).some(a=>i===a))?!1:(Object.keys(o).forEach(i=>{if(e){const n=typeof o[i]>"u"?"":o[i],a=typeof t[i]>"u"?"":t[i];e=n.toString()===a.toString()}}),e)},h=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);function et(){return h()+h()+"-"+h()+"-"+h()+"-"+h()+"-"+h()+h()+h()}class ot{constructor(t){this.queue=[],this.queueAttemptCalls=0,this.callCount=5,this.add=e=>{this.queue.push(e),this.queueAttempt=setInterval(this.processQueue,1e3)},this.processQueue=()=>{if(this.queue.length>0){const e=[];this.queue.forEach((r,i)=>{const n=r();typeof n=="function"&&(n(),e.push(i))}),this.queue=this.queue.filter((r,i)=>!(e.indexOf(i)>-1)),this.queueAttempt&&clearInterval(this.queueAttempt)}this.queueAttemptCalls>this.callCount&&(clearInterval(this.queueAttempt),this.queueAttemptCalls=0),this.queueAttemptCalls=this.queueAttemptCalls+1},t&&t.callCount&&(this.callCount=t.callCount)}}exports.Logger=y;exports.WaitFor=ot;exports.appendClassNames=I;exports.buildCategoryTrail=L;exports.camilize=T;exports.categoryTrail=S;exports.createBatch=B;exports.createParams=O;exports.dataURItoBlob=M;exports.debugLog=U;exports.deepClone=A;exports.findAndActivateStoredWidgets=V;exports.findCategoryById=N;exports.formatDate=F;exports.formatUrl=$;exports.getCategoryTrailAsObjects=q;exports.getCookie=Y;exports.hash=P;exports.htmlParentContains=K;exports.kebabCase=Z;exports.lock=Q;exports.mergeDeep=H;exports.notifyDataLoaded=G;exports.removeNullAndUndefinedValues=X;exports.setCookie=_;exports.shallowCompare=tt;exports.uuid=et;
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- function S(o) {
1
+ function q(o) {
2
2
  const t = [];
3
3
  return o.forEach((e) => {
4
4
  t.indexOf(e) === -1 && t.push(e);
@@ -6,9 +6,9 @@ function S(o) {
6
6
  }
7
7
  function k(o = "", t = "") {
8
8
  const e = o.split(" ").concat(t.split(" "));
9
- return S(e).join(" ").trim();
9
+ return q(e).join(" ").trim();
10
10
  }
11
- function P(o, t) {
11
+ function S(o, t) {
12
12
  if (o) {
13
13
  if (typeof t == "string")
14
14
  return t;
@@ -21,7 +21,7 @@ function P(o, t) {
21
21
  function V(...o) {
22
22
  let t = "";
23
23
  return o.length && o.forEach((e) => {
24
- typeof e == "string" ? t = k(t, e) : Array.isArray(e) ? t = k(t, P(...e)) : typeof e < "u" && e !== null && process.env.NODE_ENV !== "production" && N.warn(
24
+ typeof e == "string" ? t = k(t, e) : Array.isArray(e) ? t = k(t, S(...e)) : typeof e < "u" && e !== null && process.env.NODE_ENV !== "production" && C.warn(
25
25
  "appendClassNames: arguments either haveto be a string or [boolean, ...string[]]. Passed args:",
26
26
  ...o
27
27
  );
@@ -32,7 +32,7 @@ const Y = (o, t) => {
32
32
  return (i) => (clearTimeout(e), new Promise((n, c) => {
33
33
  r.push([i, n, c]), e = setTimeout(() => {
34
34
  let f = t();
35
- r.forEach(([a, g, m]) => {
35
+ r.forEach(([a, g, h]) => {
36
36
  f = a(f);
37
37
  }), r = [], n(f);
38
38
  }, o);
@@ -49,8 +49,7 @@ function $(o) {
49
49
  t[i] = [];
50
50
  for (let n = 0, c = r.length; n < c; n++)
51
51
  t[i].push($(r[n]));
52
- } else
53
- r !== null && typeof r == "object" ? t[i] = $(r) : t[i] = r;
52
+ } else r !== null && typeof r == "object" ? t[i] = $(r) : t[i] = r;
54
53
  }
55
54
  return t;
56
55
  }
@@ -65,15 +64,15 @@ function x(o = {}) {
65
64
  accordion: f,
66
65
  id: a,
67
66
  uriName: g,
68
- sorting: m,
67
+ sorting: h,
69
68
  tag: u,
70
69
  tagId: l,
71
- tagTitle: d,
72
- ...q
70
+ tagTitle: p,
71
+ ...N
73
72
  } = o, s = {};
74
- return Object.keys(q).forEach((A) => {
73
+ return Object.keys(N).forEach((A) => {
75
74
  typeof o[A] == "string" && (s[A] = o[A]);
76
- }), typeof t == "string" && t.length && (s.phrase = t), t === null && (s.phrase = t), typeof r == "string" && r !== "0" && (s.guideCategory = r), typeof r == "number" && r !== 0 && (s.guideCategory = r), typeof r == "object" && r !== null && (typeof r.id == "string" && r.id !== "0" && (s.guideCategory = r.id), typeof r.id == "number" && r.id !== 0 && (s.guideCategory = r.id)), typeof i == "string" && i !== "0" && (s.contactCategory = i), typeof i == "number" && i !== 0 && (s.contactCategory = i), typeof i == "object" && i !== null && (typeof i.id == "string" && i.id !== "0" && (s.contactCategory = i.id), typeof i.id == "number" && i.id !== 0 && (s.contactCategory = i.id)), typeof e == "string" && e !== "0" && (s.category = e), typeof e == "number" && e !== 0 && (s.category = e), typeof e == "object" && e !== null && (typeof e.id == "string" && e.id !== "0" && (s.category = e.id), typeof e.id == "number" && e.id !== 0 && (s.category = e.id)), a && (s.id = a), g && (+s.category || +s.guideCategory || +s.guide || +s.contactCategory || +s.contactMethod) && (s.uriName = g), c && (s.connectionKey = c), n && (s.take = n), m && (s.sorting = m), typeof f == "string" && f.length > 0 && (s.accordion = f), typeof u == "string" && u !== "0" && (s.tag = u), typeof u == "number" && u !== 0 && (s.tag = u), Array.isArray(u) && u.length && (s.tag = u), (typeof l == "string" || typeof l == "number") && (s.tagId = l), typeof d == "string" && (s.tagTitle = d), typeof s.tag == "string" && (s.tag = s.tag.split(",")), s;
75
+ }), typeof t == "string" && t.length && (s.phrase = t), t === null && (s.phrase = t), typeof r == "string" && r !== "0" && (s.guideCategory = r), typeof r == "number" && r !== 0 && (s.guideCategory = r), typeof r == "object" && r !== null && (typeof r.id == "string" && r.id !== "0" && (s.guideCategory = r.id), typeof r.id == "number" && r.id !== 0 && (s.guideCategory = r.id)), typeof i == "string" && i !== "0" && (s.contactCategory = i), typeof i == "number" && i !== 0 && (s.contactCategory = i), typeof i == "object" && i !== null && (typeof i.id == "string" && i.id !== "0" && (s.contactCategory = i.id), typeof i.id == "number" && i.id !== 0 && (s.contactCategory = i.id)), typeof e == "string" && e !== "0" && (s.category = e), typeof e == "number" && e !== 0 && (s.category = e), typeof e == "object" && e !== null && (typeof e.id == "string" && e.id !== "0" && (s.category = e.id), typeof e.id == "number" && e.id !== 0 && (s.category = e.id)), a && (s.id = a), g && (+s.category || +s.guideCategory || +s.guide || +s.contactCategory || +s.contactMethod) && (s.uriName = g), c && (s.connectionKey = c), n && (s.take = n), h && (s.sorting = h), typeof f == "string" && f.length > 0 && (s.accordion = f), typeof u == "string" && u !== "0" && (s.tag = u), typeof u == "number" && u !== 0 && (s.tag = u), Array.isArray(u) && u.length && (s.tag = u), (typeof l == "string" || typeof l == "number") && (s.tagId = l), typeof p == "string" && (s.tagTitle = p), typeof s.tag == "string" && (s.tag = s.tag.split(",")), s;
77
76
  }
78
77
  function* E(o) {
79
78
  if (o)
@@ -82,7 +81,7 @@ function* E(o) {
82
81
  yield e, e.items && (yield* E(e.items));
83
82
  }
84
83
  }
85
- const L = (o, t) => {
84
+ const P = (o, t) => {
86
85
  const e = E(t);
87
86
  let r = e.next(), i = null;
88
87
  for (; !r.done; )
@@ -201,15 +200,15 @@ function D(o, t, e = [o], r = j(t)) {
201
200
  }
202
201
  const z = (o, t) => typeof o > "u" || typeof t > "u" ? /* @__PURE__ */ new Map() : new Map(
203
202
  o.map((e) => {
204
- const r = L(e, t);
203
+ const r = P(e, t);
205
204
  return [e, r];
206
205
  })
207
206
  ), F = (o, t, e, r = "guide-categories") => e.getAsync("dataClient").then((i) => i.fetch(r, { expandCategories: "descendants" }).then(({ categories: n }) => {
208
207
  const c = (f) => {
209
- const a = D(f, n), g = z(a, n), m = [];
208
+ const a = D(f, n), g = z(a, n), h = [];
210
209
  return a.forEach((u) => {
211
210
  const l = g.get(u);
212
- l && m.push({
211
+ l && h.push({
213
212
  routeName: o,
214
213
  title: l.title,
215
214
  symbol: l.symbol,
@@ -222,7 +221,7 @@ const z = (o, t) => typeof o > "u" || typeof t > "u" ? /* @__PURE__ */ new Map()
222
221
  uriName: T(l.title)
223
222
  })
224
223
  });
225
- }), m;
224
+ }), h;
226
225
  };
227
226
  return Array.isArray(t) ? t.reduce((f, a) => {
228
227
  const g = c(a);
@@ -239,19 +238,16 @@ const z = (o, t) => typeof o > "u" || typeof t > "u" ? /* @__PURE__ */ new Map()
239
238
  function B(...o) {
240
239
  return process.env.NODE_ENV !== "production" && console && console.warn(...o);
241
240
  }
242
- const C = (o, t, ...e) => typeof t == "string" ? o(`[humany] ${t}`, ...e) : o(t, ...e), y = class p {
241
+ const y = (o, t, ...e) => typeof t == "string" ? o(`[humany] ${t}`, ...e) : o(t, ...e), m = class m {
243
242
  constructor() {
244
- this.keys = [], this.log = (t, ...e) => this.lookup(t, () => p.log(...e)), this.warn = (t, ...e) => this.lookup(t, () => p.warn(...e)), this.error = (t, ...e) => this.lookup(t, () => p.error(...e)), this.info = (t, ...e) => this.lookup(t, () => p.info(...e));
243
+ this.keys = [], this.log = (t, ...e) => this.lookup(t, () => m.log(...e)), this.warn = (t, ...e) => this.lookup(t, () => m.warn(...e)), this.error = (t, ...e) => this.lookup(t, () => m.error(...e)), this.info = (t, ...e) => this.lookup(t, () => m.info(...e));
245
244
  }
246
245
  lookup(t, e) {
247
246
  this.keys.indexOf(t) === -1 && (this.keys.push(t), e());
248
247
  }
249
248
  };
250
- y.log = (...o) => C(console.log, ...o);
251
- y.warn = (...o) => C(console.warn, ...o);
252
- y.error = (...o) => C(console.error, ...o);
253
- y.info = (...o) => C(console.info, ...o);
254
- let N = y;
249
+ m.log = (...t) => y(console.log, ...t), m.warn = (...t) => y(console.warn, ...t), m.error = (...t) => y(console.error, ...t), m.info = (...t) => y(console.info, ...t);
250
+ let C = m;
255
251
  const w = (o) => {
256
252
  let t = {}, e, r;
257
253
  if (typeof o != "object" || o === null)
@@ -260,7 +256,7 @@ const w = (o) => {
260
256
  for (r in o)
261
257
  e = o[r], t[r] = typeof e == "object" && e !== null ? w(e) : e;
262
258
  return t;
263
- }, U = (o) => {
259
+ }, L = (o) => {
264
260
  var e;
265
261
  if (!o)
266
262
  return null;
@@ -288,7 +284,7 @@ const w = (o) => {
288
284
  }
289
285
  }
290
286
  }
291
- }, Z = (o, t = !1) => {
287
+ }, U = (o, t = !1) => {
292
288
  const e = new Date(o);
293
289
  let r = `${e.getMonth() + 1}`, i = `${e.getDate()}`;
294
290
  const n = e.getFullYear();
@@ -298,7 +294,7 @@ const w = (o) => {
298
294
  }
299
295
  return [n, r, i].join("-");
300
296
  };
301
- function _(o) {
297
+ function Z(o) {
302
298
  const t = document.cookie;
303
299
  if (t.length > 0) {
304
300
  let e = t.indexOf(`${o}=`);
@@ -344,7 +340,7 @@ class I {
344
340
  if (t) {
345
341
  let e;
346
342
  const r = setTimeout(() => {
347
- process.env.NODE_ENV !== "production" && N.warn(
343
+ process.env.NODE_ENV !== "production" && C.warn(
348
344
  `A lock has exceeded ${this.lockWarningTime} ms. Waiting additional ${this.lockErrorTime} ms before rejecting the task.`,
349
345
  t
350
346
  ), e = setTimeout(() => {
@@ -374,8 +370,7 @@ const v = (o) => !!o && typeof o == "object" && !Array.isArray(o), G = (o, ...t)
374
370
  const e = w(o), r = w(t);
375
371
  return O(e, ...r);
376
372
  }, O = (o, ...t) => {
377
- if (!t.length)
378
- return o;
373
+ if (!t.length) return o;
379
374
  const e = t.shift();
380
375
  if (v(o) && v(e))
381
376
  for (const r in e)
@@ -415,13 +410,13 @@ const v = (o) => !!o && typeof o == "object" && !Array.isArray(o), G = (o, ...t)
415
410
  new MutationObserver((f, a) => {
416
411
  f.forEach((g) => {
417
412
  if (g.addedNodes) {
418
- const m = Array.from(
413
+ const h = Array.from(
419
414
  g.addedNodes
420
415
  ).reduce((u, l) => {
421
- const d = l.getAttribute && l.getAttribute("data-name");
422
- return d && i.indexOf(d) > -1 && u.push(d), u;
416
+ const p = l.getAttribute && l.getAttribute("data-name");
417
+ return p && i.indexOf(p) > -1 && u.push(p), u;
423
418
  }, []);
424
- i = i.filter((u) => m.indexOf(u) === -1), !n && i.length === 0 && (n = !0, M(o, t), a.disconnect());
419
+ i = i.filter((u) => h.indexOf(u) === -1), !n && i.length === 0 && (n = !0, M(o, t), a.disconnect());
425
420
  }
426
421
  });
427
422
  }).observe(t, {
@@ -438,7 +433,7 @@ const v = (o) => !!o && typeof o == "object" && !Array.isArray(o), G = (o, ...t)
438
433
  }, X = (o = {}) => (Object.keys(o).forEach((t) => {
439
434
  (o[t] === null || typeof o[t] > "u") && delete o[t];
440
435
  }), o);
441
- function tt(o, t, e) {
436
+ function _(o, t, e) {
442
437
  let r = "";
443
438
  if (e) {
444
439
  const i = /* @__PURE__ */ new Date();
@@ -446,7 +441,7 @@ function tt(o, t, e) {
446
441
  }
447
442
  document.cookie = `${o}=${t}${r}; path=/`;
448
443
  }
449
- const et = (o, t) => {
444
+ const tt = (o, t) => {
450
445
  let e = !0;
451
446
  return Object.keys(o).length !== Object.keys(t).length || Object.keys(o).some((i) => !Object.keys(t).some((c) => i === c)) ? !1 : (Object.keys(o).forEach((i) => {
452
447
  if (e) {
@@ -454,11 +449,11 @@ const et = (o, t) => {
454
449
  e = n.toString() === c.toString();
455
450
  }
456
451
  }), e);
457
- }, h = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
458
- function ot() {
459
- return h() + h() + "-" + h() + "-" + h() + "-" + h() + "-" + h() + h() + h();
452
+ }, d = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
453
+ function et() {
454
+ return d() + d() + "-" + d() + "-" + d() + "-" + d() + "-" + d() + d() + d();
460
455
  }
461
- class rt {
456
+ class ot {
462
457
  constructor(t) {
463
458
  this.queue = [], this.queueAttemptCalls = 0, this.callCount = 5, this.add = (e) => {
464
459
  this.queue.push(e), this.queueAttempt = setInterval(this.processQueue, 1e3);
@@ -475,8 +470,8 @@ class rt {
475
470
  }
476
471
  }
477
472
  export {
478
- N as Logger,
479
- rt as WaitFor,
473
+ C as Logger,
474
+ ot as WaitFor,
480
475
  V as appendClassNames,
481
476
  F as buildCategoryTrail,
482
477
  $ as camilize,
@@ -486,12 +481,12 @@ export {
486
481
  K as dataURItoBlob,
487
482
  B as debugLog,
488
483
  w as deepClone,
489
- U as findAndActivateStoredWidgets,
490
- L as findCategoryById,
491
- Z as formatDate,
484
+ L as findAndActivateStoredWidgets,
485
+ P as findCategoryById,
486
+ U as formatDate,
492
487
  T as formatUrl,
493
488
  z as getCategoryTrailAsObjects,
494
- _ as getCookie,
489
+ Z as getCookie,
495
490
  W as hash,
496
491
  J as htmlParentContains,
497
492
  Q as kebabCase,
@@ -499,7 +494,7 @@ export {
499
494
  G as mergeDeep,
500
495
  R as notifyDataLoaded,
501
496
  X as removeNullAndUndefinedValues,
502
- tt as setCookie,
503
- et as shallowCompare,
504
- ot as uuid
497
+ _ as setCookie,
498
+ tt as shallowCompare,
499
+ et as uuid
505
500
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/widget-utilities",
3
- "version": "1.3.41-rc.1",
3
+ "version": "1.3.41-rc.2",
4
4
  "dependencies": {
5
5
  "@webprovisions/platform": "^1.1.4"
6
6
  },