c15t 1.1.2-canary.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/client/client-c15t.d.ts.map +1 -1
- package/dist/client/client-custom.d.ts.map +1 -1
- package/dist/client/client-interface.d.ts +34 -3
- package/dist/client/client-interface.d.ts.map +1 -1
- package/dist/client/client-offline.d.ts.map +1 -1
- package/dist/index.cjs +139 -12
- package/dist/index.js +139 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# c15t
|
|
2
2
|
|
|
3
|
+
## 1.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#203](https://github.com/c15t/c15t/pull/203) [`4d47e21`](https://github.com/c15t/c15t/commit/4d47e2109bfc894f1666b19f4ff40d7398f10c57) Thanks [@KayleeWilliams](https://github.com/KayleeWilliams)! - fix(core): callbacks not working on c15t mode
|
|
8
|
+
|
|
3
9
|
## 1.0.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-c15t.d.ts","sourceRoot":"","sources":["../../src/client/client-c15t.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,qBAAqB,EACrB,kBAAkB,EAClB,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,EACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"client-c15t.d.ts","sourceRoot":"","sources":["../../src/client/client-c15t.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,qBAAqB,EACrB,kBAAkB,EAClB,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,EACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAEX,uBAAuB,EACvB,uBAAuB,EAGv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,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,iBAAiB,EAAE,eAAe,CAAC,yBAAyB,CAAC,CAAC;IAE9D;;OAEG;IACH,UAAU,EAAE,eAAe,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,CAAC;IAEvE;;OAEG;IACH,aAAa,EAAE,eAAe,CAC7B,qBAAqB,EACrB,wBAAwB,CACxB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;OAEG;IACH,gBAAgB,EAAE,gBAAgB,CAAC;IAEnC;;OAEG;IACH,SAAS,CAAC,EAAE,uBAAuB,CAAC;CACpC;AAED;;;GAGG;AACH,qBAAa,YAAa,YAAW,uBAAuB;IAC3D;;;OAGG;IACH,OAAO,CAAC,gBAAgB,CAAmB;IAE3C;;;OAGG;IACH,OAAO,CAAC,eAAe,CAGhB;IAEP;;;OAGG;IACH,OAAO,CAAC,SAAS,CAAC,CAA0B;IAE5C;;;;OAIG;gBACS,OAAO,EAAE,mBAAmB;IAKxC;;;;OAIG;IACH,YAAY,IAAI,uBAAuB,GAAG,SAAS;IAInD;;OAEG;IACH,YAAY,CAAC,SAAS,EAAE,uBAAuB,GAAG,IAAI;IAItD;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAmB3B;;OAEG;YACW,cAAc;
|
|
1
|
+
{"version":3,"file":"client-custom.d.ts","sourceRoot":"","sources":["../../src/client/client-custom.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,qBAAqB,EACrB,kBAAkB,EAClB,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,EACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EACX,uBAAuB,EACvB,uBAAuB,EACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK7D;;GAE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AE,YAAY,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAC/D,OAAO,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;IAQ/C;;OAEG;IACG,aAAa,CAClB,OAAO,CAAC,EAAE,YAAY,CAAC,qBAAqB,EAAE,wBAAwB,CAAC,GACrE,OAAO,CAAC,eAAe,CAAC,qBAAqB,CAAC,CAAC;IAOlD;;OAEG;IACH,eAAe,CAAC,YAAY,EAAE,QAAQ,GAAG,OAAO,EAAE,SAAS,GAAG,OAAO,EACpE,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,eAAe,CAAC,YAAY,EAAE,QAAQ,EAAE,SAAS,CAAC,GACzD,IAAI;IAQP;;OAEG;IACG,MAAM,CAAC,YAAY,EAAE,QAAQ,GAAG,OAAO,EAAE,SAAS,GAAG,OAAO,EACjE,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,YAAY,CAAC,YAAY,EAAE,QAAQ,EAAE,SAAS,CAAC,GACvD,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;CA0CzC"}
|
|
@@ -54,6 +54,37 @@ export interface ConsentManagerInterface {
|
|
|
54
54
|
*/
|
|
55
55
|
setCallbacks(callbacks: ConsentManagerCallbacks): void;
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Payload for the onConsentSet callback
|
|
59
|
+
*/
|
|
60
|
+
export interface ConsentSetCallbackPayload {
|
|
61
|
+
type: string;
|
|
62
|
+
preferences: Record<string, boolean>;
|
|
63
|
+
domain?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Payload for the onConsentBannerFetched callback
|
|
67
|
+
*/
|
|
68
|
+
export interface ConsentBannerFetchedCallbackPayload {
|
|
69
|
+
showConsentBanner: boolean;
|
|
70
|
+
jurisdiction: {
|
|
71
|
+
code: string;
|
|
72
|
+
message: string;
|
|
73
|
+
};
|
|
74
|
+
location?: {
|
|
75
|
+
countryCode: string | null;
|
|
76
|
+
regionCode: string | null;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Payload for the onConsentVerified callback
|
|
81
|
+
*/
|
|
82
|
+
export interface ConsentVerifiedCallbackPayload {
|
|
83
|
+
type: string;
|
|
84
|
+
domain?: string;
|
|
85
|
+
preferences: string[];
|
|
86
|
+
valid: boolean;
|
|
87
|
+
}
|
|
57
88
|
/**
|
|
58
89
|
* Base callback configuration for consent clients
|
|
59
90
|
*/
|
|
@@ -68,16 +99,16 @@ export interface ConsentManagerCallbacks {
|
|
|
68
99
|
* Called after successfully fetching the consent banner information
|
|
69
100
|
* @param response The response from the showConsentBanner endpoint
|
|
70
101
|
*/
|
|
71
|
-
onConsentBannerFetched?: (response: ResponseContext<
|
|
102
|
+
onConsentBannerFetched?: (response: ResponseContext<ConsentBannerFetchedCallbackPayload>) => void;
|
|
72
103
|
/**
|
|
73
104
|
* Called after successfully setting consent preferences
|
|
74
105
|
* @param response The response from the setConsent endpoint
|
|
75
106
|
*/
|
|
76
|
-
onConsentSet?: (response: ResponseContext<
|
|
107
|
+
onConsentSet?: (response: ResponseContext<ConsentSetCallbackPayload>) => void;
|
|
77
108
|
/**
|
|
78
109
|
* Called after successfully verifying consent
|
|
79
110
|
* @param response The response from the verifyConsent endpoint
|
|
80
111
|
*/
|
|
81
|
-
onConsentVerified?: (response: ResponseContext<
|
|
112
|
+
onConsentVerified?: (response: ResponseContext<ConsentVerifiedCallbackPayload>) => void;
|
|
82
113
|
}
|
|
83
114
|
//# sourceMappingURL=client-interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-interface.d.ts","sourceRoot":"","sources":["../../src/client/client-interface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,qBAAqB,EACrB,kBAAkB,EAClB,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,EACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,YAAY,EAAE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M,WAAW,mCAAmC;IACnD,iBAAiB,EAAE,OAAO,CAAC;IAC3B,YAAY,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAChD,QAAQ,CAAC,EAAE;QAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;CACrE;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAErE;;;OAGG;IACH,sBAAsB,CAAC,EAAE,CACxB,QAAQ,EAAE,eAAe,CAAC,mCAAmC,CAAC,KAC1D,IAAI,CAAC;IAEV;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,yBAAyB,CAAC,KAAK,IAAI,CAAC;IAE9E;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CACnB,QAAQ,EAAE,eAAe,CAAC,8BAA8B,CAAC,KACrD,IAAI,CAAC;CACV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-offline.d.ts","sourceRoot":"","sources":["../../src/client/client-offline.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,qBAAqB,EACrB,kBAAkB,EAClB,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,EACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EACX,uBAAuB,EACvB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"client-offline.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,GAAG,OAAO,EACjE,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,YAAY,CAAC,YAAY,EAAE,QAAQ,EAAE,SAAS,CAAC,GACvD,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;CAGzC"}
|
package/dist/index.cjs
CHANGED
|
@@ -301,7 +301,25 @@ class C15tClient {
|
|
|
301
301
|
method: 'GET',
|
|
302
302
|
...options
|
|
303
303
|
});
|
|
304
|
-
if (response.ok || options?.testing)
|
|
304
|
+
if (response.ok || options?.testing) {
|
|
305
|
+
if (this.callbacks?.onConsentBannerFetched && response.data) {
|
|
306
|
+
const callbackPayload = {
|
|
307
|
+
ok: response.ok,
|
|
308
|
+
error: response.error,
|
|
309
|
+
response: null,
|
|
310
|
+
data: {
|
|
311
|
+
showConsentBanner: response.data.showConsentBanner,
|
|
312
|
+
jurisdiction: response.data.jurisdiction,
|
|
313
|
+
location: {
|
|
314
|
+
countryCode: response.data.location.countryCode,
|
|
315
|
+
regionCode: response.data.location.regionCode
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
this.callbacks.onConsentBannerFetched(callbackPayload);
|
|
320
|
+
}
|
|
321
|
+
return response;
|
|
322
|
+
}
|
|
305
323
|
console.warn('API request failed, falling back to offline mode for consent banner');
|
|
306
324
|
return this.offlineFallbackForConsentBanner(options);
|
|
307
325
|
} catch (error) {
|
|
@@ -346,6 +364,22 @@ class C15tClient {
|
|
|
346
364
|
}
|
|
347
365
|
}, null, null);
|
|
348
366
|
if (options?.onSuccess) await options.onSuccess(response);
|
|
367
|
+
if (this.callbacks?.onConsentBannerFetched && response.data) {
|
|
368
|
+
const callbackPayload = {
|
|
369
|
+
ok: response.ok,
|
|
370
|
+
error: response.error,
|
|
371
|
+
response: null,
|
|
372
|
+
data: {
|
|
373
|
+
showConsentBanner: response.data.showConsentBanner,
|
|
374
|
+
jurisdiction: response.data.jurisdiction,
|
|
375
|
+
location: {
|
|
376
|
+
countryCode: response.data.location.countryCode,
|
|
377
|
+
regionCode: response.data.location.regionCode
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
this.callbacks.onConsentBannerFetched(callbackPayload);
|
|
382
|
+
}
|
|
349
383
|
return response;
|
|
350
384
|
}
|
|
351
385
|
async setConsent(options) {
|
|
@@ -354,7 +388,22 @@ class C15tClient {
|
|
|
354
388
|
method: 'POST',
|
|
355
389
|
...options
|
|
356
390
|
});
|
|
357
|
-
if (response.ok || options?.testing)
|
|
391
|
+
if (response.ok && response.data || options?.testing) {
|
|
392
|
+
if (this.callbacks?.onConsentSet) {
|
|
393
|
+
const callbackPayload = {
|
|
394
|
+
ok: response.ok,
|
|
395
|
+
error: response.error,
|
|
396
|
+
response: null,
|
|
397
|
+
data: {
|
|
398
|
+
type: options?.body?.type || 'cookie_banner',
|
|
399
|
+
preferences: options?.body?.preferences || {},
|
|
400
|
+
domain: options?.body?.domain
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
this.callbacks.onConsentSet(callbackPayload);
|
|
404
|
+
}
|
|
405
|
+
return response;
|
|
406
|
+
}
|
|
358
407
|
console.warn('API request failed, falling back to offline mode for setting consent');
|
|
359
408
|
return this.offlineFallbackForSetConsent(options);
|
|
360
409
|
} catch (error) {
|
|
@@ -392,7 +441,7 @@ class C15tClient {
|
|
|
392
441
|
pendingSubmissions = [];
|
|
393
442
|
}
|
|
394
443
|
const newSubmission = options.body;
|
|
395
|
-
const isDuplicate = pendingSubmissions.some((submission)=>JSON.stringify(submission
|
|
444
|
+
const isDuplicate = pendingSubmissions.some((submission)=>JSON.stringify(submission) === JSON.stringify(newSubmission));
|
|
396
445
|
if (!isDuplicate) {
|
|
397
446
|
pendingSubmissions.push(newSubmission);
|
|
398
447
|
window.localStorage.setItem(pendingSubmissionsKey, JSON.stringify(pendingSubmissions));
|
|
@@ -405,13 +454,39 @@ class C15tClient {
|
|
|
405
454
|
}
|
|
406
455
|
const response = this.createResponseContext(true, null, null, null);
|
|
407
456
|
if (options?.onSuccess) await options.onSuccess(response);
|
|
457
|
+
if (this.callbacks?.onConsentSet) {
|
|
458
|
+
const callbackPayload = {
|
|
459
|
+
...response,
|
|
460
|
+
data: {
|
|
461
|
+
type: options?.body?.type || 'cookie_banner',
|
|
462
|
+
preferences: options?.body?.preferences || {},
|
|
463
|
+
domain: options?.body?.domain
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
this.callbacks.onConsentSet(callbackPayload);
|
|
467
|
+
}
|
|
408
468
|
return response;
|
|
409
469
|
}
|
|
410
470
|
async verifyConsent(options) {
|
|
411
|
-
|
|
471
|
+
const response = await this.fetcher(API_ENDPOINTS.VERIFY_CONSENT, {
|
|
412
472
|
method: 'POST',
|
|
413
473
|
...options
|
|
414
474
|
});
|
|
475
|
+
if (response.ok && this.callbacks?.onConsentVerified && response.data) {
|
|
476
|
+
const callbackPayload = {
|
|
477
|
+
ok: response.ok,
|
|
478
|
+
error: response.error,
|
|
479
|
+
response: null,
|
|
480
|
+
data: {
|
|
481
|
+
type: options?.body?.type || 'cookie_banner',
|
|
482
|
+
preferences: options?.body?.preferences || [],
|
|
483
|
+
valid: response.data.isValid,
|
|
484
|
+
domain: options?.body?.domain
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
this.callbacks.onConsentVerified(callbackPayload);
|
|
488
|
+
}
|
|
489
|
+
return response;
|
|
415
490
|
}
|
|
416
491
|
async $fetch(path, options) {
|
|
417
492
|
return await this.fetcher(path, options);
|
|
@@ -524,7 +599,37 @@ class CustomClient {
|
|
|
524
599
|
};
|
|
525
600
|
if (normalizedResponse.ok && callbackKey && this.callbacks?.[callbackKey]) {
|
|
526
601
|
const callback = this.callbacks[callbackKey];
|
|
527
|
-
|
|
602
|
+
let callbackPayload;
|
|
603
|
+
if ('onConsentBannerFetched' === callbackKey && normalizedResponse.data) {
|
|
604
|
+
const data = normalizedResponse.data;
|
|
605
|
+
callbackPayload = {
|
|
606
|
+
...normalizedResponse,
|
|
607
|
+
data: {
|
|
608
|
+
showConsentBanner: data.showConsentBanner,
|
|
609
|
+
jurisdiction: data.jurisdiction,
|
|
610
|
+
location: {
|
|
611
|
+
countryCode: data.location.countryCode || 'GB',
|
|
612
|
+
regionCode: data.location.regionCode || null
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
};
|
|
616
|
+
} else callbackPayload = 'onConsentSet' === callbackKey && normalizedResponse.data ? {
|
|
617
|
+
...normalizedResponse,
|
|
618
|
+
data: {
|
|
619
|
+
type: options?.body?.type || 'cookie_banner',
|
|
620
|
+
preferences: options?.body?.preferences || {},
|
|
621
|
+
domain: options?.body?.domain
|
|
622
|
+
}
|
|
623
|
+
} : 'onConsentVerified' === callbackKey && normalizedResponse.data ? {
|
|
624
|
+
...normalizedResponse,
|
|
625
|
+
data: {
|
|
626
|
+
type: options?.body?.type || 'cookie_banner',
|
|
627
|
+
preferences: options?.body?.preferences || [],
|
|
628
|
+
valid: true,
|
|
629
|
+
domain: options?.body?.domain
|
|
630
|
+
}
|
|
631
|
+
} : normalizedResponse;
|
|
632
|
+
callback(callbackPayload);
|
|
528
633
|
}
|
|
529
634
|
return normalizedResponse;
|
|
530
635
|
} catch (error) {
|
|
@@ -585,12 +690,13 @@ class OfflineClient {
|
|
|
585
690
|
response: null
|
|
586
691
|
};
|
|
587
692
|
}
|
|
588
|
-
async handleOfflineResponse(options, callbackKey) {
|
|
693
|
+
async handleOfflineResponse(options, callbackKey, callbackPayload) {
|
|
589
694
|
const emptyResponse = this.createResponseContext();
|
|
590
695
|
if (options?.onSuccess) await options.onSuccess(emptyResponse);
|
|
591
696
|
if (callbackKey && this.callbacks?.[callbackKey]) {
|
|
592
697
|
const callback = this.callbacks[callbackKey];
|
|
593
|
-
|
|
698
|
+
const payload = callbackPayload ? this.createResponseContext(callbackPayload) : emptyResponse;
|
|
699
|
+
callback(payload);
|
|
594
700
|
}
|
|
595
701
|
return emptyResponse;
|
|
596
702
|
}
|
|
@@ -614,11 +720,21 @@ class OfflineClient {
|
|
|
614
720
|
message: 'EU'
|
|
615
721
|
},
|
|
616
722
|
location: {
|
|
617
|
-
countryCode: '
|
|
618
|
-
regionCode:
|
|
723
|
+
countryCode: 'GB',
|
|
724
|
+
regionCode: null
|
|
619
725
|
}
|
|
620
726
|
});
|
|
621
|
-
if (this.callbacks?.onConsentBannerFetched
|
|
727
|
+
if (this.callbacks?.onConsentBannerFetched && response.data) {
|
|
728
|
+
const callbackPayload = this.createResponseContext({
|
|
729
|
+
showConsentBanner: response.data.showConsentBanner,
|
|
730
|
+
jurisdiction: response.data.jurisdiction,
|
|
731
|
+
location: {
|
|
732
|
+
countryCode: response.data.location.countryCode || 'GB',
|
|
733
|
+
regionCode: response.data.location.regionCode || null
|
|
734
|
+
}
|
|
735
|
+
});
|
|
736
|
+
this.callbacks.onConsentBannerFetched(callbackPayload);
|
|
737
|
+
}
|
|
622
738
|
if (options?.onSuccess) await options.onSuccess(response);
|
|
623
739
|
return response;
|
|
624
740
|
}
|
|
@@ -635,10 +751,21 @@ class OfflineClient {
|
|
|
635
751
|
} catch (error) {
|
|
636
752
|
console.warn('Failed to write to localStorage:', error);
|
|
637
753
|
}
|
|
638
|
-
|
|
754
|
+
const setConsentCallbackPayload = {
|
|
755
|
+
type: options?.body?.type || 'cookie_banner',
|
|
756
|
+
preferences: options?.body?.preferences || {},
|
|
757
|
+
domain: options?.body?.domain || ''
|
|
758
|
+
};
|
|
759
|
+
return await this.handleOfflineResponse(options, 'onConsentSet', setConsentCallbackPayload);
|
|
639
760
|
}
|
|
640
761
|
async verifyConsent(options) {
|
|
641
|
-
|
|
762
|
+
const verifiedCallbackPayload = {
|
|
763
|
+
type: options?.body?.type || 'cookie_banner',
|
|
764
|
+
preferences: options?.body?.preferences || [],
|
|
765
|
+
valid: true,
|
|
766
|
+
domain: options?.body?.domain || ''
|
|
767
|
+
};
|
|
768
|
+
return await this.handleOfflineResponse(options, 'onConsentVerified', verifiedCallbackPayload);
|
|
642
769
|
}
|
|
643
770
|
async $fetch(_path, options) {
|
|
644
771
|
return await this.handleOfflineResponse(options);
|
package/dist/index.js
CHANGED
|
@@ -266,7 +266,25 @@ class C15tClient {
|
|
|
266
266
|
method: 'GET',
|
|
267
267
|
...options
|
|
268
268
|
});
|
|
269
|
-
if (response.ok || options?.testing)
|
|
269
|
+
if (response.ok || options?.testing) {
|
|
270
|
+
if (this.callbacks?.onConsentBannerFetched && response.data) {
|
|
271
|
+
const callbackPayload = {
|
|
272
|
+
ok: response.ok,
|
|
273
|
+
error: response.error,
|
|
274
|
+
response: null,
|
|
275
|
+
data: {
|
|
276
|
+
showConsentBanner: response.data.showConsentBanner,
|
|
277
|
+
jurisdiction: response.data.jurisdiction,
|
|
278
|
+
location: {
|
|
279
|
+
countryCode: response.data.location.countryCode,
|
|
280
|
+
regionCode: response.data.location.regionCode
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
this.callbacks.onConsentBannerFetched(callbackPayload);
|
|
285
|
+
}
|
|
286
|
+
return response;
|
|
287
|
+
}
|
|
270
288
|
console.warn('API request failed, falling back to offline mode for consent banner');
|
|
271
289
|
return this.offlineFallbackForConsentBanner(options);
|
|
272
290
|
} catch (error) {
|
|
@@ -311,6 +329,22 @@ class C15tClient {
|
|
|
311
329
|
}
|
|
312
330
|
}, null, null);
|
|
313
331
|
if (options?.onSuccess) await options.onSuccess(response);
|
|
332
|
+
if (this.callbacks?.onConsentBannerFetched && response.data) {
|
|
333
|
+
const callbackPayload = {
|
|
334
|
+
ok: response.ok,
|
|
335
|
+
error: response.error,
|
|
336
|
+
response: null,
|
|
337
|
+
data: {
|
|
338
|
+
showConsentBanner: response.data.showConsentBanner,
|
|
339
|
+
jurisdiction: response.data.jurisdiction,
|
|
340
|
+
location: {
|
|
341
|
+
countryCode: response.data.location.countryCode,
|
|
342
|
+
regionCode: response.data.location.regionCode
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
this.callbacks.onConsentBannerFetched(callbackPayload);
|
|
347
|
+
}
|
|
314
348
|
return response;
|
|
315
349
|
}
|
|
316
350
|
async setConsent(options) {
|
|
@@ -319,7 +353,22 @@ class C15tClient {
|
|
|
319
353
|
method: 'POST',
|
|
320
354
|
...options
|
|
321
355
|
});
|
|
322
|
-
if (response.ok || options?.testing)
|
|
356
|
+
if (response.ok && response.data || options?.testing) {
|
|
357
|
+
if (this.callbacks?.onConsentSet) {
|
|
358
|
+
const callbackPayload = {
|
|
359
|
+
ok: response.ok,
|
|
360
|
+
error: response.error,
|
|
361
|
+
response: null,
|
|
362
|
+
data: {
|
|
363
|
+
type: options?.body?.type || 'cookie_banner',
|
|
364
|
+
preferences: options?.body?.preferences || {},
|
|
365
|
+
domain: options?.body?.domain
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
this.callbacks.onConsentSet(callbackPayload);
|
|
369
|
+
}
|
|
370
|
+
return response;
|
|
371
|
+
}
|
|
323
372
|
console.warn('API request failed, falling back to offline mode for setting consent');
|
|
324
373
|
return this.offlineFallbackForSetConsent(options);
|
|
325
374
|
} catch (error) {
|
|
@@ -357,7 +406,7 @@ class C15tClient {
|
|
|
357
406
|
pendingSubmissions = [];
|
|
358
407
|
}
|
|
359
408
|
const newSubmission = options.body;
|
|
360
|
-
const isDuplicate = pendingSubmissions.some((submission)=>JSON.stringify(submission
|
|
409
|
+
const isDuplicate = pendingSubmissions.some((submission)=>JSON.stringify(submission) === JSON.stringify(newSubmission));
|
|
361
410
|
if (!isDuplicate) {
|
|
362
411
|
pendingSubmissions.push(newSubmission);
|
|
363
412
|
window.localStorage.setItem(pendingSubmissionsKey, JSON.stringify(pendingSubmissions));
|
|
@@ -370,13 +419,39 @@ class C15tClient {
|
|
|
370
419
|
}
|
|
371
420
|
const response = this.createResponseContext(true, null, null, null);
|
|
372
421
|
if (options?.onSuccess) await options.onSuccess(response);
|
|
422
|
+
if (this.callbacks?.onConsentSet) {
|
|
423
|
+
const callbackPayload = {
|
|
424
|
+
...response,
|
|
425
|
+
data: {
|
|
426
|
+
type: options?.body?.type || 'cookie_banner',
|
|
427
|
+
preferences: options?.body?.preferences || {},
|
|
428
|
+
domain: options?.body?.domain
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
this.callbacks.onConsentSet(callbackPayload);
|
|
432
|
+
}
|
|
373
433
|
return response;
|
|
374
434
|
}
|
|
375
435
|
async verifyConsent(options) {
|
|
376
|
-
|
|
436
|
+
const response = await this.fetcher(API_ENDPOINTS.VERIFY_CONSENT, {
|
|
377
437
|
method: 'POST',
|
|
378
438
|
...options
|
|
379
439
|
});
|
|
440
|
+
if (response.ok && this.callbacks?.onConsentVerified && response.data) {
|
|
441
|
+
const callbackPayload = {
|
|
442
|
+
ok: response.ok,
|
|
443
|
+
error: response.error,
|
|
444
|
+
response: null,
|
|
445
|
+
data: {
|
|
446
|
+
type: options?.body?.type || 'cookie_banner',
|
|
447
|
+
preferences: options?.body?.preferences || [],
|
|
448
|
+
valid: response.data.isValid,
|
|
449
|
+
domain: options?.body?.domain
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
this.callbacks.onConsentVerified(callbackPayload);
|
|
453
|
+
}
|
|
454
|
+
return response;
|
|
380
455
|
}
|
|
381
456
|
async $fetch(path, options) {
|
|
382
457
|
return await this.fetcher(path, options);
|
|
@@ -489,7 +564,37 @@ class CustomClient {
|
|
|
489
564
|
};
|
|
490
565
|
if (normalizedResponse.ok && callbackKey && this.callbacks?.[callbackKey]) {
|
|
491
566
|
const callback = this.callbacks[callbackKey];
|
|
492
|
-
|
|
567
|
+
let callbackPayload;
|
|
568
|
+
if ('onConsentBannerFetched' === callbackKey && normalizedResponse.data) {
|
|
569
|
+
const data = normalizedResponse.data;
|
|
570
|
+
callbackPayload = {
|
|
571
|
+
...normalizedResponse,
|
|
572
|
+
data: {
|
|
573
|
+
showConsentBanner: data.showConsentBanner,
|
|
574
|
+
jurisdiction: data.jurisdiction,
|
|
575
|
+
location: {
|
|
576
|
+
countryCode: data.location.countryCode || 'GB',
|
|
577
|
+
regionCode: data.location.regionCode || null
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
} else callbackPayload = 'onConsentSet' === callbackKey && normalizedResponse.data ? {
|
|
582
|
+
...normalizedResponse,
|
|
583
|
+
data: {
|
|
584
|
+
type: options?.body?.type || 'cookie_banner',
|
|
585
|
+
preferences: options?.body?.preferences || {},
|
|
586
|
+
domain: options?.body?.domain
|
|
587
|
+
}
|
|
588
|
+
} : 'onConsentVerified' === callbackKey && normalizedResponse.data ? {
|
|
589
|
+
...normalizedResponse,
|
|
590
|
+
data: {
|
|
591
|
+
type: options?.body?.type || 'cookie_banner',
|
|
592
|
+
preferences: options?.body?.preferences || [],
|
|
593
|
+
valid: true,
|
|
594
|
+
domain: options?.body?.domain
|
|
595
|
+
}
|
|
596
|
+
} : normalizedResponse;
|
|
597
|
+
callback(callbackPayload);
|
|
493
598
|
}
|
|
494
599
|
return normalizedResponse;
|
|
495
600
|
} catch (error) {
|
|
@@ -550,12 +655,13 @@ class OfflineClient {
|
|
|
550
655
|
response: null
|
|
551
656
|
};
|
|
552
657
|
}
|
|
553
|
-
async handleOfflineResponse(options, callbackKey) {
|
|
658
|
+
async handleOfflineResponse(options, callbackKey, callbackPayload) {
|
|
554
659
|
const emptyResponse = this.createResponseContext();
|
|
555
660
|
if (options?.onSuccess) await options.onSuccess(emptyResponse);
|
|
556
661
|
if (callbackKey && this.callbacks?.[callbackKey]) {
|
|
557
662
|
const callback = this.callbacks[callbackKey];
|
|
558
|
-
|
|
663
|
+
const payload = callbackPayload ? this.createResponseContext(callbackPayload) : emptyResponse;
|
|
664
|
+
callback(payload);
|
|
559
665
|
}
|
|
560
666
|
return emptyResponse;
|
|
561
667
|
}
|
|
@@ -579,11 +685,21 @@ class OfflineClient {
|
|
|
579
685
|
message: 'EU'
|
|
580
686
|
},
|
|
581
687
|
location: {
|
|
582
|
-
countryCode: '
|
|
583
|
-
regionCode:
|
|
688
|
+
countryCode: 'GB',
|
|
689
|
+
regionCode: null
|
|
584
690
|
}
|
|
585
691
|
});
|
|
586
|
-
if (this.callbacks?.onConsentBannerFetched
|
|
692
|
+
if (this.callbacks?.onConsentBannerFetched && response.data) {
|
|
693
|
+
const callbackPayload = this.createResponseContext({
|
|
694
|
+
showConsentBanner: response.data.showConsentBanner,
|
|
695
|
+
jurisdiction: response.data.jurisdiction,
|
|
696
|
+
location: {
|
|
697
|
+
countryCode: response.data.location.countryCode || 'GB',
|
|
698
|
+
regionCode: response.data.location.regionCode || null
|
|
699
|
+
}
|
|
700
|
+
});
|
|
701
|
+
this.callbacks.onConsentBannerFetched(callbackPayload);
|
|
702
|
+
}
|
|
587
703
|
if (options?.onSuccess) await options.onSuccess(response);
|
|
588
704
|
return response;
|
|
589
705
|
}
|
|
@@ -600,10 +716,21 @@ class OfflineClient {
|
|
|
600
716
|
} catch (error) {
|
|
601
717
|
console.warn('Failed to write to localStorage:', error);
|
|
602
718
|
}
|
|
603
|
-
|
|
719
|
+
const setConsentCallbackPayload = {
|
|
720
|
+
type: options?.body?.type || 'cookie_banner',
|
|
721
|
+
preferences: options?.body?.preferences || {},
|
|
722
|
+
domain: options?.body?.domain || ''
|
|
723
|
+
};
|
|
724
|
+
return await this.handleOfflineResponse(options, 'onConsentSet', setConsentCallbackPayload);
|
|
604
725
|
}
|
|
605
726
|
async verifyConsent(options) {
|
|
606
|
-
|
|
727
|
+
const verifiedCallbackPayload = {
|
|
728
|
+
type: options?.body?.type || 'cookie_banner',
|
|
729
|
+
preferences: options?.body?.preferences || [],
|
|
730
|
+
valid: true,
|
|
731
|
+
domain: options?.body?.domain || ''
|
|
732
|
+
};
|
|
733
|
+
return await this.handleOfflineResponse(options, 'onConsentVerified', verifiedCallbackPayload);
|
|
607
734
|
}
|
|
608
735
|
async $fetch(_path, options) {
|
|
609
736
|
return await this.handleOfflineResponse(options);
|