Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PROD-2599 Update PC to support hierarchical consent notices + Update all types #5291

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b006c8a
PROD-2599 WIP
Aug 30, 2024
64f0204
PROD-2599 WIP
Sep 4, 2024
d5df3f5
PROD-2599 WIP
Sep 4, 2024
cd8ec89
PROD-2599 Add mock chile items. Organize files
Sep 5, 2024
b7f9924
PROD-2599 Adjust stylings
Sep 5, 2024
842ca1f
PROD-2599 Adjust responsive styles
Sep 5, 2024
36ecc9f
PROD-2599 Adjust responsive styles
Sep 5, 2024
92b2f6a
PROD-2599 Adjust responsive styles
Sep 5, 2024
cc788ed
PROD-2599 Styling improvements
Sep 9, 2024
7f656f7
PROD-2599 WIP
Sep 10, 2024
e20a28f
PROD-2599 WIP
Sep 10, 2024
e3b3662
Update all openapi models
Sep 10, 2024
16b1426
Fix updated types!
Sep 10, 2024
44da3dc
PROD-2599 WIP
Sep 11, 2024
6957636
PROD-2599 WIP
Sep 12, 2024
bba1a77
PROD-2599 Make child toggles work
Sep 16, 2024
e7bec7e
PROD-2599 Implement child/parent toggle behavior
Sep 16, 2024
779bd6d
PROD-2599 Implement child/parent toggle behavior
Sep 16, 2024
b8ac043
Add child notices to notices served
Sep 16, 2024
63539cc
PROD-2599 Update types
Sep 17, 2024
f310c9d
PROD-2599 Integrate translations to child consent items
Sep 17, 2024
215127b
Merge branch 'main' of github.com:ethyca/fides into PROD-2599-Privacy…
Sep 17, 2024
3897430
PROD-2599 Update types
Sep 17, 2024
8806bec
PROD-2599 Fix consent save for child notices. Simplify code.
Sep 17, 2024
ea70a9f
PROD-2599 Add cypress tests
Sep 18, 2024
9376b10
PROD-2599 Revert accidental removal of settings
Sep 18, 2024
b44643d
PROD-2599 Update changelog
Sep 18, 2024
a761a7a
PROD-2599 Remove unnecessary code
Sep 24, 2024
9d8ebc1
Merge branch 'main' of github.com:ethyca/fides into PROD-2599-Privacy…
Sep 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ The types of changes are:
- Ignore `400` errors from Talkable's `person` endpoint. [#5317](https://github.com/ethyca/fides/pull/5317)
- Fix Email Connector logs so they use configuration key instead of name [#5286](https://github.com/ethyca/fides/pull/5286)

### Added
- Added support for hierarchical notices in Privacy Center [#5291](https://github.com/ethyca/fides/pull/5291)


## [2.45.2](https://github.com/ethyca/fides/compare/2.45.1...2.45.2)

### Fixed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ConsentContext } from "fides-js";

import { makeNoticeConsent } from "~/features/consent/helpers";
import { ConfigConsentOption } from "~/types/config";
import { ConfigConsentOption } from "~/types/api";

describe("makeNoticeConsent", () => {
// Some display options don't matter for these tests.
Expand Down
17 changes: 15 additions & 2 deletions clients/privacy-center/common/hooks/useI18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
} from "fides-js";
import { useCallback, useContext } from "react";

import { ExperienceConfigResponseNoNotices } from "~/types/api";

import { I18nContext } from "../i18nContext";

const useI18n = () => {
Expand All @@ -18,12 +20,23 @@ const useI18n = () => {

// Useful wrapper for selectBestExperienceConfigTranslation
const selectExperienceConfigTranslation = useCallback(
(experienceConfig: ExperienceConfig | undefined) => {
(
experienceConfig:
| ExperienceConfig
| ExperienceConfigResponseNoNotices
| undefined,
) => {
if (!experienceConfig) {
throw new Error("ExperienceConfig must be defined");
}

const experienceConfigTransalation =
selectBestExperienceConfigTranslation(i18n, experienceConfig);
selectBestExperienceConfigTranslation(
i18n,
// DEFER (PROD-2737) remove type casting
experienceConfig as ExperienceConfig,
);

if (!experienceConfigTransalation) {
throw new Error("Coudln't find correct experience config translation");
}
Expand Down
2 changes: 1 addition & 1 deletion clients/privacy-center/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Layout = ({ children }: { children: ReactNode }) => {
justifyContent="center"
alignItems="center"
>
<Logo src={config.logo_path} href={config.logo_url} />
<Logo src={config.logo_path ?? ""} href={config.logo_url ?? ""} />
</Flex>
</header>
<div>{children}</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const ConfigDrivenConsent = ({
});
const consent = consentOptions.map((option) => {
const defaultValue = resolveLegacyConsentValue(
option.default,
option.default!,
consentContext,
);
const value = fidesKeyToConsent[option.fidesDataUseKey] ?? defaultValue;
Expand Down Expand Up @@ -161,7 +161,7 @@ const ConfigDrivenConsent = ({
() =>
consentOptions.map((option) => {
const defaultValue = resolveLegacyConsentValue(
option.default,
option.default!,
consentContext,
);
const value = fidesKeyToConsent[option.fidesDataUseKey] ?? defaultValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { selectIsNoticeDriven } from "~/features/common/settings.slice";

const TEXT_PROPS: TextProps = {
fontSize: ["small", "medium"],
fontWeight: "medium",
fontWeight: "normal",
maxWidth: 624,
textAlign: "center",
color: "gray.600",
Expand Down
3 changes: 2 additions & 1 deletion clients/privacy-center/components/consent/ConsentHeading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ const ConsentHeading = () => {
<Heading
fontSize={["3xl", "4xl"]}
color="gray.600"
fontWeight="semibold"
fontWeight="medium"
textAlign="center"
data-testid="consent-heading"
mb={3}
>
{headingText}
</Heading>
Expand Down
2 changes: 1 addition & 1 deletion clients/privacy-center/components/consent/ConsentItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type ConsentItemProps = {
id: string;
name: string;
description: string;
highlight?: boolean;
highlight?: boolean | null;
url?: string;
value: boolean;
gpcStatus: GpcStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useSettings } from "~/features/common/settings.slice";
import { ConsentPreferences } from "~/types/api";

import ConfigDrivenConsent from "./ConfigDrivenConsent";
import NoticeDrivenConsent from "./NoticeDrivenConsent";
import NoticeDrivenConsent from "./notice-driven/NoticeDrivenConsent";

const ConsentToggles = ({
storePreferences,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const PrivacyPolicyLink = ({
if (!label || !url) {
return null;
}

return (
<Link
href={url}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Flex, Text } from "fidesui";

import Toggle from "../Toggle";

interface ConsentChildItemProps {
id: string;
title: string;
value: boolean;
onChange: (value: boolean) => void;
isDisabled?: boolean;
}
const ConsentChildItem = ({
id,
title,
value,
onChange,
isDisabled,
}: ConsentChildItemProps) => (
<Flex justifyContent="space-between" alignItems="center" pl={0} py={1}>
<Text fontSize={16}>{title}</Text>
<Toggle
label={title}
name={id}
id={id}
disabled={isDisabled}
checked={value}
onChange={() => onChange(!value)}
/>
</Flex>
);
export default ConsentChildItem;
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import { GpcStatus } from "fides-js";
import {
AccordionButton,
AccordionIcon,
AccordionItem,
AccordionPanel,
Box,
Flex,
Text,
} from "fidesui";
import React from "react";

import { GpcBadge, GpcInfo } from "~/features/consent/GpcMessages";

import Toggle from "../Toggle";

export type ConsentItemAccordionProps = {
id: string;
title: string;
description: string;
value: boolean;
gpcStatus: GpcStatus;
onChange: (value: boolean) => void;
disabled?: boolean;
children?: React.ReactNode;
};

const ConsentItemAccordion = ({
id,
title,
description,
value,
gpcStatus,
onChange,
disabled,
children,
}: ConsentItemAccordionProps) => (
<AccordionItem
data-testid={`consent-item-${id}`}
width="full"
_hover={{ bgColor: "gray.100" }}
>
<AccordionButton pl={2} py={2.5} _hover={{ bgColor: "gray.100" }}>
<Flex justifyContent="space-between" alignItems="center" width="full">
<Flex alignItems="center">
<AccordionIcon fontSize={26} />
<Text
fontSize="lg"
fontWeight="medium"
color="gray.600"
ml={1}
mb="4px"
>
{title}
</Text>
</Flex>
<Flex alignItems="center">
<Box display={{ base: "none", sm: "block" }}>
<GpcBadge status={gpcStatus} />
</Box>
<Flex ml={2} onClick={(e) => e.stopPropagation()}>
<Toggle
label={title}
name={id}
id={id}
disabled={disabled}
checked={value}
onChange={() => onChange(!value)}
/>
</Flex>
</Flex>
</Flex>
</AccordionButton>
<AccordionPanel>
<Box>
<Flex
justifyContent="flex-start"
mb={2}
display={{ base: "block", sm: "none" }}
>
<GpcBadge status={gpcStatus} />
</Flex>

<GpcInfo status={gpcStatus} />
<Text
fontSize="sm"
fontWeight="medium"
color="gray.600"
mb="2px"
pr={[0, 8]}
pl={6}
>
{description}
</Text>

<Box pl={6}>{children}</Box>
</Box>
</AccordionPanel>
</AccordionItem>
);

export default ConsentItemAccordion;
Loading
Loading