@pubtech-ai/core 2.9.0 → 3.0.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SemanticPreEncoder=void 0;var index_js_1=require("../errors/index.js"),index_js_2=require("../model/index.js"),SemanticPreEncoder=function(){function e(){}return e.process=function(e,s){var r=e.gvl;if(!r)throw new index_js_1.EncodingError("Unable to encode TCModel without a GVL");if(!r.isReady)throw new index_js_1.EncodingError("Unable to encode TCModel tcModel.gvl.readyPromise is not resolved");e.consentLanguage=r.language.slice(0,2).toUpperCase(),(null==s?void 0:s.version)>0&&(null==s?void 0:s.version)<=this.processor.length?e.version=s.version:e.version=this.processor.length;var n=e.version-1;if(!this.processor[n])throw new index_js_1.EncodingError("Invalid version: ".concat(e.version));return this.processor[n](e,r)},e.processor=[function(e){return e},function(e,s){e.publisherRestrictions.gvl=s,e.purposeLegitimateInterests.unset([1,3,4,5,6]);var r=new Map;return r.set("legIntPurposes",e.vendorLegitimateInterests),r.set("purposes",e.vendorConsents),r.forEach((function(r,n){r.forEach((function(o,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SemanticPreEncoder=void 0;var index_js_1=require("../errors/index.js"),index_js_2=require("../model/index.js"),SemanticPreEncoder=function(){function e(){}return e.process=function(e,s){var r=e.gvl;if(!r)throw new index_js_1.EncodingError("Unable to encode TCModel without a GVL");if(!r.isReady)throw new index_js_1.EncodingError("Unable to encode TCModel tcModel.gvl.readyPromise is not resolved");e.consentLanguage=r.language.slice(0,2).toUpperCase(),(null==s?void 0:s.version)>0&&(null==s?void 0:s.version)<=this.processor.length?e.version=s.version:e.version=this.processor.length;var n=e.version-1;if(!this.processor[n])throw new index_js_1.EncodingError("Invalid version: ".concat(e.version));return this.processor[n](e,r)},e.processor=[function(e){return e},function(e,s){e.publisherRestrictions.gvl=s,e.purposeLegitimateInterests.unset([1,3,4,5,6]);var r=new Map;return r.set("legIntPurposes",e.vendorLegitimateInterests),r.set("purposes",e.vendorConsents),r.forEach((function(r,n){r.forEach((function(o,t){if(o){var i=s.vendors[t];if(!i||i.deletedDate)r.unset(t);else if(0===i[n].length)if("legIntPurposes"===n&&0===i.purposes.length&&0===i.legIntPurposes.length&&i.specialPurposes.length>0)r.set(t);else if("legIntPurposes"===n&&i.purposes.length>0&&0===i.legIntPurposes.length&&i.specialPurposes.length>0)r.set(t);else if(e.isServiceSpecific)if(0===i.flexiblePurposes.length)r.unset(t);else{for(var l=e.publisherRestrictions.getRestrictions(t),c=!1,u=0,p=l.length;u<p&&!c;u++)c=l[u].restrictionType===index_js_2.RestrictionType.REQUIRE_CONSENT&&"purposes"===n||l[u].restrictionType===index_js_2.RestrictionType.REQUIRE_LI&&"legIntPurposes"===n;c||r.unset(t)}else r.unset(t)}}))})),e.vendorsDisclosed.set(s.vendors),e}],e}();exports.SemanticPreEncoder=SemanticPreEncoder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __values=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConsentLanguages=void 0;var ConsentLanguages=function(){function e(){}return e.prototype.has=function(t){return e.langSet.has(t)},e.prototype.parseLanguage=function(t){var n,r,o=(t=t.toUpperCase()).split("-")[0];if(t.length>=2&&2==o.length){if(e.langSet.has(t))return t;if(e.langSet.has(o))return o;var a=o+"-"+o;if(e.langSet.has(a))return a;try{for(var u=__values(e.langSet),i=u.next();!i.done;i=u.next()){var l=i.value;if(-1!==l.indexOf(t)||-1!==l.indexOf(o))return l}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}throw new Error("unsupported language ".concat(t))},e.prototype.forEach=function(t){e.langSet.forEach(t)},Object.defineProperty(e.prototype,"size",{get:function(){return e.langSet.size},enumerable:!1,configurable:!0}),e.langSet=new Set(["AR","BG","BS","CA","CS","CY","DA","DE","EL","EN","ES","ET","EU","FI","FR","GL","HE","HR","HU","ID","IT","JA","KO","LT","LV","MK","MS","MT","NL","NO","PL","PT-BR","PT-PT","RO","RU","SK","SL","SR-LATN","SR-CYRL","SV","TL","TR","UK","ZH"]),e}();exports.ConsentLanguages=ConsentLanguages;
|
|
1
|
+
"use strict";var __values=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConsentLanguages=void 0;var ConsentLanguages=function(){function e(){}return e.prototype.has=function(t){return e.langSet.has(t)},e.prototype.parseLanguage=function(t){var n,r,o=(t=t.toUpperCase()).split("-")[0];if(t.length>=2&&2==o.length){if(e.langSet.has(t))return t;if(e.langSet.has(o))return o;var a=o+"-"+o;if(e.langSet.has(a))return a;try{for(var u=__values(e.langSet),i=u.next();!i.done;i=u.next()){var l=i.value;if(-1!==l.indexOf(t)||-1!==l.indexOf(o))return l}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}throw new Error("unsupported language ".concat(t))},e.prototype.forEach=function(t){e.langSet.forEach(t)},Object.defineProperty(e.prototype,"size",{get:function(){return e.langSet.size},enumerable:!1,configurable:!0}),e.langSet=new Set(["AR","BG","BS","CA","CS","CY","DA","DE","EL","EN","ES","ET","EU","FI","FR","GL","HE","HI","HR","HU","ID","IT","JA","KA","KO","LT","LV","MK","MS","MT","NL","NO","PL","PT-BR","PT-PT","RO","RU","SK","SL","SQ","SR-LATN","SR-CYRL","SV","SW","TH","TL","TR","UK","VI","ZH","ZH-HANT"]),e}();exports.ConsentLanguages=ConsentLanguages;
|
|
@@ -38,8 +38,17 @@ export class SemanticPreEncoder {
|
|
|
38
38
|
/**
|
|
39
39
|
* Per June 2021 Policy change, Vendors declaring only Special Purposes must
|
|
40
40
|
* have their legitimate interest Vendor bit set if they have been disclosed.
|
|
41
|
-
* This
|
|
41
|
+
* This block ensures their LI bit remains set
|
|
42
42
|
*/
|
|
43
|
+
vector.set(vendorId);
|
|
44
|
+
}
|
|
45
|
+
else if (gvlVendorKey === 'legIntPurposes' && vendor['purposes'].length > 0 && vendor['legIntPurposes'].length === 0 && vendor['specialPurposes'].length > 0) {
|
|
46
|
+
/**
|
|
47
|
+
* Per June 2021 Policy change, Vendors declaring only Special Purposes must
|
|
48
|
+
* have their legitimate interest Vendor bit set if they have been disclosed.
|
|
49
|
+
* This block ensures their LI bit remains set
|
|
50
|
+
*/
|
|
51
|
+
vector.set(vendorId);
|
|
43
52
|
}
|
|
44
53
|
else {
|
|
45
54
|
/**
|
|
@@ -17,11 +17,13 @@ export class ConsentLanguages {
|
|
|
17
17
|
'FR',
|
|
18
18
|
'GL',
|
|
19
19
|
'HE',
|
|
20
|
+
'HI',
|
|
20
21
|
'HR',
|
|
21
22
|
'HU',
|
|
22
23
|
'ID',
|
|
23
24
|
'IT',
|
|
24
25
|
'JA',
|
|
26
|
+
'KA',
|
|
25
27
|
'KO',
|
|
26
28
|
'LT',
|
|
27
29
|
'LV',
|
|
@@ -37,13 +39,18 @@ export class ConsentLanguages {
|
|
|
37
39
|
'RU',
|
|
38
40
|
'SK',
|
|
39
41
|
'SL',
|
|
42
|
+
'SQ',
|
|
40
43
|
'SR-LATN',
|
|
41
44
|
'SR-CYRL',
|
|
42
45
|
'SV',
|
|
46
|
+
'SW',
|
|
47
|
+
'TH',
|
|
43
48
|
'TL',
|
|
44
49
|
'TR',
|
|
45
50
|
'UK',
|
|
51
|
+
'VI',
|
|
46
52
|
'ZH',
|
|
53
|
+
'ZH-HANT',
|
|
47
54
|
]);
|
|
48
55
|
has(key) {
|
|
49
56
|
return ConsentLanguages.langSet.has(key);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubtech-ai/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Ensures consistent encoding and decoding of TC Signals for the iab. Transparency and Consent Framework (TCF).",
|
|
5
5
|
"author": "Mayank Mishra <mayank@iabtechlab.com>",
|
|
6
6
|
"homepage": "https://iabtcf.com/",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"test-ci": "mocha --reporter mocha-junit-reporter"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@pubtech-ai/testing": "
|
|
32
|
+
"@pubtech-ai/testing": "3.0.0",
|
|
33
33
|
"@istanbuljs/nyc-config-typescript": "^0.1.3",
|
|
34
34
|
"@types/sinon": "^10.0.11",
|
|
35
35
|
"@types/sinon-chai": "3.2.8",
|