Skip to content

Commit

Permalink
fix precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
kate-kazantseva committed Oct 25, 2024
1 parent 395c9bb commit 97dab73
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
27 changes: 14 additions & 13 deletions src/hooks/useGetInvertedPurposeMessageKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, DefinedMessage>,
),
Expand Down
11 changes: 6 additions & 5 deletions src/hooks/useGetPurposeDescriptionKeys.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -25,7 +23,8 @@ export const useGetPurposeDescriptionKeys = ({
const purposeToDescriptionKey: Record<string, DefinedMessage> = 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) {
Expand All @@ -40,7 +39,9 @@ export const useGetPurposeDescriptionKeys = ({
};
}
return {...allMessages};
}, defaultPurposeToDescriptionKey as Record<string, DefinedMessage>),
},
defaultPurposeToDescriptionKey as Record<string, DefinedMessage>,
),
[consentSelection, defaultPurposeToDescriptionKey],
);

Expand Down
6 changes: 2 additions & 4 deletions src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand All @@ -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.',
Expand Down

0 comments on commit 97dab73

Please sign in to comment.