@telia-ace/widget-utilities 1.3.58-rc.0 → 1.3.58-rc.1
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/escape-handled.d.ts +3 -0
- package/index.d.ts +1 -0
- package/index.js +1 -1
- package/index.mjs +77 -73
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type { Params, ParamValue } from './create-params';
|
|
|
8
8
|
export { default as dataURItoBlob } from './data-uri-to-blob';
|
|
9
9
|
export { debugLog, Logger } from './debug';
|
|
10
10
|
export { default as deepClone } from './deep-clone';
|
|
11
|
+
export { isEscapeHandled, markEscapeHandled } from './escape-handled';
|
|
11
12
|
export { default as findAndActivateStoredWidgets } from './find-and-activate-stored-widgets';
|
|
12
13
|
export { default as findCategoryById } from './find-category-by-id';
|
|
13
14
|
export { default as formatDate } from './format-date';
|
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"&&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;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function z(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 z(e).join(" ").trim()}function I(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 L(...o){let t="";return o.length&&o.forEach(e=>{typeof e=="string"?t=w(t,e):Array.isArray(e)?t=w(t,I(...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,f)=>{r.push([i,n,f]),e=setTimeout(()=>{let a=t();r.forEach(([c,g,m])=>{a=c(a)}),r=[],n(a)},o)}))};function E(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,f=r.length;n<f;n++)t[i].push(E(r[n]))}else r!==null&&typeof r=="object"?t[i]=E(r):t[i]=r}return t}function T(o={}){const{phrase:t="",category:e,guideCategory:r,contactCategory:i,take:n,connectionKey:f,accordion:a,id:c,uriName:g,sorting:m,tag:u,tagId:l,tagTitle:p,...W}=o,s={};return Object.keys(W).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),f&&(s.connectionKey=f),n&&(s.take=n),m&&(s.sorting=m),typeof a=="string"&&a.length>0&&(s.accordion=a),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*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 j=(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=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 x(o,t={},e){return o.forEach(r=>{e&&(t[+r.id]=e),r.items&&x(r.items,t,r.id)}),t}function S(o,t,e=[o],r=x(t)){const i=f=>{const a=r[+f];a&&(e.unshift(a),i(a))},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=j(e,t);return[e,r]})),H=(o,t,e,r="guide-categories")=>e.getAsync("dataClient").then(i=>i.fetch(r,{expandCategories:"descendants"}).then(({categories:n})=>{const f=a=>{const c=S(a,n),g=q(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:T(r==="contact-method-categories"?{contactCategory:l.id,uriName:O(l.title)}:{guideCategory:l.id,uriName:O(l.title)})})}),m};return Array.isArray(t)?t.reduce((a,c)=>{const g=f(c);return g.length>0&&a.push(g),a},[]):f(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),d=class d{constructor(){this.keys=[],this.log=(t,...e)=>this.lookup(t,()=>d.log(...e)),this.warn=(t,...e)=>this.lookup(t,()=>d.warn(...e)),this.error=(t,...e)=>this.lookup(t,()=>d.error(...e)),this.info=(t,...e)=>this.lookup(t,()=>d.info(...e))}lookup(t,e){this.keys.indexOf(t)===-1&&(this.keys.push(t),e())}};d.log=(...t)=>b(console.log,...t),d.warn=(...t)=>b(console.warn,...t),d.error=(...t)=>b(console.error,...t),d.info=(...t)=>b(console.info,...t);let y=d;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},P=Symbol.for("humany.escapeHandled"),V=o=>{o[P]=!0},F=o=>!!o[P],Y=o=>{var e;if(!o)return null;const t=localStorage.getItem(`humany_${D(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)}}}},K=(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 f=`${e.getHours()}`,a=`${e.getMinutes()}`;return f.length<2&&(f=`0${f}`),a.length<2&&(a=`0${a}`),`${[n,r,i].join("-")} ${[f,a].join(":")}`}return[n,r,i].join("-")};function Z(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 D(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 J=(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 Q(o){return o.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/\s+/g,"-").toLowerCase()}class R{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 G(o,t=5e3,e=1e3){return C.has(o)||C.set(o,new R(t,e)),r=>new Promise((i,n)=>{const f=C.get(o);f.add(r,i,n,()=>{f.tasks.length||C.delete(o)})})}const k=o=>!!o&&typeof o=="object"&&!Array.isArray(o),X=(o,...t)=>{const e=A(o),r=A(t);return $(e,...r)},$=(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]:{}}),$(o[r],e[r])):Object.assign(o,{[r]:e[r]});return $(o,...t)},_=(o,t)=>{const e=()=>t.querySelectorAll("[data-loading=true]").length>0,i=(()=>{let f=!1;return()=>{if(f)return;o.get("$widget").events.dispatch("widget:data-loaded",{element:t}),f=!0}})();if(!e())return i();new MutationObserver((f,a)=>{f.find(g=>g.type==="attributes"&&g.attributeName==="data-loading")&&!e()&&(a.disconnect(),i())}).observe(t,{attributes:!0,childList:!0,subtree:!0})},tt=(o,t)=>{o.get("$widget").container.getAsync("components").then(r=>{r.events.subscribeOnce("components:component-model-initialized",()=>{let i=r.nodes.visible.reduce((a,c)=>(!c.name||!c.type||c.type==="view"||c.type==="root"||c.attributes.layout.size==="none"||t.querySelector(`[data-name="${c.name}"]`)||a.push(c.name),a),[]),n=!1;new MutationObserver((a,c)=>{a.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,_(o,t),c.disconnect())}})}).observe(t,{attributes:!1,characterData:!1,childList:!0,subtree:!0,attributeOldValue:!1,characterDataOldValue:!1})})})},et=(o={})=>(Object.keys(o).forEach(t=>{(o[t]===null||typeof o[t]>"u")&&delete o[t]}),o);function ot(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 rt=(o,t)=>{let e=!0;return Object.keys(o).length!==Object.keys(t).length||Object.keys(o).some(i=>!Object.keys(t).some(f=>i===f))?!1:(Object.keys(o).forEach(i=>{if(e){const n=typeof o[i]>"u"?"":o[i],f=typeof t[i]>"u"?"":t[i];e=n.toString()===f.toString()}}),e)},h=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);function it(){return h()+h()+"-"+h()+"-"+h()+"-"+h()+"-"+h()+h()+h()}class nt{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=nt;exports.appendClassNames=L;exports.buildCategoryTrail=H;exports.camilize=E;exports.categoryTrail=S;exports.createBatch=B;exports.createParams=T;exports.dataURItoBlob=M;exports.debugLog=U;exports.deepClone=A;exports.findAndActivateStoredWidgets=Y;exports.findCategoryById=j;exports.formatDate=K;exports.formatUrl=O;exports.getCategoryTrailAsObjects=q;exports.getCookie=Z;exports.hash=D;exports.htmlParentContains=J;exports.isEscapeHandled=F;exports.kebabCase=Q;exports.lock=G;exports.markEscapeHandled=V;exports.mergeDeep=X;exports.notifyDataLoaded=tt;exports.removeNullAndUndefinedValues=et;exports.setCookie=ot;exports.shallowCompare=rt;exports.uuid=it;
|
package/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ function k(o = "", t = "") {
|
|
|
8
8
|
const e = o.split(" ").concat(t.split(" "));
|
|
9
9
|
return q(e).join(" ").trim();
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function P(o, t) {
|
|
12
12
|
if (o) {
|
|
13
13
|
if (typeof t == "string")
|
|
14
14
|
return t;
|
|
@@ -18,16 +18,16 @@ function S(o, t) {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function Y(...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,
|
|
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" && C.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
|
|
30
|
+
const F = (o, t) => {
|
|
31
31
|
let e, r = [];
|
|
32
32
|
return (i) => (clearTimeout(e), new Promise((n, c) => {
|
|
33
33
|
r.push([i, n, c]), e = setTimeout(() => {
|
|
@@ -38,7 +38,7 @@ const Y = (o, t) => {
|
|
|
38
38
|
}, o);
|
|
39
39
|
}));
|
|
40
40
|
};
|
|
41
|
-
function
|
|
41
|
+
function O(o) {
|
|
42
42
|
const t = {};
|
|
43
43
|
if (typeof o == "number" || typeof o == "string")
|
|
44
44
|
return o;
|
|
@@ -48,12 +48,12 @@ function $(o) {
|
|
|
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++)
|
|
51
|
-
t[i].push(
|
|
52
|
-
} else r !== null && typeof r == "object" ? t[i] =
|
|
51
|
+
t[i].push(O(r[n]));
|
|
52
|
+
} else r !== null && typeof r == "object" ? t[i] = O(r) : t[i] = r;
|
|
53
53
|
}
|
|
54
54
|
return t;
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function $(o = {}) {
|
|
57
57
|
const {
|
|
58
58
|
phrase: t = "",
|
|
59
59
|
category: e,
|
|
@@ -68,26 +68,26 @@ function x(o = {}) {
|
|
|
68
68
|
tag: u,
|
|
69
69
|
tagId: l,
|
|
70
70
|
tagTitle: p,
|
|
71
|
-
...
|
|
71
|
+
...S
|
|
72
72
|
} = o, s = {};
|
|
73
|
-
return Object.keys(
|
|
73
|
+
return Object.keys(S).forEach((A) => {
|
|
74
74
|
typeof o[A] == "string" && (s[A] = o[A]);
|
|
75
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;
|
|
76
76
|
}
|
|
77
|
-
function*
|
|
77
|
+
function* T(o) {
|
|
78
78
|
if (o)
|
|
79
79
|
for (let t = 0; t < o.length; t++) {
|
|
80
80
|
const e = o[t];
|
|
81
|
-
yield e, e.items && (yield*
|
|
81
|
+
yield e, e.items && (yield* T(e.items));
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
const
|
|
85
|
-
const e =
|
|
84
|
+
const D = (o, t) => {
|
|
85
|
+
const e = T(t);
|
|
86
86
|
let r = e.next(), i = null;
|
|
87
87
|
for (; !r.done; )
|
|
88
88
|
r.value.id === o && (i = r.value), r = e.next();
|
|
89
89
|
return i;
|
|
90
|
-
},
|
|
90
|
+
}, x = (o) => {
|
|
91
91
|
if (!o)
|
|
92
92
|
return "";
|
|
93
93
|
const t = [
|
|
@@ -186,26 +186,26 @@ const P = (o, t) => {
|
|
|
186
186
|
t.hasOwnProperty(n) && t[n].from.test(o) && (i = i.replace(t[n].from, t[n].to));
|
|
187
187
|
return i = i.replace(e, "-"), i = i.replace(r, ""), i = i.toLowerCase(), i || "humany";
|
|
188
188
|
};
|
|
189
|
-
function
|
|
189
|
+
function N(o, t = {}, e) {
|
|
190
190
|
return o.forEach((r) => {
|
|
191
|
-
e && (t[+r.id] = e), r.items &&
|
|
191
|
+
e && (t[+r.id] = e), r.items && N(r.items, t, r.id);
|
|
192
192
|
}), t;
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function z(o, t, e = [o], r = N(t)) {
|
|
195
195
|
const i = (c) => {
|
|
196
196
|
const f = r[+c];
|
|
197
197
|
f && (e.unshift(f), i(f));
|
|
198
198
|
}, n = r[+o];
|
|
199
199
|
return n && (e.unshift(n), i(n)), e;
|
|
200
200
|
}
|
|
201
|
-
const
|
|
201
|
+
const W = (o, t) => typeof o > "u" || typeof t > "u" ? /* @__PURE__ */ new Map() : new Map(
|
|
202
202
|
o.map((e) => {
|
|
203
|
-
const r =
|
|
203
|
+
const r = D(e, t);
|
|
204
204
|
return [e, r];
|
|
205
205
|
})
|
|
206
|
-
),
|
|
206
|
+
), H = (o, t, e, r = "guide-categories") => e.getAsync("dataClient").then((i) => i.fetch(r, { expandCategories: "descendants" }).then(({ categories: n }) => {
|
|
207
207
|
const c = (f) => {
|
|
208
|
-
const a =
|
|
208
|
+
const a = z(f, n), g = W(a, n), h = [];
|
|
209
209
|
return a.forEach((u) => {
|
|
210
210
|
const l = g.get(u);
|
|
211
211
|
l && h.push({
|
|
@@ -213,12 +213,12 @@ const z = (o, t) => typeof o > "u" || typeof t > "u" ? /* @__PURE__ */ new Map()
|
|
|
213
213
|
title: l.title,
|
|
214
214
|
symbol: l.symbol,
|
|
215
215
|
id: l.id,
|
|
216
|
-
routeParams:
|
|
216
|
+
routeParams: $(r === "contact-method-categories" ? {
|
|
217
217
|
contactCategory: l.id,
|
|
218
|
-
uriName:
|
|
218
|
+
uriName: x(l.title)
|
|
219
219
|
} : {
|
|
220
220
|
guideCategory: l.id,
|
|
221
|
-
uriName:
|
|
221
|
+
uriName: x(l.title)
|
|
222
222
|
})
|
|
223
223
|
});
|
|
224
224
|
}), h;
|
|
@@ -235,7 +235,7 @@ const z = (o, t) => typeof o > "u" || typeof t > "u" ? /* @__PURE__ */ new Map()
|
|
|
235
235
|
r[i] = t.charCodeAt(i);
|
|
236
236
|
return new Blob([new Uint8Array(r)], { type: e });
|
|
237
237
|
};
|
|
238
|
-
function
|
|
238
|
+
function L(...o) {
|
|
239
239
|
return process.env.NODE_ENV !== "production" && console && console.warn(...o);
|
|
240
240
|
}
|
|
241
241
|
const y = (o, t, ...e) => typeof t == "string" ? o(`[humany] ${t}`, ...e) : o(t, ...e), m = class m {
|
|
@@ -256,12 +256,14 @@ const w = (o) => {
|
|
|
256
256
|
for (r in o)
|
|
257
257
|
e = o[r], t[r] = typeof e == "object" && e !== null ? w(e) : e;
|
|
258
258
|
return t;
|
|
259
|
-
},
|
|
259
|
+
}, j = Symbol.for("humany.escapeHandled"), B = (o) => {
|
|
260
|
+
o[j] = !0;
|
|
261
|
+
}, U = (o) => !!o[j], Z = (o) => {
|
|
260
262
|
var e;
|
|
261
263
|
if (!o)
|
|
262
264
|
return null;
|
|
263
265
|
const t = localStorage.getItem(
|
|
264
|
-
`humany_${
|
|
266
|
+
`humany_${I(o.tenant + o.name)}`
|
|
265
267
|
);
|
|
266
268
|
if (t) {
|
|
267
269
|
const { activeStickyWidget: r } = JSON.parse(t);
|
|
@@ -284,7 +286,7 @@ const w = (o) => {
|
|
|
284
286
|
}
|
|
285
287
|
}
|
|
286
288
|
}
|
|
287
|
-
},
|
|
289
|
+
}, J = (o, t = !1) => {
|
|
288
290
|
const e = new Date(o);
|
|
289
291
|
let r = `${e.getMonth() + 1}`, i = `${e.getDate()}`;
|
|
290
292
|
const n = e.getFullYear();
|
|
@@ -294,7 +296,7 @@ const w = (o) => {
|
|
|
294
296
|
}
|
|
295
297
|
return [n, r, i].join("-");
|
|
296
298
|
};
|
|
297
|
-
function
|
|
299
|
+
function Q(o) {
|
|
298
300
|
const t = document.cookie;
|
|
299
301
|
if (t.length > 0) {
|
|
300
302
|
let e = t.indexOf(`${o}=`);
|
|
@@ -306,7 +308,7 @@ function Z(o) {
|
|
|
306
308
|
}
|
|
307
309
|
return null;
|
|
308
310
|
}
|
|
309
|
-
function
|
|
311
|
+
function I(o) {
|
|
310
312
|
let t = 0;
|
|
311
313
|
if (o.length === 0)
|
|
312
314
|
return t.toString();
|
|
@@ -316,7 +318,7 @@ function W(o) {
|
|
|
316
318
|
}
|
|
317
319
|
return t.toString();
|
|
318
320
|
}
|
|
319
|
-
const
|
|
321
|
+
const G = (o, t) => {
|
|
320
322
|
if (!o || !t)
|
|
321
323
|
return !0;
|
|
322
324
|
let e = t.parentNode, r = !1;
|
|
@@ -324,10 +326,10 @@ const J = (o, t) => {
|
|
|
324
326
|
e === o && (r = !0), e = e.parentNode;
|
|
325
327
|
return r;
|
|
326
328
|
};
|
|
327
|
-
function
|
|
329
|
+
function R(o) {
|
|
328
330
|
return o.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/\s+/g, "-").toLowerCase();
|
|
329
331
|
}
|
|
330
|
-
class
|
|
332
|
+
class M {
|
|
331
333
|
constructor(t, e) {
|
|
332
334
|
this.lockWarningTime = t, this.lockErrorTime = e, this.tasks = [], this.current = Promise.resolve(), this.next = this.next.bind(this);
|
|
333
335
|
}
|
|
@@ -358,25 +360,25 @@ class I {
|
|
|
358
360
|
}
|
|
359
361
|
}
|
|
360
362
|
const b = /* @__PURE__ */ new WeakMap();
|
|
361
|
-
function
|
|
362
|
-
return b.has(o) || b.set(o, new
|
|
363
|
+
function X(o, t = 5e3, e = 1e3) {
|
|
364
|
+
return b.has(o) || b.set(o, new M(t, e)), (r) => new Promise((i, n) => {
|
|
363
365
|
const c = b.get(o);
|
|
364
366
|
c.add(r, i, n, () => {
|
|
365
367
|
c.tasks.length || b.delete(o);
|
|
366
368
|
});
|
|
367
369
|
});
|
|
368
370
|
}
|
|
369
|
-
const v = (o) => !!o && typeof o == "object" && !Array.isArray(o),
|
|
371
|
+
const v = (o) => !!o && typeof o == "object" && !Array.isArray(o), _ = (o, ...t) => {
|
|
370
372
|
const e = w(o), r = w(t);
|
|
371
|
-
return
|
|
372
|
-
},
|
|
373
|
+
return E(e, ...r);
|
|
374
|
+
}, E = (o, ...t) => {
|
|
373
375
|
if (!t.length) return o;
|
|
374
376
|
const e = t.shift();
|
|
375
377
|
if (v(o) && v(e))
|
|
376
378
|
for (const r in e)
|
|
377
|
-
v(e[r]) ? (o[r] || Object.assign(o, { [r]: {} }),
|
|
378
|
-
return
|
|
379
|
-
},
|
|
379
|
+
v(e[r]) ? (o[r] || Object.assign(o, { [r]: {} }), E(o[r], e[r])) : Object.assign(o, { [r]: e[r] });
|
|
380
|
+
return E(o, ...t);
|
|
381
|
+
}, V = (o, t) => {
|
|
380
382
|
const e = () => t.querySelectorAll("[data-loading=true]").length > 0, i = (() => {
|
|
381
383
|
let c = !1;
|
|
382
384
|
return () => {
|
|
@@ -398,7 +400,7 @@ const v = (o) => !!o && typeof o == "object" && !Array.isArray(o), G = (o, ...t)
|
|
|
398
400
|
childList: !0,
|
|
399
401
|
subtree: !0
|
|
400
402
|
});
|
|
401
|
-
},
|
|
403
|
+
}, tt = (o, t) => {
|
|
402
404
|
o.get("$widget").container.getAsync("components").then((r) => {
|
|
403
405
|
r.events.subscribeOnce(
|
|
404
406
|
"components:component-model-initialized",
|
|
@@ -416,7 +418,7 @@ const v = (o) => !!o && typeof o == "object" && !Array.isArray(o), G = (o, ...t)
|
|
|
416
418
|
const p = l.getAttribute && l.getAttribute("data-name");
|
|
417
419
|
return p && i.indexOf(p) > -1 && u.push(p), u;
|
|
418
420
|
}, []);
|
|
419
|
-
i = i.filter((u) => h.indexOf(u) === -1), !n && i.length === 0 && (n = !0,
|
|
421
|
+
i = i.filter((u) => h.indexOf(u) === -1), !n && i.length === 0 && (n = !0, V(o, t), a.disconnect());
|
|
420
422
|
}
|
|
421
423
|
});
|
|
422
424
|
}).observe(t, {
|
|
@@ -430,10 +432,10 @@ const v = (o) => !!o && typeof o == "object" && !Array.isArray(o), G = (o, ...t)
|
|
|
430
432
|
}
|
|
431
433
|
);
|
|
432
434
|
});
|
|
433
|
-
},
|
|
435
|
+
}, et = (o = {}) => (Object.keys(o).forEach((t) => {
|
|
434
436
|
(o[t] === null || typeof o[t] > "u") && delete o[t];
|
|
435
437
|
}), o);
|
|
436
|
-
function
|
|
438
|
+
function ot(o, t, e) {
|
|
437
439
|
let r = "";
|
|
438
440
|
if (e) {
|
|
439
441
|
const i = /* @__PURE__ */ new Date();
|
|
@@ -441,7 +443,7 @@ function _(o, t, e) {
|
|
|
441
443
|
}
|
|
442
444
|
document.cookie = `${o}=${t}${r}; path=/`;
|
|
443
445
|
}
|
|
444
|
-
const
|
|
446
|
+
const rt = (o, t) => {
|
|
445
447
|
let e = !0;
|
|
446
448
|
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) => {
|
|
447
449
|
if (e) {
|
|
@@ -450,10 +452,10 @@ const tt = (o, t) => {
|
|
|
450
452
|
}
|
|
451
453
|
}), e);
|
|
452
454
|
}, d = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
|
453
|
-
function
|
|
455
|
+
function it() {
|
|
454
456
|
return d() + d() + "-" + d() + "-" + d() + "-" + d() + "-" + d() + d() + d();
|
|
455
457
|
}
|
|
456
|
-
class
|
|
458
|
+
class nt {
|
|
457
459
|
constructor(t) {
|
|
458
460
|
this.queue = [], this.queueAttemptCalls = 0, this.callCount = 5, this.add = (e) => {
|
|
459
461
|
this.queue.push(e), this.queueAttempt = setInterval(this.processQueue, 1e3);
|
|
@@ -471,30 +473,32 @@ class ot {
|
|
|
471
473
|
}
|
|
472
474
|
export {
|
|
473
475
|
C as Logger,
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
476
|
+
nt as WaitFor,
|
|
477
|
+
Y as appendClassNames,
|
|
478
|
+
H as buildCategoryTrail,
|
|
479
|
+
O as camilize,
|
|
480
|
+
z as categoryTrail,
|
|
481
|
+
F as createBatch,
|
|
482
|
+
$ as createParams,
|
|
481
483
|
K as dataURItoBlob,
|
|
482
|
-
|
|
484
|
+
L as debugLog,
|
|
483
485
|
w as deepClone,
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
486
|
+
Z as findAndActivateStoredWidgets,
|
|
487
|
+
D as findCategoryById,
|
|
488
|
+
J as formatDate,
|
|
489
|
+
x as formatUrl,
|
|
490
|
+
W as getCategoryTrailAsObjects,
|
|
491
|
+
Q as getCookie,
|
|
492
|
+
I as hash,
|
|
493
|
+
G as htmlParentContains,
|
|
494
|
+
U as isEscapeHandled,
|
|
495
|
+
R as kebabCase,
|
|
496
|
+
X as lock,
|
|
497
|
+
B as markEscapeHandled,
|
|
498
|
+
_ as mergeDeep,
|
|
499
|
+
tt as notifyDataLoaded,
|
|
500
|
+
et as removeNullAndUndefinedValues,
|
|
501
|
+
ot as setCookie,
|
|
502
|
+
rt as shallowCompare,
|
|
503
|
+
it as uuid
|
|
500
504
|
};
|