stream-chat 8.60.0 → 8.61.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.
@@ -4,10 +4,10 @@ import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
4
4
  import _createClass from '@babel/runtime/helpers/createClass';
5
5
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
6
6
  import _regeneratorRuntime from '@babel/runtime/regenerator';
7
- import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
8
7
  import _extends from '@babel/runtime/helpers/extends';
9
8
  import _typeof from '@babel/runtime/helpers/typeof';
10
9
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
10
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
11
11
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
12
12
  import axios from 'axios';
13
13
  import FormData from 'form-data';
@@ -11831,6 +11831,10 @@ var StreamChat = /*#__PURE__*/function () {
11831
11831
 
11832
11832
  _defineProperty(this, "deviceIdentifier", void 0);
11833
11833
 
11834
+ _defineProperty(this, "appIdentifier", void 0);
11835
+
11836
+ _defineProperty(this, "cachedUserAgent", void 0);
11837
+
11834
11838
  _defineProperty(this, "nextRequestAbortController", null);
11835
11839
 
11836
11840
  _defineProperty(this, "_getConnectionID", function () {
@@ -12568,6 +12572,55 @@ var StreamChat = /*#__PURE__*/function () {
12568
12572
 
12569
12573
  _defineProperty(this, "markAllRead", this.markChannelsRead);
12570
12574
 
12575
+ _defineProperty(this, "getUserAgent", function () {
12576
+ // An explicit override (deprecated `setUserAgent`) always wins and is never cached.
12577
+ if (_this.userAgent) {
12578
+ return _this.userAgent;
12579
+ } // Computed once, then memoized for the client's lifetime - inputs read on
12580
+ // the first call (sdk/app/device identifiers, build-time env) are not re-read.
12581
+
12582
+
12583
+ if (!_this.cachedUserAgent) {
12584
+ var _this$sdkIdentifier, _this$appIdentifier, _this$deviceIdentifie;
12585
+
12586
+ var version = "8.61.0";
12587
+
12588
+ var _ref8 = (_this$sdkIdentifier = _this.sdkIdentifier) !== null && _this$sdkIdentifier !== void 0 ? _this$sdkIdentifier : {},
12589
+ sdkName = _ref8.name,
12590
+ sdkVersion = _ref8.version;
12591
+
12592
+ var _ref9 = (_this$appIdentifier = _this.appIdentifier) !== null && _this$appIdentifier !== void 0 ? _this$appIdentifier : {},
12593
+ appName = _ref9.name,
12594
+ appVersion = _ref9.version;
12595
+
12596
+ var _ref10 = (_this$deviceIdentifie = _this.deviceIdentifier) !== null && _this$deviceIdentifie !== void 0 ? _this$deviceIdentifie : {},
12597
+ os = _ref10.os,
12598
+ deviceModel = _ref10.model;
12599
+
12600
+ var head = sdkName ? "stream-chat-".concat(sdkName, "-v").concat(sdkVersion, "-llc-v").concat(version) : "stream-chat-js-v".concat(version, "-").concat(_this.node ? 'node' : 'browser');
12601
+ _this.cachedUserAgent = [head].concat(_toConsumableArray(Object.entries({
12602
+ app: appName,
12603
+ app_version: appVersion,
12604
+ os: os,
12605
+ device_model: deviceModel,
12606
+ client_bundle: ""
12607
+ }).filter(function (_ref11) {
12608
+ var _ref12 = _slicedToArray(_ref11, 2),
12609
+ value = _ref12[1];
12610
+
12611
+ return value && value.length > 0;
12612
+ }).map(function (_ref13) {
12613
+ var _ref14 = _slicedToArray(_ref13, 2),
12614
+ key = _ref14[0],
12615
+ value = _ref14[1];
12616
+
12617
+ return "".concat(key, "=").concat(value);
12618
+ }))).join('|');
12619
+ }
12620
+
12621
+ return _this.cachedUserAgent;
12622
+ });
12623
+
12571
12624
  _defineProperty(this, "_isUsingServerAuth", function () {
12572
12625
  return !!_this.secret;
12573
12626
  });
@@ -14344,13 +14397,13 @@ var StreamChat = /*#__PURE__*/function () {
14344
14397
  key: "getRateLimits",
14345
14398
  value: function () {
14346
14399
  var _getRateLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(params) {
14347
- var _ref8, serverSide, web, android, ios, endpoints;
14400
+ var _ref15, serverSide, web, android, ios, endpoints;
14348
14401
 
14349
14402
  return _regeneratorRuntime.wrap(function _callee29$(_context29) {
14350
14403
  while (1) {
14351
14404
  switch (_context29.prev = _context29.next) {
14352
14405
  case 0:
14353
- _ref8 = params || {}, serverSide = _ref8.serverSide, web = _ref8.web, android = _ref8.android, ios = _ref8.ios, endpoints = _ref8.endpoints;
14406
+ _ref15 = params || {}, serverSide = _ref15.serverSide, web = _ref15.web, android = _ref15.android, ios = _ref15.ios, endpoints = _ref15.endpoints;
14354
14407
  return _context29.abrupt("return", this.get(this.baseURL + '/rate_limits', {
14355
14408
  server_side: serverSide,
14356
14409
  web: web,
@@ -14375,9 +14428,9 @@ var StreamChat = /*#__PURE__*/function () {
14375
14428
  }()
14376
14429
  }, {
14377
14430
  key: "_addChannelConfig",
14378
- value: function _addChannelConfig(_ref9) {
14379
- var cid = _ref9.cid,
14380
- config = _ref9.config;
14431
+ value: function _addChannelConfig(_ref16) {
14432
+ var cid = _ref16.cid,
14433
+ config = _ref16.config;
14381
14434
 
14382
14435
  if (this._cacheEnabled()) {
14383
14436
  this.configs[cid] = config;
@@ -16376,47 +16429,13 @@ var StreamChat = /*#__PURE__*/function () {
16376
16429
  return partialUpdateThread;
16377
16430
  }()
16378
16431
  }, {
16379
- key: "getUserAgent",
16380
- value: function getUserAgent() {
16381
- var _this$deviceIdentifie;
16382
-
16383
- if (this.userAgent) {
16384
- return this.userAgent;
16385
- }
16386
-
16387
- var version = "8.60.0";
16388
- var clientBundle = "";
16389
- var userAgentString = '';
16390
-
16391
- if (this.sdkIdentifier) {
16392
- userAgentString = "stream-chat-".concat(this.sdkIdentifier.name, "-v").concat(this.sdkIdentifier.version, "-llc-v").concat(version);
16393
- } else {
16394
- userAgentString = "stream-chat-js-v".concat(version, "-").concat(this.node ? 'node' : 'browser');
16395
- }
16396
-
16397
- var _ref10 = (_this$deviceIdentifie = this.deviceIdentifier) !== null && _this$deviceIdentifie !== void 0 ? _this$deviceIdentifie : {},
16398
- os = _ref10.os,
16399
- model = _ref10.model;
16400
-
16401
- return [// reports the device OS, if provided
16402
- ['os', os], // reports the device model, if provided
16403
- ['device_model', model], // reports which bundle is being picked from the exports
16404
- ['client_bundle', clientBundle]].reduce(function (withArguments, _ref11) {
16405
- var _ref12 = _slicedToArray(_ref11, 2),
16406
- key = _ref12[0],
16407
- value = _ref12[1];
16408
-
16409
- return value && value.length > 0 ? withArguments.concat("|".concat(key, "=").concat(value)) : withArguments;
16410
- }, userAgentString);
16411
- }
16432
+ key: "setUserAgent",
16433
+ value:
16412
16434
  /**
16413
16435
  * @deprecated use sdkIdentifier instead
16414
16436
  * @param userAgent
16415
16437
  */
16416
-
16417
- }, {
16418
- key: "setUserAgent",
16419
- value: function setUserAgent(userAgent) {
16438
+ function setUserAgent(userAgent) {
16420
16439
  this.userAgent = userAgent;
16421
16440
  }
16422
16441
  /**
@@ -16452,10 +16471,10 @@ var StreamChat = /*#__PURE__*/function () {
16452
16471
  });
16453
16472
  }
16454
16473
 
16455
- var _ref13 = this.options.axiosRequestConfig || {},
16456
- axiosRequestConfigParams = _ref13.params,
16457
- axiosRequestConfigHeaders = _ref13.headers,
16458
- axiosRequestConfigRest = _objectWithoutProperties(_ref13, _excluded2);
16474
+ var _ref17 = this.options.axiosRequestConfig || {},
16475
+ axiosRequestConfigParams = _ref17.params,
16476
+ axiosRequestConfigHeaders = _ref17.headers,
16477
+ axiosRequestConfigRest = _objectWithoutProperties(_ref17, _excluded2);
16459
16478
 
16460
16479
  return _objectSpread$1(_objectSpread$1(_objectSpread$1({
16461
16480
  params: _objectSpread$1(_objectSpread$1({
@@ -17798,13 +17817,13 @@ var StreamChat = /*#__PURE__*/function () {
17798
17817
  }, {
17799
17818
  key: "deletePushProvider",
17800
17819
  value: function () {
17801
- var _deletePushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee97(_ref14) {
17820
+ var _deletePushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee97(_ref18) {
17802
17821
  var type, name;
17803
17822
  return _regeneratorRuntime.wrap(function _callee97$(_context97) {
17804
17823
  while (1) {
17805
17824
  switch (_context97.prev = _context97.next) {
17806
17825
  case 0:
17807
- type = _ref14.type, name = _ref14.name;
17826
+ type = _ref18.type, name = _ref18.name;
17808
17827
  _context97.next = 3;
17809
17828
  return this.delete(this.baseURL + "/push_providers/".concat(encodeURIComponent(type), "/").concat(encodeURIComponent(name)));
17810
17829