@telia-ace/widget-types-grid 1.1.2-rc.1 → 1.1.2-rc.11
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 +25 -25
- package/index.mjs +143 -99
- package/package.json +6 -6
package/index.js
CHANGED
|
@@ -8,19 +8,19 @@
|
|
|
8
8
|
right: 0;
|
|
9
9
|
${t=>!!t.animationCss&&t.animationCss}
|
|
10
10
|
${t=>!!t.scrollableCss&&t.scrollableCss}
|
|
11
|
-
`,me={index:1,search:2,browse:3,guide:4,contact:5,"contact-method":6,conversation:7},ge=({className:t="",...n})=>{const[e,s]=b.useState("index"),[i,o]=b.useState(U.forth),r=d.useRouteData(),a=d.useRouter(),c=d.useProperties(),f=d.useContext(),h=d.useContainer(),u=d.useComponentNode(),{gap:
|
|
12
|
-
|
|
13
|
-
`,ye=({className:t="",...n})=>{const e=d.useProperties(),s=d.useContext(),i=d.useContainer(),o=d.useComponentNode(),{views:r}=i.get("$settings"),{gap:a="0"}=s,{columns:c=1,animation:f="none",scrollable:h=!1,...u}=e,[
|
|
14
|
-
|
|
11
|
+
`,me={index:1,search:2,browse:3,guide:4,contact:5,"contact-method":6,conversation:7},ge=({className:t="",...n})=>{const[e,s]=b.useState("index"),[i,o]=b.useState(U.forth),r=d.useRouteData(),a=d.useRouter(),c=d.useProperties(),f=d.useContext(),h=d.useContainer(),u=d.useComponentNode(),{gap:m="0"}=f,{columns:w=1,animation:S="none",scrollable:p=!1,...v}=c,[C,A]=d.useScroll(p);if(!u||!a)return null;const{location:k}=a;r.name!==e&&r.name!==""&&S&&(o(de(e,r.name,me)),s(r.name));const{views:N}=h.get("$settings");if(!Object.keys(N).length)return null;const O=(x,D,R)=>{const E=T(D,R),j=u.getChildren(x)[0];return g.jsx(pe,{...n,...v,scrollableCss:C,ref:A,columns:w,gap:m,...E,className:M.appendClassNames(t,"humany-view"),children:g.jsx(B,{id:j.id,branch:"default"})})},T=(x,D)=>{if(S==="slide"||S==="fade")return{animationCss:d.transitionComposer.composeViewTransition(x,S,D),"data-state":x}};return g.jsx(he,{className:"humany-animated-view",children:g.jsx(K.TransitionGroup,{component:null,childFactory:x=>b.cloneElement(x,{direction:i}),children:g.jsx(K.Transition,{timeout:{enter:500,exit:500},onEnter:x=>x==null?void 0:x.clientHeight,unmountOnExit:!0,direction:U.forth,children:(x,{direction:D})=>g.jsx(Z,{views:N,location:k,render:R=>O(R,x,D)})},e)})})},fe=P(d.Grid)`
|
|
12
|
+
${t=>!!t.scrollableCss&&t.scrollableCss}
|
|
13
|
+
`,ye=({className:t="",...n})=>{const e=d.useProperties(),s=d.useContext(),i=d.useContainer(),o=d.useComponentNode(),{views:r}=i.get("$settings"),{gap:a="0"}=s,{columns:c=1,animation:f="none",scrollable:h=!1,...u}=e,[m,w]=d.useScroll(h);return o?g.jsx(fe,{...n,...u,scrollableCss:m,ref:w,columns:c,gap:a,className:M.appendClassNames(t,"humany-view"),children:g.jsx(Z,{views:r,render:S=>{const p=o.getChildren(S)[0];return g.jsx(B,{id:p.id,node:p,branch:"default"})}})}):null},W=t=>{var n,e;return z.css`
|
|
14
|
+
outline: none;
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
* {
|
|
15
17
|
box-sizing: border-box;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
outline: none;
|
|
19
|
-
}
|
|
18
|
+
outline: none;
|
|
19
|
+
}
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
grid-column: ${t["data-indent"]?`${t["data-indent"]+1} / ${t["data-indent"]+(t["data-width"]||0)+1}`:`span ${t["data-width"]}`};
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
${((n=t.theme.fonts)==null?void 0:n.type)&&`
|
|
24
24
|
font-family: ${t.theme.fonts.type};
|
|
25
25
|
|
|
26
26
|
input, textarea {
|
|
@@ -28,29 +28,29 @@
|
|
|
28
28
|
}
|
|
29
29
|
`}
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
${((e=t.theme.fonts)==null?void 0:e.base)&&`
|
|
32
32
|
font-size: ${t.theme.fonts.base};
|
|
33
33
|
`}
|
|
34
34
|
|
|
35
35
|
&:focus-visible {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
${d.paddedBorderTabStyle(t)};
|
|
37
|
+
}
|
|
38
38
|
`},be=P(ye)`
|
|
39
|
-
|
|
39
|
+
${t=>W(t)}
|
|
40
40
|
`,we=P(ge)`
|
|
41
|
-
|
|
41
|
+
${t=>W(t)}
|
|
42
42
|
`,ve=P.div`
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
text-align: center;
|
|
44
|
+
${t=>{var n,e,s;return typeof((n=t.theme.colors)==null?void 0:n.warning)<"u"&&z.css`
|
|
45
|
+
color: ${(e=t.theme.colors)==null?void 0:e.warning};
|
|
46
|
+
border: 2px dashed ${(s=t.theme.colors)==null?void 0:s.warning};
|
|
47
|
+
`}}
|
|
48
|
+
${t=>typeof t.theme.borderRadius<"u"&&`border-radius: ${t.theme.borderRadius};`}
|
|
49
49
|
${t=>W(t)}
|
|
50
50
|
`,Se=b.forwardRef(({className:t="",children:n,...e},s)=>{const i=d.useComponent(),{name:o,type:r,id:a}=d.useComponentDescriptor(),c=b.useMemo(()=>i?P(i)`
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
${W}
|
|
52
|
+
${d.filterCssPropsStyle}
|
|
53
|
+
`:null,[i]);return typeof i>"u"?null:i===null||c===null?process.env.NODE_ENV!=="production"?g.jsx(ve,{...e,title:`type: ${r}, definition-id: ${o}, instance-id: ${a}`,className:M.appendClassNames(t,"humany-non-resolved-component"),children:g.jsx(d.Typography,{variant:"h5",children:"Non Resolved Component Type"})}):null:g.jsx(b.Suspense,{fallback:null,children:g.jsx(c,{ref:s,...e,className:M.appendClassNames(t,"humany-component",`humany-component-${o}`),children:n})})}),Ce=t=>{const n=d.useComponentNode(t),e=d.useComponentPlatform(),[s,i]=b.useState({}),o=d.useIsMounted();return b.useEffect(()=>{n&&o.current&&i(n.attributes.properties)},[n,t,o]),b.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},xe=(t,n)=>n?!0:typeof t=="string"?t==="full":t>0,B=b.forwardRef(({className:t="",id:n,branch:e,node:s,ariaLabel:i,tabIndex:o,context:r,...a},c)=>{const f=d.useComponentPlatform(),h=d.useContainer(),[u,m]=b.useState(),w=d.useColumns(),S=d.useContext(n),p=Ce(n),{size:v="none",indent:C=0}=d.useLayout(n),A=xe(v,s);if(b.useEffect(()=>{if(f){if(n&&!s){const E=f.nodes.get(n);if(E&&(m(y.asDescriptor(E,e)),A)){const j=E.mount(h);return()=>{j()}}}else if(s){m(y.asDescriptor(s,e));const E=s.mount(h);return()=>{E()}}}},[f,n,s,A]),!u||!A)return null;const k={...S,...r||{}},{cardinal:N,fonts:O={},accessibility:T={},...x}=k,D={type:O.type,base:O.base||"16px",small:O.small||"0.8em",normal:O.normal||"1em",medium:O.medium||"1.2em",large:O.large||"1.6em",huge:O.huge||"2.5em"},R={...x,fonts:D,accessibility:{...T}};return typeof N=="number"&&(R.sizes={cardinal:N,small:`${N}px`,normal:`${N*3}px`,medium:`${N*5}px`,large:`${N*8}px`}),g.jsx(z.ThemeProvider,{theme:R,children:g.jsx(d.ComponentNodeContext.Provider,{value:u,children:g.jsx(d.ComponentPropertyContext.Provider,{value:p,children:(()=>{const E={"data-width":v==="full"?w:Math.min(v,w),"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:p.role?p&&p.role:null,...a};switch(u.type){case"view":return typeof p.animation=="string"&&p.animation!=="none"?g.jsx(we,{...E,className:t}):g.jsx(be,{...E,className:t});default:{const j=d.filterCssProps(p);return g.jsx(Se,{ref:c,...E,...j,className:t})}}})()})})})}),J=({builder:t})=>{const n=d.useContainer(),[e,s]=b.useState(null);return b.useEffect(()=>{n.getAsync("components").then(i=>t(i).then(o=>{s(o)}))},[]),b.useEffect(()=>()=>{e&&n.getAsync("components").then(i=>{i.nodes.detached=i.nodes.detached.filter(o=>o.id!==e.id)})},[e]),e?g.jsx(B,{id:e.id,node:e,branch:"default"}):null},Oe=Object.freeze(Object.defineProperty({__proto__:null,default:J},Symbol.toStringTag,{value:"Module"})),Ee=b.lazy(()=>Promise.resolve().then(()=>Oe)),Me=({showSearch:t=!1})=>{const n=z.useTheme(),e=d.useContainer();return g.jsx(b.Suspense,{fallback:null,children:g.jsx(Ee,{builder:s=>e.get("settings").then(i=>{var f;const{properties:o,context:r}=Object.keys(i.components).reduce((h,u)=>(i.components[u].type==="not-found"&&(h.properties=i.components[u].properties,h.context=i.components[u].context),h),{properties:{},context:{}});o.showSearch=t;const a=s.createNode("area",{detached:!0});if(a.name="not-found-area",a.writeLayout({size:"full"}),t){const h=Object.keys(i.components).reduce((m,w)=>i.components[w].type==="search"?i.components[w].properties:m,{}),u=s.createNode("search",{detached:!0});u.writeLayout({size:"full"}),u.writeProperties({"css-margin-bottom":((f=n==null?void 0:n.sizes)==null?void 0:f.normal)||"15px",...h}),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})})})},Ae=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""}}},Ne=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 De(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=Ae(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")),Ne(t)}function Le(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 $e(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 X(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 Pe=(t,n)=>t&&n?"both":t?"widgetDOM":n?"triggerDOM":"none",ee=t=>t?typeof t=="boolean"&&t?"link":typeof t=="object"&&!Array.isArray(t)?"badge":"unsupported":"inline",Re=(t,n,e,s,i=!1)=>{var f,h;const o=Pe(n,e),r=ee(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",(f=e==null?void 0:e.parentNode)==null||f.appendChild(u),c.callback=()=>{var p;(p=e==null?void 0:e.parentNode)==null||p.replaceChild(u,e),u.style.display=(e==null?void 0:e.style.display)||"block"}):(h=e==null?void 0:e.parentNode)==null||h.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 p=document.body.appendChild(document.createElement("a"));r==="link"&&(p.innerText=t),c.triggerDOMElement=p}break}}return c},ke="modals";class je{constructor(n,e){L(this,"container");L(this,"unsubscribe",[]);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");this.options.widgetDOMElement.classList.add("humany-widget"),this.options.widgetDOMElement.classList.add(`humany_${s.name}`);const i=n.get("widgetDOMElements")||[];n.register("widgetDOMElements",[...i,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&&$e(e),Promise.resolve().then(()=>require("./render-ec465011.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;X(e,o)}M.notifyDataLoaded(this.container,n);const i=this.container.get("$environment").widgets.all();l.readStorage(this.container,ke,l.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,f={closedTooltip:a,openTooltip:c};this.options.triggerOptions=f;const h=De(e,{label:i,symbol:o,ariaLabel:r,widgetName:s,tooltip:a});this.unsubscribe.push(h)}dispose(){return Promise.resolve().then(()=>require("./unmount-7ebc3b77.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 I="changesets",Ve=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 F{constructor(n,e){this.container=n,this.storageWriter=e}static create(n){return l.createStorageWriter(n,I,l.StorageCategory.Necessary,{medium:l.StorageMedium.Local}).then(e=>new F(n,e))}write(n,e,s,i){return M.lock(this)(()=>l.readStorage(this.container,I,l.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:Ve(s),rules:e.rules},this.storageWriter({keys:r,items:a})}))}remove(n){return M.lock(this)(()=>l.readStorage(this.container,I,l.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 M.lock(this)(()=>l.readStorage(this.container,I,l.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:f}=r;n.write({attributes:c,options:f,target:new y.ComponentQuery(n,a)})}})}))}}const We=t=>{const{container:n}=t;return F.create(n).then(e=>{const s=n.get("$settings"),i={localStorage:e},o=new y.ComponentPlatform(t,i),r=y.createComponentModel(o,s);return t.events.subscribe("widget:state-change",(a,c)=>{c.state===Q.WidgetState.Deactivating&&r()}),o})},_e=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(f=>({name:f,path:a[f].path})),basePath:r})})),Ie=t=>import("@telia-ace/widget-services").then(({StorageProvider:n})=>new n),qe=t=>import("@telia-ace/widget-core").then(({ActionResolver:n})=>new n(t)),ze=t=>import("@telia-ace/widget-core").then(({ComponentResolver:n})=>new n(t)),Be=t=>import("@telia-ace/widget-core").then(({ComponentPlatform:n,createComponentModel:e})=>We(t.get("$widget"))),H="$settings",q="open",Y="activeStickyWidget";class te extends Q.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",()=>Ie(this.container)),this.container.registerFactory("settings",()=>l.readStorage(this.container,H,l.StorageMedium.Local).then((s={})=>({...this.container.get("$settings"),...s}))),le.supportBootstrapping(this,"load",this.handleBootstrapping),this.container.registerAsync("componentResolver",()=>ze(this.container)),this.container.registerAsync("router",()=>_e(this.container)),this.container.registerAsync("actionResolver",()=>qe(this.container)),this.container.register("matchMedia",window.matchMedia),this.container.registerAsync("components",()=>Be(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 h;i.subscribe(this.widget.name,(u,p,w)=>this.onAction(p,w));const c=u=>{r.nodes.query({type:"view"}).forEach(p=>{r.setSwitch(p,u)})},f=((h=o.getInitialRoute())==null?void 0:h.name)||"index";return c(f),this.events.subscribe("widget:data-loaded",(u,{element:p})=>{this.widget.container.get("seoConfiguration")&&this.events.dispatch("widget:preloaded-replaced",{element:p})}),this.events.subscribe("router:change",(u,{previous:p={routeData:{}},next:w={routeData:{}}})=>{const{routeData:S}=p,{routeData:m}=w,v=Object.keys(a.views).reduce((C,A)=>typeof a.views[A].path>"u"?A:C,"");!m.name&&v?c(v):c(m.name),M.removeNullAndUndefinedValues(S&&S.params),M.removeNullAndUndefinedValues(m&&m.params),this.container.getAsync("actionResolver").then(C=>{C.action(this.widget.name,"routeChange",{next:m,previous:S})})}),o.initialize()})}attach(e={}){return this.container.get("settings").then(({trigger:s})=>{var w,S;const{widgetDOMElement:i,key:o=M.uuid(),triggerDOMElement:r,withRenderState:a}=e,f=ee(s)===$.Inline&&((r==null?void 0:r.childElementCount)||0)>0,h=Re(this.widget.name,i,r,s,f);this.outlets.size<1&&!a&&this.setRenderState("unset");const u=()=>{const m=()=>v.querySelectorAll("[data-loading=true]").length===0,[v]=this.widget.container.get("widgetDOMElements"),C=(N,O)=>{m()&&(h.callback&&h.callback(),O.disconnect())},A={attributes:!0,subtree:!0,childList:!0};m()&&h.callback&&h.callback(),new MutationObserver(C).observe(v,A)};f&&this.widget.container.getAsync("dataClient").then(({events:m})=>{m.subscribe("data-client:fetched",(v,C)=>{C.unresolvedQueries===0&&u()})});const p=this.getOrCreateViewOutlet(o,h);if(this.outlets.set(o,p),this.widget.events.dispatch("widget:attached",{},{bubbles:!0}),h.triggerType===$.Badge&&s&&((w=h.triggerDOMElement)==null||w.setAttribute("aria-expanded","false"),p==null||p.renderBadge(s)),h.triggerType!==$.Inline&&((S=h.triggerDOMElement)==null||S.addEventListener("click",m=>{m.preventDefault(),this.container.get("settings").then(({trigger:v})=>{p.render().then(()=>this.renderState()).then(C=>v&&v.action&&v.action==="hide"?C===y.WidgetRenderState.open?this.hide():this.open():C===y.WidgetRenderState.open?this.close():this.open())})})),this.outlets.size>1)return this.renderState().then(m=>{this.triggerStateIfApplicable(m)});if(a)return a==="storage"?this.renderState().then(m=>{if(h.triggerType===$.Inline){this.triggerStateIfApplicable("open");return}this.triggerStateIfApplicable(m)}):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 je(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"),l.createStorageWriter(this.container,H,l.StorageCategory.Necessary,{medium:l.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 l.createStorageWriter(this.container,H,l.StorageCategory.Necessary,{medium:l.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(ue.onWidgetUrl(this.container))return Promise.resolve(y.WidgetRenderState.open);const e=()=>l.readStorage(this.container,q,l.StorageMedium.Session).then((i=y.WidgetRenderState.closed)=>i),s=()=>l.readStorage(this.container,q,l.StorageMedium.Session).then((i=y.WidgetRenderState.closed)=>i);return this.container.getAsync("router").then(i=>i.isSticky()?s().then(o=>o===y.WidgetRenderState.open?o:e()):e())}hide(){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(e=>e.render()),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.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"?y.WidgetRenderState.open:e==="close"?y.WidgetRenderState.closed:y.WidgetRenderState.hidden;return this.setRenderState(i).then(()=>{this.setTriggerState(i===y.WidgetRenderState.open),i!==y.WidgetRenderState.hidden?i===y.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([l.createStorageWriter(this.container,q,l.StorageCategory.Necessary,{medium:l.StorageMedium.Session}),l.createStorageWriter(this.container,q,l.StorageCategory.Necessary,{medium:l.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=>{var i;return(i=s.options.triggerDOMElement)==null?void 0:i.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?X(i,r):Le(i,a))})}deactivate(){this.subs.forEach(s=>s());const e=[];return this.outlets.forEach(s=>e.push(s.dispose())),l.readStorage(this.container,Y,l.StorageMedium.Local).then(s=>s===this.widget.name?l.createStorageWriter(this.container,Y,l.StorageCategory.Necessary,{medium:l.StorageMedium.Local,scope:l.StorageScope.Implementation}).then(i=>i()).then(()=>Promise.all(e)):Promise.all(e))}}exports.Component=B;exports.DetachedComponent=J;exports.GridWidget=te;exports.NotFound=Me;exports.Widget=te;exports.genericComponentStyling=W;
|
|
71
|
+
${i.length?`<span>${i}</span>`:""}`,setTimeout(()=>t&&t.classList.add("humany-rendered")),Ne(t)}function Le(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 $e(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 X(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 Pe=(t,n)=>t&&n?"both":t?"widgetDOM":n?"triggerDOM":"none",ee=t=>t?typeof t=="boolean"&&t?"link":typeof t=="object"&&!Array.isArray(t)?"badge":"unsupported":"inline",Re=(t,n,e,s,i=!1)=>{var f,h;const o=Pe(n,e),r=ee(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",(f=e==null?void 0:e.parentNode)==null||f.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"}):(h=e==null?void 0:e.parentNode)==null||h.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},ke="modals";class je{constructor(n,e){L(this,"container");L(this,"unsubscribe",[]);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");this.options.widgetDOMElement.classList.add("humany-widget"),this.options.widgetDOMElement.classList.add(`humany_${s.name}`);const i=n.get("widgetDOMElements")||[];n.register("widgetDOMElements",[...i,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&&$e(e),Promise.resolve().then(()=>require("./render-ec465011.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;X(e,o)}M.notifyDataLoaded(this.container,n);const i=this.container.get("$environment").widgets.all();l.readStorage(this.container,ke,l.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,f={closedTooltip:a,openTooltip:c};this.options.triggerOptions=f;const h=De(e,{label:i,symbol:o,ariaLabel:r,widgetName:s,tooltip:a});this.unsubscribe.push(h)}dispose(){return Promise.resolve().then(()=>require("./unmount-7ebc3b77.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 I="changesets",Ve=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 F{constructor(n,e){this.container=n,this.storageWriter=e}static create(n){return l.createStorageWriter(n,I,l.StorageCategory.Necessary,{medium:l.StorageMedium.Local}).then(e=>new F(n,e))}write(n,e,s,i){return M.lock(this)(()=>l.readStorage(this.container,I,l.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:Ve(s),rules:e.rules},this.storageWriter({keys:r,items:a})}))}remove(n){return M.lock(this)(()=>l.readStorage(this.container,I,l.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 M.lock(this)(()=>l.readStorage(this.container,I,l.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:f}=r;n.write({attributes:c,options:f,target:new y.ComponentQuery(n,a)})}})}))}}const We=t=>{const{container:n}=t;return F.create(n).then(e=>{const s=n.get("$settings"),i={localStorage:e},o=new y.ComponentPlatform(t,i),r=y.createComponentModel(o,s);return t.events.subscribe("widget:state-change",(a,c)=>{c.state===Q.WidgetState.Deactivating&&r()}),o})},_e=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(f=>({name:f,path:a[f].path})),basePath:r})})),Ie=t=>import("@telia-ace/widget-services").then(({StorageProvider:n})=>new n),qe=t=>import("@telia-ace/widget-core").then(({ActionResolver:n})=>new n(t)),ze=t=>import("@telia-ace/widget-core").then(({ComponentResolver:n})=>new n(t)),Be=t=>import("@telia-ace/widget-core").then(({ComponentPlatform:n,createComponentModel:e})=>We(t.get("$widget"))),H="$settings",q="open",Y="activeStickyWidget";class te extends Q.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",()=>Ie(this.container)),this.container.registerFactory("settings",()=>l.readStorage(this.container,H,l.StorageMedium.Local).then((s={})=>({...this.container.get("$settings"),...s}))),le.supportBootstrapping(this,"load",this.handleBootstrapping),this.container.registerAsync("componentResolver",()=>ze(this.container)),this.container.registerAsync("router",()=>_e(this.container)),this.container.registerAsync("actionResolver",()=>qe(this.container)),this.container.register("matchMedia",window.matchMedia),this.container.registerAsync("components",()=>Be(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 h;i.subscribe(this.widget.name,(u,m,w)=>this.onAction(m,w));const c=u=>{r.nodes.query({type:"view"}).forEach(m=>{r.setSwitch(m,u)})},f=((h=o.getInitialRoute())==null?void 0:h.name)||"index";return c(f),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:w={routeData:{}}})=>{const{routeData:S}=m,{routeData:p}=w,v=Object.keys(a.views).reduce((C,A)=>typeof a.views[A].path>"u"?A:C,"");!p.name&&v?c(v):c(p.name),M.removeNullAndUndefinedValues(S&&S.params),M.removeNullAndUndefinedValues(p&&p.params),this.container.getAsync("actionResolver").then(C=>{C.action(this.widget.name,"routeChange",{next:p,previous:S})})}),o.initialize()})}attach(e={}){return this.container.get("settings").then(({trigger:s})=>{var w,S;const{widgetDOMElement:i,key:o=M.uuid(),triggerDOMElement:r,withRenderState:a}=e,f=ee(s)===$.Inline&&((r==null?void 0:r.childElementCount)||0)>0,h=Re(this.widget.name,i,r,s,f);this.outlets.size<1&&!a&&this.setRenderState("unset");const u=()=>{const p=()=>v.querySelectorAll("[data-loading=true]").length===0,[v]=this.widget.container.get("widgetDOMElements"),C=(N,O)=>{p()&&(h.callback&&h.callback(),O.disconnect())},A={attributes:!0,subtree:!0,childList:!0};p()&&h.callback&&h.callback(),new MutationObserver(C).observe(v,A)};f&&this.widget.container.getAsync("dataClient").then(({events:p})=>{p.subscribe("data-client:fetched",(v,C)=>{C.unresolvedQueries===0&&u()})});const m=this.getOrCreateViewOutlet(o,h);if(this.outlets.set(o,m),this.widget.events.dispatch("widget:attached",{},{bubbles:!0}),h.triggerType===$.Badge&&s&&((w=h.triggerDOMElement)==null||w.setAttribute("aria-expanded","false"),m==null||m.renderBadge(s)),h.triggerType!==$.Inline&&((S=h.triggerDOMElement)==null||S.addEventListener("click",p=>{p.preventDefault(),this.container.get("settings").then(({trigger:v})=>{m.render().then(()=>this.renderState()).then(C=>v&&v.action&&v.action==="hide"?C===y.WidgetRenderState.open?this.hide():this.open():C===y.WidgetRenderState.open?this.close():this.open())})})),this.outlets.size>1)return this.renderState().then(p=>{this.triggerStateIfApplicable(p)});if(a)return a==="storage"?this.renderState().then(p=>{if(h.triggerType===$.Inline){this.triggerStateIfApplicable("open");return}this.triggerStateIfApplicable(p)}):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 je(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"),l.createStorageWriter(this.container,H,l.StorageCategory.Necessary,{medium:l.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 l.createStorageWriter(this.container,H,l.StorageCategory.Necessary,{medium:l.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(ue.onWidgetUrl(this.container))return Promise.resolve(y.WidgetRenderState.open);const e=()=>l.readStorage(this.container,q,l.StorageMedium.Session).then((i=y.WidgetRenderState.closed)=>i),s=()=>l.readStorage(this.container,q,l.StorageMedium.Session).then((i=y.WidgetRenderState.closed)=>i);return this.container.getAsync("router").then(i=>i.isSticky()?s().then(o=>o===y.WidgetRenderState.open?o:e()):e())}hide(){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(e=>e.render()),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.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"?y.WidgetRenderState.open:e==="close"?y.WidgetRenderState.closed:y.WidgetRenderState.hidden;return this.setRenderState(i).then(()=>{this.setTriggerState(i===y.WidgetRenderState.open),i!==y.WidgetRenderState.hidden?i===y.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([l.createStorageWriter(this.container,q,l.StorageCategory.Necessary,{medium:l.StorageMedium.Session}),l.createStorageWriter(this.container,q,l.StorageCategory.Necessary,{medium:l.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=>{var i;return(i=s.options.triggerDOMElement)==null?void 0:i.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?X(i,r):Le(i,a))})}deactivate(){this.subs.forEach(s=>s());const e=[];return this.outlets.forEach(s=>e.push(s.dispose())),l.readStorage(this.container,Y,l.StorageMedium.Local).then(s=>s===this.widget.name?l.createStorageWriter(this.container,Y,l.StorageCategory.Necessary,{medium:l.StorageMedium.Local,scope:l.StorageScope.Implementation}).then(i=>i()).then(()=>Promise.all(e)):Promise.all(e))}}exports.Component=B;exports.DetachedComponent=J;exports.GridWidget=te;exports.NotFound=Me;exports.Widget=te;exports.genericComponentStyling=W;
|
package/index.mjs
CHANGED
|
@@ -51,12 +51,12 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
51
51
|
}, Yt = ({ className: e = "", ...n }) => {
|
|
52
52
|
const [t, i] = _("index"), [s, o] = _(
|
|
53
53
|
U.forth
|
|
54
|
-
), r = yt(), a = wt(), c = st(), m = Y(), u = z(), l = q(), { gap:
|
|
54
|
+
), r = yt(), a = wt(), c = st(), m = Y(), u = z(), l = q(), { gap: h = "0" } = m, {
|
|
55
55
|
columns: f = 1,
|
|
56
56
|
animation: b = "none",
|
|
57
|
-
scrollable:
|
|
57
|
+
scrollable: d = !1,
|
|
58
58
|
...g
|
|
59
|
-
} = c, [y, S] = ot(
|
|
59
|
+
} = c, [y, S] = ot(d);
|
|
60
60
|
if (!l || !a)
|
|
61
61
|
return null;
|
|
62
62
|
const { location: R } = a;
|
|
@@ -76,7 +76,7 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
76
76
|
scrollableCss: y,
|
|
77
77
|
ref: S,
|
|
78
78
|
columns: f,
|
|
79
|
-
gap:
|
|
79
|
+
gap: h,
|
|
80
80
|
...E,
|
|
81
81
|
className: j(e, "humany-view"),
|
|
82
82
|
children: /* @__PURE__ */ p(Z, { id: V.id, branch: "default" })
|
|
@@ -119,15 +119,20 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
119
119
|
}
|
|
120
120
|
) });
|
|
121
121
|
}, qt = L(it)`
|
|
122
|
-
|
|
122
|
+
${(e) => !!e.scrollableCss && e.scrollableCss}
|
|
123
123
|
`, Qt = ({ className: e = "", ...n }) => {
|
|
124
|
-
const t = st(), i = Y(), s = z(), o = q(), { views: r } = s.get("$settings"), { gap: a = "0" } = i, {
|
|
124
|
+
const t = st(), i = Y(), s = z(), o = q(), { views: r } = s.get("$settings"), { gap: a = "0" } = i, {
|
|
125
|
+
columns: c = 1,
|
|
126
|
+
animation: m = "none",
|
|
127
|
+
scrollable: u = !1,
|
|
128
|
+
...l
|
|
129
|
+
} = t, [h, f] = ot(u);
|
|
125
130
|
return o ? /* @__PURE__ */ p(
|
|
126
131
|
qt,
|
|
127
132
|
{
|
|
128
133
|
...n,
|
|
129
134
|
...l,
|
|
130
|
-
scrollableCss:
|
|
135
|
+
scrollableCss: h,
|
|
131
136
|
ref: f,
|
|
132
137
|
columns: c,
|
|
133
138
|
gap: a,
|
|
@@ -137,8 +142,8 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
137
142
|
{
|
|
138
143
|
views: r,
|
|
139
144
|
render: (b) => {
|
|
140
|
-
const
|
|
141
|
-
return /* @__PURE__ */ p(Z, { id:
|
|
145
|
+
const d = o.getChildren(b)[0];
|
|
146
|
+
return /* @__PURE__ */ p(Z, { id: d.id, node: d, branch: "default" });
|
|
142
147
|
}
|
|
143
148
|
}
|
|
144
149
|
)
|
|
@@ -147,16 +152,16 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
147
152
|
}, G = (e) => {
|
|
148
153
|
var n, t;
|
|
149
154
|
return nt`
|
|
150
|
-
|
|
155
|
+
outline: none;
|
|
156
|
+
box-sizing: border-box;
|
|
157
|
+
* {
|
|
151
158
|
box-sizing: border-box;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
outline: none;
|
|
155
|
-
}
|
|
159
|
+
outline: none;
|
|
160
|
+
}
|
|
156
161
|
|
|
157
|
-
|
|
162
|
+
grid-column: ${e["data-indent"] ? `${e["data-indent"] + 1} / ${e["data-indent"] + (e["data-width"] || 0) + 1}` : `span ${e["data-width"]}`};
|
|
158
163
|
|
|
159
|
-
|
|
164
|
+
${((n = e.theme.fonts) == null ? void 0 : n.type) && `
|
|
160
165
|
font-family: ${e.theme.fonts.type};
|
|
161
166
|
|
|
162
167
|
input, textarea {
|
|
@@ -164,41 +169,44 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
164
169
|
}
|
|
165
170
|
`}
|
|
166
171
|
|
|
167
|
-
|
|
172
|
+
${((t = e.theme.fonts) == null ? void 0 : t.base) && `
|
|
168
173
|
font-size: ${e.theme.fonts.base};
|
|
169
174
|
`}
|
|
170
175
|
|
|
171
176
|
&:focus-visible {
|
|
172
|
-
|
|
173
|
-
|
|
177
|
+
${Ct(e)};
|
|
178
|
+
}
|
|
174
179
|
`;
|
|
175
180
|
}, Zt = L(Qt)`
|
|
176
|
-
|
|
181
|
+
${(e) => G(e)}
|
|
177
182
|
`, Jt = L(Yt)`
|
|
178
|
-
|
|
183
|
+
${(e) => G(e)}
|
|
179
184
|
`, Xt = L.div`
|
|
180
|
-
|
|
181
|
-
|
|
185
|
+
text-align: center;
|
|
186
|
+
${(e) => {
|
|
182
187
|
var n, t, i;
|
|
183
188
|
return typeof ((n = e.theme.colors) == null ? void 0 : n.warning) < "u" && nt`
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
189
|
+
color: ${(t = e.theme.colors) == null ? void 0 : t.warning};
|
|
190
|
+
border: 2px dashed ${(i = e.theme.colors) == null ? void 0 : i.warning};
|
|
191
|
+
`;
|
|
187
192
|
}}
|
|
188
|
-
|
|
193
|
+
${(e) => typeof e.theme.borderRadius < "u" && `border-radius: ${e.theme.borderRadius};`}
|
|
189
194
|
${(e) => G(e)}
|
|
190
195
|
`, te = at(
|
|
191
196
|
({ className: e = "", children: n, ...t }, i) => {
|
|
192
197
|
const s = Ot(), { name: o, type: r, id: a } = Et(), c = Pt(() => s ? L(s)`
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
198
|
+
${G}
|
|
199
|
+
${St}
|
|
200
|
+
` : null, [s]);
|
|
196
201
|
return typeof s > "u" ? null : s === null || c === null ? process.env.NODE_ENV !== "production" ? /* @__PURE__ */ p(
|
|
197
202
|
Xt,
|
|
198
203
|
{
|
|
199
204
|
...t,
|
|
200
205
|
title: `type: ${r}, definition-id: ${o}, instance-id: ${a}`,
|
|
201
|
-
className: j(
|
|
206
|
+
className: j(
|
|
207
|
+
e,
|
|
208
|
+
"humany-non-resolved-component"
|
|
209
|
+
),
|
|
202
210
|
children: /* @__PURE__ */ p(At, { variant: "h5", children: "Non Resolved Component Type" })
|
|
203
211
|
}
|
|
204
212
|
) : null : /* @__PURE__ */ p(kt, { fallback: null, children: /* @__PURE__ */ p(
|
|
@@ -243,19 +251,19 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
243
251
|
context: r,
|
|
244
252
|
...a
|
|
245
253
|
}, c) => {
|
|
246
|
-
const m = rt(), u = z(), [l,
|
|
254
|
+
const m = rt(), u = z(), [l, h] = _(), f = Dt(), b = Y(n), d = ee(n), { size: g = "none", indent: y = 0 } = Mt(n), S = ne(g, i);
|
|
247
255
|
if (I(() => {
|
|
248
256
|
if (m) {
|
|
249
257
|
if (n && !i) {
|
|
250
258
|
const E = m.nodes.get(n);
|
|
251
|
-
if (E && (
|
|
259
|
+
if (E && (h(X(E, t)), S)) {
|
|
252
260
|
const V = E.mount(u);
|
|
253
261
|
return () => {
|
|
254
262
|
V();
|
|
255
263
|
};
|
|
256
264
|
}
|
|
257
265
|
} else if (i) {
|
|
258
|
-
|
|
266
|
+
h(X(i, t));
|
|
259
267
|
const E = i.mount(u);
|
|
260
268
|
return () => {
|
|
261
269
|
E();
|
|
@@ -290,7 +298,7 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
290
298
|
normal: `${A * 3}px`,
|
|
291
299
|
medium: `${A * 5}px`,
|
|
292
300
|
large: `${A * 8}px`
|
|
293
|
-
}), /* @__PURE__ */ p(pt, { theme: $, children: /* @__PURE__ */ p(Nt.Provider, { value: l, children: /* @__PURE__ */ p(Lt.Provider, { value:
|
|
301
|
+
}), /* @__PURE__ */ p(pt, { theme: $, children: /* @__PURE__ */ p(Nt.Provider, { value: l, children: /* @__PURE__ */ p(Lt.Provider, { value: d, children: (() => {
|
|
294
302
|
const E = {
|
|
295
303
|
"data-width": g === "full" ? f : Math.min(g, f),
|
|
296
304
|
"data-indent": y,
|
|
@@ -300,14 +308,14 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
300
308
|
"aria-label": s,
|
|
301
309
|
tabIndex: o,
|
|
302
310
|
id: l.id,
|
|
303
|
-
role:
|
|
311
|
+
role: d.role ? d && d.role : null,
|
|
304
312
|
...a
|
|
305
313
|
};
|
|
306
314
|
switch (l.type) {
|
|
307
315
|
case "view":
|
|
308
|
-
return typeof
|
|
316
|
+
return typeof d.animation == "string" && d.animation !== "none" ? /* @__PURE__ */ p(Jt, { ...E, className: e }) : /* @__PURE__ */ p(Zt, { ...E, className: e });
|
|
309
317
|
default: {
|
|
310
|
-
const V = $t(
|
|
318
|
+
const V = $t(d);
|
|
311
319
|
return /* @__PURE__ */ p(
|
|
312
320
|
te,
|
|
313
321
|
{
|
|
@@ -344,7 +352,9 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
344
352
|
{
|
|
345
353
|
builder: (i) => t.get("settings").then((s) => {
|
|
346
354
|
var m;
|
|
347
|
-
const { properties: o, context: r } = Object.keys(
|
|
355
|
+
const { properties: o, context: r } = Object.keys(
|
|
356
|
+
s.components
|
|
357
|
+
).reduce(
|
|
348
358
|
(u, l) => (s.components[l].type === "not-found" && (u.properties = s.components[l].properties, u.context = s.components[l].context), u),
|
|
349
359
|
{ properties: {}, context: {} }
|
|
350
360
|
);
|
|
@@ -353,16 +363,19 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
353
363
|
if (a.name = "not-found-area", a.writeLayout({
|
|
354
364
|
size: "full"
|
|
355
365
|
}), e) {
|
|
356
|
-
const u = Object.keys(
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
366
|
+
const u = Object.keys(
|
|
367
|
+
s.components
|
|
368
|
+
).reduce((h, f) => s.components[f].type === "search" ? s.components[f].properties : h, {}), l = i.createNode("search", {
|
|
369
|
+
detached: !0
|
|
370
|
+
});
|
|
360
371
|
l.writeLayout({ size: "full" }), l.writeProperties({
|
|
361
372
|
"css-margin-bottom": ((m = n == null ? void 0 : n.sizes) == null ? void 0 : m.normal) || "15px",
|
|
362
373
|
...u
|
|
363
374
|
}), a.appendChild(l);
|
|
364
375
|
}
|
|
365
|
-
const c = i.createNode("not-found", {
|
|
376
|
+
const c = i.createNode("not-found", {
|
|
377
|
+
detached: !0
|
|
378
|
+
});
|
|
366
379
|
return c.writeLayout({ size: "full" }), c.writeProperties(o), c.writeContext(r), a.appendChild(c), a;
|
|
367
380
|
})
|
|
368
381
|
}
|
|
@@ -392,7 +405,13 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
392
405
|
};
|
|
393
406
|
};
|
|
394
407
|
function ce(e, n) {
|
|
395
|
-
const {
|
|
408
|
+
const {
|
|
409
|
+
symbol: t,
|
|
410
|
+
widgetName: i,
|
|
411
|
+
label: s = "",
|
|
412
|
+
ariaLabel: o = "",
|
|
413
|
+
tooltip: r = ""
|
|
414
|
+
} = n;
|
|
396
415
|
e.classList.add("humany-trigger"), e.classList.add(`humany_${i}`), s.length && e.classList.add("humany-has-text"), o.length && !e.getAttribute("aria-label") && e.setAttribute("aria-label", o), o.length && !e.getAttribute("tabindex") && e.setAttribute("tabindex", "0"), r.length && !e.getAttribute("title") && e.setAttribute("title", r);
|
|
397
416
|
const a = re(t) || "";
|
|
398
417
|
return e.innerHTML = `${a}
|
|
@@ -413,7 +432,9 @@ function ce(e, n) {
|
|
|
413
432
|
stroke-miterlimit="10" />
|
|
414
433
|
</svg>
|
|
415
434
|
</span>
|
|
416
|
-
${s.length ? `<span>${s}</span>` : ""}`, setTimeout(
|
|
435
|
+
${s.length ? `<span>${s}</span>` : ""}`, setTimeout(
|
|
436
|
+
() => e && e.classList.add("humany-rendered")
|
|
437
|
+
), ae(e);
|
|
417
438
|
}
|
|
418
439
|
function le(e, n) {
|
|
419
440
|
e instanceof HTMLElement ? (n && e.setAttribute("title", n), e.classList.remove("humany-active"), e.classList.remove("humany-loading")) : e instanceof Array && e.forEach((t) => {
|
|
@@ -461,8 +482,8 @@ const de = (e, n) => e && n ? "both" : e ? "widgetDOM" : n ? "triggerDOM" : "non
|
|
|
461
482
|
case "triggerDOM": {
|
|
462
483
|
const l = document.createElement("div");
|
|
463
484
|
c.widgetDOMElement = l, r === "inline" ? (l.id = (t == null ? void 0 : t.id) || "", s ? (l.style.display = "none", (m = t == null ? void 0 : t.parentNode) == null || m.appendChild(l), c.callback = () => {
|
|
464
|
-
var
|
|
465
|
-
(
|
|
485
|
+
var h;
|
|
486
|
+
(h = t == null ? void 0 : t.parentNode) == null || h.replaceChild(
|
|
466
487
|
l,
|
|
467
488
|
t
|
|
468
489
|
), l.style.display = (t == null ? void 0 : t.style.display) || "block";
|
|
@@ -477,10 +498,10 @@ const de = (e, n) => e && n ? "both" : e ? "widgetDOM" : n ? "triggerDOM" : "non
|
|
|
477
498
|
document.createElement("div")
|
|
478
499
|
);
|
|
479
500
|
if (c.widgetDOMElement = l, r !== "inline") {
|
|
480
|
-
const
|
|
501
|
+
const h = document.body.appendChild(
|
|
481
502
|
document.createElement("a")
|
|
482
503
|
);
|
|
483
|
-
r === "link" && (
|
|
504
|
+
r === "link" && (h.innerText = e), c.triggerDOMElement = h;
|
|
484
505
|
}
|
|
485
506
|
break;
|
|
486
507
|
}
|
|
@@ -491,7 +512,10 @@ class me {
|
|
|
491
512
|
constructor(n, t) {
|
|
492
513
|
M(this, "container");
|
|
493
514
|
M(this, "unsubscribe", []);
|
|
494
|
-
this.options = t, this.container = n.createChild(this), this.container.register("widgetDOMElement", this.options.widgetDOMElement), this.container.register(
|
|
515
|
+
this.options = t, this.container = n.createChild(this), this.container.register("widgetDOMElement", this.options.widgetDOMElement), this.container.register(
|
|
516
|
+
"triggerDOMElement",
|
|
517
|
+
this.options.triggerDOMElement
|
|
518
|
+
);
|
|
495
519
|
const i = this.container.get("$widget");
|
|
496
520
|
this.options.widgetDOMElement.classList.add("humany-widget"), this.options.widgetDOMElement.classList.add(`humany_${i.name}`);
|
|
497
521
|
const s = n.get("widgetDOMElements") || [];
|
|
@@ -566,9 +590,16 @@ class J {
|
|
|
566
590
|
this.container = n, this.storageWriter = t;
|
|
567
591
|
}
|
|
568
592
|
static create(n) {
|
|
569
|
-
return P(
|
|
570
|
-
|
|
571
|
-
|
|
593
|
+
return P(
|
|
594
|
+
n,
|
|
595
|
+
B,
|
|
596
|
+
k.Necessary,
|
|
597
|
+
{
|
|
598
|
+
medium: v.Local
|
|
599
|
+
}
|
|
600
|
+
).then(
|
|
601
|
+
(t) => new J(n, t)
|
|
602
|
+
);
|
|
572
603
|
}
|
|
573
604
|
write(n, t, i, s) {
|
|
574
605
|
return H(this)(() => x(
|
|
@@ -618,27 +649,40 @@ class J {
|
|
|
618
649
|
}
|
|
619
650
|
const ge = (e) => {
|
|
620
651
|
const { container: n } = e;
|
|
621
|
-
return J.create(n).then(
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
}
|
|
652
|
+
return J.create(n).then(
|
|
653
|
+
(t) => {
|
|
654
|
+
const i = n.get("$settings"), s = { localStorage: t }, o = new ft(e, s), r = gt(o, i);
|
|
655
|
+
return e.events.subscribe(
|
|
656
|
+
"widget:state-change",
|
|
657
|
+
(a, c) => {
|
|
658
|
+
c.state === Gt.Deactivating && r();
|
|
659
|
+
}
|
|
660
|
+
), o;
|
|
661
|
+
}
|
|
662
|
+
);
|
|
663
|
+
}, be = (e) => import("@telia-ace/widget-routing").then(
|
|
664
|
+
({ RoutingService: n, HistoryMode: t }) => e.get("settings").then((i) => {
|
|
665
|
+
const {
|
|
666
|
+
routing: {
|
|
667
|
+
initialPath: s = "/",
|
|
668
|
+
mode: o = t.scopedHash,
|
|
669
|
+
basePath: r
|
|
670
|
+
},
|
|
671
|
+
views: a
|
|
672
|
+
} = i;
|
|
673
|
+
return new n(e, {
|
|
674
|
+
initialPath: s,
|
|
675
|
+
mode: o,
|
|
676
|
+
routes: Object.keys(a).map((m) => ({
|
|
677
|
+
name: m,
|
|
678
|
+
path: a[m].path
|
|
679
|
+
})),
|
|
680
|
+
basePath: r
|
|
681
|
+
});
|
|
682
|
+
})
|
|
683
|
+
), ye = (e) => import("@telia-ace/widget-services").then(({ StorageProvider: n }) => new n()), we = (e) => import("@telia-ace/widget-core").then(({ ActionResolver: n }) => new n(e)), ve = (e) => import("@telia-ace/widget-core").then(({ ComponentResolver: n }) => new n(e)), Ce = (e) => import("@telia-ace/widget-core").then(
|
|
684
|
+
({ ComponentPlatform: n, createComponentModel: t }) => ge(e.get("$widget"))
|
|
685
|
+
), K = "$settings", T = "open", et = "activeStickyWidget";
|
|
642
686
|
class Ie extends Wt {
|
|
643
687
|
constructor(t) {
|
|
644
688
|
super(t);
|
|
@@ -693,27 +737,27 @@ class Ie extends Wt {
|
|
|
693
737
|
var u;
|
|
694
738
|
s.subscribe(
|
|
695
739
|
this.widget.name,
|
|
696
|
-
(l,
|
|
740
|
+
(l, h, f) => this.onAction(h, f)
|
|
697
741
|
);
|
|
698
742
|
const c = (l) => {
|
|
699
|
-
r.nodes.query({ type: "view" }).forEach((
|
|
700
|
-
r.setSwitch(
|
|
743
|
+
r.nodes.query({ type: "view" }).forEach((h) => {
|
|
744
|
+
r.setSwitch(h, l);
|
|
701
745
|
});
|
|
702
746
|
}, m = ((u = o.getInitialRoute()) == null ? void 0 : u.name) || "index";
|
|
703
|
-
return c(m), this.events.subscribe("widget:data-loaded", (l, { element:
|
|
747
|
+
return c(m), this.events.subscribe("widget:data-loaded", (l, { element: h }) => {
|
|
704
748
|
this.widget.container.get("seoConfiguration") && this.events.dispatch("widget:preloaded-replaced", {
|
|
705
|
-
element:
|
|
749
|
+
element: h
|
|
706
750
|
});
|
|
707
751
|
}), this.events.subscribe(
|
|
708
752
|
"router:change",
|
|
709
|
-
(l, { previous:
|
|
710
|
-
const { routeData: b } =
|
|
753
|
+
(l, { previous: h = { routeData: {} }, next: f = { routeData: {} } }) => {
|
|
754
|
+
const { routeData: b } = h, { routeData: d } = f, g = Object.keys(a.views).reduce(
|
|
711
755
|
(y, S) => typeof a.views[S].path > "u" ? S : y,
|
|
712
756
|
""
|
|
713
757
|
);
|
|
714
|
-
!
|
|
758
|
+
!d.name && g ? c(g) : c(d.name), tt(b && b.params), tt(d && d.params), this.container.getAsync("actionResolver").then((y) => {
|
|
715
759
|
y.action(this.widget.name, "routeChange", {
|
|
716
|
-
next:
|
|
760
|
+
next: d,
|
|
717
761
|
previous: b
|
|
718
762
|
});
|
|
719
763
|
});
|
|
@@ -739,45 +783,45 @@ class Ie extends Wt {
|
|
|
739
783
|
);
|
|
740
784
|
this.outlets.size < 1 && !a && this.setRenderState("unset");
|
|
741
785
|
const l = () => {
|
|
742
|
-
const
|
|
743
|
-
|
|
786
|
+
const d = () => g.querySelectorAll("[data-loading=true]").length === 0, [g] = this.widget.container.get("widgetDOMElements"), y = (A, O) => {
|
|
787
|
+
d() && (u.callback && u.callback(), O.disconnect());
|
|
744
788
|
}, S = {
|
|
745
789
|
attributes: !0,
|
|
746
790
|
subtree: !0,
|
|
747
791
|
childList: !0
|
|
748
792
|
};
|
|
749
|
-
|
|
793
|
+
d() && u.callback && u.callback(), new MutationObserver(y).observe(g, S);
|
|
750
794
|
};
|
|
751
|
-
m && this.widget.container.getAsync("dataClient").then(({ events:
|
|
752
|
-
|
|
795
|
+
m && this.widget.container.getAsync("dataClient").then(({ events: d }) => {
|
|
796
|
+
d.subscribe(
|
|
753
797
|
"data-client:fetched",
|
|
754
798
|
(g, y) => {
|
|
755
799
|
y.unresolvedQueries === 0 && l();
|
|
756
800
|
}
|
|
757
801
|
);
|
|
758
802
|
});
|
|
759
|
-
const
|
|
760
|
-
if (this.outlets.set(o,
|
|
803
|
+
const h = this.getOrCreateViewOutlet(o, u);
|
|
804
|
+
if (this.outlets.set(o, h), this.widget.events.dispatch("widget:attached", {}, { bubbles: !0 }), u.triggerType === N.Badge && i && ((f = u.triggerDOMElement) == null || f.setAttribute(
|
|
761
805
|
"aria-expanded",
|
|
762
806
|
"false"
|
|
763
|
-
),
|
|
807
|
+
), h == null || h.renderBadge(i)), u.triggerType !== N.Inline && ((b = u.triggerDOMElement) == null || b.addEventListener(
|
|
764
808
|
"click",
|
|
765
|
-
(
|
|
766
|
-
|
|
767
|
-
|
|
809
|
+
(d) => {
|
|
810
|
+
d.preventDefault(), this.container.get("settings").then(({ trigger: g }) => {
|
|
811
|
+
h.render().then(() => this.renderState()).then((y) => g && g.action && g.action === "hide" ? y === C.open ? this.hide() : this.open() : y === C.open ? this.close() : this.open());
|
|
768
812
|
});
|
|
769
813
|
}
|
|
770
814
|
)), this.outlets.size > 1)
|
|
771
|
-
return this.renderState().then((
|
|
772
|
-
this.triggerStateIfApplicable(
|
|
815
|
+
return this.renderState().then((d) => {
|
|
816
|
+
this.triggerStateIfApplicable(d);
|
|
773
817
|
});
|
|
774
818
|
if (a)
|
|
775
|
-
return a === "storage" ? this.renderState().then((
|
|
819
|
+
return a === "storage" ? this.renderState().then((d) => {
|
|
776
820
|
if (u.triggerType === N.Inline) {
|
|
777
821
|
this.triggerStateIfApplicable("open");
|
|
778
822
|
return;
|
|
779
823
|
}
|
|
780
|
-
this.triggerStateIfApplicable(
|
|
824
|
+
this.triggerStateIfApplicable(d);
|
|
781
825
|
}) : this.triggerStateIfApplicable(a);
|
|
782
826
|
});
|
|
783
827
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/widget-types-grid",
|
|
3
|
-
"version": "1.1.2-rc.
|
|
3
|
+
"version": "1.1.2-rc.11",
|
|
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.1.2-rc.
|
|
14
|
-
"@telia-ace/widget-routing": "^1.1.2-rc.
|
|
15
|
-
"@telia-ace/widget-services": "^1.1.2-rc.
|
|
16
|
-
"@telia-ace/widget-ui": "^1.1.2-rc.
|
|
17
|
-
"@telia-ace/widget-utilities": "^1.1.2-rc.
|
|
13
|
+
"@telia-ace/widget-core": "^1.1.2-rc.11",
|
|
14
|
+
"@telia-ace/widget-routing": "^1.1.2-rc.11",
|
|
15
|
+
"@telia-ace/widget-services": "^1.1.2-rc.11",
|
|
16
|
+
"@telia-ace/widget-ui": "^1.1.2-rc.11",
|
|
17
|
+
"@telia-ace/widget-utilities": "^1.1.2-rc.11",
|
|
18
18
|
"@webprovisions/bootstrapping": "^1.0.14",
|
|
19
19
|
"@webprovisions/platform": "^1.1.4"
|
|
20
20
|
},
|