@trimble-oss/trimble-id-react 1.0.0-rc.1 → 1.0.0-rc.3

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.
@@ -1,11 +1,12 @@
1
- var Rt = Object.defineProperty;
2
- var wt = (i, t, a) => t in i ? Rt(i, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : i[t] = a;
3
- var P = (i, t, a) => (wt(i, typeof t != "symbol" ? t + "" : t, a), a);
4
- import { OpenIdEndpointProvider as bt, AuthorizationCodeGrantTokenProvider as Fe, AnalyticsHttpClient as Ct, BearerTokenHttpClientProvider as St } from "@trimble-oss/trimble-id";
5
- import * as le from "es-cookie";
6
- import Pt from "jwt-decode";
7
- import Ge, { createContext as Ot, useContext as Be, useState as xt, useReducer as It, useRef as At, useMemo as Le, useEffect as qe, useCallback as $ } from "react";
8
- class Dt {
1
+ var F = Object.defineProperty;
2
+ var B = (i, e, t) => e in i ? F(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var c = (i, e, t) => (B(i, typeof e != "symbol" ? e + "" : e, t), t);
4
+ import { OpenIdEndpointProvider as $, AuthorizationCodeGrantTokenProvider as R, AnalyticsHttpClient as H, BearerTokenHttpClientProvider as Q } from "@trimble-oss/trimble-id";
5
+ import * as w from "es-cookie";
6
+ import J from "jwt-decode";
7
+ import { createContext as q, useContext as L, useState as z, useReducer as X, useRef as Y, useMemo as M, useEffect as D, useCallback as y } from "react";
8
+ import { jsx as K, Fragment as Z } from "react/jsx-runtime";
9
+ class j {
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
- P(this, "generateCache", function() {
18
- const t = {
18
+ c(this, "generateCache", function() {
19
+ const e = {
19
20
  token: void 0,
20
21
  user: void 0
21
22
  };
@@ -25,66 +26,66 @@ class Dt {
25
26
  * @return {Promise<TIDAuthToken | undefined>} Token store in memory
26
27
  */
27
28
  async getToken() {
28
- return t.token;
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 t.user;
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(a) {
43
- t.token = a;
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(a) {
51
- t.user = a;
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 t.token = void 0, t.user = void 0, Promise.resolve(void 0);
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 Mt {
65
+ class ee {
65
66
  constructor() {
66
67
  /**
67
68
  * Cache option selected
68
69
  * @type {CacheStorage}
69
70
  */
70
- P(this, "cacheStorage");
71
- this.cacheStorage = new Dt().generateCache;
71
+ c(this, "cacheStorage");
72
+ this.cacheStorage = new j().generateCache;
72
73
  }
73
74
  /**
74
75
  * Store token in cache
75
76
  * @param {TIDAuthToken} token - Token that you want to store in cache
76
77
  * @return {Promise<void>} Empty promise
77
78
  */
78
- async setToken(t) {
79
- await this.cacheStorage.storeToken(t);
79
+ async setToken(e) {
80
+ await this.cacheStorage.storeToken(e);
80
81
  }
81
82
  /**
82
83
  * Store user in cache
83
84
  * @param {TIDUser} user - User that you want to store in cache
84
85
  * @return {Promise<void>} Empty promise
85
86
  */
86
- async setUser(t) {
87
- await this.cacheStorage.storeUser(t);
87
+ async setUser(e) {
88
+ await this.cacheStorage.storeUser(e);
88
89
  }
89
90
  /**
90
91
  * Get user store in cache
@@ -108,26 +109,26 @@ class Mt {
108
109
  await this.cacheStorage.clear();
109
110
  }
110
111
  }
111
- const We = 5 * 6e4, Ut = ["code", "state"], Ne = (i) => i.split("?")[0], jt = (i) => i.split("?")[1], Je = (i) => {
112
- let t = i;
112
+ const x = 5 * 6e4, te = ["code", "state"], A = (i) => i.split("?")[0], ie = (i) => i.split("?")[1], b = (i) => {
113
+ let e = i;
113
114
  if (!i.startsWith("?"))
114
115
  try {
115
- t = new URL(i).search;
116
+ e = new URL(i).search;
116
117
  } catch {
117
118
  }
118
- return new URLSearchParams(t);
119
- }, Ft = (i = window.location.href, t) => {
120
- if (t != null) {
121
- const o = Ne(t), u = Ne(i ?? "");
122
- if (o !== u)
119
+ return new URLSearchParams(e);
120
+ }, ne = (i = window.location.href, e) => {
121
+ if (e != null) {
122
+ const n = A(e), r = A(i ?? "");
123
+ if (n !== r)
123
124
  return !1;
124
125
  }
125
- const a = Je(i);
126
- for (const o of Ut)
127
- if (!a.has(o))
126
+ const t = b(i);
127
+ for (const n of te)
128
+ if (!t.has(n))
128
129
  return !1;
129
130
  return !0;
130
- }, Lt = (i) => ({
131
+ }, re = (i) => ({
131
132
  id: i.sub,
132
133
  name: `${i.given_name} ${i.family_name}`,
133
134
  given_name: i.given_name,
@@ -135,17 +136,17 @@ const We = 5 * 6e4, Ut = ["code", "state"], Ne = (i) => i.split("?")[0], jt = (i
135
136
  picture: i.picture,
136
137
  email: i.email,
137
138
  email_verified: i.email_verified
138
- }), Wt = "@TID_COOKIE";
139
- class Nt {
139
+ }), se = "@TID_COOKIE";
140
+ class oe {
140
141
  /**
141
142
  * Retrieve a cookie from the browser
142
143
  * @param {string} key - Key to retrieve the cookies
143
144
  */
144
- get(t) {
145
- const a = le.get(t);
146
- if (a == null)
145
+ get(e) {
146
+ const t = w.get(e);
147
+ if (t == null)
147
148
  throw new Error("Cookie not found");
148
- return JSON.parse(a);
149
+ return JSON.parse(t);
149
150
  }
150
151
  /**
151
152
  * Store cookies in the browser
@@ -157,12 +158,12 @@ class Nt {
157
158
  * @example Save cookies with a custom domain
158
159
  * cookiesStorage.set('key',{data:{...}},{domain:'https://example.com/subpath'})
159
160
  */
160
- set(t, a, o) {
161
- let u = {};
162
- window.location.protocol === "https:" && (u = {
161
+ set(e, t, n) {
162
+ let r = {};
163
+ window.location.protocol === "https:" && (r = {
163
164
  secure: !0,
164
165
  sameSite: "none"
165
- }), o != null && o.expires && (u.expires = o.expires), o != null && o.domain && (u.domain = o.domain), le.set(t, JSON.stringify(a), u);
166
+ }), n != null && n.expires && (r.expires = n.expires), n != null && n.domain && (r.domain = n.domain), w.set(e, JSON.stringify(t), r);
166
167
  }
167
168
  /**
168
169
  * Remove a cookie from the browser
@@ -173,35 +174,35 @@ class Nt {
173
174
  * @example Remove cookies with custom domain
174
175
  * cookiesStorage.remove('key',{domain:'https://example.com/subpath'})
175
176
  */
176
- remove(t, a) {
177
- const o = {};
178
- a != null && a.domain && (o.domain = a.domain), le.remove(t, o);
177
+ remove(e, t) {
178
+ const n = {};
179
+ t != null && t.domain && (n.domain = t.domain), w.remove(e, n);
179
180
  }
180
181
  }
181
- class $t {
182
+ class ae {
182
183
  /**
183
184
  * Create a cookies manager to extract or save cookies in the browser
184
185
  * @param {CookiesManagerOptions} options - Configuration for the managing the cookies
185
186
  */
186
- constructor(t) {
187
+ constructor(e) {
187
188
  /**
188
189
  * Cookie full key to store and retrieve the information from cookies
189
190
  * @type {string}
190
191
  */
191
- P(this, "cookieKey");
192
+ c(this, "cookieKey");
192
193
  /**
193
194
  * Cookie storage. This object contain all functions necessary to retrieve and store tokens using cookies
194
195
  * @type {CookiesStorage}
195
196
  */
196
- P(this, "cookiesStorage");
197
- this.cookieKey = `${Wt}.${t.clientId}`, this.cookiesStorage = new Nt();
197
+ c(this, "cookiesStorage");
198
+ this.cookieKey = `${se}.${e.clientId}`, this.cookiesStorage = new oe();
198
199
  }
199
200
  /**
200
201
  * Store cookies in the browser
201
202
  * @param {CookieValue} value - information to store
202
203
  */
203
- save(t) {
204
- this.cookiesStorage.set(this.cookieKey, t, {
204
+ save(e) {
205
+ this.cookiesStorage.set(this.cookieKey, e, {
205
206
  expires: 1
206
207
  });
207
208
  }
@@ -223,70 +224,70 @@ class $t {
223
224
  this.cookiesStorage.remove(this.cookieKey);
224
225
  }
225
226
  }
226
- class $e extends Error {
227
+ class U extends Error {
227
228
  }
228
- class Ve extends Error {
229
+ class O extends Error {
229
230
  }
230
- class Vt extends Error {
231
+ class ce extends Error {
231
232
  }
232
- const O = "@trimble-oss/trimble-id-react", x = "1.0.0-rc.1", Kt = {
233
+ const d = "@trimble-oss/trimble-id-react", h = "1.0.0-rc.2", le = {
233
234
  configurationEndpoint: "",
234
235
  clientId: "",
235
236
  redirectUrl: "",
236
237
  logoutRedirectUrl: "",
237
238
  scopes: []
238
239
  };
239
- class Yt {
240
+ class de {
240
241
  /**
241
242
  * Create a TID client to handle manage all user authentication functions and information
242
243
  * @param {CacheManagerOptions} props - TID client configuration
243
244
  */
244
- constructor(t) {
245
+ constructor(e) {
245
246
  /**
246
247
  * Token provider SDK. This object handles all necessary communication with TID
247
248
  * @type {AuthorizationCodeGrantTokenProvider}
248
249
  */
249
- P(this, "tokenProvider");
250
+ c(this, "tokenProvider");
250
251
  /**
251
252
  * This object manage all caching, and all configurations necessary
252
253
  * @type {CacheManager}
253
254
  */
254
- P(this, "cacheManager");
255
+ c(this, "cacheManager");
255
256
  /**
256
257
  * This object manage all cookies administration, and all configurations necessary
257
258
  * @type {CookiesManager}
258
259
  */
259
- P(this, "cookiesManager");
260
+ c(this, "cookiesManager");
260
261
  /**
261
262
  * Client id of the application created in trimble developer console
262
263
  * @type {string}
263
264
  */
264
- P(this, "clientId");
265
+ c(this, "clientId");
265
266
  /**
266
267
  * Callback url to redirect the user after the authentication is successful
267
268
  * @type {string}
268
269
  */
269
- P(this, "redirectUrl");
270
+ c(this, "redirectUrl");
270
271
  /**
271
272
  * AnalyticsHttpClient for sending events
272
273
  * @type {AnalyticsHttpClient}
273
274
  */
274
- P(this, "analyticshttpclient");
275
- const { config: a = Kt } = t;
276
- if (this.redirectUrl = a.redirectUrl, a.configurationEndpoint == null || a.configurationEndpoint == "")
275
+ c(this, "analyticshttpclient");
276
+ const { config: t = le } = e;
277
+ if (this.redirectUrl = t.redirectUrl, t.configurationEndpoint == null || t.configurationEndpoint == "")
277
278
  throw new Error("Configuration endpoint not defined");
278
- if (a.clientId == null || a.clientId == "")
279
+ if (t.clientId == null || t.clientId == "")
279
280
  throw new Error("Consumer key is not defined");
280
- this.cookiesManager = new $t({
281
- clientId: a.clientId
281
+ this.cookiesManager = new ae({
282
+ clientId: t.clientId
282
283
  });
283
- const o = this.cookiesManager.get(), u = new bt(a.configurationEndpoint);
284
- let E = new Fe(
285
- u,
286
- a.clientId,
287
- a.redirectUrl
288
- ).WithScopes(a.scopes);
289
- a.logoutRedirectUrl && (E = E.WithLogoutRedirect(a.logoutRedirectUrl)), (o == null ? void 0 : o.code_verifier) != null && (E = E.WithProofKeyForCodeExchange(o.code_verifier)), this.tokenProvider = E, this.cacheManager = new Mt(), this.clientId = a.clientId, this.analyticshttpclient = Ct, this.analyticshttpclient.sendInitEvent("TIDClient", this.clientId, O, x);
284
+ const n = this.cookiesManager.get(), r = new $(t.configurationEndpoint);
285
+ let a = new R(
286
+ r,
287
+ t.clientId,
288
+ t.redirectUrl
289
+ ).WithScopes(t.scopes);
290
+ t.logoutRedirectUrl && (a = a.WithLogoutRedirect(t.logoutRedirectUrl)), (n == null ? void 0 : n.code_verifier) != null && (a = a.WithProofKeyForCodeExchange(n.code_verifier)), this.tokenProvider = a, this.cacheManager = new ee(), this.clientId = t.clientId, this.analyticshttpclient = H, this.analyticshttpclient.sendInitEvent("TIDClient", this.clientId, d, h);
290
291
  }
291
292
  /**
292
293
  * Redirect the user to TID using the browser
@@ -300,12 +301,12 @@ class Yt {
300
301
  * // Redirect calls onRedirect with the log-out url for TID
301
302
  * // So it can be handled by the developer
302
303
  */
303
- async loginWithRedirect(t) {
304
- this.analyticshttpclient.sendMethodEvent(this.loginWithRedirect.name, this.clientId, O, x);
305
- const { onRedirect: a } = t || {}, o = Fe.GenerateCodeVerifier();
306
- this.cookiesManager.save({ code_verifier: o }), this.tokenProvider = this.tokenProvider.WithProofKeyForCodeExchange(o);
307
- const u = await this.tokenProvider.GetOAuthRedirect("state");
308
- a != null ? a(u) : window.location.assign(u);
304
+ async loginWithRedirect(e) {
305
+ this.analyticshttpclient.sendMethodEvent(this.loginWithRedirect.name, this.clientId, d, h);
306
+ const { onRedirect: t } = e || {}, n = R.GenerateCodeVerifier();
307
+ this.cookiesManager.save({ code_verifier: n }), this.tokenProvider = this.tokenProvider.WithProofKeyForCodeExchange(n);
308
+ const r = await this.tokenProvider.GetOAuthRedirect("state");
309
+ t != null ? t(r) : window.location.assign(r);
309
310
  }
310
311
  /**
311
312
  * Authenticated the user using the url callback params
@@ -319,13 +320,13 @@ class Yt {
319
320
  * handleCallback('https://example.com?code=code....')
320
321
  * // Will try to log in the user with the url assign by the developer
321
322
  */
322
- async handleCallback(t = window.location.href) {
323
- const a = this.cookiesManager.get();
324
- if (a == null || (a == null ? void 0 : a.code_verifier) == null)
325
- throw new Vt("Code verifier not available");
326
- const o = jt(t), u = Je(t), E = u.get("identity_provider") ?? "", C = u.get("state") ?? "";
327
- return await this.tokenProvider.ValidateQuery(o), await this.generateToken(E), {
328
- authState: C
323
+ async handleCallback(e = window.location.href) {
324
+ const t = this.cookiesManager.get();
325
+ if (t == null || (t == null ? void 0 : t.code_verifier) == null)
326
+ throw new ce("Code verifier not available");
327
+ const n = ie(e), r = b(e), a = r.get("identity_provider") ?? "", g = r.get("state") ?? "";
328
+ return await this.tokenProvider.ValidateQuery(n), await this.generateToken(a), {
329
+ authState: g
329
330
  };
330
331
  }
331
332
  /**
@@ -333,33 +334,33 @@ class Yt {
333
334
  * @param {string} identityProvider - Type of identity provider used
334
335
  * @return {Promise<void>} Empty promise
335
336
  */
336
- async generateToken(t) {
337
- var f, R;
338
- const a = await this.tokenProvider.RetrieveToken(), o = await this.tokenProvider.RetrieveRefreshToken(), u = await this.tokenProvider.RetrieveIdToken(), E = await this.tokenProvider.RetrieveTokenExpiry(), T = new Date(E).getTime(), p = (R = (f = this.tokenProvider) == null ? void 0 : f._scopes) == null ? void 0 : R.join(" ");
337
+ async generateToken(e) {
338
+ var s, f;
339
+ const t = await this.tokenProvider.RetrieveToken(), n = await this.tokenProvider.RetrieveRefreshToken(), r = await this.tokenProvider.RetrieveIdToken(), a = await this.tokenProvider.RetrieveTokenExpiry(), k = new Date(a).getTime(), v = (f = (s = this.tokenProvider) == null ? void 0 : s._scopes) == null ? void 0 : f.join(" ");
339
340
  await this.cacheManager.setToken({
340
- scope: p,
341
+ scope: v,
341
342
  state: "",
342
343
  session_state: "",
343
- identity_provider: t,
344
+ identity_provider: e,
344
345
  token_type: "bearer",
345
- access_token: a,
346
- refresh_token: o,
347
- id_token: u,
348
- expires_at: T
346
+ access_token: t,
347
+ refresh_token: n,
348
+ id_token: r,
349
+ expires_at: k
349
350
  });
350
- const I = Pt(u), _ = Lt(I);
351
- await this.cacheManager.setUser(_), await this.reloadCodeVerifier();
351
+ const m = J(r), T = re(m);
352
+ await this.cacheManager.setUser(T), await this.reloadCodeVerifier();
352
353
  }
353
354
  async reloadCodeVerifier() {
354
- const t = await this.tokenProvider.RetrieveCodeVerifier();
355
- this.cookiesManager.save({ code_verifier: t }), this.tokenProvider = this.tokenProvider.WithProofKeyForCodeExchange(t);
355
+ const e = await this.tokenProvider.RetrieveCodeVerifier();
356
+ this.cookiesManager.save({ code_verifier: e }), this.tokenProvider = this.tokenProvider.WithProofKeyForCodeExchange(e);
356
357
  }
357
358
  /**
358
359
  * Return the user stored in cache
359
360
  * @return {Promise<TIDUser | undefined>} User in cache
360
361
  */
361
362
  async getUser() {
362
- return this.analyticshttpclient.sendMethodEvent(this.getUser.name, this.clientId, O, x), await this.cacheManager.getUser();
363
+ return this.analyticshttpclient.sendMethodEvent(this.getUser.name, this.clientId, d, h), await this.cacheManager.getUser();
363
364
  }
364
365
  /**
365
366
  * Gets the access token from cache. If the token already expired,
@@ -369,20 +370,20 @@ class Yt {
369
370
  * @throws {TokenExpiredException} Will throw an exception if the user token expired
370
371
  */
371
372
  async getAccessTokenSilently() {
372
- this.analyticshttpclient.sendMethodEvent(this.getAccessTokenSilently.name, this.clientId, O, x);
373
- let t = await this.cacheManager.getToken();
374
- if (t == null)
375
- throw this.analyticshttpclient.sendExceptionEvent(this.getAccessTokenSilently.name, "No token available", this.clientId, O, x), new Ve("No token available");
376
- const a = new Date((/* @__PURE__ */ new Date()).getTime() + We);
377
- if ((t == null ? void 0 : t.expires_at) == null || (t == null ? void 0 : t.expires_at) < a.getTime()) {
373
+ this.analyticshttpclient.sendMethodEvent(this.getAccessTokenSilently.name, this.clientId, d, h);
374
+ let e = await this.cacheManager.getToken();
375
+ if (e == null)
376
+ throw this.analyticshttpclient.sendExceptionEvent(this.getAccessTokenSilently.name, "No token available", this.clientId, d, h), new O("No token available");
377
+ const t = new Date((/* @__PURE__ */ new Date()).getTime() + x);
378
+ if ((e == null ? void 0 : e.expires_at) == null || (e == null ? void 0 : e.expires_at) < t.getTime()) {
378
379
  try {
379
380
  await this.tokenProvider.RetrieveToken();
380
- } catch (o) {
381
- throw this.analyticshttpclient.sendExceptionEvent(this.getAccessTokenSilently.name, o.message, this.clientId, O, x), new $e(o.message);
381
+ } catch (n) {
382
+ throw this.analyticshttpclient.sendExceptionEvent(this.getAccessTokenSilently.name, n.message, this.clientId, d, h), new U(n.message);
382
383
  }
383
- await this.generateToken((t == null ? void 0 : t.identity_provider) ?? ""), t = await this.cacheManager.getToken();
384
+ await this.generateToken((e == null ? void 0 : e.identity_provider) ?? ""), e = await this.cacheManager.getToken();
384
385
  }
385
- return (t == null ? void 0 : t.access_token) || "";
386
+ return (e == null ? void 0 : e.access_token) || "";
386
387
  }
387
388
  /**
388
389
  * Retrieves token details from the cache, including the access token, ID token, and expiration time.
@@ -392,23 +393,23 @@ class Yt {
392
393
  * @throws {TokenExpiredException} Will throw an exception if the user token expired
393
394
  */
394
395
  async getTokens() {
395
- this.analyticshttpclient.sendMethodEvent(this.getTokens.name, this.clientId, O, x);
396
- let t = await this.cacheManager.getToken();
397
- if (t == null)
398
- throw this.analyticshttpclient.sendExceptionEvent(this.getTokens.name, "No token available", this.clientId, O, x), new Ve("No token available");
399
- const a = new Date((/* @__PURE__ */ new Date()).getTime() + We);
400
- if ((t == null ? void 0 : t.expires_at) == null || (t == null ? void 0 : t.expires_at) < a.getTime()) {
396
+ this.analyticshttpclient.sendMethodEvent(this.getTokens.name, this.clientId, d, h);
397
+ let e = await this.cacheManager.getToken();
398
+ if (e == null)
399
+ throw this.analyticshttpclient.sendExceptionEvent(this.getTokens.name, "No token available", this.clientId, d, h), new O("No token available");
400
+ const t = new Date((/* @__PURE__ */ new Date()).getTime() + x);
401
+ if ((e == null ? void 0 : e.expires_at) == null || (e == null ? void 0 : e.expires_at) < t.getTime()) {
401
402
  try {
402
403
  await this.tokenProvider.RetrieveToken();
403
- } catch (o) {
404
- throw this.analyticshttpclient.sendExceptionEvent(this.getTokens.name, o.message, this.clientId, O, x), new $e(o.message);
404
+ } catch (n) {
405
+ throw this.analyticshttpclient.sendExceptionEvent(this.getTokens.name, n.message, this.clientId, d, h), new U(n.message);
405
406
  }
406
- await this.generateToken((t == null ? void 0 : t.identity_provider) ?? ""), t = await this.cacheManager.getToken();
407
+ await this.generateToken((e == null ? void 0 : e.identity_provider) ?? ""), e = await this.cacheManager.getToken();
407
408
  }
408
409
  return {
409
- access_token: (t == null ? void 0 : t.access_token) || "",
410
- expires_at: (t == null ? void 0 : t.expires_at) || 0,
411
- id_token: (t == null ? void 0 : t.id_token) || ""
410
+ access_token: (e == null ? void 0 : e.access_token) || "",
411
+ expires_at: (e == null ? void 0 : e.expires_at) || 0,
412
+ id_token: (e == null ? void 0 : e.id_token) || ""
412
413
  };
413
414
  }
414
415
  /**
@@ -423,14 +424,14 @@ class Yt {
423
424
  * // Redirect calls onRedirect with the log-out url for TID
424
425
  * // So it can be handled by the developer
425
426
  */
426
- async logout(t) {
427
- this.analyticshttpclient.sendMethodEvent(this.logout.name, this.clientId, O, x);
428
- const { onRedirect: a, disabledAutoRedirect: o } = t || {};
427
+ async logout(e) {
428
+ this.analyticshttpclient.sendMethodEvent(this.logout.name, this.clientId, d, h);
429
+ const { onRedirect: t, disabledAutoRedirect: n } = e || {};
429
430
  this.cacheManager && await this.cacheManager.clear(), this.cookiesManager && this.cookiesManager.clear();
430
- const u = await this.tokenProvider.GetOAuthLogoutRedirect("state");
431
- if (a != null)
432
- return a(u);
433
- o || window.location.assign(u);
431
+ const r = await this.tokenProvider.GetOAuthLogoutRedirect("state");
432
+ if (t != null)
433
+ return t(r);
434
+ n || window.location.assign(r);
434
435
  }
435
436
  /**
436
437
  * Check if the user still has a valid session
@@ -456,18 +457,18 @@ class Yt {
456
457
  * @return {Promise<void>} Empty promise
457
458
  */
458
459
  async loadCacheSessionIntoSDK() {
459
- const t = await this.cacheManager.getToken();
460
- if (t == null)
460
+ const e = await this.cacheManager.getToken();
461
+ if (e == null)
461
462
  return;
462
- const a = t.access_token, o = t.refresh_token || "", u = t.id_token, E = t.expires_at;
463
- this.tokenProvider = this.tokenProvider.WithAccessToken(a, E).WithRefreshToken(o).WithIdToken(u);
463
+ const t = e.access_token, n = e.refresh_token || "", r = e.id_token, a = e.expires_at;
464
+ this.tokenProvider = this.tokenProvider.WithAccessToken(t, a).WithRefreshToken(n).WithIdToken(r);
464
465
  }
465
466
  /**
466
467
  * Get a http bearer token client to use it for another SDK (Ex: Processing framework)
467
468
  * @return {any} - BearerTokenHttpClientProvider
468
469
  */
469
- getBearerTokenHttpClient(t) {
470
- return new St(this.tokenProvider, t);
470
+ getBearerTokenHttpClient(e) {
471
+ return new Q(this.tokenProvider, e);
471
472
  }
472
473
  /**
473
474
  * Get the redirect url to TID
@@ -477,642 +478,14 @@ class Yt {
477
478
  return this.redirectUrl;
478
479
  }
479
480
  }
480
- const ue = Ot(null), He = () => Be(ue) ?? {};
481
- var fe = { exports: {} }, V = {};
482
- /**
483
- * @license React
484
- * react-jsx-runtime.production.min.js
485
- *
486
- * Copyright (c) Facebook, Inc. and its affiliates.
487
- *
488
- * This source code is licensed under the MIT license found in the
489
- * LICENSE file in the root directory of this source tree.
490
- */
491
- var Ke;
492
- function Gt() {
493
- if (Ke)
494
- return V;
495
- Ke = 1;
496
- var i = Ge, t = Symbol.for("react.element"), a = Symbol.for("react.fragment"), o = Object.prototype.hasOwnProperty, u = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, E = { key: !0, ref: !0, __self: !0, __source: !0 };
497
- function C(T, p, I) {
498
- var _, f = {}, R = null, S = null;
499
- I !== void 0 && (R = "" + I), p.key !== void 0 && (R = "" + p.key), p.ref !== void 0 && (S = p.ref);
500
- for (_ in p)
501
- o.call(p, _) && !E.hasOwnProperty(_) && (f[_] = p[_]);
502
- if (T && T.defaultProps)
503
- for (_ in p = T.defaultProps, p)
504
- f[_] === void 0 && (f[_] = p[_]);
505
- return { $$typeof: t, type: T, key: R, ref: S, props: f, _owner: u.current };
506
- }
507
- return V.Fragment = a, V.jsx = C, V.jsxs = C, V;
508
- }
509
- var K = {};
510
- /**
511
- * @license React
512
- * react-jsx-runtime.development.js
513
- *
514
- * Copyright (c) Facebook, Inc. and its affiliates.
515
- *
516
- * This source code is licensed under the MIT license found in the
517
- * LICENSE file in the root directory of this source tree.
518
- */
519
- var Ye;
520
- function Bt() {
521
- return Ye || (Ye = 1, process.env.NODE_ENV !== "production" && function() {
522
- var i = Ge, t = Symbol.for("react.element"), a = Symbol.for("react.portal"), o = Symbol.for("react.fragment"), u = Symbol.for("react.strict_mode"), E = Symbol.for("react.profiler"), C = Symbol.for("react.provider"), T = Symbol.for("react.context"), p = Symbol.for("react.forward_ref"), I = Symbol.for("react.suspense"), _ = Symbol.for("react.suspense_list"), f = Symbol.for("react.memo"), R = Symbol.for("react.lazy"), S = Symbol.for("react.offscreen"), L = Symbol.iterator, Q = "@@iterator";
523
- function Y(e) {
524
- if (e === null || typeof e != "object")
525
- return null;
526
- var r = L && e[L] || e[Q];
527
- return typeof r == "function" ? r : null;
528
- }
529
- var A = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
530
- function m(e) {
531
- {
532
- for (var r = arguments.length, n = new Array(r > 1 ? r - 1 : 0), s = 1; s < r; s++)
533
- n[s - 1] = arguments[s];
534
- G("error", e, n);
535
- }
536
- }
537
- function G(e, r, n) {
538
- {
539
- var s = A.ReactDebugCurrentFrame, d = s.getStackAddendum();
540
- d !== "" && (r += "%s", n = n.concat([d]));
541
- var h = n.map(function(l) {
542
- return String(l);
543
- });
544
- h.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, h);
545
- }
546
- }
547
- var B = !1, Z = !1, v = !1, w = !1, ee = !1, he;
548
- he = Symbol.for("react.module.reference");
549
- function ze(e) {
550
- return !!(typeof e == "string" || typeof e == "function" || e === o || e === E || ee || e === u || e === I || e === _ || w || e === S || B || Z || v || typeof e == "object" && e !== null && (e.$$typeof === R || e.$$typeof === f || e.$$typeof === C || e.$$typeof === T || e.$$typeof === p || // This needs to include all possible module reference object
551
- // types supported by any Flight configuration anywhere since
552
- // we don't know which Flight build this will end up being used
553
- // with.
554
- e.$$typeof === he || e.getModuleId !== void 0));
555
- }
556
- function Xe(e, r, n) {
557
- var s = e.displayName;
558
- if (s)
559
- return s;
560
- var d = r.displayName || r.name || "";
561
- return d !== "" ? n + "(" + d + ")" : n;
562
- }
563
- function ve(e) {
564
- return e.displayName || "Context";
565
- }
566
- function D(e) {
567
- if (e == null)
568
- return null;
569
- if (typeof e.tag == "number" && m("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
570
- return e.displayName || e.name || null;
571
- if (typeof e == "string")
572
- return e;
573
- switch (e) {
574
- case o:
575
- return "Fragment";
576
- case a:
577
- return "Portal";
578
- case E:
579
- return "Profiler";
580
- case u:
581
- return "StrictMode";
582
- case I:
583
- return "Suspense";
584
- case _:
585
- return "SuspenseList";
586
- }
587
- if (typeof e == "object")
588
- switch (e.$$typeof) {
589
- case T:
590
- var r = e;
591
- return ve(r) + ".Consumer";
592
- case C:
593
- var n = e;
594
- return ve(n._context) + ".Provider";
595
- case p:
596
- return Xe(e, e.render, "ForwardRef");
597
- case f:
598
- var s = e.displayName || null;
599
- return s !== null ? s : D(e.type) || "Memo";
600
- case R: {
601
- var d = e, h = d._payload, l = d._init;
602
- try {
603
- return D(l(h));
604
- } catch {
605
- return null;
606
- }
607
- }
608
- }
609
- return null;
610
- }
611
- var U = Object.assign, W = 0, ge, pe, ye, Ee, me, _e, ke;
612
- function Te() {
613
- }
614
- Te.__reactDisabledLog = !0;
615
- function Qe() {
616
- {
617
- if (W === 0) {
618
- ge = console.log, pe = console.info, ye = console.warn, Ee = console.error, me = console.group, _e = console.groupCollapsed, ke = console.groupEnd;
619
- var e = {
620
- configurable: !0,
621
- enumerable: !0,
622
- value: Te,
623
- writable: !0
624
- };
625
- Object.defineProperties(console, {
626
- info: e,
627
- log: e,
628
- warn: e,
629
- error: e,
630
- group: e,
631
- groupCollapsed: e,
632
- groupEnd: e
633
- });
634
- }
635
- W++;
636
- }
637
- }
638
- function Ze() {
639
- {
640
- if (W--, W === 0) {
641
- var e = {
642
- configurable: !0,
643
- enumerable: !0,
644
- writable: !0
645
- };
646
- Object.defineProperties(console, {
647
- log: U({}, e, {
648
- value: ge
649
- }),
650
- info: U({}, e, {
651
- value: pe
652
- }),
653
- warn: U({}, e, {
654
- value: ye
655
- }),
656
- error: U({}, e, {
657
- value: Ee
658
- }),
659
- group: U({}, e, {
660
- value: me
661
- }),
662
- groupCollapsed: U({}, e, {
663
- value: _e
664
- }),
665
- groupEnd: U({}, e, {
666
- value: ke
667
- })
668
- });
669
- }
670
- W < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
671
- }
672
- }
673
- var te = A.ReactCurrentDispatcher, re;
674
- function q(e, r, n) {
675
- {
676
- if (re === void 0)
677
- try {
678
- throw Error();
679
- } catch (d) {
680
- var s = d.stack.trim().match(/\n( *(at )?)/);
681
- re = s && s[1] || "";
682
- }
683
- return `
684
- ` + re + e;
685
- }
686
- }
687
- var ne = !1, J;
688
- {
689
- var et = typeof WeakMap == "function" ? WeakMap : Map;
690
- J = new et();
691
- }
692
- function Re(e, r) {
693
- if (!e || ne)
694
- return "";
695
- {
696
- var n = J.get(e);
697
- if (n !== void 0)
698
- return n;
699
- }
700
- var s;
701
- ne = !0;
702
- var d = Error.prepareStackTrace;
703
- Error.prepareStackTrace = void 0;
704
- var h;
705
- h = te.current, te.current = null, Qe();
706
- try {
707
- if (r) {
708
- var l = function() {
709
- throw Error();
710
- };
711
- if (Object.defineProperty(l.prototype, "props", {
712
- set: function() {
713
- throw Error();
714
- }
715
- }), typeof Reflect == "object" && Reflect.construct) {
716
- try {
717
- Reflect.construct(l, []);
718
- } catch (M) {
719
- s = M;
720
- }
721
- Reflect.construct(e, [], l);
722
- } else {
723
- try {
724
- l.call();
725
- } catch (M) {
726
- s = M;
727
- }
728
- e.call(l.prototype);
729
- }
730
- } else {
731
- try {
732
- throw Error();
733
- } catch (M) {
734
- s = M;
735
- }
736
- e();
737
- }
738
- } catch (M) {
739
- if (M && s && typeof M.stack == "string") {
740
- for (var c = M.stack.split(`
741
- `), k = s.stack.split(`
742
- `), g = c.length - 1, y = k.length - 1; g >= 1 && y >= 0 && c[g] !== k[y]; )
743
- y--;
744
- for (; g >= 1 && y >= 0; g--, y--)
745
- if (c[g] !== k[y]) {
746
- if (g !== 1 || y !== 1)
747
- do
748
- if (g--, y--, y < 0 || c[g] !== k[y]) {
749
- var b = `
750
- ` + c[g].replace(" at new ", " at ");
751
- return e.displayName && b.includes("<anonymous>") && (b = b.replace("<anonymous>", e.displayName)), typeof e == "function" && J.set(e, b), b;
752
- }
753
- while (g >= 1 && y >= 0);
754
- break;
755
- }
756
- }
757
- } finally {
758
- ne = !1, te.current = h, Ze(), Error.prepareStackTrace = d;
759
- }
760
- var F = e ? e.displayName || e.name : "", je = F ? q(F) : "";
761
- return typeof e == "function" && J.set(e, je), je;
762
- }
763
- function tt(e, r, n) {
764
- return Re(e, !1);
765
- }
766
- function rt(e) {
767
- var r = e.prototype;
768
- return !!(r && r.isReactComponent);
769
- }
770
- function H(e, r, n) {
771
- if (e == null)
772
- return "";
773
- if (typeof e == "function")
774
- return Re(e, rt(e));
775
- if (typeof e == "string")
776
- return q(e);
777
- switch (e) {
778
- case I:
779
- return q("Suspense");
780
- case _:
781
- return q("SuspenseList");
782
- }
783
- if (typeof e == "object")
784
- switch (e.$$typeof) {
785
- case p:
786
- return tt(e.render);
787
- case f:
788
- return H(e.type, r, n);
789
- case R: {
790
- var s = e, d = s._payload, h = s._init;
791
- try {
792
- return H(h(d), r, n);
793
- } catch {
794
- }
795
- }
796
- }
797
- return "";
798
- }
799
- var z = Object.prototype.hasOwnProperty, we = {}, be = A.ReactDebugCurrentFrame;
800
- function X(e) {
801
- if (e) {
802
- var r = e._owner, n = H(e.type, e._source, r ? r.type : null);
803
- be.setExtraStackFrame(n);
804
- } else
805
- be.setExtraStackFrame(null);
806
- }
807
- function nt(e, r, n, s, d) {
808
- {
809
- var h = Function.call.bind(z);
810
- for (var l in e)
811
- if (h(e, l)) {
812
- var c = void 0;
813
- try {
814
- if (typeof e[l] != "function") {
815
- var k = Error((s || "React class") + ": " + n + " type `" + l + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[l] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
816
- throw k.name = "Invariant Violation", k;
817
- }
818
- c = e[l](r, l, s, n, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
819
- } catch (g) {
820
- c = g;
821
- }
822
- c && !(c instanceof Error) && (X(d), m("%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", n, l, typeof c), X(null)), c instanceof Error && !(c.message in we) && (we[c.message] = !0, X(d), m("Failed %s type: %s", n, c.message), X(null));
823
- }
824
- }
825
- }
826
- var at = Array.isArray;
827
- function ae(e) {
828
- return at(e);
829
- }
830
- function it(e) {
831
- {
832
- var r = typeof Symbol == "function" && Symbol.toStringTag, n = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
833
- return n;
834
- }
835
- }
836
- function ot(e) {
837
- try {
838
- return Ce(e), !1;
839
- } catch {
840
- return !0;
841
- }
842
- }
843
- function Ce(e) {
844
- return "" + e;
845
- }
846
- function Se(e) {
847
- if (ot(e))
848
- return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", it(e)), Ce(e);
849
- }
850
- var N = A.ReactCurrentOwner, st = {
851
- key: !0,
852
- ref: !0,
853
- __self: !0,
854
- __source: !0
855
- }, Pe, Oe, ie;
856
- ie = {};
857
- function ct(e) {
858
- if (z.call(e, "ref")) {
859
- var r = Object.getOwnPropertyDescriptor(e, "ref").get;
860
- if (r && r.isReactWarning)
861
- return !1;
862
- }
863
- return e.ref !== void 0;
864
- }
865
- function lt(e) {
866
- if (z.call(e, "key")) {
867
- var r = Object.getOwnPropertyDescriptor(e, "key").get;
868
- if (r && r.isReactWarning)
869
- return !1;
870
- }
871
- return e.key !== void 0;
872
- }
873
- function ut(e, r) {
874
- if (typeof e.ref == "string" && N.current && r && N.current.stateNode !== r) {
875
- var n = D(N.current.type);
876
- ie[n] || (m('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', D(N.current.type), e.ref), ie[n] = !0);
877
- }
878
- }
879
- function ft(e, r) {
880
- {
881
- var n = function() {
882
- Pe || (Pe = !0, m("%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));
883
- };
884
- n.isReactWarning = !0, Object.defineProperty(e, "key", {
885
- get: n,
886
- configurable: !0
887
- });
888
- }
889
- }
890
- function dt(e, r) {
891
- {
892
- var n = function() {
893
- Oe || (Oe = !0, m("%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));
894
- };
895
- n.isReactWarning = !0, Object.defineProperty(e, "ref", {
896
- get: n,
897
- configurable: !0
898
- });
899
- }
900
- }
901
- var ht = function(e, r, n, s, d, h, l) {
902
- var c = {
903
- // This tag allows us to uniquely identify this as a React Element
904
- $$typeof: t,
905
- // Built-in properties that belong on the element
906
- type: e,
907
- key: r,
908
- ref: n,
909
- props: l,
910
- // Record the component responsible for creating this element.
911
- _owner: h
912
- };
913
- return c._store = {}, Object.defineProperty(c._store, "validated", {
914
- configurable: !1,
915
- enumerable: !1,
916
- writable: !0,
917
- value: !1
918
- }), Object.defineProperty(c, "_self", {
919
- configurable: !1,
920
- enumerable: !1,
921
- writable: !1,
922
- value: s
923
- }), Object.defineProperty(c, "_source", {
924
- configurable: !1,
925
- enumerable: !1,
926
- writable: !1,
927
- value: d
928
- }), Object.freeze && (Object.freeze(c.props), Object.freeze(c)), c;
929
- };
930
- function vt(e, r, n, s, d) {
931
- {
932
- var h, l = {}, c = null, k = null;
933
- n !== void 0 && (Se(n), c = "" + n), lt(r) && (Se(r.key), c = "" + r.key), ct(r) && (k = r.ref, ut(r, d));
934
- for (h in r)
935
- z.call(r, h) && !st.hasOwnProperty(h) && (l[h] = r[h]);
936
- if (e && e.defaultProps) {
937
- var g = e.defaultProps;
938
- for (h in g)
939
- l[h] === void 0 && (l[h] = g[h]);
940
- }
941
- if (c || k) {
942
- var y = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
943
- c && ft(l, y), k && dt(l, y);
944
- }
945
- return ht(e, c, k, d, s, N.current, l);
946
- }
947
- }
948
- var oe = A.ReactCurrentOwner, xe = A.ReactDebugCurrentFrame;
949
- function j(e) {
950
- if (e) {
951
- var r = e._owner, n = H(e.type, e._source, r ? r.type : null);
952
- xe.setExtraStackFrame(n);
953
- } else
954
- xe.setExtraStackFrame(null);
955
- }
956
- var se;
957
- se = !1;
958
- function ce(e) {
959
- return typeof e == "object" && e !== null && e.$$typeof === t;
960
- }
961
- function Ie() {
962
- {
963
- if (oe.current) {
964
- var e = D(oe.current.type);
965
- if (e)
966
- return `
967
-
968
- Check the render method of \`` + e + "`.";
969
- }
970
- return "";
971
- }
972
- }
973
- function gt(e) {
974
- {
975
- if (e !== void 0) {
976
- var r = e.fileName.replace(/^.*[\\\/]/, ""), n = e.lineNumber;
977
- return `
978
-
979
- Check your code at ` + r + ":" + n + ".";
980
- }
981
- return "";
982
- }
983
- }
984
- var Ae = {};
985
- function pt(e) {
986
- {
987
- var r = Ie();
988
- if (!r) {
989
- var n = typeof e == "string" ? e : e.displayName || e.name;
990
- n && (r = `
991
-
992
- Check the top-level render call using <` + n + ">.");
993
- }
994
- return r;
995
- }
996
- }
997
- function De(e, r) {
998
- {
999
- if (!e._store || e._store.validated || e.key != null)
1000
- return;
1001
- e._store.validated = !0;
1002
- var n = pt(r);
1003
- if (Ae[n])
1004
- return;
1005
- Ae[n] = !0;
1006
- var s = "";
1007
- e && e._owner && e._owner !== oe.current && (s = " It was passed a child from " + D(e._owner.type) + "."), j(e), m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, s), j(null);
1008
- }
1009
- }
1010
- function Me(e, r) {
1011
- {
1012
- if (typeof e != "object")
1013
- return;
1014
- if (ae(e))
1015
- for (var n = 0; n < e.length; n++) {
1016
- var s = e[n];
1017
- ce(s) && De(s, r);
1018
- }
1019
- else if (ce(e))
1020
- e._store && (e._store.validated = !0);
1021
- else if (e) {
1022
- var d = Y(e);
1023
- if (typeof d == "function" && d !== e.entries)
1024
- for (var h = d.call(e), l; !(l = h.next()).done; )
1025
- ce(l.value) && De(l.value, r);
1026
- }
1027
- }
1028
- }
1029
- function yt(e) {
1030
- {
1031
- var r = e.type;
1032
- if (r == null || typeof r == "string")
1033
- return;
1034
- var n;
1035
- if (typeof r == "function")
1036
- n = r.propTypes;
1037
- else if (typeof r == "object" && (r.$$typeof === p || // Note: Memo only checks outer props here.
1038
- // Inner props are checked in the reconciler.
1039
- r.$$typeof === f))
1040
- n = r.propTypes;
1041
- else
1042
- return;
1043
- if (n) {
1044
- var s = D(r);
1045
- nt(n, e.props, "prop", s, e);
1046
- } else if (r.PropTypes !== void 0 && !se) {
1047
- se = !0;
1048
- var d = D(r);
1049
- m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", d || "Unknown");
1050
- }
1051
- typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
1052
- }
1053
- }
1054
- function Et(e) {
1055
- {
1056
- for (var r = Object.keys(e.props), n = 0; n < r.length; n++) {
1057
- var s = r[n];
1058
- if (s !== "children" && s !== "key") {
1059
- j(e), m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", s), j(null);
1060
- break;
1061
- }
1062
- }
1063
- e.ref !== null && (j(e), m("Invalid attribute `ref` supplied to `React.Fragment`."), j(null));
1064
- }
1065
- }
1066
- function Ue(e, r, n, s, d, h) {
1067
- {
1068
- var l = ze(e);
1069
- if (!l) {
1070
- var c = "";
1071
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (c += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
1072
- var k = gt(d);
1073
- k ? c += k : c += Ie();
1074
- var g;
1075
- e === null ? g = "null" : ae(e) ? g = "array" : e !== void 0 && e.$$typeof === t ? (g = "<" + (D(e.type) || "Unknown") + " />", c = " Did you accidentally export a JSX literal instead of a component?") : g = typeof e, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", g, c);
1076
- }
1077
- var y = vt(e, r, n, d, h);
1078
- if (y == null)
1079
- return y;
1080
- if (l) {
1081
- var b = r.children;
1082
- if (b !== void 0)
1083
- if (s)
1084
- if (ae(b)) {
1085
- for (var F = 0; F < b.length; F++)
1086
- Me(b[F], e);
1087
- Object.freeze && Object.freeze(b);
1088
- } else
1089
- m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
1090
- else
1091
- Me(b, e);
1092
- }
1093
- return e === o ? Et(y) : yt(y), y;
1094
- }
1095
- }
1096
- function mt(e, r, n) {
1097
- return Ue(e, r, n, !0);
1098
- }
1099
- function _t(e, r, n) {
1100
- return Ue(e, r, n, !1);
1101
- }
1102
- var kt = _t, Tt = mt;
1103
- K.Fragment = o, K.jsx = kt, K.jsxs = Tt;
1104
- }()), K;
1105
- }
1106
- process.env.NODE_ENV === "production" ? fe.exports = Gt() : fe.exports = Bt();
1107
- var de = fe.exports;
1108
- const qt = (i, t) => {
1109
- switch (t.type) {
481
+ const E = q(null), W = () => L(E) ?? {}, he = (i, e) => {
482
+ switch (e.type) {
1110
483
  case "INIT":
1111
484
  return {
1112
485
  ...i,
1113
486
  isLoading: !1,
1114
- isAuthenticated: t.user != null,
1115
- user: t.user,
487
+ isAuthenticated: e.user != null,
488
+ user: e.user,
1116
489
  error: void 0
1117
490
  };
1118
491
  case "GET_TOKENS_COMPLETE":
@@ -1121,8 +494,8 @@ const qt = (i, t) => {
1121
494
  return {
1122
495
  ...i,
1123
496
  isLoading: !1,
1124
- isAuthenticated: t.user != null,
1125
- user: t.user,
497
+ isAuthenticated: e.user != null,
498
+ user: e.user,
1126
499
  error: void 0
1127
500
  };
1128
501
  case "LOGOUT":
@@ -1135,128 +508,128 @@ const qt = (i, t) => {
1135
508
  return {
1136
509
  ...i,
1137
510
  isLoading: !1,
1138
- error: t.error
511
+ error: e.error
1139
512
  };
1140
513
  }
1141
- }, Jt = {
514
+ }, ue = {
1142
515
  isLoading: !0,
1143
516
  isAuthenticated: !1
1144
- }, Ht = (i) => {
517
+ }, ge = (i) => {
1145
518
  if (i == null || Object.keys(i).length <= 0)
1146
519
  return !0;
1147
- const t = Object.keys(i);
1148
- for (const a of t)
1149
- if (i[a] != null && i[a] !== "")
520
+ const e = Object.keys(i);
521
+ for (const t of e)
522
+ if (i[t] != null && i[t] !== "")
1150
523
  return !1;
1151
524
  return !0;
1152
- }, zt = (i) => !Ht(i.config), Xt = (i) => {
525
+ }, ke = (i) => !ge(i.config), fe = (i) => {
1153
526
  const {
1154
- children: t,
1155
- configurationEndpoint: a,
1156
- clientId: o,
1157
- redirectUrl: u,
1158
- logoutRedirectUrl: E,
1159
- scopes: C,
1160
- onRedirectCallback: T,
1161
- checkRedirectUrlMatch: p
527
+ children: e,
528
+ configurationEndpoint: t,
529
+ clientId: n,
530
+ redirectUrl: r,
531
+ logoutRedirectUrl: a,
532
+ scopes: g,
533
+ onRedirectCallback: k,
534
+ checkRedirectUrlMatch: v
1162
535
  } = i;
1163
- if (Be(ue) != null)
536
+ if (L(E) != null)
1164
537
  throw new Error("TID Provider already defined");
1165
- const _ = {
538
+ const T = {
1166
539
  config: {
1167
- configurationEndpoint: a ?? "",
1168
- clientId: o ?? "",
1169
- redirectUrl: u ?? "",
1170
- logoutRedirectUrl: E ?? "",
1171
- scopes: C ?? [""]
1172
- }
1173
- }, [f] = xt(i.tidClient ?? new Yt(_)), [R, S] = It(qt, Jt), L = At(!1), Q = Le(
1174
- () => p ? f.getRedirectUrl() : void 0,
1175
- [p, f]
540
+ configurationEndpoint: t ?? "",
541
+ clientId: n ?? "",
542
+ redirectUrl: r ?? "",
543
+ logoutRedirectUrl: a ?? "",
544
+ scopes: g ?? [""]
545
+ }
546
+ }, [s] = z(i.tidClient ?? new de(T)), [f, u] = X(he, ue), p = Y(!1), N = M(
547
+ () => v ? s.getRedirectUrl() : void 0,
548
+ [v, s]
1176
549
  );
1177
- qe(() => {
1178
- L.current || (i.tidClient != null && zt({
550
+ D(() => {
551
+ p.current || (i.tidClient != null && ke({
1179
552
  config: {
1180
- configurationEndpoint: a,
1181
- clientId: o,
1182
- redirectUrl: u,
1183
- logoutRedirectUrl: E,
1184
- scopes: C
553
+ configurationEndpoint: t,
554
+ clientId: n,
555
+ redirectUrl: r,
556
+ logoutRedirectUrl: a,
557
+ scopes: g
1185
558
  }
1186
559
  }) && console.warn(
1187
560
  "When TID client is pass as prop, any client configuration property sent directly to the TID Provider component will be ignored"
1188
- ), L.current = !0, (async () => {
561
+ ), p.current = !0, (async () => {
1189
562
  try {
1190
- let v;
1191
- if (Ft(void 0, Q)) {
1192
- const { authState: w } = await f.handleCallback();
1193
- v = await f.getUser(), T != null && T(w);
563
+ let o;
564
+ if (ne(void 0, N)) {
565
+ const { authState: l } = await s.handleCallback();
566
+ o = await s.getUser(), k != null && k(l);
1194
567
  } else
1195
- await f.loadUserSession(), v = await f.getUser();
1196
- S({ type: "INIT", user: v });
1197
- } catch (v) {
1198
- let w = v;
1199
- typeof v == "string" && (w = new Error(v)), S({ type: "ERROR", error: w });
568
+ await s.loadUserSession(), o = await s.getUser();
569
+ u({ type: "INIT", user: o });
570
+ } catch (o) {
571
+ let l = o;
572
+ typeof o == "string" && (l = new Error(o)), u({ type: "ERROR", error: l });
1200
573
  }
1201
574
  })());
1202
- }, [f, T]);
1203
- const Y = $(async () => {
1204
- const v = await f.getAccessTokenSilently(), w = await f.getUser();
1205
- return S({
575
+ }, [s, k]);
576
+ const _ = y(async () => {
577
+ const o = await s.getAccessTokenSilently(), l = await s.getUser();
578
+ return u({
1206
579
  type: "GET_ACCESS_TOKEN_COMPLETE",
1207
- user: w
1208
- }), v;
1209
- }, [f]), A = $(async () => {
1210
- const v = await f.getTokens(), w = await f.getUser();
1211
- return S({
580
+ user: l
581
+ }), o;
582
+ }, [s]), C = y(async () => {
583
+ const o = await s.getTokens(), l = await s.getUser();
584
+ return u({
1212
585
  type: "GET_TOKENS_COMPLETE",
1213
- user: w
1214
- }), v;
1215
- }, [f]), m = $(
1216
- async (v) => {
1217
- await f.loginWithRedirect(v);
586
+ user: l
587
+ }), o;
588
+ }, [s]), S = y(
589
+ async (o) => {
590
+ await s.loginWithRedirect(o);
1218
591
  },
1219
- [f]
1220
- ), G = $(
1221
- async (v) => {
1222
- await f.logout(v), (v == null ? void 0 : v.disabledAutoRedirect) != null && v.disabledAutoRedirect && S({
592
+ [s]
593
+ ), I = y(
594
+ async (o) => {
595
+ await s.logout(o), (o == null ? void 0 : o.disabledAutoRedirect) != null && o.disabledAutoRedirect && u({
1223
596
  type: "LOGOUT"
1224
597
  });
1225
598
  },
1226
- [f]
1227
- ), B = $(
1228
- async (v) => {
1229
- const { authState: w } = await f.handleCallback(v), ee = await f.getUser();
1230
- return S({
599
+ [s]
600
+ ), P = y(
601
+ async (o) => {
602
+ const { authState: l } = await s.handleCallback(o), V = await s.getUser();
603
+ return u({
1231
604
  type: "HANDLE_CALLBACK_COMPLETE",
1232
- user: ee
605
+ user: V
1233
606
  }), {
1234
- authState: w
607
+ authState: l
1235
608
  };
1236
609
  },
1237
- [f]
1238
- ), Z = Le(
610
+ [s]
611
+ ), G = M(
1239
612
  () => ({
1240
- ...R,
1241
- getAccessTokenSilently: Y,
1242
- getTokens: A,
1243
- loginWithRedirect: m,
1244
- handleCallback: B,
1245
- logout: G
613
+ ...f,
614
+ getAccessTokenSilently: _,
615
+ getTokens: C,
616
+ loginWithRedirect: S,
617
+ handleCallback: P,
618
+ logout: I
1246
619
  }),
1247
- [R, Y, A, m, B, G]
620
+ [f, _, C, S, P, I]
1248
621
  );
1249
- return /* @__PURE__ */ de.jsx(ue.Provider, { value: Z, children: t });
1250
- }, rr = He, nr = Xt, ar = ({ renderComponent: i, loader: t }) => {
1251
- const { isAuthenticated: a, isLoading: o, loginWithRedirect: u } = He();
1252
- return qe(() => {
1253
- !o && !a && (async () => await u())();
1254
- }, [o, a, u]), a ? i : t || /* @__PURE__ */ de.jsx(de.Fragment, {});
622
+ return /* @__PURE__ */ K(E.Provider, { value: G, children: e });
623
+ }, me = W, pe = fe, _e = ({ renderComponent: i, loader: e }) => {
624
+ const { isAuthenticated: t, isLoading: n, loginWithRedirect: r } = W();
625
+ return D(() => {
626
+ !n && !t && (async () => await r())();
627
+ }, [n, t, r]), t ? i : e || /* @__PURE__ */ K(Z, {});
1255
628
  };
1256
629
  export {
1257
- ar as AuthenticationGuard,
1258
- Yt as TIDClient,
1259
- ue as TIDContext,
1260
- nr as TIDProvider,
1261
- rr as useAuth
630
+ _e as AuthenticationGuard,
631
+ de as TIDClient,
632
+ E as TIDContext,
633
+ pe as TIDProvider,
634
+ me as useAuth
1262
635
  };