@telia-ace/widget-conversation-flamingo 1.1.36 → 1.1.37-rc.1
Sign up to get free protection for your applications and to get access to all the features.
- package/{conversation-a2cc9348.js → conversation-1aaef607.js} +3 -3
- package/{conversation-a9a10348.mjs → conversation-2fb2cb03.mjs} +4 -4
- package/{index-a3854c05.mjs → index-be7cbf2b.mjs} +1 -1
- package/{index-ea30c4f7.js → index-e34200b2.js} +1 -1
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/package.json +2 -2
@@ -64,7 +64,7 @@
|
|
64
64
|
bottom: 20px;
|
65
65
|
left: 20px;
|
66
66
|
}
|
67
|
-
`];Ui([$({attribute:!0})],Qt.prototype,"anchor",2);const Ni=new WeakMap;let we=0;const Lt=new Map,Ce=new WeakSet,Ae=()=>new Promise(s=>requestAnimationFrame(s)),ji=[{transform:"translateX(100%) scale(0)",opacity:0}],Ii=[{opacity:0}],Se=[{opacity:0},{opacity:1}],Ee=(s,t)=>{const e=s-t;return e===0?void 0:e},ke=(s,t)=>{const e=s/t;return e===1?void 0:e},Rt={left:(s,t)=>{const e=Ee(s,t);return{value:e,transform:e==null||isNaN(e)?void 0:`translateX(${e}px)`}},top:(s,t)=>{const e=Ee(s,t);return{value:e,transform:e==null||isNaN(e)?void 0:`translateY(${e}px)`}},width:(s,t)=>{let e;t===0&&(t=1,e={width:"1px"});const i=ke(s,t);return{value:i,overrideFrom:e,transform:i==null||isNaN(i)?void 0:`scaleX(${i})`}},height:(s,t)=>{let e;t===0&&(t=1,e={height:"1px"});const i=ke(s,t);return{value:i,overrideFrom:e,transform:i==null||isNaN(i)?void 0:`scaleY(${i})`}}},Di={duration:333,easing:"ease-in-out"},Bi=["left","top","width","height","opacity","color","background"],Te=new WeakMap;class zi extends ss{constructor(t){if(super(t),this.t=null,this.i=null,this.o=!0,this.shouldLog=!1,t.type===_t.CHILD)throw Error("The `animate` directive must be used in attribute position.");this.createFinished()}createFinished(){var t;(t=this.resolveFinished)==null||t.call(this),this.finished=new Promise(e=>{this.h=e})}async resolveFinished(){var t;(t=this.h)==null||t.call(this),this.h=void 0}render(t){return u}getController(){return Ni.get(this.l)}isDisabled(){var t;return this.options.disabled||((t=this.getController())==null?void 0:t.disabled)}update(t,[e]){var n;const i=this.l===void 0;return i&&(this.l=(n=t.options)==null?void 0:n.host,this.l.addController(this),this.element=t.element,Te.set(this.element,this)),this.optionsOrCallback=e,(i||typeof e!="function")&&this.u(e),this.render(e)}u(t){t=t??{};const e=this.getController();e!==void 0&&((t={...e.defaultOptions,...t}).keyframeOptions={...e.defaultOptions.keyframeOptions,...t.keyframeOptions}),t.properties??(t.properties=Bi),this.options=t}p(){const t={},e=this.element.getBoundingClientRect(),i=getComputedStyle(this.element);return this.options.properties.forEach(n=>{const o=e[n]??(Rt[n]?void 0:i[n]),r=Number(o);t[n]=isNaN(r)?o+"":r}),t}m(){let t,e=!0;return this.options.guard&&(t=this.options.guard(),e=((i,n)=>{if(Array.isArray(i)){if(Array.isArray(n)&&n.length===i.length&&i.every((o,r)=>o===n[r]))return!1}else if(n===i)return!1;return!0})(t,this.v)),this.o=this.l.hasUpdated&&!this.isDisabled()&&!this.isAnimating()&&e&&this.element.isConnected,this.o&&(this.v=Array.isArray(t)?Array.from(t):t),this.o}hostUpdate(){typeof this.optionsOrCallback=="function"&&this.u(this.optionsOrCallback()),this.m()&&(this.g=this.p(),this.t=this.t??this.element.parentNode,this.i=this.element.nextSibling)}async hostUpdated(){if(!this.o||!this.element.isConnected||this.options.skipInitial&&!this.isHostRendered)return;let t;this.prepare(),await Ae;const e=this._(),i=this.A(this.options.keyframeOptions,e),n=this.p();if(this.g!==void 0){const{from:o,to:r}=this.O(this.g,n,e);this.log("measured",[this.g,n,o,r]),t=this.calculateKeyframes(o,r)}else{const o=Lt.get(this.options.inId);if(o){Lt.delete(this.options.inId);const{from:r,to:a}=this.O(o,n,e);t=this.calculateKeyframes(r,a),t=this.options.in?[{...this.options.in[0],...t[0]},...this.options.in.slice(1),t[1]]:t,we++,t.forEach(l=>l.zIndex=we)}else this.options.in&&(t=[...this.options.in,{}])}this.animate(t,i)}resetStyles(){this.j!==void 0&&(this.element.setAttribute("style",this.j??""),this.j=void 0)}commitStyles(){var t,e;this.j=this.element.getAttribute("style"),(t=this.webAnimation)==null||t.commitStyles(),(e=this.webAnimation)==null||e.cancel()}reconnected(){}async disconnected(){var e;if(!this.o||(this.options.id!==void 0&&Lt.set(this.options.id,this.g),this.options.out===void 0))return;if(this.prepare(),await Ae(),(e=this.t)==null?void 0:e.isConnected){const i=this.i&&this.i.parentNode===this.t?this.i:null;if(this.t.insertBefore(this.element,i),this.options.stabilizeOut){const n=this.p();this.log("stabilizing out");const o=this.g.left-n.left,r=this.g.top-n.top;getComputedStyle(this.element).position!=="static"||o===0&&r===0||(this.element.style.position="relative"),o!==0&&(this.element.style.left=o+"px"),r!==0&&(this.element.style.top=r+"px")}}const t=this.A(this.options.keyframeOptions);await this.animate(this.options.out,t),this.element.remove()}prepare(){this.createFinished()}start(){var t,e;(e=(t=this.options).onStart)==null||e.call(t,this)}didFinish(t){var e,i;t&&((i=(e=this.options).onComplete)==null||i.call(e,this)),this.g=void 0,this.animatingProperties=void 0,this.frames=void 0,this.resolveFinished()}_(){const t=[];for(let e=this.element.parentNode;e;e=e==null?void 0:e.parentNode){const i=Te.get(e);i&&!i.isDisabled()&&i&&t.push(i)}return t}get isHostRendered(){const t=Ce.has(this.l);return t||this.l.updateComplete.then(()=>{Ce.add(this.l)}),t}A(t,e=this._()){const i={...Di};return e.forEach(n=>Object.assign(i,n.options.keyframeOptions)),Object.assign(i,t),i}O(t,e,i){t={...t},e={...e};const n=i.map(a=>a.animatingProperties).filter(a=>a!==void 0);let o=1,r=1;return n!==void 0&&(n.forEach(a=>{a.width&&(o/=a.width),a.height&&(r/=a.height)}),t.left!==void 0&&e.left!==void 0&&(t.left=o*t.left,e.left=o*e.left),t.top!==void 0&&e.top!==void 0&&(t.top=r*t.top,e.top=r*e.top)),{from:t,to:e}}calculateKeyframes(t,e,i=!1){const n={},o={};let r=!1;const a={};for(const l in e){const c=t[l],d=e[l];if(l in Rt){const h=Rt[l];if(c===void 0||d===void 0)continue;const p=h(c,d);p.transform!==void 0&&(a[l]=p.value,r=!0,n.transform=`${n.transform??""} ${p.transform}`,p.overrideFrom!==void 0&&Object.assign(n,p.overrideFrom))}else c!==d&&c!==void 0&&d!==void 0&&(r=!0,n[l]=c,o[l]=d)}return n.transformOrigin=o.transformOrigin=i?"center center":"top left",this.animatingProperties=a,r?[n,o]:void 0}async animate(t,e=this.options.keyframeOptions){this.start(),this.frames=t;let i=!1;if(!this.isAnimating()&&!this.isDisabled()&&(this.options.onFrames&&(this.frames=t=this.options.onFrames(this),this.log("modified frames",t)),t!==void 0)){this.log("animate",[t,e]),i=!0,this.webAnimation=this.element.animate(t,e);const n=this.getController();n==null||n.add(this);try{await this.webAnimation.finished}catch{}n==null||n.remove(this)}return this.didFinish(i),i}isAnimating(){var t,e;return((t=this.webAnimation)==null?void 0:t.playState)==="running"||((e=this.webAnimation)==null?void 0:e.pending)}log(t,e){this.shouldLog&&!this.isDisabled()&&console.log(t,this.options.id,e)}}const It=xt(zi),it=(s,t,e)=>{s&&e.style.setProperty(t,s)},is=(s,t)=>{var e,i,n,o;it((e=s.colors)==null?void 0:e.primaryBackground,"--primary-background",t),it((i=s.colors)==null?void 0:i.textOnPrimaryBackground,"--text-on-primary-background",t),it((n=s.colors)==null?void 0:n.secondaryBackground,"--secondary-background",t),it((o=s.colors)==null?void 0:o.textOnSecondaryBackground,"--text-on-secondary-background",t)};var Fi=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,wt=(s,t,e,i)=>{for(var n=i>1?void 0:i?Wi(t,e):t,o=s.length-1,r;o>=0;o--)(r=s[o])&&(n=(i?r(t,e,n):r(n))||n);return i&&n&&Fi(t,e,n),n};class M extends m{constructor(){super(...arguments),this.active=!1,this.loaded=!1,this.containerRef=pt()}async connectedCallback(){super.connectedCallback(),this.icon=await this._renderSymbol(),this.loaded=!0,this._applyBranding()}
|
67
|
+
`];Ui([$({attribute:!0})],Qt.prototype,"anchor",2);const Ni=new WeakMap;let we=0;const Lt=new Map,Ce=new WeakSet,Ae=()=>new Promise(s=>requestAnimationFrame(s)),ji=[{transform:"translateX(100%) scale(0)",opacity:0}],Ii=[{opacity:0}],Se=[{opacity:0},{opacity:1}],Ee=(s,t)=>{const e=s-t;return e===0?void 0:e},ke=(s,t)=>{const e=s/t;return e===1?void 0:e},Rt={left:(s,t)=>{const e=Ee(s,t);return{value:e,transform:e==null||isNaN(e)?void 0:`translateX(${e}px)`}},top:(s,t)=>{const e=Ee(s,t);return{value:e,transform:e==null||isNaN(e)?void 0:`translateY(${e}px)`}},width:(s,t)=>{let e;t===0&&(t=1,e={width:"1px"});const i=ke(s,t);return{value:i,overrideFrom:e,transform:i==null||isNaN(i)?void 0:`scaleX(${i})`}},height:(s,t)=>{let e;t===0&&(t=1,e={height:"1px"});const i=ke(s,t);return{value:i,overrideFrom:e,transform:i==null||isNaN(i)?void 0:`scaleY(${i})`}}},Di={duration:333,easing:"ease-in-out"},Bi=["left","top","width","height","opacity","color","background"],Te=new WeakMap;class zi extends ss{constructor(t){if(super(t),this.t=null,this.i=null,this.o=!0,this.shouldLog=!1,t.type===_t.CHILD)throw Error("The `animate` directive must be used in attribute position.");this.createFinished()}createFinished(){var t;(t=this.resolveFinished)==null||t.call(this),this.finished=new Promise(e=>{this.h=e})}async resolveFinished(){var t;(t=this.h)==null||t.call(this),this.h=void 0}render(t){return u}getController(){return Ni.get(this.l)}isDisabled(){var t;return this.options.disabled||((t=this.getController())==null?void 0:t.disabled)}update(t,[e]){var n;const i=this.l===void 0;return i&&(this.l=(n=t.options)==null?void 0:n.host,this.l.addController(this),this.element=t.element,Te.set(this.element,this)),this.optionsOrCallback=e,(i||typeof e!="function")&&this.u(e),this.render(e)}u(t){t=t??{};const e=this.getController();e!==void 0&&((t={...e.defaultOptions,...t}).keyframeOptions={...e.defaultOptions.keyframeOptions,...t.keyframeOptions}),t.properties??(t.properties=Bi),this.options=t}p(){const t={},e=this.element.getBoundingClientRect(),i=getComputedStyle(this.element);return this.options.properties.forEach(n=>{const o=e[n]??(Rt[n]?void 0:i[n]),r=Number(o);t[n]=isNaN(r)?o+"":r}),t}m(){let t,e=!0;return this.options.guard&&(t=this.options.guard(),e=((i,n)=>{if(Array.isArray(i)){if(Array.isArray(n)&&n.length===i.length&&i.every((o,r)=>o===n[r]))return!1}else if(n===i)return!1;return!0})(t,this.v)),this.o=this.l.hasUpdated&&!this.isDisabled()&&!this.isAnimating()&&e&&this.element.isConnected,this.o&&(this.v=Array.isArray(t)?Array.from(t):t),this.o}hostUpdate(){typeof this.optionsOrCallback=="function"&&this.u(this.optionsOrCallback()),this.m()&&(this.g=this.p(),this.t=this.t??this.element.parentNode,this.i=this.element.nextSibling)}async hostUpdated(){if(!this.o||!this.element.isConnected||this.options.skipInitial&&!this.isHostRendered)return;let t;this.prepare(),await Ae;const e=this._(),i=this.A(this.options.keyframeOptions,e),n=this.p();if(this.g!==void 0){const{from:o,to:r}=this.O(this.g,n,e);this.log("measured",[this.g,n,o,r]),t=this.calculateKeyframes(o,r)}else{const o=Lt.get(this.options.inId);if(o){Lt.delete(this.options.inId);const{from:r,to:a}=this.O(o,n,e);t=this.calculateKeyframes(r,a),t=this.options.in?[{...this.options.in[0],...t[0]},...this.options.in.slice(1),t[1]]:t,we++,t.forEach(l=>l.zIndex=we)}else this.options.in&&(t=[...this.options.in,{}])}this.animate(t,i)}resetStyles(){this.j!==void 0&&(this.element.setAttribute("style",this.j??""),this.j=void 0)}commitStyles(){var t,e;this.j=this.element.getAttribute("style"),(t=this.webAnimation)==null||t.commitStyles(),(e=this.webAnimation)==null||e.cancel()}reconnected(){}async disconnected(){var e;if(!this.o||(this.options.id!==void 0&&Lt.set(this.options.id,this.g),this.options.out===void 0))return;if(this.prepare(),await Ae(),(e=this.t)==null?void 0:e.isConnected){const i=this.i&&this.i.parentNode===this.t?this.i:null;if(this.t.insertBefore(this.element,i),this.options.stabilizeOut){const n=this.p();this.log("stabilizing out");const o=this.g.left-n.left,r=this.g.top-n.top;getComputedStyle(this.element).position!=="static"||o===0&&r===0||(this.element.style.position="relative"),o!==0&&(this.element.style.left=o+"px"),r!==0&&(this.element.style.top=r+"px")}}const t=this.A(this.options.keyframeOptions);await this.animate(this.options.out,t),this.element.remove()}prepare(){this.createFinished()}start(){var t,e;(e=(t=this.options).onStart)==null||e.call(t,this)}didFinish(t){var e,i;t&&((i=(e=this.options).onComplete)==null||i.call(e,this)),this.g=void 0,this.animatingProperties=void 0,this.frames=void 0,this.resolveFinished()}_(){const t=[];for(let e=this.element.parentNode;e;e=e==null?void 0:e.parentNode){const i=Te.get(e);i&&!i.isDisabled()&&i&&t.push(i)}return t}get isHostRendered(){const t=Ce.has(this.l);return t||this.l.updateComplete.then(()=>{Ce.add(this.l)}),t}A(t,e=this._()){const i={...Di};return e.forEach(n=>Object.assign(i,n.options.keyframeOptions)),Object.assign(i,t),i}O(t,e,i){t={...t},e={...e};const n=i.map(a=>a.animatingProperties).filter(a=>a!==void 0);let o=1,r=1;return n!==void 0&&(n.forEach(a=>{a.width&&(o/=a.width),a.height&&(r/=a.height)}),t.left!==void 0&&e.left!==void 0&&(t.left=o*t.left,e.left=o*e.left),t.top!==void 0&&e.top!==void 0&&(t.top=r*t.top,e.top=r*e.top)),{from:t,to:e}}calculateKeyframes(t,e,i=!1){const n={},o={};let r=!1;const a={};for(const l in e){const c=t[l],d=e[l];if(l in Rt){const h=Rt[l];if(c===void 0||d===void 0)continue;const p=h(c,d);p.transform!==void 0&&(a[l]=p.value,r=!0,n.transform=`${n.transform??""} ${p.transform}`,p.overrideFrom!==void 0&&Object.assign(n,p.overrideFrom))}else c!==d&&c!==void 0&&d!==void 0&&(r=!0,n[l]=c,o[l]=d)}return n.transformOrigin=o.transformOrigin=i?"center center":"top left",this.animatingProperties=a,r?[n,o]:void 0}async animate(t,e=this.options.keyframeOptions){this.start(),this.frames=t;let i=!1;if(!this.isAnimating()&&!this.isDisabled()&&(this.options.onFrames&&(this.frames=t=this.options.onFrames(this),this.log("modified frames",t)),t!==void 0)){this.log("animate",[t,e]),i=!0,this.webAnimation=this.element.animate(t,e);const n=this.getController();n==null||n.add(this);try{await this.webAnimation.finished}catch{}n==null||n.remove(this)}return this.didFinish(i),i}isAnimating(){var t,e;return((t=this.webAnimation)==null?void 0:t.playState)==="running"||((e=this.webAnimation)==null?void 0:e.pending)}log(t,e){this.shouldLog&&!this.isDisabled()&&console.log(t,this.options.id,e)}}const It=xt(zi),it=(s,t,e)=>{s&&e.style.setProperty(t,s)},is=(s,t)=>{var e,i,n,o;it((e=s.colors)==null?void 0:e.primaryBackground,"--primary-background",t),it((i=s.colors)==null?void 0:i.textOnPrimaryBackground,"--text-on-primary-background",t),it((n=s.colors)==null?void 0:n.secondaryBackground,"--secondary-background",t),it((o=s.colors)==null?void 0:o.textOnSecondaryBackground,"--text-on-secondary-background",t)};var Fi=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,wt=(s,t,e,i)=>{for(var n=i>1?void 0:i?Wi(t,e):t,o=s.length-1,r;o>=0;o--)(r=s[o])&&(n=(i?r(t,e,n):r(n))||n);return i&&n&&Fi(t,e,n),n};class M extends m{constructor(){super(...arguments),this.active=!1,this.loaded=!1,this.containerRef=pt()}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&&is(this.application.settings.branding,this)}async _renderSymbol(){var a,l,c;const t=(a=this.application)==null?void 0:a.branding(),e=(l=t==null?void 0:t.graphics)==null?void 0:l.trigger;if(e)return f` <img src=${e} class="trigger-icon" alt="" /> `;const i=(c=this.application)==null?void 0:c.triggerIcon;if(!i)return u;const n=async d=>await Promise.resolve().then(()=>require("./index-e34200b2.js")).then(p=>p[d]),{type:o,content:r}=i;switch(o){case"Telia":{const d=await n(r);return d?f`<telia-icon
|
68
68
|
class="trigger-icon"
|
69
69
|
svg=${d.svg}
|
70
70
|
size="lg"
|
@@ -72,7 +72,7 @@
|
|
72
72
|
${!this.active&&((n=(i=(e=(t=this.application)==null?void 0:t.settings)==null?void 0:e.branding)==null?void 0:i.other)!=null&&n.showButtonLabel)?f`
|
73
73
|
<button
|
74
74
|
class="trigger-label"
|
75
|
-
@click=${this.
|
75
|
+
@click=${this.toggleActive}
|
76
76
|
${It({keyframeOptions:{},in:ji,stabilizeOut:!0,skipInitial:!1})}
|
77
77
|
>
|
78
78
|
${this.application.settings.branding.other.buttonLabelText}
|
@@ -81,7 +81,7 @@
|
|
81
81
|
|
82
82
|
<button
|
83
83
|
class=${Kt({trigger:!0,active:this.active,rendered:this.loaded})}
|
84
|
-
@click=${this.
|
84
|
+
@click=${this.toggleActive}
|
85
85
|
>
|
86
86
|
${this.icon}
|
87
87
|
<span class="trigger-close">
|
@@ -1704,7 +1704,7 @@ class H extends m {
|
|
1704
1704
|
async connectedCallback() {
|
1705
1705
|
super.connectedCallback(), this.icon = await this._renderSymbol(), this.loaded = !0, this._applyBranding();
|
1706
1706
|
}
|
1707
|
-
|
1707
|
+
toggleActive() {
|
1708
1708
|
var t;
|
1709
1709
|
if (!((t = this.application) != null && t.root)) {
|
1710
1710
|
console.warn(
|
@@ -1726,7 +1726,7 @@ class H extends m {
|
|
1726
1726
|
const i = (c = this.application) == null ? void 0 : c.triggerIcon;
|
1727
1727
|
if (!i)
|
1728
1728
|
return u;
|
1729
|
-
const n = async (d) => await import("./index-
|
1729
|
+
const n = async (d) => await import("./index-be7cbf2b.mjs").then(
|
1730
1730
|
(p) => p[d]
|
1731
1731
|
), { type: o, content: r } = i;
|
1732
1732
|
switch (o) {
|
@@ -1748,7 +1748,7 @@ class H extends m {
|
|
1748
1748
|
${!this.active && ((n = (i = (e = (t = this.application) == null ? void 0 : t.settings) == null ? void 0 : e.branding) == null ? void 0 : i.other) != null && n.showButtonLabel) ? f`
|
1749
1749
|
<button
|
1750
1750
|
class="trigger-label"
|
1751
|
-
@click=${this.
|
1751
|
+
@click=${this.toggleActive}
|
1752
1752
|
${Nt({
|
1753
1753
|
keyframeOptions: {},
|
1754
1754
|
in: ji,
|
@@ -1766,7 +1766,7 @@ class H extends m {
|
|
1766
1766
|
active: this.active,
|
1767
1767
|
rendered: this.loaded
|
1768
1768
|
})}
|
1769
|
-
@click=${this.
|
1769
|
+
@click=${this.toggleActive}
|
1770
1770
|
>
|
1771
1771
|
${this.icon}
|
1772
1772
|
<span class="trigger-close">
|