@telia-ace/widget-utilities 1.3.30 → 1.3.31-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/category-trail.d.ts +1 -0
- package/index.js +1 -1
- package/index.mjs +187 -187
- package/notify-data-loaded.d.ts +1 -0
- package/package.json +1 -1
package/category-trail.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function L(e){const t=[];return e.forEach(o=>{t.indexOf(o)===-1&&t.push(o)}),t}function w(e="",t=""){const o=e.split(" ").concat(t.split(" "));return L(o).join(" ").trim()}function W(e,t){if(e){if(typeof t=="string")return t;if(Array.isArray(t)){let o="";return t.forEach(r=>o=w(o,r)),o}}}function z(...e){let t="";return e.length&&e.forEach(o=>{typeof o=="string"?t=w(t,o):Array.isArray(o)?t=w(t,W(...o)):typeof o<"u"&&o!==null&&process.env.NODE_ENV!=="production"&&h.warn("appendClassNames: arguments either haveto be a string or [boolean, ...string[]]. Passed args:",...e)}),t}const I=(e,t)=>{let o,r=[];return i=>(clearTimeout(o),new Promise((n,a)=>{r.push([i,n,a]),o=setTimeout(()=>{let f=t();r.forEach(([c,g,m])=>{f=c(f)}),r=[],n(f)},e)}))};function T(e){const t={};if(typeof e=="number"||typeof e=="string")return e;for(const o in e)if(e.hasOwnProperty(o)){const r=e[o],i=o.substring(0,1).toLowerCase()+o.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(e={}){const{phrase:t="",category:o,guideCategory:r,contactCategory:i,take:n,connectionKey:a,accordion:f,id:c,uriName:g,sorting:m,tag:u,tagId:l,tagTitle:p,...D}=e,s={};return Object.keys(D).forEach(v=>{typeof e[v]=="string"&&(s[v]=e[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 o=="string"&&o!=="0"&&(s.category=o),typeof o=="number"&&o!==0&&(s.category=o),typeof o=="object"&&o!==null&&(typeof o.id=="string"&&o.id!=="0"&&(s.category=o.id),typeof o.id=="number"&&o.id!==0&&(s.category=o.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 p=="string"&&(s.tagTitle=p),typeof s.tag=="string"&&(s.tag=s.tag.split(",")),s}function*x(e){if(e)for(let t=0;t<e.length;t++){const o=e[t];yield o,o.items&&(yield*x(o.items))}}const N=(e,t)=>{const o=x(t);let r=o.next(),i=null;for(;!r.done;)r.value.id===e&&(i=r.value),r=o.next();return i},$=e=>{if(!e)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"}],o=/[^a-zA-Z0-9]+/g,r=/[-]$/;let i=e;for(const n in t)t.hasOwnProperty(n)&&t[n].from.test(e)&&(i=i.replace(t[n].from,t[n].to));return i=i.replace(o,"-"),i=i.replace(r,""),i=i.toLowerCase(),i||"humany"};function E(e,t={},o){return e.forEach(r=>{o&&(t[+r.id]=o),r.items&&E(r.items,t,r.id)}),t}function S(e,t,o=[e],r=E(t)){const i=a=>{const f=r[+a];f&&(o.unshift(f),i(f))},n=r[+e];return n&&(o.unshift(n),i(n)),o}const q=(e,t)=>typeof e>"u"||typeof t>"u"?new Map:new Map(e.map(o=>{const r=N(o,t);return[o,r]})),B=(e,t,o,r="guide-categories")=>o.getAsync("dataClient").then(i=>i.fetch(r,{expandCategories:"descendants"}).then(({categories:n})=>{const a=f=>{const c=S(f,n),g=q(c,n),m=[];return c.forEach(u=>{const l=g.get(u);l&&m.push({routeName:e,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)})),M=e=>{let t;e.split(",")[0].indexOf("base64")!==-1?t=atob(e.split(",")[1]):t=decodeURI(e.split(",")[1]);const o=e.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:o})};function U(...e){return process.env.NODE_ENV!=="production"&&console&&console.warn(...e)}const A=(e,t,...o)=>typeof t=="string"?e(`[humany] ${t}`,...o):e(t,...o),y=class{constructor(){this.keys=[],this.log=(e,...t)=>this.lookup(e,()=>y.log(...t)),this.warn=(e,...t)=>this.lookup(e,()=>y.warn(...t)),this.error=(e,...t)=>this.lookup(e,()=>y.error(...t)),this.info=(e,...t)=>this.lookup(e,()=>y.info(...t))}lookup(e,t){this.keys.indexOf(e)===-1&&(this.keys.push(e),t())}};let h=y;h.log=(...e)=>A(console.log,...e);h.warn=(...e)=>A(console.warn,...e);h.error=(...e)=>A(console.error,...e);h.info=(...e)=>A(console.info,...e);const C=e=>{let t={},o,r;if(typeof e!="object"||e===null)return e;t=Array.isArray(e)?[]:{};for(r in e)o=e[r],t[r]=typeof o=="object"&&o!==null?C(o):o;return t},V=e=>{var o;if(!e)return null;const t=localStorage.getItem(`humany_${P(e.tenant+e.name)}`);if(t){const{activeStickyWidget:r}=JSON.parse(t);if(r&&r.value){const i=e.widgets.get(r.value);if(i)if(r.value.endsWith("_contact-method")){const n=e.widgets.get(r.value.slice(0,-7));(o=n==null?void 0:n.events)==null||o.subscribe("widget:attached",()=>{i.activate(),i.invoke("attach"),i.invoke("open")})}else{const n=document.createElement("a");n.setAttribute("href",`//${e.bindings[0]}/${r.value}`),document.body.appendChild(n)}}}},F=(e,t=!1)=>{const o=new Date(e);let r=`${o.getMonth()+1}`,i=`${o.getDate()}`;const n=o.getFullYear();if(r.length<2&&(r=`0${r}`),i.length<2&&(i=`0${i}`),t){let a=`${o.getHours()}`,f=`${o.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(e){const t=document.cookie;if(t.length>0){let o=t.indexOf(`${e}=`);if(o!==-1){o=o+e.length+1;let r=t.indexOf(";",o);return r===-1&&(r=t.length),unescape(t.substring(o,r))}}return null}function P(e){let t=0;if(e.length===0)return t.toString();for(let o=0;o<e.length;o++){const r=e.charCodeAt(o);t=(t<<5)-t+r,t=t&t}return t.toString()}const _=(e,t)=>{if(!e||!t)return!0;let o=t.parentNode,r=!1;for(;o!==null;)o===e&&(r=!0),o=o.parentNode;return r};function K(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/\s+/g,"-").toLowerCase()}class Z{constructor(t,o){this.lockWarningTime=t,this.lockErrorTime=o,this.tasks=[],this.current=Promise.resolve(),this.next=this.next.bind(this)}add(t,o,r,i){this.tasks.push({task:t,resolve:o,reject:r,done:i}),this.next()}next(){this.current=this.current.then(()=>{const t=this.tasks.shift();if(t){let o;const r=setTimeout(()=>{process.env.NODE_ENV!=="production"&&h.warn(`A lock has exceeded ${this.lockWarningTime} ms. Waiting additional ${this.lockErrorTime} ms before rejecting the task.`,t),o=setTimeout(()=>{t.reject("lock timeout exceeded")},this.lockErrorTime)},this.lockWarningTime),i=Promise.resolve(t.task()).then(n=>(clearTimeout(r),clearTimeout(o),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 J(e,t=5e3,o=1e3){return b.has(e)||b.set(e,new Z(t,o)),r=>new Promise((i,n)=>{const a=b.get(e);a.add(r,i,n,()=>{a.tasks.length||b.delete(e)})})}const k=e=>!!e&&typeof e=="object"&&!Array.isArray(e),Q=(e,...t)=>{const o=C(e),r=C(t);return j(o,...r)},j=(e,...t)=>{if(!t.length)return e;const o=t.shift();if(k(e)&&k(o))for(const r in o)k(o[r])?(e[r]||Object.assign(e,{[r]:{}}),j(e[r],o[r])):Object.assign(e,{[r]:o[r]});return j(e,...t)},H=(e,t)=>{const o=()=>t.querySelectorAll("[data-loading=true]").length>0,i=(()=>{let a=!1;return()=>{if(a)return;e.get("$widget").events.dispatch("widget:data-loaded",{element:t}),a=!0}})();if(!o())return i();new MutationObserver((a,f)=>{a.find(g=>g.type==="attributes"&&g.attributeName==="data-loading")&&!o()&&(f.disconnect(),i())}).observe(t,{attributes:!0,childList:!0,subtree:!0})},R=(e,t)=>{e.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 p=l.getAttribute&&l.getAttribute("data-name");return p&&i.indexOf(p)>-1&&u.push(p),u},[]);i=i.filter(u=>m.indexOf(u)===-1),!n&&i.length===0&&(n=!0,H(e,t),c.disconnect())}})}).observe(t,{attributes:!1,characterData:!1,childList:!0,subtree:!0,attributeOldValue:!1,characterDataOldValue:!1})})})},G=(e={})=>(Object.keys(e).forEach(t=>{(e[t]===null||typeof e[t]>"u")&&delete e[t]}),e);function X(e,t,o){let r="";if(o){const i=new Date;i.setTime(i.getTime()+o*24*60*60*1e3),r=`; expires=${i.toUTCString()}`}document.cookie=`${e}=${t}${r}; path=/`}const tt=(e,t)=>{let o=!0;return Object.keys(e).length!==Object.keys(t).length||Object.keys(e).some(i=>!Object.keys(t).some(a=>i===a))?!1:(Object.keys(e).forEach(i=>{if(o){const n=typeof e[i]>"u"?"":e[i],a=typeof t[i]>"u"?"":t[i];o=n.toString()===a.toString()}}),o)},d=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);function et(){return d()+d()+"-"+d()+"-"+d()+"-"+d()+"-"+d()+d()+d()}class ot{constructor(t){this.queue=[],this.queueAttemptCalls=0,this.callCount=5,this.add=o=>{this.queue.push(o),this.queueAttempt=setInterval(this.processQueue,1e3)},this.processQueue=()=>{if(this.queue.length>0){const o=[];this.queue.forEach((r,i)=>{const n=r();typeof n=="function"&&(n(),o.push(i))}),this.queue=this.queue.filter((r,i)=>!(o.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=h;exports.WaitFor=ot;exports.appendClassNames=z;exports.buildCategoryTrail=B;exports.camilize=T;exports.categoryTrail=S;exports.createBatch=I;exports.createParams=O;exports.dataURItoBlob=M;exports.debugLog=U;exports.deepClone=C;exports.findAndActivateStoredWidgets=V;exports.findCategoryById=N;exports.formatDate=F;exports.formatUrl=$;exports.getCategoryTrailAsObjects=q;exports.getCookie=Y;exports.hash=P;exports.htmlParentContains=_;exports.kebabCase=K;exports.lock=J;exports.mergeDeep=Q;exports.notifyDataLoaded=R;exports.removeNullAndUndefinedValues=G;exports.setCookie=X;exports.shallowCompare=tt;exports.uuid=et;
|
|
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;
|
package/index.mjs
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
function
|
|
1
|
+
function S(o) {
|
|
2
2
|
const t = [];
|
|
3
|
-
return
|
|
4
|
-
t.indexOf(
|
|
3
|
+
return o.forEach((e) => {
|
|
4
|
+
t.indexOf(e) === -1 && t.push(e);
|
|
5
5
|
}), t;
|
|
6
6
|
}
|
|
7
|
-
function k(
|
|
8
|
-
const
|
|
9
|
-
return
|
|
7
|
+
function k(o = "", t = "") {
|
|
8
|
+
const e = o.split(" ").concat(t.split(" "));
|
|
9
|
+
return S(e).join(" ").trim();
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
if (
|
|
11
|
+
function P(o, t) {
|
|
12
|
+
if (o) {
|
|
13
13
|
if (typeof t == "string")
|
|
14
14
|
return t;
|
|
15
15
|
if (Array.isArray(t)) {
|
|
16
|
-
let
|
|
17
|
-
return t.forEach((r) =>
|
|
16
|
+
let e = "";
|
|
17
|
+
return t.forEach((r) => e = k(e, r)), e;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function V(...o) {
|
|
22
22
|
let t = "";
|
|
23
|
-
return
|
|
24
|
-
typeof
|
|
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(
|
|
25
25
|
"appendClassNames: arguments either haveto be a string or [boolean, ...string[]]. Passed args:",
|
|
26
|
-
...
|
|
26
|
+
...o
|
|
27
27
|
);
|
|
28
28
|
}), t;
|
|
29
29
|
}
|
|
30
|
-
const
|
|
31
|
-
let
|
|
32
|
-
return (i) => (clearTimeout(
|
|
33
|
-
r.push([i, n, c]),
|
|
30
|
+
const Y = (o, t) => {
|
|
31
|
+
let e, r = [];
|
|
32
|
+
return (i) => (clearTimeout(e), new Promise((n, c) => {
|
|
33
|
+
r.push([i, n, c]), e = setTimeout(() => {
|
|
34
34
|
let f = t();
|
|
35
35
|
r.forEach(([a, g, m]) => {
|
|
36
36
|
f = a(f);
|
|
37
37
|
}), r = [], n(f);
|
|
38
|
-
},
|
|
38
|
+
}, o);
|
|
39
39
|
}));
|
|
40
40
|
};
|
|
41
|
-
function $(
|
|
41
|
+
function $(o) {
|
|
42
42
|
const t = {};
|
|
43
|
-
if (typeof
|
|
44
|
-
return
|
|
45
|
-
for (const
|
|
46
|
-
if (
|
|
47
|
-
const r = e
|
|
43
|
+
if (typeof o == "number" || typeof o == "string")
|
|
44
|
+
return o;
|
|
45
|
+
for (const e in o)
|
|
46
|
+
if (o.hasOwnProperty(e)) {
|
|
47
|
+
const r = o[e], i = e.substring(0, 1).toLowerCase() + e.substring(1);
|
|
48
48
|
if (Object.prototype.toString.call(r) === "[object Array]") {
|
|
49
49
|
t[i] = [];
|
|
50
50
|
for (let n = 0, c = r.length; n < c; n++)
|
|
@@ -54,10 +54,10 @@ function $(e) {
|
|
|
54
54
|
}
|
|
55
55
|
return t;
|
|
56
56
|
}
|
|
57
|
-
function x(
|
|
57
|
+
function x(o = {}) {
|
|
58
58
|
const {
|
|
59
59
|
phrase: t = "",
|
|
60
|
-
category:
|
|
60
|
+
category: e,
|
|
61
61
|
guideCategory: r,
|
|
62
62
|
contactCategory: i,
|
|
63
63
|
take: n,
|
|
@@ -69,27 +69,27 @@ function x(e = {}) {
|
|
|
69
69
|
tag: u,
|
|
70
70
|
tagId: l,
|
|
71
71
|
tagTitle: d,
|
|
72
|
-
...
|
|
73
|
-
} =
|
|
74
|
-
return Object.keys(
|
|
75
|
-
typeof
|
|
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
|
|
72
|
+
...q
|
|
73
|
+
} = o, s = {};
|
|
74
|
+
return Object.keys(q).forEach((A) => {
|
|
75
|
+
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;
|
|
77
77
|
}
|
|
78
|
-
function* E(
|
|
79
|
-
if (
|
|
80
|
-
for (let t = 0; t <
|
|
81
|
-
const
|
|
82
|
-
yield
|
|
78
|
+
function* E(o) {
|
|
79
|
+
if (o)
|
|
80
|
+
for (let t = 0; t < o.length; t++) {
|
|
81
|
+
const e = o[t];
|
|
82
|
+
yield e, e.items && (yield* E(e.items));
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
let r =
|
|
85
|
+
const L = (o, t) => {
|
|
86
|
+
const e = E(t);
|
|
87
|
+
let r = e.next(), i = null;
|
|
88
88
|
for (; !r.done; )
|
|
89
|
-
r.value.id ===
|
|
89
|
+
r.value.id === o && (i = r.value), r = e.next();
|
|
90
90
|
return i;
|
|
91
|
-
}, T = (
|
|
92
|
-
if (!
|
|
91
|
+
}, T = (o) => {
|
|
92
|
+
if (!o)
|
|
93
93
|
return "";
|
|
94
94
|
const t = [
|
|
95
95
|
{ from: /[äæǽ]+/gi, to: "ae" },
|
|
@@ -181,36 +181,36 @@ const P = (e, t) => {
|
|
|
181
181
|
{ from: /[ю]+/gi, to: "yu" },
|
|
182
182
|
{ from: /[Я]+/gi, to: "Ya" },
|
|
183
183
|
{ from: /[я]+/gi, to: "ya" }
|
|
184
|
-
],
|
|
185
|
-
let i =
|
|
184
|
+
], e = /[^a-zA-Z0-9]+/g, r = /[-]$/;
|
|
185
|
+
let i = o;
|
|
186
186
|
for (const n in t)
|
|
187
|
-
t.hasOwnProperty(n) && t[n].from.test(
|
|
188
|
-
return i = i.replace(
|
|
187
|
+
t.hasOwnProperty(n) && t[n].from.test(o) && (i = i.replace(t[n].from, t[n].to));
|
|
188
|
+
return i = i.replace(e, "-"), i = i.replace(r, ""), i = i.toLowerCase(), i || "humany";
|
|
189
189
|
};
|
|
190
|
-
function j(
|
|
191
|
-
return
|
|
192
|
-
|
|
190
|
+
function j(o, t = {}, e) {
|
|
191
|
+
return o.forEach((r) => {
|
|
192
|
+
e && (t[+r.id] = e), r.items && j(r.items, t, r.id);
|
|
193
193
|
}), t;
|
|
194
194
|
}
|
|
195
|
-
function D(
|
|
195
|
+
function D(o, t, e = [o], r = j(t)) {
|
|
196
196
|
const i = (c) => {
|
|
197
197
|
const f = r[+c];
|
|
198
|
-
f && (
|
|
199
|
-
}, n = r[+
|
|
200
|
-
return n && (
|
|
198
|
+
f && (e.unshift(f), i(f));
|
|
199
|
+
}, n = r[+o];
|
|
200
|
+
return n && (e.unshift(n), i(n)), e;
|
|
201
201
|
}
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
const r =
|
|
205
|
-
return [
|
|
202
|
+
const z = (o, t) => typeof o > "u" || typeof t > "u" ? /* @__PURE__ */ new Map() : new Map(
|
|
203
|
+
o.map((e) => {
|
|
204
|
+
const r = L(e, t);
|
|
205
|
+
return [e, r];
|
|
206
206
|
})
|
|
207
|
-
),
|
|
207
|
+
), F = (o, t, e, r = "guide-categories") => e.getAsync("dataClient").then((i) => i.fetch(r, { expandCategories: "descendants" }).then(({ categories: n }) => {
|
|
208
208
|
const c = (f) => {
|
|
209
|
-
const a = D(f, n), g =
|
|
209
|
+
const a = D(f, n), g = z(a, n), m = [];
|
|
210
210
|
return a.forEach((u) => {
|
|
211
211
|
const l = g.get(u);
|
|
212
212
|
l && m.push({
|
|
213
|
-
routeName:
|
|
213
|
+
routeName: o,
|
|
214
214
|
title: l.title,
|
|
215
215
|
symbol: l.symbol,
|
|
216
216
|
id: l.id,
|
|
@@ -228,129 +228,129 @@ const L = (e, t) => typeof e > "u" || typeof t > "u" ? /* @__PURE__ */ new Map()
|
|
|
228
228
|
const g = c(a);
|
|
229
229
|
return g.length > 0 && f.push(g), f;
|
|
230
230
|
}, []) : c(t);
|
|
231
|
-
})),
|
|
231
|
+
})), K = (o) => {
|
|
232
232
|
let t;
|
|
233
|
-
|
|
234
|
-
const
|
|
233
|
+
o.split(",")[0].indexOf("base64") !== -1 ? t = atob(o.split(",")[1]) : t = decodeURI(o.split(",")[1]);
|
|
234
|
+
const e = o.split(",")[0].split(":")[1].split(";")[0], r = [];
|
|
235
235
|
for (let i = 0; i < t.length; i++)
|
|
236
236
|
r[i] = t.charCodeAt(i);
|
|
237
|
-
return new Blob([new Uint8Array(r)], { type:
|
|
237
|
+
return new Blob([new Uint8Array(r)], { type: e });
|
|
238
238
|
};
|
|
239
|
-
function
|
|
240
|
-
return process.env.NODE_ENV !== "production" && console && console.warn(...
|
|
239
|
+
function B(...o) {
|
|
240
|
+
return process.env.NODE_ENV !== "production" && console && console.warn(...o);
|
|
241
241
|
}
|
|
242
|
-
const C = (
|
|
242
|
+
const C = (o, t, ...e) => typeof t == "string" ? o(`[humany] ${t}`, ...e) : o(t, ...e), y = class p {
|
|
243
243
|
constructor() {
|
|
244
|
-
this.keys = [], this.log = (
|
|
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));
|
|
245
245
|
}
|
|
246
|
-
lookup(
|
|
247
|
-
this.keys.indexOf(
|
|
246
|
+
lookup(t, e) {
|
|
247
|
+
this.keys.indexOf(t) === -1 && (this.keys.push(t), e());
|
|
248
248
|
}
|
|
249
249
|
};
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
const w = (
|
|
256
|
-
let t = {},
|
|
257
|
-
if (typeof
|
|
258
|
-
return
|
|
259
|
-
t = Array.isArray(
|
|
260
|
-
for (r in
|
|
261
|
-
|
|
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;
|
|
255
|
+
const w = (o) => {
|
|
256
|
+
let t = {}, e, r;
|
|
257
|
+
if (typeof o != "object" || o === null)
|
|
258
|
+
return o;
|
|
259
|
+
t = Array.isArray(o) ? [] : {};
|
|
260
|
+
for (r in o)
|
|
261
|
+
e = o[r], t[r] = typeof e == "object" && e !== null ? w(e) : e;
|
|
262
262
|
return t;
|
|
263
|
-
},
|
|
264
|
-
var
|
|
265
|
-
if (!
|
|
263
|
+
}, U = (o) => {
|
|
264
|
+
var e;
|
|
265
|
+
if (!o)
|
|
266
266
|
return null;
|
|
267
267
|
const t = localStorage.getItem(
|
|
268
|
-
`humany_${
|
|
268
|
+
`humany_${W(o.tenant + o.name)}`
|
|
269
269
|
);
|
|
270
270
|
if (t) {
|
|
271
271
|
const { activeStickyWidget: r } = JSON.parse(t);
|
|
272
272
|
if (r && r.value) {
|
|
273
|
-
const i =
|
|
273
|
+
const i = o.widgets.get(r.value);
|
|
274
274
|
if (i)
|
|
275
275
|
if (r.value.endsWith("_contact-method")) {
|
|
276
|
-
const n =
|
|
276
|
+
const n = o.widgets.get(
|
|
277
277
|
r.value.slice(0, -7)
|
|
278
278
|
);
|
|
279
|
-
(
|
|
279
|
+
(e = n == null ? void 0 : n.events) == null || e.subscribe("widget:attached", () => {
|
|
280
280
|
i.activate(), i.invoke("attach"), i.invoke("open");
|
|
281
281
|
});
|
|
282
282
|
} else {
|
|
283
283
|
const n = document.createElement("a");
|
|
284
284
|
n.setAttribute(
|
|
285
285
|
"href",
|
|
286
|
-
`//${
|
|
286
|
+
`//${o.bindings[0]}/${r.value}`
|
|
287
287
|
), document.body.appendChild(n);
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
|
-
},
|
|
292
|
-
const
|
|
293
|
-
let r = `${
|
|
294
|
-
const n =
|
|
291
|
+
}, Z = (o, t = !1) => {
|
|
292
|
+
const e = new Date(o);
|
|
293
|
+
let r = `${e.getMonth() + 1}`, i = `${e.getDate()}`;
|
|
294
|
+
const n = e.getFullYear();
|
|
295
295
|
if (r.length < 2 && (r = `0${r}`), i.length < 2 && (i = `0${i}`), t) {
|
|
296
|
-
let c = `${
|
|
296
|
+
let c = `${e.getHours()}`, f = `${e.getMinutes()}`;
|
|
297
297
|
return c.length < 2 && (c = `0${c}`), f.length < 2 && (f = `0${f}`), `${[n, r, i].join("-")} ${[c, f].join(":")}`;
|
|
298
298
|
}
|
|
299
299
|
return [n, r, i].join("-");
|
|
300
300
|
};
|
|
301
|
-
function
|
|
301
|
+
function _(o) {
|
|
302
302
|
const t = document.cookie;
|
|
303
303
|
if (t.length > 0) {
|
|
304
|
-
let
|
|
305
|
-
if (
|
|
306
|
-
|
|
307
|
-
let r = t.indexOf(";",
|
|
308
|
-
return r === -1 && (r = t.length), unescape(t.substring(
|
|
304
|
+
let e = t.indexOf(`${o}=`);
|
|
305
|
+
if (e !== -1) {
|
|
306
|
+
e = e + o.length + 1;
|
|
307
|
+
let r = t.indexOf(";", e);
|
|
308
|
+
return r === -1 && (r = t.length), unescape(t.substring(e, r));
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
311
|
return null;
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function W(o) {
|
|
314
314
|
let t = 0;
|
|
315
|
-
if (
|
|
315
|
+
if (o.length === 0)
|
|
316
316
|
return t.toString();
|
|
317
|
-
for (let
|
|
318
|
-
const r =
|
|
317
|
+
for (let e = 0; e < o.length; e++) {
|
|
318
|
+
const r = o.charCodeAt(e);
|
|
319
319
|
t = (t << 5) - t + r, t = t & t;
|
|
320
320
|
}
|
|
321
321
|
return t.toString();
|
|
322
322
|
}
|
|
323
|
-
const
|
|
324
|
-
if (!
|
|
323
|
+
const J = (o, t) => {
|
|
324
|
+
if (!o || !t)
|
|
325
325
|
return !0;
|
|
326
|
-
let
|
|
327
|
-
for (;
|
|
328
|
-
|
|
326
|
+
let e = t.parentNode, r = !1;
|
|
327
|
+
for (; e !== null; )
|
|
328
|
+
e === o && (r = !0), e = e.parentNode;
|
|
329
329
|
return r;
|
|
330
330
|
};
|
|
331
|
-
function
|
|
332
|
-
return
|
|
331
|
+
function Q(o) {
|
|
332
|
+
return o.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/\s+/g, "-").toLowerCase();
|
|
333
333
|
}
|
|
334
|
-
class
|
|
335
|
-
constructor(t,
|
|
336
|
-
this.lockWarningTime = t, this.lockErrorTime =
|
|
334
|
+
class I {
|
|
335
|
+
constructor(t, e) {
|
|
336
|
+
this.lockWarningTime = t, this.lockErrorTime = e, this.tasks = [], this.current = Promise.resolve(), this.next = this.next.bind(this);
|
|
337
337
|
}
|
|
338
|
-
add(t,
|
|
339
|
-
this.tasks.push({ task: t, resolve:
|
|
338
|
+
add(t, e, r, i) {
|
|
339
|
+
this.tasks.push({ task: t, resolve: e, reject: r, done: i }), this.next();
|
|
340
340
|
}
|
|
341
341
|
next() {
|
|
342
342
|
this.current = this.current.then(() => {
|
|
343
343
|
const t = this.tasks.shift();
|
|
344
344
|
if (t) {
|
|
345
|
-
let
|
|
345
|
+
let e;
|
|
346
346
|
const r = setTimeout(() => {
|
|
347
|
-
process.env.NODE_ENV !== "production" &&
|
|
347
|
+
process.env.NODE_ENV !== "production" && N.warn(
|
|
348
348
|
`A lock has exceeded ${this.lockWarningTime} ms. Waiting additional ${this.lockErrorTime} ms before rejecting the task.`,
|
|
349
349
|
t
|
|
350
|
-
),
|
|
350
|
+
), e = setTimeout(() => {
|
|
351
351
|
t.reject("lock timeout exceeded");
|
|
352
352
|
}, this.lockErrorTime);
|
|
353
|
-
}, this.lockWarningTime), i = Promise.resolve(t.task()).then((n) => (clearTimeout(r), clearTimeout(
|
|
353
|
+
}, this.lockWarningTime), i = Promise.resolve(t.task()).then((n) => (clearTimeout(r), clearTimeout(e), n));
|
|
354
354
|
return Promise.resolve(i).then(this.next).then(
|
|
355
355
|
() => i.then((n) => {
|
|
356
356
|
t.done(), t.resolve(n);
|
|
@@ -362,49 +362,49 @@ class W {
|
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
const b = /* @__PURE__ */ new WeakMap();
|
|
365
|
-
function
|
|
366
|
-
return b.has(
|
|
367
|
-
const c = b.get(
|
|
365
|
+
function H(o, t = 5e3, e = 1e3) {
|
|
366
|
+
return b.has(o) || b.set(o, new I(t, e)), (r) => new Promise((i, n) => {
|
|
367
|
+
const c = b.get(o);
|
|
368
368
|
c.add(r, i, n, () => {
|
|
369
|
-
c.tasks.length || b.delete(
|
|
369
|
+
c.tasks.length || b.delete(o);
|
|
370
370
|
});
|
|
371
371
|
});
|
|
372
372
|
}
|
|
373
|
-
const v = (
|
|
374
|
-
const
|
|
375
|
-
return O(
|
|
376
|
-
}, O = (
|
|
373
|
+
const v = (o) => !!o && typeof o == "object" && !Array.isArray(o), G = (o, ...t) => {
|
|
374
|
+
const e = w(o), r = w(t);
|
|
375
|
+
return O(e, ...r);
|
|
376
|
+
}, O = (o, ...t) => {
|
|
377
377
|
if (!t.length)
|
|
378
|
-
return
|
|
379
|
-
const
|
|
380
|
-
if (v(
|
|
381
|
-
for (const r in
|
|
382
|
-
v(
|
|
383
|
-
return O(
|
|
384
|
-
},
|
|
385
|
-
const
|
|
378
|
+
return o;
|
|
379
|
+
const e = t.shift();
|
|
380
|
+
if (v(o) && v(e))
|
|
381
|
+
for (const r in e)
|
|
382
|
+
v(e[r]) ? (o[r] || Object.assign(o, { [r]: {} }), O(o[r], e[r])) : Object.assign(o, { [r]: e[r] });
|
|
383
|
+
return O(o, ...t);
|
|
384
|
+
}, M = (o, t) => {
|
|
385
|
+
const e = () => t.querySelectorAll("[data-loading=true]").length > 0, i = (() => {
|
|
386
386
|
let c = !1;
|
|
387
387
|
return () => {
|
|
388
388
|
if (c)
|
|
389
389
|
return;
|
|
390
|
-
|
|
390
|
+
o.get("$widget").events.dispatch("widget:data-loaded", {
|
|
391
391
|
element: t
|
|
392
392
|
}), c = !0;
|
|
393
393
|
};
|
|
394
394
|
})();
|
|
395
|
-
if (!
|
|
395
|
+
if (!e())
|
|
396
396
|
return i();
|
|
397
397
|
new MutationObserver((c, f) => {
|
|
398
398
|
c.find(
|
|
399
399
|
(g) => g.type === "attributes" && g.attributeName === "data-loading"
|
|
400
|
-
) && !
|
|
400
|
+
) && !e() && (f.disconnect(), i());
|
|
401
401
|
}).observe(t, {
|
|
402
402
|
attributes: !0,
|
|
403
403
|
childList: !0,
|
|
404
404
|
subtree: !0
|
|
405
405
|
});
|
|
406
|
-
},
|
|
407
|
-
|
|
406
|
+
}, R = (o, t) => {
|
|
407
|
+
o.get("$widget").container.getAsync("components").then((r) => {
|
|
408
408
|
r.events.subscribeOnce(
|
|
409
409
|
"components:component-model-initialized",
|
|
410
410
|
() => {
|
|
@@ -421,7 +421,7 @@ const v = (e) => !!e && typeof e == "object" && !Array.isArray(e), H = (e, ...t)
|
|
|
421
421
|
const d = l.getAttribute && l.getAttribute("data-name");
|
|
422
422
|
return d && i.indexOf(d) > -1 && u.push(d), u;
|
|
423
423
|
}, []);
|
|
424
|
-
i = i.filter((u) => m.indexOf(u) === -1), !n && i.length === 0 && (n = !0,
|
|
424
|
+
i = i.filter((u) => m.indexOf(u) === -1), !n && i.length === 0 && (n = !0, M(o, t), a.disconnect());
|
|
425
425
|
}
|
|
426
426
|
});
|
|
427
427
|
}).observe(t, {
|
|
@@ -435,71 +435,71 @@ const v = (e) => !!e && typeof e == "object" && !Array.isArray(e), H = (e, ...t)
|
|
|
435
435
|
}
|
|
436
436
|
);
|
|
437
437
|
});
|
|
438
|
-
},
|
|
439
|
-
(
|
|
440
|
-
}),
|
|
441
|
-
function
|
|
438
|
+
}, X = (o = {}) => (Object.keys(o).forEach((t) => {
|
|
439
|
+
(o[t] === null || typeof o[t] > "u") && delete o[t];
|
|
440
|
+
}), o);
|
|
441
|
+
function tt(o, t, e) {
|
|
442
442
|
let r = "";
|
|
443
|
-
if (
|
|
443
|
+
if (e) {
|
|
444
444
|
const i = /* @__PURE__ */ new Date();
|
|
445
|
-
i.setTime(i.getTime() +
|
|
445
|
+
i.setTime(i.getTime() + e * 24 * 60 * 60 * 1e3), r = `; expires=${i.toUTCString()}`;
|
|
446
446
|
}
|
|
447
|
-
document.cookie = `${
|
|
447
|
+
document.cookie = `${o}=${t}${r}; path=/`;
|
|
448
448
|
}
|
|
449
|
-
const
|
|
450
|
-
let
|
|
451
|
-
return Object.keys(
|
|
452
|
-
if (
|
|
453
|
-
const n = typeof
|
|
454
|
-
|
|
449
|
+
const et = (o, t) => {
|
|
450
|
+
let e = !0;
|
|
451
|
+
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
|
+
if (e) {
|
|
453
|
+
const n = typeof o[i] > "u" ? "" : o[i], c = typeof t[i] > "u" ? "" : t[i];
|
|
454
|
+
e = n.toString() === c.toString();
|
|
455
455
|
}
|
|
456
|
-
}),
|
|
456
|
+
}), e);
|
|
457
457
|
}, h = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
|
458
|
-
function
|
|
458
|
+
function ot() {
|
|
459
459
|
return h() + h() + "-" + h() + "-" + h() + "-" + h() + "-" + h() + h() + h();
|
|
460
460
|
}
|
|
461
|
-
class
|
|
461
|
+
class rt {
|
|
462
462
|
constructor(t) {
|
|
463
|
-
this.queue = [], this.queueAttemptCalls = 0, this.callCount = 5, this.add = (
|
|
464
|
-
this.queue.push(
|
|
463
|
+
this.queue = [], this.queueAttemptCalls = 0, this.callCount = 5, this.add = (e) => {
|
|
464
|
+
this.queue.push(e), this.queueAttempt = setInterval(this.processQueue, 1e3);
|
|
465
465
|
}, this.processQueue = () => {
|
|
466
466
|
if (this.queue.length > 0) {
|
|
467
|
-
const
|
|
467
|
+
const e = [];
|
|
468
468
|
this.queue.forEach((r, i) => {
|
|
469
469
|
const n = r();
|
|
470
|
-
typeof n == "function" && (n(),
|
|
471
|
-
}), this.queue = this.queue.filter((r, i) => !(
|
|
470
|
+
typeof n == "function" && (n(), e.push(i));
|
|
471
|
+
}), this.queue = this.queue.filter((r, i) => !(e.indexOf(i) > -1)), this.queueAttempt && clearInterval(this.queueAttempt);
|
|
472
472
|
}
|
|
473
473
|
this.queueAttemptCalls > this.callCount && (clearInterval(this.queueAttempt), this.queueAttemptCalls = 0), this.queueAttemptCalls = this.queueAttemptCalls + 1;
|
|
474
474
|
}, t && t.callCount && (this.callCount = t.callCount);
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
477
|
export {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
478
|
+
N as Logger,
|
|
479
|
+
rt as WaitFor,
|
|
480
|
+
V as appendClassNames,
|
|
481
|
+
F as buildCategoryTrail,
|
|
482
482
|
$ as camilize,
|
|
483
483
|
D as categoryTrail,
|
|
484
|
-
|
|
484
|
+
Y as createBatch,
|
|
485
485
|
x as createParams,
|
|
486
|
-
|
|
487
|
-
|
|
486
|
+
K as dataURItoBlob,
|
|
487
|
+
B as debugLog,
|
|
488
488
|
w as deepClone,
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
489
|
+
U as findAndActivateStoredWidgets,
|
|
490
|
+
L as findCategoryById,
|
|
491
|
+
Z as formatDate,
|
|
492
492
|
T as formatUrl,
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
493
|
+
z as getCategoryTrailAsObjects,
|
|
494
|
+
_ as getCookie,
|
|
495
|
+
W as hash,
|
|
496
|
+
J as htmlParentContains,
|
|
497
|
+
Q as kebabCase,
|
|
498
|
+
H as lock,
|
|
499
|
+
G as mergeDeep,
|
|
500
|
+
R as notifyDataLoaded,
|
|
501
|
+
X as removeNullAndUndefinedValues,
|
|
502
|
+
tt as setCookie,
|
|
503
|
+
et as shallowCompare,
|
|
504
|
+
ot as uuid
|
|
505
505
|
};
|
package/notify-data-loaded.d.ts
CHANGED