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