@financial-times/cmp-client 0.0.0-backup.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +273 -0
- package/dist/index.cjs +862 -0
- package/dist/index.js +862 -0
- package/dist/scripts/cmp-static.js +8 -0
- package/dist/src/__tests__/index.test.d.ts +2 -0
- package/dist/src/__tests__/index.test.d.ts.map +1 -0
- package/dist/src/client.d.ts +3 -0
- package/dist/src/client.d.ts.map +1 -0
- package/dist/src/consent-parsers/__fixtures__/gpp.d.ts +20 -0
- package/dist/src/consent-parsers/__fixtures__/gpp.d.ts.map +1 -0
- package/dist/src/consent-parsers/__tests__/index.test.d.ts +2 -0
- package/dist/src/consent-parsers/__tests__/index.test.d.ts.map +1 -0
- package/dist/src/consent-parsers/gpp/__tests__/parse-gpp-consent.test.d.ts +2 -0
- package/dist/src/consent-parsers/gpp/__tests__/parse-gpp-consent.test.d.ts.map +1 -0
- package/dist/src/consent-parsers/gpp/index.d.ts +3 -0
- package/dist/src/consent-parsers/gpp/index.d.ts.map +1 -0
- package/dist/src/consent-parsers/index.d.ts +6 -0
- package/dist/src/consent-parsers/index.d.ts.map +1 -0
- package/dist/src/consent-parsers/tcfv2/__tests__/check-consent.test.d.ts +2 -0
- package/dist/src/consent-parsers/tcfv2/__tests__/check-consent.test.d.ts.map +1 -0
- package/dist/src/consent-parsers/tcfv2/index.d.ts +10 -0
- package/dist/src/consent-parsers/tcfv2/index.d.ts.map +1 -0
- package/dist/src/consent-ready/index.d.ts +5 -0
- package/dist/src/consent-ready/index.d.ts.map +1 -0
- package/dist/src/consent-ready/utils/__fixtures__/helpers.d.ts +28 -0
- package/dist/src/consent-ready/utils/__fixtures__/helpers.d.ts.map +1 -0
- package/dist/src/consent-ready/utils/__fixtures__/strings.d.ts +5 -0
- package/dist/src/consent-ready/utils/__fixtures__/strings.d.ts.map +1 -0
- package/dist/src/consent-ready/utils/__tests__/consent.test.d.ts +2 -0
- package/dist/src/consent-ready/utils/__tests__/consent.test.d.ts.map +1 -0
- package/dist/src/consent-ready/utils/__tests__/validators.test.d.ts +2 -0
- package/dist/src/consent-ready/utils/__tests__/validators.test.d.ts.map +1 -0
- package/dist/src/consent-ready/utils/consent.d.ts +6 -0
- package/dist/src/consent-ready/utils/consent.d.ts.map +1 -0
- package/dist/src/consent-ready/utils/get-consent-payload.d.ts +18 -0
- package/dist/src/consent-ready/utils/get-consent-payload.d.ts.map +1 -0
- package/dist/src/consent-ready/utils/validators.d.ts +15 -0
- package/dist/src/consent-ready/utils/validators.d.ts.map +1 -0
- package/dist/src/html/__tests__/cmp-manage-cookies-links.test.d.ts +2 -0
- package/dist/src/html/__tests__/cmp-manage-cookies-links.test.d.ts.map +1 -0
- package/dist/src/html/__tests__/cmp-scripts.test.d.ts +2 -0
- package/dist/src/html/__tests__/cmp-scripts.test.d.ts.map +1 -0
- package/dist/src/html/cmp-manage-cookies-link.d.ts +8 -0
- package/dist/src/html/cmp-manage-cookies-link.d.ts.map +1 -0
- package/dist/src/html/cmp-scripts.d.ts +7 -0
- package/dist/src/html/cmp-scripts.d.ts.map +1 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/lib/configurators/ft-dot-com.d.ts +7 -0
- package/dist/src/lib/configurators/ft-dot-com.d.ts.map +1 -0
- package/dist/src/lib/configurators/index.d.ts +14 -0
- package/dist/src/lib/configurators/index.d.ts.map +1 -0
- package/dist/src/lib/constants.d.ts +40 -0
- package/dist/src/lib/constants.d.ts.map +1 -0
- package/dist/src/lib/debug.d.ts +15 -0
- package/dist/src/lib/debug.d.ts.map +1 -0
- package/dist/src/lib/properties.d.ts +132 -0
- package/dist/src/lib/properties.d.ts.map +1 -0
- package/dist/src/scripts/cmp-static.d.ts +3 -0
- package/dist/src/scripts/cmp-static.d.ts.map +1 -0
- package/dist/src/tracking/__tests__/state.test.d.ts +2 -0
- package/dist/src/tracking/__tests__/state.test.d.ts.map +1 -0
- package/dist/src/tracking/constants.d.ts +3 -0
- package/dist/src/tracking/constants.d.ts.map +1 -0
- package/dist/src/tracking/index.d.ts +3 -0
- package/dist/src/tracking/index.d.ts.map +1 -0
- package/dist/src/tracking/state.d.ts +15 -0
- package/dist/src/tracking/state.d.ts.map +1 -0
- package/dist/src/utils/__tests__/url.test.d.ts +2 -0
- package/dist/src/utils/__tests__/url.test.d.ts.map +1 -0
- package/dist/src/utils/dom.d.ts +3 -0
- package/dist/src/utils/dom.d.ts.map +1 -0
- package/dist/src/utils/url.d.ts +127 -0
- package/dist/src/utils/url.d.ts.map +1 -0
- package/package.json +42 -0
- package/typings/globals.d.ts +20 -0
- package/typings/modules.d.ts +1 -0
- package/typings/types.d.ts +280 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function to check if a provided hostname contains a particular root domain
|
|
3
|
+
* This will help us determine the correct property config for the current window.location
|
|
4
|
+
* @param hostname Current hostname
|
|
5
|
+
* @param rootDomain Root domain to validate against
|
|
6
|
+
*/
|
|
7
|
+
export declare function containsRootDomain(hostname: string, rootDomain: string): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Function to get property config based on the hostname of window.location
|
|
10
|
+
* @param hostname - window.location.href hostname
|
|
11
|
+
*/
|
|
12
|
+
export declare function getPropertyConfigByHostname(hostname: string): {
|
|
13
|
+
accountId: number;
|
|
14
|
+
baseEndpoint: string;
|
|
15
|
+
propertyHref: string;
|
|
16
|
+
_clientOptions: {
|
|
17
|
+
privacyManagerId: number;
|
|
18
|
+
manageCookiesLinkOverride: string;
|
|
19
|
+
rootDomain: string;
|
|
20
|
+
};
|
|
21
|
+
joinHref: boolean;
|
|
22
|
+
gdpr: {};
|
|
23
|
+
} | {
|
|
24
|
+
accountId: number;
|
|
25
|
+
baseEndpoint: string;
|
|
26
|
+
propertyId: number;
|
|
27
|
+
_clientOptions: {
|
|
28
|
+
privacyManagerId: number;
|
|
29
|
+
usnatPrivacyManagerId: number;
|
|
30
|
+
ccpaPrivacyManagerId: number;
|
|
31
|
+
manageCookiesLinkOverride: string;
|
|
32
|
+
rootDomain: string;
|
|
33
|
+
};
|
|
34
|
+
joinHref: boolean;
|
|
35
|
+
gdpr: {};
|
|
36
|
+
} | {
|
|
37
|
+
accountId: number;
|
|
38
|
+
baseEndpoint: string;
|
|
39
|
+
propertyId: number;
|
|
40
|
+
_clientOptions: {
|
|
41
|
+
rootDomain: string;
|
|
42
|
+
};
|
|
43
|
+
joinHref: boolean;
|
|
44
|
+
gdpr: {};
|
|
45
|
+
} | {
|
|
46
|
+
accountId: number;
|
|
47
|
+
baseEndpoint: string;
|
|
48
|
+
propertyId: number;
|
|
49
|
+
_clientOptions: {
|
|
50
|
+
rootDomain: string;
|
|
51
|
+
};
|
|
52
|
+
joinHref: boolean;
|
|
53
|
+
gdpr: {};
|
|
54
|
+
} | {
|
|
55
|
+
accountId: number;
|
|
56
|
+
baseEndpoint: string;
|
|
57
|
+
propertyId: number;
|
|
58
|
+
_clientOptions: {
|
|
59
|
+
rootDomain: string;
|
|
60
|
+
};
|
|
61
|
+
joinHref: boolean;
|
|
62
|
+
gdpr: {};
|
|
63
|
+
} | {
|
|
64
|
+
accountId: number;
|
|
65
|
+
baseEndpoint: string;
|
|
66
|
+
propertyId: number;
|
|
67
|
+
_clientOptions: {
|
|
68
|
+
rootDomain: string;
|
|
69
|
+
};
|
|
70
|
+
joinHref: boolean;
|
|
71
|
+
gdpr: {};
|
|
72
|
+
} | {
|
|
73
|
+
accountId: number;
|
|
74
|
+
baseEndpoint: string;
|
|
75
|
+
propertyId: number;
|
|
76
|
+
_clientOptions: {
|
|
77
|
+
rootDomain: string;
|
|
78
|
+
};
|
|
79
|
+
joinHref: boolean;
|
|
80
|
+
gdpr: {};
|
|
81
|
+
} | {
|
|
82
|
+
accountId: number;
|
|
83
|
+
baseEndpoint: string;
|
|
84
|
+
propertyId: number;
|
|
85
|
+
_clientOptions: {
|
|
86
|
+
rootDomain: string;
|
|
87
|
+
};
|
|
88
|
+
joinHref: boolean;
|
|
89
|
+
gdpr: {};
|
|
90
|
+
} | {
|
|
91
|
+
accountId: number;
|
|
92
|
+
baseEndpoint: string;
|
|
93
|
+
propertyId: number;
|
|
94
|
+
_clientOptions: {
|
|
95
|
+
rootDomain: string;
|
|
96
|
+
};
|
|
97
|
+
joinHref: boolean;
|
|
98
|
+
gdpr: {};
|
|
99
|
+
} | {
|
|
100
|
+
accountId: number;
|
|
101
|
+
baseEndpoint: string;
|
|
102
|
+
propertyId: number;
|
|
103
|
+
_clientOptions: {
|
|
104
|
+
rootDomain: string;
|
|
105
|
+
};
|
|
106
|
+
joinHref: boolean;
|
|
107
|
+
gdpr: {};
|
|
108
|
+
} | {
|
|
109
|
+
accountId: number;
|
|
110
|
+
baseEndpoint: string;
|
|
111
|
+
propertyId: number;
|
|
112
|
+
_clientOptions: {
|
|
113
|
+
rootDomain: string;
|
|
114
|
+
};
|
|
115
|
+
joinHref: boolean;
|
|
116
|
+
gdpr: {};
|
|
117
|
+
} | {
|
|
118
|
+
accountId: number;
|
|
119
|
+
baseEndpoint: string;
|
|
120
|
+
propertyId: number;
|
|
121
|
+
_clientOptions: {
|
|
122
|
+
rootDomain: string;
|
|
123
|
+
};
|
|
124
|
+
joinHref: boolean;
|
|
125
|
+
gdpr: {};
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/utils/url.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAWtE;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiB3D"}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@financial-times/cmp-client",
|
|
3
|
+
"version": "0.0.0-backup.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"typings"
|
|
9
|
+
],
|
|
10
|
+
"main": "./dist/index.cjs",
|
|
11
|
+
"module": "./dist/index.js",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/index.js",
|
|
15
|
+
"require": "./dist/index.cjs"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"next-session-client": "^5.0.1"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/uuid": "^9.0.8",
|
|
23
|
+
"eslint": "^8.56.0",
|
|
24
|
+
"npm-run-all": "^4.1.5",
|
|
25
|
+
"rimraf": "^5.0.5",
|
|
26
|
+
"typescript": "^5.3.3",
|
|
27
|
+
"vite": "^5.1.1",
|
|
28
|
+
"vitest": "^1.2.2"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"lint": "eslint ./src ./typings --ext .ts",
|
|
32
|
+
"checks:lint": "npm run lint",
|
|
33
|
+
"checks:unit": "npm t -- --run",
|
|
34
|
+
"checks:types": "tsc",
|
|
35
|
+
"checks": "run-s checks:*",
|
|
36
|
+
"build:lib": "vite build --config vite.config.lib.ts",
|
|
37
|
+
"build:static": "vite build --config vite.config.static.ts",
|
|
38
|
+
"build:types": "tsc",
|
|
39
|
+
"build": "rimraf ./dist && run-s build:*",
|
|
40
|
+
"test": "vitest"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { GPP, TCData } from "./types";
|
|
2
|
+
|
|
3
|
+
export {};
|
|
4
|
+
|
|
5
|
+
declare global {
|
|
6
|
+
interface Window {
|
|
7
|
+
FT_CMP_CLIENT_VERSION: string;
|
|
8
|
+
_sp_: {
|
|
9
|
+
config: SPConfig;
|
|
10
|
+
addEventListener?: (e: string, callback: SPEventCallback) => void;
|
|
11
|
+
removeEventListener?: (e: string, callback: SPEventCallback) => void;
|
|
12
|
+
gdpr?: { loadPrivacyManagerModal: (id: number | undefined) => void };
|
|
13
|
+
ccpa?: { loadPrivacyManagerModal: (id: number | undefined) => void };
|
|
14
|
+
usnat?: { loadPrivacyManagerModal: (id: number | undefined) => void };
|
|
15
|
+
};
|
|
16
|
+
_sp_queue: (() => void)[];
|
|
17
|
+
__tcfapi: (key: string, n: number, callback: (resp: TCData) => void) => void;
|
|
18
|
+
__gpp: (key: string, callback: (resp: GPP.PingData) => void) => void;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module "next-session-client";
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import type { events } from "../src/lib/debug.ts";
|
|
2
|
+
|
|
3
|
+
import { iabCustomCategories } from "../src/lib/constants.ts";
|
|
4
|
+
|
|
5
|
+
export type SPLifecycleEvents = Partial<typeof events>;
|
|
6
|
+
|
|
7
|
+
export type SPEventId = keyof SPLifecycleEvents;
|
|
8
|
+
|
|
9
|
+
export type SPConfigClientOptions = {
|
|
10
|
+
privacyManagerId?: number;
|
|
11
|
+
usnatPrivacyManagerId?: number;
|
|
12
|
+
ccpaPrivacyManagerId?: number;
|
|
13
|
+
manageCookiesLinkOverride?: string;
|
|
14
|
+
rootDomain?: string;
|
|
15
|
+
includeUsNat?: boolean;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export interface SPConfig {
|
|
19
|
+
accountId: number;
|
|
20
|
+
baseEndpoint: string;
|
|
21
|
+
gdpr: Record<string, unknown>;
|
|
22
|
+
usnat?: Record<string, unknown>;
|
|
23
|
+
propertyHref?: string;
|
|
24
|
+
propertyId?: number;
|
|
25
|
+
joinHref?: boolean;
|
|
26
|
+
events?: Partial<SPLifecycleEvents>;
|
|
27
|
+
authId?: string;
|
|
28
|
+
_clientOptions?: SPConfigClientOptions;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type SPEventCallback = (
|
|
32
|
+
legislation: string,
|
|
33
|
+
_: string,
|
|
34
|
+
consentString: string,
|
|
35
|
+
consentMeta: Record<string, unknown>,
|
|
36
|
+
) => Promise<void>;
|
|
37
|
+
|
|
38
|
+
export type CMPInitOptions = Partial<{
|
|
39
|
+
propertyConfig: SPConfig;
|
|
40
|
+
userId: string;
|
|
41
|
+
useFTSession: boolean;
|
|
42
|
+
consentProxyHost: string;
|
|
43
|
+
cookieDomain: string;
|
|
44
|
+
formOfWordsId: string;
|
|
45
|
+
useConsentStore: boolean;
|
|
46
|
+
trackingContext: TrackingContext;
|
|
47
|
+
disableFTCookies: boolean;
|
|
48
|
+
includeUsNat: boolean;
|
|
49
|
+
}>;
|
|
50
|
+
|
|
51
|
+
export interface ConsentPayloadOptions {
|
|
52
|
+
shouldUpdateConsentStore: boolean;
|
|
53
|
+
formOfWordsId: string;
|
|
54
|
+
cookieDomain: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface ConsentCategoryPayload {
|
|
58
|
+
onsite: {
|
|
59
|
+
status: boolean;
|
|
60
|
+
lbi: false;
|
|
61
|
+
source: "sourcepoint-cmp";
|
|
62
|
+
fow?: string;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export type ConsentReadyProps = Omit<CMPInitOptions, "propertyConfig" | "useFTSession">;
|
|
67
|
+
|
|
68
|
+
export interface ConsentPayloadOptions {
|
|
69
|
+
shouldUpdateConsentStore: boolean;
|
|
70
|
+
formOfWordsId: string;
|
|
71
|
+
cookieDomain: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface ConsentCategoryPayload {
|
|
75
|
+
onsite: {
|
|
76
|
+
status: boolean;
|
|
77
|
+
lbi: false;
|
|
78
|
+
source: "sourcepoint-cmp";
|
|
79
|
+
fow?: string;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface IabCustomCategory {
|
|
84
|
+
purposes: number[];
|
|
85
|
+
iabVendors: number[];
|
|
86
|
+
customVendors: number[];
|
|
87
|
+
specialFeatures: number[];
|
|
88
|
+
fowId?: string;
|
|
89
|
+
isLbi?: boolean;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export type IabCustomCategoryName = keyof typeof iabCustomCategories;
|
|
93
|
+
|
|
94
|
+
export type Legislation = "gdpr" | "usnat";
|
|
95
|
+
|
|
96
|
+
export interface RawConsentState {
|
|
97
|
+
gdpr: string | null;
|
|
98
|
+
ccpa: string | null;
|
|
99
|
+
activeLegislation: Legislation;
|
|
100
|
+
tcfCustomVendors?: string;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export type IabCustomCategories = Record<IabCustomCategoryName, IabCustomCategory>;
|
|
104
|
+
|
|
105
|
+
export type ParsedConsentState = Record<IabCustomCategoryName, boolean>;
|
|
106
|
+
|
|
107
|
+
export interface ConsentState {
|
|
108
|
+
raw: RawConsentState;
|
|
109
|
+
parsed: ParsedConsentState;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export type TrackingProps = {
|
|
113
|
+
product?: string;
|
|
114
|
+
app?: string;
|
|
115
|
+
flags: FlagsObject;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export type TrackingContext = {
|
|
119
|
+
product?: string;
|
|
120
|
+
app?: string;
|
|
121
|
+
flags?: FlagsObject;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export type TrackingEvent = {
|
|
125
|
+
detail: {
|
|
126
|
+
component: {
|
|
127
|
+
id: number;
|
|
128
|
+
name: string;
|
|
129
|
+
type: string;
|
|
130
|
+
subtype: string;
|
|
131
|
+
};
|
|
132
|
+
category: string;
|
|
133
|
+
action: string;
|
|
134
|
+
custom?: Array<Record<string, unknown>>;
|
|
135
|
+
url: string | null;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
export type SPMessageType = "gdpr" | "ccpa" | "ios14" | "custom";
|
|
139
|
+
|
|
140
|
+
export type SPPMData = {
|
|
141
|
+
purposeConsent: "all" | "none" | "some";
|
|
142
|
+
vendorConsent: "all" | "none" | "some";
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export type FlagsObject = Record<string, string | boolean>;
|
|
146
|
+
|
|
147
|
+
export type SPFrameMessageEvent = {
|
|
148
|
+
fromPM: boolean;
|
|
149
|
+
actionType: number;
|
|
150
|
+
messageId: string;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* @see https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md#tcdata
|
|
155
|
+
*/
|
|
156
|
+
export type TCData = {
|
|
157
|
+
tcString: string;
|
|
158
|
+
tcfPolicyVersion: number;
|
|
159
|
+
cmpId: 1000;
|
|
160
|
+
cmpVersion: 1000;
|
|
161
|
+
gdprApplies: boolean | undefined;
|
|
162
|
+
eventStatus: string;
|
|
163
|
+
cmpStatus: string;
|
|
164
|
+
listenerId: number | undefined;
|
|
165
|
+
isServiceSpecific: boolean;
|
|
166
|
+
useNonStandardTexts: boolean;
|
|
167
|
+
publisherCC: string;
|
|
168
|
+
purposeOneTreatment: boolean;
|
|
169
|
+
|
|
170
|
+
purpose: {
|
|
171
|
+
consents: Record<string, boolean>;
|
|
172
|
+
legitimateInterests: Record<string, boolean>;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
vendor: {
|
|
176
|
+
consents: Record<string, boolean>;
|
|
177
|
+
legitimateInterests: Record<string, boolean>;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
specialFeatureOptins: Record<string, boolean>;
|
|
181
|
+
|
|
182
|
+
publisher: {
|
|
183
|
+
consents: Record<string, boolean>;
|
|
184
|
+
legitimateInterests: Record<string, boolean>;
|
|
185
|
+
customPurpose: {
|
|
186
|
+
consents: Record<string, boolean>;
|
|
187
|
+
legitimateInterests: Record<string, boolean>;
|
|
188
|
+
};
|
|
189
|
+
restrictions: Record<string, Record<string, 0 | 1 | 2>>;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export interface LinkOnClickFunction {
|
|
194
|
+
(e: MouseEvent): void;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface PrivacyManagerRegionId {
|
|
198
|
+
text: string;
|
|
199
|
+
onClick: LinkOnClickFunction;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export interface regionConfig {
|
|
203
|
+
[key: string]: PrivacyManagerRegionId;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export namespace GPP {
|
|
207
|
+
/**
|
|
208
|
+
* https://github.com/InteractiveAdvertisingBureau/Global-Privacy-Platform/blob/main/Sections/US-National/IAB%20Privacy%E2%80%99s%20National%20Privacy%20Technical%20Specification.md#section-encoding
|
|
209
|
+
*/
|
|
210
|
+
export interface UsNatSection {
|
|
211
|
+
Version: number;
|
|
212
|
+
SharingNotice: 0 | 1 | 2;
|
|
213
|
+
SaleOptOutNotice: 0 | 1 | 2;
|
|
214
|
+
SharingOptOutNotice: 0 | 1 | 2;
|
|
215
|
+
TargetedAdvertisingOptOutNotice: 0 | 1 | 2;
|
|
216
|
+
SensitiveDataProcessingOptOutNotice: 0 | 1 | 2;
|
|
217
|
+
SensitiveDataLimitUseNotice: 0 | 1 | 2;
|
|
218
|
+
SaleOptOut: 0 | 1 | 2;
|
|
219
|
+
SharingOptOut: 0 | 1 | 2;
|
|
220
|
+
TargetedAdvertisingOptOut: 0 | 1 | 2;
|
|
221
|
+
SensitiveDataProcessing: Array<0 | 1 | 2>;
|
|
222
|
+
KnownChildSensitiveDataConsents: Array<0 | 1 | 2>;
|
|
223
|
+
PersonalDataConsents: 0 | 1 | 2;
|
|
224
|
+
MspaCoveredTransaction: 1 | 2;
|
|
225
|
+
MspaOptOutOptionMode: 0 | 1 | 2;
|
|
226
|
+
MspaServiceProviderMode: 0 | 1 | 2;
|
|
227
|
+
Gpc: boolean;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* https://github.com/InteractiveAdvertisingBureau/Global-Privacy-Platform/blob/main/Sections/US-States/CA/GPP%20Extension%3A%20IAB%20Privacy%E2%80%99s%20California%20Privacy%20Technical%20Specification.md
|
|
232
|
+
*/
|
|
233
|
+
export interface CaliforniaSection {
|
|
234
|
+
Version: number;
|
|
235
|
+
SaleOptOutNotice: 0 | 1 | 2;
|
|
236
|
+
SharingOptOutNotice: 0 | 1 | 2;
|
|
237
|
+
SensitiveDataLimitUseNotice: 0 | 1 | 2;
|
|
238
|
+
SaleOptOut: 0 | 1 | 2;
|
|
239
|
+
SharingOptOut: 0 | 1 | 2;
|
|
240
|
+
SensitiveDataProcessing: Array<0 | 1 | 2>;
|
|
241
|
+
KnownChildSensitiveDataConsents: Array<0 | 1 | 2>;
|
|
242
|
+
PersonalDataConsents: 0 | 1 | 2;
|
|
243
|
+
MspaCoveredTransaction: 1 | 2;
|
|
244
|
+
MspaOptOutOptionMode: 0 | 1 | 2;
|
|
245
|
+
MspaServiceProviderMode: 0 | 1 | 2;
|
|
246
|
+
Gpc: boolean;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export interface ParsedSections {
|
|
250
|
+
uscav1: CaliforniaSection;
|
|
251
|
+
usnatv1: UsNatSection;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export type PingData = {
|
|
255
|
+
gppVersion: string;
|
|
256
|
+
cmpStatus: string;
|
|
257
|
+
cmpDisplayStatus: string;
|
|
258
|
+
signalStatus: string;
|
|
259
|
+
supportedAPIs: string[];
|
|
260
|
+
cmpId: number;
|
|
261
|
+
sectionList: number[];
|
|
262
|
+
applicableSections: number[];
|
|
263
|
+
gppString: string;
|
|
264
|
+
parsedSections: ParsedSections;
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
export type ParsedSectionKey = keyof ParsedSections;
|
|
268
|
+
|
|
269
|
+
export type ParsedSection = ParsedSections[ParsedSectionKey];
|
|
270
|
+
|
|
271
|
+
export interface ParseFunction {
|
|
272
|
+
(sectionData: ParsedSections[ParsedSectionKey]): ParsedConsentState;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export type DeepPartial<T> = T extends object
|
|
277
|
+
? {
|
|
278
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
279
|
+
}
|
|
280
|
+
: T;
|