Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#71479 Update type for Usercentrics Browser…
Browse files Browse the repository at this point in the history
… UI by @coltmans

Co-authored-by: Steven Coltman <steven.coltman@hess-natur.de>
Co-authored-by: Flo Edelmann <git@flo-edelmann.de>
  • Loading branch information
3 people authored Dec 20, 2024
1 parent 91d66c2 commit 9a869f9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
9 changes: 7 additions & 2 deletions types/usercentrics-browser-ui/integration-interfaces.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ export interface BaseTCFUserDecision {
/** Indicates if the user gave consent (true) or denied consent (false) */
consent?: boolean;

/** The id of the purpose/vendor the consent decision belongs to */
id: number;
/**
* The id of the purpose/vendor the consent decision belongs to.
* Note: Different pages in the Usercentrics docs disagree on the type, so both are allowed:
* https://usercentrics.com/docs/web/implementation/ui/interfaces/#basetcfuserdecision (number)
* https://usercentrics.com/docs/web/features/api/control-functionality/#updatecategoriesconsents (string)
*/
id: number | string;
}

/**
Expand Down
14 changes: 14 additions & 0 deletions types/usercentrics-browser-ui/usercentrics-browser-ui-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,18 @@ async function getConsentSettingsFromUsercentrics() {

// $ExpectType boolean
await window._ucCmp.isConsentRequired();

/*
Adding serviceConsents example data from the docs and one with id of type number
Note: Different pages in the Usercentrics docs disagree on the type, so both are allowed:
https://usercentrics.com/docs/web/implementation/ui/interfaces/#basetcfuserdecision (number)
https://usercentrics.com/docs/web/features/api/control-functionality/#updatecategoriesconsents (string)
*/
const serviceConsents = [
{ id: "HkocEodjb7", consent: true },
{ id: "S1_9Vsuj-Q", consent: false },
{ id: 12345567, consent: false },
];

await window._ucCmp.updateServicesConsents(serviceConsents);
}

0 comments on commit 9a869f9

Please sign in to comment.