@telia-ace/widget-core-flamingo 1.1.20-rc.0 → 1.1.20-rc.1
Sign up to get free protection for your applications and to get access to all the features.
- package/index.d.ts +2 -0
- package/index.js +16 -16
- package/index.mjs +77 -76
- package/models/site.d.ts +1 -0
- package/package.json +1 -1
- package/services/http-client.service.d.ts +7 -3
- package/types.d.ts +2 -0
package/index.d.ts
CHANGED
@@ -6,4 +6,6 @@ export { bootstrap } from './bootstrap';
|
|
6
6
|
export { Trigger } from './components/trigger.component';
|
7
7
|
export { WidgetComponent } from './components/widget.component';
|
8
8
|
export { AceWidget } from './components/ace-widget.component';
|
9
|
+
export { HttpClient } from './services/http-client.service';
|
10
|
+
export type { IHttpClient } from './services/http-client.service';
|
9
11
|
export type { WidgetComponentType } from './components/widget.component';
|
package/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var pt=function(i,t){return pt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])},pt(i,t)};function D(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");pt(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function ut(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],r=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&r>=i.length&&(i=void 0),{value:i&&i[r++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function F(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var r=e.call(i),n,s=[],o;try{for(;(t===void 0||t-- >0)&&!(n=r.next()).done;)s.push(n.value)}catch(a){o={error:a}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(o)throw o.error}}return s}function J(i,t,e){if(e||arguments.length===2)for(var r=0,n=t.length,s;r<n;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return i.concat(s||Array.prototype.slice.call(t))}function m(i){return typeof i=="function"}function Nt(i){var t=function(r){Error.call(r),r.stack=new Error().stack},e=i(t);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var nt=Nt(function(i){return function(e){i(this),this.message=e?e.length+` errors occurred during unsubscription:
|
2
2
|
`+e.map(function(r,n){return n+1+") "+r.toString()}).join(`
|
3
|
-
`):"",this.name="UnsubscriptionError",this.errors=e}});function
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=e}});function dt(i,t){if(i){var e=i.indexOf(t);0<=e&&i.splice(e,1)}}var tt=function(){function i(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i.prototype.unsubscribe=function(){var t,e,r,n,s;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=ut(o),c=a.next();!c.done;c=a.next()){var h=c.value;h.remove(this)}}catch(v){t={error:v}}finally{try{c&&!c.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else o.remove(this);var p=this.initialTeardown;if(m(p))try{p()}catch(v){s=v instanceof nt?v.errors:[v]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var f=ut(l),u=f.next();!u.done;u=f.next()){var g=u.value;try{wt(g)}catch(v){s=s??[],v instanceof nt?s=J(J([],F(s)),F(v.errors)):s.push(v)}}}catch(v){r={error:v}}finally{try{u&&!u.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}}if(s)throw new nt(s)}},i.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)wt(t);else{if(t instanceof i){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},i.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},i.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},i.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&dt(e,t)},i.prototype.remove=function(t){var e=this._finalizers;e&&dt(e,t),t instanceof i&&t._removeParent(this)},i.EMPTY=function(){var t=new i;return t.closed=!0,t}(),i}(),Lt=tt.EMPTY;function Dt(i){return i instanceof tt||i&&"closed"in i&&m(i.remove)&&m(i.add)&&m(i.unsubscribe)}function wt(i){m(i)?i():i.unsubscribe()}var Bt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},ft={setTimeout:function(i,t){for(var e=[],r=2;r<arguments.length;r++)e[r-2]=arguments[r];var n=ft.delegate;return n!=null&&n.setTimeout?n.setTimeout.apply(n,J([i,t],F(e))):setTimeout.apply(void 0,J([i,t],F(e)))},clearTimeout:function(i){var t=ft.delegate;return((t==null?void 0:t.clearTimeout)||clearTimeout)(i)},delegate:void 0};function le(i){ft.setTimeout(function(){throw i})}function At(){}function q(i){i()}var zt=function(i){D(t,i);function t(e){var r=i.call(this)||this;return r.isStopped=!1,e?(r.destination=e,Dt(e)&&e.add(r)):r.destination=de,r}return t.create=function(e,r,n){return new gt(e,r,n)},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,i.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(tt),he=Function.prototype.bind;function st(i,t){return he.call(i,t)}var pe=function(){function i(t){this.partialObserver=t}return i.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(r){G(r)}},i.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(r){G(r)}else G(t)},i.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){G(e)}},i}(),gt=function(i){D(t,i);function t(e,r,n){var s=i.call(this)||this,o;if(m(e)||!e)o={next:e??void 0,error:r??void 0,complete:n??void 0};else{var a;s&&Bt.useDeprecatedNextContext?(a=Object.create(e),a.unsubscribe=function(){return s.unsubscribe()},o={next:e.next&&st(e.next,a),error:e.error&&st(e.error,a),complete:e.complete&&st(e.complete,a)}):o=e}return s.destination=new pe(o),s}return t}(zt);function G(i){le(i)}function ue(i){throw i}var de={closed:!0,next:At,error:ue,complete:At},fe=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function ge(i){return i}function ve(i){return i.length===0?ge:i.length===1?i[0]:function(e){return i.reduce(function(r,n){return n(r)},e)}}var St=function(){function i(t){t&&(this._subscribe=t)}return i.prototype.lift=function(t){var e=new i;return e.source=this,e.operator=t,e},i.prototype.subscribe=function(t,e,r){var n=this,s=me(t)?t:new gt(t,e,r);return q(function(){var o=n,a=o.operator,c=o.source;s.add(a?a.call(s,c):c?n._subscribe(s):n._trySubscribe(s))}),s},i.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},i.prototype.forEach=function(t,e){var r=this;return e=Et(e),new e(function(n,s){var o=new gt({next:function(a){try{t(a)}catch(c){s(c),o.unsubscribe()}},error:s,complete:n});r.subscribe(o)})},i.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},i.prototype[fe]=function(){return this},i.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return ve(t)(this)},i.prototype.toPromise=function(t){var e=this;return t=Et(t),new t(function(r,n){var s;e.subscribe(function(o){return s=o},function(o){return n(o)},function(){return r(s)})})},i.create=function(t){return new i(t)},i}();function Et(i){var t;return(t=i??Bt.Promise)!==null&&t!==void 0?t:Promise}function ye(i){return i&&m(i.next)&&m(i.error)&&m(i.complete)}function me(i){return i&&i instanceof zt||ye(i)&&Dt(i)}var be=Nt(function(i){return function(){i(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Wt=function(i){D(t,i);function t(){var e=i.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 r=new Ct(this,this);return r.operator=e,r},t.prototype._throwIfClosed=function(){if(this.closed)throw new be},t.prototype.next=function(e){var r=this;q(function(){var n,s;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var o=ut(r.currentObservers),a=o.next();!a.done;a=o.next()){var c=a.value;c.next(e)}}catch(h){n={error:h}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(n)throw n.error}}}})},t.prototype.error=function(e){var r=this;q(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=e;for(var n=r.observers;n.length;)n.shift().error(e)}})},t.prototype.complete=function(){var e=this;q(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var r=e.observers;r.length;)r.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(),i.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 r=this,n=this,s=n.hasError,o=n.isStopped,a=n.observers;return s||o?Lt:(this.currentObservers=null,a.push(e),new tt(function(){r.currentObservers=null,dt(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var r=this,n=r.hasError,s=r.thrownError,o=r.isStopped;n?e.error(s):o&&e.complete()},t.prototype.asObservable=function(){var e=new St;return e.source=this,e},t.create=function(e,r){return new Ct(e,r)},t}(St),Ct=function(i){D(t,i);function t(e,r){var n=i.call(this)||this;return n.destination=e,n.source=r,n}return t.prototype.next=function(e){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.next)===null||n===void 0||n.call(r,e)},t.prototype.error=function(e){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.error)===null||n===void 0||n.call(r,e)},t.prototype.complete=function(){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||r===void 0||r.call(e)},t.prototype._subscribe=function(e){var r,n;return(n=(r=this.source)===null||r===void 0?void 0:r.subscribe(e))!==null&&n!==void 0?n:Lt},t}(Wt),_e=function(i){D(t,i);function t(e){var r=i.call(this)||this;return r._value=e,r}return Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(e){var r=i.prototype._subscribe.call(this,e);return!r.closed&&e.next(this._value),r},t.prototype.getValue=function(){var e=this,r=e.hasError,n=e.thrownError,s=e._value;if(r)throw n;return this._throwIfClosed(),s},t.prototype.next=function(e){i.prototype.next.call(this,this._value=e)},t}(Wt),Gt=(i=>(i.Loading="loading",i.Ready="ready",i))(Gt||{});class vt{constructor(t,e){this.state=new _e("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,17 +8,17 @@
|
|
8
8
|
* @license
|
9
9
|
* Copyright 2017 Google LLC
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
11
|
-
*/const{is:Ae,defineProperty:Se,getOwnPropertyDescriptor:Ee,getOwnPropertyNames:Ce,getOwnPropertySymbols:xe,getPrototypeOf:Pe}=Object,$=globalThis,Tt=$.trustedTypes,Te=Tt?Tt.emptyScript:"",
|
11
|
+
*/const{is:Ae,defineProperty:Se,getOwnPropertyDescriptor:Ee,getOwnPropertyNames:Ce,getOwnPropertySymbols:xe,getPrototypeOf:Pe}=Object,$=globalThis,Tt=$.trustedTypes,Te=Tt?Tt.emptyScript:"",ot=$.reactiveElementPolyfillSupport,I=(i,t)=>i,K={toAttribute(i,t){switch(t){case Boolean:i=i?Te:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},bt=(i,t)=>!Ae(i,t),Ot={attribute:!0,type:String,converter:K,reflect:!1,hasChanged:bt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),$.litPropertyMetadata??($.litPropertyMetadata=new WeakMap);class T 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=Ot){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const r=Symbol(),n=this.getPropertyDescriptor(t,r,e);n!==void 0&&Se(this.prototype,t,n)}}static getPropertyDescriptor(t,e,r){const{get:n,set:s}=Ee(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return n==null?void 0:n.call(this)},set(o){const a=n==null?void 0:n.call(this);s.call(this,o),this.requestUpdate(t,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ot}static _$Ei(){if(this.hasOwnProperty(I("elementProperties")))return;const t=Pe(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(I("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(I("properties"))){const e=this.properties,r=[...Ce(e),...xe(e)];for(const n of r)this.createProperty(n,e[n])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[r,n]of e)this.elementProperties.set(r,n)}this._$Eh=new Map;for(const[e,r]of this.elementProperties){const n=this._$Eu(e,r);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const n of r)e.unshift(Pt(n))}else t!==void 0&&e.push(Pt(t));return e}static _$Eu(t,e){const r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$Eg=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$ES??(this._$ES=[])).push(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$ES)==null||e.splice(this._$ES.indexOf(t)>>>0,1)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return we(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)==null||t.forEach(e=>{var r;return(r=e.hostConnected)==null?void 0:r.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)==null||t.forEach(e=>{var r;return(r=e.hostDisconnected)==null?void 0:r.call(e)})}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EO(t,e){var s;const r=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,r);if(n!==void 0&&r.reflect===!0){const o=(((s=r.converter)==null?void 0:s.toAttribute)!==void 0?r.converter:K).toAttribute(e,r.type);this._$Em=t,o==null?this.removeAttribute(n):this.setAttribute(n,o),this._$Em=null}}_$AK(t,e){var s;const r=this.constructor,n=r._$Eh.get(t);if(n!==void 0&&this._$Em!==n){const o=r.getPropertyOptions(n),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((s=o.converter)==null?void 0:s.fromAttribute)!==void 0?o.converter:K;this._$Em=n,this[n]=a.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,r,n=!1,s){if(t!==void 0){if(r??(r=this.constructor.getPropertyOptions(t)),!(r.hasChanged??bt)(n?s:this[t],e))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(t,e,r){this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var r;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this._$Ep){for(const[s,o]of this._$Ep)this[s]=o;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[s,o]of n)o.wrapped!==!0||this._$AL.has(s)||this[s]===void 0||this.C(s,this[s],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(r=this._$ES)==null||r.forEach(n=>{var s;return(s=n.hostUpdate)==null?void 0:s.call(n)}),this.update(e)):this._$ET()}catch(n){throw t=!1,this._$ET(),n}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)==null||e.forEach(r=>{var n;return(n=r.hostUpdated)==null?void 0:n.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EO(e,this[e]))),this._$ET()}updated(t){}firstUpdated(t){}}T.elementStyles=[],T.shadowRootOptions={mode:"open"},T[I("elementProperties")]=new Map,T[I("finalized")]=new Map,ot==null||ot({ReactiveElement:T}),($.reactiveElementVersions??($.reactiveElementVersions=[])).push("2.0.1");/**
|
12
12
|
* @license
|
13
13
|
* Copyright 2017 Google LLC
|
14
14
|
* SPDX-License-Identifier: BSD-3-Clause
|
15
|
-
*/const M=globalThis,Z=M.trustedTypes,Ut=Z?Z.createPolicy("lit-html",{createHTML:i=>i}):void 0,qt="$lit$",_=`lit$${(Math.random()+"").slice(9)}$`,Yt="?"+_,Oe=`<${Yt}>`,x=document,H=()=>x.createComment(""),N=i=>i===null||typeof i!="object"&&typeof i!="function",Ft=Array.isArray,Ue=i=>Ft(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",
|
16
|
-
\f\r]`,R=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Rt=/-->/g,It=/>/g,S=RegExp(`>|${
|
17
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Mt=/'/g,kt=/"/g,Jt=/^(?:script|style|textarea|title)$/i,Re=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),k=Re(1),P=Symbol.for("lit-noChange"),
|
15
|
+
*/const M=globalThis,Z=M.trustedTypes,Ut=Z?Z.createPolicy("lit-html",{createHTML:i=>i}):void 0,qt="$lit$",_=`lit$${(Math.random()+"").slice(9)}$`,Yt="?"+_,Oe=`<${Yt}>`,x=document,H=()=>x.createComment(""),N=i=>i===null||typeof i!="object"&&typeof i!="function",Ft=Array.isArray,Ue=i=>Ft(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",at=`[
|
16
|
+
\f\r]`,R=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Rt=/-->/g,It=/>/g,S=RegExp(`>|${at}(?:([^\\s"'>=/]+)(${at}*=${at}*(?:[^
|
17
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Mt=/'/g,kt=/"/g,Jt=/^(?:script|style|textarea|title)$/i,Re=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),k=Re(1),P=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),jt=new WeakMap,C=x.createTreeWalker(x,129);function Kt(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ut!==void 0?Ut.createHTML(t):t}const Ie=(i,t)=>{const e=i.length-1,r=[];let n,s=t===2?"<svg>":"",o=R;for(let a=0;a<e;a++){const c=i[a];let h,p,l=-1,f=0;for(;f<c.length&&(o.lastIndex=f,p=o.exec(c),p!==null);)f=o.lastIndex,o===R?p[1]==="!--"?o=Rt:p[1]!==void 0?o=It:p[2]!==void 0?(Jt.test(p[2])&&(n=RegExp("</"+p[2],"g")),o=S):p[3]!==void 0&&(o=S):o===S?p[0]===">"?(o=n??R,l=-1):p[1]===void 0?l=-2:(l=o.lastIndex-p[2].length,h=p[1],o=p[3]===void 0?S:p[3]==='"'?kt:Mt):o===kt||o===Mt?o=S:o===Rt||o===It?o=R:(o=S,n=void 0);const u=o===S&&i[a+1].startsWith("/>")?" ":"";s+=o===R?c+Oe:l>=0?(r.push(h),c.slice(0,l)+qt+c.slice(l)+_+u):c+_+(l===-2?a:u)}return[Kt(i,s+(i[e]||"<?>")+(t===2?"</svg>":"")),r]};class L{constructor({strings:t,_$litType$:e},r){let n;this.parts=[];let s=0,o=0;const a=t.length-1,c=this.parts,[h,p]=Ie(t,e);if(this.el=L.createElement(h,r),C.currentNode=this.el.content,e===2){const l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(n=C.nextNode())!==null&&c.length<a;){if(n.nodeType===1){if(n.hasAttributes())for(const l of n.getAttributeNames())if(l.endsWith(qt)){const f=p[o++],u=n.getAttribute(l).split(_),g=/([.?@])?(.*)/.exec(f);c.push({type:1,index:s,name:g[2],strings:u,ctor:g[1]==="."?ke:g[1]==="?"?je:g[1]==="@"?He:et}),n.removeAttribute(l)}else l.startsWith(_)&&(c.push({type:6,index:s}),n.removeAttribute(l));if(Jt.test(n.tagName)){const l=n.textContent.split(_),f=l.length-1;if(f>0){n.textContent=Z?Z.emptyScript:"";for(let u=0;u<f;u++)n.append(l[u],H()),C.nextNode(),c.push({type:2,index:++s});n.append(l[f],H())}}}else if(n.nodeType===8)if(n.data===Yt)c.push({type:2,index:s});else{let l=-1;for(;(l=n.data.indexOf(_,l+1))!==-1;)c.push({type:7,index:s}),l+=_.length-1}s++}}static createElement(t,e){const r=x.createElement("template");return r.innerHTML=t,r}}function O(i,t,e=i,r){var o,a;if(t===P)return t;let n=r!==void 0?(o=e._$Co)==null?void 0:o[r]:e._$Cl;const s=N(t)?void 0:t._$litDirective$;return(n==null?void 0:n.constructor)!==s&&((a=n==null?void 0:n._$AO)==null||a.call(n,!1),s===void 0?n=void 0:(n=new s(i),n._$AT(i,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=n:e._$Cl=n),n!==void 0&&(t=O(i,n._$AS(i,t.values),n,r)),t}class Me{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:r}=this._$AD,n=((t==null?void 0:t.creationScope)??x).importNode(e,!0);C.currentNode=n;let s=C.nextNode(),o=0,a=0,c=r[0];for(;c!==void 0;){if(o===c.index){let h;c.type===2?h=new z(s,s.nextSibling,this,t):c.type===1?h=new c.ctor(s,c.name,c.strings,this,t):c.type===6&&(h=new Ne(s,this,t)),this._$AV.push(h),c=r[++a]}o!==(c==null?void 0:c.index)&&(s=C.nextNode(),o++)}return C.currentNode=x,n}p(t){let e=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}class z{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,r,n){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=n,this._$Cv=(n==null?void 0:n.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=O(this,t,e),N(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==P&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):Ue(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==d&&N(this._$AH)?this._$AA.nextSibling.data=t:this.$(x.createTextNode(t)),this._$AH=t}g(t){var s;const{values:e,_$litType$:r}=t,n=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=L.createElement(Kt(r.h,r.h[0]),this.options)),r);if(((s=this._$AH)==null?void 0:s._$AD)===n)this._$AH.p(e);else{const o=new Me(n,this),a=o.u(this.options);o.p(e),this.$(a),this._$AH=o}}_$AC(t){let e=jt.get(t.strings);return e===void 0&&jt.set(t.strings,e=new L(t)),e}T(t){Ft(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,n=0;for(const s of t)n===e.length?e.push(r=new z(this.k(H()),this.k(H()),this,this.options)):r=e[n],r._$AI(s),n++;n<e.length&&(this._$AR(r&&r._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,e);t&&t!==this._$AB;){const n=t.nextSibling;t.remove(),t=n}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}}class et{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,n,s){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=d}_$AI(t,e=this,r,n){const s=this.strings;let o=!1;if(s===void 0)t=O(this,t,e,0),o=!N(t)||t!==this._$AH&&t!==P,o&&(this._$AH=t);else{const a=t;let c,h;for(t=s[0],c=0;c<s.length-1;c++)h=O(this,a[r+c],e,c),h===P&&(h=this._$AH[c]),o||(o=!N(h)||h!==this._$AH[c]),h===d?t=d:t!==d&&(t+=(h??"")+s[c+1]),this._$AH[c]=h}o&&!n&&this.O(t)}O(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class ke extends et{constructor(){super(...arguments),this.type=3}O(t){this.element[this.name]=t===d?void 0:t}}class je extends et{constructor(){super(...arguments),this.type=4}O(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}}class He extends et{constructor(t,e,r,n,s){super(t,e,r,n,s),this.type=5}_$AI(t,e=this){if((t=O(this,t,e,0)??d)===P)return;const r=this._$AH,n=t===d&&r!==d||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,s=t!==d&&(r===d||n);n&&this.element.removeEventListener(this.name,this,r),s&&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 Ne{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){O(this,t)}}const ct=M.litHtmlPolyfillSupport;ct==null||ct(L,z),(M.litHtmlVersions??(M.litHtmlVersions=[])).push("3.0.2");const Le=(i,t,e)=>{const r=(e==null?void 0:e.renderBefore)??t;let n=r._$litPart$;if(n===void 0){const s=(e==null?void 0:e.renderBefore)??null;r._$litPart$=n=new z(t.insertBefore(H(),s),s,void 0,e??{})}return n._$AI(i),n};/**
|
18
18
|
* @license
|
19
19
|
* Copyright 2017 Google LLC
|
20
20
|
* SPDX-License-Identifier: BSD-3-Clause
|
21
|
-
*/let w=class extends T{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Le(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return P}};var Ht;w._$litElement$=!0,w.finalized=!0,(Ht=globalThis.litElementHydrateSupport)==null||Ht.call(globalThis,{LitElement:w});const
|
21
|
+
*/let w=class extends T{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Le(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return P}};var Ht;w._$litElement$=!0,w.finalized=!0,(Ht=globalThis.litElementHydrateSupport)==null||Ht.call(globalThis,{LitElement:w});const lt=globalThis.litElementPolyfillSupport;lt==null||lt({LitElement:w});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.1");/**
|
22
22
|
* @license
|
23
23
|
* Copyright 2017 Google LLC
|
24
24
|
* SPDX-License-Identifier: BSD-3-Clause
|
@@ -34,11 +34,11 @@
|
|
34
34
|
* @license
|
35
35
|
* Copyright 2018 Google LLC
|
36
36
|
* SPDX-License-Identifier: BSD-3-Clause
|
37
|
-
*/const ze=Qt(class extends Xt{constructor(i){var t;if(super(i),i.type!==Zt.ATTRIBUTE||i.name!=="class"||((t=i.strings)==null?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(i){return" "+Object.keys(i).filter(t=>i[t]).join(" ")+" "}update(i,[t]){var r,n;if(this.it===void 0){this.it=new Set,i.strings!==void 0&&(this.st=new Set(i.strings.join(" ").split(/\s/).filter(s=>s!=="")));for(const s in t)t[s]&&!((r=this.st)!=null&&r.has(s))&&this.it.add(s);return this.render(t)}const e=i.element.classList;for(const s of this.it)s in t||(e.remove(s),this.it.delete(s));for(const s in t){const o=!!t[s];o===this.it.has(s)||(n=this.st)!=null&&n.has(s)||(o?(e.add(s),this.it.add(s)):(e.remove(s),this.it.delete(s)))}return P}}),V=(i,t,e)=>{i&&e.style.setProperty(t,i)},te=(i,t)=>{var e,r,n,s;V((e=i.colors)==null?void 0:e.primaryBackground,"--primary-background",t),V((r=i.colors)==null?void 0:r.textOnPrimaryBackground,"--text-on-primary-background",t),V((n=i.colors)==null?void 0:n.secondaryBackground,"--secondary-background",t),V((s=i.colors)==null?void 0:s.textOnSecondaryBackground,"--text-on-secondary-background",t)};var We=Object.defineProperty,Ge=Object.getOwnPropertyDescriptor,
|
37
|
+
*/const ze=Qt(class extends Xt{constructor(i){var t;if(super(i),i.type!==Zt.ATTRIBUTE||i.name!=="class"||((t=i.strings)==null?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(i){return" "+Object.keys(i).filter(t=>i[t]).join(" ")+" "}update(i,[t]){var r,n;if(this.it===void 0){this.it=new Set,i.strings!==void 0&&(this.st=new Set(i.strings.join(" ").split(/\s/).filter(s=>s!=="")));for(const s in t)t[s]&&!((r=this.st)!=null&&r.has(s))&&this.it.add(s);return this.render(t)}const e=i.element.classList;for(const s of this.it)s in t||(e.remove(s),this.it.delete(s));for(const s in t){const o=!!t[s];o===this.it.has(s)||(n=this.st)!=null&&n.has(s)||(o?(e.add(s),this.it.add(s)):(e.remove(s),this.it.delete(s)))}return P}}),V=(i,t,e)=>{i&&e.style.setProperty(t,i)},te=(i,t)=>{var e,r,n,s;V((e=i.colors)==null?void 0:e.primaryBackground,"--primary-background",t),V((r=i.colors)==null?void 0:r.textOnPrimaryBackground,"--text-on-primary-background",t),V((n=i.colors)==null?void 0:n.secondaryBackground,"--secondary-background",t),V((s=i.colors)==null?void 0:s.textOnSecondaryBackground,"--text-on-secondary-background",t)};var We=Object.defineProperty,Ge=Object.getOwnPropertyDescriptor,rt=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ge(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&We(t,e,n),n};class b extends w{constructor(){super(...arguments),this.active=!1,this.loaded=!1}async connectedCallback(){super.connectedCallback(),this.icon=await this._renderSymbol(),this.loaded=!0,this._applyBranding()}_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.application.hide()}_applyBranding(){var t;(t=this.application)!=null&&t.settings&&te(this.application.settings.branding,this)}async _renderSymbol(){var a,c,h;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 k` <img src=${e} class="trigger-icon" alt="" /> `;const r=(h=this.application)==null?void 0:h.triggerIcon;if(!r)return d;const n=async p=>await Promise.resolve().then(()=>require("./index-6dd00f59.js")).then(f=>f[p]),{type:s,content:o}=r;switch(s){case"Telia":{const p=await n(o);return p?k`<telia-icon
|
38
38
|
class="trigger-icon"
|
39
|
-
svg=${
|
39
|
+
svg=${p.svg}
|
40
40
|
size="lg"
|
41
|
-
></telia-icon>`:
|
41
|
+
></telia-icon>`:d}default:return d}}render(){return k`<button
|
42
42
|
class=${ze({trigger:!0,active:this.active,rendered:this.loaded})}
|
43
43
|
@click=${this._toggleActive}
|
44
44
|
>
|
@@ -142,7 +142,7 @@
|
|
142
142
|
img {
|
143
143
|
max-width: 100%;
|
144
144
|
}
|
145
|
-
`];
|
145
|
+
`];rt([y({attribute:!1})],b.prototype,"application",2);rt([W()],b.prototype,"active",2);rt([W()],b.prototype,"loaded",2);rt([W()],b.prototype,"icon",2);var Ve=Object.defineProperty,qe=Object.getOwnPropertyDescriptor,E=(i,t,e,r)=>{for(var n=r>1?void 0:r?qe(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Ve(t,e,n),n};const ee=i=>{class t extends i{constructor(){super(...arguments),this.properties={},this.context={},this.layout={},this.nodes=[]}writeProperties(r){this.properties=r}writeLayout(r){this.layout=r}writeContext(r){this.context=r}addChild(r){r.parent=this,this.nodes.push(r)}connectedCallback(){super.connectedCallback(),this.renderRoot.host.style.setProperty("--width",this.layout.size==="full"?"var(--columns, 1)":`min(${this.layout.size||"var(--columns)"}, var(--columns))`)}}return t.styles=[B`
|
146
146
|
:host {
|
147
147
|
font-family: var(--font-family);
|
148
148
|
grid-column: span var(--width);
|
@@ -170,13 +170,13 @@
|
|
170
170
|
* @license
|
171
171
|
* Copyright 2020 Google LLC
|
172
172
|
* SPDX-License-Identifier: BSD-3-Clause
|
173
|
-
*/const Qe=()=>new Xe;class Xe{}const
|
173
|
+
*/const Qe=()=>new Xe;class Xe{}const ht=new WeakMap,tr=Qt(class extends Ze{render(i){return d}update(i,[t]){var r;const e=t!==this.G;return e&&this.G!==void 0&&this.ot(void 0),(e||this.rt!==this.lt)&&(this.G=t,this.ct=(r=i.options)==null?void 0:r.host,this.ot(this.lt=i.element)),d}ot(i){if(typeof this.G=="function"){const t=this.ct??globalThis;let e=ht.get(t);e===void 0&&(e=new WeakMap,ht.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ct,void 0),e.set(this.G,i),i!==void 0&&this.G.call(this.ct,i)}else this.G.value=i}get rt(){var i,t;return typeof this.G=="function"?(i=ht.get(this.ct??globalThis))==null?void 0:i.get(this.G):(t=this.G)==null?void 0:t.value}disconnected(){this.rt===this.lt&&this.ot(void 0)}reconnected(){this.ot(this.lt)}});/**
|
174
174
|
* @license
|
175
175
|
* Copyright 2021 Google LLC
|
176
176
|
* SPDX-License-Identifier: BSD-3-Clause
|
177
|
-
*/function*er(i,t){if(i!==void 0){let e=0;for(const r of i)yield t(r,e++)}}var A=(i=>(i.Inline="inline",i.Trigger="trigger",i))(A||{}),rr=Object.defineProperty,ir=Object.getOwnPropertyDescriptor,nr=(i,t,e,r)=>{for(var n=r>1?void 0:r?ir(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&rr(t,e,n),n};class
|
177
|
+
*/function*er(i,t){if(i!==void 0){let e=0;for(const r of i)yield t(r,e++)}}var A=(i=>(i.Inline="inline",i.Trigger="trigger",i))(A||{}),rr=Object.defineProperty,ir=Object.getOwnPropertyDescriptor,nr=(i,t,e,r)=>{for(var n=r>1?void 0:r?ir(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&rr(t,e,n),n};class it extends w{constructor(){super(...arguments),this.nodes=[],this.wrapperRef=Qe()}addChild(t){t.parent=this,this.nodes.push(t)}applyBranding(){if(this.wrapperRef.value){const t=this.application.settings;t!=null&&t.branding&&te(t.branding,this.wrapperRef.value)}}firstUpdated(t){this.applyBranding()}render(){return this.application.renderStrategy===A.Trigger&&this.renderRoot.host.classList.add("floating"),k`<div class="widget-container" ${tr(this.wrapperRef)}>
|
178
178
|
${er(this.nodes,t=>t)}
|
179
|
-
</div>`}}
|
179
|
+
</div>`}}it.styles=B`
|
180
180
|
:host {
|
181
181
|
--font-family: TeliaSans, Helvetica, Arial, Lucida Grande, sans-serif;
|
182
182
|
--spacing-xs: 0.2rem;
|
@@ -254,8 +254,8 @@
|
|
254
254
|
opacity: 0;
|
255
255
|
animation: slideDown 0.3s linear;
|
256
256
|
}
|
257
|
-
`;nr([y({attribute:!1})],
|
257
|
+
`;nr([y({attribute:!1})],it.prototype,"application",2);class sr{constructor(){this.root=this.createRoot()}createComponentModel(t,e){this.root.application=e;const r=a=>{if(Array.isArray(a)){const[c,...h]=a;return{definitionId:c,overrides:h}}return{definitionId:a,overrides:[]}},n=(a,c,h,p)=>{h.forEach(l=>{const f=r(l),u=p[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&&n(a,g,u.children,p))})},{entry:s,components:o}=t;return n(this,this.root,[s],o),this.root}createRoot(){return new it}createNode(t,e){const r=this.resolveComponent(e);if(!r)return console.warn(`Unable to resolve component: ${e}`),new _t;const n=new r;return n.type=e,n.name=t,n}resolveComponent(t){return customElements.get(`ace-${t}`)}getRoot(){return this.root}}const ie=class{constructor(){this.components=new Map}getComponent(i){const t=this.components.get(i);return t||console.warn(`Unable to resolve component: ${i}. You most likely forgot to register the required plugin.`),t}registerComponent(i,t){this.components.set(i,t)}async loadComponents(){const i=[...this.components.entries()].map(([t,e])=>e.then(r=>{this.defineAsWebComponent(t,r.default)}));await Promise.all(i)}defineAsWebComponent(i,t){const e=ie.ResolveWebComponentName(i);customElements.get(e)||customElements.define(e,t)}};let ne=ie;ne.ResolveWebComponentName=i=>`ace-${i}`;class se{constructor(t,e,r,n){this.name=t,this.container=e,this.settings=r,this.options=n,this.platform=new sr,this.renderStrategy=A.Inline,this.autoActivate=!1,this.plugins=[],this.componentResolver=new ne,this.renderStrategy=this.options.renderStrategy||A.Inline,this.triggerIcon=this.options.triggerIcon,typeof n.autoActivate=="boolean"&&(this.autoActivate=n.autoActivate),this.container.register("$settings",r)}async activate(){if(await this.loadPlugins(),await this.componentResolver.loadComponents(),this.root=this.platform.createComponentModel(this.settings,this),this.container.setState(Gt.Ready),this.autoActivate){const t=this.render();t&&document.body.appendChild(t)}}async loadPlugins(){for await(const t of this.plugins)await t(this)}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))}hide(){this.root&&(this.root.classList.add("hidden"),this.root.classList.remove("expanded"))}registerComponent(t,e){this.componentResolver.registerComponent(t,e)}resolveComponent(t){return this.componentResolver.getComponent(t)}render(){if(this.renderStrategy===A.Trigger){const t=new b;return t.application=this,t}return this.root}}const oe=class{async getSite(i){const e=await(await fetch(i)).json();return e?{id:e.id,apps:e.widgets.map(r=>{let n=A.Inline;return r.renderStrategy==="Trigger"&&(n=A.Trigger),{id:r.id,widgetId:r.widgetId,renderStrategy:n,autoActivate:r.autoActivate,triggerIcon:{type:"Telia",content:r.triggerIcon}}})}:null}async getWidget(i){const e=await(await fetch(`${oe.endpoint}/widget/${i}`)).json();return e?{name:e.name,config:JSON.parse(e.configuration)}:null}};let X=oe;X.endpoint="https://widgets.ace.teliacompany.net/api";class ae{constructor(){this.applications=[],this.container=new vt("environment",this),setTimeout(()=>{this.notifyWidgetsOfCreation()},1e3)}async bootstrap(){await this.activate()}async activate(){const t=this.applications.filter(e=>e.autoActivate);for await(const e of t)await e.activate()}notifyWidgetsOfCreation(){document.querySelectorAll("ace-widget").forEach(e=>{const r=this.applications.find(n=>n.name===e.name);r&&e.dispatchEvent(new CustomEvent("environment-created",{detail:{widget:r}}))})}registerApp(t,e,r){const n=new vt(t,this),s=new se(t,n,e,r);this.applications.push(s)}}class ce{constructor(t){this.configurations=[],this.httpClient=new X,this.httpClient=new X,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,triggerIcon:{type:"Telia",content:e.triggerIcon||"question"}}))}async bootstrap(t){var e;this.url&&await this.load(this.url),this.environment=new ae,this.addGlobal(this.environment);for await(const r of this.configurations){const n=await this.httpClient.getWidget(r.widgetId);n&&((e=this.environment)==null||e.registerApp(n.name,n.config,{renderStrategy:r.renderStrategy,triggerIcon:r.triggerIcon,autoActivate:r.autoActivate}))}t(this.environment),await this.environment.bootstrap()}addGlobal(t){globalThis.widgets=t}}var or=Object.defineProperty,ar=Object.getOwnPropertyDescriptor,$t=(i,t,e,r)=>{for(var n=r>1?void 0:r?ar(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&or(t,e,n),n};class U extends w{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===A.Trigger){const t=new b;return t.application=this.widget,t}return this.widget.render()}}U.styles=[B`
|
258
258
|
:host {
|
259
259
|
display: block;
|
260
260
|
}
|
261
|
-
`];$t([y({attribute:!0})],U.prototype,"name",2);$t([W()],U.prototype,"widget",2);$t([W()],U.prototype,"status",2);customElements.get("ace-trigger")||customElements.define("ace-trigger",b);customElements.get("ace-unresolved-component")||customElements.define("ace-unresolved-component",_t);customElements.get("ace-wrapper")||customElements.define("ace-wrapper",
|
261
|
+
`];$t([y({attribute:!0})],U.prototype,"name",2);$t([W()],U.prototype,"widget",2);$t([W()],U.prototype,"status",2);customElements.get("ace-trigger")||customElements.define("ace-trigger",b);customElements.get("ace-unresolved-component")||customElements.define("ace-unresolved-component",_t);customElements.get("ace-wrapper")||customElements.define("ace-wrapper",it);customElements.get("ace-widget")||customElements.define("ace-widget",U);const cr=async(i,t)=>{await new ce(i).bootstrap(t)};exports.AceWidget=U;exports.Application=se;exports.Container=vt;exports.Environment=ae;exports.HttpClient=X;exports.Site=ce;exports.Trigger=b;exports.WidgetComponent=ee;exports.bootstrap=cr;
|
package/index.mjs
CHANGED
@@ -90,8 +90,8 @@ var X = function() {
|
|
90
90
|
if (this._parentage = null, Array.isArray(o))
|
91
91
|
try {
|
92
92
|
for (var a = pt(o), c = a.next(); !c.done; c = a.next()) {
|
93
|
-
var
|
94
|
-
|
93
|
+
var h = c.value;
|
94
|
+
h.remove(this);
|
95
95
|
}
|
96
96
|
} catch (v) {
|
97
97
|
t = { error: v };
|
@@ -105,19 +105,19 @@ var X = function() {
|
|
105
105
|
}
|
106
106
|
else
|
107
107
|
o.remove(this);
|
108
|
-
var
|
109
|
-
if (m(
|
108
|
+
var p = this.initialTeardown;
|
109
|
+
if (m(p))
|
110
110
|
try {
|
111
|
-
|
111
|
+
p();
|
112
112
|
} catch (v) {
|
113
113
|
s = v instanceof it ? v.errors : [v];
|
114
114
|
}
|
115
|
-
var
|
116
|
-
if (
|
115
|
+
var l = this._finalizers;
|
116
|
+
if (l) {
|
117
117
|
this._finalizers = null;
|
118
118
|
try {
|
119
|
-
for (var f = pt(
|
120
|
-
var g =
|
119
|
+
for (var f = pt(l), u = f.next(); !u.done; u = f.next()) {
|
120
|
+
var g = u.value;
|
121
121
|
try {
|
122
122
|
$t(g);
|
123
123
|
} catch (v) {
|
@@ -128,7 +128,7 @@ var X = function() {
|
|
128
128
|
r = { error: v };
|
129
129
|
} finally {
|
130
130
|
try {
|
131
|
-
|
131
|
+
u && !u.done && (n = f.return) && n.call(f);
|
132
132
|
} finally {
|
133
133
|
if (r)
|
134
134
|
throw r.error;
|
@@ -414,8 +414,8 @@ var ge = Nt(function(i) {
|
|
414
414
|
var c = a.value;
|
415
415
|
c.next(e);
|
416
416
|
}
|
417
|
-
} catch (
|
418
|
-
n = { error:
|
417
|
+
} catch (h) {
|
418
|
+
n = { error: h };
|
419
419
|
} finally {
|
420
420
|
try {
|
421
421
|
a && !a.done && (s = o.return) && s.call(o);
|
@@ -836,7 +836,7 @@ T.elementStyles = [], T.shadowRootOptions = { mode: "open" }, T[R("elementProper
|
|
836
836
|
*/
|
837
837
|
const I = globalThis, Z = I.trustedTypes, Ut = Z ? Z.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, Yt = "$lit$", b = `lit$${(Math.random() + "").slice(9)}$`, qt = "?" + b, Ce = `<${qt}>`, x = document, j = () => x.createComment(""), H = (i) => i === null || typeof i != "object" && typeof i != "function", Ft = Array.isArray, xe = (i) => Ft(i) || typeof (i == null ? void 0 : i[Symbol.iterator]) == "function", ot = `[
|
838
838
|
\f\r]`, U = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Rt = /-->/g, It = />/g, S = RegExp(`>|${ot}(?:([^\\s"'>=/]+)(${ot}*=${ot}*(?:[^
|
839
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), Mt = /'/g, kt = /"/g, Jt = /^(?:script|style|textarea|title)$/i, Pe = (i) => (t, ...e) => ({ _$litType$: i, strings: t, values: e }), M = Pe(1), P = Symbol.for("lit-noChange"),
|
839
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), Mt = /'/g, kt = /"/g, Jt = /^(?:script|style|textarea|title)$/i, Pe = (i) => (t, ...e) => ({ _$litType$: i, strings: t, values: e }), M = Pe(1), P = Symbol.for("lit-noChange"), d = Symbol.for("lit-nothing"), jt = /* @__PURE__ */ new WeakMap(), C = x.createTreeWalker(x, 129);
|
840
840
|
function Kt(i, t) {
|
841
841
|
if (!Array.isArray(i) || !i.hasOwnProperty("raw"))
|
842
842
|
throw Error("invalid template strings array");
|
@@ -847,11 +847,11 @@ const Te = (i, t) => {
|
|
847
847
|
let n, s = t === 2 ? "<svg>" : "", o = U;
|
848
848
|
for (let a = 0; a < e; a++) {
|
849
849
|
const c = i[a];
|
850
|
-
let
|
851
|
-
for (; f < c.length && (o.lastIndex = f,
|
852
|
-
f = o.lastIndex, o === U ?
|
853
|
-
const
|
854
|
-
s += o === U ? c + Ce :
|
850
|
+
let h, p, l = -1, f = 0;
|
851
|
+
for (; f < c.length && (o.lastIndex = f, p = o.exec(c), p !== null); )
|
852
|
+
f = o.lastIndex, o === U ? p[1] === "!--" ? o = Rt : p[1] !== void 0 ? o = It : p[2] !== void 0 ? (Jt.test(p[2]) && (n = RegExp("</" + p[2], "g")), o = S) : p[3] !== void 0 && (o = S) : o === S ? p[0] === ">" ? (o = n ?? U, l = -1) : p[1] === void 0 ? l = -2 : (l = o.lastIndex - p[2].length, h = p[1], o = p[3] === void 0 ? S : p[3] === '"' ? kt : Mt) : o === kt || o === Mt ? o = S : o === Rt || o === It ? o = U : (o = S, n = void 0);
|
853
|
+
const u = o === S && i[a + 1].startsWith("/>") ? " " : "";
|
854
|
+
s += o === U ? c + Ce : l >= 0 ? (r.push(h), c.slice(0, l) + Yt + c.slice(l) + b + u) : c + b + (l === -2 ? a : u);
|
855
855
|
}
|
856
856
|
return [Kt(i, s + (i[e] || "<?>") + (t === 2 ? "</svg>" : "")), r];
|
857
857
|
};
|
@@ -860,36 +860,36 @@ class N {
|
|
860
860
|
let n;
|
861
861
|
this.parts = [];
|
862
862
|
let s = 0, o = 0;
|
863
|
-
const a = t.length - 1, c = this.parts, [
|
864
|
-
if (this.el = N.createElement(
|
865
|
-
const
|
866
|
-
|
863
|
+
const a = t.length - 1, c = this.parts, [h, p] = Te(t, e);
|
864
|
+
if (this.el = N.createElement(h, r), C.currentNode = this.el.content, e === 2) {
|
865
|
+
const l = this.el.content.firstChild;
|
866
|
+
l.replaceWith(...l.childNodes);
|
867
867
|
}
|
868
868
|
for (; (n = C.nextNode()) !== null && c.length < a; ) {
|
869
869
|
if (n.nodeType === 1) {
|
870
870
|
if (n.hasAttributes())
|
871
|
-
for (const
|
872
|
-
if (
|
873
|
-
const f =
|
874
|
-
c.push({ type: 1, index: s, name: g[2], strings:
|
871
|
+
for (const l of n.getAttributeNames())
|
872
|
+
if (l.endsWith(Yt)) {
|
873
|
+
const f = p[o++], u = n.getAttribute(l).split(b), g = /([.?@])?(.*)/.exec(f);
|
874
|
+
c.push({ type: 1, index: s, name: g[2], strings: u, ctor: g[1] === "." ? Ue : g[1] === "?" ? Re : g[1] === "@" ? Ie : tt }), n.removeAttribute(l);
|
875
875
|
} else
|
876
|
-
|
876
|
+
l.startsWith(b) && (c.push({ type: 6, index: s }), n.removeAttribute(l));
|
877
877
|
if (Jt.test(n.tagName)) {
|
878
|
-
const
|
878
|
+
const l = n.textContent.split(b), f = l.length - 1;
|
879
879
|
if (f > 0) {
|
880
880
|
n.textContent = Z ? Z.emptyScript : "";
|
881
|
-
for (let
|
882
|
-
n.append(
|
883
|
-
n.append(
|
881
|
+
for (let u = 0; u < f; u++)
|
882
|
+
n.append(l[u], j()), C.nextNode(), c.push({ type: 2, index: ++s });
|
883
|
+
n.append(l[f], j());
|
884
884
|
}
|
885
885
|
}
|
886
886
|
} else if (n.nodeType === 8)
|
887
887
|
if (n.data === qt)
|
888
888
|
c.push({ type: 2, index: s });
|
889
889
|
else {
|
890
|
-
let
|
891
|
-
for (; (
|
892
|
-
c.push({ type: 7, index: s }),
|
890
|
+
let l = -1;
|
891
|
+
for (; (l = n.data.indexOf(b, l + 1)) !== -1; )
|
892
|
+
c.push({ type: 7, index: s }), l += b.length - 1;
|
893
893
|
}
|
894
894
|
s++;
|
895
895
|
}
|
@@ -923,8 +923,8 @@ class Oe {
|
|
923
923
|
let s = C.nextNode(), o = 0, a = 0, c = r[0];
|
924
924
|
for (; c !== void 0; ) {
|
925
925
|
if (o === c.index) {
|
926
|
-
let
|
927
|
-
c.type === 2 ?
|
926
|
+
let h;
|
927
|
+
c.type === 2 ? h = new B(s, s.nextSibling, this, t) : c.type === 1 ? h = new c.ctor(s, c.name, c.strings, this, t) : c.type === 6 && (h = new Me(s, this, t)), this._$AV.push(h), c = r[++a];
|
928
928
|
}
|
929
929
|
o !== (c == null ? void 0 : c.index) && (s = C.nextNode(), o++);
|
930
930
|
}
|
@@ -942,7 +942,7 @@ class B {
|
|
942
942
|
return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
|
943
943
|
}
|
944
944
|
constructor(t, e, r, n) {
|
945
|
-
this.type = 2, this._$AH =
|
945
|
+
this.type = 2, this._$AH = d, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = r, this.options = n, this._$Cv = (n == null ? void 0 : n.isConnected) ?? !0;
|
946
946
|
}
|
947
947
|
get parentNode() {
|
948
948
|
let t = this._$AA.parentNode;
|
@@ -956,7 +956,7 @@ class B {
|
|
956
956
|
return this._$AB;
|
957
957
|
}
|
958
958
|
_$AI(t, e = this) {
|
959
|
-
t = O(this, t, e), H(t) ? t ===
|
959
|
+
t = O(this, t, e), H(t) ? t === d || t == null || t === "" ? (this._$AH !== d && this._$AR(), this._$AH = d) : t !== this._$AH && t !== P && this._(t) : t._$litType$ !== void 0 ? this.g(t) : t.nodeType !== void 0 ? this.$(t) : xe(t) ? this.T(t) : this._(t);
|
960
960
|
}
|
961
961
|
k(t) {
|
962
962
|
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
@@ -965,7 +965,7 @@ class B {
|
|
965
965
|
this._$AH !== t && (this._$AR(), this._$AH = this.k(t));
|
966
966
|
}
|
967
967
|
_(t) {
|
968
|
-
this._$AH !==
|
968
|
+
this._$AH !== d && H(this._$AH) ? this._$AA.nextSibling.data = t : this.$(x.createTextNode(t)), this._$AH = t;
|
969
969
|
}
|
970
970
|
g(t) {
|
971
971
|
var s;
|
@@ -1009,7 +1009,7 @@ class tt {
|
|
1009
1009
|
return this._$AM._$AU;
|
1010
1010
|
}
|
1011
1011
|
constructor(t, e, r, n, s) {
|
1012
|
-
this.type = 1, this._$AH =
|
1012
|
+
this.type = 1, this._$AH = d, this._$AN = void 0, this.element = t, this.name = e, this._$AM = n, this.options = s, r.length > 2 || r[0] !== "" || r[1] !== "" ? (this._$AH = Array(r.length - 1).fill(new String()), this.strings = r) : this._$AH = d;
|
1013
1013
|
}
|
1014
1014
|
_$AI(t, e = this, r, n) {
|
1015
1015
|
const s = this.strings;
|
@@ -1018,14 +1018,14 @@ class tt {
|
|
1018
1018
|
t = O(this, t, e, 0), o = !H(t) || t !== this._$AH && t !== P, o && (this._$AH = t);
|
1019
1019
|
else {
|
1020
1020
|
const a = t;
|
1021
|
-
let c,
|
1021
|
+
let c, h;
|
1022
1022
|
for (t = s[0], c = 0; c < s.length - 1; c++)
|
1023
|
-
|
1023
|
+
h = O(this, a[r + c], e, c), h === P && (h = this._$AH[c]), o || (o = !H(h) || h !== this._$AH[c]), h === d ? t = d : t !== d && (t += (h ?? "") + s[c + 1]), this._$AH[c] = h;
|
1024
1024
|
}
|
1025
1025
|
o && !n && this.O(t);
|
1026
1026
|
}
|
1027
1027
|
O(t) {
|
1028
|
-
t ===
|
1028
|
+
t === d ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
1029
1029
|
}
|
1030
1030
|
}
|
1031
1031
|
class Ue extends tt {
|
@@ -1033,7 +1033,7 @@ class Ue extends tt {
|
|
1033
1033
|
super(...arguments), this.type = 3;
|
1034
1034
|
}
|
1035
1035
|
O(t) {
|
1036
|
-
this.element[this.name] = t ===
|
1036
|
+
this.element[this.name] = t === d ? void 0 : t;
|
1037
1037
|
}
|
1038
1038
|
}
|
1039
1039
|
class Re extends tt {
|
@@ -1041,7 +1041,7 @@ class Re extends tt {
|
|
1041
1041
|
super(...arguments), this.type = 4;
|
1042
1042
|
}
|
1043
1043
|
O(t) {
|
1044
|
-
this.element.toggleAttribute(this.name, !!t && t !==
|
1044
|
+
this.element.toggleAttribute(this.name, !!t && t !== d);
|
1045
1045
|
}
|
1046
1046
|
}
|
1047
1047
|
class Ie extends tt {
|
@@ -1049,9 +1049,9 @@ class Ie extends tt {
|
|
1049
1049
|
super(t, e, r, n, s), this.type = 5;
|
1050
1050
|
}
|
1051
1051
|
_$AI(t, e = this) {
|
1052
|
-
if ((t = O(this, t, e, 0) ??
|
1052
|
+
if ((t = O(this, t, e, 0) ?? d) === P)
|
1053
1053
|
return;
|
1054
|
-
const r = this._$AH, n = t ===
|
1054
|
+
const r = this._$AH, n = t === d && r !== d || t.capture !== r.capture || t.once !== r.once || t.passive !== r.passive, s = t !== d && (r === d || n);
|
1055
1055
|
n && this.element.removeEventListener(this.name, this, r), s && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
1056
1056
|
}
|
1057
1057
|
handleEvent(t) {
|
@@ -1254,27 +1254,27 @@ class A extends $ {
|
|
1254
1254
|
(t = this.application) != null && t.settings && te(this.application.settings.branding, this);
|
1255
1255
|
}
|
1256
1256
|
async _renderSymbol() {
|
1257
|
-
var a, c;
|
1258
|
-
const t = (a = this.application) == null ? void 0 : a.branding(), e = t == null ? void 0 : t.graphics.trigger;
|
1257
|
+
var a, c, h;
|
1258
|
+
const t = (a = this.application) == null ? void 0 : a.branding(), e = (c = t == null ? void 0 : t.graphics) == null ? void 0 : c.trigger;
|
1259
1259
|
if (e)
|
1260
1260
|
return M` <img src=${e} class="trigger-icon" alt="" /> `;
|
1261
|
-
const r = (
|
1261
|
+
const r = (h = this.application) == null ? void 0 : h.triggerIcon;
|
1262
1262
|
if (!r)
|
1263
|
-
return
|
1264
|
-
const n = async (
|
1265
|
-
(
|
1263
|
+
return d;
|
1264
|
+
const n = async (p) => await import("./index-5087564d.mjs").then(
|
1265
|
+
(f) => f[p]
|
1266
1266
|
), { type: s, content: o } = r;
|
1267
1267
|
switch (s) {
|
1268
1268
|
case "Telia": {
|
1269
|
-
const
|
1270
|
-
return
|
1269
|
+
const p = await n(o);
|
1270
|
+
return p ? M`<telia-icon
|
1271
1271
|
class="trigger-icon"
|
1272
|
-
svg=${
|
1272
|
+
svg=${p.svg}
|
1273
1273
|
size="lg"
|
1274
|
-
></telia-icon>` :
|
1274
|
+
></telia-icon>` : d;
|
1275
1275
|
}
|
1276
1276
|
default:
|
1277
|
-
return
|
1277
|
+
return d;
|
1278
1278
|
}
|
1279
1279
|
}
|
1280
1280
|
render() {
|
@@ -1564,12 +1564,12 @@ class Ke {
|
|
1564
1564
|
}
|
1565
1565
|
const lt = /* @__PURE__ */ new WeakMap(), Ze = Qt(class extends Fe {
|
1566
1566
|
render(i) {
|
1567
|
-
return
|
1567
|
+
return d;
|
1568
1568
|
}
|
1569
1569
|
update(i, [t]) {
|
1570
1570
|
var r;
|
1571
1571
|
const e = t !== this.G;
|
1572
|
-
return e && this.G !== void 0 && this.ot(void 0), (e || this.rt !== this.lt) && (this.G = t, this.ct = (r = i.options) == null ? void 0 : r.host, this.ot(this.lt = i.element)),
|
1572
|
+
return e && this.G !== void 0 && this.ot(void 0), (e || this.rt !== this.lt) && (this.G = t, this.ct = (r = i.options) == null ? void 0 : r.host, this.ot(this.lt = i.element)), d;
|
1573
1573
|
}
|
1574
1574
|
ot(i) {
|
1575
1575
|
if (typeof this.G == "function") {
|
@@ -1719,31 +1719,31 @@ class rr {
|
|
1719
1719
|
this.root.application = e;
|
1720
1720
|
const r = (a) => {
|
1721
1721
|
if (Array.isArray(a)) {
|
1722
|
-
const [c, ...
|
1722
|
+
const [c, ...h] = a;
|
1723
1723
|
return {
|
1724
1724
|
definitionId: c,
|
1725
|
-
overrides:
|
1725
|
+
overrides: h
|
1726
1726
|
};
|
1727
1727
|
}
|
1728
1728
|
return {
|
1729
1729
|
definitionId: a,
|
1730
1730
|
overrides: []
|
1731
1731
|
};
|
1732
|
-
}, n = (a, c,
|
1733
|
-
|
1734
|
-
const f = r(
|
1735
|
-
if (!
|
1732
|
+
}, n = (a, c, h, p) => {
|
1733
|
+
h.forEach((l) => {
|
1734
|
+
const f = r(l), u = p[f.definitionId];
|
1735
|
+
if (!u) {
|
1736
1736
|
console.error(
|
1737
1737
|
`No definition found for component type '${f.definitionId}'.`
|
1738
1738
|
);
|
1739
1739
|
return;
|
1740
1740
|
}
|
1741
|
-
const g = a.createNode(
|
1742
|
-
g && (g.name = f.definitionId, g.application = e,
|
1741
|
+
const g = a.createNode(u.type, u.type);
|
1742
|
+
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 && n(
|
1743
1743
|
a,
|
1744
1744
|
g,
|
1745
|
-
|
1746
|
-
|
1745
|
+
u.children,
|
1746
|
+
p
|
1747
1747
|
// views
|
1748
1748
|
));
|
1749
1749
|
});
|
@@ -1836,7 +1836,7 @@ class ir {
|
|
1836
1836
|
const ne = class {
|
1837
1837
|
// TODO:
|
1838
1838
|
// private static endpoint = 'http://localhost:5299/api'; // TODO:
|
1839
|
-
|
1839
|
+
async getSite(i) {
|
1840
1840
|
const e = await (await fetch(i)).json();
|
1841
1841
|
return e ? {
|
1842
1842
|
id: e.id,
|
@@ -1855,7 +1855,7 @@ const ne = class {
|
|
1855
1855
|
})
|
1856
1856
|
} : null;
|
1857
1857
|
}
|
1858
|
-
|
1858
|
+
async getWidget(i) {
|
1859
1859
|
const e = await (await fetch(`${ne.endpoint}/widget/${i}`)).json();
|
1860
1860
|
return e ? {
|
1861
1861
|
name: e.name,
|
@@ -1898,10 +1898,10 @@ class nr {
|
|
1898
1898
|
}
|
1899
1899
|
class sr {
|
1900
1900
|
constructor(t) {
|
1901
|
-
this.configurations = [], typeof t == "string" ? this.url = t : this.loadFromConfig(t);
|
1901
|
+
this.configurations = [], this.httpClient = new gt(), this.httpClient = new gt(), typeof t == "string" ? this.url = t : (t.httpClient && (this.httpClient = t.httpClient), this.loadFromConfig(t));
|
1902
1902
|
}
|
1903
1903
|
async load(t) {
|
1904
|
-
const e = await
|
1904
|
+
const e = await this.httpClient.getSite(t);
|
1905
1905
|
if (!e) {
|
1906
1906
|
console.warn(`Unable to load site from the url provided: ${t}`);
|
1907
1907
|
return;
|
@@ -1924,7 +1924,7 @@ class sr {
|
|
1924
1924
|
var e;
|
1925
1925
|
this.url && await this.load(this.url), this.environment = new nr(), this.addGlobal(this.environment);
|
1926
1926
|
for await (const r of this.configurations) {
|
1927
|
-
const n = await
|
1927
|
+
const n = await this.httpClient.getWidget(r.widgetId);
|
1928
1928
|
n && ((e = this.environment) == null || e.registerApp(n.name, n.config, {
|
1929
1929
|
renderStrategy: r.renderStrategy,
|
1930
1930
|
triggerIcon: r.triggerIcon,
|
@@ -1966,7 +1966,7 @@ class W extends $ {
|
|
1966
1966
|
}
|
1967
1967
|
render() {
|
1968
1968
|
if (!this.widget || this.status !== "activated")
|
1969
|
-
return
|
1969
|
+
return d;
|
1970
1970
|
if (this.widget.renderStrategy === w.Trigger) {
|
1971
1971
|
const t = new A();
|
1972
1972
|
return t.application = this.widget, t;
|
@@ -2002,6 +2002,7 @@ export {
|
|
2002
2002
|
ir as Application,
|
2003
2003
|
Ct as Container,
|
2004
2004
|
nr as Environment,
|
2005
|
+
gt as HttpClient,
|
2005
2006
|
sr as Site,
|
2006
2007
|
A as Trigger,
|
2007
2008
|
We as WidgetComponent,
|
package/models/site.d.ts
CHANGED
package/package.json
CHANGED
@@ -3,9 +3,13 @@ type GetWidgetResponse = {
|
|
3
3
|
name: string;
|
4
4
|
config: WidgetConfig;
|
5
5
|
};
|
6
|
-
export
|
6
|
+
export interface IHttpClient {
|
7
|
+
getSite(url: string): Promise<SiteConfig | null>;
|
8
|
+
getWidget(widgetId: string): Promise<GetWidgetResponse | null>;
|
9
|
+
}
|
10
|
+
export declare class HttpClient implements IHttpClient {
|
7
11
|
private static endpoint;
|
8
|
-
|
9
|
-
|
12
|
+
getSite(url: string): Promise<SiteConfig | null>;
|
13
|
+
getWidget(widgetId: string): Promise<GetWidgetResponse | null>;
|
10
14
|
}
|
11
15
|
export {};
|
package/types.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { Application } from './models/application';
|
2
|
+
import { IHttpClient } from './services/http-client.service';
|
2
3
|
export type ComponentDefinition = {
|
3
4
|
name: string;
|
4
5
|
type: string;
|
@@ -43,5 +44,6 @@ export type InitConfig = {
|
|
43
44
|
triggerIcon?: string;
|
44
45
|
autoActivate?: boolean;
|
45
46
|
}[];
|
47
|
+
httpClient?: IHttpClient;
|
46
48
|
};
|
47
49
|
export type PluginType = (app: Application) => Promise<void>;
|