stream-chat 8.23.1 → 8.25.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.
@@ -6220,7 +6220,7 @@ var Campaign = /*#__PURE__*/function () {
6220
6220
  case 0:
6221
6221
  this.verifyCampaignId();
6222
6222
  _context4.next = 3;
6223
- return this.client.delete(this.client.baseURL + "/campaigns/".concat(this.id));
6223
+ return this.client.deleteCampaign(this.id);
6224
6224
 
6225
6225
  case 3:
6226
6226
  return _context4.abrupt("return", _context4.sent);
@@ -6248,7 +6248,7 @@ var Campaign = /*#__PURE__*/function () {
6248
6248
  switch (_context5.prev = _context5.next) {
6249
6249
  case 0:
6250
6250
  this.verifyCampaignId();
6251
- return _context5.abrupt("return", this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/stop")));
6251
+ return _context5.abrupt("return", this.client.stopCampaign(this.id));
6252
6252
 
6253
6253
  case 2:
6254
6254
  case "end":
@@ -6316,7 +6316,7 @@ var Segment = /*#__PURE__*/function () {
6316
6316
  key: "create",
6317
6317
  value: function () {
6318
6318
  var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
6319
- var _this$data, _this$data2, _this$data3, _this$data4;
6319
+ var _this$data, _this$data2, _this$data3, _this$data4, _this$data5;
6320
6320
 
6321
6321
  var body;
6322
6322
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -6324,14 +6324,13 @@ var Segment = /*#__PURE__*/function () {
6324
6324
  switch (_context.prev = _context.next) {
6325
6325
  case 0:
6326
6326
  body = {
6327
- id: this.id,
6328
- type: this.type,
6329
6327
  name: (_this$data = this.data) === null || _this$data === void 0 ? void 0 : _this$data.name,
6330
6328
  filter: (_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2.filter,
6331
6329
  description: (_this$data3 = this.data) === null || _this$data3 === void 0 ? void 0 : _this$data3.description,
6332
- all_users: (_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.all_users
6330
+ all_sender_channels: (_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.all_sender_channels,
6331
+ all_users: (_this$data5 = this.data) === null || _this$data5 === void 0 ? void 0 : _this$data5.all_users
6333
6332
  };
6334
- return _context.abrupt("return", this.client.post(this.client.baseURL + "/segments", body));
6333
+ return _context.abrupt("return", this.client.createSegment(this.type, this.id, body));
6335
6334
 
6336
6335
  case 2:
6337
6336
  case "end":
@@ -11115,7 +11114,7 @@ var StreamChat = /*#__PURE__*/function () {
11115
11114
  }, {
11116
11115
  key: "getUserAgent",
11117
11116
  value: function getUserAgent() {
11118
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.23.1");
11117
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.25.0");
11119
11118
  }
11120
11119
  }, {
11121
11120
  key: "setUserAgent",
@@ -11415,11 +11414,11 @@ var StreamChat = /*#__PURE__*/function () {
11415
11414
  }, {
11416
11415
  key: "campaign",
11417
11416
  value: function campaign(idOrData, data) {
11418
- if (typeof idOrData === 'string') {
11419
- return new Campaign(this, idOrData, data);
11417
+ if (idOrData && _typeof(idOrData) === 'object') {
11418
+ return new Campaign(this, null, idOrData);
11420
11419
  }
11421
11420
 
11422
- return new Campaign(this, null, idOrData);
11421
+ return new Campaign(this, idOrData, data);
11423
11422
  }
11424
11423
  }, {
11425
11424
  key: "segment",
@@ -11442,8 +11441,8 @@ var StreamChat = /*#__PURE__*/function () {
11442
11441
  *
11443
11442
  * @private
11444
11443
  * @param {SegmentType} type Segment type
11445
- * @param {string} id Segment ID (valid UUID)
11446
- * @param {string} name Segment name (valid UUID)
11444
+ * @param {string} id Segment ID
11445
+ * @param {string} name Segment name
11447
11446
  * @param {SegmentData} params Segment data
11448
11447
  *
11449
11448
  * @return {{segment: SegmentResponse} & APIResponse} The created Segment
@@ -11452,19 +11451,17 @@ var StreamChat = /*#__PURE__*/function () {
11452
11451
  }, {
11453
11452
  key: "createSegment",
11454
11453
  value: function () {
11455
- var _createSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64(type, id, name, data) {
11454
+ var _createSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64(type, id, data) {
11456
11455
  var body;
11457
11456
  return _regeneratorRuntime.wrap(function _callee64$(_context64) {
11458
11457
  while (1) {
11459
11458
  switch (_context64.prev = _context64.next) {
11460
11459
  case 0:
11461
11460
  this.validateServerSideAuth();
11462
- body = {
11461
+ body = _objectSpread({
11463
11462
  id: id,
11464
- type: type,
11465
- name: name,
11466
- data: data
11467
- };
11463
+ type: type
11464
+ }, data);
11468
11465
  return _context64.abrupt("return", this.post(this.baseURL + "/segments", body));
11469
11466
 
11470
11467
  case 3:
@@ -11475,7 +11472,7 @@ var StreamChat = /*#__PURE__*/function () {
11475
11472
  }, _callee64, this);
11476
11473
  }));
11477
11474
 
11478
- function createSegment(_x87, _x88, _x89, _x90) {
11475
+ function createSegment(_x87, _x88, _x89) {
11479
11476
  return _createSegment.apply(this, arguments);
11480
11477
  }
11481
11478
 
@@ -11484,7 +11481,7 @@ var StreamChat = /*#__PURE__*/function () {
11484
11481
  /**
11485
11482
  * createUserSegment - Creates a user segment
11486
11483
  *
11487
- * @param {string} id Segment ID (valid UUID)
11484
+ * @param {string} id Segment ID
11488
11485
  * @param {string} name Segment name
11489
11486
  * @param {SegmentData} data Segment data
11490
11487
  *
@@ -11494,13 +11491,13 @@ var StreamChat = /*#__PURE__*/function () {
11494
11491
  }, {
11495
11492
  key: "createUserSegment",
11496
11493
  value: function () {
11497
- var _createUserSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(id, name, data) {
11494
+ var _createUserSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(id, data) {
11498
11495
  return _regeneratorRuntime.wrap(function _callee65$(_context65) {
11499
11496
  while (1) {
11500
11497
  switch (_context65.prev = _context65.next) {
11501
11498
  case 0:
11502
11499
  this.validateServerSideAuth();
11503
- return _context65.abrupt("return", this.createSegment('user', id, name, data));
11500
+ return _context65.abrupt("return", this.createSegment('user', id, data));
11504
11501
 
11505
11502
  case 2:
11506
11503
  case "end":
@@ -11510,7 +11507,7 @@ var StreamChat = /*#__PURE__*/function () {
11510
11507
  }, _callee65, this);
11511
11508
  }));
11512
11509
 
11513
- function createUserSegment(_x91, _x92, _x93) {
11510
+ function createUserSegment(_x90, _x91) {
11514
11511
  return _createUserSegment.apply(this, arguments);
11515
11512
  }
11516
11513
 
@@ -11519,7 +11516,7 @@ var StreamChat = /*#__PURE__*/function () {
11519
11516
  /**
11520
11517
  * createChannelSegment - Creates a channel segment
11521
11518
  *
11522
- * @param {string} id Segment ID (valid UUID)
11519
+ * @param {string} id Segment ID
11523
11520
  * @param {string} name Segment name
11524
11521
  * @param {SegmentData} data Segment data
11525
11522
  *
@@ -11529,13 +11526,13 @@ var StreamChat = /*#__PURE__*/function () {
11529
11526
  }, {
11530
11527
  key: "createChannelSegment",
11531
11528
  value: function () {
11532
- var _createChannelSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66(id, name, data) {
11529
+ var _createChannelSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66(id, data) {
11533
11530
  return _regeneratorRuntime.wrap(function _callee66$(_context66) {
11534
11531
  while (1) {
11535
11532
  switch (_context66.prev = _context66.next) {
11536
11533
  case 0:
11537
11534
  this.validateServerSideAuth();
11538
- return _context66.abrupt("return", this.createSegment('channel', id, name, data));
11535
+ return _context66.abrupt("return", this.createSegment('channel', id, data));
11539
11536
 
11540
11537
  case 2:
11541
11538
  case "end":
@@ -11545,7 +11542,7 @@ var StreamChat = /*#__PURE__*/function () {
11545
11542
  }, _callee66, this);
11546
11543
  }));
11547
11544
 
11548
- function createChannelSegment(_x94, _x95, _x96) {
11545
+ function createChannelSegment(_x92, _x93) {
11549
11546
  return _createChannelSegment.apply(this, arguments);
11550
11547
  }
11551
11548
 
@@ -11570,7 +11567,7 @@ var StreamChat = /*#__PURE__*/function () {
11570
11567
  }, _callee67, this);
11571
11568
  }));
11572
11569
 
11573
- function getSegment(_x97) {
11570
+ function getSegment(_x94) {
11574
11571
  return _getSegment.apply(this, arguments);
11575
11572
  }
11576
11573
 
@@ -11604,7 +11601,7 @@ var StreamChat = /*#__PURE__*/function () {
11604
11601
  }, _callee68, this);
11605
11602
  }));
11606
11603
 
11607
- function updateSegment(_x98, _x99) {
11604
+ function updateSegment(_x95, _x96) {
11608
11605
  return _updateSegment.apply(this, arguments);
11609
11606
  }
11610
11607
 
@@ -11642,7 +11639,7 @@ var StreamChat = /*#__PURE__*/function () {
11642
11639
  }, _callee69, this);
11643
11640
  }));
11644
11641
 
11645
- function addSegmentTargets(_x100, _x101) {
11642
+ function addSegmentTargets(_x97, _x98) {
11646
11643
  return _addSegmentTargets.apply(this, arguments);
11647
11644
  }
11648
11645
 
@@ -11677,7 +11674,7 @@ var StreamChat = /*#__PURE__*/function () {
11677
11674
  }, _callee70, this);
11678
11675
  }));
11679
11676
 
11680
- function querySegmentTargets(_x102) {
11677
+ function querySegmentTargets(_x99) {
11681
11678
  return _querySegmentTargets.apply(this, arguments);
11682
11679
  }
11683
11680
 
@@ -11715,7 +11712,7 @@ var StreamChat = /*#__PURE__*/function () {
11715
11712
  }, _callee71, this);
11716
11713
  }));
11717
11714
 
11718
- function removeSegmentTargets(_x103, _x104) {
11715
+ function removeSegmentTargets(_x100, _x101) {
11719
11716
  return _removeSegmentTargets.apply(this, arguments);
11720
11717
  }
11721
11718
 
@@ -11755,7 +11752,7 @@ var StreamChat = /*#__PURE__*/function () {
11755
11752
  }, _callee72, this);
11756
11753
  }));
11757
11754
 
11758
- function querySegments(_x105, _x106) {
11755
+ function querySegments(_x102, _x103) {
11759
11756
  return _querySegments.apply(this, arguments);
11760
11757
  }
11761
11758
 
@@ -11788,7 +11785,7 @@ var StreamChat = /*#__PURE__*/function () {
11788
11785
  }, _callee73, this);
11789
11786
  }));
11790
11787
 
11791
- function deleteSegment(_x107) {
11788
+ function deleteSegment(_x104) {
11792
11789
  return _deleteSegment.apply(this, arguments);
11793
11790
  }
11794
11791
 
@@ -11822,7 +11819,7 @@ var StreamChat = /*#__PURE__*/function () {
11822
11819
  }, _callee74, this);
11823
11820
  }));
11824
11821
 
11825
- function segmentTargetExists(_x108, _x109) {
11822
+ function segmentTargetExists(_x105, _x106) {
11826
11823
  return _segmentTargetExists.apply(this, arguments);
11827
11824
  }
11828
11825
 
@@ -11855,7 +11852,7 @@ var StreamChat = /*#__PURE__*/function () {
11855
11852
  }, _callee75, this);
11856
11853
  }));
11857
11854
 
11858
- function createCampaign(_x110) {
11855
+ function createCampaign(_x107) {
11859
11856
  return _createCampaign.apply(this, arguments);
11860
11857
  }
11861
11858
 
@@ -11880,7 +11877,7 @@ var StreamChat = /*#__PURE__*/function () {
11880
11877
  }, _callee76, this);
11881
11878
  }));
11882
11879
 
11883
- function getCampaign(_x111) {
11880
+ function getCampaign(_x108) {
11884
11881
  return _getCampaign.apply(this, arguments);
11885
11882
  }
11886
11883
 
@@ -11908,7 +11905,7 @@ var StreamChat = /*#__PURE__*/function () {
11908
11905
  }, _callee77, this);
11909
11906
  }));
11910
11907
 
11911
- function startCampaign(_x112, _x113) {
11908
+ function startCampaign(_x109, _x110) {
11912
11909
  return _startCampaign.apply(this, arguments);
11913
11910
  }
11914
11911
 
@@ -11947,7 +11944,7 @@ var StreamChat = /*#__PURE__*/function () {
11947
11944
  }, _callee78, this);
11948
11945
  }));
11949
11946
 
11950
- function queryCampaigns(_x114, _x115, _x116) {
11947
+ function queryCampaigns(_x111, _x112, _x113) {
11951
11948
  return _queryCampaigns.apply(this, arguments);
11952
11949
  }
11953
11950
 
@@ -11981,7 +11978,7 @@ var StreamChat = /*#__PURE__*/function () {
11981
11978
  }, _callee79, this);
11982
11979
  }));
11983
11980
 
11984
- function updateCampaign(_x117, _x118) {
11981
+ function updateCampaign(_x114, _x115) {
11985
11982
  return _updateCampaign.apply(this, arguments);
11986
11983
  }
11987
11984
 
@@ -12014,7 +12011,7 @@ var StreamChat = /*#__PURE__*/function () {
12014
12011
  }, _callee80, this);
12015
12012
  }));
12016
12013
 
12017
- function deleteCampaign(_x119) {
12014
+ function deleteCampaign(_x116) {
12018
12015
  return _deleteCampaign.apply(this, arguments);
12019
12016
  }
12020
12017
 
@@ -12032,22 +12029,14 @@ var StreamChat = /*#__PURE__*/function () {
12032
12029
  key: "stopCampaign",
12033
12030
  value: function () {
12034
12031
  var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee81(id) {
12035
- var _yield$this$patch, campaign;
12036
-
12037
12032
  return _regeneratorRuntime.wrap(function _callee81$(_context81) {
12038
12033
  while (1) {
12039
12034
  switch (_context81.prev = _context81.next) {
12040
12035
  case 0:
12041
12036
  this.validateServerSideAuth();
12042
- _context81.next = 3;
12043
- return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
12037
+ return _context81.abrupt("return", this.post(this.baseURL + "/campaigns/".concat(id, "/stop")));
12044
12038
 
12045
- case 3:
12046
- _yield$this$patch = _context81.sent;
12047
- campaign = _yield$this$patch.campaign;
12048
- return _context81.abrupt("return", campaign);
12049
-
12050
- case 6:
12039
+ case 2:
12051
12040
  case "end":
12052
12041
  return _context81.stop();
12053
12042
  }
@@ -12055,7 +12044,7 @@ var StreamChat = /*#__PURE__*/function () {
12055
12044
  }, _callee81, this);
12056
12045
  }));
12057
12046
 
12058
- function stopCampaign(_x120) {
12047
+ function stopCampaign(_x117) {
12059
12048
  return _stopCampaign.apply(this, arguments);
12060
12049
  }
12061
12050
 
@@ -12088,7 +12077,7 @@ var StreamChat = /*#__PURE__*/function () {
12088
12077
  }, _callee82, this);
12089
12078
  }));
12090
12079
 
12091
- function enrichURL(_x121) {
12080
+ function enrichURL(_x118) {
12092
12081
  return _enrichURL.apply(this, arguments);
12093
12082
  }
12094
12083
 
@@ -12120,7 +12109,7 @@ var StreamChat = /*#__PURE__*/function () {
12120
12109
  }, _callee83, this);
12121
12110
  }));
12122
12111
 
12123
- function getTask(_x122) {
12112
+ function getTask(_x119) {
12124
12113
  return _getTask.apply(this, arguments);
12125
12114
  }
12126
12115
 
@@ -12162,7 +12151,7 @@ var StreamChat = /*#__PURE__*/function () {
12162
12151
  }, _callee84, this);
12163
12152
  }));
12164
12153
 
12165
- function deleteChannels(_x123) {
12154
+ function deleteChannels(_x120) {
12166
12155
  return _deleteChannels.apply(this, arguments);
12167
12156
  }
12168
12157
 
@@ -12229,7 +12218,7 @@ var StreamChat = /*#__PURE__*/function () {
12229
12218
  }, _callee85, this);
12230
12219
  }));
12231
12220
 
12232
- function deleteUsers(_x124) {
12221
+ function deleteUsers(_x121) {
12233
12222
  return _deleteUsers.apply(this, arguments);
12234
12223
  }
12235
12224
 
@@ -12271,7 +12260,7 @@ var StreamChat = /*#__PURE__*/function () {
12271
12260
  }, _callee86, this);
12272
12261
  }));
12273
12262
 
12274
- function _createImportURL(_x125) {
12263
+ function _createImportURL(_x122) {
12275
12264
  return _createImportURL2.apply(this, arguments);
12276
12265
  }
12277
12266
 
@@ -12319,7 +12308,7 @@ var StreamChat = /*#__PURE__*/function () {
12319
12308
  }, _callee87, this);
12320
12309
  }));
12321
12310
 
12322
- function _createImport(_x126) {
12311
+ function _createImport(_x123) {
12323
12312
  return _createImport2.apply(this, arguments);
12324
12313
  }
12325
12314
 
@@ -12360,7 +12349,7 @@ var StreamChat = /*#__PURE__*/function () {
12360
12349
  }, _callee88, this);
12361
12350
  }));
12362
12351
 
12363
- function _getImport(_x127) {
12352
+ function _getImport(_x124) {
12364
12353
  return _getImport2.apply(this, arguments);
12365
12354
  }
12366
12355
 
@@ -12401,7 +12390,7 @@ var StreamChat = /*#__PURE__*/function () {
12401
12390
  }, _callee89, this);
12402
12391
  }));
12403
12392
 
12404
- function _listImports(_x128) {
12393
+ function _listImports(_x125) {
12405
12394
  return _listImports2.apply(this, arguments);
12406
12395
  }
12407
12396
 
@@ -12441,7 +12430,7 @@ var StreamChat = /*#__PURE__*/function () {
12441
12430
  }, _callee90, this);
12442
12431
  }));
12443
12432
 
12444
- function upsertPushProvider(_x129) {
12433
+ function upsertPushProvider(_x126) {
12445
12434
  return _upsertPushProvider.apply(this, arguments);
12446
12435
  }
12447
12436
 
@@ -12481,7 +12470,7 @@ var StreamChat = /*#__PURE__*/function () {
12481
12470
  }, _callee91, this);
12482
12471
  }));
12483
12472
 
12484
- function deletePushProvider(_x130) {
12473
+ function deletePushProvider(_x127) {
12485
12474
  return _deletePushProvider.apply(this, arguments);
12486
12475
  }
12487
12476
 
@@ -12561,7 +12550,7 @@ var StreamChat = /*#__PURE__*/function () {
12561
12550
  }, _callee93, this);
12562
12551
  }));
12563
12552
 
12564
- function commitMessage(_x131) {
12553
+ function commitMessage(_x128) {
12565
12554
  return _commitMessage.apply(this, arguments);
12566
12555
  }
12567
12556