@telia-ace/widget-conversation-flamingo 1.0.32 → 1.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent.d.ts +3 -3
- package/{conversation-18045ffc.mjs → conversation-025ea610.mjs} +1 -1
- package/{conversation-2a8210a9.js → conversation-9a2e4011.js} +1 -1
- package/conversation-platform.d.ts +1 -1
- package/{index-a12a1d3f.js → index-2a545cb2.js} +10 -10
- package/{index-8a04bebb.mjs → index-fb306d2b.mjs} +57 -59
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/package.json +16 -3
- package/types.d.ts +1 -1
package/agent.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { ConversationEntry } from './conversation-controller';
|
|
2
2
|
import { ConversationProvider } from './conversation-provider';
|
|
3
|
-
import { ConversationMessageSettings, ConverstationMessageItem
|
|
3
|
+
import { ConversationMessageSettings, ConverstationMessageItem } from './types';
|
|
4
4
|
export type AgentSettings = {
|
|
5
5
|
id?: string;
|
|
6
6
|
name?: string;
|
|
7
|
-
avatar?: string |
|
|
7
|
+
avatar?: string | symbol;
|
|
8
8
|
};
|
|
9
9
|
export declare class Agent {
|
|
10
10
|
private provider;
|
|
11
11
|
id: string;
|
|
12
12
|
name?: string;
|
|
13
|
-
avatar?: string |
|
|
13
|
+
avatar?: string | symbol;
|
|
14
14
|
constructor(provider: ConversationProvider, settings: AgentSettings);
|
|
15
15
|
print: (settings: string | ConversationMessageSettings | ConverstationMessageItem<any> | ConverstationMessageItem<any>[], options?: {
|
|
16
16
|
key?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as Dt, P as he, h as ue, i as w, n as x, t as k, E as ft, m as fe, a as It, b as at, e as lt, A as $, s as P, x as f, C as V, o as Nt, T as pe } from "./index-
|
|
1
|
+
import { p as Dt, P as he, h as ue, i as w, n as x, t as k, E as ft, m as fe, a as It, b as at, e as lt, A as $, s as P, x as f, C as V, o as Nt, T as pe } from "./index-fb306d2b.mjs";
|
|
2
2
|
import { g as $e, s as ge } from "./send-1e9780e5.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* @license
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index-2a545cb2.js"),nt=require("./send-df47dcea.js");/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -46,6 +46,6 @@ export declare class ConversationPlatform {
|
|
|
46
46
|
private invokeHandler;
|
|
47
47
|
getComponentRoute(): Promise<any>;
|
|
48
48
|
dispose(): void;
|
|
49
|
-
static handleContactMethodClick(event: any, container: Container, contactMethod: any, _callback?:
|
|
49
|
+
static handleContactMethodClick(event: any, container: Container, contactMethod: any, _callback?: () => any): Promise<void>;
|
|
50
50
|
static handleContactMethodSubmit(container: Container, contactMethod: any): Promise<any>;
|
|
51
51
|
}
|
|
@@ -12,7 +12,7 @@ ${o.map(a=>`${a.name||"<no name>"} (${a.id})
|
|
|
12
12
|
Passed consent: ${JSON.stringify(s)}`);return}const n=[$.Necessary,$.Functional,$.Analytical,$.Marketing].filter((r,o,a)=>typeof s=="number"?s>o:typeof s=="string"?a.indexOf(s)+1>o:Array.isArray(s)?s.findIndex(c=>c===o+1||c===r)>-1:!0);return n.indexOf($.Necessary)===-1&&(process.env.NODE_ENV!=="production"&&_.warn(`storagePolicyConfigurationApi: passed consent does not include category: '${$.Necessary}'. Consent has to atleast include the '${$.Necessary}' category.
|
|
13
13
|
Passed consent: ${JSON.stringify(s)}`),n.unshift($.Necessary)),wt(t.container,"storagePolicy",$.Necessary,{medium:b.Cookie,scope:bt.Tenant,duration:{days:365}}).then(r=>r(n)).then(()=>{he(t.container),t.events.dispatch("storage:policy-changed",n)})}})});class Wi{constructor(t){this.controller=t,this.cache=new Map,this.subscriptions=[];const{events:e}=t.container.get("$widget"),s=e.subscribe("data-client:fetched",(n,r)=>{r.type==="contact-method"&&this.cache.set(r.response.id,r.response)});this.subscriptions.push(s)}getConversationLogs(){return this.controller.messages.reduce((e,s)=>{const n=At(s),{content:r,type:o,sender:a,timestamp:c}=n.content,h=this.parseEntry(r,o,a,c);return h&&e.push(h),e},[])}parseEntry(t,e,s,n){const r=h=>{let l=[],d=[],u;if(Array.isArray(h)){const[v,f]=h;u=f}else u=h;return this.createMessageContent(u).length&&(d=[...d,this.createMessageContent(u)]),l=[...l,...this.createMessageOptions(u)],{messagesAsList:d,options:l}};let o=[],a=[];if(Array.isArray(t.items)){const{items:h}=t;h.forEach(l=>{const d=r(l);o=[...o,...d.options],a=[...a,...d.messagesAsList]})}else{const h=r(t);o=[...o,...h.options],a=[...a,...h.messagesAsList]}return{options:o,message:a.length?a.join(`
|
|
14
14
|
`):void 0,source:this.createMessageSource(e),alias:this.createAlias(e,s),timestamp:n}}createMessageSource(t){return t}createAlias(t,e){return t===Q.System?"system":(e==null?void 0:e.name)||"Me"}handleContactMethod(t){if(!this.cache.has(t))return;const e=this.cache.get(t);let s="";return s=this.appendText(s,`${e.clientName}:`),s=this.appendText(s,e.title),e.description&&(s=this.appendText(s,e.title)),s}getDetails(t,e=!0){if(!t)return"";const{header:s,title:n,label:r,description:o,text:a,html:c,body:h,contactMethodId:l}=t;let d="";if(l){const u=this.handleContactMethod(l.toString());u&&(d=this.appendText(d,u,e))}return s&&(d=this.appendText(d,s,e)),n&&(d=this.appendText(d,n,e)),o&&(d=this.appendText(d,o,e)),a&&(d=this.appendText(d,a,e)),r&&(d=this.appendText(d,r,e)),c&&(d=this.appendText(d,c,e)),h&&typeof h=="string"&&(d=this.appendText(d,h,e)),d}createMessageContent(t){let e="";return e=this.getDetails(t),e}createMessageOptions(t){let e=[],s=[];return Array.isArray(t==null?void 0:t.actions)?s=t.actions:typeof(t==null?void 0:t.actions)=="object"&&(s=Object.entries(t.actions).map(([n,r])=>({actionKey:n,label:r}))),s.length&&(e=s.map(n=>this.getDetails(n,!1))),e}appendText(t,e,s=!0){return s&&t.length?`${t}
|
|
15
|
-
${e}`:t.length?`${t} ${e}`:e}dispose(){this.subscriptions.forEach(t=>{t()})}}class Zt{constructor(t,e){this.provider=t,this.print=(s,n)=>{const r={name:this.name,avatar:this.avatar,id:this.id},o=At(s,n);return this.provider.createEntry(o.key,o.content,Q.Agent,r,o.timestamp)},this.typing=()=>this.provider.setTypingState({name:this.name,avatar:this.avatar}),this.id=e.id||F(),this.name=e.name,this.avatar=e.avatar}update(t){var n;const{name:e,avatar:s}=t;s===null?this.avatar=void 0:s&&(this.avatar=s),e===null?this.name=void 0:e&&(this.name=e),(n=this.provider.controller)==null||n.events.dispatch("conversation:agent-updated",{agent:this})}}class de{constructor(t,e,s){this.name=t,this.controller=s,this.subscriptions=[],this.user=s==null?void 0:s.user,this.options={silent:!1}}static create(t,e,s){return new de(t,e,s)}createAgent(t={}){var e;if(this.controller){const s=this.controller.getAgentById(t.id),n=s?new Zt(this,{...s,...t}):new Zt(this,t);return s||(e=this.controller)==null||e.events.dispatch("conversation:agent-created",{agent:n}),n}}print(t){var e;return(e=this.controller)==null?void 0:e.print(t)}setTypingState(t,e){var s;return(s=this.controller)==null?void 0:s.setTypingState(t,e)}loading(){return this.controller?this.controller.loader():()=>()=>{}}createEntry(t,e,s,n,r){var o;return(o=this.controller)==null?void 0:o.createEntry(t,e,s,n,r)}dispose(){var t;process.env.NODE_ENV!=="production"&&console.log(`conversation-provider: dispose (${this.name})`),(t=this.controller)==null||t.disposeProvider(this),this.controller=null,this.subscriptions.forEach(e=>e())}isRehydrated(){var t;return((t=this.controller)==null?void 0:t.isRehydrated())||Promise.resolve(!1)}getHistory(){var t;return((t=this.controller)==null?void 0:t.getHistory())||[]}complete(){var t;(t=this.controller)==null||t.onCompleteProvider()}setOptions(t={silent:!1}){this.options=t}onUnreadMessage(t){var e;if(this.controller){const s=(e=this.controller)==null?void 0:e.onUnreadMessage(t);return this.subscriptions.push(s),()=>{s()}}}onMounted(t){var e;if(this.controller){const s=(e=this.controller)==null?void 0:e.events.subscribe("conversation:component-mount-changed",t);return this.subscriptions.push(s),t({},this.controller.getComponentMountedState()),()=>{s()}}}}const ps=i=>`conversation-${i}`;class Bi{constructor(){this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){this._locks+=1;let t,e=new Promise(n=>t=()=>{this._locks-=1,n()}),s=this._locking.then(()=>t);return this._locking=this._locking.then(()=>e),s}}class Vi{constructor(t,e,s){this.container=t,this.enabled=s,this.locker=new Bi,this.initialStoredAgents=[],this.sessionStorageKey=ps(e.id),e.onStarted(async()=>{if(e.messages.length>0)return;const{agents:n}=await this.read(),r=[];n&&n.forEach(a=>{const c=e.providerIndex(a.providerName),h=c>-1?e.registeredProviders[c]:e.createProvider(a.providerName),l=new Zt(h,{name:a.name,avatar:a.avatar,id:a.id});r.push(l)});const{messages:o}=await this.read();o.forEach(a=>{switch(a.type){case"agent":{const c=r.find(h=>{var l;return h.id===((l=a.sender)==null?void 0:l.id)});c&&c.print(a.content.items||a.content,{key:a.key});return}case"user":{e.user.print(a.content.items||a.content,{key:a.key});return}case"system":default:e.print(a.content.items||a.content)}})}),e.onMessageCreated(async(n,r)=>{this.write(r.message,"messages")}),e.events.subscribe("conversation:agent-created",async(n,r)=>{const o={id:r.agent.id,name:r.agent.name,avatar:r.agent.avatar,providerName:r.agent.provider.name};await this.write(o,"agents")}),e.events.subscribe("conversation:agent-updated",async(n,r)=>{const{agents:o}=await this.read();await this.write([...o.map(a=>a.id===r.agent.id?{...a,name:r.agent.name,avatar:r.agent.avatar}:a)],"agents","update")})}setInitialData(t){this.initialStoredAgents=t.agents}async isRehydrated(){const{messages:t}=await this.read();return t.length>0}getStoredAgent(t){if(this.enabled)return this.initialStoredAgents.find(e=>e.id===t)}async write(t,e,s="add"){if(!this.enabled)return;const n=await this.locker.lock();return wt(this.container,this.sessionStorageKey,$.Necessary).then(async r=>{if(s==="add"){const o=await this.read();if(e==="messages"&&o.messages.findIndex(c=>c.key===t.key)>-1){n();return}let a={...o};return e==="messages"?a.messages=[...a.messages,t]:e==="agents"&&(a.agents=[...a.agents,t]),r({...o,...a}).then(()=>{n()})}if(s==="update"&&e==="agents"){const o=await this.read();return r({...o,agents:t}).then(()=>{n()})}return r(t).then(()=>{n()})})}async read(){return z(this.container,this.sessionStorageKey).then(t=>t||{messages:[],agents:[]})}}class Ji{constructor(t){this.controller=t,this.print=(e,s)=>{const n=At(e,s);return this.controller.createEntry(n.key,n.content,Q.User,void 0,n.timestamp)}}}const Gt=async(i,t,e)=>{const s=await i.getAsync("conversation"),n=await i.getAsync("components"),r=s.controllers.find(o=>o.conversation.id===t);if(r){const o=[...r.conversation.providers];o.forEach(c=>{r.conversation.setProviderOptions(c,{silent:!0})}),r.conversation.queueProviders(o),r.conversation.setProviders([e]);const a=n.components().ofType("conversation");n.write({key:"setConversationProvider",attributes:{properties:{providers:[e]}},target:a,provider:"localStorage"})}};class gs{constructor(t){this.writer=t}update(t){const e=this.getNormalizedSettings(t);this.writer(e)}remove(){this.writer(null)}getNormalizedSettings(t){return typeof t=="string"?{body:t}:t.length>-1&&typeof t=="object"?{items:t}:t}}var Q=(i=>(i.User="user",i.Agent="agent",i.System="system",i))(Q||{});const At=(i,t)=>{let e,s=(t==null?void 0:t.key)||F(),n=Date.now();return Array.isArray(i)&&i.length>-1?typeof i[0]=="string"?e={items:[i]}:e={items:i}:typeof i=="string"?e={body:i}:(i=i||{},i.type?e={...i}:(e={body:i.body,actions:i.actions,title:i.title},i.key&&(s=i.key),i.timestamp&&(n=i.timestamp),i.form,i.timestamp===null&&(n=null))),{content:e,key:s,timestamp:n}},je=(i,t)=>{if(!t)return;const e=JSON.stringify(t),s=i.findIndex(n=>e===JSON.stringify(n));if(s>-1)return i.splice(s,1)};class ms{constructor(t,e,s){this.container=t,this.id=e,this.formHandlers={},this.user=new Ji(this),this.providers=[],this.active=!1,this.queuedProviders=[],this.registeredProviders=[],this.loaders=0,this.componentMounted=!1,this.messages=[],this.typingActors=[],this.print=r=>{const o=At(r);return this.createEntry(o.key,o.content,"system",void 0,o.timestamp)};const n=t.get("$widget");this.events=n.events.createChild(this),this.store=new Vi(t,this,s.rehydrate),this.conversationHistory=new Wi(this)}setInitialStorage(t){this.store.setInitialData(t)}setProviders(t){const e=[],s=[];this.providers.reduce((n,r)=>(t.indexOf(r)===-1&&n.push(r),n),[]).forEach(n=>{const r=this.providers.indexOf(n);r>-1&&(e.push(n),this.providers.splice(r,1))}),t.forEach(n=>{this.providers.indexOf(n)===-1&&(s.push(n),this.providers.push(n))}),(s.length||e.length)&&this.events.dispatch("conversation:providers-changed",{added:s,removed:e})}createProvider(t){const e=this.providerIndex(t);if(e>-1)return this.registeredProviders[e];const s=de.create(t,this.container,this);return this.registeredProviders.push(s),s}providerIndex(t){return this.registeredProviders.findIndex(e=>e.name===t)}getAgentById(t){if(t)return this.store.getStoredAgent(t)}dispose(){this.conversationHistory.dispose(),this.registeredProviders.forEach(t=>t.dispose()),this.messages=[],this.events.dispatch("conversation:controller-disposed",this),this.active=!1}onDispose(t){return this.events.subscribe("conversation:controller-disposed",t)}onStarted(t){return this.events.subscribe("conversation:started",t)}onMessageCreated(t){return this.events.subscribe("conversation:message-created",t)}isRehydrated(){return this.store.isRehydrated()}disposeProvider(t){const e=this.providerIndex(t.name);e>-1&&this.registeredProviders.splice(e,1),this.events.dispatch("conversation:providers-changed",{removed:[t.name]}),this.registeredProviders.length||this.dispose()}onProvidersChange(t){return this.events.subscribe("conversation:providers-changed",t)}setComponentMountedState(t){this.componentMounted!==t&&(this.componentMounted=t,t&&(this.events.dispatch("conversation:unread-message",!1),this.events.dispatch("conversation:started",!0),this.active=!0),this.events.dispatch("conversation:component-mount-changed",t))}setProviderOptions(t,e){const s=this.providerIndex(t);s>-1&&this.registeredProviders[s].setOptions(e)}changeProvider(t){this.registeredProviders.find(s=>s.name===t)&&Gt(this.container,this.id,t)}queueProviders(t){this.queuedProviders=t}onCompleteProvider(){const t=this.queuedProviders.pop();t&&Gt(this.container,this.id,t)}getComponentMountedState(){return this.componentMounted}onUnreadMessage(t){return this.events.subscribe("conversation:unread-message",t)}createEntry(t,e,s,n,r){const o={key:t,content:e,type:s,sender:n||null,timestamp:r||r===null?r:Date.now()};this.messages.push(o),o.type==="agent"&&je(this.typingActors,n);const a=new gs(c=>{if(c!==null){const{timestamp:h=void 0,...l}=c;o.content=l,h&&(o.timestamp=h)}else{const h=this.messages.indexOf(o);o.content=null,h>-1&&this.messages.splice(h,1)}this.events.dispatch("conversation:message-updated",{message:o}),this.update()});return this.events.dispatch("conversation:message-created",{message:o}),this.update(),this.componentMounted||this.events.dispatch("conversation:unread-message",!0),a}update(){this.events.dispatch("conversation:updated",{messages:this.messages,loading:this.loaders>0,typingActors:this.typingActors})}getMessageStream(){return{messages:this.messages,loading:this.loaders>0,typingActors:this.typingActors}}setTypingState(t,e){return this.typingActors.indexOf(t)===-1&&(this.typingActors.push(t),this.update()),()=>{je(this.typingActors,t),this.update()}}loader(){this.loaders=this.loaders+1;let t=!1;return this.loaders===1&&this.update(),()=>{t||(t=!0,this.loaders=this.loaders-1,this.loaders===0&&this.update())}}submitForm(t,e){this.formHandlers[t]={...this.formHandlers[t],submit:e}}validateForm(t,e){this.formHandlers[t]={...this.formHandlers[t],validate:e}}getHistory(){return this.conversationHistory.getConversationLogs()}}const qi=(i,t)=>{const e=i.split("_contact");return t.widgets.get(e[0])},ue=i=>{const t=i.get("$widget"),{name:e,implementation:s}=i.get("$widget"),n=e.indexOf("_contact")>-1?qi(e,s):t,{data:r}=i.get("$settings"),{trigger:o}=n.container.get("$settings"),a=`${e.replace("_contact-method","").replace("_contact","")}_contact-method`,c=s.widgets.get(a);return c&&!o?{chatWidget:c,mainWidget:n,data:r}:{mainWidget:n,data:r}},Fi=i=>{const{chatWidget:t}=ue(i);return!!t},He=(i,t,e)=>{const{mainWidget:s,data:n,chatWidget:r}=ue(i);return r?r.state==="activated"?r.invoke("open").then(()=>{r.container.getAsync("conversation").then(o=>{o.navigateToConversationIfActive(t.id)})}):r.activate().then(()=>{const{trigger:o}=r.container.get("$settings");return o.action="hide",r.invoke("setSettings",()=>({data:n,trigger:o,activate:!0})).then(()=>r.container.getAsync("components").then(a=>{const c=a.components().ofType("contact-method");a.write({key:"setContactMethodId",attributes:{properties:{id:t.id,guideId:t.guideId}},target:c,provider:"localStorage"});const h=a.components().ofType("conversation");a.write({key:"setConversationProvider",attributes:{properties:{providers:[t.clientName]}},target:h,provider:"localStorage"})}))}).then(()=>r.invoke("attach",{key:"contact-method",triggerDOMElement:e,withRenderState:"open"})).then(()=>(wt(r.container,"activeStickyWidget",$.Necessary,{medium:b.Local,scope:bt.Implementation}).then(o=>o(r.name)),r.container.getAsync("conversation").then(o=>{o.setConversationEndedBehavior(Et.Deactivate)}).then(()=>!1))):!r},Qi=(i,t,e="conversation")=>{const{mainWidget:s,chatWidget:n}=ue(i);return s.container.getAsync("conversation").then(r=>{var o;(o=r.setConversationEndedBehavior(Et.Navigate))==null||o.then(()=>{s.container.getAsync("components").then(a=>{const c=a.components().ofType("conversation");a.write({key:"setConversationProvider",attributes:{properties:{providers:[t.clientName]}},target:c,provider:"localStorage"})})})})},lt="conversations";var Et=(i=>(i.Deactivate="deactivate",i.Navigate="navigate",i.None="none",i))(Et||{});class Ct{constructor(t,e){this.container=t,this.components=e,this.controllers=[],this.providers=[],this.disposeProviders={},this.subscriptions=[],this.storageWriter=null,this.buttonQuery=null,this.sessionInfo=null;const s=t.get("$widget");this.events=s.events.createChild(this)}initialize(){wt(this.container,lt,$.Necessary,{medium:b.Local}).then(t=>this.storageWriter=t),z(this.container,lt,b.Local).then(t=>{this.buttonQuery=this.components.components().ofType("conversation-return-button"),t&&(this.sessionInfo=t,t.id&&t.route&&this.writeToComponents({active:!0,alert:{show:!1}}))}),this.events.subscribe("conversation:ended",(t,e)=>{var s;switch((s=this.sessionInfo)==null?void 0:s.conversationEndedBehavior){case"deactivate":this.container.get("$widget").deactivate();break}this.writeToComponents({active:!1}),this.sessionInfo=null,this.storageWriter&&this.storageWriter()})}addSubscription(t){this.subscriptions.push(t)}static getInstance(t,e="conversation"){return nt(t)(()=>t.getAsync(e).then(s=>{let n=s;return n||ae.getInstance(t).then(r=>(n=new Ct(t,r),n.initialize(),t.registerAsync(e,()=>n),n))}))}setConversationEndedBehavior(t){return z(this.container,lt,b.Local).then(e=>{let s=e;return s?s.conversationEndedBehavior=t:s={conversationEndedBehavior:t},this.sessionInfo=s,this.storageWriter&&this.storageWriter(this.sessionInfo)||Promise.resolve()})}async createController(t,e){const s=ps(t),{agents:n}=await z(this.container,s)||{agents:[]},r=this.controllers.findIndex(a=>a.conversation.id===t);let o;return r>-1?o=this.controllers[r].conversation:o=new ms(this.container,t,e),o.setInitialStorage({agents:n||[]}),o}registerProvider(t,e){const s={name:t,handler:e};this.providers.push(s),this.controllers.filter(n=>n.conversation.providers.indexOf(t)>-1).forEach(n=>{this.invokeHandler(s,n)})}registerController(t,e){const s=this.controllers.findIndex(r=>r.conversation.id===t.id);let n;if(s<0){n={conversation:t,component:e},this.controllers.push(n);const r=o=>{o&&this.providers.filter(a=>o.indexOf(a.name)>-1).forEach(a=>{this.invokeHandler(a,n)})};return this.subscriptions.push(t.onDispose((o,a)=>{const c=this.controllers.findIndex(h=>h.conversation===a);c>-1&&this.controllers.splice(c,1),this.components.components().ofType("conversation-return-button").select().writeProperties({active:!1}),this.events.dispatch("conversation:ended",{},{bubbles:!0})})),this.subscriptions.push(t.onProvidersChange((o,a)=>{const{added:c,removed:h=[]}=a;h.forEach(l=>{(this.disposeProviders[l]||[]).forEach(d=>{d()})}),r(c)})),this.subscriptions.push(t.onStarted((o,a)=>{var h;const c={id:t.id,conversationEndedBehavior:(h=this.sessionInfo)==null?void 0:h.conversationEndedBehavior};this.sessionInfo=c,this.storageWriter&&this.storageWriter(c),this.writeToComponents({active:a})})),this.subscriptions.push(t.onUnreadMessage((o,a)=>{this.events.dispatch("conversation:unread-message",a),this.writeToComponents({alert:{show:a}})})),r(t.providers),!0}return n=this.controllers[s],!1}writeToComponents(t,e="conversationReturnButtonState"){this.buttonQuery&&this.components.write({key:"conversationReturnButtonState",attributes:{properties:t},target:this.buttonQuery,provider:"localStorage"})}invokeHandler(t,e){const s=t.handler(e.conversation.createProvider(t.name),e.component);s&&(this.disposeProviders[t.name]||(this.disposeProviders[t.name]=[]),this.disposeProviders[t.name].push(s))}getComponentRoute(){return z(this.container,lt,b.Local).then(t=>t==null?void 0:t.route)}dispose(){Object.keys(this.disposeProviders).forEach(t=>{this.disposeProviders[t].forEach(e=>{e()})}),this.subscriptions.forEach(t=>{t()}),this.controllers=[],this.providers=[]}static async handleContactMethodClick(t,e,s,n){if(Fi(e)){t.preventDefault();let r=document.getElementById("humany-dynamic-anchor");r||(r=document.createElement("a"),r.setAttribute("href","#"),r.id="humany-dynamic-anchor",document.body.appendChild(r)),He(e,s,r)}He(e,s)}static async handleContactMethodSubmit(t,e){var s,n;return(n=(s=e==null?void 0:e.body.form.meta)==null?void 0:s.conversation)!=null&&n.id?Gt(t,e.body.form.meta.conversation.id,e.clientName):Qi(t,e)}}/**
|
|
15
|
+
${e}`:t.length?`${t} ${e}`:e}dispose(){this.subscriptions.forEach(t=>{t()})}}class Zt{constructor(t,e){this.provider=t,this.print=(s,n)=>{const r={name:this.name,avatar:this.avatar,id:this.id},o=At(s,n);return this.provider.createEntry(o.key,o.content,Q.Agent,r,o.timestamp)},this.typing=()=>this.provider.setTypingState({name:this.name,avatar:this.avatar}),this.id=e.id||F(),this.name=e.name,this.avatar=e.avatar}update(t){var n;const{name:e,avatar:s}=t;s===null?this.avatar=void 0:s&&(this.avatar=s),e===null?this.name=void 0:e&&(this.name=e),(n=this.provider.controller)==null||n.events.dispatch("conversation:agent-updated",{agent:this})}}class de{constructor(t,e,s){this.name=t,this.controller=s,this.subscriptions=[],this.user=s==null?void 0:s.user,this.options={silent:!1}}static create(t,e,s){return new de(t,e,s)}createAgent(t={}){var e;if(this.controller){const s=this.controller.getAgentById(t.id),n=s?new Zt(this,{...s,...t}):new Zt(this,t);return s||(e=this.controller)==null||e.events.dispatch("conversation:agent-created",{agent:n}),n}}print(t){var e;return(e=this.controller)==null?void 0:e.print(t)}setTypingState(t,e){var s;return(s=this.controller)==null?void 0:s.setTypingState(t,e)}loading(){return this.controller?this.controller.loader():()=>()=>{}}createEntry(t,e,s,n,r){var o;return(o=this.controller)==null?void 0:o.createEntry(t,e,s,n,r)}dispose(){var t;process.env.NODE_ENV!=="production"&&console.log(`conversation-provider: dispose (${this.name})`),(t=this.controller)==null||t.disposeProvider(this),this.controller=null,this.subscriptions.forEach(e=>e())}isRehydrated(){var t;return((t=this.controller)==null?void 0:t.isRehydrated())||Promise.resolve(!1)}getHistory(){var t;return((t=this.controller)==null?void 0:t.getHistory())||[]}complete(){var t;(t=this.controller)==null||t.onCompleteProvider()}setOptions(t={silent:!1}){this.options=t}onUnreadMessage(t){var e;if(this.controller){const s=(e=this.controller)==null?void 0:e.onUnreadMessage(t);return this.subscriptions.push(s),()=>{s()}}}onMounted(t){var e;if(this.controller){const s=(e=this.controller)==null?void 0:e.events.subscribe("conversation:component-mount-changed",t);return this.subscriptions.push(s),t({},this.controller.getComponentMountedState()),()=>{s()}}}}const ps=i=>`conversation-${i}`;class Bi{constructor(){this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){this._locks+=1;let t;const e=new Promise(n=>t=()=>{this._locks-=1,n()}),s=this._locking.then(()=>t);return this._locking=this._locking.then(()=>e),s}}class Vi{constructor(t,e,s){this.container=t,this.enabled=s,this.locker=new Bi,this.initialStoredAgents=[],this.sessionStorageKey=ps(e.id),e.onStarted(async()=>{if(e.messages.length>0)return;const{agents:n}=await this.read(),r=[];n&&n.forEach(a=>{const c=e.providerIndex(a.providerName),h=c>-1?e.registeredProviders[c]:e.createProvider(a.providerName),l=new Zt(h,{name:a.name,avatar:a.avatar,id:a.id});r.push(l)});const{messages:o}=await this.read();o.forEach(a=>{switch(a.type){case"agent":{const c=r.find(h=>{var l;return h.id===((l=a.sender)==null?void 0:l.id)});c&&c.print(a.content.items||a.content,{key:a.key});return}case"user":{e.user.print(a.content.items||a.content,{key:a.key});return}case"system":default:e.print(a.content.items||a.content)}})}),e.onMessageCreated(async(n,r)=>{this.write(r.message,"messages")}),e.events.subscribe("conversation:agent-created",async(n,r)=>{const o={id:r.agent.id,name:r.agent.name,avatar:r.agent.avatar,providerName:r.agent.provider.name};await this.write(o,"agents")}),e.events.subscribe("conversation:agent-updated",async(n,r)=>{const{agents:o}=await this.read();await this.write([...o.map(a=>a.id===r.agent.id?{...a,name:r.agent.name,avatar:r.agent.avatar}:a)],"agents","update")})}setInitialData(t){this.initialStoredAgents=t.agents}async isRehydrated(){const{messages:t}=await this.read();return t.length>0}getStoredAgent(t){if(this.enabled)return this.initialStoredAgents.find(e=>e.id===t)}async write(t,e,s="add"){if(!this.enabled)return;const n=await this.locker.lock();return wt(this.container,this.sessionStorageKey,$.Necessary).then(async r=>{if(s==="add"){const o=await this.read();if(e==="messages"&&o.messages.findIndex(c=>c.key===t.key)>-1){n();return}const a={...o};return e==="messages"?a.messages=[...a.messages,t]:e==="agents"&&(a.agents=[...a.agents,t]),r({...o,...a}).then(()=>{n()})}if(s==="update"&&e==="agents"){const o=await this.read();return r({...o,agents:t}).then(()=>{n()})}return r(t).then(()=>{n()})})}async read(){return z(this.container,this.sessionStorageKey).then(t=>t||{messages:[],agents:[]})}}class Ji{constructor(t){this.controller=t,this.print=(e,s)=>{const n=At(e,s);return this.controller.createEntry(n.key,n.content,Q.User,void 0,n.timestamp)}}}const Gt=async(i,t,e)=>{const s=await i.getAsync("conversation"),n=await i.getAsync("components"),r=s.controllers.find(o=>o.conversation.id===t);if(r){const o=[...r.conversation.providers];o.forEach(c=>{r.conversation.setProviderOptions(c,{silent:!0})}),r.conversation.queueProviders(o),r.conversation.setProviders([e]);const a=n.components().ofType("conversation");n.write({key:"setConversationProvider",attributes:{properties:{providers:[e]}},target:a,provider:"localStorage"})}};class gs{constructor(t){this.writer=t}update(t){const e=this.getNormalizedSettings(t);this.writer(e)}remove(){this.writer(null)}getNormalizedSettings(t){return typeof t=="string"?{body:t}:t.length>-1&&typeof t=="object"?{items:t}:t}}var Q=(i=>(i.User="user",i.Agent="agent",i.System="system",i))(Q||{});const At=(i,t)=>{let e,s=(t==null?void 0:t.key)||F(),n=Date.now();return Array.isArray(i)&&i.length>-1?typeof i[0]=="string"?e={items:[i]}:e={items:i}:typeof i=="string"?e={body:i}:(i=i||{},i.type?e={...i}:(e={body:i.body,actions:i.actions,title:i.title},i.key&&(s=i.key),i.timestamp&&(n=i.timestamp),i.form,i.timestamp===null&&(n=null))),{content:e,key:s,timestamp:n}},je=(i,t)=>{if(!t)return;const e=JSON.stringify(t),s=i.findIndex(n=>e===JSON.stringify(n));if(s>-1)return i.splice(s,1)};class ms{constructor(t,e,s){this.container=t,this.id=e,this.formHandlers={},this.user=new Ji(this),this.providers=[],this.active=!1,this.queuedProviders=[],this.registeredProviders=[],this.loaders=0,this.componentMounted=!1,this.messages=[],this.typingActors=[],this.print=r=>{const o=At(r);return this.createEntry(o.key,o.content,"system",void 0,o.timestamp)};const n=t.get("$widget");this.events=n.events.createChild(this),this.store=new Vi(t,this,s.rehydrate),this.conversationHistory=new Wi(this)}setInitialStorage(t){this.store.setInitialData(t)}setProviders(t){const e=[],s=[];this.providers.reduce((n,r)=>(t.indexOf(r)===-1&&n.push(r),n),[]).forEach(n=>{const r=this.providers.indexOf(n);r>-1&&(e.push(n),this.providers.splice(r,1))}),t.forEach(n=>{this.providers.indexOf(n)===-1&&(s.push(n),this.providers.push(n))}),(s.length||e.length)&&this.events.dispatch("conversation:providers-changed",{added:s,removed:e})}createProvider(t){const e=this.providerIndex(t);if(e>-1)return this.registeredProviders[e];const s=de.create(t,this.container,this);return this.registeredProviders.push(s),s}providerIndex(t){return this.registeredProviders.findIndex(e=>e.name===t)}getAgentById(t){if(t)return this.store.getStoredAgent(t)}dispose(){this.conversationHistory.dispose(),this.registeredProviders.forEach(t=>t.dispose()),this.messages=[],this.events.dispatch("conversation:controller-disposed",this),this.active=!1}onDispose(t){return this.events.subscribe("conversation:controller-disposed",t)}onStarted(t){return this.events.subscribe("conversation:started",t)}onMessageCreated(t){return this.events.subscribe("conversation:message-created",t)}isRehydrated(){return this.store.isRehydrated()}disposeProvider(t){const e=this.providerIndex(t.name);e>-1&&this.registeredProviders.splice(e,1),this.events.dispatch("conversation:providers-changed",{removed:[t.name]}),this.registeredProviders.length||this.dispose()}onProvidersChange(t){return this.events.subscribe("conversation:providers-changed",t)}setComponentMountedState(t){this.componentMounted!==t&&(this.componentMounted=t,t&&(this.events.dispatch("conversation:unread-message",!1),this.events.dispatch("conversation:started",!0),this.active=!0),this.events.dispatch("conversation:component-mount-changed",t))}setProviderOptions(t,e){const s=this.providerIndex(t);s>-1&&this.registeredProviders[s].setOptions(e)}changeProvider(t){this.registeredProviders.find(s=>s.name===t)&&Gt(this.container,this.id,t)}queueProviders(t){this.queuedProviders=t}onCompleteProvider(){const t=this.queuedProviders.pop();t&&Gt(this.container,this.id,t)}getComponentMountedState(){return this.componentMounted}onUnreadMessage(t){return this.events.subscribe("conversation:unread-message",t)}createEntry(t,e,s,n,r){const o={key:t,content:e,type:s,sender:n||null,timestamp:r||r===null?r:Date.now()};this.messages.push(o),o.type==="agent"&&je(this.typingActors,n);const a=new gs(c=>{if(c!==null){const{timestamp:h=void 0,...l}=c;o.content=l,h&&(o.timestamp=h)}else{const h=this.messages.indexOf(o);o.content=null,h>-1&&this.messages.splice(h,1)}this.events.dispatch("conversation:message-updated",{message:o}),this.update()});return this.events.dispatch("conversation:message-created",{message:o}),this.update(),this.componentMounted||this.events.dispatch("conversation:unread-message",!0),a}update(){this.events.dispatch("conversation:updated",{messages:this.messages,loading:this.loaders>0,typingActors:this.typingActors})}getMessageStream(){return{messages:this.messages,loading:this.loaders>0,typingActors:this.typingActors}}setTypingState(t,e){return this.typingActors.indexOf(t)===-1&&(this.typingActors.push(t),this.update()),()=>{je(this.typingActors,t),this.update()}}loader(){this.loaders=this.loaders+1;let t=!1;return this.loaders===1&&this.update(),()=>{t||(t=!0,this.loaders=this.loaders-1,this.loaders===0&&this.update())}}submitForm(t,e){this.formHandlers[t]={...this.formHandlers[t],submit:e}}validateForm(t,e){this.formHandlers[t]={...this.formHandlers[t],validate:e}}getHistory(){return this.conversationHistory.getConversationLogs()}}const qi=(i,t)=>{const e=i.split("_contact");return t.widgets.get(e[0])},ue=i=>{const t=i.get("$widget"),{name:e,implementation:s}=i.get("$widget"),n=e.indexOf("_contact")>-1?qi(e,s):t,{data:r}=i.get("$settings"),{trigger:o}=n.container.get("$settings"),a=`${e.replace("_contact-method","").replace("_contact","")}_contact-method`,c=s.widgets.get(a);return c&&!o?{chatWidget:c,mainWidget:n,data:r}:{mainWidget:n,data:r}},Fi=i=>{const{chatWidget:t}=ue(i);return!!t},He=(i,t,e)=>{const{mainWidget:s,data:n,chatWidget:r}=ue(i);return r?r.state==="activated"?r.invoke("open").then(()=>{r.container.getAsync("conversation").then(o=>{o.navigateToConversationIfActive(t.id)})}):r.activate().then(()=>{const{trigger:o}=r.container.get("$settings");return o.action="hide",r.invoke("setSettings",()=>({data:n,trigger:o,activate:!0})).then(()=>r.container.getAsync("components").then(a=>{const c=a.components().ofType("contact-method");a.write({key:"setContactMethodId",attributes:{properties:{id:t.id,guideId:t.guideId}},target:c,provider:"localStorage"});const h=a.components().ofType("conversation");a.write({key:"setConversationProvider",attributes:{properties:{providers:[t.clientName]}},target:h,provider:"localStorage"})}))}).then(()=>r.invoke("attach",{key:"contact-method",triggerDOMElement:e,withRenderState:"open"})).then(()=>(wt(r.container,"activeStickyWidget",$.Necessary,{medium:b.Local,scope:bt.Implementation}).then(o=>o(r.name)),r.container.getAsync("conversation").then(o=>{o.setConversationEndedBehavior(Et.Deactivate)}).then(()=>!1))):!r},Qi=(i,t,e="conversation")=>{const{mainWidget:s,chatWidget:n}=ue(i);return s.container.getAsync("conversation").then(r=>{var o;(o=r.setConversationEndedBehavior(Et.Navigate))==null||o.then(()=>{s.container.getAsync("components").then(a=>{const c=a.components().ofType("conversation");a.write({key:"setConversationProvider",attributes:{properties:{providers:[t.clientName]}},target:c,provider:"localStorage"})})})})},lt="conversations";var Et=(i=>(i.Deactivate="deactivate",i.Navigate="navigate",i.None="none",i))(Et||{});class Ct{constructor(t,e){this.container=t,this.components=e,this.controllers=[],this.providers=[],this.disposeProviders={},this.subscriptions=[],this.storageWriter=null,this.buttonQuery=null,this.sessionInfo=null;const s=t.get("$widget");this.events=s.events.createChild(this)}initialize(){wt(this.container,lt,$.Necessary,{medium:b.Local}).then(t=>this.storageWriter=t),z(this.container,lt,b.Local).then(t=>{this.buttonQuery=this.components.components().ofType("conversation-return-button"),t&&(this.sessionInfo=t,t.id&&t.route&&this.writeToComponents({active:!0,alert:{show:!1}}))}),this.events.subscribe("conversation:ended",(t,e)=>{var s;switch((s=this.sessionInfo)==null?void 0:s.conversationEndedBehavior){case"deactivate":this.container.get("$widget").deactivate();break}this.writeToComponents({active:!1}),this.sessionInfo=null,this.storageWriter&&this.storageWriter()})}addSubscription(t){this.subscriptions.push(t)}static getInstance(t,e="conversation"){return nt(t)(()=>t.getAsync(e).then(s=>{let n=s;return n||ae.getInstance(t).then(r=>(n=new Ct(t,r),n.initialize(),t.registerAsync(e,()=>n),n))}))}setConversationEndedBehavior(t){return z(this.container,lt,b.Local).then(e=>{let s=e;return s?s.conversationEndedBehavior=t:s={conversationEndedBehavior:t},this.sessionInfo=s,this.storageWriter&&this.storageWriter(this.sessionInfo)||Promise.resolve()})}async createController(t,e){const s=ps(t),{agents:n}=await z(this.container,s)||{agents:[]},r=this.controllers.findIndex(a=>a.conversation.id===t);let o;return r>-1?o=this.controllers[r].conversation:o=new ms(this.container,t,e),o.setInitialStorage({agents:n||[]}),o}registerProvider(t,e){const s={name:t,handler:e};this.providers.push(s),this.controllers.filter(n=>n.conversation.providers.indexOf(t)>-1).forEach(n=>{this.invokeHandler(s,n)})}registerController(t,e){const s=this.controllers.findIndex(r=>r.conversation.id===t.id);let n;if(s<0){n={conversation:t,component:e},this.controllers.push(n);const r=o=>{o&&this.providers.filter(a=>o.indexOf(a.name)>-1).forEach(a=>{this.invokeHandler(a,n)})};return this.subscriptions.push(t.onDispose((o,a)=>{const c=this.controllers.findIndex(h=>h.conversation===a);c>-1&&this.controllers.splice(c,1),this.components.components().ofType("conversation-return-button").select().writeProperties({active:!1}),this.events.dispatch("conversation:ended",{},{bubbles:!0})})),this.subscriptions.push(t.onProvidersChange((o,a)=>{const{added:c,removed:h=[]}=a;h.forEach(l=>{(this.disposeProviders[l]||[]).forEach(d=>{d()})}),r(c)})),this.subscriptions.push(t.onStarted((o,a)=>{var h;const c={id:t.id,conversationEndedBehavior:(h=this.sessionInfo)==null?void 0:h.conversationEndedBehavior};this.sessionInfo=c,this.storageWriter&&this.storageWriter(c),this.writeToComponents({active:a})})),this.subscriptions.push(t.onUnreadMessage((o,a)=>{this.events.dispatch("conversation:unread-message",a),this.writeToComponents({alert:{show:a}})})),r(t.providers),!0}return n=this.controllers[s],!1}writeToComponents(t,e="conversationReturnButtonState"){this.buttonQuery&&this.components.write({key:"conversationReturnButtonState",attributes:{properties:t},target:this.buttonQuery,provider:"localStorage"})}invokeHandler(t,e){const s=t.handler(e.conversation.createProvider(t.name),e.component);s&&(this.disposeProviders[t.name]||(this.disposeProviders[t.name]=[]),this.disposeProviders[t.name].push(s))}getComponentRoute(){return z(this.container,lt,b.Local).then(t=>t==null?void 0:t.route)}dispose(){Object.keys(this.disposeProviders).forEach(t=>{this.disposeProviders[t].forEach(e=>{e()})}),this.subscriptions.forEach(t=>{t()}),this.controllers=[],this.providers=[]}static async handleContactMethodClick(t,e,s,n){if(Fi(e)){t.preventDefault();let r=document.getElementById("humany-dynamic-anchor");r||(r=document.createElement("a"),r.setAttribute("href","#"),r.id="humany-dynamic-anchor",document.body.appendChild(r)),He(e,s,r)}He(e,s)}static async handleContactMethodSubmit(t,e){var s,n;return(n=(s=e==null?void 0:e.body.form.meta)==null?void 0:s.conversation)!=null&&n.id?Gt(t,e.body.form.meta.conversation.id,e.clientName):Qi(t,e)}}/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2019 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -50,14 +50,14 @@ ${e}`:t.length?`${t} ${e}`:e}dispose(){this.subscriptions.forEach(t=>{t()})}}cla
|
|
|
50
50
|
* @license
|
|
51
51
|
* Copyright 2018 Google LLC
|
|
52
52
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
53
|
-
*/const Ps=Es(class extends Cs{constructor(i){var t;if(super(i),i.type!==As.ATTRIBUTE||i.name!=="class"||((t=i.strings)===null||t===void 0?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(i){return" "+Object.keys(i).filter(t=>i[t]).join(" ")+" "}update(i,[t]){var e,s;if(this.it===void 0){this.it=new Set,i.strings!==void 0&&(this.nt=new Set(i.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(const r in t)t[r]&&!(!((e=this.nt)===null||e===void 0)&&e.has(r))&&this.it.add(r);return this.render(t)}const n=i.element.classList;this.it.forEach(r=>{r in t||(n.remove(r),this.it.delete(r))});for(const r in t){const o=!!t[r];o===this.it.has(r)||!((s=this.nt)===null||s===void 0)&&s.has(r)||(o?(n.add(r),this.it.add(r)):(n.remove(r),this.it.delete(r)))}return I}}),y=(i,t,e)=>{i&&e.style.setProperty(t,i)},xs=(i,t)=>{var e,s,n,r,o,a,c,h,l,d,u;y((e=i.colors)==null?void 0:e.primary,"--primary-color",t),y((s=i.colors)==null?void 0:s.secondary,"--secondary-color",t),y((n=i.colors)==null?void 0:n.text,"--text-color",t),y((r=i.colors)==null?void 0:r.link,"--link-color",t),y((o=i.colors)==null?void 0:o.gray,"--gray-color",t),y((a=i.colors)==null?void 0:a.grayDark,"--gray-dark-color",t),y((c=i.spacing)==null?void 0:c.xs,"--spacing-xs",t),y((h=i.spacing)==null?void 0:h.sm,"--spacing-sm",t),y((l=i.spacing)==null?void 0:l.md,"--spacing-md",t),y((d=i.spacing)==null?void 0:d.lg,"--spacing-lg",t),y((u=i.spacing)==null?void 0:u.xl,"--spacing-xl",t),y(i.boxShadow,"--box-shadow",t),y(i.borderRadius,"--border-radius",t),y(i.borderRadiusSm,"--border-radius-sm",t),y(i.fontFamily,"--font-family",t)};var un=Object.defineProperty,pn=Object.getOwnPropertyDescriptor,ot=(i,t,e,s)=>{for(var n=s>1?void 0:s?pn(t,e):t,r=i.length-1,o;r>=0;r--)(o=i[r])&&(n=(s?o(t,e,n):o(n))||n);return s&&n&&un(t,e,n),n};class K extends B{constructor(){super(...arguments),this.active=!1,this.loaded=!1}async connectedCallback(){super.connectedCallback(),this.icon=await this._renderSymbol(this.symbol),this.loaded=!0,this._applyBranding()}_toggleActive(){this.active=!this.active}_applyBranding(){var s;const t=((s=this.container)==null?void 0:s.get("$settings"))??{},e=t==null?void 0:t.components[t==null?void 0:t.entry];e&&xs(e.context,this)}async _renderSymbol(t){const e=async
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
*/const Ps=Es(class extends Cs{constructor(i){var t;if(super(i),i.type!==As.ATTRIBUTE||i.name!=="class"||((t=i.strings)===null||t===void 0?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(i){return" "+Object.keys(i).filter(t=>i[t]).join(" ")+" "}update(i,[t]){var e,s;if(this.it===void 0){this.it=new Set,i.strings!==void 0&&(this.nt=new Set(i.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(const r in t)t[r]&&!(!((e=this.nt)===null||e===void 0)&&e.has(r))&&this.it.add(r);return this.render(t)}const n=i.element.classList;this.it.forEach(r=>{r in t||(n.remove(r),this.it.delete(r))});for(const r in t){const o=!!t[r];o===this.it.has(r)||!((s=this.nt)===null||s===void 0)&&s.has(r)||(o?(n.add(r),this.it.add(r)):(n.remove(r),this.it.delete(r)))}return I}}),y=(i,t,e)=>{i&&e.style.setProperty(t,i)},xs=(i,t)=>{var e,s,n,r,o,a,c,h,l,d,u;y((e=i.colors)==null?void 0:e.primary,"--primary-color",t),y((s=i.colors)==null?void 0:s.secondary,"--secondary-color",t),y((n=i.colors)==null?void 0:n.text,"--text-color",t),y((r=i.colors)==null?void 0:r.link,"--link-color",t),y((o=i.colors)==null?void 0:o.gray,"--gray-color",t),y((a=i.colors)==null?void 0:a.grayDark,"--gray-dark-color",t),y((c=i.spacing)==null?void 0:c.xs,"--spacing-xs",t),y((h=i.spacing)==null?void 0:h.sm,"--spacing-sm",t),y((l=i.spacing)==null?void 0:l.md,"--spacing-md",t),y((d=i.spacing)==null?void 0:d.lg,"--spacing-lg",t),y((u=i.spacing)==null?void 0:u.xl,"--spacing-xl",t),y(i.boxShadow,"--box-shadow",t),y(i.borderRadius,"--border-radius",t),y(i.borderRadiusSm,"--border-radius-sm",t),y(i.fontFamily,"--font-family",t)};var un=Object.defineProperty,pn=Object.getOwnPropertyDescriptor,ot=(i,t,e,s)=>{for(var n=s>1?void 0:s?pn(t,e):t,r=i.length-1,o;r>=0;r--)(o=i[r])&&(n=(s?o(t,e,n):o(n))||n);return s&&n&&un(t,e,n),n};class K extends B{constructor(){super(...arguments),this.active=!1,this.loaded=!1}async connectedCallback(){super.connectedCallback(),this.icon=await this._renderSymbol(this.symbol),this.loaded=!0,this._applyBranding()}_toggleActive(){this.active=!this.active}_applyBranding(){var s;const t=((s=this.container)==null?void 0:s.get("$settings"))??{},e=t==null?void 0:t.components[t==null?void 0:t.entry];e&&xs(e.context,this)}async _renderSymbol(t){const e=async s=>await Promise.resolve().then(()=>require("./index-17fa2121.js")).then(r=>r[s]);if(t){const{type:s,content:n}=t;switch(s){case"Telia":{const r=await e(n);return r?X`<telia-icon
|
|
54
|
+
class="trigger-icon"
|
|
55
|
+
svg=${r.svg}
|
|
56
|
+
size="lg"
|
|
57
|
+
></telia-icon>`:g}case"FontAwesome":return X`<i class="trigger-fa-icon fa fa-${n}"></i>`;case"Uri":return X`<i
|
|
58
|
+
class="trigger-custom-icon"
|
|
59
|
+
style="background: url(${n}) no-repeat center center;background-size: contain;"
|
|
60
|
+
></i>`;default:return g}}}render(){return X`<button
|
|
61
61
|
class=${Ps({trigger:!0,active:this.active,rendered:this.loaded})}
|
|
62
62
|
@click=${this._toggleActive}
|
|
63
63
|
>
|
|
@@ -157,4 +157,4 @@ ${e}`:t.length?`${t} ${e}`:e}dispose(){this.subscriptions.forEach(t=>{t()})}}cla
|
|
|
157
157
|
align-items: center;
|
|
158
158
|
fill: var(--trigger-text-color, #fff);
|
|
159
159
|
}
|
|
160
|
-
`];ot([xt({attribute:!1})],K.prototype,"symbol",2);ot([xt({attribute:!1})],K.prototype,"container",2);ot([kt()],K.prototype,"active",2);ot([kt()],K.prototype,"loaded",2);ot([kt()],K.prototype,"icon",2);const gn=(i,t,e,s,n)=>i.getAsync("componentResolver").then(r=>(r.registerComponent(t,e),Ei(i,t,s||(()=>{}),t,n)))
|
|
160
|
+
`];ot([xt({attribute:!1})],K.prototype,"symbol",2);ot([xt({attribute:!1})],K.prototype,"container",2);ot([kt()],K.prototype,"active",2);ot([kt()],K.prototype,"loaded",2);ot([kt()],K.prototype,"icon",2);const gn=(i,t,e,s,n)=>i.getAsync("componentResolver").then(r=>(r.registerComponent(t,e),Ei(i,t,s||(()=>{}),t,n))),mn=(i,t)=>i.reduce((e,s,n)=>{var o,a;const r={...s,content:[{...s.content,key:s.key}]};if(e.length>0&&s.type!==Q.System){const c=e[e.length-1];if((!t&&t!==0||Math.abs(c.timestamp-s.timestamp)<t)&&((o=c.sender)==null?void 0:o.name)===((a=s.sender)==null?void 0:a.name)&&c.type===s.type)return c.timestamp=s.timestamp,c.content.push({...s.content,key:s.key}),e}return e.push(r),e},[]),vn=async i=>gn(i,"conversation",Promise.resolve().then(()=>require("./conversation-9a2e4011.js")),async t=>{const e=await Ct.getInstance(i),{rehydrate:s=!1}=t.properties(),n="component",r=await e.createController(n,{rehydrate:s}),o=e.registerController(r,t),a=3*60*1e3,c=d=>{const{providers:u=[]}=d;if(u){const p=Array.isArray(u)?u:[u];return r.setProviders(p),p}};c(t.properties(c)),r.setComponentMountedState(!0);const h=d=>{const{loading:u,typingActors:p,messages:v}=d;t.writeProperties({loading:u,typingActors:p,messages:mn(v,a)})};h(r.getMessageStream()),o&&(t.writeProperties({conversationControllerId:r.id}),t.actions.create("user-submit",(d,u)=>{if(u){const{preventDefault:p,validationPromise:v}=u;if(p){v&&v().then(f=>{f&&r.user.print(f)});return}}r.user.print(d.text)}),t.actions.create("user-typing",(d,u)=>{}),t.actions.create("form",(d,u)=>{}),t.actions.create("action",(d,u)=>{}),t.actions.create("overlay-mounted",(d,u)=>{}),t.actions.create("show-overlay",(d,u)=>{t.writeProperties({overlay:{conversation:!1,secondary:!1}})}),t.actions.create("hide-overlay",(d,u)=>{t.writeProperties({overlay:null})}),t.actions.create("show-overlay-conversation",(d,u)=>{t.writeProperties({overlay:{conversation:!0,secondary:!1}})}),t.actions.create("hide-overlay-conversation",(d,u)=>{t.writeProperties({overlay:{conversation:!1,secondary:!1}})}));const l=r.events.subscribe("conversation:updated",(d,u)=>{h(u)});return()=>{r.setComponentMountedState(!1),l(),r.active||h({messages:[],typingActors:[],loading:!1})}},{reuseController:!0});var ks=(i=>(i.LinkList="link-list",i.Separator="separator",i.ButtonList="button-list",i.ItemList="item-list",i.Text="text",i.HTML="html",i.VideoRequest="video-request",i))(ks||{});const fn=async(i,t,e)=>{await e};exports.A=g;exports.ConversationComponent=vn;exports.ConversationController=ms;exports.ConversationEndedBehavior=Et;exports.ConversationEntry=gs;exports.ConversationMessageListItemType=ks;exports.ConversationMessageType=Q;exports.ConversationPlatform=Ct;exports.Et=Ai;exports.P=$t;exports.T=I;exports.e=Es;exports.ht=F;exports.i=fs;exports.i$1=Cs;exports.mapBranding=xs;exports.n=xt;exports.o=Ps;exports.pt=ae;exports.registerCustomMessageComponent=fn;exports.s=B;exports.t=kt;exports.t$1=As;exports.x=X;
|
|
@@ -192,11 +192,11 @@ const kt = (i, t, e, ...s) => {
|
|
|
192
192
|
warn: (e, ...s) => kt(t, "warning", e, ...s),
|
|
193
193
|
error: (e, ...s) => kt(t, "error", e, ...s)
|
|
194
194
|
};
|
|
195
|
-
},
|
|
195
|
+
}, g = J(), Zt = (() => {
|
|
196
196
|
let i = 0;
|
|
197
197
|
return () => ++i;
|
|
198
198
|
})(), Gt = (i, t, e) => {
|
|
199
|
-
const s =
|
|
199
|
+
const s = g(i).touchQueue.get(t);
|
|
200
200
|
s && s.forEach((n) => {
|
|
201
201
|
n(e, i);
|
|
202
202
|
});
|
|
@@ -232,21 +232,21 @@ let Es = class {
|
|
|
232
232
|
* @param parent Parent container this should be a child of.
|
|
233
233
|
*/
|
|
234
234
|
constructor(t, e, s) {
|
|
235
|
-
this.owner = t, this.name = e, this.parent = s,
|
|
235
|
+
this.owner = t, this.name = e, this.parent = s, g(this).resolvers = /* @__PURE__ */ new Map(), g(this).touchQueue = /* @__PURE__ */ new Map(), g(this).children = [];
|
|
236
236
|
}
|
|
237
237
|
/**
|
|
238
238
|
* Deletes an existing resolver by its unique id.
|
|
239
239
|
* @param id Resolver id.
|
|
240
240
|
*/
|
|
241
241
|
delete(t) {
|
|
242
|
-
const e =
|
|
243
|
-
return s ? (
|
|
242
|
+
const e = g(this).resolvers, s = Array.from(e.values()).find((n) => n.id === t);
|
|
243
|
+
return s ? (g(this).touchQueue.delete(s.key), Promise.resolve(e.delete(s.key))) : this.parent ? this.parent.delete(t) : Promise.resolve(!1);
|
|
244
244
|
}
|
|
245
245
|
/**
|
|
246
246
|
* Clears the `Container` and any child containers by deleteing all registered resolvers.
|
|
247
247
|
*/
|
|
248
248
|
clear() {
|
|
249
|
-
const t =
|
|
249
|
+
const t = g(this).resolvers, e = Array.from(t.values());
|
|
250
250
|
return Promise.all(e.map((s) => {
|
|
251
251
|
if (s.constructed)
|
|
252
252
|
return Promise.resolve(s.resolve()).then((n) => {
|
|
@@ -254,7 +254,7 @@ let Es = class {
|
|
|
254
254
|
return n.dispose.call(n, this, s);
|
|
255
255
|
});
|
|
256
256
|
})).then(() => {
|
|
257
|
-
e.forEach((s) => this.delete(s.id)),
|
|
257
|
+
e.forEach((s) => this.delete(s.id)), g(this).children.forEach((s) => s.clear());
|
|
258
258
|
});
|
|
259
259
|
}
|
|
260
260
|
/**
|
|
@@ -262,7 +262,7 @@ let Es = class {
|
|
|
262
262
|
*/
|
|
263
263
|
detach() {
|
|
264
264
|
if (this.parent) {
|
|
265
|
-
const t =
|
|
265
|
+
const t = g(this.parent).children, e = t.indexOf(this);
|
|
266
266
|
e > -1 && (t.splice(e, 1), delete this.parent);
|
|
267
267
|
}
|
|
268
268
|
}
|
|
@@ -272,13 +272,13 @@ let Es = class {
|
|
|
272
272
|
* @param handler Handler function for touching the resolved value.
|
|
273
273
|
*/
|
|
274
274
|
touch(t, e) {
|
|
275
|
-
const s =
|
|
275
|
+
const s = g(this).resolvers.get(t);
|
|
276
276
|
if (s && s.constructed)
|
|
277
277
|
Promise.resolve(s.resolve()).then((n) => {
|
|
278
278
|
e(n, this);
|
|
279
279
|
});
|
|
280
280
|
else {
|
|
281
|
-
const n =
|
|
281
|
+
const n = g(this).touchQueue;
|
|
282
282
|
let r = n.get(t);
|
|
283
283
|
r || (r = [], n.set(t, r)), r.push(e);
|
|
284
284
|
}
|
|
@@ -290,10 +290,10 @@ let Es = class {
|
|
|
290
290
|
* @param factory Value factory.
|
|
291
291
|
*/
|
|
292
292
|
registerAsync(t, e) {
|
|
293
|
-
const s =
|
|
293
|
+
const s = g(this).resolvers.get(t);
|
|
294
294
|
s && !s.async && process.env.NODE_ENV !== "production" && w(this).warn(`Mismatching resolver type. You are registering an async resolver with a key ('${t}') previously used by a non-async resolver.`);
|
|
295
295
|
const n = new Es(t, e, s, this);
|
|
296
|
-
return
|
|
296
|
+
return g(this).resolvers.set(t, n), n.id;
|
|
297
297
|
}
|
|
298
298
|
/**
|
|
299
299
|
* Registers a factory resolver for constructing the value to be resolved.
|
|
@@ -301,10 +301,10 @@ let Es = class {
|
|
|
301
301
|
* @param factory Value factory.
|
|
302
302
|
*/
|
|
303
303
|
registerFactory(t, e) {
|
|
304
|
-
const s =
|
|
304
|
+
const s = g(this).resolvers.get(t);
|
|
305
305
|
s && s.async && process.env.NODE_ENV !== "production" && w(this).warn(`Mismatching resolver type. You are registering a non-async resolver with a key ('${t}') previously used by an async resolver.`);
|
|
306
306
|
const n = new Cs(t, e, s, this);
|
|
307
|
-
return
|
|
307
|
+
return g(this).resolvers.set(t, n), n.id;
|
|
308
308
|
}
|
|
309
309
|
/**
|
|
310
310
|
* Registers an synchronous resolver.
|
|
@@ -312,17 +312,17 @@ let Es = class {
|
|
|
312
312
|
* @param value Value.
|
|
313
313
|
*/
|
|
314
314
|
register(t, e) {
|
|
315
|
-
const s =
|
|
315
|
+
const s = g(this).resolvers.get(t);
|
|
316
316
|
s && s.async && process.env.NODE_ENV !== "production" && w(this).warn(`Mismatching resolver type. You are registering a non-async resolver with a key ('${t}') previously used by an async resolver.`);
|
|
317
317
|
const n = new Ps(t, e, s, this);
|
|
318
|
-
return
|
|
318
|
+
return g(this).resolvers.set(t, n), n.id;
|
|
319
319
|
}
|
|
320
320
|
/**
|
|
321
321
|
* Gets the value for a synchronous resolver.
|
|
322
322
|
* @param key Key of resolver to get.
|
|
323
323
|
*/
|
|
324
324
|
get(t) {
|
|
325
|
-
const e =
|
|
325
|
+
const e = g(this).resolvers.get(t);
|
|
326
326
|
if (e)
|
|
327
327
|
return e.async && process.env.NODE_ENV !== "production" && w(this).warn(`You are retrieving an async value (with key '${t}') by the non-async function 'container.get(key)'. This will not be supported in future versions. Use 'container.getAsync(key) instead.'`), e.resolve();
|
|
328
328
|
if (this.parent)
|
|
@@ -333,7 +333,7 @@ let Es = class {
|
|
|
333
333
|
* @param key Key of resolver to get.
|
|
334
334
|
*/
|
|
335
335
|
getAsync(t) {
|
|
336
|
-
const e =
|
|
336
|
+
const e = g(this).resolvers.get(t);
|
|
337
337
|
if (e) {
|
|
338
338
|
if (!e.async)
|
|
339
339
|
throw process.env.NODE_ENV !== "production" && w(this).warn(`You are retrieving a non-async value (with key '${t}') by the async function 'container.getAsync(key)'.Use 'container.get(key) instead.'`), "Mismatching resolver type";
|
|
@@ -351,7 +351,7 @@ let Es = class {
|
|
|
351
351
|
}
|
|
352
352
|
createChild(t, e) {
|
|
353
353
|
const s = new Ye(t, e, this);
|
|
354
|
-
return
|
|
354
|
+
return g(this).children.push(s), s;
|
|
355
355
|
}
|
|
356
356
|
}, ye = class {
|
|
357
357
|
/**
|
|
@@ -2320,7 +2320,8 @@ class Ii {
|
|
|
2320
2320
|
}
|
|
2321
2321
|
lock() {
|
|
2322
2322
|
this._locks += 1;
|
|
2323
|
-
let t
|
|
2323
|
+
let t;
|
|
2324
|
+
const e = new Promise(
|
|
2324
2325
|
(n) => t = () => {
|
|
2325
2326
|
this._locks -= 1, n();
|
|
2326
2327
|
}
|
|
@@ -2423,7 +2424,7 @@ class Mi {
|
|
|
2423
2424
|
n();
|
|
2424
2425
|
return;
|
|
2425
2426
|
}
|
|
2426
|
-
|
|
2427
|
+
const a = {
|
|
2427
2428
|
...o
|
|
2428
2429
|
};
|
|
2429
2430
|
return e === "messages" ? a.messages = [...a.messages, t] : e === "agents" && (a.agents = [...a.agents, t]), r({
|
|
@@ -3204,7 +3205,7 @@ R[Kt] = !0, R.elementProperties = /* @__PURE__ */ new Map(), R.elementStyles = [
|
|
|
3204
3205
|
var Lt;
|
|
3205
3206
|
const ft = window, B = ft.trustedTypes, ze = B ? B.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, Yt = "$lit$", N = `lit$${(Math.random() + "").slice(9)}$`, vs = "?" + N, Ji = `<${vs}>`, j = document, G = () => j.createComment(""), X = (i) => i === null || typeof i != "object" && typeof i != "function", fs = Array.isArray, Fi = (i) => fs(i) || typeof (i == null ? void 0 : i[Symbol.iterator]) == "function", Rt = `[
|
|
3206
3207
|
\f\r]`, Q = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, We = /-->/g, Be = />/g, I = RegExp(`>|${Rt}(?:([^\\s"'>=/]+)(${Rt}*=${Rt}*(?:[^
|
|
3207
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), Ve = /'/g, Je = /"/g, ys = /^(?:script|style|textarea|title)$/i, qi = (i) => (t, ...e) => ({ _$litType$: i, strings: t, values: e }), lt = qi(1), H = Symbol.for("lit-noChange"),
|
|
3208
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), Ve = /'/g, Je = /"/g, ys = /^(?:script|style|textarea|title)$/i, qi = (i) => (t, ...e) => ({ _$litType$: i, strings: t, values: e }), lt = qi(1), H = Symbol.for("lit-noChange"), m = Symbol.for("lit-nothing"), Fe = /* @__PURE__ */ new WeakMap(), D = j.createTreeWalker(j, 129, null, !1);
|
|
3208
3209
|
function $s(i, t) {
|
|
3209
3210
|
if (!Array.isArray(i) || !i.hasOwnProperty("raw"))
|
|
3210
3211
|
throw Error("invalid template strings array");
|
|
@@ -3315,7 +3316,7 @@ class Ki {
|
|
|
3315
3316
|
class nt {
|
|
3316
3317
|
constructor(t, e, s, n) {
|
|
3317
3318
|
var r;
|
|
3318
|
-
this.type = 2, this._$AH =
|
|
3319
|
+
this.type = 2, this._$AH = m, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = n, this._$Cp = (r = n == null ? void 0 : n.isConnected) === null || r === void 0 || r;
|
|
3319
3320
|
}
|
|
3320
3321
|
get _$AU() {
|
|
3321
3322
|
var t, e;
|
|
@@ -3333,7 +3334,7 @@ class nt {
|
|
|
3333
3334
|
return this._$AB;
|
|
3334
3335
|
}
|
|
3335
3336
|
_$AI(t, e = this) {
|
|
3336
|
-
t = V(this, t, e), X(t) ? t ===
|
|
3337
|
+
t = V(this, t, e), X(t) ? t === m || t == null || t === "" ? (this._$AH !== m && this._$AR(), this._$AH = m) : t !== this._$AH && t !== H && this._(t) : t._$litType$ !== void 0 ? this.g(t) : t.nodeType !== void 0 ? this.$(t) : Fi(t) ? this.T(t) : this._(t);
|
|
3337
3338
|
}
|
|
3338
3339
|
k(t) {
|
|
3339
3340
|
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
@@ -3342,7 +3343,7 @@ class nt {
|
|
|
3342
3343
|
this._$AH !== t && (this._$AR(), this._$AH = this.k(t));
|
|
3343
3344
|
}
|
|
3344
3345
|
_(t) {
|
|
3345
|
-
this._$AH !==
|
|
3346
|
+
this._$AH !== m && X(this._$AH) ? this._$AA.nextSibling.data = t : this.$(j.createTextNode(t)), this._$AH = t;
|
|
3346
3347
|
}
|
|
3347
3348
|
g(t) {
|
|
3348
3349
|
var e;
|
|
@@ -3380,7 +3381,7 @@ class nt {
|
|
|
3380
3381
|
}
|
|
3381
3382
|
class At {
|
|
3382
3383
|
constructor(t, e, s, n, r) {
|
|
3383
|
-
this.type = 1, this._$AH =
|
|
3384
|
+
this.type = 1, this._$AH = m, this._$AN = void 0, this.element = t, this.name = e, this._$AM = n, this.options = r, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = m;
|
|
3384
3385
|
}
|
|
3385
3386
|
get tagName() {
|
|
3386
3387
|
return this.element.tagName;
|
|
@@ -3397,12 +3398,12 @@ class At {
|
|
|
3397
3398
|
const a = t;
|
|
3398
3399
|
let c, h;
|
|
3399
3400
|
for (t = r[0], c = 0; c < r.length - 1; c++)
|
|
3400
|
-
h = V(this, a[s + c], e, c), h === H && (h = this._$AH[c]), o || (o = !X(h) || h !== this._$AH[c]), h ===
|
|
3401
|
+
h = V(this, a[s + c], e, c), h === H && (h = this._$AH[c]), o || (o = !X(h) || h !== this._$AH[c]), h === m ? t = m : t !== m && (t += (h ?? "") + r[c + 1]), this._$AH[c] = h;
|
|
3401
3402
|
}
|
|
3402
3403
|
o && !n && this.j(t);
|
|
3403
3404
|
}
|
|
3404
3405
|
j(t) {
|
|
3405
|
-
t ===
|
|
3406
|
+
t === m ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
3406
3407
|
}
|
|
3407
3408
|
}
|
|
3408
3409
|
class Yi extends At {
|
|
@@ -3410,7 +3411,7 @@ class Yi extends At {
|
|
|
3410
3411
|
super(...arguments), this.type = 3;
|
|
3411
3412
|
}
|
|
3412
3413
|
j(t) {
|
|
3413
|
-
this.element[this.name] = t ===
|
|
3414
|
+
this.element[this.name] = t === m ? void 0 : t;
|
|
3414
3415
|
}
|
|
3415
3416
|
}
|
|
3416
3417
|
const Zi = B ? B.emptyScript : "";
|
|
@@ -3419,7 +3420,7 @@ class Gi extends At {
|
|
|
3419
3420
|
super(...arguments), this.type = 4;
|
|
3420
3421
|
}
|
|
3421
3422
|
j(t) {
|
|
3422
|
-
t && t !==
|
|
3423
|
+
t && t !== m ? this.element.setAttribute(this.name, Zi) : this.element.removeAttribute(this.name);
|
|
3423
3424
|
}
|
|
3424
3425
|
}
|
|
3425
3426
|
class Xi extends At {
|
|
@@ -3428,9 +3429,9 @@ class Xi extends At {
|
|
|
3428
3429
|
}
|
|
3429
3430
|
_$AI(t, e = this) {
|
|
3430
3431
|
var s;
|
|
3431
|
-
if ((t = (s = V(this, t, e, 0)) !== null && s !== void 0 ? s :
|
|
3432
|
+
if ((t = (s = V(this, t, e, 0)) !== null && s !== void 0 ? s : m) === H)
|
|
3432
3433
|
return;
|
|
3433
|
-
const n = this._$AH, r = t ===
|
|
3434
|
+
const n = this._$AH, r = t === m && n !== m || t.capture !== n.capture || t.once !== n.once || t.passive !== n.passive, o = t !== m && (n === m || r);
|
|
3434
3435
|
r && this.element.removeEventListener(this.name, this, n), o && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
|
3435
3436
|
}
|
|
3436
3437
|
handleEvent(t) {
|
|
@@ -3609,28 +3610,28 @@ class F extends Y {
|
|
|
3609
3610
|
e && hn(e.context, this);
|
|
3610
3611
|
}
|
|
3611
3612
|
async _renderSymbol(t) {
|
|
3612
|
-
const e = async (
|
|
3613
|
-
if (
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3613
|
+
const e = async (s) => await import("./index-17239ac6.mjs").then((r) => r[s]);
|
|
3614
|
+
if (t) {
|
|
3615
|
+
const { type: s, content: n } = t;
|
|
3616
|
+
switch (s) {
|
|
3617
|
+
case "Telia": {
|
|
3618
|
+
const r = await e(n);
|
|
3619
|
+
return r ? lt`<telia-icon
|
|
3620
|
+
class="trigger-icon"
|
|
3621
|
+
svg=${r.svg}
|
|
3622
|
+
size="lg"
|
|
3623
|
+
></telia-icon>` : m;
|
|
3624
|
+
}
|
|
3625
|
+
case "FontAwesome":
|
|
3626
|
+
return lt`<i class="trigger-fa-icon fa fa-${n}"></i>`;
|
|
3627
|
+
case "Uri":
|
|
3628
|
+
return lt`<i
|
|
3629
|
+
class="trigger-custom-icon"
|
|
3630
|
+
style="background: url(${n}) no-repeat center center;background-size: contain;"
|
|
3631
|
+
></i>`;
|
|
3632
|
+
default:
|
|
3633
|
+
return m;
|
|
3624
3634
|
}
|
|
3625
|
-
case "FontAwesome":
|
|
3626
|
-
return lt`<i class="trigger-fa-icon fa fa-${n}"></i>`;
|
|
3627
|
-
case "Uri":
|
|
3628
|
-
return lt`<i
|
|
3629
|
-
class="trigger-custom-icon"
|
|
3630
|
-
style="background: url(${n}) no-repeat center center;background-size: contain;"
|
|
3631
|
-
></i>`;
|
|
3632
|
-
default:
|
|
3633
|
-
return g;
|
|
3634
3635
|
}
|
|
3635
3636
|
}
|
|
3636
3637
|
render() {
|
|
@@ -3760,9 +3761,7 @@ rt([
|
|
|
3760
3761
|
pe()
|
|
3761
3762
|
], F.prototype, "icon", 2);
|
|
3762
3763
|
const un = (i, t, e, s, n) => i.getAsync("componentResolver").then((r) => (r.registerComponent(t, e), gi(i, t, s || (() => {
|
|
3763
|
-
}), t, n)))
|
|
3764
|
-
console.log("test1232342532422");
|
|
3765
|
-
const pn = (i, t) => i.reduce((e, s, n) => {
|
|
3764
|
+
}), t, n))), pn = (i, t) => i.reduce((e, s, n) => {
|
|
3766
3765
|
var o, a;
|
|
3767
3766
|
const r = {
|
|
3768
3767
|
...s,
|
|
@@ -3777,7 +3776,7 @@ const pn = (i, t) => i.reduce((e, s, n) => {
|
|
|
3777
3776
|
}, []), Mn = async (i) => un(
|
|
3778
3777
|
i,
|
|
3779
3778
|
"conversation",
|
|
3780
|
-
import("./conversation-
|
|
3779
|
+
import("./conversation-025ea610.mjs"),
|
|
3781
3780
|
async (t) => {
|
|
3782
3781
|
const e = await he.getInstance(i), { rehydrate: s = !1 } = t.properties(), n = "component", r = await e.createController(n, { rehydrate: s }), o = e.registerController(
|
|
3783
3782
|
r,
|
|
@@ -3858,9 +3857,8 @@ var gn = /* @__PURE__ */ ((i) => (i.LinkList = "link-list", i.Separator = "separ
|
|
|
3858
3857
|
const Dn = async (i, t, e) => {
|
|
3859
3858
|
await e;
|
|
3860
3859
|
};
|
|
3861
|
-
console.log("tes3t123");
|
|
3862
3860
|
export {
|
|
3863
|
-
|
|
3861
|
+
m as A,
|
|
3864
3862
|
it as C,
|
|
3865
3863
|
On as E,
|
|
3866
3864
|
te as P,
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-2a545cb2.js");exports.ConversationComponent=e.ConversationComponent;exports.ConversationController=e.ConversationController;exports.ConversationEndedBehavior=e.ConversationEndedBehavior;exports.ConversationEntry=e.ConversationEntry;exports.ConversationMessageListItemType=e.ConversationMessageListItemType;exports.ConversationMessageType=e.ConversationMessageType;exports.ConversationPlatform=e.ConversationPlatform;exports.registerCustomMessageComponent=e.registerCustomMessageComponent;
|
package/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/widget-conversation-flamingo",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"
|
|
3
|
+
"version": "1.0.42",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"registry": "https://registry.npmjs.org"
|
|
6
|
+
},
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@telia-ace/widget-utilities": "^1.0.16",
|
|
9
|
+
"lit": "^2.8.0",
|
|
10
|
+
"@lit-labs/motion": "^1.0.4",
|
|
11
|
+
"@teliads/icons": "^8.4.0",
|
|
12
|
+
"@teliads/components": "^22.1.1",
|
|
13
|
+
"@telia-ace/widget-runtime-flamingo": "^1.0.42",
|
|
14
|
+
"@webprovisions/platform": "^1.1.3",
|
|
15
|
+
"@telia-ace/widget-core": "^1.0.27",
|
|
16
|
+
"@telia-ace/widget-services": "^1.0.27"
|
|
17
|
+
},
|
|
5
18
|
"main": "./index.js",
|
|
6
19
|
"module": "./index.mjs",
|
|
7
20
|
"typings": "./index.d.ts"
|
|
8
|
-
}
|
|
21
|
+
}
|
package/types.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export type ConversationMessageUpdateSettings = ConversationMessageContent & {
|
|
|
49
49
|
};
|
|
50
50
|
export type ConversationMessageSender = {
|
|
51
51
|
name?: string;
|
|
52
|
-
avatar?: string |
|
|
52
|
+
avatar?: string | symbol;
|
|
53
53
|
id?: string;
|
|
54
54
|
};
|
|
55
55
|
export declare enum ConversationMessageListType {
|