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.
package/dist/index.es.js CHANGED
@@ -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 https from 'https';
@@ -11834,6 +11834,10 @@ var StreamChat = /*#__PURE__*/function () {
11834
11834
 
11835
11835
  _defineProperty(this, "deviceIdentifier", void 0);
11836
11836
 
11837
+ _defineProperty(this, "appIdentifier", void 0);
11838
+
11839
+ _defineProperty(this, "cachedUserAgent", void 0);
11840
+
11837
11841
  _defineProperty(this, "nextRequestAbortController", null);
11838
11842
 
11839
11843
  _defineProperty(this, "_getConnectionID", function () {
@@ -12571,6 +12575,55 @@ var StreamChat = /*#__PURE__*/function () {
12571
12575
 
12572
12576
  _defineProperty(this, "markAllRead", this.markChannelsRead);
12573
12577
 
12578
+ _defineProperty(this, "getUserAgent", function () {
12579
+ // An explicit override (deprecated `setUserAgent`) always wins and is never cached.
12580
+ if (_this.userAgent) {
12581
+ return _this.userAgent;
12582
+ } // Computed once, then memoized for the client's lifetime - inputs read on
12583
+ // the first call (sdk/app/device identifiers, build-time env) are not re-read.
12584
+
12585
+
12586
+ if (!_this.cachedUserAgent) {
12587
+ var _this$sdkIdentifier, _this$appIdentifier, _this$deviceIdentifie;
12588
+
12589
+ var version = "8.61.0";
12590
+
12591
+ var _ref8 = (_this$sdkIdentifier = _this.sdkIdentifier) !== null && _this$sdkIdentifier !== void 0 ? _this$sdkIdentifier : {},
12592
+ sdkName = _ref8.name,
12593
+ sdkVersion = _ref8.version;
12594
+
12595
+ var _ref9 = (_this$appIdentifier = _this.appIdentifier) !== null && _this$appIdentifier !== void 0 ? _this$appIdentifier : {},
12596
+ appName = _ref9.name,
12597
+ appVersion = _ref9.version;
12598
+
12599
+ var _ref10 = (_this$deviceIdentifie = _this.deviceIdentifier) !== null && _this$deviceIdentifie !== void 0 ? _this$deviceIdentifie : {},
12600
+ os = _ref10.os,
12601
+ deviceModel = _ref10.model;
12602
+
12603
+ 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');
12604
+ _this.cachedUserAgent = [head].concat(_toConsumableArray(Object.entries({
12605
+ app: appName,
12606
+ app_version: appVersion,
12607
+ os: os,
12608
+ device_model: deviceModel,
12609
+ client_bundle: ""
12610
+ }).filter(function (_ref11) {
12611
+ var _ref12 = _slicedToArray(_ref11, 2),
12612
+ value = _ref12[1];
12613
+
12614
+ return value && value.length > 0;
12615
+ }).map(function (_ref13) {
12616
+ var _ref14 = _slicedToArray(_ref13, 2),
12617
+ key = _ref14[0],
12618
+ value = _ref14[1];
12619
+
12620
+ return "".concat(key, "=").concat(value);
12621
+ }))).join('|');
12622
+ }
12623
+
12624
+ return _this.cachedUserAgent;
12625
+ });
12626
+
12574
12627
  _defineProperty(this, "_isUsingServerAuth", function () {
12575
12628
  return !!_this.secret;
12576
12629
  });
@@ -14347,13 +14400,13 @@ var StreamChat = /*#__PURE__*/function () {
14347
14400
  key: "getRateLimits",
14348
14401
  value: function () {
14349
14402
  var _getRateLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(params) {
14350
- var _ref8, serverSide, web, android, ios, endpoints;
14403
+ var _ref15, serverSide, web, android, ios, endpoints;
14351
14404
 
14352
14405
  return _regeneratorRuntime.wrap(function _callee29$(_context29) {
14353
14406
  while (1) {
14354
14407
  switch (_context29.prev = _context29.next) {
14355
14408
  case 0:
14356
- _ref8 = params || {}, serverSide = _ref8.serverSide, web = _ref8.web, android = _ref8.android, ios = _ref8.ios, endpoints = _ref8.endpoints;
14409
+ _ref15 = params || {}, serverSide = _ref15.serverSide, web = _ref15.web, android = _ref15.android, ios = _ref15.ios, endpoints = _ref15.endpoints;
14357
14410
  return _context29.abrupt("return", this.get(this.baseURL + '/rate_limits', {
14358
14411
  server_side: serverSide,
14359
14412
  web: web,
@@ -14378,9 +14431,9 @@ var StreamChat = /*#__PURE__*/function () {
14378
14431
  }()
14379
14432
  }, {
14380
14433
  key: "_addChannelConfig",
14381
- value: function _addChannelConfig(_ref9) {
14382
- var cid = _ref9.cid,
14383
- config = _ref9.config;
14434
+ value: function _addChannelConfig(_ref16) {
14435
+ var cid = _ref16.cid,
14436
+ config = _ref16.config;
14384
14437
 
14385
14438
  if (this._cacheEnabled()) {
14386
14439
  this.configs[cid] = config;
@@ -16379,47 +16432,13 @@ var StreamChat = /*#__PURE__*/function () {
16379
16432
  return partialUpdateThread;
16380
16433
  }()
16381
16434
  }, {
16382
- key: "getUserAgent",
16383
- value: function getUserAgent() {
16384
- var _this$deviceIdentifie;
16385
-
16386
- if (this.userAgent) {
16387
- return this.userAgent;
16388
- }
16389
-
16390
- var version = "8.60.0";
16391
- var clientBundle = "";
16392
- var userAgentString = '';
16393
-
16394
- if (this.sdkIdentifier) {
16395
- userAgentString = "stream-chat-".concat(this.sdkIdentifier.name, "-v").concat(this.sdkIdentifier.version, "-llc-v").concat(version);
16396
- } else {
16397
- userAgentString = "stream-chat-js-v".concat(version, "-").concat(this.node ? 'node' : 'browser');
16398
- }
16399
-
16400
- var _ref10 = (_this$deviceIdentifie = this.deviceIdentifier) !== null && _this$deviceIdentifie !== void 0 ? _this$deviceIdentifie : {},
16401
- os = _ref10.os,
16402
- model = _ref10.model;
16403
-
16404
- return [// reports the device OS, if provided
16405
- ['os', os], // reports the device model, if provided
16406
- ['device_model', model], // reports which bundle is being picked from the exports
16407
- ['client_bundle', clientBundle]].reduce(function (withArguments, _ref11) {
16408
- var _ref12 = _slicedToArray(_ref11, 2),
16409
- key = _ref12[0],
16410
- value = _ref12[1];
16411
-
16412
- return value && value.length > 0 ? withArguments.concat("|".concat(key, "=").concat(value)) : withArguments;
16413
- }, userAgentString);
16414
- }
16435
+ key: "setUserAgent",
16436
+ value:
16415
16437
  /**
16416
16438
  * @deprecated use sdkIdentifier instead
16417
16439
  * @param userAgent
16418
16440
  */
16419
-
16420
- }, {
16421
- key: "setUserAgent",
16422
- value: function setUserAgent(userAgent) {
16441
+ function setUserAgent(userAgent) {
16423
16442
  this.userAgent = userAgent;
16424
16443
  }
16425
16444
  /**
@@ -16455,10 +16474,10 @@ var StreamChat = /*#__PURE__*/function () {
16455
16474
  });
16456
16475
  }
16457
16476
 
16458
- var _ref13 = this.options.axiosRequestConfig || {},
16459
- axiosRequestConfigParams = _ref13.params,
16460
- axiosRequestConfigHeaders = _ref13.headers,
16461
- axiosRequestConfigRest = _objectWithoutProperties(_ref13, _excluded2);
16477
+ var _ref17 = this.options.axiosRequestConfig || {},
16478
+ axiosRequestConfigParams = _ref17.params,
16479
+ axiosRequestConfigHeaders = _ref17.headers,
16480
+ axiosRequestConfigRest = _objectWithoutProperties(_ref17, _excluded2);
16462
16481
 
16463
16482
  return _objectSpread$1(_objectSpread$1(_objectSpread$1({
16464
16483
  params: _objectSpread$1(_objectSpread$1({
@@ -17801,13 +17820,13 @@ var StreamChat = /*#__PURE__*/function () {
17801
17820
  }, {
17802
17821
  key: "deletePushProvider",
17803
17822
  value: function () {
17804
- var _deletePushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee97(_ref14) {
17823
+ var _deletePushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee97(_ref18) {
17805
17824
  var type, name;
17806
17825
  return _regeneratorRuntime.wrap(function _callee97$(_context97) {
17807
17826
  while (1) {
17808
17827
  switch (_context97.prev = _context97.next) {
17809
17828
  case 0:
17810
- type = _ref14.type, name = _ref14.name;
17829
+ type = _ref18.type, name = _ref18.name;
17811
17830
  _context97.next = 3;
17812
17831
  return this.delete(this.baseURL + "/push_providers/".concat(encodeURIComponent(type), "/").concat(encodeURIComponent(name)));
17813
17832