crisp-api 10.9.1 → 10.9.3

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/dist/crisp.d.ts CHANGED
@@ -9,7 +9,7 @@ import { WebsiteServiceInterface } from "./services/website";
9
9
  * TYPES
10
10
  ***************************************************************************/
11
11
  export type RTM_MODES = "websockets" | "webhooks";
12
- export type CrispTier = "user" | "plugin";
12
+ export type CrispTier = "user" | "website" | "plugin";
13
13
  /**************************************************************************
14
14
  * INTERFACES
15
15
  ***************************************************************************/
@@ -79,7 +79,7 @@ declare class Crisp {
79
79
  /**
80
80
  * Sets the authentication tier
81
81
  */
82
- setTier(tier: "user" | "plugin"): void;
82
+ setTier(tier: "user" | "website" | "plugin"): void;
83
83
  /**
84
84
  * Authenticates
85
85
  */
package/dist/crisp.js CHANGED
@@ -46,7 +46,7 @@ const AVAILABLE_RTM_MODES = [
46
46
  "websockets",
47
47
  "webhooks"
48
48
  ];
49
- const VERSION = "10.9.1";
49
+ const VERSION = "10.9.3";
50
50
  // Base configuration
51
51
  const DEFAULT_REQUEST_TIMEOUT = 10000;
52
52
  const DEFAULT_SOCKET_TIMEOUT = 10000;
@@ -578,6 +578,10 @@ class Crisp {
578
578
  // Acquire RTM API URL from remote
579
579
  let restUrlSegments;
580
580
  switch (this.auth.tier) {
581
+ case "website": {
582
+ restUrlSegments = ["website", "connect", "endpoints"];
583
+ break;
584
+ }
581
585
  case "plugin": {
582
586
  restUrlSegments = ["plugin", "connect", "endpoints"];
583
587
  break;
@@ -555,7 +555,7 @@ declare class WebsiteConversation extends BaseResource {
555
555
  /**
556
556
  * Update Conversation Inbox
557
557
  */
558
- updateConversationInbox(websiteID: string, sessionID: string, inboxID: string): Promise<any>;
558
+ updateConversationInbox(websiteID: string, sessionID: string, inboxID?: string | null): Promise<any>;
559
559
  /**
560
560
  * Get Conversation Metas
561
561
  */
@@ -595,7 +595,7 @@ declare class WebsiteConversation extends BaseResource {
595
595
  /**
596
596
  * Get Conversation Participants
597
597
  */
598
- getConversationParticipants(websiteID: string, sessionID: string): Promise<ConversationParticipant[]>;
598
+ getConversationParticipants(websiteID: string, sessionID: string): Promise<ConversationParticipants>;
599
599
  /**
600
600
  * Save Conversation Participants
601
601
  */
@@ -268,7 +268,7 @@ class WebsiteConversation extends BaseResource_1.default {
268
268
  return this.crisp.patch(this.crisp.prepareRestUrl([
269
269
  "website", websiteID, "conversation", sessionID, "inbox"
270
270
  ]), null, {
271
- inbox_id: inboxID
271
+ inbox_id: inboxID || null
272
272
  });
273
273
  }
274
274
  /**
@@ -12,6 +12,7 @@ export type WebsiteInbox = {
12
12
  order?: number;
13
13
  operators?: string[];
14
14
  conditions?: WebsiteInboxCondition[];
15
+ operator?: string;
15
16
  created_at?: number;
16
17
  updated_at?: number;
17
18
  };
package/lib/crisp.ts CHANGED
@@ -31,7 +31,7 @@ import Website, { WebsiteServiceInterface } from "@/services/website";
31
31
 
32
32
  export type RTM_MODES = "websockets" | "webhooks";
33
33
 
34
- export type CrispTier = "user" | "plugin";
34
+ export type CrispTier = "user" | "website" | "plugin";
35
35
 
36
36
  /**************************************************************************
37
37
  * CONSTANTS
@@ -322,7 +322,7 @@ class Crisp {
322
322
  /**
323
323
  * Sets the authentication tier
324
324
  */
325
- setTier(tier: "user" | "plugin") {
325
+ setTier(tier: "user" | "website" | "plugin") {
326
326
  this.auth.tier = (tier || "user");
327
327
  }
328
328
 
@@ -753,6 +753,12 @@ class Crisp {
753
753
  let restUrlSegments;
754
754
 
755
755
  switch (this.auth.tier) {
756
+ case "website": {
757
+ restUrlSegments = ["website", "connect", "endpoints"];
758
+
759
+ break;
760
+ }
761
+
756
762
  case "plugin": {
757
763
  restUrlSegments = ["plugin", "connect", "endpoints"];
758
764
 
@@ -947,7 +947,7 @@ class WebsiteConversation extends BaseResource {
947
947
  * Update Conversation Inbox
948
948
  */
949
949
  updateConversationInbox(
950
- websiteID: string, sessionID: string, inboxID: string
950
+ websiteID: string, sessionID: string, inboxID?: string | null
951
951
  ) {
952
952
  return this.crisp.patch(
953
953
  this.crisp.prepareRestUrl([
@@ -957,7 +957,7 @@ class WebsiteConversation extends BaseResource {
957
957
  null,
958
958
 
959
959
  {
960
- inbox_id: inboxID
960
+ inbox_id: inboxID || null
961
961
  }
962
962
  );
963
963
  }
@@ -1100,7 +1100,7 @@ class WebsiteConversation extends BaseResource {
1100
1100
  */
1101
1101
  getConversationParticipants(
1102
1102
  websiteID: string, sessionID: string
1103
- ): Promise<ConversationParticipant[]> {
1103
+ ): Promise<ConversationParticipants> {
1104
1104
  return this.crisp.get(
1105
1105
  this.crisp.prepareRestUrl([
1106
1106
  "website", websiteID, "conversation", sessionID, "participants"
@@ -23,6 +23,7 @@ export type WebsiteInbox = {
23
23
  order?: number;
24
24
  operators?: string[];
25
25
  conditions?: WebsiteInboxCondition[];
26
+ operator?: string;
26
27
  created_at?: number;
27
28
  updated_at?: number;
28
29
  }
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": "10.9.1",
4
+ "version": "10.9.3",
5
5
  "homepage": "https://github.com/crisp-im/node-crisp-api",
6
6
  "license": "MIT",
7
7
  "author": {