@azure/msal-browser 2.29.0 → 2.31.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.
Files changed (89) hide show
  1. package/README.md +1 -2
  2. package/dist/_virtual/_tslib.js +1 -1
  3. package/dist/app/ClientApplication.d.ts.map +1 -1
  4. package/dist/app/ClientApplication.js +13 -9
  5. package/dist/app/ClientApplication.js.map +1 -1
  6. package/dist/app/IPublicClientApplication.js +1 -1
  7. package/dist/app/PublicClientApplication.d.ts.map +1 -1
  8. package/dist/app/PublicClientApplication.js +8 -6
  9. package/dist/app/PublicClientApplication.js.map +1 -1
  10. package/dist/broker/nativeBroker/NativeMessageHandler.d.ts +11 -0
  11. package/dist/broker/nativeBroker/NativeMessageHandler.d.ts.map +1 -1
  12. package/dist/broker/nativeBroker/NativeMessageHandler.js +16 -1
  13. package/dist/broker/nativeBroker/NativeMessageHandler.js.map +1 -1
  14. package/dist/cache/AsyncMemoryStorage.js +1 -1
  15. package/dist/cache/BrowserCacheManager.js +1 -1
  16. package/dist/cache/BrowserStorage.js +1 -1
  17. package/dist/cache/CryptoKeyStore.js +1 -1
  18. package/dist/cache/DatabaseStorage.js +1 -1
  19. package/dist/cache/ITokenCache.d.ts +6 -3
  20. package/dist/cache/ITokenCache.d.ts.map +1 -1
  21. package/dist/cache/MemoryStorage.js +1 -1
  22. package/dist/cache/TokenCache.d.ts +33 -5
  23. package/dist/cache/TokenCache.d.ts.map +1 -1
  24. package/dist/cache/TokenCache.js +121 -20
  25. package/dist/cache/TokenCache.js.map +1 -1
  26. package/dist/config/Configuration.d.ts +4 -0
  27. package/dist/config/Configuration.d.ts.map +1 -1
  28. package/dist/config/Configuration.js +3 -3
  29. package/dist/config/Configuration.js.map +1 -1
  30. package/dist/crypto/BrowserCrypto.js +1 -1
  31. package/dist/crypto/CryptoOps.js +1 -1
  32. package/dist/crypto/GuidGenerator.js +1 -1
  33. package/dist/crypto/ModernBrowserCrypto.js +1 -1
  34. package/dist/crypto/MsBrowserCrypto.js +1 -1
  35. package/dist/crypto/MsrBrowserCrypto.js +1 -1
  36. package/dist/crypto/PkceGenerator.js +1 -1
  37. package/dist/crypto/SignedHttpRequest.js +1 -1
  38. package/dist/encode/Base64Decode.js +1 -1
  39. package/dist/encode/Base64Encode.js +1 -1
  40. package/dist/error/BrowserAuthError.js +1 -1
  41. package/dist/error/BrowserConfigurationAuthError.js +1 -1
  42. package/dist/error/NativeAuthError.js +1 -1
  43. package/dist/event/EventHandler.js +1 -1
  44. package/dist/event/EventMessage.js +1 -1
  45. package/dist/event/EventType.js +1 -1
  46. package/dist/index.cjs.js +296 -132
  47. package/dist/index.cjs.js.map +1 -1
  48. package/dist/index.js +1 -1
  49. package/dist/interaction_client/BaseInteractionClient.js +1 -1
  50. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
  51. package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
  52. package/dist/interaction_client/NativeInteractionClient.js +28 -7
  53. package/dist/interaction_client/NativeInteractionClient.js.map +1 -1
  54. package/dist/interaction_client/PopupClient.js +4 -4
  55. package/dist/interaction_client/PopupClient.js.map +1 -1
  56. package/dist/interaction_client/RedirectClient.js +1 -1
  57. package/dist/interaction_client/SilentAuthCodeClient.js +2 -2
  58. package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -1
  59. package/dist/interaction_client/SilentCacheClient.js +1 -1
  60. package/dist/interaction_client/SilentIframeClient.js +2 -2
  61. package/dist/interaction_client/SilentIframeClient.js.map +1 -1
  62. package/dist/interaction_client/SilentRefreshClient.js +1 -1
  63. package/dist/interaction_client/StandardInteractionClient.js +1 -1
  64. package/dist/interaction_handler/InteractionHandler.js +1 -1
  65. package/dist/interaction_handler/RedirectHandler.js +1 -1
  66. package/dist/interaction_handler/SilentHandler.d.ts +3 -1
  67. package/dist/interaction_handler/SilentHandler.d.ts.map +1 -1
  68. package/dist/interaction_handler/SilentHandler.js +5 -5
  69. package/dist/interaction_handler/SilentHandler.js.map +1 -1
  70. package/dist/internals.js +1 -1
  71. package/dist/navigation/NavigationClient.js +1 -1
  72. package/dist/network/FetchClient.js +1 -1
  73. package/dist/network/XhrClient.js +1 -1
  74. package/dist/packageMetadata.d.ts +1 -1
  75. package/dist/packageMetadata.js +2 -2
  76. package/dist/packageMetadata.js.map +1 -1
  77. package/dist/telemetry/BrowserPerformanceClient.js +1 -1
  78. package/dist/telemetry/BrowserPerformanceMeasurement.js +1 -1
  79. package/dist/utils/BrowserConstants.d.ts +1 -1
  80. package/dist/utils/BrowserConstants.js +2 -2
  81. package/dist/utils/BrowserConstants.js.map +1 -1
  82. package/dist/utils/BrowserProtocolUtils.js +1 -1
  83. package/dist/utils/BrowserStringUtils.js +1 -1
  84. package/dist/utils/BrowserUtils.js +1 -1
  85. package/dist/utils/MathUtils.js +1 -1
  86. package/lib/msal-browser.js +296 -132
  87. package/lib/msal-browser.js.map +1 -1
  88. package/lib/msal-browser.min.js +44 -44
  89. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.29.0 2022-10-03 */
1
+ /*! @azure/msal-browser v2.31.0 2022-11-07 */
2
2
  'use strict';
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
@@ -119,7 +119,7 @@
119
119
  return ar;
120
120
  }
121
121
 
122
- /*! @azure/msal-common v7.5.0 2022-10-03 */
122
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
123
123
  /*! *****************************************************************************
124
124
  Copyright (c) Microsoft Corporation.
125
125
 
@@ -206,7 +206,7 @@
206
206
  return r;
207
207
  }
208
208
 
209
- /*! @azure/msal-common v7.5.0 2022-10-03 */
209
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
210
210
 
211
211
  /*
212
212
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -587,7 +587,7 @@
587
587
  JsonTypes["Jwk"] = "JWK";
588
588
  })(JsonTypes || (JsonTypes = {}));
589
589
 
590
- /*! @azure/msal-common v7.5.0 2022-10-03 */
590
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
591
591
 
592
592
  /*
593
593
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -643,7 +643,7 @@
643
643
  return AuthError;
644
644
  }(Error));
645
645
 
646
- /*! @azure/msal-common v7.5.0 2022-10-03 */
646
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
647
647
 
648
648
  /*
649
649
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -718,7 +718,7 @@
718
718
  }
719
719
  };
720
720
 
721
- /*! @azure/msal-common v7.5.0 2022-10-03 */
721
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
722
722
 
723
723
  /*
724
724
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1213,7 +1213,7 @@
1213
1213
  return ClientAuthError;
1214
1214
  }(AuthError));
1215
1215
 
1216
- /*! @azure/msal-common v7.5.0 2022-10-03 */
1216
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
1217
1217
 
1218
1218
  /*
1219
1219
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1338,7 +1338,7 @@
1338
1338
  return StringUtils;
1339
1339
  }());
1340
1340
 
1341
- /*! @azure/msal-common v7.5.0 2022-10-03 */
1341
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
1342
1342
 
1343
1343
  /*
1344
1344
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1518,12 +1518,12 @@
1518
1518
  return Logger;
1519
1519
  }());
1520
1520
 
1521
- /*! @azure/msal-common v7.5.0 2022-10-03 */
1521
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
1522
1522
  /* eslint-disable header/header */
1523
1523
  var name$1 = "@azure/msal-common";
1524
- var version$1 = "7.5.0";
1524
+ var version$1 = "8.0.0";
1525
1525
 
1526
- /*! @azure/msal-common v7.5.0 2022-10-03 */
1526
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
1527
1527
  /*
1528
1528
  * Copyright (c) Microsoft Corporation. All rights reserved.
1529
1529
  * Licensed under the MIT License.
@@ -1544,7 +1544,7 @@
1544
1544
  AzureCloudInstance["AzureUsGovernment"] = "https://login.microsoftonline.us";
1545
1545
  })(exports.AzureCloudInstance || (exports.AzureCloudInstance = {}));
1546
1546
 
1547
- /*! @azure/msal-common v7.5.0 2022-10-03 */
1547
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
1548
1548
 
1549
1549
  /*
1550
1550
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1703,7 +1703,7 @@
1703
1703
  return CredentialEntity;
1704
1704
  }());
1705
1705
 
1706
- /*! @azure/msal-common v7.5.0 2022-10-03 */
1706
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
1707
1707
 
1708
1708
  /*
1709
1709
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1958,7 +1958,7 @@
1958
1958
  return ClientConfigurationError;
1959
1959
  }(ClientAuthError));
1960
1960
 
1961
- /*! @azure/msal-common v7.5.0 2022-10-03 */
1961
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
1962
1962
 
1963
1963
  /*
1964
1964
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2142,7 +2142,7 @@
2142
2142
  return ScopeSet;
2143
2143
  }());
2144
2144
 
2145
- /*! @azure/msal-common v7.5.0 2022-10-03 */
2145
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
2146
2146
 
2147
2147
  /*
2148
2148
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2180,7 +2180,7 @@
2180
2180
  };
2181
2181
  }
2182
2182
 
2183
- /*! @azure/msal-common v7.5.0 2022-10-03 */
2183
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
2184
2184
  /*
2185
2185
  * Copyright (c) Microsoft Corporation. All rights reserved.
2186
2186
  * Licensed under the MIT License.
@@ -2195,7 +2195,7 @@
2195
2195
  AuthorityType[AuthorityType["Dsts"] = 2] = "Dsts";
2196
2196
  })(AuthorityType || (AuthorityType = {}));
2197
2197
 
2198
- /*! @azure/msal-common v7.5.0 2022-10-03 */
2198
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
2199
2199
 
2200
2200
  /*
2201
2201
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2434,7 +2434,7 @@
2434
2434
  return AccountEntity;
2435
2435
  }());
2436
2436
 
2437
- /*! @azure/msal-common v7.5.0 2022-10-03 */
2437
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
2438
2438
 
2439
2439
  /*
2440
2440
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2486,7 +2486,7 @@
2486
2486
  return AuthToken;
2487
2487
  }());
2488
2488
 
2489
- /*! @azure/msal-common v7.5.0 2022-10-03 */
2489
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
2490
2490
 
2491
2491
  /*
2492
2492
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2688,7 +2688,11 @@
2688
2688
  if (!!userAssertionHash && !_this.matchUserAssertionHash(entity, userAssertionHash)) {
2689
2689
  return;
2690
2690
  }
2691
- if (!!homeAccountId && !_this.matchHomeAccountId(entity, homeAccountId)) {
2691
+ /*
2692
+ * homeAccountId can undefined, and we want to filter out cached items that have a homeAccountId of ""
2693
+ * because we don't want a client_credential request to return a cached token that has a homeAccountId
2694
+ */
2695
+ if ((typeof homeAccountId === "string") && !_this.matchHomeAccountId(entity, homeAccountId)) {
2692
2696
  return;
2693
2697
  }
2694
2698
  if (!!environment && !_this.matchEnvironment(entity, environment)) {
@@ -3107,7 +3111,7 @@
3107
3111
  * @param homeAccountId
3108
3112
  */
3109
3113
  CacheManager.prototype.matchHomeAccountId = function (entity, homeAccountId) {
3110
- return !!(entity.homeAccountId && homeAccountId === entity.homeAccountId);
3114
+ return !!((typeof entity.homeAccountId === "string") && (homeAccountId === entity.homeAccountId));
3111
3115
  };
3112
3116
  /**
3113
3117
  * helper to match assertion
@@ -3361,7 +3365,7 @@
3361
3365
  return DefaultStorageClass;
3362
3366
  }(CacheManager));
3363
3367
 
3364
- /*! @azure/msal-common v7.5.0 2022-10-03 */
3368
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
3365
3369
 
3366
3370
  /*
3367
3371
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3455,7 +3459,7 @@
3455
3459
  return __assign({ clientCapabilities: [], azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS, skipAuthorityMetadataCache: false }, authOptions);
3456
3460
  }
3457
3461
 
3458
- /*! @azure/msal-common v7.5.0 2022-10-03 */
3462
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
3459
3463
 
3460
3464
  /*
3461
3465
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3475,7 +3479,7 @@
3475
3479
  return ServerError;
3476
3480
  }(AuthError));
3477
3481
 
3478
- /*! @azure/msal-common v7.5.0 2022-10-03 */
3482
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
3479
3483
 
3480
3484
  /*
3481
3485
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3571,7 +3575,7 @@
3571
3575
  return ThrottlingUtils;
3572
3576
  }());
3573
3577
 
3574
- /*! @azure/msal-common v7.5.0 2022-10-03 */
3578
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
3575
3579
 
3576
3580
  /*
3577
3581
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3620,7 +3624,7 @@
3620
3624
  return NetworkManager;
3621
3625
  }());
3622
3626
 
3623
- /*! @azure/msal-common v7.5.0 2022-10-03 */
3627
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
3624
3628
  /*
3625
3629
  * Copyright (c) Microsoft Corporation. All rights reserved.
3626
3630
  * Licensed under the MIT License.
@@ -3631,7 +3635,7 @@
3631
3635
  CcsCredentialType["UPN"] = "UPN";
3632
3636
  })(CcsCredentialType || (CcsCredentialType = {}));
3633
3637
 
3634
- /*! @azure/msal-common v7.5.0 2022-10-03 */
3638
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
3635
3639
 
3636
3640
  /*
3637
3641
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3722,7 +3726,7 @@
3722
3726
  return BaseClient;
3723
3727
  }());
3724
3728
 
3725
- /*! @azure/msal-common v7.5.0 2022-10-03 */
3729
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
3726
3730
 
3727
3731
  /*
3728
3732
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3808,7 +3812,7 @@
3808
3812
  return RequestValidator;
3809
3813
  }());
3810
3814
 
3811
- /*! @azure/msal-common v7.5.0 2022-10-03 */
3815
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
3812
3816
 
3813
3817
  /*
3814
3818
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4186,7 +4190,7 @@
4186
4190
  return RequestParameterBuilder;
4187
4191
  }());
4188
4192
 
4189
- /*! @azure/msal-common v7.5.0 2022-10-03 */
4193
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
4190
4194
 
4191
4195
  /*
4192
4196
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4250,7 +4254,7 @@
4250
4254
  return IdTokenEntity;
4251
4255
  }(CredentialEntity));
4252
4256
 
4253
- /*! @azure/msal-common v7.5.0 2022-10-03 */
4257
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
4254
4258
  /*
4255
4259
  * Copyright (c) Microsoft Corporation. All rights reserved.
4256
4260
  * Licensed under the MIT License.
@@ -4300,7 +4304,7 @@
4300
4304
  return TimeUtils;
4301
4305
  }());
4302
4306
 
4303
- /*! @azure/msal-common v7.5.0 2022-10-03 */
4307
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
4304
4308
 
4305
4309
  /*
4306
4310
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4414,7 +4418,7 @@
4414
4418
  return AccessTokenEntity;
4415
4419
  }(CredentialEntity));
4416
4420
 
4417
- /*! @azure/msal-common v7.5.0 2022-10-03 */
4421
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
4418
4422
 
4419
4423
  /*
4420
4424
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4481,7 +4485,7 @@
4481
4485
  return RefreshTokenEntity;
4482
4486
  }(CredentialEntity));
4483
4487
 
4484
- /*! @azure/msal-common v7.5.0 2022-10-03 */
4488
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
4485
4489
 
4486
4490
  /*
4487
4491
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4556,7 +4560,7 @@
4556
4560
  return InteractionRequiredAuthError;
4557
4561
  }(AuthError));
4558
4562
 
4559
- /*! @azure/msal-common v7.5.0 2022-10-03 */
4563
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
4560
4564
  /*
4561
4565
  * Copyright (c) Microsoft Corporation. All rights reserved.
4562
4566
  * Licensed under the MIT License.
@@ -4572,7 +4576,7 @@
4572
4576
  return CacheRecord;
4573
4577
  }());
4574
4578
 
4575
- /*! @azure/msal-common v7.5.0 2022-10-03 */
4579
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
4576
4580
 
4577
4581
  /*
4578
4582
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4643,7 +4647,7 @@
4643
4647
  return ProtocolUtils;
4644
4648
  }());
4645
4649
 
4646
- /*! @azure/msal-common v7.5.0 2022-10-03 */
4650
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
4647
4651
 
4648
4652
  /*
4649
4653
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4877,7 +4881,7 @@
4877
4881
  return UrlString;
4878
4882
  }());
4879
4883
 
4880
- /*! @azure/msal-common v7.5.0 2022-10-03 */
4884
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
4881
4885
 
4882
4886
  /*
4883
4887
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4978,7 +4982,7 @@
4978
4982
  return PopTokenGenerator;
4979
4983
  }());
4980
4984
 
4981
- /*! @azure/msal-common v7.5.0 2022-10-03 */
4985
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
4982
4986
 
4983
4987
  /*
4984
4988
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5048,7 +5052,7 @@
5048
5052
  return AppMetadataEntity;
5049
5053
  }());
5050
5054
 
5051
- /*! @azure/msal-common v7.5.0 2022-10-03 */
5055
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
5052
5056
  /*
5053
5057
  * Copyright (c) Microsoft Corporation. All rights reserved.
5054
5058
  * Licensed under the MIT License.
@@ -5084,7 +5088,7 @@
5084
5088
  return TokenCacheContext;
5085
5089
  }());
5086
5090
 
5087
- /*! @azure/msal-common v7.5.0 2022-10-03 */
5091
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
5088
5092
 
5089
5093
  /*
5090
5094
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5364,7 +5368,7 @@
5364
5368
  return ResponseHandler;
5365
5369
  }());
5366
5370
 
5367
- /*! @azure/msal-common v7.5.0 2022-10-03 */
5371
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
5368
5372
 
5369
5373
  /*
5370
5374
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5817,7 +5821,7 @@
5817
5821
  return AuthorizationCodeClient;
5818
5822
  }(BaseClient));
5819
5823
 
5820
- /*! @azure/msal-common v7.5.0 2022-10-03 */
5824
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
5821
5825
  /*
5822
5826
  * Copyright (c) Microsoft Corporation. All rights reserved.
5823
5827
  * Licensed under the MIT License.
@@ -5942,7 +5946,7 @@
5942
5946
  PerformanceEventStatus[PerformanceEventStatus["Completed"] = 2] = "Completed";
5943
5947
  })(PerformanceEventStatus || (PerformanceEventStatus = {}));
5944
5948
 
5945
- /*! @azure/msal-common v7.5.0 2022-10-03 */
5949
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
5946
5950
 
5947
5951
  /*
5948
5952
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5957,27 +5961,28 @@
5957
5961
  return _super.call(this, configuration, performanceClient) || this;
5958
5962
  }
5959
5963
  RefreshTokenClient.prototype.acquireToken = function (request) {
5960
- var _a, _b;
5964
+ var _a, _b, _c;
5961
5965
  return __awaiter(this, void 0, void 0, function () {
5962
5966
  var atsMeasurement, reqTimestamp, response, requestId, responseHandler;
5963
5967
  var _this = this;
5964
- return __generator(this, function (_c) {
5965
- switch (_c.label) {
5968
+ return __generator(this, function (_d) {
5969
+ switch (_d.label) {
5966
5970
  case 0:
5967
5971
  atsMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(exports.PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
5968
5972
  this.logger.verbose("RefreshTokenClientAcquireToken called", request.correlationId);
5969
5973
  reqTimestamp = TimeUtils.nowSeconds();
5970
5974
  return [4 /*yield*/, this.executeTokenRequest(request, this.authority)];
5971
5975
  case 1:
5972
- response = _c.sent();
5973
- requestId = (_b = response.headers) === null || _b === void 0 ? void 0 : _b[HeaderNames.X_MS_REQUEST_ID];
5976
+ response = _d.sent();
5977
+ atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.addStaticFields({
5978
+ refreshTokenSize: ((_b = response.body.refresh_token) === null || _b === void 0 ? void 0 : _b.length) || 0
5979
+ });
5980
+ requestId = (_c = response.headers) === null || _c === void 0 ? void 0 : _c[HeaderNames.X_MS_REQUEST_ID];
5974
5981
  responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
5975
5982
  responseHandler.validateTokenResponse(response.body);
5976
5983
  return [2 /*return*/, responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, undefined, undefined, true, request.forceCache, requestId).then(function (result) {
5977
- var _a;
5978
5984
  atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.endMeasurement({
5979
- success: true,
5980
- refreshTokenSize: ((_a = response.body.refresh_token) === null || _a === void 0 ? void 0 : _a.length) || 0
5985
+ success: true
5981
5986
  });
5982
5987
  return result;
5983
5988
  })
@@ -5986,8 +5991,7 @@
5986
5991
  atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.endMeasurement({
5987
5992
  errorCode: error.errorCode,
5988
5993
  subErrorCode: error.subError,
5989
- success: false,
5990
- refreshTokenSize: undefined
5994
+ success: false
5991
5995
  });
5992
5996
  throw error;
5993
5997
  })];
@@ -6207,7 +6211,7 @@
6207
6211
  return RefreshTokenClient;
6208
6212
  }(BaseClient));
6209
6213
 
6210
- /*! @azure/msal-common v7.5.0 2022-10-03 */
6214
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
6211
6215
 
6212
6216
  /*
6213
6217
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6331,7 +6335,7 @@
6331
6335
  return SilentFlowClient;
6332
6336
  }(BaseClient));
6333
6337
 
6334
- /*! @azure/msal-common v7.5.0 2022-10-03 */
6338
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
6335
6339
  /*
6336
6340
  * Copyright (c) Microsoft Corporation. All rights reserved.
6337
6341
  * Licensed under the MIT License.
@@ -6343,7 +6347,7 @@
6343
6347
  response.hasOwnProperty("jwks_uri"));
6344
6348
  }
6345
6349
 
6346
- /*! @azure/msal-common v7.5.0 2022-10-03 */
6350
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
6347
6351
  /*
6348
6352
  * Copyright (c) Microsoft Corporation. All rights reserved.
6349
6353
  * Licensed under the MIT License.
@@ -6352,7 +6356,7 @@
6352
6356
  var EndpointMetadata = rawMetdataJSON.endpointMetadata;
6353
6357
  var InstanceDiscoveryMetadata = rawMetdataJSON.instanceDiscoveryMetadata;
6354
6358
 
6355
- /*! @azure/msal-common v7.5.0 2022-10-03 */
6359
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
6356
6360
  /*
6357
6361
  * Copyright (c) Microsoft Corporation. All rights reserved.
6358
6362
  * Licensed under the MIT License.
@@ -6366,7 +6370,7 @@
6366
6370
  ProtocolMode["OIDC"] = "OIDC";
6367
6371
  })(exports.ProtocolMode || (exports.ProtocolMode = {}));
6368
6372
 
6369
- /*! @azure/msal-common v7.5.0 2022-10-03 */
6373
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
6370
6374
 
6371
6375
  /*
6372
6376
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6443,7 +6447,7 @@
6443
6447
  return AuthorityMetadataEntity;
6444
6448
  }());
6445
6449
 
6446
- /*! @azure/msal-common v7.5.0 2022-10-03 */
6450
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
6447
6451
  /*
6448
6452
  * Copyright (c) Microsoft Corporation. All rights reserved.
6449
6453
  * Licensed under the MIT License.
@@ -6453,7 +6457,7 @@
6453
6457
  response.hasOwnProperty("metadata"));
6454
6458
  }
6455
6459
 
6456
- /*! @azure/msal-common v7.5.0 2022-10-03 */
6460
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
6457
6461
 
6458
6462
  /*
6459
6463
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6575,7 +6579,7 @@
6575
6579
  return RegionDiscovery;
6576
6580
  }());
6577
6581
 
6578
- /*! @azure/msal-common v7.5.0 2022-10-03 */
6582
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
6579
6583
 
6580
6584
  /*
6581
6585
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7247,7 +7251,7 @@
7247
7251
  return Authority;
7248
7252
  }());
7249
7253
 
7250
- /*! @azure/msal-common v7.5.0 2022-10-03 */
7254
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
7251
7255
 
7252
7256
  /*
7253
7257
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7308,7 +7312,7 @@
7308
7312
  return AuthorityFactory;
7309
7313
  }());
7310
7314
 
7311
- /*! @azure/msal-common v7.5.0 2022-10-03 */
7315
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
7312
7316
 
7313
7317
  /*
7314
7318
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7339,7 +7343,7 @@
7339
7343
  return ServerTelemetryEntity;
7340
7344
  }());
7341
7345
 
7342
- /*! @azure/msal-common v7.5.0 2022-10-03 */
7346
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
7343
7347
 
7344
7348
  /*
7345
7349
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7367,7 +7371,7 @@
7367
7371
  return ThrottlingEntity;
7368
7372
  }());
7369
7373
 
7370
- /*! @azure/msal-common v7.5.0 2022-10-03 */
7374
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
7371
7375
 
7372
7376
  /*
7373
7377
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7384,7 +7388,7 @@
7384
7388
  }
7385
7389
  };
7386
7390
 
7387
- /*! @azure/msal-common v7.5.0 2022-10-03 */
7391
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
7388
7392
 
7389
7393
  /*
7390
7394
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7429,7 +7433,7 @@
7429
7433
  return JoseHeaderError;
7430
7434
  }(AuthError));
7431
7435
 
7432
- /*! @azure/msal-common v7.5.0 2022-10-03 */
7436
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
7433
7437
 
7434
7438
  /*
7435
7439
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7469,7 +7473,7 @@
7469
7473
  return JoseHeader;
7470
7474
  }());
7471
7475
 
7472
- /*! @azure/msal-common v7.5.0 2022-10-03 */
7476
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
7473
7477
 
7474
7478
  /*
7475
7479
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7528,7 +7532,7 @@
7528
7532
  return AuthenticationHeaderParser;
7529
7533
  }());
7530
7534
 
7531
- /*! @azure/msal-common v7.5.0 2022-10-03 */
7535
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
7532
7536
 
7533
7537
  /*
7534
7538
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7690,7 +7694,7 @@
7690
7694
  return ServerTelemetryManager;
7691
7695
  }());
7692
7696
 
7693
- /*! @azure/msal-common v7.5.0 2022-10-03 */
7697
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
7694
7698
 
7695
7699
  /*
7696
7700
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7717,6 +7721,7 @@
7717
7721
  this.logger = logger;
7718
7722
  this.callbacks = new Map();
7719
7723
  this.eventsByCorrelationId = new Map();
7724
+ this.staticFieldsByCorrelationId = new Map();
7720
7725
  this.measurementsById = new Map();
7721
7726
  }
7722
7727
  /**
@@ -7743,8 +7748,6 @@
7743
7748
  authority: this.authority,
7744
7749
  libraryName: this.libraryName,
7745
7750
  libraryVersion: this.libraryVersion,
7746
- appName: (_a = this.applicationTelemetry) === null || _a === void 0 ? void 0 : _a.appName,
7747
- appVersion: (_b = this.applicationTelemetry) === null || _b === void 0 ? void 0 : _b.appVersion,
7748
7751
  clientId: this.clientId,
7749
7752
  name: measureName,
7750
7753
  startTimeMs: Date.now(),
@@ -7752,6 +7755,11 @@
7752
7755
  };
7753
7756
  // Store in progress events so they can be discarded if not ended properly
7754
7757
  this.cacheEventByCorrelationId(inProgressEvent);
7758
+ var staticFields = {
7759
+ appName: (_a = this.applicationTelemetry) === null || _a === void 0 ? void 0 : _a.appName,
7760
+ appVersion: (_b = this.applicationTelemetry) === null || _b === void 0 ? void 0 : _b.appVersion,
7761
+ };
7762
+ this.addStaticFields(staticFields, eventCorrelationId);
7755
7763
  this.cacheMeasurement(inProgressEvent, performanceMeasurement);
7756
7764
  // Return the event and functions the caller can use to properly end/flush the measurement
7757
7765
  return {
@@ -7769,6 +7777,9 @@
7769
7777
  discardMeasurement: function () {
7770
7778
  return _this.discardMeasurements(inProgressEvent.correlationId);
7771
7779
  },
7780
+ addStaticFields: function (fields) {
7781
+ return _this.addStaticFields(fields, inProgressEvent.correlationId);
7782
+ },
7772
7783
  measurement: performanceMeasurement,
7773
7784
  event: inProgressEvent
7774
7785
  };
@@ -7804,6 +7815,22 @@
7804
7815
  }
7805
7816
  return null;
7806
7817
  };
7818
+ /**
7819
+ * Saves extra information to be emitted when the measurements are flushed
7820
+ * @param fields
7821
+ * @param correlationId
7822
+ */
7823
+ PerformanceClient.prototype.addStaticFields = function (fields, correlationId) {
7824
+ var existingStaticFields = this.staticFieldsByCorrelationId.get(correlationId);
7825
+ if (existingStaticFields) {
7826
+ this.logger.trace("PerformanceClient: Updating static fields");
7827
+ this.staticFieldsByCorrelationId.set(correlationId, __assign(__assign({}, existingStaticFields), fields));
7828
+ }
7829
+ else {
7830
+ this.logger.trace("PerformanceClient: Adding static fields");
7831
+ this.staticFieldsByCorrelationId.set(correlationId, fields);
7832
+ }
7833
+ };
7807
7834
  /**
7808
7835
  * Upserts event into event cache.
7809
7836
  * First key is the correlation id, second key is the event id.
@@ -7893,19 +7920,12 @@
7893
7920
  else {
7894
7921
  _this.logger.verbose("PerformanceClient: Submeasurement for " + measureName + " already exists for " + current.name + ", ignoring", correlationId);
7895
7922
  }
7896
- if (current.accessTokenSize) {
7897
- previous.accessTokenSize = current.accessTokenSize;
7898
- }
7899
- if (current.idTokenSize) {
7900
- previous.idTokenSize = current.idTokenSize;
7901
- }
7902
- if (current.refreshTokenSize) {
7903
- previous.refreshTokenSize = current.refreshTokenSize;
7904
- }
7905
7923
  }
7906
7924
  return previous;
7907
7925
  }, topLevelEvent);
7908
- this.emitEvents([eventToEmit], eventToEmit.correlationId);
7926
+ var staticFields = this.staticFieldsByCorrelationId.get(correlationId);
7927
+ var finalEvent = __assign(__assign({}, eventToEmit), staticFields);
7928
+ this.emitEvents([finalEvent], eventToEmit.correlationId);
7909
7929
  }
7910
7930
  else {
7911
7931
  this.logger.verbose("PerformanceClient: No completed top-level measurements found for " + measureName, correlationId);
@@ -7969,7 +7989,7 @@
7969
7989
  return PerformanceClient;
7970
7990
  }());
7971
7991
 
7972
- /*! @azure/msal-common v7.5.0 2022-10-03 */
7992
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
7973
7993
 
7974
7994
  /*
7975
7995
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8507,7 +8527,7 @@
8507
8527
  /**
8508
8528
  * Default popup monitor poll interval in milliseconds
8509
8529
  */
8510
- POLL_INTERVAL_MS: 50,
8530
+ DEFAULT_POLL_INTERVAL_MS: 30,
8511
8531
  /**
8512
8532
  * Msal-browser SKU
8513
8533
  */
@@ -9844,7 +9864,7 @@
9844
9864
 
9845
9865
  /* eslint-disable header/header */
9846
9866
  var name = "@azure/msal-browser";
9847
- var version = "2.29.0";
9867
+ var version = "2.31.0";
9848
9868
 
9849
9869
  /*
9850
9870
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11225,7 +11245,7 @@
11225
11245
  result = _a.sent();
11226
11246
  nativeATMeasurement.endMeasurement({
11227
11247
  success: true,
11228
- isNativeBroker: true,
11248
+ isNativeBroker: false,
11229
11249
  fromCache: true
11230
11250
  });
11231
11251
  return [2 /*return*/, result];
@@ -11367,7 +11387,7 @@
11367
11387
  */
11368
11388
  NativeInteractionClient.prototype.handleRedirectPromise = function () {
11369
11389
  return __awaiter$1(this, void 0, void 0, function () {
11370
- var cachedRequest, messageBody, reqTimestamp, response, result, e_4;
11390
+ var cachedRequest, prompt, request, messageBody, reqTimestamp, response, result, e_4;
11371
11391
  return __generator$1(this, function (_a) {
11372
11392
  switch (_a.label) {
11373
11393
  case 0:
@@ -11381,10 +11401,14 @@
11381
11401
  this.logger.verbose("NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null.");
11382
11402
  return [2 /*return*/, null];
11383
11403
  }
11404
+ prompt = cachedRequest.prompt, request = __rest(cachedRequest, ["prompt"]);
11405
+ if (prompt) {
11406
+ this.logger.verbose("NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window.");
11407
+ }
11384
11408
  this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));
11385
11409
  messageBody = {
11386
11410
  method: NativeExtensionMethod.GetToken,
11387
- request: cachedRequest
11411
+ request: request
11388
11412
  };
11389
11413
  reqTimestamp = TimeUtils.nowSeconds();
11390
11414
  _a.label = 1;
@@ -11395,7 +11419,7 @@
11395
11419
  case 2:
11396
11420
  response = _a.sent();
11397
11421
  this.validateNativeResponse(response);
11398
- result = this.handleNativeResponse(response, cachedRequest, reqTimestamp);
11422
+ result = this.handleNativeResponse(response, request, reqTimestamp);
11399
11423
  this.browserStorage.setInteractionInProgress(false);
11400
11424
  return [2 /*return*/, result];
11401
11425
  case 3:
@@ -11423,12 +11447,30 @@
11423
11447
  */
11424
11448
  NativeInteractionClient.prototype.handleNativeResponse = function (response, request, reqTimestamp) {
11425
11449
  return __awaiter$1(this, void 0, void 0, function () {
11426
- var idTokenObj, authority, authorityPreferredCache, homeAccountIdentifier, accountEntity, responseScopes, accountProperties, uid, tid, responseAccessToken, responseTokenType, _a, popTokenGenerator, shrParameters, mats, result, idTokenEntity, expiresIn, tokenExpirationSeconds, accessTokenEntity;
11450
+ var mats, idTokenObj, authority, authorityPreferredCache, homeAccountIdentifier, accountEntity, responseScopes, accountProperties, uid, tid, responseAccessToken, responseTokenType, _a, popTokenGenerator, shrParameters, result, idTokenEntity, expiresIn, tokenExpirationSeconds, accessTokenEntity;
11427
11451
  var _this = this;
11428
11452
  return __generator$1(this, function (_b) {
11429
11453
  switch (_b.label) {
11430
11454
  case 0:
11431
11455
  this.logger.trace("NativeInteractionClient - handleNativeResponse called.");
11456
+ mats = this.getMATSFromResponse(response);
11457
+ this.performanceClient.addStaticFields({
11458
+ extensionId: this.nativeMessageHandler.getExtensionId(),
11459
+ extensionVersion: this.nativeMessageHandler.getExtensionVersion(),
11460
+ matsBrokerVersion: mats ? mats.broker_version : undefined,
11461
+ matsAccountJoinOnStart: mats ? mats.account_join_on_start : undefined,
11462
+ matsAccountJoinOnEnd: mats ? mats.account_join_on_end : undefined,
11463
+ matsDeviceJoin: mats ? mats.device_join : undefined,
11464
+ matsPromptBehavior: mats ? mats.prompt_behavior : undefined,
11465
+ matsApiErrorCode: mats ? mats.api_error_code : undefined,
11466
+ matsUiVisible: mats ? mats.ui_visible : undefined,
11467
+ matsSilentCode: mats ? mats.silent_code : undefined,
11468
+ matsSilentBiSubCode: mats ? mats.silent_bi_sub_code : undefined,
11469
+ matsSilentMessage: mats ? mats.silent_message : undefined,
11470
+ matsSilentStatus: mats ? mats.silent_status : undefined,
11471
+ matsHttpStatus: mats ? mats.http_status : undefined,
11472
+ matsHttpEventCount: mats ? mats.http_event_count : undefined
11473
+ }, this.correlationId);
11432
11474
  if (response.account.id !== request.accountId) {
11433
11475
  // User switch in native broker prompt is not supported. All users must first sign in through web flow to ensure server state is in sync
11434
11476
  throw NativeAuthError.createUserSwitchError();
@@ -11484,7 +11526,6 @@
11484
11526
  }
11485
11527
  _b.label = 5;
11486
11528
  case 5:
11487
- mats = this.getMATSFromResponse(response);
11488
11529
  result = {
11489
11530
  authority: authority.canonicalAuthority,
11490
11531
  uniqueId: uid,
@@ -11816,6 +11857,7 @@
11816
11857
  clearTimeout(this.timeoutId); // Clear setTimeout
11817
11858
  window.removeEventListener("message", this.windowListener, false); // Remove 'No extension' listener
11818
11859
  this.extensionId = request.extensionId;
11860
+ this.extensionVersion = request.body.version;
11819
11861
  this.logger.verbose("NativeMessageHandler - Received HandshakeResponse from extension: " + this.extensionId);
11820
11862
  handshakeResolver.resolve();
11821
11863
  this.handshakeResolvers.delete(request.responseId);
@@ -11834,6 +11876,20 @@
11834
11876
  }
11835
11877
  }
11836
11878
  };
11879
+ /**
11880
+ * Returns the Id for the browser extension this handler is communicating with
11881
+ * @returns
11882
+ */
11883
+ NativeMessageHandler.prototype.getExtensionId = function () {
11884
+ return this.extensionId;
11885
+ };
11886
+ /**
11887
+ * Returns the version for the browser extension this handler is communicating with
11888
+ * @returns
11889
+ */
11890
+ NativeMessageHandler.prototype.getExtensionVersion = function () {
11891
+ return this.extensionVersion;
11892
+ };
11837
11893
  /**
11838
11894
  * Returns boolean indicating whether or not the request should attempt to use native broker
11839
11895
  * @param logger
@@ -12464,7 +12520,7 @@
12464
12520
  * Polling for popups needs to be tick-based,
12465
12521
  * since a non-trivial amount of time can be spent on interaction (which should not count against the timeout).
12466
12522
  */
12467
- var maxTicks = _this.config.system.windowHashTimeout / BrowserConstants.POLL_INTERVAL_MS;
12523
+ var maxTicks = _this.config.system.windowHashTimeout / _this.config.system.pollIntervalMilliseconds;
12468
12524
  var ticks = 0;
12469
12525
  _this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");
12470
12526
  var intervalId = setInterval(function () {
@@ -12517,7 +12573,7 @@
12517
12573
  clearInterval(intervalId);
12518
12574
  reject(BrowserAuthError.createMonitorPopupTimeoutError());
12519
12575
  }
12520
- }, BrowserConstants.POLL_INTERVAL_MS);
12576
+ }, _this.config.system.pollIntervalMilliseconds);
12521
12577
  });
12522
12578
  };
12523
12579
  /**
@@ -12555,7 +12611,7 @@
12555
12611
  clearInterval(intervalId);
12556
12612
  _this.cleanPopup(popupWindow);
12557
12613
  resolve();
12558
- }, BrowserConstants.POLL_INTERVAL_MS);
12614
+ }, _this.config.system.pollIntervalMilliseconds);
12559
12615
  });
12560
12616
  };
12561
12617
  /**
@@ -12788,7 +12844,7 @@
12788
12844
  // Default system options for browser
12789
12845
  var DEFAULT_BROWSER_SYSTEM_OPTIONS = __assign$1(__assign$1({}, DEFAULT_SYSTEM_OPTIONS), { loggerOptions: DEFAULT_LOGGER_OPTIONS, networkClient: isBrowserEnvironment ? BrowserUtils.getBrowserNetworkClient() : StubbedNetworkModule, navigationClient: new NavigationClient(), loadFrameTimeout: 0,
12790
12846
  // If loadFrameTimeout is provided, use that as default.
12791
- windowHashTimeout: (userInputSystem === null || userInputSystem === void 0 ? void 0 : userInputSystem.loadFrameTimeout) || DEFAULT_POPUP_TIMEOUT_MS, iframeHashTimeout: (userInputSystem === null || userInputSystem === void 0 ? void 0 : userInputSystem.loadFrameTimeout) || DEFAULT_IFRAME_TIMEOUT_MS, navigateFrameWait: isBrowserEnvironment && BrowserUtils.detectIEOrEdge() ? 500 : 0, redirectNavigationTimeout: DEFAULT_REDIRECT_TIMEOUT_MS, asyncPopups: false, allowRedirectInIframe: false, allowNativeBroker: false, nativeBrokerHandshakeTimeout: (userInputSystem === null || userInputSystem === void 0 ? void 0 : userInputSystem.nativeBrokerHandshakeTimeout) || DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS, cryptoOptions: {
12847
+ windowHashTimeout: (userInputSystem === null || userInputSystem === void 0 ? void 0 : userInputSystem.loadFrameTimeout) || DEFAULT_POPUP_TIMEOUT_MS, iframeHashTimeout: (userInputSystem === null || userInputSystem === void 0 ? void 0 : userInputSystem.loadFrameTimeout) || DEFAULT_IFRAME_TIMEOUT_MS, navigateFrameWait: isBrowserEnvironment && BrowserUtils.detectIEOrEdge() ? 500 : 0, redirectNavigationTimeout: DEFAULT_REDIRECT_TIMEOUT_MS, asyncPopups: false, allowRedirectInIframe: false, allowNativeBroker: false, nativeBrokerHandshakeTimeout: (userInputSystem === null || userInputSystem === void 0 ? void 0 : userInputSystem.nativeBrokerHandshakeTimeout) || DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS, pollIntervalMilliseconds: BrowserConstants.DEFAULT_POLL_INTERVAL_MS, cryptoOptions: {
12792
12848
  useMsrCrypto: false,
12793
12849
  entropy: undefined
12794
12850
  } });
@@ -12813,9 +12869,10 @@
12813
12869
  */
12814
12870
  var SilentHandler = /** @class */ (function (_super) {
12815
12871
  __extends$1(SilentHandler, _super);
12816
- function SilentHandler(authCodeModule, storageImpl, authCodeRequest, logger, navigateFrameWait) {
12872
+ function SilentHandler(authCodeModule, storageImpl, authCodeRequest, logger, systemOptions) {
12817
12873
  var _this = _super.call(this, authCodeModule, storageImpl, authCodeRequest, logger) || this;
12818
- _this.navigateFrameWait = navigateFrameWait;
12874
+ _this.navigateFrameWait = systemOptions.navigateFrameWait;
12875
+ _this.pollIntervalMilliseconds = systemOptions.pollIntervalMilliseconds;
12819
12876
  return _this;
12820
12877
  }
12821
12878
  /**
@@ -12893,7 +12950,7 @@
12893
12950
  resolve(contentHash);
12894
12951
  return;
12895
12952
  }
12896
- }, BrowserConstants.POLL_INTERVAL_MS);
12953
+ }, _this.pollIntervalMilliseconds);
12897
12954
  });
12898
12955
  };
12899
12956
  /**
@@ -13058,7 +13115,7 @@
13058
13115
  return [4 /*yield*/, authClient.getAuthCodeUrl(__assign$1(__assign$1({}, silentRequest), { nativeBroker: NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeMessageHandler, silentRequest.authenticationScheme) }))];
13059
13116
  case 2:
13060
13117
  navigateUrl = _a.sent();
13061
- silentHandler = new SilentHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.config.system.navigateFrameWait);
13118
+ silentHandler = new SilentHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.config.system);
13062
13119
  return [4 /*yield*/, silentHandler.initiateAuthRequest(navigateUrl)];
13063
13120
  case 3:
13064
13121
  msalFrame = _a.sent();
@@ -14867,15 +14924,19 @@
14867
14924
  * @param request
14868
14925
  * @param response
14869
14926
  * @param options
14927
+ * @returns `AuthenticationResult` for the response that was loaded.
14870
14928
  */
14871
14929
  TokenCache.prototype.loadExternalTokens = function (request, response, options) {
14872
14930
  this.logger.info("TokenCache - loadExternalTokens called");
14873
14931
  if (!response.id_token) {
14874
14932
  throw BrowserAuthError.createUnableToLoadTokenError("Please ensure server response includes id token.");
14875
14933
  }
14934
+ var idToken = new AuthToken(response.id_token, this.cryptoObj);
14935
+ var cacheRecord;
14936
+ var authority;
14876
14937
  if (request.account) {
14877
- this.loadIdToken(response.id_token, request.account.homeAccountId, request.account.environment, request.account.tenantId, options);
14878
- this.loadAccessToken(request, response, request.account.homeAccountId, request.account.environment, request.account.tenantId, options);
14938
+ var cacheRecordAccount = this.loadAccount(idToken, request.account.environment, undefined, undefined, request.account.homeAccountId);
14939
+ cacheRecord = new CacheRecord(cacheRecordAccount, this.loadIdToken(idToken, cacheRecordAccount.homeAccountId, request.account.environment, request.account.tenantId), this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, request.account.environment, request.account.tenantId, options), this.loadRefreshToken(request, response, cacheRecordAccount.homeAccountId, request.account.environment));
14879
14940
  }
14880
14941
  else if (request.authority) {
14881
14942
  var authorityUrl = Authority.generateAuthority(request.authority, request.azureCloudOptions);
@@ -14886,17 +14947,17 @@
14886
14947
  authorityMetadata: this.config.auth.authorityMetadata,
14887
14948
  skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache,
14888
14949
  };
14889
- var authority = new Authority(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions);
14950
+ authority = new Authority(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions);
14890
14951
  // "clientInfo" from options takes precedence over "clientInfo" in response
14891
14952
  if (options.clientInfo) {
14892
14953
  this.logger.trace("TokenCache - homeAccountId from options");
14893
- this.loadIdToken(response.id_token, options.clientInfo, authority.hostnameAndPort, authority.tenant, options);
14894
- this.loadAccessToken(request, response, options.clientInfo, authority.hostnameAndPort, authority.tenant, options);
14954
+ var cacheRecordAccount = this.loadAccount(idToken, authority.hostnameAndPort, options.clientInfo, authority.authorityType);
14955
+ cacheRecord = new CacheRecord(cacheRecordAccount, this.loadIdToken(idToken, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant), this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant, options), this.loadRefreshToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort));
14895
14956
  }
14896
14957
  else if (response.client_info) {
14897
14958
  this.logger.trace("TokenCache - homeAccountId from response");
14898
- this.loadIdToken(response.id_token, response.client_info, authority.hostnameAndPort, authority.tenant, options);
14899
- this.loadAccessToken(request, response, response.client_info, authority.hostnameAndPort, authority.tenant, options);
14959
+ var cacheRecordAccount = this.loadAccount(idToken, authority.hostnameAndPort, response.client_info, authority.authorityType);
14960
+ cacheRecord = new CacheRecord(cacheRecordAccount, this.loadIdToken(idToken, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant), this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant, options), this.loadRefreshToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort));
14900
14961
  }
14901
14962
  else {
14902
14963
  throw BrowserAuthError.createUnableToLoadTokenError("Please provide clientInfo in the response or options.");
@@ -14905,6 +14966,39 @@
14905
14966
  else {
14906
14967
  throw BrowserAuthError.createUnableToLoadTokenError("Please provide a request with an account or a request with authority.");
14907
14968
  }
14969
+ return this.generateAuthenticationResult(request, idToken, cacheRecord, authority);
14970
+ };
14971
+ /**
14972
+ * Helper function to load account to msal-browser cache
14973
+ * @param idToken
14974
+ * @param environment
14975
+ * @param clientInfo
14976
+ * @param authorityType
14977
+ * @param requestHomeAccountId
14978
+ * @returns `AccountEntity`
14979
+ */
14980
+ TokenCache.prototype.loadAccount = function (idToken, environment, clientInfo, authorityType, requestHomeAccountId) {
14981
+ var homeAccountId;
14982
+ if (requestHomeAccountId) {
14983
+ homeAccountId = requestHomeAccountId;
14984
+ }
14985
+ else if (authorityType !== undefined && clientInfo) {
14986
+ homeAccountId = AccountEntity.generateHomeAccountId(clientInfo, authorityType, this.logger, this.cryptoObj, idToken);
14987
+ }
14988
+ if (!homeAccountId) {
14989
+ throw BrowserAuthError.createUnableToLoadTokenError("Unexpected missing homeAccountId");
14990
+ }
14991
+ var accountEntity = clientInfo ?
14992
+ AccountEntity.createAccount(clientInfo, homeAccountId, idToken, undefined, undefined, undefined, environment) :
14993
+ AccountEntity.createGenericAccount(homeAccountId, idToken, undefined, undefined, undefined, environment);
14994
+ if (this.isBrowserEnvironment) {
14995
+ this.logger.verbose("TokenCache - loading account");
14996
+ this.storage.setAccount(accountEntity);
14997
+ return accountEntity;
14998
+ }
14999
+ else {
15000
+ throw BrowserAuthError.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.");
15001
+ }
14908
15002
  };
14909
15003
  /**
14910
15004
  * Helper function to load id tokens to msal-browser cache
@@ -14912,18 +15006,14 @@
14912
15006
  * @param homeAccountId
14913
15007
  * @param environment
14914
15008
  * @param tenantId
14915
- * @param options
15009
+ * @returns `IdTokenEntity`
14916
15010
  */
14917
- TokenCache.prototype.loadIdToken = function (idToken, homeAccountId, environment, tenantId, options) {
14918
- var idTokenEntity = IdTokenEntity.createIdTokenEntity(homeAccountId, environment, idToken, this.config.auth.clientId, tenantId);
14919
- var idAuthToken = new AuthToken(idToken, this.cryptoObj);
14920
- var accountEntity = options.clientInfo ?
14921
- AccountEntity.createAccount(options.clientInfo, homeAccountId, idAuthToken, undefined, undefined, undefined, environment) :
14922
- AccountEntity.createGenericAccount(homeAccountId, idAuthToken, undefined, undefined, undefined, environment);
15011
+ TokenCache.prototype.loadIdToken = function (idToken, homeAccountId, environment, tenantId) {
15012
+ var idTokenEntity = IdTokenEntity.createIdTokenEntity(homeAccountId, environment, idToken.rawToken, this.config.auth.clientId, tenantId);
14923
15013
  if (this.isBrowserEnvironment) {
14924
15014
  this.logger.verbose("TokenCache - loading id token");
14925
- this.storage.setAccount(accountEntity);
14926
15015
  this.storage.setIdTokenCredential(idTokenEntity);
15016
+ return idTokenEntity;
14927
15017
  }
14928
15018
  else {
14929
15019
  throw BrowserAuthError.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.");
@@ -14933,16 +15023,15 @@
14933
15023
  * Helper function to load access tokens to msal-browser cache
14934
15024
  * @param request
14935
15025
  * @param response
14936
- * @param options
14937
15026
  * @param homeAccountId
14938
15027
  * @param environment
14939
15028
  * @param tenantId
14940
- * @returns
15029
+ * @returns `AccessTokenEntity`
14941
15030
  */
14942
15031
  TokenCache.prototype.loadAccessToken = function (request, response, homeAccountId, environment, tenantId, options) {
14943
15032
  if (!response.access_token) {
14944
15033
  this.logger.verbose("TokenCache - No access token provided for caching");
14945
- return;
15034
+ return null;
14946
15035
  }
14947
15036
  if (!response.expires_in) {
14948
15037
  throw BrowserAuthError.createUnableToLoadTokenError("Please ensure server response includes expires_in value.");
@@ -14957,11 +15046,80 @@
14957
15046
  if (this.isBrowserEnvironment) {
14958
15047
  this.logger.verbose("TokenCache - loading access token");
14959
15048
  this.storage.setAccessTokenCredential(accessTokenEntity);
15049
+ return accessTokenEntity;
15050
+ }
15051
+ else {
15052
+ throw BrowserAuthError.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.");
15053
+ }
15054
+ };
15055
+ /**
15056
+ * Helper function to load refresh tokens to msal-browser cache
15057
+ * @param request
15058
+ * @param response
15059
+ * @param homeAccountId
15060
+ * @param environment
15061
+ * @returns `RefreshTokenEntity`
15062
+ */
15063
+ TokenCache.prototype.loadRefreshToken = function (request, response, homeAccountId, environment) {
15064
+ if (!response.refresh_token) {
15065
+ this.logger.verbose("TokenCache - No refresh token provided for caching");
15066
+ return null;
15067
+ }
15068
+ var refreshTokenEntity = RefreshTokenEntity.createRefreshTokenEntity(homeAccountId, environment, response.refresh_token, this.config.auth.clientId);
15069
+ if (this.isBrowserEnvironment) {
15070
+ this.logger.verbose("TokenCache - loading refresh token");
15071
+ this.storage.setRefreshTokenCredential(refreshTokenEntity);
15072
+ return refreshTokenEntity;
14960
15073
  }
14961
15074
  else {
14962
15075
  throw BrowserAuthError.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.");
14963
15076
  }
14964
15077
  };
15078
+ /**
15079
+ * Helper function to generate an `AuthenticationResult` for the result.
15080
+ * @param request
15081
+ * @param idTokenObj
15082
+ * @param cacheRecord
15083
+ * @param authority
15084
+ * @returns `AuthenticationResult`
15085
+ */
15086
+ TokenCache.prototype.generateAuthenticationResult = function (request, idTokenObj, cacheRecord, authority) {
15087
+ var _a, _b, _c;
15088
+ var accessToken = Constants.EMPTY_STRING;
15089
+ var responseScopes = [];
15090
+ var expiresOn = null;
15091
+ var extExpiresOn;
15092
+ if (cacheRecord === null || cacheRecord === void 0 ? void 0 : cacheRecord.accessToken) {
15093
+ accessToken = cacheRecord.accessToken.secret;
15094
+ responseScopes = ScopeSet.fromString(cacheRecord.accessToken.target).asArray();
15095
+ expiresOn = new Date(Number(cacheRecord.accessToken.expiresOn) * 1000);
15096
+ extExpiresOn = new Date(Number(cacheRecord.accessToken.extendedExpiresOn) * 1000);
15097
+ }
15098
+ var uid = (idTokenObj === null || idTokenObj === void 0 ? void 0 : idTokenObj.claims.oid) || (idTokenObj === null || idTokenObj === void 0 ? void 0 : idTokenObj.claims.sub) || Constants.EMPTY_STRING;
15099
+ var tid = (idTokenObj === null || idTokenObj === void 0 ? void 0 : idTokenObj.claims.tid) || Constants.EMPTY_STRING;
15100
+ return {
15101
+ authority: authority ? authority.canonicalAuthority : Constants.EMPTY_STRING,
15102
+ uniqueId: uid,
15103
+ tenantId: tid,
15104
+ scopes: responseScopes,
15105
+ account: (cacheRecord === null || cacheRecord === void 0 ? void 0 : cacheRecord.account) ? cacheRecord.account.getAccountInfo() : null,
15106
+ idToken: idTokenObj ? idTokenObj.rawToken : Constants.EMPTY_STRING,
15107
+ idTokenClaims: idTokenObj ? idTokenObj.claims : {},
15108
+ accessToken: accessToken,
15109
+ fromCache: true,
15110
+ expiresOn: expiresOn,
15111
+ correlationId: request.correlationId || Constants.EMPTY_STRING,
15112
+ requestId: Constants.EMPTY_STRING,
15113
+ extExpiresOn: extExpiresOn,
15114
+ familyId: Constants.EMPTY_STRING,
15115
+ tokenType: ((_a = cacheRecord === null || cacheRecord === void 0 ? void 0 : cacheRecord.accessToken) === null || _a === void 0 ? void 0 : _a.tokenType) || Constants.EMPTY_STRING,
15116
+ state: Constants.EMPTY_STRING,
15117
+ cloudGraphHostName: ((_b = cacheRecord === null || cacheRecord === void 0 ? void 0 : cacheRecord.account) === null || _b === void 0 ? void 0 : _b.cloudGraphHostName) || Constants.EMPTY_STRING,
15118
+ msGraphHost: ((_c = cacheRecord === null || cacheRecord === void 0 ? void 0 : cacheRecord.account) === null || _c === void 0 ? void 0 : _c.msGraphHost) || Constants.EMPTY_STRING,
15119
+ code: undefined,
15120
+ fromNativeBroker: false
15121
+ };
15122
+ };
14965
15123
  return TokenCache;
14966
15124
  }());
14967
15125
 
@@ -15019,7 +15177,7 @@
15019
15177
  clientConfig = _a.sent();
15020
15178
  authClient = new HybridSpaAuthorizationCodeClient(clientConfig);
15021
15179
  this.logger.verbose("Auth code client created");
15022
- silentHandler = new SilentHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.config.system.navigateFrameWait);
15180
+ silentHandler = new SilentHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.config.system);
15023
15181
  // Handle auth code parameters from request
15024
15182
  return [2 /*return*/, silentHandler.handleCodeResponseFromServer({
15025
15183
  code: request.code,
@@ -15425,8 +15583,6 @@
15425
15583
  atPopupMeasurement.endMeasurement({
15426
15584
  success: true,
15427
15585
  isNativeBroker: true,
15428
- accessTokenSize: response.accessToken.length,
15429
- idTokenSize: response.idToken.length,
15430
15586
  requestId: response.requestId
15431
15587
  });
15432
15588
  atPopupMeasurement.flushMeasurement();
@@ -15461,10 +15617,12 @@
15461
15617
  else {
15462
15618
  _this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Popup, result);
15463
15619
  }
15620
+ atPopupMeasurement.addStaticFields({
15621
+ accessTokenSize: result.accessToken.length,
15622
+ idTokenSize: result.idToken.length
15623
+ });
15464
15624
  atPopupMeasurement.endMeasurement({
15465
15625
  success: true,
15466
- accessTokenSize: result.accessToken.length,
15467
- idTokenSize: result.idToken.length,
15468
15626
  requestId: result.requestId
15469
15627
  });
15470
15628
  atPopupMeasurement.flushMeasurement();
@@ -15533,11 +15691,13 @@
15533
15691
  }
15534
15692
  return [2 /*return*/, result.then(function (response) {
15535
15693
  _this.eventHandler.emitEvent(exports.EventType.SSO_SILENT_SUCCESS, exports.InteractionType.Silent, response);
15694
+ ssoSilentMeasurement.addStaticFields({
15695
+ accessTokenSize: response.accessToken.length,
15696
+ idTokenSize: response.idToken.length
15697
+ });
15536
15698
  ssoSilentMeasurement.endMeasurement({
15537
15699
  success: true,
15538
15700
  isNativeBroker: response.fromNativeBroker,
15539
- accessTokenSize: response.accessToken.length,
15540
- idTokenSize: response.idToken.length,
15541
15701
  requestId: response.requestId
15542
15702
  });
15543
15703
  ssoSilentMeasurement.flushMeasurement();
@@ -15585,10 +15745,12 @@
15585
15745
  .then(function (result) {
15586
15746
  _this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_BY_CODE_SUCCESS, exports.InteractionType.Silent, result);
15587
15747
  _this.hybridAuthCodeResponses.delete(hybridAuthCode_1);
15748
+ atbcMeasurement.addStaticFields({
15749
+ accessTokenSize: result.accessToken.length,
15750
+ idTokenSize: result.idToken.length
15751
+ });
15588
15752
  atbcMeasurement.endMeasurement({
15589
15753
  success: true,
15590
- accessTokenSize: result.accessToken.length,
15591
- idTokenSize: result.idToken.length,
15592
15754
  isNativeBroker: result.fromNativeBroker,
15593
15755
  requestId: result.requestId
15594
15756
  });
@@ -16189,6 +16351,9 @@
16189
16351
  return __generator$1(this, function (_a) {
16190
16352
  correlationId = this.getRequestCorrelationId(request);
16191
16353
  atsMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.AcquireTokenSilent, correlationId);
16354
+ atsMeasurement.addStaticFields({
16355
+ cacheLookupPolicy: request.cacheLookupPolicy
16356
+ });
16192
16357
  this.preflightBrowserEnvironmentCheck(exports.InteractionType.Silent);
16193
16358
  this.logger.verbose("acquireTokenSilent called", correlationId);
16194
16359
  account = request.account || this.getActiveAccount();
@@ -16214,13 +16379,14 @@
16214
16379
  response = this.acquireTokenSilentAsync(__assign$1(__assign$1({}, request), { correlationId: correlationId }), account)
16215
16380
  .then(function (result) {
16216
16381
  _this.activeSilentTokenRequests.delete(silentRequestKey);
16382
+ atsMeasurement.addStaticFields({
16383
+ accessTokenSize: result.accessToken.length,
16384
+ idTokenSize: result.idToken.length
16385
+ });
16217
16386
  atsMeasurement.endMeasurement({
16218
16387
  success: true,
16219
16388
  fromCache: result.fromCache,
16220
- accessTokenSize: result.accessToken.length,
16221
- idTokenSize: result.idToken.length,
16222
16389
  isNativeBroker: result.fromNativeBroker,
16223
- cacheLookupPolicy: request.cacheLookupPolicy,
16224
16390
  requestId: result.requestId
16225
16391
  });
16226
16392
  atsMeasurement.flushMeasurement();
@@ -16321,8 +16487,6 @@
16321
16487
  astsAsyncMeasurement.endMeasurement({
16322
16488
  success: true,
16323
16489
  fromCache: response.fromCache,
16324
- accessTokenSize: response.accessToken.length,
16325
- idTokenSize: response.idToken.length,
16326
16490
  isNativeBroker: response.fromNativeBroker,
16327
16491
  requestId: response.requestId
16328
16492
  });