@klauswuestefeld/jux-web 2024.12.17 → 2025.2.11

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 CHANGED
@@ -14517,11 +14517,13 @@ var juxWeb = (function (exports) {
14517
14517
  // setSuperToken();
14518
14518
  onUserLogin();
14519
14519
  };
14520
- const clearSession = () => {
14520
+ const clearSession = (itemsToSave) => {
14521
14521
  // onUserChanged(null);
14522
14522
  // TODO: find a better way to preserve backend-url
14523
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) }));
14524
14525
  localStorage.clear();
14526
+ savedItems === null || savedItems === void 0 ? void 0 : savedItems.forEach((item) => localStorage.setItem(item.key, item.value));
14525
14527
  setBackendUrl(backendUrl);
14526
14528
  // @ts-ignore
14527
14529
  window.store = {};
@@ -14951,6 +14953,7 @@ var juxWeb = (function (exports) {
14951
14953
  };
14952
14954
 
14953
14955
  exports.chosenLanguage = chosenLanguage;
14956
+ exports.clearSession = clearSession;
14954
14957
  exports.command = command;
14955
14958
  exports.getTranslation = getTranslation;
14956
14959
  exports.handleJuxEvent = handleJuxEvent;
@@ -1,5 +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: (itemsToSave?: string[]) => void;
3
4
  export declare const initSession: (clientApp: HTMLElement, supportedLoginTypes: string[], onUserLogin: any, onLoginError: any, backgroundImage: string, fetchUserBackendUrl: any, magicLinkRequestEndpoint: string | null, magicLinkAuthEndpoint: string | null) => void;
4
5
  export declare const onMicrosoftSignIn: (onUserLogin: any) => Promise<void>;
5
6
  export declare const onGoogleSignIn: (onUserLogin: any) => void;
package/dist/main.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { chosenLanguage, reloadWithLanguageOverride, initLanguage, getTranslation } from './jux/language';
2
2
  export { loginButton } from './login/login-button';
3
3
  export { loginPage } from './login/login-page';
4
- export { handleMagicLinkRequest, initSession, onMicrosoftSignIn } from './login/session';
4
+ export { handleMagicLinkRequest, initSession, onMicrosoftSignIn, clearSession } from './login/session';
5
5
  export { handleJuxEvent, requestMagicLink } from './api-client';
6
6
  export { magicLinkModal } from './login/magic-link-modal';
7
7
  export { command, query } from './jux/jux-event';
package/dist/main.esm.js CHANGED
@@ -1002,11 +1002,13 @@ const onTokenAcquired = (token, onUserLogin) => {
1002
1002
  // setSuperToken();
1003
1003
  onUserLogin();
1004
1004
  };
1005
- const clearSession = () => {
1005
+ const clearSession = (itemsToSave) => {
1006
1006
  // onUserChanged(null);
1007
1007
  // TODO: find a better way to preserve backend-url
1008
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) }));
1009
1010
  localStorage.clear();
1011
+ savedItems === null || savedItems === void 0 ? void 0 : savedItems.forEach((item) => localStorage.setItem(item.key, item.value));
1010
1012
  setBackendUrl(backendUrl);
1011
1013
  // @ts-ignore
1012
1014
  window.store = {};
@@ -1435,4 +1437,4 @@ const command = (element, endpoint, onResult, params, onError, onRedirect) => {
1435
1437
  element.dispatchEvent(new JuxEvent('command', 'POST', endpoint, onResult, params, onError, onRedirect));
1436
1438
  };
1437
1439
 
1438
- export { chosenLanguage, command, getTranslation, handleJuxEvent, handleMagicLinkRequest, initLanguage, initSession, loginButton, loginPage, magicLinkModal, onMicrosoftSignIn, query, reloadWithLanguageOverride, requestMagicLink };
1440
+ export { chosenLanguage, clearSession, command, getTranslation, handleJuxEvent, handleMagicLinkRequest, initLanguage, initSession, loginButton, loginPage, magicLinkModal, onMicrosoftSignIn, query, reloadWithLanguageOverride, requestMagicLink };
package/dist/main.js CHANGED
@@ -1026,11 +1026,13 @@ const onTokenAcquired = (token, onUserLogin) => {
1026
1026
  // setSuperToken();
1027
1027
  onUserLogin();
1028
1028
  };
1029
- const clearSession = () => {
1029
+ const clearSession = (itemsToSave) => {
1030
1030
  // onUserChanged(null);
1031
1031
  // TODO: find a better way to preserve backend-url
1032
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) }));
1033
1034
  localStorage.clear();
1035
+ savedItems === null || savedItems === void 0 ? void 0 : savedItems.forEach((item) => localStorage.setItem(item.key, item.value));
1034
1036
  setBackendUrl(backendUrl);
1035
1037
  // @ts-ignore
1036
1038
  window.store = {};
@@ -1460,6 +1462,7 @@ const command = (element, endpoint, onResult, params, onError, onRedirect) => {
1460
1462
  };
1461
1463
 
1462
1464
  exports.chosenLanguage = chosenLanguage;
1465
+ exports.clearSession = clearSession;
1463
1466
  exports.command = command;
1464
1467
  exports.getTranslation = getTranslation;
1465
1468
  exports.handleJuxEvent = handleJuxEvent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klauswuestefeld/jux-web",
3
- "version": "2024.12.17",
3
+ "version": "2025.02.11",
4
4
  "author": "Jux.House",
5
5
  "license": "Copyrighted",
6
6
  "description": "",