crisp-api 10.8.3 → 10.8.4

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/README.md CHANGED
@@ -680,7 +680,7 @@ All methods that you will most likely need when building a Crisp integration are
680
680
  </details>
681
681
 
682
682
  * **⭐ Change Conversation State** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#change-conversation-state)
683
- * `CrispClient.website.changeConversationState(websiteID, sessionID, state)`
683
+ * `CrispClient.website.changeConversationState(websiteID, sessionID, state, user, origin)`
684
684
  * <details>
685
685
  <summary>See Example</summary>
686
686
 
@@ -756,7 +756,7 @@ All methods that you will most likely need when building a Crisp integration are
756
756
  </details>
757
757
 
758
758
  * **Block Incoming Messages For Conversation** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#block-incoming-messages-for-conversation)
759
- * `CrispClient.website.blockIncomingMessagesForConversation(websiteID, sessionID, blocked)`
759
+ * `CrispClient.website.blockIncomingMessagesForConversation(websiteID, sessionID, blocked, user, origin)`
760
760
  * <details>
761
761
  <summary>See Example</summary>
762
762
 
@@ -942,7 +942,7 @@ All methods that you will most likely need when building a Crisp integration are
942
942
  </details>
943
943
 
944
944
  * **Initiate New Call Session For Conversation** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#initiate-new-call-session-for-conversation)
945
- * `CrispClient.website.initiateNewCallSessionForConversation(websiteID, sessionID, mode)`
945
+ * `CrispClient.website.initiateNewCallSessionForConversation(websiteID, sessionID, mode, user, origin)`
946
946
  * <details>
947
947
  <summary>See Example</summary>
948
948
 
@@ -970,7 +970,7 @@ All methods that you will most likely need when building a Crisp integration are
970
970
  </details>
971
971
 
972
972
  * **Abort Ongoing Call Session For Conversation** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#abort-ongoing-call-session-for-conversation)
973
- * `CrispClient.website.abortOngoingCallSessionForConversation(websiteID, sessionID, callID)`
973
+ * `CrispClient.website.abortOngoingCallSessionForConversation(websiteID, sessionID, callID, user, origin)`
974
974
  * <details>
975
975
  <summary>See Example</summary>
976
976
 
@@ -1073,7 +1073,7 @@ All methods that you will most likely need when building a Crisp integration are
1073
1073
  </details>
1074
1074
 
1075
1075
  * **Schedule A Reminder For Conversation** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#schedule-a-reminder-for-conversation)
1076
- * `CrispClient.website.scheduleReminderForConversation(websiteID, sessionID, date, note)`
1076
+ * `CrispClient.website.scheduleReminderForConversation(websiteID, sessionID, date, note, user, origin)`
1077
1077
  * <details>
1078
1078
  <summary>See Example</summary>
1079
1079
 
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.8.3";
49
+ const VERSION = "10.8.4";
50
50
  // Base configuration
51
51
  const DEFAULT_REQUEST_TIMEOUT = 10000;
52
52
  const DEFAULT_SOCKET_TIMEOUT = 10000;
@@ -88,6 +88,7 @@ export interface ConversationParticipants {
88
88
  export interface ConversationParticipantsSave {
89
89
  participants?: ConversationParticipant[];
90
90
  user?: ConversationMessageUser;
91
+ origin?: string;
91
92
  }
92
93
  export interface ConversationMeta {
93
94
  nickname?: string;
@@ -586,7 +587,7 @@ declare class WebsiteConversation extends BaseResource {
586
587
  /**
587
588
  * Change Conversation State
588
589
  */
589
- changeConversationState(websiteID: string, sessionID: string, state: ConversationState, user?: ConversationMessageUser): Promise<any>;
590
+ changeConversationState(websiteID: string, sessionID: string, state: ConversationState, user?: ConversationMessageUser, origin?: string): Promise<any>;
590
591
  /**
591
592
  * Get Conversation Relations
592
593
  */
@@ -606,7 +607,7 @@ declare class WebsiteConversation extends BaseResource {
606
607
  /**
607
608
  * Block Incoming Messages For Conversation
608
609
  */
609
- blockIncomingMessagesForConversation(websiteID: string, sessionID: string, blocked: boolean, user?: ConversationMessageUser): Promise<any>;
610
+ blockIncomingMessagesForConversation(websiteID: string, sessionID: string, blocked: boolean, user?: ConversationMessageUser, origin?: string): Promise<any>;
610
611
  /**
611
612
  * Get Verify Status For Conversation
612
613
  */
@@ -654,7 +655,7 @@ declare class WebsiteConversation extends BaseResource {
654
655
  /**
655
656
  * Initiate New Call Session For Conversation
656
657
  */
657
- initiateNewCallSessionForConversation(websiteID: string, sessionID: string, mode: string, user?: ConversationMessageUser): Promise<any>;
658
+ initiateNewCallSessionForConversation(websiteID: string, sessionID: string, mode: string, user?: ConversationMessageUser, origin?: string): Promise<any>;
658
659
  /**
659
660
  * Get Ongoing Call Session For Conversation
660
661
  */
@@ -662,7 +663,7 @@ declare class WebsiteConversation extends BaseResource {
662
663
  /**
663
664
  * Abort Ongoing Call Session For Conversation
664
665
  */
665
- abortOngoingCallSessionForConversation(websiteID: string, sessionID: string, callID: string, user?: ConversationMessageUser): Promise<any>;
666
+ abortOngoingCallSessionForConversation(websiteID: string, sessionID: string, callID: string, user?: ConversationMessageUser, origin?: string): Promise<any>;
666
667
  /**
667
668
  * Transmit Signaling On Ongoing Call Session
668
669
  */
@@ -682,7 +683,7 @@ declare class WebsiteConversation extends BaseResource {
682
683
  /**
683
684
  * Schedule A Reminder For Conversation
684
685
  */
685
- scheduleReminderForConversation(websiteID: string, sessionID: string, date: string, note: string, user?: ConversationMessageUser): Promise<any>;
686
+ scheduleReminderForConversation(websiteID: string, sessionID: string, date: string, note: string, user?: ConversationMessageUser, origin?: string): Promise<any>;
686
687
  /**
687
688
  * Report Conversation
688
689
  */
@@ -334,13 +334,19 @@ class WebsiteConversation extends BaseResource_1.default {
334
334
  /**
335
335
  * Change Conversation State
336
336
  */
337
- changeConversationState(websiteID, sessionID, state, user) {
338
- return this.crisp.patch(this.crisp.prepareRestUrl([
339
- "website", websiteID, "conversation", sessionID, "state"
340
- ]), null, {
337
+ changeConversationState(websiteID, sessionID, state, user, origin) {
338
+ // Generate body
339
+ let body = {
341
340
  state: state,
342
341
  user: user
343
- });
342
+ };
343
+ if (origin) {
344
+ // @ts-ignore
345
+ body.origin = origin;
346
+ }
347
+ return this.crisp.patch(this.crisp.prepareRestUrl([
348
+ "website", websiteID, "conversation", sessionID, "state"
349
+ ]), null, body);
344
350
  }
345
351
  ;
346
352
  /**
@@ -382,13 +388,19 @@ class WebsiteConversation extends BaseResource_1.default {
382
388
  /**
383
389
  * Block Incoming Messages For Conversation
384
390
  */
385
- blockIncomingMessagesForConversation(websiteID, sessionID, blocked, user) {
386
- return this.crisp.patch(this.crisp.prepareRestUrl([
387
- "website", websiteID, "conversation", sessionID, "block"
388
- ]), null, {
391
+ blockIncomingMessagesForConversation(websiteID, sessionID, blocked, user, origin) {
392
+ // Generate body
393
+ let body = {
389
394
  blocked: (blocked || false),
390
395
  user: user
391
- });
396
+ };
397
+ if (origin) {
398
+ // @ts-ignore
399
+ body.origin = origin;
400
+ }
401
+ return this.crisp.patch(this.crisp.prepareRestUrl([
402
+ "website", websiteID, "conversation", sessionID, "block"
403
+ ]), null, body);
392
404
  }
393
405
  ;
394
406
  /**
@@ -507,13 +519,19 @@ class WebsiteConversation extends BaseResource_1.default {
507
519
  /**
508
520
  * Initiate New Call Session For Conversation
509
521
  */
510
- initiateNewCallSessionForConversation(websiteID, sessionID, mode, user) {
511
- return this.crisp.post(this.crisp.prepareRestUrl([
512
- "website", websiteID, "conversation", sessionID, "call"
513
- ]), null, {
522
+ initiateNewCallSessionForConversation(websiteID, sessionID, mode, user, origin) {
523
+ // Generate body
524
+ let body = {
514
525
  mode: (mode || "audio"),
515
526
  user: user
516
- });
527
+ };
528
+ if (origin) {
529
+ // @ts-ignore
530
+ body.origin = origin;
531
+ }
532
+ return this.crisp.post(this.crisp.prepareRestUrl([
533
+ "website", websiteID, "conversation", sessionID, "call"
534
+ ]), null, body);
517
535
  }
518
536
  ;
519
537
  /**
@@ -528,12 +546,18 @@ class WebsiteConversation extends BaseResource_1.default {
528
546
  /**
529
547
  * Abort Ongoing Call Session For Conversation
530
548
  */
531
- abortOngoingCallSessionForConversation(websiteID, sessionID, callID, user) {
549
+ abortOngoingCallSessionForConversation(websiteID, sessionID, callID, user, origin) {
550
+ // Generate body
551
+ let body = {
552
+ user: user
553
+ };
554
+ if (origin) {
555
+ // @ts-ignore
556
+ body.origin = origin;
557
+ }
532
558
  return this.crisp.delete(this.crisp.prepareRestUrl([
533
559
  "website", websiteID, "conversation", sessionID, "call", callID
534
- ]), null, {
535
- user: user
536
- });
560
+ ]), null, body);
537
561
  }
538
562
  ;
539
563
  /**
@@ -596,14 +620,20 @@ class WebsiteConversation extends BaseResource_1.default {
596
620
  /**
597
621
  * Schedule A Reminder For Conversation
598
622
  */
599
- scheduleReminderForConversation(websiteID, sessionID, date, note, user) {
600
- return this.crisp.post(this.crisp.prepareRestUrl([
601
- "website", websiteID, "conversation", sessionID, "reminder"
602
- ]), null, {
623
+ scheduleReminderForConversation(websiteID, sessionID, date, note, user, origin) {
624
+ // Generate body
625
+ let body = {
603
626
  date: date,
604
627
  note: note,
605
628
  user: user
606
- });
629
+ };
630
+ if (origin) {
631
+ // @ts-ignore
632
+ body.origin = origin;
633
+ }
634
+ return this.crisp.post(this.crisp.prepareRestUrl([
635
+ "website", websiteID, "conversation", sessionID, "reminder"
636
+ ]), null, body);
607
637
  }
608
638
  ;
609
639
  /**
@@ -113,6 +113,7 @@ export interface ConversationParticipants {
113
113
  export interface ConversationParticipantsSave {
114
114
  participants?: ConversationParticipant[];
115
115
  user?: ConversationMessageUser;
116
+ origin?: string;
116
117
  }
117
118
 
118
119
  export interface ConversationMeta {
@@ -1059,19 +1060,25 @@ class WebsiteConversation extends BaseResource {
1059
1060
  */
1060
1061
  changeConversationState(
1061
1062
  websiteID: string, sessionID: string, state: ConversationState,
1062
- user?: ConversationMessageUser
1063
+ user?: ConversationMessageUser, origin?: string
1063
1064
  ) {
1065
+ // Generate body
1066
+ let body = {
1067
+ state: state,
1068
+ user: user
1069
+ };
1070
+
1071
+ if (origin) {
1072
+ // @ts-ignore
1073
+ body.origin = origin;
1074
+ }
1075
+
1064
1076
  return this.crisp.patch(
1065
1077
  this.crisp.prepareRestUrl([
1066
1078
  "website", websiteID, "conversation", sessionID, "state"
1067
1079
  ]),
1068
1080
 
1069
- null,
1070
-
1071
- {
1072
- state: state,
1073
- user: user
1074
- }
1081
+ null, body
1075
1082
  );
1076
1083
  };
1077
1084
 
@@ -1134,19 +1141,25 @@ class WebsiteConversation extends BaseResource {
1134
1141
  */
1135
1142
  blockIncomingMessagesForConversation(
1136
1143
  websiteID: string, sessionID: string, blocked: boolean,
1137
- user?: ConversationMessageUser
1144
+ user?: ConversationMessageUser, origin?: string
1138
1145
  ) {
1146
+ // Generate body
1147
+ let body = {
1148
+ blocked: (blocked || false),
1149
+ user: user
1150
+ };
1151
+
1152
+ if (origin) {
1153
+ // @ts-ignore
1154
+ body.origin = origin;
1155
+ }
1156
+
1139
1157
  return this.crisp.patch(
1140
1158
  this.crisp.prepareRestUrl([
1141
1159
  "website", websiteID, "conversation", sessionID, "block"
1142
1160
  ]),
1143
1161
 
1144
- null,
1145
-
1146
- {
1147
- blocked: (blocked || false),
1148
- user: user
1149
- }
1162
+ null, body
1150
1163
  );
1151
1164
  };
1152
1165
 
@@ -1340,19 +1353,25 @@ class WebsiteConversation extends BaseResource {
1340
1353
  */
1341
1354
  initiateNewCallSessionForConversation(
1342
1355
  websiteID: string, sessionID: string, mode: string,
1343
- user?: ConversationMessageUser
1356
+ user?: ConversationMessageUser, origin?: string
1344
1357
  ) {
1358
+ // Generate body
1359
+ let body = {
1360
+ mode: (mode || "audio"),
1361
+ user: user
1362
+ };
1363
+
1364
+ if (origin) {
1365
+ // @ts-ignore
1366
+ body.origin = origin;
1367
+ }
1368
+
1345
1369
  return this.crisp.post(
1346
1370
  this.crisp.prepareRestUrl([
1347
1371
  "website", websiteID, "conversation", sessionID, "call"
1348
1372
  ]),
1349
1373
 
1350
- null,
1351
-
1352
- {
1353
- mode: (mode || "audio"),
1354
- user: user
1355
- }
1374
+ null, body
1356
1375
  );
1357
1376
  };
1358
1377
 
@@ -1374,18 +1393,24 @@ class WebsiteConversation extends BaseResource {
1374
1393
  */
1375
1394
  abortOngoingCallSessionForConversation(
1376
1395
  websiteID: string, sessionID: string, callID: string,
1377
- user?: ConversationMessageUser
1396
+ user?: ConversationMessageUser, origin?: string
1378
1397
  ) {
1398
+ // Generate body
1399
+ let body = {
1400
+ user: user
1401
+ };
1402
+
1403
+ if (origin) {
1404
+ // @ts-ignore
1405
+ body.origin = origin;
1406
+ }
1407
+
1379
1408
  return this.crisp.delete(
1380
1409
  this.crisp.prepareRestUrl([
1381
1410
  "website", websiteID, "conversation", sessionID, "call", callID
1382
1411
  ]),
1383
1412
 
1384
- null,
1385
-
1386
- {
1387
- user: user
1388
- }
1413
+ null, body
1389
1414
  );
1390
1415
  };
1391
1416
 
@@ -1484,20 +1509,26 @@ class WebsiteConversation extends BaseResource {
1484
1509
  */
1485
1510
  scheduleReminderForConversation(
1486
1511
  websiteID: string, sessionID: string, date: string, note: string,
1487
- user?: ConversationMessageUser
1512
+ user?: ConversationMessageUser, origin?: string
1488
1513
  ) {
1514
+ // Generate body
1515
+ let body = {
1516
+ date: date,
1517
+ note: note,
1518
+ user: user
1519
+ };
1520
+
1521
+ if (origin) {
1522
+ // @ts-ignore
1523
+ body.origin = origin;
1524
+ }
1525
+
1489
1526
  return this.crisp.post(
1490
1527
  this.crisp.prepareRestUrl([
1491
1528
  "website", websiteID, "conversation", sessionID, "reminder"
1492
1529
  ]),
1493
1530
 
1494
- null,
1495
-
1496
- {
1497
- date: date,
1498
- note: note,
1499
- user: user
1500
- }
1531
+ null, body
1501
1532
  );
1502
1533
  };
1503
1534
 
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.8.3",
4
+ "version": "10.8.4",
5
5
  "homepage": "https://github.com/crisp-im/node-crisp-api",
6
6
  "license": "MIT",
7
7
  "author": {