@telia-ace/widget-conversation-flamingo 1.1.42-rc.0 → 1.1.42-rc.2
Sign up to get free protection for your applications and to get access to all the features.
package/index.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let T;const wt=new Uint8Array(16);function St(){if(!T&&(T=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!T))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return T(wt)}const d=[];for(let r=0;r<256;++r)d.push((r+256).toString(16).slice(1));function gt(r,e=0){return d[r[e+0]]+d[r[e+1]]+d[r[e+2]]+d[r[e+3]]+"-"+d[r[e+4]]+d[r[e+5]]+"-"+d[r[e+6]]+d[r[e+7]]+"-"+d[r[e+8]]+d[r[e+9]]+"-"+d[r[e+10]]+d[r[e+11]]+d[r[e+12]]+d[r[e+13]]+d[r[e+14]]+d[r[e+15]]}const xt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),G={randomUUID:xt};function Et(r,e,t){if(G.randomUUID&&!e&&!r)return G.randomUUID();r=r||{};const n=r.random||(r.rng||St)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){t=t||0;for(let i=0;i<16;++i)e[t+i]=n[i];return e}return gt(n)}var M=function(r,e){return M=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},M(r,e)};function x(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");M(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function _t(r,e,t,n){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function u(l){try{c(n.next(l))}catch(v){s(v)}}function a(l){try{c(n.throw(l))}catch(v){s(v)}}function c(l){l.done?o(l.value):i(l.value).then(u,a)}c((n=n.apply(r,e||[])).next())})}function W(r,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(c){return function(l){return a([c,l])}}function a(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(t=0)),t;)try{if(n=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){t.label=c[1];break}if(c[0]===6&&t.label<o[1]){t.label=o[1],o=c;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(c);break}o[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(r,t)}catch(l){c=[6,l],i=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function g(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function C(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return o}function k(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))}function S(r){return this instanceof S?(this.v=r,this):new S(r)}function Pt(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(f){n[f]&&(i[f]=function(y){return new Promise(function(_,p){o.push([f,y,_,p])>1||u(f,y)})})}function u(f,y){try{a(n[f](y))}catch(_){v(o[0][3],_)}}function a(f){f.value instanceof S?Promise.resolve(f.value.v).then(c,l):v(o[0][2],f)}function c(f){u("next",f)}function l(f){u("throw",f)}function v(f,y){f(y),o.shift(),o.length&&u(o[0][0],o[0][1])}}function It(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof g=="function"?g(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(o){t[o]=r[o]&&function(s){return new Promise(function(u,a){s=r[o](s),i(u,a,s.done,s.value)})}}function i(o,s,u,a){Promise.resolve(a).then(function(c){o({value:c,done:u})},s)}}function h(r){return typeof r=="function"}function X(r){var e=function(n){Error.call(n),n.stack=new Error().stack},t=r(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var F=X(function(r){return function(t){r(this),this.message=t?t.length+` errors occurred during unsubscription:
|
2
2
|
`+t.map(function(n,i){return i+1+") "+n.toString()}).join(`
|
3
|
-
`):"",this.name="UnsubscriptionError",this.errors=t}});function D(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}var j=function(){function r(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var e,t,n,i,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var u=g(s),a=u.next();!a.done;a=u.next()){var c=a.value;c.remove(this)}}catch(p){e={error:p}}finally{try{a&&!a.done&&(t=u.return)&&t.call(u)}finally{if(e)throw e.error}}else s.remove(this);var l=this.initialTeardown;if(h(l))try{l()}catch(p){o=p instanceof F?p.errors:[p]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var f=g(v),y=f.next();!y.done;y=f.next()){var _=y.value;try{z(_)}catch(p){o=o??[],p instanceof F?o=k(k([],C(o)),C(p.errors)):o.push(p)}}}catch(p){n={error:p}}finally{try{y&&!y.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}}if(o)throw new F(o)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)z(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&D(t,e)},r.prototype.remove=function(e){var t=this._finalizers;t&&D(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=function(){var e=new r;return e.closed=!0,e}(),r}(),Z=j.EMPTY;function N(r){return r instanceof j||r&&"closed"in r&&h(r.remove)&&h(r.add)&&h(r.unsubscribe)}function z(r){h(r)?r():r.unsubscribe()}var tt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Y={setTimeout:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i=Y.delegate;return i!=null&&i.setTimeout?i.setTimeout.apply(i,k([r,e],C(t))):setTimeout.apply(void 0,k([r,e],C(t)))},clearTimeout:function(r){var e=Y.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(r)},delegate:void 0};function et(r){Y.setTimeout(function(){throw r})}function V(){}function $(r){r()}var B=function(r){x(e,r);function e(t){var n=r.call(this)||this;return n.isStopped=!1,t?(n.destination=t,N(t)&&t.add(n)):n.destination=At,n}return e.create=function(t,n,i){return new q(t,n,i)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(j),Ot=Function.prototype.bind;function L(r,e){return Ot.call(r,e)}var Ut=function(){function r(e){this.partialObserver=e}return r.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(n){A(n)}},r.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){A(n)}else A(e)},r.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){A(t)}},r}(),q=function(r){x(e,r);function e(t,n,i){var o=r.call(this)||this,s;if(h(t)||!t)s={next:t??void 0,error:n??void 0,complete:i??void 0};else{var u;o&&tt.useDeprecatedNextContext?(u=Object.create(t),u.unsubscribe=function(){return o.unsubscribe()},s={next:t.next&&L(t.next,u),error:t.error&&L(t.error,u),complete:t.complete&&L(t.complete,u)}):s=t}return o.destination=new Ut(s),o}return e}(B);function A(r){et(r)}function Tt(r){throw r}var At={closed:!0,next:V,error:Tt,complete:V},H=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function $t(r){return r}function Ct(r){return r.length===0?$t:r.length===1?r[0]:function(t){return r.reduce(function(n,i){return i(n)},t)}}var b=function(){function r(e){e&&(this._subscribe=e)}return r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.subscribe=function(e,t,n){var i=this,o=jt(e)?e:new q(e,t,n);return $(function(){var s=i,u=s.operator,a=s.source;o.add(u?u.call(o,a):a?i._subscribe(o):i._trySubscribe(o))}),o},r.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},r.prototype.forEach=function(e,t){var n=this;return t=K(t),new t(function(i,o){var s=new q({next:function(u){try{e(u)}catch(a){o(a),s.unsubscribe()}},error:o,complete:i});n.subscribe(s)})},r.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},r.prototype[H]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Ct(e)(this)},r.prototype.toPromise=function(e){var t=this;return e=K(e),new e(function(n,i){var o;t.subscribe(function(s){return o=s},function(s){return i(s)},function(){return n(o)})})},r.create=function(e){return new r(e)},r}();function K(r){var e;return(e=r??tt.Promise)!==null&&e!==void 0?e:Promise}function kt(r){return r&&h(r.next)&&h(r.error)&&h(r.complete)}function jt(r){return r&&r instanceof B||kt(r)&&N(r)}function Rt(r){return h(r==null?void 0:r.lift)}function I(r){return function(e){if(Rt(e))return e.lift(function(t){try{return r(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function P(r,e,t,n,i){return new Ft(r,e,t,n,i)}var Ft=function(r){x(e,r);function e(t,n,i,o,s,u){var a=r.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=u,a._next=n?function(c){try{n(c)}catch(l){t.error(l)}}:r.prototype._next,a._error=o?function(c){try{o(c)}catch(l){t.error(l)}finally{this.unsubscribe()}}:r.prototype._error,a._complete=i?function(){try{i()}catch(c){t.error(c)}finally{this.unsubscribe()}}:r.prototype._complete,a}return e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;r.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e}(B),Lt=X(function(r){return function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),m=function(r){x(e,r);function e(){var t=r.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return e.prototype.lift=function(t){var n=new J(this,this);return n.operator=t,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new Lt},e.prototype.next=function(t){var n=this;$(function(){var i,o;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=g(n.currentObservers),u=s.next();!u.done;u=s.next()){var a=u.value;a.next(t)}}catch(c){i={error:c}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})},e.prototype.error=function(t){var n=this;$(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=t;for(var i=n.observers;i.length;)i.shift().error(t)}})},e.prototype.complete=function(){var t=this;$(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var n=t.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var n=this,i=this,o=i.hasError,s=i.isStopped,u=i.observers;return o||s?Z:(this.currentObservers=null,u.push(t),new j(function(){n.currentObservers=null,D(u,t)}))},e.prototype._checkFinalizedStatuses=function(t){var n=this,i=n.hasError,o=n.thrownError,s=n.isStopped;i?t.error(o):s&&t.complete()},e.prototype.asObservable=function(){var t=new b;return t.source=this,t},e.create=function(t,n){return new J(t,n)},e}(b),J=function(r){x(e,r);function e(t,n){var i=r.call(this)||this;return i.destination=t,i.source=n,i}return e.prototype.next=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,t)},e.prototype.error=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,t)},e.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},e.prototype._subscribe=function(t){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&i!==void 0?i:Z},e}(m),rt=function(r){x(e,r);function e(t){var n=r.call(this)||this;return n._value=t,n}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(t){var n=r.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},e.prototype.getValue=function(){var t=this,n=t.hasError,i=t.thrownError,o=t._value;if(n)throw i;return this._throwIfClosed(),o},e.prototype.next=function(t){r.prototype.next.call(this,this._value=t)},e}(m),Mt=new b(function(r){return r.complete()});function Dt(r){return r&&h(r.schedule)}function Yt(r){return r[r.length-1]}function Vt(r){return Dt(Yt(r))?r.pop():void 0}var nt=function(r){return r&&typeof r.length=="number"&&typeof r!="function"};function it(r){return h(r==null?void 0:r.then)}function ot(r){return h(r[H])}function st(r){return Symbol.asyncIterator&&h(r==null?void 0:r[Symbol.asyncIterator])}function ut(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function qt(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var ct=qt();function at(r){return h(r==null?void 0:r[ct])}function lt(r){return Pt(this,arguments,function(){var t,n,i,o;return W(this,function(s){switch(s.label){case 0:t=r.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,S(t.read())];case 3:return n=s.sent(),i=n.value,o=n.done,o?[4,S(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,S(i)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function ft(r){return h(r==null?void 0:r.getReader)}function O(r){if(r instanceof b)return r;if(r!=null){if(ot(r))return Bt(r);if(nt(r))return Ht(r);if(it(r))return Gt(r);if(st(r))return ht(r);if(at(r))return zt(r);if(ft(r))return Kt(r)}throw ut(r)}function Bt(r){return new b(function(e){var t=r[H]();if(h(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Ht(r){return new b(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()})}function Gt(r){return new b(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,et)})}function zt(r){return new b(function(e){var t,n;try{for(var i=g(r),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(u){t={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}e.complete()})}function ht(r){return new b(function(e){Jt(r,e).catch(function(t){return e.error(t)})})}function Kt(r){return ht(lt(r))}function Jt(r,e){var t,n,i,o;return _t(this,void 0,void 0,function(){var s,u;return W(this,function(a){switch(a.label){case 0:a.trys.push([0,5,6,11]),t=It(r),a.label=1;case 1:return[4,t.next()];case 2:if(n=a.sent(),!!n.done)return[3,4];if(s=n.value,e.next(s),e.closed)return[2];a.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=a.sent(),i={error:u},[3,11];case 6:return a.trys.push([6,,9,10]),n&&!n.done&&(o=t.return)?[4,o.call(t)]:[3,8];case 7:a.sent(),a.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function w(r,e,t,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var o=e.schedule(function(){t(),i?r.add(this.schedule(null,n)):this.unsubscribe()},n);if(r.add(o),!i)return o}function dt(r,e){return e===void 0&&(e=0),I(function(t,n){t.subscribe(P(n,function(i){return w(n,r,function(){return n.next(i)},e)},function(){return w(n,r,function(){return n.complete()},e)},function(i){return w(n,r,function(){return n.error(i)},e)}))})}function pt(r,e){return e===void 0&&(e=0),I(function(t,n){n.add(r.schedule(function(){return t.subscribe(n)},e))})}function Qt(r,e){return O(r).pipe(pt(e),dt(e))}function Wt(r,e){return O(r).pipe(pt(e),dt(e))}function Xt(r,e){return new b(function(t){var n=0;return e.schedule(function(){n===r.length?t.complete():(t.next(r[n++]),t.closed||this.schedule())})})}function Zt(r,e){return new b(function(t){var n;return w(t,e,function(){n=r[ct](),w(t,e,function(){var i,o,s;try{i=n.next(),o=i.value,s=i.done}catch(u){t.error(u);return}s?t.complete():t.next(o)},0,!0)}),function(){return h(n==null?void 0:n.return)&&n.return()}})}function vt(r,e){if(!r)throw new Error("Iterable cannot be null");return new b(function(t){w(t,e,function(){var n=r[Symbol.asyncIterator]();w(t,e,function(){n.next().then(function(i){i.done?t.complete():t.next(i.value)})},0,!0)})})}function Nt(r,e){return vt(lt(r),e)}function te(r,e){if(r!=null){if(ot(r))return Qt(r,e);if(nt(r))return Xt(r,e);if(it(r))return Wt(r,e);if(st(r))return vt(r,e);if(at(r))return Zt(r,e);if(ft(r))return Nt(r,e)}throw ut(r)}function ee(r,e){return e?te(r,e):O(r)}function re(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Vt(r);return ee(r,t)}function Q(r){return r<=0?function(){return Mt}:I(function(e,t){var n=0;e.subscribe(P(t,function(i){++n<=r&&(t.next(i),r<=n&&t.complete())}))})}function ne(r,e){return I(function(t,n){var i=null,o=0,s=!1,u=function(){return s&&!i&&n.complete()};t.subscribe(P(n,function(a){i==null||i.unsubscribe();var c=0,l=o++;O(r(a,l)).subscribe(i=P(n,function(v){return n.next(e?e(a,v,l,c++):v)},function(){i=null,u()}))},function(){s=!0,u()}))})}function ie(r){return I(function(e,t){O(r).subscribe(P(t,function(){return t.complete()},V)),!t.closed&&e.subscribe(t)})}class yt{constructor(e,t,n){this.id=e,this.component=t,this.platform=n,this.entries$=new rt([]),this.kill$=new m,this.queue=[],t.addEventListener("user-submit",i=>{if(!this.provider){console.warn("No provider activated, unable to print message to conversation.");return}this.provider.onUserSubmit(i.detail)})}write(e){this.addEntryRemoveHandler(e),this.entries$.pipe(Q(1)).subscribe(t=>{this.entries$.next([...t,e])})}entries(){return this.entries$.asObservable()}setProvider(e){this.provider=e,this.provider.actions().pipe(ie(this.kill$)).subscribe(t=>{this.write(t)}),this.provider.connect()}handover(e){const t=this.platform.registeredProviders.get(e);if(t){this.provider&&this.queue.unshift(this.provider),this.kill$.next();const n=t(this);this.setProvider(n)}}addEntryRemoveHandler(e){e.remove$.pipe(ne(()=>this.entries$),Q(1)).subscribe(t=>{this.entries$.next(t.filter(n=>n!==e))})}completeProvider(){const[e]=this.queue;e&&this.setProvider(e)}isTyping(){return this.provider?this.provider.isTyping():re(!1)}}class R{constructor(){this.sessions=new Map,this.registeredProviders=new Map,this.activeSessionId=null}static async getInstance(e){let t=await e.get("conversation");return t||(t=new R,await e.register("conversation",t),t)}registerProvider(e,t){this.registeredProviders.set(e,t)}createSession(e){const t=new yt(Et(),e,this),n=this.getProviderByConfiguration(e);if(n){const i=n(t);t.setProvider(i)}return this.sessions.set(t.id,t),this.activeSessionId=t.id,t}getProviderByConfiguration(e){const[t]=e.properties.providers||[];if(!t){console.warn("No providers registered. You most likely forgot to add a provider to the conversation component properties.");return}return this.registeredProviders.get(t)}}const oe=async r=>{r.registerComponent("conversation",Promise.resolve().then(()=>require("./conversation-49660f36.js"))),await R.getInstance(r.container)};var E=(r=>(r.User="user",r.Agent="agent",r.System="system",r))(E||{});class U{constructor(e,t,n){this.type=e,this.sender=t,this.messages=n,this.status="delivered",this.didUpdate=new m,this.actions$=new m,this.remove$=new m,this.timestamp=Date.now()}update(e){this.messages=[{items:e}],this.didUpdate.next(this)}setStatus(e){this.status=e,this.didUpdate.next(this)}remove(){this.remove$.next()}}class bt{constructor(e){this.name=e,this.print$=new m}print(e){const t=new U(E.Agent,{name:this.name},[{items:[["html",{content:e}]]}]);return this.print$.next(t),t}subscribe(){return this.print$.asObservable()}}class mt{constructor(e){this.name=e,this.print$=new m}print(e){const t=new U(E.User,{name:this.name},[{items:[["html",{content:e}]]}]);return this.print$.next(t),t}subscribe(){return this.print$.asObservable()}}class se{constructor(){this.print$=new m,this.name="system"}print(e){const t=new U(E.System,{name:this.name},[{items:[["html",{content:e}]]}]);return this.print$.next(t),t}subscribe(){return this.print$.asObservable()}}class ue{constructor(e,t){this.name=e,this.session=t,this.print$=new m,this.typingState$=new rt(!1),this.system=this.createSystem()}connect(){}onUserSubmit(e){this.print(E.User,e.text)}print(e,t){const n=new U(e,{name:""},[{items:[["html",{content:t}]]}]);return this.printEntry(n)}printEntry(e){return this.print$.next(e),e}createAgent(e){const t=new bt(e);return t.subscribe().subscribe(n=>{this.playNotification(),this.printEntry(n)}),t}createUser(e){const t=new mt(e);return t.subscribe().subscribe(n=>{this.printEntry(n)}),t}createSystem(){const e=new se;return e.subscribe().subscribe(t=>{this.printEntry(t)}),e}setTypingState(e){this.typingState$.next(e)}setToastMessage(e){this.session.component.setToastMessage(e)}isTyping(){return this.typingState$.asObservable()}actions(){return this.print$.asObservable()}complete(){this.session.completeProvider()}playNotification(){const e="https://publicpoc.blob.core.windows.net/widget-assets/notification.mp3";this.session.component.application.branding().other.disableSound||new Audio(e).play()}}exports.Agent=bt;exports.ConversationComponent=oe;exports.ConversationEntry=U;exports.ConversationMessageType=E;exports.ConversationPlatform=R;exports.ConversationProvider=ue;exports.ConversationSessionState=yt;exports.User=mt;
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=t}});function D(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}var j=function(){function r(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var e,t,n,i,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var u=g(s),a=u.next();!a.done;a=u.next()){var c=a.value;c.remove(this)}}catch(p){e={error:p}}finally{try{a&&!a.done&&(t=u.return)&&t.call(u)}finally{if(e)throw e.error}}else s.remove(this);var l=this.initialTeardown;if(h(l))try{l()}catch(p){o=p instanceof F?p.errors:[p]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var f=g(v),y=f.next();!y.done;y=f.next()){var _=y.value;try{z(_)}catch(p){o=o??[],p instanceof F?o=k(k([],C(o)),C(p.errors)):o.push(p)}}}catch(p){n={error:p}}finally{try{y&&!y.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}}if(o)throw new F(o)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)z(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&D(t,e)},r.prototype.remove=function(e){var t=this._finalizers;t&&D(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=function(){var e=new r;return e.closed=!0,e}(),r}(),Z=j.EMPTY;function N(r){return r instanceof j||r&&"closed"in r&&h(r.remove)&&h(r.add)&&h(r.unsubscribe)}function z(r){h(r)?r():r.unsubscribe()}var tt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Y={setTimeout:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i=Y.delegate;return i!=null&&i.setTimeout?i.setTimeout.apply(i,k([r,e],C(t))):setTimeout.apply(void 0,k([r,e],C(t)))},clearTimeout:function(r){var e=Y.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(r)},delegate:void 0};function et(r){Y.setTimeout(function(){throw r})}function V(){}function $(r){r()}var B=function(r){x(e,r);function e(t){var n=r.call(this)||this;return n.isStopped=!1,t?(n.destination=t,N(t)&&t.add(n)):n.destination=At,n}return e.create=function(t,n,i){return new q(t,n,i)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(j),Ot=Function.prototype.bind;function L(r,e){return Ot.call(r,e)}var Ut=function(){function r(e){this.partialObserver=e}return r.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(n){A(n)}},r.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){A(n)}else A(e)},r.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){A(t)}},r}(),q=function(r){x(e,r);function e(t,n,i){var o=r.call(this)||this,s;if(h(t)||!t)s={next:t??void 0,error:n??void 0,complete:i??void 0};else{var u;o&&tt.useDeprecatedNextContext?(u=Object.create(t),u.unsubscribe=function(){return o.unsubscribe()},s={next:t.next&&L(t.next,u),error:t.error&&L(t.error,u),complete:t.complete&&L(t.complete,u)}):s=t}return o.destination=new Ut(s),o}return e}(B);function A(r){et(r)}function Tt(r){throw r}var At={closed:!0,next:V,error:Tt,complete:V},H=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function $t(r){return r}function Ct(r){return r.length===0?$t:r.length===1?r[0]:function(t){return r.reduce(function(n,i){return i(n)},t)}}var b=function(){function r(e){e&&(this._subscribe=e)}return r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.subscribe=function(e,t,n){var i=this,o=jt(e)?e:new q(e,t,n);return $(function(){var s=i,u=s.operator,a=s.source;o.add(u?u.call(o,a):a?i._subscribe(o):i._trySubscribe(o))}),o},r.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},r.prototype.forEach=function(e,t){var n=this;return t=K(t),new t(function(i,o){var s=new q({next:function(u){try{e(u)}catch(a){o(a),s.unsubscribe()}},error:o,complete:i});n.subscribe(s)})},r.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},r.prototype[H]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Ct(e)(this)},r.prototype.toPromise=function(e){var t=this;return e=K(e),new e(function(n,i){var o;t.subscribe(function(s){return o=s},function(s){return i(s)},function(){return n(o)})})},r.create=function(e){return new r(e)},r}();function K(r){var e;return(e=r??tt.Promise)!==null&&e!==void 0?e:Promise}function kt(r){return r&&h(r.next)&&h(r.error)&&h(r.complete)}function jt(r){return r&&r instanceof B||kt(r)&&N(r)}function Rt(r){return h(r==null?void 0:r.lift)}function I(r){return function(e){if(Rt(e))return e.lift(function(t){try{return r(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function P(r,e,t,n,i){return new Ft(r,e,t,n,i)}var Ft=function(r){x(e,r);function e(t,n,i,o,s,u){var a=r.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=u,a._next=n?function(c){try{n(c)}catch(l){t.error(l)}}:r.prototype._next,a._error=o?function(c){try{o(c)}catch(l){t.error(l)}finally{this.unsubscribe()}}:r.prototype._error,a._complete=i?function(){try{i()}catch(c){t.error(c)}finally{this.unsubscribe()}}:r.prototype._complete,a}return e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;r.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e}(B),Lt=X(function(r){return function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),m=function(r){x(e,r);function e(){var t=r.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return e.prototype.lift=function(t){var n=new J(this,this);return n.operator=t,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new Lt},e.prototype.next=function(t){var n=this;$(function(){var i,o;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=g(n.currentObservers),u=s.next();!u.done;u=s.next()){var a=u.value;a.next(t)}}catch(c){i={error:c}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})},e.prototype.error=function(t){var n=this;$(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=t;for(var i=n.observers;i.length;)i.shift().error(t)}})},e.prototype.complete=function(){var t=this;$(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var n=t.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var n=this,i=this,o=i.hasError,s=i.isStopped,u=i.observers;return o||s?Z:(this.currentObservers=null,u.push(t),new j(function(){n.currentObservers=null,D(u,t)}))},e.prototype._checkFinalizedStatuses=function(t){var n=this,i=n.hasError,o=n.thrownError,s=n.isStopped;i?t.error(o):s&&t.complete()},e.prototype.asObservable=function(){var t=new b;return t.source=this,t},e.create=function(t,n){return new J(t,n)},e}(b),J=function(r){x(e,r);function e(t,n){var i=r.call(this)||this;return i.destination=t,i.source=n,i}return e.prototype.next=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,t)},e.prototype.error=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,t)},e.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},e.prototype._subscribe=function(t){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&i!==void 0?i:Z},e}(m),rt=function(r){x(e,r);function e(t){var n=r.call(this)||this;return n._value=t,n}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(t){var n=r.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},e.prototype.getValue=function(){var t=this,n=t.hasError,i=t.thrownError,o=t._value;if(n)throw i;return this._throwIfClosed(),o},e.prototype.next=function(t){r.prototype.next.call(this,this._value=t)},e}(m),Mt=new b(function(r){return r.complete()});function Dt(r){return r&&h(r.schedule)}function Yt(r){return r[r.length-1]}function Vt(r){return Dt(Yt(r))?r.pop():void 0}var nt=function(r){return r&&typeof r.length=="number"&&typeof r!="function"};function it(r){return h(r==null?void 0:r.then)}function ot(r){return h(r[H])}function st(r){return Symbol.asyncIterator&&h(r==null?void 0:r[Symbol.asyncIterator])}function ut(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function qt(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var ct=qt();function at(r){return h(r==null?void 0:r[ct])}function lt(r){return Pt(this,arguments,function(){var t,n,i,o;return W(this,function(s){switch(s.label){case 0:t=r.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,S(t.read())];case 3:return n=s.sent(),i=n.value,o=n.done,o?[4,S(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,S(i)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function ft(r){return h(r==null?void 0:r.getReader)}function O(r){if(r instanceof b)return r;if(r!=null){if(ot(r))return Bt(r);if(nt(r))return Ht(r);if(it(r))return Gt(r);if(st(r))return ht(r);if(at(r))return zt(r);if(ft(r))return Kt(r)}throw ut(r)}function Bt(r){return new b(function(e){var t=r[H]();if(h(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Ht(r){return new b(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()})}function Gt(r){return new b(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,et)})}function zt(r){return new b(function(e){var t,n;try{for(var i=g(r),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(u){t={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}e.complete()})}function ht(r){return new b(function(e){Jt(r,e).catch(function(t){return e.error(t)})})}function Kt(r){return ht(lt(r))}function Jt(r,e){var t,n,i,o;return _t(this,void 0,void 0,function(){var s,u;return W(this,function(a){switch(a.label){case 0:a.trys.push([0,5,6,11]),t=It(r),a.label=1;case 1:return[4,t.next()];case 2:if(n=a.sent(),!!n.done)return[3,4];if(s=n.value,e.next(s),e.closed)return[2];a.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=a.sent(),i={error:u},[3,11];case 6:return a.trys.push([6,,9,10]),n&&!n.done&&(o=t.return)?[4,o.call(t)]:[3,8];case 7:a.sent(),a.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function w(r,e,t,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var o=e.schedule(function(){t(),i?r.add(this.schedule(null,n)):this.unsubscribe()},n);if(r.add(o),!i)return o}function dt(r,e){return e===void 0&&(e=0),I(function(t,n){t.subscribe(P(n,function(i){return w(n,r,function(){return n.next(i)},e)},function(){return w(n,r,function(){return n.complete()},e)},function(i){return w(n,r,function(){return n.error(i)},e)}))})}function pt(r,e){return e===void 0&&(e=0),I(function(t,n){n.add(r.schedule(function(){return t.subscribe(n)},e))})}function Qt(r,e){return O(r).pipe(pt(e),dt(e))}function Wt(r,e){return O(r).pipe(pt(e),dt(e))}function Xt(r,e){return new b(function(t){var n=0;return e.schedule(function(){n===r.length?t.complete():(t.next(r[n++]),t.closed||this.schedule())})})}function Zt(r,e){return new b(function(t){var n;return w(t,e,function(){n=r[ct](),w(t,e,function(){var i,o,s;try{i=n.next(),o=i.value,s=i.done}catch(u){t.error(u);return}s?t.complete():t.next(o)},0,!0)}),function(){return h(n==null?void 0:n.return)&&n.return()}})}function vt(r,e){if(!r)throw new Error("Iterable cannot be null");return new b(function(t){w(t,e,function(){var n=r[Symbol.asyncIterator]();w(t,e,function(){n.next().then(function(i){i.done?t.complete():t.next(i.value)})},0,!0)})})}function Nt(r,e){return vt(lt(r),e)}function te(r,e){if(r!=null){if(ot(r))return Qt(r,e);if(nt(r))return Xt(r,e);if(it(r))return Wt(r,e);if(st(r))return vt(r,e);if(at(r))return Zt(r,e);if(ft(r))return Nt(r,e)}throw ut(r)}function ee(r,e){return e?te(r,e):O(r)}function re(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Vt(r);return ee(r,t)}function Q(r){return r<=0?function(){return Mt}:I(function(e,t){var n=0;e.subscribe(P(t,function(i){++n<=r&&(t.next(i),r<=n&&t.complete())}))})}function ne(r,e){return I(function(t,n){var i=null,o=0,s=!1,u=function(){return s&&!i&&n.complete()};t.subscribe(P(n,function(a){i==null||i.unsubscribe();var c=0,l=o++;O(r(a,l)).subscribe(i=P(n,function(v){return n.next(e?e(a,v,l,c++):v)},function(){i=null,u()}))},function(){s=!0,u()}))})}function ie(r){return I(function(e,t){O(r).subscribe(P(t,function(){return t.complete()},V)),!t.closed&&e.subscribe(t)})}class yt{constructor(e,t,n){this.id=e,this.component=t,this.platform=n,this.entries$=new rt([]),this.kill$=new m,this.queue=[],t.addEventListener("user-submit",i=>{if(!this.provider){console.warn("No provider activated, unable to print message to conversation.");return}this.provider.onUserSubmit(i.detail)})}write(e){this.addEntryRemoveHandler(e),this.entries$.pipe(Q(1)).subscribe(t=>{this.entries$.next([...t,e])})}entries(){return this.entries$.asObservable()}setProvider(e){this.provider=e,this.provider.actions().pipe(ie(this.kill$)).subscribe(t=>{this.write(t)}),this.provider.connect()}handover(e){const t=this.platform.registeredProviders.get(e);if(t){this.provider&&this.queue.unshift(this.provider),this.kill$.next();const n=t(this);this.setProvider(n)}}addEntryRemoveHandler(e){e.remove$.pipe(ne(()=>this.entries$),Q(1)).subscribe(t=>{this.entries$.next(t.filter(n=>n!==e))})}completeProvider(){const[e]=this.queue;e&&this.setProvider(e)}isTyping(){return this.provider?this.provider.isTyping():re(!1)}}class R{constructor(){this.sessions=new Map,this.registeredProviders=new Map,this.activeSessionId=null}static async getInstance(e){let t=await e.get("conversation");return t||(t=new R,await e.register("conversation",t),t)}registerProvider(e,t){this.registeredProviders.set(e,t)}createSession(e){const t=new yt(Et(),e,this),n=this.getProviderByConfiguration(e);if(n){const i=n(t);t.setProvider(i)}return this.sessions.set(t.id,t),this.activeSessionId=t.id,t}getProviderByConfiguration(e){const[t]=e.properties.providers||[];if(!t){console.warn("No providers registered. You most likely forgot to add a provider to the conversation component properties.");return}return this.registeredProviders.get(t)}}const oe=async r=>{r.registerComponent("conversation",Promise.resolve().then(()=>require("./conversation-3b7bba32.js"))),await R.getInstance(r.container)};var E=(r=>(r.User="user",r.Agent="agent",r.System="system",r))(E||{});class U{constructor(e,t,n){this.type=e,this.sender=t,this.messages=n,this.status="delivered",this.didUpdate=new m,this.actions$=new m,this.remove$=new m,this.timestamp=Date.now()}update(e){this.messages=[{items:e}],this.didUpdate.next(this)}setStatus(e){this.status=e,this.didUpdate.next(this)}remove(){this.remove$.next()}}class bt{constructor(e){this.name=e,this.print$=new m}print(e){const t=new U(E.Agent,{name:this.name},[{items:[["html",{content:e}]]}]);return this.print$.next(t),t}subscribe(){return this.print$.asObservable()}}class mt{constructor(e){this.name=e,this.print$=new m}print(e){const t=new U(E.User,{name:this.name},[{items:[["html",{content:e}]]}]);return this.print$.next(t),t}subscribe(){return this.print$.asObservable()}}class se{constructor(){this.print$=new m,this.name="system"}print(e){const t=new U(E.System,{name:this.name},[{items:[["html",{content:e}]]}]);return this.print$.next(t),t}subscribe(){return this.print$.asObservable()}}class ue{constructor(e,t){this.name=e,this.session=t,this.print$=new m,this.typingState$=new rt(!1),this.system=this.createSystem()}connect(){}onUserSubmit(e){this.print(E.User,e.text)}print(e,t){const n=new U(e,{name:""},[{items:[["html",{content:t}]]}]);return this.printEntry(n)}printEntry(e){return this.print$.next(e),e}createAgent(e){const t=new bt(e);return t.subscribe().subscribe(n=>{this.playNotification(),this.printEntry(n)}),t}createUser(e){const t=new mt(e);return t.subscribe().subscribe(n=>{this.printEntry(n)}),t}createSystem(){const e=new se;return e.subscribe().subscribe(t=>{this.printEntry(t)}),e}setTypingState(e){this.typingState$.next(e)}setToastMessage(e){this.session.component.setToastMessage(e)}isTyping(){return this.typingState$.asObservable()}actions(){return this.print$.asObservable()}complete(){this.session.completeProvider()}playNotification(){const e="https://publicpoc.blob.core.windows.net/widget-assets/notification.mp3";this.session.component.application.branding().other.disableSound||new Audio(e).play()}}exports.Agent=bt;exports.ConversationComponent=oe;exports.ConversationEntry=U;exports.ConversationMessageType=E;exports.ConversationPlatform=R;exports.ConversationProvider=ue;exports.ConversationSessionState=yt;exports.User=mt;
|
package/index.mjs
CHANGED
@@ -1151,7 +1151,7 @@ class H {
|
|
1151
1151
|
}
|
1152
1152
|
}
|
1153
1153
|
const se = async (r) => {
|
1154
|
-
r.registerComponent("conversation", import("./conversation-
|
1154
|
+
r.registerComponent("conversation", import("./conversation-8cbf7648.mjs")), await H.getInstance(r.container);
|
1155
1155
|
};
|
1156
1156
|
var O = /* @__PURE__ */ ((r) => (r.User = "user", r.Agent = "agent", r.System = "system", r))(O || {});
|
1157
1157
|
class C {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@telia-ace/widget-conversation-flamingo",
|
3
|
-
"version": "1.1.42-rc.
|
3
|
+
"version": "1.1.42-rc.2",
|
4
4
|
"publishConfig": {
|
5
5
|
"registry": "https://registry.npmjs.org"
|
6
6
|
},
|
@@ -9,7 +9,7 @@
|
|
9
9
|
"@lit-labs/motion": "^1.0.4",
|
10
10
|
"@teliads/icons": "^8.4.0",
|
11
11
|
"@teliads/components": "^22.1.1",
|
12
|
-
"@telia-ace/widget-core-flamingo": "1.1.42-rc.
|
12
|
+
"@telia-ace/widget-core-flamingo": "1.1.42-rc.2",
|
13
13
|
"uuid": "^9.0.1",
|
14
14
|
"lit-html": "^3.0.2",
|
15
15
|
"rxjs": "^7.8.1"
|