c15t 1.0.0 → 1.0.2

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 CHANGED
@@ -1,12 +1,26 @@
1
1
  # c15t
2
2
 
3
+ ## 1.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`08446ae`](https://github.com/c15t/c15t/commit/08446aef443a20a2262477a1dca3569d6bf672ad) Thanks [@BurnedChris](https://github.com/BurnedChris)! - # Removal of localstorage option in offline and custom
8
+
9
+ - **Documentation**
10
+ - Updated offline mode documentation to remove references to the `localStorageKey` configuration option.
11
+ - **Bug Fixes**
12
+ - Removed the ability to customize the localStorage key for storing consent data; a fixed key is now always used.
13
+ - **Refactor**
14
+ - Streamlined internal handling of localStorage keys by removing related configuration options and parameters.
15
+ - **Tests**
16
+ - Updated and removed tests related to custom localStorage key usage.
3
17
 
4
18
  ## 1.0.0-rc.1
5
19
 
6
20
  ### Patch Changes
7
21
 
8
22
  - Refactored package.json imports
9
-
23
+
10
24
  ## 0.0.1-beta.10
11
25
 
12
26
  ### 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,EACX,uBAAuB,EACvB,uBAAuB,EACvB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAEN,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,MAAM,SAAS,CAAC;AAgBjB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,C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H,OAAO,CAAC,8BAA8B;IA8CtC;;;OAGG;YACW,yBAAyB;CAqFvC"}
@@ -13,11 +13,6 @@ export interface OfflineClientOptions {
13
13
  * Global callbacks for handling API responses
14
14
  */
15
15
  callbacks?: ConsentManagerCallbacks;
16
- /**
17
- * Custom localStorage key to check for consent banner visibility
18
- * @default 'c15t-consent'
19
- */
20
- localStorageKey?: string;
21
16
  }
22
17
  /**
23
18
  * Offline implementation of the consent client interface.
@@ -29,11 +24,6 @@ export declare class OfflineClient implements ConsentManagerInterface {
29
24
  * @internal
30
25
  */
31
26
  private callbacks?;
32
- /**
33
- * LocalStorage key for consent banner visibility
34
- * @internal
35
- */
36
- private localStorageKey;
37
27
  /**
38
28
  * Creates a new Offline client instance.
39
29
  *
@@ -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,EACvB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC;;OAEG;IACH,SAAS,CAAC,EAAE,uBAAuB,CAAC;IAEpC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,qBAAa,aAAc,YAAW,uBAAuB;IAC5D;;;OAGG;IACH,OAAO,CAAC,SAAS,CAAC,CAA0B;IAE5C;;;OAGG;IACH,OAAO,CAAC,eAAe,CAAS;IAEhC;;;;OAIG;gBACS,OAAO,GAAE,oBAAyB;IAK9C;;;;OAIG;IACH,YAAY,IAAI,uBAAuB,GAAG,SAAS;IAInD;;OAEG;IACH,YA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aAAc,YAAW,uBAAuB;IAC5D;;;OAGG;IACH,OAAO,CAAC,SAAS,CAAC,CAA0B;IAE5C;;;;OAIG;gBACS,OAAO,GAAE,oBAAyB;IAI9C;;;;OAIG;IACH,YAAY,IAAI,uBAAuB,GAAG,SAAS;IAInD;;OAEG;IACH,YAAY,CAAC,SAAS,EAAE,uBAAuB,GAAG,IAAI;IAItD;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAS7B;;OAEG;YACW,qBAAqB;IAyBnC;;;OAGG;IACG,iBAAiB,CACtB,OAAO,CAAC,EAAE,YAAY,CAAC,yBAAyB,CAAC,GAC/C,OAAO,CAAC,eAAe,CAAC,yBAAyB,CAAC,CAAC;IA4CtD;;;OAGG;IACG,UAAU,CACf,OAAO,CAAC,EAAE,YAAY,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAC/D,OAAO,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;IA+B/C;;OAEG;IACG,aAAa,CAClB,OAAO,CAAC,EAAE,YAAY,CAAC,qBAAqB,EAAE,wBAAwB,CAAC,GACrE,OAAO,CAAC,eAAe,CAAC,qBAAqB,CAAC,CAAC;IAOlD;;OAEG;IACG,MAAM,CAAC,YAAY,EAAE,QAAQ,GAAG,OAAO,EAAE,SAAS,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
@@ -322,13 +322,12 @@ class C15tClient {
322
322
  async offlineFallbackForConsentBanner(options) {
323
323
  let shouldShow = true;
324
324
  let hasLocalStorageAccess = false;
325
- const localStorageKey = 'c15t-consent';
326
325
  try {
327
326
  if ('undefined' != typeof window && window.localStorage) {
328
327
  window.localStorage.setItem('c15t-storage-test-key', 'test');
329
328
  window.localStorage.removeItem('c15t-storage-test-key');
330
329
  hasLocalStorageAccess = true;
331
- const storedConsent = window.localStorage.getItem(localStorageKey);
330
+ const storedConsent = window.localStorage.getItem('c15t-consent');
332
331
  shouldShow = null === storedConsent;
333
332
  }
334
333
  } catch (error) {
@@ -374,13 +373,12 @@ class C15tClient {
374
373
  }
375
374
  }
376
375
  async offlineFallbackForSetConsent(options) {
377
- const localStorageKey = 'c15t-consent';
378
376
  const pendingSubmissionsKey = 'c15t-pending-consent-submissions';
379
377
  try {
380
378
  if ('undefined' != typeof window && window.localStorage) {
381
379
  window.localStorage.setItem('c15t-storage-test-key', 'test');
382
380
  window.localStorage.removeItem('c15t-storage-test-key');
383
- window.localStorage.setItem(localStorageKey, JSON.stringify({
381
+ window.localStorage.setItem('c15t-consent', JSON.stringify({
384
382
  timestamp: new Date().toISOString(),
385
383
  preferences: options?.body?.preferences || {}
386
384
  }));
@@ -570,10 +568,8 @@ class CustomClient {
570
568
  }
571
569
  class OfflineClient {
572
570
  callbacks;
573
- localStorageKey;
574
571
  constructor(options = {}){
575
572
  this.callbacks = options.callbacks;
576
- this.localStorageKey = options.localStorageKey || 'c15t-consent';
577
573
  }
578
574
  getCallbacks() {
579
575
  return this.callbacks;
@@ -604,7 +600,7 @@ class OfflineClient {
604
600
  if ('undefined' != typeof window && window.localStorage) {
605
601
  window.localStorage.setItem('c15t-storage-test-key', 'test');
606
602
  window.localStorage.removeItem('c15t-storage-test-key');
607
- const storedConsent = window.localStorage.getItem(this.localStorageKey);
603
+ const storedConsent = window.localStorage.getItem('c15t-consent');
608
604
  shouldShow = null === storedConsent;
609
605
  }
610
606
  } catch (error) {
@@ -631,7 +627,7 @@ class OfflineClient {
631
627
  if ('undefined' != typeof window && window.localStorage) {
632
628
  window.localStorage.setItem('c15t-storage-test-key', 'test');
633
629
  window.localStorage.removeItem('c15t-storage-test-key');
634
- window.localStorage.setItem(this.localStorageKey, JSON.stringify({
630
+ window.localStorage.setItem('c15t-consent', JSON.stringify({
635
631
  timestamp: new Date().toISOString(),
636
632
  preferences: options?.body?.preferences || {}
637
633
  }));
package/dist/index.js CHANGED
@@ -287,13 +287,12 @@ class C15tClient {
287
287
  async offlineFallbackForConsentBanner(options) {
288
288
  let shouldShow = true;
289
289
  let hasLocalStorageAccess = false;
290
- const localStorageKey = 'c15t-consent';
291
290
  try {
292
291
  if ('undefined' != typeof window && window.localStorage) {
293
292
  window.localStorage.setItem('c15t-storage-test-key', 'test');
294
293
  window.localStorage.removeItem('c15t-storage-test-key');
295
294
  hasLocalStorageAccess = true;
296
- const storedConsent = window.localStorage.getItem(localStorageKey);
295
+ const storedConsent = window.localStorage.getItem('c15t-consent');
297
296
  shouldShow = null === storedConsent;
298
297
  }
299
298
  } catch (error) {
@@ -339,13 +338,12 @@ class C15tClient {
339
338
  }
340
339
  }
341
340
  async offlineFallbackForSetConsent(options) {
342
- const localStorageKey = 'c15t-consent';
343
341
  const pendingSubmissionsKey = 'c15t-pending-consent-submissions';
344
342
  try {
345
343
  if ('undefined' != typeof window && window.localStorage) {
346
344
  window.localStorage.setItem('c15t-storage-test-key', 'test');
347
345
  window.localStorage.removeItem('c15t-storage-test-key');
348
- window.localStorage.setItem(localStorageKey, JSON.stringify({
346
+ window.localStorage.setItem('c15t-consent', JSON.stringify({
349
347
  timestamp: new Date().toISOString(),
350
348
  preferences: options?.body?.preferences || {}
351
349
  }));
@@ -535,10 +533,8 @@ class CustomClient {
535
533
  }
536
534
  class OfflineClient {
537
535
  callbacks;
538
- localStorageKey;
539
536
  constructor(options = {}){
540
537
  this.callbacks = options.callbacks;
541
- this.localStorageKey = options.localStorageKey || 'c15t-consent';
542
538
  }
543
539
  getCallbacks() {
544
540
  return this.callbacks;
@@ -569,7 +565,7 @@ class OfflineClient {
569
565
  if ('undefined' != typeof window && window.localStorage) {
570
566
  window.localStorage.setItem('c15t-storage-test-key', 'test');
571
567
  window.localStorage.removeItem('c15t-storage-test-key');
572
- const storedConsent = window.localStorage.getItem(this.localStorageKey);
568
+ const storedConsent = window.localStorage.getItem('c15t-consent');
573
569
  shouldShow = null === storedConsent;
574
570
  }
575
571
  } catch (error) {
@@ -596,7 +592,7 @@ class OfflineClient {
596
592
  if ('undefined' != typeof window && window.localStorage) {
597
593
  window.localStorage.setItem('c15t-storage-test-key', 'test');
598
594
  window.localStorage.removeItem('c15t-storage-test-key');
599
- window.localStorage.setItem(this.localStorageKey, JSON.stringify({
595
+ window.localStorage.setItem('c15t-consent', JSON.stringify({
600
596
  timestamp: new Date().toISOString(),
601
597
  preferences: options?.body?.preferences || {}
602
598
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c15t",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "license": "GPL-3.0-only",
5
5
  "type": "module",
6
6
  "exports": {