Skip to content

Commit 4f2b9d0

Browse files
Adds and supports new experience config to delete cookie based on host domain (#6706)
1 parent aa604b2 commit 4f2b9d0

37 files changed

+175
-9
lines changed

.fides/db_dataset.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,6 +1475,8 @@ dataset:
14751475
data_categories: [ system.operations ]
14761476
- name: auto_subdomain_cookie_deletion
14771477
data_categories: [ system.operations ]
1478+
- name: cookie_deletion_based_on_host_domain
1479+
data_categories: [ system.operations ]
14781480
- name: id
14791481
data_categories: [system.operations]
14801482
- name: name
@@ -1526,6 +1528,8 @@ dataset:
15261528
data_categories: [ system.operations ]
15271529
- name: auto_subdomain_cookie_deletion
15281530
data_categories: [ system.operations ]
1531+
- name: cookie_deletion_based_on_host_domain
1532+
data_categories: [ system.operations ]
15291533
- name: id
15301534
data_categories: [system.operations]
15311535
- name: is_default
@@ -2438,6 +2442,8 @@ dataset:
24382442
data_categories: [ system.operations ]
24392443
- name: auto_subdomain_cookie_deletion
24402444
data_categories: [ system.operations ]
2445+
- name: cookie_deletion_based_on_host_domain
2446+
data_categories: [ system.operations ]
24412447
- name: id
24422448
data_categories: [system.operations]
24432449
- name: name

clients/admin-ui/cypress/e2e/privacy-experience/experience-editor.cy.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ describe("Experience editor", () => {
4747
allow_language_selection: false,
4848
auto_detect_language: true,
4949
auto_subdomain_cookie_deletion: true,
50+
cookie_deletion_based_on_host_domain: true,
5051
allow_vendor_asset_disclosure: false,
5152
component: "banner_and_modal",
5253
disabled: true,

clients/admin-ui/cypress/e2e/privacy-experiences.cy.ts

Whitespace-only changes.

clients/admin-ui/cypress/fixtures/privacy-experiences/experienceConfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"allow_language_selection": false,
88
"auto_detect_language": true,
99
"auto_subdomain_cookie_deletion": true,
10+
"cookie_deletion_based_on_host_domain": true,
1011
"regions": ["us_ca", "us_co", "us_ct", "us_ut", "us_va"],
1112
"id": "pri_001",
1213
"created_at": "2024-03-22T20:06:27.119285+00:00",

clients/admin-ui/cypress/fixtures/privacy-experiences/tcf-experience.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"allow_language_selection": true,
88
"auto_detect_language": true,
99
"auto_subdomain_cookie_deletion": true,
10+
"cookie_deletion_based_on_host_domain": true,
1011
"regions": [
1112
"be",
1213
"bg",

clients/admin-ui/src/features/common/form/inputs.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,11 @@ interface CustomSwitchProps {
375375
isDisabled?: boolean;
376376
onChange?: (checked: boolean) => void;
377377
className?: string;
378+
/**
379+
* When provided, the switch will render with this checked state instead of the Formik-managed value.
380+
* Useful for read-only or UI-only switches that shouldn't be toggleable.
381+
*/
382+
checkedOverride?: boolean;
378383
}
379384
export const CustomSwitch = ({
380385
label,
@@ -383,6 +388,7 @@ export const CustomSwitch = ({
383388
size = "small",
384389
onChange,
385390
isDisabled,
391+
checkedOverride,
386392
...props
387393
}: CustomSwitchProps & Omit<FieldHookConfig<boolean>, "onChange">) => {
388394
const [field, meta] = useField({
@@ -395,7 +401,7 @@ export const CustomSwitch = ({
395401
<Field name={field.name}>
396402
{({ form: { setFieldValue } }: FieldProps) => (
397403
<Switch
398-
checked={field.checked}
404+
checked={checkedOverride ?? field.checked}
399405
onChange={(v) => {
400406
setFieldValue(field.name, v);
401407
onChange?.(v);
@@ -443,7 +449,7 @@ export const CustomSwitch = ({
443449
return (
444450
<FormControl isInvalid={isInvalid} width="full">
445451
<Box display="flex" alignItems="center" justifyContent="space-between">
446-
<HStack spacing={1}>
452+
<HStack spacing={1} mr={1}>
447453
<Label htmlFor={props.id || props.name} fontSize="xs" my={0} mr={0}>
448454
{label}
449455
</Label>

clients/admin-ui/src/features/privacy-experience/PrivacyExperienceForm.tsx

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
Divider,
88
Flex,
99
formatIsoLocation,
10+
FormLabel,
1011
Heading,
1112
isoStringToEntry,
1213
Text,
@@ -635,12 +636,35 @@ export const PrivacyExperienceForm = ({
635636
]}
636637
/>
637638
</Collapse>
639+
<Divider />
640+
<Heading fontSize="md" fontWeight="semibold">
641+
Cookie Deletion
642+
</Heading>
643+
<FormLabel htmlFor="regions" fontSize="xs" my={0} mr={1}>
644+
Delete rejected cookies on:
645+
</FormLabel>
646+
<CustomSwitch
647+
name="cookie_deletion_based_on_host_domain"
648+
id="cookie_deletion_based_on_host_domain"
649+
label="Host's domain"
650+
variant="stacked"
651+
tooltip="If enabled, deletes user-rejected cookies on the current host domain regardless of the cookie's configured domain. Recommended to enable for ease of consent compliance."
652+
/>
638653
<CustomSwitch
639654
name="auto_subdomain_cookie_deletion"
640655
id="auto_subdomain_cookie_deletion"
641-
label="Automatically delete subdomain cookies"
656+
label="Host's subdomain"
657+
variant="stacked"
658+
tooltip="If enabled, deletes user-rejected cookies on subdomains in addition to main domain. Recommended to enable for full consent compliance."
659+
/>
660+
<CustomSwitch
661+
name="configured_domain_cookie_deletion"
662+
id="configured_domain_cookie_deletion"
663+
label="Configured domain"
642664
variant="stacked"
643-
tooltip="If enabled, automatically deletes cookies set on subdomains in addition to main domain where appropriate. Recommended to enable for full consent compliance."
665+
tooltip="Deletes cookies using the cookie's configured domain. This is enabled by default and not configurable in the admin UI."
666+
isDisabled
667+
checkedOverride
644668
/>
645669
</PrivacyExperienceConfigColumnLayout>
646670
);

clients/admin-ui/src/features/privacy-experience/form/helpers.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export const defaultInitialValues: Omit<ExperienceConfigCreate, "component"> = {
5252
translations: defaultTranslations,
5353
auto_detect_language: true,
5454
auto_subdomain_cookie_deletion: true,
55+
cookie_deletion_based_on_host_domain: true,
5556
allow_vendor_asset_disclosure: false,
5657
asset_disclosure_include_types: [],
5758
};

clients/admin-ui/src/features/privacy-experience/preview/helpers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export const buildBaseConfig = (
6969
allow_language_selection: true,
7070
auto_detect_language: true,
7171
auto_subdomain_cookie_deletion: true,
72+
cookie_deletion_based_on_host_domain: true,
7273
component: experienceConfig.component,
7374
disabled: false,
7475
dismissable: experienceConfig.dismissable,

clients/admin-ui/src/types/api/models/ExperienceConfigCreate.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export type ExperienceConfigCreate = {
2323
allow_language_selection?: boolean | null;
2424
auto_detect_language?: boolean | null;
2525
auto_subdomain_cookie_deletion?: boolean | null;
26+
cookie_deletion_based_on_host_domain?: boolean | null;
2627
/** Enable Vendor / Asset Disclosure */
2728
allow_vendor_asset_disclosure?: boolean | null;
2829
/** Asset types to disclose */

0 commit comments

Comments
 (0)