@pubtech-ai/core 1.6.0
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/LICENSE +202 -0
- package/README.md +527 -0
- package/lib/cjs/Cloneable.d.ts +27 -0
- package/lib/cjs/Cloneable.js +1 -0
- package/lib/cjs/GVL.d.ts +295 -0
- package/lib/cjs/GVL.js +1 -0
- package/lib/cjs/Json.d.ts +20 -0
- package/lib/cjs/Json.js +1 -0
- package/lib/cjs/TCModel.d.ts +337 -0
- package/lib/cjs/TCModel.js +1 -0
- package/lib/cjs/TCString.d.ts +27 -0
- package/lib/cjs/TCString.js +1 -0
- package/lib/cjs/encoder/Base64Url.d.ts +29 -0
- package/lib/cjs/encoder/Base64Url.js +1 -0
- package/lib/cjs/encoder/BitLength.d.ts +32 -0
- package/lib/cjs/encoder/BitLength.js +1 -0
- package/lib/cjs/encoder/EncodingOptions.d.ts +6 -0
- package/lib/cjs/encoder/EncodingOptions.js +1 -0
- package/lib/cjs/encoder/SegmentEncoder.d.ts +8 -0
- package/lib/cjs/encoder/SegmentEncoder.js +1 -0
- package/lib/cjs/encoder/SemanticPreEncoder.d.ts +6 -0
- package/lib/cjs/encoder/SemanticPreEncoder.js +1 -0
- package/lib/cjs/encoder/field/BooleanEncoder.d.ts +4 -0
- package/lib/cjs/encoder/field/BooleanEncoder.js +1 -0
- package/lib/cjs/encoder/field/DateEncoder.d.ts +4 -0
- package/lib/cjs/encoder/field/DateEncoder.js +1 -0
- package/lib/cjs/encoder/field/FieldEncoderMap.d.ts +1 -0
- package/lib/cjs/encoder/field/FieldEncoderMap.js +1 -0
- package/lib/cjs/encoder/field/FixedVectorEncoder.d.ts +5 -0
- package/lib/cjs/encoder/field/FixedVectorEncoder.js +1 -0
- package/lib/cjs/encoder/field/IntEncoder.d.ts +4 -0
- package/lib/cjs/encoder/field/IntEncoder.js +1 -0
- package/lib/cjs/encoder/field/LangEncoder.d.ts +4 -0
- package/lib/cjs/encoder/field/LangEncoder.js +1 -0
- package/lib/cjs/encoder/field/PurposeRestrictionVectorEncoder.d.ts +5 -0
- package/lib/cjs/encoder/field/PurposeRestrictionVectorEncoder.js +1 -0
- package/lib/cjs/encoder/field/VectorEncodingType.d.ts +4 -0
- package/lib/cjs/encoder/field/VectorEncodingType.js +1 -0
- package/lib/cjs/encoder/field/VendorVectorEncoder.d.ts +6 -0
- package/lib/cjs/encoder/field/VendorVectorEncoder.js +1 -0
- package/lib/cjs/encoder/field/index.d.ts +9 -0
- package/lib/cjs/encoder/field/index.js +1 -0
- package/lib/cjs/encoder/index.d.ts +7 -0
- package/lib/cjs/encoder/index.js +1 -0
- package/lib/cjs/encoder/sequence/FieldSequence.d.ts +5 -0
- package/lib/cjs/encoder/sequence/FieldSequence.js +1 -0
- package/lib/cjs/encoder/sequence/SegmentSequence.d.ts +9 -0
- package/lib/cjs/encoder/sequence/SegmentSequence.js +1 -0
- package/lib/cjs/encoder/sequence/SequenceVersionMap.d.ts +7 -0
- package/lib/cjs/encoder/sequence/SequenceVersionMap.js +1 -0
- package/lib/cjs/encoder/sequence/index.d.ts +3 -0
- package/lib/cjs/encoder/sequence/index.js +1 -0
- package/lib/cjs/errors/DecodingError.d.ts +15 -0
- package/lib/cjs/errors/DecodingError.js +1 -0
- package/lib/cjs/errors/EncodingError.d.ts +15 -0
- package/lib/cjs/errors/EncodingError.js +1 -0
- package/lib/cjs/errors/GVLError.d.ts +15 -0
- package/lib/cjs/errors/GVLError.js +1 -0
- package/lib/cjs/errors/TCModelError.d.ts +16 -0
- package/lib/cjs/errors/TCModelError.js +1 -0
- package/lib/cjs/errors/index.d.ts +4 -0
- package/lib/cjs/errors/index.js +1 -0
- package/lib/cjs/index.d.ts +8 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/model/BinarySearchTree.d.ts +30 -0
- package/lib/cjs/model/BinarySearchTree.js +1 -0
- package/lib/cjs/model/ConsentLanguages.d.ts +6 -0
- package/lib/cjs/model/ConsentLanguages.js +1 -0
- package/lib/cjs/model/DeviceDisclosure.d.ts +9 -0
- package/lib/cjs/model/DeviceDisclosure.js +1 -0
- package/lib/cjs/model/DeviceDisclosureStorageAccessType.d.ts +5 -0
- package/lib/cjs/model/DeviceDisclosureStorageAccessType.js +1 -0
- package/lib/cjs/model/Fields.d.ts +29 -0
- package/lib/cjs/model/Fields.js +1 -0
- package/lib/cjs/model/IntMap.d.ts +13 -0
- package/lib/cjs/model/IntMap.js +1 -0
- package/lib/cjs/model/KeyMap.d.ts +12 -0
- package/lib/cjs/model/KeyMap.js +1 -0
- package/lib/cjs/model/PurposeRestriction.d.ts +33 -0
- package/lib/cjs/model/PurposeRestriction.js +1 -0
- package/lib/cjs/model/PurposeRestrictionVector.d.ts +100 -0
- package/lib/cjs/model/PurposeRestrictionVector.js +1 -0
- package/lib/cjs/model/RestrictionType.d.ts +19 -0
- package/lib/cjs/model/RestrictionType.js +1 -0
- package/lib/cjs/model/Segment.d.ts +6 -0
- package/lib/cjs/model/Segment.js +1 -0
- package/lib/cjs/model/SegmentIDs.d.ts +12 -0
- package/lib/cjs/model/SegmentIDs.js +1 -0
- package/lib/cjs/model/Vector.d.ts +72 -0
- package/lib/cjs/model/Vector.js +1 -0
- package/lib/cjs/model/gvl/ByPurposeVendorMap.d.ts +7 -0
- package/lib/cjs/model/gvl/ByPurposeVendorMap.js +1 -0
- package/lib/cjs/model/gvl/DataCategory.d.ts +4 -0
- package/lib/cjs/model/gvl/DataCategory.js +1 -0
- package/lib/cjs/model/gvl/DataRetention.d.ts +6 -0
- package/lib/cjs/model/gvl/DataRetention.js +1 -0
- package/lib/cjs/model/gvl/Declarations.d.ts +13 -0
- package/lib/cjs/model/gvl/Declarations.js +1 -0
- package/lib/cjs/model/gvl/Feature.d.ts +5 -0
- package/lib/cjs/model/gvl/Feature.js +1 -0
- package/lib/cjs/model/gvl/GVLMapItem.d.ts +4 -0
- package/lib/cjs/model/gvl/GVLMapItem.js +1 -0
- package/lib/cjs/model/gvl/IDSetMap.d.ts +2 -0
- package/lib/cjs/model/gvl/IDSetMap.js +1 -0
- package/lib/cjs/model/gvl/Purpose.d.ts +5 -0
- package/lib/cjs/model/gvl/Purpose.js +1 -0
- package/lib/cjs/model/gvl/Stack.d.ts +6 -0
- package/lib/cjs/model/gvl/Stack.js +1 -0
- package/lib/cjs/model/gvl/Vendor.d.ts +24 -0
- package/lib/cjs/model/gvl/Vendor.js +1 -0
- package/lib/cjs/model/gvl/VendorList.d.ts +10 -0
- package/lib/cjs/model/gvl/VendorList.js +1 -0
- package/lib/cjs/model/gvl/VendorUrl.d.ts +5 -0
- package/lib/cjs/model/gvl/VendorUrl.js +1 -0
- package/lib/cjs/model/gvl/index.d.ts +10 -0
- package/lib/cjs/model/gvl/index.js +1 -0
- package/lib/cjs/model/index.d.ts +14 -0
- package/lib/cjs/model/index.js +1 -0
- package/lib/cjs/package.json +3 -0
- package/lib/mjs/Cloneable.d.ts +27 -0
- package/lib/mjs/Cloneable.js +76 -0
- package/lib/mjs/GVL.d.ts +295 -0
- package/lib/mjs/GVL.js +591 -0
- package/lib/mjs/Json.d.ts +20 -0
- package/lib/mjs/Json.js +74 -0
- package/lib/mjs/TCModel.d.ts +337 -0
- package/lib/mjs/TCModel.js +512 -0
- package/lib/mjs/TCString.d.ts +27 -0
- package/lib/mjs/TCString.js +71 -0
- package/lib/mjs/encoder/Base64Url.d.ts +29 -0
- package/lib/mjs/encoder/Base64Url.js +80 -0
- package/lib/mjs/encoder/BitLength.d.ts +32 -0
- package/lib/mjs/encoder/BitLength.js +32 -0
- package/lib/mjs/encoder/EncodingOptions.d.ts +6 -0
- package/lib/mjs/encoder/EncodingOptions.js +1 -0
- package/lib/mjs/encoder/SegmentEncoder.d.ts +8 -0
- package/lib/mjs/encoder/SegmentEncoder.js +106 -0
- package/lib/mjs/encoder/SemanticPreEncoder.d.ts +6 -0
- package/lib/mjs/encoder/SemanticPreEncoder.js +133 -0
- package/lib/mjs/encoder/field/BooleanEncoder.d.ts +4 -0
- package/lib/mjs/encoder/field/BooleanEncoder.js +9 -0
- package/lib/mjs/encoder/field/DateEncoder.d.ts +4 -0
- package/lib/mjs/encoder/field/DateEncoder.js +15 -0
- package/lib/mjs/encoder/field/FieldEncoderMap.d.ts +1 -0
- package/lib/mjs/encoder/field/FieldEncoderMap.js +39 -0
- package/lib/mjs/encoder/field/FixedVectorEncoder.d.ts +5 -0
- package/lib/mjs/encoder/field/FixedVectorEncoder.js +25 -0
- package/lib/mjs/encoder/field/IntEncoder.d.ts +4 -0
- package/lib/mjs/encoder/field/IntEncoder.js +25 -0
- package/lib/mjs/encoder/field/LangEncoder.d.ts +4 -0
- package/lib/mjs/encoder/field/LangEncoder.js +36 -0
- package/lib/mjs/encoder/field/PurposeRestrictionVectorEncoder.d.ts +5 -0
- package/lib/mjs/encoder/field/PurposeRestrictionVectorEncoder.js +109 -0
- package/lib/mjs/encoder/field/VectorEncodingType.d.ts +4 -0
- package/lib/mjs/encoder/field/VectorEncodingType.js +5 -0
- package/lib/mjs/encoder/field/VendorVectorEncoder.d.ts +6 -0
- package/lib/mjs/encoder/field/VendorVectorEncoder.js +156 -0
- package/lib/mjs/encoder/field/index.d.ts +9 -0
- package/lib/mjs/encoder/field/index.js +9 -0
- package/lib/mjs/encoder/index.d.ts +7 -0
- package/lib/mjs/encoder/index.js +7 -0
- package/lib/mjs/encoder/sequence/FieldSequence.d.ts +5 -0
- package/lib/mjs/encoder/sequence/FieldSequence.js +53 -0
- package/lib/mjs/encoder/sequence/SegmentSequence.d.ts +9 -0
- package/lib/mjs/encoder/sequence/SegmentSequence.js +52 -0
- package/lib/mjs/encoder/sequence/SequenceVersionMap.d.ts +7 -0
- package/lib/mjs/encoder/sequence/SequenceVersionMap.js +1 -0
- package/lib/mjs/encoder/sequence/index.d.ts +3 -0
- package/lib/mjs/encoder/sequence/index.js +4 -0
- package/lib/mjs/errors/DecodingError.d.ts +15 -0
- package/lib/mjs/errors/DecodingError.js +18 -0
- package/lib/mjs/errors/EncodingError.d.ts +15 -0
- package/lib/mjs/errors/EncodingError.js +18 -0
- package/lib/mjs/errors/GVLError.d.ts +15 -0
- package/lib/mjs/errors/GVLError.js +18 -0
- package/lib/mjs/errors/TCModelError.d.ts +16 -0
- package/lib/mjs/errors/TCModelError.js +19 -0
- package/lib/mjs/errors/index.d.ts +4 -0
- package/lib/mjs/errors/index.js +4 -0
- package/lib/mjs/index.d.ts +8 -0
- package/lib/mjs/index.js +9 -0
- package/lib/mjs/model/BinarySearchTree.d.ts +30 -0
- package/lib/mjs/model/BinarySearchTree.js +267 -0
- package/lib/mjs/model/ConsentLanguages.d.ts +6 -0
- package/lib/mjs/model/ConsentLanguages.js +42 -0
- package/lib/mjs/model/DeviceDisclosure.d.ts +9 -0
- package/lib/mjs/model/DeviceDisclosure.js +1 -0
- package/lib/mjs/model/DeviceDisclosureStorageAccessType.d.ts +5 -0
- package/lib/mjs/model/DeviceDisclosureStorageAccessType.js +6 -0
- package/lib/mjs/model/Fields.d.ts +29 -0
- package/lib/mjs/model/Fields.js +29 -0
- package/lib/mjs/model/IntMap.d.ts +13 -0
- package/lib/mjs/model/IntMap.js +1 -0
- package/lib/mjs/model/KeyMap.d.ts +12 -0
- package/lib/mjs/model/KeyMap.js +1 -0
- package/lib/mjs/model/PurposeRestriction.d.ts +33 -0
- package/lib/mjs/model/PurposeRestriction.js +69 -0
- package/lib/mjs/model/PurposeRestrictionVector.d.ts +100 -0
- package/lib/mjs/model/PurposeRestrictionVector.js +286 -0
- package/lib/mjs/model/RestrictionType.d.ts +19 -0
- package/lib/mjs/model/RestrictionType.js +20 -0
- package/lib/mjs/model/Segment.d.ts +6 -0
- package/lib/mjs/model/Segment.js +7 -0
- package/lib/mjs/model/SegmentIDs.d.ts +12 -0
- package/lib/mjs/model/SegmentIDs.js +21 -0
- package/lib/mjs/model/Vector.d.ts +72 -0
- package/lib/mjs/model/Vector.js +161 -0
- package/lib/mjs/model/gvl/ByPurposeVendorMap.d.ts +7 -0
- package/lib/mjs/model/gvl/ByPurposeVendorMap.js +1 -0
- package/lib/mjs/model/gvl/DataCategory.d.ts +4 -0
- package/lib/mjs/model/gvl/DataCategory.js +1 -0
- package/lib/mjs/model/gvl/DataRetention.d.ts +6 -0
- package/lib/mjs/model/gvl/DataRetention.js +1 -0
- package/lib/mjs/model/gvl/Declarations.d.ts +13 -0
- package/lib/mjs/model/gvl/Declarations.js +1 -0
- package/lib/mjs/model/gvl/Feature.d.ts +5 -0
- package/lib/mjs/model/gvl/Feature.js +2 -0
- package/lib/mjs/model/gvl/GVLMapItem.d.ts +4 -0
- package/lib/mjs/model/gvl/GVLMapItem.js +1 -0
- package/lib/mjs/model/gvl/IDSetMap.d.ts +2 -0
- package/lib/mjs/model/gvl/IDSetMap.js +1 -0
- package/lib/mjs/model/gvl/Purpose.d.ts +5 -0
- package/lib/mjs/model/gvl/Purpose.js +1 -0
- package/lib/mjs/model/gvl/Stack.d.ts +6 -0
- package/lib/mjs/model/gvl/Stack.js +1 -0
- package/lib/mjs/model/gvl/Vendor.d.ts +24 -0
- package/lib/mjs/model/gvl/Vendor.js +1 -0
- package/lib/mjs/model/gvl/VendorList.d.ts +10 -0
- package/lib/mjs/model/gvl/VendorList.js +1 -0
- package/lib/mjs/model/gvl/VendorUrl.d.ts +5 -0
- package/lib/mjs/model/gvl/VendorUrl.js +1 -0
- package/lib/mjs/model/gvl/index.d.ts +10 -0
- package/lib/mjs/model/gvl/index.js +11 -0
- package/lib/mjs/model/index.d.ts +14 -0
- package/lib/mjs/model/index.js +14 -0
- package/lib/mjs/package.json +3 -0
- package/package.json +95 -0
package/lib/cjs/GVL.d.ts
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { Cloneable } from './Cloneable.js';
|
|
2
|
+
import { GVLError } from './errors/index.js';
|
|
3
|
+
import { ConsentLanguages, IntMap } from './model/index.js';
|
|
4
|
+
import { Feature, Purpose, Stack, Vendor, VendorList, DataCategory } from './model/gvl/index.js';
|
|
5
|
+
export declare type VersionOrVendorList = string | number | VendorList;
|
|
6
|
+
/**
|
|
7
|
+
* class with utilities for managing the global vendor list. Will use JSON to
|
|
8
|
+
* fetch the vendor list from specified url and will serialize it into this
|
|
9
|
+
* object and provide accessors. Provides ways to group vendors on the list by
|
|
10
|
+
* purpose and feature.
|
|
11
|
+
*/
|
|
12
|
+
export declare class GVL extends Cloneable<GVL> implements VendorList {
|
|
13
|
+
private static LANGUAGE_CACHE;
|
|
14
|
+
private static CACHE;
|
|
15
|
+
private static LATEST_CACHE_KEY;
|
|
16
|
+
static readonly DEFAULT_LANGUAGE: string;
|
|
17
|
+
/**
|
|
18
|
+
* Set of available consent languages published by the IAB
|
|
19
|
+
*/
|
|
20
|
+
static readonly consentLanguages: ConsentLanguages;
|
|
21
|
+
private static baseUrl_;
|
|
22
|
+
/**
|
|
23
|
+
* baseUrl - Entities using the vendor-list.json are required by the iab to
|
|
24
|
+
* host their own copy of it to reduce the load on the iab's infrastructure
|
|
25
|
+
* so a 'base' url must be set to be put together with the versioning scheme
|
|
26
|
+
* of the filenames.
|
|
27
|
+
*
|
|
28
|
+
* @static
|
|
29
|
+
* @param {string} url - the base url to load the vendor-list.json from. This is
|
|
30
|
+
* broken out from the filename because it follows a different scheme for
|
|
31
|
+
* latest file vs versioned files.
|
|
32
|
+
*
|
|
33
|
+
* @throws {GVLError} - If the url is http[s]://vendorlist.consensu.org/...
|
|
34
|
+
* this will throw an error. IAB Europe requires that that CMPs and Vendors
|
|
35
|
+
* cache their own copies of the GVL to minimize load on their
|
|
36
|
+
* infrastructure. For more information regarding caching of the
|
|
37
|
+
* vendor-list.json, please see [the TCF documentation on 'Caching the Global
|
|
38
|
+
* Vendor List'
|
|
39
|
+
* ](https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20Consent%20string%20and%20vendor%20list%20formats%20v2.md#caching-the-global-vendor-list)
|
|
40
|
+
*/
|
|
41
|
+
static set baseUrl(url: string);
|
|
42
|
+
/**
|
|
43
|
+
* baseUrl - Entities using the vendor-list.json are required by the iab to
|
|
44
|
+
* host their own copy of it to reduce the load on the iab's infrastructure
|
|
45
|
+
* so a 'base' url must be set to be put together with the versioning scheme
|
|
46
|
+
* of the filenames.
|
|
47
|
+
*
|
|
48
|
+
* @static
|
|
49
|
+
* @return {string} - returns the previously set baseUrl, the default is
|
|
50
|
+
* `undefined`
|
|
51
|
+
*/
|
|
52
|
+
static get baseUrl(): string;
|
|
53
|
+
/**
|
|
54
|
+
* @static
|
|
55
|
+
* @param {string} - the latest is assumed to be vendor-list.json because
|
|
56
|
+
* that is what the iab uses, but it could be different... if you want
|
|
57
|
+
*/
|
|
58
|
+
static latestFilename: string;
|
|
59
|
+
/**
|
|
60
|
+
* @static
|
|
61
|
+
* @param {string} - the versioned name is assumed to be
|
|
62
|
+
* vendor-list-v[VERSION].json where [VERSION] will be replaced with the
|
|
63
|
+
* specified version. But it could be different... if you want just make
|
|
64
|
+
* sure to include the [VERSION] macro if you have a numbering scheme, it's a
|
|
65
|
+
* simple string substitution.
|
|
66
|
+
*
|
|
67
|
+
* eg.
|
|
68
|
+
* ```javascript
|
|
69
|
+
* GVL.baseUrl = "http://www.mydomain.com/iabcmp/";
|
|
70
|
+
* GVL.versionedFilename = "vendorlist?getVersion=[VERSION]";
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
static versionedFilename: string;
|
|
74
|
+
/**
|
|
75
|
+
* @param {string} - Translations of the names and descriptions for Purposes,
|
|
76
|
+
* Special Purposes, Features, and Special Features to non-English languages
|
|
77
|
+
* are contained in a file where attributes containing English content
|
|
78
|
+
* (except vendor declaration information) are translated. The iab publishes
|
|
79
|
+
* one following the scheme below where the LANG is the iso639-1 language
|
|
80
|
+
* code. For a list of available translations
|
|
81
|
+
* [please go here](https://register.consensu.org/Translation).
|
|
82
|
+
*
|
|
83
|
+
* eg.
|
|
84
|
+
* ```javascript
|
|
85
|
+
* GVL.baseUrl = "http://www.mydomain.com/iabcmp/";
|
|
86
|
+
* GVL.languageFilename = "purposes?getPurposes=[LANG]";
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
static languageFilename: string;
|
|
90
|
+
/**
|
|
91
|
+
* @param {Promise} resolved when this GVL object is populated with the data
|
|
92
|
+
* or rejected if there is an error.
|
|
93
|
+
*/
|
|
94
|
+
readyPromise: Promise<void | GVLError>;
|
|
95
|
+
/**
|
|
96
|
+
* @param {number} gvlSpecificationVersion - schema version for the GVL that is used
|
|
97
|
+
*/
|
|
98
|
+
gvlSpecificationVersion: number;
|
|
99
|
+
/**
|
|
100
|
+
* @param {number} incremented with each published file change
|
|
101
|
+
*/
|
|
102
|
+
vendorListVersion: number;
|
|
103
|
+
/**
|
|
104
|
+
* @param {number} tcfPolicyVersion - The TCF MO will increment this value
|
|
105
|
+
* whenever a GVL change (such as adding a new Purpose or Feature or a change
|
|
106
|
+
* in Purpose wording) legally invalidates existing TC Strings and requires
|
|
107
|
+
* CMPs to re-establish transparency and consent from users. If the policy
|
|
108
|
+
* version number in the latest GVL is different from the value in your TC
|
|
109
|
+
* String, then you need to re-establish transparency and consent for that
|
|
110
|
+
* user. A version 1 format TC String is considered to have a version value
|
|
111
|
+
* of 1.
|
|
112
|
+
*/
|
|
113
|
+
tcfPolicyVersion: number;
|
|
114
|
+
/**
|
|
115
|
+
* @param {string | Date} lastUpdated - the date in which the vendor list
|
|
116
|
+
* json file was last updated.
|
|
117
|
+
*/
|
|
118
|
+
lastUpdated: string | Date;
|
|
119
|
+
/**
|
|
120
|
+
* @param {IntMap<Purpose>} a collection of [[Purpose]]s
|
|
121
|
+
*/
|
|
122
|
+
purposes: IntMap<Purpose>;
|
|
123
|
+
/**
|
|
124
|
+
* @param {IntMap<Purpose>} a collection of [[Purpose]]s
|
|
125
|
+
*/
|
|
126
|
+
specialPurposes: IntMap<Purpose>;
|
|
127
|
+
/**
|
|
128
|
+
* @param {IntMap<Feature>} a collection of [[Feature]]s
|
|
129
|
+
*/
|
|
130
|
+
features: IntMap<Feature>;
|
|
131
|
+
/**
|
|
132
|
+
* @param {IntMap<Feature>} a collection of [[Feature]]s
|
|
133
|
+
*/
|
|
134
|
+
specialFeatures: IntMap<Feature>;
|
|
135
|
+
/**
|
|
136
|
+
* @param {boolean} internal reference of when the GVL is ready to be used
|
|
137
|
+
*/
|
|
138
|
+
private isReady_;
|
|
139
|
+
/**
|
|
140
|
+
* @param {IntMap<Vendor>} a collection of [[Vendor]]s
|
|
141
|
+
*/
|
|
142
|
+
private vendors_;
|
|
143
|
+
vendorIds: Set<number>;
|
|
144
|
+
/**
|
|
145
|
+
* @param {IntMap<Vendor>} a collection of [[Vendor]]. Used as a backup if a whitelist is sets
|
|
146
|
+
*/
|
|
147
|
+
private fullVendorList;
|
|
148
|
+
/**
|
|
149
|
+
* @param {ByPurposeVendorMap} vendors by purpose
|
|
150
|
+
*/
|
|
151
|
+
private byPurposeVendorMap;
|
|
152
|
+
/**
|
|
153
|
+
* @param {IDSetMap} vendors by special purpose
|
|
154
|
+
*/
|
|
155
|
+
private bySpecialPurposeVendorMap;
|
|
156
|
+
/**
|
|
157
|
+
* @param {IDSetMap} vendors by feature
|
|
158
|
+
*/
|
|
159
|
+
private byFeatureVendorMap;
|
|
160
|
+
/**
|
|
161
|
+
* @param {IDSetMap} vendors by special feature
|
|
162
|
+
*/
|
|
163
|
+
private bySpecialFeatureVendorMap;
|
|
164
|
+
/**
|
|
165
|
+
* @param {IntMap<Stack>} a collection of [[Stack]]s
|
|
166
|
+
*/
|
|
167
|
+
stacks: IntMap<Stack>;
|
|
168
|
+
/**
|
|
169
|
+
* @param {IntMap<DataCategory>} a collection of [[DataCategory]]s
|
|
170
|
+
*/
|
|
171
|
+
dataCategories?: IntMap<DataCategory>;
|
|
172
|
+
private lang_;
|
|
173
|
+
private isLatest;
|
|
174
|
+
/**
|
|
175
|
+
* @param {VersionOrVendorList} [versionOrVendorList] - can be either a
|
|
176
|
+
* [[VendorList]] object or a version number represented as a string or
|
|
177
|
+
* number to download. If nothing is passed the latest version of the GVL
|
|
178
|
+
* will be loaded
|
|
179
|
+
*/
|
|
180
|
+
constructor(versionOrVendorList?: VersionOrVendorList);
|
|
181
|
+
/**
|
|
182
|
+
* emptyLanguageCache
|
|
183
|
+
*
|
|
184
|
+
* @param {string} [lang] - Optional ISO 639-1 langauge code to remove from
|
|
185
|
+
* the cache. Should be one of the languages in GVL.consentLanguages set.
|
|
186
|
+
* If not then the whole cache will be deleted.
|
|
187
|
+
* @return {boolean} - true if anything was deleted from the cache
|
|
188
|
+
*/
|
|
189
|
+
static emptyLanguageCache(lang?: string): boolean;
|
|
190
|
+
/**
|
|
191
|
+
* emptyCache
|
|
192
|
+
*
|
|
193
|
+
* @param {number} [vendorListVersion] - version of the vendor list to delete
|
|
194
|
+
* from the cache. If none is specified then the whole cache is deleted.
|
|
195
|
+
* @return {boolean} - true if anything was deleted from the cache
|
|
196
|
+
*/
|
|
197
|
+
static emptyCache(vendorListVersion?: number): boolean;
|
|
198
|
+
private cacheLanguage;
|
|
199
|
+
private fetchJson;
|
|
200
|
+
/**
|
|
201
|
+
* getJson - Method for getting the JSON that was downloaded to created this
|
|
202
|
+
* `GVL` object
|
|
203
|
+
*
|
|
204
|
+
* @return {VendorList} - The basic JSON structure without the extra
|
|
205
|
+
* functionality and methods of this class.
|
|
206
|
+
*/
|
|
207
|
+
getJson(): VendorList;
|
|
208
|
+
/**
|
|
209
|
+
* changeLanguage - retrieves the purpose language translation and sets the
|
|
210
|
+
* internal language variable
|
|
211
|
+
*
|
|
212
|
+
* @param {string} lang - ISO 639-1 langauge code to change language to
|
|
213
|
+
* @return {Promise<void | GVLError>} - returns the `readyPromise` and
|
|
214
|
+
* resolves when this GVL is populated with the data from the language file.
|
|
215
|
+
*/
|
|
216
|
+
changeLanguage(lang: string): Promise<void | GVLError>;
|
|
217
|
+
get language(): string;
|
|
218
|
+
private isVendorList;
|
|
219
|
+
private populate;
|
|
220
|
+
private mapVendors;
|
|
221
|
+
private getFilteredVendors;
|
|
222
|
+
/**
|
|
223
|
+
* getVendorsWithConsentPurpose
|
|
224
|
+
*
|
|
225
|
+
* @param {number} purposeId
|
|
226
|
+
* @return {IntMap<Vendor>} - list of vendors that have declared the consent purpose id
|
|
227
|
+
*/
|
|
228
|
+
getVendorsWithConsentPurpose(purposeId: number): IntMap<Vendor>;
|
|
229
|
+
/**
|
|
230
|
+
* getVendorsWithLegIntPurpose
|
|
231
|
+
*
|
|
232
|
+
* @param {number} purposeId
|
|
233
|
+
* @return {IntMap<Vendor>} - list of vendors that have declared the legInt (Legitimate Interest) purpose id
|
|
234
|
+
*/
|
|
235
|
+
getVendorsWithLegIntPurpose(purposeId: number): IntMap<Vendor>;
|
|
236
|
+
/**
|
|
237
|
+
* getVendorsWithFlexiblePurpose
|
|
238
|
+
*
|
|
239
|
+
* @param {number} purposeId
|
|
240
|
+
* @return {IntMap<Vendor>} - list of vendors that have declared the flexible purpose id
|
|
241
|
+
*/
|
|
242
|
+
getVendorsWithFlexiblePurpose(purposeId: number): IntMap<Vendor>;
|
|
243
|
+
/**
|
|
244
|
+
* getVendorsWithSpecialPurpose
|
|
245
|
+
*
|
|
246
|
+
* @param {number} specialPurposeId
|
|
247
|
+
* @return {IntMap<Vendor>} - list of vendors that have declared the special purpose id
|
|
248
|
+
*/
|
|
249
|
+
getVendorsWithSpecialPurpose(specialPurposeId: number): IntMap<Vendor>;
|
|
250
|
+
/**
|
|
251
|
+
* getVendorsWithFeature
|
|
252
|
+
*
|
|
253
|
+
* @param {number} featureId
|
|
254
|
+
* @return {IntMap<Vendor>} - list of vendors that have declared the feature id
|
|
255
|
+
*/
|
|
256
|
+
getVendorsWithFeature(featureId: number): IntMap<Vendor>;
|
|
257
|
+
/**
|
|
258
|
+
* getVendorsWithSpecialFeature
|
|
259
|
+
*
|
|
260
|
+
* @param {number} specialFeatureId
|
|
261
|
+
* @return {IntMap<Vendor>} - list of vendors that have declared the special feature id
|
|
262
|
+
*/
|
|
263
|
+
getVendorsWithSpecialFeature(specialFeatureId: number): IntMap<Vendor>;
|
|
264
|
+
/**
|
|
265
|
+
* vendors
|
|
266
|
+
*
|
|
267
|
+
* @return {IntMap<Vendor>} - the list of vendors as it would on the JSON file
|
|
268
|
+
* except if `narrowVendorsTo` was called, it would be that narrowed list
|
|
269
|
+
*/
|
|
270
|
+
get vendors(): IntMap<Vendor>;
|
|
271
|
+
/**
|
|
272
|
+
* narrowVendorsTo - narrows vendors represented in this GVL to the list of ids passed in
|
|
273
|
+
*
|
|
274
|
+
* @param {number[]} vendorIds - list of ids to narrow this GVL to
|
|
275
|
+
* @return {void}
|
|
276
|
+
*/
|
|
277
|
+
narrowVendorsTo(vendorIds: number[]): void;
|
|
278
|
+
/**
|
|
279
|
+
* isReady - Whether or not this instance is ready to be used. This will be
|
|
280
|
+
* immediately and synchronously true if a vendorlist object is passed into
|
|
281
|
+
* the constructor or once the JSON vendorllist is retrieved.
|
|
282
|
+
*
|
|
283
|
+
* @return {boolean} whether or not the instance is ready to be interacted
|
|
284
|
+
* with and all the data is populated
|
|
285
|
+
*/
|
|
286
|
+
get isReady(): boolean;
|
|
287
|
+
/**
|
|
288
|
+
* clone - overrides base `clone()` method since GVL is a special class that
|
|
289
|
+
* represents a JSON structure with some additional functionality.
|
|
290
|
+
*
|
|
291
|
+
* @return {GVL}
|
|
292
|
+
*/
|
|
293
|
+
clone(): GVL;
|
|
294
|
+
static isInstanceOf(questionableInstance: unknown): questionableInstance is GVL;
|
|
295
|
+
}
|
package/lib/cjs/GVL.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __extends=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),__awaiter=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(s,o){function i(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},__generator=this&&this.__generator||function(e,t){var r,n,s,o,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(s=2&o[0]?n.return:o[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,o[1])).done)return s;switch(n=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(s=i.trys,(s=s.length>0&&s[s.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){i.label=o[1];break}if(6===o[0]&&i.label<s[1]){i.label=s[1],s=o;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(o);break}s[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{r=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.GVL=void 0;var Cloneable_js_1=require("./Cloneable.js"),index_js_1=require("./errors/index.js"),Json_js_1=require("./Json.js"),index_js_2=require("./model/index.js"),GVL=function(e){function t(r){var n=e.call(this)||this;n.isReady_=!1,n.isLatest=!1;var s=t.baseUrl;if(n.lang_=t.DEFAULT_LANGUAGE,n.isVendorList(r))n.populate(r),n.readyPromise=Promise.resolve();else{if(!s)throw new index_js_1.GVLError("must specify GVL.baseUrl before loading GVL json");if(r>0){var o=r;t.CACHE.has(o)?(n.populate(t.CACHE.get(o)),n.readyPromise=Promise.resolve()):(s+=t.versionedFilename.replace("[VERSION]",String(o)),n.readyPromise=n.fetchJson(s))}else t.CACHE.has(t.LATEST_CACHE_KEY)?(n.populate(t.CACHE.get(t.LATEST_CACHE_KEY)),n.readyPromise=Promise.resolve()):(n.isLatest=!0,n.readyPromise=n.fetchJson(s+t.latestFilename))}return n}return __extends(t,e),Object.defineProperty(t,"baseUrl",{get:function(){return this.baseUrl_},set:function(e){if(/^https?:\/\/vendorlist\.consensu\.org\//.test(e))throw new index_js_1.GVLError("Invalid baseUrl! You may not pull directly from vendorlist.consensu.org and must provide your own cache");e.length>0&&"/"!==e[e.length-1]&&(e+="/"),this.baseUrl_=e},enumerable:!1,configurable:!0}),t.emptyLanguageCache=function(e){var r=!1;return void 0===e&&t.LANGUAGE_CACHE.size>0?(t.LANGUAGE_CACHE=new Map,r=!0):"string"==typeof e&&this.consentLanguages.has(e.toUpperCase())&&(t.LANGUAGE_CACHE.delete(e.toUpperCase()),r=!0),r},t.emptyCache=function(e){var r=!1;return Number.isInteger(e)&&e>=0?(t.CACHE.delete(e),r=!0):void 0===e&&(t.CACHE=new Map,r=!0),r},t.prototype.cacheLanguage=function(){t.LANGUAGE_CACHE.has(this.lang_)||t.LANGUAGE_CACHE.set(this.lang_,{purposes:this.purposes,specialPurposes:this.specialPurposes,features:this.features,specialFeatures:this.specialFeatures,stacks:this.stacks,dataCategories:this.dataCategories})},t.prototype.fetchJson=function(e){return __awaiter(this,void 0,void 0,(function(){var t,r;return __generator(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),t=this.populate,[4,Json_js_1.Json.fetch(e)];case 1:return t.apply(this,[n.sent()]),[3,3];case 2:throw r=n.sent(),new index_js_1.GVLError(r.message);case 3:return[2]}}))}))},t.prototype.getJson=function(){return JSON.parse(JSON.stringify({gvlSpecificationVersion:this.gvlSpecificationVersion,vendorListVersion:this.vendorListVersion,tcfPolicyVersion:this.tcfPolicyVersion,lastUpdated:this.lastUpdated,purposes:this.purposes,specialPurposes:this.specialPurposes,features:this.features,specialFeatures:this.specialFeatures,stacks:this.stacks,dataCategories:this.dataCategories,vendors:this.fullVendorList}))},t.prototype.changeLanguage=function(e){return __awaiter(this,void 0,void 0,(function(){var r,n,s,o,i;return __generator(this,(function(a){switch(a.label){case 0:if(r=e.toUpperCase(),!t.consentLanguages.has(r))return[3,6];if(r===this.lang_)return[3,5];if(this.lang_=r,!t.LANGUAGE_CACHE.has(r))return[3,1];for(s in n=t.LANGUAGE_CACHE.get(r))n.hasOwnProperty(s)&&(this[s]=n[s]);return[3,5];case 1:o=t.baseUrl+t.languageFilename.replace("[LANG]",e),a.label=2;case 2:return a.trys.push([2,4,,5]),[4,this.fetchJson(o)];case 3:return a.sent(),this.cacheLanguage(),[3,5];case 4:throw i=a.sent(),new index_js_1.GVLError("unable to load language: "+i.message);case 5:return[3,7];case 6:throw new index_js_1.GVLError("unsupported language ".concat(e));case 7:return[2]}}))}))},Object.defineProperty(t.prototype,"language",{get:function(){return this.lang_},enumerable:!1,configurable:!0}),t.prototype.isVendorList=function(e){return void 0!==e&&void 0!==e.vendors},t.prototype.populate=function(e){this.purposes=e.purposes,this.specialPurposes=e.specialPurposes,this.features=e.features,this.specialFeatures=e.specialFeatures,this.stacks=e.stacks,this.dataCategories=e.dataCategories,this.isVendorList(e)&&(this.gvlSpecificationVersion=e.gvlSpecificationVersion,this.tcfPolicyVersion=e.tcfPolicyVersion,this.vendorListVersion=e.vendorListVersion,this.lastUpdated=e.lastUpdated,"string"==typeof this.lastUpdated&&(this.lastUpdated=new Date(this.lastUpdated)),this.vendors_=e.vendors,this.fullVendorList=e.vendors,this.mapVendors(),this.isReady_=!0,this.isLatest&&t.CACHE.set(t.LATEST_CACHE_KEY,this.getJson()),t.CACHE.has(this.vendorListVersion)||t.CACHE.set(this.vendorListVersion,this.getJson())),this.cacheLanguage()},t.prototype.mapVendors=function(e){var t=this;this.byPurposeVendorMap={},this.bySpecialPurposeVendorMap={},this.byFeatureVendorMap={},this.bySpecialFeatureVendorMap={},Object.keys(this.purposes).forEach((function(e){t.byPurposeVendorMap[e]={legInt:new Set,consent:new Set,flexible:new Set}})),Object.keys(this.specialPurposes).forEach((function(e){t.bySpecialPurposeVendorMap[e]=new Set})),Object.keys(this.features).forEach((function(e){t.byFeatureVendorMap[e]=new Set})),Object.keys(this.specialFeatures).forEach((function(e){t.bySpecialFeatureVendorMap[e]=new Set})),Array.isArray(e)||(e=Object.keys(this.fullVendorList).map((function(e){return+e}))),this.vendorIds=new Set(e),this.vendors_=e.reduce((function(e,r){var n=t.vendors_[String(r)];return n&&void 0===n.deletedDate&&(n.purposes.forEach((function(e){t.byPurposeVendorMap[String(e)].consent.add(r)})),n.specialPurposes.forEach((function(e){t.bySpecialPurposeVendorMap[String(e)].add(r)})),n.legIntPurposes.forEach((function(e){t.byPurposeVendorMap[String(e)].legInt.add(r)})),n.flexiblePurposes&&n.flexiblePurposes.forEach((function(e){t.byPurposeVendorMap[String(e)].flexible.add(r)})),n.features.forEach((function(e){t.byFeatureVendorMap[String(e)].add(r)})),n.specialFeatures.forEach((function(e){t.bySpecialFeatureVendorMap[String(e)].add(r)})),e[r]=n),e}),{})},t.prototype.getFilteredVendors=function(e,t,r,n){var s=this,o=e.charAt(0).toUpperCase()+e.slice(1),i={};return("purpose"===e&&r?this["by"+o+"VendorMap"][String(t)][r]:this["by"+(n?"Special":"")+o+"VendorMap"][String(t)]).forEach((function(e){i[String(e)]=s.vendors[String(e)]})),i},t.prototype.getVendorsWithConsentPurpose=function(e){return this.getFilteredVendors("purpose",e,"consent")},t.prototype.getVendorsWithLegIntPurpose=function(e){return this.getFilteredVendors("purpose",e,"legInt")},t.prototype.getVendorsWithFlexiblePurpose=function(e){return this.getFilteredVendors("purpose",e,"flexible")},t.prototype.getVendorsWithSpecialPurpose=function(e){return this.getFilteredVendors("purpose",e,void 0,!0)},t.prototype.getVendorsWithFeature=function(e){return this.getFilteredVendors("feature",e)},t.prototype.getVendorsWithSpecialFeature=function(e){return this.getFilteredVendors("feature",e,void 0,!0)},Object.defineProperty(t.prototype,"vendors",{get:function(){return this.vendors_},enumerable:!1,configurable:!0}),t.prototype.narrowVendorsTo=function(e){this.mapVendors(e)},Object.defineProperty(t.prototype,"isReady",{get:function(){return this.isReady_},enumerable:!1,configurable:!0}),t.prototype.clone=function(){var e=new t(this.getJson());return this.lang_!==t.DEFAULT_LANGUAGE&&e.changeLanguage(this.lang_),e},t.isInstanceOf=function(e){return"object"==typeof e&&"function"==typeof e.narrowVendorsTo},t.LANGUAGE_CACHE=new Map,t.CACHE=new Map,t.LATEST_CACHE_KEY=0,t.DEFAULT_LANGUAGE="EN",t.consentLanguages=new index_js_2.ConsentLanguages,t.latestFilename="vendor-list.json",t.versionedFilename="archives/vendor-list-v[VERSION].json",t.languageFilename="purposes-[LANG].json",t}(Cloneable_js_1.Cloneable);exports.GVL=GVL;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare class Json {
|
|
2
|
+
private static absCall;
|
|
3
|
+
/**
|
|
4
|
+
* @static
|
|
5
|
+
* @param {string} url - full path to POST to
|
|
6
|
+
* @param {object} body - JSON object to post
|
|
7
|
+
* @param {boolean} sendCookies - Whether or not to send the XMLHttpRequest with credentials or not
|
|
8
|
+
* @param {number} [timeout] - optional timeout in milliseconds
|
|
9
|
+
* @return {Promise<object>} - if the server responds the response will be returned here
|
|
10
|
+
*/
|
|
11
|
+
static post(url: string, body: object, sendCookies?: boolean, timeout?: number): Promise<object>;
|
|
12
|
+
/**
|
|
13
|
+
* @static
|
|
14
|
+
* @param {string} url - full path to the json
|
|
15
|
+
* @param {boolean} sendCookies - Whether or not to send the XMLHttpRequest with credentials or not
|
|
16
|
+
* @param {number} [timeout] - optional timeout in milliseconds
|
|
17
|
+
* @return {Promise<object>} - resolves with parsed JSON
|
|
18
|
+
*/
|
|
19
|
+
static fetch(url: string, sendCookies?: boolean, timeout?: number): Promise<object>;
|
|
20
|
+
}
|
package/lib/cjs/Json.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Json=void 0;var Json=function(){function e(){}return e.absCall=function(e,t,n,r){return new Promise((function(o,s){var i=new XMLHttpRequest;i.withCredentials=n,i.addEventListener("load",(function(){if(i.readyState==XMLHttpRequest.DONE)if(i.status>=200&&i.status<300){var e=i.response;if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}o(e)}else s(new Error("HTTP Status: ".concat(i.status," response type: ").concat(i.responseType)))})),i.addEventListener("error",(function(){s(new Error("error"))})),i.addEventListener("abort",(function(){s(new Error("aborted"))})),null===t?i.open("GET",e,!0):i.open("POST",e,!0),i.responseType="json",i.timeout=r,i.ontimeout=function(){s(new Error("Timeout "+r+"ms "+e))},i.send(t)}))},e.post=function(e,t,n,r){return void 0===n&&(n=!1),void 0===r&&(r=0),this.absCall(e,JSON.stringify(t),n,r)},e.fetch=function(e,t,n){return void 0===t&&(t=!1),void 0===n&&(n=0),this.absCall(e,null,t,n)},e}();exports.Json=Json;
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { Cloneable } from './Cloneable.js';
|
|
2
|
+
import { GVL } from './GVL.js';
|
|
3
|
+
import { ConsentLanguages, IntMap, PurposeRestrictionVector, Vector } from './model/index.js';
|
|
4
|
+
import { Purpose } from './model/gvl/index.js';
|
|
5
|
+
declare type StringOrNumber = number | string;
|
|
6
|
+
export declare type TCModelPropType = number | Date | string | boolean | Vector | PurposeRestrictionVector;
|
|
7
|
+
export declare class TCModel extends Cloneable<TCModel> {
|
|
8
|
+
/**
|
|
9
|
+
* Set of available consent languages published by the IAB
|
|
10
|
+
*/
|
|
11
|
+
static readonly consentLanguages: ConsentLanguages;
|
|
12
|
+
private isServiceSpecific_;
|
|
13
|
+
private supportOOB_;
|
|
14
|
+
private useNonStandardStacks_;
|
|
15
|
+
private purposeOneTreatment_;
|
|
16
|
+
private publisherCountryCode_;
|
|
17
|
+
private version_;
|
|
18
|
+
private consentScreen_;
|
|
19
|
+
private policyVersion_;
|
|
20
|
+
private consentLanguage_;
|
|
21
|
+
private cmpId_;
|
|
22
|
+
private cmpVersion_;
|
|
23
|
+
private vendorListVersion_;
|
|
24
|
+
private numCustomPurposes_;
|
|
25
|
+
private gvl_;
|
|
26
|
+
created: Date;
|
|
27
|
+
lastUpdated: Date;
|
|
28
|
+
/**
|
|
29
|
+
* The TCF designates certain Features as special, that is, a CMP must afford
|
|
30
|
+
* the user a means to opt in to their use. These Special Features are
|
|
31
|
+
* published and numbered in the GVL separately from normal Features.
|
|
32
|
+
* Provides for up to 12 special features.
|
|
33
|
+
*/
|
|
34
|
+
readonly specialFeatureOptins: Vector;
|
|
35
|
+
/**
|
|
36
|
+
* Renamed from `PurposesAllowed` in TCF v1.1
|
|
37
|
+
* The user’s consent value for each Purpose established on the legal basis
|
|
38
|
+
* of consent. Purposes are published in the Global Vendor List (see. [[GVL]]).
|
|
39
|
+
*/
|
|
40
|
+
readonly purposeConsents: Vector;
|
|
41
|
+
/**
|
|
42
|
+
* The user’s permission for each Purpose established on the legal basis of
|
|
43
|
+
* legitimate interest. If the user has exercised right-to-object for a
|
|
44
|
+
* purpose.
|
|
45
|
+
*/
|
|
46
|
+
readonly purposeLegitimateInterests: Vector;
|
|
47
|
+
/**
|
|
48
|
+
* The user’s consent value for each Purpose established on the legal basis
|
|
49
|
+
* of consent, for the publisher. Purposes are published in the Global
|
|
50
|
+
* Vendor List.
|
|
51
|
+
*/
|
|
52
|
+
readonly publisherConsents: Vector;
|
|
53
|
+
/**
|
|
54
|
+
* The user’s permission for each Purpose established on the legal basis of
|
|
55
|
+
* legitimate interest. If the user has exercised right-to-object for a
|
|
56
|
+
* purpose.
|
|
57
|
+
*/
|
|
58
|
+
readonly publisherLegitimateInterests: Vector;
|
|
59
|
+
/**
|
|
60
|
+
* The user’s consent value for each Purpose established on the legal basis
|
|
61
|
+
* of consent, for the publisher. Purposes are published in the Global
|
|
62
|
+
* Vendor List.
|
|
63
|
+
*/
|
|
64
|
+
readonly publisherCustomConsents: Vector;
|
|
65
|
+
/**
|
|
66
|
+
* The user’s permission for each Purpose established on the legal basis of
|
|
67
|
+
* legitimate interest. If the user has exercised right-to-object for a
|
|
68
|
+
* purpose that is established in the publisher's custom purposes.
|
|
69
|
+
*/
|
|
70
|
+
readonly publisherCustomLegitimateInterests: Vector;
|
|
71
|
+
/**
|
|
72
|
+
* set by a publisher if they wish to collect consent and LI Transparency for
|
|
73
|
+
* purposes outside of the TCF
|
|
74
|
+
*/
|
|
75
|
+
customPurposes: IntMap<Purpose>;
|
|
76
|
+
/**
|
|
77
|
+
* Each [[Vendor]] is keyed by id. Their consent value is true if it is in
|
|
78
|
+
* the Vector
|
|
79
|
+
*/
|
|
80
|
+
readonly vendorConsents: Vector;
|
|
81
|
+
/**
|
|
82
|
+
* Each [[Vendor]] is keyed by id. Whether their Legitimate Interests
|
|
83
|
+
* Disclosures have been established is stored as boolean.
|
|
84
|
+
* see: [[Vector]]
|
|
85
|
+
*/
|
|
86
|
+
readonly vendorLegitimateInterests: Vector;
|
|
87
|
+
/**
|
|
88
|
+
* The value included for disclosed vendors signals which vendors have been
|
|
89
|
+
* disclosed to the user in the interface surfaced by the CMP. This section
|
|
90
|
+
* content is required when writing a TC string to the global (consensu)
|
|
91
|
+
* scope. When a CMP has read from and is updating a TC string from the
|
|
92
|
+
* global consensu.org storage, the CMP MUST retain the existing disclosure
|
|
93
|
+
* information and only add information for vendors that it has disclosed
|
|
94
|
+
* that had not been disclosed by other CMPs in prior interactions with this
|
|
95
|
+
* device/user agent.
|
|
96
|
+
*/
|
|
97
|
+
readonly vendorsDisclosed: Vector;
|
|
98
|
+
/**
|
|
99
|
+
* Signals which vendors the publisher permits to use OOB legal bases.
|
|
100
|
+
*/
|
|
101
|
+
readonly vendorsAllowed: Vector;
|
|
102
|
+
readonly publisherRestrictions: PurposeRestrictionVector;
|
|
103
|
+
/**
|
|
104
|
+
* Constructs the TCModel. Passing a [[GVL]] is optional when constructing
|
|
105
|
+
* as this TCModel may be constructed from decoding an existing encoded
|
|
106
|
+
* TCString.
|
|
107
|
+
*
|
|
108
|
+
* @param {GVL} [gvl]
|
|
109
|
+
*/
|
|
110
|
+
constructor(gvl?: GVL);
|
|
111
|
+
/**
|
|
112
|
+
* sets the [[GVL]] with side effects of also setting the `vendorListVersion`, `policyVersion`, and `consentLanguage`
|
|
113
|
+
* @param {GVL} gvl
|
|
114
|
+
*/
|
|
115
|
+
set gvl(gvl: GVL);
|
|
116
|
+
/**
|
|
117
|
+
* @return {GVL} the gvl instance set on this TCModel instance
|
|
118
|
+
*/
|
|
119
|
+
get gvl(): GVL;
|
|
120
|
+
/**
|
|
121
|
+
* @param {number} integer - A unique ID will be assigned to each Consent
|
|
122
|
+
* Manager Provider (CMP) from the iab.
|
|
123
|
+
*
|
|
124
|
+
* @throws {TCModelError} if the value is not an integer greater than 1 as those are not valid.
|
|
125
|
+
*/
|
|
126
|
+
set cmpId(integer: StringOrNumber);
|
|
127
|
+
get cmpId(): StringOrNumber;
|
|
128
|
+
/**
|
|
129
|
+
* Each change to an operating CMP should receive a
|
|
130
|
+
* new version number, for logging proof of consent. CmpVersion defined by
|
|
131
|
+
* each CMP.
|
|
132
|
+
*
|
|
133
|
+
* @param {number} integer
|
|
134
|
+
*
|
|
135
|
+
* @throws {TCModelError} if the value is not an integer greater than 1 as those are not valid.
|
|
136
|
+
*/
|
|
137
|
+
set cmpVersion(integer: StringOrNumber);
|
|
138
|
+
get cmpVersion(): StringOrNumber;
|
|
139
|
+
/**
|
|
140
|
+
* The screen number is CMP and CmpVersion
|
|
141
|
+
* specific, and is for logging proof of consent.(For example, a CMP could
|
|
142
|
+
* keep records so that a publisher can request information about the context
|
|
143
|
+
* in which consent was gathered.)
|
|
144
|
+
*
|
|
145
|
+
* @param {number} integer
|
|
146
|
+
*
|
|
147
|
+
* @throws {TCModelError} if the value is not an integer greater than 0 as those are not valid.
|
|
148
|
+
*/
|
|
149
|
+
set consentScreen(integer: StringOrNumber);
|
|
150
|
+
get consentScreen(): StringOrNumber;
|
|
151
|
+
/**
|
|
152
|
+
* @param {string} lang - [two-letter ISO 639-1 language
|
|
153
|
+
* code](http://www.loc.gov/standards/iso639-2/php/code_list.php) in which
|
|
154
|
+
* the CMP UI was presented
|
|
155
|
+
*
|
|
156
|
+
* @throws {TCModelError} if the value is not a length-2 string of alpha characters
|
|
157
|
+
*/
|
|
158
|
+
set consentLanguage(lang: string);
|
|
159
|
+
get consentLanguage(): string;
|
|
160
|
+
/**
|
|
161
|
+
* @param {string} countryCode - [two-letter ISO 3166-1 alpha-2 country
|
|
162
|
+
* code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the publisher,
|
|
163
|
+
* determined by the CMP-settings of the publisher.
|
|
164
|
+
*
|
|
165
|
+
* @throws {TCModelError} if the value is not a length-2 string of alpha characters
|
|
166
|
+
*/
|
|
167
|
+
set publisherCountryCode(countryCode: string);
|
|
168
|
+
get publisherCountryCode(): string;
|
|
169
|
+
/**
|
|
170
|
+
* Version of the GVL used to create this TCModel. Global
|
|
171
|
+
* Vendor List versions will be released periodically.
|
|
172
|
+
*
|
|
173
|
+
* @param {number} integer
|
|
174
|
+
*
|
|
175
|
+
* @throws {TCModelError} if the value is not an integer greater than 0 as those are not valid.
|
|
176
|
+
*/
|
|
177
|
+
set vendorListVersion(integer: StringOrNumber);
|
|
178
|
+
get vendorListVersion(): StringOrNumber;
|
|
179
|
+
/**
|
|
180
|
+
* From the corresponding field in the GVL that was
|
|
181
|
+
* used for obtaining consent. A new policy version invalidates existing
|
|
182
|
+
* strings and requires CMPs to re-establish transparency and consent from
|
|
183
|
+
* users.
|
|
184
|
+
*
|
|
185
|
+
* If a TCF policy version number is different from the one from the latest
|
|
186
|
+
* GVL, the CMP must re-establish transparency and consent.
|
|
187
|
+
*
|
|
188
|
+
* @param {number} num - You do not need to set this. This comes
|
|
189
|
+
* directly from the [[GVL]].
|
|
190
|
+
*
|
|
191
|
+
*/
|
|
192
|
+
set policyVersion(num: StringOrNumber);
|
|
193
|
+
get policyVersion(): StringOrNumber;
|
|
194
|
+
set version(num: StringOrNumber);
|
|
195
|
+
get version(): StringOrNumber;
|
|
196
|
+
/**
|
|
197
|
+
* Whether the signals encoded in this TC String were from site-specific
|
|
198
|
+
* storage `true` versus ‘global’ consensu.org shared storage `false`. A
|
|
199
|
+
* string intended to be stored in global/shared scope but the CMP is unable
|
|
200
|
+
* to store due to a user agent not accepting third-party cookies would be
|
|
201
|
+
* considered site-specific `true`.
|
|
202
|
+
*
|
|
203
|
+
* @param {boolean} bool - value to set. Some changes to other fields in this
|
|
204
|
+
* model will automatically change this value like adding publisher
|
|
205
|
+
* restrictions.
|
|
206
|
+
*/
|
|
207
|
+
set isServiceSpecific(bool: boolean);
|
|
208
|
+
get isServiceSpecific(): boolean;
|
|
209
|
+
/**
|
|
210
|
+
* Non-standard stacks means that a CMP is using publisher-customized stack
|
|
211
|
+
* descriptions. Stacks (in terms of purposes in a stack) are pre-set by the
|
|
212
|
+
* IAB. As are titles. Descriptions are pre-set, but publishers can customize
|
|
213
|
+
* them. If they do, they need to set this bit to indicate that they've
|
|
214
|
+
* customized descriptions.
|
|
215
|
+
*
|
|
216
|
+
* @param {boolean} bool - value to set
|
|
217
|
+
*/
|
|
218
|
+
set useNonStandardStacks(bool: boolean);
|
|
219
|
+
get useNonStandardStacks(): boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Whether or not this publisher supports OOB signaling. On Global TC String
|
|
222
|
+
* OOB Vendors Disclosed will be included if the publish wishes to no allow
|
|
223
|
+
* these vendors they should set this to false.
|
|
224
|
+
* @param {boolean} bool - value to set
|
|
225
|
+
*/
|
|
226
|
+
set supportOOB(bool: boolean);
|
|
227
|
+
get supportOOB(): boolean;
|
|
228
|
+
/**
|
|
229
|
+
* `false` There is no special Purpose 1 status.
|
|
230
|
+
* Purpose 1 was disclosed normally (consent) as expected by Policy. `true`
|
|
231
|
+
* Purpose 1 not disclosed at all. CMPs use PublisherCC to indicate the
|
|
232
|
+
* publisher’s country of establishment to help Vendors determine whether the
|
|
233
|
+
* vendor requires Purpose 1 consent. In global scope TC strings, this field
|
|
234
|
+
* must always have a value of `false`. When a CMP encounters a global scope
|
|
235
|
+
* string with `purposeOneTreatment=true` then that string should be
|
|
236
|
+
* considered invalid and the CMP must re-establish transparency and consent.
|
|
237
|
+
*
|
|
238
|
+
* @param {boolean} bool
|
|
239
|
+
*/
|
|
240
|
+
set purposeOneTreatment(bool: boolean);
|
|
241
|
+
get purposeOneTreatment(): boolean;
|
|
242
|
+
/**
|
|
243
|
+
* setAllVendorConsents - sets all vendors on the GVL Consent (true)
|
|
244
|
+
*
|
|
245
|
+
* @return {void}
|
|
246
|
+
*/
|
|
247
|
+
setAllVendorConsents(): void;
|
|
248
|
+
/**
|
|
249
|
+
* unsetAllVendorConsents - unsets all vendors on the GVL Consent (false)
|
|
250
|
+
*
|
|
251
|
+
* @return {void}
|
|
252
|
+
*/
|
|
253
|
+
unsetAllVendorConsents(): void;
|
|
254
|
+
/**
|
|
255
|
+
* setAllVendorsDisclosed - sets all vendors on the GVL Vendors Disclosed (true)
|
|
256
|
+
*
|
|
257
|
+
* @return {void}
|
|
258
|
+
*/
|
|
259
|
+
setAllVendorsDisclosed(): void;
|
|
260
|
+
/**
|
|
261
|
+
* unsetAllVendorsDisclosed - unsets all vendors on the GVL Consent (false)
|
|
262
|
+
*
|
|
263
|
+
* @return {void}
|
|
264
|
+
*/
|
|
265
|
+
unsetAllVendorsDisclosed(): void;
|
|
266
|
+
/**
|
|
267
|
+
* setAllVendorsAllowed - sets all vendors on the GVL Consent (true)
|
|
268
|
+
*
|
|
269
|
+
* @return {void}
|
|
270
|
+
*/
|
|
271
|
+
setAllVendorsAllowed(): void;
|
|
272
|
+
/**
|
|
273
|
+
* unsetAllVendorsAllowed - unsets all vendors on the GVL Consent (false)
|
|
274
|
+
*
|
|
275
|
+
* @return {void}
|
|
276
|
+
*/
|
|
277
|
+
unsetAllVendorsAllowed(): void;
|
|
278
|
+
/**
|
|
279
|
+
* setAllVendorLegitimateInterests - sets all vendors on the GVL LegitimateInterests (true)
|
|
280
|
+
*
|
|
281
|
+
* @return {void}
|
|
282
|
+
*/
|
|
283
|
+
setAllVendorLegitimateInterests(): void;
|
|
284
|
+
/**
|
|
285
|
+
* unsetAllVendorLegitimateInterests - unsets all vendors on the GVL LegitimateInterests (false)
|
|
286
|
+
*
|
|
287
|
+
* @return {void}
|
|
288
|
+
*/
|
|
289
|
+
unsetAllVendorLegitimateInterests(): void;
|
|
290
|
+
/**
|
|
291
|
+
* setAllPurposeConsents - sets all purposes on the GVL Consent (true)
|
|
292
|
+
*
|
|
293
|
+
* @return {void}
|
|
294
|
+
*/
|
|
295
|
+
setAllPurposeConsents(): void;
|
|
296
|
+
/**
|
|
297
|
+
* unsetAllPurposeConsents - unsets all purposes on the GVL Consent (false)
|
|
298
|
+
*
|
|
299
|
+
* @return {void}
|
|
300
|
+
*/
|
|
301
|
+
unsetAllPurposeConsents(): void;
|
|
302
|
+
/**
|
|
303
|
+
* setAllPurposeLegitimateInterests - sets all purposes on the GVL LI Transparency (true)
|
|
304
|
+
*
|
|
305
|
+
* @return {void}
|
|
306
|
+
*/
|
|
307
|
+
setAllPurposeLegitimateInterests(): void;
|
|
308
|
+
/**
|
|
309
|
+
* unsetAllPurposeLegitimateInterests - unsets all purposes on the GVL LI Transparency (false)
|
|
310
|
+
*
|
|
311
|
+
* @return {void}
|
|
312
|
+
*/
|
|
313
|
+
unsetAllPurposeLegitimateInterests(): void;
|
|
314
|
+
/**
|
|
315
|
+
* setAllSpecialFeatureOptins - sets all special featuresOptins on the GVL (true)
|
|
316
|
+
*
|
|
317
|
+
* @return {void}
|
|
318
|
+
*/
|
|
319
|
+
setAllSpecialFeatureOptins(): void;
|
|
320
|
+
/**
|
|
321
|
+
* unsetAllSpecialFeatureOptins - unsets all special featuresOptins on the GVL (true)
|
|
322
|
+
*
|
|
323
|
+
* @return {void}
|
|
324
|
+
*/
|
|
325
|
+
unsetAllSpecialFeatureOptins(): void;
|
|
326
|
+
setAll(): void;
|
|
327
|
+
unsetAll(): void;
|
|
328
|
+
get numCustomPurposes(): StringOrNumber;
|
|
329
|
+
set numCustomPurposes(num: StringOrNumber);
|
|
330
|
+
/**
|
|
331
|
+
* updated - updates the created and lastUpdated dates with a 'now' day-level UTC timestamp
|
|
332
|
+
*
|
|
333
|
+
* @return {void}
|
|
334
|
+
*/
|
|
335
|
+
updated(): void;
|
|
336
|
+
}
|
|
337
|
+
export {};
|