Skip to content

Commit

Permalink
Merge branch 'master' into STCOR-912
Browse files Browse the repository at this point in the history
  • Loading branch information
zburke authored Dec 2, 2024
2 parents ad35a73 + 1189bd5 commit a3dd57a
Show file tree
Hide file tree
Showing 37 changed files with 137 additions and 45 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Provide `<IfAnyPermission>` and `stripes.hasAnyPermission()`. Refs STCOR-910.
* Use the `users-keycloak/_self` endpoint conditionally when the `users-keycloak` interface is present; otherwise, use `bl-users/_self` within `useUserTenantPermissions`. Refs STCOR-905.
* Don't override initial discovery and okapi data in test mocks. Refs STCOR-913.
* `<Logout>` must consume `QueryClient` in order to supply it to `loginServices::logout()`. Refs STCOR-907.
* On resuming session, spread session and `_self` together to preserve session values. Refs STCOR-912.

## [10.2.0](https://github.com/folio-org/stripes-core/tree/v10.2.0) (2024-10-11)
Expand Down
4 changes: 3 additions & 1 deletion src/components/Logout/Logout.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useEffect, useState } from 'react';
import { useLocation } from 'react-router';
import { FormattedMessage } from 'react-intl';
import { useQueryClient } from 'react-query';
import { branding } from 'stripes-config';

import {
Expand Down Expand Up @@ -35,14 +36,15 @@ const Logout = () => {
const stripes = useStripes();
const [didLogout, setDidLogout] = useState(false);
const location = useLocation();
const queryClient = useQueryClient();

const messageId = location.pathName === '/logout-timeout' ? 'stripes-core.rtr.idleSession.sessionExpiredSoSad' : 'stripes-core.logoutComplete';

useEffect(
() => {
if (stripes.okapi.isAuthenticated) {
// returns a promise, which we ignore
logout(stripes.okapi.url, stripes.store)
logout(stripes.okapi.url, stripes.store, queryClient)
.then(setDidLogout(true));
} else {
setDidLogout(true);
Expand Down
1 change: 1 addition & 0 deletions src/components/Logout/Logout.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { getUnauthorizedPathFromSession, logout, setUnauthorizedPathToSession }
jest.mock('../OrganizationLogo');
jest.mock('../../StripesContext');
jest.mock('react-router');
jest.mock('react-query');

jest.mock('../../loginServices', () => ({
...jest.requireActual('../../loginServices'),
Expand Down
4 changes: 3 additions & 1 deletion src/loginServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,9 @@ export async function logout(okapiUrl, store, queryClient) {
store.dispatch(resetStore());

// clear react-query cache
queryClient.removeQueries();
if (queryClient) {
queryClient.removeQueries();
}
})
// clear shared storage
.then(localforage.removeItem(SESSION_NAME))
Expand Down
25 changes: 25 additions & 0 deletions src/loginServices.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,31 @@ describe('logout', () => {
expect(global.fetch).not.toHaveBeenCalled();
});
});

describe('react-query client', () => {
afterEach(() => {
mockFetchCleanUp();
});

it('calls removeQueries given valid client', async () => {
global.fetch = jest.fn().mockImplementation(() => Promise.resolve());
const store = {
dispatch: jest.fn(),
};
const rqc = {
removeQueries: jest.fn(),
};

let res;
await logout('', store, rqc)
.then(() => {
res = true;
});

expect(res).toBe(true);
expect(rqc.removeQueries).toHaveBeenCalled();
});
});
});

describe('getLocale', () => {
Expand Down
4 changes: 3 additions & 1 deletion translations/stripes-core/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/ber.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/cs_CZ.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Vybrat nájemce/knihovnu",
"tenantLibrary": "Nájemce/Knihovna",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Vaše relace brzy skončí! Zbývající čas:"
"rtr.fixedLengthSession.timeRemaining": "Vaše relace brzy skončí! Zbývající čas:",
"logoutComplete": "Odhlásili jste se.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
6 changes: 4 additions & 2 deletions translations/stripes-core/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"mainnav.topLevelLabel": "Primär",
"mainnav.applicationListLabel": "App-Liste",
"errors.default.error": "Leider stimmen die Angaben nicht mit unserem Datenbestand überein.",
"errors.username.incorrect": "Dieses FOLIO-Konto kann nicht gefunden werden. Bitte wenden Sie sich an Ihre Folio-Systemadministration.",
"errors.username.incorrect": "Dieses FOLIO-Konto kann nicht gefunden werden. Bitte wenden Sie sich an Ihre FOLIO-Systemadministration.",
"errors.password.incorrect": "Anmeldeinformationen stimmen nicht",
"errors.user.blocked": "Aus Sicherheitsgründen wurde Ihr Konto gesperrt. Bitte versuchen Sie es erneut oder wenden Sie sich an Ihre FOLIO-Systemadministration.",
"errors.password.match.error": "Passwort stimmt nicht überein. Passwort erneut eingeben.",
Expand Down Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/en_GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
20 changes: 11 additions & 9 deletions translations/stripes-core/en_SE.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"front.welcome": "Välkommen till FOLIO!",
"front.home": "Start",
"front.welcome": "Welcome, the Future Of Libraries Is OPEN!",
"front.home": "Home",
"front.about": "Software versions",
"button.new": "+ Ny",
"button.new_tooltip": "Lägg till {entry}",
"button.edit": "Redigera",
"button.delete": "Radera",
"button.deleteEntry": "Radera {entry}",
"button.saveAndClose": "Spara och stäng",
"button.new": "+ New",
"button.new_tooltip": "Add {entry}",
"button.edit": "Edit",
"button.delete": "Delete",
"button.deleteEntry": "Delete {entry}",
"button.saveAndClose": "Save and close",
"button.cancel": "Cancel",
"label.confirmDeleteEntry": "<strong>{name}</strong> will be <strong>removed</strong>",
"label.editEntry": "Edit {entry}",
Expand Down Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
3 changes: 1 addition & 2 deletions translations/stripes-core/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,4 @@
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."

}
}
4 changes: 3 additions & 1 deletion translations/stripes-core/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/es_419.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/es_ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/fr_FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "Vous vous êtes déconnecté.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/hi_IN.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/it_IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "セッションはまもなく終了します。残時間:"
"rtr.fixedLengthSession.timeRemaining": "セッションはまもなく終了します。残時間:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/nb.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/nn.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Selecione seu locatário/biblioteca",
"tenantLibrary": "Locatário/Biblioteca",
"errors.saml.missingToken": "Nenhum parâmetro de consulta <code>code</code> .",
"rtr.fixedLengthSession.timeRemaining": "Sua sessão terminará em breve! Tempo restante:"
"rtr.fixedLengthSession.timeRemaining": "Sua sessão terminará em breve! Tempo restante:",
"logoutComplete": "Você efetuou logout.",
"errors.oidc": "Erro: o servidor está proibido, inacessível ou indisponível."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/pt_PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
4 changes: 3 additions & 1 deletion translations/stripes-core/sk.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@
"tenantChoose": "Select your tenant/library",
"tenantLibrary": "Tenant/Library",
"errors.saml.missingToken": "No <code>code</code> query parameter.",
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:"
"rtr.fixedLengthSession.timeRemaining": "Your session will end soon! Time remaining:",
"logoutComplete": "You have logged out.",
"errors.oidc": "Error: server is forbidden, unreachable, or unavailable."
}
Loading

0 comments on commit a3dd57a

Please sign in to comment.