From 97dab73bccd29679178c30f7d162a244f0a9b66f Mon Sep 17 00:00:00 2001 From: Kate Kazantseva <67483124+kate-kazantseva@users.noreply.github.com> Date: Fri, 25 Oct 2024 23:54:24 +0000 Subject: [PATCH] fix precommit --- src/hooks/useGetInvertedPurposeMessageKeys.ts | 27 ++++++++++--------- src/hooks/useGetPurposeDescriptionKeys.ts | 11 ++++---- src/messages.ts | 6 ++--- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/hooks/useGetInvertedPurposeMessageKeys.ts b/src/hooks/useGetInvertedPurposeMessageKeys.ts index 3d566ea..36ead18 100644 --- a/src/hooks/useGetInvertedPurposeMessageKeys.ts +++ b/src/hooks/useGetInvertedPurposeMessageKeys.ts @@ -20,19 +20,20 @@ export const useGetInvertedPurposeMessageKeys = ({ // the purpose type is unique for the bundle [...Object.keys(consentSelection ?? {}), 'Essential'].reduce( (allMessages, purposeType) => { - if (allMessages[purposeType]) { - return allMessages; - } - const purposeMessageLabel = `${PURPOSE_MESSAGE_PREFIX}.${purposeType}.title`; - return { - ...allMessages, - [purposeType]: { - id: purposeMessageLabel, - defaultMessage: defaultPurposeToMessageKey[purposeType]?.defaultMessage - || purposeType, - description: `Translatable name for purpose '${purposeType}'`, - } as DefinedMessage, - }; + if (allMessages[purposeType]) { + return allMessages; + } + const purposeMessageLabel = `${PURPOSE_MESSAGE_PREFIX}.${purposeType}.title`; + return { + ...allMessages, + [purposeType]: { + id: purposeMessageLabel, + defaultMessage: + defaultPurposeToMessageKey[purposeType]?.defaultMessage || + purposeType, + description: `Translatable name for purpose '${purposeType}'`, + } as DefinedMessage, + }; }, defaultPurposeToMessageKey as Record, ), diff --git a/src/hooks/useGetPurposeDescriptionKeys.ts b/src/hooks/useGetPurposeDescriptionKeys.ts index 1eb521d..2bc5cef 100644 --- a/src/hooks/useGetPurposeDescriptionKeys.ts +++ b/src/hooks/useGetPurposeDescriptionKeys.ts @@ -1,6 +1,4 @@ -import type { - TrackingPurposesTypes, -} from '@transcend-io/airgap.js-types'; +import type { TrackingPurposesTypes } from '@transcend-io/airgap.js-types'; import { ConsentSelection } from '../types'; @@ -25,7 +23,8 @@ export const useGetPurposeDescriptionKeys = ({ const purposeToDescriptionKey: Record = useMemo( () => // hard-coding Essential since it's not provided by consentSelection - [...Object.keys(consentSelection ?? {}), 'Essential'].reduce((allMessages, purposeType) => { + [...Object.keys(consentSelection ?? {}), 'Essential'].reduce( + (allMessages, purposeType) => { // making sure default message for Essential is not overwritten // by missing Essential message from airgap if (airgapPurposes[purposeType]?.description) { @@ -40,7 +39,9 @@ export const useGetPurposeDescriptionKeys = ({ }; } return {...allMessages}; - }, defaultPurposeToDescriptionKey as Record), + }, + defaultPurposeToDescriptionKey as Record, + ), [consentSelection, defaultPurposeToDescriptionKey], ); diff --git a/src/messages.ts b/src/messages.ts index a6af0fc..0aeeaf7 100644 --- a/src/messages.ts +++ b/src/messages.ts @@ -468,8 +468,7 @@ export const purposeMessages = defineMessages('purpose.trackingType', { }, 'Functional.title': { defaultMessage: 'Functional', - description: - 'Text for functional purposes in CompleteOptions view state.', + description: 'Text for functional purposes in CompleteOptions view state.', }, 'Functional.description': { defaultMessage: 'Personalization, autofilled forms, etc.', @@ -487,8 +486,7 @@ export const purposeMessages = defineMessages('purpose.trackingType', { }, 'Advertising.title': { defaultMessage: 'Advertising', - description: - 'Text for advertising purposes in CompleteOptions view state.', + description: 'Text for advertising purposes in CompleteOptions view state.', }, 'Advertising.description': { defaultMessage: 'Helps us and others serve ads relevant to you.',