@auth0/auth0-spa-js 2.18.0 → 2.18.1

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 (55) hide show
  1. package/dist/auth0-spa-js.development.js +394 -297
  2. package/dist/auth0-spa-js.development.js.map +1 -1
  3. package/dist/auth0-spa-js.production.esm.js +1 -1
  4. package/dist/auth0-spa-js.production.esm.js.map +1 -1
  5. package/dist/auth0-spa-js.production.js +1 -1
  6. package/dist/auth0-spa-js.production.js.map +1 -1
  7. package/dist/auth0-spa-js.worker.development.js +71 -21
  8. package/dist/auth0-spa-js.worker.development.js.map +1 -1
  9. package/dist/auth0-spa-js.worker.production.js +1 -1
  10. package/dist/auth0-spa-js.worker.production.js.map +1 -1
  11. package/dist/lib/auth0-spa-js.cjs.js +417 -317
  12. package/dist/lib/auth0-spa-js.cjs.js.map +1 -1
  13. package/package.json +4 -3
  14. package/src/Auth0Client.ts +10 -7
  15. package/src/index.ts +6 -3
  16. package/src/utils.ts +2 -1
  17. package/src/version.ts +1 -1
  18. package/dist/typings/Auth0Client.d.ts +0 -439
  19. package/dist/typings/Auth0Client.utils.d.ts +0 -90
  20. package/dist/typings/MyAccountApiClient.d.ts +0 -92
  21. package/dist/typings/TokenExchange.d.ts +0 -77
  22. package/dist/typings/api.d.ts +0 -2
  23. package/dist/typings/cache/cache-localstorage.d.ts +0 -7
  24. package/dist/typings/cache/cache-manager.d.ts +0 -56
  25. package/dist/typings/cache/cache-memory.d.ts +0 -4
  26. package/dist/typings/cache/index.d.ts +0 -4
  27. package/dist/typings/cache/key-manifest.d.ts +0 -12
  28. package/dist/typings/cache/shared.d.ts +0 -68
  29. package/dist/typings/constants.d.ts +0 -58
  30. package/dist/typings/dpop/dpop.d.ts +0 -17
  31. package/dist/typings/dpop/storage.d.ts +0 -27
  32. package/dist/typings/dpop/utils.d.ts +0 -15
  33. package/dist/typings/errors.d.ts +0 -96
  34. package/dist/typings/fetcher.d.ts +0 -54
  35. package/dist/typings/global.d.ts +0 -819
  36. package/dist/typings/http.d.ts +0 -5
  37. package/dist/typings/index.d.ts +0 -23
  38. package/dist/typings/jwt.d.ts +0 -21
  39. package/dist/typings/lock.d.ts +0 -32
  40. package/dist/typings/mfa/MfaApiClient.d.ts +0 -225
  41. package/dist/typings/mfa/MfaContextManager.d.ts +0 -79
  42. package/dist/typings/mfa/constants.d.ts +0 -23
  43. package/dist/typings/mfa/errors.d.ts +0 -117
  44. package/dist/typings/mfa/index.d.ts +0 -4
  45. package/dist/typings/mfa/types.d.ts +0 -181
  46. package/dist/typings/mfa/utils.d.ts +0 -23
  47. package/dist/typings/promise-utils.d.ts +0 -2
  48. package/dist/typings/scope.d.ts +0 -35
  49. package/dist/typings/storage.d.ts +0 -26
  50. package/dist/typings/transaction-manager.d.ts +0 -33
  51. package/dist/typings/utils.d.ts +0 -36
  52. package/dist/typings/version.d.ts +0 -2
  53. package/dist/typings/worker/token.worker.d.ts +0 -1
  54. package/dist/typings/worker/worker.types.d.ts +0 -15
  55. package/dist/typings/worker/worker.utils.d.ts +0 -7
@@ -3,19 +3,145 @@
3
3
  factory(global.auth0 = {}));
4
4
  })(this, function(exports) {
5
5
  "use strict";
6
- function __rest(s, e) {
6
+ function _OverloadYield(e, d) {
7
+ this.v = e, this.k = d;
8
+ }
9
+ function _assertClassBrand(e, t, n) {
10
+ if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
11
+ throw new TypeError("Private element is not present on this object");
12
+ }
13
+ function _awaitAsyncGenerator(e) {
14
+ return new _OverloadYield(e, 0);
15
+ }
16
+ function _checkPrivateRedeclaration(e, t) {
17
+ if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
18
+ }
19
+ function _classPrivateFieldGet2(s, a) {
20
+ return s.get(_assertClassBrand(s, a));
21
+ }
22
+ function _classPrivateFieldInitSpec(e, t, a) {
23
+ _checkPrivateRedeclaration(e, t), t.set(e, a);
24
+ }
25
+ function _classPrivateFieldSet2(s, a, r) {
26
+ return s.set(_assertClassBrand(s, a), r), r;
27
+ }
28
+ function _classPrivateMethodInitSpec(e, a) {
29
+ _checkPrivateRedeclaration(e, a), a.add(e);
30
+ }
31
+ function _defineProperty(e, r, t) {
32
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
33
+ value: t,
34
+ enumerable: !0,
35
+ configurable: !0,
36
+ writable: !0
37
+ }) : e[r] = t, e;
38
+ }
39
+ function ownKeys(e, r) {
40
+ var t = Object.keys(e);
41
+ if (Object.getOwnPropertySymbols) {
42
+ var o = Object.getOwnPropertySymbols(e);
43
+ r && (o = o.filter(function(r) {
44
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
45
+ })), t.push.apply(t, o);
46
+ }
47
+ return t;
48
+ }
49
+ function _objectSpread2(e) {
50
+ for (var r = 1; r < arguments.length; r++) {
51
+ var t = null != arguments[r] ? arguments[r] : {};
52
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
53
+ _defineProperty(e, r, t[r]);
54
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
55
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
56
+ });
57
+ }
58
+ return e;
59
+ }
60
+ function _objectWithoutProperties(e, t) {
61
+ if (null == e) return {};
62
+ var o, r, i = _objectWithoutPropertiesLoose(e, t);
63
+ if (Object.getOwnPropertySymbols) {
64
+ var n = Object.getOwnPropertySymbols(e);
65
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
66
+ }
67
+ return i;
68
+ }
69
+ function _objectWithoutPropertiesLoose(r, e) {
70
+ if (null == r) return {};
7
71
  var t = {};
8
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
9
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
10
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
72
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
73
+ if (-1 !== e.indexOf(n)) continue;
74
+ t[n] = r[n];
11
75
  }
12
76
  return t;
13
77
  }
14
- typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
15
- var e = new Error(message);
16
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
78
+ function _toPrimitive(t, r) {
79
+ if ("object" != typeof t || !t) return t;
80
+ var e = t[Symbol.toPrimitive];
81
+ if (void 0 !== e) {
82
+ var i = e.call(t, r || "default");
83
+ if ("object" != typeof i) return i;
84
+ throw new TypeError("@@toPrimitive must return a primitive value.");
85
+ }
86
+ return ("string" === r ? String : Number)(t);
87
+ }
88
+ function _toPropertyKey(t) {
89
+ var i = _toPrimitive(t, "string");
90
+ return "symbol" == typeof i ? i : i + "";
91
+ }
92
+ function _wrapAsyncGenerator(e) {
93
+ return function() {
94
+ return new AsyncGenerator(e.apply(this, arguments));
95
+ };
96
+ }
97
+ function AsyncGenerator(e) {
98
+ var t, n;
99
+ function resume(t, n) {
100
+ try {
101
+ var r = e[t](n), o = r.value, u = o instanceof _OverloadYield;
102
+ Promise.resolve(u ? o.v : o).then(function(n) {
103
+ if (u) {
104
+ var i = "return" === t && o.k ? t : "next";
105
+ if (!o.k || n.done) return resume(i, n);
106
+ n = e[i](n).value;
107
+ }
108
+ settle(!!r.done, n);
109
+ }, function(e) {
110
+ resume("throw", e);
111
+ });
112
+ } catch (e) {
113
+ settle(2, e);
114
+ }
115
+ }
116
+ function settle(e, r) {
117
+ 2 === e ? t.reject(r) : t.resolve({
118
+ value: r,
119
+ done: e
120
+ }), (t = t.next) ? resume(t.key, t.arg) : n = null;
121
+ }
122
+ this._invoke = function(e, r) {
123
+ return new Promise(function(o, u) {
124
+ var i = {
125
+ key: e,
126
+ arg: r,
127
+ resolve: o,
128
+ reject: u,
129
+ next: null
130
+ };
131
+ n ? n = n.next = i : (t = n = i, resume(e, r));
132
+ });
133
+ }, "function" != typeof e.return && (this.return = void 0);
134
+ }
135
+ AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function() {
136
+ return this;
137
+ }, AsyncGenerator.prototype.next = function(e) {
138
+ return this._invoke("next", e);
139
+ }, AsyncGenerator.prototype.throw = function(e) {
140
+ return this._invoke("throw", e);
141
+ }, AsyncGenerator.prototype.return = function(e) {
142
+ return this._invoke("return", e);
17
143
  };
18
- var version = "2.18.0";
144
+ var version = "2.18.1";
19
145
  const DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS = 60;
20
146
  const DEFAULT_POPUP_CONFIG_OPTIONS = {
21
147
  timeoutInSeconds: DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS
@@ -128,6 +254,7 @@
128
254
  let exclude = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
129
255
  return value && !exclude.includes(value) ? value : "";
130
256
  }
257
+ const _excluded$5 = [ "clientId" ];
131
258
  const parseAuthenticationResult = queryString => {
132
259
  if (queryString.indexOf("#") > -1) {
133
260
  queryString = queryString.substring(0, queryString.indexOf("#"));
@@ -183,7 +310,7 @@
183
310
  const top = window.screenY + (window.innerHeight - height) / 2;
184
311
  return window.open(url, "auth0:authorize:popup", "left=".concat(left, ",top=").concat(top, ",width=").concat(width, ",height=").concat(height, ",resizable,scrollbars=yes,status=1"));
185
312
  };
186
- const runPopup = config => new Promise((resolve, reject) => {
313
+ const runPopup = (config, eventOrigin) => new Promise((resolve, reject) => {
187
314
  let _popupEventListener;
188
315
  const popupTimer = setInterval(() => {
189
316
  if (config.popup && config.popup.closed) {
@@ -199,6 +326,7 @@
199
326
  window.removeEventListener("message", _popupEventListener, false);
200
327
  }, (config.timeoutInSeconds || DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS) * 1e3);
201
328
  _popupEventListener = function popupEventListener(e) {
329
+ if (e.origin !== eventOrigin) return;
202
330
  if (!e.data || e.data.type !== "authorization_response") {
203
331
  return;
204
332
  }
@@ -231,7 +359,7 @@
231
359
  return random;
232
360
  };
233
361
  const encode$2 = value => btoa(value);
234
- const stripUndefined = params => Object.keys(params).filter(k => typeof params[k] !== "undefined").reduce((acc, key) => Object.assign(Object.assign({}, acc), {
362
+ const stripUndefined = params => Object.keys(params).filter(k => typeof params[k] !== "undefined").reduce((acc, key) => _objectSpread2(_objectSpread2({}, acc), {}, {
235
363
  [key]: params[key]
236
364
  }), {});
237
365
  const ALLOWED_AUTH0CLIENT_PROPERTIES = [ {
@@ -257,9 +385,9 @@
257
385
  return acc;
258
386
  }, {});
259
387
  };
260
- const createQueryParams = _a => {
261
- var {clientId: client_id} = _a, params = __rest(_a, [ "clientId" ]);
262
- return new URLSearchParams(stripUndefined(Object.assign({
388
+ const createQueryParams = _ref => {
389
+ let {clientId: client_id} = _ref, params = _objectWithoutProperties(_ref, _excluded$5);
390
+ return new URLSearchParams(stripUndefined(_objectSpread2({
263
391
  client_id: client_id
264
392
  }, params))).toString();
265
393
  };
@@ -309,8 +437,8 @@
309
437
  }
310
438
  return parseInt(value, 10) || undefined;
311
439
  };
312
- const fromEntries = iterable => [ ...iterable ].reduce((obj, _ref) => {
313
- let [key, val] = _ref;
440
+ const fromEntries = iterable => [ ...iterable ].reduce((obj, _ref2) => {
441
+ let [key, val] = _ref2;
314
442
  obj[key] = val;
315
443
  return obj;
316
444
  }, {});
@@ -850,7 +978,9 @@
850
978
  }
851
979
  class LegacyLockManager {
852
980
  constructor() {
853
- this.activeLocks = new Set;
981
+ _defineProperty(this, "lock", void 0);
982
+ _defineProperty(this, "activeLocks", new Set);
983
+ _defineProperty(this, "pagehideHandler", void 0);
854
984
  this.lock = new _default;
855
985
  this.pagehideHandler = () => {
856
986
  this.activeLocks.forEach(key => this.lock.releaseLock(key));
@@ -882,8 +1012,8 @@
882
1012
  }
883
1013
  }
884
1014
  function isWebLocksSupported() {
885
- var _a;
886
- return typeof navigator !== "undefined" && typeof ((_a = navigator.locks) === null || _a === void 0 ? void 0 : _a.request) === "function";
1015
+ var _navigator$locks;
1016
+ return typeof navigator !== "undefined" && typeof ((_navigator$locks = navigator.locks) === null || _navigator$locks === void 0 ? void 0 : _navigator$locks.request) === "function";
887
1017
  }
888
1018
  function createLockManager() {
889
1019
  return isWebLocksSupported() ? new WebLocksApiManager : new LegacyLockManager;
@@ -1217,6 +1347,7 @@
1217
1347
  };
1218
1348
  to.postMessage(message, [ messageChannel.port2 ]);
1219
1349
  });
1350
+ const _excluded$4 = [ "error", "error_description" ];
1220
1351
  const createAbortController = () => new AbortController;
1221
1352
  const dofetch = async (fetchUrl, fetchOptions) => {
1222
1353
  const response = await fetch(fetchUrl, fetchOptions);
@@ -1266,7 +1397,7 @@
1266
1397
  method: options.method || "GET",
1267
1398
  nonce: await dpop.getNonce()
1268
1399
  });
1269
- options.headers = Object.assign(Object.assign({}, options.headers), {
1400
+ options.headers = _objectSpread2(_objectSpread2({}, options.headers), {}, {
1270
1401
  dpop: dpopProof
1271
1402
  });
1272
1403
  }
@@ -1284,7 +1415,7 @@
1284
1415
  if (fetchError) {
1285
1416
  throw fetchError;
1286
1417
  }
1287
- const _a = response.json, {error: error, error_description: error_description} = _a, data = __rest(_a, [ "error", "error_description" ]), {headers: headers, ok: ok} = response;
1418
+ const {json: {error: error, error_description: error_description}, headers: headers, ok: ok} = response, data = _objectWithoutProperties(response.json, _excluded$4);
1288
1419
  let newDpopNonce;
1289
1420
  if (dpop) {
1290
1421
  newDpopNonce = headers[DPOP_NONCE_HEADER];
@@ -1310,11 +1441,12 @@
1310
1441
  }
1311
1442
  return data;
1312
1443
  }
1313
- async function oauthToken(_a, worker) {
1314
- var {baseUrl: baseUrl, timeout: timeout, audience: audience, scope: scope, auth0Client: auth0Client, useFormData: useFormData, useMrrt: useMrrt, dpop: dpop} = _a, options = __rest(_a, [ "baseUrl", "timeout", "audience", "scope", "auth0Client", "useFormData", "useMrrt", "dpop" ]);
1444
+ const _excluded$3 = [ "baseUrl", "timeout", "audience", "scope", "auth0Client", "useFormData", "useMrrt", "dpop" ];
1445
+ async function oauthToken(_ref, worker) {
1446
+ let {baseUrl: baseUrl, timeout: timeout, audience: audience, scope: scope, auth0Client: auth0Client, useFormData: useFormData, useMrrt: useMrrt, dpop: dpop} = _ref, options = _objectWithoutProperties(_ref, _excluded$3);
1315
1447
  const isTokenExchange = options.grant_type === "urn:ietf:params:oauth:grant-type:token-exchange";
1316
1448
  const refreshWithMrrt = options.grant_type === "refresh_token" && useMrrt;
1317
- const allParams = Object.assign(Object.assign(Object.assign(Object.assign({}, options), isTokenExchange && audience && {
1449
+ const allParams = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, options), isTokenExchange && audience && {
1318
1450
  audience: audience
1319
1451
  }), isTokenExchange && scope && {
1320
1452
  scope: scope
@@ -1376,6 +1508,9 @@
1376
1508
  let suffix = arguments.length > 2 ? arguments[2] : undefined;
1377
1509
  this.prefix = prefix;
1378
1510
  this.suffix = suffix;
1511
+ _defineProperty(this, "clientId", void 0);
1512
+ _defineProperty(this, "scope", void 0);
1513
+ _defineProperty(this, "audience", void 0);
1379
1514
  this.clientId = data.clientId;
1380
1515
  this.scope = data.scope;
1381
1516
  this.audience = data.audience;
@@ -1423,7 +1558,7 @@
1423
1558
  }
1424
1559
  class InMemoryCache {
1425
1560
  constructor() {
1426
- this.enclosedCache = function() {
1561
+ _defineProperty(this, "enclosedCache", function() {
1427
1562
  let cache = {};
1428
1563
  return {
1429
1564
  set(key, entry) {
@@ -1443,7 +1578,7 @@
1443
1578
  return Object.keys(cache);
1444
1579
  }
1445
1580
  };
1446
- }();
1581
+ }());
1447
1582
  }
1448
1583
  }
1449
1584
  const DEFAULT_EXPIRY_ADJUSTMENT_SECONDS = 0;
@@ -1451,16 +1586,17 @@
1451
1586
  constructor(cache, keyManifest, nowProvider) {
1452
1587
  this.cache = cache;
1453
1588
  this.keyManifest = keyManifest;
1589
+ _defineProperty(this, "nowProvider", void 0);
1454
1590
  this.nowProvider = nowProvider || DEFAULT_NOW_PROVIDER;
1455
1591
  }
1456
1592
  async setIdToken(clientId, idToken, decodedToken) {
1457
- var _a;
1593
+ var _this$keyManifest;
1458
1594
  const cacheKey = this.getIdTokenCacheKey(clientId);
1459
1595
  await this.cache.set(cacheKey, {
1460
1596
  id_token: idToken,
1461
1597
  decodedToken: decodedToken
1462
1598
  });
1463
- await ((_a = this.keyManifest) === null || _a === void 0 ? void 0 : _a.add(cacheKey));
1599
+ await ((_this$keyManifest = this.keyManifest) === null || _this$keyManifest === void 0 ? void 0 : _this$keyManifest.add(cacheKey));
1464
1600
  }
1465
1601
  async getIdToken(cacheKey) {
1466
1602
  const entry = await this.cache.get(this.getIdTokenCacheKey(cacheKey.clientId));
@@ -1489,7 +1625,6 @@
1489
1625
  let expiryAdjustmentSeconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_EXPIRY_ADJUSTMENT_SECONDS;
1490
1626
  let useMrrt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1491
1627
  let cacheMode = arguments.length > 3 ? arguments[3] : undefined;
1492
- var _a;
1493
1628
  let wrappedEntry = await this.cache.get(cacheKey.toKey());
1494
1629
  if (!wrappedEntry) {
1495
1630
  const keys = await this.getCacheKeys();
@@ -1508,11 +1643,12 @@
1508
1643
  const now = await this.nowProvider();
1509
1644
  const nowSeconds = Math.floor(now / 1e3);
1510
1645
  if (wrappedEntry.expiresAt - expiryAdjustmentSeconds < nowSeconds) {
1646
+ var _this$keyManifest2;
1511
1647
  if (wrappedEntry.body.refresh_token) {
1512
1648
  return this.modifiedCachedEntry(wrappedEntry, cacheKey);
1513
1649
  }
1514
1650
  await this.cache.remove(cacheKey.toKey());
1515
- await ((_a = this.keyManifest) === null || _a === void 0 ? void 0 : _a.remove(cacheKey.toKey()));
1651
+ await ((_this$keyManifest2 = this.keyManifest) === null || _this$keyManifest2 === void 0 ? void 0 : _this$keyManifest2.remove(cacheKey.toKey()));
1516
1652
  return;
1517
1653
  }
1518
1654
  return wrappedEntry.body;
@@ -1531,7 +1667,7 @@
1531
1667
  };
1532
1668
  }
1533
1669
  async set(entry) {
1534
- var _a;
1670
+ var _this$keyManifest3;
1535
1671
  const cacheKey = new CacheKey({
1536
1672
  clientId: entry.client_id,
1537
1673
  scope: entry.scope,
@@ -1539,7 +1675,7 @@
1539
1675
  });
1540
1676
  const wrappedEntry = await this.wrapCacheEntry(entry);
1541
1677
  await this.cache.set(cacheKey.toKey(), wrappedEntry);
1542
- await ((_a = this.keyManifest) === null || _a === void 0 ? void 0 : _a.add(cacheKey.toKey()));
1678
+ await ((_this$keyManifest3 = this.keyManifest) === null || _this$keyManifest3 === void 0 ? void 0 : _this$keyManifest3.add(cacheKey.toKey()));
1543
1679
  }
1544
1680
  async remove(client_id, audience, scope) {
1545
1681
  const cacheKey = new CacheKey({
@@ -1550,14 +1686,14 @@
1550
1686
  await this.cache.remove(cacheKey.toKey());
1551
1687
  }
1552
1688
  async clear(clientId) {
1553
- var _a;
1689
+ var _this$keyManifest4;
1554
1690
  const keys = await this.getCacheKeys();
1555
1691
  if (!keys) return;
1556
1692
  await keys.filter(key => clientId ? key.includes(clientId) : true).reduce(async (memo, key) => {
1557
1693
  await memo;
1558
1694
  await this.cache.remove(key);
1559
1695
  }, Promise.resolve());
1560
- await ((_a = this.keyManifest) === null || _a === void 0 ? void 0 : _a.clear());
1696
+ await ((_this$keyManifest4 = this.keyManifest) === null || _this$keyManifest4 === void 0 ? void 0 : _this$keyManifest4.clear());
1561
1697
  }
1562
1698
  async wrapCacheEntry(entry) {
1563
1699
  const now = await this.nowProvider();
@@ -1568,9 +1704,9 @@
1568
1704
  };
1569
1705
  }
1570
1706
  async getCacheKeys() {
1571
- var _a;
1572
1707
  if (this.keyManifest) {
1573
- return (_a = await this.keyManifest.get()) === null || _a === void 0 ? void 0 : _a.keys;
1708
+ var _await$this$keyManife;
1709
+ return (_await$this$keyManife = await this.keyManifest.get()) === null || _await$this$keyManife === void 0 ? void 0 : _await$this$keyManife.keys;
1574
1710
  } else if (this.cache.allKeys) {
1575
1711
  return this.cache.allKeys();
1576
1712
  }
@@ -1582,21 +1718,21 @@
1582
1718
  }
1583
1719
  matchExistingCacheKey(keyToMatch, allKeys) {
1584
1720
  return allKeys.filter(key => {
1585
- var _a;
1721
+ var _keyToMatch$scope;
1586
1722
  const cacheKey = CacheKey.fromKey(key);
1587
1723
  const scopeSet = new Set(cacheKey.scope && cacheKey.scope.split(" "));
1588
- const scopesToMatch = ((_a = keyToMatch.scope) === null || _a === void 0 ? void 0 : _a.split(" ")) || [];
1724
+ const scopesToMatch = ((_keyToMatch$scope = keyToMatch.scope) === null || _keyToMatch$scope === void 0 ? void 0 : _keyToMatch$scope.split(" ")) || [];
1589
1725
  const hasAllScopes = cacheKey.scope && scopesToMatch.reduce((acc, current) => acc && scopeSet.has(current), true);
1590
1726
  return cacheKey.prefix === CACHE_KEY_PREFIX && cacheKey.clientId === keyToMatch.clientId && cacheKey.audience === keyToMatch.audience && hasAllScopes;
1591
1727
  })[0];
1592
1728
  }
1593
1729
  async getEntryWithRefreshToken(keyToMatch, allKeys) {
1594
- var _a;
1595
1730
  for (const key of allKeys) {
1596
1731
  const cacheKey = CacheKey.fromKey(key);
1597
1732
  if (cacheKey.prefix === CACHE_KEY_PREFIX && cacheKey.clientId === keyToMatch.clientId) {
1733
+ var _cachedEntry$body;
1598
1734
  const cachedEntry = await this.cache.get(key);
1599
- if ((_a = cachedEntry === null || cachedEntry === void 0 ? void 0 : cachedEntry.body) === null || _a === void 0 ? void 0 : _a.refresh_token) {
1735
+ if (cachedEntry !== null && cachedEntry !== void 0 && (_cachedEntry$body = cachedEntry.body) !== null && _cachedEntry$body !== void 0 && _cachedEntry$body.refresh_token) {
1600
1736
  return this.modifiedCachedEntry(cachedEntry, keyToMatch);
1601
1737
  }
1602
1738
  }
@@ -1604,12 +1740,12 @@
1604
1740
  return undefined;
1605
1741
  }
1606
1742
  async updateEntry(oldRefreshToken, newRefreshToken) {
1607
- var _a;
1608
1743
  const allKeys = await this.getCacheKeys();
1609
1744
  if (!allKeys) return;
1610
1745
  for (const key of allKeys) {
1746
+ var _entry$body;
1611
1747
  const entry = await this.cache.get(key);
1612
- if (((_a = entry === null || entry === void 0 ? void 0 : entry.body) === null || _a === void 0 ? void 0 : _a.refresh_token) === oldRefreshToken) {
1748
+ if ((entry === null || entry === void 0 || (_entry$body = entry.body) === null || _entry$body === void 0 ? void 0 : _entry$body.refresh_token) === oldRefreshToken) {
1613
1749
  entry.body.refresh_token = newRefreshToken;
1614
1750
  await this.cache.set(key, entry);
1615
1751
  }
@@ -1622,6 +1758,7 @@
1622
1758
  this.storage = storage;
1623
1759
  this.clientId = clientId;
1624
1760
  this.cookieDomain = cookieDomain;
1761
+ _defineProperty(this, "storageKey", void 0);
1625
1762
  this.storageKey = "".concat(TRANSACTION_STORAGE_KEY_PREFIX, ".").concat(this.clientId);
1626
1763
  }
1627
1764
  create(transaction) {
@@ -1845,17 +1982,17 @@
1845
1982
  sameSite: "none"
1846
1983
  };
1847
1984
  }
1848
- if (options === null || options === void 0 ? void 0 : options.daysUntilExpire) {
1985
+ if (options !== null && options !== void 0 && options.daysUntilExpire) {
1849
1986
  cookieAttributes.expires = options.daysUntilExpire;
1850
1987
  }
1851
- if (options === null || options === void 0 ? void 0 : options.cookieDomain) {
1988
+ if (options !== null && options !== void 0 && options.cookieDomain) {
1852
1989
  cookieAttributes.domain = options.cookieDomain;
1853
1990
  }
1854
1991
  set_1(key, JSON.stringify(value), cookieAttributes);
1855
1992
  },
1856
1993
  remove(key, options) {
1857
1994
  let cookieAttributes = {};
1858
- if (options === null || options === void 0 ? void 0 : options.cookieDomain) {
1995
+ if (options !== null && options !== void 0 && options.cookieDomain) {
1859
1996
  cookieAttributes.domain = options.cookieDomain;
1860
1997
  }
1861
1998
  remove_1(key, cookieAttributes);
@@ -1877,10 +2014,10 @@
1877
2014
  secure: true
1878
2015
  };
1879
2016
  }
1880
- if (options === null || options === void 0 ? void 0 : options.daysUntilExpire) {
2017
+ if (options !== null && options !== void 0 && options.daysUntilExpire) {
1881
2018
  cookieAttributes.expires = options.daysUntilExpire;
1882
2019
  }
1883
- if (options === null || options === void 0 ? void 0 : options.cookieDomain) {
2020
+ if (options !== null && options !== void 0 && options.cookieDomain) {
1884
2021
  cookieAttributes.domain = options.cookieDomain;
1885
2022
  }
1886
2023
  set_1("".concat(LEGACY_PREFIX).concat(key), JSON.stringify(value), cookieAttributes);
@@ -1888,7 +2025,7 @@
1888
2025
  },
1889
2026
  remove(key, options) {
1890
2027
  let cookieAttributes = {};
1891
- if (options === null || options === void 0 ? void 0 : options.cookieDomain) {
2028
+ if (options !== null && options !== void 0 && options.cookieDomain) {
1892
2029
  cookieAttributes.domain = options.cookieDomain;
1893
2030
  }
1894
2031
  remove_1(key, cookieAttributes);
@@ -1914,12 +2051,35 @@
1914
2051
  sessionStorage.removeItem(key);
1915
2052
  }
1916
2053
  };
1917
- exports.ResponseType = void 0;
1918
- (function(ResponseType) {
2054
+ let ResponseType = function(ResponseType) {
1919
2055
  ResponseType["Code"] = "code";
1920
2056
  ResponseType["ConnectCode"] = "connect_code";
1921
- })(exports.ResponseType || (exports.ResponseType = {}));
1922
- class User {}
2057
+ return ResponseType;
2058
+ }({});
2059
+ class User {
2060
+ constructor() {
2061
+ _defineProperty(this, "name", void 0);
2062
+ _defineProperty(this, "given_name", void 0);
2063
+ _defineProperty(this, "family_name", void 0);
2064
+ _defineProperty(this, "middle_name", void 0);
2065
+ _defineProperty(this, "nickname", void 0);
2066
+ _defineProperty(this, "preferred_username", void 0);
2067
+ _defineProperty(this, "profile", void 0);
2068
+ _defineProperty(this, "picture", void 0);
2069
+ _defineProperty(this, "website", void 0);
2070
+ _defineProperty(this, "email", void 0);
2071
+ _defineProperty(this, "email_verified", void 0);
2072
+ _defineProperty(this, "gender", void 0);
2073
+ _defineProperty(this, "birthdate", void 0);
2074
+ _defineProperty(this, "zoneinfo", void 0);
2075
+ _defineProperty(this, "locale", void 0);
2076
+ _defineProperty(this, "phone_number", void 0);
2077
+ _defineProperty(this, "phone_number_verified", void 0);
2078
+ _defineProperty(this, "address", void 0);
2079
+ _defineProperty(this, "updated_at", void 0);
2080
+ _defineProperty(this, "sub", void 0);
2081
+ }
2082
+ }
1923
2083
  function decodeBase64$1(base64, enableUnicode) {
1924
2084
  var binaryString = atob(base64);
1925
2085
  if (enableUnicode) {
@@ -1949,7 +2109,7 @@
1949
2109
  return new Worker(url, options);
1950
2110
  };
1951
2111
  }
1952
- var WorkerFactory = createBase64WorkerFactory("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24oKSB7CiAgICAidXNlIHN0cmljdCI7CiAgICBjbGFzcyBHZW5lcmljRXJyb3IgZXh0ZW5kcyBFcnJvciB7CiAgICAgICAgY29uc3RydWN0b3IoZXJyb3IsIGVycm9yX2Rlc2NyaXB0aW9uKSB7CiAgICAgICAgICAgIHN1cGVyKGVycm9yX2Rlc2NyaXB0aW9uKTsKICAgICAgICAgICAgdGhpcy5lcnJvciA9IGVycm9yOwogICAgICAgICAgICB0aGlzLmVycm9yX2Rlc2NyaXB0aW9uID0gZXJyb3JfZGVzY3JpcHRpb247CiAgICAgICAgICAgIE9iamVjdC5zZXRQcm90b3R5cGVPZih0aGlzLCBHZW5lcmljRXJyb3IucHJvdG90eXBlKTsKICAgICAgICB9CiAgICAgICAgc3RhdGljIGZyb21QYXlsb2FkKF9yZWYpIHsKICAgICAgICAgICAgbGV0IHtlcnJvcjogZXJyb3IsIGVycm9yX2Rlc2NyaXB0aW9uOiBlcnJvcl9kZXNjcmlwdGlvbn0gPSBfcmVmOwogICAgICAgICAgICByZXR1cm4gbmV3IEdlbmVyaWNFcnJvcihlcnJvciwgZXJyb3JfZGVzY3JpcHRpb24pOwogICAgICAgIH0KICAgI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lKV07CiAgICBjb25zdCB3YWl0ID0gdGltZSA9PiBuZXcgUHJvbWlzZShyZXNvbHZlID0+IHNldFRpbWVvdXQocmVzb2x2ZSwgdGltZSkpOwogICAgY29uc3QgZm9ybURhdGFUb09iamVjdCA9IGZvcm1EYXRhID0+IHsKICAgICAgICBjb25zdCBxdWVyeVBhcmFtcyA9IG5ldyBVUkxTZWFyY2hQYXJhbXMoZm9ybURhdGEpOwogICAgICAgIGNvbnN0IHBhcnNlZFF1ZXJ5ID0ge307CiAgICAgICAgcXVlcnlQYXJhbXMuZm9yRWFjaCgodmFsLCBrZXkpID0+IHsKICAgICAgICAgICAgcGFyc2VkUXVlcnlba2V5XSA9IHZhbDsKICAgICAgICB9KTsKICAgICAgICByZXR1cm4gcGFyc2VkUXVlcnk7CiAgICB9OwogICAgY29uc3QgdXBkYXRlUmVmcmVzaFRva2VucyA9IChvbGRSZWZyZXNoVG9rZW4sIG5ld1JlZnJlc2hUb2tlbikgPT4gewogICAgICAgIE9iamVjdC5lbnRyaWVzKHJlZnJlc2hUb2tlbnMpLmZvckVhY2goX3JlZiA9PiB7CiAgICAgICAgICAgIGxldCBba2V5LCB0b2tlbl0gPSBfcmVmOwogICAgICAgICAgICBpZiAodG9rZW4gPT09IG9sZFJlZnJlc2hUb2tlbikgewogICAgICAgICAgICAgICAgcmVmcmVzaFRva2Vuc1trZXldID0gbmV3UmVmcmVzaFRva2VuOwogICAgICAgICAgICB9CiAgICAgICAgfSk7CiAgICB9OwogICAgY29uc3QgY2hlY2tEb3duc2NvcGluZyA9IChzY29wZSwgYXVkaWVuY2UpID0+IHsKICAgICAgICBjb25zdCBmaW5kQ29pbmNpZGVuY2UgPSBPYmplY3Qua2V5cyhyZWZyZXNoVG9rZW5zKS5maW5kKGtleSA9PiB7CiAgICAgICAgICAgIGlmIChrZXkgIT09ICJsYXRlc3RfcmVmcmVzaF90b2tlbiIpIHsKICAgICAgICAgICAgICAgIGNvbnN0IGlzU2FtZUF1ZGllbmNlID0g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TT04ucGFyc2UoZmV0Y2hPcHRpb25zLmJvZHkpOwogICAgICAgICAgICBpZiAoIWJvZHkucmVmcmVzaF90b2tlbiAmJiBib2R5LmdyYW50X3R5cGUgPT09ICJyZWZyZXNoX3Rva2VuIikgewogICAgICAgICAgICAgICAgcmVmcmVzaFRva2VuID0gZ2V0UmVmcmVzaFRva2VuKGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgICAgICBpZiAoIXJlZnJlc2hUb2tlbiAmJiB1c2VNcnJ0KSB7CiAgICAgICAgICAgICAgICAgICAgY29uc3QgbGF0ZXN0UmVmcmVzaFRva2VuID0gcmVmcmVzaFRva2Vuc1sibGF0ZXN0X3JlZnJlc2hfdG9rZW4iXTsKICAgICAgICAgICAgICAgICAgICBjb25zdCBpc0Rvd25zY29waW5nID0gY2hlY2tEb3duc2NvcGluZyhzY29wZSwgYXVkaWVuY2UpOwogICAgICAgICAgICAgICAgICAgIGlmIChsYXRlc3RSZWZyZXNoVG9rZW4gJiYgIWlzRG93bnNjb3BpbmcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFRva2VuID0gbGF0ZXN0UmVmcmVzaFRva2VuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICghcmVmcmVzaFRva2VuKSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IE1pc3NpbmdSZWZyZXNoVG9rZW5FcnJvcihhdWRpZW5jZSwgc2NvcGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZmV0Y2hPcHRpb25zLmJvZHkgPSB1c2VGb3JtRGF0YSA/IGNyZWF0ZVF1ZXJ5UGFyYW1zKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSwgYm9keSksIHsKICAgICAgICAgICAgICAgICAgICByZWZyZXNoX3Rva2VuOiByZWZyZXNoVG9rZW4KICAgICAgICAgICAgICAgIH0pKSA6IEpTT04uc3RyaW5naWZ5KE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSwgYm9keSksIHsKICAgICAgICAgICAgICAgICAgICByZWZyZXNoX3Rva2VuOiByZWZyZXNoVG9rZW4KICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBsZXQgYWJvcnRDb250cm9sbGVyOwogICAgICAgICAgICBpZiAodHlwZW9mIEFib3J0Q29udHJvbGxlciA9PT0gImZ1bmN0aW9uIikgewogICAgICAgICAgICAgICAgYWJvcnRDb250cm9sbGVyID0gbmV3IEFib3J0Q29udHJvbGxlcjsKICAgICAgICAgICAgICAgIGZldGNoT3B0aW9ucy5zaWduYWwgPSBhYm9ydENvbnRyb2xsZXIuc2lnbmFsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGxldCByZXNwb25zZTsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIHJlc3BvbnNlID0gYXdhaXQgUHJvbWlzZS5yYWNlKFsgd2FpdCh0aW1lb3V0KSwgZmV0Y2goZmV0Y2hVcmwsIE9iamVjdC5hc3NpZ24oe30sIGZldGNoT3B0aW9ucykpIF0pOwogICAgICAgICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGVycm9yLm1lc3NhZ2UKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICghcmVzcG9uc2UpIHsKICAgICAgICAgICAgICAgIGlmIChhYm9ydENvbnRyb2xsZXIpIGFib3J0Q29udHJvbGxlci5hYm9ydCgpOwogICAgICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICAgICAgZXJyb3I6ICJUaW1lb3V0IHdoZW4gZXhlY3V0aW5nICdmZXRjaCciCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgfQogICAgICAgICAgICBoZWFkZXJzID0gZnJvbUVudHJpZXMocmVzcG9uc2UuaGVhZGVycyk7CiAgICAgICAgICAgIGpzb24gPSBhd2FpdCByZXNwb25zZS5qc29uKCk7CiAgICAgICAgICAgIGlmIChqc29uLnJlZnJlc2hfdG9rZW4pIHsKICAgICAgICAgICAgICAgIGlmICh1c2VNcnJ0KSB7CiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFRva2Vuc1sibGF0ZXN0X3JlZnJlc2hfdG9rZW4iXSA9IGpzb24ucmVmcmVzaF90b2tlbjsKICAgICAgICAgICAgICAgICAgICB1cGRhdGVSZWZyZXNoVG9rZW5zKHJlZnJlc2hUb2tlbiwganNvbi5yZWZyZXNoX3Rva2VuKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHNldFJlZnJlc2hUb2tlbihqc29uLnJlZnJlc2hfdG9rZW4sIGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgICAgICBkZWxldGUganNvbi5yZWZyZXNoX3Rva2VuOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgZGVsZXRlUmVmcmVzaFRva2VuKGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICBvazogcmVzcG9uc2Uub2ssCiAgICAgICAgICAgICAgICBqc29uOiBqc29uLAogICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycwogICAgICAgICAgICB9KTsKICAgICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgICAgICBwb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgIG9rOiBmYWxzZSwKICAgICAgICAgICAgICAgIGpzb246IHsKICAgICAgICAgICAgICAgICAgICBlcnJvcjogZXJyb3IuZXJyb3IsCiAgICAgICAgICAgICAgICAgICAgZXJyb3JfZGVzY3JpcHRpb246IGVycm9yLm1lc3NhZ2UKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBoZWFkZXJzOiBoZWFkZXJzCiAgICAgICAgICAgIH0pOwogICAgICAgIH0KICAgIH07CiAgICB7CiAgICAgICAgYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsIG1lc3NhZ2VIYW5kbGVyKTsKICAgIH0KfSkoKTsKCg==", null, false);
2112
+ var WorkerFactory = createBase64WorkerFactory("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24oKSB7CiAgICAidXNlIHN0cmljdCI7CiAgICBmdW5jdGlvbiBfZGVmaW5lUHJvcGVydHkoZSwgciwgdCkgewogICAgICAgIHJldHVybiAociA9IF90b1Byb3BlcnR5S2V5KHIpKSBpbiBlID8gT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIHIsIHsKICAgICAgICAgICAgdmFsdWU6IHQsCiAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICB3cml0YWJsZTogITAKICAgICAgICB9KSA6IGVbcl0gPSB0LCBlOwogICAgfQogICAgZnVuY3Rpb24gb3duS2V5cyhlLCByKSB7CiAgICAgICAgdmFyIHQgPSBPYmplY3Qua2V5cyhlKTsKICAgICAgICBpZiAoT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scykgewogICAgICAgICAgICB2YXIgbyA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7CiAgICAgICAgICAgIHIgJiYgKG8gPSBvLmZpbHRlcihmdW5jdGlvbihyKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihlLCByKS5lbnVtZXJhYmxlOwogICAgICAgICAgICB9KSksIHQucHVzaC5hcHBseSh0LCBvKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHQ7CiAgICB9CiAgICBmdW5jdGlvbiBfb2JqZWN0U3ByZWFkMihlKSB7CiAgICAgICAgZm9yICh2YXIgciA9IDE7IHIgPCBhcmd1bWVudHMubGVuZ3RoOyByKyspIHsKICAgICAgICAgICAgdmFyIHQgPSBudWxsICE9IGFyZ3VtZW50c1tyXSA/IGFyZ3VtZW50c1tyXSA6IHt9OwogICAgICAgICAgICByICUgMiA/IG93bktleXMoT2JqZWN0KHQpLCAhMCkuZm9yRWFjaChmdW5jdGlvbihyKSB7CiAgICAgICAgICAgICAgICBfZGVmaW5lUHJvcGVydHkoZSwgciwgdFtyXSk7CiAgICAgICAgICAgIH0pIDogT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcnMgPyBPYmplY3QuZGVmaW5lUHJvcGVydGllcyhlLCBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycyh0KSkgOiBvd25LZXlzKE9iamVjdCh0KSkuZm9yRWFjaChmdW5jdGlvbihyKSB7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgciwgT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcih0LCByKSk7CiAgICAgICAgICAgIH0pOwogICAgICAgIH0KICAgICAgICByZXR1cm4gZTsKICAgIH0KICAgIGZ1bmN0aW9uIF9vYmplY3RXaXRob3V0UHJvcGVydGllcyhlLCB0KSB7CiAgICAgICAgaWYgKG51bGwgPT0gZSkgcmV0dXJuIHt9OwogICAgICAgIHZhciBvLCByLCBpID0gX29iamVjdFdpdGhvdXRQcm9wZXJ0aWVzTG9vc2UoZSwgdCk7CiAgICAgICAgaWYgKE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMpIHsKICAgICAgICAgICAgdmFyIG4gPSBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKGUpOwogICAgICAgICAgICBmb3IgKHIgPSAwOyByIDwgbi5sZW5ndGg7IHIrKykgbyA9IG5bcl0sIC0xID09PSB0LmluZGV4T2YobykgJiYge30ucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLCBvKSAmJiAoaVtvXSA9IGVbb10pOwogICAgICAgIH0KICAgICAgICByZXR1cm4gaTsKICAgIH0KICAgIGZ1bmN0aW9uIF9vYmplY3RXaXRob3V0UHJvcGVydGllc0xvb3NlKHIsIGUpIHsKICAgICAgICBpZiAobnVsbCA9PSByKSByZXR1cm4ge307CiAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICBmb3IgKHZhciBuIGluIHIpIGlmICh7fS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHIsIG4pKSB7CiAgICAgICAgICAgIGlmICgtMSAhPT0gZS5pbmRleE9mKG4pKSBjb250aW51ZTsKICAgICAgICAgICAgdFtuXSA9IHJbbl07CiAgICAgICAgfQogICAgICAgIHJldHVybiB0OwogICAgfQogICAgZnVuY3Rpb24gX3RvUHJpbWl0aXZlKHQsIHIpIHsKICAgICAgICBpZiAoIm9iamVjdCIgIT0gdHlwZW9mIHQgfHwgIXQpIHJldHVybiB0OwogICAgICAgIHZhciBlID0gdFtTeW1ib2wudG9QcmltaXRpdmVdOwogICAgICAgIGlmICh2b2lkIDAgIT09IGUpIHsKICAgICAgICAgICAgdmFyIGkgPSBlLmNhbGwodCwgciB8fCAiZGVmYXVsdCIpOwogICAgICAgICAgICBpZiAoIm9iamVjdCIgIT0gdHlwZW9mIGkpIHJldHVybiBpOwogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJAQHRvUHJpbWl0aXZlIG11c3QgcmV0dXJuIGEgcHJpbWl0aXZlIHZhbHVlLiIpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gKCJzdHJpbmciID09PSByID8gU3RyaW5nIDogTnVtYmVyKSh0KTsKICAgIH0KICAgIGZ1bmN0aW9uIF90b1Byb3BlcnR5S2V5KHQpIHsKICAgICAgICB2YXIgaSA9IF90b1ByaW1pdGl2ZSh0LCAic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Sk7CiAgICBjb25zdCBmb3JtRGF0YVRvT2JqZWN0ID0gZm9ybURhdGEgPT4gewogICAgICAgIGNvbnN0IHF1ZXJ5UGFyYW1zID0gbmV3IFVSTFNlYXJjaFBhcmFtcyhmb3JtRGF0YSk7CiAgICAgICAgY29uc3QgcGFyc2VkUXVlcnkgPSB7fTsKICAgICAgICBxdWVyeVBhcmFtcy5mb3JFYWNoKCh2YWwsIGtleSkgPT4gewogICAgICAgICAgICBwYXJzZWRRdWVyeVtrZXldID0gdmFsOwogICAgICAgIH0pOwogICAgICAgIHJldHVybiBwYXJzZWRRdWVyeTsKICAgIH07CiAgICBjb25zdCB1cGRhdGVSZWZyZXNoVG9rZW5zID0gKG9sZFJlZnJlc2hUb2tlbiwgbmV3UmVmcmVzaFRva2VuKSA9PiB7CiAgICAgICAgT2JqZWN0LmVudHJpZXMocmVmcmVzaFRva2VucykuZm9yRWFjaChfcmVmID0+IHsKICAgICAgICAgICAgbGV0IFtrZXksIHRva2VuXSA9IF9yZWY7CiAgICAgICAgICAgIGlmICh0b2tlbiA9PT0gb2xkUmVmcmVzaFRva2VuKSB7CiAgICAgICAgICAgICAgICByZWZyZXNoVG9rZW5zW2tleV0gPSBuZXdSZWZyZXNoVG9rZW47CiAgICAgICAgICAgIH0KICAgICAgICB9KTsKICAgIH07CiAgICBjb25zdCBjaGVja0Rvd25zY29waW5nID0gKHNjb3BlLCBhdWRpZW5jZSkgPT4gewogICAgICAgIGNvbnN0IGZpbmRDb2luY2lkZW5jZSA9IE9iamVjdC5rZXlzKHJlZnJlc2hUb2tlbnMpLmZpbmQoa2V5ID0+IHsKICAgICAgICAgICAgaWYgKGtleSAhPT0gImxhdGVzdF9yZWZyZXNoX3Rva2VuIikgewogICAgICAgICAgICAgICAgY29uc3QgaXNTYW1lQXVkaWVuY2UgPSBjYWNoZUtleUNvbnRhaW5zQXVkaWVuY2UoYXVkaWVuY2UsIGtleSk7CiAgICAgICAgICAgICAgICBjb25zdCBzY29wZXNLZXkg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uICYmIGJvZHkuZ3JhbnRfdHlwZSA9PT0gInJlZnJlc2hfdG9rZW4iKSB7CiAgICAgICAgICAgICAgICByZWZyZXNoVG9rZW4gPSBnZXRSZWZyZXNoVG9rZW4oYXVkaWVuY2UsIHNjb3BlKTsKICAgICAgICAgICAgICAgIGlmICghcmVmcmVzaFRva2VuICYmIHVzZU1ycnQpIHsKICAgICAgICAgICAgICAgICAgICBjb25zdCBsYXRlc3RSZWZyZXNoVG9rZW4gPSByZWZyZXNoVG9rZW5zWyJsYXRlc3RfcmVmcmVzaF90b2tlbiJdOwogICAgICAgICAgICAgICAgICAgIGNvbnN0IGlzRG93bnNjb3BpbmcgPSBjaGVja0Rvd25zY29waW5nKHNjb3BlLCBhdWRpZW5jZSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGxhdGVzdFJlZnJlc2hUb2tlbiAmJiAhaXNEb3duc2NvcGluZykgewogICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoVG9rZW4gPSBsYXRlc3RSZWZyZXNoVG9rZW47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKCFyZWZyZXNoVG9rZW4pIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTWlzc2luZ1JlZnJlc2hUb2tlbkVycm9yKGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmZXRjaE9wdGlvbnMuYm9keSA9IHVzZUZvcm1EYXRhID8gY3JlYXRlUXVlcnlQYXJhbXMoX29iamVjdFNwcmVhZDIoX29iamVjdFNwcmVhZDIoe30sIGJvZHkpLCB7fSwgewogICAgICAgICAgICAgICAgICAgIHJlZnJlc2hfdG9rZW46IHJlZnJlc2hUb2tlbgogICAgICAgICAgICAgICAgfSkpIDogSlNPTi5zdHJpbmdpZnkoX29iamVjdFNwcmVhZDIoX29iamVjdFNwcmVhZDIoe30sIGJvZHkpLCB7fSwgewogICAgICAgICAgICAgICAgICAgIHJlZnJlc2hfdG9rZW46IHJlZnJlc2hUb2tlbgogICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGxldCBhYm9ydENvbnRyb2xsZXI7CiAgICAgICAgICAgIGlmICh0eXBlb2YgQWJvcnRDb250cm9sbGVyID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgICAgICBhYm9ydENvbnRyb2xsZXIgPSBuZXcgQWJvcnRDb250cm9sbGVyOwogICAgICAgICAgICAgICAgZmV0Y2hPcHRpb25zLnNpZ25hbCA9IGFib3J0Q29udHJvbGxlci5zaWduYWw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbGV0IHJlc3BvbnNlOwogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgcmVzcG9uc2UgPSBhd2FpdCBQcm9taXNlLnJhY2UoWyB3YWl0KHRpbWVvdXQpLCBmZXRjaChmZXRjaFVybCwgX29iamVjdFNwcmVhZDIoe30sIGZldGNoT3B0aW9ucykpIF0pOwogICAgICAgICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGVycm9yLm1lc3NhZ2UKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICghcmVzcG9uc2UpIHsKICAgICAgICAgICAgICAgIGlmIChhYm9ydENvbnRyb2xsZXIpIGFib3J0Q29udHJvbGxlci5hYm9ydCgpOwogICAgICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICAgICAgZXJyb3I6ICJUaW1lb3V0IHdoZW4gZXhlY3V0aW5nICdmZXRjaCciCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgfQogICAgICAgICAgICBoZWFkZXJzID0gZnJvbUVudHJpZXMocmVzcG9uc2UuaGVhZGVycyk7CiAgICAgICAgICAgIGpzb24gPSBhd2FpdCByZXNwb25zZS5qc29uKCk7CiAgICAgICAgICAgIGlmIChqc29uLnJlZnJlc2hfdG9rZW4pIHsKICAgICAgICAgICAgICAgIGlmICh1c2VNcnJ0KSB7CiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFRva2Vuc1sibGF0ZXN0X3JlZnJlc2hfdG9rZW4iXSA9IGpzb24ucmVmcmVzaF90b2tlbjsKICAgICAgICAgICAgICAgICAgICB1cGRhdGVSZWZyZXNoVG9rZW5zKHJlZnJlc2hUb2tlbiwganNvbi5yZWZyZXNoX3Rva2VuKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHNldFJlZnJlc2hUb2tlbihqc29uLnJlZnJlc2hfdG9rZW4sIGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgICAgICBkZWxldGUganNvbi5yZWZyZXNoX3Rva2VuOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgZGVsZXRlUmVmcmVzaFRva2VuKGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICBvazogcmVzcG9uc2Uub2ssCiAgICAgICAgICAgICAgICBqc29uOiBqc29uLAogICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycwogICAgICAgICAgICB9KTsKICAgICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgICAgICBwb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgIG9rOiBmYWxzZSwKICAgICAgICAgICAgICAgIGpzb246IHsKICAgICAgICAgICAgICAgICAgICBlcnJvcjogZXJyb3IuZXJyb3IsCiAgICAgICAgICAgICAgICAgICAgZXJyb3JfZGVzY3JpcHRpb246IGVycm9yLm1lc3NhZ2UKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBoZWFkZXJzOiBoZWFkZXJzCiAgICAgICAgICAgIH0pOwogICAgICAgIH0KICAgIH07CiAgICB7CiAgICAgICAgYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsIG1lc3NhZ2VIYW5kbGVyKTsKICAgIH0KfSkoKTsKCg==", null, false);
1953
2113
  const singlePromiseMap = {};
1954
2114
  const singlePromise = (cb, key) => {
1955
2115
  let promise = singlePromiseMap[key];
@@ -1966,11 +2126,12 @@
1966
2126
  constructor(cache, clientId) {
1967
2127
  this.cache = cache;
1968
2128
  this.clientId = clientId;
2129
+ _defineProperty(this, "manifestKey", void 0);
1969
2130
  this.manifestKey = this.createManifestKeyFrom(this.clientId);
1970
2131
  }
1971
2132
  async add(key) {
1972
- var _a;
1973
- const keys = new Set(((_a = await this.cache.get(this.manifestKey)) === null || _a === void 0 ? void 0 : _a.keys) || []);
2133
+ var _await$this$cache$get;
2134
+ const keys = new Set(((_await$this$cache$get = await this.cache.get(this.manifestKey)) === null || _await$this$cache$get === void 0 ? void 0 : _await$this$cache$get.keys) || []);
1974
2135
  keys.add(key);
1975
2136
  await this.cache.set(this.manifestKey, {
1976
2137
  keys: [ ...keys ]
@@ -1999,6 +2160,7 @@
1999
2160
  return "".concat(CACHE_KEY_PREFIX, "::").concat(clientId);
2000
2161
  }
2001
2162
  }
2163
+ const _excluded$2 = [ "openUrl", "onRedirect" ];
2002
2164
  const GET_TOKEN_SILENTLY_LOCK_KEY = "auth0.lock.getTokenSilently";
2003
2165
  const GET_TOKEN_FROM_IFRAME_LOCK_KEY = "auth0.lock.getTokenFromIFrame";
2004
2166
  const buildGetTokenSilentlyLockKey = (clientId, audience) => "".concat(GET_TOKEN_SILENTLY_LOCK_KEY, ".").concat(clientId, ".").concat(audience);
@@ -2011,9 +2173,9 @@
2011
2173
  localstorage: () => new LocalStorageCache
2012
2174
  };
2013
2175
  const cacheFactory = location => cacheLocationBuilders[location];
2014
- const getAuthorizeParams = (clientOptions, scope, authorizationParams, state, nonce, code_challenge, redirect_uri, response_mode, thumbprint) => Object.assign(Object.assign(Object.assign({
2176
+ const getAuthorizeParams = (clientOptions, scope, authorizationParams, state, nonce, code_challenge, redirect_uri, response_mode, thumbprint) => _objectSpread2(_objectSpread2(_objectSpread2({
2015
2177
  client_id: clientOptions.clientId
2016
- }, clientOptions.authorizationParams), authorizationParams), {
2178
+ }, clientOptions.authorizationParams), authorizationParams), {}, {
2017
2179
  scope: scopesToRequest(scope, authorizationParams.scope, authorizationParams.audience),
2018
2180
  response_type: "code",
2019
2181
  response_mode: response_mode || "query",
@@ -2025,8 +2187,8 @@
2025
2187
  dpop_jkt: thumbprint
2026
2188
  });
2027
2189
  const patchOpenUrlWithOnRedirect = options => {
2028
- const {openUrl: openUrl, onRedirect: onRedirect} = options, originalOptions = __rest(options, [ "openUrl", "onRedirect" ]);
2029
- const result = Object.assign(Object.assign({}, originalOptions), {
2190
+ const {openUrl: openUrl, onRedirect: onRedirect} = options, originalOptions = _objectWithoutProperties(options, _excluded$2);
2191
+ const result = _objectSpread2(_objectSpread2({}, originalOptions), {}, {
2030
2192
  openUrl: openUrl === false || openUrl ? openUrl : onRedirect
2031
2193
  });
2032
2194
  return result;
@@ -2043,13 +2205,13 @@
2043
2205
  return missingScopes.join(",");
2044
2206
  };
2045
2207
  const getScopeToRequest = (useMrrt, authorizationParams, cachedAudience, cachedScope) => {
2046
- var _a;
2047
2208
  if (useMrrt && cachedAudience && cachedScope) {
2209
+ var _authorizationParams$;
2048
2210
  if (authorizationParams.audience !== cachedAudience) {
2049
2211
  return authorizationParams.scope;
2050
2212
  }
2051
2213
  const cachedScopes = cachedScope.split(" ");
2052
- const newScopes = ((_a = authorizationParams.scope) === null || _a === void 0 ? void 0 : _a.split(" ")) || [];
2214
+ const newScopes = ((_authorizationParams$ = authorizationParams.scope) === null || _authorizationParams$ === void 0 ? void 0 : _authorizationParams$.split(" ")) || [];
2053
2215
  const newScopesAreIncluded = newScopes.every(scope => cachedScopes.includes(scope));
2054
2216
  return cachedScopes.length >= newScopes.length && newScopesAreIncluded ? cachedScope : authorizationParams.scope;
2055
2217
  }
@@ -2070,6 +2232,8 @@
2070
2232
  const AUTH0_NONCE_ID = "auth0";
2071
2233
  class DpopStorage {
2072
2234
  constructor(clientId) {
2235
+ _defineProperty(this, "clientId", void 0);
2236
+ _defineProperty(this, "dbHandle", void 0);
2073
2237
  this.clientId = clientId;
2074
2238
  }
2075
2239
  getVersion() {
@@ -2123,7 +2287,7 @@
2123
2287
  }
2124
2288
  async deleteBy(table, predicate) {
2125
2289
  const allKeys = await this.executeDbRequest(table, "readonly", table => table.getAllKeys());
2126
- allKeys === null || allKeys === void 0 ? void 0 : allKeys.filter(predicate).map(k => this.executeDbRequest(table, "readwrite", table => table.delete(k)));
2290
+ allKeys === null || allKeys === void 0 || allKeys.filter(predicate).map(k => this.executeDbRequest(table, "readwrite", table => table.delete(k)));
2127
2291
  }
2128
2292
  deleteByClientId(table, clientId) {
2129
2293
  return this.deleteBy(table, k => typeof k === "string" && k.startsWith("".concat(clientId, "::")));
@@ -2137,6 +2301,7 @@
2137
2301
  }
2138
2302
  class Dpop {
2139
2303
  constructor(clientId) {
2304
+ _defineProperty(this, "storage", void 0);
2140
2305
  this.storage = new DpopStorage(clientId);
2141
2306
  }
2142
2307
  getNonce(id) {
@@ -2155,7 +2320,7 @@
2155
2320
  }
2156
2321
  async generateProof(params) {
2157
2322
  const keyPair = await this.getOrGenerateKeyPair();
2158
- return generateProof(Object.assign({
2323
+ return generateProof(_objectSpread2({
2159
2324
  keyPair: keyPair
2160
2325
  }, params));
2161
2326
  }
@@ -2167,15 +2332,17 @@
2167
2332
  await Promise.all([ this.storage.clearNonces(), this.storage.clearKeyPairs() ]);
2168
2333
  }
2169
2334
  }
2170
- var TokenType;
2171
- (function(TokenType) {
2335
+ var TokenType = function(TokenType) {
2172
2336
  TokenType["Bearer"] = "Bearer";
2173
2337
  TokenType["DPoP"] = "DPoP";
2174
- })(TokenType || (TokenType = {}));
2338
+ return TokenType;
2339
+ }(TokenType || {});
2175
2340
  class Fetcher {
2176
2341
  constructor(config, hooks) {
2342
+ _defineProperty(this, "config", void 0);
2343
+ _defineProperty(this, "hooks", void 0);
2177
2344
  this.hooks = hooks;
2178
- this.config = Object.assign(Object.assign({}, config), {
2345
+ this.config = _objectSpread2(_objectSpread2({}, config), {}, {
2179
2346
  fetch: config.fetch || (typeof window === "undefined" ? fetch : window.fetch.bind(window))
2180
2347
  });
2181
2348
  }
@@ -2283,7 +2450,7 @@
2283
2450
  }
2284
2451
  fetchWithAuth(info, init, authParams) {
2285
2452
  const callbacks = {
2286
- onUseDpopNonceError: () => this.internalFetchWithAuth(info, init, Object.assign(Object.assign({}, callbacks), {
2453
+ onUseDpopNonceError: () => this.internalFetchWithAuth(info, init, _objectSpread2(_objectSpread2({}, callbacks), {}, {
2287
2454
  onUseDpopNonceError: undefined
2288
2455
  }), authParams)
2289
2456
  };
@@ -2339,6 +2506,11 @@
2339
2506
  constructor(_ref) {
2340
2507
  let {type: type, status: status, title: title, detail: detail, validation_errors: validation_errors} = _ref;
2341
2508
  super(detail);
2509
+ _defineProperty(this, "type", void 0);
2510
+ _defineProperty(this, "status", void 0);
2511
+ _defineProperty(this, "title", void 0);
2512
+ _defineProperty(this, "detail", void 0);
2513
+ _defineProperty(this, "validation_errors", void 0);
2342
2514
  this.name = "MyAccountApiError";
2343
2515
  this.type = type;
2344
2516
  this.status = status;
@@ -2376,7 +2548,7 @@
2376
2548
  };
2377
2549
  function getAuthJsEnrollParams(params) {
2378
2550
  const mapping = FACTOR_MAPPING[params.factorType];
2379
- return Object.assign(Object.assign(Object.assign({
2551
+ return _objectSpread2(_objectSpread2(_objectSpread2({
2380
2552
  mfaToken: params.mfaToken,
2381
2553
  authenticatorTypes: mapping.authenticatorTypes
2382
2554
  }, mapping.oobChannels && {
@@ -2399,144 +2571,6 @@
2399
2571
  }
2400
2572
  return undefined;
2401
2573
  }
2402
- function _OverloadYield(e, d) {
2403
- this.v = e, this.k = d;
2404
- }
2405
- function _assertClassBrand(e, t, n) {
2406
- if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
2407
- throw new TypeError("Private element is not present on this object");
2408
- }
2409
- function _awaitAsyncGenerator(e) {
2410
- return new _OverloadYield(e, 0);
2411
- }
2412
- function _checkPrivateRedeclaration(e, t) {
2413
- if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
2414
- }
2415
- function _classPrivateFieldGet2(s, a) {
2416
- return s.get(_assertClassBrand(s, a));
2417
- }
2418
- function _classPrivateFieldInitSpec(e, t, a) {
2419
- _checkPrivateRedeclaration(e, t), t.set(e, a);
2420
- }
2421
- function _classPrivateFieldSet2(s, a, r) {
2422
- return s.set(_assertClassBrand(s, a), r), r;
2423
- }
2424
- function _classPrivateMethodInitSpec(e, a) {
2425
- _checkPrivateRedeclaration(e, a), a.add(e);
2426
- }
2427
- function _defineProperty(e, r, t) {
2428
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
2429
- value: t,
2430
- enumerable: !0,
2431
- configurable: !0,
2432
- writable: !0
2433
- }) : e[r] = t, e;
2434
- }
2435
- function ownKeys(e, r) {
2436
- var t = Object.keys(e);
2437
- if (Object.getOwnPropertySymbols) {
2438
- var o = Object.getOwnPropertySymbols(e);
2439
- r && (o = o.filter(function(r) {
2440
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
2441
- })), t.push.apply(t, o);
2442
- }
2443
- return t;
2444
- }
2445
- function _objectSpread2(e) {
2446
- for (var r = 1; r < arguments.length; r++) {
2447
- var t = null != arguments[r] ? arguments[r] : {};
2448
- r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
2449
- _defineProperty(e, r, t[r]);
2450
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
2451
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
2452
- });
2453
- }
2454
- return e;
2455
- }
2456
- function _objectWithoutProperties(e, t) {
2457
- if (null == e) return {};
2458
- var o, r, i = _objectWithoutPropertiesLoose(e, t);
2459
- if (Object.getOwnPropertySymbols) {
2460
- var n = Object.getOwnPropertySymbols(e);
2461
- for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
2462
- }
2463
- return i;
2464
- }
2465
- function _objectWithoutPropertiesLoose(r, e) {
2466
- if (null == r) return {};
2467
- var t = {};
2468
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
2469
- if (-1 !== e.indexOf(n)) continue;
2470
- t[n] = r[n];
2471
- }
2472
- return t;
2473
- }
2474
- function _toPrimitive(t, r) {
2475
- if ("object" != typeof t || !t) return t;
2476
- var e = t[Symbol.toPrimitive];
2477
- if (void 0 !== e) {
2478
- var i = e.call(t, r || "default");
2479
- if ("object" != typeof i) return i;
2480
- throw new TypeError("@@toPrimitive must return a primitive value.");
2481
- }
2482
- return ("string" === r ? String : Number)(t);
2483
- }
2484
- function _toPropertyKey(t) {
2485
- var i = _toPrimitive(t, "string");
2486
- return "symbol" == typeof i ? i : i + "";
2487
- }
2488
- function _wrapAsyncGenerator(e) {
2489
- return function() {
2490
- return new AsyncGenerator(e.apply(this, arguments));
2491
- };
2492
- }
2493
- function AsyncGenerator(e) {
2494
- var t, n;
2495
- function resume(t, n) {
2496
- try {
2497
- var r = e[t](n), o = r.value, u = o instanceof _OverloadYield;
2498
- Promise.resolve(u ? o.v : o).then(function(n) {
2499
- if (u) {
2500
- var i = "return" === t && o.k ? t : "next";
2501
- if (!o.k || n.done) return resume(i, n);
2502
- n = e[i](n).value;
2503
- }
2504
- settle(!!r.done, n);
2505
- }, function(e) {
2506
- resume("throw", e);
2507
- });
2508
- } catch (e) {
2509
- settle(2, e);
2510
- }
2511
- }
2512
- function settle(e, r) {
2513
- 2 === e ? t.reject(r) : t.resolve({
2514
- value: r,
2515
- done: e
2516
- }), (t = t.next) ? resume(t.key, t.arg) : n = null;
2517
- }
2518
- this._invoke = function(e, r) {
2519
- return new Promise(function(o, u) {
2520
- var i = {
2521
- key: e,
2522
- arg: r,
2523
- resolve: o,
2524
- reject: u,
2525
- next: null
2526
- };
2527
- n ? n = n.next = i : (t = n = i, resume(e, r));
2528
- });
2529
- }, "function" != typeof e.return && (this.return = void 0);
2530
- }
2531
- AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function() {
2532
- return this;
2533
- }, AsyncGenerator.prototype.next = function(e) {
2534
- return this._invoke("next", e);
2535
- }, AsyncGenerator.prototype.throw = function(e) {
2536
- return this._invoke("throw", e);
2537
- }, AsyncGenerator.prototype.return = function(e) {
2538
- return this._invoke("return", e);
2539
- };
2540
2574
  var _navigator$userAgent$2, _navigator$userAgent$$2;
2541
2575
  let USER_AGENT$2;
2542
2576
  if (typeof navigator === "undefined" || !((_navigator$userAgent$2 = navigator.userAgent) !== null && _navigator$userAgent$2 !== void 0 && (_navigator$userAgent$$2 = _navigator$userAgent$2.startsWith) !== null && _navigator$userAgent$$2 !== void 0 && _navigator$userAgent$$2.call(_navigator$userAgent$2, "Mozilla/5.0 "))) {
@@ -6492,7 +6526,7 @@
6492
6526
  });
6493
6527
  return remoteJWKSet;
6494
6528
  }
6495
- const _excluded = [ "mfaToken" ], _excluded2 = [ "mfaToken" ];
6529
+ const _excluded$1 = [ "mfaToken" ], _excluded2$1 = [ "mfaToken" ];
6496
6530
  var _baseUrl, _clientId, _customFetch, _entries, _ttlMs, _maxEntries, _configuration, _serverMetadata, _clientAuthPromise, _options, _customFetch2, _jwks, _discoveryCache, _inFlightDiscovery, _jwksCache, _Class9_brand;
6497
6531
  var NotSupportedError = class NotSupportedError extends Error {
6498
6532
  constructor(code, message) {
@@ -6533,6 +6567,12 @@
6533
6567
  this.name = "TokenByRefreshTokenError";
6534
6568
  }
6535
6569
  };
6570
+ var TokenByPasswordError = class extends ApiError {
6571
+ constructor(message, cause) {
6572
+ super("token_by_password_error", message, cause);
6573
+ this.name = "TokenByPasswordError";
6574
+ }
6575
+ };
6536
6576
  var TokenForConnectionError = class extends ApiError {
6537
6577
  constructor(message, cause) {
6538
6578
  super("token_for_connection_error", message, cause);
@@ -6706,7 +6746,7 @@
6706
6746
  }
6707
6747
  async enrollAuthenticator(options) {
6708
6748
  const url = "".concat(_classPrivateFieldGet2(_baseUrl, this), "/mfa/associate");
6709
- const {mfaToken: mfaToken} = options, sdkParams = _objectWithoutProperties(options, _excluded);
6749
+ const {mfaToken: mfaToken} = options, sdkParams = _objectWithoutProperties(options, _excluded$1);
6710
6750
  const apiParams = {
6711
6751
  authenticator_types: sdkParams.authenticatorTypes
6712
6752
  };
@@ -6751,7 +6791,7 @@
6751
6791
  }
6752
6792
  async challengeAuthenticator(options) {
6753
6793
  const url = "".concat(_classPrivateFieldGet2(_baseUrl, this), "/mfa/challenge");
6754
- const {mfaToken: mfaToken} = options, challengeParams = _objectWithoutProperties(options, _excluded2);
6794
+ const {mfaToken: mfaToken} = options, challengeParams = _objectWithoutProperties(options, _excluded2$1);
6755
6795
  const body = {
6756
6796
  mfa_token: mfaToken,
6757
6797
  client_id: _classPrivateFieldGet2(_clientId, this),
@@ -6806,7 +6846,7 @@
6806
6846
  return {
6807
6847
  enabled: true,
6808
6848
  name: (_config$name = config === null || config === void 0 ? void 0 : config.name) !== null && _config$name !== void 0 ? _config$name : "@auth0/auth0-auth-js",
6809
- version: (_config$version = config === null || config === void 0 ? void 0 : config.version) !== null && _config$version !== void 0 ? _config$version : "1.5.0"
6849
+ version: (_config$version = config === null || config === void 0 ? void 0 : config.version) !== null && _config$version !== void 0 ? _config$version : "1.6.0"
6810
6850
  };
6811
6851
  }
6812
6852
  var TokenResponse = class _TokenResponse {
@@ -7155,6 +7195,38 @@
7155
7195
  throw new TokenByRefreshTokenError("The access token has expired and there was an error while trying to refresh it.", e);
7156
7196
  }
7157
7197
  }
7198
+ async getTokenByPassword(options) {
7199
+ const {configuration: configuration} = await _assertClassBrand(_Class9_brand, this, _discover).call(this);
7200
+ const params = new URLSearchParams({
7201
+ username: options.username,
7202
+ password: options.password
7203
+ });
7204
+ if (options.audience) {
7205
+ params.append("audience", options.audience);
7206
+ }
7207
+ if (options.scope) {
7208
+ params.append("scope", options.scope);
7209
+ }
7210
+ if (options.realm) {
7211
+ params.append("realm", options.realm);
7212
+ }
7213
+ let requestConfig = configuration;
7214
+ if (options.auth0ForwardedFor) {
7215
+ const clientAuth = await _assertClassBrand(_Class9_brand, this, _getClientAuth).call(this);
7216
+ requestConfig = new Configuration(configuration.serverMetadata(), _classPrivateFieldGet2(_options, this).clientId, _classPrivateFieldGet2(_options, this).clientSecret, clientAuth);
7217
+ requestConfig[customFetch$1] = (url, init) => _classPrivateFieldGet2(_customFetch2, this).call(this, url, _objectSpread2(_objectSpread2({}, init), {}, {
7218
+ headers: _objectSpread2(_objectSpread2({}, init.headers), {}, {
7219
+ "auth0-forwarded-for": options.auth0ForwardedFor
7220
+ })
7221
+ }));
7222
+ }
7223
+ try {
7224
+ const tokenEndpointResponse = await genericGrantRequest(requestConfig, "password", params);
7225
+ return TokenResponse.fromTokenEndpointResponse(tokenEndpointResponse);
7226
+ } catch (e) {
7227
+ throw new TokenByPasswordError("There was an error while trying to request a token.", e);
7228
+ }
7229
+ }
7158
7230
  async getTokenByClientCredentials(options) {
7159
7231
  const {configuration: configuration} = await _assertClassBrand(_Class9_brand, this, _discover).call(this);
7160
7232
  try {
@@ -7439,12 +7511,13 @@
7439
7511
  class MfaContextManager {
7440
7512
  constructor() {
7441
7513
  let ttlMs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_TTL_MS;
7442
- this.contexts = new Map;
7514
+ _defineProperty(this, "contexts", new Map);
7515
+ _defineProperty(this, "ttlMs", void 0);
7443
7516
  this.ttlMs = ttlMs;
7444
7517
  }
7445
7518
  set(mfaToken, context) {
7446
7519
  this.cleanup();
7447
- this.contexts.set(mfaToken, Object.assign(Object.assign({}, context), {
7520
+ this.contexts.set(mfaToken, _objectSpread2(_objectSpread2({}, context), {}, {
7448
7521
  createdAt: Date.now()
7449
7522
  }));
7450
7523
  }
@@ -7476,6 +7549,9 @@
7476
7549
  }
7477
7550
  class MfaApiClient {
7478
7551
  constructor(authJsMfaClient, auth0Client) {
7552
+ _defineProperty(this, "authJsMfaClient", void 0);
7553
+ _defineProperty(this, "auth0Client", void 0);
7554
+ _defineProperty(this, "contextManager", void 0);
7479
7555
  this.authJsMfaClient = authJsMfaClient;
7480
7556
  this.auth0Client = auth0Client;
7481
7557
  this.contextManager = new MfaContextManager;
@@ -7488,9 +7564,9 @@
7488
7564
  });
7489
7565
  }
7490
7566
  async getAuthenticators(mfaToken) {
7491
- var _a, _b;
7567
+ var _context$mfaRequireme;
7492
7568
  const context = this.contextManager.get(mfaToken);
7493
- if (!((_a = context === null || context === void 0 ? void 0 : context.mfaRequirements) === null || _a === void 0 ? void 0 : _a.challenge) || context.mfaRequirements.challenge.length === 0) {
7569
+ if (!(context !== null && context !== void 0 && (_context$mfaRequireme = context.mfaRequirements) !== null && _context$mfaRequireme !== void 0 && _context$mfaRequireme.challenge) || context.mfaRequirements.challenge.length === 0) {
7494
7570
  throw new MfaListAuthenticatorsError("invalid_request", "challengeType is required and must contain at least one challenge type, please check mfa_required error payload");
7495
7571
  }
7496
7572
  const challengeTypes = context.mfaRequirements.challenge.map(c => c.type);
@@ -7504,25 +7580,25 @@
7504
7580
  });
7505
7581
  } catch (error) {
7506
7582
  if (error instanceof MfaListAuthenticatorsError$1) {
7507
- throw new MfaListAuthenticatorsError((_b = error.cause) === null || _b === void 0 ? void 0 : _b.error, error.message);
7583
+ var _error$cause;
7584
+ throw new MfaListAuthenticatorsError((_error$cause = error.cause) === null || _error$cause === void 0 ? void 0 : _error$cause.error, error.message);
7508
7585
  }
7509
7586
  throw error;
7510
7587
  }
7511
7588
  }
7512
7589
  async enroll(params) {
7513
- var _a;
7514
7590
  const authJsParams = getAuthJsEnrollParams(params);
7515
7591
  try {
7516
7592
  return await this.authJsMfaClient.enrollAuthenticator(authJsParams);
7517
7593
  } catch (error) {
7518
7594
  if (error instanceof MfaEnrollmentError$1) {
7519
- throw new MfaEnrollmentError((_a = error.cause) === null || _a === void 0 ? void 0 : _a.error, error.message);
7595
+ var _error$cause2;
7596
+ throw new MfaEnrollmentError((_error$cause2 = error.cause) === null || _error$cause2 === void 0 ? void 0 : _error$cause2.error, error.message);
7520
7597
  }
7521
7598
  throw error;
7522
7599
  }
7523
7600
  }
7524
7601
  async challenge(params) {
7525
- var _a;
7526
7602
  try {
7527
7603
  const authJsParams = {
7528
7604
  challengeType: params.challengeType,
@@ -7534,7 +7610,8 @@
7534
7610
  return await this.authJsMfaClient.challengeAuthenticator(authJsParams);
7535
7611
  } catch (error) {
7536
7612
  if (error instanceof MfaChallengeError$1) {
7537
- throw new MfaChallengeError((_a = error.cause) === null || _a === void 0 ? void 0 : _a.error, error.message);
7613
+ var _error$cause3;
7614
+ throw new MfaChallengeError((_error$cause3 = error.cause) === null || _error$cause3 === void 0 ? void 0 : _error$cause3.error, error.message);
7538
7615
  }
7539
7616
  throw error;
7540
7617
  }
@@ -7583,18 +7660,37 @@
7583
7660
  }
7584
7661
  }
7585
7662
  }
7663
+ const _excluded = [ "openUrl", "fragment", "appState" ], _excluded2 = [ "url" ], _excluded3 = [ "cacheMode" ], _excluded4 = [ "federated" ], _excluded5 = [ "openUrl" ], _excluded6 = [ "id_token", "decodedToken" ], _excluded7 = [ "mfaToken" ];
7586
7664
  class Auth0Client {
7587
7665
  constructor(options) {
7588
- this.userCache = (new InMemoryCache).enclosedCache;
7589
- this.defaultOptions = {
7666
+ _defineProperty(this, "transactionManager", void 0);
7667
+ _defineProperty(this, "cacheManager", void 0);
7668
+ _defineProperty(this, "lockManager", void 0);
7669
+ _defineProperty(this, "domainUrl", void 0);
7670
+ _defineProperty(this, "tokenIssuer", void 0);
7671
+ _defineProperty(this, "scope", void 0);
7672
+ _defineProperty(this, "cookieStorage", void 0);
7673
+ _defineProperty(this, "dpop", void 0);
7674
+ _defineProperty(this, "sessionCheckExpiryDays", void 0);
7675
+ _defineProperty(this, "orgHintCookieName", void 0);
7676
+ _defineProperty(this, "isAuthenticatedCookieName", void 0);
7677
+ _defineProperty(this, "nowProvider", void 0);
7678
+ _defineProperty(this, "httpTimeoutMs", void 0);
7679
+ _defineProperty(this, "options", void 0);
7680
+ _defineProperty(this, "userCache", (new InMemoryCache).enclosedCache);
7681
+ _defineProperty(this, "myAccountApi", void 0);
7682
+ _defineProperty(this, "mfa", void 0);
7683
+ _defineProperty(this, "worker", void 0);
7684
+ _defineProperty(this, "authJsClient", void 0);
7685
+ _defineProperty(this, "defaultOptions", {
7590
7686
  authorizationParams: {
7591
7687
  scope: DEFAULT_SCOPE
7592
7688
  },
7593
7689
  useRefreshTokensFallback: false,
7594
7690
  useFormData: true
7595
- };
7596
- this.options = Object.assign(Object.assign(Object.assign({}, this.defaultOptions), options), {
7597
- authorizationParams: Object.assign(Object.assign({}, this.defaultOptions.authorizationParams), options.authorizationParams)
7691
+ });
7692
+ this.options = _objectSpread2(_objectSpread2(_objectSpread2({}, this.defaultOptions), options), {}, {
7693
+ authorizationParams: _objectSpread2(_objectSpread2({}, this.defaultOptions.authorizationParams), options.authorizationParams)
7598
7694
  });
7599
7695
  typeof window !== "undefined" && validateCrypto();
7600
7696
  this.lockManager = getLockManager();
@@ -7626,9 +7722,9 @@
7626
7722
  this.domainUrl = getDomain(this.options.domain);
7627
7723
  this.tokenIssuer = getTokenIssuer(this.options.issuer, this.domainUrl);
7628
7724
  const myAccountApiIdentifier = "".concat(this.domainUrl, "/me/");
7629
- const myAccountFetcher = this.createFetcher(Object.assign(Object.assign({}, this.options.useDpop && {
7725
+ const myAccountFetcher = this.createFetcher(_objectSpread2(_objectSpread2({}, this.options.useDpop && {
7630
7726
  dpopNonceId: "__auth0_my_account_api__"
7631
- }), {
7727
+ }), {}, {
7632
7728
  getAccessToken: () => this.getTokenSilently({
7633
7729
  authorizationParams: {
7634
7730
  scope: "create:me:connected_accounts",
@@ -7702,7 +7798,7 @@
7702
7798
  url.searchParams.delete(paramName);
7703
7799
  window.history.replaceState({}, "", url.toString());
7704
7800
  }
7705
- } catch (_a) {}
7801
+ } catch (_unused) {}
7706
7802
  }
7707
7803
  _applySessionTransferToken(authorizationParams) {
7708
7804
  const paramName = this.options.sessionTransferTokenQueryParamName;
@@ -7712,18 +7808,18 @@
7712
7808
  const token = this._extractSessionTransferToken(paramName);
7713
7809
  if (!token) return authorizationParams;
7714
7810
  this._clearSessionTransferTokenFromUrl(paramName);
7715
- return Object.assign(Object.assign({}, authorizationParams), {
7811
+ return _objectSpread2(_objectSpread2({}, authorizationParams), {}, {
7716
7812
  session_transfer_token: token
7717
7813
  });
7718
7814
  }
7719
7815
  async _prepareAuthorizeUrl(authorizationParams, authorizeOptions, fallbackRedirectUri) {
7720
- var _a;
7816
+ var _this$dpop;
7721
7817
  const state = encode$2(createRandomString());
7722
7818
  const nonce = encode$2(createRandomString());
7723
7819
  const code_verifier = createRandomString();
7724
7820
  const code_challengeBuffer = await sha256(code_verifier);
7725
7821
  const code_challenge = bufferToBase64UrlEncoded(code_challengeBuffer);
7726
- const thumbprint = await ((_a = this.dpop) === null || _a === void 0 ? void 0 : _a.calculateThumbprint());
7822
+ const thumbprint = await ((_this$dpop = this.dpop) === null || _this$dpop === void 0 ? void 0 : _this$dpop.calculateThumbprint());
7727
7823
  const params = getAuthorizeParams(this.options, this.scope, authorizationParams, state, nonce, code_challenge, authorizationParams.redirect_uri || this.options.authorizationParams.redirect_uri || fallbackRedirectUri, authorizeOptions === null || authorizeOptions === void 0 ? void 0 : authorizeOptions.response_mode, thumbprint);
7728
7824
  const url = this._authorizeUrl(params);
7729
7825
  return {
@@ -7737,7 +7833,7 @@
7737
7833
  };
7738
7834
  }
7739
7835
  async loginWithPopup(options, config) {
7740
- var _a;
7836
+ var _options$authorizatio;
7741
7837
  options = options || {};
7742
7838
  config = config || {};
7743
7839
  if (!config.popup) {
@@ -7751,13 +7847,13 @@
7751
7847
  response_mode: "web_message"
7752
7848
  }, window.location.origin);
7753
7849
  config.popup.location.href = params.url;
7754
- const codeResult = await runPopup(Object.assign(Object.assign({}, config), {
7850
+ const codeResult = await runPopup(_objectSpread2(_objectSpread2({}, config), {}, {
7755
7851
  timeoutInSeconds: config.timeoutInSeconds || this.options.authorizeTimeoutInSeconds || DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS
7756
- }));
7852
+ }), new URL(params.url).origin);
7757
7853
  if (params.state !== codeResult.state) {
7758
7854
  throw new GenericError("state_mismatch", "Invalid state");
7759
7855
  }
7760
- const organization = ((_a = options.authorizationParams) === null || _a === void 0 ? void 0 : _a.organization) || this.options.authorizationParams.organization;
7856
+ const organization = ((_options$authorizatio = options.authorizationParams) === null || _options$authorizatio === void 0 ? void 0 : _options$authorizatio.organization) || this.options.authorizationParams.organization;
7761
7857
  await this._requestToken({
7762
7858
  audience: params.audience,
7763
7859
  scope: params.scope,
@@ -7771,26 +7867,26 @@
7771
7867
  });
7772
7868
  }
7773
7869
  async getUser() {
7774
- var _a;
7870
+ var _cache$decodedToken;
7775
7871
  const cache = await this._getIdTokenFromCache();
7776
- return (_a = cache === null || cache === void 0 ? void 0 : cache.decodedToken) === null || _a === void 0 ? void 0 : _a.user;
7872
+ return cache === null || cache === void 0 || (_cache$decodedToken = cache.decodedToken) === null || _cache$decodedToken === void 0 ? void 0 : _cache$decodedToken.user;
7777
7873
  }
7778
7874
  async getIdTokenClaims() {
7779
- var _a;
7875
+ var _cache$decodedToken2;
7780
7876
  const cache = await this._getIdTokenFromCache();
7781
- return (_a = cache === null || cache === void 0 ? void 0 : cache.decodedToken) === null || _a === void 0 ? void 0 : _a.claims;
7877
+ return cache === null || cache === void 0 || (_cache$decodedToken2 = cache.decodedToken) === null || _cache$decodedToken2 === void 0 ? void 0 : _cache$decodedToken2.claims;
7782
7878
  }
7783
7879
  async loginWithRedirect() {
7880
+ var _urlOptions$authoriza;
7784
7881
  let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7785
- var _a;
7786
- const _b = patchOpenUrlWithOnRedirect(options), {openUrl: openUrl, fragment: fragment, appState: appState} = _b, urlOptions = __rest(_b, [ "openUrl", "fragment", "appState" ]);
7787
- const organization = ((_a = urlOptions.authorizationParams) === null || _a === void 0 ? void 0 : _a.organization) || this.options.authorizationParams.organization;
7882
+ const _patchOpenUrlWithOnRe = patchOpenUrlWithOnRedirect(options), {openUrl: openUrl, fragment: fragment, appState: appState} = _patchOpenUrlWithOnRe, urlOptions = _objectWithoutProperties(_patchOpenUrlWithOnRe, _excluded);
7883
+ const organization = ((_urlOptions$authoriza = urlOptions.authorizationParams) === null || _urlOptions$authoriza === void 0 ? void 0 : _urlOptions$authoriza.organization) || this.options.authorizationParams.organization;
7788
7884
  const authorizationParams = this._applySessionTransferToken(urlOptions.authorizationParams || {});
7789
- const _c = await this._prepareAuthorizeUrl(authorizationParams), {url: url} = _c, transaction = __rest(_c, [ "url" ]);
7790
- this.transactionManager.create(Object.assign(Object.assign(Object.assign({}, transaction), {
7885
+ const _await$this$_prepareA = await this._prepareAuthorizeUrl(authorizationParams), {url: url} = _await$this$_prepareA, transaction = _objectWithoutProperties(_await$this$_prepareA, _excluded2);
7886
+ this.transactionManager.create(_objectSpread2(_objectSpread2({}, transaction), {}, {
7791
7887
  appState: appState,
7792
- response_type: exports.ResponseType.Code
7793
- }), organization && {
7888
+ response_type: ResponseType.Code
7889
+ }, organization && {
7794
7890
  organization: organization
7795
7891
  }));
7796
7892
  const urlWithFragment = fragment ? "".concat(url, "#").concat(fragment) : url;
@@ -7812,7 +7908,7 @@
7812
7908
  }
7813
7909
  this.transactionManager.remove();
7814
7910
  const authenticationResult = parseAuthenticationResult(queryStringFragments.join(""));
7815
- if (transaction.response_type === exports.ResponseType.ConnectCode) {
7911
+ if (transaction.response_type === ResponseType.ConnectCode) {
7816
7912
  return this._handleConnectAccountRedirectCallback(authenticationResult, transaction);
7817
7913
  }
7818
7914
  return this._handleLoginRedirectCallback(authenticationResult, transaction);
@@ -7828,7 +7924,7 @@
7828
7924
  const organization = transaction.organization;
7829
7925
  const nonceIn = transaction.nonce;
7830
7926
  const redirect_uri = transaction.redirect_uri;
7831
- await this._requestToken(Object.assign({
7927
+ await this._requestToken(_objectSpread2({
7832
7928
  audience: transaction.audience,
7833
7929
  scope: transaction.scope,
7834
7930
  code_verifier: transaction.code_verifier,
@@ -7842,7 +7938,7 @@
7842
7938
  });
7843
7939
  return {
7844
7940
  appState: transaction.appState,
7845
- response_type: exports.ResponseType.Code
7941
+ response_type: ResponseType.Code
7846
7942
  };
7847
7943
  }
7848
7944
  async _handleConnectAccountRedirectCallback(connectResult, transaction) {
@@ -7862,9 +7958,9 @@
7862
7958
  redirect_uri: transaction.redirect_uri,
7863
7959
  code_verifier: transaction.code_verifier
7864
7960
  });
7865
- return Object.assign(Object.assign({}, data), {
7961
+ return _objectSpread2(_objectSpread2({}, data), {}, {
7866
7962
  appState: transaction.appState,
7867
- response_type: exports.ResponseType.ConnectCode
7963
+ response_type: ResponseType.ConnectCode
7868
7964
  });
7869
7965
  }
7870
7966
  async checkSession(options) {
@@ -7884,20 +7980,20 @@
7884
7980
  } catch (_) {}
7885
7981
  }
7886
7982
  async getTokenSilently() {
7983
+ var _options$authorizatio2, _options$authorizatio3;
7887
7984
  let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7888
- var _a, _b;
7889
- const localOptions = Object.assign(Object.assign({
7985
+ const localOptions = _objectSpread2(_objectSpread2({
7890
7986
  cacheMode: "on"
7891
- }, options), {
7892
- authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), options.authorizationParams), {
7893
- scope: scopesToRequest(this.scope, (_a = options.authorizationParams) === null || _a === void 0 ? void 0 : _a.scope, ((_b = options.authorizationParams) === null || _b === void 0 ? void 0 : _b.audience) || this.options.authorizationParams.audience)
7987
+ }, options), {}, {
7988
+ authorizationParams: _objectSpread2(_objectSpread2(_objectSpread2({}, this.options.authorizationParams), options.authorizationParams), {}, {
7989
+ scope: scopesToRequest(this.scope, (_options$authorizatio2 = options.authorizationParams) === null || _options$authorizatio2 === void 0 ? void 0 : _options$authorizatio2.scope, ((_options$authorizatio3 = options.authorizationParams) === null || _options$authorizatio3 === void 0 ? void 0 : _options$authorizatio3.audience) || this.options.authorizationParams.audience)
7894
7990
  })
7895
7991
  });
7896
7992
  const result = await singlePromise(() => this._getTokenSilently(localOptions), "".concat(this.options.clientId, "::").concat(localOptions.authorizationParams.audience, "::").concat(localOptions.authorizationParams.scope));
7897
7993
  return options.detailedResponse ? result : result === null || result === void 0 ? void 0 : result.access_token;
7898
7994
  }
7899
7995
  async _getTokenSilently(options) {
7900
- const {cacheMode: cacheMode} = options, getTokenOptions = __rest(options, [ "cacheMode" ]);
7996
+ const {cacheMode: cacheMode} = options, getTokenOptions = _objectWithoutProperties(options, _excluded3);
7901
7997
  if (cacheMode !== "off") {
7902
7998
  const entry = await this._getEntryFromCache({
7903
7999
  scope: getTokenOptions.authorizationParams.scope,
@@ -7927,13 +8023,13 @@
7927
8023
  }
7928
8024
  const authResult = this.options.useRefreshTokens ? await this._getTokenUsingRefreshToken(getTokenOptions) : await this._getTokenFromIFrame(getTokenOptions);
7929
8025
  const {id_token: id_token, token_type: token_type, access_token: access_token, oauthTokenScope: oauthTokenScope, expires_in: expires_in} = authResult;
7930
- return Object.assign(Object.assign({
8026
+ return _objectSpread2(_objectSpread2({
7931
8027
  id_token: id_token,
7932
8028
  token_type: token_type,
7933
8029
  access_token: access_token
7934
8030
  }, oauthTokenScope ? {
7935
8031
  scope: oauthTokenScope
7936
- } : null), {
8032
+ } : null), {}, {
7937
8033
  expires_in: expires_in
7938
8034
  });
7939
8035
  });
@@ -7969,15 +8065,15 @@
7969
8065
  }
7970
8066
  }
7971
8067
  async getTokenWithPopup() {
8068
+ var _options$authorizatio4, _options$authorizatio5;
7972
8069
  let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7973
8070
  let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
7974
- var _a, _b;
7975
- const localOptions = Object.assign(Object.assign({}, options), {
7976
- authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), options.authorizationParams), {
7977
- scope: scopesToRequest(this.scope, (_a = options.authorizationParams) === null || _a === void 0 ? void 0 : _a.scope, ((_b = options.authorizationParams) === null || _b === void 0 ? void 0 : _b.audience) || this.options.authorizationParams.audience)
8071
+ const localOptions = _objectSpread2(_objectSpread2({}, options), {}, {
8072
+ authorizationParams: _objectSpread2(_objectSpread2(_objectSpread2({}, this.options.authorizationParams), options.authorizationParams), {}, {
8073
+ scope: scopesToRequest(this.scope, (_options$authorizatio4 = options.authorizationParams) === null || _options$authorizatio4 === void 0 ? void 0 : _options$authorizatio4.scope, ((_options$authorizatio5 = options.authorizationParams) === null || _options$authorizatio5 === void 0 ? void 0 : _options$authorizatio5.audience) || this.options.authorizationParams.audience)
7978
8074
  })
7979
8075
  });
7980
- config = Object.assign(Object.assign({}, DEFAULT_POPUP_CONFIG_OPTIONS), config);
8076
+ config = _objectSpread2(_objectSpread2({}, DEFAULT_POPUP_CONFIG_OPTIONS), config);
7981
8077
  await this.loginWithPopup(localOptions, config);
7982
8078
  const cache = await this.cacheManager.get(new CacheKey({
7983
8079
  scope: localOptions.authorizationParams.scope,
@@ -7996,17 +8092,17 @@
7996
8092
  } else {
7997
8093
  delete options.clientId;
7998
8094
  }
7999
- const _a = options.logoutParams || {}, {federated: federated} = _a, logoutOptions = __rest(_a, [ "federated" ]);
8095
+ const _ref = options.logoutParams || {}, {federated: federated} = _ref, logoutOptions = _objectWithoutProperties(_ref, _excluded4);
8000
8096
  const federatedQuery = federated ? "&federated" : "";
8001
- const url = this._url("/v2/logout?".concat(createQueryParams(Object.assign({
8097
+ const url = this._url("/v2/logout?".concat(createQueryParams(_objectSpread2({
8002
8098
  clientId: options.clientId
8003
8099
  }, logoutOptions))));
8004
8100
  return url + federatedQuery;
8005
8101
  }
8006
8102
  async logout() {
8103
+ var _this$dpop2;
8007
8104
  let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8008
- var _a;
8009
- const _b = patchOpenUrlWithOnRedirect(options), {openUrl: openUrl} = _b, logoutOptions = __rest(_b, [ "openUrl" ]);
8105
+ const _patchOpenUrlWithOnRe2 = patchOpenUrlWithOnRedirect(options), {openUrl: openUrl} = _patchOpenUrlWithOnRe2, logoutOptions = _objectWithoutProperties(_patchOpenUrlWithOnRe2, _excluded5);
8010
8106
  if (options.clientId === null) {
8011
8107
  await this.cacheManager.clear();
8012
8108
  } else {
@@ -8019,7 +8115,7 @@
8019
8115
  cookieDomain: this.options.cookieDomain
8020
8116
  });
8021
8117
  this.userCache.remove(CACHE_KEY_ID_TOKEN_SUFFIX);
8022
- await ((_a = this.dpop) === null || _a === void 0 ? void 0 : _a.clear());
8118
+ await ((_this$dpop2 = this.dpop) === null || _this$dpop2 === void 0 ? void 0 : _this$dpop2.clear());
8023
8119
  const url = this._buildLogoutUrl(logoutOptions);
8024
8120
  if (openUrl) {
8025
8121
  await openUrl(url);
@@ -8031,7 +8127,7 @@
8031
8127
  const iframeLockKey = buildIframeLockKey(this.options.clientId);
8032
8128
  try {
8033
8129
  return await this.lockManager.runWithLock(iframeLockKey, 5e3, async () => {
8034
- const params = Object.assign(Object.assign({}, options.authorizationParams), {
8130
+ const params = _objectSpread2(_objectSpread2({}, options.authorizationParams), {}, {
8035
8131
  prompt: "none"
8036
8132
  });
8037
8133
  const orgHint = this.cookieStorage.get(this.orgHintCookieName);
@@ -8048,14 +8144,14 @@
8048
8144
  let eventOrigin;
8049
8145
  try {
8050
8146
  eventOrigin = new URL(this.domainUrl).origin;
8051
- } catch (_a) {
8147
+ } catch (_unused2) {
8052
8148
  eventOrigin = this.domainUrl;
8053
8149
  }
8054
8150
  const codeResult = await runIframe(url, eventOrigin, authorizeTimeout);
8055
8151
  if (stateIn !== codeResult.state) {
8056
8152
  throw new GenericError("state_mismatch", "Invalid state");
8057
8153
  }
8058
- const tokenResult = await this._requestToken(Object.assign(Object.assign({}, options.authorizationParams), {
8154
+ const tokenResult = await this._requestToken(_objectSpread2(_objectSpread2({}, options.authorizationParams), {}, {
8059
8155
  code_verifier: code_verifier,
8060
8156
  code: codeResult.code,
8061
8157
  grant_type: "authorization_code",
@@ -8065,7 +8161,7 @@
8065
8161
  nonceIn: nonceIn,
8066
8162
  organization: params.organization
8067
8163
  });
8068
- return Object.assign(Object.assign({}, tokenResult), {
8164
+ return _objectSpread2(_objectSpread2({}, tokenResult), {}, {
8069
8165
  scope: scope,
8070
8166
  oauthTokenScope: tokenResult.scope,
8071
8167
  audience: audience
@@ -8084,7 +8180,6 @@
8084
8180
  }
8085
8181
  }
8086
8182
  async _getTokenUsingRefreshToken(options) {
8087
- var _a, _b;
8088
8183
  const cache = await this.cacheManager.get(new CacheKey({
8089
8184
  scope: options.authorizationParams.scope,
8090
8185
  audience: options.authorizationParams.audience || DEFAULT_AUDIENCE,
@@ -8100,16 +8195,16 @@
8100
8195
  const timeout = typeof options.timeoutInSeconds === "number" ? options.timeoutInSeconds * 1e3 : null;
8101
8196
  const scopesToRequest = getScopeToRequest(this.options.useMrrt, options.authorizationParams, cache === null || cache === void 0 ? void 0 : cache.audience, cache === null || cache === void 0 ? void 0 : cache.scope);
8102
8197
  try {
8103
- const tokenResult = await this._requestToken(Object.assign(Object.assign(Object.assign({}, options.authorizationParams), {
8198
+ const tokenResult = await this._requestToken(_objectSpread2(_objectSpread2({}, options.authorizationParams), {}, {
8104
8199
  grant_type: "refresh_token",
8105
8200
  refresh_token: cache && cache.refresh_token,
8106
8201
  redirect_uri: redirect_uri
8107
- }), timeout && {
8202
+ }, timeout && {
8108
8203
  timeout: timeout
8109
8204
  }), {
8110
8205
  scopesToRequest: scopesToRequest
8111
8206
  });
8112
- if (tokenResult.refresh_token && (cache === null || cache === void 0 ? void 0 : cache.refresh_token)) {
8207
+ if (tokenResult.refresh_token && cache !== null && cache !== void 0 && cache.refresh_token) {
8113
8208
  await this.cacheManager.updateEntry(cache.refresh_token, tokenResult.refresh_token);
8114
8209
  }
8115
8210
  if (this.options.useMrrt) {
@@ -8126,7 +8221,7 @@
8126
8221
  }
8127
8222
  }
8128
8223
  }
8129
- return Object.assign(Object.assign({}, tokenResult), {
8224
+ return _objectSpread2(_objectSpread2({}, tokenResult), {}, {
8130
8225
  scope: options.authorizationParams.scope,
8131
8226
  oauthTokenScope: tokenResult.scope,
8132
8227
  audience: options.authorizationParams.audience || DEFAULT_AUDIENCE
@@ -8144,13 +8239,14 @@
8144
8239
  }
8145
8240
  }
8146
8241
  if (e instanceof MfaRequiredError) {
8147
- this.mfa.setMFAAuthDetails(e.mfa_token, (_a = options.authorizationParams) === null || _a === void 0 ? void 0 : _a.scope, (_b = options.authorizationParams) === null || _b === void 0 ? void 0 : _b.audience, e.mfa_requirements);
8242
+ var _options$authorizatio6, _options$authorizatio7;
8243
+ this.mfa.setMFAAuthDetails(e.mfa_token, (_options$authorizatio6 = options.authorizationParams) === null || _options$authorizatio6 === void 0 ? void 0 : _options$authorizatio6.scope, (_options$authorizatio7 = options.authorizationParams) === null || _options$authorizatio7 === void 0 ? void 0 : _options$authorizatio7.audience, e.mfa_requirements);
8148
8244
  }
8149
8245
  throw e;
8150
8246
  }
8151
8247
  }
8152
8248
  async _saveEntryInCache(entry) {
8153
- const {id_token: id_token, decodedToken: decodedToken} = entry, entryWithoutIdToken = __rest(entry, [ "id_token", "decodedToken" ]);
8249
+ const {id_token: id_token, decodedToken: decodedToken} = entry, entryWithoutIdToken = _objectWithoutProperties(entry, _excluded6);
8154
8250
  this.userCache.set(CACHE_KEY_ID_TOKEN_SUFFIX, {
8155
8251
  id_token: id_token,
8156
8252
  decodedToken: decodedToken
@@ -8173,8 +8269,8 @@
8173
8269
  this.userCache.set(CACHE_KEY_ID_TOKEN_SUFFIX, cache);
8174
8270
  return cache;
8175
8271
  }
8176
- async _getEntryFromCache(_ref) {
8177
- let {scope: scope, audience: audience, clientId: clientId, cacheMode: cacheMode} = _ref;
8272
+ async _getEntryFromCache(_ref2) {
8273
+ let {scope: scope, audience: audience, clientId: clientId, cacheMode: cacheMode} = _ref2;
8178
8274
  const entry = await this.cacheManager.get(new CacheKey({
8179
8275
  scope: scope,
8180
8276
  audience: audience,
@@ -8183,21 +8279,20 @@
8183
8279
  if (entry && entry.access_token) {
8184
8280
  const {token_type: token_type, access_token: access_token, oauthTokenScope: oauthTokenScope, expires_in: expires_in} = entry;
8185
8281
  const cache = await this._getIdTokenFromCache();
8186
- return cache && Object.assign(Object.assign({
8282
+ return cache && _objectSpread2(_objectSpread2({
8187
8283
  id_token: cache.id_token,
8188
8284
  token_type: token_type ? token_type : "Bearer",
8189
8285
  access_token: access_token
8190
8286
  }, oauthTokenScope ? {
8191
8287
  scope: oauthTokenScope
8192
- } : null), {
8288
+ } : null), {}, {
8193
8289
  expires_in: expires_in
8194
8290
  });
8195
8291
  }
8196
8292
  }
8197
8293
  async _requestToken(options, additionalParameters) {
8198
- var _a, _b;
8199
8294
  const {nonceIn: nonceIn, organization: organization, scopesToRequest: scopesToRequest} = additionalParameters || {};
8200
- const authResult = await oauthToken(Object.assign(Object.assign({
8295
+ const authResult = await oauthToken(_objectSpread2(_objectSpread2({
8201
8296
  baseUrl: this.domainUrl,
8202
8297
  client_id: this.options.clientId,
8203
8298
  auth0Client: this.options.auth0Client,
@@ -8205,24 +8300,25 @@
8205
8300
  timeout: this.httpTimeoutMs,
8206
8301
  useMrrt: this.options.useMrrt,
8207
8302
  dpop: this.dpop
8208
- }, options), {
8303
+ }, options), {}, {
8209
8304
  scope: scopesToRequest || options.scope
8210
8305
  }), this.worker);
8211
8306
  const decodedToken = await this._verifyIdToken(authResult.id_token, nonceIn, organization);
8212
8307
  if (options.grant_type === "authorization_code") {
8308
+ var _existingIdToken$deco;
8213
8309
  const existingIdToken = await this._getIdTokenFromCache();
8214
- if (((_b = (_a = existingIdToken === null || existingIdToken === void 0 ? void 0 : existingIdToken.decodedToken) === null || _a === void 0 ? void 0 : _a.claims) === null || _b === void 0 ? void 0 : _b.sub) && existingIdToken.decodedToken.claims.sub !== decodedToken.claims.sub) {
8310
+ if (existingIdToken !== null && existingIdToken !== void 0 && (_existingIdToken$deco = existingIdToken.decodedToken) !== null && _existingIdToken$deco !== void 0 && (_existingIdToken$deco = _existingIdToken$deco.claims) !== null && _existingIdToken$deco !== void 0 && _existingIdToken$deco.sub && existingIdToken.decodedToken.claims.sub !== decodedToken.claims.sub) {
8215
8311
  await this.cacheManager.clear(this.options.clientId);
8216
8312
  this.userCache.remove(CACHE_KEY_ID_TOKEN_SUFFIX);
8217
8313
  }
8218
8314
  }
8219
- await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({}, authResult), {
8315
+ await this._saveEntryInCache(_objectSpread2(_objectSpread2(_objectSpread2({}, authResult), {}, {
8220
8316
  decodedToken: decodedToken,
8221
8317
  scope: options.scope,
8222
8318
  audience: options.audience || DEFAULT_AUDIENCE
8223
- }), authResult.scope ? {
8319
+ }, authResult.scope ? {
8224
8320
  oauthTokenScope: authResult.scope
8225
- } : null), {
8321
+ } : null), {}, {
8226
8322
  client_id: this.options.clientId
8227
8323
  }));
8228
8324
  this.cookieStorage.save(this.isAuthenticatedCookieName, true, {
@@ -8230,12 +8326,12 @@
8230
8326
  cookieDomain: this.options.cookieDomain
8231
8327
  });
8232
8328
  this._processOrgHint(organization || decodedToken.claims.org_id);
8233
- return Object.assign(Object.assign({}, authResult), {
8329
+ return _objectSpread2(_objectSpread2({}, authResult), {}, {
8234
8330
  decodedToken: decodedToken
8235
8331
  });
8236
8332
  }
8237
8333
  async loginWithCustomTokenExchange(options) {
8238
- return this._requestToken(Object.assign(Object.assign({}, options), {
8334
+ return this._requestToken(_objectSpread2(_objectSpread2({}, options), {}, {
8239
8335
  grant_type: "urn:ietf:params:oauth:grant-type:token-exchange",
8240
8336
  subject_token: options.subject_token,
8241
8337
  subject_token_type: options.subject_token_type,
@@ -8269,10 +8365,10 @@
8269
8365
  return new Fetcher(config, {
8270
8366
  isDpopEnabled: () => !!this.options.useDpop,
8271
8367
  getAccessToken: authParams => {
8272
- var _a;
8368
+ var _authParams$scope;
8273
8369
  return this.getTokenSilently({
8274
8370
  authorizationParams: {
8275
- scope: (_a = authParams === null || authParams === void 0 ? void 0 : authParams.scope) === null || _a === void 0 ? void 0 : _a.join(" "),
8371
+ scope: authParams === null || authParams === void 0 || (_authParams$scope = authParams.scope) === null || _authParams$scope === void 0 ? void 0 : _authParams$scope.join(" "),
8276
8372
  audience: authParams === null || authParams === void 0 ? void 0 : authParams.audience
8277
8373
  },
8278
8374
  detailedResponse: true
@@ -8308,7 +8404,7 @@
8308
8404
  redirect_uri: redirectUri,
8309
8405
  appState: appState,
8310
8406
  connection: connection,
8311
- response_type: exports.ResponseType.ConnectCode
8407
+ response_type: ResponseType.ConnectCode
8312
8408
  });
8313
8409
  const url = new URL(connect_uri);
8314
8410
  url.searchParams.set("ticket", connect_params.ticket);
@@ -8319,8 +8415,8 @@
8319
8415
  }
8320
8416
  }
8321
8417
  async _requestTokenForMfa(options, additionalParameters) {
8322
- const {mfaToken: mfaToken} = options, restOptions = __rest(options, [ "mfaToken" ]);
8323
- return this._requestToken(Object.assign(Object.assign({}, restOptions), {
8418
+ const {mfaToken: mfaToken} = options, restOptions = _objectWithoutProperties(options, _excluded7);
8419
+ return this._requestToken(_objectSpread2(_objectSpread2({}, restOptions), {}, {
8324
8420
  mfa_token: mfaToken
8325
8421
  }), additionalParameters);
8326
8422
  }
@@ -8350,6 +8446,7 @@
8350
8446
  exports.PopupCancelledError = PopupCancelledError;
8351
8447
  exports.PopupOpenError = PopupOpenError;
8352
8448
  exports.PopupTimeoutError = PopupTimeoutError;
8449
+ exports.ResponseType = ResponseType;
8353
8450
  exports.TimeoutError = TimeoutError;
8354
8451
  exports.UseDpopNonceError = UseDpopNonceError;
8355
8452
  exports.User = User;