@wandelbots/wandelbots-js-react-components 3.3.0 → 3.3.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.
- package/README.md +10 -44
- package/dist/3d.cjs.js +1 -1
- package/dist/3d.es.js +1 -1
- package/dist/{LoadingCover-DkXwZXg8.js → LoadingCover-Dr9hDTku.js} +2 -2
- package/dist/{LoadingCover-DkXwZXg8.js.map → LoadingCover-Dr9hDTku.js.map} +1 -1
- package/dist/{LoadingCover-CbvPNfkO.cjs → LoadingCover-r2yhJZF9.cjs} +2 -2
- package/dist/{LoadingCover-CbvPNfkO.cjs.map → LoadingCover-r2yhJZF9.cjs.map} +1 -1
- package/dist/{WandelscriptEditor-DepOICD0.cjs → WandelscriptEditor-Dj7TBCkF.cjs} +2 -2
- package/dist/{WandelscriptEditor-DepOICD0.cjs.map → WandelscriptEditor-Dj7TBCkF.cjs.map} +1 -1
- package/dist/{WandelscriptEditor-DomKLwOz.js → WandelscriptEditor-DnJvITTA.js} +3 -3
- package/dist/{WandelscriptEditor-DomKLwOz.js.map → WandelscriptEditor-DnJvITTA.js.map} +1 -1
- package/dist/{auth0-spa-js.production.esm-Bb4L9JDU.js → auth0-spa-js.production.esm-9WdmjTxR.js} +452 -446
- package/dist/auth0-spa-js.production.esm-9WdmjTxR.js.map +1 -0
- package/dist/auth0-spa-js.production.esm-BcLLh1tx.cjs +5 -0
- package/dist/auth0-spa-js.production.esm-BcLLh1tx.cjs.map +1 -0
- package/dist/core.cjs.js +1 -1
- package/dist/core.es.js +4 -4
- package/dist/{index-BSgNMmxG.js → index-CAib4NKw.js} +532 -534
- package/dist/index-CAib4NKw.js.map +1 -0
- package/dist/{index-BHtHALJk.cjs → index-CqMZL0FV.cjs} +2 -2
- package/dist/index-CqMZL0FV.cjs.map +1 -0
- package/dist/{index-obAnXT9_.js → index-CxasuX80.js} +2 -123
- package/dist/index-CxasuX80.js.map +1 -0
- package/dist/index-DxwppshT.cjs +29 -0
- package/dist/index-DxwppshT.cjs.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +6 -6
- package/dist/{manufacturerHomePositions-AGIQC0U_.cjs → manufacturerHomePositions-Ca80ycLi.cjs} +2 -2
- package/dist/{manufacturerHomePositions-AGIQC0U_.cjs.map → manufacturerHomePositions-Ca80ycLi.cjs.map} +1 -1
- package/dist/{manufacturerHomePositions-4m2Kt5Pk.js → manufacturerHomePositions-CgaG5vaK.js} +3 -3
- package/dist/{manufacturerHomePositions-4m2Kt5Pk.js.map → manufacturerHomePositions-CgaG5vaK.js.map} +1 -1
- package/dist/{theming-CO0a0eRg.js → theming-BWOmVwDm.js} +8560 -6899
- package/dist/theming-BWOmVwDm.js.map +1 -0
- package/dist/theming-hsf8KjGm.cjs +133 -0
- package/dist/theming-hsf8KjGm.cjs.map +1 -0
- package/dist/wandelscript.cjs.js +1 -1
- package/dist/wandelscript.es.js +1 -1
- package/package.json +5 -5
- package/dist/auth0-spa-js.production.esm-Bb4L9JDU.js.map +0 -1
- package/dist/auth0-spa-js.production.esm-CEI5Uihg.cjs +0 -5
- package/dist/auth0-spa-js.production.esm-CEI5Uihg.cjs.map +0 -1
- package/dist/index-BHtHALJk.cjs.map +0 -1
- package/dist/index-BSgNMmxG.js.map +0 -1
- package/dist/index-DS_xdVel.cjs +0 -29
- package/dist/index-DS_xdVel.cjs.map +0 -1
- package/dist/index-obAnXT9_.js.map +0 -1
- package/dist/theming-CO0a0eRg.js.map +0 -1
- package/dist/theming-ZJr8jTwS.cjs +0 -128
- package/dist/theming-ZJr8jTwS.cjs.map +0 -1
package/dist/{auth0-spa-js.production.esm-Bb4L9JDU.js → auth0-spa-js.production.esm-9WdmjTxR.js}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
function I(i, e) {
|
|
2
2
|
var t = {};
|
|
3
|
-
for (var
|
|
3
|
+
for (var n in i) Object.prototype.hasOwnProperty.call(i, n) && e.indexOf(n) < 0 && (t[n] = i[n]);
|
|
4
4
|
if (i != null && typeof Object.getOwnPropertySymbols == "function") {
|
|
5
|
-
var
|
|
6
|
-
for (
|
|
5
|
+
var o = 0;
|
|
6
|
+
for (n = Object.getOwnPropertySymbols(i); o < n.length; o++) e.indexOf(n[o]) < 0 && Object.prototype.propertyIsEnumerable.call(i, n[o]) && (t[n[o]] = i[n[o]]);
|
|
7
7
|
}
|
|
8
8
|
return t;
|
|
9
9
|
}
|
|
@@ -14,40 +14,40 @@ function Q(i) {
|
|
|
14
14
|
function ee(i, e) {
|
|
15
15
|
return i(e = { exports: {} }, e.exports), e.exports;
|
|
16
16
|
}
|
|
17
|
-
var O = ee(function(i, e) {
|
|
17
|
+
var O = ee((function(i, e) {
|
|
18
18
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
19
|
-
var t = function() {
|
|
20
|
-
function
|
|
21
|
-
var
|
|
19
|
+
var t = (function() {
|
|
20
|
+
function n() {
|
|
21
|
+
var o = this;
|
|
22
22
|
this.locked = /* @__PURE__ */ new Map(), this.addToLocked = function(r, a) {
|
|
23
|
-
var h =
|
|
24
|
-
h === void 0 ? a === void 0 ?
|
|
23
|
+
var h = o.locked.get(r);
|
|
24
|
+
h === void 0 ? a === void 0 ? o.locked.set(r, []) : o.locked.set(r, [a]) : a !== void 0 && (h.unshift(a), o.locked.set(r, h));
|
|
25
25
|
}, this.isLocked = function(r) {
|
|
26
|
-
return
|
|
26
|
+
return o.locked.has(r);
|
|
27
27
|
}, this.lock = function(r) {
|
|
28
|
-
return new Promise(function(a, h) {
|
|
29
|
-
|
|
30
|
-
});
|
|
28
|
+
return new Promise((function(a, h) {
|
|
29
|
+
o.isLocked(r) ? o.addToLocked(r, a) : (o.addToLocked(r), a());
|
|
30
|
+
}));
|
|
31
31
|
}, this.unlock = function(r) {
|
|
32
|
-
var a =
|
|
32
|
+
var a = o.locked.get(r);
|
|
33
33
|
if (a !== void 0 && a.length !== 0) {
|
|
34
34
|
var h = a.pop();
|
|
35
|
-
|
|
36
|
-
} else
|
|
35
|
+
o.locked.set(r, a), h !== void 0 && setTimeout(h, 0);
|
|
36
|
+
} else o.locked.delete(r);
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
return
|
|
40
|
-
return
|
|
41
|
-
},
|
|
42
|
-
}();
|
|
39
|
+
return n.getInstance = function() {
|
|
40
|
+
return n.instance === void 0 && (n.instance = new n()), n.instance;
|
|
41
|
+
}, n;
|
|
42
|
+
})();
|
|
43
43
|
e.default = function() {
|
|
44
44
|
return t.getInstance();
|
|
45
45
|
};
|
|
46
|
-
});
|
|
46
|
+
}));
|
|
47
47
|
Q(O);
|
|
48
|
-
var
|
|
48
|
+
var je = Q(ee((function(i, e) {
|
|
49
49
|
var t = C && C.__awaiter || function(s, c, d, l) {
|
|
50
|
-
return new (d || (d = Promise))(function(m, y) {
|
|
50
|
+
return new (d || (d = Promise))((function(m, y) {
|
|
51
51
|
function g(w) {
|
|
52
52
|
try {
|
|
53
53
|
b(l.next(w));
|
|
@@ -63,13 +63,13 @@ var Ce = Q(ee(function(i, e) {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
function b(w) {
|
|
66
|
-
w.done ? m(w.value) : new d(function(f) {
|
|
66
|
+
w.done ? m(w.value) : new d((function(f) {
|
|
67
67
|
f(w.value);
|
|
68
|
-
}).then(g, k);
|
|
68
|
+
})).then(g, k);
|
|
69
69
|
}
|
|
70
70
|
b((l = l.apply(s, c || [])).next());
|
|
71
|
-
});
|
|
72
|
-
},
|
|
71
|
+
}));
|
|
72
|
+
}, n = C && C.__generator || function(s, c) {
|
|
73
73
|
var d, l, m, y, g = { label: 0, sent: function() {
|
|
74
74
|
if (1 & m[0]) throw m[1];
|
|
75
75
|
return m[1];
|
|
@@ -79,7 +79,7 @@ var Ce = Q(ee(function(i, e) {
|
|
|
79
79
|
}), y;
|
|
80
80
|
function k(b) {
|
|
81
81
|
return function(w) {
|
|
82
|
-
return function(f) {
|
|
82
|
+
return (function(f) {
|
|
83
83
|
if (d) throw new TypeError("Generator is already executing.");
|
|
84
84
|
for (; g; ) try {
|
|
85
85
|
if (d = 1, l && (m = 2 & f[0] ? l.return : f[0] ? l.throw || ((m = l.return) && m.call(l), 0) : l.next) && !(m = m.call(l, f[1])).done) return m;
|
|
@@ -124,41 +124,41 @@ var Ce = Q(ee(function(i, e) {
|
|
|
124
124
|
}
|
|
125
125
|
if (5 & f[0]) throw f[1];
|
|
126
126
|
return { value: f[0] ? f[1] : void 0, done: !0 };
|
|
127
|
-
}([b, w]);
|
|
127
|
+
})([b, w]);
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
|
-
},
|
|
130
|
+
}, o = C;
|
|
131
131
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
132
132
|
var r = "browser-tabs-lock-key", a = { key: function(s) {
|
|
133
|
-
return t(
|
|
134
|
-
return
|
|
133
|
+
return t(o, void 0, void 0, (function() {
|
|
134
|
+
return n(this, (function(c) {
|
|
135
135
|
throw new Error("Unsupported");
|
|
136
|
-
});
|
|
137
|
-
});
|
|
136
|
+
}));
|
|
137
|
+
}));
|
|
138
138
|
}, getItem: function(s) {
|
|
139
|
-
return t(
|
|
140
|
-
return
|
|
139
|
+
return t(o, void 0, void 0, (function() {
|
|
140
|
+
return n(this, (function(c) {
|
|
141
141
|
throw new Error("Unsupported");
|
|
142
|
-
});
|
|
143
|
-
});
|
|
142
|
+
}));
|
|
143
|
+
}));
|
|
144
144
|
}, clear: function() {
|
|
145
|
-
return t(
|
|
146
|
-
return
|
|
145
|
+
return t(o, void 0, void 0, (function() {
|
|
146
|
+
return n(this, (function(s) {
|
|
147
147
|
return [2, window.localStorage.clear()];
|
|
148
|
-
});
|
|
149
|
-
});
|
|
148
|
+
}));
|
|
149
|
+
}));
|
|
150
150
|
}, removeItem: function(s) {
|
|
151
|
-
return t(
|
|
152
|
-
return
|
|
151
|
+
return t(o, void 0, void 0, (function() {
|
|
152
|
+
return n(this, (function(c) {
|
|
153
153
|
throw new Error("Unsupported");
|
|
154
|
-
});
|
|
155
|
-
});
|
|
154
|
+
}));
|
|
155
|
+
}));
|
|
156
156
|
}, setItem: function(s, c) {
|
|
157
|
-
return t(
|
|
158
|
-
return
|
|
157
|
+
return t(o, void 0, void 0, (function() {
|
|
158
|
+
return n(this, (function(d) {
|
|
159
159
|
throw new Error("Unsupported");
|
|
160
|
-
});
|
|
161
|
-
});
|
|
160
|
+
}));
|
|
161
|
+
}));
|
|
162
162
|
}, keySync: function(s) {
|
|
163
163
|
return window.localStorage.key(s);
|
|
164
164
|
}, getItemSync: function(s) {
|
|
@@ -171,23 +171,23 @@ var Ce = Q(ee(function(i, e) {
|
|
|
171
171
|
return window.localStorage.setItem(s, c);
|
|
172
172
|
} };
|
|
173
173
|
function h(s) {
|
|
174
|
-
return new Promise(function(c) {
|
|
174
|
+
return new Promise((function(c) {
|
|
175
175
|
return setTimeout(c, s);
|
|
176
|
-
});
|
|
176
|
+
}));
|
|
177
177
|
}
|
|
178
178
|
function u(s) {
|
|
179
179
|
for (var c = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz", d = "", l = 0; l < s; l++)
|
|
180
180
|
d += c[Math.floor(Math.random() * c.length)];
|
|
181
181
|
return d;
|
|
182
182
|
}
|
|
183
|
-
var p = function() {
|
|
183
|
+
var p = (function() {
|
|
184
184
|
function s(c) {
|
|
185
185
|
this.acquiredIatSet = /* @__PURE__ */ new Set(), this.storageHandler = void 0, this.id = Date.now().toString() + u(15), this.acquireLock = this.acquireLock.bind(this), this.releaseLock = this.releaseLock.bind(this), this.releaseLock__private__ = this.releaseLock__private__.bind(this), this.waitForSomethingToChange = this.waitForSomethingToChange.bind(this), this.refreshLockWhileAcquired = this.refreshLockWhileAcquired.bind(this), this.storageHandler = c, s.waiters === void 0 && (s.waiters = []);
|
|
186
186
|
}
|
|
187
187
|
return s.prototype.acquireLock = function(c, d) {
|
|
188
|
-
return d === void 0 && (d = 5e3), t(this, void 0, void 0, function() {
|
|
188
|
+
return d === void 0 && (d = 5e3), t(this, void 0, void 0, (function() {
|
|
189
189
|
var l, m, y, g, k, b, w;
|
|
190
|
-
return
|
|
190
|
+
return n(this, (function(f) {
|
|
191
191
|
switch (f.label) {
|
|
192
192
|
case 0:
|
|
193
193
|
l = Date.now() + u(4), m = Date.now() + d, y = r + "-" + c, g = this.storageHandler === void 0 ? a : this.storageHandler, f.label = 1;
|
|
@@ -208,33 +208,33 @@ var Ce = Q(ee(function(i, e) {
|
|
|
208
208
|
case 8:
|
|
209
209
|
return [2, !1];
|
|
210
210
|
}
|
|
211
|
-
});
|
|
212
|
-
});
|
|
211
|
+
}));
|
|
212
|
+
}));
|
|
213
213
|
}, s.prototype.refreshLockWhileAcquired = function(c, d) {
|
|
214
|
-
return t(this, void 0, void 0, function() {
|
|
214
|
+
return t(this, void 0, void 0, (function() {
|
|
215
215
|
var l = this;
|
|
216
|
-
return
|
|
217
|
-
return setTimeout(function() {
|
|
218
|
-
return t(l, void 0, void 0, function() {
|
|
216
|
+
return n(this, (function(m) {
|
|
217
|
+
return setTimeout((function() {
|
|
218
|
+
return t(l, void 0, void 0, (function() {
|
|
219
219
|
var y, g, k;
|
|
220
|
-
return
|
|
220
|
+
return n(this, (function(b) {
|
|
221
221
|
switch (b.label) {
|
|
222
222
|
case 0:
|
|
223
223
|
return [4, O.default().lock(d)];
|
|
224
224
|
case 1:
|
|
225
225
|
return b.sent(), this.acquiredIatSet.has(d) ? (y = this.storageHandler === void 0 ? a : this.storageHandler, (g = y.getItemSync(c)) === null ? (O.default().unlock(d), [2]) : ((k = JSON.parse(g)).timeRefreshed = Date.now(), y.setItemSync(c, JSON.stringify(k)), O.default().unlock(d), this.refreshLockWhileAcquired(c, d), [2])) : (O.default().unlock(d), [2]);
|
|
226
226
|
}
|
|
227
|
-
});
|
|
228
|
-
});
|
|
229
|
-
}, 1e3), [2];
|
|
230
|
-
});
|
|
231
|
-
});
|
|
227
|
+
}));
|
|
228
|
+
}));
|
|
229
|
+
}), 1e3), [2];
|
|
230
|
+
}));
|
|
231
|
+
}));
|
|
232
232
|
}, s.prototype.waitForSomethingToChange = function(c) {
|
|
233
|
-
return t(this, void 0, void 0, function() {
|
|
234
|
-
return
|
|
233
|
+
return t(this, void 0, void 0, (function() {
|
|
234
|
+
return n(this, (function(d) {
|
|
235
235
|
switch (d.label) {
|
|
236
236
|
case 0:
|
|
237
|
-
return [4, new Promise(function(l) {
|
|
237
|
+
return [4, new Promise((function(l) {
|
|
238
238
|
var m = !1, y = Date.now(), g = !1;
|
|
239
239
|
function k() {
|
|
240
240
|
if (g || (window.removeEventListener("storage", k), s.removeFromWaiting(k), clearTimeout(b), g = !0), !m) {
|
|
@@ -245,37 +245,37 @@ var Ce = Q(ee(function(i, e) {
|
|
|
245
245
|
}
|
|
246
246
|
window.addEventListener("storage", k), s.addToWaiting(k);
|
|
247
247
|
var b = setTimeout(k, Math.max(0, c - Date.now()));
|
|
248
|
-
})];
|
|
248
|
+
}))];
|
|
249
249
|
case 1:
|
|
250
250
|
return d.sent(), [2];
|
|
251
251
|
}
|
|
252
|
-
});
|
|
253
|
-
});
|
|
252
|
+
}));
|
|
253
|
+
}));
|
|
254
254
|
}, s.addToWaiting = function(c) {
|
|
255
255
|
this.removeFromWaiting(c), s.waiters !== void 0 && s.waiters.push(c);
|
|
256
256
|
}, s.removeFromWaiting = function(c) {
|
|
257
|
-
s.waiters !== void 0 && (s.waiters = s.waiters.filter(function(d) {
|
|
257
|
+
s.waiters !== void 0 && (s.waiters = s.waiters.filter((function(d) {
|
|
258
258
|
return d !== c;
|
|
259
|
-
}));
|
|
259
|
+
})));
|
|
260
260
|
}, s.notifyWaiters = function() {
|
|
261
|
-
s.waiters !== void 0 && s.waiters.slice().forEach(function(c) {
|
|
261
|
+
s.waiters !== void 0 && s.waiters.slice().forEach((function(c) {
|
|
262
262
|
return c();
|
|
263
|
-
});
|
|
263
|
+
}));
|
|
264
264
|
}, s.prototype.releaseLock = function(c) {
|
|
265
|
-
return t(this, void 0, void 0, function() {
|
|
266
|
-
return
|
|
265
|
+
return t(this, void 0, void 0, (function() {
|
|
266
|
+
return n(this, (function(d) {
|
|
267
267
|
switch (d.label) {
|
|
268
268
|
case 0:
|
|
269
269
|
return [4, this.releaseLock__private__(c)];
|
|
270
270
|
case 1:
|
|
271
271
|
return [2, d.sent()];
|
|
272
272
|
}
|
|
273
|
-
});
|
|
274
|
-
});
|
|
273
|
+
}));
|
|
274
|
+
}));
|
|
275
275
|
}, s.prototype.releaseLock__private__ = function(c) {
|
|
276
|
-
return t(this, void 0, void 0, function() {
|
|
276
|
+
return t(this, void 0, void 0, (function() {
|
|
277
277
|
var d, l, m, y;
|
|
278
|
-
return
|
|
278
|
+
return n(this, (function(g) {
|
|
279
279
|
switch (g.label) {
|
|
280
280
|
case 0:
|
|
281
281
|
return d = this.storageHandler === void 0 ? a : this.storageHandler, l = r + "-" + c, (m = d.getItemSync(l)) === null ? [2] : (y = JSON.parse(m)).id !== this.id ? [3, 2] : [4, O.default().lock(y.iat)];
|
|
@@ -284,8 +284,8 @@ var Ce = Q(ee(function(i, e) {
|
|
|
284
284
|
case 2:
|
|
285
285
|
return [2];
|
|
286
286
|
}
|
|
287
|
-
});
|
|
288
|
-
});
|
|
287
|
+
}));
|
|
288
|
+
}));
|
|
289
289
|
}, s.lockCorrector = function(c) {
|
|
290
290
|
for (var d = Date.now() - 5e3, l = c, m = [], y = 0; ; ) {
|
|
291
291
|
var g = l.keySync(y);
|
|
@@ -304,10 +304,10 @@ var Ce = Q(ee(function(i, e) {
|
|
|
304
304
|
}
|
|
305
305
|
k && s.notifyWaiters();
|
|
306
306
|
}, s.waiters = void 0, s;
|
|
307
|
-
}();
|
|
307
|
+
})();
|
|
308
308
|
e.default = p;
|
|
309
|
-
}));
|
|
310
|
-
const
|
|
309
|
+
})));
|
|
310
|
+
const Ke = { timeoutInSeconds: 60 }, be = { name: "auth0-spa-js", version: "2.11.0" }, ke = () => Date.now();
|
|
311
311
|
class v extends Error {
|
|
312
312
|
constructor(e, t) {
|
|
313
313
|
super(t), this.error = e, this.error_description = t, Object.setPrototypeOf(this, v.prototype);
|
|
@@ -317,13 +317,13 @@ class v extends Error {
|
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
class te extends v {
|
|
320
|
-
constructor(e, t,
|
|
321
|
-
super(e, t), this.state =
|
|
320
|
+
constructor(e, t, n, o = null) {
|
|
321
|
+
super(e, t), this.state = n, this.appState = o, Object.setPrototypeOf(this, te.prototype);
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
|
-
class
|
|
325
|
-
constructor(e, t,
|
|
326
|
-
super(e, t), this.connection =
|
|
324
|
+
class ne extends v {
|
|
325
|
+
constructor(e, t, n, o, r = null) {
|
|
326
|
+
super(e, t), this.connection = n, this.state = o, this.appState = r, Object.setPrototypeOf(this, ne.prototype);
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
class U extends v {
|
|
@@ -331,9 +331,9 @@ class U extends v {
|
|
|
331
331
|
super("timeout", "Timeout"), Object.setPrototypeOf(this, U.prototype);
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
|
-
class
|
|
334
|
+
class oe extends U {
|
|
335
335
|
constructor(e) {
|
|
336
|
-
super(), this.popup = e, Object.setPrototypeOf(this,
|
|
336
|
+
super(), this.popup = e, Object.setPrototypeOf(this, oe.prototype);
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
class ie extends v {
|
|
@@ -342,8 +342,13 @@ class ie extends v {
|
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
class re extends v {
|
|
345
|
-
constructor(
|
|
346
|
-
super(
|
|
345
|
+
constructor() {
|
|
346
|
+
super("popup_open", "Unable to open a popup for loginWithPopup - window.open returned `null`"), Object.setPrototypeOf(this, re.prototype);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
class se extends v {
|
|
350
|
+
constructor(e, t, n) {
|
|
351
|
+
super(e, t), this.mfa_token = n, Object.setPrototypeOf(this, se.prototype);
|
|
347
352
|
}
|
|
348
353
|
}
|
|
349
354
|
class V extends v {
|
|
@@ -351,9 +356,9 @@ class V extends v {
|
|
|
351
356
|
super("missing_refresh_token", `Missing Refresh Token (audience: '${W(e, ["default"])}', scope: '${W(t)}')`), this.audience = e, this.scope = t, Object.setPrototypeOf(this, V.prototype);
|
|
352
357
|
}
|
|
353
358
|
}
|
|
354
|
-
class
|
|
359
|
+
class ae extends v {
|
|
355
360
|
constructor(e, t) {
|
|
356
|
-
super("missing_scopes", `Missing requested scopes after refresh (audience: '${W(e, ["default"])}', missing scope: '${W(t)}')`), this.audience = e, this.scope = t, Object.setPrototypeOf(this,
|
|
361
|
+
super("missing_scopes", `Missing requested scopes after refresh (audience: '${W(e, ["default"])}', missing scope: '${W(t)}')`), this.audience = e, this.scope = t, Object.setPrototypeOf(this, ae.prototype);
|
|
357
362
|
}
|
|
358
363
|
}
|
|
359
364
|
class F extends v {
|
|
@@ -367,48 +372,48 @@ function W(i, e = []) {
|
|
|
367
372
|
const J = () => window.crypto, N = () => {
|
|
368
373
|
const i = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";
|
|
369
374
|
let e = "";
|
|
370
|
-
return Array.from(J().getRandomValues(new Uint8Array(43))).forEach((t) => e += i[t % i.length]), e;
|
|
371
|
-
}, G = (i) => btoa(i),
|
|
372
|
-
const
|
|
373
|
-
return
|
|
374
|
-
}, {}), B = (i) => {
|
|
375
|
+
return Array.from(J().getRandomValues(new Uint8Array(43))).forEach(((t) => e += i[t % i.length])), e;
|
|
376
|
+
}, G = (i) => btoa(i), xe = [{ key: "name", type: ["string"] }, { key: "version", type: ["string", "number"] }, { key: "env", type: ["object"] }], ze = (i) => Object.keys(i).reduce(((e, t) => {
|
|
377
|
+
const n = xe.find(((o) => o.key === t));
|
|
378
|
+
return n && n.type.includes(typeof i[t]) && (e[t] = i[t]), e;
|
|
379
|
+
}), {}), B = (i) => {
|
|
375
380
|
var { clientId: e } = i, t = I(i, ["clientId"]);
|
|
376
|
-
return new URLSearchParams(((
|
|
377
|
-
},
|
|
381
|
+
return new URLSearchParams(((n) => Object.keys(n).filter(((o) => n[o] !== void 0)).reduce(((o, r) => Object.assign(Object.assign({}, o), { [r]: n[r] })), {}))(Object.assign({ client_id: e }, t))).toString();
|
|
382
|
+
}, ue = async (i) => await J().subtle.digest({ name: "SHA-256" }, new TextEncoder().encode(i)), he = (i) => ((e) => decodeURIComponent(atob(e).split("").map(((t) => "%" + ("00" + t.charCodeAt(0).toString(16)).slice(-2))).join("")))(i.replace(/_/g, "/").replace(/-/g, "+")), de = (i) => {
|
|
378
383
|
const e = new Uint8Array(i);
|
|
379
384
|
return ((t) => {
|
|
380
|
-
const
|
|
381
|
-
return t.replace(/[+/=]/g, (
|
|
385
|
+
const n = { "+": "-", "/": "_", "=": "" };
|
|
386
|
+
return t.replace(/[+/=]/g, ((o) => n[o]));
|
|
382
387
|
})(window.btoa(String.fromCharCode(...Array.from(e))));
|
|
383
|
-
}, Ee = new TextEncoder(),
|
|
388
|
+
}, Ee = new TextEncoder(), Ne = new TextDecoder();
|
|
384
389
|
function D(i) {
|
|
385
|
-
return typeof i == "string" ? Ee.encode(i) :
|
|
390
|
+
return typeof i == "string" ? Ee.encode(i) : Ne.decode(i);
|
|
386
391
|
}
|
|
387
|
-
function
|
|
388
|
-
if (typeof i.modulusLength != "number" || i.modulusLength < 2048) throw new
|
|
392
|
+
function le(i) {
|
|
393
|
+
if (typeof i.modulusLength != "number" || i.modulusLength < 2048) throw new De(`${i.name} modulusLength must be at least 2048 bits`);
|
|
389
394
|
}
|
|
390
|
-
async function
|
|
395
|
+
async function Re(i, e, t) {
|
|
391
396
|
if (t.usages.includes("sign") === !1) throw new TypeError('private CryptoKey instances used for signing assertions must include "sign" in their "usages"');
|
|
392
|
-
const
|
|
393
|
-
return `${
|
|
394
|
-
switch (
|
|
397
|
+
const n = `${A(D(JSON.stringify(i)))}.${A(D(JSON.stringify(e)))}`;
|
|
398
|
+
return `${n}.${A(await crypto.subtle.sign((function(o) {
|
|
399
|
+
switch (o.algorithm.name) {
|
|
395
400
|
case "ECDSA":
|
|
396
|
-
return { name:
|
|
401
|
+
return { name: o.algorithm.name, hash: "SHA-256" };
|
|
397
402
|
case "RSA-PSS":
|
|
398
|
-
return
|
|
403
|
+
return le(o.algorithm), { name: o.algorithm.name, saltLength: 32 };
|
|
399
404
|
case "RSASSA-PKCS1-v1_5":
|
|
400
|
-
return
|
|
405
|
+
return le(o.algorithm), { name: o.algorithm.name };
|
|
401
406
|
case "Ed25519":
|
|
402
|
-
return { name:
|
|
407
|
+
return { name: o.algorithm.name };
|
|
403
408
|
}
|
|
404
409
|
throw new K();
|
|
405
|
-
}(t), t, D(
|
|
410
|
+
})(t), t, D(n)))}`;
|
|
406
411
|
}
|
|
407
412
|
let q;
|
|
408
413
|
Uint8Array.prototype.toBase64 ? q = (i) => (i instanceof ArrayBuffer && (i = new Uint8Array(i)), i.toBase64({ alphabet: "base64url", omitPadding: !0 })) : q = (e) => {
|
|
409
414
|
e instanceof ArrayBuffer && (e = new Uint8Array(e));
|
|
410
415
|
const t = [];
|
|
411
|
-
for (let
|
|
416
|
+
for (let n = 0; n < e.byteLength; n += 32768) t.push(String.fromCharCode.apply(null, e.subarray(n, n + 32768)));
|
|
412
417
|
return btoa(t.join("")).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
413
418
|
};
|
|
414
419
|
function A(i) {
|
|
@@ -420,142 +425,142 @@ class K extends Error {
|
|
|
420
425
|
super(e ?? "operation not supported"), this.name = this.constructor.name, (t = Error.captureStackTrace) === null || t === void 0 || t.call(Error, this, this.constructor);
|
|
421
426
|
}
|
|
422
427
|
}
|
|
423
|
-
class
|
|
428
|
+
class De extends Error {
|
|
424
429
|
constructor(e) {
|
|
425
430
|
var t;
|
|
426
431
|
super(e), this.name = this.constructor.name, (t = Error.captureStackTrace) === null || t === void 0 || t.call(Error, this, this.constructor);
|
|
427
432
|
}
|
|
428
433
|
}
|
|
429
|
-
function
|
|
434
|
+
function Ae(i) {
|
|
430
435
|
switch (i.algorithm.name) {
|
|
431
436
|
case "RSA-PSS":
|
|
432
|
-
return function(e) {
|
|
437
|
+
return (function(e) {
|
|
433
438
|
if (e.algorithm.hash.name === "SHA-256") return "PS256";
|
|
434
439
|
throw new K("unsupported RsaHashedKeyAlgorithm hash name");
|
|
435
|
-
}(i);
|
|
440
|
+
})(i);
|
|
436
441
|
case "RSASSA-PKCS1-v1_5":
|
|
437
|
-
return function(e) {
|
|
442
|
+
return (function(e) {
|
|
438
443
|
if (e.algorithm.hash.name === "SHA-256") return "RS256";
|
|
439
444
|
throw new K("unsupported RsaHashedKeyAlgorithm hash name");
|
|
440
|
-
}(i);
|
|
445
|
+
})(i);
|
|
441
446
|
case "ECDSA":
|
|
442
|
-
return function(e) {
|
|
447
|
+
return (function(e) {
|
|
443
448
|
if (e.algorithm.namedCurve === "P-256") return "ES256";
|
|
444
449
|
throw new K("unsupported EcKeyAlgorithm namedCurve");
|
|
445
|
-
}(i);
|
|
450
|
+
})(i);
|
|
446
451
|
case "Ed25519":
|
|
447
452
|
return "Ed25519";
|
|
448
453
|
default:
|
|
449
454
|
throw new K("unsupported CryptoKey algorithm name");
|
|
450
455
|
}
|
|
451
456
|
}
|
|
452
|
-
function
|
|
457
|
+
function ve(i) {
|
|
453
458
|
return i instanceof CryptoKey;
|
|
454
459
|
}
|
|
455
|
-
function
|
|
456
|
-
return
|
|
460
|
+
function _e(i) {
|
|
461
|
+
return ve(i) && i.type === "public";
|
|
457
462
|
}
|
|
458
|
-
async function
|
|
463
|
+
async function Ue(i, e, t, n, o, r) {
|
|
459
464
|
const a = i == null ? void 0 : i.privateKey, h = i == null ? void 0 : i.publicKey;
|
|
460
|
-
if (!
|
|
465
|
+
if (!ve(u = a) || u.type !== "private") throw new TypeError('"keypair.privateKey" must be a private CryptoKey');
|
|
461
466
|
var u;
|
|
462
|
-
if (!
|
|
467
|
+
if (!_e(h)) throw new TypeError('"keypair.publicKey" must be a public CryptoKey');
|
|
463
468
|
if (h.extractable !== !0) throw new TypeError('"keypair.publicKey.extractable" must be true');
|
|
464
469
|
if (typeof e != "string") throw new TypeError('"htu" must be a string');
|
|
465
470
|
if (typeof t != "string") throw new TypeError('"htm" must be a string');
|
|
466
|
-
if (
|
|
467
|
-
if (
|
|
468
|
-
return
|
|
471
|
+
if (n !== void 0 && typeof n != "string") throw new TypeError('"nonce" must be a string or undefined');
|
|
472
|
+
if (o !== void 0 && typeof o != "string") throw new TypeError('"accessToken" must be a string or undefined');
|
|
473
|
+
return Re({ alg: Ae(a), typ: "dpop+jwt", jwk: await Se(h) }, Object.assign(Object.assign({}, r), { iat: Math.floor(Date.now() / 1e3), jti: crypto.randomUUID(), htm: t, nonce: n, htu: e, ath: o ? A(await crypto.subtle.digest("SHA-256", D(o))) : void 0 }), a);
|
|
469
474
|
}
|
|
470
|
-
async function
|
|
471
|
-
const { kty: e, e: t, n
|
|
472
|
-
return { kty: e, crv: a, e: t, n
|
|
475
|
+
async function Se(i) {
|
|
476
|
+
const { kty: e, e: t, n, x: o, y: r, crv: a } = await crypto.subtle.exportKey("jwk", i);
|
|
477
|
+
return { kty: e, crv: a, e: t, n, x: o, y: r };
|
|
473
478
|
}
|
|
474
|
-
const
|
|
475
|
-
function
|
|
476
|
-
return async function(i, e) {
|
|
479
|
+
const Le = ["authorization_code", "refresh_token", "urn:ietf:params:oauth:grant-type:token-exchange"];
|
|
480
|
+
function Ze() {
|
|
481
|
+
return (async function(i, e) {
|
|
477
482
|
var t;
|
|
478
|
-
let
|
|
483
|
+
let n;
|
|
479
484
|
if (i.length === 0) throw new TypeError('"alg" must be a non-empty string');
|
|
480
485
|
switch (i) {
|
|
481
486
|
case "PS256":
|
|
482
|
-
|
|
487
|
+
n = { name: "RSA-PSS", hash: "SHA-256", modulusLength: 2048, publicExponent: new Uint8Array([1, 0, 1]) };
|
|
483
488
|
break;
|
|
484
489
|
case "RS256":
|
|
485
|
-
|
|
490
|
+
n = { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256", modulusLength: 2048, publicExponent: new Uint8Array([1, 0, 1]) };
|
|
486
491
|
break;
|
|
487
492
|
case "ES256":
|
|
488
|
-
|
|
493
|
+
n = { name: "ECDSA", namedCurve: "P-256" };
|
|
489
494
|
break;
|
|
490
495
|
case "Ed25519":
|
|
491
|
-
|
|
496
|
+
n = { name: "Ed25519" };
|
|
492
497
|
break;
|
|
493
498
|
default:
|
|
494
499
|
throw new K();
|
|
495
500
|
}
|
|
496
|
-
return crypto.subtle.generateKey(
|
|
497
|
-
}("ES256", { extractable: !1 });
|
|
501
|
+
return crypto.subtle.generateKey(n, (t = e == null ? void 0 : e.extractable) !== null && t !== void 0 && t, ["sign", "verify"]);
|
|
502
|
+
})("ES256", { extractable: !1 });
|
|
498
503
|
}
|
|
499
|
-
function
|
|
500
|
-
return async function(e) {
|
|
501
|
-
if (!
|
|
504
|
+
function He(i) {
|
|
505
|
+
return (async function(e) {
|
|
506
|
+
if (!_e(e)) throw new TypeError('"publicKey" must be a public CryptoKey');
|
|
502
507
|
if (e.extractable !== !0) throw new TypeError('"publicKey.extractable" must be true');
|
|
503
|
-
const t = await
|
|
504
|
-
let
|
|
508
|
+
const t = await Se(e);
|
|
509
|
+
let n;
|
|
505
510
|
switch (t.kty) {
|
|
506
511
|
case "EC":
|
|
507
|
-
|
|
512
|
+
n = { crv: t.crv, kty: t.kty, x: t.x, y: t.y };
|
|
508
513
|
break;
|
|
509
514
|
case "OKP":
|
|
510
|
-
|
|
515
|
+
n = { crv: t.crv, kty: t.kty, x: t.x };
|
|
511
516
|
break;
|
|
512
517
|
case "RSA":
|
|
513
|
-
|
|
518
|
+
n = { e: t.e, kty: t.kty, n: t.n };
|
|
514
519
|
break;
|
|
515
520
|
default:
|
|
516
521
|
throw new K("unsupported JWK kty");
|
|
517
522
|
}
|
|
518
|
-
return A(await crypto.subtle.digest({ name: "SHA-256" }, D(JSON.stringify(
|
|
519
|
-
}(i.publicKey);
|
|
523
|
+
return A(await crypto.subtle.digest({ name: "SHA-256" }, D(JSON.stringify(n))));
|
|
524
|
+
})(i.publicKey);
|
|
520
525
|
}
|
|
521
|
-
function
|
|
522
|
-
const r = function(a) {
|
|
526
|
+
function We({ keyPair: i, url: e, method: t, nonce: n, accessToken: o }) {
|
|
527
|
+
const r = (function(a) {
|
|
523
528
|
const h = new URL(a);
|
|
524
529
|
return h.search = "", h.hash = "", h.href;
|
|
525
|
-
}(e);
|
|
526
|
-
return
|
|
530
|
+
})(e);
|
|
531
|
+
return Ue(i, r, t, n, o);
|
|
527
532
|
}
|
|
528
|
-
const
|
|
533
|
+
const Je = async (i, e) => {
|
|
529
534
|
const t = await fetch(i, e);
|
|
530
|
-
return { ok: t.ok, json: await t.json(), headers: (
|
|
531
|
-
var
|
|
532
|
-
},
|
|
533
|
-
const
|
|
534
|
-
let
|
|
535
|
-
return e.signal =
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
}, t);
|
|
539
|
-
})]).finally(() => {
|
|
540
|
-
clearTimeout(
|
|
541
|
-
});
|
|
542
|
-
},
|
|
543
|
-
return u = { auth: { audience: e, scope: t }, timeout:
|
|
535
|
+
return { ok: t.ok, json: await t.json(), headers: (n = t.headers, [...n].reduce(((o, [r, a]) => (o[r] = a, o)), {})) };
|
|
536
|
+
var n;
|
|
537
|
+
}, Xe = async (i, e, t) => {
|
|
538
|
+
const n = new AbortController();
|
|
539
|
+
let o;
|
|
540
|
+
return e.signal = n.signal, Promise.race([Je(i, e), new Promise(((r, a) => {
|
|
541
|
+
o = setTimeout((() => {
|
|
542
|
+
n.abort(), a(new Error("Timeout when executing 'fetch'"));
|
|
543
|
+
}), t);
|
|
544
|
+
}))]).finally((() => {
|
|
545
|
+
clearTimeout(o);
|
|
546
|
+
}));
|
|
547
|
+
}, Ve = async (i, e, t, n, o, r, a, h) => {
|
|
548
|
+
return u = { auth: { audience: e, scope: t }, timeout: o, fetchUrl: i, fetchOptions: n, useFormData: a, useMrrt: h }, p = r, new Promise((function(s, c) {
|
|
544
549
|
const d = new MessageChannel();
|
|
545
550
|
d.port1.onmessage = function(l) {
|
|
546
551
|
l.data.error ? c(new Error(l.data.error)) : s(l.data), d.port1.close();
|
|
547
552
|
}, p.postMessage(u, [d.port2]);
|
|
548
|
-
});
|
|
553
|
+
}));
|
|
549
554
|
var u, p;
|
|
550
|
-
},
|
|
551
|
-
async function
|
|
555
|
+
}, Fe = async (i, e, t, n, o, r, a = 1e4, h) => o ? Ve(i, e, t, n, a, o, r, h) : Xe(i, n, a);
|
|
556
|
+
async function Ie(i, e, t, n, o, r, a, h, u, p) {
|
|
552
557
|
if (u) {
|
|
553
|
-
const w = await u.generateProof({ url: i, method:
|
|
554
|
-
|
|
558
|
+
const w = await u.generateProof({ url: i, method: o.method || "GET", nonce: await u.getNonce() });
|
|
559
|
+
o.headers = Object.assign(Object.assign({}, o.headers), { dpop: w });
|
|
555
560
|
}
|
|
556
561
|
let s, c = null;
|
|
557
562
|
for (let w = 0; w < 3; w++) try {
|
|
558
|
-
s = await
|
|
563
|
+
s = await Fe(i, t, n, o, r, a, e, h), c = null;
|
|
559
564
|
break;
|
|
560
565
|
} catch (f) {
|
|
561
566
|
c = f;
|
|
@@ -565,46 +570,46 @@ async function Se(i, e, t, o, n, r, a, h, u, p) {
|
|
|
565
570
|
let b;
|
|
566
571
|
if (u && (b = g["dpop-nonce"], b && await u.setNonce(b)), !k) {
|
|
567
572
|
const w = m || `HTTP error. Unable to fetch ${i}`;
|
|
568
|
-
if (l === "mfa_required") throw new
|
|
569
|
-
if (l === "missing_refresh_token") throw new V(t,
|
|
573
|
+
if (l === "mfa_required") throw new se(l, w, y.mfa_token);
|
|
574
|
+
if (l === "missing_refresh_token") throw new V(t, n);
|
|
570
575
|
if (l === "use_dpop_nonce") {
|
|
571
576
|
if (!u || !b || p) throw new F(b);
|
|
572
|
-
return
|
|
577
|
+
return Ie(i, e, t, n, o, r, a, h, u, !0);
|
|
573
578
|
}
|
|
574
579
|
throw new v(l || "request_error", w);
|
|
575
580
|
}
|
|
576
581
|
return y;
|
|
577
582
|
}
|
|
578
|
-
async function
|
|
579
|
-
var { baseUrl: t, timeout:
|
|
580
|
-
const c = s.grant_type === "urn:ietf:params:oauth:grant-type:token-exchange", d = s.grant_type === "refresh_token" && u, l = Object.assign(Object.assign(Object.assign(Object.assign({}, s), c &&
|
|
583
|
+
async function Ge(i, e) {
|
|
584
|
+
var { baseUrl: t, timeout: n, audience: o, scope: r, auth0Client: a, useFormData: h, useMrrt: u, dpop: p } = i, s = I(i, ["baseUrl", "timeout", "audience", "scope", "auth0Client", "useFormData", "useMrrt", "dpop"]);
|
|
585
|
+
const c = s.grant_type === "urn:ietf:params:oauth:grant-type:token-exchange", d = s.grant_type === "refresh_token" && u, l = Object.assign(Object.assign(Object.assign(Object.assign({}, s), c && o && { audience: o }), c && r && { scope: r }), d && { audience: o, scope: r }), m = h ? B(l) : JSON.stringify(l), y = (g = s.grant_type, Le.includes(g));
|
|
581
586
|
var g;
|
|
582
|
-
return await
|
|
587
|
+
return await Ie(`${t}/oauth/token`, n, o || "default", r, { method: "POST", body: m, headers: { "Content-Type": h ? "application/x-www-form-urlencoded" : "application/json", "Auth0-Client": btoa(JSON.stringify(ze(a || be))) } }, e, h, u, y ? p : void 0);
|
|
583
588
|
}
|
|
584
589
|
const H = (...i) => {
|
|
585
590
|
return (e = i.filter(Boolean).join(" ").trim().split(/\s+/), Array.from(new Set(e))).join(" ");
|
|
586
591
|
var e;
|
|
587
592
|
}, Z = (i, e, t) => {
|
|
588
|
-
let
|
|
589
|
-
return t && (
|
|
593
|
+
let n;
|
|
594
|
+
return t && (n = i[t]), n || (n = i.default), H(n, e);
|
|
590
595
|
};
|
|
591
596
|
class _ {
|
|
592
|
-
constructor(e, t = "@@auth0spajs@@",
|
|
593
|
-
this.prefix = t, this.suffix =
|
|
597
|
+
constructor(e, t = "@@auth0spajs@@", n) {
|
|
598
|
+
this.prefix = t, this.suffix = n, this.clientId = e.clientId, this.scope = e.scope, this.audience = e.audience;
|
|
594
599
|
}
|
|
595
600
|
toKey() {
|
|
596
601
|
return [this.prefix, this.clientId, this.audience, this.scope, this.suffix].filter(Boolean).join("::");
|
|
597
602
|
}
|
|
598
603
|
static fromKey(e) {
|
|
599
|
-
const [t,
|
|
600
|
-
return new _({ clientId:
|
|
604
|
+
const [t, n, o, r] = e.split("::");
|
|
605
|
+
return new _({ clientId: n, scope: r, audience: o }, t);
|
|
601
606
|
}
|
|
602
607
|
static fromCacheEntry(e) {
|
|
603
|
-
const { scope: t, audience:
|
|
604
|
-
return new _({ scope: t, audience:
|
|
608
|
+
const { scope: t, audience: n, client_id: o } = e;
|
|
609
|
+
return new _({ scope: t, audience: n, clientId: o });
|
|
605
610
|
}
|
|
606
611
|
}
|
|
607
|
-
class
|
|
612
|
+
class Me {
|
|
608
613
|
set(e, t) {
|
|
609
614
|
localStorage.setItem(e, JSON.stringify(t));
|
|
610
615
|
}
|
|
@@ -620,49 +625,49 @@ class Ge {
|
|
|
620
625
|
localStorage.removeItem(e);
|
|
621
626
|
}
|
|
622
627
|
allKeys() {
|
|
623
|
-
return Object.keys(window.localStorage).filter((e) => e.startsWith("@@auth0spajs@@"));
|
|
628
|
+
return Object.keys(window.localStorage).filter(((e) => e.startsWith("@@auth0spajs@@")));
|
|
624
629
|
}
|
|
625
630
|
}
|
|
626
|
-
class
|
|
631
|
+
class Pe {
|
|
627
632
|
constructor() {
|
|
628
|
-
this.enclosedCache = /* @__PURE__ */ function() {
|
|
633
|
+
this.enclosedCache = /* @__PURE__ */ (function() {
|
|
629
634
|
let e = {};
|
|
630
|
-
return { set(t,
|
|
631
|
-
e[t] =
|
|
635
|
+
return { set(t, n) {
|
|
636
|
+
e[t] = n;
|
|
632
637
|
}, get(t) {
|
|
633
|
-
const
|
|
634
|
-
if (
|
|
638
|
+
const n = e[t];
|
|
639
|
+
if (n) return n;
|
|
635
640
|
}, remove(t) {
|
|
636
641
|
delete e[t];
|
|
637
642
|
}, allKeys: () => Object.keys(e) };
|
|
638
|
-
}();
|
|
643
|
+
})();
|
|
639
644
|
}
|
|
640
645
|
}
|
|
641
|
-
class
|
|
642
|
-
constructor(e, t,
|
|
643
|
-
this.cache = e, this.keyManifest = t, this.nowProvider =
|
|
646
|
+
class Ye {
|
|
647
|
+
constructor(e, t, n) {
|
|
648
|
+
this.cache = e, this.keyManifest = t, this.nowProvider = n || ke;
|
|
644
649
|
}
|
|
645
|
-
async setIdToken(e, t,
|
|
646
|
-
var
|
|
650
|
+
async setIdToken(e, t, n) {
|
|
651
|
+
var o;
|
|
647
652
|
const r = this.getIdTokenCacheKey(e);
|
|
648
|
-
await this.cache.set(r, { id_token: t, decodedToken:
|
|
653
|
+
await this.cache.set(r, { id_token: t, decodedToken: n }), await ((o = this.keyManifest) === null || o === void 0 ? void 0 : o.add(r));
|
|
649
654
|
}
|
|
650
655
|
async getIdToken(e) {
|
|
651
656
|
const t = await this.cache.get(this.getIdTokenCacheKey(e.clientId));
|
|
652
657
|
if (!t && e.scope && e.audience) {
|
|
653
|
-
const
|
|
654
|
-
return !
|
|
658
|
+
const n = await this.get(e);
|
|
659
|
+
return !n || !n.id_token || !n.decodedToken ? void 0 : { id_token: n.id_token, decodedToken: n.decodedToken };
|
|
655
660
|
}
|
|
656
661
|
if (t) return { id_token: t.id_token, decodedToken: t.decodedToken };
|
|
657
662
|
}
|
|
658
|
-
async get(e, t = 0,
|
|
663
|
+
async get(e, t = 0, n = !1, o) {
|
|
659
664
|
var r;
|
|
660
665
|
let a = await this.cache.get(e.toKey());
|
|
661
666
|
if (!a) {
|
|
662
667
|
const p = await this.getCacheKeys();
|
|
663
668
|
if (!p) return;
|
|
664
669
|
const s = this.matchExistingCacheKey(e, p);
|
|
665
|
-
if (s && (a = await this.cache.get(s)), !s &&
|
|
670
|
+
if (s && (a = await this.cache.get(s)), !s && n && o !== "cache-only") return this.getEntryWithRefreshToken(e, p);
|
|
666
671
|
}
|
|
667
672
|
if (!a) return;
|
|
668
673
|
const h = await this.nowProvider(), u = Math.floor(h / 1e3);
|
|
@@ -673,19 +678,19 @@ class Me {
|
|
|
673
678
|
}
|
|
674
679
|
async set(e) {
|
|
675
680
|
var t;
|
|
676
|
-
const
|
|
677
|
-
await this.cache.set(
|
|
681
|
+
const n = new _({ clientId: e.client_id, scope: e.scope, audience: e.audience }), o = await this.wrapCacheEntry(e);
|
|
682
|
+
await this.cache.set(n.toKey(), o), await ((t = this.keyManifest) === null || t === void 0 ? void 0 : t.add(n.toKey()));
|
|
678
683
|
}
|
|
679
|
-
async remove(e, t,
|
|
680
|
-
const
|
|
681
|
-
await this.cache.remove(
|
|
684
|
+
async remove(e, t, n) {
|
|
685
|
+
const o = new _({ clientId: e, scope: n, audience: t });
|
|
686
|
+
await this.cache.remove(o.toKey());
|
|
682
687
|
}
|
|
683
688
|
async clear(e) {
|
|
684
689
|
var t;
|
|
685
|
-
const
|
|
686
|
-
|
|
687
|
-
await
|
|
688
|
-
}, Promise.resolve()), await ((t = this.keyManifest) === null || t === void 0 ? void 0 : t.clear()));
|
|
690
|
+
const n = await this.getCacheKeys();
|
|
691
|
+
n && (await n.filter(((o) => !e || o.includes(e))).reduce((async (o, r) => {
|
|
692
|
+
await o, await this.cache.remove(r);
|
|
693
|
+
}), Promise.resolve()), await ((t = this.keyManifest) === null || t === void 0 ? void 0 : t.clear()));
|
|
689
694
|
}
|
|
690
695
|
async wrapCacheEntry(e) {
|
|
691
696
|
const t = await this.nowProvider();
|
|
@@ -699,37 +704,37 @@ class Me {
|
|
|
699
704
|
return new _({ clientId: e }, "@@auth0spajs@@", "@@user@@").toKey();
|
|
700
705
|
}
|
|
701
706
|
matchExistingCacheKey(e, t) {
|
|
702
|
-
return t.filter((
|
|
703
|
-
var
|
|
704
|
-
const r = _.fromKey(
|
|
707
|
+
return t.filter(((n) => {
|
|
708
|
+
var o;
|
|
709
|
+
const r = _.fromKey(n), a = new Set(r.scope && r.scope.split(" ")), h = ((o = e.scope) === null || o === void 0 ? void 0 : o.split(" ")) || [], u = r.scope && h.reduce(((p, s) => p && a.has(s)), !0);
|
|
705
710
|
return r.prefix === "@@auth0spajs@@" && r.clientId === e.clientId && r.audience === e.audience && u;
|
|
706
|
-
})[0];
|
|
711
|
+
}))[0];
|
|
707
712
|
}
|
|
708
713
|
async getEntryWithRefreshToken(e, t) {
|
|
709
|
-
var
|
|
710
|
-
for (const
|
|
711
|
-
const r = _.fromKey(
|
|
714
|
+
var n;
|
|
715
|
+
for (const o of t) {
|
|
716
|
+
const r = _.fromKey(o);
|
|
712
717
|
if (r.prefix === "@@auth0spajs@@" && r.clientId === e.clientId) {
|
|
713
|
-
const a = await this.cache.get(
|
|
714
|
-
if (!((
|
|
718
|
+
const a = await this.cache.get(o);
|
|
719
|
+
if (!((n = a == null ? void 0 : a.body) === null || n === void 0) && n.refresh_token) return this.modifiedCachedEntry(a, e);
|
|
715
720
|
}
|
|
716
721
|
}
|
|
717
722
|
}
|
|
718
723
|
async updateEntry(e, t) {
|
|
719
|
-
var
|
|
720
|
-
const
|
|
721
|
-
if (
|
|
724
|
+
var n;
|
|
725
|
+
const o = await this.getCacheKeys();
|
|
726
|
+
if (o) for (const r of o) {
|
|
722
727
|
const a = await this.cache.get(r);
|
|
723
|
-
if (((
|
|
728
|
+
if (((n = a == null ? void 0 : a.body) === null || n === void 0 ? void 0 : n.refresh_token) === e) {
|
|
724
729
|
const h = Object.assign(Object.assign({}, a.body), { refresh_token: t });
|
|
725
730
|
await this.set(h);
|
|
726
731
|
}
|
|
727
732
|
}
|
|
728
733
|
}
|
|
729
734
|
}
|
|
730
|
-
class
|
|
731
|
-
constructor(e, t,
|
|
732
|
-
this.storage = e, this.clientId = t, this.cookieDomain =
|
|
735
|
+
class $e {
|
|
736
|
+
constructor(e, t, n) {
|
|
737
|
+
this.storage = e, this.clientId = t, this.cookieDomain = n, this.storageKey = `a0.spajs.txs.${this.clientId}`;
|
|
733
738
|
}
|
|
734
739
|
create(e) {
|
|
735
740
|
this.storage.save(this.storageKey, e, { daysUntilExpire: 1, cookieDomain: this.cookieDomain });
|
|
@@ -741,15 +746,15 @@ class Ye {
|
|
|
741
746
|
this.storage.remove(this.storageKey, { cookieDomain: this.cookieDomain });
|
|
742
747
|
}
|
|
743
748
|
}
|
|
744
|
-
const R = (i) => typeof i == "number",
|
|
749
|
+
const R = (i) => typeof i == "number", Be = ["iss", "aud", "exp", "nbf", "iat", "jti", "azp", "nonce", "auth_time", "at_hash", "c_hash", "acr", "amr", "sub_jwk", "cnf", "sip_from_tag", "sip_date", "sip_callid", "sip_cseq_num", "sip_via_branch", "orig", "dest", "mky", "events", "toe", "txn", "rph", "sid", "vot", "vtm"], qe = (i) => {
|
|
745
750
|
if (!i.id_token) throw new Error("ID token is required but missing");
|
|
746
751
|
const e = ((r) => {
|
|
747
752
|
const a = r.split("."), [h, u, p] = a;
|
|
748
753
|
if (a.length !== 3 || !h || !u || !p) throw new Error("ID token could not be decoded");
|
|
749
|
-
const s = JSON.parse(
|
|
750
|
-
return Object.keys(s).forEach((l) => {
|
|
751
|
-
c[l] = s[l],
|
|
752
|
-
}), { encoded: { header: h, payload: u, signature: p }, header: JSON.parse(
|
|
754
|
+
const s = JSON.parse(he(u)), c = { __raw: r }, d = {};
|
|
755
|
+
return Object.keys(s).forEach(((l) => {
|
|
756
|
+
c[l] = s[l], Be.includes(l) || (d[l] = s[l]);
|
|
757
|
+
})), { encoded: { header: h, payload: u, signature: p }, header: JSON.parse(he(h)), claims: c, user: d };
|
|
753
758
|
})(i.id_token);
|
|
754
759
|
if (!e.claims.iss) throw new Error("Issuer (iss) claim must be a string present in the ID token");
|
|
755
760
|
if (e.claims.iss !== i.iss) throw new Error(`Issuer (iss) claim mismatch in the ID token; expected "${i.iss}", found "${e.claims.iss}"`);
|
|
@@ -770,15 +775,15 @@ const R = (i) => typeof i == "number", $e = ["iss", "aud", "exp", "nbf", "iat",
|
|
|
770
775
|
if (i.max_age && !R(e.claims.auth_time)) throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");
|
|
771
776
|
if (e.claims.exp == null || !R(e.claims.exp)) throw new Error("Expiration Time (exp) claim must be a number present in the ID token");
|
|
772
777
|
if (!R(e.claims.iat)) throw new Error("Issued At (iat) claim must be a number present in the ID token");
|
|
773
|
-
const t = i.leeway || 60,
|
|
774
|
-
if (
|
|
778
|
+
const t = i.leeway || 60, n = new Date(i.now || Date.now()), o = /* @__PURE__ */ new Date(0);
|
|
779
|
+
if (o.setUTCSeconds(e.claims.exp + t), n > o) throw new Error(`Expiration Time (exp) claim error in the ID token; current time (${n}) is after expiration time (${o})`);
|
|
775
780
|
if (e.claims.nbf != null && R(e.claims.nbf)) {
|
|
776
781
|
const r = /* @__PURE__ */ new Date(0);
|
|
777
|
-
if (r.setUTCSeconds(e.claims.nbf - t),
|
|
782
|
+
if (r.setUTCSeconds(e.claims.nbf - t), n < r) throw new Error(`Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (${n}) is before ${r}`);
|
|
778
783
|
}
|
|
779
784
|
if (e.claims.auth_time != null && R(e.claims.auth_time)) {
|
|
780
785
|
const r = /* @__PURE__ */ new Date(0);
|
|
781
|
-
if (r.setUTCSeconds(parseInt(e.claims.auth_time) + i.max_age + t),
|
|
786
|
+
if (r.setUTCSeconds(parseInt(e.claims.auth_time) + i.max_age + t), n > r) throw new Error(`Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (${n}) is after last auth at ${r}`);
|
|
782
787
|
}
|
|
783
788
|
if (i.organization) {
|
|
784
789
|
const r = i.organization.trim();
|
|
@@ -794,26 +799,26 @@ const R = (i) => typeof i == "number", $e = ["iss", "aud", "exp", "nbf", "iat",
|
|
|
794
799
|
}
|
|
795
800
|
return e;
|
|
796
801
|
};
|
|
797
|
-
var x = ee(function(i, e) {
|
|
802
|
+
var x = ee((function(i, e) {
|
|
798
803
|
var t = C && C.__assign || function() {
|
|
799
804
|
return t = Object.assign || function(u) {
|
|
800
805
|
for (var p, s = 1, c = arguments.length; s < c; s++) for (var d in p = arguments[s]) Object.prototype.hasOwnProperty.call(p, d) && (u[d] = p[d]);
|
|
801
806
|
return u;
|
|
802
807
|
}, t.apply(this, arguments);
|
|
803
808
|
};
|
|
804
|
-
function
|
|
809
|
+
function n(u, p) {
|
|
805
810
|
if (!p) return "";
|
|
806
811
|
var s = "; " + u;
|
|
807
812
|
return p === !0 ? s : s + "=" + p;
|
|
808
813
|
}
|
|
809
|
-
function
|
|
810
|
-
return encodeURIComponent(u).replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent).replace(/\(/g, "%28").replace(/\)/g, "%29") + "=" + encodeURIComponent(p).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent) + function(c) {
|
|
814
|
+
function o(u, p, s) {
|
|
815
|
+
return encodeURIComponent(u).replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent).replace(/\(/g, "%28").replace(/\)/g, "%29") + "=" + encodeURIComponent(p).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent) + (function(c) {
|
|
811
816
|
if (typeof c.expires == "number") {
|
|
812
817
|
var d = /* @__PURE__ */ new Date();
|
|
813
818
|
d.setMilliseconds(d.getMilliseconds() + 864e5 * c.expires), c.expires = d;
|
|
814
819
|
}
|
|
815
|
-
return
|
|
816
|
-
}(s);
|
|
820
|
+
return n("Expires", c.expires ? c.expires.toUTCString() : "") + n("Domain", c.domain) + n("Path", c.path) + n("Secure", c.secure) + n("SameSite", c.sameSite);
|
|
821
|
+
})(s);
|
|
817
822
|
}
|
|
818
823
|
function r(u) {
|
|
819
824
|
for (var p = {}, s = u ? u.split("; ") : [], c = /(%[\dA-F]{2})+/gi, d = 0; d < s.length; d++) {
|
|
@@ -830,34 +835,34 @@ var x = ee(function(i, e) {
|
|
|
830
835
|
return r(document.cookie);
|
|
831
836
|
}
|
|
832
837
|
function h(u, p, s) {
|
|
833
|
-
document.cookie =
|
|
838
|
+
document.cookie = o(u, p, t({ path: "/" }, s));
|
|
834
839
|
}
|
|
835
|
-
e.__esModule = !0, e.encode =
|
|
840
|
+
e.__esModule = !0, e.encode = o, e.parse = r, e.getAll = a, e.get = function(u) {
|
|
836
841
|
return a()[u];
|
|
837
842
|
}, e.set = h, e.remove = function(u, p) {
|
|
838
843
|
h(u, "", t(t({}, p), { expires: -1 }));
|
|
839
844
|
};
|
|
840
|
-
});
|
|
845
|
+
}));
|
|
841
846
|
Q(x), x.encode, x.parse, x.getAll;
|
|
842
|
-
var
|
|
843
|
-
const
|
|
844
|
-
const e =
|
|
847
|
+
var Qe = x.get, Te = x.set, Oe = x.remove;
|
|
848
|
+
const z = { get(i) {
|
|
849
|
+
const e = Qe(i);
|
|
845
850
|
if (e !== void 0) return JSON.parse(e);
|
|
846
851
|
}, save(i, e, t) {
|
|
847
|
-
let
|
|
848
|
-
window.location.protocol === "https:" && (
|
|
852
|
+
let n = {};
|
|
853
|
+
window.location.protocol === "https:" && (n = { secure: !0, sameSite: "none" }), t != null && t.daysUntilExpire && (n.expires = t.daysUntilExpire), t != null && t.cookieDomain && (n.domain = t.cookieDomain), Te(i, JSON.stringify(e), n);
|
|
849
854
|
}, remove(i, e) {
|
|
850
855
|
let t = {};
|
|
851
|
-
e != null && e.cookieDomain && (t.domain = e.cookieDomain),
|
|
852
|
-
} },
|
|
853
|
-
return
|
|
856
|
+
e != null && e.cookieDomain && (t.domain = e.cookieDomain), Oe(i, t);
|
|
857
|
+
} }, et = { get(i) {
|
|
858
|
+
return z.get(i) || z.get(`_legacy_${i}`);
|
|
854
859
|
}, save(i, e, t) {
|
|
855
|
-
let
|
|
856
|
-
window.location.protocol === "https:" && (
|
|
860
|
+
let n = {};
|
|
861
|
+
window.location.protocol === "https:" && (n = { secure: !0 }), t != null && t.daysUntilExpire && (n.expires = t.daysUntilExpire), t != null && t.cookieDomain && (n.domain = t.cookieDomain), Te(`_legacy_${i}`, JSON.stringify(e), n), z.save(i, e, t);
|
|
857
862
|
}, remove(i, e) {
|
|
858
863
|
let t = {};
|
|
859
|
-
e != null && e.cookieDomain && (t.domain = e.cookieDomain),
|
|
860
|
-
} },
|
|
864
|
+
e != null && e.cookieDomain && (t.domain = e.cookieDomain), Oe(i, t), z.remove(i, e), z.remove(`_legacy_${i}`, e);
|
|
865
|
+
} }, tt = { get(i) {
|
|
861
866
|
if (typeof sessionStorage > "u") return;
|
|
862
867
|
const e = sessionStorage.getItem(i);
|
|
863
868
|
return e != null ? JSON.parse(e) : void 0;
|
|
@@ -870,36 +875,36 @@ var j;
|
|
|
870
875
|
(function(i) {
|
|
871
876
|
i.Code = "code", i.ConnectCode = "connect_code";
|
|
872
877
|
})(j || (j = {}));
|
|
873
|
-
function
|
|
874
|
-
var
|
|
878
|
+
function nt(i, e, t) {
|
|
879
|
+
var n = e === void 0 ? null : e, o = (function(u, p) {
|
|
875
880
|
var s = atob(u);
|
|
876
881
|
if (p) {
|
|
877
882
|
for (var c = new Uint8Array(s.length), d = 0, l = s.length; d < l; ++d) c[d] = s.charCodeAt(d);
|
|
878
883
|
return String.fromCharCode.apply(null, new Uint16Array(c.buffer));
|
|
879
884
|
}
|
|
880
885
|
return s;
|
|
881
|
-
}(i, t !== void 0 && t), r =
|
|
882
|
-
`, 10) + 1, a =
|
|
886
|
+
})(i, t !== void 0 && t), r = o.indexOf(`
|
|
887
|
+
`, 10) + 1, a = o.substring(r) + (n ? "//# sourceMappingURL=" + n : ""), h = new Blob([a], { type: "application/javascript" });
|
|
883
888
|
return URL.createObjectURL(h);
|
|
884
889
|
}
|
|
885
|
-
var
|
|
886
|
-
return M = M ||
|
|
890
|
+
var pe, me, fe, M, ot = (pe = "Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YSx1c2VNcnJ0OmZ9LHBvcnRzOltwXX0pPT57bGV0IGgsdSxsPXt9O2NvbnN0e2F1ZGllbmNlOmQsc2NvcGU6eX09cnx8e307dHJ5e2NvbnN0IHI9YT8oZT0+e2NvbnN0IHQ9bmV3IFVSTFNlYXJjaFBhcmFtcyhlKSxyPXt9O3JldHVybiB0LmZvckVhY2goKChlLHQpPT57clt0XT1lfSkpLHJ9KShjLmJvZHkpOkpTT04ucGFyc2UoYy5ib2R5KTtpZighci5yZWZyZXNoX3Rva2VuJiYicmVmcmVzaF90b2tlbiI9PT1yLmdyYW50X3R5cGUpe2lmKHU9KChlLHQpPT5vW24oZSx0KV0pKGQseSksIXUmJmYpe2NvbnN0IGU9by5sYXRlc3RfcmVmcmVzaF90b2tlbix0PSgoZSx0KT0+e2NvbnN0IHI9T2JqZWN0LmtleXMobykuZmluZCgocj0+e2lmKCJsYXRlc3RfcmVmcmVzaF90b2tlbiIhPT1yKXtjb25zdCBzPSgoZSx0KT0+dC5zdGFydHNXaXRoKGAke2V9fGApKSh0LHIpLG89ci5zcGxpdCgifCIpWzFdLnNwbGl0KCIgIiksbj1lLnNwbGl0KCIgIikuZXZlcnkoKGU9Pm8uaW5jbHVkZXMoZSkpKTtyZXR1cm4gcyYmbn19KSk7cmV0dXJuISFyfSkoeSxkKTtlJiYhdCYmKHU9ZSl9aWYoIXUpdGhyb3cgbmV3IHQoZCx5KTtjLmJvZHk9YT9zKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxyKSx7cmVmcmVzaF90b2tlbjp1fSkpOkpTT04uc3RyaW5naWZ5KE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxyKSx7cmVmcmVzaF90b2tlbjp1fSkpfWxldCBqLGs7ImZ1bmN0aW9uIj09dHlwZW9mIEFib3J0Q29udHJvbGxlciYmKGo9bmV3IEFib3J0Q29udHJvbGxlcixjLnNpZ25hbD1qLnNpZ25hbCk7dHJ5e2s9YXdhaXQgUHJvbWlzZS5yYWNlKFsoXz1lLG5ldyBQcm9taXNlKChlPT5zZXRUaW1lb3V0KGUsXykpKSksZmV0Y2goaSxPYmplY3QuYXNzaWduKHt9LGMpKV0pfWNhdGNoKGUpe3JldHVybiB2b2lkIHAucG9zdE1lc3NhZ2Uoe2Vycm9yOmUubWVzc2FnZX0pfWlmKCFrKXJldHVybiBqJiZqLmFib3J0KCksdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjoiVGltZW91dCB3aGVuIGV4ZWN1dGluZyAnZmV0Y2gnIn0pO2c9ay5oZWFkZXJzLGw9Wy4uLmddLnJlZHVjZSgoKGUsW3Qscl0pPT4oZVt0XT1yLGUpKSx7fSksaD1hd2FpdCBrLmpzb24oKSxoLnJlZnJlc2hfdG9rZW4/KGYmJihvLmxhdGVzdF9yZWZyZXNoX3Rva2VuPWgucmVmcmVzaF90b2tlbixPPXUsYj1oLnJlZnJlc2hfdG9rZW4sT2JqZWN0LmVudHJpZXMobykuZm9yRWFjaCgoKFtlLHRdKT0+e3Q9PT1PJiYob1tlXT1iKX0pKSksKChlLHQscik9PntvW24odCxyKV09ZX0pKGgucmVmcmVzaF90b2tlbixkLHkpLGRlbGV0ZSBoLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KShkLHkpLHAucG9zdE1lc3NhZ2Uoe29rOmsub2ssanNvbjpoLGhlYWRlcnM6bH0pfWNhdGNoKGUpe3AucG9zdE1lc3NhZ2Uoe29rOiExLGpzb246e2Vycm9yOmUuZXJyb3IsZXJyb3JfZGVzY3JpcHRpb246ZS5tZXNzYWdlfSxoZWFkZXJzOmx9KX12YXIgTyxiLGcsX30pKX0oKTsKCg==", me = null, fe = !1, function(i) {
|
|
891
|
+
return M = M || nt(pe, me, fe), new Worker(M, i);
|
|
887
892
|
});
|
|
888
893
|
const Y = {};
|
|
889
|
-
class
|
|
894
|
+
class it {
|
|
890
895
|
constructor(e, t) {
|
|
891
896
|
this.cache = e, this.clientId = t, this.manifestKey = this.createManifestKeyFrom(this.clientId);
|
|
892
897
|
}
|
|
893
898
|
async add(e) {
|
|
894
899
|
var t;
|
|
895
|
-
const
|
|
896
|
-
|
|
900
|
+
const n = new Set(((t = await this.cache.get(this.manifestKey)) === null || t === void 0 ? void 0 : t.keys) || []);
|
|
901
|
+
n.add(e), await this.cache.set(this.manifestKey, { keys: [...n] });
|
|
897
902
|
}
|
|
898
903
|
async remove(e) {
|
|
899
904
|
const t = await this.cache.get(this.manifestKey);
|
|
900
905
|
if (t) {
|
|
901
|
-
const
|
|
902
|
-
return
|
|
906
|
+
const n = new Set(t.keys);
|
|
907
|
+
return n.delete(e), n.size > 0 ? await this.cache.set(this.manifestKey, { keys: [...n] }) : await this.cache.remove(this.manifestKey);
|
|
903
908
|
}
|
|
904
909
|
}
|
|
905
910
|
get() {
|
|
@@ -912,14 +917,14 @@ class nt {
|
|
|
912
917
|
return `@@auth0spajs@@::${e}`;
|
|
913
918
|
}
|
|
914
919
|
}
|
|
915
|
-
const
|
|
916
|
-
const { openUrl: e, onRedirect: t } = i,
|
|
917
|
-
return Object.assign(Object.assign({},
|
|
918
|
-
},
|
|
920
|
+
const rt = { memory: () => new Pe().enclosedCache, localstorage: () => new Me() }, ge = (i) => rt[i], ye = (i) => {
|
|
921
|
+
const { openUrl: e, onRedirect: t } = i, n = I(i, ["openUrl", "onRedirect"]);
|
|
922
|
+
return Object.assign(Object.assign({}, n), { openUrl: e === !1 || e ? e : t });
|
|
923
|
+
}, we = (i, e) => {
|
|
919
924
|
const t = (e == null ? void 0 : e.split(" ")) || [];
|
|
920
|
-
return ((i == null ? void 0 : i.split(" ")) || []).every((
|
|
925
|
+
return ((i == null ? void 0 : i.split(" ")) || []).every(((n) => t.includes(n)));
|
|
921
926
|
}, T = { NONCE: "nonce", KEYPAIR: "keypair" };
|
|
922
|
-
class
|
|
927
|
+
class st {
|
|
923
928
|
constructor(e) {
|
|
924
929
|
this.clientId = e;
|
|
925
930
|
}
|
|
@@ -928,18 +933,18 @@ class rt {
|
|
|
928
933
|
}
|
|
929
934
|
createDbHandle() {
|
|
930
935
|
const e = window.indexedDB.open("auth0-spa-js", this.getVersion());
|
|
931
|
-
return new Promise((t,
|
|
932
|
-
e.onupgradeneeded = () => Object.values(T).forEach((
|
|
933
|
-
});
|
|
936
|
+
return new Promise(((t, n) => {
|
|
937
|
+
e.onupgradeneeded = () => Object.values(T).forEach(((o) => e.result.createObjectStore(o))), e.onerror = () => n(e.error), e.onsuccess = () => t(e.result);
|
|
938
|
+
}));
|
|
934
939
|
}
|
|
935
940
|
async getDbHandle() {
|
|
936
941
|
return this.dbHandle || (this.dbHandle = await this.createDbHandle()), this.dbHandle;
|
|
937
942
|
}
|
|
938
|
-
async executeDbRequest(e, t,
|
|
939
|
-
const
|
|
940
|
-
return new Promise((r, a) => {
|
|
941
|
-
|
|
942
|
-
});
|
|
943
|
+
async executeDbRequest(e, t, n) {
|
|
944
|
+
const o = n((await this.getDbHandle()).transaction(e, t).objectStore(e));
|
|
945
|
+
return new Promise(((r, a) => {
|
|
946
|
+
o.onsuccess = () => r(o.result), o.onerror = () => a(o.error);
|
|
947
|
+
}));
|
|
943
948
|
}
|
|
944
949
|
buildKey(e) {
|
|
945
950
|
const t = e ? `_${e}` : "auth0";
|
|
@@ -951,8 +956,8 @@ class rt {
|
|
|
951
956
|
setKeyPair(e) {
|
|
952
957
|
return this.save(T.KEYPAIR, this.buildKey(), e);
|
|
953
958
|
}
|
|
954
|
-
async save(e, t,
|
|
955
|
-
await this.executeDbRequest(e, "readwrite", (
|
|
959
|
+
async save(e, t, n) {
|
|
960
|
+
await this.executeDbRequest(e, "readwrite", ((o) => o.put(n, t)));
|
|
956
961
|
}
|
|
957
962
|
findNonce(e) {
|
|
958
963
|
return this.find(T.NONCE, this.buildKey(e));
|
|
@@ -961,14 +966,14 @@ class rt {
|
|
|
961
966
|
return this.find(T.KEYPAIR, this.buildKey());
|
|
962
967
|
}
|
|
963
968
|
find(e, t) {
|
|
964
|
-
return this.executeDbRequest(e, "readonly", (
|
|
969
|
+
return this.executeDbRequest(e, "readonly", ((n) => n.get(t)));
|
|
965
970
|
}
|
|
966
971
|
async deleteBy(e, t) {
|
|
967
|
-
const
|
|
968
|
-
|
|
972
|
+
const n = await this.executeDbRequest(e, "readonly", ((o) => o.getAllKeys()));
|
|
973
|
+
n == null || n.filter(t).map(((o) => this.executeDbRequest(e, "readwrite", ((r) => r.delete(o)))));
|
|
969
974
|
}
|
|
970
975
|
deleteByClientId(e, t) {
|
|
971
|
-
return this.deleteBy(e, (
|
|
976
|
+
return this.deleteBy(e, ((n) => typeof n == "string" && n.startsWith(`${t}::`)));
|
|
972
977
|
}
|
|
973
978
|
clearNonces() {
|
|
974
979
|
return this.deleteByClientId(T.NONCE, this.clientId);
|
|
@@ -977,9 +982,9 @@ class rt {
|
|
|
977
982
|
return this.deleteByClientId(T.KEYPAIR, this.clientId);
|
|
978
983
|
}
|
|
979
984
|
}
|
|
980
|
-
class
|
|
985
|
+
class at {
|
|
981
986
|
constructor(e) {
|
|
982
|
-
this.storage = new
|
|
987
|
+
this.storage = new st(e);
|
|
983
988
|
}
|
|
984
989
|
getNonce(e) {
|
|
985
990
|
return this.storage.findNonce(e);
|
|
@@ -989,24 +994,24 @@ class st {
|
|
|
989
994
|
}
|
|
990
995
|
async getOrGenerateKeyPair() {
|
|
991
996
|
let e = await this.storage.findKeyPair();
|
|
992
|
-
return e || (e = await
|
|
997
|
+
return e || (e = await Ze(), await this.storage.setKeyPair(e)), e;
|
|
993
998
|
}
|
|
994
999
|
async generateProof(e) {
|
|
995
1000
|
const t = await this.getOrGenerateKeyPair();
|
|
996
|
-
return
|
|
1001
|
+
return We(Object.assign({ keyPair: t }, e));
|
|
997
1002
|
}
|
|
998
1003
|
async calculateThumbprint() {
|
|
999
|
-
return
|
|
1004
|
+
return He(await this.getOrGenerateKeyPair());
|
|
1000
1005
|
}
|
|
1001
1006
|
async clear() {
|
|
1002
1007
|
await Promise.all([this.storage.clearNonces(), this.storage.clearKeyPairs()]);
|
|
1003
1008
|
}
|
|
1004
1009
|
}
|
|
1005
|
-
var
|
|
1010
|
+
var E;
|
|
1006
1011
|
(function(i) {
|
|
1007
1012
|
i.Bearer = "Bearer", i.DPoP = "DPoP";
|
|
1008
|
-
})(
|
|
1009
|
-
class
|
|
1013
|
+
})(E || (E = {}));
|
|
1014
|
+
class ct {
|
|
1010
1015
|
constructor(e, t) {
|
|
1011
1016
|
this.hooks = t, this.config = Object.assign(Object.assign({}, e), { fetch: e.fetch || (typeof window > "u" ? fetch : window.fetch.bind(window)) });
|
|
1012
1017
|
}
|
|
@@ -1028,21 +1033,21 @@ class at {
|
|
|
1028
1033
|
}
|
|
1029
1034
|
buildBaseRequest(e, t) {
|
|
1030
1035
|
if (!this.config.baseUrl) return new Request(e, t);
|
|
1031
|
-
const
|
|
1032
|
-
return new Request(
|
|
1036
|
+
const n = this.buildUrl(this.config.baseUrl, this.extractUrl(e)), o = e instanceof Request ? new Request(n, e) : n;
|
|
1037
|
+
return new Request(o, t);
|
|
1033
1038
|
}
|
|
1034
|
-
setAuthorizationHeader(e, t,
|
|
1035
|
-
e.headers.set("authorization", `${
|
|
1039
|
+
setAuthorizationHeader(e, t, n = E.Bearer) {
|
|
1040
|
+
e.headers.set("authorization", `${n} ${t}`);
|
|
1036
1041
|
}
|
|
1037
1042
|
async setDpopProofHeader(e, t) {
|
|
1038
1043
|
if (!this.config.dpopNonceId) return;
|
|
1039
|
-
const
|
|
1040
|
-
e.headers.set("dpop",
|
|
1044
|
+
const n = await this.hooks.getDpopNonce(), o = await this.hooks.generateDpopProof({ accessToken: t, method: e.method, nonce: n, url: e.url });
|
|
1045
|
+
e.headers.set("dpop", o);
|
|
1041
1046
|
}
|
|
1042
1047
|
async prepareRequest(e, t) {
|
|
1043
|
-
const
|
|
1044
|
-
let
|
|
1045
|
-
typeof
|
|
1048
|
+
const n = await this.getAccessToken(t);
|
|
1049
|
+
let o, r;
|
|
1050
|
+
typeof n == "string" ? (o = this.config.dpopNonceId ? E.DPoP : E.Bearer, r = n) : (o = n.token_type, r = n.access_token), this.setAuthorizationHeader(e, r, o), o === E.DPoP && await this.setDpopProofHeader(e, r);
|
|
1046
1051
|
}
|
|
1047
1052
|
getHeader(e, t) {
|
|
1048
1053
|
return Array.isArray(e) ? new Headers(e).get(t) || "" : typeof e.get == "function" ? e.get(t) || "" : e[t] || "";
|
|
@@ -1053,23 +1058,23 @@ class at {
|
|
|
1053
1058
|
return t.includes("invalid_dpop_nonce") || t.includes("use_dpop_nonce");
|
|
1054
1059
|
}
|
|
1055
1060
|
async handleResponse(e, t) {
|
|
1056
|
-
const
|
|
1057
|
-
if (
|
|
1058
|
-
if (!
|
|
1061
|
+
const n = this.getHeader(e.headers, "dpop-nonce");
|
|
1062
|
+
if (n && await this.hooks.setDpopNonce(n), !this.hasUseDpopNonceError(e)) return e;
|
|
1063
|
+
if (!n || !t.onUseDpopNonceError) throw new F(n);
|
|
1059
1064
|
return t.onUseDpopNonceError();
|
|
1060
1065
|
}
|
|
1061
|
-
async internalFetchWithAuth(e, t,
|
|
1066
|
+
async internalFetchWithAuth(e, t, n, o) {
|
|
1062
1067
|
const r = this.buildBaseRequest(e, t);
|
|
1063
|
-
await this.prepareRequest(r,
|
|
1068
|
+
await this.prepareRequest(r, o);
|
|
1064
1069
|
const a = await this.config.fetch(r);
|
|
1065
|
-
return this.handleResponse(a,
|
|
1070
|
+
return this.handleResponse(a, n);
|
|
1066
1071
|
}
|
|
1067
|
-
fetchWithAuth(e, t,
|
|
1068
|
-
const
|
|
1069
|
-
return this.internalFetchWithAuth(e, t,
|
|
1072
|
+
fetchWithAuth(e, t, n) {
|
|
1073
|
+
const o = { onUseDpopNonceError: () => this.internalFetchWithAuth(e, t, Object.assign(Object.assign({}, o), { onUseDpopNonceError: void 0 }), n) };
|
|
1074
|
+
return this.internalFetchWithAuth(e, t, o, n);
|
|
1070
1075
|
}
|
|
1071
1076
|
}
|
|
1072
|
-
class
|
|
1077
|
+
class ut {
|
|
1073
1078
|
constructor(e, t) {
|
|
1074
1079
|
this.myAccountFetcher = e, this.apiBase = t;
|
|
1075
1080
|
}
|
|
@@ -1085,23 +1090,23 @@ class ct {
|
|
|
1085
1090
|
let t;
|
|
1086
1091
|
try {
|
|
1087
1092
|
t = await e.text(), t = JSON.parse(t);
|
|
1088
|
-
} catch (
|
|
1089
|
-
throw new X({ type: "invalid_json", status: e.status, title: "Invalid JSON response", detail: t || String(
|
|
1093
|
+
} catch (n) {
|
|
1094
|
+
throw new X({ type: "invalid_json", status: e.status, title: "Invalid JSON response", detail: t || String(n) });
|
|
1090
1095
|
}
|
|
1091
1096
|
if (e.ok) return t;
|
|
1092
1097
|
throw new X(t);
|
|
1093
1098
|
}
|
|
1094
1099
|
}
|
|
1095
1100
|
class X extends Error {
|
|
1096
|
-
constructor({ type: e, status: t, title:
|
|
1097
|
-
super(
|
|
1101
|
+
constructor({ type: e, status: t, title: n, detail: o, validation_errors: r }) {
|
|
1102
|
+
super(o), this.name = "MyAccountApiError", this.type = e, this.status = t, this.title = n, this.detail = o, this.validation_errors = r, Object.setPrototypeOf(this, X.prototype);
|
|
1098
1103
|
}
|
|
1099
1104
|
}
|
|
1100
|
-
const $ = new
|
|
1101
|
-
class
|
|
1105
|
+
const $ = new je();
|
|
1106
|
+
class ht {
|
|
1102
1107
|
constructor(e) {
|
|
1103
|
-
let t,
|
|
1104
|
-
if (this.userCache = new
|
|
1108
|
+
let t, n;
|
|
1109
|
+
if (this.userCache = new Pe().enclosedCache, this.activeLockKeys = /* @__PURE__ */ new Set(), this.defaultOptions = { authorizationParams: { scope: "openid profile email" }, useRefreshTokensFallback: !1, useFormData: !0 }, this._releaseLockOnPageHide = async () => {
|
|
1105
1110
|
const u = Array.from(this.activeLockKeys);
|
|
1106
1111
|
for (const p of u) await $.releaseLock(p);
|
|
1107
1112
|
this.activeLockKeys.clear(), window.removeEventListener("pagehide", this._releaseLockOnPageHide);
|
|
@@ -1110,70 +1115,70 @@ class ut {
|
|
|
1110
1115
|
if (J().subtle === void 0) throw new Error(`
|
|
1111
1116
|
auth0-spa-js must run on a secure origin. See https://github.com/auth0/auth0-spa-js/blob/main/FAQ.md#why-do-i-get-auth0-spa-js-must-run-on-a-secure-origin for more information.
|
|
1112
1117
|
`);
|
|
1113
|
-
})(), e.cache && e.cacheLocation && console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."), e.cache)
|
|
1118
|
+
})(), e.cache && e.cacheLocation && console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."), e.cache) n = e.cache;
|
|
1114
1119
|
else {
|
|
1115
|
-
if (t = e.cacheLocation || "memory", !
|
|
1116
|
-
|
|
1120
|
+
if (t = e.cacheLocation || "memory", !ge(t)) throw new Error(`Invalid cache location "${t}"`);
|
|
1121
|
+
n = ge(t)();
|
|
1117
1122
|
}
|
|
1118
|
-
this.httpTimeoutMs = e.httpTimeoutInSeconds ? 1e3 * e.httpTimeoutInSeconds : 1e4, this.cookieStorage = e.legacySameSiteCookie === !1 ?
|
|
1119
|
-
const
|
|
1123
|
+
this.httpTimeoutMs = e.httpTimeoutInSeconds ? 1e3 * e.httpTimeoutInSeconds : 1e4, this.cookieStorage = e.legacySameSiteCookie === !1 ? z : et, this.orgHintCookieName = `auth0.${this.options.clientId}.organization_hint`, this.isAuthenticatedCookieName = ((u) => `auth0.${u}.is.authenticated`)(this.options.clientId), this.sessionCheckExpiryDays = e.sessionCheckExpiryDays || 1;
|
|
1124
|
+
const o = e.useCookiesForTransactions ? this.cookieStorage : tt;
|
|
1120
1125
|
var r;
|
|
1121
1126
|
this.scope = ((u, p, ...s) => {
|
|
1122
1127
|
if (typeof u != "object") return { default: H(p, u, ...s) };
|
|
1123
1128
|
let c = { default: H(p, ...s) };
|
|
1124
|
-
return Object.keys(u).forEach((d) => {
|
|
1129
|
+
return Object.keys(u).forEach(((d) => {
|
|
1125
1130
|
const l = u[d];
|
|
1126
1131
|
c[d] = H(p, l, ...s);
|
|
1127
|
-
}), c;
|
|
1128
|
-
})(this.options.authorizationParams.scope, "openid", this.options.useRefreshTokens ? "offline_access" : ""), this.transactionManager = new
|
|
1132
|
+
})), c;
|
|
1133
|
+
})(this.options.authorizationParams.scope, "openid", this.options.useRefreshTokens ? "offline_access" : ""), this.transactionManager = new $e(o, this.options.clientId, this.options.cookieDomain), this.nowProvider = this.options.nowProvider || ke, this.cacheManager = new Ye(n, n.allKeys ? void 0 : new it(n, this.options.clientId), this.nowProvider), this.dpop = this.options.useDpop ? new at(this.options.clientId) : void 0, this.domainUrl = (r = this.options.domain, /^https?:\/\//.test(r) ? r : `https://${r}`), this.tokenIssuer = ((u, p) => u ? u.startsWith("https://") ? u : `https://${u}/` : `${p}/`)(this.options.issuer, this.domainUrl);
|
|
1129
1134
|
const a = `${this.domainUrl}/me/`, h = this.createFetcher(Object.assign(Object.assign({}, this.options.useDpop && { dpopNonceId: "__auth0_my_account_api__" }), { getAccessToken: () => this.getTokenSilently({ authorizationParams: { scope: "create:me:connected_accounts", audience: a }, detailedResponse: !0 }) }));
|
|
1130
|
-
this.myAccountApi = new
|
|
1135
|
+
this.myAccountApi = new ut(h, a), typeof window < "u" && window.Worker && this.options.useRefreshTokens && t === "memory" && (this.options.workerUrl ? this.worker = new Worker(this.options.workerUrl) : this.worker = new ot());
|
|
1131
1136
|
}
|
|
1132
1137
|
_url(e) {
|
|
1133
|
-
const t = encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client ||
|
|
1138
|
+
const t = encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client || be)));
|
|
1134
1139
|
return `${this.domainUrl}${e}&auth0Client=${t}`;
|
|
1135
1140
|
}
|
|
1136
1141
|
_authorizeUrl(e) {
|
|
1137
1142
|
return this._url(`/authorize?${B(e)}`);
|
|
1138
1143
|
}
|
|
1139
|
-
async _verifyIdToken(e, t,
|
|
1140
|
-
const
|
|
1141
|
-
return
|
|
1144
|
+
async _verifyIdToken(e, t, n) {
|
|
1145
|
+
const o = await this.nowProvider();
|
|
1146
|
+
return qe({ iss: this.tokenIssuer, aud: this.options.clientId, id_token: e, nonce: t, organization: n, leeway: this.options.leeway, max_age: (r = this.options.authorizationParams.max_age, typeof r != "string" ? r : parseInt(r, 10) || void 0), now: o });
|
|
1142
1147
|
var r;
|
|
1143
1148
|
}
|
|
1144
1149
|
_processOrgHint(e) {
|
|
1145
1150
|
e ? this.cookieStorage.save(this.orgHintCookieName, e, { daysUntilExpire: this.sessionCheckExpiryDays, cookieDomain: this.options.cookieDomain }) : this.cookieStorage.remove(this.orgHintCookieName, { cookieDomain: this.options.cookieDomain });
|
|
1146
1151
|
}
|
|
1147
|
-
async _prepareAuthorizeUrl(e, t,
|
|
1148
|
-
var
|
|
1149
|
-
const r = G(N()), a = G(N()), h = N(), u = await
|
|
1152
|
+
async _prepareAuthorizeUrl(e, t, n) {
|
|
1153
|
+
var o;
|
|
1154
|
+
const r = G(N()), a = G(N()), h = N(), u = await ue(h), p = de(u), s = await ((o = this.dpop) === null || o === void 0 ? void 0 : o.calculateThumbprint()), c = ((l, m, y, g, k, b, w, f, S) => Object.assign(Object.assign(Object.assign({ client_id: l.clientId }, l.authorizationParams), y), { scope: Z(m, y.scope, y.audience), response_type: "code", response_mode: f || "query", state: g, nonce: k, redirect_uri: w || l.authorizationParams.redirect_uri, code_challenge: b, code_challenge_method: "S256", dpop_jkt: S }))(this.options, this.scope, e, r, a, p, e.redirect_uri || this.options.authorizationParams.redirect_uri || n, t == null ? void 0 : t.response_mode, s), d = this._authorizeUrl(c);
|
|
1150
1155
|
return { nonce: a, code_verifier: h, scope: c.scope, audience: c.audience || "default", redirect_uri: c.redirect_uri, state: r, url: d };
|
|
1151
1156
|
}
|
|
1152
1157
|
async loginWithPopup(e, t) {
|
|
1153
|
-
var
|
|
1158
|
+
var n;
|
|
1154
1159
|
if (e = e || {}, !(t = t || {}).popup && (t.popup = ((h) => {
|
|
1155
1160
|
const u = window.screenX + (window.innerWidth - 400) / 2, p = window.screenY + (window.innerHeight - 600) / 2;
|
|
1156
1161
|
return window.open(h, "auth0:authorize:popup", `left=${u},top=${p},width=400,height=600,resizable,scrollbars=yes,status=1`);
|
|
1157
|
-
})(""), !t.popup)) throw new
|
|
1158
|
-
const
|
|
1159
|
-
t.popup.location.href =
|
|
1160
|
-
const r = await ((h) => new Promise((u, p) => {
|
|
1162
|
+
})(""), !t.popup)) throw new re();
|
|
1163
|
+
const o = await this._prepareAuthorizeUrl(e.authorizationParams || {}, { response_mode: "web_message" }, window.location.origin);
|
|
1164
|
+
t.popup.location.href = o.url;
|
|
1165
|
+
const r = await ((h) => new Promise(((u, p) => {
|
|
1161
1166
|
let s;
|
|
1162
|
-
const c = setInterval(() => {
|
|
1167
|
+
const c = setInterval((() => {
|
|
1163
1168
|
h.popup && h.popup.closed && (clearInterval(c), clearTimeout(d), window.removeEventListener("message", s, !1), p(new ie(h.popup)));
|
|
1164
|
-
}, 1e3), d = setTimeout(() => {
|
|
1165
|
-
clearInterval(c), p(new
|
|
1166
|
-
}, 1e3 * (h.timeoutInSeconds || 60));
|
|
1169
|
+
}), 1e3), d = setTimeout((() => {
|
|
1170
|
+
clearInterval(c), p(new oe(h.popup)), window.removeEventListener("message", s, !1);
|
|
1171
|
+
}), 1e3 * (h.timeoutInSeconds || 60));
|
|
1167
1172
|
s = function(l) {
|
|
1168
1173
|
if (l.data && l.data.type === "authorization_response") {
|
|
1169
1174
|
if (clearTimeout(d), clearInterval(c), window.removeEventListener("message", s, !1), h.popup.close(), l.data.response.error) return p(v.fromPayload(l.data.response));
|
|
1170
1175
|
u(l.data.response);
|
|
1171
1176
|
}
|
|
1172
1177
|
}, window.addEventListener("message", s);
|
|
1173
|
-
}))(Object.assign(Object.assign({}, t), { timeoutInSeconds: t.timeoutInSeconds || this.options.authorizeTimeoutInSeconds || 60 }));
|
|
1174
|
-
if (
|
|
1175
|
-
const a = ((
|
|
1176
|
-
await this._requestToken({ audience:
|
|
1178
|
+
})))(Object.assign(Object.assign({}, t), { timeoutInSeconds: t.timeoutInSeconds || this.options.authorizeTimeoutInSeconds || 60 }));
|
|
1179
|
+
if (o.state !== r.state) throw new v("state_mismatch", "Invalid state");
|
|
1180
|
+
const a = ((n = e.authorizationParams) === null || n === void 0 ? void 0 : n.organization) || this.options.authorizationParams.organization;
|
|
1181
|
+
await this._requestToken({ audience: o.audience, scope: o.scope, code_verifier: o.code_verifier, grant_type: "authorization_code", code: r.code, redirect_uri: o.redirect_uri }, { nonceIn: o.nonce, organization: a });
|
|
1177
1182
|
}
|
|
1178
1183
|
async getUser() {
|
|
1179
1184
|
var e;
|
|
@@ -1187,37 +1192,37 @@ class ut {
|
|
|
1187
1192
|
}
|
|
1188
1193
|
async loginWithRedirect(e = {}) {
|
|
1189
1194
|
var t;
|
|
1190
|
-
const
|
|
1195
|
+
const n = ye(e), { openUrl: o, fragment: r, appState: a } = n, h = I(n, ["openUrl", "fragment", "appState"]), u = ((t = h.authorizationParams) === null || t === void 0 ? void 0 : t.organization) || this.options.authorizationParams.organization, p = await this._prepareAuthorizeUrl(h.authorizationParams || {}), { url: s } = p, c = I(p, ["url"]);
|
|
1191
1196
|
this.transactionManager.create(Object.assign(Object.assign(Object.assign({}, c), { appState: a, response_type: j.Code }), u && { organization: u }));
|
|
1192
1197
|
const d = r ? `${s}#${r}` : s;
|
|
1193
|
-
|
|
1198
|
+
o ? await o(d) : window.location.assign(d);
|
|
1194
1199
|
}
|
|
1195
1200
|
async handleRedirectCallback(e = window.location.href) {
|
|
1196
1201
|
const t = e.split("?").slice(1);
|
|
1197
1202
|
if (t.length === 0) throw new Error("There are no query params available for parsing.");
|
|
1198
|
-
const
|
|
1199
|
-
if (!
|
|
1203
|
+
const n = this.transactionManager.get();
|
|
1204
|
+
if (!n) throw new v("missing_transaction", "Invalid state");
|
|
1200
1205
|
this.transactionManager.remove();
|
|
1201
|
-
const
|
|
1206
|
+
const o = ((r) => {
|
|
1202
1207
|
r.indexOf("#") > -1 && (r = r.substring(0, r.indexOf("#")));
|
|
1203
1208
|
const a = new URLSearchParams(r);
|
|
1204
1209
|
return { state: a.get("state"), code: a.get("code") || void 0, connect_code: a.get("connect_code") || void 0, error: a.get("error") || void 0, error_description: a.get("error_description") || void 0 };
|
|
1205
1210
|
})(t.join(""));
|
|
1206
|
-
return
|
|
1211
|
+
return n.response_type === j.ConnectCode ? this._handleConnectAccountRedirectCallback(o, n) : this._handleLoginRedirectCallback(o, n);
|
|
1207
1212
|
}
|
|
1208
1213
|
async _handleLoginRedirectCallback(e, t) {
|
|
1209
|
-
const { code:
|
|
1210
|
-
if (r) throw new te(r, a || r,
|
|
1211
|
-
if (!t.code_verifier || t.state && t.state !==
|
|
1214
|
+
const { code: n, state: o, error: r, error_description: a } = e;
|
|
1215
|
+
if (r) throw new te(r, a || r, o, t.appState);
|
|
1216
|
+
if (!t.code_verifier || t.state && t.state !== o) throw new v("state_mismatch", "Invalid state");
|
|
1212
1217
|
const h = t.organization, u = t.nonce, p = t.redirect_uri;
|
|
1213
|
-
return await this._requestToken(Object.assign({ audience: t.audience, scope: t.scope, code_verifier: t.code_verifier, grant_type: "authorization_code", code:
|
|
1218
|
+
return await this._requestToken(Object.assign({ audience: t.audience, scope: t.scope, code_verifier: t.code_verifier, grant_type: "authorization_code", code: n }, p ? { redirect_uri: p } : {}), { nonceIn: u, organization: h }), { appState: t.appState, response_type: j.Code };
|
|
1214
1219
|
}
|
|
1215
1220
|
async _handleConnectAccountRedirectCallback(e, t) {
|
|
1216
|
-
const { connect_code:
|
|
1217
|
-
if (r) throw new
|
|
1218
|
-
if (!
|
|
1219
|
-
if (!(t.code_verifier && t.state && t.auth_session && t.redirect_uri && t.state ===
|
|
1220
|
-
const h = await this.myAccountApi.completeAccount({ auth_session: t.auth_session, connect_code:
|
|
1221
|
+
const { connect_code: n, state: o, error: r, error_description: a } = e;
|
|
1222
|
+
if (r) throw new ne(r, a || r, t.connection, o, t.appState);
|
|
1223
|
+
if (!n) throw new v("missing_connect_code", "Missing connect code");
|
|
1224
|
+
if (!(t.code_verifier && t.state && t.auth_session && t.redirect_uri && t.state === o)) throw new v("state_mismatch", "Invalid state");
|
|
1225
|
+
const h = await this.myAccountApi.completeAccount({ auth_session: t.auth_session, connect_code: n, redirect_uri: t.redirect_uri, code_verifier: t.code_verifier });
|
|
1221
1226
|
return Object.assign(Object.assign({}, h), { appState: t.appState, response_type: j.ConnectCode });
|
|
1222
1227
|
}
|
|
1223
1228
|
async checkSession(e) {
|
|
@@ -1231,64 +1236,64 @@ class ut {
|
|
|
1231
1236
|
}
|
|
1232
1237
|
}
|
|
1233
1238
|
async getTokenSilently(e = {}) {
|
|
1234
|
-
var t,
|
|
1235
|
-
const
|
|
1239
|
+
var t, n;
|
|
1240
|
+
const o = Object.assign(Object.assign({ cacheMode: "on" }, e), { authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), e.authorizationParams), { scope: Z(this.scope, (t = e.authorizationParams) === null || t === void 0 ? void 0 : t.scope, ((n = e.authorizationParams) === null || n === void 0 ? void 0 : n.audience) || this.options.authorizationParams.audience) }) }), r = await ((a, h) => {
|
|
1236
1241
|
let u = Y[h];
|
|
1237
|
-
return u || (u = a().finally(() => {
|
|
1242
|
+
return u || (u = a().finally((() => {
|
|
1238
1243
|
delete Y[h], u = null;
|
|
1239
|
-
}), Y[h] = u), u;
|
|
1240
|
-
})(() => this._getTokenSilently(
|
|
1244
|
+
})), Y[h] = u), u;
|
|
1245
|
+
})((() => this._getTokenSilently(o)), `${this.options.clientId}::${o.authorizationParams.audience}::${o.authorizationParams.scope}`);
|
|
1241
1246
|
return e.detailedResponse ? r : r == null ? void 0 : r.access_token;
|
|
1242
1247
|
}
|
|
1243
1248
|
async _getTokenSilently(e) {
|
|
1244
|
-
const { cacheMode: t } = e,
|
|
1249
|
+
const { cacheMode: t } = e, n = I(e, ["cacheMode"]);
|
|
1245
1250
|
if (t !== "off") {
|
|
1246
|
-
const h = await this._getEntryFromCache({ scope:
|
|
1251
|
+
const h = await this._getEntryFromCache({ scope: n.authorizationParams.scope, audience: n.authorizationParams.audience || "default", clientId: this.options.clientId, cacheMode: t });
|
|
1247
1252
|
if (h) return h;
|
|
1248
1253
|
}
|
|
1249
1254
|
if (t === "cache-only") return;
|
|
1250
|
-
const
|
|
1255
|
+
const o = (r = this.options.clientId, a = n.authorizationParams.audience || "default", `auth0.lock.getTokenSilently.${r}.${a}`);
|
|
1251
1256
|
var r, a;
|
|
1252
1257
|
if (!await (async (h, u = 3) => {
|
|
1253
1258
|
for (let p = 0; p < u; p++) if (await h()) return !0;
|
|
1254
1259
|
return !1;
|
|
1255
|
-
})(() => $.acquireLock(
|
|
1256
|
-
this.activeLockKeys.add(
|
|
1260
|
+
})((() => $.acquireLock(o, 5e3)), 10)) throw new U();
|
|
1261
|
+
this.activeLockKeys.add(o), this.activeLockKeys.size === 1 && window.addEventListener("pagehide", this._releaseLockOnPageHide);
|
|
1257
1262
|
try {
|
|
1258
1263
|
if (t !== "off") {
|
|
1259
|
-
const l = await this._getEntryFromCache({ scope:
|
|
1264
|
+
const l = await this._getEntryFromCache({ scope: n.authorizationParams.scope, audience: n.authorizationParams.audience || "default", clientId: this.options.clientId });
|
|
1260
1265
|
if (l) return l;
|
|
1261
1266
|
}
|
|
1262
|
-
const h = this.options.useRefreshTokens ? await this._getTokenUsingRefreshToken(
|
|
1267
|
+
const h = this.options.useRefreshTokens ? await this._getTokenUsingRefreshToken(n) : await this._getTokenFromIFrame(n), { id_token: u, token_type: p, access_token: s, oauthTokenScope: c, expires_in: d } = h;
|
|
1263
1268
|
return Object.assign(Object.assign({ id_token: u, token_type: p, access_token: s }, c ? { scope: c } : null), { expires_in: d });
|
|
1264
1269
|
} finally {
|
|
1265
|
-
await $.releaseLock(
|
|
1270
|
+
await $.releaseLock(o), this.activeLockKeys.delete(o), this.activeLockKeys.size === 0 && window.removeEventListener("pagehide", this._releaseLockOnPageHide);
|
|
1266
1271
|
}
|
|
1267
1272
|
}
|
|
1268
1273
|
async getTokenWithPopup(e = {}, t = {}) {
|
|
1269
|
-
var
|
|
1270
|
-
const r = Object.assign(Object.assign({}, e), { authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), e.authorizationParams), { scope: Z(this.scope, (
|
|
1271
|
-
return t = Object.assign(Object.assign({},
|
|
1274
|
+
var n, o;
|
|
1275
|
+
const r = Object.assign(Object.assign({}, e), { authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), e.authorizationParams), { scope: Z(this.scope, (n = e.authorizationParams) === null || n === void 0 ? void 0 : n.scope, ((o = e.authorizationParams) === null || o === void 0 ? void 0 : o.audience) || this.options.authorizationParams.audience) }) });
|
|
1276
|
+
return t = Object.assign(Object.assign({}, Ke), t), await this.loginWithPopup(r, t), (await this.cacheManager.get(new _({ scope: r.authorizationParams.scope, audience: r.authorizationParams.audience || "default", clientId: this.options.clientId }), void 0, this.options.useMrrt)).access_token;
|
|
1272
1277
|
}
|
|
1273
1278
|
async isAuthenticated() {
|
|
1274
1279
|
return !!await this.getUser();
|
|
1275
1280
|
}
|
|
1276
1281
|
_buildLogoutUrl(e) {
|
|
1277
1282
|
e.clientId !== null ? e.clientId = e.clientId || this.options.clientId : delete e.clientId;
|
|
1278
|
-
const t = e.logoutParams || {}, { federated:
|
|
1279
|
-
return this._url(`/v2/logout?${B(Object.assign({ clientId: e.clientId },
|
|
1283
|
+
const t = e.logoutParams || {}, { federated: n } = t, o = I(t, ["federated"]), r = n ? "&federated" : "";
|
|
1284
|
+
return this._url(`/v2/logout?${B(Object.assign({ clientId: e.clientId }, o))}`) + r;
|
|
1280
1285
|
}
|
|
1281
1286
|
async logout(e = {}) {
|
|
1282
1287
|
var t;
|
|
1283
|
-
const
|
|
1288
|
+
const n = ye(e), { openUrl: o } = n, r = I(n, ["openUrl"]);
|
|
1284
1289
|
e.clientId === null ? await this.cacheManager.clear() : await this.cacheManager.clear(e.clientId || this.options.clientId), this.cookieStorage.remove(this.orgHintCookieName, { cookieDomain: this.options.cookieDomain }), this.cookieStorage.remove(this.isAuthenticatedCookieName, { cookieDomain: this.options.cookieDomain }), this.userCache.remove("@@user@@"), await ((t = this.dpop) === null || t === void 0 ? void 0 : t.clear());
|
|
1285
1290
|
const a = this._buildLogoutUrl(r);
|
|
1286
|
-
|
|
1291
|
+
o ? await o(a) : o !== !1 && window.location.assign(a);
|
|
1287
1292
|
}
|
|
1288
1293
|
async _getTokenFromIFrame(e) {
|
|
1289
|
-
const t = Object.assign(Object.assign({}, e.authorizationParams), { prompt: "none" }),
|
|
1290
|
-
|
|
1291
|
-
const { url:
|
|
1294
|
+
const t = Object.assign(Object.assign({}, e.authorizationParams), { prompt: "none" }), n = this.cookieStorage.get(this.orgHintCookieName);
|
|
1295
|
+
n && !t.organization && (t.organization = n);
|
|
1296
|
+
const { url: o, state: r, nonce: a, code_verifier: h, redirect_uri: u, scope: p, audience: s } = await this._prepareAuthorizeUrl(t, { response_mode: "web_message" }, window.location.origin);
|
|
1292
1297
|
try {
|
|
1293
1298
|
if (window.crossOriginIsolated) throw new v("login_required", "The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");
|
|
1294
1299
|
const c = e.timeoutInSeconds || this.options.authorizeTimeoutInSeconds;
|
|
@@ -1298,22 +1303,22 @@ class ut {
|
|
|
1298
1303
|
} catch {
|
|
1299
1304
|
d = this.domainUrl;
|
|
1300
1305
|
}
|
|
1301
|
-
const l = await ((y, g, k = 60) => new Promise((b, w) => {
|
|
1306
|
+
const l = await ((y, g, k = 60) => new Promise(((b, w) => {
|
|
1302
1307
|
const f = window.document.createElement("iframe");
|
|
1303
1308
|
f.setAttribute("width", "0"), f.setAttribute("height", "0"), f.style.display = "none";
|
|
1304
1309
|
const S = () => {
|
|
1305
1310
|
window.document.body.contains(f) && (window.document.body.removeChild(f), window.removeEventListener("message", L, !1));
|
|
1306
1311
|
};
|
|
1307
1312
|
let L;
|
|
1308
|
-
const
|
|
1313
|
+
const Ce = setTimeout((() => {
|
|
1309
1314
|
w(new U()), S();
|
|
1310
|
-
}, 1e3 * k);
|
|
1315
|
+
}), 1e3 * k);
|
|
1311
1316
|
L = function(P) {
|
|
1312
1317
|
if (P.origin != g || !P.data || P.data.type !== "authorization_response") return;
|
|
1313
|
-
const
|
|
1314
|
-
|
|
1318
|
+
const ce = P.source;
|
|
1319
|
+
ce && ce.close(), P.data.response.error ? w(v.fromPayload(P.data.response)) : b(P.data.response), clearTimeout(Ce), window.removeEventListener("message", L, !1), setTimeout(S, 2e3);
|
|
1315
1320
|
}, window.addEventListener("message", L, !1), window.document.body.appendChild(f), f.setAttribute("src", y);
|
|
1316
|
-
}))(
|
|
1321
|
+
})))(o, d, c);
|
|
1317
1322
|
if (r !== l.state) throw new v("state_mismatch", "Invalid state");
|
|
1318
1323
|
const m = await this._requestToken(Object.assign(Object.assign({}, e.authorizationParams), { code_verifier: h, code: l.code, grant_type: "authorization_code", redirect_uri: u, timeout: e.authorizationParams.timeout || this.httpTimeoutMs }), { nonceIn: a, organization: t.organization });
|
|
1319
1324
|
return Object.assign(Object.assign({}, m), { scope: p, oauthTokenScope: m.scope, audience: s });
|
|
@@ -1327,25 +1332,25 @@ class ut {
|
|
|
1327
1332
|
if (this.options.useRefreshTokensFallback) return await this._getTokenFromIFrame(e);
|
|
1328
1333
|
throw new V(e.authorizationParams.audience || "default", e.authorizationParams.scope);
|
|
1329
1334
|
}
|
|
1330
|
-
const
|
|
1335
|
+
const n = e.authorizationParams.redirect_uri || this.options.authorizationParams.redirect_uri || window.location.origin, o = typeof e.timeoutInSeconds == "number" ? 1e3 * e.timeoutInSeconds : null, r = ((s, c, d, l) => {
|
|
1331
1336
|
var m;
|
|
1332
1337
|
if (s && d && l) {
|
|
1333
1338
|
if (c.audience !== d) return c.scope;
|
|
1334
|
-
const y = l.split(" "), g = ((m = c.scope) === null || m === void 0 ? void 0 : m.split(" ")) || [], k = g.every((b) => y.includes(b));
|
|
1339
|
+
const y = l.split(" "), g = ((m = c.scope) === null || m === void 0 ? void 0 : m.split(" ")) || [], k = g.every(((b) => y.includes(b)));
|
|
1335
1340
|
return y.length >= g.length && k ? l : c.scope;
|
|
1336
1341
|
}
|
|
1337
1342
|
return c.scope;
|
|
1338
1343
|
})(this.options.useMrrt, e.authorizationParams, t == null ? void 0 : t.audience, t == null ? void 0 : t.scope);
|
|
1339
1344
|
try {
|
|
1340
|
-
const s = await this._requestToken(Object.assign(Object.assign(Object.assign({}, e.authorizationParams), { grant_type: "refresh_token", refresh_token: t && t.refresh_token, redirect_uri:
|
|
1341
|
-
if (s.refresh_token && this.options.useMrrt && (t != null && t.refresh_token) && await this.cacheManager.updateEntry(t.refresh_token, s.refresh_token), this.options.useMrrt && (a = t == null ? void 0 : t.audience, h = t == null ? void 0 : t.scope, u = e.authorizationParams.audience, p = e.authorizationParams.scope, (a !== u || !
|
|
1345
|
+
const s = await this._requestToken(Object.assign(Object.assign(Object.assign({}, e.authorizationParams), { grant_type: "refresh_token", refresh_token: t && t.refresh_token, redirect_uri: n }), o && { timeout: o }), { scopesToRequest: r });
|
|
1346
|
+
if (s.refresh_token && this.options.useMrrt && (t != null && t.refresh_token) && await this.cacheManager.updateEntry(t.refresh_token, s.refresh_token), this.options.useMrrt && (a = t == null ? void 0 : t.audience, h = t == null ? void 0 : t.scope, u = e.authorizationParams.audience, p = e.authorizationParams.scope, (a !== u || !we(p, h)) && !we(r, s.scope))) {
|
|
1342
1347
|
if (this.options.useRefreshTokensFallback) return await this._getTokenFromIFrame(e);
|
|
1343
1348
|
await this.cacheManager.remove(this.options.clientId, e.authorizationParams.audience, e.authorizationParams.scope);
|
|
1344
1349
|
const c = ((d, l) => {
|
|
1345
1350
|
const m = (d == null ? void 0 : d.split(" ")) || [], y = (l == null ? void 0 : l.split(" ")) || [];
|
|
1346
|
-
return m.filter((g) => y.indexOf(g) == -1).join(",");
|
|
1351
|
+
return m.filter(((g) => y.indexOf(g) == -1)).join(",");
|
|
1347
1352
|
})(r, s.scope);
|
|
1348
|
-
throw new
|
|
1353
|
+
throw new ae(e.authorizationParams.audience || "default", c);
|
|
1349
1354
|
}
|
|
1350
1355
|
return Object.assign(Object.assign({}, s), { scope: e.authorizationParams.scope, oauthTokenScope: s.scope, audience: e.authorizationParams.audience || "default" });
|
|
1351
1356
|
} catch (s) {
|
|
@@ -1355,26 +1360,26 @@ class ut {
|
|
|
1355
1360
|
var a, h, u, p;
|
|
1356
1361
|
}
|
|
1357
1362
|
async _saveEntryInCache(e) {
|
|
1358
|
-
const { id_token: t, decodedToken:
|
|
1359
|
-
this.userCache.set("@@user@@", { id_token: t, decodedToken:
|
|
1363
|
+
const { id_token: t, decodedToken: n } = e, o = I(e, ["id_token", "decodedToken"]);
|
|
1364
|
+
this.userCache.set("@@user@@", { id_token: t, decodedToken: n }), await this.cacheManager.setIdToken(this.options.clientId, e.id_token, e.decodedToken), await this.cacheManager.set(o);
|
|
1360
1365
|
}
|
|
1361
1366
|
async _getIdTokenFromCache() {
|
|
1362
|
-
const e = this.options.authorizationParams.audience || "default", t = this.scope[e],
|
|
1363
|
-
return
|
|
1367
|
+
const e = this.options.authorizationParams.audience || "default", t = this.scope[e], n = await this.cacheManager.getIdToken(new _({ clientId: this.options.clientId, audience: e, scope: t })), o = this.userCache.get("@@user@@");
|
|
1368
|
+
return n && n.id_token === (o == null ? void 0 : o.id_token) ? o : (this.userCache.set("@@user@@", n), n);
|
|
1364
1369
|
}
|
|
1365
|
-
async _getEntryFromCache({ scope: e, audience: t, clientId:
|
|
1366
|
-
const r = await this.cacheManager.get(new _({ scope: e, audience: t, clientId:
|
|
1370
|
+
async _getEntryFromCache({ scope: e, audience: t, clientId: n, cacheMode: o }) {
|
|
1371
|
+
const r = await this.cacheManager.get(new _({ scope: e, audience: t, clientId: n }), 60, this.options.useMrrt, o);
|
|
1367
1372
|
if (r && r.access_token) {
|
|
1368
1373
|
const { token_type: a, access_token: h, oauthTokenScope: u, expires_in: p } = r, s = await this._getIdTokenFromCache();
|
|
1369
1374
|
return s && Object.assign(Object.assign({ id_token: s.id_token, token_type: a || "Bearer", access_token: h }, u ? { scope: u } : null), { expires_in: p });
|
|
1370
1375
|
}
|
|
1371
1376
|
}
|
|
1372
1377
|
async _requestToken(e, t) {
|
|
1373
|
-
const { nonceIn:
|
|
1374
|
-
return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({}, a), { decodedToken: h, scope: e.scope, audience: e.audience || "default" }), a.scope ? { oauthTokenScope: a.scope } : null), { client_id: this.options.clientId })), this.cookieStorage.save(this.isAuthenticatedCookieName, !0, { daysUntilExpire: this.sessionCheckExpiryDays, cookieDomain: this.options.cookieDomain }), this._processOrgHint(
|
|
1378
|
+
const { nonceIn: n, organization: o, scopesToRequest: r } = t || {}, a = await Ge(Object.assign(Object.assign({ baseUrl: this.domainUrl, client_id: this.options.clientId, auth0Client: this.options.auth0Client, useFormData: this.options.useFormData, timeout: this.httpTimeoutMs, useMrrt: this.options.useMrrt, dpop: this.dpop }, e), { scope: r || e.scope }), this.worker), h = await this._verifyIdToken(a.id_token, n, o);
|
|
1379
|
+
return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({}, a), { decodedToken: h, scope: e.scope, audience: e.audience || "default" }), a.scope ? { oauthTokenScope: a.scope } : null), { client_id: this.options.clientId })), this.cookieStorage.save(this.isAuthenticatedCookieName, !0, { daysUntilExpire: this.sessionCheckExpiryDays, cookieDomain: this.options.cookieDomain }), this._processOrgHint(o || h.claims.org_id), Object.assign(Object.assign({}, a), { decodedToken: h });
|
|
1375
1380
|
}
|
|
1376
1381
|
async exchangeToken(e) {
|
|
1377
|
-
return this._requestToken({ grant_type: "urn:ietf:params:oauth:grant-type:token-exchange", subject_token: e.subject_token, subject_token_type: e.subject_token_type, scope: Z(this.scope, e.scope, e.audience || this.options.authorizationParams.audience), audience: e.audience || this.options.authorizationParams.audience });
|
|
1382
|
+
return this._requestToken({ grant_type: "urn:ietf:params:oauth:grant-type:token-exchange", subject_token: e.subject_token, subject_token_type: e.subject_token_type, scope: Z(this.scope, e.scope, e.audience || this.options.authorizationParams.audience), audience: e.audience || this.options.authorizationParams.audience, organization: e.organization || this.options.authorizationParams.organization });
|
|
1378
1383
|
}
|
|
1379
1384
|
_assertDpop(e) {
|
|
1380
1385
|
if (!e) throw new Error("`useDpop` option must be enabled before using DPoP.");
|
|
@@ -1389,35 +1394,36 @@ class ut {
|
|
|
1389
1394
|
return this._assertDpop(this.dpop), this.dpop.generateProof(e);
|
|
1390
1395
|
}
|
|
1391
1396
|
createFetcher(e = {}) {
|
|
1392
|
-
return new
|
|
1393
|
-
var
|
|
1394
|
-
return this.getTokenSilently({ authorizationParams: { scope: (
|
|
1397
|
+
return new ct(e, { isDpopEnabled: () => !!this.options.useDpop, getAccessToken: (t) => {
|
|
1398
|
+
var n;
|
|
1399
|
+
return this.getTokenSilently({ authorizationParams: { scope: (n = t == null ? void 0 : t.scope) === null || n === void 0 ? void 0 : n.join(" "), audience: t == null ? void 0 : t.audience }, detailedResponse: !0 });
|
|
1395
1400
|
}, getDpopNonce: () => this.getDpopNonce(e.dpopNonceId), setDpopNonce: (t) => this.setDpopNonce(t, e.dpopNonceId), generateDpopProof: (t) => this.generateDpopProof(t) });
|
|
1396
1401
|
}
|
|
1397
1402
|
async connectAccountWithRedirect(e) {
|
|
1398
|
-
const { openUrl: t, appState:
|
|
1399
|
-
if (!
|
|
1400
|
-
const
|
|
1401
|
-
this.transactionManager.create({ state:
|
|
1402
|
-
const
|
|
1403
|
-
|
|
1403
|
+
const { openUrl: t, appState: n, connection: o, scopes: r, authorization_params: a, redirectUri: h = this.options.authorizationParams.redirect_uri || window.location.origin } = e;
|
|
1404
|
+
if (!o) throw new Error("connection is required");
|
|
1405
|
+
const u = G(N()), p = N(), s = await ue(p), c = de(s), { connect_uri: d, connect_params: l, auth_session: m } = await this.myAccountApi.connectAccount({ connection: o, scopes: r, redirect_uri: h, state: u, code_challenge: c, code_challenge_method: "S256", authorization_params: a });
|
|
1406
|
+
this.transactionManager.create({ state: u, code_verifier: p, auth_session: m, redirect_uri: h, appState: n, connection: o, response_type: j.ConnectCode });
|
|
1407
|
+
const y = new URL(d);
|
|
1408
|
+
y.searchParams.set("ticket", l.ticket), t ? await t(y.toString()) : window.location.assign(y);
|
|
1404
1409
|
}
|
|
1405
1410
|
}
|
|
1406
1411
|
export {
|
|
1407
|
-
|
|
1412
|
+
ht as Auth0Client,
|
|
1408
1413
|
te as AuthenticationError,
|
|
1409
1414
|
_ as CacheKey,
|
|
1410
|
-
|
|
1415
|
+
ne as ConnectError,
|
|
1411
1416
|
v as GenericError,
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1417
|
+
Pe as InMemoryCache,
|
|
1418
|
+
Me as LocalStorageCache,
|
|
1419
|
+
se as MfaRequiredError,
|
|
1415
1420
|
V as MissingRefreshTokenError,
|
|
1416
1421
|
X as MyAccountApiError,
|
|
1417
1422
|
ie as PopupCancelledError,
|
|
1418
|
-
|
|
1423
|
+
re as PopupOpenError,
|
|
1424
|
+
oe as PopupTimeoutError,
|
|
1419
1425
|
j as ResponseType,
|
|
1420
1426
|
U as TimeoutError,
|
|
1421
1427
|
F as UseDpopNonceError
|
|
1422
1428
|
};
|
|
1423
|
-
//# sourceMappingURL=auth0-spa-js.production.esm-
|
|
1429
|
+
//# sourceMappingURL=auth0-spa-js.production.esm-9WdmjTxR.js.map
|