@telia-ace/widget-core-flamingo 1.1.120-rc.21 → 1.1.120-rc.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +20 -18
- package/index.mjs +63 -61
- package/package.json +1 -1
package/index.js
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var gt=function(r,t){return gt=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])},gt(r,t)};function G(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");gt(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function mt(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 vt(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var i=e.call(r),s,o=[],n;try{for(;(t===void 0||t-- >0)&&!(s=i.next()).done;)o.push(s.value)}catch(a){n={error:a}}finally{try{s&&!s.done&&(e=i.return)&&e.call(i)}finally{if(n)throw n.error}}return o}function yt(r,t,e){if(e||arguments.length===2)for(var i=0,s=t.length,o;i<s;i++)(o||!(i in t))&&(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return r.concat(o||Array.prototype.slice.call(t))}function _(r){return typeof r=="function"}function ce(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 at=ce(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 bt(r,t){if(r){var e=r.indexOf(t);0<=e&&r.splice(e,1)}}var ot=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,o;if(!this.closed){this.closed=!0;var n=this._parentage;if(n)if(this._parentage=null,Array.isArray(n))try{for(var a=mt(n),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 n.remove(this);var h=this.initialTeardown;if(_(h))try{h()}catch(v){o=v instanceof at?v.errors:[v]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var u=mt(d),f=u.next();!f.done;f=u.next()){var g=f.value;try{jt(g)}catch(v){o=o??[],v instanceof at?o=yt(yt([],vt(o)),vt(v.errors)):o.push(v)}}}catch(v){i={error:v}}finally{try{f&&!f.done&&(s=u.return)&&s.call(u)}finally{if(i)throw i.error}}}if(o)throw new at(o)}},r.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)jt(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)&&bt(e,t)},r.prototype.remove=function(t){var e=this._finalizers;e&&bt(e,t),t instanceof r&&t._removeParent(this)},r.EMPTY=function(){var t=new r;return t.closed=!0,t}(),r}(),he=ot.EMPTY;function le(r){return r instanceof ot||r&&"closed"in r&&_(r.remove)&&_(r.add)&&_(r.unsubscribe)}function jt(r){_(r)?r():r.unsubscribe()}var Re={Promise:void 0},Me={setTimeout:function(r,t){for(var e=[],i=2;i<arguments.length;i++)e[i-2]=arguments[i];return setTimeout.apply(void 0,yt([r,t],vt(e)))},clearTimeout:function(r){return clearTimeout(r)},delegate:void 0};function Ne(r){Me.setTimeout(function(){throw r})}function Ht(){}function J(r){r()}var de=function(r){G(t,r);function t(e){var i=r.call(this)||this;return i.isStopped=!1,e?(i.destination=e,le(e)&&e.add(i)):i.destination=je,i}return t.create=function(e,i,s){return new wt(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}(ot),
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=e}});function bt(r,t){if(r){var e=r.indexOf(t);0<=e&&r.splice(e,1)}}var ot=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,o;if(!this.closed){this.closed=!0;var n=this._parentage;if(n)if(this._parentage=null,Array.isArray(n))try{for(var a=mt(n),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 n.remove(this);var h=this.initialTeardown;if(_(h))try{h()}catch(v){o=v instanceof at?v.errors:[v]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var u=mt(d),f=u.next();!f.done;f=u.next()){var g=f.value;try{jt(g)}catch(v){o=o??[],v instanceof at?o=yt(yt([],vt(o)),vt(v.errors)):o.push(v)}}}catch(v){i={error:v}}finally{try{f&&!f.done&&(s=u.return)&&s.call(u)}finally{if(i)throw i.error}}}if(o)throw new at(o)}},r.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)jt(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)&&bt(e,t)},r.prototype.remove=function(t){var e=this._finalizers;e&&bt(e,t),t instanceof r&&t._removeParent(this)},r.EMPTY=function(){var t=new r;return t.closed=!0,t}(),r}(),he=ot.EMPTY;function le(r){return r instanceof ot||r&&"closed"in r&&_(r.remove)&&_(r.add)&&_(r.unsubscribe)}function jt(r){_(r)?r():r.unsubscribe()}var Re={Promise:void 0},Me={setTimeout:function(r,t){for(var e=[],i=2;i<arguments.length;i++)e[i-2]=arguments[i];return setTimeout.apply(void 0,yt([r,t],vt(e)))},clearTimeout:function(r){return clearTimeout(r)},delegate:void 0};function Ne(r){Me.setTimeout(function(){throw r})}function Ht(){}function J(r){r()}var de=function(r){G(t,r);function t(e){var i=r.call(this)||this;return i.isStopped=!1,e?(i.destination=e,le(e)&&e.add(i)):i.destination=je,i}return t.create=function(e,i,s){return new wt(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}(ot),Le=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){Z(i)}},r.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(i){Z(i)}else Z(t)},r.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){Z(e)}},r}(),wt=function(r){G(t,r);function t(e,i,s){var o=r.call(this)||this,n;return _(e)||!e?n={next:e??void 0,error:i??void 0,complete:s??void 0}:n=e,o.destination=new Le(n),o}return t}(de);function Z(r){Ne(r)}function Ue(r){throw r}var je={closed:!0,next:Ht,error:Ue,complete:Ht},He=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Fe(r){return r}function Be(r){return r.length===0?Fe:r.length===1?r[0]:function(e){return r.reduce(function(i,s){return s(i)},e)}}var Ft=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,o=ze(t)?t:new wt(t,e,i);return J(function(){var n=s,a=n.operator,c=n.source;o.add(a?a.call(o,c):c?s._subscribe(o):s._trySubscribe(o))}),o},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=Bt(e),new e(function(s,o){var n=new wt({next:function(a){try{t(a)}catch(c){o(c),n.unsubscribe()}},error:o,complete:s});i.subscribe(n)})},r.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},r.prototype[He]=function(){return this},r.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Be(t)(this)},r.prototype.toPromise=function(t){var e=this;return t=Bt(t),new t(function(i,s){var o;e.subscribe(function(n){return o=n},function(n){return s(n)},function(){return i(o)})})},r.create=function(t){return new r(t)},r}();function Bt(r){var t;return(t=r??Re.Promise)!==null&&t!==void 0?t:Promise}function De(r){return r&&_(r.next)&&_(r.error)&&_(r.complete)}function ze(r){return r&&r instanceof de||De(r)&&le(r)}var We=ce(function(r){return function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),xt=function(r){G(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 Dt(this,this);return i.operator=e,i},t.prototype._throwIfClosed=function(){if(this.closed)throw new We},t.prototype.next=function(e){var i=this;J(function(){var s,o;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var n=mt(i.currentObservers),a=n.next();!a.done;a=n.next()){var c=a.value;c.next(e)}}catch(l){s={error:l}}finally{try{a&&!a.done&&(o=n.return)&&o.call(n)}finally{if(s)throw s.error}}}})},t.prototype.error=function(e){var i=this;J(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;J(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,o=s.hasError,n=s.isStopped,a=s.observers;return o||n?he:(this.currentObservers=null,a.push(e),new ot(function(){i.currentObservers=null,bt(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var i=this,s=i.hasError,o=i.thrownError,n=i.isStopped;s?e.error(o):n&&e.complete()},t.prototype.asObservable=function(){var e=new Ft;return e.source=this,e},t.create=function(e,i){return new Dt(e,i)},t}(Ft),Dt=function(r){G(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:he},t}(xt),Ct=function(r){G(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,o=e._value;if(i)throw s;return this._throwIfClosed(),o},t.prototype.next=function(e){r.prototype.next.call(this,this._value=e)},t}(xt),ue=(r=>(r.Loading="loading",r.Ready="ready",r))(ue||{});class $t{constructor(t,e){this.state=new Ct("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
|
7
|
-
*/const X=globalThis,
|
7
|
+
*/const X=globalThis,Et=X.ShadowRoot&&(X.ShadyCSS===void 0||X.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,St=Symbol(),zt=new WeakMap;let pe=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==St)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(Et&&t===void 0){const i=e!==void 0&&e.length===1;i&&(t=zt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&zt.set(e,t))}return t}toString(){return this.cssText}};const Ve=r=>new pe(typeof r=="string"?r:r+"",void 0,St),j=(r,...t)=>{const e=r.length===1?r[0]:t.reduce((i,s,o)=>i+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+r[o+1],r[0]);return new pe(e,r,St)},qe=(r,t)=>{if(Et)r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const i=document.createElement("style"),s=X.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=e.cssText,r.appendChild(i)}},Wt=Et?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return Ve(e)})(r):r;/**
|
8
8
|
* @license
|
9
9
|
* Copyright 2017 Google LLC
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
11
|
-
*/const{is:Ge,defineProperty:Ke,getOwnPropertyDescriptor:Ye,getOwnPropertyNames:Ze,getOwnPropertySymbols:Je,getPrototypeOf:Xe}=Object,C=globalThis,
|
11
|
+
*/const{is:Ge,defineProperty:Ke,getOwnPropertyDescriptor:Ye,getOwnPropertyNames:Ze,getOwnPropertySymbols:Je,getPrototypeOf:Xe}=Object,C=globalThis,Vt=C.trustedTypes,Qe=Vt?Vt.emptyScript:"",ct=C.reactiveElementPolyfillSupport,B=(r,t)=>r,Q={toAttribute(r,t){switch(t){case Boolean:r=r?Qe: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}},Pt=(r,t)=>!Ge(r,t),qt={attribute:!0,type:String,converter:Q,reflect:!1,useDefault:!1,hasChanged:Pt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),C.litPropertyMetadata??(C.litPropertyMetadata=new WeakMap);let R=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=qt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);s!==void 0&&Ke(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:o}=Ye(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get:s,set(n){const a=s==null?void 0:s.call(this);o==null||o.call(this,n),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??qt}static _$Ei(){if(this.hasOwnProperty(B("elementProperties")))return;const t=Xe(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(B("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(B("properties"))){const e=this.properties,i=[...Ze(e),...Je(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(Wt(s))}else t!==void 0&&e.push(Wt(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 qe(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)}_$ET(t,e){var o;const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(s!==void 0&&i.reflect===!0){const n=(((o=i.converter)==null?void 0:o.toAttribute)!==void 0?i.converter:Q).toAttribute(e,i.type);this._$Em=t,n==null?this.removeAttribute(s):this.setAttribute(s,n),this._$Em=null}}_$AK(t,e){var o,n;const i=this.constructor,s=i._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const a=i.getPropertyOptions(s),c=typeof a.converter=="function"?{fromAttribute:a.converter}:((o=a.converter)==null?void 0:o.fromAttribute)!==void 0?a.converter:Q;this._$Em=s,this[s]=c.fromAttribute(e,a.type)??((n=this._$Ej)==null?void 0:n.get(s))??null,this._$Em=null}}requestUpdate(t,e,i){var s;if(t!==void 0){const o=this.constructor,n=this[t];if(i??(i=o.getPropertyOptions(t)),!((i.hasChanged??Pt)(n,e)||i.useDefault&&i.reflect&&n===((s=this._$Ej)==null?void 0:s.get(t))&&!this.hasAttribute(o._$Eu(t,i))))return;this.C(t,e,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:o},n){i&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,n??e??this[t]),o!==!0||n!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),s===!0&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){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[o,n]of this._$Ep)this[o]=n;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[o,n]of s){const{wrapped:a}=n,c=this[o];a!==!0||this._$AL.has(o)||c===void 0||this.C(o,void 0,n,c)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(i=this._$EO)==null||i.forEach(s=>{var o;return(o=s.hostUpdate)==null?void 0:o.call(s)}),this.update(e)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==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)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(e=>this._$ET(e,this[e]))),this._$EM()}updated(t){}firstUpdated(t){}};R.elementStyles=[],R.shadowRootOptions={mode:"open"},R[B("elementProperties")]=new Map,R[B("finalized")]=new Map,ct==null||ct({ReactiveElement:R}),(C.reactiveElementVersions??(C.reactiveElementVersions=[])).push("2.1.0");/**
|
12
12
|
* @license
|
13
13
|
* Copyright 2017 Google LLC
|
14
14
|
* SPDX-License-Identifier: BSD-3-Clause
|
15
|
-
*/const D=globalThis,tt=D.trustedTypes,Gt=tt?tt.createPolicy("lit-html",{createHTML:r=>r}):void 0,fe="$lit$",x=`lit$${Math.random().toFixed(9).slice(2)}$`,ge="?"+x,ti=`<${ge}>`,I=document,
|
16
|
-
\f\r]`,F=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Kt=/-->/g,Yt=/>/g,
|
17
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Zt=/'/g,Jt=/"/g,me=/^(?:script|style|textarea|title)$/i,ii=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),M=ii(1),k=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),Xt=new WeakMap,P=I.createTreeWalker(I,129);function ve(r,t){if(!Ot(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Gt!==void 0?Gt.createHTML(t):t}const si=(r,t)=>{const e=r.length-1,i=[];let s,o=t===2?"<svg>":t===3?"<math>":"",n=F;for(let a=0;a<e;a++){const c=r[a];let l,h,d=-1,u=0;for(;u<c.length&&(n.lastIndex=u,h=n.exec(c),h!==null);)u=n.lastIndex,n===F?h[1]==="!--"?n=Kt:h[1]!==void 0?n=Yt:h[2]!==void 0?(me.test(h[2])&&(s=RegExp("</"+h[2],"g")),n=
|
15
|
+
*/const D=globalThis,tt=D.trustedTypes,Gt=tt?tt.createPolicy("lit-html",{createHTML:r=>r}):void 0,fe="$lit$",x=`lit$${Math.random().toFixed(9).slice(2)}$`,ge="?"+x,ti=`<${ge}>`,I=document,W=()=>I.createComment(""),V=r=>r===null||typeof r!="object"&&typeof r!="function",Ot=Array.isArray,ei=r=>Ot(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",ht=`[
|
16
|
+
\f\r]`,F=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Kt=/-->/g,Yt=/>/g,E=RegExp(`>|${ht}(?:([^\\s"'>=/]+)(${ht}*=${ht}*(?:[^
|
17
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Zt=/'/g,Jt=/"/g,me=/^(?:script|style|textarea|title)$/i,ii=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),M=ii(1),k=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),Xt=new WeakMap,P=I.createTreeWalker(I,129);function ve(r,t){if(!Ot(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Gt!==void 0?Gt.createHTML(t):t}const si=(r,t)=>{const e=r.length-1,i=[];let s,o=t===2?"<svg>":t===3?"<math>":"",n=F;for(let a=0;a<e;a++){const c=r[a];let l,h,d=-1,u=0;for(;u<c.length&&(n.lastIndex=u,h=n.exec(c),h!==null);)u=n.lastIndex,n===F?h[1]==="!--"?n=Kt:h[1]!==void 0?n=Yt:h[2]!==void 0?(me.test(h[2])&&(s=RegExp("</"+h[2],"g")),n=E):h[3]!==void 0&&(n=E):n===E?h[0]===">"?(n=s??F,d=-1):h[1]===void 0?d=-2:(d=n.lastIndex-h[2].length,l=h[1],n=h[3]===void 0?E:h[3]==='"'?Jt:Zt):n===Jt||n===Zt?n=E:n===Kt||n===Yt?n=F:(n=E,s=void 0);const f=n===E&&r[a+1].startsWith("/>")?" ":"";o+=n===F?c+ti:d>=0?(i.push(l),c.slice(0,d)+fe+c.slice(d)+x+f):c+x+(d===-2?a:f)}return[ve(r,o+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]};let _t=class ye{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let o=0,n=0;const a=t.length-1,c=this.parts,[l,h]=si(t,e);if(this.el=ye.createElement(l,i),P.currentNode=this.el.content,e===2||e===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(s=P.nextNode())!==null&&c.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const d of s.getAttributeNames())if(d.endsWith(fe)){const u=h[n++],f=s.getAttribute(d).split(x),g=/([.?@])?(.*)/.exec(u);c.push({type:1,index:o,name:g[2],strings:f,ctor:g[1]==="."?oi:g[1]==="?"?ni:g[1]==="@"?ai:nt}),s.removeAttribute(d)}else d.startsWith(x)&&(c.push({type:6,index:o}),s.removeAttribute(d));if(me.test(s.tagName)){const d=s.textContent.split(x),u=d.length-1;if(u>0){s.textContent=tt?tt.emptyScript:"";for(let f=0;f<u;f++)s.append(d[f],W()),P.nextNode(),c.push({type:2,index:++o});s.append(d[u],W())}}}else if(s.nodeType===8)if(s.data===ge)c.push({type:2,index:o});else{let d=-1;for(;(d=s.data.indexOf(x,d+1))!==-1;)c.push({type:7,index:o}),d+=x.length-1}o++}}static createElement(t,e){const i=I.createElement("template");return i.innerHTML=t,i}};function N(r,t,e=r,i){var n,a;if(t===k)return t;let s=i!==void 0?(n=e._$Co)==null?void 0:n[i]:e._$Cl;const o=V(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==o&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),o===void 0?s=void 0:(s=new o(r),s._$AT(r,e,i)),i!==void 0?(e._$Co??(e._$Co=[]))[i]=s:e._$Cl=s),s!==void 0&&(t=N(r,s._$AS(r,t.values),s,i)),t}class ri{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)??I).importNode(e,!0);P.currentNode=s;let o=P.nextNode(),n=0,a=0,c=i[0];for(;c!==void 0;){if(n===c.index){let l;c.type===2?l=new K(o,o.nextSibling,this,t):c.type===1?l=new c.ctor(o,c.name,c.strings,this,t):c.type===6&&(l=new ci(o,this,t)),this._$AV.push(l),c=i[++a]}n!==(c==null?void 0:c.index)&&(o=P.nextNode(),n++)}return P.currentNode=I,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 K{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=p,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=N(this,t,e),V(t)?t===p||t==null||t===""?(this._$AH!==p&&this._$AR(),this._$AH=p):t!==this._$AH&&t!==k&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):ei(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==p&&V(this._$AH)?this._$AA.nextSibling.data=t:this.T(I.createTextNode(t)),this._$AH=t}$(t){var o;const{values:e,_$litType$:i}=t,s=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=_t.createElement(ve(i.h,i.h[0]),this.options)),i);if(((o=this._$AH)==null?void 0:o._$AD)===s)this._$AH.p(e);else{const n=new ri(s,this),a=n.u(this.options);n.p(e),this.T(a),this._$AH=n}}_$AC(t){let e=Xt.get(t.strings);return e===void 0&&Xt.set(t.strings,e=new _t(t)),e}k(t){Ot(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const o of t)s===e.length?e.push(i=new K(this.O(W()),this.O(W()),this,this.options)):i=e[s],i._$AI(o),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 nt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,o){this.type=1,this._$AH=p,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=p}_$AI(t,e=this,i,s){const o=this.strings;let n=!1;if(o===void 0)t=N(this,t,e,0),n=!V(t)||t!==this._$AH&&t!==k,n&&(this._$AH=t);else{const a=t;let c,l;for(t=o[0],c=0;c<o.length-1;c++)l=N(this,a[i+c],e,c),l===k&&(l=this._$AH[c]),n||(n=!V(l)||l!==this._$AH[c]),l===p?t=p:t!==p&&(t+=(l??"")+o[c+1]),this._$AH[c]=l}n&&!s&&this.j(t)}j(t){t===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class oi extends nt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===p?void 0:t}}class ni extends nt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==p)}}class ai extends nt{constructor(t,e,i,s,o){super(t,e,i,s,o),this.type=5}_$AI(t,e=this){if((t=N(this,t,e,0)??p)===k)return;const i=this._$AH,s=t===p&&i!==p||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==p&&(i===p||s);s&&this.element.removeEventListener(this.name,this,i),o&&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 ci{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){N(this,t)}}const lt=D.litHtmlPolyfillSupport;lt==null||lt(_t,K),(D.litHtmlVersions??(D.litHtmlVersions=[])).push("3.3.0");const hi=(r,t,e)=>{const i=(e==null?void 0:e.renderBefore)??t;let s=i._$litPart$;if(s===void 0){const o=(e==null?void 0:e.renderBefore)??null;i._$litPart$=s=new K(t.insertBefore(W(),o),o,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
|
@@ -62,27 +62,29 @@
|
|
62
62
|
* @license
|
63
63
|
* Copyright 2020 Google LLC
|
64
64
|
* SPDX-License-Identifier: BSD-3-Clause
|
65
|
-
*/const Ae=()=>new Ci;class Ci{}const ft=new WeakMap,xe=kt(class extends $e{render(r){return p}update(r,[t]){var i;const e=t!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=(i=r.options)==null?void 0:i.host,this.rt(this.ct=r.element)),p}rt(r){if(this.isConnected||(r=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let e=ft.get(t);e===void 0&&(e=new WeakMap,ft.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,r),r!==void 0&&this.G.call(this.ht,r)}else this.G.value=r}get lt(){var r,t;return typeof this.G=="function"?(r=ft.get(this.ht??globalThis))==null?void 0:r.get(this.G):(t=this.G)==null?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var
|
65
|
+
*/const Ae=()=>new Ci;class Ci{}const ft=new WeakMap,xe=kt(class extends $e{render(r){return p}update(r,[t]){var i;const e=t!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=(i=r.options)==null?void 0:i.host,this.rt(this.ct=r.element)),p}rt(r){if(this.isConnected||(r=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let e=ft.get(t);e===void 0&&(e=new WeakMap,ft.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,r),r!==void 0&&this.G.call(this.ht,r)}else this.G.value=r}get lt(){var r,t;return typeof this.G=="function"?(r=ft.get(this.ht??globalThis))==null?void 0:r.get(this.G):(t=this.G)==null?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var Ei=Object.defineProperty,Y=(r,t,e,i)=>{for(var s=void 0,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=n(t,e,s)||s);return s&&Ei(t,e,s),s};const Mt=class Mt extends A{constructor(){super(...arguments),this.active=!1,this.triggerVisible=!0,this.loaded=!1,this.containerRef=Ae(),this.widgetActive$=new Ct(!1),this.componentIsDestroyed$=new xt}async connectedCallback(){super.connectedCallback(),this.icon=await this._renderSymbol(),this.loaded=!0,this._applyBranding()}disconnectedCallback(){super.disconnectedCallback(),this.componentIsDestroyed$.next(),this.componentIsDestroyed$.complete()}toggleActive(){var t;if(!((t=this.application)!=null&&t.root)){console.warn("Could not activate widget. No root element assigned to widget.");return}this.active=!this.active,this.active?(this.application.appendToDOM(),this.notify("widget-set-active",{widgetId:this.application.id,active:!0}),this.widgetActive$.next(!0),this.hideTrigger()):(this.application.hide(),this.notify("widget-set-active",{widgetId:this.application.id,active:!1}),this.widgetActive$.next(!1),this.showTrigger())}notify(t,e={}){window!=null&&window.parent&&window.parent.postMessage({type:t,data:e},"*")}_applyBranding(){var t;(t=this.application)!=null&&t.settings&&_e(this.application.settings.branding,this)}async _renderSymbol(){var a,c,l;const t=(a=this.application)==null?void 0:a.branding(),e=(c=t==null?void 0:t.graphics)==null?void 0:c.trigger;if(e)return M` <img src=${e} class="trigger-icon" alt="" /> `;const i=(l=this.application)==null?void 0:l.triggerIcon;if(!i)return p;const s=async h=>xi,{type:o,content:n}=i;switch(o){case"Telia":{const h=await s();return h?M`<telia-icon
|
66
66
|
class="trigger-icon"
|
67
67
|
svg=${h.svg}
|
68
68
|
size="lg"
|
69
|
-
></telia-icon>`:p}default:return p}}hideTrigger(){this.triggerVisible=!1}showTrigger(){this.triggerVisible=!0}render(){var t,e,i,s;return M`<div
|
69
|
+
></telia-icon>`:p}default:return p}}hideTrigger(){this.triggerVisible=!1}showTrigger(){this.triggerVisible=!0}render(){var t,e,i,s,o,n,a;return M`<div
|
70
70
|
class=${oe({"trigger-container":!0,hidden:!this.triggerVisible})}
|
71
71
|
${xe(this.containerRef)}
|
72
72
|
>
|
73
73
|
${!this.active&&((s=(i=(e=(t=this.application)==null?void 0:t.settings)==null?void 0:e.branding)==null?void 0:i.other)!=null&&s.showButtonLabel)?M`
|
74
74
|
<button
|
75
|
-
|
75
|
+
type="button"
|
76
|
+
aria-label="${this.application.settings.branding.other.buttonLabelText??"Widget trigger"}"
|
76
77
|
class="trigger-label"
|
77
78
|
@click=${this.toggleActive}
|
78
79
|
${Ai({keyframeOptions:{},in:bi,stabilizeOut:!0,skipInitial:!1})}
|
79
80
|
>
|
80
|
-
${this.application.settings.branding.other.buttonLabelText}
|
81
|
+
${this.application.settings.branding.other.buttonLabelText??"Widget trigger"}
|
81
82
|
</button>
|
82
83
|
`:p}
|
83
84
|
|
84
85
|
<button
|
85
|
-
|
86
|
+
type="button"
|
87
|
+
aria-label="${((a=(n=(o=this.application)==null?void 0:o.settings)==null?void 0:n.branding.other)==null?void 0:a.buttonLabelText)??"Widget trigger"}"
|
86
88
|
class=${oe({trigger:!0,active:this.active,rendered:this.loaded})}
|
87
89
|
@click=${this.toggleActive}
|
88
90
|
>
|
@@ -244,7 +246,7 @@
|
|
244
246
|
.trigger-label:hover {
|
245
247
|
opacity: 0.8;
|
246
248
|
}
|
247
|
-
`];let b=Mt;Y([m({attribute:!1})],b.prototype,"application");Y([H()],b.prototype,"active");Y([H()],b.prototype,"triggerVisible");Y([H()],b.prototype,"loaded");Y([H()],b.prototype,"icon");var
|
249
|
+
`];let b=Mt;Y([m({attribute:!1})],b.prototype,"application");Y([H()],b.prototype,"active");Y([H()],b.prototype,"triggerVisible");Y([H()],b.prototype,"loaded");Y([H()],b.prototype,"icon");var Si=Object.defineProperty,S=(r,t,e,i)=>{for(var s=void 0,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=n(t,e,s)||s);return s&&Si(t,e,s),s};const Ce=r=>{const e=class e extends r{constructor(){super(...arguments),this.properties={},this.context={},this.layout={},this.nodes=[]}writeProperties(s){this.properties=s}writeLayout(s){this.layout=s}writeContext(s){this.context=s}addChild(s){s.parent=this,this.nodes.push(s)}connectedCallback(){super.connectedCallback(),this.renderRoot.host.style.setProperty("--width",this.layout.size==="full"?"var(--columns, 1)":`min(${this.layout.size||"var(--columns)"}, var(--columns))`),this.application.mountComponent(this)}};e.styles=[j`
|
248
250
|
:host {
|
249
251
|
font-family: var(--font-family);
|
250
252
|
grid-column: span var(--width);
|
@@ -256,7 +258,7 @@
|
|
256
258
|
* {
|
257
259
|
box-sizing: border-box;
|
258
260
|
}
|
259
|
-
`];let t=e;return
|
261
|
+
`];let t=e;return S([m()],t.prototype,"properties"),S([m()],t.prototype,"context"),S([m()],t.prototype,"layout"),S([m()],t.prototype,"name"),S([m()],t.prototype,"type"),S([m({attribute:!1})],t.prototype,"application"),S([m({attribute:!1})],t.prototype,"parent"),t},Nt=class Nt extends Ce(A){render(){return M`Non resolved component`}};Nt.styles=[j`
|
260
262
|
:host {
|
261
263
|
display: block;
|
262
264
|
}
|
@@ -264,7 +266,7 @@
|
|
264
266
|
* @license
|
265
267
|
* Copyright 2021 Google LLC
|
266
268
|
* SPDX-License-Identifier: BSD-3-Clause
|
267
|
-
*/function*Pi(r,t){if(r!==void 0){let e=0;for(const i of r)yield t(i,e++)}}var $=(r=>(r.Inline="inline",r.Trigger="trigger",r))($||{}),
|
269
|
+
*/function*Pi(r,t){if(r!==void 0){let e=0;for(const i of r)yield t(i,e++)}}var $=(r=>(r.Inline="inline",r.Trigger="trigger",r))($||{}),Ee=(r=>(r.NonAuthenticated="non-authenticated",r.Authenticating="authenticating",r.Authenticated="authenticated",r.ChatEnded="chat-ended",r))(Ee||{});/**
|
268
270
|
* @license
|
269
271
|
* Copyright 2021 Google LLC
|
270
272
|
* SPDX-License-Identifier: BSD-3-Clause
|
@@ -284,9 +286,9 @@
|
|
284
286
|
* @license
|
285
287
|
* Copyright 2017 Google LLC
|
286
288
|
* SPDX-License-Identifier: BSD-3-Clause
|
287
|
-
*/function Ti({context:r}){return(t,e)=>{const i=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(s){return i.get(this).setValue(s),t.set.call(this,s)},init(s){return i.set(this,new ne(this,{context:r,initialValue:s})),s}};{t.constructor.addInitializer(n=>{i.set(n,new ne(n,{context:r}))});const s=Object.getOwnPropertyDescriptor(t,e);let o;if(s===void 0){const n=new WeakMap;o={get(){return n.get(this)},set(a){i.get(this).setValue(a),n.set(this,a)},configurable:!0,enumerable:!0}}else{const n=s.set;o={...s,set(a){i.get(this).setValue(a),n==null||n.call(this,a)}}}return void Object.defineProperty(t,e,o)}}}var Ri=Object.defineProperty,
|
289
|
+
*/function Ti({context:r}){return(t,e)=>{const i=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(s){return i.get(this).setValue(s),t.set.call(this,s)},init(s){return i.set(this,new ne(this,{context:r,initialValue:s})),s}};{t.constructor.addInitializer(n=>{i.set(n,new ne(n,{context:r}))});const s=Object.getOwnPropertyDescriptor(t,e);let o;if(s===void 0){const n=new WeakMap;o={get(){return n.get(this)},set(a){i.get(this).setValue(a),n.set(this,a)},configurable:!0,enumerable:!0}}else{const n=s.set;o={...s,set(a){i.get(this).setValue(a),n==null||n.call(this,a)}}}return void Object.defineProperty(t,e,o)}}}var Ri=Object.defineProperty,Se=(r,t,e,i)=>{for(var s=void 0,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=n(t,e,s)||s);return s&&Ri(t,e,s),s};const Pe="application",Lt=class Lt extends A{constructor(){super(...arguments),this.nodes=[],this.wrapperRef=Ae(),this.fullscreen=!1,this.isReady=new Ct(!1)}addChild(t){t.parent=this,this.nodes.push(t)}applyBranding(){if(!this.wrapperRef.value)return;const t=this.application.settings;t!=null&&t.branding&&_e(t.branding,this.wrapperRef.value)}applyStyles(){if(!this.wrapperRef.value)return;const t=this.application.styles(),e=this.wrapperRef.value;Object.entries(t).forEach(([i,s])=>{e.style.setProperty(`--${i}`,s)})}firstUpdated(t){this.applyBranding(),this.applyStyles()}render(){var i,s;const t=this.application.settings.components.conversation;return((s=(i=t==null?void 0:t.properties)==null?void 0:i.chat)==null?void 0:s.isThirdPartyWidget)?this.renderRoot.host.classList.add("third-party"):this.application.renderStrategy===$.Trigger&&(this.renderRoot.host.classList.add("floating"),this.application.anchor==="BottomLeft"?this.renderRoot.host.classList.add("bottom-left"):this.application.anchor==="BottomRight"&&this.renderRoot.host.classList.add("bottom-right")),this.application.fullscreen&&this.renderRoot.host.classList.add("fullscreen"),window.self!==window.top&&this.renderRoot.host.classList.add("embedded"),M`<div class="widget-container" ${xe(this.wrapperRef)}>
|
288
290
|
${Pi(this.nodes,o=>o)}
|
289
|
-
</div>`}};
|
291
|
+
</div>`}};Lt.styles=j`
|
290
292
|
:host {
|
291
293
|
--font-family: TeliaSans, Helvetica, Arial, Lucida Grande, sans-serif;
|
292
294
|
--spacing-xs: 0.2rem;
|
@@ -451,8 +453,8 @@
|
|
451
453
|
:host(.expanded.embedded) {
|
452
454
|
animation: none;
|
453
455
|
}
|
454
|
-
`;let U=Ut;Ee([m({attribute:!0})],U.prototype,"fullscreen");Ee([m({attribute:!1}),Ti({context:Pe})],U.prototype,"application");class Mi{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(d=>{const u=i(d),f=h[u.definitionId];if(!f){console.error(`No definition found for component type '${u.definitionId}'.`);return}const g=a.createNode(f.type,f.type);g&&(g.name=u.definitionId,g.application=e,f.properties&&g.writeProperties(f.properties),f.context&&g.writeContext(f.context),f.layout&&g.writeLayout(f.layout),c.addChild(g),f.children&&s(a,g,f.children,h))})},{entry:o,components:n}=t;return s(this,this.root,[o],n),this.root}createRoot(){return typeof window<"u"&&(window.customElements.get("ace-wrapper")||window.customElements.define("ace-wrapper",U)),document.createElement("ace-wrapper")}createNode(t,e){if(!this.resolveComponent(e))return console.warn(`Unable to resolve component: ${e}`),new it;const s=document.createElement(`ace-${e}`);return s.type=e,s.name=t,s}resolveComponent(t){return customElements.get(`ace-${t}`)}getRoot(){return this.root}}const st=class st{constructor(){this.components=new Map}getComponent(t){const e=this.components.get(t);return e||console.warn(`Unable to resolve component: ${t}. You most likely forgot to register the required plugin.`),e}registerComponent(t,e){this.components.set(t,e)}async loadComponents(){const t=[...this.components.entries()].map(([e,i])=>i.then(s=>{this.defineAsWebComponent(e,s.default)}));await Promise.all(t)}defineAsWebComponent(t,e){const i=st.ResolveWebComponentName(t);customElements.get(i)||customElements.define(i,e)}};st.ResolveWebComponentName=t=>`ace-${t}`;let At=st;var y=(r=>(r.Necessary="necessary",r.Functional="functional",r.Analytics="analytics",r))(y||{});class Oe{constructor(t,e,i,s){this.disallowedKeys=[],this.widgetId=t,this.storage=e==="localStorage"?window.localStorage:window.sessionStorage,this.policy=i,this.storageEntries=s}set(t,e){if(this.disallowedKeys.includes(t))return;const i=this.storageEntries[t];if(!i){console.warn(`Storage key '${t}' is not defined.`);return}const s=i.category;if(this.policy[s]){const o={value:e,category:s};this.storage.setItem(this._prefixKey(t),JSON.stringify(o))}else console.warn(`Storage policy does not allow storing items in category: ${s}`)}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 s=(t=JSON.parse(i))==null?void 0:t.category;this.policy[s]||this.storage.removeItem(e)}}updatePolicy(t){this.policy=t,this.enforcePolicy()}disallowKey(t){this.disallowedKeys.includes(t)||this.disallowedKeys.push(t),this.removeItem(t)}stringify(){return JSON.stringify(this.storage)}_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}}const Ui="1.1.120-rc.21";class Li{constructor(t){this.widget=t,this.name=t.name}open(t={}){this.widget.appendToDOM(t)}close(){this.widget.hide()}setFullscreenMode(t){this.widget.setFullscreenMode(t)}setZIndex(t){this.widget.setZIndex(t)}version(){return{version:Ui}}}class Ie{constructor(t,e,i,s,o){this.id=t,this.name=e,this.container=i,this.settings=s,this.options=o,this.platform=new Mi,this.texts=new Ni,this.renderStrategy=$.Inline,this.fullscreen=!1,this.anchor="BottomRight",this.autoActivate=!1,this.plugins=[],this.componentResolver=new At,this.components=[],this.trigger=null,this.api=new Li(this),this.onMessageReceived=async a=>{var l;const c=a.data;switch(c.type){case"set-storage-policies":{const{policies:h}=c.data||[],d={[y.Analytics]:h.includes("analytics"),[y.Necessary]:h.includes("necessary"),[y.Functional]:h.includes("functional")};this.storage.updatePolicy(d);return}case"disallow-storage-key":{const{storageKey:h}=c.data||null;h&&this.storage.disallowKey(h);return}case"set-fullscreen-mode":{const{value:h}=c.data;typeof h=="boolean"&&this.setFullscreenMode(h);return}case"open":{this.appendToDOM();return}case"close":{this.hide();return}case"set-z-index":{const{zIndex:h}=c.data||null;h&&this.setZIndex(h);return}case"deactivate-widget":{const h=this.storage.get("open");this.hide(),(l=this.trigger)==null||l.hideTrigger(),h&&this.storage.set("open",!0);return}case"set-open":{typeof c.data.value=="boolean"&&(this.storage.set("open",c.data.value),this.root&&c.data.value===!0&&!this.root.isReady.getValue()&&this.root.isReady.next(!0));return}default:return}},this.renderStrategy=this.options.renderStrategy||$.Inline,this.triggerIcon=this.options.triggerIcon;const n={[y.Necessary]:!0,[y.Functional]:!0,[y.Analytics]:!0};this.storage=new Oe(this.id,"sessionStorage",n,this.settings.storage),typeof o.autoActivate=="boolean"&&(this.autoActivate=o.autoActivate),o.anchor&&(this.anchor=o.anchor),this.container.register("$settings",s),this.texts.loadTexts(s.texts||{}),window.addEventListener("message",this.onMessageReceived)}async activate(){if(await this.loadPlugins(),await this.componentResolver.loadComponents(),this.root=this.platform.createComponentModel(this.settings,this),this.container.setState(ue.Ready),this.autoActivate){const t=this.render();t&&this._getTargetElement().appendChild(t)}if(window!=null&&window.parent){const{version:t}=this.api.version();window.parent.postMessage({type:"widget-activated",data:{widgetId:this.id,version:t,storage:this.storage.stringify()}},"*")}}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(t={}){this.root&&(this.root.classList.add("expanded"),this.root.classList.remove("hidden"),document.body.appendChild(this.root)),t.ignoreStorage||this.storage.set("open",!0)}hide(){this.root&&(this.root.classList.add("hidden"),this.root.classList.remove("expanded")),this.storage.set("open",!1)}setZIndex(t){this.root&&(this.root.style.zIndex=t.toString())}mute(){this.storage.set("muteAudioNotifications",!0)}unmute(){this.storage.set("muteAudioNotifications",!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===$.Trigger){let e=document.querySelector(`ace-trigger-slot.${t}`);return e||(e=new q,e.anchor=this.anchor,document.body.appendChild(e)),e}return document.body}_isEmbeddedInIFrame(){return window.self!==window.top&&window.__RENDER_WIDGET_FULLSCREEN__}setFullscreenMode(t){this.fullscreen=t,this.root&&(this.root.fullscreen=!0)}render(){if(this._isEmbeddedInIFrame())return this.root;if(!this._isEmbeddedInIFrame()&&this.root&&(this.root.isReady.getValue()||this.root.isReady.next(!0)),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 ji=r=>new L(r),rt=class rt{constructor(t=rt.endpoint){this._endpoint=t}async getSite(t){const i=await(await fetch(t)).json();return i?{id:i.id,triggers:i.triggers||[],apps:(i.widgets||[]).map(s=>{let o=$.Trigger;s.renderStrategy.toLowerCase()==="inline"&&(o=$.Inline);const n=s.widgetId?s.widgetId:s.id,a=typeof s.autoActivate=="boolean"?s.autoActivate:!1,c=typeof s.anchor=="string"?s.anchor:"BottomRight",l=typeof s.triggerIcon=="string"?s.triggerIcon:"question";return{id:n,widgetId:n,renderStrategy:o,autoActivate:a,anchor:c,triggerIcon:{type:"Telia",content:l}}})}:null}async getWidget(t){const i=await(await fetch(`${this._endpoint}/widget/${t}`)).json();return i?{name:i.name,config:JSON.parse(i.configuration)}:null}};rt.endpoint="https://widgets.ace.teliacompany.net/api";let L=rt;class Hi{constructor(t){this.site=t}storagePolicy(t){var i;(((i=this.site.environment)==null?void 0:i.applications)||[]).forEach(s=>{if(s.storage){const o={[y.Analytics]:t.includes("analytics"),[y.Necessary]:t.includes("necessary"),[y.Functional]:t.includes("functional")};s.storage.updatePolicy(o)}})}disallowStorageKey(t){var e;(((e=this.site.environment)==null?void 0:e.applications)||[]).forEach(i=>{i.storage&&i.storage.disallowKey(t)})}}class ke{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(){var e;const t=this.applications.filter(i=>i.autoActivate);(((e=this.site)==null?void 0:e.triggers)||[]).filter(i=>i.triggerType==="visit").forEach(i=>{const s=window.location.pathname,o=i.condition.outputs||[];i.condition.type==="url"&&o.forEach(n=>{const a=n.action.type==="render_widget";if((n.value===s||n.value==="*")&&a){let l={widgetId:""};try{l=JSON.parse(n.action.data)}catch{l={widgetId:""}}const h=t.findIndex(u=>u.id===l.widgetId)>-1,d=this.applications.find(u=>u.id===l.widgetId);d&&!h&&(d.autoActivate=!0,t.push(d))}})});for await(const i of t)await i.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}}))})}configure(t){if(!this.site||!this.bootstrapped){this.siteConfigurationHandlers.push(t);return}t(this.site.api)}widget(t,e){const i=this.applications.find(s=>s.name===t);if(!i){const s=this.widgetAPIHandlers.get(t)||[];s.push(()=>{const o=this.applications.find(n=>n.name===t);e(o==null?void 0:o.api)}),this.widgetAPIHandlers.set(t,s);return}e(i==null?void 0:i.api)}registerApp(t,e,i,s){const o=new $t(e,this),n=new Ie(t,e,o,i,s);this.applications.push(n)}registerSite(t){this.site=t}plugin(t){return this.applications.forEach(e=>{e.plugin(t)}),this}}class Te{constructor(t){this.configurations=[],this.httpClient=new L,this.api=new Hi(this),this.triggers=[],this.httpClient=new L,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,this.triggers=e.triggers||[]}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"}}))}setHttpClient(t){this.httpClient=t}async bootstrap(t){var e;this.url&&await this.load(this.url),this.environment=new ke,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),this.environment.registerSite(this),await this.environment.bootstrap()}addGlobal(t){const e=globalThis.ace;((e==null?void 0:e._w)||[]).forEach(([i,s])=>{t.widget(i,s)}),((e==null?void 0:e._c)||[]).forEach(i=>{t.configure(i)}),globalThis.ace=t}}var Fi=Object.defineProperty,Tt=(r,t,e,i)=>{for(var s=void 0,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=n(t,e,s)||s);return s&&Fi(t,e,s),s};const Lt=class Lt extends A{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 p;if(this.widget.renderStrategy===$.Trigger){const t=new b;return t.application=this.widget,t}return this.widget.render()}};Lt.styles=[j`
|
456
|
+
`;let L=Lt;Se([m({attribute:!0})],L.prototype,"fullscreen");Se([m({attribute:!1}),Ti({context:Pe})],L.prototype,"application");class Mi{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(d=>{const u=i(d),f=h[u.definitionId];if(!f){console.error(`No definition found for component type '${u.definitionId}'.`);return}const g=a.createNode(f.type,f.type);g&&(g.name=u.definitionId,g.application=e,f.properties&&g.writeProperties(f.properties),f.context&&g.writeContext(f.context),f.layout&&g.writeLayout(f.layout),c.addChild(g),f.children&&s(a,g,f.children,h))})},{entry:o,components:n}=t;return s(this,this.root,[o],n),this.root}createRoot(){return typeof window<"u"&&(window.customElements.get("ace-wrapper")||window.customElements.define("ace-wrapper",L)),document.createElement("ace-wrapper")}createNode(t,e){if(!this.resolveComponent(e))return console.warn(`Unable to resolve component: ${e}`),new it;const s=document.createElement(`ace-${e}`);return s.type=e,s.name=t,s}resolveComponent(t){return customElements.get(`ace-${t}`)}getRoot(){return this.root}}const st=class st{constructor(){this.components=new Map}getComponent(t){const e=this.components.get(t);return e||console.warn(`Unable to resolve component: ${t}. You most likely forgot to register the required plugin.`),e}registerComponent(t,e){this.components.set(t,e)}async loadComponents(){const t=[...this.components.entries()].map(([e,i])=>i.then(s=>{this.defineAsWebComponent(e,s.default)}));await Promise.all(t)}defineAsWebComponent(t,e){const i=st.ResolveWebComponentName(t);customElements.get(i)||customElements.define(i,e)}};st.ResolveWebComponentName=t=>`ace-${t}`;let At=st;var y=(r=>(r.Necessary="necessary",r.Functional="functional",r.Analytics="analytics",r))(y||{});class Oe{constructor(t,e,i,s){this.disallowedKeys=[],this.widgetId=t,this.storage=e==="localStorage"?window.localStorage:window.sessionStorage,this.policy=i,this.storageEntries=s}set(t,e){if(this.disallowedKeys.includes(t))return;const i=this.storageEntries[t];if(!i){console.warn(`Storage key '${t}' is not defined.`);return}const s=i.category;if(this.policy[s]){const o={value:e,category:s};this.storage.setItem(this._prefixKey(t),JSON.stringify(o))}else console.warn(`Storage policy does not allow storing items in category: ${s}`)}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 s=(t=JSON.parse(i))==null?void 0:t.category;this.policy[s]||this.storage.removeItem(e)}}updatePolicy(t){this.policy=t,this.enforcePolicy()}disallowKey(t){this.disallowedKeys.includes(t)||this.disallowedKeys.push(t),this.removeItem(t)}stringify(){return JSON.stringify(this.storage)}_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}}const Li="1.1.120-rc.23";class Ui{constructor(t){this.widget=t,this.name=t.name}open(t={}){this.widget.appendToDOM(t)}close(){this.widget.hide()}setFullscreenMode(t){this.widget.setFullscreenMode(t)}setZIndex(t){this.widget.setZIndex(t)}version(){return{version:Li}}}class Ie{constructor(t,e,i,s,o){this.id=t,this.name=e,this.container=i,this.settings=s,this.options=o,this.platform=new Mi,this.texts=new Ni,this.renderStrategy=$.Inline,this.fullscreen=!1,this.anchor="BottomRight",this.autoActivate=!1,this.plugins=[],this.componentResolver=new At,this.components=[],this.trigger=null,this.api=new Ui(this),this.onMessageReceived=async a=>{var l;const c=a.data;switch(c.type){case"set-storage-policies":{const{policies:h}=c.data||[],d={[y.Analytics]:h.includes("analytics"),[y.Necessary]:h.includes("necessary"),[y.Functional]:h.includes("functional")};this.storage.updatePolicy(d);return}case"disallow-storage-key":{const{storageKey:h}=c.data||null;h&&this.storage.disallowKey(h);return}case"set-fullscreen-mode":{const{value:h}=c.data;typeof h=="boolean"&&this.setFullscreenMode(h);return}case"open":{this.appendToDOM();return}case"close":{this.hide();return}case"set-z-index":{const{zIndex:h}=c.data||null;h&&this.setZIndex(h);return}case"deactivate-widget":{const h=this.storage.get("open");this.hide(),(l=this.trigger)==null||l.hideTrigger(),h&&this.storage.set("open",!0);return}case"set-open":{typeof c.data.value=="boolean"&&(this.storage.set("open",c.data.value),this.root&&c.data.value===!0&&!this.root.isReady.getValue()&&this.root.isReady.next(!0));return}default:return}},this.renderStrategy=this.options.renderStrategy||$.Inline,this.triggerIcon=this.options.triggerIcon;const n={[y.Necessary]:!0,[y.Functional]:!0,[y.Analytics]:!0};this.storage=new Oe(this.id,"sessionStorage",n,this.settings.storage),typeof o.autoActivate=="boolean"&&(this.autoActivate=o.autoActivate),o.anchor&&(this.anchor=o.anchor),this.container.register("$settings",s),this.texts.loadTexts(s.texts||{}),window.addEventListener("message",this.onMessageReceived)}async activate(){if(await this.loadPlugins(),await this.componentResolver.loadComponents(),this.root=this.platform.createComponentModel(this.settings,this),this.container.setState(ue.Ready),this.autoActivate){const t=this.render();t&&this._getTargetElement().appendChild(t)}if(window!=null&&window.parent){const{version:t}=this.api.version();window.parent.postMessage({type:"widget-activated",data:{widgetId:this.id,version:t,storage:this.storage.stringify()}},"*")}}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(t={}){this.root&&(this.root.classList.add("expanded"),this.root.classList.remove("hidden"),this.root.removeAttribute("inert"),document.body.appendChild(this.root)),t.ignoreStorage||this.storage.set("open",!0)}hide(){this.root&&(this.root.contains(document.activeElement)&&(this.trigger&&typeof this.trigger.focus=="function"?this.trigger.focus():(document.activeElement instanceof HTMLElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),document.body.focus())),this.root.classList.add("hidden"),this.root.classList.remove("expanded"),this.root.setAttribute("inert","")),this.storage.set("open",!1)}setZIndex(t){this.root&&(this.root.style.zIndex=t.toString())}mute(){this.storage.set("muteAudioNotifications",!0)}unmute(){this.storage.set("muteAudioNotifications",!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===$.Trigger){let e=document.querySelector(`ace-trigger-slot.${t}`);return e||(e=new q,e.anchor=this.anchor,document.body.appendChild(e)),e}return document.body}_isEmbeddedInIFrame(){return window.self!==window.top&&window.__RENDER_WIDGET_FULLSCREEN__}setFullscreenMode(t){this.fullscreen=t,this.root&&(this.root.fullscreen=!0)}render(){if(this._isEmbeddedInIFrame())return this.root;if(!this._isEmbeddedInIFrame()&&this.root&&(this.root.isReady.getValue()||this.root.isReady.next(!0)),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 ji=r=>new U(r),rt=class rt{constructor(t=rt.endpoint){this._endpoint=t}async getSite(t){const i=await(await fetch(t)).json();return i?{id:i.id,triggers:i.triggers||[],apps:(i.widgets||[]).map(s=>{let o=$.Trigger;s.renderStrategy.toLowerCase()==="inline"&&(o=$.Inline);const n=s.widgetId?s.widgetId:s.id,a=typeof s.autoActivate=="boolean"?s.autoActivate:!1,c=typeof s.anchor=="string"?s.anchor:"BottomRight",l=typeof s.triggerIcon=="string"?s.triggerIcon:"question";return{id:n,widgetId:n,renderStrategy:o,autoActivate:a,anchor:c,triggerIcon:{type:"Telia",content:l}}})}:null}async getWidget(t){const i=await(await fetch(`${this._endpoint}/widget/${t}`)).json();return i?{name:i.name,config:JSON.parse(i.configuration)}:null}};rt.endpoint="https://widgets.ace.teliacompany.net/api";let U=rt;class Hi{constructor(t){this.site=t}storagePolicy(t){var i;(((i=this.site.environment)==null?void 0:i.applications)||[]).forEach(s=>{if(s.storage){const o={[y.Analytics]:t.includes("analytics"),[y.Necessary]:t.includes("necessary"),[y.Functional]:t.includes("functional")};s.storage.updatePolicy(o)}})}disallowStorageKey(t){var e;(((e=this.site.environment)==null?void 0:e.applications)||[]).forEach(i=>{i.storage&&i.storage.disallowKey(t)})}}class ke{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(){var e;const t=this.applications.filter(i=>i.autoActivate);(((e=this.site)==null?void 0:e.triggers)||[]).filter(i=>i.triggerType==="visit").forEach(i=>{const s=window.location.pathname,o=i.condition.outputs||[];i.condition.type==="url"&&o.forEach(n=>{const a=n.action.type==="render_widget";if((n.value===s||n.value==="*")&&a){let l={widgetId:""};try{l=JSON.parse(n.action.data)}catch{l={widgetId:""}}const h=t.findIndex(u=>u.id===l.widgetId)>-1,d=this.applications.find(u=>u.id===l.widgetId);d&&!h&&(d.autoActivate=!0,t.push(d))}})});for await(const i of t)await i.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}}))})}configure(t){if(!this.site||!this.bootstrapped){this.siteConfigurationHandlers.push(t);return}t(this.site.api)}widget(t,e){const i=this.applications.find(s=>s.name===t);if(!i){const s=this.widgetAPIHandlers.get(t)||[];s.push(()=>{const o=this.applications.find(n=>n.name===t);e(o==null?void 0:o.api)}),this.widgetAPIHandlers.set(t,s);return}e(i==null?void 0:i.api)}registerApp(t,e,i,s){const o=new $t(e,this),n=new Ie(t,e,o,i,s);this.applications.push(n)}registerSite(t){this.site=t}plugin(t){return this.applications.forEach(e=>{e.plugin(t)}),this}}class Te{constructor(t){this.configurations=[],this.httpClient=new U,this.api=new Hi(this),this.triggers=[],this.httpClient=new U,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,this.triggers=e.triggers||[]}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"}}))}setHttpClient(t){this.httpClient=t}async bootstrap(t){var e;this.url&&await this.load(this.url),this.environment=new ke,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),this.environment.registerSite(this),await this.environment.bootstrap()}addGlobal(t){const e=globalThis.ace;((e==null?void 0:e._w)||[]).forEach(([i,s])=>{t.widget(i,s)}),((e==null?void 0:e._c)||[]).forEach(i=>{t.configure(i)}),globalThis.ace=t}}var Fi=Object.defineProperty,Tt=(r,t,e,i)=>{for(var s=void 0,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=n(t,e,s)||s);return s&&Fi(t,e,s),s};const Ut=class Ut extends A{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 p;if(this.widget.renderStrategy===$.Trigger){const t=new b;return t.application=this.widget,t}return this.widget.render()}};Ut.styles=[j`
|
455
457
|
:host {
|
456
458
|
display: block;
|
457
459
|
}
|
458
|
-
`];let T=
|
460
|
+
`];let T=Ut;Tt([m({attribute:!0})],T.prototype,"name");Tt([H()],T.prototype,"widget");Tt([H()],T.prototype,"status");customElements.get("ace-trigger-slot")||customElements.define("ace-trigger-slot",q);customElements.get("ace-trigger")||customElements.define("ace-trigger",b);customElements.get("ace-unresolved-component")||customElements.define("ace-unresolved-component",it);customElements.get("ace-wrapper")||customElements.define("ace-wrapper",L);customElements.get("ace-widget")||customElements.define("ace-widget",T);const Bi=async(r,t,e={})=>{const i=new Te(r);e.httpClient&&i.setHttpClient(e.httpClient),await i.bootstrap(t)};exports.AceWidget=T;exports.Application=Ie;exports.AuthState=Ee;exports.Container=$t;exports.Environment=ke;exports.HttpClient=U;exports.Site=Te;exports.StorageCategory=y;exports.StorageService=Oe;exports.Trigger=b;exports.WidgetComponent=Ce;exports.applicationContext=Pe;exports.bootstrap=Bi;exports.createHttpClient=ji;
|
package/index.mjs
CHANGED
@@ -111,7 +111,7 @@ var nt = function() {
|
|
111
111
|
for (var u = mt(d), f = u.next(); !f.done; f = u.next()) {
|
112
112
|
var g = f.value;
|
113
113
|
try {
|
114
|
-
|
114
|
+
Ut(g);
|
115
115
|
} catch (v) {
|
116
116
|
n = n ?? [], v instanceof at ? n = yt(yt([], vt(n)), vt(v.errors)) : n.push(v);
|
117
117
|
}
|
@@ -133,7 +133,7 @@ var nt = function() {
|
|
133
133
|
var e;
|
134
134
|
if (t && t !== this)
|
135
135
|
if (this.closed)
|
136
|
-
|
136
|
+
Ut(t);
|
137
137
|
else {
|
138
138
|
if (t instanceof r) {
|
139
139
|
if (t.closed || t._hasParent(this))
|
@@ -162,7 +162,7 @@ var nt = function() {
|
|
162
162
|
function le(r) {
|
163
163
|
return r instanceof nt || r && "closed" in r && _(r.remove) && _(r.add) && _(r.unsubscribe);
|
164
164
|
}
|
165
|
-
function
|
165
|
+
function Ut(r) {
|
166
166
|
_(r) ? r() : r.unsubscribe();
|
167
167
|
}
|
168
168
|
var Ee = {
|
@@ -294,7 +294,7 @@ var Ht = function() {
|
|
294
294
|
var e = new r();
|
295
295
|
return e.source = this, e.operator = t, e;
|
296
296
|
}, r.prototype.subscribe = function(t, e, i) {
|
297
|
-
var s = this, n =
|
297
|
+
var s = this, n = Le(t) ? t : new wt(t, e, i);
|
298
298
|
return J(function() {
|
299
299
|
var o = s, a = o.operator, c = o.source;
|
300
300
|
n.add(a ? a.call(n, c) : c ? s._subscribe(n) : s._trySubscribe(n));
|
@@ -353,14 +353,14 @@ function Ft(r) {
|
|
353
353
|
function Ne(r) {
|
354
354
|
return r && _(r.next) && _(r.error) && _(r.complete);
|
355
355
|
}
|
356
|
-
function
|
356
|
+
function Le(r) {
|
357
357
|
return r && r instanceof de || Ne(r) && le(r);
|
358
358
|
}
|
359
|
-
var
|
359
|
+
var Ue = ce(function(r) {
|
360
360
|
return function() {
|
361
361
|
r(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
|
362
362
|
};
|
363
|
-
}),
|
363
|
+
}), At = function(r) {
|
364
364
|
G(t, r);
|
365
365
|
function t() {
|
366
366
|
var e = r.call(this) || this;
|
@@ -371,7 +371,7 @@ var Le = ce(function(r) {
|
|
371
371
|
return i.operator = e, i;
|
372
372
|
}, t.prototype._throwIfClosed = function() {
|
373
373
|
if (this.closed)
|
374
|
-
throw new
|
374
|
+
throw new Ue();
|
375
375
|
}, t.prototype.next = function(e) {
|
376
376
|
var i = this;
|
377
377
|
J(function() {
|
@@ -458,7 +458,7 @@ var Le = ce(function(r) {
|
|
458
458
|
var i, s;
|
459
459
|
return (s = (i = this.source) === null || i === void 0 ? void 0 : i.subscribe(e)) !== null && s !== void 0 ? s : he;
|
460
460
|
}, t;
|
461
|
-
}(
|
461
|
+
}(At), xt = function(r) {
|
462
462
|
G(t, r);
|
463
463
|
function t(e) {
|
464
464
|
var i = r.call(this) || this;
|
@@ -481,10 +481,10 @@ var Le = ce(function(r) {
|
|
481
481
|
}, t.prototype.next = function(e) {
|
482
482
|
r.prototype.next.call(this, this._value = e);
|
483
483
|
}, t;
|
484
|
-
}(
|
484
|
+
}(At), ue = /* @__PURE__ */ ((r) => (r.Loading = "loading", r.Ready = "ready", r))(ue || {});
|
485
485
|
class Dt {
|
486
486
|
constructor(t, e) {
|
487
|
-
this.state = new
|
487
|
+
this.state = new xt(
|
488
488
|
"loading"
|
489
489
|
/* Loading */
|
490
490
|
), this.resolvers = /* @__PURE__ */ new Map(), this.name = t, this.environment = e, this.state.next(
|
@@ -526,7 +526,7 @@ let pe = class {
|
|
526
526
|
return this.cssText;
|
527
527
|
}
|
528
528
|
};
|
529
|
-
const je = (r) => new pe(typeof r == "string" ? r : r + "", void 0, Et),
|
529
|
+
const je = (r) => new pe(typeof r == "string" ? r : r + "", void 0, Et), U = (r, ...t) => {
|
530
530
|
const e = r.length === 1 ? r[0] : t.reduce((i, s, n) => i + ((o) => {
|
531
531
|
if (o._$cssResult$ === !0) return o.cssText;
|
532
532
|
if (typeof o == "number") return o;
|
@@ -786,7 +786,7 @@ T.elementStyles = [], T.shadowRootOptions = { mode: "open" }, T[F("elementProper
|
|
786
786
|
* Copyright 2017 Google LLC
|
787
787
|
* SPDX-License-Identifier: BSD-3-Clause
|
788
788
|
*/
|
789
|
-
const B = globalThis, tt = B.trustedTypes, Gt = tt ? tt.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, fe = "$lit$",
|
789
|
+
const B = globalThis, tt = B.trustedTypes, Gt = tt ? tt.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, fe = "$lit$", x = `lit$${Math.random().toFixed(9).slice(2)}$`, ge = "?" + x, Ge = `<${ge}>`, I = document, z = () => I.createComment(""), V = (r) => r === null || typeof r != "object" && typeof r != "function", Pt = Array.isArray, Ke = (r) => Pt(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", ht = `[
|
790
790
|
\f\r]`, H = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Kt = /-->/g, Yt = />/g, E = RegExp(`>|${ht}(?:([^\\s"'>=/]+)(${ht}*=${ht}*(?:[^
|
791
791
|
\f\r"'\`<>=]|("|')|))|$)`, "g"), Zt = /'/g, Jt = /"/g, me = /^(?:script|style|textarea|title)$/i, Ye = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), R = Ye(1), k = Symbol.for("lit-noChange"), p = Symbol.for("lit-nothing"), Xt = /* @__PURE__ */ new WeakMap(), P = I.createTreeWalker(I, 129);
|
792
792
|
function ve(r, t) {
|
@@ -801,7 +801,7 @@ const Ze = (r, t) => {
|
|
801
801
|
let l, h, d = -1, u = 0;
|
802
802
|
for (; u < c.length && (o.lastIndex = u, h = o.exec(c), h !== null); ) u = o.lastIndex, o === H ? h[1] === "!--" ? o = Kt : h[1] !== void 0 ? o = Yt : h[2] !== void 0 ? (me.test(h[2]) && (s = RegExp("</" + h[2], "g")), o = E) : h[3] !== void 0 && (o = E) : o === E ? h[0] === ">" ? (o = s ?? H, d = -1) : h[1] === void 0 ? d = -2 : (d = o.lastIndex - h[2].length, l = h[1], o = h[3] === void 0 ? E : h[3] === '"' ? Jt : Zt) : o === Jt || o === Zt ? o = E : o === Kt || o === Yt ? o = H : (o = E, s = void 0);
|
803
803
|
const f = o === E && r[a + 1].startsWith("/>") ? " " : "";
|
804
|
-
n += o === H ? c + Ge : d >= 0 ? (i.push(l), c.slice(0, d) + fe + c.slice(d) +
|
804
|
+
n += o === H ? c + Ge : d >= 0 ? (i.push(l), c.slice(0, d) + fe + c.slice(d) + x + f) : c + x + (d === -2 ? a : f);
|
805
805
|
}
|
806
806
|
return [ve(r, n + (r[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), i];
|
807
807
|
};
|
@@ -818,11 +818,11 @@ let $t = class ye {
|
|
818
818
|
for (; (s = P.nextNode()) !== null && c.length < a; ) {
|
819
819
|
if (s.nodeType === 1) {
|
820
820
|
if (s.hasAttributes()) for (const d of s.getAttributeNames()) if (d.endsWith(fe)) {
|
821
|
-
const u = h[o++], f = s.getAttribute(d).split(
|
821
|
+
const u = h[o++], f = s.getAttribute(d).split(x), g = /([.?@])?(.*)/.exec(u);
|
822
822
|
c.push({ type: 1, index: n, name: g[2], strings: f, ctor: g[1] === "." ? Xe : g[1] === "?" ? Qe : g[1] === "@" ? ti : ot }), s.removeAttribute(d);
|
823
|
-
} else d.startsWith(
|
823
|
+
} else d.startsWith(x) && (c.push({ type: 6, index: n }), s.removeAttribute(d));
|
824
824
|
if (me.test(s.tagName)) {
|
825
|
-
const d = s.textContent.split(
|
825
|
+
const d = s.textContent.split(x), u = d.length - 1;
|
826
826
|
if (u > 0) {
|
827
827
|
s.textContent = tt ? tt.emptyScript : "";
|
828
828
|
for (let f = 0; f < u; f++) s.append(d[f], z()), P.nextNode(), c.push({ type: 2, index: ++n });
|
@@ -832,7 +832,7 @@ let $t = class ye {
|
|
832
832
|
} else if (s.nodeType === 8) if (s.data === ge) c.push({ type: 2, index: n });
|
833
833
|
else {
|
834
834
|
let d = -1;
|
835
|
-
for (; (d = s.data.indexOf(
|
835
|
+
for (; (d = s.data.indexOf(x, d + 1)) !== -1; ) c.push({ type: 7, index: n }), d += x.length - 1;
|
836
836
|
}
|
837
837
|
n++;
|
838
838
|
}
|
@@ -1023,7 +1023,7 @@ const ii = (r, t, e) => {
|
|
1023
1023
|
* SPDX-License-Identifier: BSD-3-Clause
|
1024
1024
|
*/
|
1025
1025
|
const O = globalThis;
|
1026
|
-
let
|
1026
|
+
let A = class extends T {
|
1027
1027
|
constructor() {
|
1028
1028
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
1029
1029
|
}
|
@@ -1049,9 +1049,9 @@ let x = class extends T {
|
|
1049
1049
|
}
|
1050
1050
|
};
|
1051
1051
|
var ae;
|
1052
|
-
|
1052
|
+
A._$litElement$ = !0, A.finalized = !0, (ae = O.litElementHydrateSupport) == null || ae.call(O, { LitElement: A });
|
1053
1053
|
const dt = O.litElementPolyfillSupport;
|
1054
|
-
dt == null || dt({ LitElement:
|
1054
|
+
dt == null || dt({ LitElement: A });
|
1055
1055
|
(O.litElementVersions ?? (O.litElementVersions = [])).push("4.2.0");
|
1056
1056
|
/**
|
1057
1057
|
* @license
|
@@ -1098,7 +1098,7 @@ var ni = Object.defineProperty, oi = (r, t, e, i) => {
|
|
1098
1098
|
(o = r[n]) && (s = o(t, e, s) || s);
|
1099
1099
|
return s && ni(t, e, s), s;
|
1100
1100
|
};
|
1101
|
-
const Tt = class Tt extends
|
1101
|
+
const Tt = class Tt extends A {
|
1102
1102
|
constructor() {
|
1103
1103
|
super(...arguments), this.anchor = "BottomRight";
|
1104
1104
|
}
|
@@ -1111,7 +1111,7 @@ const Tt = class Tt extends x {
|
|
1111
1111
|
}
|
1112
1112
|
};
|
1113
1113
|
Tt.styles = [
|
1114
|
-
|
1114
|
+
U`
|
1115
1115
|
:host {
|
1116
1116
|
position: fixed;
|
1117
1117
|
display: flex;
|
@@ -1485,10 +1485,10 @@ const ne = It(class extends be {
|
|
1485
1485
|
* Copyright 2020 Google LLC
|
1486
1486
|
* SPDX-License-Identifier: BSD-3-Clause
|
1487
1487
|
*/
|
1488
|
-
const
|
1488
|
+
const Ae = () => new yi();
|
1489
1489
|
class yi {
|
1490
1490
|
}
|
1491
|
-
const ft = /* @__PURE__ */ new WeakMap(),
|
1491
|
+
const ft = /* @__PURE__ */ new WeakMap(), xe = It(class extends $e {
|
1492
1492
|
render(r) {
|
1493
1493
|
return p;
|
1494
1494
|
}
|
@@ -1520,9 +1520,9 @@ var bi = Object.defineProperty, Y = (r, t, e, i) => {
|
|
1520
1520
|
(o = r[n]) && (s = o(t, e, s) || s);
|
1521
1521
|
return s && bi(t, e, s), s;
|
1522
1522
|
};
|
1523
|
-
const Rt = class Rt extends
|
1523
|
+
const Rt = class Rt extends A {
|
1524
1524
|
constructor() {
|
1525
|
-
super(...arguments), this.active = !1, this.triggerVisible = !0, this.loaded = !1, this.containerRef =
|
1525
|
+
super(...arguments), this.active = !1, this.triggerVisible = !0, this.loaded = !1, this.containerRef = Ae(), this.widgetActive$ = new xt(!1), this.componentIsDestroyed$ = new At();
|
1526
1526
|
}
|
1527
1527
|
async connectedCallback() {
|
1528
1528
|
super.connectedCallback(), this.icon = await this._renderSymbol(), this.loaded = !0, this._applyBranding();
|
@@ -1595,17 +1595,18 @@ const Rt = class Rt extends x {
|
|
1595
1595
|
this.triggerVisible = !0;
|
1596
1596
|
}
|
1597
1597
|
render() {
|
1598
|
-
var t, e, i, s;
|
1598
|
+
var t, e, i, s, n, o, a;
|
1599
1599
|
return R`<div
|
1600
1600
|
class=${ne({
|
1601
1601
|
"trigger-container": !0,
|
1602
1602
|
hidden: !this.triggerVisible
|
1603
1603
|
})}
|
1604
|
-
${
|
1604
|
+
${xe(this.containerRef)}
|
1605
1605
|
>
|
1606
1606
|
${!this.active && ((s = (i = (e = (t = this.application) == null ? void 0 : t.settings) == null ? void 0 : e.branding) == null ? void 0 : i.other) != null && s.showButtonLabel) ? R`
|
1607
1607
|
<button
|
1608
|
-
|
1608
|
+
type="button"
|
1609
|
+
aria-label="${this.application.settings.branding.other.buttonLabelText ?? "Widget trigger"}"
|
1609
1610
|
class="trigger-label"
|
1610
1611
|
@click=${this.toggleActive}
|
1611
1612
|
${mi({
|
@@ -1615,12 +1616,13 @@ const Rt = class Rt extends x {
|
|
1615
1616
|
skipInitial: !1
|
1616
1617
|
})}
|
1617
1618
|
>
|
1618
|
-
${this.application.settings.branding.other.buttonLabelText}
|
1619
|
+
${this.application.settings.branding.other.buttonLabelText ?? "Widget trigger"}
|
1619
1620
|
</button>
|
1620
1621
|
` : p}
|
1621
1622
|
|
1622
1623
|
<button
|
1623
|
-
|
1624
|
+
type="button"
|
1625
|
+
aria-label="${((a = (o = (n = this.application) == null ? void 0 : n.settings) == null ? void 0 : o.branding.other) == null ? void 0 : a.buttonLabelText) ?? "Widget trigger"}"
|
1624
1626
|
class=${ne({
|
1625
1627
|
trigger: !0,
|
1626
1628
|
active: this.active,
|
@@ -1661,7 +1663,7 @@ const Rt = class Rt extends x {
|
|
1661
1663
|
}
|
1662
1664
|
};
|
1663
1665
|
Rt.styles = [
|
1664
|
-
|
1666
|
+
U`
|
1665
1667
|
:host {
|
1666
1668
|
--voca-rem-multiplier: 0.625;
|
1667
1669
|
--trigger-label-bg: #f5e0ff;
|
@@ -1839,7 +1841,7 @@ const $i = (r) => {
|
|
1839
1841
|
};
|
1840
1842
|
e.styles = [
|
1841
1843
|
// (superClass as unknown as typeof LitElement).styles ?? [],
|
1842
|
-
|
1844
|
+
U`
|
1843
1845
|
:host {
|
1844
1846
|
font-family: var(--font-family);
|
1845
1847
|
grid-column: span var(--width);
|
@@ -1869,13 +1871,13 @@ const $i = (r) => {
|
|
1869
1871
|
], t.prototype, "application"), S([
|
1870
1872
|
m({ attribute: !1 })
|
1871
1873
|
], t.prototype, "parent"), t;
|
1872
|
-
}, Mt = class Mt extends $i(
|
1874
|
+
}, Mt = class Mt extends $i(A) {
|
1873
1875
|
render() {
|
1874
1876
|
return R`Non resolved component`;
|
1875
1877
|
}
|
1876
1878
|
};
|
1877
1879
|
Mt.styles = [
|
1878
|
-
|
1880
|
+
U`
|
1879
1881
|
:host {
|
1880
1882
|
display: block;
|
1881
1883
|
}
|
@@ -1893,13 +1895,13 @@ function* _i(r, t) {
|
|
1893
1895
|
for (const i of r) yield t(i, e++);
|
1894
1896
|
}
|
1895
1897
|
}
|
1896
|
-
var $ = /* @__PURE__ */ ((r) => (r.Inline = "inline", r.Trigger = "trigger", r))($ || {}),
|
1898
|
+
var $ = /* @__PURE__ */ ((r) => (r.Inline = "inline", r.Trigger = "trigger", r))($ || {}), Ai = /* @__PURE__ */ ((r) => (r.NonAuthenticated = "non-authenticated", r.Authenticating = "authenticating", r.Authenticated = "authenticated", r.ChatEnded = "chat-ended", r))(Ai || {});
|
1897
1899
|
/**
|
1898
1900
|
* @license
|
1899
1901
|
* Copyright 2021 Google LLC
|
1900
1902
|
* SPDX-License-Identifier: BSD-3-Clause
|
1901
1903
|
*/
|
1902
|
-
let
|
1904
|
+
let xi = class extends Event {
|
1903
1905
|
constructor(t, e, i, s) {
|
1904
1906
|
super("context-request", { bubbles: !0, composed: !0 }), this.context = t, this.contextTarget = e, this.callback = i, this.subscribe = s ?? !1;
|
1905
1907
|
}
|
@@ -1962,7 +1964,7 @@ class oe extends Ci {
|
|
1962
1964
|
}, this.onProviderRequest = (o) => {
|
1963
1965
|
if (o.context !== this.context || (o.contextTarget ?? o.composedPath()[0]) === this.host) return;
|
1964
1966
|
const a = /* @__PURE__ */ new Set();
|
1965
|
-
for (const [c, { consumerHost: l }] of this.subscriptions) a.has(c) || (a.add(c), l.dispatchEvent(new
|
1967
|
+
for (const [c, { consumerHost: l }] of this.subscriptions) a.has(c) || (a.add(c), l.dispatchEvent(new xi(this.context, l, c, !0)));
|
1966
1968
|
o.stopPropagation();
|
1967
1969
|
}, this.host = t, e.context !== void 0 ? this.context = e.context : this.context = e, this.attachListeners(), (n = (s = this.host).addController) == null || n.call(s, this);
|
1968
1970
|
}
|
@@ -2016,9 +2018,9 @@ var Pi = Object.defineProperty, Ce = (r, t, e, i) => {
|
|
2016
2018
|
(o = r[n]) && (s = o(t, e, s) || s);
|
2017
2019
|
return s && Pi(t, e, s), s;
|
2018
2020
|
};
|
2019
|
-
const Oi = "application", Nt = class Nt extends
|
2021
|
+
const Oi = "application", Nt = class Nt extends A {
|
2020
2022
|
constructor() {
|
2021
|
-
super(...arguments), this.nodes = [], this.wrapperRef =
|
2023
|
+
super(...arguments), this.nodes = [], this.wrapperRef = Ae(), this.fullscreen = !1, this.isReady = new xt(!1);
|
2022
2024
|
}
|
2023
2025
|
addChild(t) {
|
2024
2026
|
t.parent = this, this.nodes.push(t);
|
@@ -2043,12 +2045,12 @@ const Oi = "application", Nt = class Nt extends x {
|
|
2043
2045
|
render() {
|
2044
2046
|
var i, s;
|
2045
2047
|
const t = this.application.settings.components.conversation;
|
2046
|
-
return ((s = (i = t == null ? void 0 : t.properties) == null ? void 0 : i.chat) == null ? void 0 : s.isThirdPartyWidget) ? this.renderRoot.host.classList.add("third-party") : this.application.renderStrategy === $.Trigger && (this.renderRoot.host.classList.add("floating"), this.application.anchor === "BottomLeft" ? this.renderRoot.host.classList.add("bottom-left") : this.application.anchor === "BottomRight" && this.renderRoot.host.classList.add("bottom-right")), this.application.fullscreen && this.renderRoot.host.classList.add("fullscreen"), window.self !== window.top && this.renderRoot.host.classList.add("embedded"), R`<div class="widget-container" ${
|
2048
|
+
return ((s = (i = t == null ? void 0 : t.properties) == null ? void 0 : i.chat) == null ? void 0 : s.isThirdPartyWidget) ? this.renderRoot.host.classList.add("third-party") : this.application.renderStrategy === $.Trigger && (this.renderRoot.host.classList.add("floating"), this.application.anchor === "BottomLeft" ? this.renderRoot.host.classList.add("bottom-left") : this.application.anchor === "BottomRight" && this.renderRoot.host.classList.add("bottom-right")), this.application.fullscreen && this.renderRoot.host.classList.add("fullscreen"), window.self !== window.top && this.renderRoot.host.classList.add("embedded"), R`<div class="widget-container" ${xe(this.wrapperRef)}>
|
2047
2049
|
${_i(this.nodes, (n) => n)}
|
2048
2050
|
</div>`;
|
2049
2051
|
}
|
2050
2052
|
};
|
2051
|
-
Nt.styles =
|
2053
|
+
Nt.styles = U`
|
2052
2054
|
:host {
|
2053
2055
|
--font-family: TeliaSans, Helvetica, Arial, Lucida Grande, sans-serif;
|
2054
2056
|
--spacing-xs: 0.2rem;
|
@@ -2378,7 +2380,7 @@ class Ti {
|
|
2378
2380
|
return this.texts.get(t) || e;
|
2379
2381
|
}
|
2380
2382
|
}
|
2381
|
-
const Ri = "1.1.120-rc.
|
2383
|
+
const Ri = "1.1.120-rc.23";
|
2382
2384
|
class Mi {
|
2383
2385
|
constructor(t) {
|
2384
2386
|
this.widget = t, this.name = t.name;
|
@@ -2498,10 +2500,10 @@ class Ni {
|
|
2498
2500
|
return this.plugins.push(t), this;
|
2499
2501
|
}
|
2500
2502
|
appendToDOM(t = {}) {
|
2501
|
-
this.root && (this.root.classList.add("expanded"), this.root.classList.remove("hidden"), document.body.appendChild(this.root)), t.ignoreStorage || this.storage.set("open", !0);
|
2503
|
+
this.root && (this.root.classList.add("expanded"), this.root.classList.remove("hidden"), this.root.removeAttribute("inert"), document.body.appendChild(this.root)), t.ignoreStorage || this.storage.set("open", !0);
|
2502
2504
|
}
|
2503
2505
|
hide() {
|
2504
|
-
this.root && (this.root.classList.add("hidden"), this.root.classList.remove("expanded")), this.storage.set("open", !1);
|
2506
|
+
this.root && (this.root.contains(document.activeElement) && (this.trigger && typeof this.trigger.focus == "function" ? this.trigger.focus() : (document.activeElement instanceof HTMLElement && typeof document.activeElement.blur == "function" && document.activeElement.blur(), document.body.focus())), this.root.classList.add("hidden"), this.root.classList.remove("expanded"), this.root.setAttribute("inert", "")), this.storage.set("open", !1);
|
2505
2507
|
}
|
2506
2508
|
setZIndex(t) {
|
2507
2509
|
this.root && (this.root.style.zIndex = t.toString());
|
@@ -2590,7 +2592,7 @@ const qi = (r) => new q(r), rt = class rt {
|
|
2590
2592
|
};
|
2591
2593
|
rt.endpoint = "https://widgets.ace.teliacompany.net/api";
|
2592
2594
|
let q = rt;
|
2593
|
-
class
|
2595
|
+
class Li {
|
2594
2596
|
constructor(t) {
|
2595
2597
|
this.site = t;
|
2596
2598
|
}
|
@@ -2614,7 +2616,7 @@ class Ui {
|
|
2614
2616
|
});
|
2615
2617
|
}
|
2616
2618
|
}
|
2617
|
-
class
|
2619
|
+
class Ui {
|
2618
2620
|
constructor() {
|
2619
2621
|
this.applications = [], this.container = new Dt("environment", this), this.bootstrapped = !1, this.site = null, this.widgetAPIHandlers = /* @__PURE__ */ new Map(), this.siteConfigurationHandlers = [], setTimeout(() => {
|
2620
2622
|
this.notifyWidgetsOfCreation();
|
@@ -2704,7 +2706,7 @@ class Li {
|
|
2704
2706
|
}
|
2705
2707
|
class ji {
|
2706
2708
|
constructor(t) {
|
2707
|
-
this.configurations = [], this.httpClient = new q(), this.api = new
|
2709
|
+
this.configurations = [], this.httpClient = new q(), this.api = new Li(this), this.triggers = [], this.httpClient = new q(), typeof t == "string" ? this.url = t : (t.httpClient && (this.httpClient = t.httpClient), this.loadFromConfig(t));
|
2708
2710
|
}
|
2709
2711
|
async load(t) {
|
2710
2712
|
const e = await this.httpClient.getSite(t);
|
@@ -2732,7 +2734,7 @@ class ji {
|
|
2732
2734
|
}
|
2733
2735
|
async bootstrap(t) {
|
2734
2736
|
var e;
|
2735
|
-
this.url && await this.load(this.url), this.environment = new
|
2737
|
+
this.url && await this.load(this.url), this.environment = new Ui(), this.addGlobal(this.environment);
|
2736
2738
|
for await (const i of this.configurations) {
|
2737
2739
|
const s = await this.httpClient.getWidget(i.widgetId);
|
2738
2740
|
s && ((e = this.environment) == null || e.registerApp(
|
@@ -2763,7 +2765,7 @@ var Hi = Object.defineProperty, kt = (r, t, e, i) => {
|
|
2763
2765
|
(o = r[n]) && (s = o(t, e, s) || s);
|
2764
2766
|
return s && Hi(t, e, s), s;
|
2765
2767
|
};
|
2766
|
-
const
|
2768
|
+
const Lt = class Lt extends A {
|
2767
2769
|
constructor() {
|
2768
2770
|
super(), this.status = "deactivated", this.addEventListener("environment-created", this.onEnvironmentCreated);
|
2769
2771
|
}
|
@@ -2795,38 +2797,38 @@ const Ut = class Ut extends x {
|
|
2795
2797
|
return this.widget.render();
|
2796
2798
|
}
|
2797
2799
|
};
|
2798
|
-
|
2799
|
-
|
2800
|
+
Lt.styles = [
|
2801
|
+
U`
|
2800
2802
|
:host {
|
2801
2803
|
display: block;
|
2802
2804
|
}
|
2803
2805
|
`
|
2804
2806
|
];
|
2805
|
-
let
|
2807
|
+
let L = Lt;
|
2806
2808
|
kt([
|
2807
2809
|
m({ attribute: !0 })
|
2808
|
-
],
|
2810
|
+
], L.prototype, "name");
|
2809
2811
|
kt([
|
2810
2812
|
j()
|
2811
|
-
],
|
2813
|
+
], L.prototype, "widget");
|
2812
2814
|
kt([
|
2813
2815
|
j()
|
2814
|
-
],
|
2816
|
+
], L.prototype, "status");
|
2815
2817
|
customElements.get("ace-trigger-slot") || customElements.define("ace-trigger-slot", W);
|
2816
2818
|
customElements.get("ace-trigger") || customElements.define("ace-trigger", b);
|
2817
2819
|
customElements.get("ace-unresolved-component") || customElements.define("ace-unresolved-component", it);
|
2818
2820
|
customElements.get("ace-wrapper") || customElements.define("ace-wrapper", N);
|
2819
|
-
customElements.get("ace-widget") || customElements.define("ace-widget",
|
2821
|
+
customElements.get("ace-widget") || customElements.define("ace-widget", L);
|
2820
2822
|
const Gi = async (r, t, e = {}) => {
|
2821
2823
|
const i = new ji(r);
|
2822
2824
|
e.httpClient && i.setHttpClient(e.httpClient), await i.bootstrap(t);
|
2823
2825
|
};
|
2824
2826
|
export {
|
2825
|
-
|
2827
|
+
L as AceWidget,
|
2826
2828
|
Ni as Application,
|
2827
|
-
|
2829
|
+
Ai as AuthState,
|
2828
2830
|
Dt as Container,
|
2829
|
-
|
2831
|
+
Ui as Environment,
|
2830
2832
|
q as HttpClient,
|
2831
2833
|
ji as Site,
|
2832
2834
|
y as StorageCategory,
|