stream-chat 8.16.0 → 8.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1964,7 +1964,9 @@ var Channel = /*#__PURE__*/function () {
1964
1964
  key: "updatePartial",
1965
1965
  value: function () {
1966
1966
  var _updatePartial = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(update) {
1967
- var data;
1967
+ var _this$data2, _this$data3;
1968
+
1969
+ var data, areCapabilitiesChanged;
1968
1970
  return _regeneratorRuntime.wrap(function _callee8$(_context8) {
1969
1971
  while (1) {
1970
1972
  switch (_context8.prev = _context8.next) {
@@ -1974,10 +1976,20 @@ var Channel = /*#__PURE__*/function () {
1974
1976
 
1975
1977
  case 2:
1976
1978
  data = _context8.sent;
1977
- this.data = data.channel;
1979
+ areCapabilitiesChanged = _toConsumableArray(data.channel.own_capabilities || []).sort().join() !== _toConsumableArray(Array.isArray((_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2.own_capabilities) ? (_this$data3 = this.data) === null || _this$data3 === void 0 ? void 0 : _this$data3.own_capabilities : []).sort().join();
1980
+ this.data = data.channel; // If the capabiltities are changed, we trigger the `capabilities.changed` event.
1981
+
1982
+ if (areCapabilitiesChanged) {
1983
+ this.getClient().dispatchEvent({
1984
+ type: 'capabilities.changed',
1985
+ cid: this.cid,
1986
+ own_capabilities: data.channel.own_capabilities
1987
+ });
1988
+ }
1989
+
1978
1990
  return _context8.abrupt("return", data);
1979
1991
 
1980
- case 5:
1992
+ case 7:
1981
1993
  case "end":
1982
1994
  return _context8.stop();
1983
1995
  }
@@ -2791,7 +2803,7 @@ var Channel = /*#__PURE__*/function () {
2791
2803
 
2792
2804
  this._checkInitialized();
2793
2805
 
2794
- if ((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) {
2806
+ if (!(!((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) && !this.getClient()._isUsingServerAuth())) {
2795
2807
  _context26.next = 4;
2796
2808
  break;
2797
2809
  }
@@ -2838,7 +2850,7 @@ var Channel = /*#__PURE__*/function () {
2838
2850
  case 0:
2839
2851
  this._checkInitialized();
2840
2852
 
2841
- if ((_this$getConfig4 = this.getConfig()) !== null && _this$getConfig4 !== void 0 && _this$getConfig4.read_events) {
2853
+ if (!(!((_this$getConfig4 = this.getConfig()) !== null && _this$getConfig4 !== void 0 && _this$getConfig4.read_events) && !this.getClient()._isUsingServerAuth())) {
2842
2854
  _context27.next = 3;
2843
2855
  break;
2844
2856
  }
@@ -3123,7 +3135,7 @@ var Channel = /*#__PURE__*/function () {
3123
3135
  }, {
3124
3136
  key: "_countMessageAsUnread",
3125
3137
  value: function _countMessageAsUnread(message) {
3126
- var _message$user, _message$user2, _this$data2, _this$data3;
3138
+ var _message$user, _message$user2, _this$data4, _this$data5;
3127
3139
 
3128
3140
  if (message.shadowed) return false;
3129
3141
  if (message.silent) return false;
@@ -3132,7 +3144,7 @@ var Channel = /*#__PURE__*/function () {
3132
3144
  if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
3133
3145
  if (message.type === 'system') return false; // Return false if channel doesn't allow read events.
3134
3146
 
3135
- if (Array.isArray((_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2.own_capabilities) && !((_this$data3 = this.data) !== null && _this$data3 !== void 0 && _this$data3.own_capabilities.includes('read-events'))) return false;
3147
+ if (Array.isArray((_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.own_capabilities) && !((_this$data5 = this.data) !== null && _this$data5 !== void 0 && _this$data5.own_capabilities.includes('read-events'))) return false;
3136
3148
  if (this.muteStatus().muted) return false;
3137
3149
  return true;
3138
3150
  }
@@ -3207,7 +3219,7 @@ var Channel = /*#__PURE__*/function () {
3207
3219
  */
3208
3220
  function () {
3209
3221
  var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(options) {
3210
- var _this$data4, _this$data5;
3222
+ var _this$data6, _this$data7;
3211
3223
 
3212
3224
  var messageSetToAddToIfDoesNotExist,
3213
3225
  queryURL,
@@ -3270,7 +3282,7 @@ var Channel = /*#__PURE__*/function () {
3270
3282
 
3271
3283
 
3272
3284
  _this$_initializeStat = this._initializeState(state, messageSetToAddToIfDoesNotExist), messageSet = _this$_initializeStat.messageSet;
3273
- areCapabilitiesChanged = _toConsumableArray(state.channel.own_capabilities || []).sort().join() !== _toConsumableArray(Array.isArray((_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.own_capabilities) ? (_this$data5 = this.data) === null || _this$data5 === void 0 ? void 0 : _this$data5.own_capabilities : []).sort().join();
3285
+ areCapabilitiesChanged = _toConsumableArray(state.channel.own_capabilities || []).sort().join() !== _toConsumableArray(Array.isArray((_this$data6 = this.data) === null || _this$data6 === void 0 ? void 0 : _this$data6.own_capabilities) ? (_this$data7 = this.data) === null || _this$data7 === void 0 ? void 0 : _this$data7.own_capabilities : []).sort().join();
3274
3286
  this.data = state.channel;
3275
3287
  this.offlineMode = false;
3276
3288
 
@@ -6075,126 +6087,664 @@ var WSConnectionFallback = /*#__PURE__*/function () {
6075
6087
  return WSConnectionFallback;
6076
6088
  }();
6077
6089
 
6078
- 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); }; }
6090
+ var Campaign = /*#__PURE__*/function () {
6091
+ function Campaign(client, id, data) {
6092
+ _classCallCheck(this, Campaign);
6079
6093
 
6080
- 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; } }
6094
+ _defineProperty(this, "id", void 0);
6081
6095
 
6082
- /**
6083
- * Utility Types
6084
- */
6096
+ _defineProperty(this, "data", void 0);
6085
6097
 
6086
- /* Unknown Record */
6087
- //alias to avoid breaking change
6098
+ _defineProperty(this, "client", void 0);
6088
6099
 
6089
- /**
6090
- * Response Types
6091
- */
6092
- // TODO: Figure out a way to strongly type set and unset.
6093
- // Thumb URL(thumb_url) is added considering video attachments as the backend will return the thumbnail in the response.
6100
+ this.client = client;
6101
+ this.id = id;
6102
+ this.data = data;
6103
+ }
6094
6104
 
6095
- /**
6096
- * Option Types
6097
- */
6098
- // TODO: rename to UpdateChannelOptions in the next major update and use it in channel._update and/or channel.update
6105
+ _createClass(Campaign, [{
6106
+ key: "create",
6107
+ value: function () {
6108
+ var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
6109
+ var _this$data, _this$data2, _this$data3, _this$data4, _this$data5, _this$data6, _this$data7, _this$data8;
6099
6110
 
6100
- /** @deprecated use MarkChannelsReadOptions instead */
6101
- // TODO: rename to UpdateChannelTypeOptions in the next major update
6111
+ var body, result;
6112
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
6113
+ while (1) {
6114
+ switch (_context.prev = _context.next) {
6115
+ case 0:
6116
+ body = {
6117
+ id: this.id,
6118
+ message_template: (_this$data = this.data) === null || _this$data === void 0 ? void 0 : _this$data.message_template,
6119
+ segment_ids: (_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2.segment_ids,
6120
+ sender_id: (_this$data3 = this.data) === null || _this$data3 === void 0 ? void 0 : _this$data3.sender_id,
6121
+ channel_template: (_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.channel_template,
6122
+ create_channels: (_this$data5 = this.data) === null || _this$data5 === void 0 ? void 0 : _this$data5.create_channels,
6123
+ description: (_this$data6 = this.data) === null || _this$data6 === void 0 ? void 0 : _this$data6.description,
6124
+ name: (_this$data7 = this.data) === null || _this$data7 === void 0 ? void 0 : _this$data7.name,
6125
+ user_ids: (_this$data8 = this.data) === null || _this$data8 === void 0 ? void 0 : _this$data8.user_ids
6126
+ };
6127
+ _context.next = 3;
6128
+ return this.client.createCampaign(body);
6102
6129
 
6103
- /**
6104
- * Event Types
6105
- */
6130
+ case 3:
6131
+ result = _context.sent;
6132
+ this.id = result.campaign.id;
6133
+ this.data = result.campaign;
6134
+ return _context.abrupt("return", result);
6106
6135
 
6107
- /**
6108
- * Filter Types
6109
- */
6136
+ case 7:
6137
+ case "end":
6138
+ return _context.stop();
6139
+ }
6140
+ }
6141
+ }, _callee, this);
6142
+ }));
6110
6143
 
6111
- /**
6112
- * Sort Types
6113
- */
6144
+ function create() {
6145
+ return _create.apply(this, arguments);
6146
+ }
6114
6147
 
6115
- /**
6116
- * Base Types
6117
- */
6148
+ return create;
6149
+ }()
6150
+ }, {
6151
+ key: "verifyCampaignId",
6152
+ value: function verifyCampaignId() {
6153
+ if (!this.id) {
6154
+ 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)');
6155
+ }
6156
+ }
6157
+ }, {
6158
+ key: "start",
6159
+ value: function () {
6160
+ var _start = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(scheduledFor) {
6161
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
6162
+ while (1) {
6163
+ switch (_context2.prev = _context2.next) {
6164
+ case 0:
6165
+ this.verifyCampaignId();
6166
+ _context2.next = 3;
6167
+ return this.client.startCampaign(this.id, scheduledFor);
6118
6168
 
6119
- /*
6120
- DeleteUserOptions specifies a collection of one or more `user_ids` to be deleted.
6169
+ case 3:
6170
+ return _context2.abrupt("return", _context2.sent);
6121
6171
 
6122
- `user`:
6123
- - soft: marks user as deleted and retains all user data
6124
- - pruning: marks user as deleted and nullifies user information
6125
- - hard: deletes user completely - this requires hard option for messages and conversation as well
6126
- `conversations`:
6127
- - soft: marks all conversation channels as deleted (same effect as Delete Channels with 'hard' option disabled)
6128
- - hard: deletes channel and all its data completely including messages (same effect as Delete Channels with 'hard' option enabled)
6129
- `messages`:
6130
- - soft: marks all user messages as deleted without removing any related message data
6131
- - pruning: marks all user messages as deleted, nullifies message information and removes some message data such as reactions and flags
6132
- - hard: deletes messages completely with all related information
6133
- `new_channel_owner_id`: any channels owned by the hard-deleted user will be transferred to this user ID
6134
- */
6135
- // TODO: add better typing
6136
- var ErrorFromResponse = /*#__PURE__*/function (_Error) {
6137
- _inherits(ErrorFromResponse, _Error);
6172
+ case 4:
6173
+ case "end":
6174
+ return _context2.stop();
6175
+ }
6176
+ }
6177
+ }, _callee2, this);
6178
+ }));
6138
6179
 
6139
- var _super = _createSuper(ErrorFromResponse);
6180
+ function start(_x) {
6181
+ return _start.apply(this, arguments);
6182
+ }
6140
6183
 
6141
- function ErrorFromResponse() {
6142
- var _this;
6184
+ return start;
6185
+ }()
6186
+ }, {
6187
+ key: "update",
6188
+ value: function () {
6189
+ var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data) {
6190
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
6191
+ while (1) {
6192
+ switch (_context3.prev = _context3.next) {
6193
+ case 0:
6194
+ this.verifyCampaignId();
6195
+ return _context3.abrupt("return", this.client.updateCampaign(this.id, data));
6143
6196
 
6144
- _classCallCheck(this, ErrorFromResponse);
6197
+ case 2:
6198
+ case "end":
6199
+ return _context3.stop();
6200
+ }
6201
+ }
6202
+ }, _callee3, this);
6203
+ }));
6145
6204
 
6146
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
6147
- args[_key] = arguments[_key];
6148
- }
6205
+ function update(_x2) {
6206
+ return _update.apply(this, arguments);
6207
+ }
6149
6208
 
6150
- _this = _super.call.apply(_super, [this].concat(args));
6209
+ return update;
6210
+ }()
6211
+ }, {
6212
+ key: "delete",
6213
+ value: function () {
6214
+ var _delete2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
6215
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
6216
+ while (1) {
6217
+ switch (_context4.prev = _context4.next) {
6218
+ case 0:
6219
+ this.verifyCampaignId();
6220
+ _context4.next = 3;
6221
+ return this.client.delete(this.client.baseURL + "/campaigns/".concat(this.id));
6151
6222
 
6152
- _defineProperty(_assertThisInitialized(_this), "code", void 0);
6223
+ case 3:
6224
+ return _context4.abrupt("return", _context4.sent);
6153
6225
 
6154
- _defineProperty(_assertThisInitialized(_this), "response", void 0);
6226
+ case 4:
6227
+ case "end":
6228
+ return _context4.stop();
6229
+ }
6230
+ }
6231
+ }, _callee4, this);
6232
+ }));
6155
6233
 
6156
- _defineProperty(_assertThisInitialized(_this), "status", void 0);
6234
+ function _delete() {
6235
+ return _delete2.apply(this, arguments);
6236
+ }
6157
6237
 
6158
- return _this;
6159
- }
6238
+ return _delete;
6239
+ }()
6240
+ }, {
6241
+ key: "schedule",
6242
+ value: function () {
6243
+ var _schedule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(params) {
6244
+ var scheduledFor, _yield$this$client$pa, campaign;
6160
6245
 
6161
- return ErrorFromResponse;
6162
- }( /*#__PURE__*/_wrapNativeSuper(Error));
6246
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
6247
+ while (1) {
6248
+ switch (_context5.prev = _context5.next) {
6249
+ case 0:
6250
+ this.verifyCampaignId();
6251
+ scheduledFor = params.scheduledFor;
6252
+ _context5.next = 4;
6253
+ return this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/schedule"), {
6254
+ scheduled_for: scheduledFor
6255
+ });
6163
6256
 
6164
- function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
6257
+ case 4:
6258
+ _yield$this$client$pa = _context5.sent;
6259
+ campaign = _yield$this$client$pa.campaign;
6260
+ return _context5.abrupt("return", campaign);
6165
6261
 
6166
- function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6262
+ case 7:
6263
+ case "end":
6264
+ return _context5.stop();
6265
+ }
6266
+ }
6267
+ }, _callee5, this);
6268
+ }));
6167
6269
 
6168
- function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
6270
+ function schedule(_x3) {
6271
+ return _schedule.apply(this, arguments);
6272
+ }
6169
6273
 
6170
- function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
6274
+ return schedule;
6275
+ }()
6276
+ }, {
6277
+ key: "stop",
6278
+ value: function () {
6279
+ var _stop = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
6280
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
6281
+ while (1) {
6282
+ switch (_context6.prev = _context6.next) {
6283
+ case 0:
6284
+ this.verifyCampaignId();
6285
+ return _context6.abrupt("return", this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/stop")));
6171
6286
 
6172
- function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
6173
- var Thread = /*#__PURE__*/function () {
6174
- function Thread(client, t) {
6175
- _classCallCheck(this, Thread);
6287
+ case 2:
6288
+ case "end":
6289
+ return _context6.stop();
6290
+ }
6291
+ }
6292
+ }, _callee6, this);
6293
+ }));
6176
6294
 
6177
- _defineProperty(this, "id", void 0);
6295
+ function stop() {
6296
+ return _stop.apply(this, arguments);
6297
+ }
6178
6298
 
6179
- _defineProperty(this, "latestReplies", []);
6299
+ return stop;
6300
+ }()
6301
+ }, {
6302
+ key: "pause",
6303
+ value: function () {
6304
+ var _pause = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
6305
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
6306
+ while (1) {
6307
+ switch (_context7.prev = _context7.next) {
6308
+ case 0:
6309
+ this.verifyCampaignId();
6310
+ return _context7.abrupt("return", this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/pause")));
6180
6311
 
6181
- _defineProperty(this, "participants", []);
6312
+ case 2:
6313
+ case "end":
6314
+ return _context7.stop();
6315
+ }
6316
+ }
6317
+ }, _callee7, this);
6318
+ }));
6182
6319
 
6183
- _defineProperty(this, "message", void 0);
6320
+ function pause() {
6321
+ return _pause.apply(this, arguments);
6322
+ }
6184
6323
 
6185
- _defineProperty(this, "channel", void 0);
6324
+ return pause;
6325
+ }()
6326
+ }, {
6327
+ key: "resume",
6328
+ value: function () {
6329
+ var _resume = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
6330
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
6331
+ while (1) {
6332
+ switch (_context8.prev = _context8.next) {
6333
+ case 0:
6334
+ this.verifyCampaignId();
6335
+ return _context8.abrupt("return", this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/resume")));
6186
6336
 
6187
- _defineProperty(this, "_channel", void 0);
6337
+ case 2:
6338
+ case "end":
6339
+ return _context8.stop();
6340
+ }
6341
+ }
6342
+ }, _callee8, this);
6343
+ }));
6188
6344
 
6189
- _defineProperty(this, "replyCount", 0);
6345
+ function resume() {
6346
+ return _resume.apply(this, arguments);
6347
+ }
6190
6348
 
6191
- _defineProperty(this, "_client", void 0);
6349
+ return resume;
6350
+ }()
6351
+ }, {
6352
+ key: "get",
6353
+ value: function () {
6354
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
6355
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
6356
+ while (1) {
6357
+ switch (_context9.prev = _context9.next) {
6358
+ case 0:
6359
+ this.verifyCampaignId();
6360
+ return _context9.abrupt("return", this.client.getCampaign(this.id));
6192
6361
 
6193
- _defineProperty(this, "read", {});
6362
+ case 2:
6363
+ case "end":
6364
+ return _context9.stop();
6365
+ }
6366
+ }
6367
+ }, _callee9, this);
6368
+ }));
6194
6369
 
6195
- this.id = t.parent_message.id;
6196
- this.message = formatMessage(t.parent_message);
6197
- this.latestReplies = t.latest_replies.map(formatMessage);
6370
+ function get() {
6371
+ return _get.apply(this, arguments);
6372
+ }
6373
+
6374
+ return get;
6375
+ }()
6376
+ }]);
6377
+
6378
+ return Campaign;
6379
+ }();
6380
+
6381
+ var Segment = /*#__PURE__*/function () {
6382
+ function Segment(client, type, id, data) {
6383
+ _classCallCheck(this, Segment);
6384
+
6385
+ _defineProperty(this, "type", void 0);
6386
+
6387
+ _defineProperty(this, "id", void 0);
6388
+
6389
+ _defineProperty(this, "client", void 0);
6390
+
6391
+ _defineProperty(this, "data", void 0);
6392
+
6393
+ this.client = client;
6394
+ this.type = type;
6395
+ this.id = id;
6396
+ this.data = data;
6397
+ }
6398
+
6399
+ _createClass(Segment, [{
6400
+ key: "create",
6401
+ value: function () {
6402
+ var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
6403
+ var _this$data, _this$data2, _this$data3, _this$data4;
6404
+
6405
+ var body;
6406
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
6407
+ while (1) {
6408
+ switch (_context.prev = _context.next) {
6409
+ case 0:
6410
+ body = {
6411
+ id: this.id,
6412
+ type: this.type,
6413
+ name: (_this$data = this.data) === null || _this$data === void 0 ? void 0 : _this$data.name,
6414
+ filter: (_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2.filter,
6415
+ description: (_this$data3 = this.data) === null || _this$data3 === void 0 ? void 0 : _this$data3.description,
6416
+ all_users: (_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.all_users
6417
+ };
6418
+ return _context.abrupt("return", this.client.post(this.client.baseURL + "/segments", body));
6419
+
6420
+ case 2:
6421
+ case "end":
6422
+ return _context.stop();
6423
+ }
6424
+ }
6425
+ }, _callee, this);
6426
+ }));
6427
+
6428
+ function create() {
6429
+ return _create.apply(this, arguments);
6430
+ }
6431
+
6432
+ return create;
6433
+ }()
6434
+ }, {
6435
+ key: "verifySegmentId",
6436
+ value: function verifySegmentId() {
6437
+ if (!this.id) {
6438
+ 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)');
6439
+ }
6440
+ }
6441
+ }, {
6442
+ key: "get",
6443
+ value: function () {
6444
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
6445
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
6446
+ while (1) {
6447
+ switch (_context2.prev = _context2.next) {
6448
+ case 0:
6449
+ this.verifySegmentId();
6450
+ return _context2.abrupt("return", this.client.getSegment(this.id));
6451
+
6452
+ case 2:
6453
+ case "end":
6454
+ return _context2.stop();
6455
+ }
6456
+ }
6457
+ }, _callee2, this);
6458
+ }));
6459
+
6460
+ function get() {
6461
+ return _get.apply(this, arguments);
6462
+ }
6463
+
6464
+ return get;
6465
+ }()
6466
+ }, {
6467
+ key: "update",
6468
+ value: function () {
6469
+ var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data) {
6470
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
6471
+ while (1) {
6472
+ switch (_context3.prev = _context3.next) {
6473
+ case 0:
6474
+ this.verifySegmentId();
6475
+ return _context3.abrupt("return", this.client.updateSegment(this.id, data));
6476
+
6477
+ case 2:
6478
+ case "end":
6479
+ return _context3.stop();
6480
+ }
6481
+ }
6482
+ }, _callee3, this);
6483
+ }));
6484
+
6485
+ function update(_x) {
6486
+ return _update.apply(this, arguments);
6487
+ }
6488
+
6489
+ return update;
6490
+ }()
6491
+ }, {
6492
+ key: "addTargets",
6493
+ value: function () {
6494
+ var _addTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(targets) {
6495
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
6496
+ while (1) {
6497
+ switch (_context4.prev = _context4.next) {
6498
+ case 0:
6499
+ this.verifySegmentId();
6500
+ return _context4.abrupt("return", this.client.addSegmentTargets(this.id, targets));
6501
+
6502
+ case 2:
6503
+ case "end":
6504
+ return _context4.stop();
6505
+ }
6506
+ }
6507
+ }, _callee4, this);
6508
+ }));
6509
+
6510
+ function addTargets(_x2) {
6511
+ return _addTargets.apply(this, arguments);
6512
+ }
6513
+
6514
+ return addTargets;
6515
+ }()
6516
+ }, {
6517
+ key: "removeTargets",
6518
+ value: function () {
6519
+ var _removeTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(targets) {
6520
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
6521
+ while (1) {
6522
+ switch (_context5.prev = _context5.next) {
6523
+ case 0:
6524
+ this.verifySegmentId();
6525
+ return _context5.abrupt("return", this.client.removeSegmentTargets(this.id, targets));
6526
+
6527
+ case 2:
6528
+ case "end":
6529
+ return _context5.stop();
6530
+ }
6531
+ }
6532
+ }, _callee5, this);
6533
+ }));
6534
+
6535
+ function removeTargets(_x3) {
6536
+ return _removeTargets.apply(this, arguments);
6537
+ }
6538
+
6539
+ return removeTargets;
6540
+ }()
6541
+ }, {
6542
+ key: "delete",
6543
+ value: function () {
6544
+ var _delete2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
6545
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
6546
+ while (1) {
6547
+ switch (_context6.prev = _context6.next) {
6548
+ case 0:
6549
+ this.verifySegmentId();
6550
+ return _context6.abrupt("return", this.client.deleteSegment(this.id));
6551
+
6552
+ case 2:
6553
+ case "end":
6554
+ return _context6.stop();
6555
+ }
6556
+ }
6557
+ }, _callee6, this);
6558
+ }));
6559
+
6560
+ function _delete() {
6561
+ return _delete2.apply(this, arguments);
6562
+ }
6563
+
6564
+ return _delete;
6565
+ }()
6566
+ }, {
6567
+ key: "targetExists",
6568
+ value: function () {
6569
+ var _targetExists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(targetId) {
6570
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
6571
+ while (1) {
6572
+ switch (_context7.prev = _context7.next) {
6573
+ case 0:
6574
+ this.verifySegmentId();
6575
+ return _context7.abrupt("return", this.client.segmentTargetExists(this.id, targetId));
6576
+
6577
+ case 2:
6578
+ case "end":
6579
+ return _context7.stop();
6580
+ }
6581
+ }
6582
+ }, _callee7, this);
6583
+ }));
6584
+
6585
+ function targetExists(_x4) {
6586
+ return _targetExists.apply(this, arguments);
6587
+ }
6588
+
6589
+ return targetExists;
6590
+ }()
6591
+ }, {
6592
+ key: "queryTargets",
6593
+ value: function () {
6594
+ var _queryTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
6595
+ var filter,
6596
+ sort,
6597
+ options,
6598
+ _args8 = arguments;
6599
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
6600
+ while (1) {
6601
+ switch (_context8.prev = _context8.next) {
6602
+ case 0:
6603
+ filter = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
6604
+ sort = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : [];
6605
+ options = _args8.length > 2 && _args8[2] !== undefined ? _args8[2] : {};
6606
+ this.verifySegmentId();
6607
+ return _context8.abrupt("return", this.client.querySegmentTargets(this.id, filter, sort, options));
6608
+
6609
+ case 5:
6610
+ case "end":
6611
+ return _context8.stop();
6612
+ }
6613
+ }
6614
+ }, _callee8, this);
6615
+ }));
6616
+
6617
+ function queryTargets() {
6618
+ return _queryTargets.apply(this, arguments);
6619
+ }
6620
+
6621
+ return queryTargets;
6622
+ }()
6623
+ }]);
6624
+
6625
+ return Segment;
6626
+ }();
6627
+
6628
+ 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); }; }
6629
+
6630
+ 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; } }
6631
+
6632
+ /**
6633
+ * Utility Types
6634
+ */
6635
+
6636
+ /* Unknown Record */
6637
+ //alias to avoid breaking change
6638
+
6639
+ /**
6640
+ * Response Types
6641
+ */
6642
+ // TODO: Figure out a way to strongly type set and unset.
6643
+ // Thumb URL(thumb_url) is added considering video attachments as the backend will return the thumbnail in the response.
6644
+
6645
+ /**
6646
+ * Option Types
6647
+ */
6648
+ // TODO: rename to UpdateChannelOptions in the next major update and use it in channel._update and/or channel.update
6649
+
6650
+ /** @deprecated use MarkChannelsReadOptions instead */
6651
+ // TODO: rename to UpdateChannelTypeOptions in the next major update
6652
+
6653
+ /**
6654
+ * Event Types
6655
+ */
6656
+
6657
+ /**
6658
+ * Filter Types
6659
+ */
6660
+
6661
+ /**
6662
+ * Sort Types
6663
+ */
6664
+
6665
+ /**
6666
+ * Base Types
6667
+ */
6668
+
6669
+ /*
6670
+ DeleteUserOptions specifies a collection of one or more `user_ids` to be deleted.
6671
+
6672
+ `user`:
6673
+ - soft: marks user as deleted and retains all user data
6674
+ - pruning: marks user as deleted and nullifies user information
6675
+ - hard: deletes user completely - this requires hard option for messages and conversation as well
6676
+ `conversations`:
6677
+ - soft: marks all conversation channels as deleted (same effect as Delete Channels with 'hard' option disabled)
6678
+ - hard: deletes channel and all its data completely including messages (same effect as Delete Channels with 'hard' option enabled)
6679
+ `messages`:
6680
+ - soft: marks all user messages as deleted without removing any related message data
6681
+ - pruning: marks all user messages as deleted, nullifies message information and removes some message data such as reactions and flags
6682
+ - hard: deletes messages completely with all related information
6683
+ `new_channel_owner_id`: any channels owned by the hard-deleted user will be transferred to this user ID
6684
+ */
6685
+ // TODO: add better typing
6686
+ var ErrorFromResponse = /*#__PURE__*/function (_Error) {
6687
+ _inherits(ErrorFromResponse, _Error);
6688
+
6689
+ var _super = _createSuper(ErrorFromResponse);
6690
+
6691
+ function ErrorFromResponse() {
6692
+ var _this;
6693
+
6694
+ _classCallCheck(this, ErrorFromResponse);
6695
+
6696
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
6697
+ args[_key] = arguments[_key];
6698
+ }
6699
+
6700
+ _this = _super.call.apply(_super, [this].concat(args));
6701
+
6702
+ _defineProperty(_assertThisInitialized(_this), "code", void 0);
6703
+
6704
+ _defineProperty(_assertThisInitialized(_this), "response", void 0);
6705
+
6706
+ _defineProperty(_assertThisInitialized(_this), "status", void 0);
6707
+
6708
+ return _this;
6709
+ }
6710
+
6711
+ return ErrorFromResponse;
6712
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
6713
+
6714
+ function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
6715
+
6716
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6717
+
6718
+ function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
6719
+
6720
+ function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
6721
+
6722
+ function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
6723
+ var Thread = /*#__PURE__*/function () {
6724
+ function Thread(client, t) {
6725
+ _classCallCheck(this, Thread);
6726
+
6727
+ _defineProperty(this, "id", void 0);
6728
+
6729
+ _defineProperty(this, "latestReplies", []);
6730
+
6731
+ _defineProperty(this, "participants", []);
6732
+
6733
+ _defineProperty(this, "message", void 0);
6734
+
6735
+ _defineProperty(this, "channel", void 0);
6736
+
6737
+ _defineProperty(this, "_channel", void 0);
6738
+
6739
+ _defineProperty(this, "replyCount", 0);
6740
+
6741
+ _defineProperty(this, "_client", void 0);
6742
+
6743
+ _defineProperty(this, "read", {});
6744
+
6745
+ this.id = t.parent_message.id;
6746
+ this.message = formatMessage(t.parent_message);
6747
+ this.latestReplies = t.latest_replies.map(formatMessage);
6198
6748
  this.participants = t.thread_participants;
6199
6749
  this.replyCount = t.reply_count;
6200
6750
  this.channel = t.channel;
@@ -10592,7 +11142,7 @@ var StreamChat = /*#__PURE__*/function () {
10592
11142
  }, {
10593
11143
  key: "getUserAgent",
10594
11144
  value: function getUserAgent() {
10595
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.16.0");
11145
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.18.0");
10596
11146
  }
10597
11147
  }, {
10598
11148
  key: "setUserAgent",
@@ -10889,6 +11439,31 @@ var StreamChat = /*#__PURE__*/function () {
10889
11439
  value: function getExportChannelStatus(id) {
10890
11440
  return this.get("".concat(this.baseURL, "/export_channels/").concat(id));
10891
11441
  }
11442
+ }, {
11443
+ key: "campaign",
11444
+ value: function campaign(idOrData, data) {
11445
+ if (typeof idOrData === 'string') {
11446
+ return new Campaign(this, idOrData, data);
11447
+ }
11448
+
11449
+ return new Campaign(this, null, idOrData);
11450
+ }
11451
+ }, {
11452
+ key: "segment",
11453
+ value: function segment(type, idOrData, data) {
11454
+ if (typeof idOrData === 'string') {
11455
+ return new Segment(this, type, idOrData, data);
11456
+ }
11457
+
11458
+ return new Segment(this, type, null, idOrData);
11459
+ }
11460
+ }, {
11461
+ key: "validateServerSideAuth",
11462
+ value: function validateServerSideAuth() {
11463
+ if (!this.secret) {
11464
+ throw new Error('Campaigns is a server-side only feature. Please initialize the client with a secret to use this feature.');
11465
+ }
11466
+ }
10892
11467
  /**
10893
11468
  * createSegment - Creates a segment
10894
11469
  *
@@ -10898,34 +11473,28 @@ var StreamChat = /*#__PURE__*/function () {
10898
11473
  * @param {string} name Segment name (valid UUID)
10899
11474
  * @param {SegmentData} params Segment data
10900
11475
  *
10901
- * @return {Segment} The created Segment
11476
+ * @return {{segment: SegmentResponse} & APIResponse} The created Segment
10902
11477
  */
10903
11478
 
10904
11479
  }, {
10905
11480
  key: "createSegment",
10906
11481
  value: function () {
10907
11482
  var _createSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee63(type, id, name, data) {
10908
- var body, _yield$this$post, segment;
10909
-
11483
+ var body;
10910
11484
  return _regeneratorRuntime.wrap(function _callee63$(_context63) {
10911
11485
  while (1) {
10912
11486
  switch (_context63.prev = _context63.next) {
10913
11487
  case 0:
11488
+ this.validateServerSideAuth();
10914
11489
  body = {
10915
11490
  id: id,
10916
11491
  type: type,
10917
11492
  name: name,
10918
11493
  data: data
10919
11494
  };
10920
- _context63.next = 3;
10921
- return this.post(this.baseURL + "/segments", body);
11495
+ return _context63.abrupt("return", this.post(this.baseURL + "/segments", body));
10922
11496
 
10923
11497
  case 3:
10924
- _yield$this$post = _context63.sent;
10925
- segment = _yield$this$post.segment;
10926
- return _context63.abrupt("return", segment);
10927
-
10928
- case 6:
10929
11498
  case "end":
10930
11499
  return _context63.stop();
10931
11500
  }
@@ -10957,13 +11526,10 @@ var StreamChat = /*#__PURE__*/function () {
10957
11526
  while (1) {
10958
11527
  switch (_context64.prev = _context64.next) {
10959
11528
  case 0:
10960
- _context64.next = 2;
10961
- return this.createSegment('user', id, name, data);
11529
+ this.validateServerSideAuth();
11530
+ return _context64.abrupt("return", this.createSegment('user', id, name, data));
10962
11531
 
10963
11532
  case 2:
10964
- return _context64.abrupt("return", _context64.sent);
10965
-
10966
- case 3:
10967
11533
  case "end":
10968
11534
  return _context64.stop();
10969
11535
  }
@@ -10995,13 +11561,10 @@ var StreamChat = /*#__PURE__*/function () {
10995
11561
  while (1) {
10996
11562
  switch (_context65.prev = _context65.next) {
10997
11563
  case 0:
10998
- _context65.next = 2;
10999
- return this.createSegment('channel', id, name, data);
11564
+ this.validateServerSideAuth();
11565
+ return _context65.abrupt("return", this.createSegment('channel', id, name, data));
11000
11566
 
11001
11567
  case 2:
11002
- return _context65.abrupt("return", _context65.sent);
11003
-
11004
- case 3:
11005
11568
  case "end":
11006
11569
  return _context65.stop();
11007
11570
  }
@@ -11015,34 +11578,18 @@ var StreamChat = /*#__PURE__*/function () {
11015
11578
 
11016
11579
  return createChannelSegment;
11017
11580
  }()
11018
- /**
11019
- * updateSegment - Update a segment
11020
- *
11021
- * @param {string} id Segment ID
11022
- * @param {Partial<UpdateSegmentData>} data Data to update
11023
- *
11024
- * @return {Segment} Updated Segment
11025
- */
11026
-
11027
11581
  }, {
11028
- key: "updateSegment",
11582
+ key: "getSegment",
11029
11583
  value: function () {
11030
- var _updateSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66(id, data) {
11031
- var _yield$this$put, segment;
11032
-
11584
+ var _getSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66(id) {
11033
11585
  return _regeneratorRuntime.wrap(function _callee66$(_context66) {
11034
11586
  while (1) {
11035
11587
  switch (_context66.prev = _context66.next) {
11036
11588
  case 0:
11037
- _context66.next = 2;
11038
- return this.put(this.baseURL + "/segments/".concat(id), data);
11589
+ this.validateServerSideAuth();
11590
+ return _context66.abrupt("return", this.get(this.baseURL + "/segments/".concat(id)));
11039
11591
 
11040
11592
  case 2:
11041
- _yield$this$put = _context66.sent;
11042
- segment = _yield$this$put.segment;
11043
- return _context66.abrupt("return", segment);
11044
-
11045
- case 5:
11046
11593
  case "end":
11047
11594
  return _context66.stop();
11048
11595
  }
@@ -11050,40 +11597,33 @@ var StreamChat = /*#__PURE__*/function () {
11050
11597
  }, _callee66, this);
11051
11598
  }));
11052
11599
 
11053
- function updateSegment(_x94, _x95) {
11054
- return _updateSegment.apply(this, arguments);
11600
+ function getSegment(_x94) {
11601
+ return _getSegment.apply(this, arguments);
11055
11602
  }
11056
11603
 
11057
- return updateSegment;
11604
+ return getSegment;
11058
11605
  }()
11059
11606
  /**
11060
- * addSegmentTargets - Add targets to a segment
11607
+ * updateSegment - Update a segment
11061
11608
  *
11062
11609
  * @param {string} id Segment ID
11063
- * @param {string[]} targets Targets to add to the segment
11610
+ * @param {Partial<UpdateSegmentData>} data Data to update
11064
11611
  *
11065
- * @return {APIResponse} API response
11612
+ * @return {Segment} Updated Segment
11066
11613
  */
11067
11614
 
11068
11615
  }, {
11069
- key: "addSegmentTargets",
11616
+ key: "updateSegment",
11070
11617
  value: function () {
11071
- var _addSegmentTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee67(id, targets) {
11072
- var body;
11618
+ var _updateSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee67(id, data) {
11073
11619
  return _regeneratorRuntime.wrap(function _callee67$(_context67) {
11074
11620
  while (1) {
11075
11621
  switch (_context67.prev = _context67.next) {
11076
11622
  case 0:
11077
- body = {
11078
- targets: targets
11079
- };
11080
- _context67.next = 3;
11081
- return this.post(this.baseURL + "/segments/".concat(id, "/addtargets"), body);
11623
+ this.validateServerSideAuth();
11624
+ return _context67.abrupt("return", this.put(this.baseURL + "/segments/".concat(id), data));
11082
11625
 
11083
- case 3:
11084
- return _context67.abrupt("return", _context67.sent);
11085
-
11086
- case 4:
11626
+ case 2:
11087
11627
  case "end":
11088
11628
  return _context67.stop();
11089
11629
  }
@@ -11091,14 +11631,14 @@ var StreamChat = /*#__PURE__*/function () {
11091
11631
  }, _callee67, this);
11092
11632
  }));
11093
11633
 
11094
- function addSegmentTargets(_x96, _x97) {
11095
- return _addSegmentTargets.apply(this, arguments);
11634
+ function updateSegment(_x95, _x96) {
11635
+ return _updateSegment.apply(this, arguments);
11096
11636
  }
11097
11637
 
11098
- return addSegmentTargets;
11638
+ return updateSegment;
11099
11639
  }()
11100
11640
  /**
11101
- * deleteSegmentTargets - Delete targets from a segment
11641
+ * addSegmentTargets - Add targets to a segment
11102
11642
  *
11103
11643
  * @param {string} id Segment ID
11104
11644
  * @param {string[]} targets Targets to add to the segment
@@ -11107,24 +11647,21 @@ var StreamChat = /*#__PURE__*/function () {
11107
11647
  */
11108
11648
 
11109
11649
  }, {
11110
- key: "deleteSegmentTargets",
11650
+ key: "addSegmentTargets",
11111
11651
  value: function () {
11112
- var _deleteSegmentTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee68(id, targets) {
11652
+ var _addSegmentTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee68(id, targets) {
11113
11653
  var body;
11114
11654
  return _regeneratorRuntime.wrap(function _callee68$(_context68) {
11115
11655
  while (1) {
11116
11656
  switch (_context68.prev = _context68.next) {
11117
11657
  case 0:
11658
+ this.validateServerSideAuth();
11118
11659
  body = {
11119
- targets: targets
11660
+ target_ids: targets
11120
11661
  };
11121
- _context68.next = 3;
11122
- return this.post(this.baseURL + "/segments/".concat(id, "/deletetargets"), body);
11662
+ return _context68.abrupt("return", this.post(this.baseURL + "/segments/".concat(id, "/addtargets"), body));
11123
11663
 
11124
11664
  case 3:
11125
- return _context68.abrupt("return", _context68.sent);
11126
-
11127
- case 4:
11128
11665
  case "end":
11129
11666
  return _context68.stop();
11130
11667
  }
@@ -11132,43 +11669,34 @@ var StreamChat = /*#__PURE__*/function () {
11132
11669
  }, _callee68, this);
11133
11670
  }));
11134
11671
 
11135
- function deleteSegmentTargets(_x98, _x99) {
11136
- return _deleteSegmentTargets.apply(this, arguments);
11672
+ function addSegmentTargets(_x97, _x98) {
11673
+ return _addSegmentTargets.apply(this, arguments);
11137
11674
  }
11138
11675
 
11139
- return deleteSegmentTargets;
11676
+ return addSegmentTargets;
11140
11677
  }()
11141
- /**
11142
- * querySegments - Query Segments
11143
- *
11144
- * @param {filter} filter MongoDB style filter conditions
11145
- * @param {QuerySegmentsOptions} options Options for sorting/paginating the results
11146
- *
11147
- * @return {Segment[]} Segments
11148
- */
11149
-
11150
11678
  }, {
11151
- key: "querySegments",
11679
+ key: "querySegmentTargets",
11152
11680
  value: function () {
11153
- var _querySegments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee69(filter) {
11154
- var options,
11681
+ var _querySegmentTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee69(id) {
11682
+ var filter,
11683
+ sort,
11684
+ options,
11155
11685
  _args69 = arguments;
11156
11686
  return _regeneratorRuntime.wrap(function _callee69$(_context69) {
11157
11687
  while (1) {
11158
11688
  switch (_context69.prev = _context69.next) {
11159
11689
  case 0:
11160
- options = _args69.length > 1 && _args69[1] !== undefined ? _args69[1] : {};
11161
- _context69.next = 3;
11162
- return this.get(this.baseURL + "/segments", {
11163
- payload: _objectSpread({
11164
- filter: filter
11165
- }, options)
11166
- });
11690
+ filter = _args69.length > 1 && _args69[1] !== undefined ? _args69[1] : {};
11691
+ sort = _args69.length > 2 && _args69[2] !== undefined ? _args69[2] : [];
11692
+ options = _args69.length > 3 && _args69[3] !== undefined ? _args69[3] : {};
11693
+ this.validateServerSideAuth();
11694
+ return _context69.abrupt("return", this.post(this.baseURL + "/segments/".concat(id, "/targets/query"), _objectSpread({
11695
+ filter: filter || {},
11696
+ sort: sort || []
11697
+ }, options)));
11167
11698
 
11168
- case 3:
11169
- return _context69.abrupt("return", _context69.sent);
11170
-
11171
- case 4:
11699
+ case 5:
11172
11700
  case "end":
11173
11701
  return _context69.stop();
11174
11702
  }
@@ -11176,33 +11704,35 @@ var StreamChat = /*#__PURE__*/function () {
11176
11704
  }, _callee69, this);
11177
11705
  }));
11178
11706
 
11179
- function querySegments(_x100) {
11180
- return _querySegments.apply(this, arguments);
11707
+ function querySegmentTargets(_x99) {
11708
+ return _querySegmentTargets.apply(this, arguments);
11181
11709
  }
11182
11710
 
11183
- return querySegments;
11711
+ return querySegmentTargets;
11184
11712
  }()
11185
11713
  /**
11186
- * deleteSegment - Delete a Campaign Segment
11714
+ * removeSegmentTargets - Remove targets from a segment
11187
11715
  *
11188
11716
  * @param {string} id Segment ID
11717
+ * @param {string[]} targets Targets to add to the segment
11189
11718
  *
11190
- * @return {Promise<APIResponse>} The Server Response
11719
+ * @return {APIResponse} API response
11191
11720
  */
11192
11721
 
11193
11722
  }, {
11194
- key: "deleteSegment",
11723
+ key: "removeSegmentTargets",
11195
11724
  value: function () {
11196
- var _deleteSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee70(id) {
11725
+ var _removeSegmentTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee70(id, targets) {
11726
+ var body;
11197
11727
  return _regeneratorRuntime.wrap(function _callee70$(_context70) {
11198
11728
  while (1) {
11199
11729
  switch (_context70.prev = _context70.next) {
11200
11730
  case 0:
11201
- _context70.next = 2;
11202
- return this.delete(this.baseURL + "/segments/".concat(id));
11203
-
11204
- case 2:
11205
- return _context70.abrupt("return", _context70.sent);
11731
+ this.validateServerSideAuth();
11732
+ body = {
11733
+ target_ids: targets
11734
+ };
11735
+ return _context70.abrupt("return", this.post(this.baseURL + "/segments/".concat(id, "/deletetargets"), body));
11206
11736
 
11207
11737
  case 3:
11208
11738
  case "end":
@@ -11212,34 +11742,37 @@ var StreamChat = /*#__PURE__*/function () {
11212
11742
  }, _callee70, this);
11213
11743
  }));
11214
11744
 
11215
- function deleteSegment(_x101) {
11216
- return _deleteSegment.apply(this, arguments);
11745
+ function removeSegmentTargets(_x100, _x101) {
11746
+ return _removeSegmentTargets.apply(this, arguments);
11217
11747
  }
11218
11748
 
11219
- return deleteSegment;
11749
+ return removeSegmentTargets;
11220
11750
  }()
11221
11751
  /**
11222
- * segmentTargetExists - Check if a target exists in a segment
11752
+ * querySegments - Query Segments
11223
11753
  *
11224
- * @param {string} segmentId Segment ID
11225
- * @param {string} targetId Target ID
11754
+ * @param {filter} filter MongoDB style filter conditions
11755
+ * @param {QuerySegmentsOptions} options Options for sorting/paginating the results
11226
11756
  *
11227
- * @return {Promise<APIResponse>} The Server Response
11757
+ * @return {Segment[]} Segments
11228
11758
  */
11229
11759
 
11230
11760
  }, {
11231
- key: "segmentTargetExists",
11761
+ key: "querySegments",
11232
11762
  value: function () {
11233
- var _segmentTargetExists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee71(segmentId, targetId) {
11763
+ var _querySegments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee71(filter, sort) {
11764
+ var options,
11765
+ _args71 = arguments;
11234
11766
  return _regeneratorRuntime.wrap(function _callee71$(_context71) {
11235
11767
  while (1) {
11236
11768
  switch (_context71.prev = _context71.next) {
11237
11769
  case 0:
11238
- _context71.next = 2;
11239
- return this.get(this.baseURL + "/segments/".concat(segmentId, "/target/").concat(targetId));
11240
-
11241
- case 2:
11242
- return _context71.abrupt("return", _context71.sent);
11770
+ options = _args71.length > 2 && _args71[2] !== undefined ? _args71[2] : {};
11771
+ this.validateServerSideAuth();
11772
+ return _context71.abrupt("return", this.post(this.baseURL + "/segments/query", _objectSpread({
11773
+ filter: filter,
11774
+ sort: sort
11775
+ }, options)));
11243
11776
 
11244
11777
  case 3:
11245
11778
  case "end":
@@ -11249,41 +11782,32 @@ var StreamChat = /*#__PURE__*/function () {
11249
11782
  }, _callee71, this);
11250
11783
  }));
11251
11784
 
11252
- function segmentTargetExists(_x102, _x103) {
11253
- return _segmentTargetExists.apply(this, arguments);
11785
+ function querySegments(_x102, _x103) {
11786
+ return _querySegments.apply(this, arguments);
11254
11787
  }
11255
11788
 
11256
- return segmentTargetExists;
11789
+ return querySegments;
11257
11790
  }()
11258
11791
  /**
11259
- * createCampaign - Creates a Campaign
11792
+ * deleteSegment - Delete a Campaign Segment
11260
11793
  *
11261
- * @param {CampaignData} params Campaign data
11794
+ * @param {string} id Segment ID
11262
11795
  *
11263
- * @return {Campaign} The Created Campaign
11796
+ * @return {Promise<APIResponse>} The Server Response
11264
11797
  */
11265
11798
 
11266
11799
  }, {
11267
- key: "createCampaign",
11800
+ key: "deleteSegment",
11268
11801
  value: function () {
11269
- var _createCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee72(params) {
11270
- var _yield$this$post2, campaign;
11271
-
11802
+ var _deleteSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee72(id) {
11272
11803
  return _regeneratorRuntime.wrap(function _callee72$(_context72) {
11273
11804
  while (1) {
11274
11805
  switch (_context72.prev = _context72.next) {
11275
11806
  case 0:
11276
- _context72.next = 2;
11277
- return this.post(this.baseURL + "/campaigns", {
11278
- campaign: params
11279
- });
11807
+ this.validateServerSideAuth();
11808
+ return _context72.abrupt("return", this.delete(this.baseURL + "/segments/".concat(id)));
11280
11809
 
11281
11810
  case 2:
11282
- _yield$this$post2 = _context72.sent;
11283
- campaign = _yield$this$post2.campaign;
11284
- return _context72.abrupt("return", campaign);
11285
-
11286
- case 5:
11287
11811
  case "end":
11288
11812
  return _context72.stop();
11289
11813
  }
@@ -11291,41 +11815,33 @@ var StreamChat = /*#__PURE__*/function () {
11291
11815
  }, _callee72, this);
11292
11816
  }));
11293
11817
 
11294
- function createCampaign(_x104) {
11295
- return _createCampaign.apply(this, arguments);
11818
+ function deleteSegment(_x104) {
11819
+ return _deleteSegment.apply(this, arguments);
11296
11820
  }
11297
11821
 
11298
- return createCampaign;
11822
+ return deleteSegment;
11299
11823
  }()
11300
11824
  /**
11301
- * queryCampaigns - Query Campaigns
11825
+ * segmentTargetExists - Check if a target exists in a segment
11302
11826
  *
11827
+ * @param {string} segmentId Segment ID
11828
+ * @param {string} targetId Target ID
11303
11829
  *
11304
- * @return {Campaign[]} Campaigns
11830
+ * @return {Promise<APIResponse>} The Server Response
11305
11831
  */
11306
11832
 
11307
11833
  }, {
11308
- key: "queryCampaigns",
11834
+ key: "segmentTargetExists",
11309
11835
  value: function () {
11310
- var _queryCampaigns = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee73(filters) {
11311
- var options,
11312
- _args73 = arguments;
11836
+ var _segmentTargetExists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee73(segmentId, targetId) {
11313
11837
  return _regeneratorRuntime.wrap(function _callee73$(_context73) {
11314
11838
  while (1) {
11315
11839
  switch (_context73.prev = _context73.next) {
11316
11840
  case 0:
11317
- options = _args73.length > 1 && _args73[1] !== undefined ? _args73[1] : {};
11318
- _context73.next = 3;
11319
- return this.get(this.baseURL + "/campaigns", {
11320
- payload: _objectSpread({
11321
- filter_conditions: filters
11322
- }, options)
11323
- });
11324
-
11325
- case 3:
11326
- return _context73.abrupt("return", _context73.sent);
11841
+ this.validateServerSideAuth();
11842
+ return _context73.abrupt("return", this.get(this.baseURL + "/segments/".concat(segmentId, "/target/").concat(targetId)));
11327
11843
 
11328
- case 4:
11844
+ case 2:
11329
11845
  case "end":
11330
11846
  return _context73.stop();
11331
11847
  }
@@ -11333,42 +11849,32 @@ var StreamChat = /*#__PURE__*/function () {
11333
11849
  }, _callee73, this);
11334
11850
  }));
11335
11851
 
11336
- function queryCampaigns(_x105) {
11337
- return _queryCampaigns.apply(this, arguments);
11852
+ function segmentTargetExists(_x105, _x106) {
11853
+ return _segmentTargetExists.apply(this, arguments);
11338
11854
  }
11339
11855
 
11340
- return queryCampaigns;
11856
+ return segmentTargetExists;
11341
11857
  }()
11342
11858
  /**
11343
- * updateCampaign - Update a Campaign
11859
+ * createCampaign - Creates a Campaign
11344
11860
  *
11345
- * @param {string} id Campaign ID
11346
- * @param {Partial<CampaignData>} params Campaign data
11861
+ * @param {CampaignData} params Campaign data
11347
11862
  *
11348
- * @return {Campaign} Updated Campaign
11863
+ * @return {Campaign} The Created Campaign
11349
11864
  */
11350
11865
 
11351
11866
  }, {
11352
- key: "updateCampaign",
11867
+ key: "createCampaign",
11353
11868
  value: function () {
11354
- var _updateCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee74(id, params) {
11355
- var _yield$this$put2, campaign;
11356
-
11869
+ var _createCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee74(params) {
11357
11870
  return _regeneratorRuntime.wrap(function _callee74$(_context74) {
11358
11871
  while (1) {
11359
11872
  switch (_context74.prev = _context74.next) {
11360
11873
  case 0:
11361
- _context74.next = 2;
11362
- return this.put(this.baseURL + "/campaigns/".concat(id), {
11363
- campaign: params
11364
- });
11874
+ this.validateServerSideAuth();
11875
+ return _context74.abrupt("return", this.post(this.baseURL + "/campaigns", _objectSpread({}, params)));
11365
11876
 
11366
11877
  case 2:
11367
- _yield$this$put2 = _context74.sent;
11368
- campaign = _yield$this$put2.campaign;
11369
- return _context74.abrupt("return", campaign);
11370
-
11371
- case 5:
11372
11878
  case "end":
11373
11879
  return _context74.stop();
11374
11880
  }
@@ -11376,32 +11882,22 @@ var StreamChat = /*#__PURE__*/function () {
11376
11882
  }, _callee74, this);
11377
11883
  }));
11378
11884
 
11379
- function updateCampaign(_x106, _x107) {
11380
- return _updateCampaign.apply(this, arguments);
11885
+ function createCampaign(_x107) {
11886
+ return _createCampaign.apply(this, arguments);
11381
11887
  }
11382
11888
 
11383
- return updateCampaign;
11889
+ return createCampaign;
11384
11890
  }()
11385
- /**
11386
- * deleteCampaign - Delete a Campaign
11387
- *
11388
- * @param {string} id Campaign ID
11389
- *
11390
- * @return {Promise<APIResponse>} The Server Response
11391
- */
11392
-
11393
11891
  }, {
11394
- key: "deleteCampaign",
11892
+ key: "getCampaign",
11395
11893
  value: function () {
11396
- var _deleteCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee75(id) {
11397
- var params,
11398
- _args75 = arguments;
11894
+ var _getCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee75(id) {
11399
11895
  return _regeneratorRuntime.wrap(function _callee75$(_context75) {
11400
11896
  while (1) {
11401
11897
  switch (_context75.prev = _context75.next) {
11402
11898
  case 0:
11403
- params = _args75.length > 1 && _args75[1] !== undefined ? _args75[1] : {};
11404
- return _context75.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id), params));
11899
+ this.validateServerSideAuth();
11900
+ return _context75.abrupt("return", this.get(this.baseURL + "/campaigns/".concat(id)));
11405
11901
 
11406
11902
  case 2:
11407
11903
  case "end":
@@ -11411,43 +11907,26 @@ var StreamChat = /*#__PURE__*/function () {
11411
11907
  }, _callee75, this);
11412
11908
  }));
11413
11909
 
11414
- function deleteCampaign(_x108) {
11415
- return _deleteCampaign.apply(this, arguments);
11910
+ function getCampaign(_x108) {
11911
+ return _getCampaign.apply(this, arguments);
11416
11912
  }
11417
11913
 
11418
- return deleteCampaign;
11914
+ return getCampaign;
11419
11915
  }()
11420
- /**
11421
- * scheduleCampaign - Schedule a Campaign
11422
- *
11423
- * @param {string} id Campaign ID
11424
- * @param {{scheduledFor: number}} params Schedule params
11425
- *
11426
- * @return {Campaign} Scheduled Campaign
11427
- */
11428
-
11429
11916
  }, {
11430
- key: "scheduleCampaign",
11917
+ key: "startCampaign",
11431
11918
  value: function () {
11432
- var _scheduleCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee76(id, params) {
11433
- var scheduledFor, _yield$this$patch, campaign;
11434
-
11919
+ var _startCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee76(id, scheduledFor) {
11435
11920
  return _regeneratorRuntime.wrap(function _callee76$(_context76) {
11436
11921
  while (1) {
11437
11922
  switch (_context76.prev = _context76.next) {
11438
11923
  case 0:
11439
- scheduledFor = params.scheduledFor;
11440
- _context76.next = 3;
11441
- return this.patch(this.baseURL + "/campaigns/".concat(id, "/schedule"), {
11924
+ this.validateServerSideAuth();
11925
+ return _context76.abrupt("return", this.post(this.baseURL + "/campaigns/".concat(id, "/start"), {
11442
11926
  scheduled_for: scheduledFor
11443
- });
11444
-
11445
- case 3:
11446
- _yield$this$patch = _context76.sent;
11447
- campaign = _yield$this$patch.campaign;
11448
- return _context76.abrupt("return", campaign);
11927
+ }));
11449
11928
 
11450
- case 6:
11929
+ case 2:
11451
11930
  case "end":
11452
11931
  return _context76.stop();
11453
11932
  }
@@ -11455,39 +11934,38 @@ var StreamChat = /*#__PURE__*/function () {
11455
11934
  }, _callee76, this);
11456
11935
  }));
11457
11936
 
11458
- function scheduleCampaign(_x109, _x110) {
11459
- return _scheduleCampaign.apply(this, arguments);
11937
+ function startCampaign(_x109, _x110) {
11938
+ return _startCampaign.apply(this, arguments);
11460
11939
  }
11461
11940
 
11462
- return scheduleCampaign;
11941
+ return startCampaign;
11463
11942
  }()
11464
11943
  /**
11465
- * stopCampaign - Stop a Campaign
11944
+ * queryCampaigns - Query Campaigns
11466
11945
  *
11467
- * @param {string} id Campaign ID
11468
11946
  *
11469
- * @return {Campaign} Stopped Campaign
11947
+ * @return {Campaign[]} Campaigns
11470
11948
  */
11471
11949
 
11472
11950
  }, {
11473
- key: "stopCampaign",
11951
+ key: "queryCampaigns",
11474
11952
  value: function () {
11475
- var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee77(id) {
11476
- var _yield$this$patch2, campaign;
11477
-
11953
+ var _queryCampaigns = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee77(filter, sort, options) {
11478
11954
  return _regeneratorRuntime.wrap(function _callee77$(_context77) {
11479
11955
  while (1) {
11480
11956
  switch (_context77.prev = _context77.next) {
11481
11957
  case 0:
11482
- _context77.next = 2;
11483
- return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
11958
+ this.validateServerSideAuth();
11959
+ _context77.next = 3;
11960
+ return this.post(this.baseURL + "/campaigns/query", _objectSpread({
11961
+ filter: filter,
11962
+ sort: sort
11963
+ }, options || {}));
11484
11964
 
11485
- case 2:
11486
- _yield$this$patch2 = _context77.sent;
11487
- campaign = _yield$this$patch2.campaign;
11488
- return _context77.abrupt("return", campaign);
11965
+ case 3:
11966
+ return _context77.abrupt("return", _context77.sent);
11489
11967
 
11490
- case 5:
11968
+ case 4:
11491
11969
  case "end":
11492
11970
  return _context77.stop();
11493
11971
  }
@@ -11495,39 +11973,33 @@ var StreamChat = /*#__PURE__*/function () {
11495
11973
  }, _callee77, this);
11496
11974
  }));
11497
11975
 
11498
- function stopCampaign(_x111) {
11499
- return _stopCampaign.apply(this, arguments);
11976
+ function queryCampaigns(_x111, _x112, _x113) {
11977
+ return _queryCampaigns.apply(this, arguments);
11500
11978
  }
11501
11979
 
11502
- return stopCampaign;
11980
+ return queryCampaigns;
11503
11981
  }()
11504
11982
  /**
11505
- * resumeCampaign - Resume a Campaign
11983
+ * updateCampaign - Update a Campaign
11506
11984
  *
11507
11985
  * @param {string} id Campaign ID
11986
+ * @param {Partial<CampaignData>} params Campaign data
11508
11987
  *
11509
- * @return {Campaign} Resumed Campaign
11988
+ * @return {Campaign} Updated Campaign
11510
11989
  */
11511
11990
 
11512
11991
  }, {
11513
- key: "resumeCampaign",
11992
+ key: "updateCampaign",
11514
11993
  value: function () {
11515
- var _resumeCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee78(id) {
11516
- var _yield$this$patch3, campaign;
11517
-
11994
+ var _updateCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee78(id, params) {
11518
11995
  return _regeneratorRuntime.wrap(function _callee78$(_context78) {
11519
11996
  while (1) {
11520
11997
  switch (_context78.prev = _context78.next) {
11521
11998
  case 0:
11522
- _context78.next = 2;
11523
- return this.patch(this.baseURL + "/campaigns/".concat(id, "/resume"));
11999
+ this.validateServerSideAuth();
12000
+ return _context78.abrupt("return", this.put(this.baseURL + "/campaigns/".concat(id), params));
11524
12001
 
11525
12002
  case 2:
11526
- _yield$this$patch3 = _context78.sent;
11527
- campaign = _yield$this$patch3.campaign;
11528
- return _context78.abrupt("return", campaign);
11529
-
11530
- case 5:
11531
12003
  case "end":
11532
12004
  return _context78.stop();
11533
12005
  }
@@ -11535,40 +12007,32 @@ var StreamChat = /*#__PURE__*/function () {
11535
12007
  }, _callee78, this);
11536
12008
  }));
11537
12009
 
11538
- function resumeCampaign(_x112) {
11539
- return _resumeCampaign.apply(this, arguments);
12010
+ function updateCampaign(_x114, _x115) {
12011
+ return _updateCampaign.apply(this, arguments);
11540
12012
  }
11541
12013
 
11542
- return resumeCampaign;
12014
+ return updateCampaign;
11543
12015
  }()
11544
12016
  /**
11545
- * testCampaign - Test a Campaign
12017
+ * deleteCampaign - Delete a Campaign
11546
12018
  *
11547
12019
  * @param {string} id Campaign ID
11548
- * @param {{users: string[]}} params Test params
11549
12020
  *
11550
- * @return {TestCampaignResponse} Test campaign response
12021
+ * @return {Promise<APIResponse>} The Server Response
11551
12022
  */
11552
12023
 
11553
12024
  }, {
11554
- key: "testCampaign",
12025
+ key: "deleteCampaign",
11555
12026
  value: function () {
11556
- var _testCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee79(id, params) {
11557
- var users;
12027
+ var _deleteCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee79(id) {
11558
12028
  return _regeneratorRuntime.wrap(function _callee79$(_context79) {
11559
12029
  while (1) {
11560
12030
  switch (_context79.prev = _context79.next) {
11561
12031
  case 0:
11562
- users = params.users;
11563
- _context79.next = 3;
11564
- return this.post(this.baseURL + "/campaigns/".concat(id, "/test"), {
11565
- users: users
11566
- });
12032
+ this.validateServerSideAuth();
12033
+ return _context79.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id)));
11567
12034
 
11568
- case 3:
11569
- return _context79.abrupt("return", _context79.sent);
11570
-
11571
- case 4:
12035
+ case 2:
11572
12036
  case "end":
11573
12037
  return _context79.stop();
11574
12038
  }
@@ -11576,11 +12040,52 @@ var StreamChat = /*#__PURE__*/function () {
11576
12040
  }, _callee79, this);
11577
12041
  }));
11578
12042
 
11579
- function testCampaign(_x113, _x114) {
11580
- return _testCampaign.apply(this, arguments);
12043
+ function deleteCampaign(_x116) {
12044
+ return _deleteCampaign.apply(this, arguments);
12045
+ }
12046
+
12047
+ return deleteCampaign;
12048
+ }()
12049
+ /**
12050
+ * stopCampaign - Stop a Campaign
12051
+ *
12052
+ * @param {string} id Campaign ID
12053
+ *
12054
+ * @return {Campaign} Stopped Campaign
12055
+ */
12056
+
12057
+ }, {
12058
+ key: "stopCampaign",
12059
+ value: function () {
12060
+ var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee80(id) {
12061
+ var _yield$this$patch, campaign;
12062
+
12063
+ return _regeneratorRuntime.wrap(function _callee80$(_context80) {
12064
+ while (1) {
12065
+ switch (_context80.prev = _context80.next) {
12066
+ case 0:
12067
+ this.validateServerSideAuth();
12068
+ _context80.next = 3;
12069
+ return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
12070
+
12071
+ case 3:
12072
+ _yield$this$patch = _context80.sent;
12073
+ campaign = _yield$this$patch.campaign;
12074
+ return _context80.abrupt("return", campaign);
12075
+
12076
+ case 6:
12077
+ case "end":
12078
+ return _context80.stop();
12079
+ }
12080
+ }
12081
+ }, _callee80, this);
12082
+ }));
12083
+
12084
+ function stopCampaign(_x117) {
12085
+ return _stopCampaign.apply(this, arguments);
11581
12086
  }
11582
12087
 
11583
- return testCampaign;
12088
+ return stopCampaign;
11584
12089
  }()
11585
12090
  /**
11586
12091
  * enrichURL - Get OpenGraph data of the given link
@@ -11592,24 +12097,24 @@ var StreamChat = /*#__PURE__*/function () {
11592
12097
  }, {
11593
12098
  key: "enrichURL",
11594
12099
  value: function () {
11595
- var _enrichURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee80(url) {
11596
- return _regeneratorRuntime.wrap(function _callee80$(_context80) {
12100
+ var _enrichURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee81(url) {
12101
+ return _regeneratorRuntime.wrap(function _callee81$(_context81) {
11597
12102
  while (1) {
11598
- switch (_context80.prev = _context80.next) {
12103
+ switch (_context81.prev = _context81.next) {
11599
12104
  case 0:
11600
- return _context80.abrupt("return", this.get(this.baseURL + "/og", {
12105
+ return _context81.abrupt("return", this.get(this.baseURL + "/og", {
11601
12106
  url: url
11602
12107
  }));
11603
12108
 
11604
12109
  case 1:
11605
12110
  case "end":
11606
- return _context80.stop();
12111
+ return _context81.stop();
11607
12112
  }
11608
12113
  }
11609
- }, _callee80, this);
12114
+ }, _callee81, this);
11610
12115
  }));
11611
12116
 
11612
- function enrichURL(_x115) {
12117
+ function enrichURL(_x118) {
11613
12118
  return _enrichURL.apply(this, arguments);
11614
12119
  }
11615
12120
 
@@ -11626,22 +12131,22 @@ var StreamChat = /*#__PURE__*/function () {
11626
12131
  }, {
11627
12132
  key: "getTask",
11628
12133
  value: function () {
11629
- var _getTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee81(id) {
11630
- return _regeneratorRuntime.wrap(function _callee81$(_context81) {
12134
+ var _getTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee82(id) {
12135
+ return _regeneratorRuntime.wrap(function _callee82$(_context82) {
11631
12136
  while (1) {
11632
- switch (_context81.prev = _context81.next) {
12137
+ switch (_context82.prev = _context82.next) {
11633
12138
  case 0:
11634
- return _context81.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
12139
+ return _context82.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
11635
12140
 
11636
12141
  case 1:
11637
12142
  case "end":
11638
- return _context81.stop();
12143
+ return _context82.stop();
11639
12144
  }
11640
12145
  }
11641
- }, _callee81, this);
12146
+ }, _callee82, this);
11642
12147
  }));
11643
12148
 
11644
- function getTask(_x116) {
12149
+ function getTask(_x119) {
11645
12150
  return _getTask.apply(this, arguments);
11646
12151
  }
11647
12152
 
@@ -11659,31 +12164,31 @@ var StreamChat = /*#__PURE__*/function () {
11659
12164
  }, {
11660
12165
  key: "deleteChannels",
11661
12166
  value: function () {
11662
- var _deleteChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee82(cids) {
12167
+ var _deleteChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee83(cids) {
11663
12168
  var options,
11664
- _args82 = arguments;
11665
- return _regeneratorRuntime.wrap(function _callee82$(_context82) {
12169
+ _args83 = arguments;
12170
+ return _regeneratorRuntime.wrap(function _callee83$(_context83) {
11666
12171
  while (1) {
11667
- switch (_context82.prev = _context82.next) {
12172
+ switch (_context83.prev = _context83.next) {
11668
12173
  case 0:
11669
- options = _args82.length > 1 && _args82[1] !== undefined ? _args82[1] : {};
11670
- _context82.next = 3;
12174
+ options = _args83.length > 1 && _args83[1] !== undefined ? _args83[1] : {};
12175
+ _context83.next = 3;
11671
12176
  return this.post(this.baseURL + "/channels/delete", _objectSpread({
11672
12177
  cids: cids
11673
12178
  }, options));
11674
12179
 
11675
12180
  case 3:
11676
- return _context82.abrupt("return", _context82.sent);
12181
+ return _context83.abrupt("return", _context83.sent);
11677
12182
 
11678
12183
  case 4:
11679
12184
  case "end":
11680
- return _context82.stop();
12185
+ return _context83.stop();
11681
12186
  }
11682
12187
  }
11683
- }, _callee82, this);
12188
+ }, _callee83, this);
11684
12189
  }));
11685
12190
 
11686
- function deleteChannels(_x117) {
12191
+ function deleteChannels(_x120) {
11687
12192
  return _deleteChannels.apply(this, arguments);
11688
12193
  }
11689
12194
 
@@ -11701,17 +12206,17 @@ var StreamChat = /*#__PURE__*/function () {
11701
12206
  }, {
11702
12207
  key: "deleteUsers",
11703
12208
  value: function () {
11704
- var _deleteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee83(user_ids) {
12209
+ var _deleteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee84(user_ids) {
11705
12210
  var options,
11706
- _args83 = arguments;
11707
- return _regeneratorRuntime.wrap(function _callee83$(_context83) {
12211
+ _args84 = arguments;
12212
+ return _regeneratorRuntime.wrap(function _callee84$(_context84) {
11708
12213
  while (1) {
11709
- switch (_context83.prev = _context83.next) {
12214
+ switch (_context84.prev = _context84.next) {
11710
12215
  case 0:
11711
- options = _args83.length > 1 && _args83[1] !== undefined ? _args83[1] : {};
12216
+ options = _args84.length > 1 && _args84[1] !== undefined ? _args84[1] : {};
11712
12217
 
11713
12218
  if (!(typeof options.user !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.user))) {
11714
- _context83.next = 3;
12219
+ _context84.next = 3;
11715
12220
  break;
11716
12221
  }
11717
12222
 
@@ -11719,7 +12224,7 @@ var StreamChat = /*#__PURE__*/function () {
11719
12224
 
11720
12225
  case 3:
11721
12226
  if (!(typeof options.conversations !== 'undefined' && !['soft', 'hard'].includes(options.conversations))) {
11722
- _context83.next = 5;
12227
+ _context84.next = 5;
11723
12228
  break;
11724
12229
  }
11725
12230
 
@@ -11727,30 +12232,30 @@ var StreamChat = /*#__PURE__*/function () {
11727
12232
 
11728
12233
  case 5:
11729
12234
  if (!(typeof options.messages !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.messages))) {
11730
- _context83.next = 7;
12235
+ _context84.next = 7;
11731
12236
  break;
11732
12237
  }
11733
12238
 
11734
12239
  throw new Error('Invalid delete user options. messages must be one of [soft hard pruning]');
11735
12240
 
11736
12241
  case 7:
11737
- _context83.next = 9;
12242
+ _context84.next = 9;
11738
12243
  return this.post(this.baseURL + "/users/delete", _objectSpread({
11739
12244
  user_ids: user_ids
11740
12245
  }, options));
11741
12246
 
11742
12247
  case 9:
11743
- return _context83.abrupt("return", _context83.sent);
12248
+ return _context84.abrupt("return", _context84.sent);
11744
12249
 
11745
12250
  case 10:
11746
12251
  case "end":
11747
- return _context83.stop();
12252
+ return _context84.stop();
11748
12253
  }
11749
12254
  }
11750
- }, _callee83, this);
12255
+ }, _callee84, this);
11751
12256
  }));
11752
12257
 
11753
- function deleteUsers(_x118) {
12258
+ function deleteUsers(_x121) {
11754
12259
  return _deleteUsers.apply(this, arguments);
11755
12260
  }
11756
12261
 
@@ -11771,28 +12276,28 @@ var StreamChat = /*#__PURE__*/function () {
11771
12276
  }, {
11772
12277
  key: "_createImportURL",
11773
12278
  value: function () {
11774
- var _createImportURL2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee84(filename) {
11775
- return _regeneratorRuntime.wrap(function _callee84$(_context84) {
12279
+ var _createImportURL2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee85(filename) {
12280
+ return _regeneratorRuntime.wrap(function _callee85$(_context85) {
11776
12281
  while (1) {
11777
- switch (_context84.prev = _context84.next) {
12282
+ switch (_context85.prev = _context85.next) {
11778
12283
  case 0:
11779
- _context84.next = 2;
12284
+ _context85.next = 2;
11780
12285
  return this.post(this.baseURL + "/import_urls", {
11781
12286
  filename: filename
11782
12287
  });
11783
12288
 
11784
12289
  case 2:
11785
- return _context84.abrupt("return", _context84.sent);
12290
+ return _context85.abrupt("return", _context85.sent);
11786
12291
 
11787
12292
  case 3:
11788
12293
  case "end":
11789
- return _context84.stop();
12294
+ return _context85.stop();
11790
12295
  }
11791
12296
  }
11792
- }, _callee84, this);
12297
+ }, _callee85, this);
11793
12298
  }));
11794
12299
 
11795
- function _createImportURL(_x119) {
12300
+ function _createImportURL(_x122) {
11796
12301
  return _createImportURL2.apply(this, arguments);
11797
12302
  }
11798
12303
 
@@ -11814,33 +12319,33 @@ var StreamChat = /*#__PURE__*/function () {
11814
12319
  }, {
11815
12320
  key: "_createImport",
11816
12321
  value: function () {
11817
- var _createImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee85(path) {
12322
+ var _createImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee86(path) {
11818
12323
  var options,
11819
- _args85 = arguments;
11820
- return _regeneratorRuntime.wrap(function _callee85$(_context85) {
12324
+ _args86 = arguments;
12325
+ return _regeneratorRuntime.wrap(function _callee86$(_context86) {
11821
12326
  while (1) {
11822
- switch (_context85.prev = _context85.next) {
12327
+ switch (_context86.prev = _context86.next) {
11823
12328
  case 0:
11824
- options = _args85.length > 1 && _args85[1] !== undefined ? _args85[1] : {
12329
+ options = _args86.length > 1 && _args86[1] !== undefined ? _args86[1] : {
11825
12330
  mode: 'upsert'
11826
12331
  };
11827
- _context85.next = 3;
12332
+ _context86.next = 3;
11828
12333
  return this.post(this.baseURL + "/imports", _objectSpread({
11829
12334
  path: path
11830
12335
  }, options));
11831
12336
 
11832
12337
  case 3:
11833
- return _context85.abrupt("return", _context85.sent);
12338
+ return _context86.abrupt("return", _context86.sent);
11834
12339
 
11835
12340
  case 4:
11836
12341
  case "end":
11837
- return _context85.stop();
12342
+ return _context86.stop();
11838
12343
  }
11839
12344
  }
11840
- }, _callee85, this);
12345
+ }, _callee86, this);
11841
12346
  }));
11842
12347
 
11843
- function _createImport(_x120) {
12348
+ function _createImport(_x123) {
11844
12349
  return _createImport2.apply(this, arguments);
11845
12350
  }
11846
12351
 
@@ -11862,26 +12367,26 @@ var StreamChat = /*#__PURE__*/function () {
11862
12367
  }, {
11863
12368
  key: "_getImport",
11864
12369
  value: function () {
11865
- var _getImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee86(id) {
11866
- return _regeneratorRuntime.wrap(function _callee86$(_context86) {
12370
+ var _getImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee87(id) {
12371
+ return _regeneratorRuntime.wrap(function _callee87$(_context87) {
11867
12372
  while (1) {
11868
- switch (_context86.prev = _context86.next) {
12373
+ switch (_context87.prev = _context87.next) {
11869
12374
  case 0:
11870
- _context86.next = 2;
12375
+ _context87.next = 2;
11871
12376
  return this.get(this.baseURL + "/imports/".concat(id));
11872
12377
 
11873
12378
  case 2:
11874
- return _context86.abrupt("return", _context86.sent);
12379
+ return _context87.abrupt("return", _context87.sent);
11875
12380
 
11876
12381
  case 3:
11877
12382
  case "end":
11878
- return _context86.stop();
12383
+ return _context87.stop();
11879
12384
  }
11880
12385
  }
11881
- }, _callee86, this);
12386
+ }, _callee87, this);
11882
12387
  }));
11883
12388
 
11884
- function _getImport(_x121) {
12389
+ function _getImport(_x124) {
11885
12390
  return _getImport2.apply(this, arguments);
11886
12391
  }
11887
12392
 
@@ -11903,26 +12408,26 @@ var StreamChat = /*#__PURE__*/function () {
11903
12408
  }, {
11904
12409
  key: "_listImports",
11905
12410
  value: function () {
11906
- var _listImports2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee87(options) {
11907
- return _regeneratorRuntime.wrap(function _callee87$(_context87) {
12411
+ var _listImports2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee88(options) {
12412
+ return _regeneratorRuntime.wrap(function _callee88$(_context88) {
11908
12413
  while (1) {
11909
- switch (_context87.prev = _context87.next) {
12414
+ switch (_context88.prev = _context88.next) {
11910
12415
  case 0:
11911
- _context87.next = 2;
12416
+ _context88.next = 2;
11912
12417
  return this.get(this.baseURL + "/imports", options);
11913
12418
 
11914
12419
  case 2:
11915
- return _context87.abrupt("return", _context87.sent);
12420
+ return _context88.abrupt("return", _context88.sent);
11916
12421
 
11917
12422
  case 3:
11918
12423
  case "end":
11919
- return _context87.stop();
12424
+ return _context88.stop();
11920
12425
  }
11921
12426
  }
11922
- }, _callee87, this);
12427
+ }, _callee88, this);
11923
12428
  }));
11924
12429
 
11925
- function _listImports(_x122) {
12430
+ function _listImports(_x125) {
11926
12431
  return _listImports2.apply(this, arguments);
11927
12432
  }
11928
12433
 
@@ -11941,28 +12446,28 @@ var StreamChat = /*#__PURE__*/function () {
11941
12446
  }, {
11942
12447
  key: "upsertPushProvider",
11943
12448
  value: function () {
11944
- var _upsertPushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee88(pushProvider) {
11945
- return _regeneratorRuntime.wrap(function _callee88$(_context88) {
12449
+ var _upsertPushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee89(pushProvider) {
12450
+ return _regeneratorRuntime.wrap(function _callee89$(_context89) {
11946
12451
  while (1) {
11947
- switch (_context88.prev = _context88.next) {
12452
+ switch (_context89.prev = _context89.next) {
11948
12453
  case 0:
11949
- _context88.next = 2;
12454
+ _context89.next = 2;
11950
12455
  return this.post(this.baseURL + "/push_providers", {
11951
12456
  push_provider: pushProvider
11952
12457
  });
11953
12458
 
11954
12459
  case 2:
11955
- return _context88.abrupt("return", _context88.sent);
12460
+ return _context89.abrupt("return", _context89.sent);
11956
12461
 
11957
12462
  case 3:
11958
12463
  case "end":
11959
- return _context88.stop();
12464
+ return _context89.stop();
11960
12465
  }
11961
12466
  }
11962
- }, _callee88, this);
12467
+ }, _callee89, this);
11963
12468
  }));
11964
12469
 
11965
- function upsertPushProvider(_x123) {
12470
+ function upsertPushProvider(_x126) {
11966
12471
  return _upsertPushProvider.apply(this, arguments);
11967
12472
  }
11968
12473
 
@@ -11981,28 +12486,28 @@ var StreamChat = /*#__PURE__*/function () {
11981
12486
  }, {
11982
12487
  key: "deletePushProvider",
11983
12488
  value: function () {
11984
- var _deletePushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee89(_ref10) {
12489
+ var _deletePushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee90(_ref10) {
11985
12490
  var type, name;
11986
- return _regeneratorRuntime.wrap(function _callee89$(_context89) {
12491
+ return _regeneratorRuntime.wrap(function _callee90$(_context90) {
11987
12492
  while (1) {
11988
- switch (_context89.prev = _context89.next) {
12493
+ switch (_context90.prev = _context90.next) {
11989
12494
  case 0:
11990
12495
  type = _ref10.type, name = _ref10.name;
11991
- _context89.next = 3;
12496
+ _context90.next = 3;
11992
12497
  return this.delete(this.baseURL + "/push_providers/".concat(type, "/").concat(name));
11993
12498
 
11994
12499
  case 3:
11995
- return _context89.abrupt("return", _context89.sent);
12500
+ return _context90.abrupt("return", _context90.sent);
11996
12501
 
11997
12502
  case 4:
11998
12503
  case "end":
11999
- return _context89.stop();
12504
+ return _context90.stop();
12000
12505
  }
12001
12506
  }
12002
- }, _callee89, this);
12507
+ }, _callee90, this);
12003
12508
  }));
12004
12509
 
12005
- function deletePushProvider(_x124) {
12510
+ function deletePushProvider(_x127) {
12006
12511
  return _deletePushProvider.apply(this, arguments);
12007
12512
  }
12008
12513
 
@@ -12019,23 +12524,23 @@ var StreamChat = /*#__PURE__*/function () {
12019
12524
  }, {
12020
12525
  key: "listPushProviders",
12021
12526
  value: function () {
12022
- var _listPushProviders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee90() {
12023
- return _regeneratorRuntime.wrap(function _callee90$(_context90) {
12527
+ var _listPushProviders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee91() {
12528
+ return _regeneratorRuntime.wrap(function _callee91$(_context91) {
12024
12529
  while (1) {
12025
- switch (_context90.prev = _context90.next) {
12530
+ switch (_context91.prev = _context91.next) {
12026
12531
  case 0:
12027
- _context90.next = 2;
12532
+ _context91.next = 2;
12028
12533
  return this.get(this.baseURL + "/push_providers");
12029
12534
 
12030
12535
  case 2:
12031
- return _context90.abrupt("return", _context90.sent);
12536
+ return _context91.abrupt("return", _context91.sent);
12032
12537
 
12033
12538
  case 3:
12034
12539
  case "end":
12035
- return _context90.stop();
12540
+ return _context91.stop();
12036
12541
  }
12037
12542
  }
12038
- }, _callee90, this);
12543
+ }, _callee91, this);
12039
12544
  }));
12040
12545
 
12041
12546
  function listPushProviders() {
@@ -12063,26 +12568,26 @@ var StreamChat = /*#__PURE__*/function () {
12063
12568
  }, {
12064
12569
  key: "commitMessage",
12065
12570
  value: function () {
12066
- var _commitMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee91(id) {
12067
- return _regeneratorRuntime.wrap(function _callee91$(_context91) {
12571
+ var _commitMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee92(id) {
12572
+ return _regeneratorRuntime.wrap(function _callee92$(_context92) {
12068
12573
  while (1) {
12069
- switch (_context91.prev = _context91.next) {
12574
+ switch (_context92.prev = _context92.next) {
12070
12575
  case 0:
12071
- _context91.next = 2;
12576
+ _context92.next = 2;
12072
12577
  return this.post(this.baseURL + "/messages/".concat(id, "/commit"));
12073
12578
 
12074
12579
  case 2:
12075
- return _context91.abrupt("return", _context91.sent);
12580
+ return _context92.abrupt("return", _context92.sent);
12076
12581
 
12077
12582
  case 3:
12078
12583
  case "end":
12079
- return _context91.stop();
12584
+ return _context92.stop();
12080
12585
  }
12081
12586
  }
12082
- }, _callee91, this);
12587
+ }, _callee92, this);
12083
12588
  }));
12084
12589
 
12085
- function commitMessage(_x125) {
12590
+ function commitMessage(_x128) {
12086
12591
  return _commitMessage.apply(this, arguments);
12087
12592
  }
12088
12593
 
@@ -12234,5 +12739,5 @@ var BuiltinPermissions = {
12234
12739
  UseFrozenChannel: 'Send messages and reactions to frozen channels'
12235
12740
  };
12236
12741
 
12237
- 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 };
12742
+ 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 };
12238
12743
  //# sourceMappingURL=browser.es.js.map