quiq-chat
Advanced tools
Comparing version 1.6.1 to 1.6.2
@@ -258,3 +258,3 @@ 'use strict'; | ||
var version = "1.6.1"; | ||
var version = "1.6.2"; | ||
@@ -601,13 +601,26 @@ // | ||
case 0: | ||
_context2.prev = 0; | ||
_context2.next = 3; | ||
if (!_this2.initialized) { | ||
_context2.next = 2; | ||
break; | ||
} | ||
return _context2.abrupt('return'); | ||
case 2: | ||
_context2.prev = 2; | ||
_this2.initialized = true; | ||
// Order Matters here. Ensure we successfully complete this fetchConversation request before connecting to | ||
// the websocket below! | ||
_context2.next = 6; | ||
return login(); | ||
case 3: | ||
case 6: | ||
onInit(); | ||
_context2.next = 6; | ||
_context2.next = 9; | ||
return getConversation(); | ||
case 6: | ||
case 9: | ||
_ref3 = _context2.sent; | ||
@@ -624,6 +637,6 @@ messages = _ref3.messages; | ||
disconnectSocket(); // Ensure we only have one websocket connection open | ||
_context2.next = 14; | ||
_context2.next = 17; | ||
return fetchWebsocketInfo(); | ||
case 14: | ||
case 17: | ||
wsInfo = _context2.sent; | ||
@@ -644,8 +657,8 @@ | ||
} | ||
_context2.next = 23; | ||
_context2.next = 26; | ||
break; | ||
case 19: | ||
_context2.prev = 19; | ||
_context2.t0 = _context2['catch'](0); | ||
case 22: | ||
_context2.prev = 22; | ||
_context2.t0 = _context2['catch'](2); | ||
@@ -658,3 +671,3 @@ disconnectSocket(); | ||
case 23: | ||
case 26: | ||
case 'end': | ||
@@ -664,3 +677,3 @@ return _context2.stop(); | ||
} | ||
}, _callee2, _this2, [[0, 19]]); | ||
}, _callee2, _this2, [[2, 22]]); | ||
})); | ||
@@ -670,2 +683,3 @@ | ||
disconnectSocket(); | ||
_this2.initialized = false; | ||
}; | ||
@@ -934,2 +948,3 @@ | ||
this.connected = false; | ||
this.initialized = false; | ||
@@ -936,0 +951,0 @@ setGlobals({ |
{ | ||
"name": "quiq-chat", | ||
"version": "1.6.1", | ||
"version": "1.6.2", | ||
"description": "Library to help with network requests to create a webchat client for Quiq Messaging", | ||
@@ -5,0 +5,0 @@ "main": "build/quiq-chat.js", |
@@ -29,2 +29,3 @@ // @flow | ||
userIsRegistered: boolean; | ||
initialized: boolean; | ||
@@ -39,2 +40,3 @@ constructor(host: string, contactPoint: string) { | ||
this.connected = false; | ||
this.initialized = false; | ||
@@ -103,3 +105,8 @@ setGlobals({ | ||
start = async (): Promise<?QuiqChatClient> => { | ||
// Avoid race conditions by only running start() once | ||
if (this.initialized) return; | ||
try { | ||
this.initialized = true; | ||
// Order Matters here. Ensure we successfully complete this fetchConversation request before connecting to | ||
@@ -144,2 +151,3 @@ // the websocket below! | ||
disconnectSocket(); | ||
this.initialized = false; | ||
}; | ||
@@ -146,0 +154,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
726116
59
8275