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

Break out tcf URLs and dataRetention into their own codecs #96

Merged
merged 4 commits into from
Sep 15, 2023
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Transcend Inc.",
"name": "@transcend-io/airgap.js-types",
"description": "TypeScript types for airgap.js interoperability with custom consent UIs",
"version": "10.5.4",
"version": "10.5.5",
"homepage": "https://github.com/transcend-io/airgap.js-types",
"repository": {
"type": "git",
Expand Down
54 changes: 36 additions & 18 deletions src/iab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,40 @@ export const TcfGvlV3DataCategory = t.type({
export type TcfGvlV3DataCategory = t.TypeOf<typeof TcfGvlV3DataCategory>;

/**
* TCF GVL v3 stack configuration
* TCF GVL v3 URL configuration
*/
export const TcfGvlV3Url = t.intersection([
t.type({ langId: t.string, privacy: t.string }),
t.partial({
legIntClaim: t.string,
}),
]);

/**
* Type override
*/
export type TcfGvlV3Url = t.TypeOf<typeof TcfGvlV3Url>;

/**
* TCF GVL v3 data retention configuration
*/
export const TcfGvlV3DataRetention = t.intersection([
t.type({
purposes: t.record(t.string, t.number),
specialPurposes: t.record(t.string, t.number),
}),
t.partial({
stdRetention: t.number,
}),
]);

/**
* Type override
*/
export type TcfGvlV3DataRetention = t.TypeOf<typeof TcfGvlV3DataRetention>;

/**
* TCF GVL v3 vendor configuration
*/
export const TcfGvlV3Vendor = t.intersection([
t.type({
Expand All @@ -141,23 +174,8 @@ export const TcfGvlV3Vendor = t.intersection([
usesCookies: t.boolean,
cookieRefresh: t.boolean,
usesNonCookieAccess: t.boolean,
dataRetention: t.intersection([
t.type({
purposes: t.record(t.string, t.number),
specialPurposes: t.record(t.string, t.number),
}),
t.partial({
stdRetention: t.number,
}),
]),
urls: t.array(
t.intersection([
t.type({ langId: t.string, privacy: t.string }),
t.partial({
legIntClaim: t.string,
}),
]),
),
dataRetention: TcfGvlV3DataRetention,
urls: t.array(TcfGvlV3Url),
deviceStorageDisclosureUrl: t.string,
}),
t.partial({
Expand Down
Loading