stream-chat 6.3.0 → 6.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -390,12 +390,15 @@ var ChannelState = /*#__PURE__*/function () {
390
390
 
391
391
  if (isFromShadowBannedUser) {
392
392
  continue;
393
- }
393
+ } // If message is already formatted we can skip the tasks below
394
+ // This will be true for messages that are already present at the state -> this happens when we perform merging of message sets
395
+ // This will be also true for message previews used by some SDKs
396
+
394
397
 
395
- var isMerging = messagesToAdd[i].created_at instanceof Date;
398
+ var isMessageFormatted = messagesToAdd[i].created_at instanceof Date;
396
399
  var message = void 0;
397
400
 
398
- if (isMerging) {
401
+ if (isMessageFormatted) {
399
402
  message = messagesToAdd[i];
400
403
  } else {
401
404
  var _this$_channel;
@@ -445,7 +448,7 @@ var ChannelState = /*#__PURE__*/function () {
445
448
  */
446
449
 
447
450
 
448
- if (parentID && !initializing && !isMerging) {
451
+ if (parentID && !initializing) {
449
452
  var thread = this.threads[parentID] || [];
450
453
 
451
454
  var threadMessages = this._addToMessageList(thread, message, timestampChanged, 'created_at', addIfDoesNotExist);
@@ -5172,7 +5175,7 @@ function TokenManager(secret) {
5172
5175
  _defineProperty__default['default'](this, "loadToken", function () {
5173
5176
  // eslint-disable-next-line no-async-promise-executor
5174
5177
  _this.loadTokenPromise = new Promise( /*#__PURE__*/function () {
5175
- var _ref2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(resolve) {
5178
+ var _ref2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(resolve, reject) {
5176
5179
  return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
5177
5180
  while (1) {
5178
5181
  switch (_context2.prev = _context2.next) {
@@ -5186,26 +5189,36 @@ function TokenManager(secret) {
5186
5189
 
5187
5190
  case 2:
5188
5191
  if (!(_this.tokenProvider && typeof _this.tokenProvider !== 'string')) {
5189
- _context2.next = 7;
5192
+ _context2.next = 13;
5190
5193
  break;
5191
5194
  }
5192
5195
 
5193
- _context2.next = 5;
5196
+ _context2.prev = 3;
5197
+ _context2.next = 6;
5194
5198
  return _this.tokenProvider();
5195
5199
 
5196
- case 5:
5200
+ case 6:
5197
5201
  _this.token = _context2.sent;
5202
+ _context2.next = 12;
5203
+ break;
5204
+
5205
+ case 9:
5206
+ _context2.prev = 9;
5207
+ _context2.t0 = _context2["catch"](3);
5208
+ return _context2.abrupt("return", reject(new Error("Call to tokenProvider failed with message: ".concat(_context2.t0))));
5209
+
5210
+ case 12:
5198
5211
  resolve(_this.token);
5199
5212
 
5200
- case 7:
5213
+ case 13:
5201
5214
  case "end":
5202
5215
  return _context2.stop();
5203
5216
  }
5204
5217
  }
5205
- }, _callee2);
5218
+ }, _callee2, null, [[3, 9]]);
5206
5219
  }));
5207
5220
 
5208
- return function (_x3) {
5221
+ return function (_x3, _x4) {
5209
5222
  return _ref2.apply(this, arguments);
5210
5223
  };
5211
5224
  }());
@@ -5975,7 +5988,7 @@ var StreamChat = /*#__PURE__*/function () {
5975
5988
  }());
5976
5989
 
5977
5990
  _defineProperty__default['default'](this, "openConnection", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3() {
5978
- var _this$wsConnection3, _this$wsFallback3;
5991
+ var _this$wsConnection3, _this$wsConnection4, _this$wsFallback3;
5979
5992
 
5980
5993
  return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
5981
5994
  while (1) {
@@ -5989,18 +6002,30 @@ var StreamChat = /*#__PURE__*/function () {
5989
6002
  throw Error('User is not set on client, use client.connectUser or client.connectAnonymousUser instead');
5990
6003
 
5991
6004
  case 2:
5992
- if (!(((_this$wsConnection3 = _this.wsConnection) !== null && _this$wsConnection3 !== void 0 && _this$wsConnection3.isHealthy || (_this$wsFallback3 = _this.wsFallback) !== null && _this$wsFallback3 !== void 0 && _this$wsFallback3.isHealthy()) && _this._hasConnectionID())) {
6005
+ if (!((_this$wsConnection3 = _this.wsConnection) !== null && _this$wsConnection3 !== void 0 && _this$wsConnection3.isConnecting)) {
5993
6006
  _context3.next = 5;
5994
6007
  break;
5995
6008
  }
5996
6009
 
5997
- _this.logger('info', 'client:openConnection() - openConnection called twice, healthy connection already exists', {
6010
+ _this.logger('info', 'client:openConnection() - connection already in progress', {
5998
6011
  tags: ['connection', 'client']
5999
6012
  });
6000
6013
 
6001
6014
  return _context3.abrupt("return", Promise.resolve());
6002
6015
 
6003
6016
  case 5:
6017
+ if (!(((_this$wsConnection4 = _this.wsConnection) !== null && _this$wsConnection4 !== void 0 && _this$wsConnection4.isHealthy || (_this$wsFallback3 = _this.wsFallback) !== null && _this$wsFallback3 !== void 0 && _this$wsFallback3.isHealthy()) && _this._hasConnectionID())) {
6018
+ _context3.next = 8;
6019
+ break;
6020
+ }
6021
+
6022
+ _this.logger('info', 'client:openConnection() - openConnection called twice, healthy connection already exists', {
6023
+ tags: ['connection', 'client']
6024
+ });
6025
+
6026
+ return _context3.abrupt("return", Promise.resolve());
6027
+
6028
+ case 8:
6004
6029
  _this.clientID = "".concat(_this.userID, "--").concat(randomId());
6005
6030
  _this.wsPromise = _this.connect();
6006
6031
 
@@ -6008,7 +6033,7 @@ var StreamChat = /*#__PURE__*/function () {
6008
6033
 
6009
6034
  return _context3.abrupt("return", _this.wsPromise);
6010
6035
 
6011
- case 9:
6036
+ case 12:
6012
6037
  case "end":
6013
6038
  return _context3.stop();
6014
6039
  }
@@ -6715,30 +6740,31 @@ var StreamChat = /*#__PURE__*/function () {
6715
6740
  key: "updateAppSettings",
6716
6741
  value:
6717
6742
  /**
6718
- * updateAppSettings - updates application settings
6719
- *
6720
- * @param {AppSettings} options App settings.
6721
- * IE: {
6722
- "apn_config": {
6723
- "auth_type": "token",
6724
- "auth_key": fs.readFileSync(
6725
- './apn-push-auth-key.p8',
6726
- 'utf-8',
6727
- ),
6728
- "key_id": "keyid",
6729
- "team_id": "teamid", //either ALL these 3
6730
- "notification_template": "notification handlebars template",
6731
- "bundle_id": "com.apple.your.app",
6732
- "development": true
6733
- },
6734
- "firebase_config": {
6735
- "server_key": "server key from fcm",
6736
- "notification_template": "notification handlebars template"
6737
- "data_template": "data handlebars template"
6738
- },
6739
- "webhook_url": "https://acme.com/my/awesome/webhook/"
6740
- }
6741
- */
6743
+ * updateAppSettings - updates application settings
6744
+ *
6745
+ * @param {AppSettings} options App settings.
6746
+ * IE: {
6747
+ 'apn_config': {
6748
+ 'auth_type': 'token',
6749
+ 'auth_key": fs.readFileSync(
6750
+ './apn-push-auth-key.p8',
6751
+ 'utf-8',
6752
+ ),
6753
+ 'key_id': 'keyid',
6754
+ 'team_id': 'teamid',
6755
+ 'notification_template": 'notification handlebars template',
6756
+ 'bundle_id': 'com.apple.your.app',
6757
+ 'development': true
6758
+ },
6759
+ 'firebase_config': {
6760
+ 'server_key': 'server key from fcm',
6761
+ 'notification_template': 'notification handlebars template',
6762
+ 'data_template': 'data handlebars template',
6763
+ 'apn_template': 'apn notification handlebars template under v2'
6764
+ },
6765
+ 'webhook_url': 'https://acme.com/my/awesome/webhook/'
6766
+ }
6767
+ */
6742
6768
  function () {
6743
6769
  var _updateAppSettings = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee7(options) {
6744
6770
  var _options$apn_config;
@@ -6929,17 +6955,19 @@ var StreamChat = /*#__PURE__*/function () {
6929
6955
  return getAppSettings;
6930
6956
  }()
6931
6957
  /**
6932
- * testPushSettings - Tests the push settings for a user with a random chat message and the configured push templates
6933
- *
6934
- * @param {string} userID User ID. If user has no devices, it will error
6935
- * @param {TestPushDataInput} [data] Overrides for push templates/message used
6936
- * IE: {
6937
- messageID: 'id-of-message',//will error if message does not exist
6938
- apnTemplate: '{}', //if app doesn't have apn configured it will error
6939
- firebaseTemplate: '{}', //if app doesn't have firebase configured it will error
6940
- firebaseDataTemplate: '{}', //if app doesn't have firebase configured it will error
6941
- skipDevices: true, // skip config/device checks and sending to real devices
6942
- }
6958
+ * testPushSettings - Tests the push settings for a user with a random chat message and the configured push templates
6959
+ *
6960
+ * @param {string} userID User ID. If user has no devices, it will error
6961
+ * @param {TestPushDataInput} [data] Overrides for push templates/message used
6962
+ * IE: {
6963
+ messageID: 'id-of-message', // will error if message does not exist
6964
+ apnTemplate: '{}', // if app doesn't have apn configured it will error
6965
+ firebaseTemplate: '{}', // if app doesn't have firebase configured it will error
6966
+ firebaseDataTemplate: '{}', // if app doesn't have firebase configured it will error
6967
+ skipDevices: true, // skip config/device checks and sending to real devices
6968
+ pushProviderName: 'staging' // one of your configured push providers
6969
+ pushProviderType: 'apn' // one of supported provider types
6970
+ }
6943
6971
  */
6944
6972
 
6945
6973
  }, {
@@ -6954,7 +6982,7 @@ var StreamChat = /*#__PURE__*/function () {
6954
6982
  case 0:
6955
6983
  data = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {};
6956
6984
  _context12.next = 3;
6957
- return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
6985
+ return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
6958
6986
  user_id: userID
6959
6987
  }, data.messageID ? {
6960
6988
  message_id: data.messageID
@@ -6966,6 +6994,10 @@ var StreamChat = /*#__PURE__*/function () {
6966
6994
  firebase_data_template: data.firebaseDataTemplate
6967
6995
  } : {}), data.skipDevices ? {
6968
6996
  skip_devices: true
6997
+ } : {}), data.pushProviderName ? {
6998
+ push_provider_name: data.pushProviderName
6999
+ } : {}), data.pushProviderType ? {
7000
+ push_provider_type: data.pushProviderType
6969
7001
  } : {}));
6970
7002
 
6971
7003
  case 3:
@@ -6989,11 +7021,11 @@ var StreamChat = /*#__PURE__*/function () {
6989
7021
  * testSQSSettings - Tests that the given or configured SQS configuration is valid
6990
7022
  *
6991
7023
  * @param {TestSQSDataInput} [data] Overrides SQS settings for testing if needed
6992
- * IE: {
6993
- sqs_key: 'auth_key',
6994
- sqs_secret: 'auth_secret',
6995
- sqs_url: 'url_to_queue',
6996
- }
7024
+ * IE: {
7025
+ sqs_key: 'auth_key',
7026
+ sqs_secret: 'auth_secret',
7027
+ sqs_url: 'url_to_queue',
7028
+ }
6997
7029
  */
6998
7030
 
6999
7031
  }, {
@@ -7096,7 +7128,7 @@ var StreamChat = /*#__PURE__*/function () {
7096
7128
  }()
7097
7129
  /**
7098
7130
  * createToken - Creates a token to authenticate this user. This function is used server side.
7099
- * The resulting token should be passed to the client side when the users registers or logs in
7131
+ * The resulting token should be passed to the client side when the users registers or logs in.
7100
7132
  *
7101
7133
  * @param {string} userID The User ID
7102
7134
  * @param {number} [exp] The expiration time for the token expressed in the number of seconds since the epoch
@@ -7348,7 +7380,7 @@ var StreamChat = /*#__PURE__*/function () {
7348
7380
  this.mutedUsers = event.me.mutes;
7349
7381
  }
7350
7382
 
7351
- if (event.type === 'notification.mark_read') {
7383
+ if (event.type === 'notification.mark_read' && event.unread_channels === 0) {
7352
7384
  var activeChannelKeys = Object.keys(this.activeChannels);
7353
7385
  activeChannelKeys.forEach(function (activeChannelKey) {
7354
7386
  return _this3.activeChannels[activeChannelKey].state.unreadCount = 0;
@@ -7931,23 +7963,26 @@ var StreamChat = /*#__PURE__*/function () {
7931
7963
  * @param {string} id the device id
7932
7964
  * @param {PushProvider} push_provider the push provider
7933
7965
  * @param {string} [userID] the user id (defaults to current user)
7966
+ * @param {string} [push_provider_name] user provided push provider name for multi bundle support
7934
7967
  *
7935
7968
  */
7936
7969
 
7937
7970
  }, {
7938
7971
  key: "addDevice",
7939
7972
  value: function () {
7940
- var _addDevice = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee21(id, push_provider, userID) {
7973
+ var _addDevice = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee21(id, push_provider, userID, push_provider_name) {
7941
7974
  return _regeneratorRuntime__default['default'].wrap(function _callee21$(_context21) {
7942
7975
  while (1) {
7943
7976
  switch (_context21.prev = _context21.next) {
7944
7977
  case 0:
7945
7978
  _context21.next = 2;
7946
- return this.post(this.baseURL + '/devices', _objectSpread({
7979
+ return this.post(this.baseURL + '/devices', _objectSpread(_objectSpread({
7947
7980
  id: id,
7948
7981
  push_provider: push_provider
7949
7982
  }, userID != null ? {
7950
7983
  user_id: userID
7984
+ } : {}), push_provider_name != null ? {
7985
+ push_provider_name: push_provider_name
7951
7986
  } : {}));
7952
7987
 
7953
7988
  case 2:
@@ -7961,7 +7996,7 @@ var StreamChat = /*#__PURE__*/function () {
7961
7996
  }, _callee21, this);
7962
7997
  }));
7963
7998
 
7964
- function addDevice(_x20, _x21, _x22) {
7999
+ function addDevice(_x20, _x21, _x22, _x23) {
7965
8000
  return _addDevice.apply(this, arguments);
7966
8001
  }
7967
8002
 
@@ -7999,7 +8034,7 @@ var StreamChat = /*#__PURE__*/function () {
7999
8034
  }, _callee22, this);
8000
8035
  }));
8001
8036
 
8002
- function getDevices(_x23) {
8037
+ function getDevices(_x24) {
8003
8038
  return _getDevices.apply(this, arguments);
8004
8039
  }
8005
8040
 
@@ -8039,7 +8074,7 @@ var StreamChat = /*#__PURE__*/function () {
8039
8074
  }, _callee23, this);
8040
8075
  }));
8041
8076
 
8042
- function removeDevice(_x24, _x25) {
8077
+ function removeDevice(_x25, _x26) {
8043
8078
  return _removeDevice.apply(this, arguments);
8044
8079
  }
8045
8080
 
@@ -8080,7 +8115,7 @@ var StreamChat = /*#__PURE__*/function () {
8080
8115
  }, _callee24, this);
8081
8116
  }));
8082
8117
 
8083
- function getRateLimits(_x26) {
8118
+ function getRateLimits(_x27) {
8084
8119
  return _getRateLimits.apply(this, arguments);
8085
8120
  }
8086
8121
 
@@ -8181,7 +8216,7 @@ var StreamChat = /*#__PURE__*/function () {
8181
8216
  }, _callee25, this);
8182
8217
  }));
8183
8218
 
8184
- function partialUpdateUser(_x27) {
8219
+ function partialUpdateUser(_x28) {
8185
8220
  return _partialUpdateUser.apply(this, arguments);
8186
8221
  }
8187
8222
 
@@ -8267,7 +8302,7 @@ var StreamChat = /*#__PURE__*/function () {
8267
8302
  }, _callee26, this, [[2, 13, 16, 19]]);
8268
8303
  }));
8269
8304
 
8270
- function upsertUsers(_x28) {
8305
+ function upsertUsers(_x29) {
8271
8306
  return _upsertUsers.apply(this, arguments);
8272
8307
  }
8273
8308
 
@@ -8380,7 +8415,7 @@ var StreamChat = /*#__PURE__*/function () {
8380
8415
  }, _callee27, this, [[1, 11, 14, 17]]);
8381
8416
  }));
8382
8417
 
8383
- function partialUpdateUsers(_x29) {
8418
+ function partialUpdateUsers(_x30) {
8384
8419
  return _partialUpdateUsers.apply(this, arguments);
8385
8420
  }
8386
8421
 
@@ -8408,7 +8443,7 @@ var StreamChat = /*#__PURE__*/function () {
8408
8443
  }, _callee28, this);
8409
8444
  }));
8410
8445
 
8411
- function deleteUser(_x30, _x31) {
8446
+ function deleteUser(_x31, _x32) {
8412
8447
  return _deleteUser.apply(this, arguments);
8413
8448
  }
8414
8449
 
@@ -8436,7 +8471,7 @@ var StreamChat = /*#__PURE__*/function () {
8436
8471
  }, _callee29, this);
8437
8472
  }));
8438
8473
 
8439
- function reactivateUser(_x32, _x33) {
8474
+ function reactivateUser(_x33, _x34) {
8440
8475
  return _reactivateUser.apply(this, arguments);
8441
8476
  }
8442
8477
 
@@ -8464,7 +8499,7 @@ var StreamChat = /*#__PURE__*/function () {
8464
8499
  }, _callee30, this);
8465
8500
  }));
8466
8501
 
8467
- function deactivateUser(_x34, _x35) {
8502
+ function deactivateUser(_x35, _x36) {
8468
8503
  return _deactivateUser.apply(this, arguments);
8469
8504
  }
8470
8505
 
@@ -8492,7 +8527,7 @@ var StreamChat = /*#__PURE__*/function () {
8492
8527
  }, _callee31, this);
8493
8528
  }));
8494
8529
 
8495
- function exportUser(_x36, _x37) {
8530
+ function exportUser(_x37, _x38) {
8496
8531
  return _exportUser.apply(this, arguments);
8497
8532
  }
8498
8533
 
@@ -8529,7 +8564,7 @@ var StreamChat = /*#__PURE__*/function () {
8529
8564
  }, _callee32, this);
8530
8565
  }));
8531
8566
 
8532
- function banUser(_x38, _x39) {
8567
+ function banUser(_x39, _x40) {
8533
8568
  return _banUser.apply(this, arguments);
8534
8569
  }
8535
8570
 
@@ -8566,7 +8601,7 @@ var StreamChat = /*#__PURE__*/function () {
8566
8601
  }, _callee33, this);
8567
8602
  }));
8568
8603
 
8569
- function unbanUser(_x40, _x41) {
8604
+ function unbanUser(_x41, _x42) {
8570
8605
  return _unbanUser.apply(this, arguments);
8571
8606
  }
8572
8607
 
@@ -8603,7 +8638,7 @@ var StreamChat = /*#__PURE__*/function () {
8603
8638
  }, _callee34, this);
8604
8639
  }));
8605
8640
 
8606
- function shadowBan(_x42, _x43) {
8641
+ function shadowBan(_x43, _x44) {
8607
8642
  return _shadowBan.apply(this, arguments);
8608
8643
  }
8609
8644
 
@@ -8640,7 +8675,7 @@ var StreamChat = /*#__PURE__*/function () {
8640
8675
  }, _callee35, this);
8641
8676
  }));
8642
8677
 
8643
- function removeShadowBan(_x44, _x45) {
8678
+ function removeShadowBan(_x45, _x46) {
8644
8679
  return _removeShadowBan.apply(this, arguments);
8645
8680
  }
8646
8681
 
@@ -8683,7 +8718,7 @@ var StreamChat = /*#__PURE__*/function () {
8683
8718
  }, _callee36, this);
8684
8719
  }));
8685
8720
 
8686
- function muteUser(_x46, _x47) {
8721
+ function muteUser(_x47, _x48) {
8687
8722
  return _muteUser.apply(this, arguments);
8688
8723
  }
8689
8724
 
@@ -8722,7 +8757,7 @@ var StreamChat = /*#__PURE__*/function () {
8722
8757
  }, _callee37, this);
8723
8758
  }));
8724
8759
 
8725
- function unmuteUser(_x48, _x49) {
8760
+ function unmuteUser(_x49, _x50) {
8726
8761
  return _unmuteUser.apply(this, arguments);
8727
8762
  }
8728
8763
 
@@ -8781,7 +8816,7 @@ var StreamChat = /*#__PURE__*/function () {
8781
8816
  }, _callee38, this);
8782
8817
  }));
8783
8818
 
8784
- function flagMessage(_x50) {
8819
+ function flagMessage(_x51) {
8785
8820
  return _flagMessage.apply(this, arguments);
8786
8821
  }
8787
8822
 
@@ -8821,7 +8856,7 @@ var StreamChat = /*#__PURE__*/function () {
8821
8856
  }, _callee39, this);
8822
8857
  }));
8823
8858
 
8824
- function flagUser(_x51) {
8859
+ function flagUser(_x52) {
8825
8860
  return _flagUser.apply(this, arguments);
8826
8861
  }
8827
8862
 
@@ -8861,7 +8896,7 @@ var StreamChat = /*#__PURE__*/function () {
8861
8896
  }, _callee40, this);
8862
8897
  }));
8863
8898
 
8864
- function unflagMessage(_x52) {
8899
+ function unflagMessage(_x53) {
8865
8900
  return _unflagMessage.apply(this, arguments);
8866
8901
  }
8867
8902
 
@@ -8901,7 +8936,7 @@ var StreamChat = /*#__PURE__*/function () {
8901
8936
  }, _callee41, this);
8902
8937
  }));
8903
8938
 
8904
- function unflagUser(_x53) {
8939
+ function unflagUser(_x54) {
8905
8940
  return _unflagUser.apply(this, arguments);
8906
8941
  }
8907
8942
 
@@ -9047,7 +9082,7 @@ var StreamChat = /*#__PURE__*/function () {
9047
9082
  }, _callee44, this);
9048
9083
  }));
9049
9084
 
9050
- function _reviewFlagReport(_x54, _x55) {
9085
+ function _reviewFlagReport(_x55, _x56) {
9051
9086
  return _reviewFlagReport2.apply(this, arguments);
9052
9087
  }
9053
9088
 
@@ -9093,7 +9128,7 @@ var StreamChat = /*#__PURE__*/function () {
9093
9128
  }, _callee45, this);
9094
9129
  }));
9095
9130
 
9096
- function _unblockMessage(_x56) {
9131
+ function _unblockMessage(_x57) {
9097
9132
  return _unblockMessage2.apply(this, arguments);
9098
9133
  }
9099
9134
 
@@ -9232,7 +9267,7 @@ var StreamChat = /*#__PURE__*/function () {
9232
9267
  }, _callee47, this);
9233
9268
  }));
9234
9269
 
9235
- function translateMessage(_x57, _x58) {
9270
+ function translateMessage(_x58, _x59) {
9236
9271
  return _translateMessage.apply(this, arguments);
9237
9272
  }
9238
9273
 
@@ -9394,7 +9429,7 @@ var StreamChat = /*#__PURE__*/function () {
9394
9429
  }, _callee48, this);
9395
9430
  }));
9396
9431
 
9397
- function updateMessage(_x59, _x60, _x61) {
9432
+ function updateMessage(_x60, _x61, _x62) {
9398
9433
  return _updateMessage.apply(this, arguments);
9399
9434
  }
9400
9435
 
@@ -9455,7 +9490,7 @@ var StreamChat = /*#__PURE__*/function () {
9455
9490
  }, _callee49, this);
9456
9491
  }));
9457
9492
 
9458
- function partialUpdateMessage(_x62, _x63, _x64, _x65) {
9493
+ function partialUpdateMessage(_x63, _x64, _x65, _x66) {
9459
9494
  return _partialUpdateMessage.apply(this, arguments);
9460
9495
  }
9461
9496
 
@@ -9492,7 +9527,7 @@ var StreamChat = /*#__PURE__*/function () {
9492
9527
  }, _callee50, this);
9493
9528
  }));
9494
9529
 
9495
- function deleteMessage(_x66, _x67) {
9530
+ function deleteMessage(_x67, _x68) {
9496
9531
  return _deleteMessage.apply(this, arguments);
9497
9532
  }
9498
9533
 
@@ -9520,7 +9555,7 @@ var StreamChat = /*#__PURE__*/function () {
9520
9555
  }, _callee51, this);
9521
9556
  }));
9522
9557
 
9523
- function getMessage(_x68) {
9558
+ function getMessage(_x69) {
9524
9559
  return _getMessage.apply(this, arguments);
9525
9560
  }
9526
9561
 
@@ -9529,7 +9564,7 @@ var StreamChat = /*#__PURE__*/function () {
9529
9564
  }, {
9530
9565
  key: "getUserAgent",
9531
9566
  value: function getUserAgent() {
9532
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "6.3.0");
9567
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "6.5.1");
9533
9568
  }
9534
9569
  }, {
9535
9570
  key: "setUserAgent",
@@ -9745,7 +9780,7 @@ var StreamChat = /*#__PURE__*/function () {
9745
9780
  }, _callee52, this);
9746
9781
  }));
9747
9782
 
9748
- function sendUserCustomEvent(_x69, _x70) {
9783
+ function sendUserCustomEvent(_x70, _x71) {
9749
9784
  return _sendUserCustomEvent.apply(this, arguments);
9750
9785
  }
9751
9786
 
@@ -9838,7 +9873,7 @@ var StreamChat = /*#__PURE__*/function () {
9838
9873
  }, _callee53, this);
9839
9874
  }));
9840
9875
 
9841
- function createSegment(_x71) {
9876
+ function createSegment(_x72) {
9842
9877
  return _createSegment.apply(this, arguments);
9843
9878
  }
9844
9879
 
@@ -9878,7 +9913,7 @@ var StreamChat = /*#__PURE__*/function () {
9878
9913
  }, _callee54, this);
9879
9914
  }));
9880
9915
 
9881
- function getSegment(_x72) {
9916
+ function getSegment(_x73) {
9882
9917
  return _getSegment.apply(this, arguments);
9883
9918
  }
9884
9919
 
@@ -9917,7 +9952,7 @@ var StreamChat = /*#__PURE__*/function () {
9917
9952
  }, _callee55, this);
9918
9953
  }));
9919
9954
 
9920
- function listSegments(_x73) {
9955
+ function listSegments(_x74) {
9921
9956
  return _listSegments.apply(this, arguments);
9922
9957
  }
9923
9958
 
@@ -9960,7 +9995,7 @@ var StreamChat = /*#__PURE__*/function () {
9960
9995
  }, _callee56, this);
9961
9996
  }));
9962
9997
 
9963
- function updateSegment(_x74, _x75) {
9998
+ function updateSegment(_x75, _x76) {
9964
9999
  return _updateSegment.apply(this, arguments);
9965
10000
  }
9966
10001
 
@@ -9992,7 +10027,7 @@ var StreamChat = /*#__PURE__*/function () {
9992
10027
  }, _callee57, this);
9993
10028
  }));
9994
10029
 
9995
- function deleteSegment(_x76) {
10030
+ function deleteSegment(_x77) {
9996
10031
  return _deleteSegment.apply(this, arguments);
9997
10032
  }
9998
10033
 
@@ -10034,7 +10069,7 @@ var StreamChat = /*#__PURE__*/function () {
10034
10069
  }, _callee58, this);
10035
10070
  }));
10036
10071
 
10037
- function createCampaign(_x77) {
10072
+ function createCampaign(_x78) {
10038
10073
  return _createCampaign.apply(this, arguments);
10039
10074
  }
10040
10075
 
@@ -10074,7 +10109,7 @@ var StreamChat = /*#__PURE__*/function () {
10074
10109
  }, _callee59, this);
10075
10110
  }));
10076
10111
 
10077
- function getCampaign(_x78) {
10112
+ function getCampaign(_x79) {
10078
10113
  return _getCampaign.apply(this, arguments);
10079
10114
  }
10080
10115
 
@@ -10113,7 +10148,7 @@ var StreamChat = /*#__PURE__*/function () {
10113
10148
  }, _callee60, this);
10114
10149
  }));
10115
10150
 
10116
- function listCampaigns(_x79) {
10151
+ function listCampaigns(_x80) {
10117
10152
  return _listCampaigns.apply(this, arguments);
10118
10153
  }
10119
10154
 
@@ -10156,7 +10191,7 @@ var StreamChat = /*#__PURE__*/function () {
10156
10191
  }, _callee61, this);
10157
10192
  }));
10158
10193
 
10159
- function updateCampaign(_x80, _x81) {
10194
+ function updateCampaign(_x81, _x82) {
10160
10195
  return _updateCampaign.apply(this, arguments);
10161
10196
  }
10162
10197
 
@@ -10188,7 +10223,7 @@ var StreamChat = /*#__PURE__*/function () {
10188
10223
  }, _callee62, this);
10189
10224
  }));
10190
10225
 
10191
- function deleteCampaign(_x82) {
10226
+ function deleteCampaign(_x83) {
10192
10227
  return _deleteCampaign.apply(this, arguments);
10193
10228
  }
10194
10229
 
@@ -10232,7 +10267,7 @@ var StreamChat = /*#__PURE__*/function () {
10232
10267
  }, _callee63, this);
10233
10268
  }));
10234
10269
 
10235
- function scheduleCampaign(_x83, _x84) {
10270
+ function scheduleCampaign(_x84, _x85) {
10236
10271
  return _scheduleCampaign.apply(this, arguments);
10237
10272
  }
10238
10273
 
@@ -10272,7 +10307,7 @@ var StreamChat = /*#__PURE__*/function () {
10272
10307
  }, _callee64, this);
10273
10308
  }));
10274
10309
 
10275
- function stopCampaign(_x85) {
10310
+ function stopCampaign(_x86) {
10276
10311
  return _stopCampaign.apply(this, arguments);
10277
10312
  }
10278
10313
 
@@ -10312,7 +10347,7 @@ var StreamChat = /*#__PURE__*/function () {
10312
10347
  }, _callee65, this);
10313
10348
  }));
10314
10349
 
10315
- function resumeCampaign(_x86) {
10350
+ function resumeCampaign(_x87) {
10316
10351
  return _resumeCampaign.apply(this, arguments);
10317
10352
  }
10318
10353
 
@@ -10355,7 +10390,7 @@ var StreamChat = /*#__PURE__*/function () {
10355
10390
  }, _callee66, this);
10356
10391
  }));
10357
10392
 
10358
- function testCampaign(_x87, _x88) {
10393
+ function testCampaign(_x88, _x89) {
10359
10394
  return _testCampaign.apply(this, arguments);
10360
10395
  }
10361
10396
 
@@ -10388,7 +10423,7 @@ var StreamChat = /*#__PURE__*/function () {
10388
10423
  }, _callee67, this);
10389
10424
  }));
10390
10425
 
10391
- function enrichURL(_x89) {
10426
+ function enrichURL(_x90) {
10392
10427
  return _enrichURL.apply(this, arguments);
10393
10428
  }
10394
10429
 
@@ -10420,7 +10455,7 @@ var StreamChat = /*#__PURE__*/function () {
10420
10455
  }, _callee68, this);
10421
10456
  }));
10422
10457
 
10423
- function getTask(_x90) {
10458
+ function getTask(_x91) {
10424
10459
  return _getTask.apply(this, arguments);
10425
10460
  }
10426
10461
 
@@ -10462,7 +10497,7 @@ var StreamChat = /*#__PURE__*/function () {
10462
10497
  }, _callee69, this);
10463
10498
  }));
10464
10499
 
10465
- function deleteChannels(_x91) {
10500
+ function deleteChannels(_x92) {
10466
10501
  return _deleteChannels.apply(this, arguments);
10467
10502
  }
10468
10503
 
@@ -10525,7 +10560,7 @@ var StreamChat = /*#__PURE__*/function () {
10525
10560
  }, _callee70, this);
10526
10561
  }));
10527
10562
 
10528
- function deleteUsers(_x92, _x93) {
10563
+ function deleteUsers(_x93, _x94) {
10529
10564
  return _deleteUsers.apply(this, arguments);
10530
10565
  }
10531
10566
 
@@ -10540,7 +10575,6 @@ var StreamChat = /*#__PURE__*/function () {
10540
10575
  *
10541
10576
  * @private
10542
10577
  * @param {string} filename filename of uploaded data
10543
- *
10544
10578
  * @return {APIResponse & CreateImportResponse} An ImportTask
10545
10579
  */
10546
10580
 
@@ -10568,7 +10602,7 @@ var StreamChat = /*#__PURE__*/function () {
10568
10602
  }, _callee71, this);
10569
10603
  }));
10570
10604
 
10571
- function _createImportURL(_x94) {
10605
+ function _createImportURL(_x95) {
10572
10606
  return _createImportURL2.apply(this, arguments);
10573
10607
  }
10574
10608
 
@@ -10583,7 +10617,7 @@ var StreamChat = /*#__PURE__*/function () {
10583
10617
  *
10584
10618
  * @private
10585
10619
  * @param {string} path path of uploaded data
10586
- *
10620
+ * @param {CreateImportOptions} options import options
10587
10621
  * @return {APIResponse & CreateImportResponse} An ImportTask
10588
10622
  */
10589
10623
 
@@ -10591,19 +10625,24 @@ var StreamChat = /*#__PURE__*/function () {
10591
10625
  key: "_createImport",
10592
10626
  value: function () {
10593
10627
  var _createImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee72(path) {
10628
+ var options,
10629
+ _args72 = arguments;
10594
10630
  return _regeneratorRuntime__default['default'].wrap(function _callee72$(_context72) {
10595
10631
  while (1) {
10596
10632
  switch (_context72.prev = _context72.next) {
10597
10633
  case 0:
10598
- _context72.next = 2;
10599
- return this.post(this.baseURL + "/imports", {
10634
+ options = _args72.length > 1 && _args72[1] !== undefined ? _args72[1] : {
10635
+ mode: 'upsert'
10636
+ };
10637
+ _context72.next = 3;
10638
+ return this.post(this.baseURL + "/imports", _objectSpread({
10600
10639
  path: path
10601
- });
10640
+ }, options));
10602
10641
 
10603
- case 2:
10642
+ case 3:
10604
10643
  return _context72.abrupt("return", _context72.sent);
10605
10644
 
10606
- case 3:
10645
+ case 4:
10607
10646
  case "end":
10608
10647
  return _context72.stop();
10609
10648
  }
@@ -10611,7 +10650,7 @@ var StreamChat = /*#__PURE__*/function () {
10611
10650
  }, _callee72, this);
10612
10651
  }));
10613
10652
 
10614
- function _createImport(_x95) {
10653
+ function _createImport(_x96) {
10615
10654
  return _createImport2.apply(this, arguments);
10616
10655
  }
10617
10656
 
@@ -10652,7 +10691,7 @@ var StreamChat = /*#__PURE__*/function () {
10652
10691
  }, _callee73, this);
10653
10692
  }));
10654
10693
 
10655
- function _getImport(_x96) {
10694
+ function _getImport(_x97) {
10656
10695
  return _getImport2.apply(this, arguments);
10657
10696
  }
10658
10697
 
@@ -10693,7 +10732,7 @@ var StreamChat = /*#__PURE__*/function () {
10693
10732
  }, _callee74, this);
10694
10733
  }));
10695
10734
 
10696
- function _listImports(_x97) {
10735
+ function _listImports(_x98) {
10697
10736
  return _listImports2.apply(this, arguments);
10698
10737
  }
10699
10738
 
@@ -10733,7 +10772,7 @@ var StreamChat = /*#__PURE__*/function () {
10733
10772
  }, _callee75, this);
10734
10773
  }));
10735
10774
 
10736
- function upsertPushProvider(_x98) {
10775
+ function upsertPushProvider(_x99) {
10737
10776
  return _upsertPushProvider.apply(this, arguments);
10738
10777
  }
10739
10778
 
@@ -10773,7 +10812,7 @@ var StreamChat = /*#__PURE__*/function () {
10773
10812
  }, _callee76, this);
10774
10813
  }));
10775
10814
 
10776
- function deletePushProvider(_x99) {
10815
+ function deletePushProvider(_x100) {
10777
10816
  return _deletePushProvider.apply(this, arguments);
10778
10817
  }
10779
10818