@solvenza/cookies-compliance 1.1.0 → 1.2.0
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/LICENSE +21 -0
- package/dist/{chunk-CNAXWXBL.js → chunk-FBRP4MSA.js} +42 -1
- package/dist/chunk-FBRP4MSA.js.map +1 -0
- package/dist/{consent-engine-D3ApY7o3.d.cts → consent-engine-DOMyEKfk.d.cts} +1 -0
- package/dist/{consent-engine-D3ApY7o3.d.ts → consent-engine-DOMyEKfk.d.ts} +1 -0
- package/dist/consent.esm.cjs +41 -0
- package/dist/consent.esm.cjs.map +1 -1
- package/dist/consent.esm.d.cts +3 -2
- package/dist/consent.esm.d.ts +3 -2
- package/dist/consent.esm.js +1 -1
- package/dist/consent.min.js +19 -19
- package/dist/consent.min.js.map +1 -1
- package/dist/wrappers/angular.cjs +41 -0
- package/dist/wrappers/angular.cjs.map +1 -1
- package/dist/wrappers/angular.d.cts +1 -1
- package/dist/wrappers/angular.d.ts +1 -1
- package/dist/wrappers/angular.js +1 -1
- package/dist/wrappers/next.cjs +41 -0
- package/dist/wrappers/next.cjs.map +1 -1
- package/dist/wrappers/next.js +1 -1
- package/dist/wrappers/react.cjs +41 -0
- package/dist/wrappers/react.cjs.map +1 -1
- package/dist/wrappers/react.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-CNAXWXBL.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ConsentConfig, j as ConsentState, b as ConsentChoices, d as Consent } from '../consent-engine-
|
|
1
|
+
import { a as ConsentConfig, j as ConsentState, b as ConsentChoices, d as Consent } from '../consent-engine-DOMyEKfk.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Angular Consent Service helper.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ConsentConfig, j as ConsentState, b as ConsentChoices, d as Consent } from '../consent-engine-
|
|
1
|
+
import { a as ConsentConfig, j as ConsentState, b as ConsentChoices, d as Consent } from '../consent-engine-DOMyEKfk.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Angular Consent Service helper.
|
package/dist/wrappers/angular.js
CHANGED
package/dist/wrappers/next.cjs
CHANGED
|
@@ -473,6 +473,19 @@ var CookieStore = class {
|
|
|
473
473
|
}
|
|
474
474
|
document.cookie = cookieStr;
|
|
475
475
|
}
|
|
476
|
+
static clearServiceCookies(config, revokedCategory) {
|
|
477
|
+
var _a, _b;
|
|
478
|
+
if (typeof document === "undefined" || !config.services) return;
|
|
479
|
+
const path = ((_a = config.storage) == null ? void 0 : _a.path) || "/";
|
|
480
|
+
const domain = (_b = config.storage) == null ? void 0 : _b.domain;
|
|
481
|
+
for (const service of Object.values(config.services)) {
|
|
482
|
+
if (service.category === revokedCategory && service.cookies) {
|
|
483
|
+
for (const cookieItem of service.cookies) {
|
|
484
|
+
this.remove(cookieItem.name, path, domain || cookieItem.domain);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
476
489
|
};
|
|
477
490
|
|
|
478
491
|
// src/storage/memory-store.ts
|
|
@@ -1632,6 +1645,7 @@ var ConsentEngine = class {
|
|
|
1632
1645
|
GoogleConsentAdapter.initDefault();
|
|
1633
1646
|
if (evalResult.isValid) {
|
|
1634
1647
|
GoogleConsentAdapter.update(evalResult.choices);
|
|
1648
|
+
this.dispatchDomEvent("solvenza:restored", { state: this.getConsent() });
|
|
1635
1649
|
}
|
|
1636
1650
|
this.blockerRegistry.init(
|
|
1637
1651
|
(cat) => this.has(cat),
|
|
@@ -1728,9 +1742,15 @@ var ConsentEngine = class {
|
|
|
1728
1742
|
} else {
|
|
1729
1743
|
CookieStore.remove(cookieName, ((_c = config.storage) == null ? void 0 : _c.path) || "/", (_d = config.storage) == null ? void 0 : _d.domain);
|
|
1730
1744
|
}
|
|
1745
|
+
for (const catId of Object.keys(config.categories)) {
|
|
1746
|
+
if (catId !== "necessary") {
|
|
1747
|
+
CookieStore.clearServiceCookies(config, catId);
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1731
1750
|
this.stateManager.clearChoices();
|
|
1732
1751
|
GoogleConsentAdapter.update(this.stateManager.getChoices());
|
|
1733
1752
|
this.eventBus.emit("consent:withdrawn", { previousChoices });
|
|
1753
|
+
this.dispatchDomEvent("solvenza:updated", { choices: this.stateManager.getChoices() });
|
|
1734
1754
|
this.showBanner();
|
|
1735
1755
|
}
|
|
1736
1756
|
when(categoryOrService, callback) {
|
|
@@ -1776,6 +1796,11 @@ var ConsentEngine = class {
|
|
|
1776
1796
|
(_a = config.security) == null ? void 0 : _a.secretKey
|
|
1777
1797
|
);
|
|
1778
1798
|
this.stateManager.updateChoices(receipt);
|
|
1799
|
+
for (const [catId, isAllowed] of Object.entries(choices)) {
|
|
1800
|
+
if (!isAllowed) {
|
|
1801
|
+
CookieStore.clearServiceCookies(config, catId);
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1779
1804
|
const cookieName = ((_b = config.storage) == null ? void 0 : _b.name) || "site_consent";
|
|
1780
1805
|
const receiptJson = JSON.stringify(receipt);
|
|
1781
1806
|
if (((_c = config.storage) == null ? void 0 : _c.type) === "memory") {
|
|
@@ -1807,6 +1832,7 @@ var ConsentEngine = class {
|
|
|
1807
1832
|
}
|
|
1808
1833
|
this.banner.remove();
|
|
1809
1834
|
this.eventBus.emit("consent:changed", { choices, receipt });
|
|
1835
|
+
this.dispatchDomEvent("solvenza:updated", { choices, receipt });
|
|
1810
1836
|
}
|
|
1811
1837
|
showBanner() {
|
|
1812
1838
|
const config = this.stateManager.getConfig();
|
|
@@ -1817,6 +1843,7 @@ var ConsentEngine = class {
|
|
|
1817
1843
|
onConfigure: () => this.openPreferences()
|
|
1818
1844
|
});
|
|
1819
1845
|
this.eventBus.emit("banner:shown", void 0);
|
|
1846
|
+
this.dispatchDomEvent("solvenza:show", void 0);
|
|
1820
1847
|
}
|
|
1821
1848
|
setupGlobalRevocationTrigger() {
|
|
1822
1849
|
if (typeof document === "undefined") return;
|
|
@@ -1827,6 +1854,20 @@ var ConsentEngine = class {
|
|
|
1827
1854
|
this.openPreferences();
|
|
1828
1855
|
}
|
|
1829
1856
|
});
|
|
1857
|
+
document.addEventListener("solvenza:show", () => {
|
|
1858
|
+
this.showBanner();
|
|
1859
|
+
});
|
|
1860
|
+
document.addEventListener("solvenza:preferences", () => {
|
|
1861
|
+
this.openPreferences();
|
|
1862
|
+
});
|
|
1863
|
+
}
|
|
1864
|
+
dispatchDomEvent(name, detail) {
|
|
1865
|
+
if (typeof document === "undefined") return;
|
|
1866
|
+
try {
|
|
1867
|
+
const customEvent = new CustomEvent(name, { detail, bubbles: true });
|
|
1868
|
+
document.dispatchEvent(customEvent);
|
|
1869
|
+
} catch (e) {
|
|
1870
|
+
}
|
|
1830
1871
|
}
|
|
1831
1872
|
};
|
|
1832
1873
|
var globalScope = typeof window !== "undefined" ? window : globalThis;
|