diff --git a/.docker/wiremock/fbs/mappings/fbs-availability-31ef8b31-c7f7-4463-89e9-1b1f9875864b.json b/.docker/wiremock/fbs/mappings/fbs-availability-31ef8b31-c7f7-4463-89e9-1b1f9875864b.json new file mode 100644 index 0000000000..631cddfab7 --- /dev/null +++ b/.docker/wiremock/fbs/mappings/fbs-availability-31ef8b31-c7f7-4463-89e9-1b1f9875864b.json @@ -0,0 +1,18 @@ +{ + "id" : "31ef8b31-c7f7-4463-89e9-1b1f9875864b", + "name" : "FBS availability", + "request" : { + "urlPath" : "/external/agencyid/catalog/availability/v3", + "method" : "GET" + }, + "response" : { + "status" : 200, + "body" : "[\n {\n \"available\": true,\n \"recordId\": \"52557240\",\n \"reservable\": true,\n \"reservations\": 2\n },\n {\n \"available\": true,\n \"recordId\": \"52643414\",\n \"reservable\": true,\n \"reservations\": 2\n }\n]", + "headers" : { } + }, + "uuid" : "31ef8b31-c7f7-4463-89e9-1b1f9875864b", + "persistent" : true, + "priority" : 5, + "insertionIndex" : 2, + "postServeActions" : [ ] +} \ No newline at end of file diff --git a/.docker/wiremock/fbs/mappings/fbs-holdings-a530c110-c4a9-42f4-a06f-9390744b8b00.json b/.docker/wiremock/fbs/mappings/fbs-holdings-a530c110-c4a9-42f4-a06f-9390744b8b00.json new file mode 100644 index 0000000000..79bcbe974e --- /dev/null +++ b/.docker/wiremock/fbs/mappings/fbs-holdings-a530c110-c4a9-42f4-a06f-9390744b8b00.json @@ -0,0 +1,18 @@ +{ + "id" : "a530c110-c4a9-42f4-a06f-9390744b8b00", + "name" : "FBS holdings", + "request" : { + "urlPath" : "/external/agencyid/catalog/holdings/v3", + "method" : "GET" + }, + "response" : { + "status" : 200, + "body" : "[\n {\n \"recordId\": \"52557240\",\n \"reservable\": false,\n \"reservations\": 0,\n \"holdings\": []\n },\n {\n \"recordId\": \"52643414\",\n \"reservable\": false,\n \"reservations\": 0,\n \"holdings\": []\n }\n]\n", + "headers" : { } + }, + "uuid" : "a530c110-c4a9-42f4-a06f-9390744b8b00", + "persistent" : true, + "priority" : 5, + "insertionIndex" : 16, + "postServeActions" : [ ] +} \ No newline at end of file diff --git a/docs/request_mocking_wiremock.md b/docs/request_mocking_wiremock.md index 164c4c34d8..dd6a861a45 100644 --- a/docs/request_mocking_wiremock.md +++ b/docs/request_mocking_wiremock.md @@ -52,7 +52,9 @@ To set up a mocked response for a new request to FBS do the following: 2. Click "FBS" to manage the Wiremock instance for FBS 3. Click "Stubs" to see a list of existing requests/responses 4. Click "New" to create a new request/response set and provide a name -5. Provide the HTTP method, path and other parts of the request to match +5. Provide the HTTP method, path and other parts of the request to match (note: +make sure to check "advanced" option out, and match either path, or path AND the +query.) 6. Provide the response HTTP status code and body to return 7. Click "Save" 8. See that the stub has been persisted as a new file in diff --git a/src/apps/dashboard/dashboard-fees/dashboard-fees.tsx b/src/apps/dashboard/dashboard-fees/dashboard-fees.tsx index 6acb5fd783..8cec1ca4ad 100644 --- a/src/apps/dashboard/dashboard-fees/dashboard-fees.tsx +++ b/src/apps/dashboard/dashboard-fees/dashboard-fees.tsx @@ -45,7 +45,8 @@ const DashboardFees: FC = () => { placeholders: { "@total": totalFeeAmount } })} overdueText={t("totalOwedText")} - rightButtonText={t("payOwedText")} + rightButtonText={t("dashboardSeeMoreFeesText")} + rightButtonAriaLabelText={t("dashboardSeeMoreFeesAriaLabelText")} rightLink={feesPageUrl} /> diff --git a/src/apps/dashboard/dashboard.dev.tsx b/src/apps/dashboard/dashboard.dev.tsx index bcbe1541b2..47db9b98cd 100644 --- a/src/apps/dashboard/dashboard.dev.tsx +++ b/src/apps/dashboard/dashboard.dev.tsx @@ -50,8 +50,12 @@ export default { defaultValue: "You owe in total", control: { type: "text" } }, - payOwedText: { - defaultValue: "Pay", + dashboardSeeMoreFeesText: { + defaultValue: "See more", + control: { type: "text" } + }, + dashboardSeeMoreFeesAriaLabelText: { + defaultValue: "See your fees and how to pay", control: { type: "text" } }, totalAmountFeeText: { diff --git a/src/apps/dashboard/dashboard.entry.tsx b/src/apps/dashboard/dashboard.entry.tsx index 26afd0907c..6b8cf4b95c 100644 --- a/src/apps/dashboard/dashboard.entry.tsx +++ b/src/apps/dashboard/dashboard.entry.tsx @@ -43,7 +43,8 @@ export interface DashBoardProps { materialByAuthorText: string; noPhysicalLoansText: string; noReservationsText: string; - payOwedText: string; + dashboardSeeMoreFeesText: string; + dashboardSeeMoreFeesAriaLabelText: string; physicalLoansText: string; publizonAudioBookText: string; publizonEbookText: string; diff --git a/src/apps/fee-list/FeeList.tsx b/src/apps/fee-list/FeeList.tsx index ee1f1fec26..a9569f5987 100644 --- a/src/apps/fee-list/FeeList.tsx +++ b/src/apps/fee-list/FeeList.tsx @@ -114,7 +114,10 @@ const FeeList: FC = () => { {!itemsPrePaymentChange && !itemsPostPaymentChange && ( <> - {t("unpaidFeesText")}} amount={0} /> + {t("unpaidFeesFirstHeadlineText")}} + amount={0} + /> = ({ overdueText, rightText, rightButtonText, + rightButtonAriaLabelText, leftLink, rightLink }) => { + const labelId = useId(); + return (
@@ -48,14 +53,19 @@ const WarningBar: FC = ({ > {rightText}

+ + {rightButtonAriaLabelText} + {rightLink && ( - {rightButtonText} - + )}
)} diff --git a/src/apps/material/material.dev.tsx b/src/apps/material/material.dev.tsx index 48bb23d025..85dd317487 100644 --- a/src/apps/material/material.dev.tsx +++ b/src/apps/material/material.dev.tsx @@ -809,7 +809,7 @@ export default { }, interestPeriodsConfig: { defaultValue: - '[\n {\n "value":"30",\n "label":"1 month"\n },\n {\n "value":"60",\n "label":"2 months"\n },\n {\n "value":"90",\n "label":"3 months"\n },\n {\n "value":"180",\n "label":"6 months"\n },\n {\n "value":"360",\n "label":"1 year"\n }\n]', + '{ "interestPeriods":[ { "value":14, "label":"14 days" }, { "value":30, "label":"1 month" }, { "value":60, "label":"2 months" }, { "value":90, "label":"3 months" }, { "value":180, "label":"6 months" }, { "value":365, "label":"1 year" } ], "defaultInterestPeriod":{ "value":"14", "label":"14 days" } }', control: { type: "text" } }, openOrderResponseTitleText: { diff --git a/src/apps/reservation-list/modal/reservation-details/reservation-details.test.ts b/src/apps/reservation-list/modal/reservation-details/reservation-details.test.ts index 142836bd72..7f7a03b0be 100644 --- a/src/apps/reservation-list/modal/reservation-details/reservation-details.test.ts +++ b/src/apps/reservation-list/modal/reservation-details/reservation-details.test.ts @@ -532,7 +532,7 @@ describe("Reservation details modal", () => { cy.getBySel("modal-reservation-form-select").should( "have.text", - "Choose one1 month2 months3 months6 months1 year" + "Choose one14 days1 month2 months3 months6 months1 year" ); cy.getBySel("reservation-form-button", true).click(); diff --git a/src/components/reservation/UserListItems.tsx b/src/components/reservation/UserListItems.tsx index c9c52711c9..8ca023f373 100644 --- a/src/components/reservation/UserListItems.tsx +++ b/src/components/reservation/UserListItems.tsx @@ -22,7 +22,7 @@ import { } from "./helper"; import PickupModal from "./forms/PickupModal"; import NoInterestAfterModal from "./forms/NoInterestAfterModal"; -import { Option } from "../Dropdown/Dropdown"; +import { Periods } from "./types"; export interface UserListItemsProps { patron: PatronV5; @@ -51,7 +51,7 @@ const UserListItems: FC = ({ }) => { const t = useText(); const config = useConfig(); - const interstPeriods = config("interestPeriodsConfig", { + const interestPeriods = config("interestPeriodsConfig", { transformer: "jsonParse" }); @@ -61,8 +61,12 @@ const UserListItems: FC = ({ }; const interestPeriod = selectedInterest - ? getNoInterestAfter(selectedInterest, interstPeriods, t) - : getNoInterestAfter(defaultInterestPeriod, interstPeriods, t); + ? getNoInterestAfter(selectedInterest, interestPeriods, t) + : getNoInterestAfter( + Number(interestPeriods.defaultInterestPeriod.value), + interestPeriods, + t + ); const pickupBranch = selectedBranch ? getPreferredBranch(selectedBranch, branches) diff --git a/src/components/reservation/forms/NoInterestAfterModal.tsx b/src/components/reservation/forms/NoInterestAfterModal.tsx index c9ade2ddec..2451f0be33 100644 --- a/src/components/reservation/forms/NoInterestAfterModal.tsx +++ b/src/components/reservation/forms/NoInterestAfterModal.tsx @@ -2,8 +2,8 @@ import React from "react"; import { useText } from "../../../core/utils/text"; import ModalReservationFormSelect from "./ModalReservationFormSelect"; import { useConfig } from "../../../core/utils/config"; -import { Option } from "../../Dropdown/Dropdown"; import { RequestStatus } from "../../../core/utils/types/request"; +import { Periods } from "../types"; export interface PickupModalProps { selectedInterest: number; @@ -22,7 +22,7 @@ const NoInterestAfterModal = ({ }: PickupModalProps) => { const t = useText(); const config = useConfig(); - const interstPeriods = config("interestPeriodsConfig", { + const interstPeriods = config("interestPeriodsConfig", { transformer: "jsonParse" }); @@ -35,7 +35,7 @@ const NoInterestAfterModal = ({ t("modalReservationFormNoInterestAfterHeaderDescriptionText") ] }} - items={interstPeriods} + items={interstPeriods.interestPeriods} defaultSelectedItem={String(selectedInterest)} selectHandler={(value: string) => setSelectedInterest(Number(value))} ariaLabel={t("modalReservationFormNoInterestAfterLabelText")} diff --git a/src/components/reservation/helper.ts b/src/components/reservation/helper.ts index e4aeb9ef36..b20c5a97a2 100644 --- a/src/components/reservation/helper.ts +++ b/src/components/reservation/helper.ts @@ -19,7 +19,7 @@ import { PeriodicalEdition } from "../material/periodical/helper"; import { ModalReservationFormTextType } from "./forms/helper"; import invalidSwitchCase from "../../core/utils/helpers/invalid-switch-case"; import { SubmitOrderStatus } from "../../core/dbc-gateway/generated/graphql"; -import { Option } from "../Dropdown/Dropdown"; +import { Periods } from "./types"; export const isConfigValueOne = (configValue: string | undefined | string[]) => configValue === "1"; @@ -31,10 +31,10 @@ export const getPreferredBranch = (id: string, array: AgencyBranch[]) => { export const getNoInterestAfter = ( days: number, - interestPeriod: Option[], + interestPeriod: Periods, t: UseTextFunction ) => { - const interestPeriodFound = interestPeriod.find( + const interestPeriodFound = interestPeriod.interestPeriods.find( ({ value }) => value === String(days) ); diff --git a/src/components/reservation/types.ts b/src/components/reservation/types.ts new file mode 100644 index 0000000000..5780e3ebd3 --- /dev/null +++ b/src/components/reservation/types.ts @@ -0,0 +1,6 @@ +import { Option } from "../Dropdown/Dropdown"; + +export type Periods = { + interestPeriods: Option[]; + defaultInterestPeriod: Option; +}; diff --git a/src/core/storybook/reservationMaterialDetailsArgs.ts b/src/core/storybook/reservationMaterialDetailsArgs.ts index ddebf43de6..b168abbb69 100644 --- a/src/core/storybook/reservationMaterialDetailsArgs.ts +++ b/src/core/storybook/reservationMaterialDetailsArgs.ts @@ -16,7 +16,7 @@ export default { }, interestPeriodsConfig: { defaultValue: - '[\n {\n "value":"30",\n "label":"1 month"\n },\n {\n "value":"60",\n "label":"2 months"\n },\n {\n "value":"90",\n "label":"3 months"\n },\n {\n "value":"180",\n "label":"6 months"\n },\n {\n "value":"360",\n "label":"1 year"\n }\n]', + '{ "interestPeriods":[ { "value":14, "label":"14 days" }, { "value":30, "label":"1 month" }, { "value":60, "label":"2 months" }, { "value":90, "label":"3 months" }, { "value":180, "label":"6 months" }, { "value":365, "label":"1 year" } ], "defaultInterestPeriod":{ "value":"14", "label":"14 days" } }', control: { type: "text" } }, reservationDetailsRemoveDigitalReservationText: {