@telia-ace/widget-runtime-flamingo 1.0.32 → 1.0.37
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-c94328c7.js → index-0d792c3e.js} +2 -2
- package/{index-7a734709.mjs → index-19a13f23.mjs} +2 -2
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/package.json +11 -2
- package/{render-ad873416.mjs → render-8ecc38bd.mjs} +2 -3
- package/{render-42bea194.js → render-938224a8.js} +2 -2
- package/ui/trigger-component.d.ts +3 -3
- package/ui/view-outlet.d.ts +2 -2
|
@@ -167,7 +167,7 @@ ${o.map(a=>`${a.name||"<no name>"} (${a.id})
|
|
|
167
167
|
align-items: center;
|
|
168
168
|
fill: var(--trigger-text-color, #fff);
|
|
169
169
|
}
|
|
170
|
-
`];ct([G({attribute:!1})],H.prototype,"symbol",2);ct([G({attribute:!1})],H.prototype,"container",2);ct([O()],H.prototype,"active",2);ct([O()],H.prototype,"loaded",2);ct([O()],H.prototype,"icon",2);var V=(n=>(n.Inline="inline",n.Link="link",n.Badge="badge",n.Unsupported="unsupported",n))(V||{});const Mn=(n,t)=>n&&t?"both":n?"widgetDOM":t?"triggerDOM":"none",is=n=>n?typeof n=="boolean"&&n?"link":typeof n=="object"&&!Array.isArray(n)?"badge":"unsupported":"inline",In=async(n,t,e,s,i,r=!1)=>{var l,d;const o=Mn(e,s),a=is(i),h={widgetDOMElement:e?e.cloneNode(!0):void 0,triggerDOMElement:s?s.cloneNode(!0):void 0},c={triggerType:a,cachedOriginals:h,widgetDOMElement:document.createElement("div")};switch(o){case"both":{c.widgetDOMElement=e||document.createElement("div"),a!=="inline"&&(c.triggerDOMElement=s);break}case"widgetDOM":{if(c.widgetDOMElement=e||document.createElement("div"),a!=="inline"){const u=document.body.appendChild(document.createElement("a"));a==="link"&&(u.innerText=t),c.triggerDOMElement=u}break}case"triggerDOM":{const u=document.createElement("div");c.widgetDOMElement=u,a==="inline"?(u.id=(s==null?void 0:s.id)||"",r?(u.style.display="none",(l=s==null?void 0:s.parentNode)==null||l.appendChild(u),c.callback=()=>{var p;(p=s==null?void 0:s.parentNode)==null||p.replaceChild(u,s),u.style.display=(s==null?void 0:s.style.display)||"block"}):(d=s==null?void 0:s.parentNode)==null||d.replaceChild(u,s),c.cachedOriginals.widgetDOMElement=s,c.cachedOriginals.triggerDOMElement=void 0):(c.widgetDOMElement=document.body.appendChild(u),c.triggerDOMElement=s);break}case"none":{const u=document.body.appendChild(document.createElement("div"));if(c.widgetDOMElement=u,a!=="inline"){customElements.get("ace-widget-trigger")||customElements.define("ace-widget-trigger",H);const p=document.createElement("ace-widget-trigger");p.symbol=i.symbol,p.container=n,document.body.appendChild(p),console.log("Created trigger"),c.triggerDOMElement=p}break}}return c},Rn="modals";class Tn{constructor(t,e){this.options=e,this.unsubscribe=[],this.container=t.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("ace-widget"),this.options.widgetDOMElement.classList.add(`ace-widget_${s.name}`);const i=t.get("widgetDOMElements")||[];t.register("widgetDOMElements",[...i,this.options.widgetDOMElement])}render(){const{widgetDOMElement:t,triggerDOMElement:e}=this.options,s=this.container.get("$widget");return t.getAttribute("data-rendered")==="true"?Promise.resolve():(e&&this.options.triggerType===V.Badge&&pn(e),Promise.resolve().then(()=>require("./render-42bea194.js")).then(i=>i.default(this.container,t)).then(()=>{if(t.setAttribute("data-rendered","true"),e&&this.options.triggerType===V.Badge){const r=this.options.triggerOptions.openTooltip;Ke(e,r)}Ss(this.container,t);const i=this.container.get("$environment").widgets.all();S(this.container,Rn,m.Session).then(r=>{r&&r.forEach(o=>{i.find(a=>a.name===o.name&&a.state==="activated")&&s.events.dispatch("widget:modal-opened",o)})})}))}renderBadge(t){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:r,ariaLabel:o,closedTooltip:a,openTooltip:h}=t,c={closedTooltip:a,openTooltip:h};this.options.triggerOptions=c;const l=dn(e,{label:i,symbol:r,ariaLabel:o,widgetName:s,tooltip:a});this.unsubscribe.push(l)}async dispose(){var s,i,r,o;const{triggerDOMElement:t,widgetDOMElement:e}=this.options;this.options.cachedOriginals.widgetDOMElement&&e&&((s=e.parentNode)==null||s.replaceChild(this.options.cachedOriginals.widgetDOMElement,e)),this.options.cachedOriginals.triggerDOMElement&&t&&((i=t.parentNode)==null||i.replaceChild(this.options.cachedOriginals.triggerDOMElement,t)),this.unsubscribe.forEach(a=>{a()}),(r=e.parentNode)==null||r.removeChild(e),(o=t==null?void 0:t.parentNode)==null||o.removeChild(t)}}const ut="changesets",jn=n=>{const t={tags:n.tags};return n.context&&typeof n.context!="function"&&(t.context=n.context),n.properties&&typeof n.properties!="function"&&(t.properties=n.properties),n.layout&&typeof n.layout!="function"&&(t.layout=n.layout),t};class le{constructor(t,e){this.container=t,this.storageWriter=e}static create(t){return k(t,ut,g.Necessary,{medium:m.Local}).then(e=>new le(t,e))}write(t,e,s,i){return A(this)(()=>S(this.container,ut,m.Local).then((r={})=>{const{keys:o=[],items:a={}}=r,h=o.indexOf(t);return h>-1&&o.splice(h,1),o.push(t),a[t]={options:i,attributes:jn(s),rules:e.rules},this.storageWriter({keys:o,items:a})}))}remove(t){return A(this)(()=>S(this.container,ut,m.Local).then((e={})=>{const{keys:s=[],items:i={}}=e,r=s.indexOf(t);if(r>-1)return s.splice(r,1),delete i[t],this.storageWriter(e)}))}load(t){return A(this)(()=>S(this.container,ut,m.Local).then((e={})=>{const{keys:s=[],items:i={}}=e;s.forEach(r=>{const o=i[r];if(o){const{rules:a,attributes:h,options:c}=o;t.write({attributes:h,options:c,target:new Y(t,a)})}})}))}}const Vn=n=>{const{container:t}=n;return le.create(t).then(e=>{const s=t.get("$settings"),i={localStorage:e},r=new Z(n,i),o=Be(r,s);return n.events.subscribe("widget:state-change",(a,h)=>{h.state===je.Deactivating&&o()}),r})},Un=n=>Promise.resolve().then(()=>hn).then(({StorageProvider:t})=>new t),Hn=n=>Promise.resolve().then(()=>se).then(({ActionResolver:t})=>new t(n)),zn=n=>Promise.resolve().then(()=>se).then(({ComponentResolver:t})=>new t(n)),Bn=n=>Promise.resolve().then(()=>se).then(()=>Vn(n.get("$widget"))),Ft="$settings",Kt="open",Me="activeStickyWidget";class Wn extends Es{constructor(t){super(t),this.outlets=new Map,this.activated=void 0,this.subs=[],this.handleBootstrapping=e=>{const s={triggerDOMElement:e.sourceDOMElement,withRenderState:"storage"};this.container.get("settings").then(i=>{const{activate:r}=i;(typeof r>"u"||r===null||r===!0)&&(this.activated=(this.activated||this.widget.activate()).then(()=>this.attach(s)))})},this.container.registerAsync("storage",()=>Un(this.container)),this.container.registerFactory("settings",()=>S(this.container,Ft,m.Local).then((e={})=>({...this.container.get("$settings"),...e}))),bs(this,"load",this.handleBootstrapping),this.container.registerAsync("componentResolver",()=>zn(this.container)),this.container.registerAsync("actionResolver",()=>Hn(this.container)),this.container.register("matchMedia",window.matchMedia),this.container.registerAsync("components",()=>Bn(this.container))}initialize(){const t=this.container.getManyAsync("actionResolver","components"),e=this.container.get("csp");return e&&(window.webprovisionsEnvironmentVariables||(window.webprovisionsEnvironmentVariables={}),window.webprovisionsEnvironmentVariables.cspNonce=e.nonce),Promise.all([t,this.container.get("settings")]).then(([{actionResolver:s,components:i},r])=>(s.subscribe(this.widget.name,(h,c,l)=>this.onAction(c,l)),(h=>{i.nodes.query({type:"view"}).forEach(c=>{i.setSwitch(c,h)})})("index"),this.events.subscribe("widget:data-loaded",(h,{element:c})=>{this.widget.container.get("seoConfiguration")&&this.events.dispatch("widget:preloaded-replaced",{element:c})}),Promise.resolve()))}attach(t={}){return this.container.get("settings").then(async({trigger:e})=>{var u,p;const{widgetDOMElement:s,key:i=ot(),triggerDOMElement:r,withRenderState:o}=t,h=is(e)===V.Inline&&((r==null?void 0:r.childElementCount)||0)>0,c=await In(this.container,this.widget.name,s,r,e,h);this.outlets.size<1&&!o&&this.setRenderState("unset");const l=()=>{const v=()=>y.querySelectorAll("[data-loading=true]").length===0,[y]=this.widget.container.get("widgetDOMElements"),C=(Nt,_)=>{v()&&(c.callback&&c.callback(),_.disconnect())},ht={attributes:!0,subtree:!0,childList:!0};v()&&c.callback&&c.callback(),new MutationObserver(C).observe(y,ht)};h&&this.widget.container.getAsync("dataClient").then(({events:v})=>{v.subscribe("data-client:fetched",(y,C)=>{C.unresolvedQueries===0&&l()})});const d=this.getOrCreateViewOutlet(i,c);if(this.outlets.set(i,d),this.widget.events.dispatch("widget:attached",{},{bubbles:!0}),c.triggerType===V.Badge&&e&&((u=c.triggerDOMElement)==null||u.setAttribute("aria-expanded","false"),d==null||d.renderBadge(e)),c.triggerType!==V.Inline&&((p=c.triggerDOMElement)==null||p.addEventListener("click",v=>{v.preventDefault(),this.container.get("settings").then(({trigger:y})=>{d.render().then(()=>this.renderState()).then(C=>y&&y.action&&y.action==="hide"?C===$.open?this.hide():this.open():C===$.open?this.close():this.open())})})),this.outlets.size>1)return this.renderState().then(v=>{this.triggerStateIfApplicable(v)});if(o)return o==="storage"?this.renderState().then(v=>{if(c.triggerType===V.Inline){this.triggerStateIfApplicable("open");return}this.triggerStateIfApplicable(v)}):this.triggerStateIfApplicable(o)})}detach(t){if(t){if(this.outlets.has(t)){const e=this.outlets.get(t);e==null||e.dispose(),this.outlets.delete(t);return}process.env.NODE_ENV!=="production"&&console.warn(`detach(): Could not find View Outlet with key ${t}`);return}this.outlets.forEach(e=>{e.dispose()}),this.outlets.clear()}triggerStateIfApplicable(t){switch(t){case"closed":this.close();break;case"open":this.open();break;case"hidden":this.hide();break;default:return}}getOrCreateViewOutlet(t,e){return this.outlets.has(t)?this.outlets.get(t):new Tn(this.container,e)}render(t={}){if(process.env.NODE_ENV!=="production"&&console.warn("widget.render() is deprecated. Use widget.attach() instead."),t.open){const e={...t,withRenderState:"open"};return this.attach(e)}return this.attach(t)}activate(t){t!=null&&t.override&&this.setSettings(()=>t.override),t!=null&&t.apiNotificationPriorityBy&&this.container.register("apiNotificationPriorityBy",t.apiNotificationPriorityBy)}setSettings(t){return Promise.all([this.container.get("settings"),k(this.container,Ft,g.Necessary,{medium:m.Local})]).then(([e,s])=>Promise.resolve(t(e)).then(i=>s(i).then(()=>{const r={...e,...i};return this.widget.events.dispatch("widget:settings-updated",r),r})))}clearSettings(){return k(this.container,Ft,g.Necessary,{medium:m.Local}).then(t=>t()).then(()=>this.container.get("settings")).then(t=>{this.widget.events.dispatch("widget:settings-updated",t)})}action({action:t,value:e}){return this.container.getAsync("actionResolver").then(s=>{s.action(this.widget.name,t,e)})}renderState(){return(()=>S(this.container,Kt,m.Session).then((e=$.closed)=>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(t=>t.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(t=>t.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(t,e){switch(t){case"close":case"open":case"hide":const s=t==="open"?$.open:t==="close"?$.closed:$.hidden;return this.setRenderState(s).then(()=>{this.setTriggerState(s===$.open),s!==$.hidden?s===$.open?this.onOpen():this.onClose():this.outlets.forEach(i=>{var r;return(r=i.options.triggerDOMElement)==null?void 0:r.setAttribute("aria-expanded","false")})})}}setRenderState(t){const{invoke:e,events:s}=this.container.get("$widget");return Promise.all([k(this.container,Kt,g.Necessary,{medium:m.Session}),k(this.container,Kt,g.Necessary,{medium:m.Local,duration:{minutes:5}}),e("renderState")]).then(([i,r,o])=>{t==="unset"||!t?(r(),i()):i(t),s.dispatch("widget:render-state-changed",{previous:o,next:t})})}onOpen(){return this.outlets.forEach(t=>{var e;return(e=t.options.triggerDOMElement)==null?void 0:e.setAttribute("aria-expanded","true")}),Promise.resolve()}onClose(){const t=this.container.getManyAsync("components");return(()=>this.container.get("settings").then(s=>{const{activate:i}=this.container.get("$settings");return s.activate!==i?this.setSettings(()=>Promise.resolve({activate:i})):Promise.resolve()}))().then(()=>t).then(({components:s})=>{this.outlets.forEach(i=>{var r;return(r=i.options.triggerDOMElement)==null?void 0:r.setAttribute("aria-expanded","false")})})}setTriggerState(t){this.outlets.forEach(e=>{const{options:{triggerDOMElement:s,triggerOptions:i}}=e,{openTooltip:r,closedTooltip:o}=i||{};s&&(t?Ke(s,r):un(s,o))})}deactivate(){this.subs.forEach(e=>e());const t=[];return this.outlets.forEach(e=>t.push(e.dispose())),S(this.container,Me,m.Local).then(e=>e===this.widget.name?k(this.container,Me,g.Necessary,{medium:m.Local,scope:Q.Implementation}).then(s=>s()).then(()=>Promise.all(t)):Promise.all(t))}}/**
|
|
170
|
+
`];ct([G({attribute:!1})],H.prototype,"symbol",2);ct([G({attribute:!1})],H.prototype,"container",2);ct([O()],H.prototype,"active",2);ct([O()],H.prototype,"loaded",2);ct([O()],H.prototype,"icon",2);var V=(n=>(n.Inline="inline",n.Link="link",n.Badge="badge",n.Unsupported="unsupported",n))(V||{});const Mn=(n,t)=>n&&t?"both":n?"widgetDOM":t?"triggerDOM":"none",is=n=>n?typeof n=="boolean"&&n?"link":typeof n=="object"&&!Array.isArray(n)?"badge":"unsupported":"inline",In=async(n,t,e,s,i,r=!1)=>{var l,d;const o=Mn(e,s),a=is(i),h={widgetDOMElement:e?e.cloneNode(!0):void 0,triggerDOMElement:s?s.cloneNode(!0):void 0},c={triggerType:a,cachedOriginals:h,widgetDOMElement:document.createElement("div")};switch(o){case"both":{c.widgetDOMElement=e||document.createElement("div"),a!=="inline"&&(c.triggerDOMElement=s);break}case"widgetDOM":{if(c.widgetDOMElement=e||document.createElement("div"),a!=="inline"){const u=document.body.appendChild(document.createElement("a"));a==="link"&&(u.innerText=t),c.triggerDOMElement=u}break}case"triggerDOM":{const u=document.createElement("div");c.widgetDOMElement=u,a==="inline"?(u.id=(s==null?void 0:s.id)||"",r?(u.style.display="none",(l=s==null?void 0:s.parentNode)==null||l.appendChild(u),c.callback=()=>{var p;(p=s==null?void 0:s.parentNode)==null||p.replaceChild(u,s),u.style.display=(s==null?void 0:s.style.display)||"block"}):(d=s==null?void 0:s.parentNode)==null||d.replaceChild(u,s),c.cachedOriginals.widgetDOMElement=s,c.cachedOriginals.triggerDOMElement=void 0):(c.widgetDOMElement=document.body.appendChild(u),c.triggerDOMElement=s);break}case"none":{const u=document.body.appendChild(document.createElement("div"));if(c.widgetDOMElement=u,a!=="inline"){customElements.get("ace-widget-trigger")||customElements.define("ace-widget-trigger",H);const p=document.createElement("ace-widget-trigger");p.symbol=i.symbol,p.container=n,document.body.appendChild(p),console.log("Created trigger"),c.triggerDOMElement=p}break}}return c},Rn="modals";class Tn{constructor(t,e){this.options=e,this.unsubscribe=[],this.container=t.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("ace-widget"),this.options.widgetDOMElement.classList.add(`ace-widget_${s.name}`);const i=t.get("widgetDOMElements")||[];t.register("widgetDOMElements",[...i,this.options.widgetDOMElement])}render(){const{widgetDOMElement:t,triggerDOMElement:e}=this.options,s=this.container.get("$widget");return t.getAttribute("data-rendered")==="true"?Promise.resolve():(e&&this.options.triggerType===V.Badge&&pn(e),Promise.resolve().then(()=>require("./render-938224a8.js")).then(i=>i.default(this.container,t)).then(()=>{if(t.setAttribute("data-rendered","true"),e&&this.options.triggerType===V.Badge){const r=this.options.triggerOptions.openTooltip;Ke(e,r)}Ss(this.container,t);const i=this.container.get("$environment").widgets.all();S(this.container,Rn,m.Session).then(r=>{r&&r.forEach(o=>{i.find(a=>a.name===o.name&&a.state==="activated")&&s.events.dispatch("widget:modal-opened",o)})})}))}renderBadge(t){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:r,ariaLabel:o,closedTooltip:a,openTooltip:h}=t,c={closedTooltip:a,openTooltip:h};this.options.triggerOptions=c;const l=dn(e,{label:i,symbol:r,ariaLabel:o,widgetName:s,tooltip:a});this.unsubscribe.push(l)}async dispose(){var s,i,r,o;const{triggerDOMElement:t,widgetDOMElement:e}=this.options;this.options.cachedOriginals.widgetDOMElement&&e&&((s=e.parentNode)==null||s.replaceChild(this.options.cachedOriginals.widgetDOMElement,e)),this.options.cachedOriginals.triggerDOMElement&&t&&((i=t.parentNode)==null||i.replaceChild(this.options.cachedOriginals.triggerDOMElement,t)),this.unsubscribe.forEach(a=>{a()}),(r=e.parentNode)==null||r.removeChild(e),(o=t==null?void 0:t.parentNode)==null||o.removeChild(t)}}const ut="changesets",jn=n=>{const t={tags:n.tags};return n.context&&typeof n.context!="function"&&(t.context=n.context),n.properties&&typeof n.properties!="function"&&(t.properties=n.properties),n.layout&&typeof n.layout!="function"&&(t.layout=n.layout),t};class le{constructor(t,e){this.container=t,this.storageWriter=e}static create(t){return k(t,ut,g.Necessary,{medium:m.Local}).then(e=>new le(t,e))}write(t,e,s,i){return A(this)(()=>S(this.container,ut,m.Local).then((r={})=>{const{keys:o=[],items:a={}}=r,h=o.indexOf(t);return h>-1&&o.splice(h,1),o.push(t),a[t]={options:i,attributes:jn(s),rules:e.rules},this.storageWriter({keys:o,items:a})}))}remove(t){return A(this)(()=>S(this.container,ut,m.Local).then((e={})=>{const{keys:s=[],items:i={}}=e,r=s.indexOf(t);if(r>-1)return s.splice(r,1),delete i[t],this.storageWriter(e)}))}load(t){return A(this)(()=>S(this.container,ut,m.Local).then((e={})=>{const{keys:s=[],items:i={}}=e;s.forEach(r=>{const o=i[r];if(o){const{rules:a,attributes:h,options:c}=o;t.write({attributes:h,options:c,target:new Y(t,a)})}})}))}}const Vn=n=>{const{container:t}=n;return le.create(t).then(e=>{const s=t.get("$settings"),i={localStorage:e},r=new Z(n,i),o=Be(r,s);return n.events.subscribe("widget:state-change",(a,h)=>{h.state===je.Deactivating&&o()}),r})},Un=n=>Promise.resolve().then(()=>hn).then(({StorageProvider:t})=>new t),Hn=n=>Promise.resolve().then(()=>se).then(({ActionResolver:t})=>new t(n)),zn=n=>Promise.resolve().then(()=>se).then(({ComponentResolver:t})=>new t(n)),Bn=n=>Promise.resolve().then(()=>se).then(()=>Vn(n.get("$widget"))),Ft="$settings",Kt="open",Me="activeStickyWidget";class Wn extends Es{constructor(t){super(t),this.outlets=new Map,this.activated=void 0,this.subs=[],this.handleBootstrapping=e=>{const s={triggerDOMElement:e.sourceDOMElement,withRenderState:"storage"};this.container.get("settings").then(i=>{const{activate:r}=i;(typeof r>"u"||r===null||r===!0)&&(this.activated=(this.activated||this.widget.activate()).then(()=>this.attach(s)))})},this.container.registerAsync("storage",()=>Un(this.container)),this.container.registerFactory("settings",()=>S(this.container,Ft,m.Local).then((e={})=>({...this.container.get("$settings"),...e}))),bs(this,"load",this.handleBootstrapping),this.container.registerAsync("componentResolver",()=>zn(this.container)),this.container.registerAsync("actionResolver",()=>Hn(this.container)),this.container.register("matchMedia",window.matchMedia),this.container.registerAsync("components",()=>Bn(this.container))}initialize(){const t=this.container.getManyAsync("actionResolver","components"),e=this.container.get("csp");return e&&(window.webprovisionsEnvironmentVariables||(window.webprovisionsEnvironmentVariables={}),window.webprovisionsEnvironmentVariables.cspNonce=e.nonce),Promise.all([t,this.container.get("settings")]).then(([{actionResolver:s,components:i},r])=>(s.subscribe(this.widget.name,(h,c,l)=>this.onAction(c,l)),(h=>{i.nodes.query({type:"view"}).forEach(c=>{i.setSwitch(c,h)})})("index"),this.events.subscribe("widget:data-loaded",(h,{element:c})=>{this.widget.container.get("seoConfiguration")&&this.events.dispatch("widget:preloaded-replaced",{element:c})}),Promise.resolve()))}attach(t={}){return this.container.get("settings").then(async({trigger:e})=>{var u,p;const{widgetDOMElement:s,key:i=ot(),triggerDOMElement:r,withRenderState:o}=t,h=is(e)===V.Inline&&((r==null?void 0:r.childElementCount)||0)>0,c=await In(this.container,this.widget.name,s,r,e,h);this.outlets.size<1&&!o&&this.setRenderState("unset");const l=()=>{const v=()=>y.querySelectorAll("[data-loading=true]").length===0,[y]=this.widget.container.get("widgetDOMElements"),C=(Nt,_)=>{v()&&(c.callback&&c.callback(),_.disconnect())},ht={attributes:!0,subtree:!0,childList:!0};v()&&c.callback&&c.callback(),new MutationObserver(C).observe(y,ht)};h&&this.widget.container.getAsync("dataClient").then(({events:v})=>{v.subscribe("data-client:fetched",(y,C)=>{C.unresolvedQueries===0&&l()})});const d=this.getOrCreateViewOutlet(i,c);if(this.outlets.set(i,d),this.widget.events.dispatch("widget:attached",{},{bubbles:!0}),c.triggerType===V.Badge&&e&&((u=c.triggerDOMElement)==null||u.setAttribute("aria-expanded","false"),d==null||d.renderBadge(e)),c.triggerType!==V.Inline&&((p=c.triggerDOMElement)==null||p.addEventListener("click",v=>{v.preventDefault(),this.container.get("settings").then(({trigger:y})=>{d.render().then(()=>this.renderState()).then(C=>y&&y.action&&y.action==="hide"?C===$.open?this.hide():this.open():C===$.open?this.close():this.open())})})),this.outlets.size>1)return this.renderState().then(v=>{this.triggerStateIfApplicable(v)});if(o)return o==="storage"?this.renderState().then(v=>{if(c.triggerType===V.Inline){this.triggerStateIfApplicable("open");return}this.triggerStateIfApplicable(v)}):this.triggerStateIfApplicable(o)})}detach(t){if(t){if(this.outlets.has(t)){const e=this.outlets.get(t);e==null||e.dispose(),this.outlets.delete(t);return}process.env.NODE_ENV!=="production"&&console.warn(`detach(): Could not find View Outlet with key ${t}`);return}this.outlets.forEach(e=>{e.dispose()}),this.outlets.clear()}triggerStateIfApplicable(t){switch(t){case"closed":this.close();break;case"open":this.open();break;case"hidden":this.hide();break;default:return}}getOrCreateViewOutlet(t,e){return this.outlets.has(t)?this.outlets.get(t):new Tn(this.container,e)}render(t={}){if(process.env.NODE_ENV!=="production"&&console.warn("widget.render() is deprecated. Use widget.attach() instead."),t.open){const e={...t,withRenderState:"open"};return this.attach(e)}return this.attach(t)}activate(t){t!=null&&t.override&&this.setSettings(()=>t.override),t!=null&&t.apiNotificationPriorityBy&&this.container.register("apiNotificationPriorityBy",t.apiNotificationPriorityBy)}setSettings(t){return Promise.all([this.container.get("settings"),k(this.container,Ft,g.Necessary,{medium:m.Local})]).then(([e,s])=>Promise.resolve(t(e)).then(i=>s(i).then(()=>{const r={...e,...i};return this.widget.events.dispatch("widget:settings-updated",r),r})))}clearSettings(){return k(this.container,Ft,g.Necessary,{medium:m.Local}).then(t=>t()).then(()=>this.container.get("settings")).then(t=>{this.widget.events.dispatch("widget:settings-updated",t)})}action({action:t,value:e}){return this.container.getAsync("actionResolver").then(s=>{s.action(this.widget.name,t,e)})}renderState(){return(()=>S(this.container,Kt,m.Session).then((e=$.closed)=>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(t=>t.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(t=>t.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(t,e){switch(t){case"close":case"open":case"hide":const s=t==="open"?$.open:t==="close"?$.closed:$.hidden;return this.setRenderState(s).then(()=>{this.setTriggerState(s===$.open),s!==$.hidden?s===$.open?this.onOpen():this.onClose():this.outlets.forEach(i=>{var r;return(r=i.options.triggerDOMElement)==null?void 0:r.setAttribute("aria-expanded","false")})})}}setRenderState(t){const{invoke:e,events:s}=this.container.get("$widget");return Promise.all([k(this.container,Kt,g.Necessary,{medium:m.Session}),k(this.container,Kt,g.Necessary,{medium:m.Local,duration:{minutes:5}}),e("renderState")]).then(([i,r,o])=>{t==="unset"||!t?(r(),i()):i(t),s.dispatch("widget:render-state-changed",{previous:o,next:t})})}onOpen(){return this.outlets.forEach(t=>{var e;return(e=t.options.triggerDOMElement)==null?void 0:e.setAttribute("aria-expanded","true")}),Promise.resolve()}onClose(){const t=this.container.getManyAsync("components");return(()=>this.container.get("settings").then(s=>{const{activate:i}=this.container.get("$settings");return s.activate!==i?this.setSettings(()=>Promise.resolve({activate:i})):Promise.resolve()}))().then(()=>t).then(({components:s})=>{this.outlets.forEach(i=>{var r;return(r=i.options.triggerDOMElement)==null?void 0:r.setAttribute("aria-expanded","false")})})}setTriggerState(t){this.outlets.forEach(e=>{const{options:{triggerDOMElement:s,triggerOptions:i}}=e,{openTooltip:r,closedTooltip:o}=i||{};s&&(t?Ke(s,r):un(s,o))})}deactivate(){this.subs.forEach(e=>e());const t=[];return this.outlets.forEach(e=>t.push(e.dispose())),S(this.container,Me,m.Local).then(e=>e===this.widget.name?k(this.container,Me,g.Necessary,{medium:m.Local,scope:Q.Implementation}).then(s=>s()).then(()=>Promise.all(t)):Promise.all(t))}}/**
|
|
171
171
|
* @license
|
|
172
172
|
* Copyright 2021 Google LLC
|
|
173
173
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -203,4 +203,4 @@ ${o.map(a=>`${a.name||"<no name>"} (${a.id})
|
|
|
203
203
|
* {
|
|
204
204
|
box-sizing: border-box;
|
|
205
205
|
}
|
|
206
|
-
`],I([Kn({context:cs}),G({attribute:!1})],t.prototype,"container",2),I([G()],t.prototype,"entry",2),I([O()],t.prototype,"descriptor",2),I([O()],t.prototype,"component",2),I([O()],t.prototype,"context",2),I([O()],t.prototype,"layout",2),I([O()],t.prototype,"properties",2),t};console.log("
|
|
206
|
+
`],I([Kn({context:cs}),G({attribute:!1})],t.prototype,"container",2),I([G()],t.prototype,"entry",2),I([O()],t.prototype,"descriptor",2),I([O()],t.prototype,"component",2),I([O()],t.prototype,"context",2),I([O()],t.prototype,"layout",2),I([O()],t.prototype,"properties",2),t};console.log("test12323425324222");exports.A=f;exports.ActionsController=us;exports.DataProvider=ps;exports.GuideProviderPlugin=Qn;exports.T=L;exports.Widget=Wn;exports.WidgetComponent=ni;exports.appendStyleFromProperties=gs;exports.childrenContext=os;exports.containerContext=cs;exports.contextCtx=hs;exports.createDataProvider=Yn;exports.createLitComponent=Xn;exports.descriptorContext=as;exports.e=ss;exports.i=ns;exports.i$1=W;exports.i$2=ce;exports.layoutCtx=ls;exports.mapBranding=he;exports.mt=$;exports.n=G;exports.propertiesCtx=ds;exports.pt=Z;exports.s=J;exports.t=es;exports.t$1=O;exports.x=et;
|
|
@@ -2586,7 +2586,7 @@ class Sn {
|
|
|
2586
2586
|
*/
|
|
2587
2587
|
render() {
|
|
2588
2588
|
const { widgetDOMElement: t, triggerDOMElement: e } = this.options, s = this.container.get("$widget");
|
|
2589
|
-
return t.getAttribute("data-rendered") === "true" ? Promise.resolve() : (e && this.options.triggerType === j.Badge && tn(e), import("./render-
|
|
2589
|
+
return t.getAttribute("data-rendered") === "true" ? Promise.resolve() : (e && this.options.triggerType === j.Badge && tn(e), import("./render-8ecc38bd.mjs").then((i) => i.default(this.container, t)).then(() => {
|
|
2590
2590
|
if (t.setAttribute("data-rendered", "true"), e && this.options.triggerType === j.Badge) {
|
|
2591
2591
|
const r = this.options.triggerOptions.openTooltip;
|
|
2592
2592
|
Je(e, r);
|
|
@@ -3372,7 +3372,7 @@ const yi = (n) => {
|
|
|
3372
3372
|
N()
|
|
3373
3373
|
], t.prototype, "properties", 2), t;
|
|
3374
3374
|
};
|
|
3375
|
-
console.log("
|
|
3375
|
+
console.log("test12323425324222");
|
|
3376
3376
|
export {
|
|
3377
3377
|
f as A,
|
|
3378
3378
|
Fn as D,
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-0d792c3e.js");exports.ActionsController=t.ActionsController;exports.DataProvider=t.DataProvider;exports.GridWidget=t.Widget;exports.GuideProviderPlugin=t.GuideProviderPlugin;exports.Widget=t.Widget;exports.WidgetComponent=t.WidgetComponent;exports.childrenContext=t.childrenContext;exports.containerContext=t.containerContext;exports.contextCtx=t.contextCtx;exports.createDataProvider=t.createDataProvider;exports.createWebComponent=t.createLitComponent;exports.descriptorContext=t.descriptorContext;exports.layoutCtx=t.layoutCtx;exports.propertiesCtx=t.propertiesCtx;
|
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as a, D as o, h as r, G as s, h as i, W as n, j as d, c as C, l as c, u as x, v as l, k as p, o as W, q as g } from "./index-
|
|
1
|
+
import { r as a, D as o, h as r, G as s, h as i, W as n, j as d, c as C, l as c, u as x, v as l, k as p, o as W, q as g } from "./index-19a13f23.mjs";
|
|
2
2
|
export {
|
|
3
3
|
a as ActionsController,
|
|
4
4
|
o as DataProvider,
|
package/package.json
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/widget-runtime-flamingo",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.37",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"release": "release-it"
|
|
6
6
|
},
|
|
7
7
|
"release-it": {
|
|
8
8
|
"git": false
|
|
9
9
|
},
|
|
10
|
-
"dependencies": {
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@telia-ace/widget-core": "^1.0.27",
|
|
12
|
+
"@telia-ace/widget-services": "^1.0.27",
|
|
13
|
+
"@telia-ace/widget-utilities": "^1.0.16",
|
|
14
|
+
"@webprovisions/platform": "^1.1.3",
|
|
15
|
+
"@lit-labs/context": "^0.4.0",
|
|
16
|
+
"lit": "^2.8.0",
|
|
17
|
+
"@teliads/icons": "^8.4.0",
|
|
18
|
+
"@webprovisions/bootstrapping": "^1.0.13"
|
|
19
|
+
},
|
|
11
20
|
"main": "./index.js",
|
|
12
21
|
"module": "./index.mjs",
|
|
13
22
|
"typings": "./index.d.ts"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as L, t as D, e as A, A as y, s as P, a as Y, c as M, p as T, m as f, x as v, b as R, n as j, d as u, T as w, W as z, f as E, g as N } from "./index-
|
|
1
|
+
import { i as L, t as D, e as A, A as y, s as P, a as Y, c as M, p as T, m as f, x as v, b as R, n as j, d as u, T as w, W as z, f as E, g as N } from "./index-19a13f23.mjs";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2017 Google LLC
|
|
@@ -134,8 +134,7 @@ const $ = /* @__PURE__ */ new WeakMap(), V = A(class extends G {
|
|
|
134
134
|
const i = s.reduce(
|
|
135
135
|
(o, { breakpoints: a = [], values: l }) => a.length ? t.some((g) => a.includes(g)) ? { ...o, ...l } : o : { ...o, ...l },
|
|
136
136
|
{}
|
|
137
|
-
), n = {};
|
|
138
|
-
let r = i.type;
|
|
137
|
+
), n = {}, r = i.type;
|
|
139
138
|
return n.height = i.height || "", n.width = i.width || "", i.type === "floating" || i.type === "inline" && e && (n.height = "calc(100vh - 120px)"), { type: r, styles: n };
|
|
140
139
|
};
|
|
141
140
|
var J = Object.defineProperty, X = Object.getOwnPropertyDescriptor, h = (s, t, e, i) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-0d792c3e.js");/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* @license
|
|
15
15
|
* Copyright 2020 Google LLC
|
|
16
16
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
|
-
*/const G=()=>new O;class O{}const g=new WeakMap,L=r.e(class extends C{render(s){return r.A}update(s,[t]){var e;const i=t!==this.G;return i&&this.G!==void 0&&this.ot(void 0),(i||this.rt!==this.lt)&&(this.G=t,this.dt=(e=s.options)===null||e===void 0?void 0:e.host,this.ot(this.lt=s.element)),r.A}ot(s){var t;if(typeof this.G=="function"){const e=(t=this.dt)!==null&&t!==void 0?t:globalThis;let i=g.get(e);i===void 0&&(i=new WeakMap,g.set(e,i)),i.get(this.G)!==void 0&&this.G.call(this.dt,void 0),i.set(this.G,s),s!==void 0&&this.G.call(this.dt,s)}else this.G.value=s}get rt(){var s,t,e;return typeof this.G=="function"?(t=g.get((s=this.dt)!==null&&s!==void 0?s:globalThis))===null||t===void 0?void 0:t.get(this.G):(e=this.G)===null||e===void 0?void 0:e.value}disconnected(){this.rt===this.lt&&this.ot(void 0)}reconnected(){this.ot(this.lt)}}),T=async s=>await s.get("$widget").invoke("renderState"),D=async(s,t)=>{const e=s.get("$widget");return(await s.getAsync("actionResolver")).subscribe(e.name,t)},M=(s,t,e=!1)=>{const i=s.reduce((a,{breakpoints:c=[],values:h})=>c.length?t.some(v=>c.includes(v))?{...a,...h}:a:{...a,...h},{}),n={}
|
|
17
|
+
*/const G=()=>new O;class O{}const g=new WeakMap,L=r.e(class extends C{render(s){return r.A}update(s,[t]){var e;const i=t!==this.G;return i&&this.G!==void 0&&this.ot(void 0),(i||this.rt!==this.lt)&&(this.G=t,this.dt=(e=s.options)===null||e===void 0?void 0:e.host,this.ot(this.lt=s.element)),r.A}ot(s){var t;if(typeof this.G=="function"){const e=(t=this.dt)!==null&&t!==void 0?t:globalThis;let i=g.get(e);i===void 0&&(i=new WeakMap,g.set(e,i)),i.get(this.G)!==void 0&&this.G.call(this.dt,void 0),i.set(this.G,s),s!==void 0&&this.G.call(this.dt,s)}else this.G.value=s}get rt(){var s,t,e;return typeof this.G=="function"?(t=g.get((s=this.dt)!==null&&s!==void 0?s:globalThis))===null||t===void 0?void 0:t.get(this.G):(e=this.G)===null||e===void 0?void 0:e.value}disconnected(){this.rt===this.lt&&this.ot(void 0)}reconnected(){this.ot(this.lt)}}),T=async s=>await s.get("$widget").invoke("renderState"),D=async(s,t)=>{const e=s.get("$widget");return(await s.getAsync("actionResolver")).subscribe(e.name,t)},M=(s,t,e=!1)=>{const i=s.reduce((a,{breakpoints:c=[],values:h})=>c.length?t.some(v=>c.includes(v))?{...a,...h}:a:{...a,...h},{}),n={},o=i.type;return n.height=i.height||"",n.width=i.width||"",i.type==="floating"||i.type==="inline"&&e&&(n.height="calc(100vh - 120px)"),{type:o,styles:n}};var Y=Object.defineProperty,j=Object.getOwnPropertyDescriptor,d=(s,t,e,i)=>{for(var n=i>1?void 0:i?j(t,e):t,o=s.length-1,a;o>=0;o--)(a=s[o])&&(n=(i?a(t,e,n):a(n))||n);return i&&n&&Y(t,e,n),n};let l=class extends r.s{constructor(){super(),this._provider=new r.i$1(this,r.containerContext,void 0),this.wrapperRef=G(),this.breakpoints=[],this.breakpointsSet=!1}connectedCallback(){super.connectedCallback(),this._provider.setValue(this.container),this.container&&(T(this.container).then(s=>{this.renderState=s}),D(this.container,(s,t)=>{switch(t){case"close":case"open":this.renderState=t==="open"?r.mt.open:r.mt.closed;break;case"hide":this.renderState=r.mt.hidden}}).then(s=>{this._unsubscribeRenderState=s}),r.pt.getInstance(this.container).then(s=>{this.componentPlatform=s,this.breakpoints=this.componentPlatform.breakpoints,this.breakpointsSet=!0,this._unsubscribePropChange=this.componentPlatform.events.subscribe("components:properties-changed",(t,e)=>{var i,n;((i=e==null?void 0:e.node)==null?void 0:i.type)==="root"&&(this.breakpoints=(n=this.componentPlatform)!=null&&n.breakpoints?[...this.componentPlatform.breakpoints]:[])}),this.entry=this.componentPlatform.nodes.root.children.default[0].id||void 0}))}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribeRenderState&&this._unsubscribeRenderState(),this._unsubscribePropChange&&this._unsubscribePropChange()}render(){var t,e,i,n;let s;if(!this.entry||!this.breakpointsSet)return r.A;if(this.container&&this.renderState){const[o]=this.container.get("widgetDOMElements");o&&o.setAttribute("data-state",this.renderState)}if(this.container){const o=this.container.get("$settings");o!=null&&o.layout&&(s=M(o.layout,this.breakpoints,!!o.trigger),s.type==="floating"?(this.renderRoot.host.classList.add("floating"),this.renderRoot.host.classList.remove("inline")):(this.renderRoot.host.classList.add("inline"),this.renderRoot.host.classList.remove("floating")),Object.entries(s.styles).forEach(([a,c])=>{this.renderRoot.host.style.setProperty(a,c)}))}return this.renderState&&(this.renderState===r.mt.hidden?((t=this.wrapperRef.value)==null||t.classList.add("hidden"),(e=this.wrapperRef.value)==null||e.classList.remove("expanded")):((i=this.wrapperRef.value)==null||i.classList.remove("hidden"),(n=this.wrapperRef.value)==null||n.classList.add("expanded"))),r.x`
|
|
18
18
|
<div class="widget-container" ${L(this.wrapperRef)}>
|
|
19
19
|
<ace-area entry=${this.entry}></ace-area>
|
|
20
20
|
</div>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Container } from '@webprovisions/platform';
|
|
2
2
|
import { LitElement, nothing } from 'lit';
|
|
3
|
-
type
|
|
3
|
+
type SymbolType = {
|
|
4
4
|
type: 'Uri' | 'Svg' | 'FontAwesome' | 'Text' | string;
|
|
5
5
|
content: string;
|
|
6
6
|
};
|
|
7
7
|
export declare class TriggerComponent extends LitElement {
|
|
8
8
|
static styles: import("lit").CSSResult[];
|
|
9
|
-
symbol?:
|
|
9
|
+
symbol?: SymbolType;
|
|
10
10
|
container?: Container;
|
|
11
11
|
active: boolean;
|
|
12
12
|
loaded: boolean;
|
|
@@ -14,7 +14,7 @@ export declare class TriggerComponent extends LitElement {
|
|
|
14
14
|
connectedCallback(): Promise<void>;
|
|
15
15
|
_toggleActive(): void;
|
|
16
16
|
_applyBranding(): void;
|
|
17
|
-
_renderSymbol(symbol?:
|
|
17
|
+
_renderSymbol(symbol?: SymbolType): Promise<import("lit").TemplateResult<1> | typeof nothing>;
|
|
18
18
|
render(): import("lit").TemplateResult<1>;
|
|
19
19
|
}
|
|
20
20
|
export {};
|
package/ui/view-outlet.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Container } from '@webprovisions/platform';
|
|
2
2
|
import { TriggerType } from './prepare-dom';
|
|
3
|
-
type
|
|
3
|
+
type SymbolType = {
|
|
4
4
|
type: 'Uri' | 'Svg' | 'FontAwesome' | 'Text' | string;
|
|
5
5
|
content: string;
|
|
6
6
|
};
|
|
7
7
|
export type BadgeOptions = {
|
|
8
|
-
symbol?:
|
|
8
|
+
symbol?: SymbolType;
|
|
9
9
|
label?: string;
|
|
10
10
|
ariaLabel?: string;
|
|
11
11
|
openTooltip?: string;
|