From d6ae5053171cc14d0293db515168b0e6b902e258 Mon Sep 17 00:00:00 2001 From: Kasper Birch Date: Wed, 8 Nov 2023 14:51:20 +0100 Subject: [PATCH 01/10] Move logic for display `MaterialButtonReservableFromAnotherLibrary` If the material only can be reserved on another library, we don't want to show other buttons like `MaterialButtonFindOnShelf` --- .../material-buttons/MaterialButtons.tsx | 21 ++++++++++++++++++- .../physical/MaterialButtonsPhysical.tsx | 16 +------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/components/material/material-buttons/MaterialButtons.tsx b/src/components/material/material-buttons/MaterialButtons.tsx index 2e4ca08645..ceef3e5ffc 100644 --- a/src/components/material/material-buttons/MaterialButtons.tsx +++ b/src/components/material/material-buttons/MaterialButtons.tsx @@ -1,7 +1,11 @@ import * as React from "react"; import { FC } from "react"; import { AccessTypeCode } from "../../../core/dbc-gateway/generated/graphql"; -import { getAllFaustIds } from "../../../core/utils/helpers/general"; +import { + getAllFaustIds, + getManifestationType, + getReservablePidsFromAnotherLibrary +} from "../../../core/utils/helpers/general"; import { ButtonSize } from "../../../core/utils/types/button"; import { Manifestation } from "../../../core/utils/types/entities"; import { hasCorrectAccess, hasCorrectAccessType, isArticle } from "./helper"; @@ -9,6 +13,7 @@ import { WorkId } from "../../../core/utils/types/ids"; import MaterialButtonsOnline from "./online/MaterialButtonsOnline"; import MaterialButtonsFindOnShelf from "./physical/MaterialButtonsFindOnShelf"; import MaterialButtonsPhysical from "./physical/MaterialButtonsPhysical"; +import MaterialButtonReservableFromAnotherLibrary from "./physical/MaterialButtonReservableFromAnotherLibrary"; export interface MaterialButtonsProps { manifestations: Manifestation[]; @@ -29,6 +34,20 @@ const MaterialButtons: FC = ({ // We don't want to show physical buttons/find on shelf for articles because // articles appear as a part of journal/periodical publications and can't be // physically loaned for themseleves. + + const isReservableFromAnotherLibrary = + getReservablePidsFromAnotherLibrary(manifestations).length > 0; + + if (isReservableFromAnotherLibrary) { + return ( + + ); + } + return ( <> {hasCorrectAccessType(AccessTypeCode.Physical, manifestations) && diff --git a/src/components/material/material-buttons/physical/MaterialButtonsPhysical.tsx b/src/components/material/material-buttons/physical/MaterialButtonsPhysical.tsx index f673ca2f6b..bdfec68f0f 100644 --- a/src/components/material/material-buttons/physical/MaterialButtonsPhysical.tsx +++ b/src/components/material/material-buttons/physical/MaterialButtonsPhysical.tsx @@ -1,8 +1,7 @@ import React from "react"; import { getAllFaustIds, - getManifestationType, - getReservablePidsFromAnotherLibrary + getManifestationType } from "../../../../core/utils/helpers/general"; import { isBlocked, usePatronData } from "../../../../core/utils/helpers/user"; import { ButtonSize } from "../../../../core/utils/types/button"; @@ -13,7 +12,6 @@ import MaterialButtonReservePhysical from "./MaterialButtonPhysical"; import MaterialButtonLoading from "../generic/MaterialButtonLoading"; import MaterialButtonDisabled from "../generic/MaterialButtonDisabled"; import { useText } from "../../../../core/utils/text"; -import MaterialButtonReservableFromAnotherLibrary from "./MaterialButtonReservableFromAnotherLibrary"; export interface MaterialButtonsPhysicalProps { manifestations: Manifestation[]; @@ -26,8 +24,6 @@ const MaterialButtonsPhysical: React.FC = ({ size, dataCy = "material-buttons-physical" }) => { - const isReservableFromAnotherLibrary = - getReservablePidsFromAnotherLibrary(manifestations); const t = useText(); const faustIds = getAllFaustIds(manifestations); const { reservableManifestations } = UseReservableManifestations({ @@ -48,16 +44,6 @@ const MaterialButtonsPhysical: React.FC = ({ return ; } - if (isReservableFromAnotherLibrary.length > 0) { - return ( - - ); - } - // We show the reservation button if the user isn't logged in or isn't blocked. // In the former case there there's no way to see if they're blocked, so we // redirect anonymous user to the login page. From e741c5eb2e2a79922d0237716a406d85719fe1d0 Mon Sep 17 00:00:00 2001 From: Kasper Birch Date: Mon, 20 Nov 2023 09:58:35 +0100 Subject: [PATCH 02/10] Refactor `getReservablePidsFromAnotherLibrary` to `useReservableFromAnotherLibrary` hook Added validation with FBS to verify manifestation's reservable status (must be false) for Overbygningsmaterial/OpenOrder reservations. in addition, I have removed out the tests that were for `getReservablePidsFromAnotherLibrary` as they must be rewritten for the new hook --- .../material-buttons/MaterialButtons.tsx | 10 +-- .../reservation/ReservationModalBody.tsx | 24 +++--- src/core/utils/helpers/general.ts | 74 ------------------- .../utils/useReservableFromAnotherLibrary.tsx | 28 +++++++ 4 files changed, 45 insertions(+), 91 deletions(-) create mode 100644 src/core/utils/useReservableFromAnotherLibrary.tsx diff --git a/src/components/material/material-buttons/MaterialButtons.tsx b/src/components/material/material-buttons/MaterialButtons.tsx index ceef3e5ffc..9b1b7e1055 100644 --- a/src/components/material/material-buttons/MaterialButtons.tsx +++ b/src/components/material/material-buttons/MaterialButtons.tsx @@ -3,8 +3,7 @@ import { FC } from "react"; import { AccessTypeCode } from "../../../core/dbc-gateway/generated/graphql"; import { getAllFaustIds, - getManifestationType, - getReservablePidsFromAnotherLibrary + getManifestationType } from "../../../core/utils/helpers/general"; import { ButtonSize } from "../../../core/utils/types/button"; import { Manifestation } from "../../../core/utils/types/entities"; @@ -14,6 +13,7 @@ import MaterialButtonsOnline from "./online/MaterialButtonsOnline"; import MaterialButtonsFindOnShelf from "./physical/MaterialButtonsFindOnShelf"; import MaterialButtonsPhysical from "./physical/MaterialButtonsPhysical"; import MaterialButtonReservableFromAnotherLibrary from "./physical/MaterialButtonReservableFromAnotherLibrary"; +import useReservableFromAnotherLibrary from "../../../core/utils/useReservableFromAnotherLibrary"; export interface MaterialButtonsProps { manifestations: Manifestation[]; @@ -35,10 +35,10 @@ const MaterialButtons: FC = ({ // articles appear as a part of journal/periodical publications and can't be // physically loaned for themseleves. - const isReservableFromAnotherLibrary = - getReservablePidsFromAnotherLibrary(manifestations).length > 0; + const { reservablePidsFromAnotherLibrary } = + useReservableFromAnotherLibrary(manifestations); - if (isReservableFromAnotherLibrary) { + if (reservablePidsFromAnotherLibrary.length > 0) { return ( { if (!manifestationsToReserve || manifestationsToReserve.length < 1) { return; } - if (pidsFromAnotherLibrary.length > 0 && patron) { + if (reservablePidsFromAnotherLibrary.length > 0 && patron) { const { patronId, name, emailAddress, preferredPickupBranch } = patron; mutateOpenOrder( { input: { - pids: [...pidsFromAnotherLibrary], + pids: [...reservablePidsFromAnotherLibrary], pickUpBranch: selectedBranch ? removePrefixFromBranchId(selectedBranch) : removePrefixFromBranchId(preferredPickupBranch), diff --git a/src/core/utils/helpers/general.ts b/src/core/utils/helpers/general.ts index 0ca3b14850..1dbc9b8799 100644 --- a/src/core/utils/helpers/general.ts +++ b/src/core/utils/helpers/general.ts @@ -500,86 +500,12 @@ export const getContributors = (short: boolean, creators: string[]) => { return creators[0]; }; -export const getReservablePidsFromAnotherLibrary = ( - manifestations: Manifestation[] -) => { - const matchingManifestations = manifestations.filter(({ catalogueCodes }) => - catalogueCodes?.otherCatalogues.some((code) => code.startsWith("OVE")) - ); - - return matchingManifestations.map(({ pid }) => pid); -}; - export default {}; /* ********************************* Vitest Section ********************************* */ if (import.meta.vitest) { const { describe, expect, it } = import.meta.vitest; - describe("getReservablePidsFromAnotherLibrary", () => { - it("should return true for isReservable and correct pids if manifestations are reservable on another library (catalogueCodes starts with 'OVE')", () => { - const result = getReservablePidsFromAnotherLibrary([ - { - pid: "870970-basis:135721719", - catalogueCodes: { - otherCatalogues: ["OVE123"], - nationalBibliography: ["ABE123"] - } - }, - { - pid: "870970-basis:135721719", - catalogueCodes: { - otherCatalogues: ["OVE124"], - nationalBibliography: ["ABE456"] - } - } - ] as unknown as Manifestation[]); - - expect(result.length > 0).toBe(true); - expect(result).toEqual([ - "870970-basis:135721719", - "870970-basis:135721719" - ]); - }); - - it("should return false for isReservable and empty pids array if no manifestations are reservable on another library", () => { - const result = getReservablePidsFromAnotherLibrary([ - { - pid: "pid1", - catalogueCodes: { - otherCatalogues: ["ABE789"], - nationalBibliography: ["ABE123"] - } - } - ] as unknown as Manifestation[]); - - expect(result.length > 0).toBe(false); - expect(result).toEqual([]); - }); - - it("should filter out non-reservable manifestations and return only reservable pids", () => { - const result = getReservablePidsFromAnotherLibrary([ - { - pid: "870970-basis:135721719", - catalogueCodes: { - otherCatalogues: ["OVE123"], - nationalBibliography: ["ABE123"] - } - }, - { - pid: "870970-basis:111111111", - catalogueCodes: { - otherCatalogues: ["ABE789"], - nationalBibliography: ["ABE456"] - } - } - ] as unknown as Manifestation[]); - - expect(result.length > 0).toBe(true); - expect(result).toEqual(["870970-basis:135721719"]); - }); - }); - describe("getMaterialTypes", () => { const manifestations = [ { diff --git a/src/core/utils/useReservableFromAnotherLibrary.tsx b/src/core/utils/useReservableFromAnotherLibrary.tsx new file mode 100644 index 0000000000..ab6a154d5d --- /dev/null +++ b/src/core/utils/useReservableFromAnotherLibrary.tsx @@ -0,0 +1,28 @@ +import { useConfig } from "./config"; +import { getAllFaustIds } from "./helpers/general"; +import { useGetHoldings } from "../../apps/material/helper"; +import { Manifestation } from "./types/entities"; + +const useReservableFromAnotherLibrary = (manifestations: Manifestation[]) => { + const config = useConfig(); + const { data: holdingsData } = useGetHoldings({ + faustIds: getAllFaustIds(manifestations), + config + }); + + // If there is no holdings data or if there are holdings that are reservable, we return an empty array. + // Because we use the array length to determine if we should show the button or not. + if (holdingsData?.some(({ reservable }) => reservable === true)) { + return { reservablePidsFromAnotherLibrary: [] }; + } + + const reservablePidsFromAnotherLibrary = manifestations + .filter(({ catalogueCodes }) => + catalogueCodes?.otherCatalogues.some((code) => code.startsWith("OVE")) + ) + .map(({ pid }) => pid); + + return { reservablePidsFromAnotherLibrary }; +}; + +export default useReservableFromAnotherLibrary; From 6b6218506ef5ba61efd35bcc1953eea45fd6bb57 Mon Sep 17 00:00:00 2001 From: Kasper Birch Date: Thu, 21 Dec 2023 13:59:34 +0100 Subject: [PATCH 03/10] Add correct ID to material story `overbygningsMateriale` Following the update from DBC, we now have a material that meets all requirements to activate the `MaterialButtonReservableFromAnotherLibrary` (openOrder) button. --- src/apps/material/material.dev.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/material/material.dev.tsx b/src/apps/material/material.dev.tsx index 85dd317487..ecd6874a2d 100644 --- a/src/apps/material/material.dev.tsx +++ b/src/apps/material/material.dev.tsx @@ -975,5 +975,5 @@ Underverden.args = { export const overbygningsMatriale = Template.bind({}); overbygningsMatriale.args = { - wid: "work-of:870970-basis:135721719" + wid: "work-of:870970-basis:44926407" }; From 862f61f7e6f422768e8d9a67bfddc45a4107e9af Mon Sep 17 00:00:00 2001 From: Kasper Birch Date: Thu, 21 Dec 2023 15:03:07 +0100 Subject: [PATCH 04/10] Refactor `useReservableFromAnotherLibrary` + Add Test Simplified return value to directly return the array, eliminating the need for an intermediate object. --- .../material-buttons/MaterialButtons.tsx | 2 +- .../reservation/ReservationModalBody.tsx | 2 +- .../utils/useReservableFromAnotherLibrary.tsx | 11 +- .../useReservableFromAnotherLibrary.test.tsx | 109 ++++++++++++++++++ 4 files changed, 117 insertions(+), 7 deletions(-) create mode 100644 src/tests/unit/useReservableFromAnotherLibrary.test.tsx diff --git a/src/components/material/material-buttons/MaterialButtons.tsx b/src/components/material/material-buttons/MaterialButtons.tsx index 9b1b7e1055..1773040a14 100644 --- a/src/components/material/material-buttons/MaterialButtons.tsx +++ b/src/components/material/material-buttons/MaterialButtons.tsx @@ -35,7 +35,7 @@ const MaterialButtons: FC = ({ // articles appear as a part of journal/periodical publications and can't be // physically loaned for themseleves. - const { reservablePidsFromAnotherLibrary } = + const reservablePidsFromAnotherLibrary = useReservableFromAnotherLibrary(manifestations); if (reservablePidsFromAnotherLibrary.length > 0) { diff --git a/src/components/reservation/ReservationModalBody.tsx b/src/components/reservation/ReservationModalBody.tsx index 14c42e32f3..5218022235 100644 --- a/src/components/reservation/ReservationModalBody.tsx +++ b/src/components/reservation/ReservationModalBody.tsx @@ -128,7 +128,7 @@ export const ReservationModalBody = ({ !!selectedPeriodical ); - const { reservablePidsFromAnotherLibrary } = useReservableFromAnotherLibrary( + const reservablePidsFromAnotherLibrary = useReservableFromAnotherLibrary( manifestationsToReserve ); diff --git a/src/core/utils/useReservableFromAnotherLibrary.tsx b/src/core/utils/useReservableFromAnotherLibrary.tsx index ab6a154d5d..a418eadbb3 100644 --- a/src/core/utils/useReservableFromAnotherLibrary.tsx +++ b/src/core/utils/useReservableFromAnotherLibrary.tsx @@ -2,8 +2,11 @@ import { useConfig } from "./config"; import { getAllFaustIds } from "./helpers/general"; import { useGetHoldings } from "../../apps/material/helper"; import { Manifestation } from "./types/entities"; +import { Pid } from "./types/ids"; -const useReservableFromAnotherLibrary = (manifestations: Manifestation[]) => { +const useReservableFromAnotherLibrary = ( + manifestations: Manifestation[] +): Pid[] => { const config = useConfig(); const { data: holdingsData } = useGetHoldings({ faustIds: getAllFaustIds(manifestations), @@ -13,16 +16,14 @@ const useReservableFromAnotherLibrary = (manifestations: Manifestation[]) => { // If there is no holdings data or if there are holdings that are reservable, we return an empty array. // Because we use the array length to determine if we should show the button or not. if (holdingsData?.some(({ reservable }) => reservable === true)) { - return { reservablePidsFromAnotherLibrary: [] }; + return []; } - const reservablePidsFromAnotherLibrary = manifestations + return manifestations .filter(({ catalogueCodes }) => catalogueCodes?.otherCatalogues.some((code) => code.startsWith("OVE")) ) .map(({ pid }) => pid); - - return { reservablePidsFromAnotherLibrary }; }; export default useReservableFromAnotherLibrary; diff --git a/src/tests/unit/useReservableFromAnotherLibrary.test.tsx b/src/tests/unit/useReservableFromAnotherLibrary.test.tsx new file mode 100644 index 0000000000..d3bbe9036f --- /dev/null +++ b/src/tests/unit/useReservableFromAnotherLibrary.test.tsx @@ -0,0 +1,109 @@ +import { describe, expect, it, vi, beforeAll } from "vitest"; +import { combineReducers, configureStore } from "@reduxjs/toolkit"; +import { Provider } from "react-redux"; +import React, { ReactElement } from "react"; +import { renderHook } from "@testing-library/react-hooks"; +import { act } from "react-dom/test-utils"; +import { QueryClient, QueryClientProvider } from "react-query"; +import useReservableFromAnotherLibrary from "../../core/utils/useReservableFromAnotherLibrary"; +import { Manifestation } from "../../core/utils/types/entities"; +import configReducer from "../../core/config.slice"; +import { useGetHoldings } from "../../apps/material/helper"; + +const queryClient = new QueryClient(); + +const store = configureStore({ + reducer: combineReducers({ + config: configReducer + }), + preloadedState: { + config: { + data: { + blacklistedPickupBranchesConfig: "" + } + } + } +}); + +const mockedManifestations = [ + { + pid: "870970-basis:27721257", + catalogueCodes: { + otherCatalogues: ["OVE123"] + } + } +] as unknown as Manifestation[]; + +const Wrapper = ({ children }: { children: ReactElement }) => ( + + {children} + +); + +describe("useReservableFromAnotherLibrary", () => { + beforeAll(() => { + vi.mock("../../apps/material/helper", () => ({ + useGetHoldings: vi.fn() + })); + }); + + it("should return reservable pids from another library", async () => { + // Typescript does not understand our mocked hook. + // So we gracefully ignore the error :). + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore-next-line + useGetHoldings.mockReturnValue({ + data: [ + { + recordId: "52643414", + reservable: false, // This is the key to the test + reservations: 0, + holdings: [] + } + ], + isLoading: false, + isError: false + }); + + const { result } = renderHook( + () => useReservableFromAnotherLibrary(mockedManifestations), + { + wrapper: Wrapper + } + ); + + act(() => { + expect(result.current).toEqual(["870970-basis:27721257"]); + }); + }); + + it("should return an empty array if useGetHoldings does return reservable items", async () => { + // Typescript does not understand our mocked hook. + // So we gracefully ignore the error :). + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore-next-line + useGetHoldings.mockReturnValue({ + data: [ + { + recordId: "52643414", + reservable: true, // This is the key to the test + reservations: 0, + holdings: [] + } + ], + isLoading: false, + isError: false + }); + + const { result } = renderHook( + () => useReservableFromAnotherLibrary(mockedManifestations), + { + wrapper: Wrapper + } + ); + + act(() => { + expect(result.current).toEqual([]); + }); + }); +}); From f41d7d94de34df29b723bda9b2525750e0ba3d28 Mon Sep 17 00:00:00 2001 From: Kasper Birch Date: Fri, 22 Dec 2023 12:00:50 +0100 Subject: [PATCH 05/10] Refactor `saveReservation` (openOrder) Due to the `UseReservableManifestations` hook validating whether a manifestation is reservable, we cannot use the `reservableManifestations` variable it returns in the new `useReservableFromAnotherLibrary` hook. Therefore, I have used the `selectedManifestations` variable within `useReservableFromAnotherLibrary`. Additionally, I have implemented minor changes within `saveReservation`. Specifically, I removed the guard check for an early return. Now, it directly checks for the required criteria to determine whether to use `mutateAddReservations` or `mutateOpenOrder`. --- .../reservation/ReservationModalBody.tsx | 62 +++++++++---------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/src/components/reservation/ReservationModalBody.tsx b/src/components/reservation/ReservationModalBody.tsx index 5218022235..5b2db7aff1 100644 --- a/src/components/reservation/ReservationModalBody.tsx +++ b/src/components/reservation/ReservationModalBody.tsx @@ -129,7 +129,7 @@ export const ReservationModalBody = ({ ); const reservablePidsFromAnotherLibrary = useReservableFromAnotherLibrary( - manifestationsToReserve + selectedManifestations ); // If we don't have all data for displaying the view render nothing. @@ -149,13 +149,37 @@ export const ReservationModalBody = ({ : null; const saveReservation = () => { - if (!manifestationsToReserve || manifestationsToReserve.length < 1) { - return; + if (manifestationsToReserve?.length) { + // Save reservation to FBS. + mutateAddReservations( + { + data: constructReservationData({ + manifestations: manifestationsToReserve, + selectedBranch, + expiryDate, + periodical: selectedPeriodical + }) + }, + { + onSuccess: (res) => { + // Track only if the reservation has been successfully saved. + track("click", { + id: statistics.reservation.id, + name: statistics.reservation.name, + trackedData: work.workId + }); + // This state is used to show the success or error modal. + setReservationResponse(res); + // Because after a successful reservation the holdings (reservations) are updated. + queryClient.invalidateQueries(getGetHoldingsV3QueryKey()); + } + } + ); } - if (reservablePidsFromAnotherLibrary.length > 0 && patron) { + if (reservablePidsFromAnotherLibrary?.length && patron) { const { patronId, name, emailAddress, preferredPickupBranch } = patron; - + // Save reservation to open order. mutateOpenOrder( { input: { @@ -179,35 +203,7 @@ export const ReservationModalBody = ({ } } ); - - return; } - - // Save reservation to FBS. - mutateAddReservations( - { - data: constructReservationData({ - manifestations: manifestationsToReserve, - selectedBranch, - expiryDate, - periodical: selectedPeriodical - }) - }, - { - onSuccess: (res) => { - // Track only if the reservation has been successfully saved. - track("click", { - id: statistics.reservation.id, - name: statistics.reservation.name, - trackedData: work.workId - }); - // This state is used to show the success or error modal. - setReservationResponse(res); - // Because after a successful reservation the holdings (reservations) are updated. - queryClient.invalidateQueries(getGetHoldingsV3QueryKey()); - } - } - ); }; const reservationSuccess = reservationResponse?.success || false; From 93f13ceacfb4a5a771e275637104896562f42d58 Mon Sep 17 00:00:00 2001 From: Kasper Birch Date: Wed, 27 Dec 2023 10:08:39 +0100 Subject: [PATCH 06/10] Update fbi-api.json fixtures for `open-order.test` Replace fixture with a material requiring reservation via openOrder (overbygningsmateriale). --- .../fixtures/material/open-order/fbi-api.json | 115 +++++++++--------- 1 file changed, 59 insertions(+), 56 deletions(-) diff --git a/cypress/fixtures/material/open-order/fbi-api.json b/cypress/fixtures/material/open-order/fbi-api.json index f20b7de75e..ff277f9ec0 100644 --- a/cypress/fixtures/material/open-order/fbi-api.json +++ b/cypress/fixtures/material/open-order/fbi-api.json @@ -1,31 +1,31 @@ { "data": { "work": { - "workId": "work-of:870970-basis:135721719", + "workId": "work-of:870970-basis:44926407", "titles": { "full": [ - "Restyle & restitch for little ones : 30 simple projects from preloved clothes" + "Duchess of Death : the unauthorized biography of Agatha Christie" ], "original": [] }, "abstract": [ - "30 sewing projects for creating stylish baby clothes, from newborns to two-year-olds, including trousers, dresses, sweaters, mittens, rompers and socks. The projects are accompanied by colourful, full-size patterns to help you make the most of your repurposed clothing." + "Summary: Utilizing over 5,000 previously unpublished letters, notes, and documents, the author tells how Christie's life was \"as full of romance, travel, wealth, and scandal as any mystery Christie ever crafted.\" -- from publisher description." ], "creators": [ { - "display": "Linnea Larsson", + "display": "Richard Hack", "__typename": "Person" } ], "series": [], "seriesMembers": [], "workYear": null, - "genreAndForm": ["snitmønstre", "vejledninger"], + "genreAndForm": ["biografier", "bibliografier"], "manifestations": { "all": [ { - "pid": "870970-basis:135721719", - "genreAndForm": ["snitmønstre", "vejledninger"], + "pid": "870970-basis:44926407", + "genreAndForm": ["biografier"], "source": ["Bibliotekskatalog"], "languages": { "main": [ @@ -36,7 +36,7 @@ ] }, "titles": { - "main": ["Restyle & restitch for little ones"], + "main": ["Duchess of Death"], "original": [] }, "fictionNonfiction": { @@ -50,21 +50,21 @@ ], "creators": [ { - "display": "Linnea Larsson", + "display": "Richard Hack", "__typename": "Person" } ], - "publisher": ["Search"], + "publisher": ["JR Books"], "identifiers": [ { - "value": "9781800921191" + "value": "9781906779832" } ], "contributors": [], "edition": { - "summary": "2023", + "summary": "1. edition, 2010", "publicationYear": { - "display": "2023" + "display": "2010" } }, "dateFirstEdition": null, @@ -73,7 +73,7 @@ }, "physicalDescriptions": [ { - "numberOfPages": 124, + "numberOfPages": 325, "playingTime": null } ], @@ -89,19 +89,19 @@ } ], "shelfmark": { - "postfix": "Larsson", - "shelfmark": "64.62" + "postfix": "Hack", + "shelfmark": "99.4 Christie, Agatha" }, "workYear": null, "catalogueCodes": { "nationalBibliography": [], - "otherCatalogues": ["OVE202314"] + "otherCatalogues": ["OVE999999"] } } ], "latest": { - "pid": "870970-basis:135721719", - "genreAndForm": ["snitmønstre", "vejledninger"], + "pid": "870970-basis:44926407", + "genreAndForm": ["biografier"], "source": ["Bibliotekskatalog"], "languages": { "main": [ @@ -112,7 +112,7 @@ ] }, "titles": { - "main": ["Restyle & restitch for little ones"], + "main": ["Duchess of Death"], "original": [] }, "fictionNonfiction": { @@ -126,21 +126,21 @@ ], "creators": [ { - "display": "Linnea Larsson", + "display": "Richard Hack", "__typename": "Person" } ], - "publisher": ["Search"], + "publisher": ["JR Books"], "identifiers": [ { - "value": "9781800921191" + "value": "9781906779832" } ], "contributors": [], "edition": { - "summary": "2023", + "summary": "1. edition, 2010", "publicationYear": { - "display": "2023" + "display": "2010" } }, "dateFirstEdition": null, @@ -149,7 +149,7 @@ }, "physicalDescriptions": [ { - "numberOfPages": 124, + "numberOfPages": 325, "playingTime": null } ], @@ -165,18 +165,18 @@ } ], "shelfmark": { - "postfix": "Larsson", - "shelfmark": "64.62" + "postfix": "Hack", + "shelfmark": "99.4 Christie, Agatha" }, "workYear": null, "catalogueCodes": { "nationalBibliography": [], - "otherCatalogues": ["OVE202314"] + "otherCatalogues": ["OVE999999"] } }, "bestRepresentation": { - "pid": "870970-basis:135721719", - "genreAndForm": ["snitmønstre", "vejledninger"], + "pid": "870970-basis:44926407", + "genreAndForm": ["biografier"], "source": ["Bibliotekskatalog"], "languages": { "main": [ @@ -187,7 +187,7 @@ ] }, "titles": { - "main": ["Restyle & restitch for little ones"], + "main": ["Duchess of Death"], "original": [] }, "fictionNonfiction": { @@ -201,21 +201,21 @@ ], "creators": [ { - "display": "Linnea Larsson", + "display": "Richard Hack", "__typename": "Person" } ], - "publisher": ["Search"], + "publisher": ["JR Books"], "identifiers": [ { - "value": "9781800921191" + "value": "9781906779832" } ], "contributors": [], "edition": { - "summary": "2023", + "summary": "1. edition, 2010", "publicationYear": { - "display": "2023" + "display": "2010" } }, "dateFirstEdition": null, @@ -224,7 +224,7 @@ }, "physicalDescriptions": [ { - "numberOfPages": 124, + "numberOfPages": 325, "playingTime": null } ], @@ -240,13 +240,13 @@ } ], "shelfmark": { - "postfix": "Larsson", - "shelfmark": "64.62" + "postfix": "Hack", + "shelfmark": "99.4 Christie, Agatha" }, "workYear": null, "catalogueCodes": { "nationalBibliography": [], - "otherCatalogues": ["OVE202314"] + "otherCatalogues": ["OVE999999"] } } }, @@ -264,42 +264,45 @@ "subjects": { "all": [ { - "display": "syning" + "display": "forfattere" }, { - "display": "børnetøj" + "display": "kriminalforfattere" }, { - "display": "genbrug" + "display": "England" }, { - "display": "genbrugstøj" + "display": "Authors, English -- 20th century -- Biography" }, { - "display": "tekstiler" + "display": "Detective and mystery stories -- Authorship" }, { - "display": "upcycling" + "display": "Agatha Christie (1890-1976)" + }, + { + "display": "Agatha Christie" + }, + { + "display": "1900-tallet" } ], "dbcVerified": [ { - "display": "syning" - }, - { - "display": "børnetøj" + "display": "forfattere" }, { - "display": "genbrug" + "display": "kriminalforfattere" }, { - "display": "genbrugstøj" + "display": "England" }, { - "display": "tekstiler" + "display": "Agatha Christie" }, { - "display": "upcycling" + "display": "1900-tallet" } ] }, @@ -308,7 +311,7 @@ "code": "NONFICTION" }, "dk5MainEntry": { - "display": "64.62 Syning af børnetøj" + "display": "99.4 Christie, Agatha" }, "relations": { "hasReview": [], From 5d470860df439084dd584ea32c2fc8e2a5557dfd Mon Sep 17 00:00:00 2001 From: Kasper Birch Date: Wed, 27 Dec 2023 12:00:07 +0100 Subject: [PATCH 07/10] Trigger new release From 3c179ddea9735ac7a305f619b6ed4f1c0d7f45b3 Mon Sep 17 00:00:00 2001 From: Kasper Birch Date: Wed, 27 Dec 2023 12:46:40 +0100 Subject: [PATCH 08/10] Remove unnecessary translation This line was confusing... the status will be set in the `translateOpenOrderStatus` function, and the translations for them should be descriptive of the current status of the order. --- src/apps/material/material.dev.tsx | 5 ----- src/apps/material/material.entry.tsx | 1 - src/components/reservation/ReservationModalBody.tsx | 4 +--- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/apps/material/material.dev.tsx b/src/apps/material/material.dev.tsx index ecd6874a2d..602da32c18 100644 --- a/src/apps/material/material.dev.tsx +++ b/src/apps/material/material.dev.tsx @@ -817,11 +817,6 @@ export default { defaultValue: "Order from another library:", control: { type: "text" } }, - openOrderResponseIsReservedForYouText: { - name: "Reservation Success Title", - defaultValue: "is ordered to your library", - control: { type: "text" } - }, openOrderAuthenticationErrorText: { name: "Open order authentication error text", defaultValue: "Authentication error occurred", diff --git a/src/apps/material/material.entry.tsx b/src/apps/material/material.entry.tsx index 1295ffa494..69090a213b 100644 --- a/src/apps/material/material.entry.tsx +++ b/src/apps/material/material.entry.tsx @@ -118,7 +118,6 @@ interface MaterialEntryTextProps { openOrderOrsErrorText: string; openOrderOwnedOwnCatalogueText: string; openOrderOwnedWrongMediumtypeText: string; - openOrderResponseIsReservedForYouText: string; openOrderResponseTitleText: string; openOrderServiceUnavailableText: string; openOrderStatusOwnedAcceptedText: string; diff --git a/src/components/reservation/ReservationModalBody.tsx b/src/components/reservation/ReservationModalBody.tsx index 5b2db7aff1..e725869010 100644 --- a/src/components/reservation/ReservationModalBody.tsx +++ b/src/components/reservation/ReservationModalBody.tsx @@ -316,9 +316,7 @@ export const ReservationModalBody = ({ {openOrderResponse?.submitOrder?.status && ( Date: Tue, 9 Jan 2024 13:15:05 +0100 Subject: [PATCH 09/10] Use release 2024.4.0 branch of design system --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 4ab5259fc6..3afa75acf7 100644 --- a/package.json +++ b/package.json @@ -143,7 +143,7 @@ "prop-types": "Since we use former ddb-react components that depend on prop-types we keep this. Should be removed when usage of prop-types is deprecated." }, "dependencies": { - "@danskernesdigitalebibliotek/dpl-design-system": "^2024.2.0-5f768839509efac19487828c1bf4d080c146bf47", + "@danskernesdigitalebibliotek/dpl-design-system": "0.0.0-965fea50664c3e9a7d855a5f1e2f3c4571279054", "@reach/alert": "^0.17.0", "@reach/dialog": "^0.18.0", "@reduxjs/toolkit": "^1.9.7", diff --git a/yarn.lock b/yarn.lock index 980039077b..be8ab94e0f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1477,10 +1477,10 @@ debug "^3.1.0" lodash.once "^4.1.1" -"@danskernesdigitalebibliotek/dpl-design-system@^2024.2.0-5f768839509efac19487828c1bf4d080c146bf47": - version "2024.2.0-5f768839509efac19487828c1bf4d080c146bf47" - resolved "https://npm.pkg.github.com/download/@danskernesdigitalebibliotek/dpl-design-system/2024.2.0-5f768839509efac19487828c1bf4d080c146bf47/095d038046478d425739389406b6250aba9db5af#095d038046478d425739389406b6250aba9db5af" - integrity sha512-zxeLuhlmVxADZLqHyI7o4muVn0kDW56Jx3SGF35WjIhZVuhHE7F5I37WFOFVKNAQwVJpmNNMYcOBTbWx0Juadw== +"@danskernesdigitalebibliotek/dpl-design-system@0.0.0-965fea50664c3e9a7d855a5f1e2f3c4571279054": + version "0.0.0-965fea50664c3e9a7d855a5f1e2f3c4571279054" + resolved "https://npm.pkg.github.com/download/@danskernesdigitalebibliotek/dpl-design-system/0.0.0-965fea50664c3e9a7d855a5f1e2f3c4571279054/d46eb9dd4a970b59d634edc215aaab353bd34c27#d46eb9dd4a970b59d634edc215aaab353bd34c27" + integrity sha512-xQJpDAJB85yEeQgTWOeJpnRY97Pg6TS5bZH7OqOr0gtSQqasAN6xWveRYGlSy1qlFu8xmC1dH3ExCdLg9W9p3Q== "@discoveryjs/json-ext@^0.5.0", "@discoveryjs/json-ext@^0.5.3": version "0.5.7" From ce1aef922f14d8caee4ba8110144f00558cf26ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Garn=C3=A6s?= Date: Mon, 22 Jan 2024 16:39:19 +0100 Subject: [PATCH 10/10] Use release 2024.4.0 of design system --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 3afa75acf7..a0454890cd 100644 --- a/package.json +++ b/package.json @@ -143,7 +143,7 @@ "prop-types": "Since we use former ddb-react components that depend on prop-types we keep this. Should be removed when usage of prop-types is deprecated." }, "dependencies": { - "@danskernesdigitalebibliotek/dpl-design-system": "0.0.0-965fea50664c3e9a7d855a5f1e2f3c4571279054", + "@danskernesdigitalebibliotek/dpl-design-system": "^2024.4.0-174d424951b2cc03e92bd2522b707f59226e8f12", "@reach/alert": "^0.17.0", "@reach/dialog": "^0.18.0", "@reduxjs/toolkit": "^1.9.7", diff --git a/yarn.lock b/yarn.lock index be8ab94e0f..755a73c005 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1477,10 +1477,10 @@ debug "^3.1.0" lodash.once "^4.1.1" -"@danskernesdigitalebibliotek/dpl-design-system@0.0.0-965fea50664c3e9a7d855a5f1e2f3c4571279054": - version "0.0.0-965fea50664c3e9a7d855a5f1e2f3c4571279054" - resolved "https://npm.pkg.github.com/download/@danskernesdigitalebibliotek/dpl-design-system/0.0.0-965fea50664c3e9a7d855a5f1e2f3c4571279054/d46eb9dd4a970b59d634edc215aaab353bd34c27#d46eb9dd4a970b59d634edc215aaab353bd34c27" - integrity sha512-xQJpDAJB85yEeQgTWOeJpnRY97Pg6TS5bZH7OqOr0gtSQqasAN6xWveRYGlSy1qlFu8xmC1dH3ExCdLg9W9p3Q== +"@danskernesdigitalebibliotek/dpl-design-system@^2024.4.0-174d424951b2cc03e92bd2522b707f59226e8f12": + version "2024.4.0-174d424951b2cc03e92bd2522b707f59226e8f12" + resolved "https://npm.pkg.github.com/download/@danskernesdigitalebibliotek/dpl-design-system/2024.4.0-174d424951b2cc03e92bd2522b707f59226e8f12/d41e0060d22bbef5d949bfadf1c8313df43748ea#d41e0060d22bbef5d949bfadf1c8313df43748ea" + integrity sha512-2X6JeQLeIlwmf+qMvr1i9LEudtehJSi8mwa98kqyBC0D9DU/N3XZ1rw3z/BRXjycC0MvVcuj5k1jkLli7RbJ+w== "@discoveryjs/json-ext@^0.5.0", "@discoveryjs/json-ext@^0.5.3": version "0.5.7"