@klauswuestefeld/jux-web 2025.2.11 → 2025.5.24-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/jux-web.js +16 -12
- package/dist/login/session.d.ts +1 -1
- package/dist/main.esm.js +16 -12
- package/dist/main.js +16 -12
- package/package.json +1 -1
package/dist/jux-web.js
CHANGED
|
@@ -14517,14 +14517,8 @@ var juxWeb = (function (exports) {
|
|
|
14517
14517
|
// setSuperToken();
|
|
14518
14518
|
onUserLogin();
|
|
14519
14519
|
};
|
|
14520
|
-
const clearSession = (
|
|
14521
|
-
|
|
14522
|
-
// TODO: find a better way to preserve backend-url
|
|
14523
|
-
const backendUrl = getBackendUrl(); // Preserve backend, since the authentication was succcessfull
|
|
14524
|
-
const savedItems = itemsToSave === null || itemsToSave === void 0 ? void 0 : itemsToSave.map((item) => ({ key: item, value: localStorage.getItem(item) }));
|
|
14525
|
-
localStorage.clear();
|
|
14526
|
-
savedItems === null || savedItems === void 0 ? void 0 : savedItems.forEach((item) => localStorage.setItem(item.key, item.value));
|
|
14527
|
-
setBackendUrl(backendUrl);
|
|
14520
|
+
const clearSession = () => {
|
|
14521
|
+
localStorage.removeItem('token');
|
|
14528
14522
|
// @ts-ignore
|
|
14529
14523
|
window.store = {};
|
|
14530
14524
|
};
|
|
@@ -14550,13 +14544,23 @@ var juxWeb = (function (exports) {
|
|
|
14550
14544
|
Array.from(clientApp.children).forEach(el => el.remove());
|
|
14551
14545
|
clientApp.appendChild(page);
|
|
14552
14546
|
};
|
|
14553
|
-
const
|
|
14547
|
+
const getBaseElementHref = () => {
|
|
14548
|
+
const baseElement = document.getElementsByTagName('base')[0];
|
|
14549
|
+
if (!baseElement)
|
|
14550
|
+
return null;
|
|
14551
|
+
return baseElement.href || null;
|
|
14552
|
+
};
|
|
14553
|
+
const produceSSORedirectURI = () => {
|
|
14554
|
+
const baseElementHref = getBaseElementHref();
|
|
14555
|
+
if (baseElementHref)
|
|
14556
|
+
return baseElementHref;
|
|
14554
14557
|
const { protocol, host } = window.location;
|
|
14555
|
-
return protocol + '//' + host + '/
|
|
14558
|
+
return protocol + '//' + host + '/';
|
|
14556
14559
|
};
|
|
14560
|
+
const getSSORedirectURI = () => produceSSORedirectURI() + 'callback';
|
|
14557
14561
|
const handleSSOLogin = () => {
|
|
14558
14562
|
const onSuccess = (authEndpoint) => {
|
|
14559
|
-
const authUrl = authEndpoint + `&redirect_uri=${
|
|
14563
|
+
const authUrl = authEndpoint + `&redirect_uri=${getSSORedirectURI()}`;
|
|
14560
14564
|
window.location.replace(authUrl);
|
|
14561
14565
|
};
|
|
14562
14566
|
const onError = () => onAuthenticationFailure('login-failed');
|
|
@@ -14601,7 +14605,7 @@ var juxWeb = (function (exports) {
|
|
|
14601
14605
|
}
|
|
14602
14606
|
const ssoToken = extractTokenFromWindowLocation('code');
|
|
14603
14607
|
if (ssoToken) {
|
|
14604
|
-
validateSSOToken(ssoToken,
|
|
14608
|
+
validateSSOToken(ssoToken, getSSORedirectURI(), (res) => onAuthentication(onUserLogin, res, 'SSO Authentication'), (_res) => onAuthenticationFailure('login-failed'), (res) => __awaiter$2(void 0, void 0, void 0, function* () {
|
|
14605
14609
|
const jsonResponse = yield res.json();
|
|
14606
14610
|
const unauthorizedEmail = jsonResponse.email;
|
|
14607
14611
|
const onReturn = () => handleSSOLogin();
|
package/dist/login/session.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const setBackendToken: (token: string) => void;
|
|
2
2
|
export declare const onTokenAcquired: (token: string, onUserLogin: any) => void;
|
|
3
|
-
export declare const clearSession: (
|
|
3
|
+
export declare const clearSession: () => void;
|
|
4
4
|
export declare const initSession: (clientApp: HTMLElement, supportedLoginTypes: string[], onUserLogin: any, onLoginError: any, backgroundImage: string, fetchUserBackendUrl: any, magicLinkRequestEndpoint: string | null, magicLinkAuthEndpoint: string | null) => void;
|
|
5
5
|
export declare const onMicrosoftSignIn: (onUserLogin: any) => Promise<void>;
|
|
6
6
|
export declare const onGoogleSignIn: (onUserLogin: any) => void;
|
package/dist/main.esm.js
CHANGED
|
@@ -1002,14 +1002,8 @@ const onTokenAcquired = (token, onUserLogin) => {
|
|
|
1002
1002
|
// setSuperToken();
|
|
1003
1003
|
onUserLogin();
|
|
1004
1004
|
};
|
|
1005
|
-
const clearSession = (
|
|
1006
|
-
|
|
1007
|
-
// TODO: find a better way to preserve backend-url
|
|
1008
|
-
const backendUrl = getBackendUrl(); // Preserve backend, since the authentication was succcessfull
|
|
1009
|
-
const savedItems = itemsToSave === null || itemsToSave === void 0 ? void 0 : itemsToSave.map((item) => ({ key: item, value: localStorage.getItem(item) }));
|
|
1010
|
-
localStorage.clear();
|
|
1011
|
-
savedItems === null || savedItems === void 0 ? void 0 : savedItems.forEach((item) => localStorage.setItem(item.key, item.value));
|
|
1012
|
-
setBackendUrl(backendUrl);
|
|
1005
|
+
const clearSession = () => {
|
|
1006
|
+
localStorage.removeItem('token');
|
|
1013
1007
|
// @ts-ignore
|
|
1014
1008
|
window.store = {};
|
|
1015
1009
|
};
|
|
@@ -1035,13 +1029,23 @@ const displayPage = (clientApp, page) => {
|
|
|
1035
1029
|
Array.from(clientApp.children).forEach(el => el.remove());
|
|
1036
1030
|
clientApp.appendChild(page);
|
|
1037
1031
|
};
|
|
1038
|
-
const
|
|
1032
|
+
const getBaseElementHref = () => {
|
|
1033
|
+
const baseElement = document.getElementsByTagName('base')[0];
|
|
1034
|
+
if (!baseElement)
|
|
1035
|
+
return null;
|
|
1036
|
+
return baseElement.href || null;
|
|
1037
|
+
};
|
|
1038
|
+
const produceSSORedirectURI = () => {
|
|
1039
|
+
const baseElementHref = getBaseElementHref();
|
|
1040
|
+
if (baseElementHref)
|
|
1041
|
+
return baseElementHref;
|
|
1039
1042
|
const { protocol, host } = window.location;
|
|
1040
|
-
return protocol + '//' + host + '/
|
|
1043
|
+
return protocol + '//' + host + '/';
|
|
1041
1044
|
};
|
|
1045
|
+
const getSSORedirectURI = () => produceSSORedirectURI() + 'callback';
|
|
1042
1046
|
const handleSSOLogin = () => {
|
|
1043
1047
|
const onSuccess = (authEndpoint) => {
|
|
1044
|
-
const authUrl = authEndpoint + `&redirect_uri=${
|
|
1048
|
+
const authUrl = authEndpoint + `&redirect_uri=${getSSORedirectURI()}`;
|
|
1045
1049
|
window.location.replace(authUrl);
|
|
1046
1050
|
};
|
|
1047
1051
|
const onError = () => onAuthenticationFailure('login-failed');
|
|
@@ -1086,7 +1090,7 @@ const initSession = (clientApp, supportedLoginTypes, onUserLogin, onLoginError,
|
|
|
1086
1090
|
}
|
|
1087
1091
|
const ssoToken = extractTokenFromWindowLocation('code');
|
|
1088
1092
|
if (ssoToken) {
|
|
1089
|
-
validateSSOToken(ssoToken,
|
|
1093
|
+
validateSSOToken(ssoToken, getSSORedirectURI(), (res) => onAuthentication(onUserLogin, res, 'SSO Authentication'), (_res) => onAuthenticationFailure('login-failed'), (res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1090
1094
|
const jsonResponse = yield res.json();
|
|
1091
1095
|
const unauthorizedEmail = jsonResponse.email;
|
|
1092
1096
|
const onReturn = () => handleSSOLogin();
|
package/dist/main.js
CHANGED
|
@@ -1026,14 +1026,8 @@ const onTokenAcquired = (token, onUserLogin) => {
|
|
|
1026
1026
|
// setSuperToken();
|
|
1027
1027
|
onUserLogin();
|
|
1028
1028
|
};
|
|
1029
|
-
const clearSession = (
|
|
1030
|
-
|
|
1031
|
-
// TODO: find a better way to preserve backend-url
|
|
1032
|
-
const backendUrl = getBackendUrl(); // Preserve backend, since the authentication was succcessfull
|
|
1033
|
-
const savedItems = itemsToSave === null || itemsToSave === void 0 ? void 0 : itemsToSave.map((item) => ({ key: item, value: localStorage.getItem(item) }));
|
|
1034
|
-
localStorage.clear();
|
|
1035
|
-
savedItems === null || savedItems === void 0 ? void 0 : savedItems.forEach((item) => localStorage.setItem(item.key, item.value));
|
|
1036
|
-
setBackendUrl(backendUrl);
|
|
1029
|
+
const clearSession = () => {
|
|
1030
|
+
localStorage.removeItem('token');
|
|
1037
1031
|
// @ts-ignore
|
|
1038
1032
|
window.store = {};
|
|
1039
1033
|
};
|
|
@@ -1059,13 +1053,23 @@ const displayPage = (clientApp, page) => {
|
|
|
1059
1053
|
Array.from(clientApp.children).forEach(el => el.remove());
|
|
1060
1054
|
clientApp.appendChild(page);
|
|
1061
1055
|
};
|
|
1062
|
-
const
|
|
1056
|
+
const getBaseElementHref = () => {
|
|
1057
|
+
const baseElement = document.getElementsByTagName('base')[0];
|
|
1058
|
+
if (!baseElement)
|
|
1059
|
+
return null;
|
|
1060
|
+
return baseElement.href || null;
|
|
1061
|
+
};
|
|
1062
|
+
const produceSSORedirectURI = () => {
|
|
1063
|
+
const baseElementHref = getBaseElementHref();
|
|
1064
|
+
if (baseElementHref)
|
|
1065
|
+
return baseElementHref;
|
|
1063
1066
|
const { protocol, host } = window.location;
|
|
1064
|
-
return protocol + '//' + host + '/
|
|
1067
|
+
return protocol + '//' + host + '/';
|
|
1065
1068
|
};
|
|
1069
|
+
const getSSORedirectURI = () => produceSSORedirectURI() + 'callback';
|
|
1066
1070
|
const handleSSOLogin = () => {
|
|
1067
1071
|
const onSuccess = (authEndpoint) => {
|
|
1068
|
-
const authUrl = authEndpoint + `&redirect_uri=${
|
|
1072
|
+
const authUrl = authEndpoint + `&redirect_uri=${getSSORedirectURI()}`;
|
|
1069
1073
|
window.location.replace(authUrl);
|
|
1070
1074
|
};
|
|
1071
1075
|
const onError = () => onAuthenticationFailure('login-failed');
|
|
@@ -1110,7 +1114,7 @@ const initSession = (clientApp, supportedLoginTypes, onUserLogin, onLoginError,
|
|
|
1110
1114
|
}
|
|
1111
1115
|
const ssoToken = extractTokenFromWindowLocation('code');
|
|
1112
1116
|
if (ssoToken) {
|
|
1113
|
-
validateSSOToken(ssoToken,
|
|
1117
|
+
validateSSOToken(ssoToken, getSSORedirectURI(), (res) => onAuthentication(onUserLogin, res, 'SSO Authentication'), (_res) => onAuthenticationFailure('login-failed'), (res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1114
1118
|
const jsonResponse = yield res.json();
|
|
1115
1119
|
const unauthorizedEmail = jsonResponse.email;
|
|
1116
1120
|
const onReturn = () => handleSSOLogin();
|