Skip to content

Commit

Permalink
Merge b44643d into 31bc63a
Browse files Browse the repository at this point in the history
  • Loading branch information
lucanovera authored Sep 18, 2024
2 parents 31bc63a + b44643d commit 3a39c33
Show file tree
Hide file tree
Showing 484 changed files with 9,534 additions and 622 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ The types of changes are:
- Add ability to edit dataset YAML from dataset view [#5262](https://github.com/ethyca/fides/pull/5262)
- Added support for "in progress" status in classification [#5248](https://github.com/ethyca/fides/pull/5248)
- Clarify GCP service account permissions when setting up Google Cloud SQL for Postgres in Admin-UI [#5245](https://github.com/ethyca/fides/pull/5266)
- Added support for hierarchical notices in Privacy Center [#5291](https://github.com/ethyca/fides/pull/5291)


### Changed
- Validate no path in `server_host` var for CLI config; if there is one then take only up until the first forward slash
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 @@ -14,6 +14,10 @@ const PrivacyPolicyLink = ({
return null;
}

if (experience.experience_config === null) {
return null;
}

const experienceConfigTranslation = selectExperienceConfigTranslation(
experience.experience_config,
);
Expand All @@ -23,6 +27,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

0 comments on commit 3a39c33

Please sign in to comment.