fix(core): update
This commit is contained in:
parent
4375c6f94f
commit
23bca9e4de
12
package-lock.json
generated
12
package-lock.json
generated
@ -1121,9 +1121,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@consentsoftware/interfaces": {
|
"@consentsoftware/interfaces": {
|
||||||
"version": "1.0.10",
|
"version": "1.0.11",
|
||||||
"resolved": "https://verdaccio.lossless.one/@consentsoftware%2finterfaces/-/interfaces-1.0.10.tgz",
|
"resolved": "https://verdaccio.lossless.one/@consentsoftware%2finterfaces/-/interfaces-1.0.11.tgz",
|
||||||
"integrity": "sha512-xqDb2xg5iXpzUxnOW53nha3nBoFT/yZPjo5cD1XFzGt2TFA6kw/y6VAgpGPk9/DXOb05rtkKpl4gHzrR4nQ9ew==",
|
"integrity": "sha512-RscUK4PByeXFjqQmWUsqRv4eKo5NawPbYdBDBOXx00Cpw6ldFvf//K16P+zvHhPJ3nOXHVFaVctQKh3ZcNvErg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@apiglobal/typedrequest-interfaces": "^1.0.15"
|
"@apiglobal/typedrequest-interfaces": "^1.0.15"
|
||||||
}
|
}
|
||||||
@ -2383,9 +2383,9 @@
|
|||||||
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
|
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "14.14.0",
|
"version": "14.14.2",
|
||||||
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.14.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.14.2.tgz",
|
||||||
"integrity": "sha512-BfbIHP9IapdupGhq/hc+jT5dyiBVZ2DdeC5WwJWQWDb0GijQlzUFAeIQn/2GtvZcd2HVUU7An8felIICFTC2qg=="
|
"integrity": "sha512-jeYJU2kl7hL9U5xuI/BhKPZ4vqGM/OmK6whiFAXVhlstzZhVamWhDSmHyGLIp+RVyuF9/d0dqr2P85aFj4BvJg=="
|
||||||
},
|
},
|
||||||
"@types/parcel-bundler": {
|
"@types/parcel-bundler": {
|
||||||
"version": "1.12.1",
|
"version": "1.12.1",
|
||||||
|
@ -15,13 +15,13 @@
|
|||||||
"@gitzone/tsbuild": "^2.0.22",
|
"@gitzone/tsbuild": "^2.0.22",
|
||||||
"@gitzone/tstest": "^1.0.52",
|
"@gitzone/tstest": "^1.0.52",
|
||||||
"@pushrocks/tapbundle": "^3.0.7",
|
"@pushrocks/tapbundle": "^3.0.7",
|
||||||
"@types/node": "^14.14.0",
|
"@types/node": "^14.14.2",
|
||||||
"tslint": "^6.1.3",
|
"tslint": "^6.1.3",
|
||||||
"tslint-config-prettier": "^1.15.0"
|
"tslint-config-prettier": "^1.15.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apiglobal/typedrequest": "^1.0.54",
|
"@apiglobal/typedrequest": "^1.0.54",
|
||||||
"@consentsoftware/interfaces": "^1.0.10",
|
"@consentsoftware/interfaces": "^1.0.11",
|
||||||
"@pushrocks/smarttime": "^3.0.37",
|
"@pushrocks/smarttime": "^3.0.37",
|
||||||
"@pushrocks/webstore": "^1.0.16"
|
"@pushrocks/webstore": "^1.0.16"
|
||||||
},
|
},
|
||||||
|
27
ts/index.ts
27
ts/index.ts
@ -55,17 +55,32 @@ export class CsWebclient {
|
|||||||
const csGetDomainSettingsRequest = new plugins.typedrequest.TypedRequest<
|
const csGetDomainSettingsRequest = new plugins.typedrequest.TypedRequest<
|
||||||
plugins.csInterfaces.IRequest_Client_ConsentSoftwareServer_GetDomainSettings
|
plugins.csInterfaces.IRequest_Client_ConsentSoftwareServer_GetDomainSettings
|
||||||
>('https://connect.api.global/consentsoftware', 'getDomainSettings');
|
>('https://connect.api.global/consentsoftware', 'getDomainSettings');
|
||||||
const domainToRequest = domainArg || window.location.hostname;
|
const domainToRequest = domainArg || window.location.hostname;
|
||||||
const response = await csGetDomainSettingsRequest.fire({
|
const response = await csGetDomainSettingsRequest.fire({
|
||||||
domain: domainToRequest
|
domain: domainToRequest,
|
||||||
});
|
});
|
||||||
for (const consentTuple of response.consentTuples) {
|
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;
|
const scriptString = consentTuple.script as string;
|
||||||
// tslint:disable-next-line: function-constructor
|
// tslint:disable-next-line: function-constructor
|
||||||
const tupleFunction = new Function('dataArg',`return (${scriptString})(dataArg)`);
|
const tupleFunction: plugins.csInterfaces.IConsentTuple['script'] = new Function(
|
||||||
await tupleFunction(consentTuple.scriptExecutionDataArg);
|
'dataArg',
|
||||||
console.log (`Successfully executed ConsentTuple >>${consentTuple.name}<< -> ${consentTuple.description}`);
|
'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}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user