@telia-ace/widget-runtime-flamingo 1.1.123-rc.24 → 1.1.123-rc.26
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.
|
@@ -2510,7 +2510,7 @@ class ii {
|
|
|
2510
2510
|
*/
|
|
2511
2511
|
render() {
|
|
2512
2512
|
const { widgetDOMElement: t, triggerDOMElement: e } = this.options, s = this.container.get("$widget");
|
|
2513
|
-
return t.getAttribute("data-rendered") === "true" ? Promise.resolve() : (e && this.options.triggerType === j.Badge && Cs(e), import("./render-
|
|
2513
|
+
return t.getAttribute("data-rendered") === "true" ? Promise.resolve() : (e && this.options.triggerType === j.Badge && Cs(e), import("./render-dvw3oleE.mjs").then((n) => n.default(this.container, t)).then(() => {
|
|
2514
2514
|
if (t.setAttribute("data-rendered", "true"), e && this.options.triggerType === j.Badge) {
|
|
2515
2515
|
const r = this.options.triggerOptions.openTooltip;
|
|
2516
2516
|
Le(e, r);
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
align-items: center;
|
|
160
160
|
fill: var(--trigger-text-color, var(--text-on-primary-background));
|
|
161
161
|
}
|
|
162
|
-
`];let L=re;ct([F({attribute:!1})],L.prototype,"symbol");ct([F({attribute:!1})],L.prototype,"container");ct([C()],L.prototype,"active");ct([C()],L.prototype,"loaded");ct([C()],L.prototype,"icon");var U=(i=>(i.Inline="inline",i.Link="link",i.Badge="badge",i.Unsupported="unsupported",i))(U||{});const hi=(i,t)=>i&&t?"both":i?"widgetDOM":t?"triggerDOM":"none",qe=i=>i?typeof i=="boolean"&&i?"link":typeof i=="object"&&!Array.isArray(i)?"badge":"unsupported":"inline",li=async(i,t,e,s,n,r=!1)=>{var l,d;const o=hi(e,s),a=qe(n),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",L);const p=document.createElement("ace-widget-trigger");p.symbol=n.symbol,p.container=i,document.body.appendChild(p),console.log("Created trigger"),c.triggerDOMElement=p}break}}return c},di="modals";class ui{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 n=t.get("widgetDOMElements")||[];t.register("widgetDOMElements",[...n,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===U.Badge&&Us(e),Promise.resolve().then(()=>require("./render-C5X01J2f.js")).then(n=>n.default(this.container,t)).then(()=>{if(t.setAttribute("data-rendered","true"),e&&this.options.triggerType===U.Badge){const r=this.options.triggerOptions.openTooltip;Ie(e,r)}gs(this.container,t);const n=this.container.get("$environment").widgets.all();O(this.container,di,f.Session).then(r=>{r&&r.forEach(o=>{n.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:n,symbol:r,ariaLabel:o,closedTooltip:a,openTooltip:h}=t,c={closedTooltip:a,openTooltip:h};this.options.triggerOptions=c;const l=Ts(e,{label:n,ariaLabel:o,widgetName:s,tooltip:a});this.unsubscribe.push(l)}async dispose(){var s,n,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&&((n=t.parentNode)==null||n.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",pi=i=>{const t={tags:i.tags};return i.context&&typeof i.context!="function"&&(t.context=i.context),i.properties&&typeof i.properties!="function"&&(t.properties=i.properties),i.layout&&typeof i.layout!="function"&&(t.layout=i.layout),t};class ne{constructor(t,e){this.container=t,this.storageWriter=e}static create(t){return P(t,ut,m.Necessary,{medium:f.Local}).then(e=>new ne(t,e))}write(t,e,s,n){return A(this)(()=>O(this.container,ut,f.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:n,attributes:pi(s),rules:e.rules},this.storageWriter({keys:o,items:a})}))}remove(t){return A(this)(()=>O(this.container,ut,f.Local).then((e={})=>{const{keys:s=[],items:n={}}=e,r=s.indexOf(t);if(r>-1)return s.splice(r,1),delete n[t],this.storageWriter(e)}))}load(t){return A(this)(()=>O(this.container,ut,f.Local).then((e={})=>{const{keys:s=[],items:n={}}=e;s.forEach(r=>{const o=n[r];if(o){const{rules:a,attributes:h,options:c}=o;t.write({attributes:h,options:c,target:new K(t,a)})}})}))}}const gi=i=>{const{container:t}=i;return ne.create(t).then(e=>{const s=t.get("$settings"),n={localStorage:e},r=new G(i,n),o=Ne(r,s);return i.events.subscribe("widget:state-change",(a,h)=>{h.state===Ce.Deactivating&&o()}),r})},mi=i=>Promise.resolve().then(()=>Is).then(({StorageProvider:t})=>new t),fi=i=>Promise.resolve().then(()=>Gt).then(({ActionResolver:t})=>new t(i)),yi=i=>Promise.resolve().then(()=>Gt).then(({ComponentResolver:t})=>new t(i)),vi=i=>Promise.resolve().then(()=>Gt).then(()=>gi(i.get("$widget"))),zt="$settings",Bt="open",$e="activeStickyWidget";class bi extends ds{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(n=>{const{activate:r}=n;(typeof r>"u"||r===null||r===!0)&&(this.activated=(this.activated||this.widget.activate()).then(()=>this.attach(s)))})},this.container.registerAsync("storage",()=>mi(this.container)),this.container.registerFactory("settings",()=>O(this.container,zt,f.Local).then((e={})=>({...this.container.get("$settings"),...e}))),as(this,"load",this.handleBootstrapping),this.container.registerAsync("componentResolver",()=>yi(this.container)),this.container.registerAsync("actionResolver",()=>fi(this.container)),this.container.register("matchMedia",window.matchMedia),this.container.registerAsync("components",()=>vi(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:n},r])=>(s.subscribe(this.widget.name,(h,c,l)=>this.onAction(c,l)),(h=>{n.nodes.query({type:"view"}).forEach(c=>{n.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:n=ot(),triggerDOMElement:r,withRenderState:o}=t,h=qe(e)===U.Inline&&((r==null?void 0:r.childElementCount)||0)>0,c=await li(this.container,this.widget.name,s,r,e,h);this.outlets.size<1&&!o&&this.setRenderState("unset");const l=()=>{const g=()=>b.querySelectorAll("[data-loading=true]").length===0,[b]=this.widget.container.get("widgetDOMElements"),x=(kt,$)=>{g()&&(c.callback&&c.callback(),$.disconnect())},ht={attributes:!0,subtree:!0,childList:!0};g()&&c.callback&&c.callback(),new MutationObserver(x).observe(b,ht)};h&&this.widget.container.getAsync("dataClient").then(({events:g})=>{g.subscribe("data-client:fetched",(b,x)=>{x.unresolvedQueries===0&&l()})});const d=this.getOrCreateViewOutlet(n,c);if(this.outlets.set(n,d),this.widget.events.dispatch("widget:attached",{},{bubbles:!0}),c.triggerType===U.Badge&&e&&((u=c.triggerDOMElement)==null||u.setAttribute("aria-expanded","false"),d==null||d.renderBadge(e)),c.triggerType!==U.Inline&&((p=c.triggerDOMElement)==null||p.addEventListener("click",g=>{g.preventDefault(),this.container.get("settings").then(({trigger:b})=>{d.render().then(()=>this.renderState()).then(x=>b&&b.action&&b.action==="hide"?x===w.open?this.hide():this.open():x===w.open?this.close():this.open())})})),this.outlets.size>1)return this.renderState().then(g=>{this.triggerStateIfApplicable(g)});if(o)return o==="storage"?this.renderState().then(g=>{if(c.triggerType===U.Inline){this.triggerStateIfApplicable("open");return}this.triggerStateIfApplicable(g)}):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 ui(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"),P(this.container,zt,m.Necessary,{medium:f.Local})]).then(([e,s])=>Promise.resolve(t(e)).then(n=>s(n).then(()=>{const r={...e,...n};return this.widget.events.dispatch("widget:settings-updated",r),r})))}clearSettings(){return P(this.container,zt,m.Necessary,{medium:f.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 O(this.container,Bt,f.Session).then((e=w.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"?w.open:t==="close"?w.closed:w.hidden;return this.setRenderState(s).then(()=>{this.setTriggerState(s===w.open),s!==w.hidden?s===w.open?this.onOpen():this.onClose():this.outlets.forEach(n=>{var r;return(r=n.options.triggerDOMElement)==null?void 0:r.setAttribute("aria-expanded","false")})})}}setRenderState(t){const{invoke:e,events:s}=this.container.get("$widget");return Promise.all([P(this.container,Bt,m.Necessary,{medium:f.Session}),P(this.container,Bt,m.Necessary,{medium:f.Local,duration:{minutes:5}}),e("renderState")]).then(([n,r,o])=>{t==="unset"||!t?(r(),n()):n(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:n}=this.container.get("$settings");return s.activate!==n?this.setSettings(()=>Promise.resolve({activate:n})):Promise.resolve()}).then(()=>t).then(({components:s})=>{this.outlets.forEach(n=>{var r;return(r=n.options.triggerDOMElement)==null?void 0:r.setAttribute("aria-expanded","false")})})}setTriggerState(t){this.outlets.forEach(e=>{const{options:{triggerDOMElement:s,triggerOptions:n}}=e,{openTooltip:r,closedTooltip:o}=n||{};s&&(t?Ie(s,r):js(s,o))})}deactivate(){this.subs.forEach(e=>e());const t=[];return this.outlets.forEach(e=>t.push(e.dispose())),O(this.container,$e,f.Local).then(e=>e===this.widget.name?P(this.container,$e,m.Necessary,{medium:f.Local,scope:Y.Implementation}).then(s=>s()).then(()=>Promise.all(t)):Promise.all(t))}}/**
|
|
162
|
+
`];let L=re;ct([F({attribute:!1})],L.prototype,"symbol");ct([F({attribute:!1})],L.prototype,"container");ct([C()],L.prototype,"active");ct([C()],L.prototype,"loaded");ct([C()],L.prototype,"icon");var U=(i=>(i.Inline="inline",i.Link="link",i.Badge="badge",i.Unsupported="unsupported",i))(U||{});const hi=(i,t)=>i&&t?"both":i?"widgetDOM":t?"triggerDOM":"none",qe=i=>i?typeof i=="boolean"&&i?"link":typeof i=="object"&&!Array.isArray(i)?"badge":"unsupported":"inline",li=async(i,t,e,s,n,r=!1)=>{var l,d;const o=hi(e,s),a=qe(n),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",L);const p=document.createElement("ace-widget-trigger");p.symbol=n.symbol,p.container=i,document.body.appendChild(p),console.log("Created trigger"),c.triggerDOMElement=p}break}}return c},di="modals";class ui{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 n=t.get("widgetDOMElements")||[];t.register("widgetDOMElements",[...n,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===U.Badge&&Us(e),Promise.resolve().then(()=>require("./render-CnvP9v-3.js")).then(n=>n.default(this.container,t)).then(()=>{if(t.setAttribute("data-rendered","true"),e&&this.options.triggerType===U.Badge){const r=this.options.triggerOptions.openTooltip;Ie(e,r)}gs(this.container,t);const n=this.container.get("$environment").widgets.all();O(this.container,di,f.Session).then(r=>{r&&r.forEach(o=>{n.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:n,symbol:r,ariaLabel:o,closedTooltip:a,openTooltip:h}=t,c={closedTooltip:a,openTooltip:h};this.options.triggerOptions=c;const l=Ts(e,{label:n,ariaLabel:o,widgetName:s,tooltip:a});this.unsubscribe.push(l)}async dispose(){var s,n,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&&((n=t.parentNode)==null||n.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",pi=i=>{const t={tags:i.tags};return i.context&&typeof i.context!="function"&&(t.context=i.context),i.properties&&typeof i.properties!="function"&&(t.properties=i.properties),i.layout&&typeof i.layout!="function"&&(t.layout=i.layout),t};class ne{constructor(t,e){this.container=t,this.storageWriter=e}static create(t){return P(t,ut,m.Necessary,{medium:f.Local}).then(e=>new ne(t,e))}write(t,e,s,n){return A(this)(()=>O(this.container,ut,f.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:n,attributes:pi(s),rules:e.rules},this.storageWriter({keys:o,items:a})}))}remove(t){return A(this)(()=>O(this.container,ut,f.Local).then((e={})=>{const{keys:s=[],items:n={}}=e,r=s.indexOf(t);if(r>-1)return s.splice(r,1),delete n[t],this.storageWriter(e)}))}load(t){return A(this)(()=>O(this.container,ut,f.Local).then((e={})=>{const{keys:s=[],items:n={}}=e;s.forEach(r=>{const o=n[r];if(o){const{rules:a,attributes:h,options:c}=o;t.write({attributes:h,options:c,target:new K(t,a)})}})}))}}const gi=i=>{const{container:t}=i;return ne.create(t).then(e=>{const s=t.get("$settings"),n={localStorage:e},r=new G(i,n),o=Ne(r,s);return i.events.subscribe("widget:state-change",(a,h)=>{h.state===Ce.Deactivating&&o()}),r})},mi=i=>Promise.resolve().then(()=>Is).then(({StorageProvider:t})=>new t),fi=i=>Promise.resolve().then(()=>Gt).then(({ActionResolver:t})=>new t(i)),yi=i=>Promise.resolve().then(()=>Gt).then(({ComponentResolver:t})=>new t(i)),vi=i=>Promise.resolve().then(()=>Gt).then(()=>gi(i.get("$widget"))),zt="$settings",Bt="open",$e="activeStickyWidget";class bi extends ds{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(n=>{const{activate:r}=n;(typeof r>"u"||r===null||r===!0)&&(this.activated=(this.activated||this.widget.activate()).then(()=>this.attach(s)))})},this.container.registerAsync("storage",()=>mi(this.container)),this.container.registerFactory("settings",()=>O(this.container,zt,f.Local).then((e={})=>({...this.container.get("$settings"),...e}))),as(this,"load",this.handleBootstrapping),this.container.registerAsync("componentResolver",()=>yi(this.container)),this.container.registerAsync("actionResolver",()=>fi(this.container)),this.container.register("matchMedia",window.matchMedia),this.container.registerAsync("components",()=>vi(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:n},r])=>(s.subscribe(this.widget.name,(h,c,l)=>this.onAction(c,l)),(h=>{n.nodes.query({type:"view"}).forEach(c=>{n.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:n=ot(),triggerDOMElement:r,withRenderState:o}=t,h=qe(e)===U.Inline&&((r==null?void 0:r.childElementCount)||0)>0,c=await li(this.container,this.widget.name,s,r,e,h);this.outlets.size<1&&!o&&this.setRenderState("unset");const l=()=>{const g=()=>b.querySelectorAll("[data-loading=true]").length===0,[b]=this.widget.container.get("widgetDOMElements"),x=(kt,$)=>{g()&&(c.callback&&c.callback(),$.disconnect())},ht={attributes:!0,subtree:!0,childList:!0};g()&&c.callback&&c.callback(),new MutationObserver(x).observe(b,ht)};h&&this.widget.container.getAsync("dataClient").then(({events:g})=>{g.subscribe("data-client:fetched",(b,x)=>{x.unresolvedQueries===0&&l()})});const d=this.getOrCreateViewOutlet(n,c);if(this.outlets.set(n,d),this.widget.events.dispatch("widget:attached",{},{bubbles:!0}),c.triggerType===U.Badge&&e&&((u=c.triggerDOMElement)==null||u.setAttribute("aria-expanded","false"),d==null||d.renderBadge(e)),c.triggerType!==U.Inline&&((p=c.triggerDOMElement)==null||p.addEventListener("click",g=>{g.preventDefault(),this.container.get("settings").then(({trigger:b})=>{d.render().then(()=>this.renderState()).then(x=>b&&b.action&&b.action==="hide"?x===w.open?this.hide():this.open():x===w.open?this.close():this.open())})})),this.outlets.size>1)return this.renderState().then(g=>{this.triggerStateIfApplicable(g)});if(o)return o==="storage"?this.renderState().then(g=>{if(c.triggerType===U.Inline){this.triggerStateIfApplicable("open");return}this.triggerStateIfApplicable(g)}):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 ui(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"),P(this.container,zt,m.Necessary,{medium:f.Local})]).then(([e,s])=>Promise.resolve(t(e)).then(n=>s(n).then(()=>{const r={...e,...n};return this.widget.events.dispatch("widget:settings-updated",r),r})))}clearSettings(){return P(this.container,zt,m.Necessary,{medium:f.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 O(this.container,Bt,f.Session).then((e=w.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"?w.open:t==="close"?w.closed:w.hidden;return this.setRenderState(s).then(()=>{this.setTriggerState(s===w.open),s!==w.hidden?s===w.open?this.onOpen():this.onClose():this.outlets.forEach(n=>{var r;return(r=n.options.triggerDOMElement)==null?void 0:r.setAttribute("aria-expanded","false")})})}}setRenderState(t){const{invoke:e,events:s}=this.container.get("$widget");return Promise.all([P(this.container,Bt,m.Necessary,{medium:f.Session}),P(this.container,Bt,m.Necessary,{medium:f.Local,duration:{minutes:5}}),e("renderState")]).then(([n,r,o])=>{t==="unset"||!t?(r(),n()):n(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:n}=this.container.get("$settings");return s.activate!==n?this.setSettings(()=>Promise.resolve({activate:n})):Promise.resolve()}).then(()=>t).then(({components:s})=>{this.outlets.forEach(n=>{var r;return(r=n.options.triggerDOMElement)==null?void 0:r.setAttribute("aria-expanded","false")})})}setTriggerState(t){this.outlets.forEach(e=>{const{options:{triggerDOMElement:s,triggerOptions:n}}=e,{openTooltip:r,closedTooltip:o}=n||{};s&&(t?Ie(s,r):js(s,o))})}deactivate(){this.subs.forEach(e=>e());const t=[];return this.outlets.forEach(e=>t.push(e.dispose())),O(this.container,$e,f.Local).then(e=>e===this.widget.name?P(this.container,$e,m.Necessary,{medium:f.Local,scope:Y.Implementation}).then(s=>s()).then(()=>Promise.all(t)):Promise.all(t))}}/**
|
|
163
163
|
* @license
|
|
164
164
|
* Copyright 2021 Google LLC
|
|
165
165
|
* SPDX-License-Identifier: BSD-3-Clause
|
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-DsLT1MGa.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 { A 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, s as x, u as p, k as l, p as W, q as g } from "./index-
|
|
1
|
+
import { A 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, s as x, u as p, k as l, p as W, q as g } from "./index-DMDO5Zga.mjs";
|
|
2
2
|
export {
|
|
3
3
|
a as ActionsController,
|
|
4
4
|
o as DataProvider,
|
package/package.json
CHANGED
|
@@ -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-DsLT1MGa.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;let O=class{};const v=new WeakMap,L=r.e(class extends C{render(t){return r.E}update(t,[e]){var n;const s=e!==this.G;return s&&this.G!==void 0&&this.rt(void 0),(s||this.lt!==this.ct)&&(this.G=e,this.ht=(n=t.options)==null?void 0:n.host,this.rt(this.ct=t.element)),r.E}rt(t){if(this.isConnected||(t=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let s=v.get(e);s===void 0&&(s=new WeakMap,v.set(e,s)),s.get(this.G)!==void 0&&this.G.call(this.ht,void 0),s.set(this.G,t),t!==void 0&&this.G.call(this.ht,t)}else this.G.value=t}get lt(){var t,e;return typeof this.G=="function"?(t=v.get(this.ht??globalThis))==null?void 0:t.get(this.G):(e=this.G)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),E=async t=>await t.get("$widget").invoke("renderState"),D=async(t,e)=>{const s=t.get("$widget");return(await t.getAsync("actionResolver")).subscribe(s.name,e)},M=(t,e,s=!1)=>{const n=t.reduce((a,{breakpoints:c=[],values:l})=>c.length?e.some(g=>c.includes(g))?{...a,...l}:a:{...a,...l},{}),i={},o=n.type;return i.height=n.height||"",i.width=n.width||"",n.type==="floating"||n.type==="inline"&&s&&(i.height="calc(100vh - 120px)"),{type:o,styles:i}};var T=Object.defineProperty,z=Object.getOwnPropertyDescriptor,d=(t,e,s,n)=>{for(var i=n>1?void 0:n?z(e,s):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=(n?a(e,s,i):a(i))||i);return n&&i&&T(e,s,i),i};let h=class extends r.i$1{constructor(){super(),this._provider=new r.i$2(this,r.containerContext,void 0),this.wrapperRef=G(),this.breakpoints=[],this.breakpointsSet=!1}connectedCallback(){super.connectedCallback(),this._provider.setValue(this.container),this.container&&(E(this.container).then(t=>{this.renderState=t}),D(this.container,(t,e)=>{switch(e){case"close":case"open":this.renderState=e==="open"?r.ot.open:r.ot.closed;break;case"hide":this.renderState=r.ot.hidden}}).then(t=>{this._unsubscribeRenderState=t}),r.et.getInstance(this.container).then(t=>{this.componentPlatform=t,this.breakpoints=this.componentPlatform.breakpoints,this.breakpointsSet=!0,this._unsubscribePropChange=this.componentPlatform.events.subscribe("components:properties-changed",(e,s)=>{var n,i;((n=s==null?void 0:s.node)==null?void 0:n.type)==="root"&&(this.breakpoints=(i=this.componentPlatform)!=null&&i.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()}applyBranding(){var t;if(this.wrapperRef.value){const e=(t=this.container)==null?void 0:t.get("$settings");e!=null&&e.branding&&r.mapBranding(e.branding,this.wrapperRef.value)}}render(){var e,s,n,i;let t;if(!this.entry||!this.breakpointsSet)return r.E;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&&(t=M(o.layout,this.breakpoints,!!o.trigger),t.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(t.styles).forEach(([a,c])=>{this.renderRoot.host.style.setProperty(a,c)}))}return this.renderState&&(this.renderState===r.ot.hidden?((e=this.wrapperRef.value)==null||e.classList.add("hidden"),(s=this.wrapperRef.value)==null||s.classList.remove("expanded")):((n=this.wrapperRef.value)==null||n.classList.remove("hidden"),(i=this.wrapperRef.value)==null||i.classList.add("expanded"))),this.applyBranding(),r.x`
|
|
17
|
+
*/const G=()=>new O;let O=class{};const v=new WeakMap,L=r.e(class extends C{render(t){return r.E}update(t,[e]){var n;const s=e!==this.G;return s&&this.G!==void 0&&this.rt(void 0),(s||this.lt!==this.ct)&&(this.G=e,this.ht=(n=t.options)==null?void 0:n.host,this.rt(this.ct=t.element)),r.E}rt(t){if(this.isConnected||(t=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let s=v.get(e);s===void 0&&(s=new WeakMap,v.set(e,s)),s.get(this.G)!==void 0&&this.G.call(this.ht,void 0),s.set(this.G,t),t!==void 0&&this.G.call(this.ht,t)}else this.G.value=t}get lt(){var t,e;return typeof this.G=="function"?(t=v.get(this.ht??globalThis))==null?void 0:t.get(this.G):(e=this.G)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),E=async t=>await t.get("$widget").invoke("renderState"),D=async(t,e)=>{const s=t.get("$widget");return(await t.getAsync("actionResolver")).subscribe(s.name,e)},M=(t,e,s=!1)=>{const n=t.reduce((a,{breakpoints:c=[],values:l})=>c.length?e.some(g=>c.includes(g))?{...a,...l}:a:{...a,...l},{}),i={},o=n.type;return i.height=n.height||"",i.width=n.width||"",n.type==="floating"||n.type==="inline"&&s&&(i.height="calc(100vh - 120px)"),{type:o,styles:i}};var T=Object.defineProperty,z=Object.getOwnPropertyDescriptor,d=(t,e,s,n)=>{for(var i=n>1?void 0:n?z(e,s):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=(n?a(e,s,i):a(i))||i);return n&&i&&T(e,s,i),i};let h=class extends r.i$1{constructor(){super(),this._provider=new r.i$2(this,r.containerContext,void 0),this.wrapperRef=G(),this.breakpoints=[],this.breakpointsSet=!1}connectedCallback(){super.connectedCallback(),this._provider.setValue(this.container),this.container&&(E(this.container).then(t=>{this.renderState=t}),D(this.container,(t,e)=>{switch(e){case"close":case"open":this.renderState=e==="open"?r.ot.open:r.ot.closed;break;case"hide":this.renderState=r.ot.hidden}}).then(t=>{this._unsubscribeRenderState=t}),r.et.getInstance(this.container).then(t=>{this.componentPlatform=t,this.breakpoints=this.componentPlatform.breakpoints,this.breakpointsSet=!0,this._unsubscribePropChange=this.componentPlatform.events.subscribe("components:properties-changed",(e,s)=>{var n,i;((n=s==null?void 0:s.node)==null?void 0:n.type)==="root"&&(this.breakpoints=(i=this.componentPlatform)!=null&&i.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()}applyBranding(){var t;if(this.wrapperRef.value){const e=(t=this.container)==null?void 0:t.get("$settings");e!=null&&e.branding&&r.mapBranding(e.branding,this.wrapperRef.value)}}render(){var e,s,n,i;let t;if(!this.entry||!this.breakpointsSet)return r.E;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&&(t=M(o.layout,this.breakpoints,!!o.trigger),t.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(t.styles).forEach(([a,c])=>{this.renderRoot.host.style.setProperty(a,c)}))}return this.renderState&&(this.renderState===r.ot.hidden?((e=this.wrapperRef.value)==null||e.classList.add("ace-hidden"),(s=this.wrapperRef.value)==null||s.classList.remove("ace-expanded")):((n=this.wrapperRef.value)==null||n.classList.remove("ace-hidden"),(i=this.wrapperRef.value)==null||i.classList.add("ace-expanded"))),this.applyBranding(),r.x`
|
|
18
18
|
<div class="widget-container" ${L(this.wrapperRef)}>
|
|
19
19
|
<ace-area entry=${this.entry}></ace-area>
|
|
20
20
|
</div>
|
|
@@ -68,11 +68,11 @@
|
|
|
68
68
|
background-color: var(--primary-background);
|
|
69
69
|
padding: 0 var(--spacing-sm);
|
|
70
70
|
}
|
|
71
|
-
.widget-container.expanded {
|
|
71
|
+
.widget-container.ace-expanded {
|
|
72
72
|
opacity: 1;
|
|
73
73
|
animation: slideUp 0.5s;
|
|
74
74
|
}
|
|
75
|
-
.widget-container.hidden {
|
|
75
|
+
.widget-container.ace-hidden {
|
|
76
76
|
opacity: 0;
|
|
77
77
|
animation: slideDown 0.5s;
|
|
78
78
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as L, t as D, e as A, E as b, a as P, b as z, c as E, d as M, m as Y, o as f, x as g, f as R, n as N, r as u, T as w, W as T, g as j } from "./index-
|
|
1
|
+
import { i as L, t as D, e as A, E as b, a as P, b as z, c as E, d as M, m as Y, o as f, x as g, f as R, n as N, r as u, T as w, W as T, g as j } from "./index-DMDO5Zga.mjs";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2017 Google LLC
|
|
@@ -185,7 +185,7 @@ let c = class extends P {
|
|
|
185
185
|
this.renderRoot.host.style.setProperty(o, a);
|
|
186
186
|
}));
|
|
187
187
|
}
|
|
188
|
-
return this.renderState && (this.renderState === f.hidden ? ((e = this.wrapperRef.value) == null || e.classList.add("hidden"), (s = this.wrapperRef.value) == null || s.classList.remove("expanded")) : ((n = this.wrapperRef.value) == null || n.classList.remove("hidden"), (i = this.wrapperRef.value) == null || i.classList.add("expanded"))), this.applyBranding(), g`
|
|
188
|
+
return this.renderState && (this.renderState === f.hidden ? ((e = this.wrapperRef.value) == null || e.classList.add("ace-hidden"), (s = this.wrapperRef.value) == null || s.classList.remove("ace-expanded")) : ((n = this.wrapperRef.value) == null || n.classList.remove("ace-hidden"), (i = this.wrapperRef.value) == null || i.classList.add("ace-expanded"))), this.applyBranding(), g`
|
|
189
189
|
<div class="widget-container" ${U(this.wrapperRef)}>
|
|
190
190
|
<ace-area entry=${this.entry}></ace-area>
|
|
191
191
|
</div>
|
|
@@ -242,11 +242,11 @@ c.styles = R`
|
|
|
242
242
|
background-color: var(--primary-background);
|
|
243
243
|
padding: 0 var(--spacing-sm);
|
|
244
244
|
}
|
|
245
|
-
.widget-container.expanded {
|
|
245
|
+
.widget-container.ace-expanded {
|
|
246
246
|
opacity: 1;
|
|
247
247
|
animation: slideUp 0.5s;
|
|
248
248
|
}
|
|
249
|
-
.widget-container.hidden {
|
|
249
|
+
.widget-container.ace-hidden {
|
|
250
250
|
opacity: 0;
|
|
251
251
|
animation: slideDown 0.5s;
|
|
252
252
|
}
|