@didomi/iabtcf-core
Advanced tools
Comparing version 1.6.0 to 1.6.1
@@ -1,1 +0,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,r){var s=e.gvl;if(!s)throw new index_js_1.EncodingError("Unable to encode TCModel without a GVL");if(!s.isReady)throw new index_js_1.EncodingError("Unable to encode TCModel tcModel.gvl.readyPromise is not resolved");(e=e.clone()).consentLanguage=s.language.toUpperCase(),(null==r?void 0:r.version)>0&&(null==r?void 0:r.version)<=this.processor.length?e.version=r.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,s)},e.processor=[function(e){return e},function(e,r){e.publisherRestrictions.gvl=r,e.purposeLegitimateInterests.unset(1);var s=new Map;return s.set("legIntPurposes",e.vendorLegitimateInterests),s.set("purposes",e.vendorConsents),s.forEach((function(s,n){s.forEach((function(o,t){if(o){var i=r.vendors[t];if(!i||i.deletedDate)s.unset(t);else if(0===i[n].length)if("legIntPurposes"===n&&0===i.purposes.length&&0===i.legIntPurposes.length&&i.specialPurposes.length>0);else if(e.isServiceSpecific)if(0===i.flexiblePurposes.length)s.unset(t);else{for(var c=e.publisherRestrictions.getRestrictions(t),l=!1,d=0,u=c.length;d<u&&!l;d++)l=c[d].restrictionType===index_js_2.RestrictionType.REQUIRE_CONSENT&&"purposes"===n||c[d].restrictionType===index_js_2.RestrictionType.REQUIRE_LI&&"legIntPurposes"===n;l||s.unset(t)}else s.unset(t)}}))})),e.vendorsDisclosed.set(r.vendors),e}],e}();exports.SemanticPreEncoder=SemanticPreEncoder; | ||
"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,r){var s=e.gvl;if(!s)throw new index_js_1.EncodingError("Unable to encode TCModel without a GVL");if(!s.isReady)throw new index_js_1.EncodingError("Unable to encode TCModel tcModel.gvl.readyPromise is not resolved");(e=e.clone()).consentLanguage=s.language.toUpperCase(),(null==r?void 0:r.version)>0&&(null==r?void 0:r.version)<=this.processor.length?e.version=r.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,s)},e.processor=[function(e){return e},function(e,r){e.publisherRestrictions.gvl=r,e.purposeLegitimateInterests.unset([1,3,4,5,6]);var s=new Map;return s.set("legIntPurposes",e.vendorLegitimateInterests),s.set("purposes",e.vendorConsents),s.forEach((function(s,n){s.forEach((function(o,t){if(o){var i=r.vendors[t];if(!i||i.deletedDate)s.unset(t);else if(0===i[n].length)if("legIntPurposes"===n&&0===i.purposes.length&&0===i.legIntPurposes.length&&i.specialPurposes.length>0);else if(e.isServiceSpecific)if(0===i.flexiblePurposes.length)s.unset(t);else{for(var c=e.publisherRestrictions.getRestrictions(t),l=!1,d=0,u=c.length;d<u&&!l;d++)l=c[d].restrictionType===index_js_2.RestrictionType.REQUIRE_CONSENT&&"purposes"===n||c[d].restrictionType===index_js_2.RestrictionType.REQUIRE_LI&&"legIntPurposes"===n;l||s.unset(t)}else s.unset(t)}}))})),e.vendorsDisclosed.set(r.vendors),e}],e}();exports.SemanticPreEncoder=SemanticPreEncoder; |
@@ -1,1 +0,1 @@ | ||
"use strict";var __extends=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function s(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(s.prototype=n.prototype,new s)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.TCModel=void 0;var Cloneable_js_1=require("./Cloneable.js"),index_js_1=require("./errors/index.js"),GVL_js_1=require("./GVL.js"),index_js_2=require("./model/index.js"),TCModel=function(e){function t(t){var n=e.call(this)||this;return n.isServiceSpecific_=!1,n.supportOOB_=!0,n.useNonStandardTexts_=!1,n.purposeOneTreatment_=!1,n.publisherCountryCode_="AA",n.version_=2,n.consentScreen_=0,n.policyVersion_=2,n.consentLanguage_="EN",n.cmpId_=0,n.cmpVersion_=0,n.vendorListVersion_=0,n.numCustomPurposes_=0,n.specialFeatureOptins=new index_js_2.Vector,n.purposeConsents=new index_js_2.Vector,n.purposeLegitimateInterests=new index_js_2.Vector,n.publisherConsents=new index_js_2.Vector,n.publisherLegitimateInterests=new index_js_2.Vector,n.publisherCustomConsents=new index_js_2.Vector,n.publisherCustomLegitimateInterests=new index_js_2.Vector,n.vendorConsents=new index_js_2.Vector,n.vendorLegitimateInterests=new index_js_2.Vector,n.vendorsDisclosed=new index_js_2.Vector,n.vendorsAllowed=new index_js_2.Vector,n.publisherRestrictions=new index_js_2.PurposeRestrictionVector,t&&(n.gvl=t),n.updated(),n}return __extends(t,e),Object.defineProperty(t.prototype,"gvl",{get:function(){return this.gvl_},set:function(e){GVL_js_1.GVL.isInstanceOf(e)||(e=new GVL_js_1.GVL(e)),this.gvl_=e,this.publisherRestrictions.gvl=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cmpId",{get:function(){return this.cmpId_},set:function(e){if(e=Number(e),!(Number.isInteger(e)&&e>1))throw new index_js_1.TCModelError("cmpId",e);this.cmpId_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cmpVersion",{get:function(){return this.cmpVersion_},set:function(e){if(e=Number(e),!(Number.isInteger(e)&&e>-1))throw new index_js_1.TCModelError("cmpVersion",e);this.cmpVersion_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"consentScreen",{get:function(){return this.consentScreen_},set:function(e){if(e=Number(e),!(Number.isInteger(e)&&e>-1))throw new index_js_1.TCModelError("consentScreen",e);this.consentScreen_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"consentLanguage",{get:function(){return this.consentLanguage_},set:function(e){this.consentLanguage_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"publisherCountryCode",{get:function(){return this.publisherCountryCode_},set:function(e){if(!/^([A-z]){2}$/.test(e))throw new index_js_1.TCModelError("publisherCountryCode",e);this.publisherCountryCode_=e.toUpperCase()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vendorListVersion",{get:function(){return this.gvl?this.gvl.vendorListVersion:this.vendorListVersion_},set:function(e){if((e=Number(e)>>0)<0)throw new index_js_1.TCModelError("vendorListVersion",e);this.vendorListVersion_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"policyVersion",{get:function(){return this.gvl?this.gvl.tcfPolicyVersion:this.policyVersion_},set:function(e){if(this.policyVersion_=parseInt(e,10),this.policyVersion_<0)throw new index_js_1.TCModelError("policyVersion",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"version",{get:function(){return this.version_},set:function(e){this.version_=parseInt(e,10)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isServiceSpecific",{get:function(){return this.isServiceSpecific_},set:function(e){this.isServiceSpecific_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useNonStandardTexts",{get:function(){return this.useNonStandardTexts_},set:function(e){this.useNonStandardTexts_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"supportOOB",{get:function(){return this.supportOOB_},set:function(e){this.supportOOB_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"purposeOneTreatment",{get:function(){return this.purposeOneTreatment_},set:function(e){this.purposeOneTreatment_=e},enumerable:!1,configurable:!0}),t.prototype.setAllVendorConsents=function(){this.vendorConsents.set(this.gvl.vendors)},t.prototype.unsetAllVendorConsents=function(){this.vendorConsents.empty()},t.prototype.setAllVendorsDisclosed=function(){this.vendorsDisclosed.set(this.gvl.vendors)},t.prototype.unsetAllVendorsDisclosed=function(){this.vendorsDisclosed.empty()},t.prototype.setAllVendorsAllowed=function(){this.vendorsAllowed.set(this.gvl.vendors)},t.prototype.unsetAllVendorsAllowed=function(){this.vendorsAllowed.empty()},t.prototype.setAllVendorLegitimateInterests=function(){this.vendorLegitimateInterests.set(this.gvl.vendors)},t.prototype.unsetAllVendorLegitimateInterests=function(){this.vendorLegitimateInterests.empty()},t.prototype.setAllPurposeConsents=function(){this.purposeConsents.set(this.gvl.purposes)},t.prototype.unsetAllPurposeConsents=function(){this.purposeConsents.empty()},t.prototype.setAllPurposeLegitimateInterests=function(){this.purposeLegitimateInterests.set(this.gvl.purposes)},t.prototype.unsetAllPurposeLegitimateInterests=function(){this.purposeLegitimateInterests.empty()},t.prototype.setAllSpecialFeatureOptins=function(){this.specialFeatureOptins.set(this.gvl.specialFeatures)},t.prototype.unsetAllSpecialFeatureOptins=function(){this.specialFeatureOptins.empty()},t.prototype.setAll=function(){this.setAllVendorConsents(),this.setAllPurposeLegitimateInterests(),this.setAllSpecialFeatureOptins(),this.setAllPurposeConsents(),this.setAllVendorLegitimateInterests()},t.prototype.unsetAll=function(){this.unsetAllVendorConsents(),this.unsetAllPurposeLegitimateInterests(),this.unsetAllSpecialFeatureOptins(),this.unsetAllPurposeConsents(),this.unsetAllVendorLegitimateInterests()},Object.defineProperty(t.prototype,"numCustomPurposes",{get:function(){var e=this.numCustomPurposes_;if("object"==typeof this.customPurposes){var t=Object.keys(this.customPurposes).sort((function(e,t){return Number(e)-Number(t)}));e=parseInt(t.pop(),10)}return e},set:function(e){if(this.numCustomPurposes_=parseInt(e,10),this.numCustomPurposes_<0)throw new index_js_1.TCModelError("numCustomPurposes",e)},enumerable:!1,configurable:!0}),t.prototype.updated=function(){var e=new Date,t=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));this.created=t,this.lastUpdated=t},t.consentLanguages=GVL_js_1.GVL.consentLanguages,t}(Cloneable_js_1.Cloneable);exports.TCModel=TCModel; | ||
"use strict";var __extends=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function s(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(s.prototype=n.prototype,new s)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.TCModel=void 0;var Cloneable_js_1=require("./Cloneable.js"),index_js_1=require("./errors/index.js"),GVL_js_1=require("./GVL.js"),index_js_2=require("./model/index.js"),TCModel=function(e){function t(t){var n=e.call(this)||this;return n.isServiceSpecific_=!1,n.supportOOB_=!0,n.useNonStandardTexts_=!1,n.purposeOneTreatment_=!1,n.publisherCountryCode_="AA",n.version_=2,n.consentScreen_=0,n.policyVersion_=4,n.consentLanguage_="EN",n.cmpId_=0,n.cmpVersion_=0,n.vendorListVersion_=0,n.numCustomPurposes_=0,n.specialFeatureOptins=new index_js_2.Vector,n.purposeConsents=new index_js_2.Vector,n.purposeLegitimateInterests=new index_js_2.Vector,n.publisherConsents=new index_js_2.Vector,n.publisherLegitimateInterests=new index_js_2.Vector,n.publisherCustomConsents=new index_js_2.Vector,n.publisherCustomLegitimateInterests=new index_js_2.Vector,n.vendorConsents=new index_js_2.Vector,n.vendorLegitimateInterests=new index_js_2.Vector,n.vendorsDisclosed=new index_js_2.Vector,n.vendorsAllowed=new index_js_2.Vector,n.publisherRestrictions=new index_js_2.PurposeRestrictionVector,t&&(n.gvl=t),n.updated(),n}return __extends(t,e),Object.defineProperty(t.prototype,"gvl",{get:function(){return this.gvl_},set:function(e){GVL_js_1.GVL.isInstanceOf(e)||(e=new GVL_js_1.GVL(e)),this.gvl_=e,this.publisherRestrictions.gvl=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cmpId",{get:function(){return this.cmpId_},set:function(e){if(e=Number(e),!(Number.isInteger(e)&&e>1))throw new index_js_1.TCModelError("cmpId",e);this.cmpId_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cmpVersion",{get:function(){return this.cmpVersion_},set:function(e){if(e=Number(e),!(Number.isInteger(e)&&e>-1))throw new index_js_1.TCModelError("cmpVersion",e);this.cmpVersion_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"consentScreen",{get:function(){return this.consentScreen_},set:function(e){if(e=Number(e),!(Number.isInteger(e)&&e>-1))throw new index_js_1.TCModelError("consentScreen",e);this.consentScreen_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"consentLanguage",{get:function(){return this.consentLanguage_},set:function(e){this.consentLanguage_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"publisherCountryCode",{get:function(){return this.publisherCountryCode_},set:function(e){if(!/^([A-z]){2}$/.test(e))throw new index_js_1.TCModelError("publisherCountryCode",e);this.publisherCountryCode_=e.toUpperCase()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vendorListVersion",{get:function(){return this.gvl?this.gvl.vendorListVersion:this.vendorListVersion_},set:function(e){if((e=Number(e)>>0)<0)throw new index_js_1.TCModelError("vendorListVersion",e);this.vendorListVersion_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"policyVersion",{get:function(){return this.gvl?this.gvl.tcfPolicyVersion:this.policyVersion_},set:function(e){if(this.policyVersion_=parseInt(e,10),this.policyVersion_<0)throw new index_js_1.TCModelError("policyVersion",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"version",{get:function(){return this.version_},set:function(e){this.version_=parseInt(e,10)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isServiceSpecific",{get:function(){return this.isServiceSpecific_},set:function(e){this.isServiceSpecific_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useNonStandardTexts",{get:function(){return this.useNonStandardTexts_},set:function(e){this.useNonStandardTexts_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"supportOOB",{get:function(){return this.supportOOB_},set:function(e){this.supportOOB_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"purposeOneTreatment",{get:function(){return this.purposeOneTreatment_},set:function(e){this.purposeOneTreatment_=e},enumerable:!1,configurable:!0}),t.prototype.setAllVendorConsents=function(){this.vendorConsents.set(this.gvl.vendors)},t.prototype.unsetAllVendorConsents=function(){this.vendorConsents.empty()},t.prototype.setAllVendorsDisclosed=function(){this.vendorsDisclosed.set(this.gvl.vendors)},t.prototype.unsetAllVendorsDisclosed=function(){this.vendorsDisclosed.empty()},t.prototype.setAllVendorsAllowed=function(){this.vendorsAllowed.set(this.gvl.vendors)},t.prototype.unsetAllVendorsAllowed=function(){this.vendorsAllowed.empty()},t.prototype.setAllVendorLegitimateInterests=function(){this.vendorLegitimateInterests.set(this.gvl.vendors)},t.prototype.unsetAllVendorLegitimateInterests=function(){this.vendorLegitimateInterests.empty()},t.prototype.setAllPurposeConsents=function(){this.purposeConsents.set(this.gvl.purposes)},t.prototype.unsetAllPurposeConsents=function(){this.purposeConsents.empty()},t.prototype.setAllPurposeLegitimateInterests=function(){this.purposeLegitimateInterests.set(this.gvl.purposes)},t.prototype.unsetAllPurposeLegitimateInterests=function(){this.purposeLegitimateInterests.empty()},t.prototype.setAllSpecialFeatureOptins=function(){this.specialFeatureOptins.set(this.gvl.specialFeatures)},t.prototype.unsetAllSpecialFeatureOptins=function(){this.specialFeatureOptins.empty()},t.prototype.setAll=function(){this.setAllVendorConsents(),this.setAllPurposeLegitimateInterests(),this.setAllSpecialFeatureOptins(),this.setAllPurposeConsents(),this.setAllVendorLegitimateInterests()},t.prototype.unsetAll=function(){this.unsetAllVendorConsents(),this.unsetAllPurposeLegitimateInterests(),this.unsetAllSpecialFeatureOptins(),this.unsetAllPurposeConsents(),this.unsetAllVendorLegitimateInterests()},Object.defineProperty(t.prototype,"numCustomPurposes",{get:function(){var e=this.numCustomPurposes_;if("object"==typeof this.customPurposes){var t=Object.keys(this.customPurposes).sort((function(e,t){return Number(e)-Number(t)}));e=parseInt(t.pop(),10)}return e},set:function(e){if(this.numCustomPurposes_=parseInt(e,10),this.numCustomPurposes_<0)throw new index_js_1.TCModelError("numCustomPurposes",e)},enumerable:!1,configurable:!0}),t.prototype.updated=function(){var e=new Date,t=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));this.created=t,this.lastUpdated=t},t.consentLanguages=GVL_js_1.GVL.consentLanguages,t}(Cloneable_js_1.Cloneable);exports.TCModel=TCModel; |
@@ -14,4 +14,5 @@ import { EncodingError } from '../errors/index.js'; | ||
* Purpose 1 is never allowed to be true for legitimate interest | ||
* As of TCF v2.2 purposes 3,4,5 & 6 are not allowed to be true for LI | ||
*/ | ||
tcModel.purposeLegitimateInterests.unset(1); | ||
tcModel.purposeLegitimateInterests.unset([1, 3, 4, 5, 6]); | ||
/** | ||
@@ -18,0 +19,0 @@ * If a Vendor does not declare a purpose for consent or legitimate |
@@ -17,3 +17,3 @@ import { Cloneable } from './Cloneable.js'; | ||
consentScreen_ = 0; | ||
policyVersion_ = 2; | ||
policyVersion_ = 4; | ||
consentLanguage_ = 'EN'; | ||
@@ -20,0 +20,0 @@ cmpId_ = 0; |
{ | ||
"name": "@didomi/iabtcf-core", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"description": "Ensures consistent encoding and decoding of TC Signals for the iab. Transparency and Consent Framework (TCF).", | ||
@@ -5,0 +5,0 @@ "author": "Chris Paterson <tcf@chrispaterson.io>", |
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
310685
5678
0