@telia-ace/widget-core-flamingo 1.1.55-rc.5 → 1.1.55-rc.7
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +6 -6
- package/index.mjs +41 -30
- package/models/application.d.ts +2 -1
- package/models/environment.d.ts +1 -1
- package/package.json +1 -1
- package/services/storage.service.d.ts +3 -0
package/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var ft=function(r,t){return ft=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])},ft(r,t)};function D(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");ft(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function gt(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],i=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Y(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var i=e.call(r),s,n=[],o;try{for(;(t===void 0||t-- >0)&&!(s=i.next()).done;)n.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return n}function
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var ft=function(r,t){return ft=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])},ft(r,t)};function D(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");ft(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function gt(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],i=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Y(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var i=e.call(r),s,n=[],o;try{for(;(t===void 0||t-- >0)&&!(s=i.next()).done;)n.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return n}function K(r,t,e){if(e||arguments.length===2)for(var i=0,s=t.length,n;i<s;i++)(n||!(i in t))&&(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return r.concat(n||Array.prototype.slice.call(t))}function b(r){return typeof r=="function"}function Kt(r){var t=function(i){Error.call(i),i.stack=new Error().stack},e=r(t);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var nt=Kt(function(r){return function(e){r(this),this.message=e?e.length+` errors occurred during unsubscription:
|
2
2
|
`+e.map(function(i,s){return s+1+") "+i.toString()}).join(`
|
3
|
-
`):"",this.name="UnsubscriptionError",this.errors=e}});function mt(r,t){if(r){var e=r.indexOf(t);0<=e&&r.splice(e,1)}}var tt=function(){function r(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var t,e,i,s,n;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=gt(o),c=a.next();!c.done;c=a.next()){var l=c.value;l.remove(this)}}catch(v){t={error:v}}finally{try{c&&!c.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else o.remove(this);var h=this.initialTeardown;if(b(h))try{h()}catch(v){n=v instanceof nt?v.errors:[v]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var f=gt(p),u=f.next();!u.done;u=f.next()){var g=u.value;try{Et(g)}catch(v){n=n??[],v instanceof nt?n=
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=e}});function mt(r,t){if(r){var e=r.indexOf(t);0<=e&&r.splice(e,1)}}var tt=function(){function r(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var t,e,i,s,n;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=gt(o),c=a.next();!c.done;c=a.next()){var l=c.value;l.remove(this)}}catch(v){t={error:v}}finally{try{c&&!c.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else o.remove(this);var h=this.initialTeardown;if(b(h))try{h()}catch(v){n=v instanceof nt?v.errors:[v]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var f=gt(p),u=f.next();!u.done;u=f.next()){var g=u.value;try{Et(g)}catch(v){n=n??[],v instanceof nt?n=K(K([],Y(n)),Y(v.errors)):n.push(v)}}}catch(v){i={error:v}}finally{try{u&&!u.done&&(s=f.return)&&s.call(f)}finally{if(i)throw i.error}}}if(n)throw new nt(n)}},r.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)Et(t);else{if(t instanceof r){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},r.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},r.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},r.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&mt(e,t)},r.prototype.remove=function(t){var e=this._finalizers;e&&mt(e,t),t instanceof r&&t._removeParent(this)},r.EMPTY=function(){var t=new r;return t.closed=!0,t}(),r}(),Zt=tt.EMPTY;function Jt(r){return r instanceof tt||r&&"closed"in r&&b(r.remove)&&b(r.add)&&b(r.unsubscribe)}function Et(r){b(r)?r():r.unsubscribe()}var Xt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},vt={setTimeout:function(r,t){for(var e=[],i=2;i<arguments.length;i++)e[i-2]=arguments[i];var s=vt.delegate;return s!=null&&s.setTimeout?s.setTimeout.apply(s,K([r,t],Y(e))):setTimeout.apply(void 0,K([r,t],Y(e)))},clearTimeout:function(r){var t=vt.delegate;return((t==null?void 0:t.clearTimeout)||clearTimeout)(r)},delegate:void 0};function we(r){vt.setTimeout(function(){throw r})}function Ot(){}function q(r){r()}var Qt=function(r){D(t,r);function t(e){var i=r.call(this)||this;return i.isStopped=!1,e?(i.destination=e,Jt(e)&&e.add(i)):i.destination=xe,i}return t.create=function(e,i,s){return new yt(e,i,s)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(tt),Ae=Function.prototype.bind;function ot(r,t){return Ae.call(r,t)}var Ce=function(){function r(t){this.partialObserver=t}return r.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(i){F(i)}},r.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(i){F(i)}else F(t)},r.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){F(e)}},r}(),yt=function(r){D(t,r);function t(e,i,s){var n=r.call(this)||this,o;if(b(e)||!e)o={next:e??void 0,error:i??void 0,complete:s??void 0};else{var a;n&&Xt.useDeprecatedNextContext?(a=Object.create(e),a.unsubscribe=function(){return n.unsubscribe()},o={next:e.next&&ot(e.next,a),error:e.error&&ot(e.error,a),complete:e.complete&&ot(e.complete,a)}):o=e}return n.destination=new Ce(o),n}return t}(Qt);function F(r){we(r)}function Se(r){throw r}var xe={closed:!0,next:Ot,error:Se,complete:Ot},Ee=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Oe(r){return r}function Pe(r){return r.length===0?Oe:r.length===1?r[0]:function(e){return r.reduce(function(i,s){return s(i)},e)}}var Pt=function(){function r(t){t&&(this._subscribe=t)}return r.prototype.lift=function(t){var e=new r;return e.source=this,e.operator=t,e},r.prototype.subscribe=function(t,e,i){var s=this,n=Re(t)?t:new yt(t,e,i);return q(function(){var o=s,a=o.operator,c=o.source;n.add(a?a.call(n,c):c?s._subscribe(n):s._trySubscribe(n))}),n},r.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},r.prototype.forEach=function(t,e){var i=this;return e=Tt(e),new e(function(s,n){var o=new yt({next:function(a){try{t(a)}catch(c){n(c),o.unsubscribe()}},error:n,complete:s});i.subscribe(o)})},r.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},r.prototype[Ee]=function(){return this},r.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Pe(t)(this)},r.prototype.toPromise=function(t){var e=this;return t=Tt(t),new t(function(i,s){var n;e.subscribe(function(o){return n=o},function(o){return s(o)},function(){return i(n)})})},r.create=function(t){return new r(t)},r}();function Tt(r){var t;return(t=r??Xt.Promise)!==null&&t!==void 0?t:Promise}function Te(r){return r&&b(r.next)&&b(r.error)&&b(r.complete)}function Re(r){return r&&r instanceof Qt||Te(r)&&Jt(r)}var Ue=Kt(function(r){return function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),te=function(r){D(t,r);function t(){var e=r.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return t.prototype.lift=function(e){var i=new Rt(this,this);return i.operator=e,i},t.prototype._throwIfClosed=function(){if(this.closed)throw new Ue},t.prototype.next=function(e){var i=this;q(function(){var s,n;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var o=gt(i.currentObservers),a=o.next();!a.done;a=o.next()){var c=a.value;c.next(e)}}catch(l){s={error:l}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(s)throw s.error}}}})},t.prototype.error=function(e){var i=this;q(function(){if(i._throwIfClosed(),!i.isStopped){i.hasError=i.isStopped=!0,i.thrownError=e;for(var s=i.observers;s.length;)s.shift().error(e)}})},t.prototype.complete=function(){var e=this;q(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var i=e.observers;i.length;)i.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return((e=this.observers)===null||e===void 0?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(e){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,e)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var i=this,s=this,n=s.hasError,o=s.isStopped,a=s.observers;return n||o?Zt:(this.currentObservers=null,a.push(e),new tt(function(){i.currentObservers=null,mt(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var i=this,s=i.hasError,n=i.thrownError,o=i.isStopped;s?e.error(n):o&&e.complete()},t.prototype.asObservable=function(){var e=new Pt;return e.source=this,e},t.create=function(e,i){return new Rt(e,i)},t}(Pt),Rt=function(r){D(t,r);function t(e,i){var s=r.call(this)||this;return s.destination=e,s.source=i,s}return t.prototype.next=function(e){var i,s;(s=(i=this.destination)===null||i===void 0?void 0:i.next)===null||s===void 0||s.call(i,e)},t.prototype.error=function(e){var i,s;(s=(i=this.destination)===null||i===void 0?void 0:i.error)===null||s===void 0||s.call(i,e)},t.prototype.complete=function(){var e,i;(i=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||i===void 0||i.call(e)},t.prototype._subscribe=function(e){var i,s;return(s=(i=this.source)===null||i===void 0?void 0:i.subscribe(e))!==null&&s!==void 0?s:Zt},t}(te),Ie=function(r){D(t,r);function t(e){var i=r.call(this)||this;return i._value=e,i}return Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(e){var i=r.prototype._subscribe.call(this,e);return!i.closed&&e.next(this._value),i},t.prototype.getValue=function(){var e=this,i=e.hasError,s=e.thrownError,n=e._value;if(i)throw s;return this._throwIfClosed(),n},t.prototype.next=function(e){r.prototype.next.call(this,this._value=e)},t}(te),ee=(r=>(r.Loading="loading",r.Ready="ready",r))(ee||{});class bt{constructor(t,e){this.state=new Ie("loading"),this.resolvers=new Map,this.name=t,this.environment=e,this.state.next("ready")}setState(t){this.state.next(t)}async register(t,e){this.resolvers.set(t,e)}async get(t){return this.resolvers.get(t)}}/**
|
4
4
|
* @license
|
5
5
|
* Copyright 2019 Google LLC
|
6
6
|
* SPDX-License-Identifier: BSD-3-Clause
|
@@ -8,13 +8,13 @@
|
|
8
8
|
* @license
|
9
9
|
* Copyright 2017 Google LLC
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
11
|
-
*/const{is:Ne,defineProperty:je,getOwnPropertyDescriptor:Le,getOwnPropertyNames:He,getOwnPropertySymbols:Be,getPrototypeOf:De}=Object,A=globalThis,kt=A.trustedTypes,ze=kt?kt.emptyScript:"",at=A.reactiveElementPolyfillSupport,M=(r,t)=>r,
|
11
|
+
*/const{is:Ne,defineProperty:je,getOwnPropertyDescriptor:Le,getOwnPropertyNames:He,getOwnPropertySymbols:Be,getPrototypeOf:De}=Object,A=globalThis,kt=A.trustedTypes,ze=kt?kt.emptyScript:"",at=A.reactiveElementPolyfillSupport,M=(r,t)=>r,Z={toAttribute(r,t){switch(t){case Boolean:r=r?ze:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},wt=(r,t)=>!Ne(r,t),Mt={attribute:!0,type:String,converter:Z,reflect:!1,hasChanged:wt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),A.litPropertyMetadata??(A.litPropertyMetadata=new WeakMap);let P=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Mt){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);s!==void 0&&je(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:n}=Le(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return s==null?void 0:s.call(this)},set(o){const a=s==null?void 0:s.call(this);n.call(this,o),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Mt}static _$Ei(){if(this.hasOwnProperty(M("elementProperties")))return;const t=De(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(M("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(M("properties"))){const e=this.properties,i=[...He(e),...Be(e)];for(const s of i)this.createProperty(s,e[s])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[i,s]of e)this.elementProperties.set(i,s)}this._$Eh=new Map;for(const[e,i]of this.elementProperties){const s=this._$Eu(e,i);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const s of i)e.unshift(It(s))}else t!==void 0&&e.push(It(t));return e}static _$Eu(t,e){const i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$Eg=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$ES??(this._$ES=[])).push(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$ES)==null||e.splice(this._$ES.indexOf(t)>>>0,1)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Me(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)==null||t.forEach(e=>{var i;return(i=e.hostConnected)==null?void 0:i.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)==null||t.forEach(e=>{var i;return(i=e.hostDisconnected)==null?void 0:i.call(e)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e){var n;const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(s!==void 0&&i.reflect===!0){const o=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:Z).toAttribute(e,i.type);this._$Em=t,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,e){var n;const i=this.constructor,s=i._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const o=i.getPropertyOptions(s),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:Z;this._$Em=s,this[s]=a.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,i,s=!1,n){if(t!==void 0){if(i??(i=this.constructor.getPropertyOptions(t)),!(i.hasChanged??wt)(s?n:this[t],e))return;this.C(t,e,i)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(t,e,i){this._$AL.has(t)||this._$AL.set(t,e),i.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[n,o]of s)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.C(n,this[n],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(i=this._$ES)==null||i.forEach(s=>{var n;return(n=s.hostUpdate)==null?void 0:n.call(s)}),this.update(e)):this._$ET()}catch(s){throw t=!1,this._$ET(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)==null||e.forEach(i=>{var s;return(s=i.hostUpdated)==null?void 0:s.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EO(e,this[e]))),this._$ET()}updated(t){}firstUpdated(t){}};P.elementStyles=[],P.shadowRootOptions={mode:"open"},P[M("elementProperties")]=new Map,P[M("finalized")]=new Map,at==null||at({ReactiveElement:P}),(A.reactiveElementVersions??(A.reactiveElementVersions=[])).push("2.0.1");/**
|
12
12
|
* @license
|
13
13
|
* Copyright 2017 Google LLC
|
14
14
|
* SPDX-License-Identifier: BSD-3-Clause
|
15
15
|
*/const N=globalThis,J=N.trustedTypes,Nt=J?J.createPolicy("lit-html",{createHTML:r=>r}):void 0,re="$lit$",w=`lit$${(Math.random()+"").slice(9)}$`,se="?"+w,We=`<${se}>`,E=document,L=()=>E.createComment(""),H=r=>r===null||typeof r!="object"&&typeof r!="function",ne=Array.isArray,Fe=r=>ne(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",ct=`[
|
16
16
|
\f\r]`,k=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,jt=/-->/g,Lt=/>/g,C=RegExp(`>|${ct}(?:([^\\s"'>=/]+)(${ct}*=${ct}*(?:[^
|
17
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ht=/'/g,Bt=/"/g,oe=/^(?:script|style|textarea|title)$/i,Ge=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),T=Ge(1),O=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Dt=new WeakMap,x=E.createTreeWalker(E,129);function ae(r,t){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Nt!==void 0?Nt.createHTML(t):t}const qe=(r,t)=>{const e=r.length-1,i=[];let s,n=t===2?"<svg>":"",o=k;for(let a=0;a<e;a++){const c=r[a];let l,h,p=-1,f=0;for(;f<c.length&&(o.lastIndex=f,h=o.exec(c),h!==null);)f=o.lastIndex,o===k?h[1]==="!--"?o=jt:h[1]!==void 0?o=Lt:h[2]!==void 0?(oe.test(h[2])&&(s=RegExp("</"+h[2],"g")),o=C):h[3]!==void 0&&(o=C):o===C?h[0]===">"?(o=s??k,p=-1):h[1]===void 0?p=-2:(p=o.lastIndex-h[2].length,l=h[1],o=h[3]===void 0?C:h[3]==='"'?Bt:Ht):o===Bt||o===Ht?o=C:o===jt||o===Lt?o=k:(o=C,s=void 0);const u=o===C&&r[a+1].startsWith("/>")?" ":"";n+=o===k?c+We:p>=0?(i.push(l),c.slice(0,p)+re+c.slice(p)+w+u):c+w+(p===-2?a:u)}return[ae(r,n+(r[e]||"<?>")+(t===2?"</svg>":"")),i]};class B{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let n=0,o=0;const a=t.length-1,c=this.parts,[l,h]=qe(t,e);if(this.el=B.createElement(l,i),x.currentNode=this.el.content,e===2){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(s=x.nextNode())!==null&&c.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const p of s.getAttributeNames())if(p.endsWith(re)){const f=h[o++],u=s.getAttribute(p).split(w),g=/([.?@])?(.*)/.exec(f);c.push({type:1,index:n,name:g[2],strings:u,ctor:g[1]==="."?Ye:g[1]==="?"?
|
17
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ht=/'/g,Bt=/"/g,oe=/^(?:script|style|textarea|title)$/i,Ge=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),T=Ge(1),O=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Dt=new WeakMap,x=E.createTreeWalker(E,129);function ae(r,t){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Nt!==void 0?Nt.createHTML(t):t}const qe=(r,t)=>{const e=r.length-1,i=[];let s,n=t===2?"<svg>":"",o=k;for(let a=0;a<e;a++){const c=r[a];let l,h,p=-1,f=0;for(;f<c.length&&(o.lastIndex=f,h=o.exec(c),h!==null);)f=o.lastIndex,o===k?h[1]==="!--"?o=jt:h[1]!==void 0?o=Lt:h[2]!==void 0?(oe.test(h[2])&&(s=RegExp("</"+h[2],"g")),o=C):h[3]!==void 0&&(o=C):o===C?h[0]===">"?(o=s??k,p=-1):h[1]===void 0?p=-2:(p=o.lastIndex-h[2].length,l=h[1],o=h[3]===void 0?C:h[3]==='"'?Bt:Ht):o===Bt||o===Ht?o=C:o===jt||o===Lt?o=k:(o=C,s=void 0);const u=o===C&&r[a+1].startsWith("/>")?" ":"";n+=o===k?c+We:p>=0?(i.push(l),c.slice(0,p)+re+c.slice(p)+w+u):c+w+(p===-2?a:u)}return[ae(r,n+(r[e]||"<?>")+(t===2?"</svg>":"")),i]};class B{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let n=0,o=0;const a=t.length-1,c=this.parts,[l,h]=qe(t,e);if(this.el=B.createElement(l,i),x.currentNode=this.el.content,e===2){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(s=x.nextNode())!==null&&c.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const p of s.getAttributeNames())if(p.endsWith(re)){const f=h[o++],u=s.getAttribute(p).split(w),g=/([.?@])?(.*)/.exec(f);c.push({type:1,index:n,name:g[2],strings:u,ctor:g[1]==="."?Ye:g[1]==="?"?Ke:g[1]==="@"?Ze:et}),s.removeAttribute(p)}else p.startsWith(w)&&(c.push({type:6,index:n}),s.removeAttribute(p));if(oe.test(s.tagName)){const p=s.textContent.split(w),f=p.length-1;if(f>0){s.textContent=J?J.emptyScript:"";for(let u=0;u<f;u++)s.append(p[u],L()),x.nextNode(),c.push({type:2,index:++n});s.append(p[f],L())}}}else if(s.nodeType===8)if(s.data===se)c.push({type:2,index:n});else{let p=-1;for(;(p=s.data.indexOf(w,p+1))!==-1;)c.push({type:7,index:n}),p+=w.length-1}n++}}static createElement(t,e){const i=E.createElement("template");return i.innerHTML=t,i}}function R(r,t,e=r,i){var o,a;if(t===O)return t;let s=i!==void 0?(o=e._$Co)==null?void 0:o[i]:e._$Cl;const n=H(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==n&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),n===void 0?s=void 0:(s=new n(r),s._$AT(r,e,i)),i!==void 0?(e._$Co??(e._$Co=[]))[i]=s:e._$Cl=s),s!==void 0&&(t=R(r,s._$AS(r,t.values),s,i)),t}class Ve{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,s=((t==null?void 0:t.creationScope)??E).importNode(e,!0);x.currentNode=s;let n=x.nextNode(),o=0,a=0,c=i[0];for(;c!==void 0;){if(o===c.index){let l;c.type===2?l=new z(n,n.nextSibling,this,t):c.type===1?l=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(l=new Je(n,this,t)),this._$AV.push(l),c=i[++a]}o!==(c==null?void 0:c.index)&&(n=x.nextNode(),o++)}return x.currentNode=E,s}p(t){let e=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class z{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,i,s){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cv=(s==null?void 0:s.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=R(this,t,e),H(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==O&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):Fe(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==d&&H(this._$AH)?this._$AA.nextSibling.data=t:this.$(E.createTextNode(t)),this._$AH=t}g(t){var n;const{values:e,_$litType$:i}=t,s=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=B.createElement(ae(i.h,i.h[0]),this.options)),i);if(((n=this._$AH)==null?void 0:n._$AD)===s)this._$AH.p(e);else{const o=new Ve(s,this),a=o.u(this.options);o.p(e),this.$(a),this._$AH=o}}_$AC(t){let e=Dt.get(t.strings);return e===void 0&&Dt.set(t.strings,e=new B(t)),e}T(t){ne(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const n of t)s===e.length?e.push(i=new z(this.k(L()),this.k(L()),this,this.options)):i=e[s],i._$AI(n),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,e);t&&t!==this._$AB;){const s=t.nextSibling;t.remove(),t=s}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}}class et{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,n){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=d}_$AI(t,e=this,i,s){const n=this.strings;let o=!1;if(n===void 0)t=R(this,t,e,0),o=!H(t)||t!==this._$AH&&t!==O,o&&(this._$AH=t);else{const a=t;let c,l;for(t=n[0],c=0;c<n.length-1;c++)l=R(this,a[i+c],e,c),l===O&&(l=this._$AH[c]),o||(o=!H(l)||l!==this._$AH[c]),l===d?t=d:t!==d&&(t+=(l??"")+n[c+1]),this._$AH[c]=l}o&&!s&&this.O(t)}O(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Ye extends et{constructor(){super(...arguments),this.type=3}O(t){this.element[this.name]=t===d?void 0:t}}class Ke extends et{constructor(){super(...arguments),this.type=4}O(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}}class Ze extends et{constructor(t,e,i,s,n){super(t,e,i,s,n),this.type=5}_$AI(t,e=this){if((t=R(this,t,e,0)??d)===O)return;const i=this._$AH,s=t===d&&i!==d||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,n=t!==d&&(i===d||s);s&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class Je{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){R(this,t)}}const lt=N.litHtmlPolyfillSupport;lt==null||lt(B,z),(N.litHtmlVersions??(N.litHtmlVersions=[])).push("3.0.2");const Xe=(r,t,e)=>{const i=(e==null?void 0:e.renderBefore)??t;let s=i._$litPart$;if(s===void 0){const n=(e==null?void 0:e.renderBefore)??null;i._$litPart$=s=new z(t.insertBefore(L(),n),n,void 0,e??{})}return s._$AI(r),s};/**
|
18
18
|
* @license
|
19
19
|
* Copyright 2017 Google LLC
|
20
20
|
* SPDX-License-Identifier: BSD-3-Clause
|
@@ -22,7 +22,7 @@
|
|
22
22
|
* @license
|
23
23
|
* Copyright 2017 Google LLC
|
24
24
|
* SPDX-License-Identifier: BSD-3-Clause
|
25
|
-
*/const Qe={attribute:!0,type:String,converter:
|
25
|
+
*/const Qe={attribute:!0,type:String,converter:Z,reflect:!1,hasChanged:wt},ti=(r=Qe,t,e)=>{const{kind:i,metadata:s}=e;let n=globalThis.litPropertyMetadata.get(s);if(n===void 0&&globalThis.litPropertyMetadata.set(s,n=new Map),n.set(e.name,r),i==="accessor"){const{name:o}=e;return{set(a){const c=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,c,r)},init(a){return a!==void 0&&this.C(o,void 0,r),a}}}if(i==="setter"){const{name:o}=e;return function(a){const c=this[o];t.call(this,a),this.requestUpdate(o,c,r)}}throw Error("Unsupported decorator location: "+i)};function m(r){return(t,e)=>typeof e=="object"?ti(r,t,e):((i,s,n)=>{const o=s.hasOwnProperty(n);return s.constructor.createProperty(n,o?{...i,wrapped:!0}:i),o?Object.getOwnPropertyDescriptor(s,n):void 0})(r,t,e)}/**
|
26
26
|
* @license
|
27
27
|
* Copyright 2017 Google LLC
|
28
28
|
* SPDX-License-Identifier: BSD-3-Clause
|
@@ -333,7 +333,7 @@
|
|
333
333
|
opacity: 0;
|
334
334
|
animation: slideDown 0.3s linear;
|
335
335
|
}
|
336
|
-
`;Ci([m({attribute:!1})],st.prototype,"application",2);class Si{constructor(){this.root=this.createRoot()}createComponentModel(t,e){this.root.application=e;const i=a=>{if(Array.isArray(a)){const[c,...l]=a;return{definitionId:c,overrides:l}}return{definitionId:a,overrides:[]}},s=(a,c,l,h)=>{l.forEach(p=>{const f=i(p),u=h[f.definitionId];if(!u){console.error(`No definition found for component type '${f.definitionId}'.`);return}const g=a.createNode(u.type,u.type);g&&(g.name=f.definitionId,g.application=e,u.properties&&g.writeProperties(u.properties),u.context&&g.writeContext(u.context),u.layout&&g.writeLayout(u.layout),c.addChild(g),u.children&&s(a,g,u.children,h))})},{entry:n,components:o}=t;return s(this,this.root,[n],o),this.root}createRoot(){return new st}createNode(t,e){const i=this.resolveComponent(e);if(!i)return console.warn(`Unable to resolve component: ${e}`),new St;const s=new i;return s.type=e,s.name=t,s}resolveComponent(t){return customElements.get(`ace-${t}`)}getRoot(){return this.root}}const ge=class{constructor(){this.components=new Map}getComponent(r){const t=this.components.get(r);return t||console.warn(`Unable to resolve component: ${r}. You most likely forgot to register the required plugin.`),t}registerComponent(r,t){this.components.set(r,t)}async loadComponents(){const r=[...this.components.entries()].map(([t,e])=>e.then(i=>{this.defineAsWebComponent(t,i.default)}));await Promise.all(r)}defineAsWebComponent(r,t){const e=ge.ResolveWebComponentName(r);customElements.get(e)||customElements.define(e,t)}};let me=ge;me.ResolveWebComponentName=r=>`ace-${r}`;class ve{set(t,e){sessionStorage.setItem(t,e)}get(t){const e=sessionStorage.getItem(t);if(!e)return null;try{return JSON.parse(e)}catch{return e}}}class xi{constructor(){this.texts=new Map}loadTexts(t){this.texts=new Map(Object.entries(t))}get(t,e){const i=this.texts.get(t);return i||e||null}getOrFallback(t,e){return this.texts.get(t)||e}}class ye{constructor(t,e,i,s){this.
|
336
|
+
`;Ci([m({attribute:!1})],st.prototype,"application",2);class Si{constructor(){this.root=this.createRoot()}createComponentModel(t,e){this.root.application=e;const i=a=>{if(Array.isArray(a)){const[c,...l]=a;return{definitionId:c,overrides:l}}return{definitionId:a,overrides:[]}},s=(a,c,l,h)=>{l.forEach(p=>{const f=i(p),u=h[f.definitionId];if(!u){console.error(`No definition found for component type '${f.definitionId}'.`);return}const g=a.createNode(u.type,u.type);g&&(g.name=f.definitionId,g.application=e,u.properties&&g.writeProperties(u.properties),u.context&&g.writeContext(u.context),u.layout&&g.writeLayout(u.layout),c.addChild(g),u.children&&s(a,g,u.children,h))})},{entry:n,components:o}=t;return s(this,this.root,[n],o),this.root}createRoot(){return new st}createNode(t,e){const i=this.resolveComponent(e);if(!i)return console.warn(`Unable to resolve component: ${e}`),new St;const s=new i;return s.type=e,s.name=t,s}resolveComponent(t){return customElements.get(`ace-${t}`)}getRoot(){return this.root}}const ge=class{constructor(){this.components=new Map}getComponent(r){const t=this.components.get(r);return t||console.warn(`Unable to resolve component: ${r}. You most likely forgot to register the required plugin.`),t}registerComponent(r,t){this.components.set(r,t)}async loadComponents(){const r=[...this.components.entries()].map(([t,e])=>e.then(i=>{this.defineAsWebComponent(t,i.default)}));await Promise.all(r)}defineAsWebComponent(r,t){const e=ge.ResolveWebComponentName(r);customElements.get(e)||customElements.define(e,t)}};let me=ge;me.ResolveWebComponentName=r=>`ace-${r}`;class ve{constructor(t){this.widgetId=t}_prefixKey(t){return`ace_${this.widgetId.substring(0,7)}-${t}`}set(t,e){sessionStorage.setItem(this._prefixKey(t),e)}get(t){const e=sessionStorage.getItem(this._prefixKey(t));if(!e)return null;try{return JSON.parse(e)}catch{return e}}}class xi{constructor(){this.texts=new Map}loadTexts(t){this.texts=new Map(Object.entries(t))}get(t,e){const i=this.texts.get(t);return i||e||null}getOrFallback(t,e){return this.texts.get(t)||e}}class ye{constructor(t,e,i,s,n){this.id=t,this.name=e,this.container=i,this.settings=s,this.options=n,this.platform=new Si,this.texts=new xi,this.renderStrategy=y.Inline,this.anchor="BottomRight",this.autoActivate=!1,this.plugins=[],this.componentResolver=new me,this.components=[],this.trigger=null,this.renderStrategy=this.options.renderStrategy||y.Inline,this.triggerIcon=this.options.triggerIcon,this.storage=new ve(this.id),typeof n.autoActivate=="boolean"&&(this.autoActivate=n.autoActivate),n.anchor&&(this.anchor=n.anchor),this.container.register("$settings",s),this.texts.loadTexts(s.texts||{})}async activate(){if(await this.loadPlugins(),await this.componentResolver.loadComponents(),this.root=this.platform.createComponentModel(this.settings,this),this.container.setState(ee.Ready),this.autoActivate){const t=this.render();t&&this._getTargetElement().appendChild(t)}}async loadPlugins(){for await(const t of this.plugins)await t(this)}styles(){return this.settings.styles||{}}branding(){return this.settings.branding||{}}plugin(t){return this.plugins.push(t),this}appendToDOM(){this.root&&(this.root.classList.add("expanded"),this.root.classList.remove("hidden"),document.body.appendChild(this.root)),this.storage.set("open","true")}hide(){this.root&&(this.root.classList.add("hidden"),this.root.classList.remove("expanded")),this.storage.set("open","false")}mute(){this.settings.branding.other.disableSound=!0}unmute(){this.settings.branding.other.disableSound=!1}registerComponent(t,e){this.componentResolver.registerComponent(t,e)}resolveComponent(t){return this.componentResolver.getComponent(t)}mountComponent(t){this.components.push(t)}getComponent(t){const e=this.components.find(i=>i.type===t);return e||null}_getTargetElement(){let t="bottom-right";if(this.anchor==="BottomRight"?t="bottom-right":this.anchor==="BottomLeft"&&(t="bottom-left"),this.renderStrategy===y.Trigger){let e=document.querySelector(`ace-trigger-slot.${t}`);return e||(e=new it,e.anchor=this.anchor,document.body.appendChild(e)),e}return document.body}render(){if(this.renderStrategy===y.Trigger){const t=new _;return t.application=this,this.trigger=t,this.storage.get("open")&&this.trigger.toggleActive(),t}return this.root}}const be=class{async getSite(r){const e=await(await fetch(r)).json();return e?{id:e.id,apps:e.widgets.map(i=>{let s=y.Inline;return i.renderStrategy==="Trigger"&&(s=y.Trigger),{id:i.id,widgetId:i.widgetId,renderStrategy:s,autoActivate:i.autoActivate,anchor:i.anchor,triggerIcon:{type:"Telia",content:i.triggerIcon}}})}:null}async getWidget(r){const e=await(await fetch(`${be.endpoint}/widget/${r}`)).json();return e?{name:e.name,config:JSON.parse(e.configuration)}:null}};let Q=be;Q.endpoint="https://widgets.ace.teliacompany.net/api";class $e{constructor(){this.applications=[],this.container=new bt("environment",this),setTimeout(()=>{this.notifyWidgetsOfCreation()},1e3)}async bootstrap(){await this.activate()}async activate(){const t=this.applications.filter(e=>e.autoActivate);for await(const e of t)await e.activate()}notifyWidgetsOfCreation(){document.querySelectorAll("ace-widget").forEach(e=>{const i=this.applications.find(s=>s.name===e.name);i&&e.dispatchEvent(new CustomEvent("environment-created",{detail:{widget:i}}))})}registerApp(t,e,i,s){const n=new bt(e,this),o=new ye(t,e,n,i,s);this.applications.push(o)}plugin(t){return this.applications.forEach(e=>{e.plugin(t)}),this}}class _e{constructor(t){this.configurations=[],this.httpClient=new Q,this.httpClient=new Q,typeof t=="string"?this.url=t:(t.httpClient&&(this.httpClient=t.httpClient),this.loadFromConfig(t))}async load(t){const e=await this.httpClient.getSite(t);if(!e){console.warn(`Unable to load site from the url provided: ${t}`);return}this.configurations=e.apps}loadFromConfig(t){this.configurations=t.apps.map(e=>({id:"",renderStrategy:e.renderStrategy,widgetId:e.widgetId,autoActivate:e.autoActivate,anchor:e.anchor,triggerIcon:{type:"Telia",content:e.triggerIcon||"question"}}))}async bootstrap(t){var e;this.url&&await this.load(this.url),this.environment=new $e,this.addGlobal(this.environment);for await(const i of this.configurations){const s=await this.httpClient.getWidget(i.widgetId);s&&((e=this.environment)==null||e.registerApp(i.widgetId,s.name,s.config,{renderStrategy:i.renderStrategy,triggerIcon:i.triggerIcon,autoActivate:i.autoActivate,anchor:i.anchor}))}t(this.environment),await this.environment.bootstrap()}addGlobal(t){globalThis.widgets=t}}var Ei=Object.defineProperty,Oi=Object.getOwnPropertyDescriptor,xt=(r,t,e,i)=>{for(var s=i>1?void 0:i?Oi(t,e):t,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(t,e,s):o(s))||s);return i&&s&&Ei(t,e,s),s};class I extends ${constructor(){super(),this.status="deactivated",this.addEventListener("environment-created",this.onEnvironmentCreated)}async connectedCallback(){super.connectedCallback(),await this.getGlobalEnvironment()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("environment-created",this.onEnvironmentCreated)}async onEnvironmentCreated(t){this.widget=t.detail.widget,await this.activate(),this.requestUpdate()}async activate(){this.widget&&(await this.widget.activate(),this.status="activated")}async getGlobalEnvironment(){const t=globalThis.widgets;t&&(this.widget=t.applications.find(e=>e.name===this.name),await this.activate())}render(){if(!this.widget||this.status!=="activated")return d;if(this.widget.renderStrategy===y.Trigger){const t=new _;return t.application=this.widget,t}return this.widget.render()}}I.styles=[U`
|
337
337
|
:host {
|
338
338
|
display: block;
|
339
339
|
}
|
package/index.mjs
CHANGED
@@ -47,7 +47,7 @@ function Y(r, t) {
|
|
47
47
|
}
|
48
48
|
return n;
|
49
49
|
}
|
50
|
-
function
|
50
|
+
function K(r, t, e) {
|
51
51
|
if (e || arguments.length === 2)
|
52
52
|
for (var i = 0, s = t.length, n; i < s; i++)
|
53
53
|
(n || !(i in t)) && (n || (n = Array.prototype.slice.call(t, 0, i)), n[i] = t[i]);
|
@@ -56,13 +56,13 @@ function Z(r, t, e) {
|
|
56
56
|
function b(r) {
|
57
57
|
return typeof r == "function";
|
58
58
|
}
|
59
|
-
function
|
59
|
+
function Kt(r) {
|
60
60
|
var t = function(i) {
|
61
61
|
Error.call(i), i.stack = new Error().stack;
|
62
62
|
}, e = r(t);
|
63
63
|
return e.prototype = Object.create(Error.prototype), e.prototype.constructor = e, e;
|
64
64
|
}
|
65
|
-
var st =
|
65
|
+
var st = Kt(function(r) {
|
66
66
|
return function(e) {
|
67
67
|
r(this), this.message = e ? e.length + ` errors occurred during unsubscription:
|
68
68
|
` + e.map(function(i, s) {
|
@@ -121,7 +121,7 @@ var Q = function() {
|
|
121
121
|
try {
|
122
122
|
xt(g);
|
123
123
|
} catch (v) {
|
124
|
-
n = n ?? [], v instanceof st ? n =
|
124
|
+
n = n ?? [], v instanceof st ? n = K(K([], Y(n)), Y(v.errors)) : n.push(v);
|
125
125
|
}
|
126
126
|
}
|
127
127
|
} catch (v) {
|
@@ -167,7 +167,7 @@ var Q = function() {
|
|
167
167
|
var t = new r();
|
168
168
|
return t.closed = !0, t;
|
169
169
|
}(), r;
|
170
|
-
}(),
|
170
|
+
}(), Zt = Q.EMPTY;
|
171
171
|
function Jt(r) {
|
172
172
|
return r instanceof Q || r && "closed" in r && b(r.remove) && b(r.add) && b(r.unsubscribe);
|
173
173
|
}
|
@@ -185,7 +185,7 @@ var Xt = {
|
|
185
185
|
for (var e = [], i = 2; i < arguments.length; i++)
|
186
186
|
e[i - 2] = arguments[i];
|
187
187
|
var s = mt.delegate;
|
188
|
-
return s != null && s.setTimeout ? s.setTimeout.apply(s,
|
188
|
+
return s != null && s.setTimeout ? s.setTimeout.apply(s, K([r, t], Y(e))) : setTimeout.apply(void 0, K([r, t], Y(e)));
|
189
189
|
},
|
190
190
|
clearTimeout: function(r) {
|
191
191
|
var t = mt.delegate;
|
@@ -387,7 +387,7 @@ function Se(r) {
|
|
387
387
|
function xe(r) {
|
388
388
|
return r && r instanceof Qt || Se(r) && Jt(r);
|
389
389
|
}
|
390
|
-
var Ee =
|
390
|
+
var Ee = Kt(function(r) {
|
391
391
|
return function() {
|
392
392
|
r(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
|
393
393
|
};
|
@@ -459,7 +459,7 @@ var Ee = Zt(function(r) {
|
|
459
459
|
return this._throwIfClosed(), this._checkFinalizedStatuses(e), this._innerSubscribe(e);
|
460
460
|
}, t.prototype._innerSubscribe = function(e) {
|
461
461
|
var i = this, s = this, n = s.hasError, o = s.isStopped, a = s.observers;
|
462
|
-
return n || o ?
|
462
|
+
return n || o ? Zt : (this.currentObservers = null, a.push(e), new Q(function() {
|
463
463
|
i.currentObservers = null, gt(a, e);
|
464
464
|
}));
|
465
465
|
}, t.prototype._checkFinalizedStatuses = function(e) {
|
@@ -488,7 +488,7 @@ var Ee = Zt(function(r) {
|
|
488
488
|
(i = (e = this.destination) === null || e === void 0 ? void 0 : e.complete) === null || i === void 0 || i.call(e);
|
489
489
|
}, t.prototype._subscribe = function(e) {
|
490
490
|
var i, s;
|
491
|
-
return (s = (i = this.source) === null || i === void 0 ? void 0 : i.subscribe(e)) !== null && s !== void 0 ? s :
|
491
|
+
return (s = (i = this.source) === null || i === void 0 ? void 0 : i.subscribe(e)) !== null && s !== void 0 ? s : Zt;
|
492
492
|
}, t;
|
493
493
|
}(te), Oe = function(r) {
|
494
494
|
B(t, r);
|
@@ -587,7 +587,7 @@ const Pe = (r) => new ie(typeof r == "string" ? r : r + "", void 0, $t), U = (r,
|
|
587
587
|
* Copyright 2017 Google LLC
|
588
588
|
* SPDX-License-Identifier: BSD-3-Clause
|
589
589
|
*/
|
590
|
-
const { is: Re, defineProperty: Ue, getOwnPropertyDescriptor: Ie, getOwnPropertyNames: ke, getOwnPropertySymbols: Me, getPrototypeOf: Ne } = Object, w = globalThis, kt = w.trustedTypes, je = kt ? kt.emptyScript : "", ot = w.reactiveElementPolyfillSupport, k = (r, t) => r,
|
590
|
+
const { is: Re, defineProperty: Ue, getOwnPropertyDescriptor: Ie, getOwnPropertyNames: ke, getOwnPropertySymbols: Me, getPrototypeOf: Ne } = Object, w = globalThis, kt = w.trustedTypes, je = kt ? kt.emptyScript : "", ot = w.reactiveElementPolyfillSupport, k = (r, t) => r, Z = { toAttribute(r, t) {
|
591
591
|
switch (t) {
|
592
592
|
case Boolean:
|
593
593
|
r = r ? je : null;
|
@@ -615,7 +615,7 @@ const { is: Re, defineProperty: Ue, getOwnPropertyDescriptor: Ie, getOwnProperty
|
|
615
615
|
}
|
616
616
|
}
|
617
617
|
return e;
|
618
|
-
} }, _t = (r, t) => !Re(r, t), Mt = { attribute: !0, type: String, converter:
|
618
|
+
} }, _t = (r, t) => !Re(r, t), Mt = { attribute: !0, type: String, converter: Z, reflect: !1, hasChanged: _t };
|
619
619
|
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), w.litPropertyMetadata ?? (w.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
620
620
|
let P = class extends HTMLElement {
|
621
621
|
static addInitializer(t) {
|
@@ -736,7 +736,7 @@ let P = class extends HTMLElement {
|
|
736
736
|
var n;
|
737
737
|
const i = this.constructor.elementProperties.get(t), s = this.constructor._$Eu(t, i);
|
738
738
|
if (s !== void 0 && i.reflect === !0) {
|
739
|
-
const o = (((n = i.converter) == null ? void 0 : n.toAttribute) !== void 0 ? i.converter :
|
739
|
+
const o = (((n = i.converter) == null ? void 0 : n.toAttribute) !== void 0 ? i.converter : Z).toAttribute(e, i.type);
|
740
740
|
this._$Em = t, o == null ? this.removeAttribute(s) : this.setAttribute(s, o), this._$Em = null;
|
741
741
|
}
|
742
742
|
}
|
@@ -744,7 +744,7 @@ let P = class extends HTMLElement {
|
|
744
744
|
var n;
|
745
745
|
const i = this.constructor, s = i._$Eh.get(t);
|
746
746
|
if (s !== void 0 && this._$Em !== s) {
|
747
|
-
const o = i.getPropertyOptions(s), a = typeof o.converter == "function" ? { fromAttribute: o.converter } : ((n = o.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? o.converter :
|
747
|
+
const o = i.getPropertyOptions(s), a = typeof o.converter == "function" ? { fromAttribute: o.converter } : ((n = o.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? o.converter : Z;
|
748
748
|
this._$Em = s, this[s] = a.fromAttribute(e, o.type), this._$Em = null;
|
749
749
|
}
|
750
750
|
}
|
@@ -1121,7 +1121,7 @@ lt == null || lt({ LitElement: $ });
|
|
1121
1121
|
* Copyright 2017 Google LLC
|
1122
1122
|
* SPDX-License-Identifier: BSD-3-Clause
|
1123
1123
|
*/
|
1124
|
-
const Ye = { attribute: !0, type: String, converter:
|
1124
|
+
const Ye = { attribute: !0, type: String, converter: Z, reflect: !1, hasChanged: _t }, Ke = (r = Ye, t, e) => {
|
1125
1125
|
const { kind: i, metadata: s } = e;
|
1126
1126
|
let n = globalThis.litPropertyMetadata.get(s);
|
1127
1127
|
if (n === void 0 && globalThis.litPropertyMetadata.set(s, n = /* @__PURE__ */ new Map()), n.set(e.name, r), i === "accessor") {
|
@@ -1143,7 +1143,7 @@ const Ye = { attribute: !0, type: String, converter: K, reflect: !1, hasChanged:
|
|
1143
1143
|
throw Error("Unsupported decorator location: " + i);
|
1144
1144
|
};
|
1145
1145
|
function m(r) {
|
1146
|
-
return (t, e) => typeof e == "object" ?
|
1146
|
+
return (t, e) => typeof e == "object" ? Ke(r, t, e) : ((i, s, n) => {
|
1147
1147
|
const o = s.hasOwnProperty(n);
|
1148
1148
|
return s.constructor.createProperty(n, o ? { ...i, wrapped: !0 } : i), o ? Object.getOwnPropertyDescriptor(s, n) : void 0;
|
1149
1149
|
})(r, t, e);
|
@@ -1156,10 +1156,10 @@ function m(r) {
|
|
1156
1156
|
function z(r) {
|
1157
1157
|
return m({ ...r, state: !0, attribute: !1 });
|
1158
1158
|
}
|
1159
|
-
var
|
1159
|
+
var Ze = Object.defineProperty, Je = Object.getOwnPropertyDescriptor, Xe = (r, t, e, i) => {
|
1160
1160
|
for (var s = i > 1 ? void 0 : i ? Je(t, e) : t, n = r.length - 1, o; n >= 0; n--)
|
1161
1161
|
(o = r[n]) && (s = (i ? o(t, e, s) : o(s)) || s);
|
1162
|
-
return i && s &&
|
1162
|
+
return i && s && Ze(t, e, s), s;
|
1163
1163
|
};
|
1164
1164
|
class et extends $ {
|
1165
1165
|
constructor() {
|
@@ -2113,11 +2113,17 @@ const fe = class {
|
|
2113
2113
|
let ge = fe;
|
2114
2114
|
ge.ResolveWebComponentName = (r) => `ace-${r}`;
|
2115
2115
|
class wi {
|
2116
|
+
constructor(t) {
|
2117
|
+
this.widgetId = t;
|
2118
|
+
}
|
2119
|
+
_prefixKey(t) {
|
2120
|
+
return `ace_${this.widgetId.substring(0, 7)}-${t}`;
|
2121
|
+
}
|
2116
2122
|
set(t, e) {
|
2117
|
-
sessionStorage.setItem(t, e);
|
2123
|
+
sessionStorage.setItem(this._prefixKey(t), e);
|
2118
2124
|
}
|
2119
2125
|
get(t) {
|
2120
|
-
const e = sessionStorage.getItem(t);
|
2126
|
+
const e = sessionStorage.getItem(this._prefixKey(t));
|
2121
2127
|
if (!e)
|
2122
2128
|
return null;
|
2123
2129
|
try {
|
@@ -2143,8 +2149,8 @@ class Ai {
|
|
2143
2149
|
}
|
2144
2150
|
}
|
2145
2151
|
class Ci {
|
2146
|
-
constructor(t, e, i, s) {
|
2147
|
-
this.
|
2152
|
+
constructor(t, e, i, s, n) {
|
2153
|
+
this.id = t, this.name = e, this.container = i, this.settings = s, this.options = n, this.platform = new _i(), this.texts = new Ai(), this.renderStrategy = y.Inline, this.anchor = "BottomRight", this.autoActivate = !1, this.plugins = [], this.componentResolver = new ge(), this.components = [], this.trigger = null, this.renderStrategy = this.options.renderStrategy || y.Inline, this.triggerIcon = this.options.triggerIcon, this.storage = new wi(this.id), typeof n.autoActivate == "boolean" && (this.autoActivate = n.autoActivate), n.anchor && (this.anchor = n.anchor), this.container.register("$settings", s), this.texts.loadTexts(s.texts || {});
|
2148
2154
|
}
|
2149
2155
|
async activate() {
|
2150
2156
|
if (await this.loadPlugins(), await this.componentResolver.loadComponents(), this.root = this.platform.createComponentModel(this.settings, this), this.container.setState(ee.Ready), this.autoActivate) {
|
@@ -2267,9 +2273,9 @@ class Si {
|
|
2267
2273
|
);
|
2268
2274
|
});
|
2269
2275
|
}
|
2270
|
-
registerApp(t, e, i) {
|
2271
|
-
const
|
2272
|
-
this.applications.push(
|
2276
|
+
registerApp(t, e, i, s) {
|
2277
|
+
const n = new Rt(e, this), o = new Ci(t, e, n, i, s);
|
2278
|
+
this.applications.push(o);
|
2273
2279
|
}
|
2274
2280
|
plugin(t) {
|
2275
2281
|
return this.applications.forEach((e) => {
|
@@ -2307,12 +2313,17 @@ class xi {
|
|
2307
2313
|
this.url && await this.load(this.url), this.environment = new Si(), this.addGlobal(this.environment);
|
2308
2314
|
for await (const i of this.configurations) {
|
2309
2315
|
const s = await this.httpClient.getWidget(i.widgetId);
|
2310
|
-
s && ((e = this.environment) == null || e.registerApp(
|
2311
|
-
|
2312
|
-
|
2313
|
-
|
2314
|
-
|
2315
|
-
|
2316
|
+
s && ((e = this.environment) == null || e.registerApp(
|
2317
|
+
i.widgetId,
|
2318
|
+
s.name,
|
2319
|
+
s.config,
|
2320
|
+
{
|
2321
|
+
renderStrategy: i.renderStrategy,
|
2322
|
+
triggerIcon: i.triggerIcon,
|
2323
|
+
autoActivate: i.autoActivate,
|
2324
|
+
anchor: i.anchor
|
2325
|
+
}
|
2326
|
+
));
|
2316
2327
|
}
|
2317
2328
|
t(this.environment), await this.environment.bootstrap();
|
2318
2329
|
}
|
package/models/application.d.ts
CHANGED
@@ -7,6 +7,7 @@ import { TextsService } from '../services/texts.service';
|
|
7
7
|
import { ApplicationOptions, PluginType, RenderStrategy, TriggerIcon, WidgetAnchor, WidgetConfig } from '../types';
|
8
8
|
import { Container } from './container';
|
9
9
|
export declare class Application {
|
10
|
+
id: string;
|
10
11
|
name: string;
|
11
12
|
container: Container;
|
12
13
|
settings: WidgetConfig;
|
@@ -23,7 +24,7 @@ export declare class Application {
|
|
23
24
|
private componentResolver;
|
24
25
|
private components;
|
25
26
|
trigger: Trigger | null;
|
26
|
-
constructor(name: string, container: Container, settings: WidgetConfig, options: ApplicationOptions);
|
27
|
+
constructor(id: string, name: string, container: Container, settings: WidgetConfig, options: ApplicationOptions);
|
27
28
|
activate(): Promise<void>;
|
28
29
|
private loadPlugins;
|
29
30
|
styles(): Record<string, any>;
|
package/models/environment.d.ts
CHANGED
@@ -8,6 +8,6 @@ export declare class Environment {
|
|
8
8
|
bootstrap(): Promise<void>;
|
9
9
|
private activate;
|
10
10
|
private notifyWidgetsOfCreation;
|
11
|
-
registerApp(name: string, config: WidgetConfig, options: ApplicationOptions): void;
|
11
|
+
registerApp(id: string, name: string, config: WidgetConfig, options: ApplicationOptions): void;
|
12
12
|
plugin(plugin: PluginType): this;
|
13
13
|
}
|
package/package.json
CHANGED