Skip to content

Commit 36280ec

Browse files
committed
Fix Vendor list logic (#6830)
Restore isConsent to LI (#6840)
1 parent 7ce5927 commit 36280ec

File tree

3 files changed

+92
-35
lines changed

3 files changed

+92
-35
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Changes can also be flagged with a GitHub label for tracking purposes. The URL o
5151
- Fixed a bug where the "Request manager" navigation item wouldn't return users to the main request view [#6814](https://github.com/ethyca/fides/pull/6814)
5252
- Fixed incorrect positioning on "Add system" button on system inventory page when Compass was disabled [#6812](https://github.com/ethyca/fides/pull/6812)
5353
- Fixed missing reference value validation in SaaS requests to apply to all access requests [#6782](https://github.com/ethyca/fides/pull/6782)
54+
- Fixed an issue where some Special purpose vendors were displaying incorrectly in the TCF modal [#6830](https://github.com/ethyca/fides/pull/6830)
5455

5556
### Changed
5657
- Switch to use `classify_params.llm_model_override` instead of `classify_params.model_override` in monitor config form [#6805](https://github.com/ethyca/fides/pull/6805)

clients/fides-js/src/components/tcf/TcfVendors.tsx

Lines changed: 89 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,13 @@ const ToggleChild = ({
244244
};
245245

246246
const PagedVendorData = ({
247+
activeTab,
247248
experience,
248249
vendors,
249250
enabledIds,
250251
onChange,
251252
}: {
253+
activeTab: string;
252254
experience: PrivacyExperience;
253255
vendors: VendorRecord[];
254256
enabledIds: string[];
@@ -258,22 +260,23 @@ const PagedVendorData = ({
258260
const { activeChunk, ...paging } = usePaging(vendors);
259261

260262
const {
261-
gvlVendors,
262-
specialPurposeOnlyGvlVendors,
263-
otherVendors,
263+
consentGvlVendors,
264+
legintGvlVendors,
265+
specialPurposeGvlVendors,
266+
nonGVLVendors,
264267
}: {
265-
gvlVendors: VendorRecord[];
266-
specialPurposeOnlyGvlVendors: VendorRecord[];
267-
otherVendors: VendorRecord[];
268+
consentGvlVendors: VendorRecord[];
269+
legintGvlVendors: VendorRecord[];
270+
specialPurposeGvlVendors: VendorRecord[];
271+
nonGVLVendors: VendorRecord[];
268272
} = useMemo(
269273
() => ({
270-
gvlVendors: activeChunk?.filter(
271-
(v) => v.isGvl && (v.isConsent || v.isLegint),
274+
nonGVLVendors: activeChunk?.filter((v) => !v.isGvl),
275+
consentGvlVendors: activeChunk?.filter((v) => v.isGvl && v.isConsent),
276+
legintGvlVendors: activeChunk?.filter((v) => v.isGvl && v.isLegint),
277+
specialPurposeGvlVendors: activeChunk?.filter(
278+
(v) => v.isGvl && v.isSpecial && !v.isLegint,
272279
),
273-
specialPurposeOnlyGvlVendors: activeChunk?.filter(
274-
(v) => v.isGvl && v.isSpecial && !v.isConsent && !v.isLegint,
275-
),
276-
otherVendors: activeChunk?.filter((v) => !v.isGvl),
277280
}),
278281
[activeChunk],
279282
);
@@ -282,13 +285,67 @@ const PagedVendorData = ({
282285
return null;
283286
}
284287

288+
if (activeTab === LegalBasisEnum.LEGITIMATE_INTERESTS.toString()) {
289+
return (
290+
<Fragment>
291+
{legintGvlVendors.length > 0 && (
292+
<RecordsList<VendorRecord>
293+
type="vendors"
294+
title={i18n.t("static.tcf.vendors.iab")}
295+
items={legintGvlVendors}
296+
enabledIds={enabledIds}
297+
onToggle={onChange}
298+
renderBadgeLabel={(vendor) =>
299+
vendorGvlEntry(vendor.id, experience.gvl)
300+
? "IAB TCF" // NOTE: As this is the proper name of the standard, it should not be localized!
301+
: undefined
302+
}
303+
renderDropdownChild={(vendor) => (
304+
<ToggleChild vendor={vendor} experience={experience} />
305+
)}
306+
/>
307+
)}
308+
{specialPurposeGvlVendors.length > 0 && (
309+
<RecordsList<VendorRecord>
310+
type="vendors"
311+
title={i18n.t("static.tcf.special_purposes")}
312+
items={specialPurposeGvlVendors}
313+
enabledIds={[]}
314+
renderBadgeLabel={(vendor) =>
315+
vendorGvlEntry(vendor.id, experience.gvl)
316+
? "IAB TCF" // NOTE: As this is the proper name of the standard, it should not be localized!
317+
: undefined
318+
}
319+
renderDropdownChild={(vendor) => (
320+
<ToggleChild vendor={vendor} experience={experience} />
321+
)}
322+
hideToggles
323+
/>
324+
)}
325+
{nonGVLVendors.length > 0 && (
326+
<RecordsList<VendorRecord>
327+
type="vendors"
328+
title={i18n.t("static.tcf.vendors.other")}
329+
items={nonGVLVendors}
330+
enabledIds={enabledIds}
331+
onToggle={onChange}
332+
renderDropdownChild={(vendor) => (
333+
<ToggleChild vendor={vendor} experience={experience} />
334+
)}
335+
/>
336+
)}
337+
<PagingButtons {...paging} />
338+
</Fragment>
339+
);
340+
}
341+
285342
return (
286343
<Fragment>
287-
{gvlVendors.length > 0 && (
344+
{consentGvlVendors.length > 0 && (
288345
<RecordsList<VendorRecord>
289346
type="vendors"
290347
title={i18n.t("static.tcf.vendors.iab")}
291-
items={gvlVendors}
348+
items={consentGvlVendors}
292349
enabledIds={enabledIds}
293350
onToggle={onChange}
294351
renderBadgeLabel={(vendor) =>
@@ -301,28 +358,11 @@ const PagedVendorData = ({
301358
)}
302359
/>
303360
)}
304-
{specialPurposeOnlyGvlVendors.length > 0 && (
305-
<RecordsList<VendorRecord>
306-
type="vendors"
307-
title={i18n.t("static.tcf.special_purposes")}
308-
items={specialPurposeOnlyGvlVendors}
309-
enabledIds={[]}
310-
renderBadgeLabel={(vendor) =>
311-
vendorGvlEntry(vendor.id, experience.gvl)
312-
? "IAB TCF" // NOTE: As this is the proper name of the standard, it should not be localized!
313-
: undefined
314-
}
315-
renderDropdownChild={(vendor) => (
316-
<ToggleChild vendor={vendor} experience={experience} />
317-
)}
318-
hideToggles
319-
/>
320-
)}
321-
{otherVendors.length > 0 && (
361+
{nonGVLVendors.length > 0 && (
322362
<RecordsList<VendorRecord>
323363
type="vendors"
324364
title={i18n.t("static.tcf.vendors.other")}
325-
items={otherVendors}
365+
items={nonGVLVendors}
326366
enabledIds={enabledIds}
327367
onToggle={onChange}
328368
renderDropdownChild={(vendor) => (
@@ -366,6 +406,21 @@ const TcfVendors = ({
366406
activeLegalBasisOption.value === LegalBasisEnum.CONSENT.toString()
367407
? vendors.filter((v) => v.isConsent)
368408
: vendors.filter((v) => v.isLegint || v.isSpecial);
409+
if (
410+
activeLegalBasisOption.value ===
411+
LegalBasisEnum.LEGITIMATE_INTERESTS.toString()
412+
) {
413+
// sort by isLegint first, then isSpecial
414+
legalBasisFiltered.sort((a, b) => {
415+
if (a.isLegint && !b.isLegint) {
416+
return -1;
417+
}
418+
if (!a.isLegint && b.isLegint) {
419+
return 1;
420+
}
421+
return 0;
422+
});
423+
}
369424
// Put "other vendors" last in the list
370425
return [
371426
...legalBasisFiltered.filter((v) => v.isGvl),
@@ -381,6 +436,7 @@ const TcfVendors = ({
381436
onChange={setActiveLegalBasisOption}
382437
/>
383438
<PagedVendorData
439+
activeTab={activeLegalBasisOption.value}
384440
experience={experience}
385441
vendors={filteredVendors}
386442
enabledIds={

clients/privacy-center/cypress/e2e/fides-js/consent-banner-tcf.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,8 +1104,8 @@ describe("Fides-js TCF", () => {
11041104
cy.get("input").should("be.checked");
11051105
});
11061106
cy.get("button").contains("Legitimate interest").click();
1107-
cy.getByTestId(`toggle-${VENDOR_1.name}`).within(() => {
1108-
cy.get("input").should("not.be.checked");
1107+
cy.getByTestId(`toggle-${SYSTEM_1.name}`).within(() => {
1108+
cy.get("input").should("be.checked");
11091109
});
11101110
});
11111111
cy.get("@FidesUIChanged").should("have.been.calledOnce");

0 commit comments

Comments
 (0)