intelica-library-ui 0.1.123 → 0.1.125
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.
|
@@ -397,6 +397,7 @@ const ErrorInterceptor = (req, next) => {
|
|
|
397
397
|
HeaderSettings["ClientID"] = configService.environment?.clientID ?? "";
|
|
398
398
|
HeaderSettings["PageRoot"] = commonFeatureFlagService.GetPageRoot();
|
|
399
399
|
HeaderSettings["LanguageCode"] = getCookie("language") ?? "";
|
|
400
|
+
HeaderSettings["Environment"] = configService.environment?.environment ?? "";
|
|
400
401
|
HeaderSettings["Access"] = authenticationClientID == "" ? "" : getCookie(authenticationClientID) ?? "";
|
|
401
402
|
}
|
|
402
403
|
let _request = req.clone({ headers: new HttpHeaders(HeaderSettings) });
|
|
@@ -424,10 +425,20 @@ const ErrorInterceptor = (req, next) => {
|
|
|
424
425
|
}
|
|
425
426
|
};
|
|
426
427
|
|
|
428
|
+
function GetCookieAttributes(environment) {
|
|
429
|
+
const domain = window.location.hostname
|
|
430
|
+
.split(".")
|
|
431
|
+
.slice(environment == "main" ? -2 : -3)
|
|
432
|
+
.join(".");
|
|
433
|
+
const secure = !domain.includes("localhost");
|
|
434
|
+
return { domain: domain, path: "/", secure: secure };
|
|
435
|
+
}
|
|
436
|
+
|
|
427
437
|
const RefreshTokenInterceptor = (req, next) => {
|
|
428
438
|
const configService = inject(ConfigService);
|
|
429
439
|
const httpClient = inject(HttpClient);
|
|
430
440
|
const commonFeatureFlagService = inject(GlobalFeatureFlagService);
|
|
441
|
+
const cookieAttributesGeneral = GetCookieAttributes(configService.environment?.environment ?? "");
|
|
431
442
|
let _request = req.clone();
|
|
432
443
|
let authenticationLocation = `${configService.environment?.authenticationWeb}?callback=${window.location.href}&clientID=${configService.environment?.clientID}`;
|
|
433
444
|
let path = `${configService.environment?.authenticationPath ?? ""}/Authenticate/ValidateToken`;
|
|
@@ -446,20 +457,20 @@ const RefreshTokenInterceptor = (req, next) => {
|
|
|
446
457
|
if (!req.url.includes("ValidateToken") && !req.url.includes("environment.json") && !req.url.includes("GetAuthenticationFromCache"))
|
|
447
458
|
return from(httpClient.post(path, validateTokenQuery)).pipe(switchMap((response) => {
|
|
448
459
|
if (response.expired) {
|
|
449
|
-
Cookies.remove("token",
|
|
450
|
-
Cookies.remove("refreshToken",
|
|
451
|
-
Cookies.remove("data",
|
|
452
|
-
Cookies.remove("businessUserClientGroupID",
|
|
453
|
-
Cookies.remove("defaultClientID",
|
|
454
|
-
Cookies.remove("defaultClientGroupID",
|
|
455
|
-
Cookies.remove(authenticationClientID,
|
|
460
|
+
Cookies.remove("token", cookieAttributesGeneral);
|
|
461
|
+
Cookies.remove("refreshToken", cookieAttributesGeneral);
|
|
462
|
+
Cookies.remove("data", cookieAttributesGeneral);
|
|
463
|
+
Cookies.remove("businessUserClientGroupID", cookieAttributesGeneral);
|
|
464
|
+
Cookies.remove("defaultClientID", cookieAttributesGeneral);
|
|
465
|
+
Cookies.remove("defaultClientGroupID", cookieAttributesGeneral);
|
|
466
|
+
Cookies.remove(authenticationClientID, cookieAttributesGeneral);
|
|
456
467
|
window.location.href = authenticationLocation;
|
|
457
468
|
return next(_request);
|
|
458
469
|
}
|
|
459
470
|
if (response.unauthorized)
|
|
460
471
|
window.location.href = window.location.origin;
|
|
461
472
|
if (response.newToken != "")
|
|
462
|
-
setCookie("token", response.newToken,
|
|
473
|
+
setCookie("token", response.newToken, cookieAttributesGeneral);
|
|
463
474
|
return next(_request);
|
|
464
475
|
}));
|
|
465
476
|
else
|
|
@@ -4143,15 +4154,6 @@ function EmailInputValidation(event) {
|
|
|
4143
4154
|
}
|
|
4144
4155
|
}
|
|
4145
4156
|
|
|
4146
|
-
function GetCookieAttributes(environment) {
|
|
4147
|
-
const domain = window.location.hostname
|
|
4148
|
-
.split(".")
|
|
4149
|
-
.slice(environment == "main" ? -2 : -3)
|
|
4150
|
-
.join(".");
|
|
4151
|
-
const secure = !domain.includes("localhost");
|
|
4152
|
-
return { domain: domain, path: "/", secure: secure };
|
|
4153
|
-
}
|
|
4154
|
-
|
|
4155
4157
|
const IntelicaTheme = definePreset(Aura, {
|
|
4156
4158
|
primitive: {
|
|
4157
4159
|
blue: {
|