@@ -18,6 +18,8 @@ const TCF2 = {
18
18
'purpose7' : { id : 7 , name : 'measurement' }
19
19
}
20
20
21
+ const VENDORLESS_MODULE_TYPES = [ 'fpid-module' ] ;
22
+
21
23
/*
22
24
These rules would be used if `consentManagement.gdpr.rules` is undefined by the publisher.
23
25
*/
@@ -123,9 +125,10 @@ function getGvlidForAnalyticsAdapter(code) {
123
125
* @param {Object } consentData - gdpr consent data
124
126
* @param {string= } currentModule - Bidder code of the current module
125
127
* @param {number= } gvlId - GVL ID for the module
128
+ * @param {string= } moduleType module type
126
129
* @returns {boolean }
127
130
*/
128
- export function validateRules ( rule , consentData , currentModule , gvlId ) {
131
+ export function validateRules ( rule , consentData , currentModule , gvlId , moduleType ) {
129
132
const purposeId = TCF2 [ Object . keys ( TCF2 ) . filter ( purposeName => TCF2 [ purposeName ] . name === rule . purpose ) [ 0 ] ] . id ;
130
133
131
134
// return 'true' if vendor present in 'vendorExceptions'
@@ -138,12 +141,14 @@ export function validateRules(rule, consentData, currentModule, gvlId) {
138
141
const vendorConsent = deepAccess ( consentData , `vendorData.vendor.consents.${ gvlId } ` ) ;
139
142
const liTransparency = deepAccess ( consentData , `vendorData.purpose.legitimateInterests.${ purposeId } ` ) ;
140
143
144
+ const vendorlessModule = includes ( VENDORLESS_MODULE_TYPES , moduleType ) ;
145
+
141
146
/*
142
147
Since vendor exceptions have already been handled, the purpose as a whole is allowed if it's not being enforced
143
148
or the user has consented. Similar with vendors.
144
149
*/
145
150
const purposeAllowed = rule . enforcePurpose === false || purposeConsent === true ;
146
- const vendorAllowed = rule . enforceVendor === false || vendorConsent === true ;
151
+ const vendorAllowed = rule . enforceVendor === false || vendorConsent === true || vendorlessModule === true ;
147
152
148
153
/*
149
154
Few if any vendors should be declaring Legitimate Interest for Device Access (Purpose 1), but some are claiming
@@ -162,15 +167,16 @@ export function validateRules(rule, consentData, currentModule, gvlId) {
162
167
* @param {Function } fn reference to original function (used by hook logic)
163
168
* @param {Number= } gvlid gvlid of the module
164
169
* @param {string= } moduleName name of the module
170
+ * @param {string= } moduleType module type
165
171
*/
166
- export function deviceAccessHook ( fn , gvlid , moduleName , result ) {
172
+ export function deviceAccessHook ( fn , gvlid , moduleName , moduleType , result ) {
167
173
result = Object . assign ( { } , {
168
174
hasEnforcementHook : true
169
175
} ) ;
170
176
if ( ! hasDeviceAccess ( ) ) {
171
177
logWarn ( 'Device access is disabled by Publisher' ) ;
172
178
result . valid = false ;
173
- fn . call ( this , gvlid , moduleName , result ) ;
179
+ fn . call ( this , gvlid , moduleName , moduleType , result ) ;
174
180
} else {
175
181
const consentData = gdprDataHandler . getConsentData ( ) ;
176
182
if ( consentData && consentData . gdprApplies ) {
@@ -183,24 +189,24 @@ export function deviceAccessHook(fn, gvlid, moduleName, result) {
183
189
gvlid = getGvlid ( moduleName ) || gvlid ;
184
190
}
185
191
const curModule = moduleName || curBidder ;
186
- let isAllowed = validateRules ( purpose1Rule , consentData , curModule , gvlid ) ;
192
+ let isAllowed = validateRules ( purpose1Rule , consentData , curModule , gvlid , moduleType ) ;
187
193
if ( isAllowed ) {
188
194
result . valid = true ;
189
- fn . call ( this , gvlid , moduleName , result ) ;
195
+ fn . call ( this , gvlid , moduleName , moduleType , result ) ;
190
196
} else {
191
197
curModule && logWarn ( `TCF2 denied device access for ${ curModule } ` ) ;
192
198
result . valid = false ;
193
199
storageBlocked . push ( curModule ) ;
194
- fn . call ( this , gvlid , moduleName , result ) ;
200
+ fn . call ( this , gvlid , moduleName , moduleType , result ) ;
195
201
}
196
202
} else {
197
203
// The module doesn't enforce TCF1.1 strings
198
204
result . valid = true ;
199
- fn . call ( this , gvlid , moduleName , result ) ;
205
+ fn . call ( this , gvlid , moduleName , moduleType , result ) ;
200
206
}
201
207
} else {
202
208
result . valid = true ;
203
- fn . call ( this , gvlid , moduleName , result ) ;
209
+ fn . call ( this , gvlid , moduleName , moduleType , result ) ;
204
210
}
205
211
}
206
212
}
0 commit comments