fix(core): update

This commit is contained in:
Philipp Kunz 2020-10-24 12:35:31 +00:00
parent 4375c6f94f
commit 23bca9e4de
3 changed files with 29 additions and 14 deletions

12
package-lock.json generated
View File

@ -1121,9 +1121,9 @@
}
},
"@consentsoftware/interfaces": {
"version": "1.0.10",
"resolved": "https://verdaccio.lossless.one/@consentsoftware%2finterfaces/-/interfaces-1.0.10.tgz",
"integrity": "sha512-xqDb2xg5iXpzUxnOW53nha3nBoFT/yZPjo5cD1XFzGt2TFA6kw/y6VAgpGPk9/DXOb05rtkKpl4gHzrR4nQ9ew==",
"version": "1.0.11",
"resolved": "https://verdaccio.lossless.one/@consentsoftware%2finterfaces/-/interfaces-1.0.11.tgz",
"integrity": "sha512-RscUK4PByeXFjqQmWUsqRv4eKo5NawPbYdBDBOXx00Cpw6ldFvf//K16P+zvHhPJ3nOXHVFaVctQKh3ZcNvErg==",
"requires": {
"@apiglobal/typedrequest-interfaces": "^1.0.15"
}
@ -2383,9 +2383,9 @@
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
},
"@types/node": {
"version": "14.14.0",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.14.0.tgz",
"integrity": "sha512-BfbIHP9IapdupGhq/hc+jT5dyiBVZ2DdeC5WwJWQWDb0GijQlzUFAeIQn/2GtvZcd2HVUU7An8felIICFTC2qg=="
"version": "14.14.2",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.14.2.tgz",
"integrity": "sha512-jeYJU2kl7hL9U5xuI/BhKPZ4vqGM/OmK6whiFAXVhlstzZhVamWhDSmHyGLIp+RVyuF9/d0dqr2P85aFj4BvJg=="
},
"@types/parcel-bundler": {
"version": "1.12.1",

View File

@ -15,13 +15,13 @@
"@gitzone/tsbuild": "^2.0.22",
"@gitzone/tstest": "^1.0.52",
"@pushrocks/tapbundle": "^3.0.7",
"@types/node": "^14.14.0",
"@types/node": "^14.14.2",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0"
},
"dependencies": {
"@apiglobal/typedrequest": "^1.0.54",
"@consentsoftware/interfaces": "^1.0.10",
"@consentsoftware/interfaces": "^1.0.11",
"@pushrocks/smarttime": "^3.0.37",
"@pushrocks/webstore": "^1.0.16"
},

View File

@ -55,17 +55,32 @@ export class CsWebclient {
const csGetDomainSettingsRequest = new plugins.typedrequest.TypedRequest<
plugins.csInterfaces.IRequest_Client_ConsentSoftwareServer_GetDomainSettings
>('https://connect.api.global/consentsoftware', 'getDomainSettings');
const domainToRequest = domainArg || window.location.hostname;
const domainToRequest = domainArg || window.location.hostname;
const response = await csGetDomainSettingsRequest.fire({
domain: domainToRequest
domain: domainToRequest,
});
for (const consentTuple of response.consentTuples) {
if (consentTuple.level === 'functional' || acceptedCookieLevels.includes(consentTuple.level)) {
if (
consentTuple.level === 'functional' ||
acceptedCookieLevels.includes(consentTuple.level)
) {
const scriptString = consentTuple.script as string;
// tslint:disable-next-line: function-constructor
const tupleFunction = new Function('dataArg',`return (${scriptString})(dataArg)`);
await tupleFunction(consentTuple.scriptExecutionDataArg);
console.log (`Successfully executed ConsentTuple >>${consentTuple.name}<< -> ${consentTuple.description}`);
const tupleFunction: plugins.csInterfaces.IConsentTuple['script'] = new Function(
'dataArg',
'cookieLevelsArg',
`return (${scriptString})(dataArg, cookieLevelsArg)`
) as plugins.csInterfaces.IConsentTuple['script'];
if (typeof tupleFunction === 'function') {
await tupleFunction(consentTuple.scriptExecutionDataArg, await this.getCookieLevels());
} else {
const errorText = 'got malformed script to execuute';
console.error(errorText);
throw new Error(errorText);
}
console.log(
`Successfully executed ConsentTuple >>${consentTuple.name}<< -> ${consentTuple.description}`
);
}
}
}