-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathTCF2Settings.tsx
More file actions
257 lines (245 loc) · 9.47 KB
/
TCF2Settings.tsx
File metadata and controls
257 lines (245 loc) · 9.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
export class TCF2Settings {
firstLayerTitle: string
secondLayerTitle: string
tabsPurposeLabel: string
tabsVendorsLabel: string
labelsFeatures: string
labelsIabVendors: string
labelsNonIabPurposes: string
labelsNonIabVendors: string
labelsPurposes: string
vendorFeatures: string
vendorLegitimateInterestPurposes: string
vendorPurpose: string
vendorSpecialFeatures: string
vendorSpecialPurposes: string
togglesConsentToggleLabel: string
togglesLegIntToggleLabel: string
buttonsAcceptAllLabel: string
buttonsDenyAllLabel: string
buttonsSaveLabel: string
linksManageSettingsLabel: string
linksVendorListLinkLabel: string
cmpId: number
cmpVersion: number
firstLayerHideToggles: boolean
secondLayerHideToggles: boolean
hideLegitimateInterestToggles: boolean
firstLayerHideButtonDeny?: boolean
secondLayerHideButtonDeny: boolean
publisherCountryCode: string
purposeOneTreatment: boolean
selectedVendorIds: [number]
gdprApplies: boolean
selectedStacks: [number]
disabledSpecialFeatures: [number]
firstLayerShowDescriptions: boolean
hideNonIabOnFirstLayer: boolean
resurfacePeriod: number
resurfacePurposeChanged: boolean
resurfaceVendorAdded: boolean
firstLayerDescription: string
firstLayerAdditionalInfo: string
secondLayerDescription: string
togglesSpecialFeaturesToggleOn: string
togglesSpecialFeaturesToggleOff: string
appLayerNoteResurface: string
firstLayerNoteResurface: string
categoriesOfDataLabel: string
dataRetentionPeriodLabel: string
legitimateInterestLabel: string
version: string
examplesLabel: string
firstLayerMobileVariant?: FirstLayerMobileVariant
showDataSharedOutsideEUText: boolean
dataSharedOutsideEUText?: string
vendorIdsOutsideEUList: [number]
scope: TCF2Scope
changedPurposes: TCF2ChangedPurposes
acmV2Enabled: boolean
selectedATPIds: number[]
consentOrPay?: TCF2ConsentOrPaySettings
mandatoryLabel: string
specialFeaturesConsentOrPay?: ConsentOrPayRestriction[]
constructor(
firstLayerTitle: string,
secondLayerTitle: string,
tabsPurposeLabel: string,
tabsVendorsLabel: string,
labelsFeatures: string,
labelsIabVendors: string,
labelsNonIabPurposes: string,
labelsNonIabVendors: string,
labelsPurposes: string,
vendorFeatures: string,
vendorLegitimateInterestPurposes: string,
vendorPurpose: string,
vendorSpecialFeatures: string,
vendorSpecialPurposes: string,
togglesConsentToggleLabel: string,
togglesLegIntToggleLabel: string,
buttonsAcceptAllLabel: string,
buttonsDenyAllLabel: string,
buttonsSaveLabel: string,
linksManageSettingsLabel: string,
linksVendorListLinkLabel: string,
cmpId: number,
cmpVersion: number,
firstLayerHideToggles: boolean,
secondLayerHideToggles: boolean,
hideLegitimateInterestToggles: boolean,
secondLayerHideButtonDeny: boolean,
publisherCountryCode: string,
purposeOneTreatment: boolean,
selectedVendorIds: [number],
gdprApplies: boolean,
selectedStacks: [number],
disabledSpecialFeatures: [number],
firstLayerShowDescriptions: boolean,
hideNonIabOnFirstLayer: boolean,
resurfacePeriod: number,
resurfacePurposeChanged: boolean,
resurfaceVendorAdded: boolean,
firstLayerDescription: string,
firstLayerAdditionalInfo: string,
secondLayerDescription: string,
togglesSpecialFeaturesToggleOn: string,
togglesSpecialFeaturesToggleOff: string,
appLayerNoteResurface: string,
firstLayerNoteResurface: string,
categoriesOfDataLabel: string,
dataRetentionPeriodLabel: string,
legitimateInterestLabel: string,
version: string,
examplesLabel: string,
showDataSharedOutsideEUText: boolean,
vendorIdsOutsideEUList: [number],
scope: TCF2Scope,
changedPurposes: TCF2ChangedPurposes,
acmV2Enabled: boolean,
selectedATPIds: number[],
firstLayerHideButtonDeny?: boolean,
firstLayerMobileVariant?: FirstLayerMobileVariant,
dataSharedOutsideEUText?: string,
consentOrPay?: TCF2ConsentOrPaySettings,
mandatoryLabel: string = 'Mandatory',
specialFeaturesConsentOrPay?: ConsentOrPayRestriction[],
) {
this.firstLayerTitle = firstLayerTitle
this.secondLayerTitle = secondLayerTitle
this.tabsPurposeLabel = tabsPurposeLabel
this.tabsVendorsLabel = tabsVendorsLabel
this.labelsFeatures = labelsFeatures
this.labelsIabVendors = labelsIabVendors
this.labelsNonIabPurposes = labelsNonIabPurposes
this.labelsNonIabVendors = labelsNonIabVendors
this.labelsPurposes = labelsPurposes
this.vendorFeatures = vendorFeatures
this.vendorLegitimateInterestPurposes = vendorLegitimateInterestPurposes
this.vendorPurpose = vendorPurpose
this.vendorSpecialFeatures = vendorSpecialFeatures
this.vendorSpecialPurposes = vendorSpecialPurposes
this.togglesConsentToggleLabel = togglesConsentToggleLabel
this.togglesLegIntToggleLabel = togglesLegIntToggleLabel
this.buttonsAcceptAllLabel = buttonsAcceptAllLabel
this.buttonsDenyAllLabel = buttonsDenyAllLabel
this.buttonsSaveLabel = buttonsSaveLabel
this.linksManageSettingsLabel = linksManageSettingsLabel
this.linksVendorListLinkLabel = linksVendorListLinkLabel
this.cmpId = cmpId
this.cmpVersion = cmpVersion
this.firstLayerHideToggles = firstLayerHideToggles
this.secondLayerHideToggles = secondLayerHideToggles
this.hideLegitimateInterestToggles = hideLegitimateInterestToggles
this.firstLayerHideButtonDeny = firstLayerHideButtonDeny
this.secondLayerHideButtonDeny = secondLayerHideButtonDeny
this.publisherCountryCode = publisherCountryCode
this.purposeOneTreatment = purposeOneTreatment
this.selectedVendorIds = selectedVendorIds
this.gdprApplies = gdprApplies
this.selectedStacks = selectedStacks
this.disabledSpecialFeatures = disabledSpecialFeatures
this.firstLayerShowDescriptions = firstLayerShowDescriptions
this.hideNonIabOnFirstLayer = hideNonIabOnFirstLayer
this.resurfacePeriod = resurfacePeriod
this.resurfacePurposeChanged = resurfacePurposeChanged
this.resurfaceVendorAdded = resurfaceVendorAdded
this.firstLayerDescription = firstLayerDescription
this.firstLayerAdditionalInfo = firstLayerAdditionalInfo
this.secondLayerDescription = secondLayerDescription
this.togglesSpecialFeaturesToggleOn = togglesSpecialFeaturesToggleOn
this.togglesSpecialFeaturesToggleOff = togglesSpecialFeaturesToggleOff
this.appLayerNoteResurface = appLayerNoteResurface
this.firstLayerNoteResurface = firstLayerNoteResurface
this.categoriesOfDataLabel = categoriesOfDataLabel
this.dataRetentionPeriodLabel = dataRetentionPeriodLabel
this.legitimateInterestLabel = legitimateInterestLabel
this.version = version
this.examplesLabel = examplesLabel
this.firstLayerMobileVariant = firstLayerMobileVariant
this.showDataSharedOutsideEUText = showDataSharedOutsideEUText
this.dataSharedOutsideEUText = dataSharedOutsideEUText
this.vendorIdsOutsideEUList = vendorIdsOutsideEUList
this.scope = scope
this.changedPurposes = changedPurposes
this.acmV2Enabled = acmV2Enabled
this.selectedATPIds = selectedATPIds
this.consentOrPay = consentOrPay
this.mandatoryLabel = mandatoryLabel
this.specialFeaturesConsentOrPay = specialFeaturesConsentOrPay
}
}
export enum FirstLayerMobileVariant {
sheet = 0,
full = 1,
popupBottom = 2,
popupCenter = 3
}
export enum TCF2Scope {
global = 0,
service = 1
}
export class TCF2ChangedPurposes {
purposes: [number]
legIntPurposes: [number]
consentOrPay?: ConsentOrPayRestriction[]
constructor(
purposes: [number],
legIntPurposes: [number],
consentOrPay?: ConsentOrPayRestriction[],
) {
this.purposes = purposes
this.legIntPurposes = legIntPurposes
this.consentOrPay = consentOrPay
}
}
export class ConsentOrPayRestriction {
id: number
value: string
constructor(id: number, value: string) {
this.id = id
this.value = value
}
isFlexible(): boolean {
return this.value?.toUpperCase() === 'FLEXIBLE'
}
}
export class TCF2ConsentOrPaySettings {
enableConsentOrPay: boolean
showTogglesForVendors: boolean
/** Maps TCF Purpose ID (as string) to "flexible". Absent entries are mandatory. */
publisherRestrictions: Record<string, string>
/** Maps Special Feature ID (as string) to "flexible". Absent entries are mandatory. */
specialFeatures: Record<string, string>
constructor(
enableConsentOrPay: boolean,
showTogglesForVendors: boolean,
publisherRestrictions: Record<string, string>,
specialFeatures: Record<string, string>,
) {
this.enableConsentOrPay = enableConsentOrPay
this.showTogglesForVendors = showTogglesForVendors
this.publisherRestrictions = publisherRestrictions
this.specialFeatures = specialFeatures
}
}