@telia-ace/widget-types-grid 1.3.58 → 1.3.59-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/index.js +5 -5
- package/index.mjs +78 -78
- package/package.json +6 -6
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var re=Object.create;var K=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var ue=Object.getPrototypeOf,de=Object.prototype.hasOwnProperty;var le=(t,n,e)=>n in t?K(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var he=(t,n,e,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of ce(n))!de.call(t,i)&&i!==e&&K(t,i,{get:()=>n[i],enumerable:!(s=ae(n,i))||s.enumerable});return t};var I=(t,n,e)=>(e=t!=null?re(ue(t)):{},he(n||!t||!t.__esModule?K(e,"default",{value:t,enumerable:!0}):e,t));var L=(t,n,e)=>le(t,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),z=require("@emotion/react"),w=require("@telia-ace/widget-core"),p=require("@telia-ace/widget-ui"),v=require("react"),k=require("@emotion/styled"),E=require("@telia-ace/widget-utilities"),Q=require("react-transition-group"),J=require("@telia-ace/widget-routing"),_=require("react-router-dom"),h=require("@telia-ace/widget-services"),pe=require("@webprovisions/bootstrapping"),X=require("@webprovisions/platform");var H=(t=>(t.back="back",t.forth="forth",t))(H||{});const me=(t,n,e)=>typeof e[t]=="number"&&typeof e[n]=="number"&&e[t]>e[n]?"back":"forth",ee=({views:t,location:n,render:e})=>f.jsx(_.Switch,{location:n&&{...n,pathname:n.pathname.split("?")[0]},children:[...Object.keys(t).filter(s=>!!t[s].path),...Object.keys(t).filter(s=>!t[s].path)].map(s=>{const i=J.normalizeRoutePaths(t[s].path);return i?Array.isArray(i)?i.map(o=>f.jsx(_.Route,{exact:!0,path:o,render:()=>e(s)},s)):f.jsx(_.Route,{exact:!0,path:i,render:()=>e(s)},s):f.jsx(_.Route,{render:()=>e(s)},s)})}),ge=k.div`
|
|
2
2
|
position: relative;
|
|
3
3
|
width: 100%;
|
|
4
4
|
flex: 1;
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
right: 0;
|
|
9
9
|
${t=>!!t.animationCss&&t.animationCss}
|
|
10
10
|
${t=>!!t.scrollableCss&&t.scrollableCss}
|
|
11
|
-
`,be={index:1,search:2,browse:3,guide:4,contact:5,"contact-method":6,conversation:7},ye=({className:t="",...n})=>{const[e,s]=v.useState("index"),[i,o]=v.useState(H.forth),r=p.useRouteData(),a=p.useRouter(),c=p.useProperties(),l=p.useContext(),d=p.useContainer(),u=p.useComponentNode(),{gap:m="0"}=l,{columns:b=1,animation:y="none",scrollable:g=!1,...S}=c,[C,D]=p.useScroll(g);if(!u||!a)return null;const{location:R}=a;r.name!==e&&r.name!==""&&y&&(o(me(e,r.name,be)),s(r.name));const{views:A}=d.get("$settings");if(!Object.keys(A).length)return null;const x=(O,N,P)=>{const M=G(N,P),j=u.getChildren(O)[0];return f.jsx(fe,{...n,...S,scrollableCss:C,ref:D,columns:b,gap:m,...M,className:E.appendClassNames(t,"humany-view"),children:f.jsx(B,{id:j.id,branch:"default"})})},G=(O,N)=>{if(y==="slide"||y==="fade")return{animationCss:p.transitionComposer.composeViewTransition(O,y,N),"data-state":O}};return f.jsx(ge,{className:"humany-animated-view",children:f.jsx(Q.TransitionGroup,{component:null,childFactory:O=>v.cloneElement(O,{direction:i}),children:f.jsx(Q.Transition,{timeout:{enter:500,exit:500},onEnter:O=>O==null?void 0:O.clientHeight,unmountOnExit:!0,direction:H.forth,children:(O,{direction:N})=>f.jsx(
|
|
11
|
+
`,be={index:1,search:2,browse:3,guide:4,contact:5,"contact-method":6,conversation:7},ye=({className:t="",...n})=>{const[e,s]=v.useState("index"),[i,o]=v.useState(H.forth),r=p.useRouteData(),a=p.useRouter(),c=p.useProperties(),l=p.useContext(),d=p.useContainer(),u=p.useComponentNode(),{gap:m="0"}=l,{columns:b=1,animation:y="none",scrollable:g=!1,...S}=c,[C,D]=p.useScroll(g);if(!u||!a)return null;const{location:R}=a;r.name!==e&&r.name!==""&&y&&(o(me(e,r.name,be)),s(r.name));const{views:A}=d.get("$settings");if(!Object.keys(A).length)return null;const x=(O,N,P)=>{const M=G(N,P),j=u.getChildren(O)[0];return f.jsx(fe,{...n,...S,scrollableCss:C,ref:D,columns:b,gap:m,...M,className:E.appendClassNames(t,"humany-view"),children:f.jsx(B,{id:j.id,branch:"default"})})},G=(O,N)=>{if(y==="slide"||y==="fade")return{animationCss:p.transitionComposer.composeViewTransition(O,y,N),"data-state":O}};return f.jsx(ge,{className:"humany-animated-view",children:f.jsx(Q.TransitionGroup,{component:null,childFactory:O=>v.cloneElement(O,{direction:i}),children:f.jsx(Q.Transition,{timeout:{enter:500,exit:500},onEnter:O=>O==null?void 0:O.clientHeight,unmountOnExit:!0,direction:H.forth,children:(O,{direction:N})=>f.jsx(ee,{views:A,location:R,render:P=>x(P,O,N)})},e)})})},we=k(p.Grid)`
|
|
12
12
|
${t=>!!t.scrollableCss&&t.scrollableCss}
|
|
13
|
-
`,ve=({className:t="",...n})=>{const e=p.useProperties(),s=p.useContext(),i=p.useContainer(),o=p.useComponentNode(),{views:r}=i.get("$settings"),{gap:a="0"}=s,{columns:c=1,animation:l="none",scrollable:d=!1,...u}=e,[m,b]=p.useScroll(d);return o?f.jsx(we,{...n,...u,scrollableCss:m,ref:b,columns:c,gap:a,className:E.appendClassNames(t,"humany-view"),children:f.jsx(
|
|
13
|
+
`,ve=({className:t="",...n})=>{const e=p.useProperties(),s=p.useContext(),i=p.useContainer(),o=p.useComponentNode(),{views:r}=i.get("$settings"),{gap:a="0"}=s,{columns:c=1,animation:l="none",scrollable:d=!1,...u}=e,[m,b]=p.useScroll(d);return o?f.jsx(we,{...n,...u,scrollableCss:m,ref:b,columns:c,gap:a,className:E.appendClassNames(t,"humany-view"),children:f.jsx(ee,{views:r,render:y=>{const g=o.getChildren(y)[0];return f.jsx(B,{id:g.id,node:g,branch:"default"})}})}):null},W=t=>{var n,e;return z.css`
|
|
14
14
|
outline: none;
|
|
15
15
|
box-sizing: border-box;
|
|
16
16
|
* {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
`,Ee=v.forwardRef(({className:t="",children:n,...e},s)=>{const i=p.useComponent(),{name:o,type:r,id:a}=p.useComponentDescriptor(),c=v.useMemo(()=>i?k(i)`
|
|
51
51
|
${W}
|
|
52
52
|
${p.filterCssPropsStyle}
|
|
53
|
-
`:null,[i]);return typeof i>"u"?null:i===null||c===null?process.env.NODE_ENV!=="production"?f.jsx(Oe,{...e,title:`type: ${r}, definition-id: ${o}, instance-id: ${a}`,className:E.appendClassNames(t,"humany-non-resolved-component"),children:f.jsx(p.Typography,{variant:"h5",children:"Non Resolved Component Type"})}):null:f.jsx(v.Suspense,{fallback:null,children:f.jsx(c,{ref:s,...e,className:E.appendClassNames(t,"humany-component",`humany-component-${o}`),children:n})})}),xe=t=>{const n=p.useComponentNode(t),e=p.useComponentPlatform(),[s,i]=v.useState({}),o=p.useIsMounted();return v.useEffect(()=>{n&&o.current&&i(n.attributes.properties)},[n,t,o]),v.useEffect(()=>{if(e){const r=e.events.subscribe("components:properties-changed",(a,c)=>{n===c.node&&o.current&&i(c.node.attributes.properties)});return()=>{r()}}},[e,o,t,n]),s},Me=(t,n)=>n?!0:typeof t=="string"?t==="full":t>0,B=v.forwardRef(({className:t="",id:n,branch:e,node:s,ariaLabel:i,tabIndex:o,context:r,...a},c)=>{const l=p.useComponentPlatform(),d=p.useContainer(),[u,m]=v.useState(),b=p.useColumns(),y=p.useContext(n),g=xe(n),{size:S="none",indent:C=0}=p.useLayout(n),D=Me(S,s);if(v.useEffect(()=>{if(l){if(n&&!s){const M=l.nodes.get(n);if(M&&(m(w.asDescriptor(M,e)),D)){const j=M.mount(d);return()=>{j()}}}else if(s){m(w.asDescriptor(s,e));const M=s.mount(d);return()=>{M()}}}},[l,n,s,D]),!u||!D)return null;const R={...y,...r||{}},{cardinal:A,fonts:x={},accessibility:G={},...O}=R,N={type:x.type,base:x.base||"16px",small:x.small||"0.8em",normal:x.normal||"1em",medium:x.medium||"1.2em",large:x.large||"1.6em",huge:x.huge||"2.5em"},P={...O,fonts:N,accessibility:{...G}};return typeof A=="number"&&(P.sizes={cardinal:A,small:`${A}px`,normal:`${A*3}px`,medium:`${A*5}px`,large:`${A*8}px`}),f.jsx(z.ThemeProvider,{theme:P,children:f.jsx(p.ComponentNodeContext.Provider,{value:u,children:f.jsx(p.ComponentPropertyContext.Provider,{value:g,children:(()=>{const M={"data-width":S==="full"?b:Math.min(S,b),"data-indent":C,"data-name":u.name,"data-node-id":u.id,"data-component-type":u.type,"aria-label":i,tabIndex:o,id:u.id,role:g.role?g&&g.role:null,...a};switch(u.type){case"view":return typeof g.animation=="string"&&g.animation!=="none"?f.jsx(Ce,{...M,className:t}):f.jsx(Se,{...M,className:t});default:{const j=p.filterCssProps(g);return f.jsx(Ee,{ref:c,...M,...j,className:t})}}})()})})})}),
|
|
53
|
+
`:null,[i]);return typeof i>"u"?null:i===null||c===null?process.env.NODE_ENV!=="production"?f.jsx(Oe,{...e,title:`type: ${r}, definition-id: ${o}, instance-id: ${a}`,className:E.appendClassNames(t,"humany-non-resolved-component"),children:f.jsx(p.Typography,{variant:"h5",children:"Non Resolved Component Type"})}):null:f.jsx(v.Suspense,{fallback:null,children:f.jsx(c,{ref:s,...e,className:E.appendClassNames(t,"humany-component",`humany-component-${o}`),children:n})})}),xe=t=>{const n=p.useComponentNode(t),e=p.useComponentPlatform(),[s,i]=v.useState({}),o=p.useIsMounted();return v.useEffect(()=>{n&&o.current&&i(n.attributes.properties)},[n,t,o]),v.useEffect(()=>{if(e){const r=e.events.subscribe("components:properties-changed",(a,c)=>{n===c.node&&o.current&&i(c.node.attributes.properties)});return()=>{r()}}},[e,o,t,n]),s},Me=(t,n)=>n?!0:typeof t=="string"?t==="full":t>0,B=v.forwardRef(({className:t="",id:n,branch:e,node:s,ariaLabel:i,tabIndex:o,context:r,...a},c)=>{const l=p.useComponentPlatform(),d=p.useContainer(),[u,m]=v.useState(),b=p.useColumns(),y=p.useContext(n),g=xe(n),{size:S="none",indent:C=0}=p.useLayout(n),D=Me(S,s);if(v.useEffect(()=>{if(l){if(n&&!s){const M=l.nodes.get(n);if(M&&(m(w.asDescriptor(M,e)),D)){const j=M.mount(d);return()=>{j()}}}else if(s){m(w.asDescriptor(s,e));const M=s.mount(d);return()=>{M()}}}},[l,n,s,D]),!u||!D)return null;const R={...y,...r||{}},{cardinal:A,fonts:x={},accessibility:G={},...O}=R,N={type:x.type,base:x.base||"16px",small:x.small||"0.8em",normal:x.normal||"1em",medium:x.medium||"1.2em",large:x.large||"1.6em",huge:x.huge||"2.5em"},P={...O,fonts:N,accessibility:{...G}};return typeof A=="number"&&(P.sizes={cardinal:A,small:`${A}px`,normal:`${A*3}px`,medium:`${A*5}px`,large:`${A*8}px`}),f.jsx(z.ThemeProvider,{theme:P,children:f.jsx(p.ComponentNodeContext.Provider,{value:u,children:f.jsx(p.ComponentPropertyContext.Provider,{value:g,children:(()=>{const M={"data-width":S==="full"?b:Math.min(S,b),"data-indent":C,"data-name":u.name,"data-node-id":u.id,"data-component-type":u.type,"aria-label":i,tabIndex:o,id:u.id,role:g.role?g&&g.role:null,...a};switch(u.type){case"view":return typeof g.animation=="string"&&g.animation!=="none"?f.jsx(Ce,{...M,className:t}):f.jsx(Se,{...M,className:t});default:{const j=p.filterCssProps(g);return f.jsx(Ee,{ref:c,...M,...j,className:t})}}})()})})})}),te=({builder:t})=>{const n=p.useContainer(),[e,s]=v.useState(null);return v.useEffect(()=>{n.getAsync("components").then(i=>t(i).then(o=>{s(o)}))},[]),v.useEffect(()=>()=>{e&&n.getAsync("components").then(i=>{i.nodes.detached=i.nodes.detached.filter(o=>o.id!==e.id)})},[e]),e?f.jsx(B,{id:e.id,node:e,branch:"default"}):null},De=Object.freeze(Object.defineProperty({__proto__:null,default:te},Symbol.toStringTag,{value:"Module"})),Ae=v.lazy(()=>Promise.resolve().then(()=>De)),Ne=({showSearch:t=!1})=>{const n=z.useTheme(),e=p.useContainer();return f.jsx(v.Suspense,{fallback:null,children:f.jsx(Ae,{builder:s=>e.get("settings").then(i=>{var l;const{properties:o,context:r}=Object.keys(i.components).reduce((d,u)=>(i.components[u].type==="not-found"&&(d.properties=i.components[u].properties,d.context=i.components[u].context),d),{properties:{},context:{}});o.showSearch=t;const a=s.createNode("area",{detached:!0});if(a.name="not-found-area",a.writeLayout({size:"full"}),t){const d=Object.keys(i.components).reduce((m,b)=>i.components[b].type==="search"?i.components[b].properties:m,{}),u=s.createNode("search",{detached:!0});u.writeLayout({size:"full"}),u.writeProperties({"css-margin-bottom":((l=n==null?void 0:n.sizes)==null?void 0:l.normal)||"15px",...d}),a.appendChild(u)}const c=s.createNode("not-found",{detached:!0});return c.writeLayout({size:"full"}),c.writeProperties(o),c.writeContext(r),a.appendChild(c),a})})})},Le='a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',F=t=>t.getClientRects().length>0&&window.getComputedStyle(t).visibility!=="hidden",ne=(t,n=F)=>Array.from(t.querySelectorAll(Le)).filter(n),q=t=>!!t.querySelector('[aria-modal="true"], .humany-area-modal'),$e=t=>t.tagName==="BUTTON"||t.tagName==="A"&&t.hasAttribute("href")||t.tagName==="INPUT"&&["button","submit"].includes(t.type),ke=t=>{if($e(t))return()=>{};const n=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),t.click())};return t.addEventListener("keydown",n),()=>t.removeEventListener("keydown",n)},Pe=(t,n,e,s=F)=>{const i=ne(n,s),o=document.activeElement;if(!i.length||!o){t.preventDefault();return}(t.shiftKey?i.some(a=>a.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING):i.some(a=>o.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_FOLLOWING))||(t.preventDefault(),e&&e.isConnected&&s(e)?e.focus():(t.shiftKey?i[i.length-1]:i[0]).focus())},Re=(t,{timeout:n=1e3,interval:e=50,visible:s=F}={})=>{const i=()=>{if(q(t))return!0;const a=t.querySelector("h1");return!a||!s(a)?!1:(a.hasAttribute("tabindex")||a.setAttribute("tabindex","-1"),a.focus(),document.activeElement===a)};if(i())return()=>{};const o=Date.now(),r=window.setInterval(()=>{var a;i()?window.clearInterval(r):Date.now()-o>=n&&(window.clearInterval(r),t.contains(document.activeElement)||(a=t.querySelector('[data-node-id][tabindex="-1"]'))==null||a.focus())},e);return()=>window.clearInterval(r)},je=(t,n,e,s=F)=>{let i=!1,o=()=>{};const r=t.events.subscribe("widget:render-state-changed",(l,{next:d})=>{i=d==="open",o(),o=i?Re(n,{visible:s}):()=>{}}),a=l=>{!i||q(n)||(l.key==="Tab"?Pe(l,n,e,s):l.key==="Escape"&&window.setTimeout(()=>{i&&!E.isEscapeHandled(l)&&t.invoke("hide",{focusTrigger:!0})}))},c=l=>{if(!i||l.key!=="Tab"||q(n))return;const d=ne(n,s);d.length&&(l.preventDefault(),(l.shiftKey?d[d.length-1]:d[0]).focus())};return n.addEventListener("keydown",a),e.addEventListener("keydown",c),()=>{o(),r(),n.removeEventListener("keydown",a),e.removeEventListener("keydown",c)}},Ie=t=>{if(t){const{type:n,content:e}=t;switch(n){case"FontAwesome":return`<i class="humany-icon fa fa-${e}"></i>`;case"Uri":return`<i class="humany-icon humany-custom-icon" style="background: url(${e}) no-repeat center center;background-size: contain;"></i>`;default:return""}}},We=t=>{const n=(i,o)=>{i&&(o?i.classList.add("humany-tabbing"):i.classList.remove("humany-tabbing"))},e=i=>{i.key==="Tab"?n(t,!0):i.key==="Enter"&&document.activeElement&&document.activeElement.classList.contains("humany-trigger")||n(t,!1)},s=i=>{document.activeElement&&document.activeElement.classList.contains("humany-trigger")&&document.activeElement.classList.contains("humany-tabbing")||n(t,!1)};return document.addEventListener("keydown",e),document.addEventListener("click",s),()=>{document.removeEventListener("keydown",e),document.removeEventListener("click",s)}};function _e(t,n){const{symbol:e,widgetName:s,label:i="",ariaLabel:o="",tooltip:r=""}=n;t.classList.add("humany-trigger"),t.classList.add(`humany_${s}`),i.length&&t.classList.add("humany-has-text"),o.length&&!t.getAttribute("aria-label")&&t.setAttribute("aria-label",o),o.length&&!t.getAttribute("tabindex")&&t.setAttribute("tabindex","0"),r.length&&!t.getAttribute("title")&&t.setAttribute("title",r);const a=Ie(e)||"";return t.innerHTML=`${a}
|
|
54
54
|
<span class="humany-close">
|
|
55
55
|
<svg width="18" height="9" viewBox="0 0 18 9" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
56
56
|
<path d="M9 9C8.81794 9.00045 8.63759 8.96634 8.46939 8.89965C8.3012 8.83295 8.14851 8.735 8.02015 8.61145L0.194523 1.12367C0.068294 0.99862 -0.00155266 0.831133 2.61958e-05 0.657285C0.00160506 0.483436 0.0744832 0.317136 0.202964 0.194202C0.331445 0.0712675 0.505249 0.00153576 0.686941 2.50649e-05C0.868634 -0.00148563 1.04368 0.0653456 1.17437 0.186125L9 7.6739L16.8256 0.186125C16.9563 0.0653456 17.1314 -0.00148563 17.3131 2.50649e-05C17.4948 0.00153576 17.6686 0.0712675 17.797 0.194202C17.9255 0.317136 17.9984 0.483436 18 0.657285C18.0016 0.831133 17.9317 0.99862 17.8055 1.12367L9.97985 8.61145C9.85149 8.735 9.6988 8.83295 9.53061 8.89965C9.36241 8.96634 9.18206 9.00045 9 9Z" fill="white"/>
|
|
@@ -68,4 +68,4 @@
|
|
|
68
68
|
stroke-miterlimit="10" />
|
|
69
69
|
</svg>
|
|
70
70
|
</span>
|
|
71
|
-
${i.length?`<span>${i}</span>`:""}`,setTimeout(()=>t&&t.classList.add("humany-rendered")),We(t)}function Ve(t,n){t instanceof HTMLElement?(n&&t.setAttribute("title",n),t.classList.remove("humany-active"),t.classList.remove("humany-loading")):t instanceof Array&&t.forEach(e=>{n&&e.setAttribute("title",n),e.classList.remove("humany-active"),e.classList.remove("humany-loading")})}function Te(t){t instanceof HTMLElement?(t.classList.remove("humany-active"),t.classList.add("humany-loading")):t instanceof Array&&t.forEach(n=>{n.classList.remove("humany-active"),n.classList.add("humany-loading")})}function ne(t,n){t instanceof HTMLElement?(n&&t.setAttribute("title",n),t.classList.add("humany-active"),t.classList.remove("humany-loading")):t instanceof Array&&t.forEach(e=>{n&&e.setAttribute("title",n),e.classList.add("humany-active"),e.classList.remove("humany-loading")})}var $=(t=>(t.Inline="inline",t.Link="link",t.Badge="badge",t.Unsupported="unsupported",t))($||{});const qe=(t,n)=>t&&n?"both":t?"widgetDOM":n?"triggerDOM":"none",ie=t=>t?typeof t=="boolean"&&t?"link":typeof t=="object"&&!Array.isArray(t)?"badge":"unsupported":"inline",ze=(t,n,e,s,i=!1)=>{var l,d;const o=qe(n,e),r=ie(s),a={widgetDOMElement:n?n.cloneNode(!0):void 0,triggerDOMElement:e?e.cloneNode(!0):void 0},c={triggerType:r,cachedOriginals:a,widgetDOMElement:document.createElement("div")};switch(o){case"both":{c.widgetDOMElement=n||document.createElement("div"),r!=="inline"&&(c.triggerDOMElement=e);break}case"widgetDOM":{if(c.widgetDOMElement=n||document.createElement("div"),r!=="inline"){const u=document.body.appendChild(document.createElement("a"));r==="link"&&(u.innerText=t),c.triggerDOMElement=u}break}case"triggerDOM":{const u=document.createElement("div");c.widgetDOMElement=u,r==="inline"?(u.id=(e==null?void 0:e.id)||"",i?(u.style.display="none",(l=e==null?void 0:e.parentNode)==null||l.appendChild(u),c.callback=()=>{var m;(m=e==null?void 0:e.parentNode)==null||m.replaceChild(u,e),u.style.display=(e==null?void 0:e.style.display)||"block"}):(d=e==null?void 0:e.parentNode)==null||d.replaceChild(u,e),c.cachedOriginals.widgetDOMElement=e,c.cachedOriginals.triggerDOMElement=void 0):(c.widgetDOMElement=document.body.appendChild(u),c.triggerDOMElement=e);break}case"none":{const u=document.body.appendChild(document.createElement("div"));if(c.widgetDOMElement=u,r!=="inline"){const m=document.body.appendChild(document.createElement("a"));r==="link"&&(m.innerText=t),c.triggerDOMElement=m}break}}return c},Be="modals";class Fe{constructor(n,e){L(this,"container");L(this,"unsubscribe",[]);var a,c,l,d,u,m,b;this.options=e,this.container=n.createChild(this),this.container.register("widgetDOMElement",this.options.widgetDOMElement),this.container.register("triggerDOMElement",this.options.triggerDOMElement);const s=this.container.get("$widget"),i=n.get("$settings");(a=this.options.widgetDOMElement)==null||a.classList.add("humany-widget"),(c=this.options.widgetDOMElement)==null||c.setAttribute("role","region"),(d=this.options.widgetDOMElement)==null||d.setAttribute("aria-label",((l=i==null?void 0:i.data)==null?void 0:l.widgetAriaLabel)??"Widget"),this.options.triggerDOMElement&&((u=this.options.widgetDOMElement)==null||u.setAttribute("id",`humany_widget_${s.name}`),(m=this.options.triggerDOMElement)==null||m.setAttribute("aria-controls",`humany_widget_${s.name}`),this.unsubscribe.push(je(s,this.options.widgetDOMElement,this.options.triggerDOMElement),ke(this.options.triggerDOMElement))),(b=this.options.widgetDOMElement)==null||b.classList.add(`humany_${s.name}`),new MutationObserver(()=>{Array.from(this.options.widgetDOMElement.querySelectorAll('[aria-label=""]')).forEach(y=>y.removeAttribute("aria-label"))}).observe(this.options.widgetDOMElement,{childList:!0,subtree:!0});const r=n.get("widgetDOMElements")||[];n.register("widgetDOMElements",[...r,this.options.widgetDOMElement])}render(){const{widgetDOMElement:n,triggerDOMElement:e}=this.options,s=this.container.get("$widget");return n.getAttribute("data-rendered")==="true"?Promise.resolve():(e&&this.options.triggerType===$.Badge&&Te(e),Promise.resolve().then(()=>require("./render-M_i97UPk.js")).then(i=>i.default(this.container,n)).then(()=>{if(n.setAttribute("data-rendered","true"),e&&this.options.triggerType===$.Badge){const o=this.options.triggerOptions.openTooltip;ne(e,o)}E.notifyDataLoaded(this.container,n);const i=this.container.get("$environment").widgets.all();h.readStorage(this.container,Be,h.StorageMedium.Session).then(o=>{o&&o.forEach(r=>{i.find(a=>a.name===r.name&&a.state==="activated")&&s.events.dispatch("widget:modal-opened",r)})})}))}renderBadge(n){const{triggerDOMElement:e}=this.options;if(!e)return;e.getAttribute("role")||e.setAttribute("role","button");const{name:s}=this.container.get("$widget"),{label:i,symbol:o,ariaLabel:r,closedTooltip:a,openTooltip:c}=n,l={closedTooltip:a,openTooltip:c};this.options.triggerOptions=l;const d=_e(e,{label:i,symbol:o,ariaLabel:r,widgetName:s,tooltip:a});this.unsubscribe.push(d)}dispose(){return Promise.resolve().then(()=>require("./unmount-1FZXwHPT.js")).then(n=>{var i,o,r,a;const{triggerDOMElement:e,widgetDOMElement:s}=this.options;n.default(s),this.options.cachedOriginals.widgetDOMElement&&s&&((i=s.parentNode)==null||i.replaceChild(this.options.cachedOriginals.widgetDOMElement,s)),this.options.cachedOriginals.triggerDOMElement&&e&&((o=e.parentNode)==null||o.replaceChild(this.options.cachedOriginals.triggerDOMElement,e)),this.unsubscribe.forEach(c=>{c()}),(r=s.parentNode)==null||r.removeChild(s),(a=e==null?void 0:e.parentNode)==null||a.removeChild(e)})}}const V="changesets",Ge=t=>{const n={tags:t.tags};return t.context&&typeof t.context!="function"&&(n.context=t.context),t.properties&&typeof t.properties!="function"&&(n.properties=t.properties),t.layout&&typeof t.layout!="function"&&(n.layout=t.layout),n};class Y{constructor(n,e){this.container=n,this.storageWriter=e}static create(n){return h.createStorageWriter(n,V,h.StorageCategory.Necessary,{medium:h.StorageMedium.Local}).then(e=>new Y(n,e))}write(n,e,s,i){return E.lock(this)(()=>h.readStorage(this.container,V,h.StorageMedium.Local).then((o={})=>{const{keys:r=[],items:a={}}=o,c=r.indexOf(n);return c>-1&&r.splice(c,1),r.push(n),a[n]={options:i,attributes:Ge(s),rules:e.rules},this.storageWriter({keys:r,items:a})}))}remove(n){return E.lock(this)(()=>h.readStorage(this.container,V,h.StorageMedium.Local).then((e={})=>{const{keys:s=[],items:i={}}=e,o=s.indexOf(n);if(o>-1)return s.splice(o,1),delete i[n],this.storageWriter(e)}))}load(n){return E.lock(this)(()=>h.readStorage(this.container,V,h.StorageMedium.Local).then((e={})=>{const{keys:s=[],items:i={}}=e;s.forEach(o=>{const r=i[o];if(r){const{rules:a,attributes:c,options:l}=r;n.write({attributes:c,options:l,target:new w.ComponentQuery(n,a)})}})}))}}const Ke=t=>{const{container:n}=t;return Y.create(n).then(e=>{const s=n.get("$settings"),i={localStorage:e},o=new w.ComponentPlatform(t,i),r=w.createComponentModel(o,s);return t.events.subscribe("widget:state-change",(a,c)=>{c.state===J.WidgetState.Deactivating&&r()}),o})},Ue=t=>import("@telia-ace/widget-routing").then(({RoutingService:n,HistoryMode:e})=>t.get("settings").then(s=>{const{routing:{initialPath:i="/",mode:o=e.scopedHash,basePath:r},views:a}=s;return new n(t,{initialPath:i,mode:o,routes:Object.keys(a).map(l=>({name:l,path:a[l].path})),basePath:r})})),He=t=>import("@telia-ace/widget-services").then(({StorageProvider:n})=>new n),Ye=t=>import("@telia-ace/widget-core").then(({ActionResolver:n})=>new n(t)),Qe=t=>import("@telia-ace/widget-core").then(({ComponentResolver:n})=>new n(t)),Ze=t=>import("@telia-ace/widget-core").then(({ComponentPlatform:n,createComponentModel:e})=>Ke(t.get("$widget"))),U="$settings",T="open",Z="activeStickyWidget";class se extends J.WidgetType{constructor(e){super(e);L(this,"outlets",new Map);L(this,"activated");L(this,"subs",[]);L(this,"handleBootstrapping",e=>{const s={triggerDOMElement:e.sourceDOMElement,withRenderState:"storage"};this.container.get("settings").then(i=>{const{activate:o}=i;(typeof o>"u"||o===null||o===!0)&&(this.activated=(this.activated||this.widget.activate()).then(()=>this.attach(s)))})});this.container.registerAsync("storage",()=>He(this.container)),this.container.registerFactory("settings",()=>h.readStorage(this.container,U,h.StorageMedium.Local).then((s={})=>({...this.container.get("$settings"),...s}))),pe.supportBootstrapping(this,"load",this.handleBootstrapping),this.container.registerAsync("componentResolver",()=>Qe(this.container)),this.container.registerAsync("router",()=>Ue(this.container)),this.container.registerAsync("actionResolver",()=>Ye(this.container)),this.container.register("matchMedia",window.matchMedia),this.container.registerAsync("components",()=>Ze(this.container))}initialize(){const e=this.container.getManyAsync("actionResolver","router","components"),s=this.container.get("csp");return s&&(window.webprovisionsEnvironmentVariables||(window.webprovisionsEnvironmentVariables={}),window.webprovisionsEnvironmentVariables.cspNonce=s.nonce),Promise.all([e,this.container.get("settings")]).then(([{actionResolver:i,router:o,components:r},a])=>{var d;i.subscribe(this.widget.name,(u,m,b)=>this.onAction(m,b));const c=u=>{r.nodes.query({type:"view"}).forEach(m=>{r.setSwitch(m,u)})},l=((d=o.getInitialRoute())==null?void 0:d.name)||"index";return c(l),this.events.subscribe("widget:data-loaded",(u,{element:m})=>{this.widget.container.get("seoConfiguration")&&this.events.dispatch("widget:preloaded-replaced",{element:m})}),this.events.subscribe("router:change",(u,{previous:m={routeData:{}},next:b={routeData:{}}})=>{const{routeData:y}=m,{routeData:g}=b,S=Object.keys(a.views).reduce((C,D)=>typeof a.views[D].path>"u"?D:C,"");!g.name&&S?c(S):c(g.name),E.removeNullAndUndefinedValues(y&&y.params),E.removeNullAndUndefinedValues(g&&g.params),this.container.getAsync("actionResolver").then(C=>{C.action(this.widget.name,"routeChange",{next:g,previous:y})})}),o.initialize()})}attach(e={}){return this.container.get("settings").then(({trigger:s})=>{var b,y;const{widgetDOMElement:i,key:o=E.uuid(),triggerDOMElement:r,withRenderState:a}=e,l=ie(s)===$.Inline&&((r==null?void 0:r.childElementCount)||0)>0,d=ze(this.widget.name,i,r,s,l);this.outlets.size<1&&!a&&this.setRenderState("unset");const u=()=>{const g=()=>S.querySelectorAll("[data-loading=true]").length===0,[S]=this.widget.container.get("widgetDOMElements"),C=(A,x)=>{g()&&(d.callback&&d.callback(),x.disconnect())},D={attributes:!0,subtree:!0,childList:!0};g()&&d.callback&&d.callback(),new MutationObserver(C).observe(S,D)};l&&this.widget.container.getAsync("dataClient").then(({events:g})=>{g.subscribe("data-client:fetched",(S,C)=>{C.unresolvedQueries===0&&u()})});const m=this.getOrCreateViewOutlet(o,d);if(this.outlets.set(o,m),this.widget.events.dispatch("widget:attached",{},{bubbles:!0}),d.triggerType===$.Badge&&s&&((b=d.triggerDOMElement)==null||b.setAttribute("aria-expanded","false"),m==null||m.renderBadge(s)),d.triggerType!==$.Inline&&((y=d.triggerDOMElement)==null||y.addEventListener("click",g=>{g.preventDefault(),this.container.get("settings").then(({trigger:S})=>{m.render().then(()=>this.renderState()).then(C=>S&&S.action&&S.action==="hide"?C===w.WidgetRenderState.open?this.hide():this.open():C===w.WidgetRenderState.open?this.close():this.open())})})),this.outlets.size>1)return this.renderState().then(g=>{this.triggerStateIfApplicable(g)});if(a)return a==="storage"?this.renderState().then(g=>{if(d.triggerType===$.Inline){this.triggerStateIfApplicable("open");return}this.triggerStateIfApplicable(g)}):this.triggerStateIfApplicable(a)})}detach(e){if(e){if(this.outlets.has(e)){const s=this.outlets.get(e);s==null||s.dispose(),this.outlets.delete(e);return}process.env.NODE_ENV!=="production"&&console.warn(`detach(): Could not find View Outlet with key ${e}`);return}this.outlets.forEach(s=>{s.dispose()}),this.outlets.clear()}triggerStateIfApplicable(e){return this.container.getAsync("router").then(s=>{switch(e){case"closed":this.close();break;case"open":this.open();break;case"hidden":this.hide(),s.start();break;default:return}})}getOrCreateViewOutlet(e,s){return this.outlets.has(e)?this.outlets.get(e):new Fe(this.container,s)}render(e={}){if(process.env.NODE_ENV!=="production"&&console.warn("widget.render() is deprecated. Use widget.attach() instead."),e.open){const s={...e,withRenderState:"open"};return this.attach(s)}return this.attach(e)}activate(e){e!=null&&e.override&&this.setSettings(()=>e.override),e!=null&&e.apiNotificationPriorityBy&&this.container.register("apiNotificationPriorityBy",e.apiNotificationPriorityBy)}setSettings(e){return Promise.all([this.container.get("settings"),h.createStorageWriter(this.container,U,h.StorageCategory.Necessary,{medium:h.StorageMedium.Local})]).then(([s,i])=>Promise.resolve(e(s)).then(o=>i(o).then(()=>{const r={...s,...o};return this.widget.events.dispatch("widget:settings-updated",r),r})))}clearSettings(){return h.createStorageWriter(this.container,U,h.StorageCategory.Necessary,{medium:h.StorageMedium.Local}).then(e=>e()).then(()=>this.container.get("settings")).then(e=>{this.widget.events.dispatch("widget:settings-updated",e)})}action({action:e,value:s}){return this.container.getAsync("actionResolver").then(i=>{i.action(this.widget.name,e,s)})}renderState(){if(he.onWidgetUrl(this.container))return Promise.resolve(w.WidgetRenderState.open);const e=()=>h.readStorage(this.container,T,h.StorageMedium.Session).then((i=w.WidgetRenderState.closed)=>i),s=()=>h.readStorage(this.container,T,h.StorageMedium.Session).then((i=w.WidgetRenderState.closed)=>i);return this.container.getAsync("router").then(i=>i.isSticky()?s().then(o=>o===w.WidgetRenderState.open?o:e()):e())}hide(e){return this.outlets.size<1?(process.env.NODE_ENV!=="production"&&console.warn("hide(): No-op as no view outlets are registered. Invoke the attach() command first."),Promise.resolve()):(this.outlets.forEach(s=>{if(s.render(),e!=null&&e.focusTrigger){const{options:{triggerDOMElement:i}}=s;i==null||i.focus()}}),this.action({action:"hide"}).then(()=>{this.setTriggerState(!1)}))}open(){return this.outlets.size<1?(process.env.NODE_ENV!=="production"&&console.warn("open(): No-op as no view outlets are registered. Invoke the attach() command first."),Promise.resolve()):(this.outlets.forEach(e=>e.render()),this.action({action:"open"}).then(()=>(this.widget.events.dispatch("tracking:widget-rendered",{}),this.onOpen())))}close(){return this.outlets.size<1?(process.env.NODE_ENV!=="production"&&console.warn("close(): No-op as no view outlets are registered. Invoke the attach() command first."),Promise.resolve()):this.action({action:"close"}).then(()=>{this.widget.events.dispatch("tracking:widget-minimized",{}),this.onClose()})}show(){return process.env.NODE_ENV!=="production"&&console.warn("show(): Command is deprecated and will be removed in the future. Use open() instead."),this.open()}onAction(e,s){switch(e){case"close":case"open":case"hide":const i=e==="open"?w.WidgetRenderState.open:e==="close"?w.WidgetRenderState.closed:w.WidgetRenderState.hidden;return this.setRenderState(i).then(()=>{this.setTriggerState(i===w.WidgetRenderState.open),i!==w.WidgetRenderState.hidden?i===w.WidgetRenderState.open?this.onOpen():this.onClose():this.outlets.forEach(o=>{var r;return(r=o.options.triggerDOMElement)==null?void 0:r.setAttribute("aria-expanded","false")})})}}setRenderState(e){const{invoke:s,events:i}=this.container.get("$widget");return Promise.all([h.createStorageWriter(this.container,T,h.StorageCategory.Necessary,{medium:h.StorageMedium.Session}),h.createStorageWriter(this.container,T,h.StorageCategory.Necessary,{medium:h.StorageMedium.Local,duration:{minutes:5}}),this.container.getAsync("router"),s("renderState")]).then(([o,r,a,c])=>{e==="unset"||!e?(r(),o()):(a.isSticky()&&r(e),o(e)),i.dispatch("widget:render-state-changed",{previous:c,next:e})})}onOpen(){return this.container.getAsync("router").then(e=>(this.outlets.forEach(s=>{s.options.triggerDOMElement&&s.options.triggerDOMElement.setAttribute("aria-expanded","true")}),e.start()))}onClose(){const e=this.container.getManyAsync("router","components");return this.container.get("settings").then(i=>{const{activate:o}=this.container.get("$settings");return i.activate!==o?this.setSettings(()=>Promise.resolve({activate:o})):Promise.resolve()}).then(()=>e).then(({router:i,components:o})=>{const r=o.nodes.visible;return this.outlets.forEach(a=>{var c;return(c=a.options.triggerDOMElement)==null?void 0:c.setAttribute("aria-expanded","false")}),r.filter(a=>a.attributes.properties.animation&&a.attributes.properties.animation!=="none").length?new Promise(a=>{setTimeout(()=>{a(i)},200)}):Promise.resolve(i)}).then(i=>i.stop())}setTriggerState(e){this.outlets.forEach(s=>{const{options:{triggerDOMElement:i,triggerOptions:o}}=s,{openTooltip:r,closedTooltip:a}=o||{};i&&(e?ne(i,r):Ve(i,a))})}deactivate(){this.subs.forEach(s=>s());const e=[];return this.outlets.forEach(s=>e.push(s.dispose())),h.readStorage(this.container,Z,h.StorageMedium.Local).then(s=>s===this.widget.name?h.createStorageWriter(this.container,Z,h.StorageCategory.Necessary,{medium:h.StorageMedium.Local,scope:h.StorageScope.Implementation}).then(i=>i()).then(()=>Promise.all(e)):Promise.all(e))}}exports.Component=B;exports.DetachedComponent=ee;exports.GridWidget=se;exports.NotFound=Ne;exports.Widget=se;exports.genericComponentStyling=W;exports.isModalActive=q;
|
|
71
|
+
${i.length?`<span>${i}</span>`:""}`,setTimeout(()=>t&&t.classList.add("humany-rendered")),We(t)}function Ve(t,n){t instanceof HTMLElement?(n&&t.setAttribute("title",n),t.classList.remove("humany-active"),t.classList.remove("humany-loading")):t instanceof Array&&t.forEach(e=>{n&&e.setAttribute("title",n),e.classList.remove("humany-active"),e.classList.remove("humany-loading")})}function Te(t){t instanceof HTMLElement?(t.classList.remove("humany-active"),t.classList.add("humany-loading")):t instanceof Array&&t.forEach(n=>{n.classList.remove("humany-active"),n.classList.add("humany-loading")})}function ie(t,n){t instanceof HTMLElement?(n&&t.setAttribute("title",n),t.classList.add("humany-active"),t.classList.remove("humany-loading")):t instanceof Array&&t.forEach(e=>{n&&e.setAttribute("title",n),e.classList.add("humany-active"),e.classList.remove("humany-loading")})}var $=(t=>(t.Inline="inline",t.Link="link",t.Badge="badge",t.Unsupported="unsupported",t))($||{});const qe=(t,n)=>t&&n?"both":t?"widgetDOM":n?"triggerDOM":"none",se=t=>t?typeof t=="boolean"&&t?"link":typeof t=="object"&&!Array.isArray(t)?"badge":"unsupported":"inline",ze=(t,n,e,s,i=!1)=>{var l,d;const o=qe(n,e),r=se(s),a={widgetDOMElement:n?n.cloneNode(!0):void 0,triggerDOMElement:e?e.cloneNode(!0):void 0},c={triggerType:r,cachedOriginals:a,widgetDOMElement:document.createElement("div")};switch(o){case"both":{c.widgetDOMElement=n||document.createElement("div"),r!=="inline"&&(c.triggerDOMElement=e);break}case"widgetDOM":{if(c.widgetDOMElement=n||document.createElement("div"),r!=="inline"){const u=document.body.appendChild(document.createElement("a"));r==="link"&&(u.innerText=t),c.triggerDOMElement=u}break}case"triggerDOM":{const u=document.createElement("div");c.widgetDOMElement=u,r==="inline"?(u.id=(e==null?void 0:e.id)||"",i?(u.style.display="none",(l=e==null?void 0:e.parentNode)==null||l.appendChild(u),c.callback=()=>{var m;(m=e==null?void 0:e.parentNode)==null||m.replaceChild(u,e),u.style.display=(e==null?void 0:e.style.display)||"block"}):(d=e==null?void 0:e.parentNode)==null||d.replaceChild(u,e),c.cachedOriginals.widgetDOMElement=e,c.cachedOriginals.triggerDOMElement=void 0):(c.widgetDOMElement=document.body.appendChild(u),c.triggerDOMElement=e);break}case"none":{const u=document.body.appendChild(document.createElement("div"));if(c.widgetDOMElement=u,r!=="inline"){const m=document.body.appendChild(document.createElement("a"));r==="link"&&(m.innerText=t),c.triggerDOMElement=m}break}}return c},Be="modals";class Fe{constructor(n,e){L(this,"container");L(this,"unsubscribe",[]);var a,c,l,d,u,m,b;this.options=e,this.container=n.createChild(this),this.container.register("widgetDOMElement",this.options.widgetDOMElement),this.container.register("triggerDOMElement",this.options.triggerDOMElement);const s=this.container.get("$widget"),i=n.get("$settings");(a=this.options.widgetDOMElement)==null||a.classList.add("humany-widget"),(c=this.options.widgetDOMElement)==null||c.setAttribute("role","region"),(d=this.options.widgetDOMElement)==null||d.setAttribute("aria-label",((l=i==null?void 0:i.data)==null?void 0:l.widgetAriaLabel)??"Widget"),this.options.triggerDOMElement&&((u=this.options.widgetDOMElement)==null||u.setAttribute("id",`humany_widget_${s.name}`),(m=this.options.triggerDOMElement)==null||m.setAttribute("aria-controls",`humany_widget_${s.name}`),this.unsubscribe.push(je(s,this.options.widgetDOMElement,this.options.triggerDOMElement),ke(this.options.triggerDOMElement))),(b=this.options.widgetDOMElement)==null||b.classList.add(`humany_${s.name}`),new MutationObserver(()=>{Array.from(this.options.widgetDOMElement.querySelectorAll('[aria-label=""]')).forEach(y=>y.removeAttribute("aria-label"))}).observe(this.options.widgetDOMElement,{childList:!0,subtree:!0});const r=n.get("widgetDOMElements")||[];n.register("widgetDOMElements",[...r,this.options.widgetDOMElement])}render(){const{widgetDOMElement:n,triggerDOMElement:e}=this.options,s=this.container.get("$widget");return n.getAttribute("data-rendered")==="true"?Promise.resolve():(e&&this.options.triggerType===$.Badge&&Te(e),Promise.resolve().then(()=>require("./render-M_i97UPk.js")).then(i=>i.default(this.container,n)).then(()=>{if(n.setAttribute("data-rendered","true"),e&&this.options.triggerType===$.Badge){const o=this.options.triggerOptions.openTooltip;ie(e,o)}E.notifyDataLoaded(this.container,n);const i=this.container.get("$environment").widgets.all();h.readStorage(this.container,Be,h.StorageMedium.Session).then(o=>{o&&o.forEach(r=>{i.find(a=>a.name===r.name&&a.state==="activated")&&s.events.dispatch("widget:modal-opened",r)})})}))}renderBadge(n){const{triggerDOMElement:e}=this.options;if(!e)return;e.getAttribute("role")||e.setAttribute("role","button");const{name:s}=this.container.get("$widget"),{label:i,symbol:o,ariaLabel:r,closedTooltip:a,openTooltip:c}=n,l={closedTooltip:a,openTooltip:c};this.options.triggerOptions=l;const d=_e(e,{label:i,symbol:o,ariaLabel:r,widgetName:s,tooltip:a});this.unsubscribe.push(d)}dispose(){return Promise.resolve().then(()=>require("./unmount-1FZXwHPT.js")).then(n=>{var i,o,r,a;const{triggerDOMElement:e,widgetDOMElement:s}=this.options;n.default(s),this.options.cachedOriginals.widgetDOMElement&&s&&((i=s.parentNode)==null||i.replaceChild(this.options.cachedOriginals.widgetDOMElement,s)),this.options.cachedOriginals.triggerDOMElement&&e&&((o=e.parentNode)==null||o.replaceChild(this.options.cachedOriginals.triggerDOMElement,e)),this.unsubscribe.forEach(c=>{c()}),(r=s.parentNode)==null||r.removeChild(s),(a=e==null?void 0:e.parentNode)==null||a.removeChild(e)})}}const V="changesets",Ge=t=>{const n={tags:t.tags};return t.context&&typeof t.context!="function"&&(n.context=t.context),t.properties&&typeof t.properties!="function"&&(n.properties=t.properties),t.layout&&typeof t.layout!="function"&&(n.layout=t.layout),n};class Y{constructor(n,e){this.container=n,this.storageWriter=e}static create(n){return h.createStorageWriter(n,V,h.StorageCategory.Necessary,{medium:h.StorageMedium.Local}).then(e=>new Y(n,e))}write(n,e,s,i){return E.lock(this)(()=>h.readStorage(this.container,V,h.StorageMedium.Local).then((o={})=>{const{keys:r=[],items:a={}}=o,c=r.indexOf(n);return c>-1&&r.splice(c,1),r.push(n),a[n]={options:i,attributes:Ge(s),rules:e.rules},this.storageWriter({keys:r,items:a})}))}remove(n){return E.lock(this)(()=>h.readStorage(this.container,V,h.StorageMedium.Local).then((e={})=>{const{keys:s=[],items:i={}}=e,o=s.indexOf(n);if(o>-1)return s.splice(o,1),delete i[n],this.storageWriter(e)}))}load(n){return E.lock(this)(()=>h.readStorage(this.container,V,h.StorageMedium.Local).then((e={})=>{const{keys:s=[],items:i={}}=e;s.forEach(o=>{const r=i[o];if(r){const{rules:a,attributes:c,options:l}=r;n.write({attributes:c,options:l,target:new w.ComponentQuery(n,a)})}})}))}}const Ke=t=>{const{container:n}=t;return Y.create(n).then(e=>{const s=n.get("$settings"),i={localStorage:e},o=new w.ComponentPlatform(t,i),r=w.createComponentModel(o,s);return t.events.subscribe("widget:state-change",(a,c)=>{c.state===X.WidgetState.Deactivating&&r()}),o})},Ue=t=>import("@telia-ace/widget-routing").then(({RoutingService:n,HistoryMode:e})=>t.get("settings").then(s=>{const{routing:{initialPath:i="/",mode:o=e.scopedHash,basePath:r},views:a}=s;return new n(t,{initialPath:i,mode:o,routes:Object.keys(a).map(l=>({name:l,path:a[l].path})),basePath:r})})),He=t=>import("@telia-ace/widget-services").then(({StorageProvider:n})=>new n),Ye=t=>import("@telia-ace/widget-core").then(({ActionResolver:n})=>new n(t)),Qe=t=>import("@telia-ace/widget-core").then(({ComponentResolver:n})=>new n(t)),Ze=t=>import("@telia-ace/widget-core").then(({ComponentPlatform:n,createComponentModel:e})=>Ke(t.get("$widget"))),U="$settings",T="open",Z="activeStickyWidget";class oe extends X.WidgetType{constructor(e){super(e);L(this,"outlets",new Map);L(this,"activated");L(this,"subs",[]);L(this,"handleBootstrapping",e=>{const s={triggerDOMElement:e.sourceDOMElement,withRenderState:"storage"};this.container.get("settings").then(i=>{const{activate:o}=i;(typeof o>"u"||o===null||o===!0)&&(this.activated=(this.activated||this.widget.activate()).then(()=>this.attach(s)))})});this.container.registerAsync("storage",()=>He(this.container)),this.container.registerFactory("settings",()=>h.readStorage(this.container,U,h.StorageMedium.Local).then((s={})=>({...this.container.get("$settings"),...s}))),pe.supportBootstrapping(this,"load",this.handleBootstrapping),this.container.registerAsync("componentResolver",()=>Qe(this.container)),this.container.registerAsync("router",()=>Ue(this.container)),this.container.registerAsync("actionResolver",()=>Ye(this.container)),this.container.register("matchMedia",window.matchMedia),this.container.registerAsync("components",()=>Ze(this.container))}initialize(){const e=this.container.getManyAsync("actionResolver","router","components"),s=this.container.get("csp");return s&&(window.webprovisionsEnvironmentVariables||(window.webprovisionsEnvironmentVariables={}),window.webprovisionsEnvironmentVariables.cspNonce=s.nonce),Promise.all([e,this.container.get("settings")]).then(([{actionResolver:i,router:o,components:r},a])=>{var d;i.subscribe(this.widget.name,(u,m,b)=>this.onAction(m,b));const c=u=>{r.nodes.query({type:"view"}).forEach(m=>{r.setSwitch(m,u)})},l=((d=o.getInitialRoute())==null?void 0:d.name)||"index";return c(l),this.events.subscribe("widget:data-loaded",(u,{element:m})=>{this.widget.container.get("seoConfiguration")&&this.events.dispatch("widget:preloaded-replaced",{element:m})}),this.events.subscribe("router:change",(u,{previous:m={routeData:{}},next:b={routeData:{}}})=>{const{routeData:y}=m,{routeData:g}=b,S=Object.keys(a.views).reduce((C,D)=>typeof a.views[D].path>"u"?D:C,"");!g.name&&S?c(S):c(g.name),E.removeNullAndUndefinedValues(y&&y.params),E.removeNullAndUndefinedValues(g&&g.params),this.container.getAsync("actionResolver").then(C=>{C.action(this.widget.name,"routeChange",{next:g,previous:y})})}),o.initialize()})}attach(e={}){return this.container.get("settings").then(({trigger:s})=>{var b,y;const{widgetDOMElement:i,key:o=E.uuid(),triggerDOMElement:r,withRenderState:a}=e,l=se(s)===$.Inline&&((r==null?void 0:r.childElementCount)||0)>0,d=ze(this.widget.name,i,r,s,l);this.outlets.size<1&&!a&&this.setRenderState("unset");const u=()=>{const g=()=>S.querySelectorAll("[data-loading=true]").length===0,[S]=this.widget.container.get("widgetDOMElements"),C=(A,x)=>{g()&&(d.callback&&d.callback(),x.disconnect())},D={attributes:!0,subtree:!0,childList:!0};g()&&d.callback&&d.callback(),new MutationObserver(C).observe(S,D)};l&&this.widget.container.getAsync("dataClient").then(({events:g})=>{g.subscribe("data-client:fetched",(S,C)=>{C.unresolvedQueries===0&&u()})});const m=this.getOrCreateViewOutlet(o,d);if(this.outlets.set(o,m),this.widget.events.dispatch("widget:attached",{},{bubbles:!0}),d.triggerType===$.Badge&&s&&((b=d.triggerDOMElement)==null||b.setAttribute("aria-expanded","false"),m==null||m.renderBadge(s)),d.triggerType!==$.Inline&&((y=d.triggerDOMElement)==null||y.addEventListener("click",g=>{g.preventDefault(),this.container.get("settings").then(({trigger:S})=>{m.render().then(()=>this.renderState()).then(C=>S&&S.action&&S.action==="hide"?C===w.WidgetRenderState.open?this.hide():this.open():C===w.WidgetRenderState.open?this.close():this.open())})})),this.outlets.size>1)return this.renderState().then(g=>{this.triggerStateIfApplicable(g)});if(a)return a==="storage"?this.renderState().then(g=>{if(d.triggerType===$.Inline){this.triggerStateIfApplicable("open");return}this.triggerStateIfApplicable(g)}):this.triggerStateIfApplicable(a)})}detach(e){if(e){if(this.outlets.has(e)){const s=this.outlets.get(e);s==null||s.dispose(),this.outlets.delete(e);return}process.env.NODE_ENV!=="production"&&console.warn(`detach(): Could not find View Outlet with key ${e}`);return}this.outlets.forEach(s=>{s.dispose()}),this.outlets.clear()}triggerStateIfApplicable(e){return this.container.getAsync("router").then(s=>{switch(e){case"closed":this.close();break;case"open":this.open();break;case"hidden":this.hide(),s.start();break;default:return}})}getOrCreateViewOutlet(e,s){return this.outlets.has(e)?this.outlets.get(e):new Fe(this.container,s)}render(e={}){if(process.env.NODE_ENV!=="production"&&console.warn("widget.render() is deprecated. Use widget.attach() instead."),e.open){const s={...e,withRenderState:"open"};return this.attach(s)}return this.attach(e)}activate(e){e!=null&&e.override&&this.setSettings(()=>e.override),e!=null&&e.apiNotificationPriorityBy&&this.container.register("apiNotificationPriorityBy",e.apiNotificationPriorityBy)}setSettings(e){return Promise.all([this.container.get("settings"),h.createStorageWriter(this.container,U,h.StorageCategory.Necessary,{medium:h.StorageMedium.Local})]).then(([s,i])=>Promise.resolve(e(s)).then(o=>i(o).then(()=>{const r={...s,...o};return this.widget.events.dispatch("widget:settings-updated",r),r})))}clearSettings(){return h.createStorageWriter(this.container,U,h.StorageCategory.Necessary,{medium:h.StorageMedium.Local}).then(e=>e()).then(()=>this.container.get("settings")).then(e=>{this.widget.events.dispatch("widget:settings-updated",e)})}action({action:e,value:s}){return this.container.getAsync("actionResolver").then(i=>{i.action(this.widget.name,e,s)})}renderState(){if(J.onWidgetUrl(this.container))return Promise.resolve(w.WidgetRenderState.open);const e=()=>h.readStorage(this.container,T,h.StorageMedium.Session).then((i=w.WidgetRenderState.closed)=>i),s=()=>h.readStorage(this.container,T,h.StorageMedium.Session).then((i=w.WidgetRenderState.closed)=>i);return this.container.getAsync("router").then(i=>i.isSticky()?s().then(o=>o===w.WidgetRenderState.open?o:e()):e())}hide(e){return this.outlets.size<1?(process.env.NODE_ENV!=="production"&&console.warn("hide(): No-op as no view outlets are registered. Invoke the attach() command first."),Promise.resolve()):(this.outlets.forEach(s=>{if(s.render(),e!=null&&e.focusTrigger){const{options:{triggerDOMElement:i}}=s;i==null||i.focus()}}),this.action({action:"hide"}).then(()=>{this.setTriggerState(!1)}))}open(){return this.outlets.size<1?(process.env.NODE_ENV!=="production"&&console.warn("open(): No-op as no view outlets are registered. Invoke the attach() command first."),Promise.resolve()):(this.outlets.forEach(e=>e.render()),this.action({action:"open"}).then(()=>(this.widget.events.dispatch("tracking:widget-rendered",{}),this.onOpen())))}close(){return this.outlets.size<1?(process.env.NODE_ENV!=="production"&&console.warn("close(): No-op as no view outlets are registered. Invoke the attach() command first."),Promise.resolve()):this.action({action:"close"}).then(()=>{this.widget.events.dispatch("tracking:widget-minimized",{}),this.onClose()})}show(){return process.env.NODE_ENV!=="production"&&console.warn("show(): Command is deprecated and will be removed in the future. Use open() instead."),this.open()}onAction(e,s){switch(e){case"close":case"open":case"hide":const i=e==="open"?w.WidgetRenderState.open:e==="close"?w.WidgetRenderState.closed:w.WidgetRenderState.hidden;return this.setRenderState(i).then(()=>{this.setTriggerState(i===w.WidgetRenderState.open),i!==w.WidgetRenderState.hidden?i===w.WidgetRenderState.open?this.onOpen():this.onClose():this.outlets.forEach(o=>{var r;return(r=o.options.triggerDOMElement)==null?void 0:r.setAttribute("aria-expanded","false")})})}}setRenderState(e){const{invoke:s,events:i}=this.container.get("$widget");return Promise.all([h.createStorageWriter(this.container,T,h.StorageCategory.Necessary,{medium:h.StorageMedium.Session}),h.createStorageWriter(this.container,T,h.StorageCategory.Necessary,{medium:h.StorageMedium.Local,duration:{minutes:5}}),this.container.getAsync("router"),s("renderState")]).then(([o,r,a,c])=>{e==="unset"||!e?(r(),o()):(a.isSticky()&&r(e),o(e)),i.dispatch("widget:render-state-changed",{previous:c,next:e})})}onOpen(){return this.container.getAsync("router").then(e=>(this.outlets.forEach(s=>{s.options.triggerDOMElement&&s.options.triggerDOMElement.setAttribute("aria-expanded","true")}),e.start()))}onClose(){const e=this.container.getManyAsync("router","components");return this.container.get("settings").then(i=>{const{activate:o}=this.container.get("$settings");return i.activate!==o?this.setSettings(()=>Promise.resolve({activate:o})):Promise.resolve()}).then(()=>e).then(({router:i,components:o})=>{const r=o.nodes.visible;return this.outlets.forEach(a=>{var c;return(c=a.options.triggerDOMElement)==null?void 0:c.setAttribute("aria-expanded","false")}),r.filter(a=>a.attributes.properties.animation&&a.attributes.properties.animation!=="none").length?new Promise(a=>{setTimeout(()=>{a(i)},200)}):Promise.resolve(i)}).then(i=>i.stop())}setTriggerState(e){this.outlets.forEach(s=>{const{options:{triggerDOMElement:i,triggerOptions:o}}=s,{openTooltip:r,closedTooltip:a}=o||{};i&&(e?ie(i,r):Ve(i,a))})}deactivate(){this.subs.forEach(s=>s());const e=[];return this.outlets.forEach(s=>e.push(s.dispose())),h.readStorage(this.container,Z,h.StorageMedium.Local).then(s=>s===this.widget.name?h.createStorageWriter(this.container,Z,h.StorageCategory.Necessary,{medium:h.StorageMedium.Local,scope:h.StorageScope.Implementation}).then(i=>i()).then(()=>Promise.all(e)):Promise.all(e))}}exports.Component=B;exports.DetachedComponent=te;exports.GridWidget=oe;exports.NotFound=Ne;exports.Widget=oe;exports.genericComponentStyling=W;exports.isModalActive=q;
|
package/index.mjs
CHANGED
|
@@ -9,14 +9,14 @@ import J, { useState as _, forwardRef as le, useMemo as Ie, Suspense as _e, useE
|
|
|
9
9
|
import L from "@emotion/styled";
|
|
10
10
|
import { appendClassNames as F, isEscapeHandled as Ve, notifyDataLoaded as Te, lock as j, removeNullAndUndefinedValues as ne, uuid as ze } from "@telia-ace/widget-utilities";
|
|
11
11
|
import { TransitionGroup as Be, Transition as Fe } from "react-transition-group";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { readStorage as S, StorageMedium as v, createStorageWriter as k, StorageCategory as P, StorageScope as
|
|
15
|
-
import { supportBootstrapping as
|
|
16
|
-
import { WidgetState as
|
|
12
|
+
import { normalizeRoutePaths as Ke, onWidgetUrl as We } from "@telia-ace/widget-routing";
|
|
13
|
+
import { Switch as Ge, Route as H } from "react-router-dom";
|
|
14
|
+
import { readStorage as S, StorageMedium as v, createStorageWriter as k, StorageCategory as P, StorageScope as je } from "@telia-ace/widget-services";
|
|
15
|
+
import { supportBootstrapping as He } from "@webprovisions/bootstrapping";
|
|
16
|
+
import { WidgetState as Ue, WidgetType as qe } from "@webprovisions/platform";
|
|
17
17
|
var q = /* @__PURE__ */ ((t) => (t.back = "back", t.forth = "forth", t))(q || {});
|
|
18
|
-
const
|
|
19
|
-
|
|
18
|
+
const Ye = (t, n, e) => typeof e[t] == "number" && typeof e[n] == "number" && e[t] > e[n] ? "back" : "forth", ue = ({ views: t, location: n, render: e }) => /* @__PURE__ */ m(
|
|
19
|
+
Ge,
|
|
20
20
|
{
|
|
21
21
|
location: n && {
|
|
22
22
|
...n,
|
|
@@ -26,21 +26,21 @@ const qe = (t, n, e) => typeof e[t] == "number" && typeof e[n] == "number" && e[
|
|
|
26
26
|
...Object.keys(t).filter((i) => !!t[i].path),
|
|
27
27
|
...Object.keys(t).filter((i) => !t[i].path)
|
|
28
28
|
].map((i) => {
|
|
29
|
-
const
|
|
29
|
+
const s = Ke(t[i].path);
|
|
30
30
|
return s ? Array.isArray(s) ? s.map((o) => /* @__PURE__ */ m(H, { exact: !0, path: o, render: () => e(i) }, i)) : /* @__PURE__ */ m(H, { exact: !0, path: s, render: () => e(i) }, i) : /* @__PURE__ */ m(H, { render: () => e(i) }, i);
|
|
31
31
|
})
|
|
32
32
|
}
|
|
33
|
-
),
|
|
33
|
+
), Qe = L.div`
|
|
34
34
|
position: relative;
|
|
35
35
|
width: 100%;
|
|
36
36
|
flex: 1;
|
|
37
|
-
`,
|
|
37
|
+
`, Ze = L(oe)`
|
|
38
38
|
position: absolute;
|
|
39
39
|
left: 0;
|
|
40
40
|
right: 0;
|
|
41
41
|
${(t) => !!t.animationCss && t.animationCss}
|
|
42
42
|
${(t) => !!t.scrollableCss && t.scrollableCss}
|
|
43
|
-
`,
|
|
43
|
+
`, Je = {
|
|
44
44
|
index: 1,
|
|
45
45
|
search: 2,
|
|
46
46
|
browse: 3,
|
|
@@ -48,7 +48,7 @@ const qe = (t, n, e) => typeof e[t] == "number" && typeof e[n] == "number" && e[
|
|
|
48
48
|
contact: 5,
|
|
49
49
|
"contact-method": 6,
|
|
50
50
|
conversation: 7
|
|
51
|
-
},
|
|
51
|
+
}, Xe = ({ className: t = "", ...n }) => {
|
|
52
52
|
const [e, i] = _("index"), [s, o] = _(
|
|
53
53
|
q.forth
|
|
54
54
|
), r = Oe(), a = Ee(), c = re(), d = Q(), u = T(), l = Z(), { gap: h = "0" } = d, {
|
|
@@ -61,7 +61,7 @@ const qe = (t, n, e) => typeof e[t] == "number" && typeof e[n] == "number" && e[
|
|
|
61
61
|
return null;
|
|
62
62
|
const { location: R } = a;
|
|
63
63
|
r.name !== e && r.name !== "" && g && (o(
|
|
64
|
-
|
|
64
|
+
Ye(e, r.name, Je)
|
|
65
65
|
), i(r.name));
|
|
66
66
|
const { views: A } = u.get("$settings");
|
|
67
67
|
if (!Object.keys(A).length)
|
|
@@ -69,7 +69,7 @@ const qe = (t, n, e) => typeof e[t] == "number" && typeof e[n] == "number" && e[
|
|
|
69
69
|
const E = (w, M, $) => {
|
|
70
70
|
const C = G(M, $), I = l.getChildren(w)[0];
|
|
71
71
|
return /* @__PURE__ */ m(
|
|
72
|
-
|
|
72
|
+
Ze,
|
|
73
73
|
{
|
|
74
74
|
...n,
|
|
75
75
|
...b,
|
|
@@ -93,7 +93,7 @@ const qe = (t, n, e) => typeof e[t] == "number" && typeof e[n] == "number" && e[
|
|
|
93
93
|
"data-state": w
|
|
94
94
|
};
|
|
95
95
|
};
|
|
96
|
-
return /* @__PURE__ */ m(
|
|
96
|
+
return /* @__PURE__ */ m(Qe, { className: "humany-animated-view", children: /* @__PURE__ */ m(
|
|
97
97
|
Be,
|
|
98
98
|
{
|
|
99
99
|
component: null,
|
|
@@ -118,9 +118,9 @@ const qe = (t, n, e) => typeof e[t] == "number" && typeof e[n] == "number" && e[
|
|
|
118
118
|
)
|
|
119
119
|
}
|
|
120
120
|
) });
|
|
121
|
-
},
|
|
121
|
+
}, et = L(oe)`
|
|
122
122
|
${(t) => !!t.scrollableCss && t.scrollableCss}
|
|
123
|
-
`,
|
|
123
|
+
`, tt = ({ className: t = "", ...n }) => {
|
|
124
124
|
const e = re(), i = Q(), s = T(), o = Z(), { views: r } = s.get("$settings"), { gap: a = "0" } = i, {
|
|
125
125
|
columns: c = 1,
|
|
126
126
|
animation: d = "none",
|
|
@@ -128,7 +128,7 @@ const qe = (t, n, e) => typeof e[t] == "number" && typeof e[n] == "number" && e[
|
|
|
128
128
|
...l
|
|
129
129
|
} = e, [h, f] = ae(u);
|
|
130
130
|
return o ? /* @__PURE__ */ m(
|
|
131
|
-
|
|
131
|
+
et,
|
|
132
132
|
{
|
|
133
133
|
...n,
|
|
134
134
|
...l,
|
|
@@ -177,11 +177,11 @@ const qe = (t, n, e) => typeof e[t] == "number" && typeof e[n] == "number" && e[
|
|
|
177
177
|
${De(t)};
|
|
178
178
|
}
|
|
179
179
|
`;
|
|
180
|
-
},
|
|
180
|
+
}, nt = L(tt)`
|
|
181
181
|
${(t) => K(t)}
|
|
182
|
-
`,
|
|
182
|
+
`, it = L(Xe)`
|
|
183
183
|
${(t) => K(t)}
|
|
184
|
-
`,
|
|
184
|
+
`, st = L.div`
|
|
185
185
|
text-align: center;
|
|
186
186
|
${(t) => {
|
|
187
187
|
var n, e, i;
|
|
@@ -192,14 +192,14 @@ const qe = (t, n, e) => typeof e[t] == "number" && typeof e[n] == "number" && e[
|
|
|
192
192
|
}}
|
|
193
193
|
${(t) => typeof t.theme.borderRadius < "u" && `border-radius: ${t.theme.borderRadius};`}
|
|
194
194
|
${(t) => K(t)}
|
|
195
|
-
`,
|
|
195
|
+
`, ot = le(
|
|
196
196
|
({ className: t = "", children: n, ...e }, i) => {
|
|
197
197
|
const s = Ae(), { name: o, type: r, id: a } = Se(), c = Ie(() => s ? L(s)`
|
|
198
198
|
${K}
|
|
199
199
|
${Me}
|
|
200
200
|
` : null, [s]);
|
|
201
201
|
return typeof s > "u" ? null : s === null || c === null ? process.env.NODE_ENV !== "production" ? /* @__PURE__ */ m(
|
|
202
|
-
|
|
202
|
+
st,
|
|
203
203
|
{
|
|
204
204
|
...e,
|
|
205
205
|
title: `type: ${r}, definition-id: ${o}, instance-id: ${a}`,
|
|
@@ -223,7 +223,7 @@ const qe = (t, n, e) => typeof e[t] == "number" && typeof e[n] == "number" && e[
|
|
|
223
223
|
}
|
|
224
224
|
) });
|
|
225
225
|
}
|
|
226
|
-
),
|
|
226
|
+
), rt = (t) => {
|
|
227
227
|
const n = Z(t), e = ce(), [i, s] = _({}), o = xe();
|
|
228
228
|
return V(() => {
|
|
229
229
|
n && o.current && s(n.attributes.properties);
|
|
@@ -240,7 +240,7 @@ const qe = (t, n, e) => typeof e[t] == "number" && typeof e[n] == "number" && e[
|
|
|
240
240
|
};
|
|
241
241
|
}
|
|
242
242
|
}, [e, o, t, n]), i;
|
|
243
|
-
},
|
|
243
|
+
}, at = (t, n) => n ? !0 : typeof t == "string" ? t === "full" : t > 0, X = le(
|
|
244
244
|
({
|
|
245
245
|
className: t = "",
|
|
246
246
|
id: n,
|
|
@@ -251,7 +251,7 @@ const qe = (t, n, e) => typeof e[t] == "number" && typeof e[n] == "number" && e[
|
|
|
251
251
|
context: r,
|
|
252
252
|
...a
|
|
253
253
|
}, c) => {
|
|
254
|
-
const d = ce(), u = T(), [l, h] = _(), f = Le(), g = Q(n), p =
|
|
254
|
+
const d = ce(), u = T(), [l, h] = _(), f = Le(), g = Q(n), p = rt(n), { size: b = "none", indent: y = 0 } = $e(n), D = at(b, i);
|
|
255
255
|
if (V(() => {
|
|
256
256
|
if (d) {
|
|
257
257
|
if (n && !i) {
|
|
@@ -313,11 +313,11 @@ const qe = (t, n, e) => typeof e[t] == "number" && typeof e[n] == "number" && e[
|
|
|
313
313
|
};
|
|
314
314
|
switch (l.type) {
|
|
315
315
|
case "view":
|
|
316
|
-
return typeof p.animation == "string" && p.animation !== "none" ? /* @__PURE__ */ m(
|
|
316
|
+
return typeof p.animation == "string" && p.animation !== "none" ? /* @__PURE__ */ m(it, { ...C, className: t }) : /* @__PURE__ */ m(nt, { ...C, className: t });
|
|
317
317
|
default: {
|
|
318
318
|
const I = Re(p);
|
|
319
319
|
return /* @__PURE__ */ m(
|
|
320
|
-
|
|
320
|
+
ot,
|
|
321
321
|
{
|
|
322
322
|
ref: c,
|
|
323
323
|
...C,
|
|
@@ -329,7 +329,7 @@ const qe = (t, n, e) => typeof e[t] == "number" && typeof e[n] == "number" && e[
|
|
|
329
329
|
}
|
|
330
330
|
})() }) }) });
|
|
331
331
|
}
|
|
332
|
-
),
|
|
332
|
+
), ct = ({ builder: t }) => {
|
|
333
333
|
const n = T(), [e, i] = _(null);
|
|
334
334
|
return V(() => {
|
|
335
335
|
n.getAsync("components").then((s) => t(s).then((o) => {
|
|
@@ -342,13 +342,13 @@ const qe = (t, n, e) => typeof e[t] == "number" && typeof e[n] == "number" && e[
|
|
|
342
342
|
);
|
|
343
343
|
});
|
|
344
344
|
}, [e]), e ? /* @__PURE__ */ m(X, { id: e.id, node: e, branch: "default" }) : null;
|
|
345
|
-
},
|
|
345
|
+
}, lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
346
346
|
__proto__: null,
|
|
347
|
-
default:
|
|
348
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
347
|
+
default: ct
|
|
348
|
+
}, Symbol.toStringTag, { value: "Module" })), ut = J.lazy(() => Promise.resolve().then(() => lt)), Ut = ({ showSearch: t = !1 }) => {
|
|
349
349
|
const n = be(), e = T();
|
|
350
350
|
return /* @__PURE__ */ m(J.Suspense, { fallback: null, children: /* @__PURE__ */ m(
|
|
351
|
-
|
|
351
|
+
ut,
|
|
352
352
|
{
|
|
353
353
|
builder: (i) => e.get("settings").then((s) => {
|
|
354
354
|
var d;
|
|
@@ -380,14 +380,14 @@ const qe = (t, n, e) => typeof e[t] == "number" && typeof e[n] == "number" && e[
|
|
|
380
380
|
})
|
|
381
381
|
}
|
|
382
382
|
) });
|
|
383
|
-
},
|
|
384
|
-
if (
|
|
383
|
+
}, dt = 'a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])', W = (t) => t.getClientRects().length > 0 && window.getComputedStyle(t).visibility !== "hidden", de = (t, n = W) => Array.from(t.querySelectorAll(dt)).filter(n), Y = (t) => !!t.querySelector('[aria-modal="true"], .humany-area-modal'), ht = (t) => t.tagName === "BUTTON" || t.tagName === "A" && t.hasAttribute("href") || t.tagName === "INPUT" && ["button", "submit"].includes(t.type), pt = (t) => {
|
|
384
|
+
if (ht(t)) return () => {
|
|
385
385
|
};
|
|
386
386
|
const n = (e) => {
|
|
387
387
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), t.click());
|
|
388
388
|
};
|
|
389
389
|
return t.addEventListener("keydown", n), () => t.removeEventListener("keydown", n);
|
|
390
|
-
},
|
|
390
|
+
}, mt = (t, n, e, i = W) => {
|
|
391
391
|
const s = de(n, i), o = document.activeElement;
|
|
392
392
|
if (!s.length || !o) {
|
|
393
393
|
t.preventDefault();
|
|
@@ -398,7 +398,7 @@ const qe = (t, n, e) => typeof e[t] == "number" && typeof e[n] == "number" && e[
|
|
|
398
398
|
) : s.some(
|
|
399
399
|
(a) => o.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_FOLLOWING
|
|
400
400
|
)) || (t.preventDefault(), e && e.isConnected && i(e) ? e.focus() : (t.shiftKey ? s[s.length - 1] : s[0]).focus());
|
|
401
|
-
},
|
|
401
|
+
}, ft = (t, { timeout: n = 1e3, interval: e = 50, visible: i = W } = {}) => {
|
|
402
402
|
const s = () => {
|
|
403
403
|
if (Y(t)) return !0;
|
|
404
404
|
const a = t.querySelector("h1");
|
|
@@ -411,17 +411,17 @@ const qe = (t, n, e) => typeof e[t] == "number" && typeof e[n] == "number" && e[
|
|
|
411
411
|
s() ? window.clearInterval(r) : Date.now() - o >= n && (window.clearInterval(r), t.contains(document.activeElement) || (a = t.querySelector('[data-node-id][tabindex="-1"]')) == null || a.focus());
|
|
412
412
|
}, e);
|
|
413
413
|
return () => window.clearInterval(r);
|
|
414
|
-
},
|
|
414
|
+
}, gt = (t, n, e, i = W) => {
|
|
415
415
|
let s = !1, o = () => {
|
|
416
416
|
};
|
|
417
417
|
const r = t.events.subscribe(
|
|
418
418
|
"widget:render-state-changed",
|
|
419
419
|
(d, { next: u }) => {
|
|
420
|
-
s = u === "open", o(), o = s ?
|
|
420
|
+
s = u === "open", o(), o = s ? ft(n, { visible: i }) : () => {
|
|
421
421
|
};
|
|
422
422
|
}
|
|
423
423
|
), a = (d) => {
|
|
424
|
-
!s || Y(n) || (d.key === "Tab" ?
|
|
424
|
+
!s || Y(n) || (d.key === "Tab" ? mt(d, n, e, i) : d.key === "Escape" && window.setTimeout(() => {
|
|
425
425
|
s && !Ve(d) && t.invoke("hide", { focusTrigger: !0 });
|
|
426
426
|
}));
|
|
427
427
|
}, c = (d) => {
|
|
@@ -432,7 +432,7 @@ const qe = (t, n, e) => typeof e[t] == "number" && typeof e[n] == "number" && e[
|
|
|
432
432
|
return n.addEventListener("keydown", a), e.addEventListener("keydown", c), () => {
|
|
433
433
|
o(), r(), n.removeEventListener("keydown", a), e.removeEventListener("keydown", c);
|
|
434
434
|
};
|
|
435
|
-
},
|
|
435
|
+
}, bt = (t) => {
|
|
436
436
|
if (t) {
|
|
437
437
|
const { type: n, content: e } = t;
|
|
438
438
|
switch (n) {
|
|
@@ -444,7 +444,7 @@ const qe = (t, n, e) => typeof e[t] == "number" && typeof e[n] == "number" && e[
|
|
|
444
444
|
return "";
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
|
-
},
|
|
447
|
+
}, yt = (t) => {
|
|
448
448
|
const n = (s, o) => {
|
|
449
449
|
s && (o ? s.classList.add("humany-tabbing") : s.classList.remove("humany-tabbing"));
|
|
450
450
|
}, e = (s) => {
|
|
@@ -456,7 +456,7 @@ const qe = (t, n, e) => typeof e[t] == "number" && typeof e[n] == "number" && e[
|
|
|
456
456
|
document.removeEventListener("keydown", e), document.removeEventListener("click", i);
|
|
457
457
|
};
|
|
458
458
|
};
|
|
459
|
-
function
|
|
459
|
+
function wt(t, n) {
|
|
460
460
|
const {
|
|
461
461
|
symbol: e,
|
|
462
462
|
widgetName: i,
|
|
@@ -465,7 +465,7 @@ function yt(t, n) {
|
|
|
465
465
|
tooltip: r = ""
|
|
466
466
|
} = n;
|
|
467
467
|
t.classList.add("humany-trigger"), t.classList.add(`humany_${i}`), s.length && t.classList.add("humany-has-text"), o.length && !t.getAttribute("aria-label") && t.setAttribute("aria-label", o), o.length && !t.getAttribute("tabindex") && t.setAttribute("tabindex", "0"), r.length && !t.getAttribute("title") && t.setAttribute("title", r);
|
|
468
|
-
const a =
|
|
468
|
+
const a = bt(e) || "";
|
|
469
469
|
return t.innerHTML = `${a}
|
|
470
470
|
<span class="humany-close">
|
|
471
471
|
<svg width="18" height="9" viewBox="0 0 18 9" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -486,14 +486,14 @@ function yt(t, n) {
|
|
|
486
486
|
</span>
|
|
487
487
|
${s.length ? `<span>${s}</span>` : ""}`, setTimeout(
|
|
488
488
|
() => t && t.classList.add("humany-rendered")
|
|
489
|
-
),
|
|
489
|
+
), yt(t);
|
|
490
490
|
}
|
|
491
|
-
function
|
|
491
|
+
function vt(t, n) {
|
|
492
492
|
t instanceof HTMLElement ? (n && t.setAttribute("title", n), t.classList.remove("humany-active"), t.classList.remove("humany-loading")) : t instanceof Array && t.forEach((e) => {
|
|
493
493
|
n && e.setAttribute("title", n), e.classList.remove("humany-active"), e.classList.remove("humany-loading");
|
|
494
494
|
});
|
|
495
495
|
}
|
|
496
|
-
function
|
|
496
|
+
function Ot(t) {
|
|
497
497
|
t instanceof HTMLElement ? (t.classList.remove("humany-active"), t.classList.add("humany-loading")) : t instanceof Array && t.forEach((n) => {
|
|
498
498
|
n.classList.remove("humany-active"), n.classList.add("humany-loading");
|
|
499
499
|
});
|
|
@@ -504,9 +504,9 @@ function he(t, n) {
|
|
|
504
504
|
});
|
|
505
505
|
}
|
|
506
506
|
var x = /* @__PURE__ */ ((t) => (t.Inline = "inline", t.Link = "link", t.Badge = "badge", t.Unsupported = "unsupported", t))(x || {});
|
|
507
|
-
const
|
|
507
|
+
const Et = (t, n) => t && n ? "both" : t ? "widgetDOM" : n ? "triggerDOM" : "none", pe = (t) => t ? typeof t == "boolean" && t ? "link" : typeof t == "object" && !Array.isArray(t) ? "badge" : "unsupported" : "inline", Ct = (t, n, e, i, s = !1) => {
|
|
508
508
|
var d, u;
|
|
509
|
-
const o =
|
|
509
|
+
const o = Et(
|
|
510
510
|
n,
|
|
511
511
|
e
|
|
512
512
|
), r = pe(i), a = {
|
|
@@ -559,8 +559,8 @@ const Ot = (t, n) => t && n ? "both" : t ? "widgetDOM" : n ? "triggerDOM" : "non
|
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
561
|
return c;
|
|
562
|
-
},
|
|
563
|
-
class
|
|
562
|
+
}, Dt = "modals";
|
|
563
|
+
class At {
|
|
564
564
|
constructor(n, e) {
|
|
565
565
|
N(this, "container");
|
|
566
566
|
N(this, "unsubscribe", []);
|
|
@@ -580,12 +580,12 @@ class Dt {
|
|
|
580
580
|
"aria-controls",
|
|
581
581
|
`humany_widget_${i.name}`
|
|
582
582
|
), this.unsubscribe.push(
|
|
583
|
-
|
|
583
|
+
gt(
|
|
584
584
|
i,
|
|
585
585
|
this.options.widgetDOMElement,
|
|
586
586
|
this.options.triggerDOMElement
|
|
587
587
|
),
|
|
588
|
-
|
|
588
|
+
pt(this.options.triggerDOMElement)
|
|
589
589
|
)), (f = this.options.widgetDOMElement) == null || f.classList.add(`humany_${i.name}`), new MutationObserver(() => {
|
|
590
590
|
Array.from(
|
|
591
591
|
this.options.widgetDOMElement.querySelectorAll('[aria-label=""]')
|
|
@@ -605,7 +605,7 @@ class Dt {
|
|
|
605
605
|
*/
|
|
606
606
|
render() {
|
|
607
607
|
const { widgetDOMElement: n, triggerDOMElement: e } = this.options, i = this.container.get("$widget");
|
|
608
|
-
return n.getAttribute("data-rendered") === "true" ? Promise.resolve() : (e && this.options.triggerType === x.Badge &&
|
|
608
|
+
return n.getAttribute("data-rendered") === "true" ? Promise.resolve() : (e && this.options.triggerType === x.Badge && Ot(e), import("./render-CQeSLj9N.mjs").then((s) => s.default(this.container, n)).then(() => {
|
|
609
609
|
if (n.setAttribute("data-rendered", "true"), e && this.options.triggerType === x.Badge) {
|
|
610
610
|
const o = this.options.triggerOptions.openTooltip;
|
|
611
611
|
he(e, o);
|
|
@@ -614,7 +614,7 @@ class Dt {
|
|
|
614
614
|
const s = this.container.get("$environment").widgets.all();
|
|
615
615
|
S(
|
|
616
616
|
this.container,
|
|
617
|
-
|
|
617
|
+
Dt,
|
|
618
618
|
v.Session
|
|
619
619
|
).then((o) => {
|
|
620
620
|
o && o.forEach((r) => {
|
|
@@ -632,7 +632,7 @@ class Dt {
|
|
|
632
632
|
e.getAttribute("role") || e.setAttribute("role", "button");
|
|
633
633
|
const { name: i } = this.container.get("$widget"), { label: s, symbol: o, ariaLabel: r, closedTooltip: a, openTooltip: c } = n, d = { closedTooltip: a, openTooltip: c };
|
|
634
634
|
this.options.triggerOptions = d;
|
|
635
|
-
const u =
|
|
635
|
+
const u = wt(e, {
|
|
636
636
|
label: s,
|
|
637
637
|
symbol: o,
|
|
638
638
|
ariaLabel: r,
|
|
@@ -657,7 +657,7 @@ class Dt {
|
|
|
657
657
|
});
|
|
658
658
|
}
|
|
659
659
|
}
|
|
660
|
-
const z = "changesets",
|
|
660
|
+
const z = "changesets", St = (t) => {
|
|
661
661
|
const n = { tags: t.tags };
|
|
662
662
|
return t.context && typeof t.context != "function" && (n.context = t.context), t.properties && typeof t.properties != "function" && (n.properties = t.properties), t.layout && typeof t.layout != "function" && (n.layout = t.layout), n;
|
|
663
663
|
};
|
|
@@ -686,7 +686,7 @@ class ee {
|
|
|
686
686
|
const { keys: r = [], items: a = {} } = o, c = r.indexOf(n);
|
|
687
687
|
return c > -1 && r.splice(c, 1), r.push(n), a[n] = {
|
|
688
688
|
options: s,
|
|
689
|
-
attributes:
|
|
689
|
+
attributes: St(i),
|
|
690
690
|
rules: e.rules
|
|
691
691
|
}, this.storageWriter({ keys: r, items: a });
|
|
692
692
|
}));
|
|
@@ -723,7 +723,7 @@ class ee {
|
|
|
723
723
|
}));
|
|
724
724
|
}
|
|
725
725
|
}
|
|
726
|
-
const
|
|
726
|
+
const Mt = (t) => {
|
|
727
727
|
const { container: n } = t;
|
|
728
728
|
return ee.create(n).then(
|
|
729
729
|
(e) => {
|
|
@@ -731,12 +731,12 @@ const St = (t) => {
|
|
|
731
731
|
return t.events.subscribe(
|
|
732
732
|
"widget:state-change",
|
|
733
733
|
(a, c) => {
|
|
734
|
-
c.state ===
|
|
734
|
+
c.state === Ue.Deactivating && r();
|
|
735
735
|
}
|
|
736
736
|
), o;
|
|
737
737
|
}
|
|
738
738
|
);
|
|
739
|
-
},
|
|
739
|
+
}, Nt = (t) => import("@telia-ace/widget-routing").then(
|
|
740
740
|
({ RoutingService: n, HistoryMode: e }) => t.get("settings").then((i) => {
|
|
741
741
|
const {
|
|
742
742
|
routing: {
|
|
@@ -756,10 +756,10 @@ const St = (t) => {
|
|
|
756
756
|
basePath: r
|
|
757
757
|
});
|
|
758
758
|
})
|
|
759
|
-
),
|
|
760
|
-
({ ComponentPlatform: n, createComponentModel: e }) =>
|
|
759
|
+
), xt = (t) => import("@telia-ace/widget-services").then(({ StorageProvider: n }) => new n()), Lt = (t) => import("@telia-ace/widget-core").then(({ ActionResolver: n }) => new n(t)), $t = (t) => import("@telia-ace/widget-core").then(({ ComponentResolver: n }) => new n(t)), kt = (t) => import("@telia-ace/widget-core").then(
|
|
760
|
+
({ ComponentPlatform: n, createComponentModel: e }) => Mt(t.get("$widget"))
|
|
761
761
|
), U = "$settings", B = "open", ie = "activeStickyWidget";
|
|
762
|
-
class
|
|
762
|
+
class qt extends qe {
|
|
763
763
|
constructor(e) {
|
|
764
764
|
super(e);
|
|
765
765
|
N(this, "outlets", /* @__PURE__ */ new Map());
|
|
@@ -780,7 +780,7 @@ class Ut extends Ue {
|
|
|
780
780
|
});
|
|
781
781
|
this.container.registerAsync(
|
|
782
782
|
"storage",
|
|
783
|
-
() =>
|
|
783
|
+
() => xt(this.container)
|
|
784
784
|
), this.container.registerFactory("settings", () => S(
|
|
785
785
|
this.container,
|
|
786
786
|
U,
|
|
@@ -788,18 +788,18 @@ class Ut extends Ue {
|
|
|
788
788
|
).then((i = {}) => ({
|
|
789
789
|
...this.container.get("$settings"),
|
|
790
790
|
...i
|
|
791
|
-
}))),
|
|
791
|
+
}))), He(this, "load", this.handleBootstrapping), this.container.registerAsync(
|
|
792
792
|
"componentResolver",
|
|
793
|
-
() =>
|
|
793
|
+
() => $t(this.container)
|
|
794
794
|
), this.container.registerAsync(
|
|
795
795
|
"router",
|
|
796
|
-
() =>
|
|
796
|
+
() => Nt(this.container)
|
|
797
797
|
), this.container.registerAsync(
|
|
798
798
|
"actionResolver",
|
|
799
|
-
() =>
|
|
799
|
+
() => Lt(this.container)
|
|
800
800
|
), this.container.register("matchMedia", window.matchMedia), this.container.registerAsync(
|
|
801
801
|
"components",
|
|
802
|
-
() =>
|
|
802
|
+
() => kt(this.container)
|
|
803
803
|
);
|
|
804
804
|
}
|
|
805
805
|
initialize() {
|
|
@@ -850,7 +850,7 @@ class Ut extends Ue {
|
|
|
850
850
|
key: o = ze(),
|
|
851
851
|
triggerDOMElement: r,
|
|
852
852
|
withRenderState: a
|
|
853
|
-
} = e, d = pe(i) === x.Inline && ((r == null ? void 0 : r.childElementCount) || 0) > 0, u =
|
|
853
|
+
} = e, d = pe(i) === x.Inline && ((r == null ? void 0 : r.childElementCount) || 0) > 0, u = Ct(
|
|
854
854
|
this.widget.name,
|
|
855
855
|
s,
|
|
856
856
|
r,
|
|
@@ -933,7 +933,7 @@ class Ut extends Ue {
|
|
|
933
933
|
});
|
|
934
934
|
}
|
|
935
935
|
getOrCreateViewOutlet(e, i) {
|
|
936
|
-
return this.outlets.has(e) ? this.outlets.get(e) : new
|
|
936
|
+
return this.outlets.has(e) ? this.outlets.get(e) : new At(this.container, i);
|
|
937
937
|
}
|
|
938
938
|
render(e = {}) {
|
|
939
939
|
if (process.env.NODE_ENV !== "production" && console.warn(
|
|
@@ -1125,7 +1125,7 @@ class Ut extends Ue {
|
|
|
1125
1125
|
const {
|
|
1126
1126
|
options: { triggerDOMElement: s, triggerOptions: o }
|
|
1127
1127
|
} = i, { openTooltip: r, closedTooltip: a } = o || {};
|
|
1128
|
-
s && (e ? he(s, r) :
|
|
1128
|
+
s && (e ? he(s, r) : vt(s, a));
|
|
1129
1129
|
});
|
|
1130
1130
|
}
|
|
1131
1131
|
deactivate() {
|
|
@@ -1141,17 +1141,17 @@ class Ut extends Ue {
|
|
|
1141
1141
|
P.Necessary,
|
|
1142
1142
|
{
|
|
1143
1143
|
medium: v.Local,
|
|
1144
|
-
scope:
|
|
1144
|
+
scope: je.Implementation
|
|
1145
1145
|
}
|
|
1146
1146
|
).then((s) => s()).then(() => Promise.all(e)) : Promise.all(e));
|
|
1147
1147
|
}
|
|
1148
1148
|
}
|
|
1149
1149
|
export {
|
|
1150
1150
|
X as Component,
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1151
|
+
ct as DetachedComponent,
|
|
1152
|
+
qt as GridWidget,
|
|
1153
|
+
Ut as NotFound,
|
|
1154
|
+
qt as Widget,
|
|
1155
1155
|
K as genericComponentStyling,
|
|
1156
1156
|
Y as isModalActive
|
|
1157
1157
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/widget-types-grid",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.59-rc.1",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"types": "./index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@telia-ace/widget-core": "^1.3.
|
|
14
|
-
"@telia-ace/widget-routing": "^1.3.
|
|
15
|
-
"@telia-ace/widget-services": "^1.3.
|
|
16
|
-
"@telia-ace/widget-ui": "^1.3.
|
|
17
|
-
"@telia-ace/widget-utilities": "^1.3.
|
|
13
|
+
"@telia-ace/widget-core": "^1.3.59-rc.1",
|
|
14
|
+
"@telia-ace/widget-routing": "^1.3.59-rc.1",
|
|
15
|
+
"@telia-ace/widget-services": "^1.3.59-rc.1",
|
|
16
|
+
"@telia-ace/widget-ui": "^1.3.59-rc.1",
|
|
17
|
+
"@telia-ace/widget-utilities": "^1.3.59-rc.1",
|
|
18
18
|
"@webprovisions/bootstrapping": "^1.0.14",
|
|
19
19
|
"@webprovisions/platform": "^1.1.4"
|
|
20
20
|
},
|