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

Fixed issue 457 #472

Merged
merged 2 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions modules/core/src/encoder/SemanticPreEncoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,17 @@ export class SemanticPreEncoder {
/**
* Per June 2021 Policy change, Vendors declaring only Special Purposes must
* have their legitimate interest Vendor bit set if they have been disclosed.
* This empty block ensures their LI bit remains set
* This block ensures their LI bit remains set
*/

vector.set(vendorId);
} else if (gvlVendorKey === 'legIntPurposes' && vendor['purposes'].length > 0 && vendor['legIntPurposes'].length === 0 && vendor['specialPurposes'].length > 0
) {
/**
* Per June 2021 Policy change, Vendors declaring only Special Purposes must
* have their legitimate interest Vendor bit set if they have been disclosed.
* This block ensures their LI bit remains set
*/
vector.set(vendorId);
} else {

/**
Expand Down
28 changes: 28 additions & 0 deletions modules/core/test/TCString.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,17 @@ describe('TCString', (): void => {

});


// The next tests require that we use GVL tcf ver 2 and gvl version 51. If we update the tests to a newer GVL
// this test and the test against specific vendors that only set special purposes or only purposes and special
// purposes will need to be updated.
it('should use vendor list tcf ver 2 and gvl version 51', (): void => {
const gvl = getTCModel().gvl;

expect(gvl.gvlSpecificationVersion, `gvl.gvlSpecificationVersion === 2`).to.equal(2);
expect(gvl.vendorListVersion, `gvl.vendorListVersion == 51`).to.equal(51);
});

it('should add a segment to a model on decode if a model is passed in', (): void => {

const tcModel = getTCModel();
Expand Down Expand Up @@ -160,6 +171,10 @@ describe('TCString', (): void => {

expect(newModel.vendorLegitimateInterests.has(id), `vendorLegitimateInterests.has(${id})`).to.be.true;

} else if (vendor && vendor.purposes.length > 0 && vendor.specialPurposes.length > 0) {

expect(newModel.vendorLegitimateInterests.has(id), `vendorLegitimateInterests.has(${id})`).to.be.true;

} else {

expect(newModel.vendorLegitimateInterests.has(id), `vendorLegitimateInterests.has(${id})`).to.be.false;
Expand Down Expand Up @@ -196,6 +211,19 @@ describe('TCString', (): void => {

});

tcModel.vendorLegitimateInterests.forEach((value: boolean, id: number): void => {
// gvl spec ver 2, gvl ver 51: vendor ids 415, 612 and 615 have special purposes only declared. LI needs to be true
if ( (id === 415 || id === 612 || id === 615 ) && value ) {
expect(newModel.vendorLegitimateInterests.has(id), `vendorLegitimateInterestsForSpecialPurpose.has(${id})`).to.be.true;
}

// use case: The number of Vendors that have declared only purposes based on consent (no LI) + at least one SP
// sample set in v2-51: ids: 545, 553, 565, 570
if ( (id === 545 || id === 553 || id === 565 || id === 570) && value ) {
expect(newModel.vendorLegitimateInterests.has(id), `vendorConsentSetAndLegitimateInterestsForSpecialPurpose.has(${id})`).to.be.true;
}
});

TCString.decode(publisherTC, newModel);

tcModel.publisherConsents.forEach((value: boolean, id: number): void => {
Expand Down
Loading