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/browser.js CHANGED
@@ -6245,7 +6245,7 @@ var Campaign = /*#__PURE__*/function () {
6245
6245
  case 0:
6246
6246
  this.verifyCampaignId();
6247
6247
  _context4.next = 3;
6248
- return this.client.delete(this.client.baseURL + "/campaigns/".concat(this.id));
6248
+ return this.client.deleteCampaign(this.id);
6249
6249
 
6250
6250
  case 3:
6251
6251
  return _context4.abrupt("return", _context4.sent);
@@ -6273,7 +6273,7 @@ var Campaign = /*#__PURE__*/function () {
6273
6273
  switch (_context5.prev = _context5.next) {
6274
6274
  case 0:
6275
6275
  this.verifyCampaignId();
6276
- return _context5.abrupt("return", this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/stop")));
6276
+ return _context5.abrupt("return", this.client.stopCampaign(this.id));
6277
6277
 
6278
6278
  case 2:
6279
6279
  case "end":
@@ -6341,7 +6341,7 @@ var Segment = /*#__PURE__*/function () {
6341
6341
  key: "create",
6342
6342
  value: function () {
6343
6343
  var _create = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
6344
- var _this$data, _this$data2, _this$data3, _this$data4;
6344
+ var _this$data, _this$data2, _this$data3, _this$data4, _this$data5;
6345
6345
 
6346
6346
  var body;
6347
6347
  return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
@@ -6349,14 +6349,13 @@ var Segment = /*#__PURE__*/function () {
6349
6349
  switch (_context.prev = _context.next) {
6350
6350
  case 0:
6351
6351
  body = {
6352
- id: this.id,
6353
- type: this.type,
6354
6352
  name: (_this$data = this.data) === null || _this$data === void 0 ? void 0 : _this$data.name,
6355
6353
  filter: (_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2.filter,
6356
6354
  description: (_this$data3 = this.data) === null || _this$data3 === void 0 ? void 0 : _this$data3.description,
6357
- all_users: (_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.all_users
6355
+ all_sender_channels: (_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.all_sender_channels,
6356
+ all_users: (_this$data5 = this.data) === null || _this$data5 === void 0 ? void 0 : _this$data5.all_users
6358
6357
  };
6359
- return _context.abrupt("return", this.client.post(this.client.baseURL + "/segments", body));
6358
+ return _context.abrupt("return", this.client.createSegment(this.type, this.id, body));
6360
6359
 
6361
6360
  case 2:
6362
6361
  case "end":
@@ -11140,7 +11139,7 @@ var StreamChat = /*#__PURE__*/function () {
11140
11139
  }, {
11141
11140
  key: "getUserAgent",
11142
11141
  value: function getUserAgent() {
11143
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.23.1");
11142
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.25.0");
11144
11143
  }
11145
11144
  }, {
11146
11145
  key: "setUserAgent",
@@ -11440,11 +11439,11 @@ var StreamChat = /*#__PURE__*/function () {
11440
11439
  }, {
11441
11440
  key: "campaign",
11442
11441
  value: function campaign(idOrData, data) {
11443
- if (typeof idOrData === 'string') {
11444
- return new Campaign(this, idOrData, data);
11442
+ if (idOrData && _typeof__default['default'](idOrData) === 'object') {
11443
+ return new Campaign(this, null, idOrData);
11445
11444
  }
11446
11445
 
11447
- return new Campaign(this, null, idOrData);
11446
+ return new Campaign(this, idOrData, data);
11448
11447
  }
11449
11448
  }, {
11450
11449
  key: "segment",
@@ -11467,8 +11466,8 @@ var StreamChat = /*#__PURE__*/function () {
11467
11466
  *
11468
11467
  * @private
11469
11468
  * @param {SegmentType} type Segment type
11470
- * @param {string} id Segment ID (valid UUID)
11471
- * @param {string} name Segment name (valid UUID)
11469
+ * @param {string} id Segment ID
11470
+ * @param {string} name Segment name
11472
11471
  * @param {SegmentData} params Segment data
11473
11472
  *
11474
11473
  * @return {{segment: SegmentResponse} & APIResponse} The created Segment
@@ -11477,19 +11476,17 @@ var StreamChat = /*#__PURE__*/function () {
11477
11476
  }, {
11478
11477
  key: "createSegment",
11479
11478
  value: function () {
11480
- var _createSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee64(type, id, name, data) {
11479
+ var _createSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee64(type, id, data) {
11481
11480
  var body;
11482
11481
  return _regeneratorRuntime__default['default'].wrap(function _callee64$(_context64) {
11483
11482
  while (1) {
11484
11483
  switch (_context64.prev = _context64.next) {
11485
11484
  case 0:
11486
11485
  this.validateServerSideAuth();
11487
- body = {
11486
+ body = _objectSpread({
11488
11487
  id: id,
11489
- type: type,
11490
- name: name,
11491
- data: data
11492
- };
11488
+ type: type
11489
+ }, data);
11493
11490
  return _context64.abrupt("return", this.post(this.baseURL + "/segments", body));
11494
11491
 
11495
11492
  case 3:
@@ -11500,7 +11497,7 @@ var StreamChat = /*#__PURE__*/function () {
11500
11497
  }, _callee64, this);
11501
11498
  }));
11502
11499
 
11503
- function createSegment(_x87, _x88, _x89, _x90) {
11500
+ function createSegment(_x87, _x88, _x89) {
11504
11501
  return _createSegment.apply(this, arguments);
11505
11502
  }
11506
11503
 
@@ -11509,7 +11506,7 @@ var StreamChat = /*#__PURE__*/function () {
11509
11506
  /**
11510
11507
  * createUserSegment - Creates a user segment
11511
11508
  *
11512
- * @param {string} id Segment ID (valid UUID)
11509
+ * @param {string} id Segment ID
11513
11510
  * @param {string} name Segment name
11514
11511
  * @param {SegmentData} data Segment data
11515
11512
  *
@@ -11519,13 +11516,13 @@ var StreamChat = /*#__PURE__*/function () {
11519
11516
  }, {
11520
11517
  key: "createUserSegment",
11521
11518
  value: function () {
11522
- var _createUserSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee65(id, name, data) {
11519
+ var _createUserSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee65(id, data) {
11523
11520
  return _regeneratorRuntime__default['default'].wrap(function _callee65$(_context65) {
11524
11521
  while (1) {
11525
11522
  switch (_context65.prev = _context65.next) {
11526
11523
  case 0:
11527
11524
  this.validateServerSideAuth();
11528
- return _context65.abrupt("return", this.createSegment('user', id, name, data));
11525
+ return _context65.abrupt("return", this.createSegment('user', id, data));
11529
11526
 
11530
11527
  case 2:
11531
11528
  case "end":
@@ -11535,7 +11532,7 @@ var StreamChat = /*#__PURE__*/function () {
11535
11532
  }, _callee65, this);
11536
11533
  }));
11537
11534
 
11538
- function createUserSegment(_x91, _x92, _x93) {
11535
+ function createUserSegment(_x90, _x91) {
11539
11536
  return _createUserSegment.apply(this, arguments);
11540
11537
  }
11541
11538
 
@@ -11544,7 +11541,7 @@ var StreamChat = /*#__PURE__*/function () {
11544
11541
  /**
11545
11542
  * createChannelSegment - Creates a channel segment
11546
11543
  *
11547
- * @param {string} id Segment ID (valid UUID)
11544
+ * @param {string} id Segment ID
11548
11545
  * @param {string} name Segment name
11549
11546
  * @param {SegmentData} data Segment data
11550
11547
  *
@@ -11554,13 +11551,13 @@ var StreamChat = /*#__PURE__*/function () {
11554
11551
  }, {
11555
11552
  key: "createChannelSegment",
11556
11553
  value: function () {
11557
- var _createChannelSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee66(id, name, data) {
11554
+ var _createChannelSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee66(id, data) {
11558
11555
  return _regeneratorRuntime__default['default'].wrap(function _callee66$(_context66) {
11559
11556
  while (1) {
11560
11557
  switch (_context66.prev = _context66.next) {
11561
11558
  case 0:
11562
11559
  this.validateServerSideAuth();
11563
- return _context66.abrupt("return", this.createSegment('channel', id, name, data));
11560
+ return _context66.abrupt("return", this.createSegment('channel', id, data));
11564
11561
 
11565
11562
  case 2:
11566
11563
  case "end":
@@ -11570,7 +11567,7 @@ var StreamChat = /*#__PURE__*/function () {
11570
11567
  }, _callee66, this);
11571
11568
  }));
11572
11569
 
11573
- function createChannelSegment(_x94, _x95, _x96) {
11570
+ function createChannelSegment(_x92, _x93) {
11574
11571
  return _createChannelSegment.apply(this, arguments);
11575
11572
  }
11576
11573
 
@@ -11595,7 +11592,7 @@ var StreamChat = /*#__PURE__*/function () {
11595
11592
  }, _callee67, this);
11596
11593
  }));
11597
11594
 
11598
- function getSegment(_x97) {
11595
+ function getSegment(_x94) {
11599
11596
  return _getSegment.apply(this, arguments);
11600
11597
  }
11601
11598
 
@@ -11629,7 +11626,7 @@ var StreamChat = /*#__PURE__*/function () {
11629
11626
  }, _callee68, this);
11630
11627
  }));
11631
11628
 
11632
- function updateSegment(_x98, _x99) {
11629
+ function updateSegment(_x95, _x96) {
11633
11630
  return _updateSegment.apply(this, arguments);
11634
11631
  }
11635
11632
 
@@ -11667,7 +11664,7 @@ var StreamChat = /*#__PURE__*/function () {
11667
11664
  }, _callee69, this);
11668
11665
  }));
11669
11666
 
11670
- function addSegmentTargets(_x100, _x101) {
11667
+ function addSegmentTargets(_x97, _x98) {
11671
11668
  return _addSegmentTargets.apply(this, arguments);
11672
11669
  }
11673
11670
 
@@ -11702,7 +11699,7 @@ var StreamChat = /*#__PURE__*/function () {
11702
11699
  }, _callee70, this);
11703
11700
  }));
11704
11701
 
11705
- function querySegmentTargets(_x102) {
11702
+ function querySegmentTargets(_x99) {
11706
11703
  return _querySegmentTargets.apply(this, arguments);
11707
11704
  }
11708
11705
 
@@ -11740,7 +11737,7 @@ var StreamChat = /*#__PURE__*/function () {
11740
11737
  }, _callee71, this);
11741
11738
  }));
11742
11739
 
11743
- function removeSegmentTargets(_x103, _x104) {
11740
+ function removeSegmentTargets(_x100, _x101) {
11744
11741
  return _removeSegmentTargets.apply(this, arguments);
11745
11742
  }
11746
11743
 
@@ -11780,7 +11777,7 @@ var StreamChat = /*#__PURE__*/function () {
11780
11777
  }, _callee72, this);
11781
11778
  }));
11782
11779
 
11783
- function querySegments(_x105, _x106) {
11780
+ function querySegments(_x102, _x103) {
11784
11781
  return _querySegments.apply(this, arguments);
11785
11782
  }
11786
11783
 
@@ -11813,7 +11810,7 @@ var StreamChat = /*#__PURE__*/function () {
11813
11810
  }, _callee73, this);
11814
11811
  }));
11815
11812
 
11816
- function deleteSegment(_x107) {
11813
+ function deleteSegment(_x104) {
11817
11814
  return _deleteSegment.apply(this, arguments);
11818
11815
  }
11819
11816
 
@@ -11847,7 +11844,7 @@ var StreamChat = /*#__PURE__*/function () {
11847
11844
  }, _callee74, this);
11848
11845
  }));
11849
11846
 
11850
- function segmentTargetExists(_x108, _x109) {
11847
+ function segmentTargetExists(_x105, _x106) {
11851
11848
  return _segmentTargetExists.apply(this, arguments);
11852
11849
  }
11853
11850
 
@@ -11880,7 +11877,7 @@ var StreamChat = /*#__PURE__*/function () {
11880
11877
  }, _callee75, this);
11881
11878
  }));
11882
11879
 
11883
- function createCampaign(_x110) {
11880
+ function createCampaign(_x107) {
11884
11881
  return _createCampaign.apply(this, arguments);
11885
11882
  }
11886
11883
 
@@ -11905,7 +11902,7 @@ var StreamChat = /*#__PURE__*/function () {
11905
11902
  }, _callee76, this);
11906
11903
  }));
11907
11904
 
11908
- function getCampaign(_x111) {
11905
+ function getCampaign(_x108) {
11909
11906
  return _getCampaign.apply(this, arguments);
11910
11907
  }
11911
11908
 
@@ -11933,7 +11930,7 @@ var StreamChat = /*#__PURE__*/function () {
11933
11930
  }, _callee77, this);
11934
11931
  }));
11935
11932
 
11936
- function startCampaign(_x112, _x113) {
11933
+ function startCampaign(_x109, _x110) {
11937
11934
  return _startCampaign.apply(this, arguments);
11938
11935
  }
11939
11936
 
@@ -11972,7 +11969,7 @@ var StreamChat = /*#__PURE__*/function () {
11972
11969
  }, _callee78, this);
11973
11970
  }));
11974
11971
 
11975
- function queryCampaigns(_x114, _x115, _x116) {
11972
+ function queryCampaigns(_x111, _x112, _x113) {
11976
11973
  return _queryCampaigns.apply(this, arguments);
11977
11974
  }
11978
11975
 
@@ -12006,7 +12003,7 @@ var StreamChat = /*#__PURE__*/function () {
12006
12003
  }, _callee79, this);
12007
12004
  }));
12008
12005
 
12009
- function updateCampaign(_x117, _x118) {
12006
+ function updateCampaign(_x114, _x115) {
12010
12007
  return _updateCampaign.apply(this, arguments);
12011
12008
  }
12012
12009
 
@@ -12039,7 +12036,7 @@ var StreamChat = /*#__PURE__*/function () {
12039
12036
  }, _callee80, this);
12040
12037
  }));
12041
12038
 
12042
- function deleteCampaign(_x119) {
12039
+ function deleteCampaign(_x116) {
12043
12040
  return _deleteCampaign.apply(this, arguments);
12044
12041
  }
12045
12042
 
@@ -12057,22 +12054,14 @@ var StreamChat = /*#__PURE__*/function () {
12057
12054
  key: "stopCampaign",
12058
12055
  value: function () {
12059
12056
  var _stopCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee81(id) {
12060
- var _yield$this$patch, campaign;
12061
-
12062
12057
  return _regeneratorRuntime__default['default'].wrap(function _callee81$(_context81) {
12063
12058
  while (1) {
12064
12059
  switch (_context81.prev = _context81.next) {
12065
12060
  case 0:
12066
12061
  this.validateServerSideAuth();
12067
- _context81.next = 3;
12068
- return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
12062
+ return _context81.abrupt("return", this.post(this.baseURL + "/campaigns/".concat(id, "/stop")));
12069
12063
 
12070
- case 3:
12071
- _yield$this$patch = _context81.sent;
12072
- campaign = _yield$this$patch.campaign;
12073
- return _context81.abrupt("return", campaign);
12074
-
12075
- case 6:
12064
+ case 2:
12076
12065
  case "end":
12077
12066
  return _context81.stop();
12078
12067
  }
@@ -12080,7 +12069,7 @@ var StreamChat = /*#__PURE__*/function () {
12080
12069
  }, _callee81, this);
12081
12070
  }));
12082
12071
 
12083
- function stopCampaign(_x120) {
12072
+ function stopCampaign(_x117) {
12084
12073
  return _stopCampaign.apply(this, arguments);
12085
12074
  }
12086
12075
 
@@ -12113,7 +12102,7 @@ var StreamChat = /*#__PURE__*/function () {
12113
12102
  }, _callee82, this);
12114
12103
  }));
12115
12104
 
12116
- function enrichURL(_x121) {
12105
+ function enrichURL(_x118) {
12117
12106
  return _enrichURL.apply(this, arguments);
12118
12107
  }
12119
12108
 
@@ -12145,7 +12134,7 @@ var StreamChat = /*#__PURE__*/function () {
12145
12134
  }, _callee83, this);
12146
12135
  }));
12147
12136
 
12148
- function getTask(_x122) {
12137
+ function getTask(_x119) {
12149
12138
  return _getTask.apply(this, arguments);
12150
12139
  }
12151
12140
 
@@ -12187,7 +12176,7 @@ var StreamChat = /*#__PURE__*/function () {
12187
12176
  }, _callee84, this);
12188
12177
  }));
12189
12178
 
12190
- function deleteChannels(_x123) {
12179
+ function deleteChannels(_x120) {
12191
12180
  return _deleteChannels.apply(this, arguments);
12192
12181
  }
12193
12182
 
@@ -12254,7 +12243,7 @@ var StreamChat = /*#__PURE__*/function () {
12254
12243
  }, _callee85, this);
12255
12244
  }));
12256
12245
 
12257
- function deleteUsers(_x124) {
12246
+ function deleteUsers(_x121) {
12258
12247
  return _deleteUsers.apply(this, arguments);
12259
12248
  }
12260
12249
 
@@ -12296,7 +12285,7 @@ var StreamChat = /*#__PURE__*/function () {
12296
12285
  }, _callee86, this);
12297
12286
  }));
12298
12287
 
12299
- function _createImportURL(_x125) {
12288
+ function _createImportURL(_x122) {
12300
12289
  return _createImportURL2.apply(this, arguments);
12301
12290
  }
12302
12291
 
@@ -12344,7 +12333,7 @@ var StreamChat = /*#__PURE__*/function () {
12344
12333
  }, _callee87, this);
12345
12334
  }));
12346
12335
 
12347
- function _createImport(_x126) {
12336
+ function _createImport(_x123) {
12348
12337
  return _createImport2.apply(this, arguments);
12349
12338
  }
12350
12339
 
@@ -12385,7 +12374,7 @@ var StreamChat = /*#__PURE__*/function () {
12385
12374
  }, _callee88, this);
12386
12375
  }));
12387
12376
 
12388
- function _getImport(_x127) {
12377
+ function _getImport(_x124) {
12389
12378
  return _getImport2.apply(this, arguments);
12390
12379
  }
12391
12380
 
@@ -12426,7 +12415,7 @@ var StreamChat = /*#__PURE__*/function () {
12426
12415
  }, _callee89, this);
12427
12416
  }));
12428
12417
 
12429
- function _listImports(_x128) {
12418
+ function _listImports(_x125) {
12430
12419
  return _listImports2.apply(this, arguments);
12431
12420
  }
12432
12421
 
@@ -12466,7 +12455,7 @@ var StreamChat = /*#__PURE__*/function () {
12466
12455
  }, _callee90, this);
12467
12456
  }));
12468
12457
 
12469
- function upsertPushProvider(_x129) {
12458
+ function upsertPushProvider(_x126) {
12470
12459
  return _upsertPushProvider.apply(this, arguments);
12471
12460
  }
12472
12461
 
@@ -12506,7 +12495,7 @@ var StreamChat = /*#__PURE__*/function () {
12506
12495
  }, _callee91, this);
12507
12496
  }));
12508
12497
 
12509
- function deletePushProvider(_x130) {
12498
+ function deletePushProvider(_x127) {
12510
12499
  return _deletePushProvider.apply(this, arguments);
12511
12500
  }
12512
12501
 
@@ -12586,7 +12575,7 @@ var StreamChat = /*#__PURE__*/function () {
12586
12575
  }, _callee93, this);
12587
12576
  }));
12588
12577
 
12589
- function commitMessage(_x131) {
12578
+ function commitMessage(_x128) {
12590
12579
  return _commitMessage.apply(this, arguments);
12591
12580
  }
12592
12581