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.
package/dist/index.es.js CHANGED
@@ -6223,7 +6223,7 @@ var Campaign = /*#__PURE__*/function () {
6223
6223
  case 0:
6224
6224
  this.verifyCampaignId();
6225
6225
  _context4.next = 3;
6226
- return this.client.delete(this.client.baseURL + "/campaigns/".concat(this.id));
6226
+ return this.client.deleteCampaign(this.id);
6227
6227
 
6228
6228
  case 3:
6229
6229
  return _context4.abrupt("return", _context4.sent);
@@ -6251,7 +6251,7 @@ var Campaign = /*#__PURE__*/function () {
6251
6251
  switch (_context5.prev = _context5.next) {
6252
6252
  case 0:
6253
6253
  this.verifyCampaignId();
6254
- return _context5.abrupt("return", this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/stop")));
6254
+ return _context5.abrupt("return", this.client.stopCampaign(this.id));
6255
6255
 
6256
6256
  case 2:
6257
6257
  case "end":
@@ -6319,7 +6319,7 @@ var Segment = /*#__PURE__*/function () {
6319
6319
  key: "create",
6320
6320
  value: function () {
6321
6321
  var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
6322
- var _this$data, _this$data2, _this$data3, _this$data4;
6322
+ var _this$data, _this$data2, _this$data3, _this$data4, _this$data5;
6323
6323
 
6324
6324
  var body;
6325
6325
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -6327,14 +6327,13 @@ var Segment = /*#__PURE__*/function () {
6327
6327
  switch (_context.prev = _context.next) {
6328
6328
  case 0:
6329
6329
  body = {
6330
- id: this.id,
6331
- type: this.type,
6332
6330
  name: (_this$data = this.data) === null || _this$data === void 0 ? void 0 : _this$data.name,
6333
6331
  filter: (_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2.filter,
6334
6332
  description: (_this$data3 = this.data) === null || _this$data3 === void 0 ? void 0 : _this$data3.description,
6335
- all_users: (_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.all_users
6333
+ all_sender_channels: (_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.all_sender_channels,
6334
+ all_users: (_this$data5 = this.data) === null || _this$data5 === void 0 ? void 0 : _this$data5.all_users
6336
6335
  };
6337
- return _context.abrupt("return", this.client.post(this.client.baseURL + "/segments", body));
6336
+ return _context.abrupt("return", this.client.createSegment(this.type, this.id, body));
6338
6337
 
6339
6338
  case 2:
6340
6339
  case "end":
@@ -11118,7 +11117,7 @@ var StreamChat = /*#__PURE__*/function () {
11118
11117
  }, {
11119
11118
  key: "getUserAgent",
11120
11119
  value: function getUserAgent() {
11121
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.23.1");
11120
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.25.0");
11122
11121
  }
11123
11122
  }, {
11124
11123
  key: "setUserAgent",
@@ -11418,11 +11417,11 @@ var StreamChat = /*#__PURE__*/function () {
11418
11417
  }, {
11419
11418
  key: "campaign",
11420
11419
  value: function campaign(idOrData, data) {
11421
- if (typeof idOrData === 'string') {
11422
- return new Campaign(this, idOrData, data);
11420
+ if (idOrData && _typeof(idOrData) === 'object') {
11421
+ return new Campaign(this, null, idOrData);
11423
11422
  }
11424
11423
 
11425
- return new Campaign(this, null, idOrData);
11424
+ return new Campaign(this, idOrData, data);
11426
11425
  }
11427
11426
  }, {
11428
11427
  key: "segment",
@@ -11445,8 +11444,8 @@ var StreamChat = /*#__PURE__*/function () {
11445
11444
  *
11446
11445
  * @private
11447
11446
  * @param {SegmentType} type Segment type
11448
- * @param {string} id Segment ID (valid UUID)
11449
- * @param {string} name Segment name (valid UUID)
11447
+ * @param {string} id Segment ID
11448
+ * @param {string} name Segment name
11450
11449
  * @param {SegmentData} params Segment data
11451
11450
  *
11452
11451
  * @return {{segment: SegmentResponse} & APIResponse} The created Segment
@@ -11455,19 +11454,17 @@ var StreamChat = /*#__PURE__*/function () {
11455
11454
  }, {
11456
11455
  key: "createSegment",
11457
11456
  value: function () {
11458
- var _createSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64(type, id, name, data) {
11457
+ var _createSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64(type, id, data) {
11459
11458
  var body;
11460
11459
  return _regeneratorRuntime.wrap(function _callee64$(_context64) {
11461
11460
  while (1) {
11462
11461
  switch (_context64.prev = _context64.next) {
11463
11462
  case 0:
11464
11463
  this.validateServerSideAuth();
11465
- body = {
11464
+ body = _objectSpread({
11466
11465
  id: id,
11467
- type: type,
11468
- name: name,
11469
- data: data
11470
- };
11466
+ type: type
11467
+ }, data);
11471
11468
  return _context64.abrupt("return", this.post(this.baseURL + "/segments", body));
11472
11469
 
11473
11470
  case 3:
@@ -11478,7 +11475,7 @@ var StreamChat = /*#__PURE__*/function () {
11478
11475
  }, _callee64, this);
11479
11476
  }));
11480
11477
 
11481
- function createSegment(_x87, _x88, _x89, _x90) {
11478
+ function createSegment(_x87, _x88, _x89) {
11482
11479
  return _createSegment.apply(this, arguments);
11483
11480
  }
11484
11481
 
@@ -11487,7 +11484,7 @@ var StreamChat = /*#__PURE__*/function () {
11487
11484
  /**
11488
11485
  * createUserSegment - Creates a user segment
11489
11486
  *
11490
- * @param {string} id Segment ID (valid UUID)
11487
+ * @param {string} id Segment ID
11491
11488
  * @param {string} name Segment name
11492
11489
  * @param {SegmentData} data Segment data
11493
11490
  *
@@ -11497,13 +11494,13 @@ var StreamChat = /*#__PURE__*/function () {
11497
11494
  }, {
11498
11495
  key: "createUserSegment",
11499
11496
  value: function () {
11500
- var _createUserSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(id, name, data) {
11497
+ var _createUserSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(id, data) {
11501
11498
  return _regeneratorRuntime.wrap(function _callee65$(_context65) {
11502
11499
  while (1) {
11503
11500
  switch (_context65.prev = _context65.next) {
11504
11501
  case 0:
11505
11502
  this.validateServerSideAuth();
11506
- return _context65.abrupt("return", this.createSegment('user', id, name, data));
11503
+ return _context65.abrupt("return", this.createSegment('user', id, data));
11507
11504
 
11508
11505
  case 2:
11509
11506
  case "end":
@@ -11513,7 +11510,7 @@ var StreamChat = /*#__PURE__*/function () {
11513
11510
  }, _callee65, this);
11514
11511
  }));
11515
11512
 
11516
- function createUserSegment(_x91, _x92, _x93) {
11513
+ function createUserSegment(_x90, _x91) {
11517
11514
  return _createUserSegment.apply(this, arguments);
11518
11515
  }
11519
11516
 
@@ -11522,7 +11519,7 @@ var StreamChat = /*#__PURE__*/function () {
11522
11519
  /**
11523
11520
  * createChannelSegment - Creates a channel segment
11524
11521
  *
11525
- * @param {string} id Segment ID (valid UUID)
11522
+ * @param {string} id Segment ID
11526
11523
  * @param {string} name Segment name
11527
11524
  * @param {SegmentData} data Segment data
11528
11525
  *
@@ -11532,13 +11529,13 @@ var StreamChat = /*#__PURE__*/function () {
11532
11529
  }, {
11533
11530
  key: "createChannelSegment",
11534
11531
  value: function () {
11535
- var _createChannelSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66(id, name, data) {
11532
+ var _createChannelSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66(id, data) {
11536
11533
  return _regeneratorRuntime.wrap(function _callee66$(_context66) {
11537
11534
  while (1) {
11538
11535
  switch (_context66.prev = _context66.next) {
11539
11536
  case 0:
11540
11537
  this.validateServerSideAuth();
11541
- return _context66.abrupt("return", this.createSegment('channel', id, name, data));
11538
+ return _context66.abrupt("return", this.createSegment('channel', id, data));
11542
11539
 
11543
11540
  case 2:
11544
11541
  case "end":
@@ -11548,7 +11545,7 @@ var StreamChat = /*#__PURE__*/function () {
11548
11545
  }, _callee66, this);
11549
11546
  }));
11550
11547
 
11551
- function createChannelSegment(_x94, _x95, _x96) {
11548
+ function createChannelSegment(_x92, _x93) {
11552
11549
  return _createChannelSegment.apply(this, arguments);
11553
11550
  }
11554
11551
 
@@ -11573,7 +11570,7 @@ var StreamChat = /*#__PURE__*/function () {
11573
11570
  }, _callee67, this);
11574
11571
  }));
11575
11572
 
11576
- function getSegment(_x97) {
11573
+ function getSegment(_x94) {
11577
11574
  return _getSegment.apply(this, arguments);
11578
11575
  }
11579
11576
 
@@ -11607,7 +11604,7 @@ var StreamChat = /*#__PURE__*/function () {
11607
11604
  }, _callee68, this);
11608
11605
  }));
11609
11606
 
11610
- function updateSegment(_x98, _x99) {
11607
+ function updateSegment(_x95, _x96) {
11611
11608
  return _updateSegment.apply(this, arguments);
11612
11609
  }
11613
11610
 
@@ -11645,7 +11642,7 @@ var StreamChat = /*#__PURE__*/function () {
11645
11642
  }, _callee69, this);
11646
11643
  }));
11647
11644
 
11648
- function addSegmentTargets(_x100, _x101) {
11645
+ function addSegmentTargets(_x97, _x98) {
11649
11646
  return _addSegmentTargets.apply(this, arguments);
11650
11647
  }
11651
11648
 
@@ -11680,7 +11677,7 @@ var StreamChat = /*#__PURE__*/function () {
11680
11677
  }, _callee70, this);
11681
11678
  }));
11682
11679
 
11683
- function querySegmentTargets(_x102) {
11680
+ function querySegmentTargets(_x99) {
11684
11681
  return _querySegmentTargets.apply(this, arguments);
11685
11682
  }
11686
11683
 
@@ -11718,7 +11715,7 @@ var StreamChat = /*#__PURE__*/function () {
11718
11715
  }, _callee71, this);
11719
11716
  }));
11720
11717
 
11721
- function removeSegmentTargets(_x103, _x104) {
11718
+ function removeSegmentTargets(_x100, _x101) {
11722
11719
  return _removeSegmentTargets.apply(this, arguments);
11723
11720
  }
11724
11721
 
@@ -11758,7 +11755,7 @@ var StreamChat = /*#__PURE__*/function () {
11758
11755
  }, _callee72, this);
11759
11756
  }));
11760
11757
 
11761
- function querySegments(_x105, _x106) {
11758
+ function querySegments(_x102, _x103) {
11762
11759
  return _querySegments.apply(this, arguments);
11763
11760
  }
11764
11761
 
@@ -11791,7 +11788,7 @@ var StreamChat = /*#__PURE__*/function () {
11791
11788
  }, _callee73, this);
11792
11789
  }));
11793
11790
 
11794
- function deleteSegment(_x107) {
11791
+ function deleteSegment(_x104) {
11795
11792
  return _deleteSegment.apply(this, arguments);
11796
11793
  }
11797
11794
 
@@ -11825,7 +11822,7 @@ var StreamChat = /*#__PURE__*/function () {
11825
11822
  }, _callee74, this);
11826
11823
  }));
11827
11824
 
11828
- function segmentTargetExists(_x108, _x109) {
11825
+ function segmentTargetExists(_x105, _x106) {
11829
11826
  return _segmentTargetExists.apply(this, arguments);
11830
11827
  }
11831
11828
 
@@ -11858,7 +11855,7 @@ var StreamChat = /*#__PURE__*/function () {
11858
11855
  }, _callee75, this);
11859
11856
  }));
11860
11857
 
11861
- function createCampaign(_x110) {
11858
+ function createCampaign(_x107) {
11862
11859
  return _createCampaign.apply(this, arguments);
11863
11860
  }
11864
11861
 
@@ -11883,7 +11880,7 @@ var StreamChat = /*#__PURE__*/function () {
11883
11880
  }, _callee76, this);
11884
11881
  }));
11885
11882
 
11886
- function getCampaign(_x111) {
11883
+ function getCampaign(_x108) {
11887
11884
  return _getCampaign.apply(this, arguments);
11888
11885
  }
11889
11886
 
@@ -11911,7 +11908,7 @@ var StreamChat = /*#__PURE__*/function () {
11911
11908
  }, _callee77, this);
11912
11909
  }));
11913
11910
 
11914
- function startCampaign(_x112, _x113) {
11911
+ function startCampaign(_x109, _x110) {
11915
11912
  return _startCampaign.apply(this, arguments);
11916
11913
  }
11917
11914
 
@@ -11950,7 +11947,7 @@ var StreamChat = /*#__PURE__*/function () {
11950
11947
  }, _callee78, this);
11951
11948
  }));
11952
11949
 
11953
- function queryCampaigns(_x114, _x115, _x116) {
11950
+ function queryCampaigns(_x111, _x112, _x113) {
11954
11951
  return _queryCampaigns.apply(this, arguments);
11955
11952
  }
11956
11953
 
@@ -11984,7 +11981,7 @@ var StreamChat = /*#__PURE__*/function () {
11984
11981
  }, _callee79, this);
11985
11982
  }));
11986
11983
 
11987
- function updateCampaign(_x117, _x118) {
11984
+ function updateCampaign(_x114, _x115) {
11988
11985
  return _updateCampaign.apply(this, arguments);
11989
11986
  }
11990
11987
 
@@ -12017,7 +12014,7 @@ var StreamChat = /*#__PURE__*/function () {
12017
12014
  }, _callee80, this);
12018
12015
  }));
12019
12016
 
12020
- function deleteCampaign(_x119) {
12017
+ function deleteCampaign(_x116) {
12021
12018
  return _deleteCampaign.apply(this, arguments);
12022
12019
  }
12023
12020
 
@@ -12035,22 +12032,14 @@ var StreamChat = /*#__PURE__*/function () {
12035
12032
  key: "stopCampaign",
12036
12033
  value: function () {
12037
12034
  var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee81(id) {
12038
- var _yield$this$patch, campaign;
12039
-
12040
12035
  return _regeneratorRuntime.wrap(function _callee81$(_context81) {
12041
12036
  while (1) {
12042
12037
  switch (_context81.prev = _context81.next) {
12043
12038
  case 0:
12044
12039
  this.validateServerSideAuth();
12045
- _context81.next = 3;
12046
- return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
12040
+ return _context81.abrupt("return", this.post(this.baseURL + "/campaigns/".concat(id, "/stop")));
12047
12041
 
12048
- case 3:
12049
- _yield$this$patch = _context81.sent;
12050
- campaign = _yield$this$patch.campaign;
12051
- return _context81.abrupt("return", campaign);
12052
-
12053
- case 6:
12042
+ case 2:
12054
12043
  case "end":
12055
12044
  return _context81.stop();
12056
12045
  }
@@ -12058,7 +12047,7 @@ var StreamChat = /*#__PURE__*/function () {
12058
12047
  }, _callee81, this);
12059
12048
  }));
12060
12049
 
12061
- function stopCampaign(_x120) {
12050
+ function stopCampaign(_x117) {
12062
12051
  return _stopCampaign.apply(this, arguments);
12063
12052
  }
12064
12053
 
@@ -12091,7 +12080,7 @@ var StreamChat = /*#__PURE__*/function () {
12091
12080
  }, _callee82, this);
12092
12081
  }));
12093
12082
 
12094
- function enrichURL(_x121) {
12083
+ function enrichURL(_x118) {
12095
12084
  return _enrichURL.apply(this, arguments);
12096
12085
  }
12097
12086
 
@@ -12123,7 +12112,7 @@ var StreamChat = /*#__PURE__*/function () {
12123
12112
  }, _callee83, this);
12124
12113
  }));
12125
12114
 
12126
- function getTask(_x122) {
12115
+ function getTask(_x119) {
12127
12116
  return _getTask.apply(this, arguments);
12128
12117
  }
12129
12118
 
@@ -12165,7 +12154,7 @@ var StreamChat = /*#__PURE__*/function () {
12165
12154
  }, _callee84, this);
12166
12155
  }));
12167
12156
 
12168
- function deleteChannels(_x123) {
12157
+ function deleteChannels(_x120) {
12169
12158
  return _deleteChannels.apply(this, arguments);
12170
12159
  }
12171
12160
 
@@ -12232,7 +12221,7 @@ var StreamChat = /*#__PURE__*/function () {
12232
12221
  }, _callee85, this);
12233
12222
  }));
12234
12223
 
12235
- function deleteUsers(_x124) {
12224
+ function deleteUsers(_x121) {
12236
12225
  return _deleteUsers.apply(this, arguments);
12237
12226
  }
12238
12227
 
@@ -12274,7 +12263,7 @@ var StreamChat = /*#__PURE__*/function () {
12274
12263
  }, _callee86, this);
12275
12264
  }));
12276
12265
 
12277
- function _createImportURL(_x125) {
12266
+ function _createImportURL(_x122) {
12278
12267
  return _createImportURL2.apply(this, arguments);
12279
12268
  }
12280
12269
 
@@ -12322,7 +12311,7 @@ var StreamChat = /*#__PURE__*/function () {
12322
12311
  }, _callee87, this);
12323
12312
  }));
12324
12313
 
12325
- function _createImport(_x126) {
12314
+ function _createImport(_x123) {
12326
12315
  return _createImport2.apply(this, arguments);
12327
12316
  }
12328
12317
 
@@ -12363,7 +12352,7 @@ var StreamChat = /*#__PURE__*/function () {
12363
12352
  }, _callee88, this);
12364
12353
  }));
12365
12354
 
12366
- function _getImport(_x127) {
12355
+ function _getImport(_x124) {
12367
12356
  return _getImport2.apply(this, arguments);
12368
12357
  }
12369
12358
 
@@ -12404,7 +12393,7 @@ var StreamChat = /*#__PURE__*/function () {
12404
12393
  }, _callee89, this);
12405
12394
  }));
12406
12395
 
12407
- function _listImports(_x128) {
12396
+ function _listImports(_x125) {
12408
12397
  return _listImports2.apply(this, arguments);
12409
12398
  }
12410
12399
 
@@ -12444,7 +12433,7 @@ var StreamChat = /*#__PURE__*/function () {
12444
12433
  }, _callee90, this);
12445
12434
  }));
12446
12435
 
12447
- function upsertPushProvider(_x129) {
12436
+ function upsertPushProvider(_x126) {
12448
12437
  return _upsertPushProvider.apply(this, arguments);
12449
12438
  }
12450
12439
 
@@ -12484,7 +12473,7 @@ var StreamChat = /*#__PURE__*/function () {
12484
12473
  }, _callee91, this);
12485
12474
  }));
12486
12475
 
12487
- function deletePushProvider(_x130) {
12476
+ function deletePushProvider(_x127) {
12488
12477
  return _deletePushProvider.apply(this, arguments);
12489
12478
  }
12490
12479
 
@@ -12564,7 +12553,7 @@ var StreamChat = /*#__PURE__*/function () {
12564
12553
  }, _callee93, this);
12565
12554
  }));
12566
12555
 
12567
- function commitMessage(_x131) {
12556
+ function commitMessage(_x128) {
12568
12557
  return _commitMessage.apply(this, arguments);
12569
12558
  }
12570
12559