crisp-api 8.0.3 → 8.2.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,36 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## v8.2.0
5
+
6
+ ### New Features
7
+
8
+ * Added support for the `session:sync:topic` RTM API event.
9
+
10
+ ## v8.1.0
11
+
12
+ ### Bug Fixes
13
+
14
+ * Fixed an issue where `CrispClient.rebindSocket` and `CrispClient._connectLoopback` base methods would not work due to undefined `this` references.
15
+
16
+ ## v8.0.3
17
+
18
+ ### Changes
19
+
20
+ * Updated `socket.io-client` dependency to latest.
21
+
22
+ ## v8.0.2
23
+
24
+ ### Changes
25
+
26
+ * Updated TypeScript definitions.
27
+
28
+ ## v8.0.1
29
+
30
+ ### Changes
31
+
32
+ * Updated TypeScript definitions.
33
+
4
34
  ## v8.0.0
5
35
 
6
36
  ### New Features
package/README.md CHANGED
@@ -2738,7 +2738,7 @@ _👉 Notice: The `peopleID` argument can be an email or the `peopleID`._
2738
2738
  ```
2739
2739
  </details>
2740
2740
 
2741
- * **List Campaign Templates** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#list-campaign-templates)
2741
+ * **List Campaign Templates** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#list-campaign-templates)
2742
2742
  * `CrispClient.website.listCampaignTemplates(websiteID, pageNumber)`
2743
2743
  * <details>
2744
2744
  <summary>See Example</summary>
@@ -2751,7 +2751,7 @@ _👉 Notice: The `peopleID` argument can be an email or the `peopleID`._
2751
2751
  ```
2752
2752
  </details>
2753
2753
 
2754
- * **Create A New Campaign Template** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#create-a-new-campaign-template)
2754
+ * **Create A New Campaign Template** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#create-a-new-campaign-template)
2755
2755
  * `CrispClient.website.createNewCampaignTemplate(websiteID, templateFormat, templateName)`
2756
2756
  * <details>
2757
2757
  <summary>See Example</summary>
@@ -2768,7 +2768,7 @@ _👉 Notice: The `peopleID` argument can be an email or the `peopleID`._
2768
2768
  ```
2769
2769
  </details>
2770
2770
 
2771
- * **Check If Campaign Template Exists** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#check-if-campaign-template-exists)
2771
+ * **Check If Campaign Template Exists** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#check-if-campaign-template-exists)
2772
2772
  * `CrispClient.website.checkCampaignTemplateExists(websiteID, templateID)`
2773
2773
  * <details>
2774
2774
  <summary>See Example</summary>
@@ -2781,7 +2781,7 @@ _👉 Notice: The `peopleID` argument can be an email or the `peopleID`._
2781
2781
  ```
2782
2782
  </details>
2783
2783
 
2784
- * **Get A Campaign Template** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#get-a-campaign-template)
2784
+ * **Get A Campaign Template** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#get-a-campaign-template)
2785
2785
  * `CrispClient.website.getCampaignTemplate(websiteID, templateID)`
2786
2786
  * <details>
2787
2787
  <summary>See Example</summary>
@@ -2794,7 +2794,7 @@ _👉 Notice: The `peopleID` argument can be an email or the `peopleID`._
2794
2794
  ```
2795
2795
  </details>
2796
2796
 
2797
- * **Save A Campaign Template** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#save-a-campaign-template)
2797
+ * **Save A Campaign Template** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#save-a-campaign-template)
2798
2798
  * `CrispClient.website.saveCampaignTemplate(websiteID, templateID, template)`
2799
2799
  * <details>
2800
2800
  <summary>See Example</summary>
@@ -2813,7 +2813,7 @@ _👉 Notice: The `peopleID` argument can be an email or the `peopleID`._
2813
2813
  ```
2814
2814
  </details>
2815
2815
 
2816
- * **Update A Campaign Template** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#update-a-campaign-template)
2816
+ * **Update A Campaign Template** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#update-a-campaign-template)
2817
2817
  * `CrispClient.website.updateCampaignTemplate(websiteID, templateID, template)`
2818
2818
  * <details>
2819
2819
  <summary>See Example</summary>
@@ -2828,7 +2828,7 @@ _👉 Notice: The `peopleID` argument can be an email or the `peopleID`._
2828
2828
  ```
2829
2829
  </details>
2830
2830
 
2831
- * **Remove A Campaign Template** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#remove-a-campaign-template)
2831
+ * **Remove A Campaign Template** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#remove-a-campaign-template)
2832
2832
  * `CrispClient.website.removeCampaignTemplate(websiteID, templateID)`
2833
2833
  * <details>
2834
2834
  <summary>See Example</summary>
@@ -3358,6 +3358,8 @@ Available events are listed below:
3358
3358
  * `session:sync:locales`
3359
3359
  * **Session Sync Rating** [`user`, `plugin`]:
3360
3360
  * `session:sync:rating`
3361
+ * **Session Sync Topic** [`user`, `plugin`]:
3362
+ * `session:sync:topic`
3361
3363
  * **Session Set State** [`user`, `plugin`]:
3362
3364
  * `session:set_state`
3363
3365
  * **Session Set Block** [`user`, `plugin`]:
package/lib/crisp.js CHANGED
@@ -70,6 +70,7 @@ Crisp.DEFAULT_RTM_EVENTS = [
70
70
  "session:sync:timezone",
71
71
  "session:sync:locales",
72
72
  "session:sync:rating",
73
+ "session:sync:topic",
73
74
  "session:set_state",
74
75
  "session:set_block",
75
76
  "session:set_segments",
@@ -644,7 +645,9 @@ Crisp.prototype = {
644
645
  * @return {Promise}
645
646
  */
646
647
  rebindSocket : function() {
647
- if (!this._socket) {
648
+ var self = this;
649
+
650
+ if (!self._socket) {
648
651
  throw new Error(
649
652
  "[Crisp] rebindSocket: cannot rebind a socket that is not yet bound"
650
653
  );
@@ -654,8 +657,8 @@ Crisp.prototype = {
654
657
  // is illegal)
655
658
  var nowTime = Date.now();
656
659
 
657
- if (this._lastEventRebind !== null &&
658
- ((nowTime - this._lastEventRebind) <
660
+ if (self._lastEventRebind !== null &&
661
+ ((nowTime - self._lastEventRebind) <
659
662
  Crisp.DEFAULT_EVENT_REBIND_INTERVAL_MIN)) {
660
663
  throw new Error(
661
664
  "[Crisp] rebindSocket: cannot rebind, last rebind was requested too " +
@@ -666,9 +669,9 @@ Crisp.prototype = {
666
669
  return Promise.resolve()
667
670
  .then(function() {
668
671
  // Rebind to socket events (eg. newly bound websites)
669
- this._lastEventRebind = nowTime;
672
+ self._lastEventRebind = nowTime;
670
673
 
671
- this._socket.emit("socket:bind", {});
674
+ self._socket.emit("socket:bind", {});
672
675
 
673
676
  return Promise.resolve();
674
677
  });
@@ -828,13 +831,15 @@ Crisp.prototype = {
828
831
  * @return {Promise}
829
832
  */
830
833
  _connectLoopback : function() {
834
+ var self = this;
835
+
831
836
  return Promise.resolve()
832
837
  .then(function() {
833
838
  // Assign emitter to loopback
834
- this._loopback = this._emitter;
839
+ self._loopback = self._emitter;
835
840
 
836
841
  // Unstack broker bind hooks immediately
837
- this._unstackBrokerBindHooks(this._loopback);
842
+ self._unstackBrokerBindHooks(self._loopback);
838
843
 
839
844
  return Promise.resolve();
840
845
  });
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.3",
4
+ "version": "8.2.0",
5
5
  "homepage": "https://github.com/crisp-im/node-crisp-api",
6
6
  "license": "MIT",
7
7
  "author": {