fix(core): update

This commit is contained in:
2020-10-20 21:02:14 +00:00
parent 7db0e622b6
commit ebd7ccc171
3 changed files with 694 additions and 818 deletions

View File

@ -46,7 +46,7 @@ export class CsWebclient {
return true;
}
public async getAndRunConsentTuples() {
public async getAndRunConsentTuples(domainArg?: string) {
const acceptedCookieLevels = await this.getCookieLevels();
if (!acceptedCookieLevels) {
console.log('You need to set accepted cookielevels first');
@ -55,8 +55,9 @@ 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 response = await csGetDomainSettingsRequest.fire({
domain: window.location.hostname
domain: domainToRequest
});
for (const consentTuple of response.consentTuples) {
if (consentTuple.level === 'functional' || acceptedCookieLevels.includes(consentTuple.level)) {