@trimble-oss/trimble-id-react 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/trimble-id-react.es.js +305 -932
- package/dist/trimble-id-react.umd.js +1 -27
- package/package.json +1 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { OpenIdEndpointProvider as
|
|
5
|
-
import * as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
1
|
+
var H = Object.defineProperty;
|
|
2
|
+
var B = (i, e, t) => e in i ? H(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
+
var a = (i, e, t) => (B(i, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import { OpenIdEndpointProvider as Y, AuthorizationCodeGrantTokenProvider as A, AnalyticsHttpClient as z, BearerTokenHttpClientProvider as Q } from "@trimble-oss/trimble-id";
|
|
5
|
+
import * as p from "es-cookie";
|
|
6
|
+
import X from "jwt-decode";
|
|
7
|
+
import { createContext as q, useContext as N, useState as Z, useReducer as j, useRef as ee, useMemo as R, useEffect as b, useCallback as f } from "react";
|
|
8
|
+
import { jsx as W, Fragment as te } from "react/jsx-runtime";
|
|
9
|
+
class ie {
|
|
9
10
|
constructor() {
|
|
10
11
|
/**
|
|
11
12
|
* This function generate a encapsulation function to store
|
|
@@ -14,8 +15,8 @@ class Dt {
|
|
|
14
15
|
* @see {https://medium.com/javascript-scene/encapsulation-in-javascript-26be60e325b4} Encapsulation
|
|
15
16
|
* @return {CacheStorage} Key for the token
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
|
-
const
|
|
18
|
+
a(this, "generateCache", function() {
|
|
19
|
+
const e = {
|
|
19
20
|
token: void 0,
|
|
20
21
|
user: void 0
|
|
21
22
|
};
|
|
@@ -25,93 +26,93 @@ class Dt {
|
|
|
25
26
|
* @return {Promise<TIDAuthToken | undefined>} Token store in memory
|
|
26
27
|
*/
|
|
27
28
|
async getToken() {
|
|
28
|
-
return
|
|
29
|
+
return e.token;
|
|
29
30
|
},
|
|
30
31
|
/**
|
|
31
32
|
* Get user store in cache
|
|
32
33
|
* @return {Promise<TIDUser | undefined>} User store in memory
|
|
33
34
|
*/
|
|
34
35
|
async getUser() {
|
|
35
|
-
return
|
|
36
|
+
return e.user;
|
|
36
37
|
},
|
|
37
38
|
/**
|
|
38
39
|
* Store token in cache
|
|
39
40
|
* @param {TIDAuthToken} token - Token that you want to store in cache
|
|
40
41
|
* @return {Promise<void>} Empty promise
|
|
41
42
|
*/
|
|
42
|
-
async storeToken(
|
|
43
|
-
|
|
43
|
+
async storeToken(t) {
|
|
44
|
+
e.token = t;
|
|
44
45
|
},
|
|
45
46
|
/**
|
|
46
47
|
* Store user in cache
|
|
47
48
|
* @param {TIDUser} user - User that you want to store in cache
|
|
48
49
|
* @return {Promise<void>} Empty promise
|
|
49
50
|
*/
|
|
50
|
-
async storeUser(
|
|
51
|
-
|
|
51
|
+
async storeUser(t) {
|
|
52
|
+
e.user = t;
|
|
52
53
|
},
|
|
53
54
|
/**
|
|
54
55
|
* The clear the cache from the storage
|
|
55
56
|
* @return {Promise<void>} Empty promise
|
|
56
57
|
*/
|
|
57
58
|
clear() {
|
|
58
|
-
return
|
|
59
|
+
return e.token = void 0, e.user = void 0, Promise.resolve(void 0);
|
|
59
60
|
}
|
|
60
61
|
};
|
|
61
62
|
}());
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
|
-
class
|
|
65
|
+
class se {
|
|
65
66
|
/**
|
|
66
67
|
* Initialized configuration to store information into local storage
|
|
67
68
|
* @param {LocalStorageCacheOptions} options - Configuration for caching in localstorage
|
|
68
69
|
*/
|
|
69
|
-
constructor(
|
|
70
|
+
constructor(e) {
|
|
70
71
|
/**
|
|
71
72
|
* Local storage from the browser
|
|
72
73
|
* @type {Storage}
|
|
73
74
|
*/
|
|
74
|
-
|
|
75
|
+
a(this, "localStorage");
|
|
75
76
|
/**
|
|
76
77
|
* The cache key represents the keys for storing and retrieving user and token from auth
|
|
77
78
|
* @type {CacheKey}
|
|
78
79
|
*/
|
|
79
|
-
|
|
80
|
-
this.localStorage = window.localStorage, this.cacheKey =
|
|
80
|
+
a(this, "cacheKey");
|
|
81
|
+
this.localStorage = window.localStorage, this.cacheKey = e.cacheKey;
|
|
81
82
|
}
|
|
82
83
|
/**
|
|
83
84
|
* Get token store in localstorage
|
|
84
85
|
* @return {Promise<TIDAuthToken | undefined>} - Token store in localstorage
|
|
85
86
|
*/
|
|
86
87
|
async getToken() {
|
|
87
|
-
const
|
|
88
|
-
return
|
|
88
|
+
const e = this.getAuthKey(), t = localStorage.getItem(e);
|
|
89
|
+
return t ? JSON.parse(t) : void 0;
|
|
89
90
|
}
|
|
90
91
|
/**
|
|
91
92
|
* Get user store in localstorage
|
|
92
93
|
* @return {Promise<TIDUser | undefined>} - User store in localstorage
|
|
93
94
|
*/
|
|
94
95
|
async getUser() {
|
|
95
|
-
const
|
|
96
|
-
return
|
|
96
|
+
const e = this.getUserKey(), t = localStorage.getItem(e);
|
|
97
|
+
return t ? JSON.parse(t) : void 0;
|
|
97
98
|
}
|
|
98
99
|
/**
|
|
99
100
|
* Store token in localstorage
|
|
100
101
|
* @param {TIDAuthToken} token - Token that you want to store in localstorage
|
|
101
102
|
* @return {Promise<void>} Empty promise
|
|
102
103
|
*/
|
|
103
|
-
async storeToken(
|
|
104
|
-
const
|
|
105
|
-
localStorage.setItem(
|
|
104
|
+
async storeToken(e) {
|
|
105
|
+
const t = this.getAuthKey(), s = JSON.stringify(e);
|
|
106
|
+
localStorage.setItem(t, s);
|
|
106
107
|
}
|
|
107
108
|
/**
|
|
108
109
|
* Store user in cache
|
|
109
110
|
* @param {TIDUser} user - User that you want to store in localstorage
|
|
110
111
|
* @return {Promise<void>} Empty promise
|
|
111
112
|
*/
|
|
112
|
-
async storeUser(
|
|
113
|
-
const
|
|
114
|
-
localStorage.setItem(
|
|
113
|
+
async storeUser(e) {
|
|
114
|
+
const t = this.getUserKey(), s = JSON.stringify(e);
|
|
115
|
+
localStorage.setItem(t, s);
|
|
115
116
|
}
|
|
116
117
|
/**
|
|
117
118
|
* Get the full key from the cachekey for the user
|
|
@@ -135,34 +136,34 @@ class Mt {
|
|
|
135
136
|
return this.localStorage.removeItem(this.getAuthKey()), this.localStorage.removeItem(this.getUserKey()), Promise.resolve(void 0);
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
|
-
const
|
|
139
|
-
class
|
|
139
|
+
const T = "@TID", re = `${T}_AUTH_KEY`, ne = `${T}_USER_KEY`;
|
|
140
|
+
class oe {
|
|
140
141
|
/**
|
|
141
142
|
* Initialized the cache key
|
|
142
143
|
* @param {CacheKeyOptions} cacheKeyOptions - Cache key options to edit the default values
|
|
143
144
|
*/
|
|
144
|
-
constructor(
|
|
145
|
+
constructor(e) {
|
|
145
146
|
/**
|
|
146
147
|
* Client id of the application created in trimble developer console
|
|
147
148
|
* @type {string}
|
|
148
149
|
*/
|
|
149
|
-
|
|
150
|
+
a(this, "clientId");
|
|
150
151
|
/**
|
|
151
152
|
* Prefix value of the key, by default the prefix is based on the constant PREFIX_KEY
|
|
152
153
|
* @type {string}
|
|
153
154
|
*/
|
|
154
|
-
|
|
155
|
+
a(this, "prefix", T);
|
|
155
156
|
/**
|
|
156
157
|
* Suffix value use it to generate the key to store and retrieve the token, by default the prefix is based on the constant AUTH_KEY
|
|
157
158
|
* @type {string}
|
|
158
159
|
*/
|
|
159
|
-
|
|
160
|
+
a(this, "authSuffix", re);
|
|
160
161
|
/**
|
|
161
162
|
* Suffix value use it to generate the key to store and retrieve the user, by default the prefix is based on the constant USER_KEY
|
|
162
163
|
* @type {string}
|
|
163
164
|
*/
|
|
164
|
-
|
|
165
|
-
this.clientId =
|
|
165
|
+
a(this, "userSuffix", ne);
|
|
166
|
+
this.clientId = e.client_id;
|
|
166
167
|
}
|
|
167
168
|
/**
|
|
168
169
|
* Get key to store/retrieve user
|
|
@@ -179,57 +180,57 @@ class Ft {
|
|
|
179
180
|
return `${this.prefix}_${this.authSuffix}_${this.clientId}`;
|
|
180
181
|
}
|
|
181
182
|
}
|
|
182
|
-
class
|
|
183
|
+
class ae {
|
|
183
184
|
/**
|
|
184
185
|
* Initialized configuration to store information into session storage
|
|
185
186
|
* @param {SessionStorageCacheOptions} options - Configuration for caching in session storage
|
|
186
187
|
*/
|
|
187
|
-
constructor(
|
|
188
|
+
constructor(e) {
|
|
188
189
|
/**
|
|
189
190
|
* Session storage from the browser
|
|
190
191
|
* @type {Storage}
|
|
191
192
|
*/
|
|
192
|
-
|
|
193
|
+
a(this, "sessionStorage");
|
|
193
194
|
/**
|
|
194
195
|
* The cache key represents the keys for storing and retrieving user and token from auth
|
|
195
196
|
* @type {CacheKey}
|
|
196
197
|
*/
|
|
197
|
-
|
|
198
|
-
this.sessionStorage = window.sessionStorage, this.cacheKey =
|
|
198
|
+
a(this, "cacheKey");
|
|
199
|
+
this.sessionStorage = window.sessionStorage, this.cacheKey = e.cacheKey;
|
|
199
200
|
}
|
|
200
201
|
/**
|
|
201
202
|
* Get token store in session storage
|
|
202
203
|
* @return {Promise<TIDAuthToken | undefined>} - Token store in session storage
|
|
203
204
|
*/
|
|
204
205
|
async getToken() {
|
|
205
|
-
const
|
|
206
|
-
return
|
|
206
|
+
const e = this.getAuthKey(), t = sessionStorage.getItem(e);
|
|
207
|
+
return t ? JSON.parse(t) : void 0;
|
|
207
208
|
}
|
|
208
209
|
/**
|
|
209
210
|
* Get user store in session storage
|
|
210
211
|
* @return {Promise<TIDUser | undefined>} - User store in session storage
|
|
211
212
|
*/
|
|
212
213
|
async getUser() {
|
|
213
|
-
const
|
|
214
|
-
return
|
|
214
|
+
const e = this.getUserKey(), t = sessionStorage.getItem(e);
|
|
215
|
+
return t ? JSON.parse(t) : void 0;
|
|
215
216
|
}
|
|
216
217
|
/**
|
|
217
218
|
* Store token in session storage
|
|
218
219
|
* @param {TIDAuthToken} authToken - Token that you want to store in session storage
|
|
219
220
|
* @return {Promise<void>} Empty promise
|
|
220
221
|
*/
|
|
221
|
-
async storeToken(
|
|
222
|
-
const
|
|
223
|
-
sessionStorage.setItem(
|
|
222
|
+
async storeToken(e) {
|
|
223
|
+
const t = this.getAuthKey(), s = JSON.stringify(e);
|
|
224
|
+
sessionStorage.setItem(t, s);
|
|
224
225
|
}
|
|
225
226
|
/**
|
|
226
227
|
* Store user in cache
|
|
227
228
|
* @param {TIDUser} user - User that you want to store in session storage
|
|
228
229
|
* @return {Promise<void>} Empty promise
|
|
229
230
|
*/
|
|
230
|
-
async storeUser(
|
|
231
|
-
const
|
|
232
|
-
sessionStorage.setItem(
|
|
231
|
+
async storeUser(e) {
|
|
232
|
+
const t = this.getUserKey(), s = JSON.stringify(e);
|
|
233
|
+
sessionStorage.setItem(t, s);
|
|
233
234
|
}
|
|
234
235
|
/**
|
|
235
236
|
* Get the full key from the cachekey for the user
|
|
@@ -253,12 +254,12 @@ class Nt {
|
|
|
253
254
|
return this.sessionStorage.removeItem(this.getAuthKey()), this.sessionStorage.removeItem(this.getUserKey()), Promise.resolve(void 0);
|
|
254
255
|
}
|
|
255
256
|
}
|
|
256
|
-
class
|
|
257
|
+
class ce {
|
|
257
258
|
/**
|
|
258
259
|
* Create a cache manager to extract or save the user, and token
|
|
259
260
|
* @param {CacheManagerOptions} options - Configuration for the managing the caching
|
|
260
261
|
*/
|
|
261
|
-
constructor(
|
|
262
|
+
constructor(e) {
|
|
262
263
|
/**
|
|
263
264
|
* Type persistent you want the user and token to be store
|
|
264
265
|
* in-memory - This one will only persist will the user stays in the page
|
|
@@ -266,40 +267,40 @@ class Wt {
|
|
|
266
267
|
* sessionStorage - This one is cleared when the page session ends
|
|
267
268
|
* @type {PersistentStore}
|
|
268
269
|
*/
|
|
269
|
-
|
|
270
|
+
a(this, "persistentStore");
|
|
270
271
|
/**
|
|
271
272
|
* Cache option selected
|
|
272
273
|
* @type {CacheStorage}
|
|
273
274
|
*/
|
|
274
|
-
|
|
275
|
+
a(this, "cacheStorage");
|
|
275
276
|
/**
|
|
276
277
|
* The cache key represents the keys for storing and retrieving user and token from auth
|
|
277
278
|
* @type {CacheKey}
|
|
278
279
|
*/
|
|
279
|
-
|
|
280
|
-
this.persistentStore =
|
|
281
|
-
client_id:
|
|
282
|
-
}), this.persistentStore === "localStorage" ? this.cacheStorage = new
|
|
280
|
+
a(this, "cacheKey");
|
|
281
|
+
this.persistentStore = e.persistentStore, this.cacheKey = new oe({
|
|
282
|
+
client_id: e.clientId
|
|
283
|
+
}), this.persistentStore === "localStorage" ? this.cacheStorage = new se({
|
|
283
284
|
cacheKey: this.cacheKey
|
|
284
|
-
}) : this.persistentStore === "sessionStorage" ? this.cacheStorage = new
|
|
285
|
+
}) : this.persistentStore === "sessionStorage" ? this.cacheStorage = new ae({
|
|
285
286
|
cacheKey: this.cacheKey
|
|
286
|
-
}) : this.cacheStorage = new
|
|
287
|
+
}) : this.cacheStorage = new ie().generateCache;
|
|
287
288
|
}
|
|
288
289
|
/**
|
|
289
290
|
* Store token in cache
|
|
290
291
|
* @param {TIDAuthToken} token - Token that you want to store in cache
|
|
291
292
|
* @return {Promise<void>} Empty promise
|
|
292
293
|
*/
|
|
293
|
-
async setToken(
|
|
294
|
-
await this.cacheStorage.storeToken(
|
|
294
|
+
async setToken(e) {
|
|
295
|
+
await this.cacheStorage.storeToken(e);
|
|
295
296
|
}
|
|
296
297
|
/**
|
|
297
298
|
* Store user in cache
|
|
298
299
|
* @param {TIDUser} user - User that you want to store in cache
|
|
299
300
|
* @return {Promise<void>} Empty promise
|
|
300
301
|
*/
|
|
301
|
-
async setUser(
|
|
302
|
-
await this.cacheStorage.storeUser(
|
|
302
|
+
async setUser(e) {
|
|
303
|
+
await this.cacheStorage.storeUser(e);
|
|
303
304
|
}
|
|
304
305
|
/**
|
|
305
306
|
* Get user store in cache
|
|
@@ -323,45 +324,45 @@ class Wt {
|
|
|
323
324
|
await this.cacheStorage.clear();
|
|
324
325
|
}
|
|
325
326
|
}
|
|
326
|
-
const
|
|
327
|
-
let
|
|
328
|
-
if (!
|
|
327
|
+
const x = 5 * 6e4, le = ["code", "state"], O = (i) => i.split("?")[0], he = (i) => i.split("?")[1], V = (i) => {
|
|
328
|
+
let e = i;
|
|
329
|
+
if (!i.startsWith("?"))
|
|
329
330
|
try {
|
|
330
|
-
|
|
331
|
+
e = new URL(i).search;
|
|
331
332
|
} catch {
|
|
332
333
|
}
|
|
333
|
-
return new URLSearchParams(
|
|
334
|
-
},
|
|
335
|
-
if (
|
|
336
|
-
const
|
|
337
|
-
if (
|
|
334
|
+
return new URLSearchParams(e);
|
|
335
|
+
}, de = (i = window.location.href, e) => {
|
|
336
|
+
if (e != null) {
|
|
337
|
+
const s = O(e), r = O(i ?? "");
|
|
338
|
+
if (s !== r)
|
|
338
339
|
return !1;
|
|
339
340
|
}
|
|
340
|
-
const
|
|
341
|
-
for (const
|
|
342
|
-
if (!
|
|
341
|
+
const t = V(i);
|
|
342
|
+
for (const s of le)
|
|
343
|
+
if (!t.has(s))
|
|
343
344
|
return !1;
|
|
344
345
|
return !0;
|
|
345
|
-
},
|
|
346
|
-
id:
|
|
347
|
-
name: `${
|
|
348
|
-
given_name:
|
|
349
|
-
family_name:
|
|
350
|
-
picture:
|
|
351
|
-
email:
|
|
352
|
-
email_verified:
|
|
346
|
+
}, ue = (i) => ({
|
|
347
|
+
id: i.sub,
|
|
348
|
+
name: `${i.given_name} ${i.family_name}`,
|
|
349
|
+
given_name: i.given_name,
|
|
350
|
+
family_name: i.family_name,
|
|
351
|
+
picture: i.picture,
|
|
352
|
+
email: i.email,
|
|
353
|
+
email_verified: i.email_verified,
|
|
353
354
|
phone_number_verified: !1
|
|
354
|
-
}),
|
|
355
|
-
class
|
|
355
|
+
}), ge = "@TID_COOKIE";
|
|
356
|
+
class ye {
|
|
356
357
|
/**
|
|
357
358
|
* Retrieve a cookie from the browser
|
|
358
359
|
* @param {string} key - Key to retrieve the cookies
|
|
359
360
|
*/
|
|
360
|
-
get(
|
|
361
|
-
const
|
|
362
|
-
if (
|
|
361
|
+
get(e) {
|
|
362
|
+
const t = p.get(e);
|
|
363
|
+
if (t == null)
|
|
363
364
|
throw new Error("Cookie not found");
|
|
364
|
-
return JSON.parse(
|
|
365
|
+
return JSON.parse(t);
|
|
365
366
|
}
|
|
366
367
|
/**
|
|
367
368
|
* Store cookies in the browser
|
|
@@ -373,12 +374,12 @@ class Bt {
|
|
|
373
374
|
* @example Save cookies with a custom domain
|
|
374
375
|
* cookiesStorage.set('key',{data:{...}},{domain:'https://example.com/subpath'})
|
|
375
376
|
*/
|
|
376
|
-
set(
|
|
377
|
-
let
|
|
378
|
-
window.location.protocol === "https:" && (
|
|
377
|
+
set(e, t, s) {
|
|
378
|
+
let r = {};
|
|
379
|
+
window.location.protocol === "https:" && (r = {
|
|
379
380
|
secure: !0,
|
|
380
381
|
sameSite: "none"
|
|
381
|
-
}),
|
|
382
|
+
}), s != null && s.expires && (r.expires = s.expires), s != null && s.domain && (r.domain = s.domain), p.set(e, JSON.stringify(t), r);
|
|
382
383
|
}
|
|
383
384
|
/**
|
|
384
385
|
* Remove a cookie from the browser
|
|
@@ -389,35 +390,35 @@ class Bt {
|
|
|
389
390
|
* @example Remove cookies with custom domain
|
|
390
391
|
* cookiesStorage.remove('key',{domain:'https://example.com/subpath'})
|
|
391
392
|
*/
|
|
392
|
-
remove(
|
|
393
|
-
const
|
|
394
|
-
|
|
393
|
+
remove(e, t) {
|
|
394
|
+
const s = {};
|
|
395
|
+
t != null && t.domain && (s.domain = t.domain), p.remove(e, s);
|
|
395
396
|
}
|
|
396
397
|
}
|
|
397
|
-
class
|
|
398
|
+
class fe {
|
|
398
399
|
/**
|
|
399
400
|
* Create a cookies manager to extract or save cookies in the browser
|
|
400
401
|
* @param {CookiesManagerOptions} options - Configuration for the managing the cookies
|
|
401
402
|
*/
|
|
402
|
-
constructor(
|
|
403
|
+
constructor(e) {
|
|
403
404
|
/**
|
|
404
405
|
* Cookie full key to store and retrieve the information from cookies
|
|
405
406
|
* @type {string}
|
|
406
407
|
*/
|
|
407
|
-
|
|
408
|
+
a(this, "cookieKey");
|
|
408
409
|
/**
|
|
409
410
|
* Cookie storage. This object contain all functions necessary to retrieve and store tokens using cookies
|
|
410
411
|
* @type {CookiesStorage}
|
|
411
412
|
*/
|
|
412
|
-
|
|
413
|
-
this.cookieKey = `${
|
|
413
|
+
a(this, "cookiesStorage");
|
|
414
|
+
this.cookieKey = `${ge}.${e.clientId}`, this.cookiesStorage = new ye();
|
|
414
415
|
}
|
|
415
416
|
/**
|
|
416
417
|
* Store cookies in the browser
|
|
417
418
|
* @param {CookieValue} value - information to store
|
|
418
419
|
*/
|
|
419
|
-
save(
|
|
420
|
-
this.cookiesStorage.set(this.cookieKey,
|
|
420
|
+
save(e) {
|
|
421
|
+
this.cookiesStorage.set(this.cookieKey, e, {
|
|
421
422
|
expires: 1
|
|
422
423
|
});
|
|
423
424
|
}
|
|
@@ -439,75 +440,75 @@ class zt {
|
|
|
439
440
|
this.cookiesStorage.remove(this.cookieKey);
|
|
440
441
|
}
|
|
441
442
|
}
|
|
442
|
-
class
|
|
443
|
+
class M extends Error {
|
|
443
444
|
}
|
|
444
|
-
class
|
|
445
|
+
class L extends Error {
|
|
445
446
|
}
|
|
446
|
-
class
|
|
447
|
+
class ke extends Error {
|
|
447
448
|
}
|
|
448
|
-
const
|
|
449
|
+
const d = "@trimble-oss/trimble-id-react", u = "0.1.1", me = {
|
|
449
450
|
configurationEndpoint: "",
|
|
450
451
|
clientId: "",
|
|
451
452
|
redirectUrl: "",
|
|
452
453
|
logoutRedirectUrl: "",
|
|
453
454
|
scopes: []
|
|
454
|
-
},
|
|
455
|
+
}, Se = {
|
|
455
456
|
persistentStore: "in-memory"
|
|
456
457
|
};
|
|
457
|
-
class
|
|
458
|
+
class pe {
|
|
458
459
|
/**
|
|
459
460
|
* Create a TID client to handle manage all user authentication functions and information
|
|
460
461
|
* @param {CacheManagerOptions} props - TID client configuration
|
|
461
462
|
*/
|
|
462
|
-
constructor(
|
|
463
|
+
constructor(e) {
|
|
463
464
|
/**
|
|
464
465
|
* Token provider SDK. This object handles all necessary communication with TID
|
|
465
466
|
* @type {AuthorizationCodeGrantTokenProvider}
|
|
466
467
|
*/
|
|
467
|
-
|
|
468
|
+
a(this, "tokenProvider");
|
|
468
469
|
/**
|
|
469
470
|
* This object manage all caching, and all configurations necessary
|
|
470
471
|
* @type {CacheManager}
|
|
471
472
|
*/
|
|
472
|
-
|
|
473
|
+
a(this, "cacheManager");
|
|
473
474
|
/**
|
|
474
475
|
* This object manage all cookies administration, and all configurations necessary
|
|
475
476
|
* @type {CookiesManager}
|
|
476
477
|
*/
|
|
477
|
-
|
|
478
|
+
a(this, "cookiesManager");
|
|
478
479
|
/**
|
|
479
480
|
* Client id of the application created in trimble developer console
|
|
480
481
|
* @type {string}
|
|
481
482
|
*/
|
|
482
|
-
|
|
483
|
+
a(this, "clientId");
|
|
483
484
|
/**
|
|
484
485
|
* Callback url to redirect the user after the authentication is successful
|
|
485
486
|
* @type {string}
|
|
486
487
|
*/
|
|
487
|
-
|
|
488
|
+
a(this, "redirectUrl");
|
|
488
489
|
/**
|
|
489
490
|
* AnalyticsHttpClient for sending events
|
|
490
491
|
* @type {AnalyticsHttpClient}
|
|
491
492
|
*/
|
|
492
|
-
|
|
493
|
-
const { config:
|
|
494
|
-
if (this.redirectUrl =
|
|
493
|
+
a(this, "analyticshttpclient");
|
|
494
|
+
const { config: t = me, persistentOptions: s = Se } = e;
|
|
495
|
+
if (this.redirectUrl = t.redirectUrl, t.configurationEndpoint == null || t.configurationEndpoint == "")
|
|
495
496
|
throw new Error("Configuration endpoint not defined");
|
|
496
|
-
if (
|
|
497
|
+
if (t.clientId == null || t.clientId == "")
|
|
497
498
|
throw new Error("Consumer key is not defined");
|
|
498
|
-
this.cookiesManager = new
|
|
499
|
-
clientId:
|
|
499
|
+
this.cookiesManager = new fe({
|
|
500
|
+
clientId: t.clientId
|
|
500
501
|
});
|
|
501
|
-
const
|
|
502
|
-
let
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
).WithScopes(
|
|
507
|
-
|
|
508
|
-
clientId:
|
|
509
|
-
persistentStore:
|
|
510
|
-
}), this.clientId =
|
|
502
|
+
const r = this.cookiesManager.get(), l = new Y(t.configurationEndpoint);
|
|
503
|
+
let c = new A(
|
|
504
|
+
l,
|
|
505
|
+
t.clientId,
|
|
506
|
+
t.redirectUrl
|
|
507
|
+
).WithScopes(t.scopes);
|
|
508
|
+
t.logoutRedirectUrl && (c = c.WithLogoutRedirect(t.logoutRedirectUrl)), (r == null ? void 0 : r.code_verifier) != null && (c = c.WithProofKeyForCodeExchange(r.code_verifier)), this.tokenProvider = c, this.cacheManager = new ce({
|
|
509
|
+
clientId: t.clientId,
|
|
510
|
+
persistentStore: s.persistentStore
|
|
511
|
+
}), this.clientId = t.clientId, this.analyticshttpclient = z, this.analyticshttpclient.sendInitEvent("TIDClient", this.clientId, d, u);
|
|
511
512
|
}
|
|
512
513
|
/**
|
|
513
514
|
* Redirect the user to TID using the browser
|
|
@@ -521,12 +522,12 @@ class Qt {
|
|
|
521
522
|
* // Redirect calls onRedirect with the log-out url for TID
|
|
522
523
|
* // So it can be handled by the developer
|
|
523
524
|
*/
|
|
524
|
-
async loginWithRedirect(
|
|
525
|
-
this.analyticshttpclient.sendMethodEvent(this.loginWithRedirect.name, this.clientId,
|
|
526
|
-
const { onRedirect:
|
|
527
|
-
this.cookiesManager.save({ code_verifier:
|
|
528
|
-
const
|
|
529
|
-
|
|
525
|
+
async loginWithRedirect(e) {
|
|
526
|
+
this.analyticshttpclient.sendMethodEvent(this.loginWithRedirect.name, this.clientId, d, u);
|
|
527
|
+
const { onRedirect: t } = e || {}, s = A.GenerateCodeVerifier();
|
|
528
|
+
this.cookiesManager.save({ code_verifier: s }), this.tokenProvider = this.tokenProvider.WithProofKeyForCodeExchange(s);
|
|
529
|
+
const r = await this.tokenProvider.GetOAuthRedirect("state");
|
|
530
|
+
t != null ? t(r) : window.location.assign(r);
|
|
530
531
|
}
|
|
531
532
|
/**
|
|
532
533
|
* Authenticated the user using the url callback params
|
|
@@ -540,13 +541,13 @@ class Qt {
|
|
|
540
541
|
* handleCallback('https://example.com?code=code....')
|
|
541
542
|
* // Will try to log in the user with the url assign by the developer
|
|
542
543
|
*/
|
|
543
|
-
async handleCallback(
|
|
544
|
-
const
|
|
545
|
-
if (
|
|
546
|
-
throw new
|
|
547
|
-
const
|
|
548
|
-
return await this.tokenProvider.ValidateQuery(
|
|
549
|
-
authState:
|
|
544
|
+
async handleCallback(e = window.location.href) {
|
|
545
|
+
const t = this.cookiesManager.get();
|
|
546
|
+
if (t == null || (t == null ? void 0 : t.code_verifier) == null)
|
|
547
|
+
throw new ke("Code verifier not available");
|
|
548
|
+
const s = he(e), r = V(e), l = r.get("identity_provider") ?? "", c = r.get("state") ?? "";
|
|
549
|
+
return await this.tokenProvider.ValidateQuery(s), await this.generateToken(l), {
|
|
550
|
+
authState: c
|
|
550
551
|
};
|
|
551
552
|
}
|
|
552
553
|
/**
|
|
@@ -554,33 +555,33 @@ class Qt {
|
|
|
554
555
|
* @param {string} identityProvider - Type of identity provider used
|
|
555
556
|
* @return {Promise<void>} Empty promise
|
|
556
557
|
*/
|
|
557
|
-
async generateToken(
|
|
558
|
-
var
|
|
559
|
-
const
|
|
558
|
+
async generateToken(e) {
|
|
559
|
+
var S, n;
|
|
560
|
+
const t = await this.tokenProvider.RetrieveToken(), s = await this.tokenProvider.RetrieveRefreshToken(), r = await this.tokenProvider.RetrieveIdToken(), l = await this.tokenProvider.RetrieveTokenExpiry(), k = new Date(l).getTime(), y = (n = (S = this.tokenProvider) == null ? void 0 : S._scopes) == null ? void 0 : n.join(" ");
|
|
560
561
|
await this.cacheManager.setToken({
|
|
561
|
-
scope:
|
|
562
|
+
scope: y,
|
|
562
563
|
state: "",
|
|
563
564
|
session_state: "",
|
|
564
|
-
identity_provider:
|
|
565
|
+
identity_provider: e,
|
|
565
566
|
token_type: "bearer",
|
|
566
|
-
access_token:
|
|
567
|
-
refresh_token:
|
|
568
|
-
id_token:
|
|
569
|
-
expires_at:
|
|
567
|
+
access_token: t,
|
|
568
|
+
refresh_token: s,
|
|
569
|
+
id_token: r,
|
|
570
|
+
expires_at: k
|
|
570
571
|
});
|
|
571
|
-
const
|
|
572
|
-
await this.cacheManager.setUser(
|
|
572
|
+
const m = X(r), E = ue(m);
|
|
573
|
+
await this.cacheManager.setUser(E), await this.reloadCodeVerifier();
|
|
573
574
|
}
|
|
574
575
|
async reloadCodeVerifier() {
|
|
575
|
-
const
|
|
576
|
-
this.cookiesManager.save({ code_verifier:
|
|
576
|
+
const e = await this.tokenProvider.RetrieveCodeVerifier();
|
|
577
|
+
this.cookiesManager.save({ code_verifier: e }), this.tokenProvider = this.tokenProvider.WithProofKeyForCodeExchange(e);
|
|
577
578
|
}
|
|
578
579
|
/**
|
|
579
580
|
* Return the user stored in cache
|
|
580
581
|
* @return {Promise<TIDUser | undefined>} User in cache
|
|
581
582
|
*/
|
|
582
583
|
async getUser() {
|
|
583
|
-
return this.analyticshttpclient.sendMethodEvent(this.getUser.name, this.clientId,
|
|
584
|
+
return this.analyticshttpclient.sendMethodEvent(this.getUser.name, this.clientId, d, u), await this.cacheManager.getUser();
|
|
584
585
|
}
|
|
585
586
|
/**
|
|
586
587
|
* Gets the access token from cache. If the token already expired,
|
|
@@ -590,20 +591,20 @@ class Qt {
|
|
|
590
591
|
* @throws {TokenExpiredException} Will throw an exception if the user token expired
|
|
591
592
|
*/
|
|
592
593
|
async getAccessTokenSilently() {
|
|
593
|
-
this.analyticshttpclient.sendMethodEvent(this.getAccessTokenSilently.name, this.clientId,
|
|
594
|
-
let
|
|
595
|
-
if (
|
|
596
|
-
throw this.analyticshttpclient.sendExceptionEvent(this.getAccessTokenSilently.name, "No token available", this.clientId,
|
|
597
|
-
const
|
|
598
|
-
if ((
|
|
594
|
+
this.analyticshttpclient.sendMethodEvent(this.getAccessTokenSilently.name, this.clientId, d, u);
|
|
595
|
+
let e = await this.cacheManager.getToken();
|
|
596
|
+
if (e == null)
|
|
597
|
+
throw this.analyticshttpclient.sendExceptionEvent(this.getAccessTokenSilently.name, "No token available", this.clientId, d, u), new L("No token available");
|
|
598
|
+
const t = new Date((/* @__PURE__ */ new Date()).getTime() + x);
|
|
599
|
+
if ((e == null ? void 0 : e.expires_at) == null || (e == null ? void 0 : e.expires_at) < t.getTime()) {
|
|
599
600
|
try {
|
|
600
601
|
await this.tokenProvider.RetrieveToken();
|
|
601
|
-
} catch (
|
|
602
|
-
throw this.analyticshttpclient.sendExceptionEvent(this.getAccessTokenSilently.name,
|
|
602
|
+
} catch (s) {
|
|
603
|
+
throw this.analyticshttpclient.sendExceptionEvent(this.getAccessTokenSilently.name, s.message, this.clientId, d, u), new M(s.message);
|
|
603
604
|
}
|
|
604
|
-
await this.generateToken((
|
|
605
|
+
await this.generateToken((e == null ? void 0 : e.identity_provider) ?? ""), e = await this.cacheManager.getToken();
|
|
605
606
|
}
|
|
606
|
-
return (
|
|
607
|
+
return (e == null ? void 0 : e.access_token) || "";
|
|
607
608
|
}
|
|
608
609
|
/**
|
|
609
610
|
* Retrieves token details from the cache, including the access token, ID token, and expiration time.
|
|
@@ -613,23 +614,23 @@ class Qt {
|
|
|
613
614
|
* @throws {TokenExpiredException} Will throw an exception if the user token expired
|
|
614
615
|
*/
|
|
615
616
|
async getTokens() {
|
|
616
|
-
this.analyticshttpclient.sendMethodEvent(this.getTokens.name, this.clientId,
|
|
617
|
-
let
|
|
618
|
-
if (
|
|
619
|
-
throw this.analyticshttpclient.sendExceptionEvent(this.getTokens.name, "No token available", this.clientId,
|
|
620
|
-
const
|
|
621
|
-
if ((
|
|
617
|
+
this.analyticshttpclient.sendMethodEvent(this.getTokens.name, this.clientId, d, u);
|
|
618
|
+
let e = await this.cacheManager.getToken();
|
|
619
|
+
if (e == null)
|
|
620
|
+
throw this.analyticshttpclient.sendExceptionEvent(this.getTokens.name, "No token available", this.clientId, d, u), new L("No token available");
|
|
621
|
+
const t = new Date((/* @__PURE__ */ new Date()).getTime() + x);
|
|
622
|
+
if ((e == null ? void 0 : e.expires_at) == null || (e == null ? void 0 : e.expires_at) < t.getTime()) {
|
|
622
623
|
try {
|
|
623
624
|
await this.tokenProvider.RetrieveToken();
|
|
624
|
-
} catch (
|
|
625
|
-
throw this.analyticshttpclient.sendExceptionEvent(this.getTokens.name,
|
|
625
|
+
} catch (s) {
|
|
626
|
+
throw this.analyticshttpclient.sendExceptionEvent(this.getTokens.name, s.message, this.clientId, d, u), new M(s.message);
|
|
626
627
|
}
|
|
627
|
-
await this.generateToken((
|
|
628
|
+
await this.generateToken((e == null ? void 0 : e.identity_provider) ?? ""), e = await this.cacheManager.getToken();
|
|
628
629
|
}
|
|
629
630
|
return {
|
|
630
|
-
access_token: (
|
|
631
|
-
expires_at: (
|
|
632
|
-
id_token: (
|
|
631
|
+
access_token: (e == null ? void 0 : e.access_token) || "",
|
|
632
|
+
expires_at: (e == null ? void 0 : e.expires_at) || 0,
|
|
633
|
+
id_token: (e == null ? void 0 : e.id_token) || ""
|
|
633
634
|
};
|
|
634
635
|
}
|
|
635
636
|
/**
|
|
@@ -644,14 +645,14 @@ class Qt {
|
|
|
644
645
|
* // Redirect calls onRedirect with the log-out url for TID
|
|
645
646
|
* // So it can be handled by the developer
|
|
646
647
|
*/
|
|
647
|
-
async logout(
|
|
648
|
-
this.analyticshttpclient.sendMethodEvent(this.logout.name, this.clientId,
|
|
649
|
-
const { onRedirect:
|
|
648
|
+
async logout(e) {
|
|
649
|
+
this.analyticshttpclient.sendMethodEvent(this.logout.name, this.clientId, d, u);
|
|
650
|
+
const { onRedirect: t, disabledAutoRedirect: s } = e || {};
|
|
650
651
|
this.cacheManager && await this.cacheManager.clear(), this.cookiesManager && this.cookiesManager.clear();
|
|
651
|
-
const
|
|
652
|
-
if (
|
|
653
|
-
return
|
|
654
|
-
|
|
652
|
+
const r = await this.tokenProvider.GetOAuthLogoutRedirect("state");
|
|
653
|
+
if (t != null)
|
|
654
|
+
return t(r);
|
|
655
|
+
s || window.location.assign(r);
|
|
655
656
|
}
|
|
656
657
|
/**
|
|
657
658
|
* Check if the user still has a valid session
|
|
@@ -677,18 +678,18 @@ class Qt {
|
|
|
677
678
|
* @return {Promise<void>} Empty promise
|
|
678
679
|
*/
|
|
679
680
|
async loadCacheSessionIntoSDK() {
|
|
680
|
-
const
|
|
681
|
-
if (
|
|
681
|
+
const e = await this.cacheManager.getToken();
|
|
682
|
+
if (e == null)
|
|
682
683
|
return;
|
|
683
|
-
const
|
|
684
|
-
this.tokenProvider = this.tokenProvider.WithAccessToken(
|
|
684
|
+
const t = e.access_token, s = e.refresh_token || "", r = e.id_token, l = e.expires_at;
|
|
685
|
+
this.tokenProvider = this.tokenProvider.WithAccessToken(t, l).WithRefreshToken(s).WithIdToken(r);
|
|
685
686
|
}
|
|
686
687
|
/**
|
|
687
688
|
* Get a http bearer token client to use it for another SDK (Ex: Processing framework)
|
|
688
689
|
* @return {any} - BearerTokenHttpClientProvider
|
|
689
690
|
*/
|
|
690
|
-
getBearerTokenHttpClient(
|
|
691
|
-
return new
|
|
691
|
+
getBearerTokenHttpClient(e) {
|
|
692
|
+
return new Q(this.tokenProvider, e);
|
|
692
693
|
}
|
|
693
694
|
/**
|
|
694
695
|
* Get the redirect url to TID
|
|
@@ -698,796 +699,168 @@ class Qt {
|
|
|
698
699
|
return this.redirectUrl;
|
|
699
700
|
}
|
|
700
701
|
}
|
|
701
|
-
const
|
|
702
|
-
|
|
703
|
-
/**
|
|
704
|
-
* @license React
|
|
705
|
-
* react-jsx-runtime.production.min.js
|
|
706
|
-
*
|
|
707
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
708
|
-
*
|
|
709
|
-
* This source code is licensed under the MIT license found in the
|
|
710
|
-
* LICENSE file in the root directory of this source tree.
|
|
711
|
-
*/
|
|
712
|
-
var Ye;
|
|
713
|
-
function Zt() {
|
|
714
|
-
if (Ye)
|
|
715
|
-
return $;
|
|
716
|
-
Ye = 1;
|
|
717
|
-
var a = Be, t = Symbol.for("react.element"), n = Symbol.for("react.fragment"), o = Object.prototype.hasOwnProperty, c = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, S = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
718
|
-
function _(w, v, P) {
|
|
719
|
-
var T, R = {}, f = null, D = null;
|
|
720
|
-
P !== void 0 && (f = "" + P), v.key !== void 0 && (f = "" + v.key), v.ref !== void 0 && (D = v.ref);
|
|
721
|
-
for (T in v)
|
|
722
|
-
o.call(v, T) && !S.hasOwnProperty(T) && (R[T] = v[T]);
|
|
723
|
-
if (w && w.defaultProps)
|
|
724
|
-
for (T in v = w.defaultProps, v)
|
|
725
|
-
R[T] === void 0 && (R[T] = v[T]);
|
|
726
|
-
return { $$typeof: t, type: w, key: f, ref: D, props: R, _owner: c.current };
|
|
727
|
-
}
|
|
728
|
-
return $.Fragment = n, $.jsx = _, $.jsxs = _, $;
|
|
729
|
-
}
|
|
730
|
-
var V = {};
|
|
731
|
-
/**
|
|
732
|
-
* @license React
|
|
733
|
-
* react-jsx-runtime.development.js
|
|
734
|
-
*
|
|
735
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
736
|
-
*
|
|
737
|
-
* This source code is licensed under the MIT license found in the
|
|
738
|
-
* LICENSE file in the root directory of this source tree.
|
|
739
|
-
*/
|
|
740
|
-
var Ge;
|
|
741
|
-
function er() {
|
|
742
|
-
return Ge || (Ge = 1, process.env.NODE_ENV !== "production" && function() {
|
|
743
|
-
var a = Be, t = Symbol.for("react.element"), n = Symbol.for("react.portal"), o = Symbol.for("react.fragment"), c = Symbol.for("react.strict_mode"), S = Symbol.for("react.profiler"), _ = Symbol.for("react.provider"), w = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), R = Symbol.for("react.memo"), f = Symbol.for("react.lazy"), D = Symbol.for("react.offscreen"), x = Symbol.iterator, Y = "@@iterator";
|
|
744
|
-
function ee(e) {
|
|
745
|
-
if (e === null || typeof e != "object")
|
|
746
|
-
return null;
|
|
747
|
-
var r = x && e[x] || e[Y];
|
|
748
|
-
return typeof r == "function" ? r : null;
|
|
749
|
-
}
|
|
750
|
-
var A = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
751
|
-
function E(e) {
|
|
752
|
-
{
|
|
753
|
-
for (var r = arguments.length, i = new Array(r > 1 ? r - 1 : 0), s = 1; s < r; s++)
|
|
754
|
-
i[s - 1] = arguments[s];
|
|
755
|
-
G("error", e, i);
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
function G(e, r, i) {
|
|
759
|
-
{
|
|
760
|
-
var s = A.ReactDebugCurrentFrame, d = s.getStackAddendum();
|
|
761
|
-
d !== "" && (r += "%s", i = i.concat([d]));
|
|
762
|
-
var h = i.map(function(u) {
|
|
763
|
-
return String(u);
|
|
764
|
-
});
|
|
765
|
-
h.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, h);
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
var J = !1, B = !1, te = !1, g = !1, b = !1, z;
|
|
769
|
-
z = Symbol.for("react.module.reference");
|
|
770
|
-
function Qe(e) {
|
|
771
|
-
return !!(typeof e == "string" || typeof e == "function" || e === o || e === S || b || e === c || e === P || e === T || g || e === D || J || B || te || typeof e == "object" && e !== null && (e.$$typeof === f || e.$$typeof === R || e.$$typeof === _ || e.$$typeof === w || e.$$typeof === v || // This needs to include all possible module reference object
|
|
772
|
-
// types supported by any Flight configuration anywhere since
|
|
773
|
-
// we don't know which Flight build this will end up being used
|
|
774
|
-
// with.
|
|
775
|
-
e.$$typeof === z || e.getModuleId !== void 0));
|
|
776
|
-
}
|
|
777
|
-
function Ze(e, r, i) {
|
|
778
|
-
var s = e.displayName;
|
|
779
|
-
if (s)
|
|
780
|
-
return s;
|
|
781
|
-
var d = r.displayName || r.name || "";
|
|
782
|
-
return d !== "" ? i + "(" + d + ")" : i;
|
|
783
|
-
}
|
|
784
|
-
function ve(e) {
|
|
785
|
-
return e.displayName || "Context";
|
|
786
|
-
}
|
|
787
|
-
function K(e) {
|
|
788
|
-
if (e == null)
|
|
789
|
-
return null;
|
|
790
|
-
if (typeof e.tag == "number" && E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
791
|
-
return e.displayName || e.name || null;
|
|
792
|
-
if (typeof e == "string")
|
|
793
|
-
return e;
|
|
794
|
-
switch (e) {
|
|
795
|
-
case o:
|
|
796
|
-
return "Fragment";
|
|
797
|
-
case n:
|
|
798
|
-
return "Portal";
|
|
799
|
-
case S:
|
|
800
|
-
return "Profiler";
|
|
801
|
-
case c:
|
|
802
|
-
return "StrictMode";
|
|
803
|
-
case P:
|
|
804
|
-
return "Suspense";
|
|
805
|
-
case T:
|
|
806
|
-
return "SuspenseList";
|
|
807
|
-
}
|
|
808
|
-
if (typeof e == "object")
|
|
809
|
-
switch (e.$$typeof) {
|
|
810
|
-
case w:
|
|
811
|
-
var r = e;
|
|
812
|
-
return ve(r) + ".Consumer";
|
|
813
|
-
case _:
|
|
814
|
-
var i = e;
|
|
815
|
-
return ve(i._context) + ".Provider";
|
|
816
|
-
case v:
|
|
817
|
-
return Ze(e, e.render, "ForwardRef");
|
|
818
|
-
case R:
|
|
819
|
-
var s = e.displayName || null;
|
|
820
|
-
return s !== null ? s : K(e.type) || "Memo";
|
|
821
|
-
case f: {
|
|
822
|
-
var d = e, h = d._payload, u = d._init;
|
|
823
|
-
try {
|
|
824
|
-
return K(u(h));
|
|
825
|
-
} catch {
|
|
826
|
-
return null;
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
return null;
|
|
831
|
-
}
|
|
832
|
-
var M = Object.assign, F = 0, ye, pe, me, Ee, _e, Te, Se;
|
|
833
|
-
function ke() {
|
|
834
|
-
}
|
|
835
|
-
ke.__reactDisabledLog = !0;
|
|
836
|
-
function et() {
|
|
837
|
-
{
|
|
838
|
-
if (F === 0) {
|
|
839
|
-
ye = console.log, pe = console.info, me = console.warn, Ee = console.error, _e = console.group, Te = console.groupCollapsed, Se = console.groupEnd;
|
|
840
|
-
var e = {
|
|
841
|
-
configurable: !0,
|
|
842
|
-
enumerable: !0,
|
|
843
|
-
value: ke,
|
|
844
|
-
writable: !0
|
|
845
|
-
};
|
|
846
|
-
Object.defineProperties(console, {
|
|
847
|
-
info: e,
|
|
848
|
-
log: e,
|
|
849
|
-
warn: e,
|
|
850
|
-
error: e,
|
|
851
|
-
group: e,
|
|
852
|
-
groupCollapsed: e,
|
|
853
|
-
groupEnd: e
|
|
854
|
-
});
|
|
855
|
-
}
|
|
856
|
-
F++;
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
function tt() {
|
|
860
|
-
{
|
|
861
|
-
if (F--, F === 0) {
|
|
862
|
-
var e = {
|
|
863
|
-
configurable: !0,
|
|
864
|
-
enumerable: !0,
|
|
865
|
-
writable: !0
|
|
866
|
-
};
|
|
867
|
-
Object.defineProperties(console, {
|
|
868
|
-
log: M({}, e, {
|
|
869
|
-
value: ye
|
|
870
|
-
}),
|
|
871
|
-
info: M({}, e, {
|
|
872
|
-
value: pe
|
|
873
|
-
}),
|
|
874
|
-
warn: M({}, e, {
|
|
875
|
-
value: me
|
|
876
|
-
}),
|
|
877
|
-
error: M({}, e, {
|
|
878
|
-
value: Ee
|
|
879
|
-
}),
|
|
880
|
-
group: M({}, e, {
|
|
881
|
-
value: _e
|
|
882
|
-
}),
|
|
883
|
-
groupCollapsed: M({}, e, {
|
|
884
|
-
value: Te
|
|
885
|
-
}),
|
|
886
|
-
groupEnd: M({}, e, {
|
|
887
|
-
value: Se
|
|
888
|
-
})
|
|
889
|
-
});
|
|
890
|
-
}
|
|
891
|
-
F < 0 && E("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
var re = A.ReactCurrentDispatcher, ne;
|
|
895
|
-
function H(e, r, i) {
|
|
896
|
-
{
|
|
897
|
-
if (ne === void 0)
|
|
898
|
-
try {
|
|
899
|
-
throw Error();
|
|
900
|
-
} catch (d) {
|
|
901
|
-
var s = d.stack.trim().match(/\n( *(at )?)/);
|
|
902
|
-
ne = s && s[1] || "";
|
|
903
|
-
}
|
|
904
|
-
return `
|
|
905
|
-
` + ne + e;
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
var ie = !1, q;
|
|
909
|
-
{
|
|
910
|
-
var rt = typeof WeakMap == "function" ? WeakMap : Map;
|
|
911
|
-
q = new rt();
|
|
912
|
-
}
|
|
913
|
-
function Re(e, r) {
|
|
914
|
-
if (!e || ie)
|
|
915
|
-
return "";
|
|
916
|
-
{
|
|
917
|
-
var i = q.get(e);
|
|
918
|
-
if (i !== void 0)
|
|
919
|
-
return i;
|
|
920
|
-
}
|
|
921
|
-
var s;
|
|
922
|
-
ie = !0;
|
|
923
|
-
var d = Error.prepareStackTrace;
|
|
924
|
-
Error.prepareStackTrace = void 0;
|
|
925
|
-
var h;
|
|
926
|
-
h = re.current, re.current = null, et();
|
|
927
|
-
try {
|
|
928
|
-
if (r) {
|
|
929
|
-
var u = function() {
|
|
930
|
-
throw Error();
|
|
931
|
-
};
|
|
932
|
-
if (Object.defineProperty(u.prototype, "props", {
|
|
933
|
-
set: function() {
|
|
934
|
-
throw Error();
|
|
935
|
-
}
|
|
936
|
-
}), typeof Reflect == "object" && Reflect.construct) {
|
|
937
|
-
try {
|
|
938
|
-
Reflect.construct(u, []);
|
|
939
|
-
} catch (U) {
|
|
940
|
-
s = U;
|
|
941
|
-
}
|
|
942
|
-
Reflect.construct(e, [], u);
|
|
943
|
-
} else {
|
|
944
|
-
try {
|
|
945
|
-
u.call();
|
|
946
|
-
} catch (U) {
|
|
947
|
-
s = U;
|
|
948
|
-
}
|
|
949
|
-
e.call(u.prototype);
|
|
950
|
-
}
|
|
951
|
-
} else {
|
|
952
|
-
try {
|
|
953
|
-
throw Error();
|
|
954
|
-
} catch (U) {
|
|
955
|
-
s = U;
|
|
956
|
-
}
|
|
957
|
-
e();
|
|
958
|
-
}
|
|
959
|
-
} catch (U) {
|
|
960
|
-
if (U && s && typeof U.stack == "string") {
|
|
961
|
-
for (var l = U.stack.split(`
|
|
962
|
-
`), k = s.stack.split(`
|
|
963
|
-
`), y = l.length - 1, m = k.length - 1; y >= 1 && m >= 0 && l[y] !== k[m]; )
|
|
964
|
-
m--;
|
|
965
|
-
for (; y >= 1 && m >= 0; y--, m--)
|
|
966
|
-
if (l[y] !== k[m]) {
|
|
967
|
-
if (y !== 1 || m !== 1)
|
|
968
|
-
do
|
|
969
|
-
if (y--, m--, m < 0 || l[y] !== k[m]) {
|
|
970
|
-
var C = `
|
|
971
|
-
` + l[y].replace(" at new ", " at ");
|
|
972
|
-
return e.displayName && C.includes("<anonymous>") && (C = C.replace("<anonymous>", e.displayName)), typeof e == "function" && q.set(e, C), C;
|
|
973
|
-
}
|
|
974
|
-
while (y >= 1 && m >= 0);
|
|
975
|
-
break;
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
} finally {
|
|
979
|
-
ie = !1, re.current = h, tt(), Error.prepareStackTrace = d;
|
|
980
|
-
}
|
|
981
|
-
var L = e ? e.displayName || e.name : "", je = L ? H(L) : "";
|
|
982
|
-
return typeof e == "function" && q.set(e, je), je;
|
|
983
|
-
}
|
|
984
|
-
function nt(e, r, i) {
|
|
985
|
-
return Re(e, !1);
|
|
986
|
-
}
|
|
987
|
-
function it(e) {
|
|
988
|
-
var r = e.prototype;
|
|
989
|
-
return !!(r && r.isReactComponent);
|
|
990
|
-
}
|
|
991
|
-
function X(e, r, i) {
|
|
992
|
-
if (e == null)
|
|
993
|
-
return "";
|
|
994
|
-
if (typeof e == "function")
|
|
995
|
-
return Re(e, it(e));
|
|
996
|
-
if (typeof e == "string")
|
|
997
|
-
return H(e);
|
|
998
|
-
switch (e) {
|
|
999
|
-
case P:
|
|
1000
|
-
return H("Suspense");
|
|
1001
|
-
case T:
|
|
1002
|
-
return H("SuspenseList");
|
|
1003
|
-
}
|
|
1004
|
-
if (typeof e == "object")
|
|
1005
|
-
switch (e.$$typeof) {
|
|
1006
|
-
case v:
|
|
1007
|
-
return nt(e.render);
|
|
1008
|
-
case R:
|
|
1009
|
-
return X(e.type, r, i);
|
|
1010
|
-
case f: {
|
|
1011
|
-
var s = e, d = s._payload, h = s._init;
|
|
1012
|
-
try {
|
|
1013
|
-
return X(h(d), r, i);
|
|
1014
|
-
} catch {
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
return "";
|
|
1019
|
-
}
|
|
1020
|
-
var Q = Object.prototype.hasOwnProperty, we = {}, be = A.ReactDebugCurrentFrame;
|
|
1021
|
-
function Z(e) {
|
|
1022
|
-
if (e) {
|
|
1023
|
-
var r = e._owner, i = X(e.type, e._source, r ? r.type : null);
|
|
1024
|
-
be.setExtraStackFrame(i);
|
|
1025
|
-
} else
|
|
1026
|
-
be.setExtraStackFrame(null);
|
|
1027
|
-
}
|
|
1028
|
-
function at(e, r, i, s, d) {
|
|
1029
|
-
{
|
|
1030
|
-
var h = Function.call.bind(Q);
|
|
1031
|
-
for (var u in e)
|
|
1032
|
-
if (h(e, u)) {
|
|
1033
|
-
var l = void 0;
|
|
1034
|
-
try {
|
|
1035
|
-
if (typeof e[u] != "function") {
|
|
1036
|
-
var k = Error((s || "React class") + ": " + i + " type `" + u + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[u] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
1037
|
-
throw k.name = "Invariant Violation", k;
|
|
1038
|
-
}
|
|
1039
|
-
l = e[u](r, u, s, i, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
1040
|
-
} catch (y) {
|
|
1041
|
-
l = y;
|
|
1042
|
-
}
|
|
1043
|
-
l && !(l instanceof Error) && (Z(d), E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", s || "React class", i, u, typeof l), Z(null)), l instanceof Error && !(l.message in we) && (we[l.message] = !0, Z(d), E("Failed %s type: %s", i, l.message), Z(null));
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
var ot = Array.isArray;
|
|
1048
|
-
function ae(e) {
|
|
1049
|
-
return ot(e);
|
|
1050
|
-
}
|
|
1051
|
-
function st(e) {
|
|
1052
|
-
{
|
|
1053
|
-
var r = typeof Symbol == "function" && Symbol.toStringTag, i = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
1054
|
-
return i;
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
function ct(e) {
|
|
1058
|
-
try {
|
|
1059
|
-
return Ce(e), !1;
|
|
1060
|
-
} catch {
|
|
1061
|
-
return !0;
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
function Ce(e) {
|
|
1065
|
-
return "" + e;
|
|
1066
|
-
}
|
|
1067
|
-
function Pe(e) {
|
|
1068
|
-
if (ct(e))
|
|
1069
|
-
return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", st(e)), Ce(e);
|
|
1070
|
-
}
|
|
1071
|
-
var N = A.ReactCurrentOwner, lt = {
|
|
1072
|
-
key: !0,
|
|
1073
|
-
ref: !0,
|
|
1074
|
-
__self: !0,
|
|
1075
|
-
__source: !0
|
|
1076
|
-
}, Oe, Ie, oe;
|
|
1077
|
-
oe = {};
|
|
1078
|
-
function ut(e) {
|
|
1079
|
-
if (Q.call(e, "ref")) {
|
|
1080
|
-
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
1081
|
-
if (r && r.isReactWarning)
|
|
1082
|
-
return !1;
|
|
1083
|
-
}
|
|
1084
|
-
return e.ref !== void 0;
|
|
1085
|
-
}
|
|
1086
|
-
function ft(e) {
|
|
1087
|
-
if (Q.call(e, "key")) {
|
|
1088
|
-
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
1089
|
-
if (r && r.isReactWarning)
|
|
1090
|
-
return !1;
|
|
1091
|
-
}
|
|
1092
|
-
return e.key !== void 0;
|
|
1093
|
-
}
|
|
1094
|
-
function dt(e, r) {
|
|
1095
|
-
if (typeof e.ref == "string" && N.current && r && N.current.stateNode !== r) {
|
|
1096
|
-
var i = K(N.current.type);
|
|
1097
|
-
oe[i] || (E('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', K(N.current.type), e.ref), oe[i] = !0);
|
|
1098
|
-
}
|
|
1099
|
-
}
|
|
1100
|
-
function ht(e, r) {
|
|
1101
|
-
{
|
|
1102
|
-
var i = function() {
|
|
1103
|
-
Oe || (Oe = !0, E("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
1104
|
-
};
|
|
1105
|
-
i.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
1106
|
-
get: i,
|
|
1107
|
-
configurable: !0
|
|
1108
|
-
});
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
function gt(e, r) {
|
|
1112
|
-
{
|
|
1113
|
-
var i = function() {
|
|
1114
|
-
Ie || (Ie = !0, E("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
1115
|
-
};
|
|
1116
|
-
i.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
1117
|
-
get: i,
|
|
1118
|
-
configurable: !0
|
|
1119
|
-
});
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
var vt = function(e, r, i, s, d, h, u) {
|
|
1123
|
-
var l = {
|
|
1124
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
1125
|
-
$$typeof: t,
|
|
1126
|
-
// Built-in properties that belong on the element
|
|
1127
|
-
type: e,
|
|
1128
|
-
key: r,
|
|
1129
|
-
ref: i,
|
|
1130
|
-
props: u,
|
|
1131
|
-
// Record the component responsible for creating this element.
|
|
1132
|
-
_owner: h
|
|
1133
|
-
};
|
|
1134
|
-
return l._store = {}, Object.defineProperty(l._store, "validated", {
|
|
1135
|
-
configurable: !1,
|
|
1136
|
-
enumerable: !1,
|
|
1137
|
-
writable: !0,
|
|
1138
|
-
value: !1
|
|
1139
|
-
}), Object.defineProperty(l, "_self", {
|
|
1140
|
-
configurable: !1,
|
|
1141
|
-
enumerable: !1,
|
|
1142
|
-
writable: !1,
|
|
1143
|
-
value: s
|
|
1144
|
-
}), Object.defineProperty(l, "_source", {
|
|
1145
|
-
configurable: !1,
|
|
1146
|
-
enumerable: !1,
|
|
1147
|
-
writable: !1,
|
|
1148
|
-
value: d
|
|
1149
|
-
}), Object.freeze && (Object.freeze(l.props), Object.freeze(l)), l;
|
|
1150
|
-
};
|
|
1151
|
-
function yt(e, r, i, s, d) {
|
|
1152
|
-
{
|
|
1153
|
-
var h, u = {}, l = null, k = null;
|
|
1154
|
-
i !== void 0 && (Pe(i), l = "" + i), ft(r) && (Pe(r.key), l = "" + r.key), ut(r) && (k = r.ref, dt(r, d));
|
|
1155
|
-
for (h in r)
|
|
1156
|
-
Q.call(r, h) && !lt.hasOwnProperty(h) && (u[h] = r[h]);
|
|
1157
|
-
if (e && e.defaultProps) {
|
|
1158
|
-
var y = e.defaultProps;
|
|
1159
|
-
for (h in y)
|
|
1160
|
-
u[h] === void 0 && (u[h] = y[h]);
|
|
1161
|
-
}
|
|
1162
|
-
if (l || k) {
|
|
1163
|
-
var m = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
1164
|
-
l && ht(u, m), k && gt(u, m);
|
|
1165
|
-
}
|
|
1166
|
-
return vt(e, l, k, d, s, N.current, u);
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
var se = A.ReactCurrentOwner, xe = A.ReactDebugCurrentFrame;
|
|
1170
|
-
function j(e) {
|
|
1171
|
-
if (e) {
|
|
1172
|
-
var r = e._owner, i = X(e.type, e._source, r ? r.type : null);
|
|
1173
|
-
xe.setExtraStackFrame(i);
|
|
1174
|
-
} else
|
|
1175
|
-
xe.setExtraStackFrame(null);
|
|
1176
|
-
}
|
|
1177
|
-
var ce;
|
|
1178
|
-
ce = !1;
|
|
1179
|
-
function le(e) {
|
|
1180
|
-
return typeof e == "object" && e !== null && e.$$typeof === t;
|
|
1181
|
-
}
|
|
1182
|
-
function Ae() {
|
|
1183
|
-
{
|
|
1184
|
-
if (se.current) {
|
|
1185
|
-
var e = K(se.current.type);
|
|
1186
|
-
if (e)
|
|
1187
|
-
return `
|
|
1188
|
-
|
|
1189
|
-
Check the render method of \`` + e + "`.";
|
|
1190
|
-
}
|
|
1191
|
-
return "";
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
function pt(e) {
|
|
1195
|
-
{
|
|
1196
|
-
if (e !== void 0) {
|
|
1197
|
-
var r = e.fileName.replace(/^.*[\\\/]/, ""), i = e.lineNumber;
|
|
1198
|
-
return `
|
|
1199
|
-
|
|
1200
|
-
Check your code at ` + r + ":" + i + ".";
|
|
1201
|
-
}
|
|
1202
|
-
return "";
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
var Ke = {};
|
|
1206
|
-
function mt(e) {
|
|
1207
|
-
{
|
|
1208
|
-
var r = Ae();
|
|
1209
|
-
if (!r) {
|
|
1210
|
-
var i = typeof e == "string" ? e : e.displayName || e.name;
|
|
1211
|
-
i && (r = `
|
|
1212
|
-
|
|
1213
|
-
Check the top-level render call using <` + i + ">.");
|
|
1214
|
-
}
|
|
1215
|
-
return r;
|
|
1216
|
-
}
|
|
1217
|
-
}
|
|
1218
|
-
function Ue(e, r) {
|
|
1219
|
-
{
|
|
1220
|
-
if (!e._store || e._store.validated || e.key != null)
|
|
1221
|
-
return;
|
|
1222
|
-
e._store.validated = !0;
|
|
1223
|
-
var i = mt(r);
|
|
1224
|
-
if (Ke[i])
|
|
1225
|
-
return;
|
|
1226
|
-
Ke[i] = !0;
|
|
1227
|
-
var s = "";
|
|
1228
|
-
e && e._owner && e._owner !== se.current && (s = " It was passed a child from " + K(e._owner.type) + "."), j(e), E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', i, s), j(null);
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
function De(e, r) {
|
|
1232
|
-
{
|
|
1233
|
-
if (typeof e != "object")
|
|
1234
|
-
return;
|
|
1235
|
-
if (ae(e))
|
|
1236
|
-
for (var i = 0; i < e.length; i++) {
|
|
1237
|
-
var s = e[i];
|
|
1238
|
-
le(s) && Ue(s, r);
|
|
1239
|
-
}
|
|
1240
|
-
else if (le(e))
|
|
1241
|
-
e._store && (e._store.validated = !0);
|
|
1242
|
-
else if (e) {
|
|
1243
|
-
var d = ee(e);
|
|
1244
|
-
if (typeof d == "function" && d !== e.entries)
|
|
1245
|
-
for (var h = d.call(e), u; !(u = h.next()).done; )
|
|
1246
|
-
le(u.value) && Ue(u.value, r);
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
function Et(e) {
|
|
1251
|
-
{
|
|
1252
|
-
var r = e.type;
|
|
1253
|
-
if (r == null || typeof r == "string")
|
|
1254
|
-
return;
|
|
1255
|
-
var i;
|
|
1256
|
-
if (typeof r == "function")
|
|
1257
|
-
i = r.propTypes;
|
|
1258
|
-
else if (typeof r == "object" && (r.$$typeof === v || // Note: Memo only checks outer props here.
|
|
1259
|
-
// Inner props are checked in the reconciler.
|
|
1260
|
-
r.$$typeof === R))
|
|
1261
|
-
i = r.propTypes;
|
|
1262
|
-
else
|
|
1263
|
-
return;
|
|
1264
|
-
if (i) {
|
|
1265
|
-
var s = K(r);
|
|
1266
|
-
at(i, e.props, "prop", s, e);
|
|
1267
|
-
} else if (r.PropTypes !== void 0 && !ce) {
|
|
1268
|
-
ce = !0;
|
|
1269
|
-
var d = K(r);
|
|
1270
|
-
E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", d || "Unknown");
|
|
1271
|
-
}
|
|
1272
|
-
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1275
|
-
function _t(e) {
|
|
1276
|
-
{
|
|
1277
|
-
for (var r = Object.keys(e.props), i = 0; i < r.length; i++) {
|
|
1278
|
-
var s = r[i];
|
|
1279
|
-
if (s !== "children" && s !== "key") {
|
|
1280
|
-
j(e), E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", s), j(null);
|
|
1281
|
-
break;
|
|
1282
|
-
}
|
|
1283
|
-
}
|
|
1284
|
-
e.ref !== null && (j(e), E("Invalid attribute `ref` supplied to `React.Fragment`."), j(null));
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
|
-
function Me(e, r, i, s, d, h) {
|
|
1288
|
-
{
|
|
1289
|
-
var u = Qe(e);
|
|
1290
|
-
if (!u) {
|
|
1291
|
-
var l = "";
|
|
1292
|
-
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (l += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
1293
|
-
var k = pt(d);
|
|
1294
|
-
k ? l += k : l += Ae();
|
|
1295
|
-
var y;
|
|
1296
|
-
e === null ? y = "null" : ae(e) ? y = "array" : e !== void 0 && e.$$typeof === t ? (y = "<" + (K(e.type) || "Unknown") + " />", l = " Did you accidentally export a JSX literal instead of a component?") : y = typeof e, E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", y, l);
|
|
1297
|
-
}
|
|
1298
|
-
var m = yt(e, r, i, d, h);
|
|
1299
|
-
if (m == null)
|
|
1300
|
-
return m;
|
|
1301
|
-
if (u) {
|
|
1302
|
-
var C = r.children;
|
|
1303
|
-
if (C !== void 0)
|
|
1304
|
-
if (s)
|
|
1305
|
-
if (ae(C)) {
|
|
1306
|
-
for (var L = 0; L < C.length; L++)
|
|
1307
|
-
De(C[L], e);
|
|
1308
|
-
Object.freeze && Object.freeze(C);
|
|
1309
|
-
} else
|
|
1310
|
-
E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
1311
|
-
else
|
|
1312
|
-
De(C, e);
|
|
1313
|
-
}
|
|
1314
|
-
return e === o ? _t(m) : Et(m), m;
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
|
-
function Tt(e, r, i) {
|
|
1318
|
-
return Me(e, r, i, !0);
|
|
1319
|
-
}
|
|
1320
|
-
function St(e, r, i) {
|
|
1321
|
-
return Me(e, r, i, !1);
|
|
1322
|
-
}
|
|
1323
|
-
var kt = St, Rt = Tt;
|
|
1324
|
-
V.Fragment = o, V.jsx = kt, V.jsxs = Rt;
|
|
1325
|
-
}()), V;
|
|
1326
|
-
}
|
|
1327
|
-
process.env.NODE_ENV === "production" ? de.exports = Zt() : de.exports = er();
|
|
1328
|
-
var he = de.exports;
|
|
1329
|
-
const tr = (a, t) => {
|
|
1330
|
-
switch (t.type) {
|
|
702
|
+
const v = q(null), $ = () => N(v) ?? {}, ve = (i, e) => {
|
|
703
|
+
switch (e.type) {
|
|
1331
704
|
case "INIT":
|
|
1332
705
|
return {
|
|
1333
|
-
...
|
|
706
|
+
...i,
|
|
1334
707
|
isLoading: !1,
|
|
1335
|
-
isAuthenticated:
|
|
1336
|
-
user:
|
|
708
|
+
isAuthenticated: e.user != null,
|
|
709
|
+
user: e.user,
|
|
1337
710
|
error: void 0
|
|
1338
711
|
};
|
|
1339
712
|
case "GET_TOKENS_COMPLETE":
|
|
1340
713
|
case "HANDLE_CALLBACK_COMPLETE":
|
|
1341
714
|
case "GET_ACCESS_TOKEN_COMPLETE":
|
|
1342
715
|
return {
|
|
1343
|
-
...
|
|
716
|
+
...i,
|
|
1344
717
|
isLoading: !1,
|
|
1345
|
-
isAuthenticated:
|
|
1346
|
-
user:
|
|
718
|
+
isAuthenticated: e.user != null,
|
|
719
|
+
user: e.user,
|
|
1347
720
|
error: void 0
|
|
1348
721
|
};
|
|
1349
722
|
case "LOGOUT":
|
|
1350
723
|
return {
|
|
1351
|
-
...
|
|
724
|
+
...i,
|
|
1352
725
|
isAuthenticated: !1,
|
|
1353
726
|
user: void 0
|
|
1354
727
|
};
|
|
1355
728
|
case "ERROR":
|
|
1356
729
|
return {
|
|
1357
|
-
...
|
|
730
|
+
...i,
|
|
1358
731
|
isLoading: !1,
|
|
1359
|
-
error:
|
|
732
|
+
error: e.error
|
|
1360
733
|
};
|
|
1361
734
|
}
|
|
1362
|
-
},
|
|
735
|
+
}, Te = {
|
|
1363
736
|
isLoading: !0,
|
|
1364
737
|
isAuthenticated: !1
|
|
1365
|
-
},
|
|
1366
|
-
if (
|
|
738
|
+
}, D = (i) => {
|
|
739
|
+
if (i == null || Object.keys(i).length <= 0)
|
|
1367
740
|
return !0;
|
|
1368
|
-
const
|
|
1369
|
-
for (const
|
|
1370
|
-
if (
|
|
741
|
+
const e = Object.keys(i);
|
|
742
|
+
for (const t of e)
|
|
743
|
+
if (i[t] != null && i[t] !== "")
|
|
1371
744
|
return !1;
|
|
1372
745
|
return !0;
|
|
1373
|
-
},
|
|
1374
|
-
const
|
|
1375
|
-
return !
|
|
1376
|
-
},
|
|
746
|
+
}, Ee = (i) => {
|
|
747
|
+
const e = D(i.config), t = D(i.persistentOptions);
|
|
748
|
+
return !e || !t;
|
|
749
|
+
}, we = (i) => {
|
|
1377
750
|
const {
|
|
1378
|
-
children:
|
|
1379
|
-
configurationEndpoint:
|
|
1380
|
-
clientId:
|
|
1381
|
-
redirectUrl:
|
|
1382
|
-
logoutRedirectUrl:
|
|
1383
|
-
scopes:
|
|
1384
|
-
persistentStore:
|
|
1385
|
-
onRedirectCallback:
|
|
1386
|
-
checkRedirectUrlMatch:
|
|
1387
|
-
} =
|
|
1388
|
-
if (
|
|
751
|
+
children: e,
|
|
752
|
+
configurationEndpoint: t,
|
|
753
|
+
clientId: s,
|
|
754
|
+
redirectUrl: r,
|
|
755
|
+
logoutRedirectUrl: l,
|
|
756
|
+
scopes: c,
|
|
757
|
+
persistentStore: k,
|
|
758
|
+
onRedirectCallback: y,
|
|
759
|
+
checkRedirectUrlMatch: m
|
|
760
|
+
} = i;
|
|
761
|
+
if (N(v) != null)
|
|
1389
762
|
throw new Error("TID Provider already defined");
|
|
1390
|
-
const
|
|
763
|
+
const S = {
|
|
1391
764
|
config: {
|
|
1392
|
-
configurationEndpoint:
|
|
1393
|
-
clientId:
|
|
1394
|
-
redirectUrl:
|
|
1395
|
-
logoutRedirectUrl:
|
|
1396
|
-
scopes:
|
|
765
|
+
configurationEndpoint: t ?? "",
|
|
766
|
+
clientId: s ?? "",
|
|
767
|
+
redirectUrl: r ?? "",
|
|
768
|
+
logoutRedirectUrl: l ?? "",
|
|
769
|
+
scopes: c ?? [""]
|
|
1397
770
|
},
|
|
1398
771
|
persistentOptions: {
|
|
1399
|
-
persistentStore:
|
|
772
|
+
persistentStore: k ?? "in-memory"
|
|
1400
773
|
}
|
|
1401
|
-
}, [
|
|
1402
|
-
() =>
|
|
1403
|
-
[
|
|
774
|
+
}, [n] = Z(i.tidClient ?? new pe(S)), [w, g] = j(ve, Te), _ = ee(!1), G = R(
|
|
775
|
+
() => m ? n.getRedirectUrl() : void 0,
|
|
776
|
+
[m, n]
|
|
1404
777
|
);
|
|
1405
|
-
|
|
1406
|
-
|
|
778
|
+
b(() => {
|
|
779
|
+
_.current || (i.tidClient != null && Ee({
|
|
1407
780
|
config: {
|
|
1408
|
-
configurationEndpoint:
|
|
1409
|
-
clientId:
|
|
1410
|
-
redirectUrl:
|
|
1411
|
-
logoutRedirectUrl:
|
|
1412
|
-
scopes:
|
|
781
|
+
configurationEndpoint: t,
|
|
782
|
+
clientId: s,
|
|
783
|
+
redirectUrl: r,
|
|
784
|
+
logoutRedirectUrl: l,
|
|
785
|
+
scopes: c
|
|
1413
786
|
},
|
|
1414
787
|
persistentOptions: {
|
|
1415
|
-
persistentStore:
|
|
788
|
+
persistentStore: k
|
|
1416
789
|
}
|
|
1417
790
|
}) && console.warn(
|
|
1418
791
|
"When TID client is pass as prop, any client configuration property sent directly to the TID Provider component will be ignored"
|
|
1419
|
-
),
|
|
792
|
+
), _.current = !0, (async () => {
|
|
1420
793
|
try {
|
|
1421
|
-
let
|
|
1422
|
-
if (
|
|
1423
|
-
const { authState:
|
|
1424
|
-
|
|
794
|
+
let o;
|
|
795
|
+
if (de(void 0, G)) {
|
|
796
|
+
const { authState: h } = await n.handleCallback();
|
|
797
|
+
o = await n.getUser(), y != null && y(h);
|
|
1425
798
|
} else
|
|
1426
|
-
await
|
|
1427
|
-
|
|
1428
|
-
} catch (
|
|
1429
|
-
let
|
|
1430
|
-
typeof
|
|
799
|
+
await n.loadUserSession(), o = await n.getUser();
|
|
800
|
+
g({ type: "INIT", user: o });
|
|
801
|
+
} catch (o) {
|
|
802
|
+
let h = o;
|
|
803
|
+
typeof o == "string" && (h = new Error(o)), g({ type: "ERROR", error: h });
|
|
1431
804
|
}
|
|
1432
805
|
})());
|
|
1433
|
-
}, [
|
|
1434
|
-
const
|
|
1435
|
-
const
|
|
1436
|
-
return
|
|
806
|
+
}, [n, y]);
|
|
807
|
+
const I = f(async () => {
|
|
808
|
+
const o = await n.getAccessTokenSilently(), h = await n.getUser();
|
|
809
|
+
return g({
|
|
1437
810
|
type: "GET_ACCESS_TOKEN_COMPLETE",
|
|
1438
|
-
user:
|
|
1439
|
-
}),
|
|
1440
|
-
}, [
|
|
1441
|
-
const
|
|
1442
|
-
return
|
|
811
|
+
user: h
|
|
812
|
+
}), o;
|
|
813
|
+
}, [n]), K = f(async () => {
|
|
814
|
+
const o = await n.getTokens(), h = await n.getUser();
|
|
815
|
+
return g({
|
|
1443
816
|
type: "GET_TOKENS_COMPLETE",
|
|
1444
|
-
user:
|
|
1445
|
-
}),
|
|
1446
|
-
}, [
|
|
1447
|
-
async (
|
|
1448
|
-
await
|
|
817
|
+
user: h
|
|
818
|
+
}), o;
|
|
819
|
+
}, [n]), C = f(
|
|
820
|
+
async (o) => {
|
|
821
|
+
await n.loginWithRedirect(o);
|
|
1449
822
|
},
|
|
1450
|
-
[
|
|
1451
|
-
),
|
|
1452
|
-
async (
|
|
1453
|
-
await
|
|
823
|
+
[n]
|
|
824
|
+
), U = f(
|
|
825
|
+
async (o) => {
|
|
826
|
+
await n.logout(o), (o == null ? void 0 : o.disabledAutoRedirect) != null && o.disabledAutoRedirect && g({
|
|
1454
827
|
type: "LOGOUT"
|
|
1455
828
|
});
|
|
1456
829
|
},
|
|
1457
|
-
[
|
|
1458
|
-
),
|
|
1459
|
-
async (
|
|
1460
|
-
const { authState:
|
|
1461
|
-
return
|
|
830
|
+
[n]
|
|
831
|
+
), P = f(
|
|
832
|
+
async (o) => {
|
|
833
|
+
const { authState: h } = await n.handleCallback(o), J = await n.getUser();
|
|
834
|
+
return g({
|
|
1462
835
|
type: "HANDLE_CALLBACK_COMPLETE",
|
|
1463
|
-
user:
|
|
836
|
+
user: J
|
|
1464
837
|
}), {
|
|
1465
|
-
authState:
|
|
838
|
+
authState: h
|
|
1466
839
|
};
|
|
1467
840
|
},
|
|
1468
|
-
[
|
|
1469
|
-
),
|
|
841
|
+
[n]
|
|
842
|
+
), F = R(
|
|
1470
843
|
() => ({
|
|
1471
|
-
...
|
|
1472
|
-
getAccessTokenSilently:
|
|
1473
|
-
getTokens:
|
|
1474
|
-
loginWithRedirect:
|
|
1475
|
-
handleCallback:
|
|
1476
|
-
logout:
|
|
844
|
+
...w,
|
|
845
|
+
getAccessTokenSilently: I,
|
|
846
|
+
getTokens: K,
|
|
847
|
+
loginWithRedirect: C,
|
|
848
|
+
handleCallback: P,
|
|
849
|
+
logout: U
|
|
1477
850
|
}),
|
|
1478
|
-
[
|
|
851
|
+
[w, I, K, C, P, U]
|
|
1479
852
|
);
|
|
1480
|
-
return /* @__PURE__ */
|
|
1481
|
-
},
|
|
1482
|
-
const { isAuthenticated:
|
|
1483
|
-
return
|
|
1484
|
-
!
|
|
1485
|
-
}, [
|
|
853
|
+
return /* @__PURE__ */ W(v.Provider, { value: F, children: e });
|
|
854
|
+
}, Pe = $, Ae = we, Re = ({ renderComponent: i, loader: e }) => {
|
|
855
|
+
const { isAuthenticated: t, isLoading: s, loginWithRedirect: r } = $();
|
|
856
|
+
return b(() => {
|
|
857
|
+
!s && !t && (async () => await r())();
|
|
858
|
+
}, [s, t, r]), t ? i : e || /* @__PURE__ */ W(te, {});
|
|
1486
859
|
};
|
|
1487
860
|
export {
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
861
|
+
Re as AuthenticationGuard,
|
|
862
|
+
pe as TIDClient,
|
|
863
|
+
v as TIDContext,
|
|
864
|
+
Ae as TIDProvider,
|
|
865
|
+
Pe as useAuth
|
|
1493
866
|
};
|