@sambath999/localize-token 12.4.6 → 12.4.7

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.
@@ -668,8 +668,11 @@
668
668
  };
669
669
  LocalizeTokenService.prototype.tokensValid = function () {
670
670
  var _a, _b;
671
- return !!((_a = this.refreshToken) === null || _a === void 0 ? void 0 : _a.length)
672
- && (!this.config.tenantToken || !!((_b = this.tenantToken) === null || _b === void 0 ? void 0 : _b.length));
671
+ if (!((_a = this.refreshToken) === null || _a === void 0 ? void 0 : _a.length))
672
+ return false;
673
+ if (this.config.requiredTenant && !((_b = this.tenantToken) === null || _b === void 0 ? void 0 : _b.length))
674
+ return false;
675
+ return true;
673
676
  };
674
677
  Object.defineProperty(LocalizeTokenService.prototype, "decodeRefreshToken", {
675
678
  get: function () {
@@ -1251,7 +1254,7 @@
1251
1254
  var _this = this;
1252
1255
  return __generator(this, function (_e) {
1253
1256
  switch (_e.label) {
1254
- case 0: return [4 /*yield*/, waitUntil(function () { return !_this.isResolvingStartup; }, 100)];
1257
+ case 0: return [4 /*yield*/, waitUntil(function () { return !_this.isResolvingStartup; }, 500)];
1255
1258
  case 1:
1256
1259
  _e.sent();
1257
1260
  return [4 /*yield*/, ApiHelper.invokeHook(this.config.onPrepareRequest)];
@@ -1364,7 +1367,7 @@
1364
1367
  case 5:
1365
1368
  // Handle the error, log it
1366
1369
  _e.sent();
1367
- return [3 /*break*/, 7];
1370
+ throw error_2;
1368
1371
  case 6:
1369
1372
  // Reset the revoking token state
1370
1373
  this.isRevokingToken = false;
@@ -1397,10 +1400,8 @@
1397
1400
  switch (_e.label) {
1398
1401
  case 0:
1399
1402
  if (!this.isRevokingToken) return [3 /*break*/, 2];
1400
- // console.warn('A token refresh is in progress. Request is waiting.');
1401
1403
  return [4 /*yield*/, waitUntil(function () { return !_this.isRevokingToken; })];
1402
1404
  case 1:
1403
- // console.warn('A token refresh is in progress. Request is waiting.');
1404
1405
  _e.sent();
1405
1406
  _e.label = 2;
1406
1407
  case 2:
@@ -1462,7 +1463,7 @@
1462
1463
  };
1463
1464
  LocalizeApiService.prototype.validateConfig = function () {
1464
1465
  var _a, _b, _c, _d;
1465
- if (this.localizeTokenService.config.tenantToken
1466
+ if (this.localizeTokenService.config.requiredTenant
1466
1467
  && !((_b = (_a = this.localizeTokenService.config.tenantToken) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.trim().length)) {
1467
1468
  throw Error('Tenant token is required but tenantTokenName is not configured');
1468
1469
  }