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