From c48ca303ddb04f116233baadf45c73bb6edee259 Mon Sep 17 00:00:00 2001 From: anotherminh Date: Mon, 18 Dec 2023 17:14:39 -0500 Subject: [PATCH] Fix labels for CompleteOptionsInverted (#153) * Fix CompleteOptionsInverted * Fix labels for CompleteOptionsInverted * pretty * rm console --- package.json | 2 +- src/components/CompleteOptionsInverted.tsx | 7 +++++-- src/components/constants.ts | 16 +++++++++++++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 34231629..63989f59 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "url": "https://github.com/transcend-io/consent-manager-ui.git" }, "homepage": "https://github.com/transcend-io/consent-manager-ui", - "version": "4.11.0", + "version": "4.11.1", "license": "MIT", "main": "build/ui", "files": [ diff --git a/src/components/CompleteOptionsInverted.tsx b/src/components/CompleteOptionsInverted.tsx index de4da612..4cc7e1c9 100644 --- a/src/components/CompleteOptionsInverted.tsx +++ b/src/components/CompleteOptionsInverted.tsx @@ -13,7 +13,10 @@ import { Button } from './Button'; import { GPCIndicator } from './GPCIndicator'; import { Toggle } from './Toggle'; import { CONSENT_OPTIONS } from '../constants'; -import { DEFAULT_PURPOSE_TO_MESSAGE_KEY, ORDER_OF_PURPOSES } from './constants'; +import { + DEFAULT_PURPOSE_TO_INVERTED_MESSAGE_KEY, + ORDER_OF_PURPOSES, +} from './constants'; /** * The model view where checking each checkbox represents an opt otu @@ -31,7 +34,7 @@ export function CompleteOptionsInverted({ const initialConsentSelections = getConsentSelections(airgap); const purposeToMessageKey = useGetPurposeMessageKeys({ consentSelection: initialConsentSelections, - defaultPurposeToMessageKey: DEFAULT_PURPOSE_TO_MESSAGE_KEY, + defaultPurposeToMessageKey: DEFAULT_PURPOSE_TO_INVERTED_MESSAGE_KEY, }); // Set state on the currently selected toggles diff --git a/src/components/constants.ts b/src/components/constants.ts index 00f33cfb..83dab18e 100644 --- a/src/components/constants.ts +++ b/src/components/constants.ts @@ -1,5 +1,8 @@ import { DefinedMessage } from '@transcend-io/internationalization'; -import { completeOptionsMessages } from '../messages'; +import { + completeOptionsMessages, + completeOptionsInvertedMessages, +} from '../messages'; // Mapping of purposes to the message translation key export const DEFAULT_PURPOSE_TO_MESSAGE_KEY: Record = { @@ -10,5 +13,16 @@ export const DEFAULT_PURPOSE_TO_MESSAGE_KEY: Record = { SaleOfInfo: completeOptionsMessages.saleOfInfoLabel, }; +export const DEFAULT_PURPOSE_TO_INVERTED_MESSAGE_KEY: Record< + string, + DefinedMessage +> = { + Essential: completeOptionsMessages.essentialLabel, + Functional: completeOptionsInvertedMessages.functionalLabel, + Analytics: completeOptionsInvertedMessages.analyticsLabel, + Advertising: completeOptionsInvertedMessages.advertisingLabel, + SaleOfInfo: completeOptionsInvertedMessages.saleOfInfoLabel, +}; + // Encode the default purpose ordering export const ORDER_OF_PURPOSES = Object.keys(DEFAULT_PURPOSE_TO_MESSAGE_KEY);