@telia-ace/widget-conversation-flamingo 1.1.12-rc.0 → 1.1.12-rc.2
Sign up to get free protection for your applications and to get access to all the features.
- package/conversation-8e924136.js +572 -0
- package/conversation-a518bd92.mjs +2634 -0
- package/conversation-component.d.ts +2 -0
- package/conversation-platform.d.ts +9 -49
- package/conversation-session.d.ts +11 -0
- package/conversation.d.ts +23 -0
- package/entry.d.ts +9 -0
- package/group.d.ts +7 -0
- package/index-231900d1.mjs +780 -0
- package/index-592f145b.js +3 -0
- package/index-b34ddf78.js +1 -0
- package/{index-1ea0fde8.mjs → index-b5ca9962.mjs} +320 -319
- package/index.d.ts +6 -10
- package/index.js +1 -1
- package/index.mjs +7 -9
- package/{components/conversation/ui/message-types → message-types}/message-type-html.d.ts +3 -2
- package/models/agent.d.ts +8 -0
- package/models/conversation-entry.d.ts +11 -0
- package/models/conversation-provider.d.ts +19 -0
- package/models/conversation-session-state.d.ts +13 -0
- package/models/user.d.ts +8 -0
- package/package.json +5 -6
- package/types.d.ts +9 -123
- package/agent.d.ts +0 -20
- package/components/conversation/conversation.d.ts +0 -19
- package/components/conversation/plugin.d.ts +0 -45
- package/components/conversation/ui/message-list.d.ts +0 -9
- package/components/conversation/ui/message-types/message-type-link-list.d.ts +0 -8
- package/components/conversation/ui/message-types/message-type-separator.d.ts +0 -7
- package/components/conversation/ui/message.d.ts +0 -8
- package/components/conversation/utils.d.ts +0 -1
- package/conversation-17a64990.mjs +0 -1865
- package/conversation-b2f9f789.js +0 -446
- package/conversation-controller.d.ts +0 -118
- package/conversation-history.d.ts +0 -26
- package/conversation-provider.d.ts +0 -32
- package/index-c51d4b6a.js +0 -1
- package/index-ecfa0fe7.js +0 -156
- package/index-ffd77508.mjs +0 -3923
- package/send-18482cae.mjs +0 -4
- package/send-eb8b9428.js +0 -1
- package/store.d.ts +0 -31
- package/user.d.ts +0 -9
- package/utils/custom-message.d.ts +0 -2
- package/utils/index.d.ts +0 -1
- package/utils/open-chat-widget.d.ts +0 -4
- package/utils/swap-provider.d.ts +0 -8
@@ -0,0 +1,3 @@
|
|
1
|
+
"use strict";const Q=async e=>{e.registerComponent("conversation",Promise.resolve().then(()=>require("./conversation-8e924136.js")).then(t=>t.conversation));const r=await Promise.resolve().then(()=>gt).then(t=>t.ConversationPlatform);e.container.environment.container.register("conversation",new r)};let S;const W=new Uint8Array(16);function X(){if(!S&&(S=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!S))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return S(W)}const a=[];for(let e=0;e<256;++e)a.push((e+256).toString(16).slice(1));function Z(e,r=0){return a[e[r+0]]+a[e[r+1]]+a[e[r+2]]+a[e[r+3]]+"-"+a[e[r+4]]+a[e[r+5]]+"-"+a[e[r+6]]+a[e[r+7]]+"-"+a[e[r+8]]+a[e[r+9]]+"-"+a[e[r+10]]+a[e[r+11]]+a[e[r+12]]+a[e[r+13]]+a[e[r+14]]+a[e[r+15]]}const N=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),R={randomUUID:N};function tt(e,r,t){if(R.randomUUID&&!r&&!e)return R.randomUUID();e=e||{};const n=e.random||(e.rng||X)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,r){t=t||0;for(let i=0;i<16;++i)r[t+i]=n[i];return r}return Z(n)}var C=function(e,r){return C=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])},C(e,r)};function d(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");C(e,r);function t(){this.constructor=e}e.prototype=r===null?Object.create(r):(t.prototype=r.prototype,new t)}function j(e){var r=typeof Symbol=="function"&&Symbol.iterator,t=r&&e[r],n=0;if(t)return t.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function _(e,r){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var n=t.call(e),i,o=[],s;try{for(;(r===void 0||r-- >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 E(e,r,t){if(t||arguments.length===2)for(var n=0,i=r.length,o;n<i;n++)(o||!(n in r))&&(o||(o=Array.prototype.slice.call(r,0,n)),o[n]=r[n]);return e.concat(o||Array.prototype.slice.call(r))}function p(e){return typeof e=="function"}function Y(e){var r=function(n){Error.call(n),n.stack=new Error().stack},t=e(r);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var x=Y(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription:
|
2
|
+
`+t.map(function(n,i){return i+1+") "+n.toString()}).join(`
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=t}});function A(e,r){if(e){var t=e.indexOf(r);0<=t&&e.splice(t,1)}}var P=function(){function e(r){this.initialTeardown=r,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var r,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=j(s),c=u.next();!c.done;c=u.next()){var h=c.value;h.remove(this)}}catch(l){r={error:l}}finally{try{c&&!c.done&&(t=u.return)&&t.call(u)}finally{if(r)throw r.error}}else s.remove(this);var f=this.initialTeardown;if(p(f))try{f()}catch(l){o=l instanceof x?l.errors:[l]}var F=this._finalizers;if(F){this._finalizers=null;try{for(var m=j(F),b=m.next();!b.done;b=m.next()){var J=b.value;try{B(J)}catch(l){o=o??[],l instanceof x?o=E(E([],_(o)),_(l.errors)):o.push(l)}}}catch(l){n={error:l}}finally{try{b&&!b.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}}if(o)throw new x(o)}},e.prototype.add=function(r){var t;if(r&&r!==this)if(this.closed)B(r);else{if(r instanceof e){if(r.closed||r._hasParent(this))return;r._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(r)}},e.prototype._hasParent=function(r){var t=this._parentage;return t===r||Array.isArray(t)&&t.includes(r)},e.prototype._addParent=function(r){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(r),t):t?[t,r]:r},e.prototype._removeParent=function(r){var t=this._parentage;t===r?this._parentage=null:Array.isArray(t)&&A(t,r)},e.prototype.remove=function(r){var t=this._finalizers;t&&A(t,r),r instanceof e&&r._removeParent(this)},e.EMPTY=function(){var r=new e;return r.closed=!0,r}(),e}(),H=P.EMPTY;function z(e){return e instanceof P||e&&"closed"in e&&p(e.remove)&&p(e.add)&&p(e.unsubscribe)}function B(e){p(e)?e():e.unsubscribe()}var L={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},T={setTimeout:function(e,r){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i=T.delegate;return i!=null&&i.setTimeout?i.setTimeout.apply(i,E([e,r],_(t))):setTimeout.apply(void 0,E([e,r],_(t)))},clearTimeout:function(e){var r=T.delegate;return((r==null?void 0:r.clearTimeout)||clearTimeout)(e)},delegate:void 0};function rt(e){T.setTimeout(function(){throw e})}function M(){}function w(e){e()}var D=function(e){d(r,e);function r(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,z(t)&&t.add(n)):n.destination=ot,n}return r.create=function(t,n,i){return new I(t,n,i)},r.prototype.next=function(t){this.isStopped||this._next(t)},r.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(t){this.destination.next(t)},r.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(P),et=Function.prototype.bind;function O(e,r){return et.call(e,r)}var nt=function(){function e(r){this.partialObserver=r}return e.prototype.next=function(r){var t=this.partialObserver;if(t.next)try{t.next(r)}catch(n){g(n)}},e.prototype.error=function(r){var t=this.partialObserver;if(t.error)try{t.error(r)}catch(n){g(n)}else g(r)},e.prototype.complete=function(){var r=this.partialObserver;if(r.complete)try{r.complete()}catch(t){g(t)}},e}(),I=function(e){d(r,e);function r(t,n,i){var o=e.call(this)||this,s;if(p(t)||!t)s={next:t??void 0,error:n??void 0,complete:i??void 0};else{var u;o&&L.useDeprecatedNextContext?(u=Object.create(t),u.unsubscribe=function(){return o.unsubscribe()},s={next:t.next&&O(t.next,u),error:t.error&&O(t.error,u),complete:t.complete&&O(t.complete,u)}):s=t}return o.destination=new nt(s),o}return r}(D);function g(e){rt(e)}function it(e){throw e}var ot={closed:!0,next:M,error:it,complete:M},st=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function ut(e){return e}function ct(e){return e.length===0?ut:e.length===1?e[0]:function(t){return e.reduce(function(n,i){return i(n)},t)}}var $=function(){function e(r){r&&(this._subscribe=r)}return e.prototype.lift=function(r){var t=new e;return t.source=this,t.operator=r,t},e.prototype.subscribe=function(r,t,n){var i=this,o=lt(r)?r:new I(r,t,n);return w(function(){var s=i,u=s.operator,c=s.source;o.add(u?u.call(o,c):c?i._subscribe(o):i._trySubscribe(o))}),o},e.prototype._trySubscribe=function(r){try{return this._subscribe(r)}catch(t){r.error(t)}},e.prototype.forEach=function(r,t){var n=this;return t=V(t),new t(function(i,o){var s=new I({next:function(u){try{r(u)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});n.subscribe(s)})},e.prototype._subscribe=function(r){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(r)},e.prototype[st]=function(){return this},e.prototype.pipe=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return ct(r)(this)},e.prototype.toPromise=function(r){var t=this;return r=V(r),new r(function(n,i){var o;t.subscribe(function(s){return o=s},function(s){return i(s)},function(){return n(o)})})},e.create=function(r){return new e(r)},e}();function V(e){var r;return(r=e??L.Promise)!==null&&r!==void 0?r:Promise}function at(e){return e&&p(e.next)&&p(e.error)&&p(e.complete)}function lt(e){return e&&e instanceof D||at(e)&&z(e)}function pt(e){return p(e==null?void 0:e.lift)}function ht(e){return function(r){if(pt(r))return r.lift(function(t){try{return e(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function ft(e,r,t,n,i){return new dt(e,r,t,n,i)}var dt=function(e){d(r,e);function r(t,n,i,o,s,u){var c=e.call(this,t)||this;return c.onFinalize=s,c.shouldUnsubscribe=u,c._next=n?function(h){try{n(h)}catch(f){t.error(f)}}:e.prototype._next,c._error=o?function(h){try{o(h)}catch(f){t.error(f)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=i?function(){try{i()}catch(h){t.error(h)}finally{this.unsubscribe()}}:e.prototype._complete,c}return r.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},r}(D),vt=Y(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),v=function(e){d(r,e);function r(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return r.prototype.lift=function(t){var n=new k(this,this);return n.operator=t,n},r.prototype._throwIfClosed=function(){if(this.closed)throw new vt},r.prototype.next=function(t){var n=this;w(function(){var i,o;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=j(n.currentObservers),u=s.next();!u.done;u=s.next()){var c=u.value;c.next(t)}}catch(h){i={error:h}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})},r.prototype.error=function(t){var n=this;w(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)}})},r.prototype.complete=function(){var t=this;w(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var n=t.observers;n.length;)n.shift().complete()}})},r.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(r.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),r.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},r.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},r.prototype._innerSubscribe=function(t){var n=this,i=this,o=i.hasError,s=i.isStopped,u=i.observers;return o||s?H:(this.currentObservers=null,u.push(t),new P(function(){n.currentObservers=null,A(u,t)}))},r.prototype._checkFinalizedStatuses=function(t){var n=this,i=n.hasError,o=n.thrownError,s=n.isStopped;i?t.error(o):s&&t.complete()},r.prototype.asObservable=function(){var t=new $;return t.source=this,t},r.create=function(t,n){return new k(t,n)},r}($),k=function(e){d(r,e);function r(t,n){var i=e.call(this)||this;return i.destination=t,i.source=n,i}return r.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)},r.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)},r.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)},r.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:H},r}(v),bt=function(e){d(r,e);function r(t){var n=e.call(this)||this;return n._value=t,n}return Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),r.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},r.prototype.getValue=function(){var t=this,n=t.hasError,i=t.thrownError,o=t._value;if(n)throw i;return this._throwIfClosed(),o},r.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},r}(v),yt=new $(function(e){return e.complete()});function mt(e){return e<=0?function(){return yt}:ht(function(r,t){var n=0;r.subscribe(ft(t,function(i){++n<=e&&(t.next(i),e<=n&&t.complete())}))})}class St{constructor(r,t){this.id=r,this.entries$=new bt([]),t.addEventListener("user-submit",n=>{if(!this.provider){console.warn("No provider activated, unable to print message to conversation.");return}this.provider.onUserSubmit(n.detail)})}write(r){this.entries$.pipe(mt(1)).subscribe(t=>{this.entries$.next([...t,r])})}entries(){return this.entries$.asObservable()}setProvider(r){this.provider=r,this.provider.actions().subscribe(t=>{this.write(t)})}}class q{constructor(){this.sessions=new Map,this.registeredProviders=new Map}registerProvider(r,t){this.registeredProviders.set(r,t)}createSession(r){const t=new St(tt(),r),n=this.getProviderByConfiguration(r);if(n){const i=n();t.setProvider(i)}return this.sessions.set(t.id,t),t}getProviderByConfiguration(r){const[t]=r.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 gt=Object.freeze(Object.defineProperty({__proto__:null,ConversationPlatform:q},Symbol.toStringTag,{value:"Module"}));var y=(e=>(e.User="user",e.Agent="agent",e.System="system",e))(y||{});class U{constructor(r,t,n){this.type=r,this.sender=t,this.messages=n,this.didUpdate=new v,this.timestamp=Date.now()}update(r){this.messages=[{items:r}],this.didUpdate.next(this)}}class K{constructor(r){this.name=r,this.print$=new v}print(r){const t=new U(y.Agent,{name:this.name},[{items:[["html",{content:r}]]}]);return this.print$.next(t),t}subscribe(){return this.print$.asObservable()}}class G{constructor(r){this.name=r,this.print$=new v}print(r){const t=new U(y.User,{name:this.name},[{items:[["html",{content:r}]]}]);return this.print$.next(t),t}subscribe(){return this.print$.asObservable()}}class wt{constructor(r){this.name=r,this.print$=new v}onUserSubmit(r){this.print(y.User,r.text)}print(r,t){const n=new U(r,{name:"Botsson"},[{items:[["html",{content:t}]]}]);return this.printEntry(n)}printEntry(r){return this.print$.next(r),r}createAgent(r){const t=new K(r);return t.subscribe().subscribe(n=>{this.printEntry(n)}),t}createUser(r){const t=new G(r);return t.subscribe().subscribe(n=>{this.printEntry(n)}),t}actions(){return this.print$.asObservable()}}exports.Agent=K;exports.ConversationComponent=Q;exports.ConversationEntry=U;exports.ConversationMessageType=y;exports.ConversationPlatform=q;exports.ConversationProvider=wt;exports.User=G;
|