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.js CHANGED
@@ -6251,7 +6251,7 @@ var Campaign = /*#__PURE__*/function () {
6251
6251
  case 0:
6252
6252
  this.verifyCampaignId();
6253
6253
  _context4.next = 3;
6254
- return this.client.delete(this.client.baseURL + "/campaigns/".concat(this.id));
6254
+ return this.client.deleteCampaign(this.id);
6255
6255
 
6256
6256
  case 3:
6257
6257
  return _context4.abrupt("return", _context4.sent);
@@ -6279,7 +6279,7 @@ var Campaign = /*#__PURE__*/function () {
6279
6279
  switch (_context5.prev = _context5.next) {
6280
6280
  case 0:
6281
6281
  this.verifyCampaignId();
6282
- return _context5.abrupt("return", this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/stop")));
6282
+ return _context5.abrupt("return", this.client.stopCampaign(this.id));
6283
6283
 
6284
6284
  case 2:
6285
6285
  case "end":
@@ -6347,7 +6347,7 @@ var Segment = /*#__PURE__*/function () {
6347
6347
  key: "create",
6348
6348
  value: function () {
6349
6349
  var _create = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
6350
- var _this$data, _this$data2, _this$data3, _this$data4;
6350
+ var _this$data, _this$data2, _this$data3, _this$data4, _this$data5;
6351
6351
 
6352
6352
  var body;
6353
6353
  return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
@@ -6355,14 +6355,13 @@ var Segment = /*#__PURE__*/function () {
6355
6355
  switch (_context.prev = _context.next) {
6356
6356
  case 0:
6357
6357
  body = {
6358
- id: this.id,
6359
- type: this.type,
6360
6358
  name: (_this$data = this.data) === null || _this$data === void 0 ? void 0 : _this$data.name,
6361
6359
  filter: (_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2.filter,
6362
6360
  description: (_this$data3 = this.data) === null || _this$data3 === void 0 ? void 0 : _this$data3.description,
6363
- all_users: (_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.all_users
6361
+ all_sender_channels: (_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.all_sender_channels,
6362
+ all_users: (_this$data5 = this.data) === null || _this$data5 === void 0 ? void 0 : _this$data5.all_users
6364
6363
  };
6365
- return _context.abrupt("return", this.client.post(this.client.baseURL + "/segments", body));
6364
+ return _context.abrupt("return", this.client.createSegment(this.type, this.id, body));
6366
6365
 
6367
6366
  case 2:
6368
6367
  case "end":
@@ -11146,7 +11145,7 @@ var StreamChat = /*#__PURE__*/function () {
11146
11145
  }, {
11147
11146
  key: "getUserAgent",
11148
11147
  value: function getUserAgent() {
11149
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.23.1");
11148
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.25.0");
11150
11149
  }
11151
11150
  }, {
11152
11151
  key: "setUserAgent",
@@ -11446,11 +11445,11 @@ var StreamChat = /*#__PURE__*/function () {
11446
11445
  }, {
11447
11446
  key: "campaign",
11448
11447
  value: function campaign(idOrData, data) {
11449
- if (typeof idOrData === 'string') {
11450
- return new Campaign(this, idOrData, data);
11448
+ if (idOrData && _typeof__default['default'](idOrData) === 'object') {
11449
+ return new Campaign(this, null, idOrData);
11451
11450
  }
11452
11451
 
11453
- return new Campaign(this, null, idOrData);
11452
+ return new Campaign(this, idOrData, data);
11454
11453
  }
11455
11454
  }, {
11456
11455
  key: "segment",
@@ -11473,8 +11472,8 @@ var StreamChat = /*#__PURE__*/function () {
11473
11472
  *
11474
11473
  * @private
11475
11474
  * @param {SegmentType} type Segment type
11476
- * @param {string} id Segment ID (valid UUID)
11477
- * @param {string} name Segment name (valid UUID)
11475
+ * @param {string} id Segment ID
11476
+ * @param {string} name Segment name
11478
11477
  * @param {SegmentData} params Segment data
11479
11478
  *
11480
11479
  * @return {{segment: SegmentResponse} & APIResponse} The created Segment
@@ -11483,19 +11482,17 @@ var StreamChat = /*#__PURE__*/function () {
11483
11482
  }, {
11484
11483
  key: "createSegment",
11485
11484
  value: function () {
11486
- var _createSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee64(type, id, name, data) {
11485
+ var _createSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee64(type, id, data) {
11487
11486
  var body;
11488
11487
  return _regeneratorRuntime__default['default'].wrap(function _callee64$(_context64) {
11489
11488
  while (1) {
11490
11489
  switch (_context64.prev = _context64.next) {
11491
11490
  case 0:
11492
11491
  this.validateServerSideAuth();
11493
- body = {
11492
+ body = _objectSpread({
11494
11493
  id: id,
11495
- type: type,
11496
- name: name,
11497
- data: data
11498
- };
11494
+ type: type
11495
+ }, data);
11499
11496
  return _context64.abrupt("return", this.post(this.baseURL + "/segments", body));
11500
11497
 
11501
11498
  case 3:
@@ -11506,7 +11503,7 @@ var StreamChat = /*#__PURE__*/function () {
11506
11503
  }, _callee64, this);
11507
11504
  }));
11508
11505
 
11509
- function createSegment(_x87, _x88, _x89, _x90) {
11506
+ function createSegment(_x87, _x88, _x89) {
11510
11507
  return _createSegment.apply(this, arguments);
11511
11508
  }
11512
11509
 
@@ -11515,7 +11512,7 @@ var StreamChat = /*#__PURE__*/function () {
11515
11512
  /**
11516
11513
  * createUserSegment - Creates a user segment
11517
11514
  *
11518
- * @param {string} id Segment ID (valid UUID)
11515
+ * @param {string} id Segment ID
11519
11516
  * @param {string} name Segment name
11520
11517
  * @param {SegmentData} data Segment data
11521
11518
  *
@@ -11525,13 +11522,13 @@ var StreamChat = /*#__PURE__*/function () {
11525
11522
  }, {
11526
11523
  key: "createUserSegment",
11527
11524
  value: function () {
11528
- var _createUserSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee65(id, name, data) {
11525
+ var _createUserSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee65(id, data) {
11529
11526
  return _regeneratorRuntime__default['default'].wrap(function _callee65$(_context65) {
11530
11527
  while (1) {
11531
11528
  switch (_context65.prev = _context65.next) {
11532
11529
  case 0:
11533
11530
  this.validateServerSideAuth();
11534
- return _context65.abrupt("return", this.createSegment('user', id, name, data));
11531
+ return _context65.abrupt("return", this.createSegment('user', id, data));
11535
11532
 
11536
11533
  case 2:
11537
11534
  case "end":
@@ -11541,7 +11538,7 @@ var StreamChat = /*#__PURE__*/function () {
11541
11538
  }, _callee65, this);
11542
11539
  }));
11543
11540
 
11544
- function createUserSegment(_x91, _x92, _x93) {
11541
+ function createUserSegment(_x90, _x91) {
11545
11542
  return _createUserSegment.apply(this, arguments);
11546
11543
  }
11547
11544
 
@@ -11550,7 +11547,7 @@ var StreamChat = /*#__PURE__*/function () {
11550
11547
  /**
11551
11548
  * createChannelSegment - Creates a channel segment
11552
11549
  *
11553
- * @param {string} id Segment ID (valid UUID)
11550
+ * @param {string} id Segment ID
11554
11551
  * @param {string} name Segment name
11555
11552
  * @param {SegmentData} data Segment data
11556
11553
  *
@@ -11560,13 +11557,13 @@ var StreamChat = /*#__PURE__*/function () {
11560
11557
  }, {
11561
11558
  key: "createChannelSegment",
11562
11559
  value: function () {
11563
- var _createChannelSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee66(id, name, data) {
11560
+ var _createChannelSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee66(id, data) {
11564
11561
  return _regeneratorRuntime__default['default'].wrap(function _callee66$(_context66) {
11565
11562
  while (1) {
11566
11563
  switch (_context66.prev = _context66.next) {
11567
11564
  case 0:
11568
11565
  this.validateServerSideAuth();
11569
- return _context66.abrupt("return", this.createSegment('channel', id, name, data));
11566
+ return _context66.abrupt("return", this.createSegment('channel', id, data));
11570
11567
 
11571
11568
  case 2:
11572
11569
  case "end":
@@ -11576,7 +11573,7 @@ var StreamChat = /*#__PURE__*/function () {
11576
11573
  }, _callee66, this);
11577
11574
  }));
11578
11575
 
11579
- function createChannelSegment(_x94, _x95, _x96) {
11576
+ function createChannelSegment(_x92, _x93) {
11580
11577
  return _createChannelSegment.apply(this, arguments);
11581
11578
  }
11582
11579
 
@@ -11601,7 +11598,7 @@ var StreamChat = /*#__PURE__*/function () {
11601
11598
  }, _callee67, this);
11602
11599
  }));
11603
11600
 
11604
- function getSegment(_x97) {
11601
+ function getSegment(_x94) {
11605
11602
  return _getSegment.apply(this, arguments);
11606
11603
  }
11607
11604
 
@@ -11635,7 +11632,7 @@ var StreamChat = /*#__PURE__*/function () {
11635
11632
  }, _callee68, this);
11636
11633
  }));
11637
11634
 
11638
- function updateSegment(_x98, _x99) {
11635
+ function updateSegment(_x95, _x96) {
11639
11636
  return _updateSegment.apply(this, arguments);
11640
11637
  }
11641
11638
 
@@ -11673,7 +11670,7 @@ var StreamChat = /*#__PURE__*/function () {
11673
11670
  }, _callee69, this);
11674
11671
  }));
11675
11672
 
11676
- function addSegmentTargets(_x100, _x101) {
11673
+ function addSegmentTargets(_x97, _x98) {
11677
11674
  return _addSegmentTargets.apply(this, arguments);
11678
11675
  }
11679
11676
 
@@ -11708,7 +11705,7 @@ var StreamChat = /*#__PURE__*/function () {
11708
11705
  }, _callee70, this);
11709
11706
  }));
11710
11707
 
11711
- function querySegmentTargets(_x102) {
11708
+ function querySegmentTargets(_x99) {
11712
11709
  return _querySegmentTargets.apply(this, arguments);
11713
11710
  }
11714
11711
 
@@ -11746,7 +11743,7 @@ var StreamChat = /*#__PURE__*/function () {
11746
11743
  }, _callee71, this);
11747
11744
  }));
11748
11745
 
11749
- function removeSegmentTargets(_x103, _x104) {
11746
+ function removeSegmentTargets(_x100, _x101) {
11750
11747
  return _removeSegmentTargets.apply(this, arguments);
11751
11748
  }
11752
11749
 
@@ -11786,7 +11783,7 @@ var StreamChat = /*#__PURE__*/function () {
11786
11783
  }, _callee72, this);
11787
11784
  }));
11788
11785
 
11789
- function querySegments(_x105, _x106) {
11786
+ function querySegments(_x102, _x103) {
11790
11787
  return _querySegments.apply(this, arguments);
11791
11788
  }
11792
11789
 
@@ -11819,7 +11816,7 @@ var StreamChat = /*#__PURE__*/function () {
11819
11816
  }, _callee73, this);
11820
11817
  }));
11821
11818
 
11822
- function deleteSegment(_x107) {
11819
+ function deleteSegment(_x104) {
11823
11820
  return _deleteSegment.apply(this, arguments);
11824
11821
  }
11825
11822
 
@@ -11853,7 +11850,7 @@ var StreamChat = /*#__PURE__*/function () {
11853
11850
  }, _callee74, this);
11854
11851
  }));
11855
11852
 
11856
- function segmentTargetExists(_x108, _x109) {
11853
+ function segmentTargetExists(_x105, _x106) {
11857
11854
  return _segmentTargetExists.apply(this, arguments);
11858
11855
  }
11859
11856
 
@@ -11886,7 +11883,7 @@ var StreamChat = /*#__PURE__*/function () {
11886
11883
  }, _callee75, this);
11887
11884
  }));
11888
11885
 
11889
- function createCampaign(_x110) {
11886
+ function createCampaign(_x107) {
11890
11887
  return _createCampaign.apply(this, arguments);
11891
11888
  }
11892
11889
 
@@ -11911,7 +11908,7 @@ var StreamChat = /*#__PURE__*/function () {
11911
11908
  }, _callee76, this);
11912
11909
  }));
11913
11910
 
11914
- function getCampaign(_x111) {
11911
+ function getCampaign(_x108) {
11915
11912
  return _getCampaign.apply(this, arguments);
11916
11913
  }
11917
11914
 
@@ -11939,7 +11936,7 @@ var StreamChat = /*#__PURE__*/function () {
11939
11936
  }, _callee77, this);
11940
11937
  }));
11941
11938
 
11942
- function startCampaign(_x112, _x113) {
11939
+ function startCampaign(_x109, _x110) {
11943
11940
  return _startCampaign.apply(this, arguments);
11944
11941
  }
11945
11942
 
@@ -11978,7 +11975,7 @@ var StreamChat = /*#__PURE__*/function () {
11978
11975
  }, _callee78, this);
11979
11976
  }));
11980
11977
 
11981
- function queryCampaigns(_x114, _x115, _x116) {
11978
+ function queryCampaigns(_x111, _x112, _x113) {
11982
11979
  return _queryCampaigns.apply(this, arguments);
11983
11980
  }
11984
11981
 
@@ -12012,7 +12009,7 @@ var StreamChat = /*#__PURE__*/function () {
12012
12009
  }, _callee79, this);
12013
12010
  }));
12014
12011
 
12015
- function updateCampaign(_x117, _x118) {
12012
+ function updateCampaign(_x114, _x115) {
12016
12013
  return _updateCampaign.apply(this, arguments);
12017
12014
  }
12018
12015
 
@@ -12045,7 +12042,7 @@ var StreamChat = /*#__PURE__*/function () {
12045
12042
  }, _callee80, this);
12046
12043
  }));
12047
12044
 
12048
- function deleteCampaign(_x119) {
12045
+ function deleteCampaign(_x116) {
12049
12046
  return _deleteCampaign.apply(this, arguments);
12050
12047
  }
12051
12048
 
@@ -12063,22 +12060,14 @@ var StreamChat = /*#__PURE__*/function () {
12063
12060
  key: "stopCampaign",
12064
12061
  value: function () {
12065
12062
  var _stopCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee81(id) {
12066
- var _yield$this$patch, campaign;
12067
-
12068
12063
  return _regeneratorRuntime__default['default'].wrap(function _callee81$(_context81) {
12069
12064
  while (1) {
12070
12065
  switch (_context81.prev = _context81.next) {
12071
12066
  case 0:
12072
12067
  this.validateServerSideAuth();
12073
- _context81.next = 3;
12074
- return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
12068
+ return _context81.abrupt("return", this.post(this.baseURL + "/campaigns/".concat(id, "/stop")));
12075
12069
 
12076
- case 3:
12077
- _yield$this$patch = _context81.sent;
12078
- campaign = _yield$this$patch.campaign;
12079
- return _context81.abrupt("return", campaign);
12080
-
12081
- case 6:
12070
+ case 2:
12082
12071
  case "end":
12083
12072
  return _context81.stop();
12084
12073
  }
@@ -12086,7 +12075,7 @@ var StreamChat = /*#__PURE__*/function () {
12086
12075
  }, _callee81, this);
12087
12076
  }));
12088
12077
 
12089
- function stopCampaign(_x120) {
12078
+ function stopCampaign(_x117) {
12090
12079
  return _stopCampaign.apply(this, arguments);
12091
12080
  }
12092
12081
 
@@ -12119,7 +12108,7 @@ var StreamChat = /*#__PURE__*/function () {
12119
12108
  }, _callee82, this);
12120
12109
  }));
12121
12110
 
12122
- function enrichURL(_x121) {
12111
+ function enrichURL(_x118) {
12123
12112
  return _enrichURL.apply(this, arguments);
12124
12113
  }
12125
12114
 
@@ -12151,7 +12140,7 @@ var StreamChat = /*#__PURE__*/function () {
12151
12140
  }, _callee83, this);
12152
12141
  }));
12153
12142
 
12154
- function getTask(_x122) {
12143
+ function getTask(_x119) {
12155
12144
  return _getTask.apply(this, arguments);
12156
12145
  }
12157
12146
 
@@ -12193,7 +12182,7 @@ var StreamChat = /*#__PURE__*/function () {
12193
12182
  }, _callee84, this);
12194
12183
  }));
12195
12184
 
12196
- function deleteChannels(_x123) {
12185
+ function deleteChannels(_x120) {
12197
12186
  return _deleteChannels.apply(this, arguments);
12198
12187
  }
12199
12188
 
@@ -12260,7 +12249,7 @@ var StreamChat = /*#__PURE__*/function () {
12260
12249
  }, _callee85, this);
12261
12250
  }));
12262
12251
 
12263
- function deleteUsers(_x124) {
12252
+ function deleteUsers(_x121) {
12264
12253
  return _deleteUsers.apply(this, arguments);
12265
12254
  }
12266
12255
 
@@ -12302,7 +12291,7 @@ var StreamChat = /*#__PURE__*/function () {
12302
12291
  }, _callee86, this);
12303
12292
  }));
12304
12293
 
12305
- function _createImportURL(_x125) {
12294
+ function _createImportURL(_x122) {
12306
12295
  return _createImportURL2.apply(this, arguments);
12307
12296
  }
12308
12297
 
@@ -12350,7 +12339,7 @@ var StreamChat = /*#__PURE__*/function () {
12350
12339
  }, _callee87, this);
12351
12340
  }));
12352
12341
 
12353
- function _createImport(_x126) {
12342
+ function _createImport(_x123) {
12354
12343
  return _createImport2.apply(this, arguments);
12355
12344
  }
12356
12345
 
@@ -12391,7 +12380,7 @@ var StreamChat = /*#__PURE__*/function () {
12391
12380
  }, _callee88, this);
12392
12381
  }));
12393
12382
 
12394
- function _getImport(_x127) {
12383
+ function _getImport(_x124) {
12395
12384
  return _getImport2.apply(this, arguments);
12396
12385
  }
12397
12386
 
@@ -12432,7 +12421,7 @@ var StreamChat = /*#__PURE__*/function () {
12432
12421
  }, _callee89, this);
12433
12422
  }));
12434
12423
 
12435
- function _listImports(_x128) {
12424
+ function _listImports(_x125) {
12436
12425
  return _listImports2.apply(this, arguments);
12437
12426
  }
12438
12427
 
@@ -12472,7 +12461,7 @@ var StreamChat = /*#__PURE__*/function () {
12472
12461
  }, _callee90, this);
12473
12462
  }));
12474
12463
 
12475
- function upsertPushProvider(_x129) {
12464
+ function upsertPushProvider(_x126) {
12476
12465
  return _upsertPushProvider.apply(this, arguments);
12477
12466
  }
12478
12467
 
@@ -12512,7 +12501,7 @@ var StreamChat = /*#__PURE__*/function () {
12512
12501
  }, _callee91, this);
12513
12502
  }));
12514
12503
 
12515
- function deletePushProvider(_x130) {
12504
+ function deletePushProvider(_x127) {
12516
12505
  return _deletePushProvider.apply(this, arguments);
12517
12506
  }
12518
12507
 
@@ -12592,7 +12581,7 @@ var StreamChat = /*#__PURE__*/function () {
12592
12581
  }, _callee93, this);
12593
12582
  }));
12594
12583
 
12595
- function commitMessage(_x131) {
12584
+ function commitMessage(_x128) {
12596
12585
  return _commitMessage.apply(this, arguments);
12597
12586
  }
12598
12587