@telia-ace/widget-core-flamingo 1.1.72-rc.1 → 1.1.72-rc.2
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +22 -8
- package/index.mjs +59 -41
- package/package.json +1 -1
- package/services/site-api.d.ts +0 -1
- package/services/storage.service.d.ts +0 -2
- package/services/widget-api.d.ts +2 -0
package/index.js
CHANGED
@@ -8,13 +8,13 @@
|
|
8
8
|
* @license
|
9
9
|
* Copyright 2017 Google LLC
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
11
|
-
*/const{is:
|
11
|
+
*/const{is:Be,defineProperty:De,getOwnPropertyDescriptor:We,getOwnPropertyNames:ze,getOwnPropertySymbols:Fe,getPrototypeOf:Ve}=Object,x=globalThis,Nt=x.trustedTypes,Ye=Nt?Nt.emptyScript:"",ct=x.reactiveElementPolyfillSupport,j=(s,t)=>s,Q={toAttribute(s,t){switch(t){case Boolean:s=s?Ye:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let e=s;switch(t){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch{e=null}}return e}},xt=(s,t)=>!Be(s,t),jt={attribute:!0,type:String,converter:Q,reflect:!1,hasChanged:xt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),x.litPropertyMetadata??(x.litPropertyMetadata=new WeakMap);let T=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=jt){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(t,i,e);r!==void 0&&De(this.prototype,t,r)}}static getPropertyDescriptor(t,e,i){const{get:r,set:n}=We(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return r==null?void 0:r.call(this)},set(o){const a=r==null?void 0:r.call(this);n.call(this,o),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??jt}static _$Ei(){if(this.hasOwnProperty(j("elementProperties")))return;const t=Ve(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(j("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(j("properties"))){const e=this.properties,i=[...ze(e),...Fe(e)];for(const r of i)this.createProperty(r,e[r])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[i,r]of e)this.elementProperties.set(i,r)}this._$Eh=new Map;for(const[e,i]of this.elementProperties){const r=this._$Eu(e,i);r!==void 0&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const r of i)e.unshift(kt(r))}else t!==void 0&&e.push(kt(t));return e}static _$Eu(t,e){const i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Le(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(e=>{var i;return(i=e.hostConnected)==null?void 0:i.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var i;return(i=e.hostDisconnected)==null?void 0:i.call(e)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EC(t,e){var n;const i=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,i);if(r!==void 0&&i.reflect===!0){const o=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:Q).toAttribute(e,i.type);this._$Em=t,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(t,e){var n;const i=this.constructor,r=i._$Eh.get(t);if(r!==void 0&&this._$Em!==r){const o=i.getPropertyOptions(r),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:Q;this._$Em=r,this[r]=a.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,i){if(t!==void 0){if(i??(i=this.constructor.getPropertyOptions(t)),!(i.hasChanged??xt)(this[t],e))return;this.P(t,e,i)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,i){this._$AL.has(t)||this._$AL.set(t,e),i.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[n,o]of r)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.P(n,this[n],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(i=this._$EO)==null||i.forEach(r=>{var n;return(n=r.hostUpdate)==null?void 0:n.call(r)}),this.update(e)):this._$EU()}catch(r){throw t=!1,this._$EU(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(i=>{var r;return(r=i.hostUpdated)==null?void 0:r.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}};T.elementStyles=[],T.shadowRootOptions={mode:"open"},T[j("elementProperties")]=new Map,T[j("finalized")]=new Map,ct==null||ct({ReactiveElement:T}),(x.reactiveElementVersions??(x.reactiveElementVersions=[])).push("2.0.4");/**
|
12
12
|
* @license
|
13
13
|
* Copyright 2017 Google LLC
|
14
14
|
* SPDX-License-Identifier: BSD-3-Clause
|
15
|
-
*/const H=globalThis,tt=H.trustedTypes,Ht=tt?tt.createPolicy("lit-html",{createHTML:s=>s}):void 0,ae="$lit$",A=`lit$${(Math.random()+"").slice(9)}$`,ce="?"+A,qe=`<${ce}>`,P=document,
|
16
|
-
\f\r]`,N=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Lt=/-->/g,
|
17
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
15
|
+
*/const H=globalThis,tt=H.trustedTypes,Ht=tt?tt.createPolicy("lit-html",{createHTML:s=>s}):void 0,ae="$lit$",A=`lit$${(Math.random()+"").slice(9)}$`,ce="?"+A,qe=`<${ce}>`,P=document,B=()=>P.createComment(""),D=s=>s===null||typeof s!="object"&&typeof s!="function",he=Array.isArray,Ke=s=>he(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",ht=`[
|
16
|
+
\f\r]`,N=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Lt=/-->/g,Bt=/>/g,C=RegExp(`>|${ht}(?:([^\\s"'>=/]+)(${ht}*=${ht}*(?:[^
|
17
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Dt=/'/g,Wt=/"/g,le=/^(?:script|style|textarea|title)$/i,Ge=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),I=Ge(1),O=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),zt=new WeakMap,E=P.createTreeWalker(P,129);function pe(s,t){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ht!==void 0?Ht.createHTML(t):t}const Ze=(s,t)=>{const e=s.length-1,i=[];let r,n=t===2?"<svg>":"",o=N;for(let a=0;a<e;a++){const c=s[a];let h,l,p=-1,f=0;for(;f<c.length&&(o.lastIndex=f,l=o.exec(c),l!==null);)f=o.lastIndex,o===N?l[1]==="!--"?o=Lt:l[1]!==void 0?o=Bt:l[2]!==void 0?(le.test(l[2])&&(r=RegExp("</"+l[2],"g")),o=C):l[3]!==void 0&&(o=C):o===C?l[0]===">"?(o=r??N,p=-1):l[1]===void 0?p=-2:(p=o.lastIndex-l[2].length,h=l[1],o=l[3]===void 0?C:l[3]==='"'?Wt:Dt):o===Wt||o===Dt?o=C:o===Lt||o===Bt?o=N:(o=C,r=void 0);const u=o===C&&s[a+1].startsWith("/>")?" ":"";n+=o===N?c+qe:p>=0?(i.push(h),c.slice(0,p)+ae+c.slice(p)+A+u):c+A+(p===-2?a:u)}return[pe(s,n+(s[e]||"<?>")+(t===2?"</svg>":"")),i]};class W{constructor({strings:t,_$litType$:e},i){let r;this.parts=[];let n=0,o=0;const a=t.length-1,c=this.parts,[h,l]=Ze(t,e);if(this.el=W.createElement(h,i),E.currentNode=this.el.content,e===2){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(r=E.nextNode())!==null&&c.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const p of r.getAttributeNames())if(p.endsWith(ae)){const f=l[o++],u=r.getAttribute(p).split(A),g=/([.?@])?(.*)/.exec(f);c.push({type:1,index:n,name:g[2],strings:u,ctor:g[1]==="."?Xe:g[1]==="?"?Qe:g[1]==="@"?ti:st}),r.removeAttribute(p)}else p.startsWith(A)&&(c.push({type:6,index:n}),r.removeAttribute(p));if(le.test(r.tagName)){const p=r.textContent.split(A),f=p.length-1;if(f>0){r.textContent=tt?tt.emptyScript:"";for(let u=0;u<f;u++)r.append(p[u],B()),E.nextNode(),c.push({type:2,index:++n});r.append(p[f],B())}}}else if(r.nodeType===8)if(r.data===ce)c.push({type:2,index:n});else{let p=-1;for(;(p=r.data.indexOf(A,p+1))!==-1;)c.push({type:7,index:n}),p+=A.length-1}n++}}static createElement(t,e){const i=P.createElement("template");return i.innerHTML=t,i}}function R(s,t,e=s,i){var o,a;if(t===O)return t;let r=i!==void 0?(o=e._$Co)==null?void 0:o[i]:e._$Cl;const n=D(t)?void 0:t._$litDirective$;return(r==null?void 0:r.constructor)!==n&&((a=r==null?void 0:r._$AO)==null||a.call(r,!1),n===void 0?r=void 0:(r=new n(s),r._$AT(s,e,i)),i!==void 0?(e._$Co??(e._$Co=[]))[i]=r:e._$Cl=r),r!==void 0&&(t=R(s,r._$AS(s,t.values),r,i)),t}class Je{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,r=((t==null?void 0:t.creationScope)??P).importNode(e,!0);E.currentNode=r;let n=E.nextNode(),o=0,a=0,c=i[0];for(;c!==void 0;){if(o===c.index){let h;c.type===2?h=new V(n,n.nextSibling,this,t):c.type===1?h=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(h=new ei(n,this,t)),this._$AV.push(h),c=i[++a]}o!==(c==null?void 0:c.index)&&(n=E.nextNode(),o++)}return E.currentNode=P,r}p(t){let e=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class V{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,i,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=r,this._$Cv=(r==null?void 0:r.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=R(this,t,e),D(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==O&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Ke(t)?this.k(t):this._(t)}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}_(t){this._$AH!==d&&D(this._$AH)?this._$AA.nextSibling.data=t:this.T(P.createTextNode(t)),this._$AH=t}$(t){var n;const{values:e,_$litType$:i}=t,r=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=W.createElement(pe(i.h,i.h[0]),this.options)),i);if(((n=this._$AH)==null?void 0:n._$AD)===r)this._$AH.p(e);else{const o=new Je(r,this),a=o.u(this.options);o.p(e),this.T(a),this._$AH=o}}_$AC(t){let e=zt.get(t.strings);return e===void 0&&zt.set(t.strings,e=new W(t)),e}k(t){he(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,r=0;for(const n of t)r===e.length?e.push(i=new V(this.S(B()),this.S(B()),this,this.options)):i=e[r],i._$AI(n),r++;r<e.length&&(this._$AR(i&&i._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,e);t&&t!==this._$AB;){const r=t.nextSibling;t.remove(),t=r}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}}class st{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,r,n){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=d}_$AI(t,e=this,i,r){const n=this.strings;let o=!1;if(n===void 0)t=R(this,t,e,0),o=!D(t)||t!==this._$AH&&t!==O,o&&(this._$AH=t);else{const a=t;let c,h;for(t=n[0],c=0;c<n.length-1;c++)h=R(this,a[i+c],e,c),h===O&&(h=this._$AH[c]),o||(o=!D(h)||h!==this._$AH[c]),h===d?t=d:t!==d&&(t+=(h??"")+n[c+1]),this._$AH[c]=h}o&&!r&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Xe extends st{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}}class Qe extends st{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}}class ti extends st{constructor(t,e,i,r,n){super(t,e,i,r,n),this.type=5}_$AI(t,e=this){if((t=R(this,t,e,0)??d)===O)return;const i=this._$AH,r=t===d&&i!==d||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,n=t!==d&&(i===d||r);r&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class ei{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){R(this,t)}}const lt=H.litHtmlPolyfillSupport;lt==null||lt(W,V),(H.litHtmlVersions??(H.litHtmlVersions=[])).push("3.1.2");const ii=(s,t,e)=>{const i=(e==null?void 0:e.renderBefore)??t;let r=i._$litPart$;if(r===void 0){const n=(e==null?void 0:e.renderBefore)??null;i._$litPart$=r=new V(t.insertBefore(B(),n),n,void 0,e??{})}return r._$AI(s),r};/**
|
18
18
|
* @license
|
19
19
|
* Copyright 2017 Google LLC
|
20
20
|
* SPDX-License-Identifier: BSD-3-Clause
|
@@ -264,8 +264,8 @@
|
|
264
264
|
* @license
|
265
265
|
* Copyright 2017 Google LLC
|
266
266
|
* SPDX-License-Identifier: BSD-3-Clause
|
267
|
-
*/function Pi({context:s}){return(t,e)=>{const i=new WeakMap;if(typeof e=="object")return e.addInitializer(function(){i.set(this,new Jt(this,{context:s}))}),{get(){return t.get.call(this)},set(r){var n;return(n=i.get(this))==null||n.setValue(r),t.set.call(this,r)},init(r){var n;return(n=i.get(this))==null||n.setValue(r),r}};{t.constructor.addInitializer(o=>{i.set(o,new Jt(o,{context:s}))});const r=Object.getOwnPropertyDescriptor(t,e);let n;if(r===void 0){const o=new WeakMap;n={get:function(){return o.get(this)},set:function(a){i.get(this).setValue(a),o.set(this,a)},configurable:!0,enumerable:!0}}else{const o=r.set;n={...r,set:function(a){i.get(this).setValue(a),o==null||o.call(this,a)}}}return void Object.defineProperty(t,e,n)}}}var Oi=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,Ii=(s,t,e,i)=>{for(var r=i>1?void 0:i?Ti(t,e):t,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(t,e,r):o(r))||r);return i&&r&&Oi(t,e,r),r};const be="application";class nt extends _{constructor(){super(...arguments),this.nodes=[],this.wrapperRef=me()}addChild(t){t.parent=this,this.nodes.push(t)}applyBranding(){if(!this.wrapperRef.value)return;const t=this.application.settings;t!=null&&t.branding&&ge(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,r])=>{e.style.setProperty(`--${i}`,r)})}firstUpdated(t){this.applyBranding(),this.applyStyles()}render(){return 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")),I`<div class="widget-container" ${ve(this.wrapperRef)}>
|
268
|
-
${xi(this.nodes,
|
267
|
+
*/function Pi({context:s}){return(t,e)=>{const i=new WeakMap;if(typeof e=="object")return e.addInitializer(function(){i.set(this,new Jt(this,{context:s}))}),{get(){return t.get.call(this)},set(r){var n;return(n=i.get(this))==null||n.setValue(r),t.set.call(this,r)},init(r){var n;return(n=i.get(this))==null||n.setValue(r),r}};{t.constructor.addInitializer(o=>{i.set(o,new Jt(o,{context:s}))});const r=Object.getOwnPropertyDescriptor(t,e);let n;if(r===void 0){const o=new WeakMap;n={get:function(){return o.get(this)},set:function(a){i.get(this).setValue(a),o.set(this,a)},configurable:!0,enumerable:!0}}else{const o=r.set;n={...r,set:function(a){i.get(this).setValue(a),o==null||o.call(this,a)}}}return void Object.defineProperty(t,e,n)}}}var Oi=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,Ii=(s,t,e,i)=>{for(var r=i>1?void 0:i?Ti(t,e):t,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(t,e,r):o(r))||r);return i&&r&&Oi(t,e,r),r};const be="application";class nt extends _{constructor(){super(...arguments),this.nodes=[],this.wrapperRef=me()}addChild(t){t.parent=this,this.nodes.push(t)}applyBranding(){if(!this.wrapperRef.value)return;const t=this.application.settings;t!=null&&t.branding&&ge(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,r])=>{e.style.setProperty(`--${i}`,r)})}firstUpdated(t){this.applyBranding(),this.applyStyles()}render(){var i,r;const t=this.application.settings.components.conversation;return((r=(i=t==null?void 0:t.properties)==null?void 0:i.chat)==null?void 0:r.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")),I`<div class="widget-container" ${ve(this.wrapperRef)}>
|
268
|
+
${xi(this.nodes,n=>n)}
|
269
269
|
</div>`}}nt.styles=M`
|
270
270
|
:host {
|
271
271
|
--font-family: TeliaSans, Helvetica, Arial, Lucida Grande, sans-serif;
|
@@ -313,6 +313,10 @@
|
|
313
313
|
inset: 0 0 95px 0;
|
314
314
|
height: 100%;
|
315
315
|
}
|
316
|
+
:host(.third-party) {
|
317
|
+
inset: 0 0 95px 0;
|
318
|
+
height: 100vh;
|
319
|
+
}
|
316
320
|
}
|
317
321
|
@media screen and (min-width: 801px) {
|
318
322
|
:host(.floating) {
|
@@ -321,6 +325,14 @@
|
|
321
325
|
width: 400px;
|
322
326
|
height: 700px;
|
323
327
|
}
|
328
|
+
:host(.third-party) {
|
329
|
+
max-width: 1000px;
|
330
|
+
height: 100vh;
|
331
|
+
position: relative;
|
332
|
+
left: 50%;
|
333
|
+
transform: translateX(-50%);
|
334
|
+
margin: -10px 0;
|
335
|
+
}
|
324
336
|
:host(.floating.bottom-right) {
|
325
337
|
inset: auto 20px 95px auto;
|
326
338
|
}
|
@@ -346,6 +358,8 @@
|
|
346
358
|
background-color: var(--primary-background);
|
347
359
|
padding: var(--spacing-sm);
|
348
360
|
border: var(--widget-border, none);
|
361
|
+
border-left: 1px solid #00000054;
|
362
|
+
border-right: 1px solid #00000054;
|
349
363
|
}
|
350
364
|
@keyframes slideDown {
|
351
365
|
from {
|
@@ -376,8 +390,8 @@
|
|
376
390
|
animation: slideDown 0.3s linear;
|
377
391
|
pointer-events: none;
|
378
392
|
}
|
379
|
-
`;Ii([m({attribute:!1}),Pi({context:be})],nt.prototype,"application",2);class Ri{constructor(){this.root=this.createRoot()}createComponentModel(t,e){this.root.application=e;const i=a=>{if(Array.isArray(a)){const[c,...h]=a;return{definitionId:c,overrides:h}}return{definitionId:a,overrides:[]}},r=(a,c,h,l)=>{h.forEach(p=>{const f=i(p),u=l[f.definitionId];if(!u){console.error(`No definition found for component type '${f.definitionId}'.`);return}const g=a.createNode(u.type,u.type);g&&(g.name=f.definitionId,g.application=e,u.properties&&g.writeProperties(u.properties),u.context&&g.writeContext(u.context),u.layout&&g.writeLayout(u.layout),c.addChild(g),u.children&&r(a,g,u.children,l))})},{entry:n,components:o}=t;return r(this,this.root,[n],o),this.root}createRoot(){return new nt}createNode(t,e){const i=this.resolveComponent(e);if(!i)return console.warn(`Unable to resolve component: ${e}`),new Et;const r=new i;return r.type=e,r.name=t,r}resolveComponent(t){return customElements.get(`ace-${t}`)}getRoot(){return this.root}}const $e=class{constructor(){this.components=new Map}getComponent(s){const t=this.components.get(s);return t||console.warn(`Unable to resolve component: ${s}. You most likely forgot to register the required plugin.`),t}registerComponent(s,t){this.components.set(s,t)}async loadComponents(){const s=[...this.components.entries()].map(([t,e])=>e.then(i=>{this.defineAsWebComponent(t,i.default)}));await Promise.all(s)}defineAsWebComponent(s,t){const e=$e.ResolveWebComponentName(s);customElements.get(e)||customElements.define(e,t)}};let we=$e;we.ResolveWebComponentName=s=>`ace-${s}`;var v=(s=>(s.Mandatory="mandatory",s.Preferences="preferences",s.Analytics="analytics",s))(v||{});class _e{constructor(t,e,i){this.
|
393
|
+
`;Ii([m({attribute:!1}),Pi({context:be})],nt.prototype,"application",2);class Ri{constructor(){this.root=this.createRoot()}createComponentModel(t,e){this.root.application=e;const i=a=>{if(Array.isArray(a)){const[c,...h]=a;return{definitionId:c,overrides:h}}return{definitionId:a,overrides:[]}},r=(a,c,h,l)=>{h.forEach(p=>{const f=i(p),u=l[f.definitionId];if(!u){console.error(`No definition found for component type '${f.definitionId}'.`);return}const g=a.createNode(u.type,u.type);g&&(g.name=f.definitionId,g.application=e,u.properties&&g.writeProperties(u.properties),u.context&&g.writeContext(u.context),u.layout&&g.writeLayout(u.layout),c.addChild(g),u.children&&r(a,g,u.children,l))})},{entry:n,components:o}=t;return r(this,this.root,[n],o),this.root}createRoot(){return new nt}createNode(t,e){const i=this.resolveComponent(e);if(!i)return console.warn(`Unable to resolve component: ${e}`),new Et;const r=new i;return r.type=e,r.name=t,r}resolveComponent(t){return customElements.get(`ace-${t}`)}getRoot(){return this.root}}const $e=class{constructor(){this.components=new Map}getComponent(s){const t=this.components.get(s);return t||console.warn(`Unable to resolve component: ${s}. You most likely forgot to register the required plugin.`),t}registerComponent(s,t){this.components.set(s,t)}async loadComponents(){const s=[...this.components.entries()].map(([t,e])=>e.then(i=>{this.defineAsWebComponent(t,i.default)}));await Promise.all(s)}defineAsWebComponent(s,t){const e=$e.ResolveWebComponentName(s);customElements.get(e)||customElements.define(e,t)}};let we=$e;we.ResolveWebComponentName=s=>`ace-${s}`;var v=(s=>(s.Mandatory="mandatory",s.Preferences="preferences",s.Analytics="analytics",s))(v||{});class _e{constructor(t,e,i){this.widgetId=t,this.storage=e==="localStorage"?window.localStorage:window.sessionStorage,this.policy=i}set(t,e,i){if(this.policy[i]){const r={value:e,category:i};this.storage.setItem(this._prefixKey(t),JSON.stringify(r))}else console.warn(`Storage policy does not allow storing items in category: ${i}`)}get(t){const e=this.storage.getItem(this._prefixKey(t));if(!e)return null;try{const i=JSON.parse(e);return this.policy[i.category]?i.value:(console.warn(`Storage policy does not allow retrieving items from category: ${i.category}`),null)}catch{return null}}removeItem(t){this.storage.removeItem(this._prefixKey(t))}updatePolicy(t){this.policy=t}_prefixKey(t){return`ace_${this.widgetId.substring(0,7)}-${t}`}}class Mi{constructor(){this.texts=new Map}loadTexts(t){this.texts=new Map(Object.entries(t))}get(t,e){const i=this.texts.get(t);return i||e||null}getOrFallback(t,e){return this.texts.get(t)||e}}class Ui{constructor(t){this.widget=t,this.name=t.name}open(){this.widget.appendToDOM()}close(){this.widget.hide()}hideTriggerButton(){var t;(t=this.widget.trigger)==null||t.hideTrigger()}showTriggerButton(){var t;(t=this.widget.trigger)==null||t.showTrigger()}}class Ae{constructor(t,e,i,r,n){this.id=t,this.name=e,this.container=i,this.settings=r,this.options=n,this.platform=new Ri,this.texts=new Mi,this.renderStrategy=$.Inline,this.anchor="BottomRight",this.autoActivate=!1,this.plugins=[],this.componentResolver=new we,this.components=[],this.trigger=null,this.api=new Ui(this),this.renderStrategy=this.options.renderStrategy||$.Inline,this.triggerIcon=this.options.triggerIcon;const o={[v.Mandatory]:!0,[v.Preferences]:!0,[v.Analytics]:!0};this.storage=new _e(this.id,"sessionStorage",o),typeof n.autoActivate=="boolean"&&(this.autoActivate=n.autoActivate),n.anchor&&(this.anchor=n.anchor),this.container.register("$settings",r),this.texts.loadTexts(r.texts||{})}async activate(){if(await this.loadPlugins(),await this.componentResolver.loadComponents(),this.root=this.platform.createComponentModel(this.settings,this),this.container.setState(ne.Ready),this.autoActivate){const t=this.render();t&&this._getTargetElement().appendChild(t)}}async loadPlugins(){for await(const t of this.plugins)await t(this)}styles(){return this.settings.styles||{}}branding(){return this.settings.branding||{}}plugin(t){return this.plugins.push(t),this}appendToDOM(){this.root&&(this.root.classList.add("expanded"),this.root.classList.remove("hidden"),document.body.appendChild(this.root)),this.storage.set("open","true",v.Mandatory)}hide(){this.root&&(this.root.classList.add("hidden"),this.root.classList.remove("expanded")),this.storage.set("open","false",v.Mandatory)}mute(){this.storage.set("muteAudioNotifications","true",v.Mandatory)}unmute(){this.storage.set("muteAudioNotifications","false",v.Mandatory)}registerComponent(t,e){this.componentResolver.registerComponent(t,e)}resolveComponent(t){return this.componentResolver.getComponent(t)}mountComponent(t){this.components.push(t)}getComponent(t){const e=this.components.find(i=>i.type===t);return e||null}_getTargetElement(){let t="bottom-right";if(this.anchor==="BottomRight"?t="bottom-right":this.anchor==="BottomLeft"&&(t="bottom-left"),this.renderStrategy===$.Trigger){let e=document.querySelector(`ace-trigger-slot.${t}`);return e||(e=new rt,e.anchor=this.anchor,document.body.appendChild(e)),e}return document.body}render(){if(this.renderStrategy===$.Trigger){const t=new b;return t.application=this,this.trigger=t,this.storage.get("open")&&this.trigger.toggleActive(),t}return this.root}}const ki=s=>new z(s),xe=class{constructor(s=xe.endpoint){this._endpoint=s}async getSite(s){const e=await(await fetch(s)).json();return e?{id:e.id,apps:e.widgets.map(i=>{let r=$.Inline;return i.renderStrategy==="Trigger"&&(r=$.Trigger),{id:i.id,widgetId:i.widgetId,renderStrategy:r,autoActivate:i.autoActivate,anchor:i.anchor,triggerIcon:{type:"Telia",content:i.triggerIcon}}})}:null}async getWidget(s){const e=await(await fetch(`${this._endpoint}/widget/${s}`)).json();return e?{name:e.name,config:JSON.parse(e.configuration)}:null}};let z=xe;z.endpoint="https://widgets.ace.teliacompany.net/api";class Ni{constructor(t){this.site=t}storagePolicy(t){var i;(((i=this.site.environment)==null?void 0:i.applications)||[]).forEach(r=>{if(r.storage){const n={[v.Analytics]:t.includes("analytics"),[v.Mandatory]:t.includes("mandatory"),[v.Preferences]:t.includes("preferences")};r.storage.updatePolicy(n)}})}}class Ce{constructor(){this.applications=[],this.container=new $t("environment",this),this.bootstrapped=!1,this.site=null,this.widgetAPIHandlers=new Map,this.siteConfigurationHandlers=[],setTimeout(()=>{this.notifyWidgetsOfCreation()},1e3)}async bootstrap(){await this.activate(),this.siteConfigurationHandlers.forEach(t=>{this.site&&t(this.site.api)});for(const[t,e]of this.widgetAPIHandlers)e.forEach(i=>{i()});this.bootstrapped=!0}async activate(){const t=this.applications.filter(e=>e.autoActivate);for await(const e of t)await e.activate()}notifyWidgetsOfCreation(){document.querySelectorAll("ace-widget").forEach(e=>{const i=this.applications.find(r=>r.name===e.name);i&&e.dispatchEvent(new CustomEvent("environment-created",{detail:{widget:i}}))})}configure(t){if(!this.site||!this.bootstrapped){this.siteConfigurationHandlers.push(t);return}t(this.site.api)}widget(t,e){const i=this.applications.find(r=>r.name===t);if(!i){const r=this.widgetAPIHandlers.get(t)||[];r.push(()=>{const n=this.applications.find(o=>o.name===t);e(n==null?void 0:n.api)}),this.widgetAPIHandlers.set(t,r);return}e(i==null?void 0:i.api)}registerApp(t,e,i,r){const n=new $t(e,this),o=new Ae(t,e,n,i,r);this.applications.push(o)}registerSite(t){this.site=t}plugin(t){return this.applications.forEach(e=>{e.plugin(t)}),this}}class Se{constructor(t){this.configurations=[],this.httpClient=new z,this.api=new Ni(this),this.httpClient=new z,typeof t=="string"?this.url=t:(t.httpClient&&(this.httpClient=t.httpClient),this.loadFromConfig(t))}async load(t){const e=await this.httpClient.getSite(t);if(!e){console.warn(`Unable to load site from the url provided: ${t}`);return}this.configurations=e.apps}loadFromConfig(t){this.configurations=t.apps.map(e=>({id:"",renderStrategy:e.renderStrategy,widgetId:e.widgetId,autoActivate:e.autoActivate,anchor:e.anchor,triggerIcon:{type:"Telia",content:e.triggerIcon||"question"}}))}async bootstrap(t){var e;this.url&&await this.load(this.url),this.environment=new Ce,this.addGlobal(this.environment);for await(const i of this.configurations){const r=await this.httpClient.getWidget(i.widgetId);r&&((e=this.environment)==null||e.registerApp(i.widgetId,r.name,r.config,{renderStrategy:i.renderStrategy,triggerIcon:i.triggerIcon,autoActivate:i.autoActivate,anchor:i.anchor}))}t(this.environment),this.environment.registerSite(this),await this.environment.bootstrap()}addGlobal(t){const e=globalThis.widgets;((e==null?void 0:e._w)||[]).forEach(([i,r])=>{t.widget(i,r)}),((e==null?void 0:e._c)||[]).forEach(i=>{t.configure(i)}),globalThis.widgets=t}}var ji=Object.defineProperty,Hi=Object.getOwnPropertyDescriptor,Pt=(s,t,e,i)=>{for(var r=i>1?void 0:i?Hi(t,e):t,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(t,e,r):o(r))||r);return i&&r&&ji(t,e,r),r};class k extends _{constructor(){super(),this.status="deactivated",this.addEventListener("environment-created",this.onEnvironmentCreated)}async connectedCallback(){super.connectedCallback(),await this.getGlobalEnvironment()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("environment-created",this.onEnvironmentCreated)}async onEnvironmentCreated(t){this.widget=t.detail.widget,await this.activate(),this.requestUpdate()}async activate(){this.widget&&(await this.widget.activate(),this.status="activated")}async getGlobalEnvironment(){const t=globalThis.widgets;t&&(this.widget=t.applications.find(e=>e.name===this.name),await this.activate())}render(){if(!this.widget||this.status!=="activated")return d;if(this.widget.renderStrategy===$.Trigger){const t=new b;return t.application=this.widget,t}return this.widget.render()}}k.styles=[M`
|
380
394
|
:host {
|
381
395
|
display: block;
|
382
396
|
}
|
383
|
-
`];Pt([m({attribute:!0})],k.prototype,"name",2);Pt([U()],k.prototype,"widget",2);Pt([U()],k.prototype,"status",2);customElements.get("ace-trigger-slot")||customElements.define("ace-trigger-slot",rt);customElements.get("ace-trigger")||customElements.define("ace-trigger",b);customElements.get("ace-unresolved-component")||customElements.define("ace-unresolved-component",Et);customElements.get("ace-wrapper")||customElements.define("ace-wrapper",nt);customElements.get("ace-widget")||customElements.define("ace-widget",k);const Li=async(s,t)=>{await new Se(s).bootstrap(t)};exports.AceWidget=k;exports.Application=Ae;exports.Container=$t;exports.Environment=Ce;exports.HttpClient=
|
397
|
+
`];Pt([m({attribute:!0})],k.prototype,"name",2);Pt([U()],k.prototype,"widget",2);Pt([U()],k.prototype,"status",2);customElements.get("ace-trigger-slot")||customElements.define("ace-trigger-slot",rt);customElements.get("ace-trigger")||customElements.define("ace-trigger",b);customElements.get("ace-unresolved-component")||customElements.define("ace-unresolved-component",Et);customElements.get("ace-wrapper")||customElements.define("ace-wrapper",nt);customElements.get("ace-widget")||customElements.define("ace-widget",k);const Li=async(s,t)=>{await new Se(s).bootstrap(t)};exports.AceWidget=k;exports.Application=Ae;exports.Container=$t;exports.Environment=Ce;exports.HttpClient=z;exports.Site=Se;exports.StorageCategory=v;exports.StorageService=_e;exports.Trigger=b;exports.WidgetComponent=ye;exports.applicationContext=be;exports.bootstrap=Li;exports.createHttpClient=ki;
|
package/index.mjs
CHANGED
@@ -587,10 +587,10 @@ const Re = (s) => new oe(typeof s == "string" ? s : s + "", void 0, _t), U = (s,
|
|
587
587
|
* Copyright 2017 Google LLC
|
588
588
|
* SPDX-License-Identifier: BSD-3-Clause
|
589
589
|
*/
|
590
|
-
const { is: Me, defineProperty: ke, getOwnPropertyDescriptor: Ne, getOwnPropertyNames: je, getOwnPropertySymbols: He, getPrototypeOf: Le } = Object, x = globalThis, Nt = x.trustedTypes,
|
590
|
+
const { is: Me, defineProperty: ke, getOwnPropertyDescriptor: Ne, getOwnPropertyNames: je, getOwnPropertySymbols: He, getPrototypeOf: Le } = Object, x = globalThis, Nt = x.trustedTypes, Be = Nt ? Nt.emptyScript : "", ct = x.reactiveElementPolyfillSupport, N = (s, t) => s, X = { toAttribute(s, t) {
|
591
591
|
switch (t) {
|
592
592
|
case Boolean:
|
593
|
-
s = s ?
|
593
|
+
s = s ? Be : null;
|
594
594
|
break;
|
595
595
|
case Object:
|
596
596
|
case Array:
|
@@ -834,9 +834,9 @@ T.elementStyles = [], T.shadowRootOptions = { mode: "open" }, T[N("elementProper
|
|
834
834
|
* Copyright 2017 Google LLC
|
835
835
|
* SPDX-License-Identifier: BSD-3-Clause
|
836
836
|
*/
|
837
|
-
const j = globalThis, Q = j.trustedTypes, Ht = Q ? Q.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, ae = "$lit$", A = `lit$${(Math.random() + "").slice(9)}$`, ce = "?" + A,
|
838
|
-
\f\r]`, k = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Lt = /-->/g,
|
839
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"),
|
837
|
+
const j = globalThis, Q = j.trustedTypes, Ht = Q ? Q.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, ae = "$lit$", A = `lit$${(Math.random() + "").slice(9)}$`, ce = "?" + A, De = `<${ce}>`, P = document, L = () => P.createComment(""), B = (s) => s === null || typeof s != "object" && typeof s != "function", he = Array.isArray, ze = (s) => he(s) || typeof (s == null ? void 0 : s[Symbol.iterator]) == "function", ht = `[
|
838
|
+
\f\r]`, k = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Lt = /-->/g, Bt = />/g, C = RegExp(`>|${ht}(?:([^\\s"'>=/]+)(${ht}*=${ht}*(?:[^
|
839
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), Dt = /'/g, zt = /"/g, le = /^(?:script|style|textarea|title)$/i, We = (s) => (t, ...e) => ({ _$litType$: s, strings: t, values: e }), I = We(1), O = Symbol.for("lit-noChange"), d = Symbol.for("lit-nothing"), Wt = /* @__PURE__ */ new WeakMap(), E = P.createTreeWalker(P, 129);
|
840
840
|
function pe(s, t) {
|
841
841
|
if (!Array.isArray(s) || !s.hasOwnProperty("raw"))
|
842
842
|
throw Error("invalid template strings array");
|
@@ -849,19 +849,19 @@ const Fe = (s, t) => {
|
|
849
849
|
const c = s[a];
|
850
850
|
let h, l, p = -1, f = 0;
|
851
851
|
for (; f < c.length && (o.lastIndex = f, l = o.exec(c), l !== null); )
|
852
|
-
f = o.lastIndex, o === k ? l[1] === "!--" ? o = Lt : l[1] !== void 0 ? o =
|
852
|
+
f = o.lastIndex, o === k ? l[1] === "!--" ? o = Lt : l[1] !== void 0 ? o = Bt : l[2] !== void 0 ? (le.test(l[2]) && (r = RegExp("</" + l[2], "g")), o = C) : l[3] !== void 0 && (o = C) : o === C ? l[0] === ">" ? (o = r ?? k, p = -1) : l[1] === void 0 ? p = -2 : (p = o.lastIndex - l[2].length, h = l[1], o = l[3] === void 0 ? C : l[3] === '"' ? zt : Dt) : o === zt || o === Dt ? o = C : o === Lt || o === Bt ? o = k : (o = C, r = void 0);
|
853
853
|
const u = o === C && s[a + 1].startsWith("/>") ? " " : "";
|
854
|
-
n += o === k ? c +
|
854
|
+
n += o === k ? c + De : p >= 0 ? (i.push(h), c.slice(0, p) + ae + c.slice(p) + A + u) : c + A + (p === -2 ? a : u);
|
855
855
|
}
|
856
856
|
return [pe(s, n + (s[e] || "<?>") + (t === 2 ? "</svg>" : "")), i];
|
857
857
|
};
|
858
|
-
class
|
858
|
+
class D {
|
859
859
|
constructor({ strings: t, _$litType$: e }, i) {
|
860
860
|
let r;
|
861
861
|
this.parts = [];
|
862
862
|
let n = 0, o = 0;
|
863
863
|
const a = t.length - 1, c = this.parts, [h, l] = Fe(t, e);
|
864
|
-
if (this.el =
|
864
|
+
if (this.el = D.createElement(h, i), E.currentNode = this.el.content, e === 2) {
|
865
865
|
const p = this.el.content.firstChild;
|
866
866
|
p.replaceWith(...p.childNodes);
|
867
867
|
}
|
@@ -904,7 +904,7 @@ function R(s, t, e = s, i) {
|
|
904
904
|
if (t === O)
|
905
905
|
return t;
|
906
906
|
let r = i !== void 0 ? (o = e._$Co) == null ? void 0 : o[i] : e._$Cl;
|
907
|
-
const n =
|
907
|
+
const n = B(t) ? void 0 : t._$litDirective$;
|
908
908
|
return (r == null ? void 0 : r.constructor) !== n && ((a = r == null ? void 0 : r._$AO) == null || a.call(r, !1), n === void 0 ? r = void 0 : (r = new n(s), r._$AT(s, e, i)), i !== void 0 ? (e._$Co ?? (e._$Co = []))[i] = r : e._$Cl = r), r !== void 0 && (t = R(s, r._$AS(s, t.values), r, i)), t;
|
909
909
|
}
|
910
910
|
class Ve {
|
@@ -956,7 +956,7 @@ class W {
|
|
956
956
|
return this._$AB;
|
957
957
|
}
|
958
958
|
_$AI(t, e = this) {
|
959
|
-
t = R(this, t, e),
|
959
|
+
t = R(this, t, e), B(t) ? t === d || t == null || t === "" ? (this._$AH !== d && this._$AR(), this._$AH = d) : t !== this._$AH && t !== O && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : ze(t) ? this.k(t) : this._(t);
|
960
960
|
}
|
961
961
|
S(t) {
|
962
962
|
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
@@ -965,11 +965,11 @@ class W {
|
|
965
965
|
this._$AH !== t && (this._$AR(), this._$AH = this.S(t));
|
966
966
|
}
|
967
967
|
_(t) {
|
968
|
-
this._$AH !== d &&
|
968
|
+
this._$AH !== d && B(this._$AH) ? this._$AA.nextSibling.data = t : this.T(P.createTextNode(t)), this._$AH = t;
|
969
969
|
}
|
970
970
|
$(t) {
|
971
971
|
var n;
|
972
|
-
const { values: e, _$litType$: i } = t, r = typeof i == "number" ? this._$AC(t) : (i.el === void 0 && (i.el =
|
972
|
+
const { values: e, _$litType$: i } = t, r = typeof i == "number" ? this._$AC(t) : (i.el === void 0 && (i.el = D.createElement(pe(i.h, i.h[0]), this.options)), i);
|
973
973
|
if (((n = this._$AH) == null ? void 0 : n._$AD) === r)
|
974
974
|
this._$AH.p(e);
|
975
975
|
else {
|
@@ -979,7 +979,7 @@ class W {
|
|
979
979
|
}
|
980
980
|
_$AC(t) {
|
981
981
|
let e = Wt.get(t.strings);
|
982
|
-
return e === void 0 && Wt.set(t.strings, e = new
|
982
|
+
return e === void 0 && Wt.set(t.strings, e = new D(t)), e;
|
983
983
|
}
|
984
984
|
k(t) {
|
985
985
|
he(this._$AH) || (this._$AH = [], this._$AR());
|
@@ -1015,12 +1015,12 @@ class st {
|
|
1015
1015
|
const n = this.strings;
|
1016
1016
|
let o = !1;
|
1017
1017
|
if (n === void 0)
|
1018
|
-
t = R(this, t, e, 0), o = !
|
1018
|
+
t = R(this, t, e, 0), o = !B(t) || t !== this._$AH && t !== O, o && (this._$AH = t);
|
1019
1019
|
else {
|
1020
1020
|
const a = t;
|
1021
1021
|
let c, h;
|
1022
1022
|
for (t = n[0], c = 0; c < n.length - 1; c++)
|
1023
|
-
h = R(this, a[i + c], e, c), h === O && (h = this._$AH[c]), o || (o = !
|
1023
|
+
h = R(this, a[i + c], e, c), h === O && (h = this._$AH[c]), o || (o = !B(h) || h !== this._$AH[c]), h === d ? t = d : t !== d && (t += (h ?? "") + n[c + 1]), this._$AH[c] = h;
|
1024
1024
|
}
|
1025
1025
|
o && !r && this.j(t);
|
1026
1026
|
}
|
@@ -1071,7 +1071,7 @@ class Ge {
|
|
1071
1071
|
}
|
1072
1072
|
}
|
1073
1073
|
const lt = j.litHtmlPolyfillSupport;
|
1074
|
-
lt == null || lt(
|
1074
|
+
lt == null || lt(D, W), (j.litHtmlVersions ?? (j.litHtmlVersions = [])).push("3.1.2");
|
1075
1075
|
const Ze = (s, t, e) => {
|
1076
1076
|
const i = (e == null ? void 0 : e.renderBefore) ?? t;
|
1077
1077
|
let r = i._$litPart$;
|
@@ -2077,8 +2077,10 @@ class nt extends w {
|
|
2077
2077
|
this.applyBranding(), this.applyStyles();
|
2078
2078
|
}
|
2079
2079
|
render() {
|
2080
|
-
|
2081
|
-
|
2080
|
+
var i, r;
|
2081
|
+
const t = this.application.settings.components.conversation;
|
2082
|
+
return ((r = (i = t == null ? void 0 : t.properties) == null ? void 0 : i.chat) == null ? void 0 : r.isThirdPartyWidget) ? this.renderRoot.host.classList.add("third-party") : this.application.renderStrategy === b.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")), I`<div class="widget-container" ${ve(this.wrapperRef)}>
|
2083
|
+
${bi(this.nodes, (n) => n)}
|
2082
2084
|
</div>`;
|
2083
2085
|
}
|
2084
2086
|
}
|
@@ -2129,6 +2131,10 @@ nt.styles = U`
|
|
2129
2131
|
inset: 0 0 95px 0;
|
2130
2132
|
height: 100%;
|
2131
2133
|
}
|
2134
|
+
:host(.third-party) {
|
2135
|
+
inset: 0 0 95px 0;
|
2136
|
+
height: 100vh;
|
2137
|
+
}
|
2132
2138
|
}
|
2133
2139
|
@media screen and (min-width: 801px) {
|
2134
2140
|
:host(.floating) {
|
@@ -2137,6 +2143,14 @@ nt.styles = U`
|
|
2137
2143
|
width: 400px;
|
2138
2144
|
height: 700px;
|
2139
2145
|
}
|
2146
|
+
:host(.third-party) {
|
2147
|
+
max-width: 1000px;
|
2148
|
+
height: 100vh;
|
2149
|
+
position: relative;
|
2150
|
+
left: 50%;
|
2151
|
+
transform: translateX(-50%);
|
2152
|
+
margin: -10px 0;
|
2153
|
+
}
|
2140
2154
|
:host(.floating.bottom-right) {
|
2141
2155
|
inset: auto 20px 95px auto;
|
2142
2156
|
}
|
@@ -2162,6 +2176,8 @@ nt.styles = U`
|
|
2162
2176
|
background-color: var(--primary-background);
|
2163
2177
|
padding: var(--spacing-sm);
|
2164
2178
|
border: var(--widget-border, none);
|
2179
|
+
border-left: 1px solid #00000054;
|
2180
|
+
border-right: 1px solid #00000054;
|
2165
2181
|
}
|
2166
2182
|
@keyframes slideDown {
|
2167
2183
|
from {
|
@@ -2282,17 +2298,16 @@ be.ResolveWebComponentName = (s) => `ace-${s}`;
|
|
2282
2298
|
var y = /* @__PURE__ */ ((s) => (s.Mandatory = "mandatory", s.Preferences = "preferences", s.Analytics = "analytics", s))(y || {});
|
2283
2299
|
class Oi {
|
2284
2300
|
constructor(t, e, i) {
|
2285
|
-
this.
|
2301
|
+
this.widgetId = t, this.storage = e === "localStorage" ? window.localStorage : window.sessionStorage, this.policy = i;
|
2286
2302
|
}
|
2287
2303
|
set(t, e, i) {
|
2288
|
-
if (
|
2289
|
-
|
2290
|
-
|
2291
|
-
|
2292
|
-
|
2293
|
-
|
2294
|
-
|
2295
|
-
);
|
2304
|
+
if (this.policy[i]) {
|
2305
|
+
const r = { value: e, category: i };
|
2306
|
+
this.storage.setItem(this._prefixKey(t), JSON.stringify(r));
|
2307
|
+
} else
|
2308
|
+
console.warn(
|
2309
|
+
`Storage policy does not allow storing items in category: ${i}`
|
2310
|
+
);
|
2296
2311
|
}
|
2297
2312
|
get(t) {
|
2298
2313
|
const e = this.storage.getItem(this._prefixKey(t));
|
@@ -2313,9 +2328,6 @@ class Oi {
|
|
2313
2328
|
updatePolicy(t) {
|
2314
2329
|
this.policy = t;
|
2315
2330
|
}
|
2316
|
-
disallowKey(t) {
|
2317
|
-
this.disallowedKeys.includes(t) || this.disallowedKeys.push(t), this.removeItem(t);
|
2318
|
-
}
|
2319
2331
|
_prefixKey(t) {
|
2320
2332
|
return `ace_${this.widgetId.substring(0, 7)}-${t}`;
|
2321
2333
|
}
|
@@ -2345,6 +2357,14 @@ class Ii {
|
|
2345
2357
|
close() {
|
2346
2358
|
this.widget.hide();
|
2347
2359
|
}
|
2360
|
+
hideTriggerButton() {
|
2361
|
+
var t;
|
2362
|
+
(t = this.widget.trigger) == null || t.hideTrigger();
|
2363
|
+
}
|
2364
|
+
showTriggerButton() {
|
2365
|
+
var t;
|
2366
|
+
(t = this.widget.trigger) == null || t.showTrigger();
|
2367
|
+
}
|
2348
2368
|
}
|
2349
2369
|
class Ri {
|
2350
2370
|
constructor(t, e, i, r, n) {
|
@@ -2376,18 +2396,22 @@ class Ri {
|
|
2376
2396
|
return this.plugins.push(t), this;
|
2377
2397
|
}
|
2378
2398
|
appendToDOM() {
|
2379
|
-
this.root && (this.root.classList.add("expanded"), this.root.classList.remove("hidden"), document.body.appendChild(this.root)), this.storage.set("open",
|
2399
|
+
this.root && (this.root.classList.add("expanded"), this.root.classList.remove("hidden"), document.body.appendChild(this.root)), this.storage.set("open", "true", y.Mandatory);
|
2380
2400
|
}
|
2381
2401
|
hide() {
|
2382
|
-
this.root && (this.root.classList.add("hidden"), this.root.classList.remove("expanded")), this.storage.set("open",
|
2402
|
+
this.root && (this.root.classList.add("hidden"), this.root.classList.remove("expanded")), this.storage.set("open", "false", y.Mandatory);
|
2383
2403
|
}
|
2384
2404
|
mute() {
|
2385
|
-
this.storage.set(
|
2405
|
+
this.storage.set(
|
2406
|
+
"muteAudioNotifications",
|
2407
|
+
"true",
|
2408
|
+
y.Mandatory
|
2409
|
+
);
|
2386
2410
|
}
|
2387
2411
|
unmute() {
|
2388
2412
|
this.storage.set(
|
2389
2413
|
"muteAudioNotifications",
|
2390
|
-
|
2414
|
+
"false",
|
2391
2415
|
y.Mandatory
|
2392
2416
|
);
|
2393
2417
|
}
|
@@ -2475,12 +2499,6 @@ class Ui {
|
|
2475
2499
|
}
|
2476
2500
|
});
|
2477
2501
|
}
|
2478
|
-
disallowStorageKey(t) {
|
2479
|
-
var e;
|
2480
|
-
(((e = this.site.environment) == null ? void 0 : e.applications) || []).forEach((i) => {
|
2481
|
-
i.storage && i.storage.disallowKey(t);
|
2482
|
-
});
|
2483
|
-
}
|
2484
2502
|
}
|
2485
2503
|
class Mi {
|
2486
2504
|
constructor() {
|
package/package.json
CHANGED
package/services/site-api.d.ts
CHANGED
@@ -7,12 +7,10 @@ export declare class StorageService {
|
|
7
7
|
private storage;
|
8
8
|
private policy;
|
9
9
|
private widgetId;
|
10
|
-
private disallowedKeys;
|
11
10
|
constructor(widgetId: string, storageType: 'localStorage' | 'sessionStorage', policy: Record<StorageCategory, boolean>);
|
12
11
|
set<T>(key: string, value: T, category: StorageCategory): void;
|
13
12
|
get<T>(key: string): T | null;
|
14
13
|
removeItem(key: string): void;
|
15
14
|
updatePolicy(newPolicy: Record<StorageCategory, boolean>): void;
|
16
|
-
disallowKey(key: string): void;
|
17
15
|
private _prefixKey;
|
18
16
|
}
|