@telia-ace/widget-core-flamingo 1.1.72-rc.5 → 1.1.72-rc.7
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +5 -5
- package/index.mjs +24 -17
- package/package.json +1 -1
- package/services/storage.service.d.ts +1 -0
package/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var gt=function(s,t){return gt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])},gt(s,t)};function F(s,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");gt(s,t);function e(){this.constructor=s}s.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function mt(s){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&s[t],i=0;if(e)return e.call(s);if(s&&typeof s.length=="number")return{next:function(){return s&&i>=s.length&&(s=void 0),{value:s&&s[i++],done:!s}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function J(s,t){var e=typeof Symbol=="function"&&s[Symbol.iterator];if(!e)return s;var i=e.call(s),r,n=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)n.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return n}function X(s,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,n;i<r;i++)(n||!(i in t))&&(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return s.concat(n||Array.prototype.slice.call(t))}function w(s){return typeof s=="function"}function Qt(s){var t=function(i){Error.call(i),i.stack=new Error().stack},e=s(t);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var ot=Qt(function(s){return function(e){s(this),this.message=e?e.length+` errors occurred during unsubscription:
|
2
2
|
`+e.map(function(i,r){return r+1+") "+i.toString()}).join(`
|
3
|
-
`):"",this.name="UnsubscriptionError",this.errors=e}});function vt(s,t){if(s){var e=s.indexOf(t);0<=e&&s.splice(e,1)}}var it=function(){function s(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return s.prototype.unsubscribe=function(){var t,e,i,r,n;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=mt(o),c=a.next();!c.done;c=a.next()){var h=c.value;h.remove(this)}}catch(y){t={error:y}}finally{try{c&&!c.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else o.remove(this);var l=this.initialTeardown;if(w(l))try{l()}catch(y){n=y instanceof ot?y.errors:[y]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var f=mt(p),u=f.next();!u.done;u=f.next()){var g=u.value;try{Ot(g)}catch(y){n=n??[],y instanceof ot?n=X(X([],J(n)),J(y.errors)):n.push(y)}}}catch(y){i={error:y}}finally{try{u&&!u.done&&(r=f.return)&&r.call(f)}finally{if(i)throw i.error}}}if(n)throw new ot(n)}},s.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)Ot(t);else{if(t instanceof s){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},s.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},s.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},s.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&vt(e,t)},s.prototype.remove=function(t){var e=this._finalizers;e&&vt(e,t),t instanceof s&&t._removeParent(this)},s.EMPTY=function(){var t=new s;return t.closed=!0,t}(),s}(),te=it.EMPTY;function ee(s){return s instanceof it||s&&"closed"in s&&w(s.remove)&&w(s.add)&&w(s.unsubscribe)}function Ot(s){w(s)?s():s.unsubscribe()}var ie={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},yt={setTimeout:function(s,t){for(var e=[],i=2;i<arguments.length;i++)e[i-2]=arguments[i];var r=yt.delegate;return r!=null&&r.setTimeout?r.setTimeout.apply(r,X([s,t],J(e))):setTimeout.apply(void 0,X([s,t],J(e)))},clearTimeout:function(s){var t=yt.delegate;return((t==null?void 0:t.clearTimeout)||clearTimeout)(s)},delegate:void 0};function Ee(s){yt.setTimeout(function(){throw s})}function Tt(){}function Z(s){s()}var se=function(s){F(t,s);function t(e){var i=s.call(this)||this;return i.isStopped=!1,e?(i.destination=e,ee(e)&&e.add(i)):i.destination=Ie,i}return t.create=function(e,i,r){return new bt(e,i,r)},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,s.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}(it),Pe=Function.prototype.bind;function at(s,t){return Pe.call(s,t)}var Oe=function(){function s(t){this.partialObserver=t}return s.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(i){q(i)}},s.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(i){q(i)}else q(t)},s.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){q(e)}},s}(),bt=function(s){F(t,s);function t(e,i,r){var n=s.call(this)||this,o;if(w(e)||!e)o={next:e??void 0,error:i??void 0,complete:r??void 0};else{var a;n&&ie.useDeprecatedNextContext?(a=Object.create(e),a.unsubscribe=function(){return n.unsubscribe()},o={next:e.next&&at(e.next,a),error:e.error&&at(e.error,a),complete:e.complete&&at(e.complete,a)}):o=e}return n.destination=new Oe(o),n}return t}(se);function q(s){Ee(s)}function Te(s){throw s}var Ie={closed:!0,next:Tt,error:Te,complete:Tt},Re=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Ne(s){return s}function Ue(s){return s.length===0?Ne:s.length===1?s[0]:function(e){return s.reduce(function(i,r){return r(i)},e)}}var It=function(){function s(t){t&&(this._subscribe=t)}return s.prototype.lift=function(t){var e=new s;return e.source=this,e.operator=t,e},s.prototype.subscribe=function(t,e,i){var r=this,n=
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=e}});function vt(s,t){if(s){var e=s.indexOf(t);0<=e&&s.splice(e,1)}}var it=function(){function s(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return s.prototype.unsubscribe=function(){var t,e,i,r,n;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=mt(o),c=a.next();!c.done;c=a.next()){var h=c.value;h.remove(this)}}catch(y){t={error:y}}finally{try{c&&!c.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else o.remove(this);var l=this.initialTeardown;if(w(l))try{l()}catch(y){n=y instanceof ot?y.errors:[y]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var f=mt(p),u=f.next();!u.done;u=f.next()){var g=u.value;try{Ot(g)}catch(y){n=n??[],y instanceof ot?n=X(X([],J(n)),J(y.errors)):n.push(y)}}}catch(y){i={error:y}}finally{try{u&&!u.done&&(r=f.return)&&r.call(f)}finally{if(i)throw i.error}}}if(n)throw new ot(n)}},s.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)Ot(t);else{if(t instanceof s){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},s.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},s.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},s.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&vt(e,t)},s.prototype.remove=function(t){var e=this._finalizers;e&&vt(e,t),t instanceof s&&t._removeParent(this)},s.EMPTY=function(){var t=new s;return t.closed=!0,t}(),s}(),te=it.EMPTY;function ee(s){return s instanceof it||s&&"closed"in s&&w(s.remove)&&w(s.add)&&w(s.unsubscribe)}function Ot(s){w(s)?s():s.unsubscribe()}var ie={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},yt={setTimeout:function(s,t){for(var e=[],i=2;i<arguments.length;i++)e[i-2]=arguments[i];var r=yt.delegate;return r!=null&&r.setTimeout?r.setTimeout.apply(r,X([s,t],J(e))):setTimeout.apply(void 0,X([s,t],J(e)))},clearTimeout:function(s){var t=yt.delegate;return((t==null?void 0:t.clearTimeout)||clearTimeout)(s)},delegate:void 0};function Ee(s){yt.setTimeout(function(){throw s})}function Tt(){}function Z(s){s()}var se=function(s){F(t,s);function t(e){var i=s.call(this)||this;return i.isStopped=!1,e?(i.destination=e,ee(e)&&e.add(i)):i.destination=Ie,i}return t.create=function(e,i,r){return new bt(e,i,r)},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,s.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}(it),Pe=Function.prototype.bind;function at(s,t){return Pe.call(s,t)}var Oe=function(){function s(t){this.partialObserver=t}return s.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(i){q(i)}},s.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(i){q(i)}else q(t)},s.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){q(e)}},s}(),bt=function(s){F(t,s);function t(e,i,r){var n=s.call(this)||this,o;if(w(e)||!e)o={next:e??void 0,error:i??void 0,complete:r??void 0};else{var a;n&&ie.useDeprecatedNextContext?(a=Object.create(e),a.unsubscribe=function(){return n.unsubscribe()},o={next:e.next&&at(e.next,a),error:e.error&&at(e.error,a),complete:e.complete&&at(e.complete,a)}):o=e}return n.destination=new Oe(o),n}return t}(se);function q(s){Ee(s)}function Te(s){throw s}var Ie={closed:!0,next:Tt,error:Te,complete:Tt},Re=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Ne(s){return s}function Ue(s){return s.length===0?Ne:s.length===1?s[0]:function(e){return s.reduce(function(i,r){return r(i)},e)}}var It=function(){function s(t){t&&(this._subscribe=t)}return s.prototype.lift=function(t){var e=new s;return e.source=this,e.operator=t,e},s.prototype.subscribe=function(t,e,i){var r=this,n=je(t)?t:new bt(t,e,i);return Z(function(){var o=r,a=o.operator,c=o.source;n.add(a?a.call(n,c):c?r._subscribe(n):r._trySubscribe(n))}),n},s.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},s.prototype.forEach=function(t,e){var i=this;return e=Rt(e),new e(function(r,n){var o=new bt({next:function(a){try{t(a)}catch(c){n(c),o.unsubscribe()}},error:n,complete:r});i.subscribe(o)})},s.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},s.prototype[Re]=function(){return this},s.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Ue(t)(this)},s.prototype.toPromise=function(t){var e=this;return t=Rt(t),new t(function(i,r){var n;e.subscribe(function(o){return n=o},function(o){return r(o)},function(){return i(n)})})},s.create=function(t){return new s(t)},s}();function Rt(s){var t;return(t=s??ie.Promise)!==null&&t!==void 0?t:Promise}function ke(s){return s&&w(s.next)&&w(s.error)&&w(s.complete)}function je(s){return s&&s instanceof se||ke(s)&&ee(s)}var Me=Qt(function(s){return function(){s(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),wt=function(s){F(t,s);function t(){var e=s.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 Nt(this,this);return i.operator=e,i},t.prototype._throwIfClosed=function(){if(this.closed)throw new Me},t.prototype.next=function(e){var i=this;Z(function(){var r,n;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var o=mt(i.currentObservers),a=o.next();!a.done;a=o.next()){var c=a.value;c.next(e)}}catch(h){r={error:h}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}})},t.prototype.error=function(e){var i=this;Z(function(){if(i._throwIfClosed(),!i.isStopped){i.hasError=i.isStopped=!0,i.thrownError=e;for(var r=i.observers;r.length;)r.shift().error(e)}})},t.prototype.complete=function(){var e=this;Z(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(),s.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,r=this,n=r.hasError,o=r.isStopped,a=r.observers;return n||o?te:(this.currentObservers=null,a.push(e),new it(function(){i.currentObservers=null,vt(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var i=this,r=i.hasError,n=i.thrownError,o=i.isStopped;r?e.error(n):o&&e.complete()},t.prototype.asObservable=function(){var e=new It;return e.source=this,e},t.create=function(e,i){return new Nt(e,i)},t}(It),Nt=function(s){F(t,s);function t(e,i){var r=s.call(this)||this;return r.destination=e,r.source=i,r}return t.prototype.next=function(e){var i,r;(r=(i=this.destination)===null||i===void 0?void 0:i.next)===null||r===void 0||r.call(i,e)},t.prototype.error=function(e){var i,r;(r=(i=this.destination)===null||i===void 0?void 0:i.error)===null||r===void 0||r.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,r;return(r=(i=this.source)===null||i===void 0?void 0:i.subscribe(e))!==null&&r!==void 0?r:te},t}(wt),re=function(s){F(t,s);function t(e){var i=s.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=s.prototype._subscribe.call(this,e);return!i.closed&&e.next(this._value),i},t.prototype.getValue=function(){var e=this,i=e.hasError,r=e.thrownError,n=e._value;if(i)throw r;return this._throwIfClosed(),n},t.prototype.next=function(e){s.prototype.next.call(this,this._value=e)},t}(wt),ne=(s=>(s.Loading="loading",s.Ready="ready",s))(ne||{});class $t{constructor(t,e){this.state=new re("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:De,defineProperty:Be,getOwnPropertyDescriptor:ze,getOwnPropertyNames:We,getOwnPropertySymbols:Fe,getPrototypeOf:Ve}=Object,x=globalThis,
|
11
|
+
*/const{is:De,defineProperty:Be,getOwnPropertyDescriptor:ze,getOwnPropertyNames:We,getOwnPropertySymbols:Fe,getPrototypeOf:Ve}=Object,x=globalThis,jt=x.trustedTypes,Ye=jt?jt.emptyScript:"",ct=x.reactiveElementPolyfillSupport,M=(s,t)=>s,Q={toAttribute(s,t){switch(t){case Boolean:s=s?Ye:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let e=s;switch(t){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch{e=null}}return e}},xt=(s,t)=>!De(s,t),Mt={attribute:!0,type:String,converter:Q,reflect:!1,hasChanged:xt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),x.litPropertyMetadata??(x.litPropertyMetadata=new WeakMap);let T=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(),r=this.getPropertyDescriptor(t,i,e);r!==void 0&&Be(this.prototype,t,r)}}static getPropertyDescriptor(t,e,i){const{get:r,set:n}=ze(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return r==null?void 0:r.call(this)},set(o){const a=r==null?void 0:r.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=Ve(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=[...We(e),...Fe(e)];for(const r of i)this.createProperty(r,e[r])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[i,r]of e)this.elementProperties.set(i,r)}this._$Eh=new Map;for(const[e,i]of this.elementProperties){const r=this._$Eu(e,i);r!==void 0&&this._$Eh.set(r,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 r of i)e.unshift(kt(r))}else t!==void 0&&e.push(kt(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._$ES=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._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$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 Le(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(e=>{var i;return(i=e.hostConnected)==null?void 0:i.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var i;return(i=e.hostDisconnected)==null?void 0:i.call(e)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EC(t,e){var n;const i=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,i);if(r!==void 0&&i.reflect===!0){const o=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:Q).toAttribute(e,i.type);this._$Em=t,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(t,e){var n;const i=this.constructor,r=i._$Eh.get(t);if(r!==void 0&&this._$Em!==r){const o=i.getPropertyOptions(r),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:Q;this._$Em=r,this[r]=a.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,i){if(t!==void 0){if(i??(i=this.constructor.getPropertyOptions(t)),!(i.hasChanged??xt)(this[t],e))return;this.P(t,e,i)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(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 _$ET(){this.isUpdatePending=!0;try{await this._$ES}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.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[n,o]of r)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.P(n,this[n],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(i=this._$EO)==null||i.forEach(r=>{var n;return(n=r.hostUpdate)==null?void 0:n.call(r)}),this.update(e)):this._$EU()}catch(r){throw t=!1,this._$EU(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(i=>{var r;return(r=i.hostUpdated)==null?void 0:r.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}};T.elementStyles=[],T.shadowRootOptions={mode:"open"},T[M("elementProperties")]=new Map,T[M("finalized")]=new Map,ct==null||ct({ReactiveElement:T}),(x.reactiveElementVersions??(x.reactiveElementVersions=[])).push("2.0.4");/**
|
12
12
|
* @license
|
13
13
|
* Copyright 2017 Google LLC
|
14
14
|
* SPDX-License-Identifier: BSD-3-Clause
|
15
15
|
*/const H=globalThis,tt=H.trustedTypes,Ht=tt?tt.createPolicy("lit-html",{createHTML:s=>s}):void 0,ae="$lit$",A=`lit$${(Math.random()+"").slice(9)}$`,ce="?"+A,qe=`<${ce}>`,P=document,D=()=>P.createComment(""),B=s=>s===null||typeof s!="object"&&typeof s!="function",he=Array.isArray,Ke=s=>he(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",ht=`[
|
16
|
-
\f\r]`,
|
17
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Bt=/'/g,zt=/"/g,le=/^(?:script|style|textarea|title)$/i,Ze=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),I=Ze(1),O=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Wt=new WeakMap,E=P.createTreeWalker(P,129);function pe(s,t){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ht!==void 0?Ht.createHTML(t):t}const Ge=(s,t)=>{const e=s.length-1,i=[];let r,n=t===2?"<svg>":"",o=
|
16
|
+
\f\r]`,j=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Lt=/-->/g,Dt=/>/g,C=RegExp(`>|${ht}(?:([^\\s"'>=/]+)(${ht}*=${ht}*(?:[^
|
17
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Bt=/'/g,zt=/"/g,le=/^(?:script|style|textarea|title)$/i,Ze=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),I=Ze(1),O=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Wt=new WeakMap,E=P.createTreeWalker(P,129);function pe(s,t){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ht!==void 0?Ht.createHTML(t):t}const Ge=(s,t)=>{const e=s.length-1,i=[];let r,n=t===2?"<svg>":"",o=j;for(let a=0;a<e;a++){const c=s[a];let h,l,p=-1,f=0;for(;f<c.length&&(o.lastIndex=f,l=o.exec(c),l!==null);)f=o.lastIndex,o===j?l[1]==="!--"?o=Lt:l[1]!==void 0?o=Dt:l[2]!==void 0?(le.test(l[2])&&(r=RegExp("</"+l[2],"g")),o=C):l[3]!==void 0&&(o=C):o===C?l[0]===">"?(o=r??j,p=-1):l[1]===void 0?p=-2:(p=o.lastIndex-l[2].length,h=l[1],o=l[3]===void 0?C:l[3]==='"'?zt:Bt):o===zt||o===Bt?o=C:o===Lt||o===Dt?o=j:(o=C,r=void 0);const u=o===C&&s[a+1].startsWith("/>")?" ":"";n+=o===j?c+qe:p>=0?(i.push(h),c.slice(0,p)+ae+c.slice(p)+A+u):c+A+(p===-2?a:u)}return[pe(s,n+(s[e]||"<?>")+(t===2?"</svg>":"")),i]};class z{constructor({strings:t,_$litType$:e},i){let r;this.parts=[];let n=0,o=0;const a=t.length-1,c=this.parts,[h,l]=Ge(t,e);if(this.el=z.createElement(h,i),E.currentNode=this.el.content,e===2){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(r=E.nextNode())!==null&&c.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const p of r.getAttributeNames())if(p.endsWith(ae)){const f=l[o++],u=r.getAttribute(p).split(A),g=/([.?@])?(.*)/.exec(f);c.push({type:1,index:n,name:g[2],strings:u,ctor:g[1]==="."?Xe:g[1]==="?"?Qe:g[1]==="@"?ti:st}),r.removeAttribute(p)}else p.startsWith(A)&&(c.push({type:6,index:n}),r.removeAttribute(p));if(le.test(r.tagName)){const p=r.textContent.split(A),f=p.length-1;if(f>0){r.textContent=tt?tt.emptyScript:"";for(let u=0;u<f;u++)r.append(p[u],D()),E.nextNode(),c.push({type:2,index:++n});r.append(p[f],D())}}}else if(r.nodeType===8)if(r.data===ce)c.push({type:2,index:n});else{let p=-1;for(;(p=r.data.indexOf(A,p+1))!==-1;)c.push({type:7,index:n}),p+=A.length-1}n++}}static createElement(t,e){const i=P.createElement("template");return i.innerHTML=t,i}}function R(s,t,e=s,i){var o,a;if(t===O)return t;let r=i!==void 0?(o=e._$Co)==null?void 0:o[i]:e._$Cl;const n=B(t)?void 0:t._$litDirective$;return(r==null?void 0:r.constructor)!==n&&((a=r==null?void 0:r._$AO)==null||a.call(r,!1),n===void 0?r=void 0:(r=new n(s),r._$AT(s,e,i)),i!==void 0?(e._$Co??(e._$Co=[]))[i]=r:e._$Cl=r),r!==void 0&&(t=R(s,r._$AS(s,t.values),r,i)),t}class Je{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,r=((t==null?void 0:t.creationScope)??P).importNode(e,!0);E.currentNode=r;let n=E.nextNode(),o=0,a=0,c=i[0];for(;c!==void 0;){if(o===c.index){let h;c.type===2?h=new V(n,n.nextSibling,this,t):c.type===1?h=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(h=new ei(n,this,t)),this._$AV.push(h),c=i[++a]}o!==(c==null?void 0:c.index)&&(n=E.nextNode(),o++)}return E.currentNode=P,r}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 V{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,i,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=r,this._$Cv=(r==null?void 0:r.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),B(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.$(t):t.nodeType!==void 0?this.T(t):Ke(t)?this.k(t):this._(t)}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}_(t){this._$AH!==d&&B(this._$AH)?this._$AA.nextSibling.data=t:this.T(P.createTextNode(t)),this._$AH=t}$(t){var n;const{values:e,_$litType$:i}=t,r=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=z.createElement(pe(i.h,i.h[0]),this.options)),i);if(((n=this._$AH)==null?void 0:n._$AD)===r)this._$AH.p(e);else{const o=new Je(r,this),a=o.u(this.options);o.p(e),this.T(a),this._$AH=o}}_$AC(t){let e=Wt.get(t.strings);return e===void 0&&Wt.set(t.strings,e=new z(t)),e}k(t){he(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,r=0;for(const n of t)r===e.length?e.push(i=new V(this.S(D()),this.S(D()),this,this.options)):i=e[r],i._$AI(n),r++;r<e.length&&(this._$AR(i&&i._$AB.nextSibling,r),e.length=r)}_$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 r=t.nextSibling;t.remove(),t=r}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}}class st{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,r,n){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,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,r){const n=this.strings;let o=!1;if(n===void 0)t=R(this,t,e,0),o=!B(t)||t!==this._$AH&&t!==O,o&&(this._$AH=t);else{const a=t;let c,h;for(t=n[0],c=0;c<n.length-1;c++)h=R(this,a[i+c],e,c),h===O&&(h=this._$AH[c]),o||(o=!B(h)||h!==this._$AH[c]),h===d?t=d:t!==d&&(t+=(h??"")+n[c+1]),this._$AH[c]=h}o&&!r&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Xe extends st{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}}class Qe extends st{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}}class ti extends st{constructor(t,e,i,r,n){super(t,e,i,r,n),this.type=5}_$AI(t,e=this){if((t=R(this,t,e,0)??d)===O)return;const i=this._$AH,r=t===d&&i!==d||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,n=t!==d&&(i===d||r);r&&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 ei{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=H.litHtmlPolyfillSupport;lt==null||lt(z,V),(H.litHtmlVersions??(H.litHtmlVersions=[])).push("3.1.2");const ii=(s,t,e)=>{const i=(e==null?void 0:e.renderBefore)??t;let r=i._$litPart$;if(r===void 0){const n=(e==null?void 0:e.renderBefore)??null;i._$litPart$=r=new V(t.insertBefore(D(),n),n,void 0,e??{})}return r._$AI(s),r};/**
|
18
18
|
* @license
|
19
19
|
* Copyright 2017 Google LLC
|
20
20
|
* SPDX-License-Identifier: BSD-3-Clause
|
@@ -390,7 +390,7 @@
|
|
390
390
|
animation: slideDown 0.3s linear;
|
391
391
|
pointer-events: none;
|
392
392
|
}
|
393
|
-
`;Ii([m({attribute:!1}),Pi({context:be})],nt.prototype,"application",2);class Ri{constructor(){this.root=this.createRoot()}createComponentModel(t,e){this.root.application=e;const i=a=>{if(Array.isArray(a)){const[c,...h]=a;return{definitionId:c,overrides:h}}return{definitionId:a,overrides:[]}},r=(a,c,h,l)=>{h.forEach(p=>{const f=i(p),u=l[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&&r(a,g,u.children,l))})},{entry:n,components:o}=t;return r(this,this.root,[n],o),this.root}createRoot(){return new nt}createNode(t,e){const i=this.resolveComponent(e);if(!i)return console.warn(`Unable to resolve component: ${e}`),new Et;const r=new i;return r.type=e,r.name=t,r}resolveComponent(t){return customElements.get(`ace-${t}`)}getRoot(){return this.root}}const $e=class{constructor(){this.components=new Map}getComponent(s){const t=this.components.get(s);return t||console.warn(`Unable to resolve component: ${s}. You most likely forgot to register the required plugin.`),t}registerComponent(s,t){this.components.set(s,t)}async loadComponents(){const s=[...this.components.entries()].map(([t,e])=>e.then(i=>{this.defineAsWebComponent(t,i.default)}));await Promise.all(s)}defineAsWebComponent(s,t){const e=$e.ResolveWebComponentName(s);customElements.get(e)||customElements.define(e,t)}};let we=$e;we.ResolveWebComponentName=s=>`ace-${s}`;var v=(s=>(s.Necessary="necessary",s.Functional="functional",s.Analytics="analytics",s))(v||{});class _e{constructor(t,e,i){this.disallowedKeys=[],this.widgetId=t,this.storage=e==="localStorage"?window.localStorage:window.sessionStorage,this.policy=i}set(t,e,i){if(!this.disallowedKeys.includes(t))if(this.policy[i]){const r={value:e,category:i};this.storage.setItem(this._prefixKey(t),JSON.stringify(r))}else console.warn(`Storage policy does not allow storing items in category: ${i}`)}get(t){const e=this.storage.getItem(this._prefixKey(t));if(!e)return null;try{const i=JSON.parse(e);return this.policy[i.category]?i.value:(console.warn(`Storage policy does not allow retrieving items from category: ${i.category}`),null)}catch{return null}}removeItem(t){this.storage.removeItem(this._prefixKey(t))}updatePolicy(t){this.policy=t}disallowKey(t){this.disallowedKeys.includes(t)||this.disallowedKeys.push(t),this.removeItem(t)}_prefixKey(t){return`ace_${this.widgetId.substring(0,7)}-${t}`}}class Ni{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 Ui{constructor(t){this.widget=t,this.name=t.name}open(){this.widget.appendToDOM()}close(){this.widget.hide()}setZIndex(t){this.widget.setZIndex(t)}}class Ae{constructor(t,e,i,r,n){this.id=t,this.name=e,this.container=i,this.settings=r,this.options=n,this.platform=new Ri,this.texts=new Ni,this.renderStrategy=$.Inline,this.anchor="BottomRight",this.autoActivate=!1,this.plugins=[],this.componentResolver=new we,this.components=[],this.trigger=null,this.api=new Ui(this),this.renderStrategy=this.options.renderStrategy||$.Inline,this.triggerIcon=this.options.triggerIcon;const o={[v.Necessary]:!0,[v.Functional]:!0,[v.Analytics]:!0};this.storage=new _e(this.id,"sessionStorage",o),typeof n.autoActivate=="boolean"&&(this.autoActivate=n.autoActivate),n.anchor&&(this.anchor=n.anchor),this.container.register("$settings",r),this.texts.loadTexts(r.texts||{})}async activate(){if(await this.loadPlugins(),await this.componentResolver.loadComponents(),this.root=this.platform.createComponentModel(this.settings,this),this.container.setState(ne.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",!0,v.Necessary)}hide(){this.root&&(this.root.classList.add("hidden"),this.root.classList.remove("expanded")),this.storage.set("open",!1,v.Necessary)}setZIndex(t){this.root&&(this.root.style.zIndex=t.toString())}mute(){this.storage.set("muteAudioNotifications",!0,v.Necessary)}unmute(){this.storage.set("muteAudioNotifications",!1,v.Necessary)}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===$.Trigger){let e=document.querySelector(`ace-trigger-slot.${t}`);return e||(e=new rt,e.anchor=this.anchor,document.body.appendChild(e)),e}return document.body}render(){if(this.renderStrategy===$.Trigger){const t=new b;return t.application=this,this.trigger=t,this.storage.get("open")&&this.trigger.toggleActive(),t}return this.root}}const ki=s=>new W(s),xe=class{constructor(s=xe.endpoint){this._endpoint=s}async getSite(s){const e=await(await fetch(s)).json();return e?{id:e.id,apps:e.widgets.map(i=>{let r=$.Inline;return i.renderStrategy==="Trigger"&&(r=$.Trigger),{id:i.id,widgetId:i.widgetId,renderStrategy:r,autoActivate:i.autoActivate,anchor:i.anchor,triggerIcon:{type:"Telia",content:i.triggerIcon}}})}:null}async getWidget(s){const e=await(await fetch(`${this._endpoint}/widget/${s}`)).json();return e?{name:e.name,config:JSON.parse(e.configuration)}:null}};let W=xe;W.endpoint="https://widgets.ace.teliacompany.net/api";class Mi{constructor(t){this.site=t}storagePolicy(t){var i;(((i=this.site.environment)==null?void 0:i.applications)||[]).forEach(r=>{if(r.storage){const n={[v.Analytics]:t.includes("analytics"),[v.Necessary]:t.includes("necessary"),[v.Functional]:t.includes("functional")};r.storage.updatePolicy(n)}})}disallowStorageKey(t){var e;(((e=this.site.environment)==null?void 0:e.applications)||[]).forEach(i=>{i.storage&&i.storage.disallowKey(t)})}}class Ce{constructor(){this.applications=[],this.container=new $t("environment",this),this.bootstrapped=!1,this.site=null,this.widgetAPIHandlers=new Map,this.siteConfigurationHandlers=[],setTimeout(()=>{this.notifyWidgetsOfCreation()},1e3)}async bootstrap(){await this.activate(),this.siteConfigurationHandlers.forEach(t=>{this.site&&t(this.site.api)});for(const[t,e]of this.widgetAPIHandlers)e.forEach(i=>{i()});this.bootstrapped=!0}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(r=>r.name===e.name);i&&e.dispatchEvent(new CustomEvent("environment-created",{detail:{widget:i}}))})}configure(t){if(!this.site||!this.bootstrapped){this.siteConfigurationHandlers.push(t);return}t(this.site.api)}widget(t,e){const i=this.applications.find(r=>r.name===t);if(!i){const r=this.widgetAPIHandlers.get(t)||[];r.push(()=>{const n=this.applications.find(o=>o.name===t);e(n==null?void 0:n.api)}),this.widgetAPIHandlers.set(t,r);return}e(i==null?void 0:i.api)}registerApp(t,e,i,r){const n=new $t(e,this),o=new Ae(t,e,n,i,r);this.applications.push(o)}registerSite(t){this.site=t}plugin(t){return this.applications.forEach(e=>{e.plugin(t)}),this}}class Se{constructor(t){this.configurations=[],this.httpClient=new W,this.api=new Mi(this),this.httpClient=new W,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 Ce,this.addGlobal(this.environment);for await(const i of this.configurations){const r=await this.httpClient.getWidget(i.widgetId);r&&((e=this.environment)==null||e.registerApp(i.widgetId,r.name,r.config,{renderStrategy:i.renderStrategy,triggerIcon:i.triggerIcon,autoActivate:i.autoActivate,anchor:i.anchor}))}t(this.environment),this.environment.registerSite(this),await this.environment.bootstrap()}addGlobal(t){const e=globalThis.ace;((e==null?void 0:e._w)||[]).forEach(([i,r])=>{t.widget(i,r)}),((e==null?void 0:e._c)||[]).forEach(i=>{t.configure(i)}),globalThis.ace=t}}var ji=Object.defineProperty,Hi=Object.getOwnPropertyDescriptor,Pt=(s,t,e,i)=>{for(var r=i>1?void 0:i?Hi(t,e):t,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(t,e,r):o(r))||r);return i&&r&&ji(t,e,r),r};class k 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===$.Trigger){const t=new b;return t.application=this.widget,t}return this.widget.render()}}k.styles=[N`
|
393
|
+
`;Ii([m({attribute:!1}),Pi({context:be})],nt.prototype,"application",2);class Ri{constructor(){this.root=this.createRoot()}createComponentModel(t,e){this.root.application=e;const i=a=>{if(Array.isArray(a)){const[c,...h]=a;return{definitionId:c,overrides:h}}return{definitionId:a,overrides:[]}},r=(a,c,h,l)=>{h.forEach(p=>{const f=i(p),u=l[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&&r(a,g,u.children,l))})},{entry:n,components:o}=t;return r(this,this.root,[n],o),this.root}createRoot(){return new nt}createNode(t,e){const i=this.resolveComponent(e);if(!i)return console.warn(`Unable to resolve component: ${e}`),new Et;const r=new i;return r.type=e,r.name=t,r}resolveComponent(t){return customElements.get(`ace-${t}`)}getRoot(){return this.root}}const $e=class{constructor(){this.components=new Map}getComponent(s){const t=this.components.get(s);return t||console.warn(`Unable to resolve component: ${s}. You most likely forgot to register the required plugin.`),t}registerComponent(s,t){this.components.set(s,t)}async loadComponents(){const s=[...this.components.entries()].map(([t,e])=>e.then(i=>{this.defineAsWebComponent(t,i.default)}));await Promise.all(s)}defineAsWebComponent(s,t){const e=$e.ResolveWebComponentName(s);customElements.get(e)||customElements.define(e,t)}};let we=$e;we.ResolveWebComponentName=s=>`ace-${s}`;var v=(s=>(s.Necessary="necessary",s.Functional="functional",s.Analytics="analytics",s))(v||{});class _e{constructor(t,e,i){this.disallowedKeys=[],this.widgetId=t,this.storage=e==="localStorage"?window.localStorage:window.sessionStorage,this.policy=i}set(t,e,i){if(!this.disallowedKeys.includes(t))if(this.policy[i]){const r={value:e,category:i};this.storage.setItem(this._prefixKey(t),JSON.stringify(r))}else console.warn(`Storage policy does not allow storing items in category: ${i}`)}get(t){const e=this.storage.getItem(this._prefixKey(t));if(!e)return null;try{const i=JSON.parse(e);return this.policy[i.category]?i.value:(console.warn(`Storage policy does not allow retrieving items from category: ${i.category}`),null)}catch{return null}}removeItem(t){this.storage.removeItem(this._prefixKey(t))}enforcePolicy(){var t;for(const[e,i]of Object.entries(this.storage)){const r=(t=JSON.parse(i))==null?void 0:t.category;this.policy[r]||this.storage.removeItem(e)}}updatePolicy(t){this.policy=t,this.enforcePolicy()}disallowKey(t){this.disallowedKeys.includes(t)||this.disallowedKeys.push(t),this.removeItem(t)}_prefixKey(t){return`ace_${this.widgetId.substring(0,7)}-${t}`}}class Ni{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 Ui{constructor(t){this.widget=t,this.name=t.name}open(){this.widget.appendToDOM()}close(){this.widget.hide()}setZIndex(t){this.widget.setZIndex(t)}}class Ae{constructor(t,e,i,r,n){this.id=t,this.name=e,this.container=i,this.settings=r,this.options=n,this.platform=new Ri,this.texts=new Ni,this.renderStrategy=$.Inline,this.anchor="BottomRight",this.autoActivate=!1,this.plugins=[],this.componentResolver=new we,this.components=[],this.trigger=null,this.api=new Ui(this),this.renderStrategy=this.options.renderStrategy||$.Inline,this.triggerIcon=this.options.triggerIcon;const o={[v.Necessary]:!0,[v.Functional]:!0,[v.Analytics]:!0};this.storage=new _e(this.id,"sessionStorage",o),typeof n.autoActivate=="boolean"&&(this.autoActivate=n.autoActivate),n.anchor&&(this.anchor=n.anchor),this.container.register("$settings",r),this.texts.loadTexts(r.texts||{})}async activate(){if(await this.loadPlugins(),await this.componentResolver.loadComponents(),this.root=this.platform.createComponentModel(this.settings,this),this.container.setState(ne.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",!0,v.Necessary)}hide(){this.root&&(this.root.classList.add("hidden"),this.root.classList.remove("expanded")),this.storage.set("open",!1,v.Necessary)}setZIndex(t){this.root&&(this.root.style.zIndex=t.toString())}mute(){this.storage.set("muteAudioNotifications",!0,v.Necessary)}unmute(){this.storage.set("muteAudioNotifications",!1,v.Necessary)}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===$.Trigger){let e=document.querySelector(`ace-trigger-slot.${t}`);return e||(e=new rt,e.anchor=this.anchor,document.body.appendChild(e)),e}return document.body}render(){if(this.renderStrategy===$.Trigger){const t=new b;return t.application=this,this.trigger=t,this.storage.get("open")&&this.trigger.toggleActive(),t}return this.root}}const ki=s=>new W(s),xe=class{constructor(s=xe.endpoint){this._endpoint=s}async getSite(s){const e=await(await fetch(s)).json();return e?{id:e.id,apps:e.widgets.map(i=>{let r=$.Inline;return i.renderStrategy==="Trigger"&&(r=$.Trigger),{id:i.id,widgetId:i.widgetId,renderStrategy:r,autoActivate:i.autoActivate,anchor:i.anchor,triggerIcon:{type:"Telia",content:i.triggerIcon}}})}:null}async getWidget(s){const e=await(await fetch(`${this._endpoint}/widget/${s}`)).json();return e?{name:e.name,config:JSON.parse(e.configuration)}:null}};let W=xe;W.endpoint="https://widgets.ace.teliacompany.net/api";class ji{constructor(t){this.site=t}storagePolicy(t){var i;(((i=this.site.environment)==null?void 0:i.applications)||[]).forEach(r=>{if(r.storage){const n={[v.Analytics]:t.includes("analytics"),[v.Necessary]:t.includes("necessary"),[v.Functional]:t.includes("functional")};r.storage.updatePolicy(n)}})}disallowStorageKey(t){var e;(((e=this.site.environment)==null?void 0:e.applications)||[]).forEach(i=>{i.storage&&i.storage.disallowKey(t)})}}class Ce{constructor(){this.applications=[],this.container=new $t("environment",this),this.bootstrapped=!1,this.site=null,this.widgetAPIHandlers=new Map,this.siteConfigurationHandlers=[],setTimeout(()=>{this.notifyWidgetsOfCreation()},1e3)}async bootstrap(){await this.activate(),this.siteConfigurationHandlers.forEach(t=>{this.site&&t(this.site.api)});for(const[t,e]of this.widgetAPIHandlers)e.forEach(i=>{i()});this.bootstrapped=!0}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(r=>r.name===e.name);i&&e.dispatchEvent(new CustomEvent("environment-created",{detail:{widget:i}}))})}configure(t){if(!this.site||!this.bootstrapped){this.siteConfigurationHandlers.push(t);return}t(this.site.api)}widget(t,e){const i=this.applications.find(r=>r.name===t);if(!i){const r=this.widgetAPIHandlers.get(t)||[];r.push(()=>{const n=this.applications.find(o=>o.name===t);e(n==null?void 0:n.api)}),this.widgetAPIHandlers.set(t,r);return}e(i==null?void 0:i.api)}registerApp(t,e,i,r){const n=new $t(e,this),o=new Ae(t,e,n,i,r);this.applications.push(o)}registerSite(t){this.site=t}plugin(t){return this.applications.forEach(e=>{e.plugin(t)}),this}}class Se{constructor(t){this.configurations=[],this.httpClient=new W,this.api=new ji(this),this.httpClient=new W,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 Ce,this.addGlobal(this.environment);for await(const i of this.configurations){const r=await this.httpClient.getWidget(i.widgetId);r&&((e=this.environment)==null||e.registerApp(i.widgetId,r.name,r.config,{renderStrategy:i.renderStrategy,triggerIcon:i.triggerIcon,autoActivate:i.autoActivate,anchor:i.anchor}))}t(this.environment),this.environment.registerSite(this),await this.environment.bootstrap()}addGlobal(t){const e=globalThis.ace;((e==null?void 0:e._w)||[]).forEach(([i,r])=>{t.widget(i,r)}),((e==null?void 0:e._c)||[]).forEach(i=>{t.configure(i)}),globalThis.ace=t}}var Mi=Object.defineProperty,Hi=Object.getOwnPropertyDescriptor,Pt=(s,t,e,i)=>{for(var r=i>1?void 0:i?Hi(t,e):t,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(t,e,r):o(r))||r);return i&&r&&Mi(t,e,r),r};class k 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===$.Trigger){const t=new b;return t.application=this.widget,t}return this.widget.render()}}k.styles=[N`
|
394
394
|
:host {
|
395
395
|
display: block;
|
396
396
|
}
|
package/index.mjs
CHANGED
@@ -587,7 +587,7 @@ const Re = (s) => new oe(typeof s == "string" ? s : s + "", void 0, _t), N = (s,
|
|
587
587
|
* Copyright 2017 Google LLC
|
588
588
|
* SPDX-License-Identifier: BSD-3-Clause
|
589
589
|
*/
|
590
|
-
const { is: Ue, defineProperty: ke, getOwnPropertyDescriptor:
|
590
|
+
const { is: Ue, defineProperty: ke, getOwnPropertyDescriptor: je, getOwnPropertyNames: Me, getOwnPropertySymbols: He, getPrototypeOf: Le } = Object, x = globalThis, jt = x.trustedTypes, De = jt ? jt.emptyScript : "", ct = x.reactiveElementPolyfillSupport, j = (s, t) => s, X = { toAttribute(s, t) {
|
591
591
|
switch (t) {
|
592
592
|
case Boolean:
|
593
593
|
s = s ? De : null;
|
@@ -615,7 +615,7 @@ const { is: Ue, defineProperty: ke, getOwnPropertyDescriptor: Me, getOwnProperty
|
|
615
615
|
}
|
616
616
|
}
|
617
617
|
return e;
|
618
|
-
} }, At = (s, t) => !Ue(s, t),
|
618
|
+
} }, At = (s, t) => !Ue(s, t), Mt = { attribute: !0, type: String, converter: X, reflect: !1, hasChanged: At };
|
619
619
|
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), x.litPropertyMetadata ?? (x.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
620
620
|
let T = class extends HTMLElement {
|
621
621
|
static addInitializer(t) {
|
@@ -624,14 +624,14 @@ let T = class extends HTMLElement {
|
|
624
624
|
static get observedAttributes() {
|
625
625
|
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
626
626
|
}
|
627
|
-
static createProperty(t, e =
|
627
|
+
static createProperty(t, e = Mt) {
|
628
628
|
if (e.state && (e.attribute = !1), this._$Ei(), this.elementProperties.set(t, e), !e.noAccessor) {
|
629
629
|
const i = Symbol(), r = this.getPropertyDescriptor(t, i, e);
|
630
630
|
r !== void 0 && ke(this.prototype, t, r);
|
631
631
|
}
|
632
632
|
}
|
633
633
|
static getPropertyDescriptor(t, e, i) {
|
634
|
-
const { get: r, set: n } =
|
634
|
+
const { get: r, set: n } = je(this.prototype, t) ?? { get() {
|
635
635
|
return this[e];
|
636
636
|
}, set(o) {
|
637
637
|
this[e] = o;
|
@@ -644,19 +644,19 @@ let T = class extends HTMLElement {
|
|
644
644
|
}, configurable: !0, enumerable: !0 };
|
645
645
|
}
|
646
646
|
static getPropertyOptions(t) {
|
647
|
-
return this.elementProperties.get(t) ??
|
647
|
+
return this.elementProperties.get(t) ?? Mt;
|
648
648
|
}
|
649
649
|
static _$Ei() {
|
650
|
-
if (this.hasOwnProperty(
|
650
|
+
if (this.hasOwnProperty(j("elementProperties")))
|
651
651
|
return;
|
652
652
|
const t = Le(this);
|
653
653
|
t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
|
654
654
|
}
|
655
655
|
static finalize() {
|
656
|
-
if (this.hasOwnProperty(
|
656
|
+
if (this.hasOwnProperty(j("finalized")))
|
657
657
|
return;
|
658
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(
|
659
|
-
const e = this.properties, i = [...
|
658
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(j("properties"))) {
|
659
|
+
const e = this.properties, i = [...Me(e), ...He(e)];
|
660
660
|
for (const r of i)
|
661
661
|
this.createProperty(r, e[r]);
|
662
662
|
}
|
@@ -828,13 +828,13 @@ let T = class extends HTMLElement {
|
|
828
828
|
firstUpdated(t) {
|
829
829
|
}
|
830
830
|
};
|
831
|
-
T.elementStyles = [], T.shadowRootOptions = { mode: "open" }, T[
|
831
|
+
T.elementStyles = [], T.shadowRootOptions = { mode: "open" }, T[j("elementProperties")] = /* @__PURE__ */ new Map(), T[j("finalized")] = /* @__PURE__ */ new Map(), ct == null || ct({ ReactiveElement: T }), (x.reactiveElementVersions ?? (x.reactiveElementVersions = [])).push("2.0.4");
|
832
832
|
/**
|
833
833
|
* @license
|
834
834
|
* Copyright 2017 Google LLC
|
835
835
|
* SPDX-License-Identifier: BSD-3-Clause
|
836
836
|
*/
|
837
|
-
const
|
837
|
+
const M = globalThis, Q = M.trustedTypes, Ht = Q ? Q.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, ae = "$lit$", A = `lit$${(Math.random() + "").slice(9)}$`, ce = "?" + A, Be = `<${ce}>`, P = document, L = () => P.createComment(""), D = (s) => s === null || typeof s != "object" && typeof s != "function", he = Array.isArray, ze = (s) => he(s) || typeof (s == null ? void 0 : s[Symbol.iterator]) == "function", ht = `[
|
838
838
|
\f\r]`, k = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Lt = /-->/g, Dt = />/g, C = RegExp(`>|${ht}(?:([^\\s"'>=/]+)(${ht}*=${ht}*(?:[^
|
839
839
|
\f\r"'\`<>=]|("|')|))|$)`, "g"), Bt = /'/g, zt = /"/g, le = /^(?:script|style|textarea|title)$/i, We = (s) => (t, ...e) => ({ _$litType$: s, strings: t, values: e }), I = We(1), O = Symbol.for("lit-noChange"), d = Symbol.for("lit-nothing"), Wt = /* @__PURE__ */ new WeakMap(), E = P.createTreeWalker(P, 129);
|
840
840
|
function pe(s, t) {
|
@@ -1070,8 +1070,8 @@ class Ze {
|
|
1070
1070
|
R(this, t);
|
1071
1071
|
}
|
1072
1072
|
}
|
1073
|
-
const lt =
|
1074
|
-
lt == null || lt(B, W), (
|
1073
|
+
const lt = M.litHtmlPolyfillSupport;
|
1074
|
+
lt == null || lt(B, W), (M.litHtmlVersions ?? (M.litHtmlVersions = [])).push("3.1.2");
|
1075
1075
|
const Ge = (s, t, e) => {
|
1076
1076
|
const i = (e == null ? void 0 : e.renderBefore) ?? t;
|
1077
1077
|
let r = i._$litPart$;
|
@@ -2326,8 +2326,15 @@ class Oi {
|
|
2326
2326
|
removeItem(t) {
|
2327
2327
|
this.storage.removeItem(this._prefixKey(t));
|
2328
2328
|
}
|
2329
|
+
enforcePolicy() {
|
2330
|
+
var t;
|
2331
|
+
for (const [e, i] of Object.entries(this.storage)) {
|
2332
|
+
const r = (t = JSON.parse(i)) == null ? void 0 : t.category;
|
2333
|
+
this.policy[r] || this.storage.removeItem(e);
|
2334
|
+
}
|
2335
|
+
}
|
2329
2336
|
updatePolicy(t) {
|
2330
|
-
this.policy = t;
|
2337
|
+
this.policy = t, this.enforcePolicy();
|
2331
2338
|
}
|
2332
2339
|
disallowKey(t) {
|
2333
2340
|
this.disallowedKeys.includes(t) || this.disallowedKeys.push(t), this.removeItem(t);
|
@@ -2622,10 +2629,10 @@ class ki {
|
|
2622
2629
|
}), globalThis.ace = t;
|
2623
2630
|
}
|
2624
2631
|
}
|
2625
|
-
var
|
2626
|
-
for (var r = i > 1 ? void 0 : i ?
|
2632
|
+
var ji = Object.defineProperty, Mi = Object.getOwnPropertyDescriptor, Et = (s, t, e, i) => {
|
2633
|
+
for (var r = i > 1 ? void 0 : i ? Mi(t, e) : t, n = s.length - 1, o; n >= 0; n--)
|
2627
2634
|
(o = s[n]) && (r = (i ? o(t, e, r) : o(r)) || r);
|
2628
|
-
return i && r &&
|
2635
|
+
return i && r && ji(t, e, r), r;
|
2629
2636
|
};
|
2630
2637
|
class V extends w {
|
2631
2638
|
constructor() {
|
package/package.json
CHANGED
@@ -12,6 +12,7 @@ export declare class StorageService {
|
|
12
12
|
set<T>(key: string, value: T, category: StorageCategory): void;
|
13
13
|
get<T>(key: string): T | null;
|
14
14
|
removeItem(key: string): void;
|
15
|
+
enforcePolicy(): void;
|
15
16
|
updatePolicy(newPolicy: Record<StorageCategory, boolean>): void;
|
16
17
|
disallowKey(key: string): void;
|
17
18
|
private _prefixKey;
|