stream-chat 8.17.0 → 8.18.1

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
@@ -160,6 +160,7 @@ function isOwnUserBaseProperty(property) {
160
160
  total_unread_count: true,
161
161
  unread_channels: true,
162
162
  unread_count: true,
163
+ unread_threads: true,
163
164
  invisible: true,
164
165
  roles: true
165
166
  };
@@ -6090,6 +6091,544 @@ var WSConnectionFallback = /*#__PURE__*/function () {
6090
6091
  return WSConnectionFallback;
6091
6092
  }();
6092
6093
 
6094
+ var Campaign = /*#__PURE__*/function () {
6095
+ function Campaign(client, id, data) {
6096
+ _classCallCheck(this, Campaign);
6097
+
6098
+ _defineProperty(this, "id", void 0);
6099
+
6100
+ _defineProperty(this, "data", void 0);
6101
+
6102
+ _defineProperty(this, "client", void 0);
6103
+
6104
+ this.client = client;
6105
+ this.id = id;
6106
+ this.data = data;
6107
+ }
6108
+
6109
+ _createClass(Campaign, [{
6110
+ key: "create",
6111
+ value: function () {
6112
+ var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
6113
+ var _this$data, _this$data2, _this$data3, _this$data4, _this$data5, _this$data6, _this$data7, _this$data8;
6114
+
6115
+ var body, result;
6116
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
6117
+ while (1) {
6118
+ switch (_context.prev = _context.next) {
6119
+ case 0:
6120
+ body = {
6121
+ id: this.id,
6122
+ message_template: (_this$data = this.data) === null || _this$data === void 0 ? void 0 : _this$data.message_template,
6123
+ segment_ids: (_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2.segment_ids,
6124
+ sender_id: (_this$data3 = this.data) === null || _this$data3 === void 0 ? void 0 : _this$data3.sender_id,
6125
+ channel_template: (_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.channel_template,
6126
+ create_channels: (_this$data5 = this.data) === null || _this$data5 === void 0 ? void 0 : _this$data5.create_channels,
6127
+ description: (_this$data6 = this.data) === null || _this$data6 === void 0 ? void 0 : _this$data6.description,
6128
+ name: (_this$data7 = this.data) === null || _this$data7 === void 0 ? void 0 : _this$data7.name,
6129
+ user_ids: (_this$data8 = this.data) === null || _this$data8 === void 0 ? void 0 : _this$data8.user_ids
6130
+ };
6131
+ _context.next = 3;
6132
+ return this.client.createCampaign(body);
6133
+
6134
+ case 3:
6135
+ result = _context.sent;
6136
+ this.id = result.campaign.id;
6137
+ this.data = result.campaign;
6138
+ return _context.abrupt("return", result);
6139
+
6140
+ case 7:
6141
+ case "end":
6142
+ return _context.stop();
6143
+ }
6144
+ }
6145
+ }, _callee, this);
6146
+ }));
6147
+
6148
+ function create() {
6149
+ return _create.apply(this, arguments);
6150
+ }
6151
+
6152
+ return create;
6153
+ }()
6154
+ }, {
6155
+ key: "verifyCampaignId",
6156
+ value: function verifyCampaignId() {
6157
+ if (!this.id) {
6158
+ throw new Error('Campaign id is missing. Either create the campaign using campaign.create() or set the id during instantiation - const campaign = client.campaign(id)');
6159
+ }
6160
+ }
6161
+ }, {
6162
+ key: "start",
6163
+ value: function () {
6164
+ var _start = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(scheduledFor) {
6165
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
6166
+ while (1) {
6167
+ switch (_context2.prev = _context2.next) {
6168
+ case 0:
6169
+ this.verifyCampaignId();
6170
+ _context2.next = 3;
6171
+ return this.client.startCampaign(this.id, scheduledFor);
6172
+
6173
+ case 3:
6174
+ return _context2.abrupt("return", _context2.sent);
6175
+
6176
+ case 4:
6177
+ case "end":
6178
+ return _context2.stop();
6179
+ }
6180
+ }
6181
+ }, _callee2, this);
6182
+ }));
6183
+
6184
+ function start(_x) {
6185
+ return _start.apply(this, arguments);
6186
+ }
6187
+
6188
+ return start;
6189
+ }()
6190
+ }, {
6191
+ key: "update",
6192
+ value: function () {
6193
+ var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data) {
6194
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
6195
+ while (1) {
6196
+ switch (_context3.prev = _context3.next) {
6197
+ case 0:
6198
+ this.verifyCampaignId();
6199
+ return _context3.abrupt("return", this.client.updateCampaign(this.id, data));
6200
+
6201
+ case 2:
6202
+ case "end":
6203
+ return _context3.stop();
6204
+ }
6205
+ }
6206
+ }, _callee3, this);
6207
+ }));
6208
+
6209
+ function update(_x2) {
6210
+ return _update.apply(this, arguments);
6211
+ }
6212
+
6213
+ return update;
6214
+ }()
6215
+ }, {
6216
+ key: "delete",
6217
+ value: function () {
6218
+ var _delete2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
6219
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
6220
+ while (1) {
6221
+ switch (_context4.prev = _context4.next) {
6222
+ case 0:
6223
+ this.verifyCampaignId();
6224
+ _context4.next = 3;
6225
+ return this.client.delete(this.client.baseURL + "/campaigns/".concat(this.id));
6226
+
6227
+ case 3:
6228
+ return _context4.abrupt("return", _context4.sent);
6229
+
6230
+ case 4:
6231
+ case "end":
6232
+ return _context4.stop();
6233
+ }
6234
+ }
6235
+ }, _callee4, this);
6236
+ }));
6237
+
6238
+ function _delete() {
6239
+ return _delete2.apply(this, arguments);
6240
+ }
6241
+
6242
+ return _delete;
6243
+ }()
6244
+ }, {
6245
+ key: "schedule",
6246
+ value: function () {
6247
+ var _schedule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(params) {
6248
+ var scheduledFor, _yield$this$client$pa, campaign;
6249
+
6250
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
6251
+ while (1) {
6252
+ switch (_context5.prev = _context5.next) {
6253
+ case 0:
6254
+ this.verifyCampaignId();
6255
+ scheduledFor = params.scheduledFor;
6256
+ _context5.next = 4;
6257
+ return this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/schedule"), {
6258
+ scheduled_for: scheduledFor
6259
+ });
6260
+
6261
+ case 4:
6262
+ _yield$this$client$pa = _context5.sent;
6263
+ campaign = _yield$this$client$pa.campaign;
6264
+ return _context5.abrupt("return", campaign);
6265
+
6266
+ case 7:
6267
+ case "end":
6268
+ return _context5.stop();
6269
+ }
6270
+ }
6271
+ }, _callee5, this);
6272
+ }));
6273
+
6274
+ function schedule(_x3) {
6275
+ return _schedule.apply(this, arguments);
6276
+ }
6277
+
6278
+ return schedule;
6279
+ }()
6280
+ }, {
6281
+ key: "stop",
6282
+ value: function () {
6283
+ var _stop = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
6284
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
6285
+ while (1) {
6286
+ switch (_context6.prev = _context6.next) {
6287
+ case 0:
6288
+ this.verifyCampaignId();
6289
+ return _context6.abrupt("return", this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/stop")));
6290
+
6291
+ case 2:
6292
+ case "end":
6293
+ return _context6.stop();
6294
+ }
6295
+ }
6296
+ }, _callee6, this);
6297
+ }));
6298
+
6299
+ function stop() {
6300
+ return _stop.apply(this, arguments);
6301
+ }
6302
+
6303
+ return stop;
6304
+ }()
6305
+ }, {
6306
+ key: "pause",
6307
+ value: function () {
6308
+ var _pause = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
6309
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
6310
+ while (1) {
6311
+ switch (_context7.prev = _context7.next) {
6312
+ case 0:
6313
+ this.verifyCampaignId();
6314
+ return _context7.abrupt("return", this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/pause")));
6315
+
6316
+ case 2:
6317
+ case "end":
6318
+ return _context7.stop();
6319
+ }
6320
+ }
6321
+ }, _callee7, this);
6322
+ }));
6323
+
6324
+ function pause() {
6325
+ return _pause.apply(this, arguments);
6326
+ }
6327
+
6328
+ return pause;
6329
+ }()
6330
+ }, {
6331
+ key: "resume",
6332
+ value: function () {
6333
+ var _resume = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
6334
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
6335
+ while (1) {
6336
+ switch (_context8.prev = _context8.next) {
6337
+ case 0:
6338
+ this.verifyCampaignId();
6339
+ return _context8.abrupt("return", this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/resume")));
6340
+
6341
+ case 2:
6342
+ case "end":
6343
+ return _context8.stop();
6344
+ }
6345
+ }
6346
+ }, _callee8, this);
6347
+ }));
6348
+
6349
+ function resume() {
6350
+ return _resume.apply(this, arguments);
6351
+ }
6352
+
6353
+ return resume;
6354
+ }()
6355
+ }, {
6356
+ key: "get",
6357
+ value: function () {
6358
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
6359
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
6360
+ while (1) {
6361
+ switch (_context9.prev = _context9.next) {
6362
+ case 0:
6363
+ this.verifyCampaignId();
6364
+ return _context9.abrupt("return", this.client.getCampaign(this.id));
6365
+
6366
+ case 2:
6367
+ case "end":
6368
+ return _context9.stop();
6369
+ }
6370
+ }
6371
+ }, _callee9, this);
6372
+ }));
6373
+
6374
+ function get() {
6375
+ return _get.apply(this, arguments);
6376
+ }
6377
+
6378
+ return get;
6379
+ }()
6380
+ }]);
6381
+
6382
+ return Campaign;
6383
+ }();
6384
+
6385
+ var Segment = /*#__PURE__*/function () {
6386
+ function Segment(client, type, id, data) {
6387
+ _classCallCheck(this, Segment);
6388
+
6389
+ _defineProperty(this, "type", void 0);
6390
+
6391
+ _defineProperty(this, "id", void 0);
6392
+
6393
+ _defineProperty(this, "client", void 0);
6394
+
6395
+ _defineProperty(this, "data", void 0);
6396
+
6397
+ this.client = client;
6398
+ this.type = type;
6399
+ this.id = id;
6400
+ this.data = data;
6401
+ }
6402
+
6403
+ _createClass(Segment, [{
6404
+ key: "create",
6405
+ value: function () {
6406
+ var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
6407
+ var _this$data, _this$data2, _this$data3, _this$data4;
6408
+
6409
+ var body;
6410
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
6411
+ while (1) {
6412
+ switch (_context.prev = _context.next) {
6413
+ case 0:
6414
+ body = {
6415
+ id: this.id,
6416
+ type: this.type,
6417
+ name: (_this$data = this.data) === null || _this$data === void 0 ? void 0 : _this$data.name,
6418
+ filter: (_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2.filter,
6419
+ description: (_this$data3 = this.data) === null || _this$data3 === void 0 ? void 0 : _this$data3.description,
6420
+ all_users: (_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.all_users
6421
+ };
6422
+ return _context.abrupt("return", this.client.post(this.client.baseURL + "/segments", body));
6423
+
6424
+ case 2:
6425
+ case "end":
6426
+ return _context.stop();
6427
+ }
6428
+ }
6429
+ }, _callee, this);
6430
+ }));
6431
+
6432
+ function create() {
6433
+ return _create.apply(this, arguments);
6434
+ }
6435
+
6436
+ return create;
6437
+ }()
6438
+ }, {
6439
+ key: "verifySegmentId",
6440
+ value: function verifySegmentId() {
6441
+ if (!this.id) {
6442
+ throw new Error('Segment id is missing. Either create the segment using segment.create() or set the id during instantiation - const segment = client.segment(id)');
6443
+ }
6444
+ }
6445
+ }, {
6446
+ key: "get",
6447
+ value: function () {
6448
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
6449
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
6450
+ while (1) {
6451
+ switch (_context2.prev = _context2.next) {
6452
+ case 0:
6453
+ this.verifySegmentId();
6454
+ return _context2.abrupt("return", this.client.getSegment(this.id));
6455
+
6456
+ case 2:
6457
+ case "end":
6458
+ return _context2.stop();
6459
+ }
6460
+ }
6461
+ }, _callee2, this);
6462
+ }));
6463
+
6464
+ function get() {
6465
+ return _get.apply(this, arguments);
6466
+ }
6467
+
6468
+ return get;
6469
+ }()
6470
+ }, {
6471
+ key: "update",
6472
+ value: function () {
6473
+ var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data) {
6474
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
6475
+ while (1) {
6476
+ switch (_context3.prev = _context3.next) {
6477
+ case 0:
6478
+ this.verifySegmentId();
6479
+ return _context3.abrupt("return", this.client.updateSegment(this.id, data));
6480
+
6481
+ case 2:
6482
+ case "end":
6483
+ return _context3.stop();
6484
+ }
6485
+ }
6486
+ }, _callee3, this);
6487
+ }));
6488
+
6489
+ function update(_x) {
6490
+ return _update.apply(this, arguments);
6491
+ }
6492
+
6493
+ return update;
6494
+ }()
6495
+ }, {
6496
+ key: "addTargets",
6497
+ value: function () {
6498
+ var _addTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(targets) {
6499
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
6500
+ while (1) {
6501
+ switch (_context4.prev = _context4.next) {
6502
+ case 0:
6503
+ this.verifySegmentId();
6504
+ return _context4.abrupt("return", this.client.addSegmentTargets(this.id, targets));
6505
+
6506
+ case 2:
6507
+ case "end":
6508
+ return _context4.stop();
6509
+ }
6510
+ }
6511
+ }, _callee4, this);
6512
+ }));
6513
+
6514
+ function addTargets(_x2) {
6515
+ return _addTargets.apply(this, arguments);
6516
+ }
6517
+
6518
+ return addTargets;
6519
+ }()
6520
+ }, {
6521
+ key: "removeTargets",
6522
+ value: function () {
6523
+ var _removeTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(targets) {
6524
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
6525
+ while (1) {
6526
+ switch (_context5.prev = _context5.next) {
6527
+ case 0:
6528
+ this.verifySegmentId();
6529
+ return _context5.abrupt("return", this.client.removeSegmentTargets(this.id, targets));
6530
+
6531
+ case 2:
6532
+ case "end":
6533
+ return _context5.stop();
6534
+ }
6535
+ }
6536
+ }, _callee5, this);
6537
+ }));
6538
+
6539
+ function removeTargets(_x3) {
6540
+ return _removeTargets.apply(this, arguments);
6541
+ }
6542
+
6543
+ return removeTargets;
6544
+ }()
6545
+ }, {
6546
+ key: "delete",
6547
+ value: function () {
6548
+ var _delete2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
6549
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
6550
+ while (1) {
6551
+ switch (_context6.prev = _context6.next) {
6552
+ case 0:
6553
+ this.verifySegmentId();
6554
+ return _context6.abrupt("return", this.client.deleteSegment(this.id));
6555
+
6556
+ case 2:
6557
+ case "end":
6558
+ return _context6.stop();
6559
+ }
6560
+ }
6561
+ }, _callee6, this);
6562
+ }));
6563
+
6564
+ function _delete() {
6565
+ return _delete2.apply(this, arguments);
6566
+ }
6567
+
6568
+ return _delete;
6569
+ }()
6570
+ }, {
6571
+ key: "targetExists",
6572
+ value: function () {
6573
+ var _targetExists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(targetId) {
6574
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
6575
+ while (1) {
6576
+ switch (_context7.prev = _context7.next) {
6577
+ case 0:
6578
+ this.verifySegmentId();
6579
+ return _context7.abrupt("return", this.client.segmentTargetExists(this.id, targetId));
6580
+
6581
+ case 2:
6582
+ case "end":
6583
+ return _context7.stop();
6584
+ }
6585
+ }
6586
+ }, _callee7, this);
6587
+ }));
6588
+
6589
+ function targetExists(_x4) {
6590
+ return _targetExists.apply(this, arguments);
6591
+ }
6592
+
6593
+ return targetExists;
6594
+ }()
6595
+ }, {
6596
+ key: "queryTargets",
6597
+ value: function () {
6598
+ var _queryTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
6599
+ var filter,
6600
+ sort,
6601
+ options,
6602
+ _args8 = arguments;
6603
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
6604
+ while (1) {
6605
+ switch (_context8.prev = _context8.next) {
6606
+ case 0:
6607
+ filter = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
6608
+ sort = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : [];
6609
+ options = _args8.length > 2 && _args8[2] !== undefined ? _args8[2] : {};
6610
+ this.verifySegmentId();
6611
+ return _context8.abrupt("return", this.client.querySegmentTargets(this.id, filter, sort, options));
6612
+
6613
+ case 5:
6614
+ case "end":
6615
+ return _context8.stop();
6616
+ }
6617
+ }
6618
+ }, _callee8, this);
6619
+ }));
6620
+
6621
+ function queryTargets() {
6622
+ return _queryTargets.apply(this, arguments);
6623
+ }
6624
+
6625
+ return queryTargets;
6626
+ }()
6627
+ }]);
6628
+
6629
+ return Segment;
6630
+ }();
6631
+
6093
6632
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6094
6633
 
6095
6634
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
@@ -6216,20 +6755,22 @@ var Thread = /*#__PURE__*/function () {
6216
6755
  this._channel = client.channel(t.channel.type, t.channel.id);
6217
6756
  this._client = client;
6218
6757
 
6219
- var _iterator = _createForOfIteratorHelper$1(t.read),
6220
- _step;
6758
+ if (t.read) {
6759
+ var _iterator = _createForOfIteratorHelper$1(t.read),
6760
+ _step;
6221
6761
 
6222
- try {
6223
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
6224
- var r = _step.value;
6225
- this.read[r.user.id] = _objectSpread$1(_objectSpread$1({}, r), {}, {
6226
- last_read: new Date(r.last_read)
6227
- });
6762
+ try {
6763
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
6764
+ var r = _step.value;
6765
+ this.read[r.user.id] = _objectSpread$1(_objectSpread$1({}, r), {}, {
6766
+ last_read: new Date(r.last_read)
6767
+ });
6768
+ }
6769
+ } catch (err) {
6770
+ _iterator.e(err);
6771
+ } finally {
6772
+ _iterator.f();
6228
6773
  }
6229
- } catch (err) {
6230
- _iterator.e(err);
6231
- } finally {
6232
- _iterator.f();
6233
6774
  }
6234
6775
  }
6235
6776
 
@@ -6238,10 +6779,20 @@ var Thread = /*#__PURE__*/function () {
6238
6779
  value: function getClient() {
6239
6780
  return this._client;
6240
6781
  }
6782
+ /**
6783
+ * addReply - Adds or updates a latestReplies to the thread
6784
+ *
6785
+ * @param {MessageResponse<StreamChatGenerics>} message reply message to be added.
6786
+ */
6787
+
6241
6788
  }, {
6242
6789
  key: "addReply",
6243
6790
  value: function addReply(message) {
6244
- this.latestReplies = addToMessageList(this.latestReplies, formatMessage(message));
6791
+ if (message.parent_id !== this.message.id) {
6792
+ throw new Error('Message does not belong to this thread');
6793
+ }
6794
+
6795
+ this.latestReplies = addToMessageList(this.latestReplies, formatMessage(message), true);
6245
6796
  }
6246
6797
  }, {
6247
6798
  key: "updateReply",
@@ -6267,6 +6818,7 @@ var Thread = /*#__PURE__*/function () {
6267
6818
 
6268
6819
  if (message.parent_id && message.parent_id === this.message.id) {
6269
6820
  this.updateReply(message);
6821
+ return;
6270
6822
  }
6271
6823
 
6272
6824
  if (!message.parent_id && message.id === this.message.id) {
@@ -10607,7 +11159,7 @@ var StreamChat = /*#__PURE__*/function () {
10607
11159
  }, {
10608
11160
  key: "getUserAgent",
10609
11161
  value: function getUserAgent() {
10610
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.17.0");
11162
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.18.1");
10611
11163
  }
10612
11164
  }, {
10613
11165
  key: "setUserAgent",
@@ -10904,6 +11456,31 @@ var StreamChat = /*#__PURE__*/function () {
10904
11456
  value: function getExportChannelStatus(id) {
10905
11457
  return this.get("".concat(this.baseURL, "/export_channels/").concat(id));
10906
11458
  }
11459
+ }, {
11460
+ key: "campaign",
11461
+ value: function campaign(idOrData, data) {
11462
+ if (typeof idOrData === 'string') {
11463
+ return new Campaign(this, idOrData, data);
11464
+ }
11465
+
11466
+ return new Campaign(this, null, idOrData);
11467
+ }
11468
+ }, {
11469
+ key: "segment",
11470
+ value: function segment(type, idOrData, data) {
11471
+ if (typeof idOrData === 'string') {
11472
+ return new Segment(this, type, idOrData, data);
11473
+ }
11474
+
11475
+ return new Segment(this, type, null, idOrData);
11476
+ }
11477
+ }, {
11478
+ key: "validateServerSideAuth",
11479
+ value: function validateServerSideAuth() {
11480
+ if (!this.secret) {
11481
+ throw new Error('Campaigns is a server-side only feature. Please initialize the client with a secret to use this feature.');
11482
+ }
11483
+ }
10907
11484
  /**
10908
11485
  * createSegment - Creates a segment
10909
11486
  *
@@ -10913,34 +11490,28 @@ var StreamChat = /*#__PURE__*/function () {
10913
11490
  * @param {string} name Segment name (valid UUID)
10914
11491
  * @param {SegmentData} params Segment data
10915
11492
  *
10916
- * @return {Segment} The created Segment
11493
+ * @return {{segment: SegmentResponse} & APIResponse} The created Segment
10917
11494
  */
10918
11495
 
10919
11496
  }, {
10920
11497
  key: "createSegment",
10921
11498
  value: function () {
10922
11499
  var _createSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee63(type, id, name, data) {
10923
- var body, _yield$this$post, segment;
10924
-
11500
+ var body;
10925
11501
  return _regeneratorRuntime.wrap(function _callee63$(_context63) {
10926
11502
  while (1) {
10927
11503
  switch (_context63.prev = _context63.next) {
10928
11504
  case 0:
11505
+ this.validateServerSideAuth();
10929
11506
  body = {
10930
11507
  id: id,
10931
11508
  type: type,
10932
11509
  name: name,
10933
11510
  data: data
10934
11511
  };
10935
- _context63.next = 3;
10936
- return this.post(this.baseURL + "/segments", body);
11512
+ return _context63.abrupt("return", this.post(this.baseURL + "/segments", body));
10937
11513
 
10938
11514
  case 3:
10939
- _yield$this$post = _context63.sent;
10940
- segment = _yield$this$post.segment;
10941
- return _context63.abrupt("return", segment);
10942
-
10943
- case 6:
10944
11515
  case "end":
10945
11516
  return _context63.stop();
10946
11517
  }
@@ -10972,13 +11543,10 @@ var StreamChat = /*#__PURE__*/function () {
10972
11543
  while (1) {
10973
11544
  switch (_context64.prev = _context64.next) {
10974
11545
  case 0:
10975
- _context64.next = 2;
10976
- return this.createSegment('user', id, name, data);
11546
+ this.validateServerSideAuth();
11547
+ return _context64.abrupt("return", this.createSegment('user', id, name, data));
10977
11548
 
10978
11549
  case 2:
10979
- return _context64.abrupt("return", _context64.sent);
10980
-
10981
- case 3:
10982
11550
  case "end":
10983
11551
  return _context64.stop();
10984
11552
  }
@@ -11010,13 +11578,10 @@ var StreamChat = /*#__PURE__*/function () {
11010
11578
  while (1) {
11011
11579
  switch (_context65.prev = _context65.next) {
11012
11580
  case 0:
11013
- _context65.next = 2;
11014
- return this.createSegment('channel', id, name, data);
11581
+ this.validateServerSideAuth();
11582
+ return _context65.abrupt("return", this.createSegment('channel', id, name, data));
11015
11583
 
11016
11584
  case 2:
11017
- return _context65.abrupt("return", _context65.sent);
11018
-
11019
- case 3:
11020
11585
  case "end":
11021
11586
  return _context65.stop();
11022
11587
  }
@@ -11030,34 +11595,18 @@ var StreamChat = /*#__PURE__*/function () {
11030
11595
 
11031
11596
  return createChannelSegment;
11032
11597
  }()
11033
- /**
11034
- * updateSegment - Update a segment
11035
- *
11036
- * @param {string} id Segment ID
11037
- * @param {Partial<UpdateSegmentData>} data Data to update
11038
- *
11039
- * @return {Segment} Updated Segment
11040
- */
11041
-
11042
11598
  }, {
11043
- key: "updateSegment",
11599
+ key: "getSegment",
11044
11600
  value: function () {
11045
- var _updateSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66(id, data) {
11046
- var _yield$this$put, segment;
11047
-
11601
+ var _getSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66(id) {
11048
11602
  return _regeneratorRuntime.wrap(function _callee66$(_context66) {
11049
11603
  while (1) {
11050
11604
  switch (_context66.prev = _context66.next) {
11051
11605
  case 0:
11052
- _context66.next = 2;
11053
- return this.put(this.baseURL + "/segments/".concat(id), data);
11606
+ this.validateServerSideAuth();
11607
+ return _context66.abrupt("return", this.get(this.baseURL + "/segments/".concat(id)));
11054
11608
 
11055
11609
  case 2:
11056
- _yield$this$put = _context66.sent;
11057
- segment = _yield$this$put.segment;
11058
- return _context66.abrupt("return", segment);
11059
-
11060
- case 5:
11061
11610
  case "end":
11062
11611
  return _context66.stop();
11063
11612
  }
@@ -11065,40 +11614,33 @@ var StreamChat = /*#__PURE__*/function () {
11065
11614
  }, _callee66, this);
11066
11615
  }));
11067
11616
 
11068
- function updateSegment(_x94, _x95) {
11069
- return _updateSegment.apply(this, arguments);
11617
+ function getSegment(_x94) {
11618
+ return _getSegment.apply(this, arguments);
11070
11619
  }
11071
11620
 
11072
- return updateSegment;
11621
+ return getSegment;
11073
11622
  }()
11074
11623
  /**
11075
- * addSegmentTargets - Add targets to a segment
11624
+ * updateSegment - Update a segment
11076
11625
  *
11077
11626
  * @param {string} id Segment ID
11078
- * @param {string[]} targets Targets to add to the segment
11627
+ * @param {Partial<UpdateSegmentData>} data Data to update
11079
11628
  *
11080
- * @return {APIResponse} API response
11629
+ * @return {Segment} Updated Segment
11081
11630
  */
11082
11631
 
11083
11632
  }, {
11084
- key: "addSegmentTargets",
11633
+ key: "updateSegment",
11085
11634
  value: function () {
11086
- var _addSegmentTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee67(id, targets) {
11087
- var body;
11635
+ var _updateSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee67(id, data) {
11088
11636
  return _regeneratorRuntime.wrap(function _callee67$(_context67) {
11089
11637
  while (1) {
11090
11638
  switch (_context67.prev = _context67.next) {
11091
11639
  case 0:
11092
- body = {
11093
- targets: targets
11094
- };
11095
- _context67.next = 3;
11096
- return this.post(this.baseURL + "/segments/".concat(id, "/addtargets"), body);
11640
+ this.validateServerSideAuth();
11641
+ return _context67.abrupt("return", this.put(this.baseURL + "/segments/".concat(id), data));
11097
11642
 
11098
- case 3:
11099
- return _context67.abrupt("return", _context67.sent);
11100
-
11101
- case 4:
11643
+ case 2:
11102
11644
  case "end":
11103
11645
  return _context67.stop();
11104
11646
  }
@@ -11106,14 +11648,14 @@ var StreamChat = /*#__PURE__*/function () {
11106
11648
  }, _callee67, this);
11107
11649
  }));
11108
11650
 
11109
- function addSegmentTargets(_x96, _x97) {
11110
- return _addSegmentTargets.apply(this, arguments);
11651
+ function updateSegment(_x95, _x96) {
11652
+ return _updateSegment.apply(this, arguments);
11111
11653
  }
11112
11654
 
11113
- return addSegmentTargets;
11655
+ return updateSegment;
11114
11656
  }()
11115
11657
  /**
11116
- * deleteSegmentTargets - Delete targets from a segment
11658
+ * addSegmentTargets - Add targets to a segment
11117
11659
  *
11118
11660
  * @param {string} id Segment ID
11119
11661
  * @param {string[]} targets Targets to add to the segment
@@ -11122,24 +11664,21 @@ var StreamChat = /*#__PURE__*/function () {
11122
11664
  */
11123
11665
 
11124
11666
  }, {
11125
- key: "deleteSegmentTargets",
11667
+ key: "addSegmentTargets",
11126
11668
  value: function () {
11127
- var _deleteSegmentTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee68(id, targets) {
11669
+ var _addSegmentTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee68(id, targets) {
11128
11670
  var body;
11129
11671
  return _regeneratorRuntime.wrap(function _callee68$(_context68) {
11130
11672
  while (1) {
11131
11673
  switch (_context68.prev = _context68.next) {
11132
11674
  case 0:
11675
+ this.validateServerSideAuth();
11133
11676
  body = {
11134
- targets: targets
11677
+ target_ids: targets
11135
11678
  };
11136
- _context68.next = 3;
11137
- return this.post(this.baseURL + "/segments/".concat(id, "/deletetargets"), body);
11679
+ return _context68.abrupt("return", this.post(this.baseURL + "/segments/".concat(id, "/addtargets"), body));
11138
11680
 
11139
11681
  case 3:
11140
- return _context68.abrupt("return", _context68.sent);
11141
-
11142
- case 4:
11143
11682
  case "end":
11144
11683
  return _context68.stop();
11145
11684
  }
@@ -11147,43 +11686,34 @@ var StreamChat = /*#__PURE__*/function () {
11147
11686
  }, _callee68, this);
11148
11687
  }));
11149
11688
 
11150
- function deleteSegmentTargets(_x98, _x99) {
11151
- return _deleteSegmentTargets.apply(this, arguments);
11689
+ function addSegmentTargets(_x97, _x98) {
11690
+ return _addSegmentTargets.apply(this, arguments);
11152
11691
  }
11153
11692
 
11154
- return deleteSegmentTargets;
11693
+ return addSegmentTargets;
11155
11694
  }()
11156
- /**
11157
- * querySegments - Query Segments
11158
- *
11159
- * @param {filter} filter MongoDB style filter conditions
11160
- * @param {QuerySegmentsOptions} options Options for sorting/paginating the results
11161
- *
11162
- * @return {Segment[]} Segments
11163
- */
11164
-
11165
11695
  }, {
11166
- key: "querySegments",
11696
+ key: "querySegmentTargets",
11167
11697
  value: function () {
11168
- var _querySegments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee69(filter) {
11169
- var options,
11698
+ var _querySegmentTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee69(id) {
11699
+ var filter,
11700
+ sort,
11701
+ options,
11170
11702
  _args69 = arguments;
11171
11703
  return _regeneratorRuntime.wrap(function _callee69$(_context69) {
11172
11704
  while (1) {
11173
11705
  switch (_context69.prev = _context69.next) {
11174
11706
  case 0:
11175
- options = _args69.length > 1 && _args69[1] !== undefined ? _args69[1] : {};
11176
- _context69.next = 3;
11177
- return this.get(this.baseURL + "/segments", {
11178
- payload: _objectSpread({
11179
- filter: filter
11180
- }, options)
11181
- });
11182
-
11183
- case 3:
11184
- return _context69.abrupt("return", _context69.sent);
11707
+ filter = _args69.length > 1 && _args69[1] !== undefined ? _args69[1] : {};
11708
+ sort = _args69.length > 2 && _args69[2] !== undefined ? _args69[2] : [];
11709
+ options = _args69.length > 3 && _args69[3] !== undefined ? _args69[3] : {};
11710
+ this.validateServerSideAuth();
11711
+ return _context69.abrupt("return", this.post(this.baseURL + "/segments/".concat(id, "/targets/query"), _objectSpread({
11712
+ filter: filter || {},
11713
+ sort: sort || []
11714
+ }, options)));
11185
11715
 
11186
- case 4:
11716
+ case 5:
11187
11717
  case "end":
11188
11718
  return _context69.stop();
11189
11719
  }
@@ -11191,33 +11721,35 @@ var StreamChat = /*#__PURE__*/function () {
11191
11721
  }, _callee69, this);
11192
11722
  }));
11193
11723
 
11194
- function querySegments(_x100) {
11195
- return _querySegments.apply(this, arguments);
11724
+ function querySegmentTargets(_x99) {
11725
+ return _querySegmentTargets.apply(this, arguments);
11196
11726
  }
11197
11727
 
11198
- return querySegments;
11728
+ return querySegmentTargets;
11199
11729
  }()
11200
11730
  /**
11201
- * deleteSegment - Delete a Campaign Segment
11731
+ * removeSegmentTargets - Remove targets from a segment
11202
11732
  *
11203
11733
  * @param {string} id Segment ID
11734
+ * @param {string[]} targets Targets to add to the segment
11204
11735
  *
11205
- * @return {Promise<APIResponse>} The Server Response
11736
+ * @return {APIResponse} API response
11206
11737
  */
11207
11738
 
11208
11739
  }, {
11209
- key: "deleteSegment",
11740
+ key: "removeSegmentTargets",
11210
11741
  value: function () {
11211
- var _deleteSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee70(id) {
11742
+ var _removeSegmentTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee70(id, targets) {
11743
+ var body;
11212
11744
  return _regeneratorRuntime.wrap(function _callee70$(_context70) {
11213
11745
  while (1) {
11214
11746
  switch (_context70.prev = _context70.next) {
11215
11747
  case 0:
11216
- _context70.next = 2;
11217
- return this.delete(this.baseURL + "/segments/".concat(id));
11218
-
11219
- case 2:
11220
- return _context70.abrupt("return", _context70.sent);
11748
+ this.validateServerSideAuth();
11749
+ body = {
11750
+ target_ids: targets
11751
+ };
11752
+ return _context70.abrupt("return", this.post(this.baseURL + "/segments/".concat(id, "/deletetargets"), body));
11221
11753
 
11222
11754
  case 3:
11223
11755
  case "end":
@@ -11227,34 +11759,37 @@ var StreamChat = /*#__PURE__*/function () {
11227
11759
  }, _callee70, this);
11228
11760
  }));
11229
11761
 
11230
- function deleteSegment(_x101) {
11231
- return _deleteSegment.apply(this, arguments);
11762
+ function removeSegmentTargets(_x100, _x101) {
11763
+ return _removeSegmentTargets.apply(this, arguments);
11232
11764
  }
11233
11765
 
11234
- return deleteSegment;
11766
+ return removeSegmentTargets;
11235
11767
  }()
11236
11768
  /**
11237
- * segmentTargetExists - Check if a target exists in a segment
11769
+ * querySegments - Query Segments
11238
11770
  *
11239
- * @param {string} segmentId Segment ID
11240
- * @param {string} targetId Target ID
11771
+ * @param {filter} filter MongoDB style filter conditions
11772
+ * @param {QuerySegmentsOptions} options Options for sorting/paginating the results
11241
11773
  *
11242
- * @return {Promise<APIResponse>} The Server Response
11774
+ * @return {Segment[]} Segments
11243
11775
  */
11244
11776
 
11245
11777
  }, {
11246
- key: "segmentTargetExists",
11778
+ key: "querySegments",
11247
11779
  value: function () {
11248
- var _segmentTargetExists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee71(segmentId, targetId) {
11780
+ var _querySegments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee71(filter, sort) {
11781
+ var options,
11782
+ _args71 = arguments;
11249
11783
  return _regeneratorRuntime.wrap(function _callee71$(_context71) {
11250
11784
  while (1) {
11251
11785
  switch (_context71.prev = _context71.next) {
11252
11786
  case 0:
11253
- _context71.next = 2;
11254
- return this.get(this.baseURL + "/segments/".concat(segmentId, "/target/").concat(targetId));
11255
-
11256
- case 2:
11257
- return _context71.abrupt("return", _context71.sent);
11787
+ options = _args71.length > 2 && _args71[2] !== undefined ? _args71[2] : {};
11788
+ this.validateServerSideAuth();
11789
+ return _context71.abrupt("return", this.post(this.baseURL + "/segments/query", _objectSpread({
11790
+ filter: filter,
11791
+ sort: sort
11792
+ }, options)));
11258
11793
 
11259
11794
  case 3:
11260
11795
  case "end":
@@ -11264,41 +11799,32 @@ var StreamChat = /*#__PURE__*/function () {
11264
11799
  }, _callee71, this);
11265
11800
  }));
11266
11801
 
11267
- function segmentTargetExists(_x102, _x103) {
11268
- return _segmentTargetExists.apply(this, arguments);
11802
+ function querySegments(_x102, _x103) {
11803
+ return _querySegments.apply(this, arguments);
11269
11804
  }
11270
11805
 
11271
- return segmentTargetExists;
11806
+ return querySegments;
11272
11807
  }()
11273
11808
  /**
11274
- * createCampaign - Creates a Campaign
11809
+ * deleteSegment - Delete a Campaign Segment
11275
11810
  *
11276
- * @param {CampaignData} params Campaign data
11811
+ * @param {string} id Segment ID
11277
11812
  *
11278
- * @return {Campaign} The Created Campaign
11813
+ * @return {Promise<APIResponse>} The Server Response
11279
11814
  */
11280
11815
 
11281
11816
  }, {
11282
- key: "createCampaign",
11817
+ key: "deleteSegment",
11283
11818
  value: function () {
11284
- var _createCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee72(params) {
11285
- var _yield$this$post2, campaign;
11286
-
11819
+ var _deleteSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee72(id) {
11287
11820
  return _regeneratorRuntime.wrap(function _callee72$(_context72) {
11288
11821
  while (1) {
11289
11822
  switch (_context72.prev = _context72.next) {
11290
11823
  case 0:
11291
- _context72.next = 2;
11292
- return this.post(this.baseURL + "/campaigns", {
11293
- campaign: params
11294
- });
11824
+ this.validateServerSideAuth();
11825
+ return _context72.abrupt("return", this.delete(this.baseURL + "/segments/".concat(id)));
11295
11826
 
11296
11827
  case 2:
11297
- _yield$this$post2 = _context72.sent;
11298
- campaign = _yield$this$post2.campaign;
11299
- return _context72.abrupt("return", campaign);
11300
-
11301
- case 5:
11302
11828
  case "end":
11303
11829
  return _context72.stop();
11304
11830
  }
@@ -11306,41 +11832,33 @@ var StreamChat = /*#__PURE__*/function () {
11306
11832
  }, _callee72, this);
11307
11833
  }));
11308
11834
 
11309
- function createCampaign(_x104) {
11310
- return _createCampaign.apply(this, arguments);
11835
+ function deleteSegment(_x104) {
11836
+ return _deleteSegment.apply(this, arguments);
11311
11837
  }
11312
11838
 
11313
- return createCampaign;
11839
+ return deleteSegment;
11314
11840
  }()
11315
11841
  /**
11316
- * queryCampaigns - Query Campaigns
11842
+ * segmentTargetExists - Check if a target exists in a segment
11317
11843
  *
11844
+ * @param {string} segmentId Segment ID
11845
+ * @param {string} targetId Target ID
11318
11846
  *
11319
- * @return {Campaign[]} Campaigns
11847
+ * @return {Promise<APIResponse>} The Server Response
11320
11848
  */
11321
11849
 
11322
11850
  }, {
11323
- key: "queryCampaigns",
11851
+ key: "segmentTargetExists",
11324
11852
  value: function () {
11325
- var _queryCampaigns = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee73(filters) {
11326
- var options,
11327
- _args73 = arguments;
11853
+ var _segmentTargetExists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee73(segmentId, targetId) {
11328
11854
  return _regeneratorRuntime.wrap(function _callee73$(_context73) {
11329
11855
  while (1) {
11330
11856
  switch (_context73.prev = _context73.next) {
11331
11857
  case 0:
11332
- options = _args73.length > 1 && _args73[1] !== undefined ? _args73[1] : {};
11333
- _context73.next = 3;
11334
- return this.get(this.baseURL + "/campaigns", {
11335
- payload: _objectSpread({
11336
- filter_conditions: filters
11337
- }, options)
11338
- });
11339
-
11340
- case 3:
11341
- return _context73.abrupt("return", _context73.sent);
11858
+ this.validateServerSideAuth();
11859
+ return _context73.abrupt("return", this.get(this.baseURL + "/segments/".concat(segmentId, "/target/").concat(targetId)));
11342
11860
 
11343
- case 4:
11861
+ case 2:
11344
11862
  case "end":
11345
11863
  return _context73.stop();
11346
11864
  }
@@ -11348,42 +11866,32 @@ var StreamChat = /*#__PURE__*/function () {
11348
11866
  }, _callee73, this);
11349
11867
  }));
11350
11868
 
11351
- function queryCampaigns(_x105) {
11352
- return _queryCampaigns.apply(this, arguments);
11869
+ function segmentTargetExists(_x105, _x106) {
11870
+ return _segmentTargetExists.apply(this, arguments);
11353
11871
  }
11354
11872
 
11355
- return queryCampaigns;
11873
+ return segmentTargetExists;
11356
11874
  }()
11357
11875
  /**
11358
- * updateCampaign - Update a Campaign
11876
+ * createCampaign - Creates a Campaign
11359
11877
  *
11360
- * @param {string} id Campaign ID
11361
- * @param {Partial<CampaignData>} params Campaign data
11878
+ * @param {CampaignData} params Campaign data
11362
11879
  *
11363
- * @return {Campaign} Updated Campaign
11880
+ * @return {Campaign} The Created Campaign
11364
11881
  */
11365
11882
 
11366
11883
  }, {
11367
- key: "updateCampaign",
11884
+ key: "createCampaign",
11368
11885
  value: function () {
11369
- var _updateCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee74(id, params) {
11370
- var _yield$this$put2, campaign;
11371
-
11886
+ var _createCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee74(params) {
11372
11887
  return _regeneratorRuntime.wrap(function _callee74$(_context74) {
11373
11888
  while (1) {
11374
11889
  switch (_context74.prev = _context74.next) {
11375
11890
  case 0:
11376
- _context74.next = 2;
11377
- return this.put(this.baseURL + "/campaigns/".concat(id), {
11378
- campaign: params
11379
- });
11891
+ this.validateServerSideAuth();
11892
+ return _context74.abrupt("return", this.post(this.baseURL + "/campaigns", _objectSpread({}, params)));
11380
11893
 
11381
11894
  case 2:
11382
- _yield$this$put2 = _context74.sent;
11383
- campaign = _yield$this$put2.campaign;
11384
- return _context74.abrupt("return", campaign);
11385
-
11386
- case 5:
11387
11895
  case "end":
11388
11896
  return _context74.stop();
11389
11897
  }
@@ -11391,32 +11899,22 @@ var StreamChat = /*#__PURE__*/function () {
11391
11899
  }, _callee74, this);
11392
11900
  }));
11393
11901
 
11394
- function updateCampaign(_x106, _x107) {
11395
- return _updateCampaign.apply(this, arguments);
11902
+ function createCampaign(_x107) {
11903
+ return _createCampaign.apply(this, arguments);
11396
11904
  }
11397
11905
 
11398
- return updateCampaign;
11906
+ return createCampaign;
11399
11907
  }()
11400
- /**
11401
- * deleteCampaign - Delete a Campaign
11402
- *
11403
- * @param {string} id Campaign ID
11404
- *
11405
- * @return {Promise<APIResponse>} The Server Response
11406
- */
11407
-
11408
11908
  }, {
11409
- key: "deleteCampaign",
11909
+ key: "getCampaign",
11410
11910
  value: function () {
11411
- var _deleteCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee75(id) {
11412
- var params,
11413
- _args75 = arguments;
11911
+ var _getCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee75(id) {
11414
11912
  return _regeneratorRuntime.wrap(function _callee75$(_context75) {
11415
11913
  while (1) {
11416
11914
  switch (_context75.prev = _context75.next) {
11417
11915
  case 0:
11418
- params = _args75.length > 1 && _args75[1] !== undefined ? _args75[1] : {};
11419
- return _context75.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id), params));
11916
+ this.validateServerSideAuth();
11917
+ return _context75.abrupt("return", this.get(this.baseURL + "/campaigns/".concat(id)));
11420
11918
 
11421
11919
  case 2:
11422
11920
  case "end":
@@ -11426,43 +11924,26 @@ var StreamChat = /*#__PURE__*/function () {
11426
11924
  }, _callee75, this);
11427
11925
  }));
11428
11926
 
11429
- function deleteCampaign(_x108) {
11430
- return _deleteCampaign.apply(this, arguments);
11927
+ function getCampaign(_x108) {
11928
+ return _getCampaign.apply(this, arguments);
11431
11929
  }
11432
11930
 
11433
- return deleteCampaign;
11931
+ return getCampaign;
11434
11932
  }()
11435
- /**
11436
- * scheduleCampaign - Schedule a Campaign
11437
- *
11438
- * @param {string} id Campaign ID
11439
- * @param {{scheduledFor: number}} params Schedule params
11440
- *
11441
- * @return {Campaign} Scheduled Campaign
11442
- */
11443
-
11444
11933
  }, {
11445
- key: "scheduleCampaign",
11934
+ key: "startCampaign",
11446
11935
  value: function () {
11447
- var _scheduleCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee76(id, params) {
11448
- var scheduledFor, _yield$this$patch, campaign;
11449
-
11936
+ var _startCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee76(id, scheduledFor) {
11450
11937
  return _regeneratorRuntime.wrap(function _callee76$(_context76) {
11451
11938
  while (1) {
11452
11939
  switch (_context76.prev = _context76.next) {
11453
11940
  case 0:
11454
- scheduledFor = params.scheduledFor;
11455
- _context76.next = 3;
11456
- return this.patch(this.baseURL + "/campaigns/".concat(id, "/schedule"), {
11941
+ this.validateServerSideAuth();
11942
+ return _context76.abrupt("return", this.post(this.baseURL + "/campaigns/".concat(id, "/start"), {
11457
11943
  scheduled_for: scheduledFor
11458
- });
11459
-
11460
- case 3:
11461
- _yield$this$patch = _context76.sent;
11462
- campaign = _yield$this$patch.campaign;
11463
- return _context76.abrupt("return", campaign);
11944
+ }));
11464
11945
 
11465
- case 6:
11946
+ case 2:
11466
11947
  case "end":
11467
11948
  return _context76.stop();
11468
11949
  }
@@ -11470,39 +11951,38 @@ var StreamChat = /*#__PURE__*/function () {
11470
11951
  }, _callee76, this);
11471
11952
  }));
11472
11953
 
11473
- function scheduleCampaign(_x109, _x110) {
11474
- return _scheduleCampaign.apply(this, arguments);
11954
+ function startCampaign(_x109, _x110) {
11955
+ return _startCampaign.apply(this, arguments);
11475
11956
  }
11476
11957
 
11477
- return scheduleCampaign;
11958
+ return startCampaign;
11478
11959
  }()
11479
11960
  /**
11480
- * stopCampaign - Stop a Campaign
11961
+ * queryCampaigns - Query Campaigns
11481
11962
  *
11482
- * @param {string} id Campaign ID
11483
11963
  *
11484
- * @return {Campaign} Stopped Campaign
11964
+ * @return {Campaign[]} Campaigns
11485
11965
  */
11486
11966
 
11487
11967
  }, {
11488
- key: "stopCampaign",
11968
+ key: "queryCampaigns",
11489
11969
  value: function () {
11490
- var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee77(id) {
11491
- var _yield$this$patch2, campaign;
11492
-
11970
+ var _queryCampaigns = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee77(filter, sort, options) {
11493
11971
  return _regeneratorRuntime.wrap(function _callee77$(_context77) {
11494
11972
  while (1) {
11495
11973
  switch (_context77.prev = _context77.next) {
11496
11974
  case 0:
11497
- _context77.next = 2;
11498
- return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
11975
+ this.validateServerSideAuth();
11976
+ _context77.next = 3;
11977
+ return this.post(this.baseURL + "/campaigns/query", _objectSpread({
11978
+ filter: filter,
11979
+ sort: sort
11980
+ }, options || {}));
11499
11981
 
11500
- case 2:
11501
- _yield$this$patch2 = _context77.sent;
11502
- campaign = _yield$this$patch2.campaign;
11503
- return _context77.abrupt("return", campaign);
11982
+ case 3:
11983
+ return _context77.abrupt("return", _context77.sent);
11504
11984
 
11505
- case 5:
11985
+ case 4:
11506
11986
  case "end":
11507
11987
  return _context77.stop();
11508
11988
  }
@@ -11510,39 +11990,33 @@ var StreamChat = /*#__PURE__*/function () {
11510
11990
  }, _callee77, this);
11511
11991
  }));
11512
11992
 
11513
- function stopCampaign(_x111) {
11514
- return _stopCampaign.apply(this, arguments);
11993
+ function queryCampaigns(_x111, _x112, _x113) {
11994
+ return _queryCampaigns.apply(this, arguments);
11515
11995
  }
11516
11996
 
11517
- return stopCampaign;
11997
+ return queryCampaigns;
11518
11998
  }()
11519
11999
  /**
11520
- * resumeCampaign - Resume a Campaign
12000
+ * updateCampaign - Update a Campaign
11521
12001
  *
11522
12002
  * @param {string} id Campaign ID
12003
+ * @param {Partial<CampaignData>} params Campaign data
11523
12004
  *
11524
- * @return {Campaign} Resumed Campaign
12005
+ * @return {Campaign} Updated Campaign
11525
12006
  */
11526
12007
 
11527
12008
  }, {
11528
- key: "resumeCampaign",
12009
+ key: "updateCampaign",
11529
12010
  value: function () {
11530
- var _resumeCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee78(id) {
11531
- var _yield$this$patch3, campaign;
11532
-
12011
+ var _updateCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee78(id, params) {
11533
12012
  return _regeneratorRuntime.wrap(function _callee78$(_context78) {
11534
12013
  while (1) {
11535
12014
  switch (_context78.prev = _context78.next) {
11536
12015
  case 0:
11537
- _context78.next = 2;
11538
- return this.patch(this.baseURL + "/campaigns/".concat(id, "/resume"));
12016
+ this.validateServerSideAuth();
12017
+ return _context78.abrupt("return", this.put(this.baseURL + "/campaigns/".concat(id), params));
11539
12018
 
11540
12019
  case 2:
11541
- _yield$this$patch3 = _context78.sent;
11542
- campaign = _yield$this$patch3.campaign;
11543
- return _context78.abrupt("return", campaign);
11544
-
11545
- case 5:
11546
12020
  case "end":
11547
12021
  return _context78.stop();
11548
12022
  }
@@ -11550,40 +12024,32 @@ var StreamChat = /*#__PURE__*/function () {
11550
12024
  }, _callee78, this);
11551
12025
  }));
11552
12026
 
11553
- function resumeCampaign(_x112) {
11554
- return _resumeCampaign.apply(this, arguments);
12027
+ function updateCampaign(_x114, _x115) {
12028
+ return _updateCampaign.apply(this, arguments);
11555
12029
  }
11556
12030
 
11557
- return resumeCampaign;
12031
+ return updateCampaign;
11558
12032
  }()
11559
12033
  /**
11560
- * testCampaign - Test a Campaign
12034
+ * deleteCampaign - Delete a Campaign
11561
12035
  *
11562
12036
  * @param {string} id Campaign ID
11563
- * @param {{users: string[]}} params Test params
11564
12037
  *
11565
- * @return {TestCampaignResponse} Test campaign response
12038
+ * @return {Promise<APIResponse>} The Server Response
11566
12039
  */
11567
12040
 
11568
12041
  }, {
11569
- key: "testCampaign",
12042
+ key: "deleteCampaign",
11570
12043
  value: function () {
11571
- var _testCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee79(id, params) {
11572
- var users;
12044
+ var _deleteCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee79(id) {
11573
12045
  return _regeneratorRuntime.wrap(function _callee79$(_context79) {
11574
12046
  while (1) {
11575
12047
  switch (_context79.prev = _context79.next) {
11576
12048
  case 0:
11577
- users = params.users;
11578
- _context79.next = 3;
11579
- return this.post(this.baseURL + "/campaigns/".concat(id, "/test"), {
11580
- users: users
11581
- });
12049
+ this.validateServerSideAuth();
12050
+ return _context79.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id)));
11582
12051
 
11583
- case 3:
11584
- return _context79.abrupt("return", _context79.sent);
11585
-
11586
- case 4:
12052
+ case 2:
11587
12053
  case "end":
11588
12054
  return _context79.stop();
11589
12055
  }
@@ -11591,11 +12057,52 @@ var StreamChat = /*#__PURE__*/function () {
11591
12057
  }, _callee79, this);
11592
12058
  }));
11593
12059
 
11594
- function testCampaign(_x113, _x114) {
11595
- return _testCampaign.apply(this, arguments);
12060
+ function deleteCampaign(_x116) {
12061
+ return _deleteCampaign.apply(this, arguments);
12062
+ }
12063
+
12064
+ return deleteCampaign;
12065
+ }()
12066
+ /**
12067
+ * stopCampaign - Stop a Campaign
12068
+ *
12069
+ * @param {string} id Campaign ID
12070
+ *
12071
+ * @return {Campaign} Stopped Campaign
12072
+ */
12073
+
12074
+ }, {
12075
+ key: "stopCampaign",
12076
+ value: function () {
12077
+ var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee80(id) {
12078
+ var _yield$this$patch, campaign;
12079
+
12080
+ return _regeneratorRuntime.wrap(function _callee80$(_context80) {
12081
+ while (1) {
12082
+ switch (_context80.prev = _context80.next) {
12083
+ case 0:
12084
+ this.validateServerSideAuth();
12085
+ _context80.next = 3;
12086
+ return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
12087
+
12088
+ case 3:
12089
+ _yield$this$patch = _context80.sent;
12090
+ campaign = _yield$this$patch.campaign;
12091
+ return _context80.abrupt("return", campaign);
12092
+
12093
+ case 6:
12094
+ case "end":
12095
+ return _context80.stop();
12096
+ }
12097
+ }
12098
+ }, _callee80, this);
12099
+ }));
12100
+
12101
+ function stopCampaign(_x117) {
12102
+ return _stopCampaign.apply(this, arguments);
11596
12103
  }
11597
12104
 
11598
- return testCampaign;
12105
+ return stopCampaign;
11599
12106
  }()
11600
12107
  /**
11601
12108
  * enrichURL - Get OpenGraph data of the given link
@@ -11607,24 +12114,24 @@ var StreamChat = /*#__PURE__*/function () {
11607
12114
  }, {
11608
12115
  key: "enrichURL",
11609
12116
  value: function () {
11610
- var _enrichURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee80(url) {
11611
- return _regeneratorRuntime.wrap(function _callee80$(_context80) {
12117
+ var _enrichURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee81(url) {
12118
+ return _regeneratorRuntime.wrap(function _callee81$(_context81) {
11612
12119
  while (1) {
11613
- switch (_context80.prev = _context80.next) {
12120
+ switch (_context81.prev = _context81.next) {
11614
12121
  case 0:
11615
- return _context80.abrupt("return", this.get(this.baseURL + "/og", {
12122
+ return _context81.abrupt("return", this.get(this.baseURL + "/og", {
11616
12123
  url: url
11617
12124
  }));
11618
12125
 
11619
12126
  case 1:
11620
12127
  case "end":
11621
- return _context80.stop();
12128
+ return _context81.stop();
11622
12129
  }
11623
12130
  }
11624
- }, _callee80, this);
12131
+ }, _callee81, this);
11625
12132
  }));
11626
12133
 
11627
- function enrichURL(_x115) {
12134
+ function enrichURL(_x118) {
11628
12135
  return _enrichURL.apply(this, arguments);
11629
12136
  }
11630
12137
 
@@ -11641,22 +12148,22 @@ var StreamChat = /*#__PURE__*/function () {
11641
12148
  }, {
11642
12149
  key: "getTask",
11643
12150
  value: function () {
11644
- var _getTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee81(id) {
11645
- return _regeneratorRuntime.wrap(function _callee81$(_context81) {
12151
+ var _getTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee82(id) {
12152
+ return _regeneratorRuntime.wrap(function _callee82$(_context82) {
11646
12153
  while (1) {
11647
- switch (_context81.prev = _context81.next) {
12154
+ switch (_context82.prev = _context82.next) {
11648
12155
  case 0:
11649
- return _context81.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
12156
+ return _context82.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
11650
12157
 
11651
12158
  case 1:
11652
12159
  case "end":
11653
- return _context81.stop();
12160
+ return _context82.stop();
11654
12161
  }
11655
12162
  }
11656
- }, _callee81, this);
12163
+ }, _callee82, this);
11657
12164
  }));
11658
12165
 
11659
- function getTask(_x116) {
12166
+ function getTask(_x119) {
11660
12167
  return _getTask.apply(this, arguments);
11661
12168
  }
11662
12169
 
@@ -11674,31 +12181,31 @@ var StreamChat = /*#__PURE__*/function () {
11674
12181
  }, {
11675
12182
  key: "deleteChannels",
11676
12183
  value: function () {
11677
- var _deleteChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee82(cids) {
12184
+ var _deleteChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee83(cids) {
11678
12185
  var options,
11679
- _args82 = arguments;
11680
- return _regeneratorRuntime.wrap(function _callee82$(_context82) {
12186
+ _args83 = arguments;
12187
+ return _regeneratorRuntime.wrap(function _callee83$(_context83) {
11681
12188
  while (1) {
11682
- switch (_context82.prev = _context82.next) {
12189
+ switch (_context83.prev = _context83.next) {
11683
12190
  case 0:
11684
- options = _args82.length > 1 && _args82[1] !== undefined ? _args82[1] : {};
11685
- _context82.next = 3;
12191
+ options = _args83.length > 1 && _args83[1] !== undefined ? _args83[1] : {};
12192
+ _context83.next = 3;
11686
12193
  return this.post(this.baseURL + "/channels/delete", _objectSpread({
11687
12194
  cids: cids
11688
12195
  }, options));
11689
12196
 
11690
12197
  case 3:
11691
- return _context82.abrupt("return", _context82.sent);
12198
+ return _context83.abrupt("return", _context83.sent);
11692
12199
 
11693
12200
  case 4:
11694
12201
  case "end":
11695
- return _context82.stop();
12202
+ return _context83.stop();
11696
12203
  }
11697
12204
  }
11698
- }, _callee82, this);
12205
+ }, _callee83, this);
11699
12206
  }));
11700
12207
 
11701
- function deleteChannels(_x117) {
12208
+ function deleteChannels(_x120) {
11702
12209
  return _deleteChannels.apply(this, arguments);
11703
12210
  }
11704
12211
 
@@ -11716,17 +12223,17 @@ var StreamChat = /*#__PURE__*/function () {
11716
12223
  }, {
11717
12224
  key: "deleteUsers",
11718
12225
  value: function () {
11719
- var _deleteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee83(user_ids) {
12226
+ var _deleteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee84(user_ids) {
11720
12227
  var options,
11721
- _args83 = arguments;
11722
- return _regeneratorRuntime.wrap(function _callee83$(_context83) {
12228
+ _args84 = arguments;
12229
+ return _regeneratorRuntime.wrap(function _callee84$(_context84) {
11723
12230
  while (1) {
11724
- switch (_context83.prev = _context83.next) {
12231
+ switch (_context84.prev = _context84.next) {
11725
12232
  case 0:
11726
- options = _args83.length > 1 && _args83[1] !== undefined ? _args83[1] : {};
12233
+ options = _args84.length > 1 && _args84[1] !== undefined ? _args84[1] : {};
11727
12234
 
11728
12235
  if (!(typeof options.user !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.user))) {
11729
- _context83.next = 3;
12236
+ _context84.next = 3;
11730
12237
  break;
11731
12238
  }
11732
12239
 
@@ -11734,7 +12241,7 @@ var StreamChat = /*#__PURE__*/function () {
11734
12241
 
11735
12242
  case 3:
11736
12243
  if (!(typeof options.conversations !== 'undefined' && !['soft', 'hard'].includes(options.conversations))) {
11737
- _context83.next = 5;
12244
+ _context84.next = 5;
11738
12245
  break;
11739
12246
  }
11740
12247
 
@@ -11742,30 +12249,30 @@ var StreamChat = /*#__PURE__*/function () {
11742
12249
 
11743
12250
  case 5:
11744
12251
  if (!(typeof options.messages !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.messages))) {
11745
- _context83.next = 7;
12252
+ _context84.next = 7;
11746
12253
  break;
11747
12254
  }
11748
12255
 
11749
12256
  throw new Error('Invalid delete user options. messages must be one of [soft hard pruning]');
11750
12257
 
11751
12258
  case 7:
11752
- _context83.next = 9;
12259
+ _context84.next = 9;
11753
12260
  return this.post(this.baseURL + "/users/delete", _objectSpread({
11754
12261
  user_ids: user_ids
11755
12262
  }, options));
11756
12263
 
11757
12264
  case 9:
11758
- return _context83.abrupt("return", _context83.sent);
12265
+ return _context84.abrupt("return", _context84.sent);
11759
12266
 
11760
12267
  case 10:
11761
12268
  case "end":
11762
- return _context83.stop();
12269
+ return _context84.stop();
11763
12270
  }
11764
12271
  }
11765
- }, _callee83, this);
12272
+ }, _callee84, this);
11766
12273
  }));
11767
12274
 
11768
- function deleteUsers(_x118) {
12275
+ function deleteUsers(_x121) {
11769
12276
  return _deleteUsers.apply(this, arguments);
11770
12277
  }
11771
12278
 
@@ -11786,28 +12293,28 @@ var StreamChat = /*#__PURE__*/function () {
11786
12293
  }, {
11787
12294
  key: "_createImportURL",
11788
12295
  value: function () {
11789
- var _createImportURL2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee84(filename) {
11790
- return _regeneratorRuntime.wrap(function _callee84$(_context84) {
12296
+ var _createImportURL2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee85(filename) {
12297
+ return _regeneratorRuntime.wrap(function _callee85$(_context85) {
11791
12298
  while (1) {
11792
- switch (_context84.prev = _context84.next) {
12299
+ switch (_context85.prev = _context85.next) {
11793
12300
  case 0:
11794
- _context84.next = 2;
12301
+ _context85.next = 2;
11795
12302
  return this.post(this.baseURL + "/import_urls", {
11796
12303
  filename: filename
11797
12304
  });
11798
12305
 
11799
12306
  case 2:
11800
- return _context84.abrupt("return", _context84.sent);
12307
+ return _context85.abrupt("return", _context85.sent);
11801
12308
 
11802
12309
  case 3:
11803
12310
  case "end":
11804
- return _context84.stop();
12311
+ return _context85.stop();
11805
12312
  }
11806
12313
  }
11807
- }, _callee84, this);
12314
+ }, _callee85, this);
11808
12315
  }));
11809
12316
 
11810
- function _createImportURL(_x119) {
12317
+ function _createImportURL(_x122) {
11811
12318
  return _createImportURL2.apply(this, arguments);
11812
12319
  }
11813
12320
 
@@ -11829,33 +12336,33 @@ var StreamChat = /*#__PURE__*/function () {
11829
12336
  }, {
11830
12337
  key: "_createImport",
11831
12338
  value: function () {
11832
- var _createImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee85(path) {
12339
+ var _createImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee86(path) {
11833
12340
  var options,
11834
- _args85 = arguments;
11835
- return _regeneratorRuntime.wrap(function _callee85$(_context85) {
12341
+ _args86 = arguments;
12342
+ return _regeneratorRuntime.wrap(function _callee86$(_context86) {
11836
12343
  while (1) {
11837
- switch (_context85.prev = _context85.next) {
12344
+ switch (_context86.prev = _context86.next) {
11838
12345
  case 0:
11839
- options = _args85.length > 1 && _args85[1] !== undefined ? _args85[1] : {
12346
+ options = _args86.length > 1 && _args86[1] !== undefined ? _args86[1] : {
11840
12347
  mode: 'upsert'
11841
12348
  };
11842
- _context85.next = 3;
12349
+ _context86.next = 3;
11843
12350
  return this.post(this.baseURL + "/imports", _objectSpread({
11844
12351
  path: path
11845
12352
  }, options));
11846
12353
 
11847
12354
  case 3:
11848
- return _context85.abrupt("return", _context85.sent);
12355
+ return _context86.abrupt("return", _context86.sent);
11849
12356
 
11850
12357
  case 4:
11851
12358
  case "end":
11852
- return _context85.stop();
12359
+ return _context86.stop();
11853
12360
  }
11854
12361
  }
11855
- }, _callee85, this);
12362
+ }, _callee86, this);
11856
12363
  }));
11857
12364
 
11858
- function _createImport(_x120) {
12365
+ function _createImport(_x123) {
11859
12366
  return _createImport2.apply(this, arguments);
11860
12367
  }
11861
12368
 
@@ -11877,26 +12384,26 @@ var StreamChat = /*#__PURE__*/function () {
11877
12384
  }, {
11878
12385
  key: "_getImport",
11879
12386
  value: function () {
11880
- var _getImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee86(id) {
11881
- return _regeneratorRuntime.wrap(function _callee86$(_context86) {
12387
+ var _getImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee87(id) {
12388
+ return _regeneratorRuntime.wrap(function _callee87$(_context87) {
11882
12389
  while (1) {
11883
- switch (_context86.prev = _context86.next) {
12390
+ switch (_context87.prev = _context87.next) {
11884
12391
  case 0:
11885
- _context86.next = 2;
12392
+ _context87.next = 2;
11886
12393
  return this.get(this.baseURL + "/imports/".concat(id));
11887
12394
 
11888
12395
  case 2:
11889
- return _context86.abrupt("return", _context86.sent);
12396
+ return _context87.abrupt("return", _context87.sent);
11890
12397
 
11891
12398
  case 3:
11892
12399
  case "end":
11893
- return _context86.stop();
12400
+ return _context87.stop();
11894
12401
  }
11895
12402
  }
11896
- }, _callee86, this);
12403
+ }, _callee87, this);
11897
12404
  }));
11898
12405
 
11899
- function _getImport(_x121) {
12406
+ function _getImport(_x124) {
11900
12407
  return _getImport2.apply(this, arguments);
11901
12408
  }
11902
12409
 
@@ -11918,26 +12425,26 @@ var StreamChat = /*#__PURE__*/function () {
11918
12425
  }, {
11919
12426
  key: "_listImports",
11920
12427
  value: function () {
11921
- var _listImports2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee87(options) {
11922
- return _regeneratorRuntime.wrap(function _callee87$(_context87) {
12428
+ var _listImports2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee88(options) {
12429
+ return _regeneratorRuntime.wrap(function _callee88$(_context88) {
11923
12430
  while (1) {
11924
- switch (_context87.prev = _context87.next) {
12431
+ switch (_context88.prev = _context88.next) {
11925
12432
  case 0:
11926
- _context87.next = 2;
12433
+ _context88.next = 2;
11927
12434
  return this.get(this.baseURL + "/imports", options);
11928
12435
 
11929
12436
  case 2:
11930
- return _context87.abrupt("return", _context87.sent);
12437
+ return _context88.abrupt("return", _context88.sent);
11931
12438
 
11932
12439
  case 3:
11933
12440
  case "end":
11934
- return _context87.stop();
12441
+ return _context88.stop();
11935
12442
  }
11936
12443
  }
11937
- }, _callee87, this);
12444
+ }, _callee88, this);
11938
12445
  }));
11939
12446
 
11940
- function _listImports(_x122) {
12447
+ function _listImports(_x125) {
11941
12448
  return _listImports2.apply(this, arguments);
11942
12449
  }
11943
12450
 
@@ -11956,28 +12463,28 @@ var StreamChat = /*#__PURE__*/function () {
11956
12463
  }, {
11957
12464
  key: "upsertPushProvider",
11958
12465
  value: function () {
11959
- var _upsertPushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee88(pushProvider) {
11960
- return _regeneratorRuntime.wrap(function _callee88$(_context88) {
12466
+ var _upsertPushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee89(pushProvider) {
12467
+ return _regeneratorRuntime.wrap(function _callee89$(_context89) {
11961
12468
  while (1) {
11962
- switch (_context88.prev = _context88.next) {
12469
+ switch (_context89.prev = _context89.next) {
11963
12470
  case 0:
11964
- _context88.next = 2;
12471
+ _context89.next = 2;
11965
12472
  return this.post(this.baseURL + "/push_providers", {
11966
12473
  push_provider: pushProvider
11967
12474
  });
11968
12475
 
11969
12476
  case 2:
11970
- return _context88.abrupt("return", _context88.sent);
12477
+ return _context89.abrupt("return", _context89.sent);
11971
12478
 
11972
12479
  case 3:
11973
12480
  case "end":
11974
- return _context88.stop();
12481
+ return _context89.stop();
11975
12482
  }
11976
12483
  }
11977
- }, _callee88, this);
12484
+ }, _callee89, this);
11978
12485
  }));
11979
12486
 
11980
- function upsertPushProvider(_x123) {
12487
+ function upsertPushProvider(_x126) {
11981
12488
  return _upsertPushProvider.apply(this, arguments);
11982
12489
  }
11983
12490
 
@@ -11996,28 +12503,28 @@ var StreamChat = /*#__PURE__*/function () {
11996
12503
  }, {
11997
12504
  key: "deletePushProvider",
11998
12505
  value: function () {
11999
- var _deletePushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee89(_ref10) {
12506
+ var _deletePushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee90(_ref10) {
12000
12507
  var type, name;
12001
- return _regeneratorRuntime.wrap(function _callee89$(_context89) {
12508
+ return _regeneratorRuntime.wrap(function _callee90$(_context90) {
12002
12509
  while (1) {
12003
- switch (_context89.prev = _context89.next) {
12510
+ switch (_context90.prev = _context90.next) {
12004
12511
  case 0:
12005
12512
  type = _ref10.type, name = _ref10.name;
12006
- _context89.next = 3;
12513
+ _context90.next = 3;
12007
12514
  return this.delete(this.baseURL + "/push_providers/".concat(type, "/").concat(name));
12008
12515
 
12009
12516
  case 3:
12010
- return _context89.abrupt("return", _context89.sent);
12517
+ return _context90.abrupt("return", _context90.sent);
12011
12518
 
12012
12519
  case 4:
12013
12520
  case "end":
12014
- return _context89.stop();
12521
+ return _context90.stop();
12015
12522
  }
12016
12523
  }
12017
- }, _callee89, this);
12524
+ }, _callee90, this);
12018
12525
  }));
12019
12526
 
12020
- function deletePushProvider(_x124) {
12527
+ function deletePushProvider(_x127) {
12021
12528
  return _deletePushProvider.apply(this, arguments);
12022
12529
  }
12023
12530
 
@@ -12034,23 +12541,23 @@ var StreamChat = /*#__PURE__*/function () {
12034
12541
  }, {
12035
12542
  key: "listPushProviders",
12036
12543
  value: function () {
12037
- var _listPushProviders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee90() {
12038
- return _regeneratorRuntime.wrap(function _callee90$(_context90) {
12544
+ var _listPushProviders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee91() {
12545
+ return _regeneratorRuntime.wrap(function _callee91$(_context91) {
12039
12546
  while (1) {
12040
- switch (_context90.prev = _context90.next) {
12547
+ switch (_context91.prev = _context91.next) {
12041
12548
  case 0:
12042
- _context90.next = 2;
12549
+ _context91.next = 2;
12043
12550
  return this.get(this.baseURL + "/push_providers");
12044
12551
 
12045
12552
  case 2:
12046
- return _context90.abrupt("return", _context90.sent);
12553
+ return _context91.abrupt("return", _context91.sent);
12047
12554
 
12048
12555
  case 3:
12049
12556
  case "end":
12050
- return _context90.stop();
12557
+ return _context91.stop();
12051
12558
  }
12052
12559
  }
12053
- }, _callee90, this);
12560
+ }, _callee91, this);
12054
12561
  }));
12055
12562
 
12056
12563
  function listPushProviders() {
@@ -12078,26 +12585,26 @@ var StreamChat = /*#__PURE__*/function () {
12078
12585
  }, {
12079
12586
  key: "commitMessage",
12080
12587
  value: function () {
12081
- var _commitMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee91(id) {
12082
- return _regeneratorRuntime.wrap(function _callee91$(_context91) {
12588
+ var _commitMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee92(id) {
12589
+ return _regeneratorRuntime.wrap(function _callee92$(_context92) {
12083
12590
  while (1) {
12084
- switch (_context91.prev = _context91.next) {
12591
+ switch (_context92.prev = _context92.next) {
12085
12592
  case 0:
12086
- _context91.next = 2;
12593
+ _context92.next = 2;
12087
12594
  return this.post(this.baseURL + "/messages/".concat(id, "/commit"));
12088
12595
 
12089
12596
  case 2:
12090
- return _context91.abrupt("return", _context91.sent);
12597
+ return _context92.abrupt("return", _context92.sent);
12091
12598
 
12092
12599
  case 3:
12093
12600
  case "end":
12094
- return _context91.stop();
12601
+ return _context92.stop();
12095
12602
  }
12096
12603
  }
12097
- }, _callee91, this);
12604
+ }, _callee92, this);
12098
12605
  }));
12099
12606
 
12100
- function commitMessage(_x125) {
12607
+ function commitMessage(_x128) {
12101
12608
  return _commitMessage.apply(this, arguments);
12102
12609
  }
12103
12610
 
@@ -12249,5 +12756,5 @@ var BuiltinPermissions = {
12249
12756
  UseFrozenChannel: 'Send messages and reactions to frozen channels'
12250
12757
  };
12251
12758
 
12252
- export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MaxPriority, MinPriority, Permission, StableWSConnection, StreamChat, Thread, TokenManager, UserFromToken, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, formatMessage, isOwnUser, logChatPromiseExecution, postInsights };
12759
+ export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, Campaign, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MaxPriority, MinPriority, Permission, Segment, StableWSConnection, StreamChat, Thread, TokenManager, UserFromToken, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, formatMessage, isOwnUser, logChatPromiseExecution, postInsights };
12253
12760
  //# sourceMappingURL=index.es.js.map