stream-chat 4.0.0-offline-caching.2 → 4.3.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.
@@ -616,60 +616,6 @@ var ChannelState = /*#__PURE__*/function () {
616
616
 
617
617
  return _toConsumableArray(messageArr);
618
618
  }
619
- }, {
620
- key: "getStateData",
621
- value: function getStateData() {
622
- return {
623
- read: this.read,
624
- messages: this.messages,
625
- pinnedMessages: this.pinnedMessages,
626
- threads: this.threads,
627
- mutedUsers: this.mutedUsers,
628
- members: this.members,
629
- membership: this.membership,
630
- unreadCount: this.unreadCount,
631
- isUpToDate: this.isUpToDate,
632
- last_message_at: this.last_message_at
633
- };
634
- }
635
- }, {
636
- key: "reInitializeWithState",
637
- value: function reInitializeWithState(channelState) {
638
- var _this4 = this;
639
-
640
- this.read = Object.entries(channelState.read).reduce(function (acc, next) {
641
- var _next = _slicedToArray(next, 2),
642
- id = _next[0],
643
- value = _next[1];
644
-
645
- acc[id] = _objectSpread$4(_objectSpread$4({}, value), {}, {
646
- last_read: new Date(value.last_read)
647
- });
648
- return acc;
649
- }, {});
650
- this.messages = channelState.messages.map(function (m) {
651
- return _this4.formatMessage(m);
652
- });
653
- this.pinnedMessages = channelState.pinnedMessages.map(function (m) {
654
- return _this4.formatMessage(m);
655
- });
656
- this.threads = Object.entries(channelState.threads).reduce(function (acc, next) {
657
- var _next2 = _slicedToArray(next, 2),
658
- id = _next2[0],
659
- value = _next2[1];
660
-
661
- acc[id] = value.map(function (m) {
662
- return _this4.formatMessage(m);
663
- });
664
- return acc;
665
- }, {});
666
- this.mutedUsers = channelState.mutedUsers;
667
- this.members = channelState.members;
668
- this.membership = channelState.membership;
669
- this.unreadCount = channelState.unreadCount;
670
- this.isUpToDate = channelState.isUpToDate;
671
- this.last_message_at = channelState.last_message_at ? new Date(channelState.last_message_at) : null;
672
- }
673
619
  /**
674
620
  * removeMessage - Description
675
621
  *
@@ -1119,7 +1065,8 @@ var Channel = /*#__PURE__*/function () {
1119
1065
  * sendMessage - Send a message to this channel
1120
1066
  *
1121
1067
  * @param {Message<AttachmentType, MessageType, UserType>} message The Message object
1122
- * @param {{ skip_push?: boolean }} [options] Option object, {skip_push: true} to skip sending push notifications
1068
+ * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
1069
+ * @param {boolean} [options.skip_push] Skip sending push notifications
1123
1070
  *
1124
1071
  * @return {Promise<SendMessageAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The Server Response
1125
1072
  */
@@ -1314,8 +1261,8 @@ var Channel = /*#__PURE__*/function () {
1314
1261
  * queryMembers - Query Members
1315
1262
  *
1316
1263
  * @param {UserFilters<UserType>} filterConditions object MongoDB style filters
1317
- * @param {UserSort<UserType>} [sort] Sort options, for instance [{created_at: -1}].
1318
- * When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_active: -1}, {created_at: 1}]
1264
+ * @param {MemberSort<UserType>} [sort] Sort options, for instance [{created_at: -1}].
1265
+ * When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{name: -1}, {created_at: 1}]
1319
1266
  * @param {{ limit?: number; offset?: number }} [options] Option object, {limit: 10, offset:10}
1320
1267
  *
1321
1268
  * @return {Promise<ChannelMemberAPIResponse<UserType>>} Query Members response
@@ -2567,6 +2514,7 @@ var Channel = /*#__PURE__*/function () {
2567
2514
  if (message.silent) return false;
2568
2515
  if (((_message$user = message.user) === null || _message$user === void 0 ? void 0 : _message$user.id) === this.getClient().userID) return false;
2569
2516
  if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
2517
+ if (message.type === 'system') return false;
2570
2518
  if (this.muteStatus().muted) return false;
2571
2519
  return true;
2572
2520
  }
@@ -3347,30 +3295,6 @@ var Channel = /*#__PURE__*/function () {
3347
3295
  }
3348
3296
  }
3349
3297
  }
3350
- }, {
3351
- key: "getStateData",
3352
- value: function getStateData() {
3353
- return {
3354
- state: this.state.getStateData(),
3355
- data: this.data,
3356
- _data: this._data,
3357
- id: this.id,
3358
- type: this.type
3359
- };
3360
- }
3361
- }, {
3362
- key: "reInitializeWithState",
3363
- value: function reInitializeWithState(channelState) {
3364
- this.state.reInitializeWithState(channelState.state);
3365
- this.data = channelState.data;
3366
-
3367
- if (channelState._data) {
3368
- this._data = channelState._data;
3369
- }
3370
-
3371
- this.id = channelState.id;
3372
- this.type = channelState.type;
3373
- }
3374
3298
  }, {
3375
3299
  key: "_disconnect",
3376
3300
  value: function _disconnect() {
@@ -3457,20 +3381,6 @@ var ClientState = /*#__PURE__*/function () {
3457
3381
  delete this.userChannelReferences[userID][channelID];
3458
3382
  }
3459
3383
  }
3460
- }, {
3461
- key: "getStateData",
3462
- value: function getStateData() {
3463
- return {
3464
- users: this.users,
3465
- userChannelReferences: this.userChannelReferences
3466
- };
3467
- }
3468
- }, {
3469
- key: "reInitializeWithState",
3470
- value: function reInitializeWithState(clientState) {
3471
- this.users = clientState.users;
3472
- this.userChannelReferences = clientState.userChannelReferences;
3473
- }
3474
3384
  }]);
3475
3385
 
3476
3386
  return ClientState;
@@ -3636,6 +3546,8 @@ var StableWSConnection = /*#__PURE__*/function () {
3636
3546
  // after that a ws.onclose..
3637
3547
 
3638
3548
  if (!_this.isResolved && data) {
3549
+ _this.isResolved = true;
3550
+
3639
3551
  if (data.error != null) {
3640
3552
  var _this$rejectPromise;
3641
3553
 
@@ -3644,7 +3556,7 @@ var StableWSConnection = /*#__PURE__*/function () {
3644
3556
  } else {
3645
3557
  var _this$resolvePromise;
3646
3558
 
3647
- (_this$resolvePromise = _this.resolvePromise) === null || _this$resolvePromise === void 0 ? void 0 : _this$resolvePromise.call(_this, event); // set healthy..
3559
+ (_this$resolvePromise = _this.resolvePromise) === null || _this$resolvePromise === void 0 ? void 0 : _this$resolvePromise.call(_this, event);
3648
3560
 
3649
3561
  _this._setHealth(true);
3650
3562
  }
@@ -3698,6 +3610,7 @@ var StableWSConnection = /*#__PURE__*/function () {
3698
3610
 
3699
3611
  _this._setHealth(false);
3700
3612
 
3613
+ _this.isConnecting = false;
3701
3614
  (_this$rejectPromise3 = _this.rejectPromise) === null || _this$rejectPromise3 === void 0 ? void 0 : _this$rejectPromise3.call(_this, _this._errorFromWSEvent(event));
3702
3615
 
3703
3616
  _this.logger('info', "connection:onclose() - WS connection closed. Calling reconnect ...", {
@@ -3719,6 +3632,7 @@ var StableWSConnection = /*#__PURE__*/function () {
3719
3632
 
3720
3633
  _this._setHealth(false);
3721
3634
 
3635
+ _this.isConnecting = false;
3722
3636
  (_this$rejectPromise4 = _this.rejectPromise) === null || _this$rejectPromise4 === void 0 ? void 0 : _this$rejectPromise4.call(_this, _this._errorFromWSEvent(event));
3723
3637
 
3724
3638
  _this.logger('info', "connection:onerror() - WS connection resulted into error", {
@@ -3791,14 +3705,22 @@ var StableWSConnection = /*#__PURE__*/function () {
3791
3705
  });
3792
3706
 
3793
3707
  _defineProperty(this, "_listenForConnectionChanges", function () {
3794
- if (typeof window !== 'undefined' && window != null && window.addEventListener != null) {
3708
+ var _window;
3709
+
3710
+ // (typeof window !== 'undefined') check is for environments where window is not defined, such as nextjs environment,
3711
+ // and thus (window === undefined) will result in ReferenceError.
3712
+ if (typeof window !== 'undefined' && (_window = window) !== null && _window !== void 0 && _window.addEventListener) {
3795
3713
  window.addEventListener('offline', _this.onlineStatusChanged);
3796
3714
  window.addEventListener('online', _this.onlineStatusChanged);
3797
3715
  }
3798
3716
  });
3799
3717
 
3800
3718
  _defineProperty(this, "_removeConnectionListeners", function () {
3801
- if (typeof window !== 'undefined' && window != null && window.addEventListener != null) {
3719
+ var _window2;
3720
+
3721
+ // (typeof window !== 'undefined') check is for environments where window is not defined, such as nextjs environment,
3722
+ // and thus (window === undefined) will result in ReferenceError.
3723
+ if (typeof window !== 'undefined' && (_window2 = window) !== null && _window2 !== void 0 && _window2.removeEventListener) {
3802
3724
  window.removeEventListener('offline', _this.onlineStatusChanged);
3803
3725
  window.removeEventListener('online', _this.onlineStatusChanged);
3804
3726
  }
@@ -3890,6 +3812,9 @@ var StableWSConnection = /*#__PURE__*/function () {
3890
3812
  /** We only make 1 attempt to reconnect at the same time.. */
3891
3813
 
3892
3814
  this.isConnecting = false;
3815
+ /** Boolean that indicates if the connection promise is resolved */
3816
+
3817
+ this.isResolved = false;
3893
3818
  /** Boolean that indicates if we have a working connection to the server */
3894
3819
 
3895
3820
  this.isHealthy = false;
@@ -3942,23 +3867,21 @@ var StableWSConnection = /*#__PURE__*/function () {
3942
3867
 
3943
3868
  case 5:
3944
3869
  healthCheck = _context.sent;
3945
- this.isConnecting = false;
3946
3870
  this.consecutiveFailures = 0;
3947
3871
  this.logger('info', "connection:connect() - Established ws connection with healthcheck: ".concat(healthCheck), {
3948
3872
  tags: ['connection']
3949
3873
  });
3950
- _context.next = 23;
3874
+ _context.next = 21;
3951
3875
  break;
3952
3876
 
3953
- case 11:
3954
- _context.prev = 11;
3877
+ case 10:
3878
+ _context.prev = 10;
3955
3879
  _context.t0 = _context["catch"](2);
3956
- this.isConnecting = false;
3957
3880
  this.isHealthy = false;
3958
3881
  this.consecutiveFailures += 1;
3959
3882
 
3960
3883
  if (!(_context.t0.code === chatCodes.TOKEN_EXPIRED && !this.tokenManager.isStatic())) {
3961
- _context.next = 21;
3884
+ _context.next = 19;
3962
3885
  break;
3963
3886
  }
3964
3887
 
@@ -3970,12 +3893,12 @@ var StableWSConnection = /*#__PURE__*/function () {
3970
3893
  refreshToken: true
3971
3894
  });
3972
3895
 
3973
- _context.next = 23;
3896
+ _context.next = 21;
3974
3897
  break;
3975
3898
 
3976
- case 21:
3899
+ case 19:
3977
3900
  if (_context.t0.isWSFailure) {
3978
- _context.next = 23;
3901
+ _context.next = 21;
3979
3902
  break;
3980
3903
  }
3981
3904
 
@@ -3986,19 +3909,19 @@ var StableWSConnection = /*#__PURE__*/function () {
3986
3909
  isWSFailure: _context.t0.isWSFailure
3987
3910
  }));
3988
3911
 
3989
- case 23:
3990
- _context.next = 25;
3912
+ case 21:
3913
+ _context.next = 23;
3991
3914
  return this._waitForHealthy();
3992
3915
 
3993
- case 25:
3916
+ case 23:
3994
3917
  return _context.abrupt("return", _context.sent);
3995
3918
 
3996
- case 26:
3919
+ case 24:
3997
3920
  case "end":
3998
3921
  return _context.stop();
3999
3922
  }
4000
3923
  }
4001
- }, _callee, this, [[2, 11]]);
3924
+ }, _callee, this, [[2, 10]]);
4002
3925
  }));
4003
3926
 
4004
3927
  function connect() {
@@ -4200,10 +4123,21 @@ var StableWSConnection = /*#__PURE__*/function () {
4200
4123
  while (1) {
4201
4124
  switch (_context5.prev = _context5.next) {
4202
4125
  case 0:
4203
- _context5.next = 2;
4204
- return this.tokenManager.tokenReady();
4126
+ if (!this.isConnecting) {
4127
+ _context5.next = 2;
4128
+ break;
4129
+ }
4130
+
4131
+ return _context5.abrupt("return");
4205
4132
 
4206
4133
  case 2:
4134
+ // simply ignore _connect if it's currently trying to connect
4135
+ this.isConnecting = true;
4136
+ _context5.prev = 3;
4137
+ _context5.next = 6;
4138
+ return this.tokenManager.tokenReady();
4139
+
4140
+ case 6:
4207
4141
  this._setupConnectionPromise();
4208
4142
 
4209
4143
  wsURL = this._buildUrl();
@@ -4212,29 +4146,37 @@ var StableWSConnection = /*#__PURE__*/function () {
4212
4146
  this.ws.onclose = this.onclose.bind(this, this.wsID);
4213
4147
  this.ws.onerror = this.onerror.bind(this, this.wsID);
4214
4148
  this.ws.onmessage = this.onmessage.bind(this, this.wsID);
4215
- _context5.next = 11;
4149
+ _context5.next = 15;
4216
4150
  return this.connectionOpen;
4217
4151
 
4218
- case 11:
4152
+ case 15:
4219
4153
  response = _context5.sent;
4154
+ this.isConnecting = false;
4220
4155
 
4221
4156
  if (!response) {
4222
- _context5.next = 15;
4157
+ _context5.next = 20;
4223
4158
  break;
4224
4159
  }
4225
4160
 
4226
4161
  this.connectionID = response.connection_id;
4227
4162
  return _context5.abrupt("return", response);
4228
4163
 
4229
- case 15:
4230
- return _context5.abrupt("return", undefined);
4164
+ case 20:
4165
+ _context5.next = 26;
4166
+ break;
4231
4167
 
4232
- case 16:
4168
+ case 22:
4169
+ _context5.prev = 22;
4170
+ _context5.t0 = _context5["catch"](3);
4171
+ this.isConnecting = false;
4172
+ throw _context5.t0;
4173
+
4174
+ case 26:
4233
4175
  case "end":
4234
4176
  return _context5.stop();
4235
4177
  }
4236
4178
  }
4237
- }, _callee5, this);
4179
+ }, _callee5, this, [[3, 22]]);
4238
4180
  }));
4239
4181
 
4240
4182
  function _connect() {
@@ -4305,8 +4247,7 @@ var StableWSConnection = /*#__PURE__*/function () {
4305
4247
  return _context6.abrupt("return");
4306
4248
 
4307
4249
  case 12:
4308
- this.isConnecting = true; // cleanup the old connection
4309
-
4250
+ // cleanup the old connection
4310
4251
  this.logger('info', 'connection:_reconnect() - Destroying current WS connection', {
4311
4252
  tags: ['connection']
4312
4253
  });
@@ -4314,52 +4255,50 @@ var StableWSConnection = /*#__PURE__*/function () {
4314
4255
  this._destroyCurrentWSConnection();
4315
4256
 
4316
4257
  if (!options.refreshToken) {
4317
- _context6.next = 18;
4258
+ _context6.next = 17;
4318
4259
  break;
4319
4260
  }
4320
4261
 
4321
- _context6.next = 18;
4262
+ _context6.next = 17;
4322
4263
  return this.tokenManager.loadToken();
4323
4264
 
4324
- case 18:
4325
- _context6.prev = 18;
4326
- _context6.next = 21;
4265
+ case 17:
4266
+ _context6.prev = 17;
4267
+ _context6.next = 20;
4327
4268
  return this._connect();
4328
4269
 
4329
- case 21:
4270
+ case 20:
4330
4271
  _open = _context6.sent;
4331
4272
 
4332
4273
  if (!this.recoverCallback) {
4333
- _context6.next = 27;
4274
+ _context6.next = 26;
4334
4275
  break;
4335
4276
  }
4336
4277
 
4337
4278
  this.logger('info', 'connection:_reconnect() - Waiting for recoverCallBack', {
4338
4279
  tags: ['connection']
4339
4280
  });
4340
- _context6.next = 26;
4281
+ _context6.next = 25;
4341
4282
  return this.recoverCallback(_open);
4342
4283
 
4343
- case 26:
4284
+ case 25:
4344
4285
  this.logger('info', 'connection:_reconnect() - Finished recoverCallBack', {
4345
4286
  tags: ['connection']
4346
4287
  });
4347
4288
 
4348
- case 27:
4349
- this.isConnecting = false;
4289
+ case 26:
4350
4290
  this.consecutiveFailures = 0;
4351
- _context6.next = 40;
4291
+ _context6.next = 37;
4352
4292
  break;
4353
4293
 
4354
- case 31:
4355
- _context6.prev = 31;
4356
- _context6.t0 = _context6["catch"](18);
4357
- this.isConnecting = false;
4294
+ case 29:
4295
+ _context6.prev = 29;
4296
+ _context6.t0 = _context6["catch"](17);
4358
4297
  this.isHealthy = false;
4359
4298
  this.consecutiveFailures += 1;
4360
4299
 
4361
4300
  if (!(_context6.t0.code === chatCodes.TOKEN_EXPIRED && !this.tokenManager.isStatic())) {
4362
- _context6.next = 39;
4301
+ _context6.next = 36;
4363
4302
  break;
4364
4303
  }
4365
4304
 
@@ -4370,7 +4309,7 @@ var StableWSConnection = /*#__PURE__*/function () {
4370
4309
  refreshToken: true
4371
4310
  }));
4372
4311
 
4373
- case 39:
4312
+ case 36:
4374
4313
  // reconnect on WS failures, don't reconnect if there is a code bug
4375
4314
  if (_context6.t0.isWSFailure) {
4376
4315
  this.logger('info', 'connection:_reconnect() - WS failure, so going to try to reconnect', {
@@ -4380,17 +4319,17 @@ var StableWSConnection = /*#__PURE__*/function () {
4380
4319
  this._reconnect();
4381
4320
  }
4382
4321
 
4383
- case 40:
4322
+ case 37:
4384
4323
  this.logger('info', 'connection:_reconnect() - == END ==', {
4385
4324
  tags: ['connection']
4386
4325
  });
4387
4326
 
4388
- case 41:
4327
+ case 38:
4389
4328
  case "end":
4390
4329
  return _context6.stop();
4391
4330
  }
4392
4331
  }
4393
- }, _callee6, this, [[18, 31]]);
4332
+ }, _callee6, this, [[17, 29]]);
4394
4333
  }));
4395
4334
 
4396
4335
  function _reconnect() {
@@ -4755,8 +4694,6 @@ var StreamChat = /*#__PURE__*/function () {
4755
4694
 
4756
4695
  _defineProperty(this, "configs", void 0);
4757
4696
 
4758
- _defineProperty(this, "connecting", void 0);
4759
-
4760
4697
  _defineProperty(this, "connectionID", void 0);
4761
4698
 
4762
4699
  _defineProperty(this, "failures", void 0);
@@ -5445,6 +5382,8 @@ var StreamChat = /*#__PURE__*/function () {
5445
5382
 
5446
5383
  _defineProperty(this, "updateUser", this.upsertUser);
5447
5384
 
5385
+ _defineProperty(this, "markAllRead", this.markChannelsRead);
5386
+
5448
5387
  _defineProperty(this, "_isUsingServerAuth", function () {
5449
5388
  return !!_this.secret;
5450
5389
  });
@@ -5850,6 +5789,7 @@ var StreamChat = /*#__PURE__*/function () {
5850
5789
  apnTemplate: '{}', //if app doesn't have apn configured it will error
5851
5790
  firebaseTemplate: '{}', //if app doesn't have firebase configured it will error
5852
5791
  firebaseDataTemplate: '{}', //if app doesn't have firebase configured it will error
5792
+ huaweiDataTemplate: '{}' //if app doesn't have huawei configured it will error
5853
5793
  skipDevices: true, // skip config/device checks and sending to real devices
5854
5794
  }
5855
5795
  */
@@ -5866,7 +5806,7 @@ var StreamChat = /*#__PURE__*/function () {
5866
5806
  case 0:
5867
5807
  data = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {};
5868
5808
  _context11.next = 3;
5869
- return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
5809
+ return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
5870
5810
  user_id: userID
5871
5811
  }, data.messageID ? {
5872
5812
  message_id: data.messageID
@@ -5876,6 +5816,8 @@ var StreamChat = /*#__PURE__*/function () {
5876
5816
  firebase_template: data.firebaseTemplate
5877
5817
  } : {}), data.firebaseDataTemplate ? {
5878
5818
  firebase_data_template: data.firebaseDataTemplate
5819
+ } : {}), data.huaweiDataTemplate ? {
5820
+ huawei_data_template: data.huaweiDataTemplate
5879
5821
  } : {}), data.skipDevices ? {
5880
5822
  skip_devices: true
5881
5823
  } : {}));
@@ -5900,13 +5842,11 @@ var StreamChat = /*#__PURE__*/function () {
5900
5842
  /**
5901
5843
  * testSQSSettings - Tests that the given or configured SQS configuration is valid
5902
5844
  *
5903
- * @param {string} userID User ID. If user has no devices, it will error
5904
- * @param {TestPushDataInput} [data] Overrides for push templates/message used
5845
+ * @param {TestSQSDataInput} [data] Overrides SQS settings for testing if needed
5905
5846
  * IE: {
5906
- messageID: 'id-of-message',//will error if message does not exist
5907
- apnTemplate: '{}', //if app doesn't have apn configured it will error
5908
- firebaseTemplate: '{}', //if app doesn't have firebase configured it will error
5909
- firebaseDataTemplate: '{}', //if app doesn't have firebase configured it will error
5847
+ sqs_key: 'auth_key',
5848
+ sqs_secret: 'auth_secret',
5849
+ sqs_url: 'url_to_queue',
5910
5850
  }
5911
5851
  */
5912
5852
 
@@ -6318,34 +6258,33 @@ var StreamChat = /*#__PURE__*/function () {
6318
6258
  while (1) {
6319
6259
  switch (_context14.prev = _context14.next) {
6320
6260
  case 0:
6321
- this.connecting = true;
6322
6261
  client = this;
6323
6262
  this.failures = 0;
6324
6263
 
6325
6264
  if (!(client.userID == null || this._user == null)) {
6326
- _context14.next = 5;
6265
+ _context14.next = 4;
6327
6266
  break;
6328
6267
  }
6329
6268
 
6330
6269
  throw Error('Call connectUser or connectAnonymousUser before starting the connection');
6331
6270
 
6332
- case 5:
6271
+ case 4:
6333
6272
  if (!(client.wsBaseURL == null)) {
6334
- _context14.next = 7;
6273
+ _context14.next = 6;
6335
6274
  break;
6336
6275
  }
6337
6276
 
6338
6277
  throw Error('Websocket base url not set');
6339
6278
 
6340
- case 7:
6279
+ case 6:
6341
6280
  if (!(client.clientID == null)) {
6342
- _context14.next = 9;
6281
+ _context14.next = 8;
6343
6282
  break;
6344
6283
  }
6345
6284
 
6346
6285
  throw Error('clientID is not set');
6347
6286
 
6348
- case 9:
6287
+ case 8:
6349
6288
  // The StableWSConnection handles all the reconnection logic.
6350
6289
  this.wsConnection = new StableWSConnection({
6351
6290
  wsBaseURL: client.wsBaseURL,
@@ -6367,35 +6306,35 @@ var StreamChat = /*#__PURE__*/function () {
6367
6306
  warmUpPromise = this.doAxiosRequest('options', this.baseURL + '/connect');
6368
6307
  }
6369
6308
 
6370
- _context14.next = 13;
6309
+ _context14.next = 12;
6371
6310
  return this.wsConnection.connect();
6372
6311
 
6373
- case 13:
6312
+ case 12:
6374
6313
  handshake = _context14.sent;
6375
- _context14.prev = 14;
6376
- _context14.next = 17;
6314
+ _context14.prev = 13;
6315
+ _context14.next = 16;
6377
6316
  return warmUpPromise;
6378
6317
 
6379
- case 17:
6380
- _context14.next = 22;
6318
+ case 16:
6319
+ _context14.next = 21;
6381
6320
  break;
6382
6321
 
6383
- case 19:
6384
- _context14.prev = 19;
6385
- _context14.t0 = _context14["catch"](14);
6322
+ case 18:
6323
+ _context14.prev = 18;
6324
+ _context14.t0 = _context14["catch"](13);
6386
6325
  this.logger('error', 'Warmup request failed', {
6387
6326
  error: _context14.t0
6388
6327
  });
6389
6328
 
6390
- case 22:
6329
+ case 21:
6391
6330
  return _context14.abrupt("return", handshake);
6392
6331
 
6393
- case 23:
6332
+ case 22:
6394
6333
  case "end":
6395
6334
  return _context14.stop();
6396
6335
  }
6397
6336
  }
6398
- }, _callee14, this, [[14, 19]]);
6337
+ }, _callee14, this, [[13, 18]]);
6399
6338
  }));
6400
6339
 
6401
6340
  function connect() {
@@ -6566,74 +6505,6 @@ var StreamChat = /*#__PURE__*/function () {
6566
6505
 
6567
6506
  return queryMessageFlags;
6568
6507
  }()
6569
- }, {
6570
- key: "getStateData",
6571
- value: function getStateData() {
6572
- var clientData = {
6573
- state: this.state.getStateData(),
6574
- user: this.user,
6575
- token: this._getToken()
6576
- };
6577
- var channelsData = Object.values(this.activeChannels).map(function (item) {
6578
- return item.getStateData();
6579
- });
6580
- return {
6581
- client: clientData,
6582
- channels: channelsData
6583
- };
6584
- }
6585
- }, {
6586
- key: "reInitializeAuthState",
6587
- value: function () {
6588
- var _reInitializeAuthState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(user, userTokenOrProvider) {
6589
- return _regeneratorRuntime.wrap(function _callee18$(_context18) {
6590
- while (1) {
6591
- switch (_context18.prev = _context18.next) {
6592
- case 0:
6593
- this.userID = user.id;
6594
- this.anonymous = false;
6595
- _context18.next = 4;
6596
- return this._setToken(user, userTokenOrProvider);
6597
-
6598
- case 4:
6599
- this._setUser(user);
6600
-
6601
- case 5:
6602
- case "end":
6603
- return _context18.stop();
6604
- }
6605
- }
6606
- }, _callee18, this);
6607
- }));
6608
-
6609
- function reInitializeAuthState(_x16, _x17) {
6610
- return _reInitializeAuthState.apply(this, arguments);
6611
- }
6612
-
6613
- return reInitializeAuthState;
6614
- }()
6615
- }, {
6616
- key: "reInitializeWithState",
6617
- value: function reInitializeWithState(clientData, channelsData) {
6618
- this.state.reInitializeWithState(clientData.state);
6619
-
6620
- var _iterator2 = _createForOfIteratorHelper(channelsData),
6621
- _step2;
6622
-
6623
- try {
6624
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
6625
- var channelData = _step2.value;
6626
- var c = this.channel(channelData.type, channelData.id);
6627
- c.data = channelData.data;
6628
- c.initialized = true;
6629
- c.reInitializeWithState(channelData);
6630
- }
6631
- } catch (err) {
6632
- _iterator2.e(err);
6633
- } finally {
6634
- _iterator2.f();
6635
- }
6636
- }
6637
6508
  /**
6638
6509
  * queryChannels - Query channels
6639
6510
  *
@@ -6650,7 +6521,7 @@ var StreamChat = /*#__PURE__*/function () {
6650
6521
  }, {
6651
6522
  key: "queryChannels",
6652
6523
  value: function () {
6653
- var _queryChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(filterConditions) {
6524
+ var _queryChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(filterConditions) {
6654
6525
  var sort,
6655
6526
  options,
6656
6527
  stateOptions,
@@ -6659,22 +6530,22 @@ var StreamChat = /*#__PURE__*/function () {
6659
6530
  payload,
6660
6531
  data,
6661
6532
  channels,
6533
+ _iterator2,
6534
+ _step2,
6535
+ channelState,
6662
6536
  _iterator3,
6663
6537
  _step3,
6664
- channelState,
6665
- _iterator4,
6666
- _step4,
6667
6538
  _channelState,
6668
6539
  c,
6669
- _args19 = arguments;
6540
+ _args18 = arguments;
6670
6541
 
6671
- return _regeneratorRuntime.wrap(function _callee19$(_context19) {
6542
+ return _regeneratorRuntime.wrap(function _callee18$(_context18) {
6672
6543
  while (1) {
6673
- switch (_context19.prev = _context19.next) {
6544
+ switch (_context18.prev = _context18.next) {
6674
6545
  case 0:
6675
- sort = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : [];
6676
- options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
6677
- stateOptions = _args19.length > 3 && _args19[3] !== undefined ? _args19[3] : {};
6546
+ sort = _args18.length > 1 && _args18[1] !== undefined ? _args18[1] : [];
6547
+ options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
6548
+ stateOptions = _args18.length > 3 && _args18[3] !== undefined ? _args18[3] : {};
6678
6549
  skipInitialization = stateOptions.skipInitialization;
6679
6550
  defaultOptions = {
6680
6551
  state: true,
@@ -6682,7 +6553,7 @@ var StreamChat = /*#__PURE__*/function () {
6682
6553
  presence: false
6683
6554
  }; // Make sure we wait for the connect promise if there is a pending one
6684
6555
 
6685
- _context19.next = 7;
6556
+ _context18.next = 7;
6686
6557
  return this.setUserPromise;
6687
6558
 
6688
6559
  case 7:
@@ -6695,32 +6566,32 @@ var StreamChat = /*#__PURE__*/function () {
6695
6566
  filter_conditions: filterConditions,
6696
6567
  sort: normalizeQuerySort(sort)
6697
6568
  }, defaultOptions), options);
6698
- _context19.next = 11;
6569
+ _context18.next = 11;
6699
6570
  return this.post(this.baseURL + '/channels', payload);
6700
6571
 
6701
6572
  case 11:
6702
- data = _context19.sent;
6573
+ data = _context18.sent;
6703
6574
  channels = []; // update our cache of the configs
6704
6575
 
6705
- _iterator3 = _createForOfIteratorHelper(data.channels);
6576
+ _iterator2 = _createForOfIteratorHelper(data.channels);
6706
6577
 
6707
6578
  try {
6708
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
6709
- channelState = _step3.value;
6579
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
6580
+ channelState = _step2.value;
6710
6581
 
6711
6582
  this._addChannelConfig(channelState);
6712
6583
  }
6713
6584
  } catch (err) {
6714
- _iterator3.e(err);
6585
+ _iterator2.e(err);
6715
6586
  } finally {
6716
- _iterator3.f();
6587
+ _iterator2.f();
6717
6588
  }
6718
6589
 
6719
- _iterator4 = _createForOfIteratorHelper(data.channels);
6590
+ _iterator3 = _createForOfIteratorHelper(data.channels);
6720
6591
 
6721
6592
  try {
6722
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
6723
- _channelState = _step4.value;
6593
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
6594
+ _channelState = _step3.value;
6724
6595
  c = this.channel(_channelState.channel.type, _channelState.channel.id);
6725
6596
  c.data = _channelState.channel;
6726
6597
  c.initialized = true;
@@ -6736,22 +6607,22 @@ var StreamChat = /*#__PURE__*/function () {
6736
6607
  channels.push(c);
6737
6608
  }
6738
6609
  } catch (err) {
6739
- _iterator4.e(err);
6610
+ _iterator3.e(err);
6740
6611
  } finally {
6741
- _iterator4.f();
6612
+ _iterator3.f();
6742
6613
  }
6743
6614
 
6744
- return _context19.abrupt("return", channels);
6615
+ return _context18.abrupt("return", channels);
6745
6616
 
6746
6617
  case 18:
6747
6618
  case "end":
6748
- return _context19.stop();
6619
+ return _context18.stop();
6749
6620
  }
6750
6621
  }
6751
- }, _callee19, this);
6622
+ }, _callee18, this);
6752
6623
  }));
6753
6624
 
6754
- function queryChannels(_x18) {
6625
+ function queryChannels(_x16) {
6755
6626
  return _queryChannels.apply(this, arguments);
6756
6627
  }
6757
6628
 
@@ -6770,18 +6641,18 @@ var StreamChat = /*#__PURE__*/function () {
6770
6641
  }, {
6771
6642
  key: "search",
6772
6643
  value: function () {
6773
- var _search = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(filterConditions, query) {
6644
+ var _search = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(filterConditions, query) {
6774
6645
  var options,
6775
6646
  payload,
6776
- _args20 = arguments;
6777
- return _regeneratorRuntime.wrap(function _callee20$(_context20) {
6647
+ _args19 = arguments;
6648
+ return _regeneratorRuntime.wrap(function _callee19$(_context19) {
6778
6649
  while (1) {
6779
- switch (_context20.prev = _context20.next) {
6650
+ switch (_context19.prev = _context19.next) {
6780
6651
  case 0:
6781
- options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
6652
+ options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
6782
6653
 
6783
6654
  if (!(options.offset && (options.sort || options.next))) {
6784
- _context20.next = 3;
6655
+ _context19.next = 3;
6785
6656
  break;
6786
6657
  }
6787
6658
 
@@ -6795,49 +6666,49 @@ var StreamChat = /*#__PURE__*/function () {
6795
6666
  });
6796
6667
 
6797
6668
  if (!(typeof query === 'string')) {
6798
- _context20.next = 8;
6669
+ _context19.next = 8;
6799
6670
  break;
6800
6671
  }
6801
6672
 
6802
6673
  payload.query = query;
6803
- _context20.next = 13;
6674
+ _context19.next = 13;
6804
6675
  break;
6805
6676
 
6806
6677
  case 8:
6807
6678
  if (!(_typeof(query) === 'object')) {
6808
- _context20.next = 12;
6679
+ _context19.next = 12;
6809
6680
  break;
6810
6681
  }
6811
6682
 
6812
6683
  payload.message_filter_conditions = query;
6813
- _context20.next = 13;
6684
+ _context19.next = 13;
6814
6685
  break;
6815
6686
 
6816
6687
  case 12:
6817
6688
  throw Error("Invalid type ".concat(_typeof(query), " for query parameter"));
6818
6689
 
6819
6690
  case 13:
6820
- _context20.next = 15;
6691
+ _context19.next = 15;
6821
6692
  return this.setUserPromise;
6822
6693
 
6823
6694
  case 15:
6824
- _context20.next = 17;
6695
+ _context19.next = 17;
6825
6696
  return this.get(this.baseURL + '/search', {
6826
6697
  payload: payload
6827
6698
  });
6828
6699
 
6829
6700
  case 17:
6830
- return _context20.abrupt("return", _context20.sent);
6701
+ return _context19.abrupt("return", _context19.sent);
6831
6702
 
6832
6703
  case 18:
6833
6704
  case "end":
6834
- return _context20.stop();
6705
+ return _context19.stop();
6835
6706
  }
6836
6707
  }
6837
- }, _callee20, this);
6708
+ }, _callee19, this);
6838
6709
  }));
6839
6710
 
6840
- function search(_x19, _x20) {
6711
+ function search(_x17, _x18) {
6841
6712
  return _search.apply(this, arguments);
6842
6713
  }
6843
6714
 
@@ -6848,7 +6719,7 @@ var StreamChat = /*#__PURE__*/function () {
6848
6719
  *
6849
6720
  * @param {BaseDeviceFields} device the device object
6850
6721
  * @param {string} device.id device id
6851
- * @param {string} device.push_provider the push provider (apn or firebase)
6722
+ * @param {string} device.push_provider the push provider
6852
6723
  *
6853
6724
  */
6854
6725
 
@@ -6865,7 +6736,7 @@ var StreamChat = /*#__PURE__*/function () {
6865
6736
  * addDevice - Adds a push device for a user.
6866
6737
  *
6867
6738
  * @param {string} id the device id
6868
- * @param {'apn' | 'firebase'} push_provider the push provider (apn or firebase)
6739
+ * @param {PushProvider} push_provider the push provider
6869
6740
  * @param {string} [userID] the user id (defaults to current user)
6870
6741
  *
6871
6742
  */
@@ -6873,12 +6744,12 @@ var StreamChat = /*#__PURE__*/function () {
6873
6744
  }, {
6874
6745
  key: "addDevice",
6875
6746
  value: function () {
6876
- var _addDevice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(id, push_provider, userID) {
6877
- return _regeneratorRuntime.wrap(function _callee21$(_context21) {
6747
+ var _addDevice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(id, push_provider, userID) {
6748
+ return _regeneratorRuntime.wrap(function _callee20$(_context20) {
6878
6749
  while (1) {
6879
- switch (_context21.prev = _context21.next) {
6750
+ switch (_context20.prev = _context20.next) {
6880
6751
  case 0:
6881
- _context21.next = 2;
6752
+ _context20.next = 2;
6882
6753
  return this.post(this.baseURL + '/devices', _objectSpread({
6883
6754
  id: id,
6884
6755
  push_provider: push_provider
@@ -6887,17 +6758,17 @@ var StreamChat = /*#__PURE__*/function () {
6887
6758
  } : {}));
6888
6759
 
6889
6760
  case 2:
6890
- return _context21.abrupt("return", _context21.sent);
6761
+ return _context20.abrupt("return", _context20.sent);
6891
6762
 
6892
6763
  case 3:
6893
6764
  case "end":
6894
- return _context21.stop();
6765
+ return _context20.stop();
6895
6766
  }
6896
6767
  }
6897
- }, _callee21, this);
6768
+ }, _callee20, this);
6898
6769
  }));
6899
6770
 
6900
- function addDevice(_x21, _x22, _x23) {
6771
+ function addDevice(_x19, _x20, _x21) {
6901
6772
  return _addDevice.apply(this, arguments);
6902
6773
  }
6903
6774
 
@@ -6914,28 +6785,28 @@ var StreamChat = /*#__PURE__*/function () {
6914
6785
  }, {
6915
6786
  key: "getDevices",
6916
6787
  value: function () {
6917
- var _getDevices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(userID) {
6918
- return _regeneratorRuntime.wrap(function _callee22$(_context22) {
6788
+ var _getDevices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(userID) {
6789
+ return _regeneratorRuntime.wrap(function _callee21$(_context21) {
6919
6790
  while (1) {
6920
- switch (_context22.prev = _context22.next) {
6791
+ switch (_context21.prev = _context21.next) {
6921
6792
  case 0:
6922
- _context22.next = 2;
6793
+ _context21.next = 2;
6923
6794
  return this.get(this.baseURL + '/devices', userID ? {
6924
6795
  user_id: userID
6925
6796
  } : {});
6926
6797
 
6927
6798
  case 2:
6928
- return _context22.abrupt("return", _context22.sent);
6799
+ return _context21.abrupt("return", _context21.sent);
6929
6800
 
6930
6801
  case 3:
6931
6802
  case "end":
6932
- return _context22.stop();
6803
+ return _context21.stop();
6933
6804
  }
6934
6805
  }
6935
- }, _callee22, this);
6806
+ }, _callee21, this);
6936
6807
  }));
6937
6808
 
6938
- function getDevices(_x24) {
6809
+ function getDevices(_x22) {
6939
6810
  return _getDevices.apply(this, arguments);
6940
6811
  }
6941
6812
 
@@ -6952,12 +6823,12 @@ var StreamChat = /*#__PURE__*/function () {
6952
6823
  }, {
6953
6824
  key: "removeDevice",
6954
6825
  value: function () {
6955
- var _removeDevice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(id, userID) {
6956
- return _regeneratorRuntime.wrap(function _callee23$(_context23) {
6826
+ var _removeDevice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(id, userID) {
6827
+ return _regeneratorRuntime.wrap(function _callee22$(_context22) {
6957
6828
  while (1) {
6958
- switch (_context23.prev = _context23.next) {
6829
+ switch (_context22.prev = _context22.next) {
6959
6830
  case 0:
6960
- _context23.next = 2;
6831
+ _context22.next = 2;
6961
6832
  return this.delete(this.baseURL + '/devices', _objectSpread({
6962
6833
  id: id
6963
6834
  }, userID ? {
@@ -6965,17 +6836,17 @@ var StreamChat = /*#__PURE__*/function () {
6965
6836
  } : {}));
6966
6837
 
6967
6838
  case 2:
6968
- return _context23.abrupt("return", _context23.sent);
6839
+ return _context22.abrupt("return", _context22.sent);
6969
6840
 
6970
6841
  case 3:
6971
6842
  case "end":
6972
- return _context23.stop();
6843
+ return _context22.stop();
6973
6844
  }
6974
6845
  }
6975
- }, _callee23, this);
6846
+ }, _callee22, this);
6976
6847
  }));
6977
6848
 
6978
- function removeDevice(_x25, _x26) {
6849
+ function removeDevice(_x23, _x24) {
6979
6850
  return _removeDevice.apply(this, arguments);
6980
6851
  }
6981
6852
 
@@ -6992,15 +6863,15 @@ var StreamChat = /*#__PURE__*/function () {
6992
6863
  }, {
6993
6864
  key: "getRateLimits",
6994
6865
  value: function () {
6995
- var _getRateLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(params) {
6866
+ var _getRateLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(params) {
6996
6867
  var _ref6, serverSide, web, android, ios, endpoints;
6997
6868
 
6998
- return _regeneratorRuntime.wrap(function _callee24$(_context24) {
6869
+ return _regeneratorRuntime.wrap(function _callee23$(_context23) {
6999
6870
  while (1) {
7000
- switch (_context24.prev = _context24.next) {
6871
+ switch (_context23.prev = _context23.next) {
7001
6872
  case 0:
7002
6873
  _ref6 = params || {}, serverSide = _ref6.serverSide, web = _ref6.web, android = _ref6.android, ios = _ref6.ios, endpoints = _ref6.endpoints;
7003
- return _context24.abrupt("return", this.get(this.baseURL + '/rate_limits', {
6874
+ return _context23.abrupt("return", this.get(this.baseURL + '/rate_limits', {
7004
6875
  server_side: serverSide,
7005
6876
  web: web,
7006
6877
  android: android,
@@ -7010,13 +6881,13 @@ var StreamChat = /*#__PURE__*/function () {
7010
6881
 
7011
6882
  case 2:
7012
6883
  case "end":
7013
- return _context24.stop();
6884
+ return _context23.stop();
7014
6885
  }
7015
6886
  }
7016
- }, _callee24, this);
6887
+ }, _callee23, this);
7017
6888
  }));
7018
6889
 
7019
- function getRateLimits(_x27) {
6890
+ function getRateLimits(_x25) {
7020
6891
  return _getRateLimits.apply(this, arguments);
7021
6892
  }
7022
6893
 
@@ -7098,26 +6969,26 @@ var StreamChat = /*#__PURE__*/function () {
7098
6969
  * @return {Promise<APIResponse & { users: { [key: string]: UserResponse<UserType> } }>} list of updated users
7099
6970
  */
7100
6971
  function () {
7101
- var _partialUpdateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(partialUserObject) {
7102
- return _regeneratorRuntime.wrap(function _callee25$(_context25) {
6972
+ var _partialUpdateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(partialUserObject) {
6973
+ return _regeneratorRuntime.wrap(function _callee24$(_context24) {
7103
6974
  while (1) {
7104
- switch (_context25.prev = _context25.next) {
6975
+ switch (_context24.prev = _context24.next) {
7105
6976
  case 0:
7106
- _context25.next = 2;
6977
+ _context24.next = 2;
7107
6978
  return this.partialUpdateUsers([partialUserObject]);
7108
6979
 
7109
6980
  case 2:
7110
- return _context25.abrupt("return", _context25.sent);
6981
+ return _context24.abrupt("return", _context24.sent);
7111
6982
 
7112
6983
  case 3:
7113
6984
  case "end":
7114
- return _context25.stop();
6985
+ return _context24.stop();
7115
6986
  }
7116
6987
  }
7117
- }, _callee25, this);
6988
+ }, _callee24, this);
7118
6989
  }));
7119
6990
 
7120
- function partialUpdateUser(_x28) {
6991
+ function partialUpdateUser(_x26) {
7121
6992
  return _partialUpdateUser.apply(this, arguments);
7122
6993
  }
7123
6994
 
@@ -7134,29 +7005,29 @@ var StreamChat = /*#__PURE__*/function () {
7134
7005
  }, {
7135
7006
  key: "upsertUsers",
7136
7007
  value: function () {
7137
- var _upsertUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(users) {
7138
- var userMap, _iterator5, _step5, userObject;
7008
+ var _upsertUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(users) {
7009
+ var userMap, _iterator4, _step4, userObject;
7139
7010
 
7140
- return _regeneratorRuntime.wrap(function _callee26$(_context26) {
7011
+ return _regeneratorRuntime.wrap(function _callee25$(_context25) {
7141
7012
  while (1) {
7142
- switch (_context26.prev = _context26.next) {
7013
+ switch (_context25.prev = _context25.next) {
7143
7014
  case 0:
7144
7015
  userMap = {};
7145
- _iterator5 = _createForOfIteratorHelper(users);
7146
- _context26.prev = 2;
7016
+ _iterator4 = _createForOfIteratorHelper(users);
7017
+ _context25.prev = 2;
7147
7018
 
7148
- _iterator5.s();
7019
+ _iterator4.s();
7149
7020
 
7150
7021
  case 4:
7151
- if ((_step5 = _iterator5.n()).done) {
7152
- _context26.next = 11;
7022
+ if ((_step4 = _iterator4.n()).done) {
7023
+ _context25.next = 11;
7153
7024
  break;
7154
7025
  }
7155
7026
 
7156
- userObject = _step5.value;
7027
+ userObject = _step4.value;
7157
7028
 
7158
7029
  if (userObject.id) {
7159
- _context26.next = 8;
7030
+ _context25.next = 8;
7160
7031
  break;
7161
7032
  }
7162
7033
 
@@ -7166,44 +7037,44 @@ var StreamChat = /*#__PURE__*/function () {
7166
7037
  userMap[userObject.id] = userObject;
7167
7038
 
7168
7039
  case 9:
7169
- _context26.next = 4;
7040
+ _context25.next = 4;
7170
7041
  break;
7171
7042
 
7172
7043
  case 11:
7173
- _context26.next = 16;
7044
+ _context25.next = 16;
7174
7045
  break;
7175
7046
 
7176
7047
  case 13:
7177
- _context26.prev = 13;
7178
- _context26.t0 = _context26["catch"](2);
7048
+ _context25.prev = 13;
7049
+ _context25.t0 = _context25["catch"](2);
7179
7050
 
7180
- _iterator5.e(_context26.t0);
7051
+ _iterator4.e(_context25.t0);
7181
7052
 
7182
7053
  case 16:
7183
- _context26.prev = 16;
7054
+ _context25.prev = 16;
7184
7055
 
7185
- _iterator5.f();
7056
+ _iterator4.f();
7186
7057
 
7187
- return _context26.finish(16);
7058
+ return _context25.finish(16);
7188
7059
 
7189
7060
  case 19:
7190
- _context26.next = 21;
7061
+ _context25.next = 21;
7191
7062
  return this.post(this.baseURL + '/users', {
7192
7063
  users: userMap
7193
7064
  });
7194
7065
 
7195
7066
  case 21:
7196
- return _context26.abrupt("return", _context26.sent);
7067
+ return _context25.abrupt("return", _context25.sent);
7197
7068
 
7198
7069
  case 22:
7199
7070
  case "end":
7200
- return _context26.stop();
7071
+ return _context25.stop();
7201
7072
  }
7202
7073
  }
7203
- }, _callee26, this, [[2, 13, 16, 19]]);
7074
+ }, _callee25, this, [[2, 13, 16, 19]]);
7204
7075
  }));
7205
7076
 
7206
- function upsertUsers(_x29) {
7077
+ function upsertUsers(_x27) {
7207
7078
  return _upsertUsers.apply(this, arguments);
7208
7079
  }
7209
7080
 
@@ -7251,72 +7122,72 @@ var StreamChat = /*#__PURE__*/function () {
7251
7122
  * @return {Promise<APIResponse & { users: { [key: string]: UserResponse<UserType> } }>}
7252
7123
  */
7253
7124
  function () {
7254
- var _partialUpdateUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(users) {
7255
- var _iterator6, _step6, userObject;
7125
+ var _partialUpdateUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(users) {
7126
+ var _iterator5, _step5, userObject;
7256
7127
 
7257
- return _regeneratorRuntime.wrap(function _callee27$(_context27) {
7128
+ return _regeneratorRuntime.wrap(function _callee26$(_context26) {
7258
7129
  while (1) {
7259
- switch (_context27.prev = _context27.next) {
7130
+ switch (_context26.prev = _context26.next) {
7260
7131
  case 0:
7261
- _iterator6 = _createForOfIteratorHelper(users);
7262
- _context27.prev = 1;
7132
+ _iterator5 = _createForOfIteratorHelper(users);
7133
+ _context26.prev = 1;
7263
7134
 
7264
- _iterator6.s();
7135
+ _iterator5.s();
7265
7136
 
7266
7137
  case 3:
7267
- if ((_step6 = _iterator6.n()).done) {
7268
- _context27.next = 9;
7138
+ if ((_step5 = _iterator5.n()).done) {
7139
+ _context26.next = 9;
7269
7140
  break;
7270
7141
  }
7271
7142
 
7272
- userObject = _step6.value;
7143
+ userObject = _step5.value;
7273
7144
 
7274
7145
  if (userObject.id) {
7275
- _context27.next = 7;
7146
+ _context26.next = 7;
7276
7147
  break;
7277
7148
  }
7278
7149
 
7279
7150
  throw Error('User ID is required when updating a user');
7280
7151
 
7281
7152
  case 7:
7282
- _context27.next = 3;
7153
+ _context26.next = 3;
7283
7154
  break;
7284
7155
 
7285
7156
  case 9:
7286
- _context27.next = 14;
7157
+ _context26.next = 14;
7287
7158
  break;
7288
7159
 
7289
7160
  case 11:
7290
- _context27.prev = 11;
7291
- _context27.t0 = _context27["catch"](1);
7161
+ _context26.prev = 11;
7162
+ _context26.t0 = _context26["catch"](1);
7292
7163
 
7293
- _iterator6.e(_context27.t0);
7164
+ _iterator5.e(_context26.t0);
7294
7165
 
7295
7166
  case 14:
7296
- _context27.prev = 14;
7167
+ _context26.prev = 14;
7297
7168
 
7298
- _iterator6.f();
7169
+ _iterator5.f();
7299
7170
 
7300
- return _context27.finish(14);
7171
+ return _context26.finish(14);
7301
7172
 
7302
7173
  case 17:
7303
- _context27.next = 19;
7174
+ _context26.next = 19;
7304
7175
  return this.patch(this.baseURL + '/users', {
7305
7176
  users: users
7306
7177
  });
7307
7178
 
7308
7179
  case 19:
7309
- return _context27.abrupt("return", _context27.sent);
7180
+ return _context26.abrupt("return", _context26.sent);
7310
7181
 
7311
7182
  case 20:
7312
7183
  case "end":
7313
- return _context27.stop();
7184
+ return _context26.stop();
7314
7185
  }
7315
7186
  }
7316
- }, _callee27, this, [[1, 11, 14, 17]]);
7187
+ }, _callee26, this, [[1, 11, 14, 17]]);
7317
7188
  }));
7318
7189
 
7319
- function partialUpdateUsers(_x30) {
7190
+ function partialUpdateUsers(_x28) {
7320
7191
  return _partialUpdateUsers.apply(this, arguments);
7321
7192
  }
7322
7193
 
@@ -7325,26 +7196,26 @@ var StreamChat = /*#__PURE__*/function () {
7325
7196
  }, {
7326
7197
  key: "deleteUser",
7327
7198
  value: function () {
7328
- var _deleteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28(userID, params) {
7329
- return _regeneratorRuntime.wrap(function _callee28$(_context28) {
7199
+ var _deleteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(userID, params) {
7200
+ return _regeneratorRuntime.wrap(function _callee27$(_context27) {
7330
7201
  while (1) {
7331
- switch (_context28.prev = _context28.next) {
7202
+ switch (_context27.prev = _context27.next) {
7332
7203
  case 0:
7333
- _context28.next = 2;
7204
+ _context27.next = 2;
7334
7205
  return this.delete(this.baseURL + "/users/".concat(userID), params);
7335
7206
 
7336
7207
  case 2:
7337
- return _context28.abrupt("return", _context28.sent);
7208
+ return _context27.abrupt("return", _context27.sent);
7338
7209
 
7339
7210
  case 3:
7340
7211
  case "end":
7341
- return _context28.stop();
7212
+ return _context27.stop();
7342
7213
  }
7343
7214
  }
7344
- }, _callee28, this);
7215
+ }, _callee27, this);
7345
7216
  }));
7346
7217
 
7347
- function deleteUser(_x31, _x32) {
7218
+ function deleteUser(_x29, _x30) {
7348
7219
  return _deleteUser.apply(this, arguments);
7349
7220
  }
7350
7221
 
@@ -7353,26 +7224,26 @@ var StreamChat = /*#__PURE__*/function () {
7353
7224
  }, {
7354
7225
  key: "reactivateUser",
7355
7226
  value: function () {
7356
- var _reactivateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(userID, options) {
7357
- return _regeneratorRuntime.wrap(function _callee29$(_context29) {
7227
+ var _reactivateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28(userID, options) {
7228
+ return _regeneratorRuntime.wrap(function _callee28$(_context28) {
7358
7229
  while (1) {
7359
- switch (_context29.prev = _context29.next) {
7230
+ switch (_context28.prev = _context28.next) {
7360
7231
  case 0:
7361
- _context29.next = 2;
7232
+ _context28.next = 2;
7362
7233
  return this.post(this.baseURL + "/users/".concat(userID, "/reactivate"), _objectSpread({}, options));
7363
7234
 
7364
7235
  case 2:
7365
- return _context29.abrupt("return", _context29.sent);
7236
+ return _context28.abrupt("return", _context28.sent);
7366
7237
 
7367
7238
  case 3:
7368
7239
  case "end":
7369
- return _context29.stop();
7240
+ return _context28.stop();
7370
7241
  }
7371
7242
  }
7372
- }, _callee29, this);
7243
+ }, _callee28, this);
7373
7244
  }));
7374
7245
 
7375
- function reactivateUser(_x33, _x34) {
7246
+ function reactivateUser(_x31, _x32) {
7376
7247
  return _reactivateUser.apply(this, arguments);
7377
7248
  }
7378
7249
 
@@ -7381,26 +7252,26 @@ var StreamChat = /*#__PURE__*/function () {
7381
7252
  }, {
7382
7253
  key: "deactivateUser",
7383
7254
  value: function () {
7384
- var _deactivateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(userID, options) {
7385
- return _regeneratorRuntime.wrap(function _callee30$(_context30) {
7255
+ var _deactivateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(userID, options) {
7256
+ return _regeneratorRuntime.wrap(function _callee29$(_context29) {
7386
7257
  while (1) {
7387
- switch (_context30.prev = _context30.next) {
7258
+ switch (_context29.prev = _context29.next) {
7388
7259
  case 0:
7389
- _context30.next = 2;
7260
+ _context29.next = 2;
7390
7261
  return this.post(this.baseURL + "/users/".concat(userID, "/deactivate"), _objectSpread({}, options));
7391
7262
 
7392
7263
  case 2:
7393
- return _context30.abrupt("return", _context30.sent);
7264
+ return _context29.abrupt("return", _context29.sent);
7394
7265
 
7395
7266
  case 3:
7396
7267
  case "end":
7397
- return _context30.stop();
7268
+ return _context29.stop();
7398
7269
  }
7399
7270
  }
7400
- }, _callee30, this);
7271
+ }, _callee29, this);
7401
7272
  }));
7402
7273
 
7403
- function deactivateUser(_x35, _x36) {
7274
+ function deactivateUser(_x33, _x34) {
7404
7275
  return _deactivateUser.apply(this, arguments);
7405
7276
  }
7406
7277
 
@@ -7409,26 +7280,26 @@ var StreamChat = /*#__PURE__*/function () {
7409
7280
  }, {
7410
7281
  key: "exportUser",
7411
7282
  value: function () {
7412
- var _exportUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31(userID, options) {
7413
- return _regeneratorRuntime.wrap(function _callee31$(_context31) {
7283
+ var _exportUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(userID, options) {
7284
+ return _regeneratorRuntime.wrap(function _callee30$(_context30) {
7414
7285
  while (1) {
7415
- switch (_context31.prev = _context31.next) {
7286
+ switch (_context30.prev = _context30.next) {
7416
7287
  case 0:
7417
- _context31.next = 2;
7288
+ _context30.next = 2;
7418
7289
  return this.get(this.baseURL + "/users/".concat(userID, "/export"), _objectSpread({}, options));
7419
7290
 
7420
7291
  case 2:
7421
- return _context31.abrupt("return", _context31.sent);
7292
+ return _context30.abrupt("return", _context30.sent);
7422
7293
 
7423
7294
  case 3:
7424
7295
  case "end":
7425
- return _context31.stop();
7296
+ return _context30.stop();
7426
7297
  }
7427
7298
  }
7428
- }, _callee31, this);
7299
+ }, _callee30, this);
7429
7300
  }));
7430
7301
 
7431
- function exportUser(_x37, _x38) {
7302
+ function exportUser(_x35, _x36) {
7432
7303
  return _exportUser.apply(this, arguments);
7433
7304
  }
7434
7305
 
@@ -7444,10 +7315,10 @@ var StreamChat = /*#__PURE__*/function () {
7444
7315
  }, {
7445
7316
  key: "banUser",
7446
7317
  value: function () {
7447
- var _banUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(targetUserID, options) {
7448
- return _regeneratorRuntime.wrap(function _callee32$(_context32) {
7318
+ var _banUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31(targetUserID, options) {
7319
+ return _regeneratorRuntime.wrap(function _callee31$(_context31) {
7449
7320
  while (1) {
7450
- switch (_context32.prev = _context32.next) {
7321
+ switch (_context31.prev = _context31.next) {
7451
7322
  case 0:
7452
7323
  if ((options === null || options === void 0 ? void 0 : options.user_id) !== undefined) {
7453
7324
  options.banned_by_id = options.user_id;
@@ -7461,23 +7332,23 @@ var StreamChat = /*#__PURE__*/function () {
7461
7332
  console.warn("banUser: 'user' is deprecated, please consider switching to 'banned_by'");
7462
7333
  }
7463
7334
 
7464
- _context32.next = 4;
7335
+ _context31.next = 4;
7465
7336
  return this.post(this.baseURL + '/moderation/ban', _objectSpread({
7466
7337
  target_user_id: targetUserID
7467
7338
  }, options));
7468
7339
 
7469
7340
  case 4:
7470
- return _context32.abrupt("return", _context32.sent);
7341
+ return _context31.abrupt("return", _context31.sent);
7471
7342
 
7472
7343
  case 5:
7473
7344
  case "end":
7474
- return _context32.stop();
7345
+ return _context31.stop();
7475
7346
  }
7476
7347
  }
7477
- }, _callee32, this);
7348
+ }, _callee31, this);
7478
7349
  }));
7479
7350
 
7480
- function banUser(_x39, _x40) {
7351
+ function banUser(_x37, _x38) {
7481
7352
  return _banUser.apply(this, arguments);
7482
7353
  }
7483
7354
 
@@ -7493,28 +7364,28 @@ var StreamChat = /*#__PURE__*/function () {
7493
7364
  }, {
7494
7365
  key: "unbanUser",
7495
7366
  value: function () {
7496
- var _unbanUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33(targetUserID, options) {
7497
- return _regeneratorRuntime.wrap(function _callee33$(_context33) {
7367
+ var _unbanUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(targetUserID, options) {
7368
+ return _regeneratorRuntime.wrap(function _callee32$(_context32) {
7498
7369
  while (1) {
7499
- switch (_context33.prev = _context33.next) {
7370
+ switch (_context32.prev = _context32.next) {
7500
7371
  case 0:
7501
- _context33.next = 2;
7372
+ _context32.next = 2;
7502
7373
  return this.delete(this.baseURL + '/moderation/ban', _objectSpread({
7503
7374
  target_user_id: targetUserID
7504
7375
  }, options));
7505
7376
 
7506
7377
  case 2:
7507
- return _context33.abrupt("return", _context33.sent);
7378
+ return _context32.abrupt("return", _context32.sent);
7508
7379
 
7509
7380
  case 3:
7510
7381
  case "end":
7511
- return _context33.stop();
7382
+ return _context32.stop();
7512
7383
  }
7513
7384
  }
7514
- }, _callee33, this);
7385
+ }, _callee32, this);
7515
7386
  }));
7516
7387
 
7517
- function unbanUser(_x41, _x42) {
7388
+ function unbanUser(_x39, _x40) {
7518
7389
  return _unbanUser.apply(this, arguments);
7519
7390
  }
7520
7391
 
@@ -7530,28 +7401,28 @@ var StreamChat = /*#__PURE__*/function () {
7530
7401
  }, {
7531
7402
  key: "shadowBan",
7532
7403
  value: function () {
7533
- var _shadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee34(targetUserID, options) {
7534
- return _regeneratorRuntime.wrap(function _callee34$(_context34) {
7404
+ var _shadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33(targetUserID, options) {
7405
+ return _regeneratorRuntime.wrap(function _callee33$(_context33) {
7535
7406
  while (1) {
7536
- switch (_context34.prev = _context34.next) {
7407
+ switch (_context33.prev = _context33.next) {
7537
7408
  case 0:
7538
- _context34.next = 2;
7409
+ _context33.next = 2;
7539
7410
  return this.banUser(targetUserID, _objectSpread({
7540
7411
  shadow: true
7541
7412
  }, options));
7542
7413
 
7543
7414
  case 2:
7544
- return _context34.abrupt("return", _context34.sent);
7415
+ return _context33.abrupt("return", _context33.sent);
7545
7416
 
7546
7417
  case 3:
7547
7418
  case "end":
7548
- return _context34.stop();
7419
+ return _context33.stop();
7549
7420
  }
7550
7421
  }
7551
- }, _callee34, this);
7422
+ }, _callee33, this);
7552
7423
  }));
7553
7424
 
7554
- function shadowBan(_x43, _x44) {
7425
+ function shadowBan(_x41, _x42) {
7555
7426
  return _shadowBan.apply(this, arguments);
7556
7427
  }
7557
7428
 
@@ -7567,28 +7438,28 @@ var StreamChat = /*#__PURE__*/function () {
7567
7438
  }, {
7568
7439
  key: "removeShadowBan",
7569
7440
  value: function () {
7570
- var _removeShadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee35(targetUserID, options) {
7571
- return _regeneratorRuntime.wrap(function _callee35$(_context35) {
7441
+ var _removeShadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee34(targetUserID, options) {
7442
+ return _regeneratorRuntime.wrap(function _callee34$(_context34) {
7572
7443
  while (1) {
7573
- switch (_context35.prev = _context35.next) {
7444
+ switch (_context34.prev = _context34.next) {
7574
7445
  case 0:
7575
- _context35.next = 2;
7446
+ _context34.next = 2;
7576
7447
  return this.unbanUser(targetUserID, _objectSpread({
7577
7448
  shadow: true
7578
7449
  }, options));
7579
7450
 
7580
7451
  case 2:
7581
- return _context35.abrupt("return", _context35.sent);
7452
+ return _context34.abrupt("return", _context34.sent);
7582
7453
 
7583
7454
  case 3:
7584
7455
  case "end":
7585
- return _context35.stop();
7456
+ return _context34.stop();
7586
7457
  }
7587
7458
  }
7588
- }, _callee35, this);
7459
+ }, _callee34, this);
7589
7460
  }));
7590
7461
 
7591
- function removeShadowBan(_x45, _x46) {
7462
+ function removeShadowBan(_x43, _x44) {
7592
7463
  return _removeShadowBan.apply(this, arguments);
7593
7464
  }
7594
7465
 
@@ -7605,15 +7476,15 @@ var StreamChat = /*#__PURE__*/function () {
7605
7476
  }, {
7606
7477
  key: "muteUser",
7607
7478
  value: function () {
7608
- var _muteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee36(targetID, userID) {
7479
+ var _muteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee35(targetID, userID) {
7609
7480
  var options,
7610
- _args36 = arguments;
7611
- return _regeneratorRuntime.wrap(function _callee36$(_context36) {
7481
+ _args35 = arguments;
7482
+ return _regeneratorRuntime.wrap(function _callee35$(_context35) {
7612
7483
  while (1) {
7613
- switch (_context36.prev = _context36.next) {
7484
+ switch (_context35.prev = _context35.next) {
7614
7485
  case 0:
7615
- options = _args36.length > 2 && _args36[2] !== undefined ? _args36[2] : {};
7616
- _context36.next = 3;
7486
+ options = _args35.length > 2 && _args35[2] !== undefined ? _args35[2] : {};
7487
+ _context35.next = 3;
7617
7488
  return this.post(this.baseURL + '/moderation/mute', _objectSpread(_objectSpread({
7618
7489
  target_id: targetID
7619
7490
  }, userID ? {
@@ -7621,17 +7492,17 @@ var StreamChat = /*#__PURE__*/function () {
7621
7492
  } : {}), options));
7622
7493
 
7623
7494
  case 3:
7624
- return _context36.abrupt("return", _context36.sent);
7495
+ return _context35.abrupt("return", _context35.sent);
7625
7496
 
7626
7497
  case 4:
7627
7498
  case "end":
7628
- return _context36.stop();
7499
+ return _context35.stop();
7629
7500
  }
7630
7501
  }
7631
- }, _callee36, this);
7502
+ }, _callee35, this);
7632
7503
  }));
7633
7504
 
7634
- function muteUser(_x47, _x48) {
7505
+ function muteUser(_x45, _x46) {
7635
7506
  return _muteUser.apply(this, arguments);
7636
7507
  }
7637
7508
 
@@ -7647,12 +7518,12 @@ var StreamChat = /*#__PURE__*/function () {
7647
7518
  }, {
7648
7519
  key: "unmuteUser",
7649
7520
  value: function () {
7650
- var _unmuteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee37(targetID, currentUserID) {
7651
- return _regeneratorRuntime.wrap(function _callee37$(_context37) {
7521
+ var _unmuteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee36(targetID, currentUserID) {
7522
+ return _regeneratorRuntime.wrap(function _callee36$(_context36) {
7652
7523
  while (1) {
7653
- switch (_context37.prev = _context37.next) {
7524
+ switch (_context36.prev = _context36.next) {
7654
7525
  case 0:
7655
- _context37.next = 2;
7526
+ _context36.next = 2;
7656
7527
  return this.post(this.baseURL + '/moderation/unmute', _objectSpread({
7657
7528
  target_id: targetID
7658
7529
  }, currentUserID ? {
@@ -7660,17 +7531,17 @@ var StreamChat = /*#__PURE__*/function () {
7660
7531
  } : {}));
7661
7532
 
7662
7533
  case 2:
7663
- return _context37.abrupt("return", _context37.sent);
7534
+ return _context36.abrupt("return", _context36.sent);
7664
7535
 
7665
7536
  case 3:
7666
7537
  case "end":
7667
- return _context37.stop();
7538
+ return _context36.stop();
7668
7539
  }
7669
7540
  }
7670
- }, _callee37, this);
7541
+ }, _callee36, this);
7671
7542
  }));
7672
7543
 
7673
- function unmuteUser(_x49, _x50) {
7544
+ function unmuteUser(_x47, _x48) {
7674
7545
  return _unmuteUser.apply(this, arguments);
7675
7546
  }
7676
7547
 
@@ -7705,31 +7576,31 @@ var StreamChat = /*#__PURE__*/function () {
7705
7576
  }, {
7706
7577
  key: "flagMessage",
7707
7578
  value: function () {
7708
- var _flagMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee38(targetMessageID) {
7579
+ var _flagMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee37(targetMessageID) {
7709
7580
  var options,
7710
- _args38 = arguments;
7711
- return _regeneratorRuntime.wrap(function _callee38$(_context38) {
7581
+ _args37 = arguments;
7582
+ return _regeneratorRuntime.wrap(function _callee37$(_context37) {
7712
7583
  while (1) {
7713
- switch (_context38.prev = _context38.next) {
7584
+ switch (_context37.prev = _context37.next) {
7714
7585
  case 0:
7715
- options = _args38.length > 1 && _args38[1] !== undefined ? _args38[1] : {};
7716
- _context38.next = 3;
7586
+ options = _args37.length > 1 && _args37[1] !== undefined ? _args37[1] : {};
7587
+ _context37.next = 3;
7717
7588
  return this.post(this.baseURL + '/moderation/flag', _objectSpread({
7718
7589
  target_message_id: targetMessageID
7719
7590
  }, options));
7720
7591
 
7721
7592
  case 3:
7722
- return _context38.abrupt("return", _context38.sent);
7593
+ return _context37.abrupt("return", _context37.sent);
7723
7594
 
7724
7595
  case 4:
7725
7596
  case "end":
7726
- return _context38.stop();
7597
+ return _context37.stop();
7727
7598
  }
7728
7599
  }
7729
- }, _callee38, this);
7600
+ }, _callee37, this);
7730
7601
  }));
7731
7602
 
7732
- function flagMessage(_x51) {
7603
+ function flagMessage(_x49) {
7733
7604
  return _flagMessage.apply(this, arguments);
7734
7605
  }
7735
7606
 
@@ -7745,31 +7616,31 @@ var StreamChat = /*#__PURE__*/function () {
7745
7616
  }, {
7746
7617
  key: "flagUser",
7747
7618
  value: function () {
7748
- var _flagUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee39(targetID) {
7619
+ var _flagUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee38(targetID) {
7749
7620
  var options,
7750
- _args39 = arguments;
7751
- return _regeneratorRuntime.wrap(function _callee39$(_context39) {
7621
+ _args38 = arguments;
7622
+ return _regeneratorRuntime.wrap(function _callee38$(_context38) {
7752
7623
  while (1) {
7753
- switch (_context39.prev = _context39.next) {
7624
+ switch (_context38.prev = _context38.next) {
7754
7625
  case 0:
7755
- options = _args39.length > 1 && _args39[1] !== undefined ? _args39[1] : {};
7756
- _context39.next = 3;
7626
+ options = _args38.length > 1 && _args38[1] !== undefined ? _args38[1] : {};
7627
+ _context38.next = 3;
7757
7628
  return this.post(this.baseURL + '/moderation/flag', _objectSpread({
7758
7629
  target_user_id: targetID
7759
7630
  }, options));
7760
7631
 
7761
7632
  case 3:
7762
- return _context39.abrupt("return", _context39.sent);
7633
+ return _context38.abrupt("return", _context38.sent);
7763
7634
 
7764
7635
  case 4:
7765
7636
  case "end":
7766
- return _context39.stop();
7637
+ return _context38.stop();
7767
7638
  }
7768
7639
  }
7769
- }, _callee39, this);
7640
+ }, _callee38, this);
7770
7641
  }));
7771
7642
 
7772
- function flagUser(_x52) {
7643
+ function flagUser(_x50) {
7773
7644
  return _flagUser.apply(this, arguments);
7774
7645
  }
7775
7646
 
@@ -7785,31 +7656,31 @@ var StreamChat = /*#__PURE__*/function () {
7785
7656
  }, {
7786
7657
  key: "unflagMessage",
7787
7658
  value: function () {
7788
- var _unflagMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee40(targetMessageID) {
7659
+ var _unflagMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee39(targetMessageID) {
7789
7660
  var options,
7790
- _args40 = arguments;
7791
- return _regeneratorRuntime.wrap(function _callee40$(_context40) {
7661
+ _args39 = arguments;
7662
+ return _regeneratorRuntime.wrap(function _callee39$(_context39) {
7792
7663
  while (1) {
7793
- switch (_context40.prev = _context40.next) {
7664
+ switch (_context39.prev = _context39.next) {
7794
7665
  case 0:
7795
- options = _args40.length > 1 && _args40[1] !== undefined ? _args40[1] : {};
7796
- _context40.next = 3;
7666
+ options = _args39.length > 1 && _args39[1] !== undefined ? _args39[1] : {};
7667
+ _context39.next = 3;
7797
7668
  return this.post(this.baseURL + '/moderation/unflag', _objectSpread({
7798
7669
  target_message_id: targetMessageID
7799
7670
  }, options));
7800
7671
 
7801
7672
  case 3:
7802
- return _context40.abrupt("return", _context40.sent);
7673
+ return _context39.abrupt("return", _context39.sent);
7803
7674
 
7804
7675
  case 4:
7805
7676
  case "end":
7806
- return _context40.stop();
7677
+ return _context39.stop();
7807
7678
  }
7808
7679
  }
7809
- }, _callee40, this);
7680
+ }, _callee39, this);
7810
7681
  }));
7811
7682
 
7812
- function unflagMessage(_x53) {
7683
+ function unflagMessage(_x51) {
7813
7684
  return _unflagMessage.apply(this, arguments);
7814
7685
  }
7815
7686
 
@@ -7825,37 +7696,39 @@ var StreamChat = /*#__PURE__*/function () {
7825
7696
  }, {
7826
7697
  key: "unflagUser",
7827
7698
  value: function () {
7828
- var _unflagUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41(targetID) {
7699
+ var _unflagUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee40(targetID) {
7829
7700
  var options,
7830
- _args41 = arguments;
7831
- return _regeneratorRuntime.wrap(function _callee41$(_context41) {
7701
+ _args40 = arguments;
7702
+ return _regeneratorRuntime.wrap(function _callee40$(_context40) {
7832
7703
  while (1) {
7833
- switch (_context41.prev = _context41.next) {
7704
+ switch (_context40.prev = _context40.next) {
7834
7705
  case 0:
7835
- options = _args41.length > 1 && _args41[1] !== undefined ? _args41[1] : {};
7836
- _context41.next = 3;
7706
+ options = _args40.length > 1 && _args40[1] !== undefined ? _args40[1] : {};
7707
+ _context40.next = 3;
7837
7708
  return this.post(this.baseURL + '/moderation/unflag', _objectSpread({
7838
7709
  target_user_id: targetID
7839
7710
  }, options));
7840
7711
 
7841
7712
  case 3:
7842
- return _context41.abrupt("return", _context41.sent);
7713
+ return _context40.abrupt("return", _context40.sent);
7843
7714
 
7844
7715
  case 4:
7845
7716
  case "end":
7846
- return _context41.stop();
7717
+ return _context40.stop();
7847
7718
  }
7848
7719
  }
7849
- }, _callee41, this);
7720
+ }, _callee40, this);
7850
7721
  }));
7851
7722
 
7852
- function unflagUser(_x54) {
7723
+ function unflagUser(_x52) {
7853
7724
  return _unflagUser.apply(this, arguments);
7854
7725
  }
7855
7726
 
7856
7727
  return unflagUser;
7857
7728
  }()
7858
7729
  /**
7730
+ * @deprecated use markChannelsRead instead
7731
+ *
7859
7732
  * markAllRead - marks all channels for this user as read
7860
7733
  * @param {MarkAllReadOptions<UserType>} [data]
7861
7734
  *
@@ -7863,32 +7736,41 @@ var StreamChat = /*#__PURE__*/function () {
7863
7736
  */
7864
7737
 
7865
7738
  }, {
7866
- key: "markAllRead",
7867
- value: function () {
7868
- var _markAllRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee42() {
7739
+ key: "markChannelsRead",
7740
+ value:
7741
+ /**
7742
+ * markChannelsRead - marks channels read -
7743
+ * it accepts a map of cid:messageid pairs, if messageid is empty, the whole channel will be marked as read
7744
+ *
7745
+ * @param {MarkChannelsReadOptions <UserType>} [data]
7746
+ *
7747
+ * @return {Promise<APIResponse>}
7748
+ */
7749
+ function () {
7750
+ var _markChannelsRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41() {
7869
7751
  var data,
7870
- _args42 = arguments;
7871
- return _regeneratorRuntime.wrap(function _callee42$(_context42) {
7752
+ _args41 = arguments;
7753
+ return _regeneratorRuntime.wrap(function _callee41$(_context41) {
7872
7754
  while (1) {
7873
- switch (_context42.prev = _context42.next) {
7755
+ switch (_context41.prev = _context41.next) {
7874
7756
  case 0:
7875
- data = _args42.length > 0 && _args42[0] !== undefined ? _args42[0] : {};
7876
- _context42.next = 3;
7757
+ data = _args41.length > 0 && _args41[0] !== undefined ? _args41[0] : {};
7758
+ _context41.next = 3;
7877
7759
  return this.post(this.baseURL + '/channels/read', _objectSpread({}, data));
7878
7760
 
7879
7761
  case 3:
7880
7762
  case "end":
7881
- return _context42.stop();
7763
+ return _context41.stop();
7882
7764
  }
7883
7765
  }
7884
- }, _callee42, this);
7766
+ }, _callee41, this);
7885
7767
  }));
7886
7768
 
7887
- function markAllRead() {
7888
- return _markAllRead.apply(this, arguments);
7769
+ function markChannelsRead() {
7770
+ return _markChannelsRead.apply(this, arguments);
7889
7771
  }
7890
7772
 
7891
- return markAllRead;
7773
+ return markChannelsRead;
7892
7774
  }()
7893
7775
  }, {
7894
7776
  key: "createCommand",
@@ -7956,28 +7838,28 @@ var StreamChat = /*#__PURE__*/function () {
7956
7838
  }, {
7957
7839
  key: "translateMessage",
7958
7840
  value: function () {
7959
- var _translateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(messageId, language) {
7960
- return _regeneratorRuntime.wrap(function _callee43$(_context43) {
7841
+ var _translateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee42(messageId, language) {
7842
+ return _regeneratorRuntime.wrap(function _callee42$(_context42) {
7961
7843
  while (1) {
7962
- switch (_context43.prev = _context43.next) {
7844
+ switch (_context42.prev = _context42.next) {
7963
7845
  case 0:
7964
- _context43.next = 2;
7846
+ _context42.next = 2;
7965
7847
  return this.post(this.baseURL + "/messages/".concat(messageId, "/translate"), {
7966
7848
  language: language
7967
7849
  });
7968
7850
 
7969
7851
  case 2:
7970
- return _context43.abrupt("return", _context43.sent);
7852
+ return _context42.abrupt("return", _context42.sent);
7971
7853
 
7972
7854
  case 3:
7973
7855
  case "end":
7974
- return _context43.stop();
7856
+ return _context42.stop();
7975
7857
  }
7976
7858
  }
7977
- }, _callee43, this);
7859
+ }, _callee42, this);
7978
7860
  }));
7979
7861
 
7980
- function translateMessage(_x55, _x56) {
7862
+ function translateMessage(_x53, _x54) {
7981
7863
  return _translateMessage.apply(this, arguments);
7982
7864
  }
7983
7865
 
@@ -8069,6 +7951,7 @@ var StreamChat = /*#__PURE__*/function () {
8069
7951
  *
8070
7952
  * @param {Omit<MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>, 'mentioned_users'> & { mentioned_users?: string[] }} message object, id needs to be specified
8071
7953
  * @param {string | { id: string }} [userId]
7954
+ * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
8072
7955
  *
8073
7956
  * @return {APIResponse & { message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> }} Response that includes the message
8074
7957
  */
@@ -8076,14 +7959,14 @@ var StreamChat = /*#__PURE__*/function () {
8076
7959
  }, {
8077
7960
  key: "updateMessage",
8078
7961
  value: function () {
8079
- var _updateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(message, userId) {
7962
+ var _updateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(message, userId, options) {
8080
7963
  var clonedMessage, reservedMessageFields;
8081
- return _regeneratorRuntime.wrap(function _callee44$(_context44) {
7964
+ return _regeneratorRuntime.wrap(function _callee43$(_context43) {
8082
7965
  while (1) {
8083
- switch (_context44.prev = _context44.next) {
7966
+ switch (_context43.prev = _context43.next) {
8084
7967
  case 0:
8085
7968
  if (message.id) {
8086
- _context44.next = 2;
7969
+ _context43.next = 2;
8087
7970
  break;
8088
7971
  }
8089
7972
 
@@ -8120,23 +8003,23 @@ var StreamChat = /*#__PURE__*/function () {
8120
8003
  });
8121
8004
  }
8122
8005
 
8123
- _context44.next = 10;
8124
- return this.post(this.baseURL + "/messages/".concat(message.id), {
8006
+ _context43.next = 10;
8007
+ return this.post(this.baseURL + "/messages/".concat(message.id), _objectSpread({
8125
8008
  message: clonedMessage
8126
- });
8009
+ }, options));
8127
8010
 
8128
8011
  case 10:
8129
- return _context44.abrupt("return", _context44.sent);
8012
+ return _context43.abrupt("return", _context43.sent);
8130
8013
 
8131
8014
  case 11:
8132
8015
  case "end":
8133
- return _context44.stop();
8016
+ return _context43.stop();
8134
8017
  }
8135
8018
  }
8136
- }, _callee44, this);
8019
+ }, _callee43, this);
8137
8020
  }));
8138
8021
 
8139
- function updateMessage(_x57, _x58) {
8022
+ function updateMessage(_x55, _x56, _x57) {
8140
8023
  return _updateMessage.apply(this, arguments);
8141
8024
  }
8142
8025
 
@@ -8151,20 +8034,22 @@ var StreamChat = /*#__PURE__*/function () {
8151
8034
  * example: {id: "user1", set:{text: "hi"}, unset:["color"]}
8152
8035
  * @param {string | { id: string }} [userId]
8153
8036
  *
8037
+ * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
8038
+ *
8154
8039
  * @return {APIResponse & { message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> }} Response that includes the updated message
8155
8040
  */
8156
8041
 
8157
8042
  }, {
8158
8043
  key: "partialUpdateMessage",
8159
8044
  value: function () {
8160
- var _partialUpdateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45(id, partialMessageObject, userId) {
8045
+ var _partialUpdateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(id, partialMessageObject, userId, options) {
8161
8046
  var user;
8162
- return _regeneratorRuntime.wrap(function _callee45$(_context45) {
8047
+ return _regeneratorRuntime.wrap(function _callee44$(_context44) {
8163
8048
  while (1) {
8164
- switch (_context45.prev = _context45.next) {
8049
+ switch (_context44.prev = _context44.next) {
8165
8050
  case 0:
8166
8051
  if (id) {
8167
- _context45.next = 2;
8052
+ _context44.next = 2;
8168
8053
  break;
8169
8054
  }
8170
8055
 
@@ -8179,23 +8064,23 @@ var StreamChat = /*#__PURE__*/function () {
8179
8064
  };
8180
8065
  }
8181
8066
 
8182
- _context45.next = 6;
8183
- return this.put(this.baseURL + "/messages/".concat(id), _objectSpread(_objectSpread({}, partialMessageObject), {}, {
8067
+ _context44.next = 6;
8068
+ return this.put(this.baseURL + "/messages/".concat(id), _objectSpread(_objectSpread(_objectSpread({}, partialMessageObject), options), {}, {
8184
8069
  user: user
8185
8070
  }));
8186
8071
 
8187
8072
  case 6:
8188
- return _context45.abrupt("return", _context45.sent);
8073
+ return _context44.abrupt("return", _context44.sent);
8189
8074
 
8190
8075
  case 7:
8191
8076
  case "end":
8192
- return _context45.stop();
8077
+ return _context44.stop();
8193
8078
  }
8194
8079
  }
8195
- }, _callee45, this);
8080
+ }, _callee44, this);
8196
8081
  }));
8197
8082
 
8198
- function partialUpdateMessage(_x59, _x60, _x61) {
8083
+ function partialUpdateMessage(_x58, _x59, _x60, _x61) {
8199
8084
  return _partialUpdateMessage.apply(this, arguments);
8200
8085
  }
8201
8086
 
@@ -8204,11 +8089,11 @@ var StreamChat = /*#__PURE__*/function () {
8204
8089
  }, {
8205
8090
  key: "deleteMessage",
8206
8091
  value: function () {
8207
- var _deleteMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46(messageID, hardDelete) {
8092
+ var _deleteMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45(messageID, hardDelete) {
8208
8093
  var params;
8209
- return _regeneratorRuntime.wrap(function _callee46$(_context46) {
8094
+ return _regeneratorRuntime.wrap(function _callee45$(_context45) {
8210
8095
  while (1) {
8211
- switch (_context46.prev = _context46.next) {
8096
+ switch (_context45.prev = _context45.next) {
8212
8097
  case 0:
8213
8098
  params = {};
8214
8099
 
@@ -8218,18 +8103,18 @@ var StreamChat = /*#__PURE__*/function () {
8218
8103
  };
8219
8104
  }
8220
8105
 
8221
- _context46.next = 4;
8106
+ _context45.next = 4;
8222
8107
  return this.delete(this.baseURL + "/messages/".concat(messageID), params);
8223
8108
 
8224
8109
  case 4:
8225
- return _context46.abrupt("return", _context46.sent);
8110
+ return _context45.abrupt("return", _context45.sent);
8226
8111
 
8227
8112
  case 5:
8228
8113
  case "end":
8229
- return _context46.stop();
8114
+ return _context45.stop();
8230
8115
  }
8231
8116
  }
8232
- }, _callee46, this);
8117
+ }, _callee45, this);
8233
8118
  }));
8234
8119
 
8235
8120
  function deleteMessage(_x62, _x63) {
@@ -8241,23 +8126,23 @@ var StreamChat = /*#__PURE__*/function () {
8241
8126
  }, {
8242
8127
  key: "getMessage",
8243
8128
  value: function () {
8244
- var _getMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee47(messageID) {
8245
- return _regeneratorRuntime.wrap(function _callee47$(_context47) {
8129
+ var _getMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46(messageID) {
8130
+ return _regeneratorRuntime.wrap(function _callee46$(_context46) {
8246
8131
  while (1) {
8247
- switch (_context47.prev = _context47.next) {
8132
+ switch (_context46.prev = _context46.next) {
8248
8133
  case 0:
8249
- _context47.next = 2;
8134
+ _context46.next = 2;
8250
8135
  return this.get(this.baseURL + "/messages/".concat(messageID));
8251
8136
 
8252
8137
  case 2:
8253
- return _context47.abrupt("return", _context47.sent);
8138
+ return _context46.abrupt("return", _context46.sent);
8254
8139
 
8255
8140
  case 3:
8256
8141
  case "end":
8257
- return _context47.stop();
8142
+ return _context46.stop();
8258
8143
  }
8259
8144
  }
8260
- }, _callee47, this);
8145
+ }, _callee46, this);
8261
8146
  }));
8262
8147
 
8263
8148
  function getMessage(_x64) {
@@ -8269,7 +8154,7 @@ var StreamChat = /*#__PURE__*/function () {
8269
8154
  }, {
8270
8155
  key: "getUserAgent",
8271
8156
  value: function getUserAgent() {
8272
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "4.0.0-offline-caching.2");
8157
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "4.3.0");
8273
8158
  }
8274
8159
  }, {
8275
8160
  key: "setUserAgent",
@@ -8450,25 +8335,25 @@ var StreamChat = /*#__PURE__*/function () {
8450
8335
  }, {
8451
8336
  key: "sendUserCustomEvent",
8452
8337
  value: function () {
8453
- var _sendUserCustomEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48(targetUserID, event) {
8454
- return _regeneratorRuntime.wrap(function _callee48$(_context48) {
8338
+ var _sendUserCustomEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee47(targetUserID, event) {
8339
+ return _regeneratorRuntime.wrap(function _callee47$(_context47) {
8455
8340
  while (1) {
8456
- switch (_context48.prev = _context48.next) {
8341
+ switch (_context47.prev = _context47.next) {
8457
8342
  case 0:
8458
- _context48.next = 2;
8343
+ _context47.next = 2;
8459
8344
  return this.post("".concat(this.baseURL, "/users/").concat(targetUserID, "/event"), {
8460
8345
  event: event
8461
8346
  });
8462
8347
 
8463
8348
  case 2:
8464
- return _context48.abrupt("return", _context48.sent);
8349
+ return _context47.abrupt("return", _context47.sent);
8465
8350
 
8466
8351
  case 3:
8467
8352
  case "end":
8468
- return _context48.stop();
8353
+ return _context47.stop();
8469
8354
  }
8470
8355
  }
8471
- }, _callee48, this);
8356
+ }, _callee47, this);
8472
8357
  }));
8473
8358
 
8474
8359
  function sendUserCustomEvent(_x65, _x66) {
@@ -8505,15 +8390,18 @@ var StreamChat = /*#__PURE__*/function () {
8505
8390
  }, {
8506
8391
  key: "exportChannels",
8507
8392
  value: function exportChannels(request) {
8508
- var payload = {
8393
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8394
+
8395
+ var payload = _objectSpread({
8509
8396
  channels: request
8510
- };
8397
+ }, options);
8398
+
8511
8399
  return this.post("".concat(this.baseURL, "/export_channels"), payload);
8512
8400
  }
8513
8401
  }, {
8514
8402
  key: "exportChannel",
8515
- value: function exportChannel(request) {
8516
- return this.exportChannels([request]);
8403
+ value: function exportChannel(request, options) {
8404
+ return this.exportChannels([request], options);
8517
8405
  }
8518
8406
  }, {
8519
8407
  key: "getExportChannelStatus",
@@ -8531,29 +8419,29 @@ var StreamChat = /*#__PURE__*/function () {
8531
8419
  }, {
8532
8420
  key: "createSegment",
8533
8421
  value: function () {
8534
- var _createSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49(params) {
8422
+ var _createSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48(params) {
8535
8423
  var _yield$this$post, segment;
8536
8424
 
8537
- return _regeneratorRuntime.wrap(function _callee49$(_context49) {
8425
+ return _regeneratorRuntime.wrap(function _callee48$(_context48) {
8538
8426
  while (1) {
8539
- switch (_context49.prev = _context49.next) {
8427
+ switch (_context48.prev = _context48.next) {
8540
8428
  case 0:
8541
- _context49.next = 2;
8429
+ _context48.next = 2;
8542
8430
  return this.post(this.baseURL + "/segments", {
8543
8431
  segment: params
8544
8432
  });
8545
8433
 
8546
8434
  case 2:
8547
- _yield$this$post = _context49.sent;
8435
+ _yield$this$post = _context48.sent;
8548
8436
  segment = _yield$this$post.segment;
8549
- return _context49.abrupt("return", segment);
8437
+ return _context48.abrupt("return", segment);
8550
8438
 
8551
8439
  case 5:
8552
8440
  case "end":
8553
- return _context49.stop();
8441
+ return _context48.stop();
8554
8442
  }
8555
8443
  }
8556
- }, _callee49, this);
8444
+ }, _callee48, this);
8557
8445
  }));
8558
8446
 
8559
8447
  function createSegment(_x67) {
@@ -8573,27 +8461,27 @@ var StreamChat = /*#__PURE__*/function () {
8573
8461
  }, {
8574
8462
  key: "getSegment",
8575
8463
  value: function () {
8576
- var _getSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee50(id) {
8464
+ var _getSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49(id) {
8577
8465
  var _yield$this$get, segment;
8578
8466
 
8579
- return _regeneratorRuntime.wrap(function _callee50$(_context50) {
8467
+ return _regeneratorRuntime.wrap(function _callee49$(_context49) {
8580
8468
  while (1) {
8581
- switch (_context50.prev = _context50.next) {
8469
+ switch (_context49.prev = _context49.next) {
8582
8470
  case 0:
8583
- _context50.next = 2;
8471
+ _context49.next = 2;
8584
8472
  return this.get(this.baseURL + "/segments/".concat(id));
8585
8473
 
8586
8474
  case 2:
8587
- _yield$this$get = _context50.sent;
8475
+ _yield$this$get = _context49.sent;
8588
8476
  segment = _yield$this$get.segment;
8589
- return _context50.abrupt("return", segment);
8477
+ return _context49.abrupt("return", segment);
8590
8478
 
8591
8479
  case 5:
8592
8480
  case "end":
8593
- return _context50.stop();
8481
+ return _context49.stop();
8594
8482
  }
8595
8483
  }
8596
- }, _callee50, this);
8484
+ }, _callee49, this);
8597
8485
  }));
8598
8486
 
8599
8487
  function getSegment(_x68) {
@@ -8612,27 +8500,27 @@ var StreamChat = /*#__PURE__*/function () {
8612
8500
  }, {
8613
8501
  key: "listSegments",
8614
8502
  value: function () {
8615
- var _listSegments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee51(options) {
8503
+ var _listSegments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee50(options) {
8616
8504
  var _yield$this$get2, segments;
8617
8505
 
8618
- return _regeneratorRuntime.wrap(function _callee51$(_context51) {
8506
+ return _regeneratorRuntime.wrap(function _callee50$(_context50) {
8619
8507
  while (1) {
8620
- switch (_context51.prev = _context51.next) {
8508
+ switch (_context50.prev = _context50.next) {
8621
8509
  case 0:
8622
- _context51.next = 2;
8510
+ _context50.next = 2;
8623
8511
  return this.get(this.baseURL + "/segments", options);
8624
8512
 
8625
8513
  case 2:
8626
- _yield$this$get2 = _context51.sent;
8514
+ _yield$this$get2 = _context50.sent;
8627
8515
  segments = _yield$this$get2.segments;
8628
- return _context51.abrupt("return", segments);
8516
+ return _context50.abrupt("return", segments);
8629
8517
 
8630
8518
  case 5:
8631
8519
  case "end":
8632
- return _context51.stop();
8520
+ return _context50.stop();
8633
8521
  }
8634
8522
  }
8635
- }, _callee51, this);
8523
+ }, _callee50, this);
8636
8524
  }));
8637
8525
 
8638
8526
  function listSegments(_x69) {
@@ -8653,27 +8541,29 @@ var StreamChat = /*#__PURE__*/function () {
8653
8541
  }, {
8654
8542
  key: "updateSegment",
8655
8543
  value: function () {
8656
- var _updateSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee52(id, params) {
8544
+ var _updateSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee51(id, params) {
8657
8545
  var _yield$this$put, segment;
8658
8546
 
8659
- return _regeneratorRuntime.wrap(function _callee52$(_context52) {
8547
+ return _regeneratorRuntime.wrap(function _callee51$(_context51) {
8660
8548
  while (1) {
8661
- switch (_context52.prev = _context52.next) {
8549
+ switch (_context51.prev = _context51.next) {
8662
8550
  case 0:
8663
- _context52.next = 2;
8664
- return this.put(this.baseURL + "/segments/".concat(id), params);
8551
+ _context51.next = 2;
8552
+ return this.put(this.baseURL + "/segments/".concat(id), {
8553
+ segment: params
8554
+ });
8665
8555
 
8666
8556
  case 2:
8667
- _yield$this$put = _context52.sent;
8557
+ _yield$this$put = _context51.sent;
8668
8558
  segment = _yield$this$put.segment;
8669
- return _context52.abrupt("return", segment);
8559
+ return _context51.abrupt("return", segment);
8670
8560
 
8671
8561
  case 5:
8672
8562
  case "end":
8673
- return _context52.stop();
8563
+ return _context51.stop();
8674
8564
  }
8675
8565
  }
8676
- }, _callee52, this);
8566
+ }, _callee51, this);
8677
8567
  }));
8678
8568
 
8679
8569
  function updateSegment(_x70, _x71) {
@@ -8693,19 +8583,19 @@ var StreamChat = /*#__PURE__*/function () {
8693
8583
  }, {
8694
8584
  key: "deleteSegment",
8695
8585
  value: function () {
8696
- var _deleteSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee53(id) {
8697
- return _regeneratorRuntime.wrap(function _callee53$(_context53) {
8586
+ var _deleteSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee52(id) {
8587
+ return _regeneratorRuntime.wrap(function _callee52$(_context52) {
8698
8588
  while (1) {
8699
- switch (_context53.prev = _context53.next) {
8589
+ switch (_context52.prev = _context52.next) {
8700
8590
  case 0:
8701
- return _context53.abrupt("return", this.delete(this.baseURL + "/segments/".concat(id)));
8591
+ return _context52.abrupt("return", this.delete(this.baseURL + "/segments/".concat(id)));
8702
8592
 
8703
8593
  case 1:
8704
8594
  case "end":
8705
- return _context53.stop();
8595
+ return _context52.stop();
8706
8596
  }
8707
8597
  }
8708
- }, _callee53, this);
8598
+ }, _callee52, this);
8709
8599
  }));
8710
8600
 
8711
8601
  function deleteSegment(_x72) {
@@ -8725,29 +8615,29 @@ var StreamChat = /*#__PURE__*/function () {
8725
8615
  }, {
8726
8616
  key: "createCampaign",
8727
8617
  value: function () {
8728
- var _createCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee54(params) {
8618
+ var _createCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee53(params) {
8729
8619
  var _yield$this$post2, campaign;
8730
8620
 
8731
- return _regeneratorRuntime.wrap(function _callee54$(_context54) {
8621
+ return _regeneratorRuntime.wrap(function _callee53$(_context53) {
8732
8622
  while (1) {
8733
- switch (_context54.prev = _context54.next) {
8623
+ switch (_context53.prev = _context53.next) {
8734
8624
  case 0:
8735
- _context54.next = 2;
8625
+ _context53.next = 2;
8736
8626
  return this.post(this.baseURL + "/campaigns", {
8737
8627
  campaign: params
8738
8628
  });
8739
8629
 
8740
8630
  case 2:
8741
- _yield$this$post2 = _context54.sent;
8631
+ _yield$this$post2 = _context53.sent;
8742
8632
  campaign = _yield$this$post2.campaign;
8743
- return _context54.abrupt("return", campaign);
8633
+ return _context53.abrupt("return", campaign);
8744
8634
 
8745
8635
  case 5:
8746
8636
  case "end":
8747
- return _context54.stop();
8637
+ return _context53.stop();
8748
8638
  }
8749
8639
  }
8750
- }, _callee54, this);
8640
+ }, _callee53, this);
8751
8641
  }));
8752
8642
 
8753
8643
  function createCampaign(_x73) {
@@ -8767,27 +8657,27 @@ var StreamChat = /*#__PURE__*/function () {
8767
8657
  }, {
8768
8658
  key: "getCampaign",
8769
8659
  value: function () {
8770
- var _getCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee55(id) {
8660
+ var _getCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee54(id) {
8771
8661
  var _yield$this$get3, campaign;
8772
8662
 
8773
- return _regeneratorRuntime.wrap(function _callee55$(_context55) {
8663
+ return _regeneratorRuntime.wrap(function _callee54$(_context54) {
8774
8664
  while (1) {
8775
- switch (_context55.prev = _context55.next) {
8665
+ switch (_context54.prev = _context54.next) {
8776
8666
  case 0:
8777
- _context55.next = 2;
8667
+ _context54.next = 2;
8778
8668
  return this.get(this.baseURL + "/campaigns/".concat(id));
8779
8669
 
8780
8670
  case 2:
8781
- _yield$this$get3 = _context55.sent;
8671
+ _yield$this$get3 = _context54.sent;
8782
8672
  campaign = _yield$this$get3.campaign;
8783
- return _context55.abrupt("return", campaign);
8673
+ return _context54.abrupt("return", campaign);
8784
8674
 
8785
8675
  case 5:
8786
8676
  case "end":
8787
- return _context55.stop();
8677
+ return _context54.stop();
8788
8678
  }
8789
8679
  }
8790
- }, _callee55, this);
8680
+ }, _callee54, this);
8791
8681
  }));
8792
8682
 
8793
8683
  function getCampaign(_x74) {
@@ -8806,27 +8696,27 @@ var StreamChat = /*#__PURE__*/function () {
8806
8696
  }, {
8807
8697
  key: "listCampaigns",
8808
8698
  value: function () {
8809
- var _listCampaigns = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee56(options) {
8699
+ var _listCampaigns = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee55(options) {
8810
8700
  var _yield$this$get4, campaigns;
8811
8701
 
8812
- return _regeneratorRuntime.wrap(function _callee56$(_context56) {
8702
+ return _regeneratorRuntime.wrap(function _callee55$(_context55) {
8813
8703
  while (1) {
8814
- switch (_context56.prev = _context56.next) {
8704
+ switch (_context55.prev = _context55.next) {
8815
8705
  case 0:
8816
- _context56.next = 2;
8706
+ _context55.next = 2;
8817
8707
  return this.get(this.baseURL + "/campaigns", options);
8818
8708
 
8819
8709
  case 2:
8820
- _yield$this$get4 = _context56.sent;
8710
+ _yield$this$get4 = _context55.sent;
8821
8711
  campaigns = _yield$this$get4.campaigns;
8822
- return _context56.abrupt("return", campaigns);
8712
+ return _context55.abrupt("return", campaigns);
8823
8713
 
8824
8714
  case 5:
8825
8715
  case "end":
8826
- return _context56.stop();
8716
+ return _context55.stop();
8827
8717
  }
8828
8718
  }
8829
- }, _callee56, this);
8719
+ }, _callee55, this);
8830
8720
  }));
8831
8721
 
8832
8722
  function listCampaigns(_x75) {
@@ -8847,27 +8737,29 @@ var StreamChat = /*#__PURE__*/function () {
8847
8737
  }, {
8848
8738
  key: "updateCampaign",
8849
8739
  value: function () {
8850
- var _updateCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee57(id, params) {
8740
+ var _updateCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee56(id, params) {
8851
8741
  var _yield$this$put2, campaign;
8852
8742
 
8853
- return _regeneratorRuntime.wrap(function _callee57$(_context57) {
8743
+ return _regeneratorRuntime.wrap(function _callee56$(_context56) {
8854
8744
  while (1) {
8855
- switch (_context57.prev = _context57.next) {
8745
+ switch (_context56.prev = _context56.next) {
8856
8746
  case 0:
8857
- _context57.next = 2;
8858
- return this.put(this.baseURL + "/campaigns/".concat(id), params);
8747
+ _context56.next = 2;
8748
+ return this.put(this.baseURL + "/campaigns/".concat(id), {
8749
+ campaign: params
8750
+ });
8859
8751
 
8860
8752
  case 2:
8861
- _yield$this$put2 = _context57.sent;
8753
+ _yield$this$put2 = _context56.sent;
8862
8754
  campaign = _yield$this$put2.campaign;
8863
- return _context57.abrupt("return", campaign);
8755
+ return _context56.abrupt("return", campaign);
8864
8756
 
8865
8757
  case 5:
8866
8758
  case "end":
8867
- return _context57.stop();
8759
+ return _context56.stop();
8868
8760
  }
8869
8761
  }
8870
- }, _callee57, this);
8762
+ }, _callee56, this);
8871
8763
  }));
8872
8764
 
8873
8765
  function updateCampaign(_x76, _x77) {
@@ -8887,19 +8779,19 @@ var StreamChat = /*#__PURE__*/function () {
8887
8779
  }, {
8888
8780
  key: "deleteCampaign",
8889
8781
  value: function () {
8890
- var _deleteCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee58(id) {
8891
- return _regeneratorRuntime.wrap(function _callee58$(_context58) {
8782
+ var _deleteCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee57(id) {
8783
+ return _regeneratorRuntime.wrap(function _callee57$(_context57) {
8892
8784
  while (1) {
8893
- switch (_context58.prev = _context58.next) {
8785
+ switch (_context57.prev = _context57.next) {
8894
8786
  case 0:
8895
- return _context58.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id)));
8787
+ return _context57.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id)));
8896
8788
 
8897
8789
  case 1:
8898
8790
  case "end":
8899
- return _context58.stop();
8791
+ return _context57.stop();
8900
8792
  }
8901
8793
  }
8902
- }, _callee58, this);
8794
+ }, _callee57, this);
8903
8795
  }));
8904
8796
 
8905
8797
  function deleteCampaign(_x78) {
@@ -8920,30 +8812,30 @@ var StreamChat = /*#__PURE__*/function () {
8920
8812
  }, {
8921
8813
  key: "scheduleCampaign",
8922
8814
  value: function () {
8923
- var _scheduleCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(id, params) {
8815
+ var _scheduleCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee58(id, params) {
8924
8816
  var sendAt, _yield$this$patch, campaign;
8925
8817
 
8926
- return _regeneratorRuntime.wrap(function _callee59$(_context59) {
8818
+ return _regeneratorRuntime.wrap(function _callee58$(_context58) {
8927
8819
  while (1) {
8928
- switch (_context59.prev = _context59.next) {
8820
+ switch (_context58.prev = _context58.next) {
8929
8821
  case 0:
8930
8822
  sendAt = params.sendAt;
8931
- _context59.next = 3;
8823
+ _context58.next = 3;
8932
8824
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/schedule"), {
8933
8825
  send_at: sendAt
8934
8826
  });
8935
8827
 
8936
8828
  case 3:
8937
- _yield$this$patch = _context59.sent;
8829
+ _yield$this$patch = _context58.sent;
8938
8830
  campaign = _yield$this$patch.campaign;
8939
- return _context59.abrupt("return", campaign);
8831
+ return _context58.abrupt("return", campaign);
8940
8832
 
8941
8833
  case 6:
8942
8834
  case "end":
8943
- return _context59.stop();
8835
+ return _context58.stop();
8944
8836
  }
8945
8837
  }
8946
- }, _callee59, this);
8838
+ }, _callee58, this);
8947
8839
  }));
8948
8840
 
8949
8841
  function scheduleCampaign(_x79, _x80) {
@@ -8963,27 +8855,27 @@ var StreamChat = /*#__PURE__*/function () {
8963
8855
  }, {
8964
8856
  key: "stopCampaign",
8965
8857
  value: function () {
8966
- var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(id) {
8858
+ var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(id) {
8967
8859
  var _yield$this$patch2, campaign;
8968
8860
 
8969
- return _regeneratorRuntime.wrap(function _callee60$(_context60) {
8861
+ return _regeneratorRuntime.wrap(function _callee59$(_context59) {
8970
8862
  while (1) {
8971
- switch (_context60.prev = _context60.next) {
8863
+ switch (_context59.prev = _context59.next) {
8972
8864
  case 0:
8973
- _context60.next = 2;
8865
+ _context59.next = 2;
8974
8866
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
8975
8867
 
8976
8868
  case 2:
8977
- _yield$this$patch2 = _context60.sent;
8869
+ _yield$this$patch2 = _context59.sent;
8978
8870
  campaign = _yield$this$patch2.campaign;
8979
- return _context60.abrupt("return", campaign);
8871
+ return _context59.abrupt("return", campaign);
8980
8872
 
8981
8873
  case 5:
8982
8874
  case "end":
8983
- return _context60.stop();
8875
+ return _context59.stop();
8984
8876
  }
8985
8877
  }
8986
- }, _callee60, this);
8878
+ }, _callee59, this);
8987
8879
  }));
8988
8880
 
8989
8881
  function stopCampaign(_x81) {
@@ -9003,27 +8895,27 @@ var StreamChat = /*#__PURE__*/function () {
9003
8895
  }, {
9004
8896
  key: "resumeCampaign",
9005
8897
  value: function () {
9006
- var _resumeCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee61(id) {
8898
+ var _resumeCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(id) {
9007
8899
  var _yield$this$patch3, campaign;
9008
8900
 
9009
- return _regeneratorRuntime.wrap(function _callee61$(_context61) {
8901
+ return _regeneratorRuntime.wrap(function _callee60$(_context60) {
9010
8902
  while (1) {
9011
- switch (_context61.prev = _context61.next) {
8903
+ switch (_context60.prev = _context60.next) {
9012
8904
  case 0:
9013
- _context61.next = 2;
8905
+ _context60.next = 2;
9014
8906
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/resume"));
9015
8907
 
9016
8908
  case 2:
9017
- _yield$this$patch3 = _context61.sent;
8909
+ _yield$this$patch3 = _context60.sent;
9018
8910
  campaign = _yield$this$patch3.campaign;
9019
- return _context61.abrupt("return", campaign);
8911
+ return _context60.abrupt("return", campaign);
9020
8912
 
9021
8913
  case 5:
9022
8914
  case "end":
9023
- return _context61.stop();
8915
+ return _context60.stop();
9024
8916
  }
9025
8917
  }
9026
- }, _callee61, this);
8918
+ }, _callee60, this);
9027
8919
  }));
9028
8920
 
9029
8921
  function resumeCampaign(_x82) {
@@ -9043,30 +8935,30 @@ var StreamChat = /*#__PURE__*/function () {
9043
8935
  }, {
9044
8936
  key: "testCampaign",
9045
8937
  value: function () {
9046
- var _testCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee62(id, params) {
8938
+ var _testCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee61(id, params) {
9047
8939
  var users, _yield$this$post3, campaign;
9048
8940
 
9049
- return _regeneratorRuntime.wrap(function _callee62$(_context62) {
8941
+ return _regeneratorRuntime.wrap(function _callee61$(_context61) {
9050
8942
  while (1) {
9051
- switch (_context62.prev = _context62.next) {
8943
+ switch (_context61.prev = _context61.next) {
9052
8944
  case 0:
9053
8945
  users = params.users;
9054
- _context62.next = 3;
8946
+ _context61.next = 3;
9055
8947
  return this.post(this.baseURL + "/campaigns/".concat(id, "/test"), {
9056
8948
  users: users
9057
8949
  });
9058
8950
 
9059
8951
  case 3:
9060
- _yield$this$post3 = _context62.sent;
8952
+ _yield$this$post3 = _context61.sent;
9061
8953
  campaign = _yield$this$post3.campaign;
9062
- return _context62.abrupt("return", campaign);
8954
+ return _context61.abrupt("return", campaign);
9063
8955
 
9064
8956
  case 6:
9065
8957
  case "end":
9066
- return _context62.stop();
8958
+ return _context61.stop();
9067
8959
  }
9068
8960
  }
9069
- }, _callee62, this);
8961
+ }, _callee61, this);
9070
8962
  }));
9071
8963
 
9072
8964
  function testCampaign(_x83, _x84) {
@@ -9075,6 +8967,176 @@ var StreamChat = /*#__PURE__*/function () {
9075
8967
 
9076
8968
  return testCampaign;
9077
8969
  }()
8970
+ /**
8971
+ * enrichURL - Get OpenGraph data of the given link
8972
+ *
8973
+ * @param {string} url link
8974
+ * @return {OGAttachment} OG Attachment
8975
+ */
8976
+
8977
+ }, {
8978
+ key: "enrichURL",
8979
+ value: function () {
8980
+ var _enrichURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee62(url) {
8981
+ return _regeneratorRuntime.wrap(function _callee62$(_context62) {
8982
+ while (1) {
8983
+ switch (_context62.prev = _context62.next) {
8984
+ case 0:
8985
+ return _context62.abrupt("return", this.get(this.baseURL + "/og", {
8986
+ url: url
8987
+ }));
8988
+
8989
+ case 1:
8990
+ case "end":
8991
+ return _context62.stop();
8992
+ }
8993
+ }
8994
+ }, _callee62, this);
8995
+ }));
8996
+
8997
+ function enrichURL(_x85) {
8998
+ return _enrichURL.apply(this, arguments);
8999
+ }
9000
+
9001
+ return enrichURL;
9002
+ }()
9003
+ /**
9004
+ * getTask - Gets status of a long running task
9005
+ *
9006
+ * @param {string} id Task ID
9007
+ *
9008
+ * @return {TaskStatus} The task status
9009
+ */
9010
+
9011
+ }, {
9012
+ key: "getTask",
9013
+ value: function () {
9014
+ var _getTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee63(id) {
9015
+ return _regeneratorRuntime.wrap(function _callee63$(_context63) {
9016
+ while (1) {
9017
+ switch (_context63.prev = _context63.next) {
9018
+ case 0:
9019
+ return _context63.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
9020
+
9021
+ case 1:
9022
+ case "end":
9023
+ return _context63.stop();
9024
+ }
9025
+ }
9026
+ }, _callee63, this);
9027
+ }));
9028
+
9029
+ function getTask(_x86) {
9030
+ return _getTask.apply(this, arguments);
9031
+ }
9032
+
9033
+ return getTask;
9034
+ }()
9035
+ /**
9036
+ * deleteChannels - Deletes a list of channel
9037
+ *
9038
+ * @param {string[]} cids Channel CIDs
9039
+ * @param {boolean} [options.hard_delete] Defines if the channel is hard deleted or not
9040
+ *
9041
+ * @return {DeleteChannelsResponse} Result of the soft deletion, if server-side, it holds the task ID as well
9042
+ */
9043
+
9044
+ }, {
9045
+ key: "deleteChannels",
9046
+ value: function () {
9047
+ var _deleteChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64(cids) {
9048
+ var options,
9049
+ _args64 = arguments;
9050
+ return _regeneratorRuntime.wrap(function _callee64$(_context64) {
9051
+ while (1) {
9052
+ switch (_context64.prev = _context64.next) {
9053
+ case 0:
9054
+ options = _args64.length > 1 && _args64[1] !== undefined ? _args64[1] : {};
9055
+ _context64.next = 3;
9056
+ return this.post(this.baseURL + "/channels/delete", _objectSpread({
9057
+ cids: cids
9058
+ }, options));
9059
+
9060
+ case 3:
9061
+ return _context64.abrupt("return", _context64.sent);
9062
+
9063
+ case 4:
9064
+ case "end":
9065
+ return _context64.stop();
9066
+ }
9067
+ }
9068
+ }, _callee64, this);
9069
+ }));
9070
+
9071
+ function deleteChannels(_x87) {
9072
+ return _deleteChannels.apply(this, arguments);
9073
+ }
9074
+
9075
+ return deleteChannels;
9076
+ }()
9077
+ /**
9078
+ * deleteUsers - Batch Delete Users
9079
+ *
9080
+ * @param {string[]} user_ids which users to delete
9081
+ * @param {DeleteUserOptions} options Configuration how to delete users
9082
+ *
9083
+ * @return {APIResponse} A task ID
9084
+ */
9085
+
9086
+ }, {
9087
+ key: "deleteUsers",
9088
+ value: function () {
9089
+ var _deleteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(user_ids, options) {
9090
+ return _regeneratorRuntime.wrap(function _callee65$(_context65) {
9091
+ while (1) {
9092
+ switch (_context65.prev = _context65.next) {
9093
+ case 0:
9094
+ if (!((options === null || options === void 0 ? void 0 : options.user) !== 'soft' && (options === null || options === void 0 ? void 0 : options.user) !== 'hard')) {
9095
+ _context65.next = 2;
9096
+ break;
9097
+ }
9098
+
9099
+ throw new Error('Invalid delete user options. user must be one of [soft hard]');
9100
+
9101
+ case 2:
9102
+ if (!(options.messages !== undefined && options.messages !== 'soft' && options.messages !== 'hard')) {
9103
+ _context65.next = 4;
9104
+ break;
9105
+ }
9106
+
9107
+ throw new Error('Invalid delete user options. messages must be one of [soft hard]');
9108
+
9109
+ case 4:
9110
+ if (!(options.conversations !== undefined && options.conversations !== 'soft' && options.conversations !== 'hard')) {
9111
+ _context65.next = 6;
9112
+ break;
9113
+ }
9114
+
9115
+ throw new Error('Invalid delete user options. conversations must be one of [soft hard]');
9116
+
9117
+ case 6:
9118
+ _context65.next = 8;
9119
+ return this.post(this.baseURL + "/users/delete", _objectSpread({
9120
+ user_ids: user_ids
9121
+ }, options));
9122
+
9123
+ case 8:
9124
+ return _context65.abrupt("return", _context65.sent);
9125
+
9126
+ case 9:
9127
+ case "end":
9128
+ return _context65.stop();
9129
+ }
9130
+ }
9131
+ }, _callee65, this);
9132
+ }));
9133
+
9134
+ function deleteUsers(_x88, _x89) {
9135
+ return _deleteUsers.apply(this, arguments);
9136
+ }
9137
+
9138
+ return deleteUsers;
9139
+ }()
9078
9140
  }], [{
9079
9141
  key: "getInstance",
9080
9142
  value: function getInstance(key, secretOrOptions, options) {