diff --git a/packages/client/src/v2-events/features/events/registered-fields/AlphaPrintButton.tsx b/packages/client/src/v2-events/features/events/registered-fields/AlphaPrintButton.tsx index e2b303b2ace..62e2049e1cc 100644 --- a/packages/client/src/v2-events/features/events/registered-fields/AlphaPrintButton.tsx +++ b/packages/client/src/v2-events/features/events/registered-fields/AlphaPrintButton.tsx @@ -45,10 +45,16 @@ interface PrintButtonProps { const addedButtonLabel = { id: 'buttons.print', defaultMessage: 'Print' } /** - * Indicates that declaration action changed declaration content. Satisfies V1 spec. + * Specialized print declaration action used only on the client side. + * + * DECLARE has been used here so that in offline mode + * getCurrentEventState can be tricked to include both + * metadata and declaration data not really persisted + * on the record’s history + * */ -export const DECLARATION_ACTION_UPDATE = 'UPDATE' as const -type DECLARATION_ACTION_UPDATE = typeof DECLARATION_ACTION_UPDATE +const PRINT_DECLARATION_ACTION = 'DECLARE' as const +type PRINT_DECLARATION_ACTION = typeof PRINT_DECLARATION_ACTION export const AlphaPrintButton = { Input: ({ @@ -62,7 +68,7 @@ export const AlphaPrintButton = { const intl = useIntl() const location = useLocation() const parts = location.pathname.split('/') - const eventId = UUID.parse(parts[3]) + const eventId = parts[3] as UUID const { getEvent } = useEvents() const { certificateTemplates, language } = useAppConfig() const { getUser } = useUsers() @@ -89,7 +95,7 @@ export const AlphaPrintButton = { const actionsWithAnOptimisticPrintAction = [ ...actions, { - type: DECLARATION_ACTION_UPDATE, + type: PRINT_DECLARATION_ACTION, id: getUUID(), transactionId: getUUID(), createdByUserType: 'user', diff --git a/packages/client/src/v2-events/features/workqueues/EventOverview/components/EventHistory/EventHistoryDialog/EventHistoryDialog.annotation.stories.tsx b/packages/client/src/v2-events/features/workqueues/EventOverview/components/EventHistory/EventHistoryDialog/EventHistoryDialog.annotation.stories.tsx index 98e3c841a41..7b5ee99b5e4 100644 --- a/packages/client/src/v2-events/features/workqueues/EventOverview/components/EventHistory/EventHistoryDialog/EventHistoryDialog.annotation.stories.tsx +++ b/packages/client/src/v2-events/features/workqueues/EventOverview/components/EventHistory/EventHistoryDialog/EventHistoryDialog.annotation.stories.tsx @@ -25,8 +25,10 @@ import { generateTrackingId } from '@opencrvs/commons/client' import { getTestValidatorContext } from '../../../../../../../../.storybook/decorators' -import { expandWithClientSpecificActions } from '../../../../../events/actions/correct/useActionForHistory' -import { DECLARATION_ACTION_UPDATE } from '../../../../../events/registered-fields' +import { + expandWithClientSpecificActions, + DECLARATION_ACTION_UPDATE +} from '../../../../../events/actions/correct/useActionForHistory' import { testDataGenerator } from '../../../../../../../tests/test-data-generators' import { EventHistoryDialog } from './EventHistoryDialog'