From d12a65a981bee412d2f53011124aff941db5c82f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Eorkell=20M=C3=A1ni=20=C3=9Eorkelsson?= Date: Mon, 9 Dec 2024 14:05:53 +0000 Subject: [PATCH 1/4] fix: add warning --- libs/feature-flags/src/lib/features.ts | 3 + .../src/lib/messages.ts | 5 ++ .../src/screens/IncomePlan/IncomePlan.tsx | 32 --------- .../IncomePlanDetail/IncomePlanDetail.tsx | 65 +++++++++++++++---- 4 files changed, 60 insertions(+), 45 deletions(-) diff --git a/libs/feature-flags/src/lib/features.ts b/libs/feature-flags/src/lib/features.ts index fc77efa64398..5cc65a03a541 100644 --- a/libs/feature-flags/src/lib/features.ts +++ b/libs/feature-flags/src/lib/features.ts @@ -60,6 +60,9 @@ export enum Features { //New License service fetch enabled licensesV2 = 'isLicensesV2Enabled', + //Is social administration payment plan 2025 enabled? + isServicePortalPaymentPlan2025Enabled = 'isServicePortalPaymentPlan2025Enabled', + //Possible universities isUniversityOfAkureyriEnabled = 'isUniversityOfAkureyriEnabled', isAgriculturalUniversityOfIcelandEnabled = 'isAgriculturalUniversityOfIcelandEnabled', diff --git a/libs/portals/my-pages/social-insurance-maintenance/src/lib/messages.ts b/libs/portals/my-pages/social-insurance-maintenance/src/lib/messages.ts index 3cbf39c1838d..f90f69b54bab 100644 --- a/libs/portals/my-pages/social-insurance-maintenance/src/lib/messages.ts +++ b/libs/portals/my-pages/social-insurance-maintenance/src/lib/messages.ts @@ -122,4 +122,9 @@ export const m = defineMessages({ id: 'sp.social-insurance-maintenance:income-plan-link-text', defaultMessage: 'Hvað er tekjuáætlun?', }, + incomePlanTemporarilyUnavailable: { + id: 'sp.social-insurance-maintenance:income-plan-temporarily-unavailable', + defaultMessage: + 'Bráðabirgðatekjuáætlun 2025 verður tilbúin seinni part desember', + }, }) diff --git a/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlan/IncomePlan.tsx b/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlan/IncomePlan.tsx index 1197a088e110..7777a757b3bf 100644 --- a/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlan/IncomePlan.tsx +++ b/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlan/IncomePlan.tsx @@ -37,38 +37,6 @@ const parseSubtext = ( } } -const parseTag = ( - tag: SocialInsuranceIncomePlanStatus, - formatMessage: FormatMessage, -) => { - switch (tag) { - case SocialInsuranceIncomePlanStatus.ACCEPTED: - return { - label: formatMessage(coreMessages.processed), - variant: 'mint' as const, - outlined: false, - } - case SocialInsuranceIncomePlanStatus.IN_PROGRESS: - return { - label: formatMessage(coreMessages.inProgress), - variant: 'purple' as const, - outlined: false, - } - case SocialInsuranceIncomePlanStatus.CANCELLED: - return { - label: formatMessage(coreMessages.rejected), - variant: 'red' as const, - outlined: false, - } - default: - return { - label: formatMessage(coreMessages.unknown), - variant: 'red' as const, - outlined: false, - } - } -} - const IncomePlan = () => { useNamespaces('sp.social-insurance-maintenance') const { formatMessage } = useLocale() diff --git a/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx b/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx index 3f5b207c349d..51878ab260c9 100644 --- a/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx +++ b/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx @@ -1,5 +1,4 @@ import { - Box, Inline, Stack, Button, @@ -10,32 +9,75 @@ import { import { useLocale, useNamespaces } from '@island.is/localization' import { EmptyTable, - FootNote, - IntroHeader, + IntroWrapper, LinkButton, amountFormat, m as coreMessages, } from '@island.is/portals/my-pages/core' import { m } from '../../lib/messages' -import { useGetIncomePlanDetailQuery } from './IncomePlanDetail.generated' +import { + useGetIncomePlanDetailLazyQuery, + useGetIncomePlanDetailQuery, +} from './IncomePlanDetail.generated' import { Problem } from '@island.is/react-spa/shared' +import { useEffect, useState } from 'react' +import { useFeatureFlagClient } from '@island.is/react/feature-flags' const IncomePlanDetail = () => { useNamespaces('sp.social-insurance-maintenance') const { formatMessage } = useLocale() - const { data, loading, error } = useGetIncomePlanDetailQuery() - return ( - - { + const isFlagEnabled = async () => { + const ffEnabled = await featureFlagClient.getValue( + `isServicePortalPaymentPlan2025Enabled`, + false, + ) + if (ffEnabled) { + setDisplayPaymentPlan(ffEnabled as boolean) + } + } + isFlagEnabled() + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []) + + useEffect(() => { + if (displayPaymentPlan) { + query() + } + }, [displayPaymentPlan]) + + if (!displayPaymentPlan) { + return ( + + > + + + ) + } + return ( + {error && !loading ? ( ) : !error && !loading && !data?.socialInsuranceIncomePlan ? ( @@ -117,10 +159,7 @@ const IncomePlanDetail = () => { )} )} - - - - + ) } From f393e799090b201bcbc5d346d7b0634546912bc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Eorkell=20M=C3=A1ni=20=C3=9Eorkelsson?= Date: Wed, 11 Dec 2024 14:35:30 +0000 Subject: [PATCH 2/4] feat: conditiona lredner on payment plan --- .../src/lib/messages.ts | 6 +- .../src/screens/PaymentPlan/PaymentPlan.tsx | 181 +++++++++++------- 2 files changed, 118 insertions(+), 69 deletions(-) diff --git a/libs/portals/my-pages/social-insurance-maintenance/src/lib/messages.ts b/libs/portals/my-pages/social-insurance-maintenance/src/lib/messages.ts index f90f69b54bab..233106923711 100644 --- a/libs/portals/my-pages/social-insurance-maintenance/src/lib/messages.ts +++ b/libs/portals/my-pages/social-insurance-maintenance/src/lib/messages.ts @@ -122,9 +122,9 @@ export const m = defineMessages({ id: 'sp.social-insurance-maintenance:income-plan-link-text', defaultMessage: 'Hvað er tekjuáætlun?', }, - incomePlanTemporarilyUnavailable: { - id: 'sp.social-insurance-maintenance:income-plan-temporarily-unavailable', + paymentPlanTemporarilyUnavailable: { + id: 'sp.social-insurance-maintenance:payment-plan-temporarily-unavailable', defaultMessage: - 'Bráðabirgðatekjuáætlun 2025 verður tilbúin seinni part desember', + 'Bráðabirgðagreiðsluáætlun 2025 verður tilbúin seinni part desember', }, }) diff --git a/libs/portals/my-pages/social-insurance-maintenance/src/screens/PaymentPlan/PaymentPlan.tsx b/libs/portals/my-pages/social-insurance-maintenance/src/screens/PaymentPlan/PaymentPlan.tsx index 35e746a9b6c0..fd05bd116943 100644 --- a/libs/portals/my-pages/social-insurance-maintenance/src/screens/PaymentPlan/PaymentPlan.tsx +++ b/libs/portals/my-pages/social-insurance-maintenance/src/screens/PaymentPlan/PaymentPlan.tsx @@ -1,27 +1,76 @@ -import { Box, Divider, Stack, Text } from '@island.is/island-ui/core' +import { + AlertMessage, + Box, + Divider, + Stack, + Text, +} from '@island.is/island-ui/core' import { useLocale, useNamespaces } from '@island.is/localization' import { Problem } from '@island.is/react-spa/shared' import { - FootNote, - IntroHeader, + IntroWrapper, LinkButton, UserInfoLine, amountFormat, m as coreMessages, } from '@island.is/portals/my-pages/core' import { m } from '../../lib/messages' -import { useGetPreviousPaymentsQuery } from './PaymentPlan.generated' import { PaymentGroupTable } from '../../components' +import { useEffect, useState } from 'react' +import { useFeatureFlagClient } from '@island.is/react/feature-flags' +import { useGetPreviousPaymentsLazyQuery } from './PaymentPlan.generated' const PaymentPlan = () => { useNamespaces('sp.social-insurance-maintenance') const { formatMessage } = useLocale() - const { data, loading, error } = useGetPreviousPaymentsQuery() + const [displayPaymentPlan, setDisplayPaymentPlan] = useState(false) + const [query, { data, loading, error }] = useGetPreviousPaymentsLazyQuery() + + const featureFlagClient = useFeatureFlagClient() + useEffect(() => { + const isFlagEnabled = async () => { + const ffEnabled = await featureFlagClient.getValue( + `isServicePortalPaymentPlan2025Enabled`, + false, + ) + if (ffEnabled) { + setDisplayPaymentPlan(ffEnabled as boolean) + } + } + isFlagEnabled() + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []) + + useEffect(() => { + if (displayPaymentPlan) { + query() + } + }, [displayPaymentPlan]) + + if (!displayPaymentPlan) { + return ( + + + + ) + } return ( - { serviceProviderTooltip={formatMessage( coreMessages.socialInsuranceTooltip, )} - /> - {error && !loading ? ( - - ) : !error && !loading && !data?.socialInsurancePayments ? ( - - ) : ( - <> - - - - - - - + > + {error && !loading ? ( + + ) : !error && !loading && !data?.socialInsurancePayments ? ( + + ) : ( + <> + + + + + + + - - {formatMessage(coreMessages.period)} - + + {formatMessage(coreMessages.period)} + - - - - - {formatMessage(m.maintenanceFooter)} - {formatMessage(m.maintenanceFooterLink, { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - link: (str: any) => ( - - ), - })} - - - - )} - + + + + + {formatMessage(m.maintenanceFooter)} + {formatMessage(m.maintenanceFooterLink, { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + link: (str: any) => ( + + ), + })} + + + + )} + ) } From 6a2f6cfe2e64f0209734dd7b71a06a86947e7077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Eorkell=20M=C3=A1ni=20=C3=9Eorkelsson?= Date: Wed, 11 Dec 2024 14:43:56 +0000 Subject: [PATCH 3/4] chore: revert inoem plan detail --- .../IncomePlanDetail/IncomePlanDetail.tsx | 53 ++----------------- 1 file changed, 5 insertions(+), 48 deletions(-) diff --git a/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx b/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx index 51878ab260c9..f5728ec8799d 100644 --- a/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx +++ b/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx @@ -1,4 +1,5 @@ import { + Box, Inline, Stack, Button, @@ -9,66 +10,22 @@ import { import { useLocale, useNamespaces } from '@island.is/localization' import { EmptyTable, + FootNote, + IntroHeader, IntroWrapper, LinkButton, amountFormat, m as coreMessages, } from '@island.is/portals/my-pages/core' import { m } from '../../lib/messages' -import { - useGetIncomePlanDetailLazyQuery, - useGetIncomePlanDetailQuery, -} from './IncomePlanDetail.generated' +import { useGetIncomePlanDetailQuery } from './IncomePlanDetail.generated' import { Problem } from '@island.is/react-spa/shared' -import { useEffect, useState } from 'react' -import { useFeatureFlagClient } from '@island.is/react/feature-flags' const IncomePlanDetail = () => { useNamespaces('sp.social-insurance-maintenance') const { formatMessage } = useLocale() - const [displayPaymentPlan, setDisplayPaymentPlan] = useState(false) - const [query, { data, loading, error }] = useGetIncomePlanDetailLazyQuery() - - const featureFlagClient = useFeatureFlagClient() - useEffect(() => { - const isFlagEnabled = async () => { - const ffEnabled = await featureFlagClient.getValue( - `isServicePortalPaymentPlan2025Enabled`, - false, - ) - if (ffEnabled) { - setDisplayPaymentPlan(ffEnabled as boolean) - } - } - isFlagEnabled() - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []) - - useEffect(() => { - if (displayPaymentPlan) { - query() - } - }, [displayPaymentPlan]) - - if (!displayPaymentPlan) { - return ( - - - - ) - } - + const { data, loading, error } = useGetIncomePlanDetailQuery() return ( Date: Thu, 12 Dec 2024 09:30:08 +0000 Subject: [PATCH 4/4] fix: revert income plan --- .../IncomePlanDetail/IncomePlanDetail.tsx | 53 ++----------------- .../src/screens/PaymentPlan/PaymentPlan.tsx | 1 + 2 files changed, 4 insertions(+), 50 deletions(-) diff --git a/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx b/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx index b96073146403..5adb2a673a20 100644 --- a/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx +++ b/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx @@ -8,68 +8,21 @@ import { } from '@island.is/island-ui/core' import { useLocale, useNamespaces } from '@island.is/localization' import { - FootNote, - IntroHeader, + EmptyTable, IntroWrapper, LinkButton, amountFormat, m as coreMessages, } from '@island.is/portals/my-pages/core' import { m } from '../../lib/messages' -import { - useGetIncomePlanDetailLazyQuery, - useGetIncomePlanDetailQuery, -} from './IncomePlanDetail.generated' +import { useGetIncomePlanDetailQuery } from './IncomePlanDetail.generated' import { Problem } from '@island.is/react-spa/shared' -import { useEffect, useState } from 'react' -import { useFeatureFlagClient } from '@island.is/react/feature-flags' const IncomePlanDetail = () => { useNamespaces('sp.social-insurance-maintenance') const { formatMessage } = useLocale() - const [displayPaymentPlan, setDisplayPaymentPlan] = useState(false) - const [query, { data, loading, error }] = useGetIncomePlanDetailLazyQuery() - - const featureFlagClient = useFeatureFlagClient() - useEffect(() => { - const isFlagEnabled = async () => { - const ffEnabled = await featureFlagClient.getValue( - `isServicePortalPaymentPlan2025Enabled`, - false, - ) - if (ffEnabled) { - setDisplayPaymentPlan(ffEnabled as boolean) - } - } - isFlagEnabled() - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []) - - useEffect(() => { - if (displayPaymentPlan) { - query() - } - }, [displayPaymentPlan]) - - if (!displayPaymentPlan) { - return ( - - - - ) - } - + const { data, loading, error } = useGetIncomePlanDetailQuery() return ( { const [query, { data, loading, error }] = useGetPreviousPaymentsLazyQuery() const featureFlagClient = useFeatureFlagClient() + useEffect(() => { const isFlagEnabled = async () => { const ffEnabled = await featureFlagClient.getValue(