crisp-api 8.0.2 → 8.1.0

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/CHANGELOG.md CHANGED
@@ -1,6 +1,30 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## v8.1.0
5
+
6
+ ### Bug Fixes
7
+
8
+ * Fixed an issue where `CrispClient.rebindSocket` and `CrispClient._connectLoopback` base methods would not work due to undefined `this` references.
9
+
10
+ ## v8.0.3
11
+
12
+ ### Changes
13
+
14
+ * Updated `socket.io-client` dependency to latest.
15
+
16
+ ## v8.0.2
17
+
18
+ ### Changes
19
+
20
+ * Updated TypeScript definitions.
21
+
22
+ ## v8.0.1
23
+
24
+ ### Changes
25
+
26
+ * Updated TypeScript definitions.
27
+
4
28
  ## v8.0.0
5
29
 
6
30
  ### New Features
package/lib/crisp.js CHANGED
@@ -644,7 +644,9 @@ Crisp.prototype = {
644
644
  * @return {Promise}
645
645
  */
646
646
  rebindSocket : function() {
647
- if (!this._socket) {
647
+ var self = this;
648
+
649
+ if (!self._socket) {
648
650
  throw new Error(
649
651
  "[Crisp] rebindSocket: cannot rebind a socket that is not yet bound"
650
652
  );
@@ -654,8 +656,8 @@ Crisp.prototype = {
654
656
  // is illegal)
655
657
  var nowTime = Date.now();
656
658
 
657
- if (this._lastEventRebind !== null &&
658
- ((nowTime - this._lastEventRebind) <
659
+ if (self._lastEventRebind !== null &&
660
+ ((nowTime - self._lastEventRebind) <
659
661
  Crisp.DEFAULT_EVENT_REBIND_INTERVAL_MIN)) {
660
662
  throw new Error(
661
663
  "[Crisp] rebindSocket: cannot rebind, last rebind was requested too " +
@@ -666,9 +668,9 @@ Crisp.prototype = {
666
668
  return Promise.resolve()
667
669
  .then(function() {
668
670
  // Rebind to socket events (eg. newly bound websites)
669
- this._lastEventRebind = nowTime;
671
+ self._lastEventRebind = nowTime;
670
672
 
671
- this._socket.emit("socket:bind", {});
673
+ self._socket.emit("socket:bind", {});
672
674
 
673
675
  return Promise.resolve();
674
676
  });
@@ -828,13 +830,15 @@ Crisp.prototype = {
828
830
  * @return {Promise}
829
831
  */
830
832
  _connectLoopback : function() {
833
+ var self = this;
834
+
831
835
  return Promise.resolve()
832
836
  .then(function() {
833
837
  // Assign emitter to loopback
834
- this._loopback = this._emitter;
838
+ self._loopback = self._emitter;
835
839
 
836
840
  // Unstack broker bind hooks immediately
837
- this._unstackBrokerBindHooks(this._loopback);
841
+ self._unstackBrokerBindHooks(self._loopback);
838
842
 
839
843
  return Promise.resolve();
840
844
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "crisp-api",
3
3
  "description": "Crisp API wrapper for Node - official, maintained by Crisp",
4
- "version": "8.0.2",
4
+ "version": "8.1.0",
5
5
  "homepage": "https://github.com/crisp-im/node-crisp-api",
6
6
  "license": "MIT",
7
7
  "author": {
@@ -48,7 +48,7 @@
48
48
  "typescript": "5.1.6"
49
49
  },
50
50
  "dependencies": {
51
- "socket.io-client": "4.4.1",
51
+ "socket.io-client": "4.7.2",
52
52
  "fbemitter": "git+https://github.com/crisp-dev/emitter.git#695f60594bdca0c876e5c232de57702ab3151b6f",
53
53
  "got": "11.8.5"
54
54
  },