@iabtcf-preprod/cmpapi
Advanced tools
Comparing version 1.5.5 to 1.5.6
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CallResponder=exports.API_KEY=void 0;const index_js_1=require("./command/index.js"),CommandMap_js_1=require("./command/CommandMap.js"),CmpApiModel_js_1=require("./CmpApiModel.js"),Disabled_js_1=require("./response/Disabled.js"),SupportedVersions_js_1=require("./SupportedVersions.js");exports.API_KEY="__tcfapi";class CallResponder{constructor(s){if(s){let o=index_js_1.TCFCommand.ADD_EVENT_LISTENER;if(null==s?void 0:s[o])throw new Error(`Built-In Custom Commmand for ${o} not allowed: Use ${index_js_1.TCFCommand.GET_TC_DATA} instead`);if(o=index_js_1.TCFCommand.REMOVE_EVENT_LISTENER,null==s?void 0:s[o])throw new Error(`Built-In Custom Commmand for ${o} not allowed`);(null==s?void 0:s[index_js_1.TCFCommand.GET_TC_DATA])&&(s[index_js_1.TCFCommand.ADD_EVENT_LISTENER]=s[index_js_1.TCFCommand.GET_TC_DATA],s[index_js_1.TCFCommand.REMOVE_EVENT_LISTENER]=s[index_js_1.TCFCommand.GET_TC_DATA]),this.customCommands=s}try{this.callQueue=window[exports.API_KEY]()||[]}catch(s){this.callQueue=[]}finally{window[exports.API_KEY]=this.apiCall.bind(this),this.purgeQueuedCalls()}}apiCall(s,o,e,...n){if("string"!=typeof s)e(null,!1);else if(SupportedVersions_js_1.SupportedVersions.has(o)){if("function"!=typeof e)throw new Error("invalid callback function");CmpApiModel_js_1.CmpApiModel.disabled?e(new Disabled_js_1.Disabled,!1):this.isCustomCommand(s)||this.isBuiltInCommand(s)?this.isCustomCommand(s)&&!this.isBuiltInCommand(s)?this.customCommands[s](e,...n):s===index_js_1.TCFCommand.PING?this.isCustomCommand(s)?new CommandMap_js_1.CommandMap[s](this.customCommands[s],n[0],null,e):new CommandMap_js_1.CommandMap[s](e,n[0]):void 0===CmpApiModel_js_1.CmpApiModel.tcModel?this.callQueue.push([s,o,e,...n]):this.isCustomCommand(s)&&this.isBuiltInCommand(s)?new CommandMap_js_1.CommandMap[s](this.customCommands[s],n[0],null,e):new CommandMap_js_1.CommandMap[s](e,n[0]):e(null,!1)}else e(null,!1)}purgeQueuedCalls(){const s=this.callQueue;this.callQueue=[],s.forEach(s=>{window[exports.API_KEY](...s)})}isCustomCommand(s){return this.customCommands&&"function"==typeof this.customCommands[s]}isBuiltInCommand(s){return void 0!==CommandMap_js_1.CommandMap[s]}}exports.CallResponder=CallResponder; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CallResponder=exports.API_KEY=void 0;const index_js_1=require("./command/index.js"),CommandMap_js_1=require("./command/CommandMap.js"),CmpApiModel_js_1=require("./CmpApiModel.js"),Disabled_js_1=require("./response/Disabled.js"),SupportedVersions_js_1=require("./SupportedVersions.js");exports.API_KEY="__tcfapi";class CallResponder{constructor(s){if(s){let o=index_js_1.TCFCommand.ADD_EVENT_LISTENER;if(null==s?void 0:s[o])throw new Error(`Built-In Custom Commmand for ${o} not allowed: Use ${index_js_1.TCFCommand.GET_TC_DATA} instead`);if(o=index_js_1.TCFCommand.REMOVE_EVENT_LISTENER,null==s?void 0:s[o])throw new Error(`Built-In Custom Commmand for ${o} not allowed`);(null==s?void 0:s[index_js_1.TCFCommand.GET_TC_DATA])&&(s[index_js_1.TCFCommand.ADD_EVENT_LISTENER]=s[index_js_1.TCFCommand.GET_TC_DATA]),this.customCommands=s}try{this.callQueue=window[exports.API_KEY]()||[]}catch(s){this.callQueue=[]}finally{window[exports.API_KEY]=this.apiCall.bind(this),this.purgeQueuedCalls()}}apiCall(s,o,e,...n){if("string"!=typeof s)e(null,!1);else if(SupportedVersions_js_1.SupportedVersions.has(o)){if("function"!=typeof e)throw new Error("invalid callback function");CmpApiModel_js_1.CmpApiModel.disabled?e(new Disabled_js_1.Disabled,!1):this.isCustomCommand(s)||this.isBuiltInCommand(s)?this.isCustomCommand(s)&&!this.isBuiltInCommand(s)?this.customCommands[s](e,...n):s===index_js_1.TCFCommand.PING?this.isCustomCommand(s)?new CommandMap_js_1.CommandMap[s](this.customCommands[s],n[0],null,e):new CommandMap_js_1.CommandMap[s](e,n[0]):void 0===CmpApiModel_js_1.CmpApiModel.tcModel?this.callQueue.push([s,o,e,...n]):this.isCustomCommand(s)&&this.isBuiltInCommand(s)?new CommandMap_js_1.CommandMap[s](this.customCommands[s],n[0],null,e):new CommandMap_js_1.CommandMap[s](e,n[0]):e(null,!1)}else e(null,!1)}purgeQueuedCalls(){const s=this.callQueue;this.callQueue=[],s.forEach(s=>{window[exports.API_KEY](...s)})}isCustomCommand(s){return this.customCommands&&"function"==typeof this.customCommands[s]}isBuiltInCommand(s){return void 0!==CommandMap_js_1.CommandMap[s]}}exports.CallResponder=CallResponder; |
@@ -32,3 +32,2 @@ import { TCFCommand } from './command/index.js'; | ||
customCommands[TCFCommand.ADD_EVENT_LISTENER] = customCommands[TCFCommand.GET_TC_DATA]; | ||
customCommands[TCFCommand.REMOVE_EVENT_LISTENER] = customCommands[TCFCommand.GET_TC_DATA]; | ||
} | ||
@@ -35,0 +34,0 @@ this.customCommands = customCommands; |
{ | ||
"name": "@iabtcf-preprod/cmpapi", | ||
"version": "1.5.5", | ||
"version": "1.5.6", | ||
"description": "Ensures other in-page digital marketing technologies have access to CMP transparency and consent information for the iab. Transparency and Consent Framework (TCF).", | ||
@@ -34,4 +34,4 @@ "author": "Chris Paterson <tcf@chrispaterson.io>", | ||
"devDependencies": { | ||
"@iabtcf-preprod/stub": "1.5.5", | ||
"@iabtcf-preprod/testing": "1.5.5", | ||
"@iabtcf-preprod/stub": "1.5.6", | ||
"@iabtcf-preprod/testing": "1.5.6", | ||
"@istanbuljs/nyc-config-typescript": "^0.1.3", | ||
@@ -38,0 +38,0 @@ "@types/mocha": "^9.1.0", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
98245
1591