@meetelise/chat
Advanced tools
Comparing version 1.0.0-rc.13 to 1.0.0-rc.14
@@ -61,4 +61,4 @@ import fetchBuildingInfo from "./fetchBuildingInfo"; | ||
restartConversation() { | ||
this.building.then(b => { | ||
restartConversation(b, resolveTheme(b, this.theme)); | ||
Promise.all([this.building, this.popup]).then(([b, p]) => { | ||
restartConversation(p, b, resolveTheme(b, this.theme)); | ||
}); | ||
@@ -73,3 +73,3 @@ } | ||
this.close(); | ||
this.building.then(b => { | ||
Promise.all([this.building, this.popup]).then(([b, p]) => { | ||
const resolvedTheme = this.theme = resolveTheme(b, { | ||
@@ -79,3 +79,3 @@ ...this.theme, | ||
}); | ||
updateTheme(b, resolvedTheme); | ||
updateTheme(p, b, resolvedTheme); | ||
this.open(); | ||
@@ -82,0 +82,0 @@ }); |
@@ -11,3 +11,3 @@ import Talk from 'talkjs'; | ||
export declare function createTalkJSPopup(building: Building, theme: Theme): Talk.Popup; | ||
export declare function restartConversation(building: Building, theme: Theme): void; | ||
export declare function updateTheme(building: Building, theme: Theme): void; | ||
export declare function restartConversation(popup: Talk.Popup, building: Building, theme: Theme): void; | ||
export declare function updateTheme(popup: Talk.Popup, building: Building, theme: Theme): void; |
import Talk from 'talkjs'; | ||
import getAvatarUrl from './getAvatarUrl'; | ||
import { getChatID, createChatID } from './chatID'; | ||
let me; | ||
let session; | ||
export async function initialize() { | ||
await Talk.ready; | ||
me = new Talk.User({ | ||
const me = new Talk.User({ | ||
id: 'anonymous', | ||
@@ -28,8 +27,6 @@ name: 'Me', | ||
} | ||
export function restartConversation(building, theme) { | ||
const popup = session.getPopups()[0]; | ||
export function restartConversation(popup, building, theme) { | ||
popup.select(createConversation(building, theme, createChatID())); | ||
} | ||
export function updateTheme(building, theme) { | ||
const popup = session.getPopups()[0]; | ||
export function updateTheme(popup, building, theme) { | ||
popup.select(createConversation(building, theme, getChatID())); | ||
@@ -49,3 +46,3 @@ } | ||
conversation.subject = theme.chatTitle; | ||
conversation.setParticipant(me); | ||
conversation.setParticipant(session.me); | ||
conversation.setParticipant(agent); | ||
@@ -52,0 +49,0 @@ conversation.custom = { |
{ | ||
"name": "@meetelise/chat", | ||
"version": "1.0.0-rc.13", | ||
"version": "1.0.0-rc.14", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -45,4 +45,4 @@ import Talk from 'talkjs'; | ||
restartConversation(): void { | ||
this.building.then(b => { | ||
restartConversation(b, resolveTheme(b, this.theme)); | ||
Promise.all([this.building, this.popup]).then(([b, p]) => { | ||
restartConversation(p, b, resolveTheme(b, this.theme)); | ||
}); | ||
@@ -58,3 +58,3 @@ } | ||
this.close(); | ||
this.building.then(b => { | ||
Promise.all([this.building, this.popup]).then(([b, p]) => { | ||
const resolvedTheme = this.theme = resolveTheme(b, { | ||
@@ -64,3 +64,3 @@ ...this.theme, | ||
}); | ||
updateTheme(b, resolvedTheme); | ||
updateTheme(p, b, resolvedTheme); | ||
this.open(); | ||
@@ -67,0 +67,0 @@ }); |
@@ -7,3 +7,2 @@ import Talk from 'talkjs'; | ||
let me: Talk.User; | ||
let session: Talk.Session; | ||
@@ -13,3 +12,3 @@ | ||
await Talk.ready; | ||
me = new Talk.User({ | ||
const me = new Talk.User({ | ||
id: 'anonymous', | ||
@@ -36,9 +35,7 @@ name: 'Me', | ||
export function restartConversation(building: Building, theme: Theme) { | ||
const popup = session.getPopups()[0]; | ||
export function restartConversation(popup: Talk.Popup, building: Building, theme: Theme) { | ||
popup.select(createConversation(building, theme, createChatID())); | ||
} | ||
export function updateTheme(building: Building, theme: Theme) { | ||
const popup = session.getPopups()[0]; | ||
export function updateTheme(popup: Talk.Popup, building: Building, theme: Theme) { | ||
popup.select(createConversation(building, theme, getChatID())); | ||
@@ -58,3 +55,3 @@ } | ||
conversation.subject = theme.chatTitle; | ||
conversation.setParticipant(me); | ||
conversation.setParticipant(session.me); | ||
conversation.setParticipant(agent); | ||
@@ -61,0 +58,0 @@ conversation.custom = { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52410
874