Skip to content

Commit

Permalink
fix precommit (#194)
Browse files Browse the repository at this point in the history
* fix precommit

* prettier
  • Loading branch information
kate-kazantseva authored Oct 25, 2024
1 parent 395c9bb commit 5b9fe65
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 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
13 changes: 7 additions & 6 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 @@ -39,8 +38,10 @@ export const useGetPurposeDescriptionKeys = ({
} as DefinedMessage,
};
}
return {...allMessages};
}, defaultPurposeToDescriptionKey as Record<string, DefinedMessage>),
return { ...allMessages };
},
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 5b9fe65

Please sign in to comment.