@telia-ace/widget-types-grid 1.3.27-rc.0 → 1.3.27-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +9 -9
- package/index.mjs +65 -64
- package/package.json +6 -6
- package/widget.d.ts +3 -1
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var ne=Object.create;var G=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var ae=(t,n,e)=>n in t?G(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var ce=(t,n,e,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of se(n))!re.call(t,s)&&s!==e&&G(t,s,{get:()=>n[s],enumerable:!(i=ie(n,s))||i.enumerable});return t};var
|
|
1
|
+
"use strict";var ne=Object.create;var G=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var ae=(t,n,e)=>n in t?G(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var ce=(t,n,e,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of se(n))!re.call(t,s)&&s!==e&&G(t,s,{get:()=>n[s],enumerable:!(i=ie(n,s))||i.enumerable});return t};var W=(t,n,e)=>(e=t!=null?ne(oe(t)):{},ce(n||!t||!t.__esModule?G(e,"default",{value:t,enumerable:!0}):e,t));var L=(t,n,e)=>(ae(t,typeof n!="symbol"?n+"":n,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),z=require("@emotion/react"),w=require("@telia-ace/widget-core"),h=require("@telia-ace/widget-ui"),v=require("react"),P=require("@emotion/styled"),M=require("@telia-ace/widget-utilities"),K=require("react-transition-group"),_=require("react-router"),ue=require("@telia-ace/widget-routing"),l=require("@telia-ace/widget-services"),le=require("@webprovisions/bootstrapping"),Q=require("@webprovisions/platform");var U=(t=>(t.back="back",t.forth="forth",t))(U||{});const de=(t,n,e)=>typeof e[t]=="number"&&typeof e[n]=="number"&&e[t]>e[n]?"back":"forth",Z=({views:t,location:n,render:e})=>f.jsx(_.Switch,{location:n&&{...n,pathname:n.pathname.split("?")[0]},children:[...Object.keys(t).filter(i=>!!t[i].path),...Object.keys(t).filter(i=>!t[i].path)].map(i=>{const{path:s}=t[i];return s?Array.isArray(s)?s.map(o=>f.jsx(_.Route,{exact:!0,path:o,render:()=>e(i)},i)):f.jsx(_.Route,{exact:!0,path:s,render:()=>e(i)},i):f.jsx(_.Route,{render:()=>e(i)},i)})}),he=P.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
|
-
`,me={index:1,search:2,browse:3,guide:4,contact:5,"contact-method":6,conversation:7},ge=({className:t="",...n})=>{const[e,i]=v.useState("index"),[s,o]=v.useState(U.forth),r=h.useRouteData(),a=h.useRouter(),c=h.useProperties(),g=h.useContext(),d=h.useContainer(),u=h.useComponentNode(),{gap:p="0"}=g,{columns:b=1,animation:y="none",scrollable:m=!1,...S}=c,[C,A]=h.useScroll(m);if(!u||!a)return null;const{location:k}=a;r.name!==e&&r.name!==""&&y&&(o(de(e,r.name,me)),i(r.name));const{views:D}=d.get("$settings");if(!Object.keys(D).length)return null;const E=(O,N,R)=>{const x=
|
|
11
|
+
`,me={index:1,search:2,browse:3,guide:4,contact:5,"contact-method":6,conversation:7},ge=({className:t="",...n})=>{const[e,i]=v.useState("index"),[s,o]=v.useState(U.forth),r=h.useRouteData(),a=h.useRouter(),c=h.useProperties(),g=h.useContext(),d=h.useContainer(),u=h.useComponentNode(),{gap:p="0"}=g,{columns:b=1,animation:y="none",scrollable:m=!1,...S}=c,[C,A]=h.useScroll(m);if(!u||!a)return null;const{location:k}=a;r.name!==e&&r.name!==""&&y&&(o(de(e,r.name,me)),i(r.name));const{views:D}=d.get("$settings");if(!Object.keys(D).length)return null;const E=(O,N,R)=>{const x=B(N,R),j=u.getChildren(O)[0];return f.jsx(pe,{...n,...S,scrollableCss:C,ref:A,columns:b,gap:p,...x,className:M.appendClassNames(t,"humany-view"),children:f.jsx(T,{id:j.id,branch:"default"})})},B=(O,N)=>{if(y==="slide"||y==="fade")return{animationCss:h.transitionComposer.composeViewTransition(O,y,N),"data-state":O}};return f.jsx(he,{className:"humany-animated-view",children:f.jsx(K.TransitionGroup,{component:null,childFactory:O=>v.cloneElement(O,{direction:s}),children:f.jsx(K.Transition,{timeout:{enter:500,exit:500},onEnter:O=>O==null?void 0:O.clientHeight,unmountOnExit:!0,direction:U.forth,children:(O,{direction:N})=>f.jsx(Z,{views:D,location:k,render:R=>E(R,O,N)})},e)})})},fe=P(h.Grid)`
|
|
12
12
|
${t=>!!t.scrollableCss&&t.scrollableCss}
|
|
13
|
-
`,be=({className:t="",...n})=>{const e=h.useProperties(),i=h.useContext(),s=h.useContainer(),o=h.useComponentNode(),{views:r}=s.get("$settings"),{gap:a="0"}=i,{columns:c=1,animation:g="none",scrollable:d=!1,...u}=e,[p,b]=h.useScroll(d);return o?f.jsx(fe,{...n,...u,scrollableCss:p,ref:b,columns:c,gap:a,className:M.appendClassNames(t,"humany-view"),children:f.jsx(Z,{views:r,render:y=>{const m=o.getChildren(y)[0];return f.jsx(
|
|
13
|
+
`,be=({className:t="",...n})=>{const e=h.useProperties(),i=h.useContext(),s=h.useContainer(),o=h.useComponentNode(),{views:r}=s.get("$settings"),{gap:a="0"}=i,{columns:c=1,animation:g="none",scrollable:d=!1,...u}=e,[p,b]=h.useScroll(d);return o?f.jsx(fe,{...n,...u,scrollableCss:p,ref:b,columns:c,gap:a,className:M.appendClassNames(t,"humany-view"),children:f.jsx(Z,{views:r,render:y=>{const m=o.getChildren(y)[0];return f.jsx(T,{id:m.id,node:m,branch:"default"})}})}):null},V=t=>{var n,e;return z.css`
|
|
14
14
|
outline: none;
|
|
15
15
|
box-sizing: border-box;
|
|
16
16
|
* {
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
${h.paddedBorderTabStyle(t)};
|
|
37
37
|
}
|
|
38
38
|
`},ye=P(be)`
|
|
39
|
-
${t=>
|
|
39
|
+
${t=>V(t)}
|
|
40
40
|
`,we=P(ge)`
|
|
41
|
-
${t=>
|
|
41
|
+
${t=>V(t)}
|
|
42
42
|
`,ve=P.div`
|
|
43
43
|
text-align: center;
|
|
44
44
|
${t=>{var n,e,i;return typeof((n=t.theme.colors)==null?void 0:n.warning)<"u"&&z.css`
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
border: 2px dashed ${(i=t.theme.colors)==null?void 0:i.warning};
|
|
47
47
|
`}}
|
|
48
48
|
${t=>typeof t.theme.borderRadius<"u"&&`border-radius: ${t.theme.borderRadius};`}
|
|
49
|
-
${t=>
|
|
49
|
+
${t=>V(t)}
|
|
50
50
|
`,Se=v.forwardRef(({className:t="",children:n,...e},i)=>{const s=h.useComponent(),{name:o,type:r,id:a}=h.useComponentDescriptor(),c=v.useMemo(()=>s?P(s)`
|
|
51
|
-
${
|
|
51
|
+
${V}
|
|
52
52
|
${h.filterCssPropsStyle}
|
|
53
|
-
`:null,[s]);return typeof s>"u"?null:s===null||c===null?process.env.NODE_ENV!=="production"?f.jsx(ve,{...e,title:`type: ${r}, definition-id: ${o}, instance-id: ${a}`,className:M.appendClassNames(t,"humany-non-resolved-component"),children:f.jsx(h.Typography,{variant:"h5",children:"Non Resolved Component Type"})}):null:f.jsx(v.Suspense,{fallback:null,children:f.jsx(c,{ref:i,...e,className:M.appendClassNames(t,"humany-component",`humany-component-${o}`),children:n})})}),Ce=t=>{const n=h.useComponentNode(t),e=h.useComponentPlatform(),[i,s]=v.useState({}),o=h.useIsMounted();return v.useEffect(()=>{n&&o.current&&s(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&&s(c.node.attributes.properties)});return()=>{r()}}},[e,o,t,n]),i},Oe=(t,n)=>n?!0:typeof t=="string"?t==="full":t>0,
|
|
53
|
+
`:null,[s]);return typeof s>"u"?null:s===null||c===null?process.env.NODE_ENV!=="production"?f.jsx(ve,{...e,title:`type: ${r}, definition-id: ${o}, instance-id: ${a}`,className:M.appendClassNames(t,"humany-non-resolved-component"),children:f.jsx(h.Typography,{variant:"h5",children:"Non Resolved Component Type"})}):null:f.jsx(v.Suspense,{fallback:null,children:f.jsx(c,{ref:i,...e,className:M.appendClassNames(t,"humany-component",`humany-component-${o}`),children:n})})}),Ce=t=>{const n=h.useComponentNode(t),e=h.useComponentPlatform(),[i,s]=v.useState({}),o=h.useIsMounted();return v.useEffect(()=>{n&&o.current&&s(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&&s(c.node.attributes.properties)});return()=>{r()}}},[e,o,t,n]),i},Oe=(t,n)=>n?!0:typeof t=="string"?t==="full":t>0,T=v.forwardRef(({className:t="",id:n,branch:e,node:i,ariaLabel:s,tabIndex:o,context:r,...a},c)=>{const g=h.useComponentPlatform(),d=h.useContainer(),[u,p]=v.useState(),b=h.useColumns(),y=h.useContext(n),m=Ce(n),{size:S="none",indent:C=0}=h.useLayout(n),A=Oe(S,i);if(v.useEffect(()=>{if(g){if(n&&!i){const x=g.nodes.get(n);if(x&&(p(w.asDescriptor(x,e)),A)){const j=x.mount(d);return()=>{j()}}}else if(i){p(w.asDescriptor(i,e));const x=i.mount(d);return()=>{x()}}}},[g,n,i,A]),!u||!A)return null;const k={...y,...r||{}},{cardinal:D,fonts:E={},accessibility:B={},...O}=k,N={type:E.type,base:E.base||"16px",small:E.small||"0.8em",normal:E.normal||"1em",medium:E.medium||"1.2em",large:E.large||"1.6em",huge:E.huge||"2.5em"},R={...O,fonts:N,accessibility:{...B}};return typeof D=="number"&&(R.sizes={cardinal:D,small:`${D}px`,normal:`${D*3}px`,medium:`${D*5}px`,large:`${D*8}px`}),f.jsx(z.ThemeProvider,{theme:R,children:f.jsx(h.ComponentNodeContext.Provider,{value:u,children:f.jsx(h.ComponentPropertyContext.Provider,{value:m,children:(()=>{const x={"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":s,tabIndex:o,id:u.id,role:m.role?m&&m.role:null,...a};switch(u.type){case"view":return typeof m.animation=="string"&&m.animation!=="none"?f.jsx(we,{...x,className:t}):f.jsx(ye,{...x,className:t});default:{const j=h.filterCssProps(m);return f.jsx(Se,{ref:c,...x,...j,className:t})}}})()})})})}),J=({builder:t})=>{const n=h.useContainer(),[e,i]=v.useState(null);return v.useEffect(()=>{n.getAsync("components").then(s=>t(s).then(o=>{i(o)}))},[]),v.useEffect(()=>()=>{e&&n.getAsync("components").then(s=>{s.nodes.detached=s.nodes.detached.filter(o=>o.id!==e.id)})},[e]),e?f.jsx(T,{id:e.id,node:e,branch:"default"}):null},Ee=Object.freeze(Object.defineProperty({__proto__:null,default:J},Symbol.toStringTag,{value:"Module"})),xe=v.lazy(()=>Promise.resolve().then(()=>Ee)),Me=({showSearch:t=!1})=>{const n=z.useTheme(),e=h.useContainer();return f.jsx(v.Suspense,{fallback:null,children:f.jsx(xe,{builder:i=>e.get("settings").then(s=>{var g;const{properties:o,context:r}=Object.keys(s.components).reduce((d,u)=>(s.components[u].type==="not-found"&&(d.properties=s.components[u].properties,d.context=s.components[u].context),d),{properties:{},context:{}});o.showSearch=t;const a=i.createNode("area",{detached:!0});if(a.name="not-found-area",a.writeLayout({size:"full"}),t){const d=Object.keys(s.components).reduce((p,b)=>s.components[b].type==="search"?s.components[b].properties:p,{}),u=i.createNode("search",{detached:!0});u.writeLayout({size:"full"}),u.writeProperties({"css-margin-bottom":((g=n==null?void 0:n.sizes)==null?void 0:g.normal)||"15px",...d}),a.appendChild(u)}const c=i.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""}}},De=t=>{const n=(s,o)=>{s&&(o?s.classList.add("humany-tabbing"):s.classList.remove("humany-tabbing"))},e=s=>{s.key==="Tab"?n(t,!0):s.key==="Enter"&&document.activeElement&&document.activeElement.classList.contains("humany-trigger")||n(t,!1)},i=s=>{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",i),()=>{document.removeEventListener("keydown",e),document.removeEventListener("click",i)}};function Ne(t,n){const{symbol:e,widgetName:i,label:s="",ariaLabel:o="",tooltip:r=""}=n;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);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
|
-
${s.length?`<span>${s}</span>`:""}`,setTimeout(()=>t&&t.classList.add("humany-rendered")),De(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,i,s=!1)=>{var g,d;const o=Pe(n,e),r=ee(i),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)||"",s?(u.style.display="none",(g=e==null?void 0:e.parentNode)==null||g.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"}):(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 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",[]);var a,c,g,d,u,p,b;this.options=e,this.container=n.createChild(this),this.container.register("widgetDOMElement",this.options.widgetDOMElement),this.container.register("triggerDOMElement",this.options.triggerDOMElement);const i=this.container.get("$widget"),s=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",((g=s==null?void 0:s.data)==null?void 0:g.widgetAriaLabel)??"Widget"),this.options.triggerDOMElement&&((u=this.options.widgetDOMElement)==null||u.setAttribute("id",`humany_widget_${i.name}`),(p=this.options.triggerDOMElement)==null||p.setAttribute("aria-controls",`humany_widget_${i.name}`)),(b=this.options.widgetDOMElement)==null||b.classList.add(`humany_${i.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,i=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(s=>s.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 s=this.container.get("$environment").widgets.all();l.readStorage(this.container,ke,l.StorageMedium.Session).then(o=>{o&&o.forEach(r=>{s.find(a=>a.name===r.name&&a.state==="activated")&&i.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:i}=this.container.get("$widget"),{label:s,symbol:o,ariaLabel:r,closedTooltip:a,openTooltip:c}=n,g={closedTooltip:a,openTooltip:c};this.options.triggerOptions=g;const d=Ne(e,{label:s,symbol:o,ariaLabel:r,widgetName:i,tooltip:a});this.unsubscribe.push(d)}dispose(){return Promise.resolve().then(()=>require("./unmount-7ebc3b77.js")).then(n=>{var s,o,r,a;const{triggerDOMElement:e,widgetDOMElement:i}=this.options;n.default(i),this.options.cachedOriginals.widgetDOMElement&&i&&((s=i.parentNode)==null||s.replaceChild(this.options.cachedOriginals.widgetDOMElement,i)),this.options.cachedOriginals.triggerDOMElement&&e&&((o=e.parentNode)==null||o.replaceChild(this.options.cachedOriginals.triggerDOMElement,e)),this.unsubscribe.forEach(c=>{c()}),(r=i.parentNode)==null||r.removeChild(i),(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,i,s){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:s,attributes:Ve(i),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:i=[],items:s={}}=e,o=i.indexOf(n);if(o>-1)return i.splice(o,1),delete s[n],this.storageWriter(e)}))}load(n){return M.lock(this)(()=>l.readStorage(this.container,I,l.StorageMedium.Local).then((e={})=>{const{keys:i=[],items:s={}}=e;i.forEach(o=>{const r=s[o];if(r){const{rules:a,attributes:c,options:g}=r;n.write({attributes:c,options:g,target:new w.ComponentQuery(n,a)})}})}))}}const We=t=>{const{container:n}=t;return F.create(n).then(e=>{const i=n.get("$settings"),s={localStorage:e},o=new w.ComponentPlatform(t,s),r=w.createComponentModel(o,i);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(i=>{const{routing:{initialPath:s="/",mode:o=e.scopedHash,basePath:r},views:a}=i;return new n(t,{initialPath:s,mode:o,routes:Object.keys(a).map(g=>({name:g,path:a[g].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 i={triggerDOMElement:e.sourceDOMElement,withRenderState:"storage"};this.container.get("settings").then(s=>{const{activate:o}=s;(typeof o>"u"||o===null||o===!0)&&(this.activated=(this.activated||this.widget.activate()).then(()=>this.attach(i)))})});this.container.registerAsync("storage",()=>Ie(this.container)),this.container.registerFactory("settings",()=>l.readStorage(this.container,H,l.StorageMedium.Local).then((i={})=>({...this.container.get("$settings"),...i}))),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"),i=this.container.get("csp");return i&&(window.webprovisionsEnvironmentVariables||(window.webprovisionsEnvironmentVariables={}),window.webprovisionsEnvironmentVariables.cspNonce=i.nonce),Promise.all([e,this.container.get("settings")]).then(([{actionResolver:s,router:o,components:r},a])=>{var d;s.subscribe(this.widget.name,(u,p,b)=>this.onAction(p,b));const c=u=>{r.nodes.query({type:"view"}).forEach(p=>{r.setSwitch(p,u)})},g=((d=o.getInitialRoute())==null?void 0:d.name)||"index";return c(g),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:b={routeData:{}}})=>{const{routeData:y}=p,{routeData:m}=b,S=Object.keys(a.views).reduce((C,A)=>typeof a.views[A].path>"u"?A:C,"");!m.name&&S?c(S):c(m.name),M.removeNullAndUndefinedValues(y&&y.params),M.removeNullAndUndefinedValues(m&&m.params),this.container.getAsync("actionResolver").then(C=>{C.action(this.widget.name,"routeChange",{next:m,previous:y})})}),o.initialize()})}attach(e={}){return this.container.get("settings").then(({trigger:i})=>{var b,y;const{widgetDOMElement:s,key:o=M.uuid(),triggerDOMElement:r,withRenderState:a}=e,g=ee(i)===$.Inline&&((r==null?void 0:r.childElementCount)||0)>0,d=Re(this.widget.name,s,r,i,g);this.outlets.size<1&&!a&&this.setRenderState("unset");const u=()=>{const m=()=>S.querySelectorAll("[data-loading=true]").length===0,[S]=this.widget.container.get("widgetDOMElements"),C=(D,E)=>{m()&&(d.callback&&d.callback(),E.disconnect())},A={attributes:!0,subtree:!0,childList:!0};m()&&d.callback&&d.callback(),new MutationObserver(C).observe(S,A)};g&&this.widget.container.getAsync("dataClient").then(({events:m})=>{m.subscribe("data-client:fetched",(S,C)=>{C.unresolvedQueries===0&&u()})});const p=this.getOrCreateViewOutlet(o,d);if(this.outlets.set(o,p),this.widget.events.dispatch("widget:attached",{},{bubbles:!0}),d.triggerType===$.Badge&&i&&((b=d.triggerDOMElement)==null||b.setAttribute("aria-expanded","false"),p==null||p.renderBadge(i)),d.triggerType!==$.Inline&&((y=d.triggerDOMElement)==null||y.addEventListener("click",m=>{m.preventDefault(),this.container.get("settings").then(({trigger:S})=>{p.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(m=>{this.triggerStateIfApplicable(m)});if(a)return a==="storage"?this.renderState().then(m=>{if(d.triggerType===$.Inline){this.triggerStateIfApplicable("open");return}this.triggerStateIfApplicable(m)}):this.triggerStateIfApplicable(a)})}detach(e){if(e){if(this.outlets.has(e)){const i=this.outlets.get(e);i==null||i.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(i=>{i.dispose()}),this.outlets.clear()}triggerStateIfApplicable(e){return this.container.getAsync("router").then(i=>{switch(e){case"closed":this.close();break;case"open":this.open();break;case"hidden":this.hide(),i.start();break;default:return}})}getOrCreateViewOutlet(e,i){return this.outlets.has(e)?this.outlets.get(e):new je(this.container,i)}render(e={}){if(process.env.NODE_ENV!=="production"&&console.warn("widget.render() is deprecated. Use widget.attach() instead."),e.open){const i={...e,withRenderState:"open"};return this.attach(i)}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(([i,s])=>Promise.resolve(e(i)).then(o=>s(o).then(()=>{const r={...i,...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:i}){return this.container.getAsync("actionResolver").then(s=>{s.action(this.widget.name,e,i)})}renderState(){if(ue.onWidgetUrl(this.container))return Promise.resolve(w.WidgetRenderState.open);const e=()=>l.readStorage(this.container,q,l.StorageMedium.Session).then((s=w.WidgetRenderState.closed)=>s),i=()=>l.readStorage(this.container,q,l.StorageMedium.Session).then((s=w.WidgetRenderState.closed)=>s);return this.container.getAsync("router").then(s=>s.isSticky()?i().then(o=>o===w.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();const{options:{triggerDOMElement:i}}=e;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,i){switch(e){case"close":case"open":case"hide":const s=e==="open"?w.WidgetRenderState.open:e==="close"?w.WidgetRenderState.closed:w.WidgetRenderState.hidden;return this.setRenderState(s).then(()=>{this.setTriggerState(s===w.WidgetRenderState.open),s!==w.WidgetRenderState.hidden?s===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:i,events:s}=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"),i("renderState")]).then(([o,r,a,c])=>{e==="unset"||!e?(r(),o()):(a.isSticky()&&r(e),o(e)),s.dispatch("widget:render-state-changed",{previous:c,next:e})})}onOpen(){return this.container.getAsync("router").then(e=>(this.outlets.forEach(i=>{i.options.triggerDOMElement&&i.options.triggerDOMElement.setAttribute("aria-expanded","true")}),e.start()))}onClose(){const e=this.container.getManyAsync("router","components");return(()=>this.container.get("settings").then(s=>{const{activate:o}=this.container.get("$settings");return s.activate!==o?this.setSettings(()=>Promise.resolve({activate:o})):Promise.resolve()}))().then(()=>e).then(({router:s,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(s)},200)}):Promise.resolve(s)}).then(s=>s.stop())}setTriggerState(e){this.outlets.forEach(i=>{const{options:{triggerDOMElement:s,triggerOptions:o}}=i,{openTooltip:r,closedTooltip:a}=o||{};s&&(e?X(s,r):Le(s,a))})}deactivate(){this.subs.forEach(i=>i());const e=[];return this.outlets.forEach(i=>e.push(i.dispose())),l.readStorage(this.container,Y,l.StorageMedium.Local).then(i=>i===this.widget.name?l.createStorageWriter(this.container,Y,l.StorageCategory.Necessary,{medium:l.StorageMedium.Local,scope:l.StorageScope.Implementation}).then(s=>s()).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
|
+
${s.length?`<span>${s}</span>`:""}`,setTimeout(()=>t&&t.classList.add("humany-rendered")),De(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,i,s=!1)=>{var g,d;const o=Pe(n,e),r=ee(i),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)||"",s?(u.style.display="none",(g=e==null?void 0:e.parentNode)==null||g.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"}):(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 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",[]);var a,c,g,d,u,p,b;this.options=e,this.container=n.createChild(this),this.container.register("widgetDOMElement",this.options.widgetDOMElement),this.container.register("triggerDOMElement",this.options.triggerDOMElement);const i=this.container.get("$widget"),s=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",((g=s==null?void 0:s.data)==null?void 0:g.widgetAriaLabel)??"Widget"),this.options.triggerDOMElement&&((u=this.options.widgetDOMElement)==null||u.setAttribute("id",`humany_widget_${i.name}`),(p=this.options.triggerDOMElement)==null||p.setAttribute("aria-controls",`humany_widget_${i.name}`)),(b=this.options.widgetDOMElement)==null||b.classList.add(`humany_${i.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,i=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(s=>s.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 s=this.container.get("$environment").widgets.all();l.readStorage(this.container,ke,l.StorageMedium.Session).then(o=>{o&&o.forEach(r=>{s.find(a=>a.name===r.name&&a.state==="activated")&&i.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:i}=this.container.get("$widget"),{label:s,symbol:o,ariaLabel:r,closedTooltip:a,openTooltip:c}=n,g={closedTooltip:a,openTooltip:c};this.options.triggerOptions=g;const d=Ne(e,{label:s,symbol:o,ariaLabel:r,widgetName:i,tooltip:a});this.unsubscribe.push(d)}dispose(){return Promise.resolve().then(()=>require("./unmount-7ebc3b77.js")).then(n=>{var s,o,r,a;const{triggerDOMElement:e,widgetDOMElement:i}=this.options;n.default(i),this.options.cachedOriginals.widgetDOMElement&&i&&((s=i.parentNode)==null||s.replaceChild(this.options.cachedOriginals.widgetDOMElement,i)),this.options.cachedOriginals.triggerDOMElement&&e&&((o=e.parentNode)==null||o.replaceChild(this.options.cachedOriginals.triggerDOMElement,e)),this.unsubscribe.forEach(c=>{c()}),(r=i.parentNode)==null||r.removeChild(i),(a=e==null?void 0:e.parentNode)==null||a.removeChild(e)})}}const I="changesets",We=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,i,s){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:s,attributes:We(i),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:i=[],items:s={}}=e,o=i.indexOf(n);if(o>-1)return i.splice(o,1),delete s[n],this.storageWriter(e)}))}load(n){return M.lock(this)(()=>l.readStorage(this.container,I,l.StorageMedium.Local).then((e={})=>{const{keys:i=[],items:s={}}=e;i.forEach(o=>{const r=s[o];if(r){const{rules:a,attributes:c,options:g}=r;n.write({attributes:c,options:g,target:new w.ComponentQuery(n,a)})}})}))}}const Ve=t=>{const{container:n}=t;return F.create(n).then(e=>{const i=n.get("$settings"),s={localStorage:e},o=new w.ComponentPlatform(t,s),r=w.createComponentModel(o,i);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(i=>{const{routing:{initialPath:s="/",mode:o=e.scopedHash,basePath:r},views:a}=i;return new n(t,{initialPath:s,mode:o,routes:Object.keys(a).map(g=>({name:g,path:a[g].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)),Te=t=>import("@telia-ace/widget-core").then(({ComponentPlatform:n,createComponentModel:e})=>Ve(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 i={triggerDOMElement:e.sourceDOMElement,withRenderState:"storage"};this.container.get("settings").then(s=>{const{activate:o}=s;(typeof o>"u"||o===null||o===!0)&&(this.activated=(this.activated||this.widget.activate()).then(()=>this.attach(i)))})});this.container.registerAsync("storage",()=>Ie(this.container)),this.container.registerFactory("settings",()=>l.readStorage(this.container,H,l.StorageMedium.Local).then((i={})=>({...this.container.get("$settings"),...i}))),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",()=>Te(this.container))}initialize(){const e=this.container.getManyAsync("actionResolver","router","components"),i=this.container.get("csp");return i&&(window.webprovisionsEnvironmentVariables||(window.webprovisionsEnvironmentVariables={}),window.webprovisionsEnvironmentVariables.cspNonce=i.nonce),Promise.all([e,this.container.get("settings")]).then(([{actionResolver:s,router:o,components:r},a])=>{var d;s.subscribe(this.widget.name,(u,p,b)=>this.onAction(p,b));const c=u=>{r.nodes.query({type:"view"}).forEach(p=>{r.setSwitch(p,u)})},g=((d=o.getInitialRoute())==null?void 0:d.name)||"index";return c(g),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:b={routeData:{}}})=>{const{routeData:y}=p,{routeData:m}=b,S=Object.keys(a.views).reduce((C,A)=>typeof a.views[A].path>"u"?A:C,"");!m.name&&S?c(S):c(m.name),M.removeNullAndUndefinedValues(y&&y.params),M.removeNullAndUndefinedValues(m&&m.params),this.container.getAsync("actionResolver").then(C=>{C.action(this.widget.name,"routeChange",{next:m,previous:y})})}),o.initialize()})}attach(e={}){return this.container.get("settings").then(({trigger:i})=>{var b,y;const{widgetDOMElement:s,key:o=M.uuid(),triggerDOMElement:r,withRenderState:a}=e,g=ee(i)===$.Inline&&((r==null?void 0:r.childElementCount)||0)>0,d=Re(this.widget.name,s,r,i,g);this.outlets.size<1&&!a&&this.setRenderState("unset");const u=()=>{const m=()=>S.querySelectorAll("[data-loading=true]").length===0,[S]=this.widget.container.get("widgetDOMElements"),C=(D,E)=>{m()&&(d.callback&&d.callback(),E.disconnect())},A={attributes:!0,subtree:!0,childList:!0};m()&&d.callback&&d.callback(),new MutationObserver(C).observe(S,A)};g&&this.widget.container.getAsync("dataClient").then(({events:m})=>{m.subscribe("data-client:fetched",(S,C)=>{C.unresolvedQueries===0&&u()})});const p=this.getOrCreateViewOutlet(o,d);if(this.outlets.set(o,p),this.widget.events.dispatch("widget:attached",{},{bubbles:!0}),d.triggerType===$.Badge&&i&&((b=d.triggerDOMElement)==null||b.setAttribute("aria-expanded","false"),p==null||p.renderBadge(i)),d.triggerType!==$.Inline&&((y=d.triggerDOMElement)==null||y.addEventListener("click",m=>{m.preventDefault(),this.container.get("settings").then(({trigger:S})=>{p.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(m=>{this.triggerStateIfApplicable(m)});if(a)return a==="storage"?this.renderState().then(m=>{if(d.triggerType===$.Inline){this.triggerStateIfApplicable("open");return}this.triggerStateIfApplicable(m)}):this.triggerStateIfApplicable(a)})}detach(e){if(e){if(this.outlets.has(e)){const i=this.outlets.get(e);i==null||i.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(i=>{i.dispose()}),this.outlets.clear()}triggerStateIfApplicable(e){return this.container.getAsync("router").then(i=>{switch(e){case"closed":this.close();break;case"open":this.open();break;case"hidden":this.hide(),i.start();break;default:return}})}getOrCreateViewOutlet(e,i){return this.outlets.has(e)?this.outlets.get(e):new je(this.container,i)}render(e={}){if(process.env.NODE_ENV!=="production"&&console.warn("widget.render() is deprecated. Use widget.attach() instead."),e.open){const i={...e,withRenderState:"open"};return this.attach(i)}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(([i,s])=>Promise.resolve(e(i)).then(o=>s(o).then(()=>{const r={...i,...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:i}){return this.container.getAsync("actionResolver").then(s=>{s.action(this.widget.name,e,i)})}renderState(){if(ue.onWidgetUrl(this.container))return Promise.resolve(w.WidgetRenderState.open);const e=()=>l.readStorage(this.container,q,l.StorageMedium.Session).then((s=w.WidgetRenderState.closed)=>s),i=()=>l.readStorage(this.container,q,l.StorageMedium.Session).then((s=w.WidgetRenderState.closed)=>s);return this.container.getAsync("router").then(s=>s.isSticky()?i().then(o=>o===w.WidgetRenderState.open?o:e()):e())}hide(e){return console.log("### HIDE",e==null?void 0:e.focusTrigger),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(i=>{if(i.render(),e!=null&&e.focusTrigger){const{options:{triggerDOMElement:s}}=i;console.log("### HIDE, set focus to trigger"),s==null||s.focus()}}),this.action({action:"hide"}).then(()=>{this.setTriggerState(!1)}))}open(){return console.log("### OPEN"),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 console.log("### CLOSE"),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 console.log("### SHOW"),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,i){switch(e){case"close":case"open":case"hide":const s=e==="open"?w.WidgetRenderState.open:e==="close"?w.WidgetRenderState.closed:w.WidgetRenderState.hidden;return this.setRenderState(s).then(()=>{this.setTriggerState(s===w.WidgetRenderState.open),s!==w.WidgetRenderState.hidden?s===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:i,events:s}=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"),i("renderState")]).then(([o,r,a,c])=>{e==="unset"||!e?(r(),o()):(a.isSticky()&&r(e),o(e)),s.dispatch("widget:render-state-changed",{previous:c,next:e})})}onOpen(){return this.container.getAsync("router").then(e=>(this.outlets.forEach(i=>{i.options.triggerDOMElement&&i.options.triggerDOMElement.setAttribute("aria-expanded","true")}),e.start()))}onClose(){const e=this.container.getManyAsync("router","components");return(()=>this.container.get("settings").then(s=>{const{activate:o}=this.container.get("$settings");return s.activate!==o?this.setSettings(()=>Promise.resolve({activate:o})):Promise.resolve()}))().then(()=>e).then(({router:s,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(s)},200)}):Promise.resolve(s)}).then(s=>s.stop())}setTriggerState(e){this.outlets.forEach(i=>{const{options:{triggerDOMElement:s,triggerOptions:o}}=i,{openTooltip:r,closedTooltip:a}=o||{};s&&(e?X(s,r):Le(s,a))})}deactivate(){this.subs.forEach(i=>i());const e=[];return this.outlets.forEach(i=>e.push(i.dispose())),l.readStorage(this.container,Y,l.StorageMedium.Local).then(i=>i===this.widget.name?l.createStorageWriter(this.container,Y,l.StorageCategory.Necessary,{medium:l.StorageMedium.Local,scope:l.StorageScope.Implementation}).then(s=>s()).then(()=>Promise.all(e)):Promise.all(e))}}exports.Component=T;exports.DetachedComponent=J;exports.GridWidget=te;exports.NotFound=Me;exports.Widget=te;exports.genericComponentStyling=V;
|
package/index.mjs
CHANGED
|
@@ -4,18 +4,18 @@ var x = (e, n, t) => (ht(e, typeof n != "symbol" ? n + "" : n, t), t);
|
|
|
4
4
|
import { jsx as m } from "react/jsx-runtime";
|
|
5
5
|
import { css as nt, ThemeProvider as pt, useTheme as mt } from "@emotion/react";
|
|
6
6
|
import { asDescriptor as X, ComponentPlatform as ft, createComponentModel as gt, ComponentQuery as bt, WidgetRenderState as O } from "@telia-ace/widget-core";
|
|
7
|
-
import { Grid as it, useRouteData as yt, useRouter as wt, useProperties as st, useContext as Y, useContainer as z, useComponentNode as q, useScroll as ot, transitionComposer as vt, paddedBorderTabStyle as Ot, useComponent as
|
|
7
|
+
import { Grid as it, useRouteData as yt, useRouter as wt, useProperties as st, useContext as Y, useContainer as z, useComponentNode as q, useScroll as ot, transitionComposer as vt, paddedBorderTabStyle as Ot, useComponent as Et, useComponentDescriptor as Ct, filterCssPropsStyle as At, Typography as St, useComponentPlatform as rt, useIsMounted as Dt, useColumns as Mt, useLayout as xt, ComponentNodeContext as Nt, ComponentPropertyContext as Lt, filterCssProps as $t } from "@telia-ace/widget-ui";
|
|
8
8
|
import Q, { useState as _, forwardRef as at, useMemo as Pt, Suspense as kt, useEffect as I } from "react";
|
|
9
9
|
import L from "@emotion/styled";
|
|
10
|
-
import { appendClassNames as
|
|
10
|
+
import { appendClassNames as H, notifyDataLoaded as Rt, lock as G, removeNullAndUndefinedValues as tt, uuid as Vt } from "@telia-ace/widget-utilities";
|
|
11
11
|
import { TransitionGroup as _t, Transition as It } from "react-transition-group";
|
|
12
12
|
import { Switch as zt, Route as F } from "react-router";
|
|
13
13
|
import { onWidgetUrl as Bt } from "@telia-ace/widget-routing";
|
|
14
|
-
import { readStorage as
|
|
15
|
-
import { supportBootstrapping as
|
|
16
|
-
import { WidgetState as Wt, WidgetType as
|
|
14
|
+
import { readStorage as D, StorageMedium as v, createStorageWriter as P, StorageCategory as k, StorageScope as Tt } from "@telia-ace/widget-services";
|
|
15
|
+
import { supportBootstrapping as Ht } from "@webprovisions/bootstrapping";
|
|
16
|
+
import { WidgetState as Wt, WidgetType as jt } from "@webprovisions/platform";
|
|
17
17
|
var U = /* @__PURE__ */ ((e) => (e.back = "back", e.forth = "forth", e))(U || {});
|
|
18
|
-
const
|
|
18
|
+
const Gt = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[e] > t[n] ? "back" : "forth", ct = ({ views: e, location: n, render: t }) => /* @__PURE__ */ m(
|
|
19
19
|
zt,
|
|
20
20
|
{
|
|
21
21
|
location: n && {
|
|
@@ -61,13 +61,13 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
61
61
|
return null;
|
|
62
62
|
const { location: R } = a;
|
|
63
63
|
r.name !== t && r.name !== "" && g && (o(
|
|
64
|
-
|
|
64
|
+
Gt(t, r.name, Ut)
|
|
65
65
|
), i(r.name));
|
|
66
66
|
const { views: S } = u.get("$settings");
|
|
67
67
|
if (!Object.keys(S).length)
|
|
68
68
|
return null;
|
|
69
|
-
const
|
|
70
|
-
const
|
|
69
|
+
const E = (w, M, $) => {
|
|
70
|
+
const C = j(M, $), V = l.getChildren(w)[0];
|
|
71
71
|
return /* @__PURE__ */ m(
|
|
72
72
|
Kt,
|
|
73
73
|
{
|
|
@@ -77,18 +77,18 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
77
77
|
ref: A,
|
|
78
78
|
columns: f,
|
|
79
79
|
gap: d,
|
|
80
|
-
...
|
|
81
|
-
className:
|
|
80
|
+
...C,
|
|
81
|
+
className: H(e, "humany-view"),
|
|
82
82
|
children: /* @__PURE__ */ m(Z, { id: V.id, branch: "default" })
|
|
83
83
|
}
|
|
84
84
|
);
|
|
85
|
-
},
|
|
85
|
+
}, j = (w, M) => {
|
|
86
86
|
if (g === "slide" || g === "fade")
|
|
87
87
|
return {
|
|
88
88
|
animationCss: vt.composeViewTransition(
|
|
89
89
|
w,
|
|
90
90
|
g,
|
|
91
|
-
|
|
91
|
+
M
|
|
92
92
|
),
|
|
93
93
|
"data-state": w
|
|
94
94
|
};
|
|
@@ -105,12 +105,12 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
105
105
|
onEnter: (w) => w == null ? void 0 : w.clientHeight,
|
|
106
106
|
unmountOnExit: !0,
|
|
107
107
|
direction: U.forth,
|
|
108
|
-
children: (w, { direction:
|
|
108
|
+
children: (w, { direction: M }) => /* @__PURE__ */ m(
|
|
109
109
|
ct,
|
|
110
110
|
{
|
|
111
111
|
views: S,
|
|
112
112
|
location: R,
|
|
113
|
-
render: ($) =>
|
|
113
|
+
render: ($) => E($, w, M)
|
|
114
114
|
}
|
|
115
115
|
)
|
|
116
116
|
},
|
|
@@ -136,7 +136,7 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
136
136
|
ref: f,
|
|
137
137
|
columns: c,
|
|
138
138
|
gap: a,
|
|
139
|
-
className:
|
|
139
|
+
className: H(e, "humany-view"),
|
|
140
140
|
children: /* @__PURE__ */ m(
|
|
141
141
|
ct,
|
|
142
142
|
{
|
|
@@ -194,7 +194,7 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
194
194
|
${(e) => W(e)}
|
|
195
195
|
`, te = at(
|
|
196
196
|
({ className: e = "", children: n, ...t }, i) => {
|
|
197
|
-
const s =
|
|
197
|
+
const s = Et(), { name: o, type: r, id: a } = Ct(), c = Pt(() => s ? L(s)`
|
|
198
198
|
${W}
|
|
199
199
|
${At}
|
|
200
200
|
` : null, [s]);
|
|
@@ -203,7 +203,7 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
203
203
|
{
|
|
204
204
|
...t,
|
|
205
205
|
title: `type: ${r}, definition-id: ${o}, instance-id: ${a}`,
|
|
206
|
-
className:
|
|
206
|
+
className: H(
|
|
207
207
|
e,
|
|
208
208
|
"humany-non-resolved-component"
|
|
209
209
|
),
|
|
@@ -214,7 +214,7 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
214
214
|
{
|
|
215
215
|
ref: i,
|
|
216
216
|
...t,
|
|
217
|
-
className:
|
|
217
|
+
className: H(
|
|
218
218
|
e,
|
|
219
219
|
"humany-component",
|
|
220
220
|
`humany-component-${o}`
|
|
@@ -224,7 +224,7 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
224
224
|
) });
|
|
225
225
|
}
|
|
226
226
|
), ee = (e) => {
|
|
227
|
-
const n = q(e), t = rt(), [i, s] = _({}), o =
|
|
227
|
+
const n = q(e), t = rt(), [i, s] = _({}), o = Dt();
|
|
228
228
|
return I(() => {
|
|
229
229
|
n && o.current && s(n.attributes.properties);
|
|
230
230
|
}, [n, e, o]), I(() => {
|
|
@@ -251,22 +251,22 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
251
251
|
context: r,
|
|
252
252
|
...a
|
|
253
253
|
}, c) => {
|
|
254
|
-
const p = rt(), u = z(), [l, d] = _(), f =
|
|
254
|
+
const p = rt(), u = z(), [l, d] = _(), f = Mt(), g = Y(n), h = ee(n), { size: b = "none", indent: y = 0 } = xt(n), A = ne(b, i);
|
|
255
255
|
if (I(() => {
|
|
256
256
|
if (p) {
|
|
257
257
|
if (n && !i) {
|
|
258
|
-
const
|
|
259
|
-
if (
|
|
260
|
-
const V =
|
|
258
|
+
const C = p.nodes.get(n);
|
|
259
|
+
if (C && (d(X(C, t)), A)) {
|
|
260
|
+
const V = C.mount(u);
|
|
261
261
|
return () => {
|
|
262
262
|
V();
|
|
263
263
|
};
|
|
264
264
|
}
|
|
265
265
|
} else if (i) {
|
|
266
266
|
d(X(i, t));
|
|
267
|
-
const
|
|
267
|
+
const C = i.mount(u);
|
|
268
268
|
return () => {
|
|
269
|
-
|
|
269
|
+
C();
|
|
270
270
|
};
|
|
271
271
|
}
|
|
272
272
|
}
|
|
@@ -274,22 +274,22 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
274
274
|
return null;
|
|
275
275
|
const R = { ...g, ...r || {} }, {
|
|
276
276
|
cardinal: S,
|
|
277
|
-
fonts:
|
|
278
|
-
accessibility:
|
|
277
|
+
fonts: E = {},
|
|
278
|
+
accessibility: j = {},
|
|
279
279
|
...w
|
|
280
|
-
} = R,
|
|
281
|
-
type:
|
|
282
|
-
base:
|
|
283
|
-
small:
|
|
284
|
-
normal:
|
|
285
|
-
medium:
|
|
286
|
-
large:
|
|
287
|
-
huge:
|
|
280
|
+
} = R, M = {
|
|
281
|
+
type: E.type,
|
|
282
|
+
base: E.base || "16px",
|
|
283
|
+
small: E.small || "0.8em",
|
|
284
|
+
normal: E.normal || "1em",
|
|
285
|
+
medium: E.medium || "1.2em",
|
|
286
|
+
large: E.large || "1.6em",
|
|
287
|
+
huge: E.huge || "2.5em"
|
|
288
288
|
}, $ = {
|
|
289
289
|
...w,
|
|
290
|
-
fonts:
|
|
290
|
+
fonts: M,
|
|
291
291
|
accessibility: {
|
|
292
|
-
...
|
|
292
|
+
...j
|
|
293
293
|
}
|
|
294
294
|
};
|
|
295
295
|
return typeof S == "number" && ($.sizes = {
|
|
@@ -299,7 +299,7 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
299
299
|
medium: `${S * 5}px`,
|
|
300
300
|
large: `${S * 8}px`
|
|
301
301
|
}), /* @__PURE__ */ m(pt, { theme: $, children: /* @__PURE__ */ m(Nt.Provider, { value: l, children: /* @__PURE__ */ m(Lt.Provider, { value: h, children: (() => {
|
|
302
|
-
const
|
|
302
|
+
const C = {
|
|
303
303
|
"data-width": b === "full" ? f : Math.min(b, f),
|
|
304
304
|
"data-indent": y,
|
|
305
305
|
"data-name": l.name,
|
|
@@ -313,14 +313,14 @@ const Ht = (e, n, t) => typeof t[e] == "number" && typeof t[n] == "number" && t[
|
|
|
313
313
|
};
|
|
314
314
|
switch (l.type) {
|
|
315
315
|
case "view":
|
|
316
|
-
return typeof h.animation == "string" && h.animation !== "none" ? /* @__PURE__ */ m(Jt, { ...
|
|
316
|
+
return typeof h.animation == "string" && h.animation !== "none" ? /* @__PURE__ */ m(Jt, { ...C, className: e }) : /* @__PURE__ */ m(Zt, { ...C, className: e });
|
|
317
317
|
default: {
|
|
318
318
|
const V = $t(h);
|
|
319
319
|
return /* @__PURE__ */ m(
|
|
320
320
|
te,
|
|
321
321
|
{
|
|
322
322
|
ref: c,
|
|
323
|
-
...
|
|
323
|
+
...C,
|
|
324
324
|
...V,
|
|
325
325
|
className: e
|
|
326
326
|
}
|
|
@@ -553,7 +553,7 @@ class me {
|
|
|
553
553
|
}
|
|
554
554
|
Rt(this.container, n);
|
|
555
555
|
const s = this.container.get("$environment").widgets.all();
|
|
556
|
-
|
|
556
|
+
D(
|
|
557
557
|
this.container,
|
|
558
558
|
pe,
|
|
559
559
|
v.Session
|
|
@@ -619,7 +619,7 @@ class J {
|
|
|
619
619
|
);
|
|
620
620
|
}
|
|
621
621
|
write(n, t, i, s) {
|
|
622
|
-
return
|
|
622
|
+
return G(this)(() => D(
|
|
623
623
|
this.container,
|
|
624
624
|
B,
|
|
625
625
|
v.Local
|
|
@@ -633,7 +633,7 @@ class J {
|
|
|
633
633
|
}));
|
|
634
634
|
}
|
|
635
635
|
remove(n) {
|
|
636
|
-
return
|
|
636
|
+
return G(this)(() => D(
|
|
637
637
|
this.container,
|
|
638
638
|
B,
|
|
639
639
|
v.Local
|
|
@@ -644,7 +644,7 @@ class J {
|
|
|
644
644
|
}));
|
|
645
645
|
}
|
|
646
646
|
load(n) {
|
|
647
|
-
return
|
|
647
|
+
return G(this)(() => D(
|
|
648
648
|
this.container,
|
|
649
649
|
B,
|
|
650
650
|
v.Local
|
|
@@ -700,7 +700,7 @@ const ge = (e) => {
|
|
|
700
700
|
), 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)), Oe = (e) => import("@telia-ace/widget-core").then(
|
|
701
701
|
({ ComponentPlatform: n, createComponentModel: t }) => ge(e.get("$widget"))
|
|
702
702
|
), K = "$settings", T = "open", et = "activeStickyWidget";
|
|
703
|
-
class Ie extends
|
|
703
|
+
class Ie extends jt {
|
|
704
704
|
constructor(t) {
|
|
705
705
|
super(t);
|
|
706
706
|
x(this, "outlets", /* @__PURE__ */ new Map());
|
|
@@ -722,14 +722,14 @@ class Ie extends Gt {
|
|
|
722
722
|
this.container.registerAsync(
|
|
723
723
|
"storage",
|
|
724
724
|
() => ye(this.container)
|
|
725
|
-
), this.container.registerFactory("settings", () =>
|
|
725
|
+
), this.container.registerFactory("settings", () => D(
|
|
726
726
|
this.container,
|
|
727
727
|
K,
|
|
728
728
|
v.Local
|
|
729
729
|
).then((i = {}) => ({
|
|
730
730
|
...this.container.get("$settings"),
|
|
731
731
|
...i
|
|
732
|
-
}))),
|
|
732
|
+
}))), Ht(this, "load", this.handleBootstrapping), this.container.registerAsync(
|
|
733
733
|
"componentResolver",
|
|
734
734
|
() => ve(this.container)
|
|
735
735
|
), this.container.registerAsync(
|
|
@@ -800,8 +800,8 @@ class Ie extends Gt {
|
|
|
800
800
|
);
|
|
801
801
|
this.outlets.size < 1 && !a && this.setRenderState("unset");
|
|
802
802
|
const l = () => {
|
|
803
|
-
const h = () => b.querySelectorAll("[data-loading=true]").length === 0, [b] = this.widget.container.get("widgetDOMElements"), y = (S,
|
|
804
|
-
h() && (u.callback && u.callback(),
|
|
803
|
+
const h = () => b.querySelectorAll("[data-loading=true]").length === 0, [b] = this.widget.container.get("widgetDOMElements"), y = (S, E) => {
|
|
804
|
+
h() && (u.callback && u.callback(), E.disconnect());
|
|
805
805
|
}, A = {
|
|
806
806
|
attributes: !0,
|
|
807
807
|
subtree: !0,
|
|
@@ -929,44 +929,45 @@ class Ie extends Gt {
|
|
|
929
929
|
renderState() {
|
|
930
930
|
if (Bt(this.container))
|
|
931
931
|
return Promise.resolve(O.open);
|
|
932
|
-
const t = () =>
|
|
932
|
+
const t = () => D(
|
|
933
933
|
this.container,
|
|
934
934
|
T,
|
|
935
935
|
v.Session
|
|
936
|
-
).then((s = O.closed) => s), i = () =>
|
|
936
|
+
).then((s = O.closed) => s), i = () => D(
|
|
937
937
|
this.container,
|
|
938
938
|
T,
|
|
939
939
|
v.Session
|
|
940
940
|
).then((s = O.closed) => s);
|
|
941
941
|
return this.container.getAsync("router").then((s) => s.isSticky() ? i().then((o) => o === O.open ? o : t()) : t());
|
|
942
942
|
}
|
|
943
|
-
hide() {
|
|
944
|
-
return this.outlets.size < 1 ? (process.env.NODE_ENV !== "production" && console.warn(
|
|
943
|
+
hide(t) {
|
|
944
|
+
return console.log("### HIDE", t == null ? void 0 : t.focusTrigger), this.outlets.size < 1 ? (process.env.NODE_ENV !== "production" && console.warn(
|
|
945
945
|
"hide(): No-op as no view outlets are registered. Invoke the attach() command first."
|
|
946
|
-
), Promise.resolve()) : (this.outlets.forEach((
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
946
|
+
), Promise.resolve()) : (this.outlets.forEach((i) => {
|
|
947
|
+
if (i.render(), t != null && t.focusTrigger) {
|
|
948
|
+
const {
|
|
949
|
+
options: { triggerDOMElement: s }
|
|
950
|
+
} = i;
|
|
951
|
+
console.log("### HIDE, set focus to trigger"), s == null || s.focus();
|
|
952
|
+
}
|
|
952
953
|
}), this.action({ action: "hide" }).then(() => {
|
|
953
954
|
this.setTriggerState(!1);
|
|
954
955
|
}));
|
|
955
956
|
}
|
|
956
957
|
open() {
|
|
957
|
-
return this.outlets.size < 1 ? (process.env.NODE_ENV !== "production" && console.warn(
|
|
958
|
+
return console.log("### OPEN"), this.outlets.size < 1 ? (process.env.NODE_ENV !== "production" && console.warn(
|
|
958
959
|
"open(): No-op as no view outlets are registered. Invoke the attach() command first."
|
|
959
960
|
), Promise.resolve()) : (this.outlets.forEach((t) => t.render()), this.action({ action: "open" }).then(() => (this.widget.events.dispatch("tracking:widget-rendered", {}), this.onOpen())));
|
|
960
961
|
}
|
|
961
962
|
close() {
|
|
962
|
-
return this.outlets.size < 1 ? (process.env.NODE_ENV !== "production" && console.warn(
|
|
963
|
+
return console.log("### CLOSE"), this.outlets.size < 1 ? (process.env.NODE_ENV !== "production" && console.warn(
|
|
963
964
|
"close(): No-op as no view outlets are registered. Invoke the attach() command first."
|
|
964
965
|
), Promise.resolve()) : this.action({ action: "close" }).then(() => {
|
|
965
966
|
this.widget.events.dispatch("tracking:widget-minimized", {}), this.onClose();
|
|
966
967
|
});
|
|
967
968
|
}
|
|
968
969
|
show() {
|
|
969
|
-
return process.env.NODE_ENV !== "production" && console.warn(
|
|
970
|
+
return console.log("### SHOW"), process.env.NODE_ENV !== "production" && console.warn(
|
|
970
971
|
"show(): Command is deprecated and will be removed in the future. Use open() instead."
|
|
971
972
|
), this.open();
|
|
972
973
|
}
|
|
@@ -1071,7 +1072,7 @@ class Ie extends Gt {
|
|
|
1071
1072
|
deactivate() {
|
|
1072
1073
|
this.subs.forEach((i) => i());
|
|
1073
1074
|
const t = [];
|
|
1074
|
-
return this.outlets.forEach((i) => t.push(i.dispose())),
|
|
1075
|
+
return this.outlets.forEach((i) => t.push(i.dispose())), D(
|
|
1075
1076
|
this.container,
|
|
1076
1077
|
et,
|
|
1077
1078
|
v.Local
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/widget-types-grid",
|
|
3
|
-
"version": "1.3.27-rc.
|
|
3
|
+
"version": "1.3.27-rc.2",
|
|
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.27-rc.
|
|
14
|
-
"@telia-ace/widget-routing": "^1.3.27-rc.
|
|
15
|
-
"@telia-ace/widget-services": "^1.3.27-rc.
|
|
16
|
-
"@telia-ace/widget-ui": "^1.3.27-rc.
|
|
17
|
-
"@telia-ace/widget-utilities": "^1.3.27-rc.
|
|
13
|
+
"@telia-ace/widget-core": "^1.3.27-rc.2",
|
|
14
|
+
"@telia-ace/widget-routing": "^1.3.27-rc.2",
|
|
15
|
+
"@telia-ace/widget-services": "^1.3.27-rc.2",
|
|
16
|
+
"@telia-ace/widget-ui": "^1.3.27-rc.2",
|
|
17
|
+
"@telia-ace/widget-utilities": "^1.3.27-rc.2",
|
|
18
18
|
"@webprovisions/bootstrapping": "^1.0.14",
|
|
19
19
|
"@webprovisions/platform": "^1.1.4"
|
|
20
20
|
},
|
package/widget.d.ts
CHANGED
|
@@ -41,7 +41,9 @@ export default class Widget extends WidgetType {
|
|
|
41
41
|
value?: any;
|
|
42
42
|
}): Promise<void>;
|
|
43
43
|
renderState(): Promise<WidgetRenderState>;
|
|
44
|
-
hide(
|
|
44
|
+
hide(options?: {
|
|
45
|
+
focusTrigger?: boolean;
|
|
46
|
+
}): Promise<void>;
|
|
45
47
|
open(): Promise<void>;
|
|
46
48
|
close(): Promise<void>;
|
|
47
49
|
show(): Promise<void>;
|