@axa-fr/react-oidc 6.0.0-beta0 → 6.0.0-beta11

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.
Files changed (47) hide show
  1. package/README.md +21 -11
  2. package/dist/OidcProvider.d.ts +3 -3
  3. package/dist/OidcProvider.d.ts.map +1 -1
  4. package/dist/OidcProvider.js +15 -7
  5. package/dist/OidcProvider.js.map +1 -1
  6. package/dist/OidcServiceWorker.js +21 -4
  7. package/dist/OidcTrustedDomains.js +7 -2
  8. package/dist/ReactOidc.d.ts.map +1 -1
  9. package/dist/ReactOidc.js +3 -2
  10. package/dist/ReactOidc.js.map +1 -1
  11. package/dist/core/default-component/SilentCallback.component.d.ts.map +1 -1
  12. package/dist/core/default-component/SilentCallback.component.js +5 -19
  13. package/dist/core/default-component/SilentCallback.component.js.map +1 -1
  14. package/dist/core/default-component/SilentLogin.component.d.ts +4 -0
  15. package/dist/core/default-component/SilentLogin.component.d.ts.map +1 -0
  16. package/dist/core/default-component/{SilentSignin.component.js → SilentLogin.component.js} +3 -3
  17. package/dist/core/default-component/SilentLogin.component.js.map +1 -0
  18. package/dist/core/routes/OidcRoutes.d.ts +1 -1
  19. package/dist/core/routes/OidcRoutes.d.ts.map +1 -1
  20. package/dist/core/routes/OidcRoutes.js +5 -8
  21. package/dist/core/routes/OidcRoutes.js.map +1 -1
  22. package/dist/vanilla/checkSessionIFrame.d.ts +6 -6
  23. package/dist/vanilla/checkSessionIFrame.d.ts.map +1 -1
  24. package/dist/vanilla/checkSessionIFrame.js +1 -1
  25. package/dist/vanilla/checkSessionIFrame.js.map +1 -1
  26. package/dist/vanilla/oidc.d.ts +14 -12
  27. package/dist/vanilla/oidc.d.ts.map +1 -1
  28. package/dist/vanilla/oidc.js +289 -169
  29. package/dist/vanilla/oidc.js.map +1 -1
  30. package/package.json +1 -1
  31. package/src/oidc/OidcProvider.tsx +18 -10
  32. package/src/oidc/ReactOidc.tsx +3 -2
  33. package/src/oidc/core/default-component/SilentCallback.component.tsx +1 -6
  34. package/src/oidc/core/default-component/{SilentSignin.component.tsx → SilentLogin.component.tsx} +2 -2
  35. package/src/oidc/core/routes/OidcRoutes.tsx +6 -10
  36. package/src/oidc/vanilla/OidcServiceWorker.js +21 -4
  37. package/src/oidc/vanilla/OidcTrustedDomains.js +7 -2
  38. package/src/oidc/vanilla/checkSessionIFrame.ts +7 -7
  39. package/src/oidc/vanilla/oidc.ts +202 -139
  40. package/dist/core/default-component/ServiceWorkerInstall.component.d.ts +0 -4
  41. package/dist/core/default-component/ServiceWorkerInstall.component.d.ts.map +0 -1
  42. package/dist/core/default-component/ServiceWorkerInstall.component.js +0 -131
  43. package/dist/core/default-component/ServiceWorkerInstall.component.js.map +0 -1
  44. package/dist/core/default-component/SilentSignin.component.d.ts +0 -4
  45. package/dist/core/default-component/SilentSignin.component.d.ts.map +0 -1
  46. package/dist/core/default-component/SilentSignin.component.js.map +0 -1
  47. package/src/oidc/core/default-component/ServiceWorkerInstall.component.tsx +0 -60
@@ -75,7 +75,7 @@ var timer_1 = __importDefault(require("./timer"));
75
75
  var checkSessionIFrame_1 = require("./checkSessionIFrame");
76
76
  var route_utils_1 = require("./route-utils");
77
77
  var performTokenRequestAsync = function (url, details, extras) { return __awaiter(void 0, void 0, void 0, function () {
78
- var _i, _a, _b, key, value, formBody, property, encodedKey, encodedValue, formBodyString, response, result;
78
+ var _i, _a, _b, key, value, formBody, property, encodedKey, encodedValue, formBodyString, response, tokens, currentTimeUnixSecond;
79
79
  return __generator(this, function (_c) {
80
80
  switch (_c.label) {
81
81
  case 0:
@@ -106,15 +106,20 @@ var performTokenRequestAsync = function (url, details, extras) { return __awaite
106
106
  }
107
107
  return [4 /*yield*/, response.json()];
108
108
  case 2:
109
- result = _c.sent();
109
+ tokens = _c.sent();
110
+ if (!tokens.issued_at) {
111
+ currentTimeUnixSecond = new Date().getTime() / 1000;
112
+ tokens.issued_at = currentTimeUnixSecond;
113
+ }
110
114
  return [2 /*return*/, { success: true,
111
115
  data: {
112
- accessToken: result.access_token,
113
- expiresIn: result.expires_in,
114
- idToken: result.id_token,
115
- refreshToken: result.refresh_token,
116
- scope: result.scope,
117
- tokenType: result.token_type,
116
+ accessToken: tokens.access_token,
117
+ expiresIn: tokens.expires_in,
118
+ idToken: tokens.id_token,
119
+ refreshToken: tokens.refresh_token,
120
+ scope: tokens.scope,
121
+ tokenType: tokens.token_type,
122
+ issuedAt: tokens.issued_at
118
123
  }
119
124
  }];
120
125
  }
@@ -123,23 +128,22 @@ var performTokenRequestAsync = function (url, details, extras) { return __awaite
123
128
  var internalFetch = function (url, headers, numberRetry) {
124
129
  if (numberRetry === void 0) { numberRetry = 0; }
125
130
  return __awaiter(void 0, void 0, void 0, function () {
126
- var response, e_1;
131
+ var response, controller_1, e_1;
127
132
  return __generator(this, function (_a) {
128
133
  switch (_a.label) {
129
134
  case 0:
130
135
  _a.trys.push([0, 2, , 8]);
131
- return [4 /*yield*/, Promise.race([
132
- fetch(url, headers),
133
- new Promise(function (_, reject) { return setTimeout(function () { return reject(new Error('Timeout')); }, 10000); })
134
- ])];
136
+ controller_1 = new AbortController();
137
+ setTimeout(function () { return controller_1.abort(); }, 10000);
138
+ return [4 /*yield*/, fetch(url, __assign(__assign({}, headers), { signal: controller_1.signal }))];
135
139
  case 1:
136
140
  response = _a.sent();
137
141
  return [3 /*break*/, 8];
138
142
  case 2:
139
143
  e_1 = _a.sent();
140
- if (!(e_1.message === 'Timeout'
144
+ if (!(e_1.message === 'AbortError'
141
145
  || e_1.message === 'Network request failed')) return [3 /*break*/, 6];
142
- if (!(numberRetry <= 2)) return [3 /*break*/, 4];
146
+ if (!(numberRetry <= 1)) return [3 /*break*/, 4];
143
147
  return [4 /*yield*/, internalFetch(url, headers, numberRetry + 1)];
144
148
  case 3: return [2 /*return*/, _a.sent()];
145
149
  case 4: throw e_1;
@@ -219,7 +223,7 @@ var autoRenewTokens = function (oidc, refreshToken, expiresAt) {
219
223
  var _a;
220
224
  var refreshTimeBeforeTokensExpirationInSecond = (_a = oidc.configuration.refresh_time_before_tokens_expiration_in_second) !== null && _a !== void 0 ? _a : 60;
221
225
  return timer_1.default.setTimeout(function () { return __awaiter(void 0, void 0, void 0, function () {
222
- var currentTimeUnixSecond, timeInfo, tokens, _a;
226
+ var currentTimeUnixSecond, timeInfo, tokens, _a, tokens;
223
227
  return __generator(this, function (_b) {
224
228
  switch (_b.label) {
225
229
  case 0:
@@ -254,9 +258,9 @@ var autoRenewTokens = function (oidc, refreshToken, expiresAt) {
254
258
  return [3 /*break*/, 7];
255
259
  case 5: return [4 /*yield*/, oidc.syncTokensAsync()];
256
260
  case 6:
257
- _b.sent();
258
- if (oidc.timeoutId) {
259
- oidc.timeoutId = autoRenewTokens(oidc, refreshToken, expiresAt);
261
+ tokens = _b.sent();
262
+ if (tokens && oidc.timeoutId) {
263
+ oidc.timeoutId = autoRenewTokens(oidc, tokens.refreshToken, tokens.expiresAt);
260
264
  }
261
265
  _b.label = 7;
262
266
  case 7: return [2 /*return*/];
@@ -299,7 +303,7 @@ var userInfoAsync = function (oidc) { return __awaiter(void 0, void 0, void 0, f
299
303
  case 0: return [4 /*yield*/, fetch(url, {
300
304
  headers: {
301
305
  authorization: "Bearer ".concat(accessToken),
302
- credentials: 'same-origin'
306
+ credentials: 'include'
303
307
  }
304
308
  })];
305
309
  case 1:
@@ -320,7 +324,7 @@ var userInfoAsync = function (oidc) { return __awaiter(void 0, void 0, void 0, f
320
324
  });
321
325
  }); };
322
326
  var setTokensAsync = function (serviceWorker, tokens) { return __awaiter(void 0, void 0, void 0, function () {
323
- var accessTokenPayload, _idTokenPayload, expiresAt;
327
+ var accessTokenPayload, _idTokenPayload, idTokenExipreAt, accessTokenExpiresAt, expiresAt;
324
328
  return __generator(this, function (_a) {
325
329
  switch (_a.label) {
326
330
  case 0:
@@ -342,7 +346,9 @@ var setTokensAsync = function (serviceWorker, tokens) { return __awaiter(void 0,
342
346
  _a.label = 6;
343
347
  case 6:
344
348
  _idTokenPayload = idTokenPayload(tokens.idToken);
345
- expiresAt = (_idTokenPayload && _idTokenPayload.exp) ? _idTokenPayload.exp : tokens.issuedAt + tokens.expiresIn;
349
+ idTokenExipreAt = (_idTokenPayload && _idTokenPayload.exp) ? _idTokenPayload.exp : Number.MAX_VALUE;
350
+ accessTokenExpiresAt = (accessTokenPayload && accessTokenPayload.exp) ? accessTokenPayload.exp : tokens.issuedAt + tokens.expiresIn;
351
+ expiresAt = idTokenExipreAt < accessTokenExpiresAt ? idTokenExipreAt : accessTokenExpiresAt;
346
352
  return [2 /*return*/, __assign(__assign({}, tokens), { idTokenPayload: _idTokenPayload, accessTokenPayload: accessTokenPayload, expiresAt: expiresAt })];
347
353
  }
348
354
  });
@@ -351,6 +357,7 @@ var eventNames = {
351
357
  service_worker_not_supported_by_browser: "service_worker_not_supported_by_browser",
352
358
  token_aquired: "token_aquired",
353
359
  logout_from_another_tab: "logout_from_another_tab",
360
+ logout_from_same_tab: "logout_from_same_tab",
354
361
  token_renewed: "token_renewed",
355
362
  token_timer: "token_timer",
356
363
  loginAsync_begin: "loginAsync_begin",
@@ -366,10 +373,10 @@ var eventNames = {
366
373
  tryKeepExistingSessionAsync_begin: "tryKeepExistingSessionAsync_begin",
367
374
  tryKeepExistingSessionAsync_end: "tryKeepExistingSessionAsync_end",
368
375
  tryKeepExistingSessionAsync_error: "tryKeepExistingSessionAsync_error",
369
- silentSigninAsync_begin: "silentSigninAsync_begin",
370
- silentSigninAsync: "silentSigninAsync",
371
- silentSigninAsync_end: "silentSigninAsync_end",
372
- silentSigninAsync_error: "silentSigninAsync_error",
376
+ silentLoginAsync_begin: "silentLoginAsync_begin",
377
+ silentLoginAsync: "silentLoginAsync",
378
+ silentLoginAsync_end: "silentLoginAsync_end",
379
+ silentLoginAsync_error: "silentLoginAsync_error",
373
380
  syncTokensAsync_begin: "syncTokensAsync_begin",
374
381
  syncTokensAsync_end: "syncTokensAsync_end",
375
382
  syncTokensAsync_error: "syncTokensAsync_error"
@@ -377,23 +384,28 @@ var eventNames = {
377
384
  var getRandomInt = function (max) {
378
385
  return Math.floor(Math.random() * max);
379
386
  };
380
- var WELL_KNOWN_PATH = '.well-known';
381
- var OPENID_CONFIGURATION = 'openid-configuration';
382
387
  var oneHourSecond = 60 * 60;
383
- var fetchFromIssuer = function (openIdIssuerUrl, timeCacheSecond) {
388
+ var fetchFromIssuerCache = null;
389
+ var fetchFromIssuer = function (openIdIssuerUrl, timeCacheSecond, storage) {
384
390
  if (timeCacheSecond === void 0) { timeCacheSecond = oneHourSecond; }
391
+ if (storage === void 0) { storage = window.sessionStorage; }
385
392
  return __awaiter(void 0, void 0, void 0, function () {
386
- var fullUrl, localStorageKey, cacheJson, oneHourMinisecond, response, result;
393
+ var fullUrl, localStorageKey, cacheJson, oneHourMinisecond, response, result, timestamp;
387
394
  return __generator(this, function (_a) {
388
395
  switch (_a.label) {
389
396
  case 0:
390
- fullUrl = "".concat(openIdIssuerUrl, "/").concat(WELL_KNOWN_PATH, "/").concat(OPENID_CONFIGURATION);
397
+ fullUrl = "".concat(openIdIssuerUrl, "/.well-known/openid-configuration");
391
398
  localStorageKey = "oidc.server:".concat(openIdIssuerUrl);
392
- cacheJson = window.localStorage.getItem(localStorageKey);
399
+ if (!fetchFromIssuerCache && storage) {
400
+ cacheJson = storage.getItem(localStorageKey);
401
+ if (cacheJson) {
402
+ fetchFromIssuerCache = JSON.parse(cacheJson);
403
+ }
404
+ }
393
405
  oneHourMinisecond = 1000 * timeCacheSecond;
394
406
  // @ts-ignore
395
- if (cacheJson && (cacheJson.timestamp + oneHourMinisecond) > Date.now()) {
396
- return [2 /*return*/, new OidcAuthorizationServiceConfiguration(JSON.parse(cacheJson))];
407
+ if (fetchFromIssuerCache && (fetchFromIssuerCache.timestamp + oneHourMinisecond) > Date.now()) {
408
+ return [2 /*return*/, new OidcAuthorizationServiceConfiguration(fetchFromIssuerCache.result)];
397
409
  }
398
410
  return [4 /*yield*/, fetch(fullUrl)];
399
411
  case 1:
@@ -404,7 +416,11 @@ var fetchFromIssuer = function (openIdIssuerUrl, timeCacheSecond) {
404
416
  return [4 /*yield*/, response.json()];
405
417
  case 2:
406
418
  result = _a.sent();
407
- window.localStorage.setItem(localStorageKey, JSON.stringify({ result: result, timestamp: Date.now() }));
419
+ timestamp = Date.now();
420
+ fetchFromIssuerCache = { result: result, timestamp: timestamp };
421
+ if (storage) {
422
+ storage.setItem(localStorageKey, JSON.stringify({ result: result, timestamp: timestamp }));
423
+ }
408
424
  return [2 /*return*/, new OidcAuthorizationServiceConfiguration(result)];
409
425
  }
410
426
  });
@@ -428,13 +444,16 @@ var buildQueries = function (extras) {
428
444
  var Oidc = /** @class */ (function () {
429
445
  function Oidc(configuration, configurationName) {
430
446
  if (configurationName === void 0) { configurationName = "default"; }
431
- this.initAsyncPromise = null;
432
447
  this.tryKeepExistingSessionPromise = null;
433
448
  this.loginPromise = null;
434
449
  this.loginCallbackPromise = null;
435
450
  this.syncTokensAsyncPromise = null;
436
451
  this.loginCallbackWithAutoTokensRenewPromise = null;
437
- this.configuration = configuration;
452
+ var silent_login_uri = configuration.silent_login_uri;
453
+ if (configuration.silent_redirect_uri && !configuration.silent_login_uri) {
454
+ silent_login_uri = "".concat(configuration.silent_redirect_uri.replace("-callback", "").replace("callback", ""), "-login");
455
+ }
456
+ this.configuration = __assign(__assign({}, configuration), { silent_login_uri: silent_login_uri });
438
457
  this.configurationName = configurationName;
439
458
  this.tokens = null;
440
459
  this.userInfo = null;
@@ -451,6 +470,8 @@ var Oidc = /** @class */ (function () {
451
470
  this.removeEventSubscription.bind(this);
452
471
  this.publishEvent.bind(this);
453
472
  this.destroyAsync.bind(this);
473
+ this.logoutAsync.bind(this);
474
+ this.initAsync(this.configuration.authority, this.configuration.authority_configuration);
454
475
  }
455
476
  Oidc.prototype.subscriveEvents = function (func) {
456
477
  var id = getRandomInt(9999999999999).toString();
@@ -478,28 +499,50 @@ var Oidc = /** @class */ (function () {
478
499
  }
479
500
  return oidcDatabase[name];
480
501
  };
481
- Oidc.prototype.silentSigninCallbackFromIFrame = function () {
482
- if (this.configuration.silent_redirect_uri && this.configuration.silent_signin_uri) {
502
+ Oidc.prototype._silentLoginCallbackFromIFrame = function () {
503
+ if (this.configuration.silent_redirect_uri && this.configuration.silent_login_uri) {
483
504
  var queryParams = (0, route_utils_1.getParseQueryStringFromLocation)(window.location.href);
484
505
  window.top.postMessage("".concat(this.configurationName, "_oidc_tokens:").concat(JSON.stringify({ tokens: this.tokens, sessionState: queryParams.session_state })), window.location.origin);
485
506
  }
486
507
  };
487
- Oidc.prototype.silentSigninErrorCallbackFromIFrame = function () {
488
- if (this.configuration.silent_redirect_uri && this.configuration.silent_signin_uri) {
508
+ Oidc.prototype._silentLoginErrorCallbackFromIFrame = function () {
509
+ if (this.configuration.silent_redirect_uri && this.configuration.silent_login_uri) {
489
510
  var queryParams = (0, route_utils_1.getParseQueryStringFromLocation)(window.location.href);
490
511
  window.top.postMessage("".concat(this.configurationName, "_oidc_error:").concat(JSON.stringify({ error: queryParams.error })), window.location.origin);
491
512
  }
492
513
  };
493
- Oidc.prototype.silentSigninAsync = function (extras, state, scope) {
514
+ Oidc.prototype.silentLoginCallBackAsync = function () {
515
+ return __awaiter(this, void 0, void 0, function () {
516
+ var error_1;
517
+ return __generator(this, function (_a) {
518
+ switch (_a.label) {
519
+ case 0:
520
+ _a.trys.push([0, 2, , 3]);
521
+ return [4 /*yield*/, this.loginCallbackAsync(true)];
522
+ case 1:
523
+ _a.sent();
524
+ this._silentLoginCallbackFromIFrame();
525
+ return [3 /*break*/, 3];
526
+ case 2:
527
+ error_1 = _a.sent();
528
+ console.error(error_1);
529
+ this._silentLoginErrorCallbackFromIFrame();
530
+ return [3 /*break*/, 3];
531
+ case 3: return [2 /*return*/];
532
+ }
533
+ });
534
+ });
535
+ };
536
+ Oidc.prototype.silentLoginAsync = function (extras, state, scope) {
494
537
  if (extras === void 0) { extras = null; }
495
538
  if (state === void 0) { state = null; }
496
539
  if (scope === void 0) { scope = null; }
497
540
  return __awaiter(this, void 0, void 0, function () {
498
- var configuration_1, queries, _i, _a, _b, key, value, link, idx, iFrameOrigin_1, iframe_1, self_1;
541
+ var numberTryOnline, configuration_1, queries, _i, _a, _b, key, value, link, idx, iFrameOrigin_1, iframe_1, self_1;
499
542
  return __generator(this, function (_c) {
500
543
  switch (_c.label) {
501
544
  case 0:
502
- if (!this.configuration.silent_redirect_uri || !this.configuration.silent_signin_uri) {
545
+ if (!this.configuration.silent_redirect_uri || !this.configuration.silent_login_uri) {
503
546
  return [2 /*return*/, Promise.resolve(null)];
504
547
  }
505
548
  _c.label = 1;
@@ -508,11 +551,22 @@ var Oidc = /** @class */ (function () {
508
551
  return [4 /*yield*/, (0, initWorker_1.sleepAsync)(1000)];
509
552
  case 2:
510
553
  _c.sent();
511
- this.publishEvent(eventNames.silentSigninAsync, { message: "wait because document is hidden" });
554
+ this.publishEvent(eventNames.silentLoginAsync, { message: "wait because document is hidden" });
512
555
  return [3 /*break*/, 1];
513
556
  case 3:
557
+ numberTryOnline = 6;
558
+ _c.label = 4;
559
+ case 4:
560
+ if (!(!navigator.onLine && numberTryOnline > 0)) return [3 /*break*/, 6];
561
+ return [4 /*yield*/, (0, initWorker_1.sleepAsync)(1000)];
562
+ case 5:
563
+ _c.sent();
564
+ numberTryOnline--;
565
+ this.publishEvent(eventNames.refreshTokensAsync, { message: "wait because navigator is offline try ".concat(numberTryOnline) });
566
+ return [3 /*break*/, 4];
567
+ case 6:
514
568
  try {
515
- this.publishEvent(eventNames.silentSigninAsync_begin, {});
569
+ this.publishEvent(eventNames.silentLoginAsync_begin, {});
516
570
  configuration_1 = this.configuration;
517
571
  queries = "";
518
572
  if (state) {
@@ -538,7 +592,7 @@ var Oidc = /** @class */ (function () {
538
592
  }
539
593
  }
540
594
  }
541
- link = configuration_1.silent_signin_uri + queries;
595
+ link = configuration_1.silent_login_uri + queries;
542
596
  idx = link.indexOf("/", link.indexOf("//") + 2);
543
597
  iFrameOrigin_1 = link.substr(0, idx);
544
598
  iframe_1 = document.createElement('iframe');
@@ -562,41 +616,41 @@ var Oidc = /** @class */ (function () {
562
616
  if (!isResolved_1) {
563
617
  if (data.startsWith(key)) {
564
618
  var result = JSON.parse(e.data.replace(key, ''));
565
- self_1.publishEvent(eventNames.silentSigninAsync_end, {});
619
+ self_1.publishEvent(eventNames.silentLoginAsync_end, {});
566
620
  iframe_1.remove();
567
621
  isResolved_1 = true;
568
622
  resolve(result);
569
623
  }
570
624
  else if (data.startsWith(key_error)) {
571
625
  var result = JSON.parse(e.data.replace(key_error, ''));
572
- self_1.publishEvent(eventNames.silentSigninAsync_error, result);
626
+ self_1.publishEvent(eventNames.silentLoginAsync_error, result);
573
627
  iframe_1.remove();
574
628
  isResolved_1 = true;
575
- reject(result);
629
+ reject(new Error("oidc_" + result.error));
576
630
  }
577
631
  }
578
632
  }
579
633
  }
580
634
  };
581
- var silentSigninTimeout = (_a = configuration_1.silent_signin_timeout) !== null && _a !== void 0 ? _a : 12000;
635
+ var silentSigninTimeout = (_a = configuration_1.silent_login_timeout) !== null && _a !== void 0 ? _a : 12000;
582
636
  setTimeout(function () {
583
637
  if (!isResolved_1) {
584
- self_1.publishEvent(eventNames.silentSigninAsync_error, "timeout");
638
+ self_1.publishEvent(eventNames.silentLoginAsync_error, { reason: "timeout" });
585
639
  iframe_1.remove();
586
640
  isResolved_1 = true;
587
- reject("timeout");
641
+ reject(new Error("timeout"));
588
642
  }
589
643
  }, silentSigninTimeout);
590
644
  }
591
645
  catch (e) {
592
646
  iframe_1.remove();
593
- self_1.publishEvent(eventNames.silentSigninAsync_error, e);
647
+ self_1.publishEvent(eventNames.silentLoginAsync_error, e);
594
648
  reject(e);
595
649
  }
596
650
  })];
597
651
  }
598
652
  catch (e) {
599
- this.publishEvent(eventNames.silentSigninAsync_error, e);
653
+ this.publishEvent(eventNames.silentLoginAsync_error, e);
600
654
  throw e;
601
655
  }
602
656
  return [2 /*return*/];
@@ -607,9 +661,9 @@ var Oidc = /** @class */ (function () {
607
661
  Oidc.prototype.initAsync = function (authority, authorityConfiguration) {
608
662
  var _a;
609
663
  return __awaiter(this, void 0, void 0, function () {
610
- var _b;
611
- return __generator(this, function (_c) {
612
- switch (_c.label) {
664
+ var serviceWorker, storage, initAsyncPromise;
665
+ return __generator(this, function (_b) {
666
+ switch (_b.label) {
613
667
  case 0:
614
668
  if (authorityConfiguration != null) {
615
669
  return [2 /*return*/, new OidcAuthorizationServiceConfiguration({
@@ -621,14 +675,14 @@ var Oidc = /** @class */ (function () {
621
675
  check_session_iframe: authorityConfiguration.check_session_iframe,
622
676
  })];
623
677
  }
624
- if (this.initAsyncPromise) {
625
- return [2 /*return*/, this.initAsyncPromise];
626
- }
627
- _b = this;
628
- return [4 /*yield*/, fetchFromIssuer(authority, (_a = this.configuration.authority_time_cache_wellknowurl_in_second) !== null && _a !== void 0 ? _a : 60 * 60)];
678
+ return [4 /*yield*/, (0, initWorker_1.initWorkerAsync)(this.configuration.service_worker_relative_url, this.configurationName)];
629
679
  case 1:
630
- _b.initAsyncPromise = _c.sent();
631
- return [2 /*return*/, this.initAsyncPromise];
680
+ serviceWorker = _b.sent();
681
+ storage = serviceWorker ? window.localStorage : null;
682
+ return [4 /*yield*/, fetchFromIssuer(authority, (_a = this.configuration.authority_time_cache_wellknowurl_in_second) !== null && _a !== void 0 ? _a : 60 * 60, storage)];
683
+ case 2:
684
+ initAsyncPromise = _b.sent();
685
+ return [2 /*return*/, initAsyncPromise];
632
686
  }
633
687
  });
634
688
  });
@@ -673,7 +727,8 @@ var Oidc = /** @class */ (function () {
673
727
  expiresIn: tokens.expires_in,
674
728
  idToken: tokens.id_token,
675
729
  scope: tokens.scope,
676
- tokenType: tokens.token_type
730
+ tokenType: tokens.token_type,
731
+ issuedAt: tokens.issued_at
677
732
  };
678
733
  _a = this;
679
734
  return [4 /*yield*/, setTokensAsync(serviceWorker, reformattedToken)];
@@ -685,8 +740,10 @@ var Oidc = /** @class */ (function () {
685
740
  return [4 /*yield*/, serviceWorker.getSessionStateAsync()];
686
741
  case 6:
687
742
  sessionState = _d.sent();
743
+ // @ts-ignore
688
744
  return [4 /*yield*/, this.startCheckSessionAsync(oidcServerConfiguration.check_session_iframe, configuration.client_id, sessionState)];
689
745
  case 7:
746
+ // @ts-ignore
690
747
  _d.sent();
691
748
  this.publishEvent(eventNames.tryKeepExistingSessionAsync_end, {
692
749
  success: true,
@@ -721,8 +778,10 @@ var Oidc = /** @class */ (function () {
721
778
  // @ts-ignore
722
779
  this.timeoutId = autoRenewTokens(this, tokens.refreshToken, this.tokens.expiresAt);
723
780
  sessionState = session.getSessionState();
781
+ // @ts-ignore
724
782
  return [4 /*yield*/, this.startCheckSessionAsync(oidcServerConfiguration.check_session_iframe, configuration.client_id, sessionState)];
725
783
  case 12:
784
+ // @ts-ignore
726
785
  _d.sent();
727
786
  this.publishEvent(eventNames.tryKeepExistingSessionAsync_end, {
728
787
  success: true,
@@ -846,7 +905,7 @@ var Oidc = /** @class */ (function () {
846
905
  var _this = this;
847
906
  return __generator(this, function (_a) {
848
907
  return [2 /*return*/, new Promise(function (resolve, reject) {
849
- if (_this.configuration.silent_signin_uri && _this.configuration.silent_redirect_uri && _this.configuration.monitor_session && checkSessionIFrameUri && sessionState && !isSilentSignin) {
908
+ if (_this.configuration.silent_login_uri && _this.configuration.silent_redirect_uri && _this.configuration.monitor_session && checkSessionIFrameUri && sessionState && !isSilentSignin) {
850
909
  var checkSessionCallback = function () {
851
910
  _this.checkSessionIFrame.stop();
852
911
  if (_this.tokens === null) {
@@ -856,7 +915,7 @@ var Oidc = /** @class */ (function () {
856
915
  var idToken = _this.tokens.idToken;
857
916
  // @ts-ignore
858
917
  var idTokenPayload = _this.tokens.idTokenPayload;
859
- _this.silentSigninAsync({
918
+ _this.silentLoginAsync({
860
919
  prompt: "none",
861
920
  id_token_hint: idToken,
862
921
  scope: "openid"
@@ -876,7 +935,7 @@ var Oidc = /** @class */ (function () {
876
935
  console.debug("SessionMonitor._callback: Different subject signed into OP:", iFrameIdTokenPayload.sub);
877
936
  }
878
937
  }).catch(function (e) {
879
- _this.publishEvent(eventNames.logout_from_another_tab, {});
938
+ _this.publishEvent(eventNames.logout_from_another_tab, { message: "SessionMonitor" });
880
939
  _this.destroyAsync();
881
940
  });
882
941
  };
@@ -1045,6 +1104,7 @@ var Oidc = /** @class */ (function () {
1045
1104
  clearTimeout(timeoutId);
1046
1105
  _this.timeoutId = null;
1047
1106
  var loginParams_1 = getLoginParams(_this.configurationName, redirectUri_1);
1107
+ // @ts-ignore
1048
1108
  _this.startCheckSessionAsync(oidcServerConfiguration_1.check_session_iframe, clientId_1, sessionState_2, isSilentSignin).then(function () {
1049
1109
  _this.publishEvent(eventNames.loginCallbackAsync_end, {});
1050
1110
  resolve({
@@ -1080,18 +1140,19 @@ var Oidc = /** @class */ (function () {
1080
1140
  };
1081
1141
  Oidc.prototype.refreshTokensAsync = function (refreshToken) {
1082
1142
  return __awaiter(this, void 0, void 0, function () {
1083
- var localSilentSigninAsync, configuration, clientId, redirectUri, authority, extras, _i, _a, _b, key, value, oidcServerConfiguration, details, index, tokenResponse, exception_4;
1143
+ var localsilentLoginAsync, configuration, clientId, redirectUri, authority, extras, _i, _a, _b, key, value, oidcServerConfiguration, details, index, numberTryOnline, tokenResponse, exception_4;
1084
1144
  var _this = this;
1085
1145
  return __generator(this, function (_c) {
1086
1146
  switch (_c.label) {
1087
1147
  case 0:
1088
- localSilentSigninAsync = function () { return __awaiter(_this, void 0, void 0, function () {
1089
- var silent_token_response, exceptionSilent_1;
1148
+ localsilentLoginAsync = function () { return __awaiter(_this, void 0, void 0, function () {
1149
+ var loginParams, silent_token_response, exceptionSilent_1;
1090
1150
  return __generator(this, function (_a) {
1091
1151
  switch (_a.label) {
1092
1152
  case 0:
1093
1153
  _a.trys.push([0, 2, , 3]);
1094
- return [4 /*yield*/, this.silentSigninAsync()];
1154
+ loginParams = getLoginParams(this.configurationName, configuration.redirect_uri);
1155
+ return [4 /*yield*/, this.silentLoginAsync(loginParams.extras, loginParams.state)];
1095
1156
  case 1:
1096
1157
  silent_token_response = _a.sent();
1097
1158
  if (silent_token_response) {
@@ -1117,7 +1178,7 @@ var Oidc = /** @class */ (function () {
1117
1178
  redirectUri = configuration.redirect_uri;
1118
1179
  authority = configuration.authority;
1119
1180
  if (!!refreshToken) return [3 /*break*/, 2];
1120
- return [4 /*yield*/, localSilentSigninAsync()];
1181
+ return [4 /*yield*/, localsilentLoginAsync()];
1121
1182
  case 1: return [2 /*return*/, _c.sent()];
1122
1183
  case 2:
1123
1184
  extras = {};
@@ -1139,12 +1200,12 @@ var Oidc = /** @class */ (function () {
1139
1200
  index = 0;
1140
1201
  _c.label = 4;
1141
1202
  case 4:
1142
- if (!(index <= 2)) return [3 /*break*/, 15];
1203
+ if (!(index <= 4)) return [3 /*break*/, 18];
1143
1204
  _c.label = 5;
1144
1205
  case 5:
1145
- _c.trys.push([5, 13, , 14]);
1206
+ _c.trys.push([5, 16, , 17]);
1146
1207
  this.publishEvent(eventNames.refreshTokensAsync_begin, { refreshToken: refreshToken, tryNumber: index });
1147
- if (!(index > 1)) return [3 /*break*/, 8];
1208
+ if (!(index > 1)) return [3 /*break*/, 11];
1148
1209
  _c.label = 6;
1149
1210
  case 6:
1150
1211
  if (!document.hidden) return [3 /*break*/, 8];
@@ -1153,108 +1214,134 @@ var Oidc = /** @class */ (function () {
1153
1214
  _c.sent();
1154
1215
  this.publishEvent(eventNames.refreshTokensAsync, { message: "wait because document is hidden" });
1155
1216
  return [3 /*break*/, 6];
1156
- case 8: return [4 /*yield*/, performTokenRequestAsync(oidcServerConfiguration.tokenEndpoint, details, extras)];
1217
+ case 8:
1218
+ numberTryOnline = 6;
1219
+ _c.label = 9;
1157
1220
  case 9:
1221
+ if (!(!navigator.onLine && numberTryOnline > 0)) return [3 /*break*/, 11];
1222
+ return [4 /*yield*/, (0, initWorker_1.sleepAsync)(1000)];
1223
+ case 10:
1224
+ _c.sent();
1225
+ numberTryOnline--;
1226
+ this.publishEvent(eventNames.refreshTokensAsync, { message: "wait because navigator is offline try ".concat(numberTryOnline) });
1227
+ return [3 /*break*/, 9];
1228
+ case 11: return [4 /*yield*/, performTokenRequestAsync(oidcServerConfiguration.tokenEndpoint, details, extras)];
1229
+ case 12:
1158
1230
  tokenResponse = _c.sent();
1159
- if (!tokenResponse.success) return [3 /*break*/, 10];
1231
+ if (!tokenResponse.success) return [3 /*break*/, 13];
1160
1232
  this.publishEvent(eventNames.refreshTokensAsync_end, { success: tokenResponse.success });
1161
1233
  return [2 /*return*/, tokenResponse.data];
1162
- case 10:
1163
- this.publishEvent(eventNames.refreshTokensAsync_silent_error, { message: "bad request", tokenResponse: tokenResponse });
1164
- return [4 /*yield*/, localSilentSigninAsync()];
1165
- case 11: return [2 /*return*/, _c.sent()];
1166
- case 12: return [3 /*break*/, 14];
1167
1234
  case 13:
1235
+ this.publishEvent(eventNames.refreshTokensAsync_silent_error, { message: "bad request", tokenResponse: tokenResponse });
1236
+ return [4 /*yield*/, localsilentLoginAsync()];
1237
+ case 14: return [2 /*return*/, _c.sent()];
1238
+ case 15: return [3 /*break*/, 17];
1239
+ case 16:
1168
1240
  exception_4 = _c.sent();
1169
1241
  console.error(exception_4);
1170
- this.publishEvent(eventNames.refreshTokensAsync_silent_error, { message: "exception", exception: exception_4 });
1171
- return [3 /*break*/, 14];
1172
- case 14:
1242
+ this.publishEvent(eventNames.refreshTokensAsync_silent_error, { message: "exception", exception: exception_4.message });
1243
+ return [3 /*break*/, 17];
1244
+ case 17:
1173
1245
  index++;
1174
1246
  return [3 /*break*/, 4];
1175
- case 15: return [2 /*return*/];
1247
+ case 18: return [2 /*return*/];
1176
1248
  }
1177
1249
  });
1178
1250
  });
1179
1251
  };
1180
1252
  Oidc.prototype.syncTokensAsync = function () {
1181
- var _a;
1182
1253
  return __awaiter(this, void 0, void 0, function () {
1183
- var configuration, oidcServerConfiguration, serviceWorker, isLogin, silent_token_response, _b, exceptionSilent_2, session, tokens;
1184
- return __generator(this, function (_c) {
1185
- switch (_c.label) {
1186
- case 0:
1187
- configuration = this.configuration;
1188
- if (!this.tokens) {
1189
- return [2 /*return*/];
1190
- }
1191
- return [4 /*yield*/, this.initAsync(configuration.authority, configuration.authority_configuration)];
1192
- case 1:
1193
- oidcServerConfiguration = _c.sent();
1194
- return [4 /*yield*/, (0, initWorker_1.initWorkerAsync)(configuration.service_worker_relative_url, this.configurationName)];
1195
- case 2:
1196
- serviceWorker = _c.sent();
1197
- if (!serviceWorker) return [3 /*break*/, 14];
1198
- return [4 /*yield*/, serviceWorker.initAsync(oidcServerConfiguration, "syncTokensAsync")];
1199
- case 3:
1200
- isLogin = (_c.sent()).isLogin;
1201
- if (!(isLogin == false)) return [3 /*break*/, 5];
1202
- this.publishEvent(eventNames.logout_from_another_tab, {});
1203
- return [4 /*yield*/, this.destroyAsync()];
1204
- case 4:
1205
- _c.sent();
1206
- return [3 /*break*/, 13];
1207
- case 5:
1208
- if (!(isLogin == null)) return [3 /*break*/, 13];
1209
- _c.label = 6;
1210
- case 6:
1211
- _c.trys.push([6, 11, , 12]);
1212
- this.publishEvent(eventNames.syncTokensAsync_begin, {});
1213
- this.syncTokensAsyncPromise = this.silentSigninAsync({ prompt: "none" });
1214
- return [4 /*yield*/, this.syncTokensAsyncPromise];
1215
- case 7:
1216
- silent_token_response = _c.sent();
1217
- if (!(silent_token_response && silent_token_response.tokens)) return [3 /*break*/, 9];
1218
- _b = this;
1219
- return [4 /*yield*/, setTokensAsync(serviceWorker, silent_token_response.tokens)];
1220
- case 8:
1221
- _b.tokens = _c.sent();
1222
- return [3 /*break*/, 10];
1223
- case 9:
1224
- this.publishEvent(eventNames.syncTokensAsync_error, { message: "no token found in result" });
1225
- if (this.timeoutId) {
1226
- timer_1.default.clearTimeout(this.timeoutId);
1227
- this.timeoutId = null;
1228
- }
1229
- return [2 /*return*/];
1230
- case 10: return [3 /*break*/, 12];
1231
- case 11:
1232
- exceptionSilent_2 = _c.sent();
1233
- console.error(exceptionSilent_2);
1234
- this.publishEvent(eventNames.syncTokensAsync_error, exceptionSilent_2);
1235
- if (this.timeoutId) {
1236
- timer_1.default.clearTimeout(this.timeoutId);
1237
- this.timeoutId = null;
1254
+ var localSyncTokensAsync;
1255
+ var _this = this;
1256
+ return __generator(this, function (_a) {
1257
+ localSyncTokensAsync = function () { return __awaiter(_this, void 0, void 0, function () {
1258
+ var configuration, oidcServerConfiguration, serviceWorker, isLogin, loginParams, silent_token_response, _a, exceptionSilent_2, session, tokens;
1259
+ var _b;
1260
+ return __generator(this, function (_c) {
1261
+ switch (_c.label) {
1262
+ case 0:
1263
+ configuration = this.configuration;
1264
+ if (!this.tokens) {
1265
+ return [2 /*return*/, null];
1266
+ }
1267
+ return [4 /*yield*/, this.initAsync(configuration.authority, configuration.authority_configuration)];
1268
+ case 1:
1269
+ oidcServerConfiguration = _c.sent();
1270
+ return [4 /*yield*/, (0, initWorker_1.initWorkerAsync)(configuration.service_worker_relative_url, this.configurationName)];
1271
+ case 2:
1272
+ serviceWorker = _c.sent();
1273
+ if (!serviceWorker) return [3 /*break*/, 13];
1274
+ return [4 /*yield*/, serviceWorker.initAsync(oidcServerConfiguration, "syncTokensAsync")];
1275
+ case 3:
1276
+ isLogin = (_c.sent()).isLogin;
1277
+ if (!(isLogin == false)) return [3 /*break*/, 5];
1278
+ this.publishEvent(eventNames.logout_from_another_tab, { "message": "service worker syncTokensAsync" });
1279
+ return [4 /*yield*/, this.destroyAsync()];
1280
+ case 4:
1281
+ _c.sent();
1282
+ return [2 /*return*/, null];
1283
+ case 5:
1284
+ if (!(isLogin == null)) return [3 /*break*/, 12];
1285
+ _c.label = 6;
1286
+ case 6:
1287
+ _c.trys.push([6, 11, , 12]);
1288
+ this.publishEvent(eventNames.syncTokensAsync_begin, {});
1289
+ loginParams = getLoginParams(this.configurationName, configuration.redirect_uri);
1290
+ return [4 /*yield*/, this.silentLoginAsync(__assign(__assign({}, loginParams.extras), { prompt: "none" }), loginParams.state)];
1291
+ case 7:
1292
+ silent_token_response = _c.sent();
1293
+ if (!(silent_token_response && silent_token_response.tokens)) return [3 /*break*/, 9];
1294
+ _a = this;
1295
+ return [4 /*yield*/, setTokensAsync(serviceWorker, silent_token_response.tokens)];
1296
+ case 8:
1297
+ _a.tokens = _c.sent();
1298
+ this.publishEvent(eventNames.syncTokensAsync_end, {});
1299
+ return [2 /*return*/, this.tokens];
1300
+ case 9:
1301
+ this.publishEvent(eventNames.syncTokensAsync_error, { message: "no token found in result" });
1302
+ if (this.timeoutId) {
1303
+ timer_1.default.clearTimeout(this.timeoutId);
1304
+ this.timeoutId = null;
1305
+ }
1306
+ this.publishEvent(eventNames.syncTokensAsync_end, {});
1307
+ return [2 /*return*/, null];
1308
+ case 10: return [3 /*break*/, 12];
1309
+ case 11:
1310
+ exceptionSilent_2 = _c.sent();
1311
+ console.error(exceptionSilent_2);
1312
+ this.publishEvent(eventNames.syncTokensAsync_error, exceptionSilent_2);
1313
+ if (this.timeoutId) {
1314
+ timer_1.default.clearTimeout(this.timeoutId);
1315
+ this.timeoutId = null;
1316
+ }
1317
+ this.publishEvent(eventNames.syncTokensAsync_end, {});
1318
+ return [2 /*return*/, null];
1319
+ case 12: return [3 /*break*/, 16];
1320
+ case 13:
1321
+ session = (0, initSession_1.initSession)(this.configurationName, configuration.redirect_uri, (_b = configuration.storage) !== null && _b !== void 0 ? _b : sessionStorage);
1322
+ return [4 /*yield*/, session.initAsync()];
1323
+ case 14:
1324
+ tokens = (_c.sent()).tokens;
1325
+ if (!!tokens) return [3 /*break*/, 16];
1326
+ this.publishEvent(eventNames.logout_from_another_tab, { "message": "session syncTokensAsync" });
1327
+ return [4 /*yield*/, this.destroyAsync()];
1328
+ case 15:
1329
+ _c.sent();
1330
+ return [2 /*return*/, null];
1331
+ case 16: return [2 /*return*/, this.tokens];
1238
1332
  }
1239
- return [2 /*return*/];
1240
- case 12:
1241
- this.syncTokensAsyncPromise = null;
1242
- this.publishEvent(eventNames.syncTokensAsync_end, {});
1243
- _c.label = 13;
1244
- case 13: return [3 /*break*/, 17];
1245
- case 14:
1246
- session = (0, initSession_1.initSession)(this.configurationName, configuration.redirect_uri, (_a = configuration.storage) !== null && _a !== void 0 ? _a : sessionStorage);
1247
- return [4 /*yield*/, session.initAsync()];
1248
- case 15:
1249
- tokens = (_c.sent()).tokens;
1250
- if (!!tokens) return [3 /*break*/, 17];
1251
- this.publishEvent(eventNames.logout_from_another_tab, {});
1252
- return [4 /*yield*/, this.destroyAsync()];
1253
- case 16:
1254
- _c.sent();
1255
- _c.label = 17;
1256
- case 17: return [2 /*return*/];
1333
+ });
1334
+ }); };
1335
+ if (this.syncTokensAsyncPromise) {
1336
+ return [2 /*return*/, this.syncTokensAsyncPromise];
1257
1337
  }
1338
+ this.syncTokensAsyncPromise = localSyncTokensAsync().then(function (result) {
1339
+ if (_this.syncTokensAsyncPromise) {
1340
+ _this.syncTokensAsyncPromise = null;
1341
+ }
1342
+ return result;
1343
+ });
1344
+ return [2 /*return*/, this.syncTokensAsyncPromise];
1258
1345
  });
1259
1346
  });
1260
1347
  };
@@ -1302,18 +1389,34 @@ var Oidc = /** @class */ (function () {
1302
1389
  });
1303
1390
  });
1304
1391
  };
1392
+ Oidc.prototype.logoutSameTabAsync = function (sub) {
1393
+ return __awaiter(this, void 0, void 0, function () {
1394
+ return __generator(this, function (_a) {
1395
+ switch (_a.label) {
1396
+ case 0:
1397
+ if (!(this.configuration.monitor_session && sub && this.tokens && this.tokens.idTokenPayload && this.tokens.idTokenPayload.sub === sub)) return [3 /*break*/, 2];
1398
+ this.publishEvent(eventNames.logout_from_same_tab, { "message": sub });
1399
+ return [4 /*yield*/, this.destroyAsync()];
1400
+ case 1:
1401
+ _a.sent();
1402
+ _a.label = 2;
1403
+ case 2: return [2 /*return*/];
1404
+ }
1405
+ });
1406
+ });
1407
+ };
1305
1408
  Oidc.prototype.logoutAsync = function (callbackPathOrUrl, extras) {
1306
1409
  if (callbackPathOrUrl === void 0) { callbackPathOrUrl = undefined; }
1307
1410
  if (extras === void 0) { extras = null; }
1308
1411
  return __awaiter(this, void 0, void 0, function () {
1309
- var configuration, oidcServerConfiguration, path, isUri, url, idToken, extraQueryString, _i, _a, _b, key, value;
1310
- return __generator(this, function (_c) {
1311
- switch (_c.label) {
1412
+ var configuration, oidcServerConfiguration, path, isUri, url, idToken, sub, _i, _a, _b, key, oidc, extraQueryString, _c, _d, _e, key, value;
1413
+ return __generator(this, function (_f) {
1414
+ switch (_f.label) {
1312
1415
  case 0:
1313
1416
  configuration = this.configuration;
1314
1417
  return [4 /*yield*/, this.initAsync(configuration.authority, configuration.authority_configuration)];
1315
1418
  case 1:
1316
- oidcServerConfiguration = _c.sent();
1419
+ oidcServerConfiguration = _f.sent();
1317
1420
  if (callbackPathOrUrl && (typeof callbackPathOrUrl !== 'string')) {
1318
1421
  callbackPathOrUrl = undefined;
1319
1422
  console.warn('callbackPathOrUrl path is not a string');
@@ -1325,14 +1428,31 @@ var Oidc = /** @class */ (function () {
1325
1428
  }
1326
1429
  url = isUri ? callbackPathOrUrl : window.location.origin + path;
1327
1430
  idToken = this.tokens ? this.tokens.idToken : "";
1431
+ sub = this.tokens && this.tokens.idTokenPayload ? this.tokens.idTokenPayload.sub : null;
1328
1432
  return [4 /*yield*/, this.destroyAsync()];
1329
1433
  case 2:
1330
- _c.sent();
1434
+ _f.sent();
1435
+ _i = 0, _a = Object.entries(oidcDatabase);
1436
+ _f.label = 3;
1437
+ case 3:
1438
+ if (!(_i < _a.length)) return [3 /*break*/, 6];
1439
+ _b = _a[_i], key = _b[0], oidc = _b[1];
1440
+ if (!(oidc !== this)) return [3 /*break*/, 5];
1441
+ // @ts-ignore
1442
+ return [4 /*yield*/, oidc.logoutSameTabAsync(sub)];
1443
+ case 4:
1444
+ // @ts-ignore
1445
+ _f.sent();
1446
+ _f.label = 5;
1447
+ case 5:
1448
+ _i++;
1449
+ return [3 /*break*/, 3];
1450
+ case 6:
1331
1451
  if (oidcServerConfiguration.endSessionEndpoint) {
1332
1452
  extraQueryString = "";
1333
1453
  if (extras) {
1334
- for (_i = 0, _a = Object.entries(extras); _i < _a.length; _i++) {
1335
- _b = _a[_i], key = _b[0], value = _b[1];
1454
+ for (_c = 0, _d = Object.entries(extras); _c < _d.length; _c++) {
1455
+ _e = _d[_c], key = _e[0], value = _e[1];
1336
1456
  extraQueryString += "&".concat(key, "=").concat(encodeURIComponent(value));
1337
1457
  }
1338
1458
  }