@vllnt/analytics 0.2.0-canary.0cf6be9 → 0.2.0-canary.2103207
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/README.md +8 -3
- package/dist/{chunk-JB5OMGDZ.cjs → chunk-BOGMJ4Z4.cjs} +1 -1
- package/dist/{chunk-UVPDJSPZ.js → chunk-IBYWNCQ4.js} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/react.cjs +32 -32
- package/dist/react.js +1 -1
- package/docs/API.md +12 -5
- package/package.json +1 -2
- package/src/consent.ts +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -37,6 +37,9 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
37
37
|
Without the provider, the limit stays at 100 until `initAnalytics()` runs.
|
|
38
38
|
- The npm description and keywords changed, and `package.json` now lists `homepage`, `bugs`,
|
|
39
39
|
`author` and `funding`.
|
|
40
|
+
- TypeScript users need `@types/react` 18.2.6 or later, because the compiled `./react`
|
|
41
|
+
declarations use `React.JSX.Element`. 0.1.1 shipped TypeScript sources that did not name
|
|
42
|
+
`React.JSX`, so older `@types/react` 18.x versions worked.
|
|
40
43
|
- Internal only: CI, a test that installs the packed package, a docs contract test, and tooling.
|
|
41
44
|
|
|
42
45
|
### Fixed
|
|
@@ -46,6 +49,9 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
46
49
|
- In `AnalyticsProvider` and `useConsent`, `acceptAll` and `declineAnalytics` save the choice with
|
|
47
50
|
their `consentVersion`; `updateConsent` keeps the stored version. Before, they always saved
|
|
48
51
|
version `1`, so a `consentVersion` above `1` asked the user again on every visit.
|
|
52
|
+
- A stored consent choice is now read even when `localStorage` is full, so a stored decline keeps
|
|
53
|
+
tracking blocked. Before, the failed write check made it ignored, so tracking started and
|
|
54
|
+
`AnalyticsProvider` showed the banner again.
|
|
49
55
|
|
|
50
56
|
### Security
|
|
51
57
|
|
package/README.md
CHANGED
|
@@ -223,7 +223,7 @@ The package has no error codes. These are every message it throws or logs as a w
|
|
|
223
223
|
| Message | Kind | Cause | Fix |
|
|
224
224
|
| --- | --- | --- | --- |
|
|
225
225
|
| `useAnalytics must be used within an AnalyticsProvider` | thrown by `useAnalytics()` | The hook ran outside `<AnalyticsProvider>`. | Render the component inside `<AnalyticsProvider>`, or use `useConsent()`. |
|
|
226
|
-
| `Failed to save consent:` | `console.warn` from `saveConsent()` |
|
|
226
|
+
| `Failed to save consent:` | `console.warn` from `saveConsent()` | The write probe (`isStorageAvailable()`) succeeded, but writing the consent value to `localStorage` or setting the cookie threw, for example because the value did not fit in the space left. On a completely full quota the probe fails first, so `saveConsent()` returns without saving and without this warning. | The new choice applies on this page but is not stored, so later visits load the earlier stored choice, if any. A failed accept over a stored decline stays blocked on this page too, because `initAnalytics` re-reads the stored decline. Free storage, or call `clearConsent()` after a failed save. |
|
|
227
227
|
|
|
228
228
|
## Limits and gotchas
|
|
229
229
|
|
|
@@ -246,8 +246,11 @@ The package has no error codes. These are every message it throws or logs as a w
|
|
|
246
246
|
- `disableAnalytics()` keeps the user id and traits; call `resetAnalytics()` to clear them.
|
|
247
247
|
- On the server, `track`, `trackPage`, `identify` and `resetAnalytics` do nothing and `loadConsent`
|
|
248
248
|
returns `null`. `initAnalytics` has no server guard: call it only in the browser.
|
|
249
|
-
- When `localStorage`
|
|
250
|
-
|
|
249
|
+
- When `localStorage` cannot be written (`isStorageAvailable()` is `false`, for example blocked or
|
|
250
|
+
completely full storage), `saveConsent` and `clearConsent` do nothing and log nothing, so a new
|
|
251
|
+
choice lasts for the current page only. `loadConsent` still reads a stored choice whenever
|
|
252
|
+
`localStorage` can be read, so a stored decline keeps tracking blocked, also after an accept that
|
|
253
|
+
could not be saved.
|
|
251
254
|
- `updateConsent("functional", false)` is ignored: functional consent is always on.
|
|
252
255
|
`updateConsent` does nothing while `consent` is `null`.
|
|
253
256
|
- `useConsent()` reads and writes stored consent only; it does not start or stop tracking and does
|
|
@@ -269,6 +272,8 @@ AnalyticsProvider mounts
|
|
|
269
272
|
## Compatibility
|
|
270
273
|
|
|
271
274
|
- React: peer range `^18.0.0 || ^19.0.0`, used by `./react` only.
|
|
275
|
+
- TypeScript users need `@types/react` 18.2.6 or later: the `./react` declarations use
|
|
276
|
+
`React.JSX.Element`.
|
|
272
277
|
- Module formats: ESM and CommonJS, with type declarations for both, from `dist/`.
|
|
273
278
|
- `./react` starts with `"use client"` in both builds; the core entry does not, so server code can
|
|
274
279
|
import it.
|
package/dist/index.cjs
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _chunkBOGMJ4Z4cjs = require('./chunk-BOGMJ4Z4.cjs');
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
@@ -61,4 +61,4 @@ var _chunkJB5OMGDZcjs = require('./chunk-JB5OMGDZ.cjs');
|
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
exports.CONSENT_COOKIE_NAME =
|
|
64
|
+
exports.CONSENT_COOKIE_NAME = _chunkBOGMJ4Z4cjs.CONSENT_COOKIE_NAME; exports.CONSENT_STORAGE_KEY = _chunkBOGMJ4Z4cjs.CONSENT_STORAGE_KEY; exports.CONSENT_VERSION = _chunkBOGMJ4Z4cjs.CONSENT_VERSION; exports.DEFAULT_MAX_QUEUED_EVENTS = _chunkBOGMJ4Z4cjs.DEFAULT_MAX_QUEUED_EVENTS; exports.clearConsent = _chunkBOGMJ4Z4cjs.clearConsent; exports.createAcceptAllConsent = _chunkBOGMJ4Z4cjs.createAcceptAllConsent; exports.createDeclineAnalyticsConsent = _chunkBOGMJ4Z4cjs.createDeclineAnalyticsConsent; exports.disableAnalytics = _chunkBOGMJ4Z4cjs.disableAnalytics; exports.enableAnalytics = _chunkBOGMJ4Z4cjs.enableAnalytics; exports.getAnalyticsState = _chunkBOGMJ4Z4cjs.getAnalyticsState; exports.getConsentFromCookie = _chunkBOGMJ4Z4cjs.getConsentFromCookie; exports.identify = _chunkBOGMJ4Z4cjs.identify; exports.initAnalytics = _chunkBOGMJ4Z4cjs.initAnalytics; exports.isAnalyticsEnabled = _chunkBOGMJ4Z4cjs.isAnalyticsEnabled; exports.isDoNotTrackEnabled = _chunkBOGMJ4Z4cjs.isDoNotTrackEnabled; exports.isStorageAvailable = _chunkBOGMJ4Z4cjs.isStorageAvailable; exports.isValidConsentState = _chunkBOGMJ4Z4cjs.isValidConsentState; exports.loadConsent = _chunkBOGMJ4Z4cjs.loadConsent; exports.needsRePrompt = _chunkBOGMJ4Z4cjs.needsRePrompt; exports.resetAnalytics = _chunkBOGMJ4Z4cjs.resetAnalytics; exports.saveConsent = _chunkBOGMJ4Z4cjs.saveConsent; exports.track = _chunkBOGMJ4Z4cjs.track; exports.trackPage = _chunkBOGMJ4Z4cjs.trackPage; exports.trackSectionComplete = _chunkBOGMJ4Z4cjs.trackSectionComplete; exports.trackSectionView = _chunkBOGMJ4Z4cjs.trackSectionView; exports.trackTimeSpent = _chunkBOGMJ4Z4cjs.trackTimeSpent; exports.trackTutorialComplete = _chunkBOGMJ4Z4cjs.trackTutorialComplete; exports.trackTutorialNavigation = _chunkBOGMJ4Z4cjs.trackTutorialNavigation; exports.trackTutorialStart = _chunkBOGMJ4Z4cjs.trackTutorialStart; exports.updateConsentCategory = _chunkBOGMJ4Z4cjs.updateConsentCategory;
|
package/dist/index.d.cts
CHANGED
|
@@ -16,7 +16,9 @@ declare function isValidConsentState(value: unknown): value is ConsentState;
|
|
|
16
16
|
*/
|
|
17
17
|
declare function isStorageAvailable(): boolean;
|
|
18
18
|
/**
|
|
19
|
-
* Load consent state from localStorage
|
|
19
|
+
* Load consent state from localStorage.
|
|
20
|
+
* Reads directly (no write probe), so a stored choice is still found when the
|
|
21
|
+
* storage quota is full.
|
|
20
22
|
*/
|
|
21
23
|
declare function loadConsent(): ConsentState | null;
|
|
22
24
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,9 @@ declare function isValidConsentState(value: unknown): value is ConsentState;
|
|
|
16
16
|
*/
|
|
17
17
|
declare function isStorageAvailable(): boolean;
|
|
18
18
|
/**
|
|
19
|
-
* Load consent state from localStorage
|
|
19
|
+
* Load consent state from localStorage.
|
|
20
|
+
* Reads directly (no write probe), so a stored choice is still found when the
|
|
21
|
+
* storage quota is full.
|
|
20
22
|
*/
|
|
21
23
|
declare function loadConsent(): ConsentState | null;
|
|
22
24
|
/**
|
package/dist/index.js
CHANGED
package/dist/react.cjs
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkBOGMJ4Z4cjs = require('./chunk-BOGMJ4Z4.cjs');
|
|
16
16
|
|
|
17
17
|
// src/react.tsx
|
|
18
18
|
|
|
@@ -28,14 +28,14 @@ var AnalyticsContext = _react.createContext.call(void 0, null);
|
|
|
28
28
|
function AnalyticsProvider({
|
|
29
29
|
children,
|
|
30
30
|
config,
|
|
31
|
-
consentVersion =
|
|
31
|
+
consentVersion = _chunkBOGMJ4Z4cjs.CONSENT_VERSION
|
|
32
32
|
}) {
|
|
33
33
|
const [consent, setConsent] = _react.useState.call(void 0, () => {
|
|
34
|
-
|
|
35
|
-
const stored =
|
|
34
|
+
_chunkBOGMJ4Z4cjs.setMaxQueuedEvents.call(void 0, config.maxQueuedEvents);
|
|
35
|
+
const stored = _chunkBOGMJ4Z4cjs.loadConsent.call(void 0, );
|
|
36
36
|
if (!stored) return null;
|
|
37
|
-
if (
|
|
38
|
-
|
|
37
|
+
if (_chunkBOGMJ4Z4cjs.needsRePrompt.call(void 0, stored, consentVersion)) {
|
|
38
|
+
_chunkBOGMJ4Z4cjs.clearConsent.call(void 0, );
|
|
39
39
|
return null;
|
|
40
40
|
}
|
|
41
41
|
return stored;
|
|
@@ -44,49 +44,49 @@ function AnalyticsProvider({
|
|
|
44
44
|
_react.useEffect.call(void 0, () => {
|
|
45
45
|
if (!consent) return;
|
|
46
46
|
if (consent.analytics) {
|
|
47
|
-
|
|
47
|
+
_chunkBOGMJ4Z4cjs.initAnalytics.call(void 0, config);
|
|
48
48
|
} else {
|
|
49
|
-
|
|
49
|
+
_chunkBOGMJ4Z4cjs.disableAnalytics.call(void 0, );
|
|
50
50
|
}
|
|
51
51
|
}, [consent, config]);
|
|
52
52
|
const acceptAll = _react.useCallback.call(void 0, () => {
|
|
53
|
-
const newConsent = { ...
|
|
54
|
-
|
|
53
|
+
const newConsent = { ..._chunkBOGMJ4Z4cjs.createAcceptAllConsent.call(void 0, ), version: consentVersion };
|
|
54
|
+
_chunkBOGMJ4Z4cjs.saveConsent.call(void 0, newConsent);
|
|
55
55
|
setConsent(newConsent);
|
|
56
56
|
setHasResponded(true);
|
|
57
|
-
|
|
57
|
+
_chunkBOGMJ4Z4cjs.enableAnalytics.call(void 0, config);
|
|
58
58
|
}, [config, consentVersion]);
|
|
59
59
|
const declineAnalytics = _react.useCallback.call(void 0, () => {
|
|
60
60
|
const newConsent = {
|
|
61
|
-
...
|
|
61
|
+
..._chunkBOGMJ4Z4cjs.createDeclineAnalyticsConsent.call(void 0, ),
|
|
62
62
|
version: consentVersion
|
|
63
63
|
};
|
|
64
|
-
|
|
64
|
+
_chunkBOGMJ4Z4cjs.saveConsent.call(void 0, newConsent);
|
|
65
65
|
setConsent(newConsent);
|
|
66
66
|
setHasResponded(true);
|
|
67
|
-
|
|
67
|
+
_chunkBOGMJ4Z4cjs.disableAnalytics.call(void 0, );
|
|
68
68
|
}, [consentVersion]);
|
|
69
69
|
const updateConsentHandler = _react.useCallback.call(void 0,
|
|
70
70
|
(category, value2) => {
|
|
71
71
|
if (!consent) return;
|
|
72
|
-
const newConsent =
|
|
73
|
-
|
|
72
|
+
const newConsent = _chunkBOGMJ4Z4cjs.updateConsentCategory.call(void 0, consent, category, value2);
|
|
73
|
+
_chunkBOGMJ4Z4cjs.saveConsent.call(void 0, newConsent);
|
|
74
74
|
setConsent(newConsent);
|
|
75
75
|
if (category === "analytics") {
|
|
76
76
|
if (value2) {
|
|
77
|
-
|
|
77
|
+
_chunkBOGMJ4Z4cjs.enableAnalytics.call(void 0, config);
|
|
78
78
|
} else {
|
|
79
|
-
|
|
79
|
+
_chunkBOGMJ4Z4cjs.disableAnalytics.call(void 0, );
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
[consent, config]
|
|
84
84
|
);
|
|
85
85
|
const resetConsentHandler = _react.useCallback.call(void 0, () => {
|
|
86
|
-
|
|
86
|
+
_chunkBOGMJ4Z4cjs.clearConsent.call(void 0, );
|
|
87
87
|
setConsent(null);
|
|
88
88
|
setHasResponded(false);
|
|
89
|
-
|
|
89
|
+
_chunkBOGMJ4Z4cjs.disableAnalytics.call(void 0, );
|
|
90
90
|
}, []);
|
|
91
91
|
const value = _react.useMemo.call(void 0,
|
|
92
92
|
() => ({
|
|
@@ -119,43 +119,43 @@ function useAnalytics() {
|
|
|
119
119
|
return context;
|
|
120
120
|
}
|
|
121
121
|
function useConsent(options = {}) {
|
|
122
|
-
const { consentVersion =
|
|
122
|
+
const { consentVersion = _chunkBOGMJ4Z4cjs.CONSENT_VERSION } = options;
|
|
123
123
|
const [consent, setConsent] = _react.useState.call(void 0, () => {
|
|
124
|
-
const stored =
|
|
124
|
+
const stored = _chunkBOGMJ4Z4cjs.loadConsent.call(void 0, );
|
|
125
125
|
if (!stored) return null;
|
|
126
|
-
if (
|
|
127
|
-
|
|
126
|
+
if (_chunkBOGMJ4Z4cjs.needsRePrompt.call(void 0, stored, consentVersion)) {
|
|
127
|
+
_chunkBOGMJ4Z4cjs.clearConsent.call(void 0, );
|
|
128
128
|
return null;
|
|
129
129
|
}
|
|
130
130
|
return stored;
|
|
131
131
|
});
|
|
132
132
|
const [hasResponded, setHasResponded] = _react.useState.call(void 0, () => consent !== null);
|
|
133
133
|
const acceptAll = _react.useCallback.call(void 0, () => {
|
|
134
|
-
const newConsent = { ...
|
|
135
|
-
|
|
134
|
+
const newConsent = { ..._chunkBOGMJ4Z4cjs.createAcceptAllConsent.call(void 0, ), version: consentVersion };
|
|
135
|
+
_chunkBOGMJ4Z4cjs.saveConsent.call(void 0, newConsent);
|
|
136
136
|
setConsent(newConsent);
|
|
137
137
|
setHasResponded(true);
|
|
138
138
|
}, [consentVersion]);
|
|
139
139
|
const declineAnalytics = _react.useCallback.call(void 0, () => {
|
|
140
140
|
const newConsent = {
|
|
141
|
-
...
|
|
141
|
+
..._chunkBOGMJ4Z4cjs.createDeclineAnalyticsConsent.call(void 0, ),
|
|
142
142
|
version: consentVersion
|
|
143
143
|
};
|
|
144
|
-
|
|
144
|
+
_chunkBOGMJ4Z4cjs.saveConsent.call(void 0, newConsent);
|
|
145
145
|
setConsent(newConsent);
|
|
146
146
|
setHasResponded(true);
|
|
147
147
|
}, [consentVersion]);
|
|
148
148
|
const updateConsentHandler = _react.useCallback.call(void 0,
|
|
149
149
|
(category, value) => {
|
|
150
150
|
if (!consent) return;
|
|
151
|
-
const newConsent =
|
|
152
|
-
|
|
151
|
+
const newConsent = _chunkBOGMJ4Z4cjs.updateConsentCategory.call(void 0, consent, category, value);
|
|
152
|
+
_chunkBOGMJ4Z4cjs.saveConsent.call(void 0, newConsent);
|
|
153
153
|
setConsent(newConsent);
|
|
154
154
|
},
|
|
155
155
|
[consent]
|
|
156
156
|
);
|
|
157
157
|
const resetConsentHandler = _react.useCallback.call(void 0, () => {
|
|
158
|
-
|
|
158
|
+
_chunkBOGMJ4Z4cjs.clearConsent.call(void 0, );
|
|
159
159
|
setConsent(null);
|
|
160
160
|
setHasResponded(false);
|
|
161
161
|
}, []);
|
|
@@ -174,4 +174,4 @@ function useConsent(options = {}) {
|
|
|
174
174
|
|
|
175
175
|
|
|
176
176
|
|
|
177
|
-
exports.AnalyticsProvider = AnalyticsProvider; exports.initAnalytics =
|
|
177
|
+
exports.AnalyticsProvider = AnalyticsProvider; exports.initAnalytics = _chunkBOGMJ4Z4cjs.initAnalytics; exports.useAnalytics = useAnalytics; exports.useConsent = useConsent;
|
package/dist/react.js
CHANGED
package/docs/API.md
CHANGED
|
@@ -23,7 +23,8 @@ one analytics state, so `initAnalytics` from `./react` and `track` from `.` act
|
|
|
23
23
|
The ESM and CommonJS builds each have their own copy, so mixing `import` and `require` in one
|
|
24
24
|
process gives two instances.
|
|
25
25
|
|
|
26
|
-
Peer dependency: `react` `^18.0.0 || ^19.0.0` (used by `./react` only).
|
|
26
|
+
Peer dependency: `react` `^18.0.0 || ^19.0.0` (used by `./react` only). TypeScript users need
|
|
27
|
+
`@types/react` 18.2.6 or later: the `./react` declarations use `React.JSX.Element`.
|
|
27
28
|
|
|
28
29
|
All browser APIs are guarded, so importing on the server is safe. On the server `track`,
|
|
29
30
|
`trackPage`, `identify` and `resetAnalytics` return early, `loadConsent` returns `null`, and
|
|
@@ -217,7 +218,9 @@ Consent is stored as JSON in `localStorage` under `CONSENT_STORAGE_KEY` and mirr
|
|
|
217
218
|
|
|
218
219
|
Signature: `loadConsent(): ConsentState | null`
|
|
219
220
|
|
|
220
|
-
Reads and validates stored consent. `null` when none, invalid,
|
|
221
|
+
Reads and validates stored consent. `null` when none is stored, the value is invalid, there is no
|
|
222
|
+
`window`, or reading `localStorage` throws. It reads without a write probe, so a stored choice is
|
|
223
|
+
found even when the storage quota is full.
|
|
221
224
|
|
|
222
225
|
```ts
|
|
223
226
|
import { loadConsent } from "@vllnt/analytics";
|
|
@@ -230,8 +233,10 @@ console.log(consent?.analytics);
|
|
|
230
233
|
|
|
231
234
|
Signature: `saveConsent(state: ConsentState): void`
|
|
232
235
|
|
|
233
|
-
Writes consent to `localStorage` and the cookie. Does nothing
|
|
234
|
-
`
|
|
236
|
+
Writes consent to `localStorage` and the cookie. Does nothing, without a warning, when
|
|
237
|
+
`isStorageAvailable()` is `false`, which includes a completely full quota. Logs
|
|
238
|
+
`Failed to save consent:` with `console.warn` when that probe succeeds but writing the consent
|
|
239
|
+
value or the cookie throws.
|
|
235
240
|
|
|
236
241
|
```ts
|
|
237
242
|
import { createAcceptAllConsent, saveConsent } from "@vllnt/analytics";
|
|
@@ -339,7 +344,9 @@ console.log(showBanner);
|
|
|
339
344
|
|
|
340
345
|
Signature: `isStorageAvailable(): boolean`
|
|
341
346
|
|
|
342
|
-
`true` when
|
|
347
|
+
`true` when a test key can be written to and removed from `localStorage`. `false` on the server
|
|
348
|
+
or when that probe throws, for example when storage is blocked or the quota is full. `loadConsent`
|
|
349
|
+
does not depend on it, so a stored choice can still be read when it is `false`.
|
|
343
350
|
|
|
344
351
|
```ts
|
|
345
352
|
import { isStorageAvailable } from "@vllnt/analytics";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vllnt/analytics",
|
|
3
|
-
"version": "0.2.0-canary.
|
|
3
|
+
"version": "0.2.0-canary.2103207",
|
|
4
4
|
"description": "Cookie consent state and consent-gated event tracking for React and TypeScript, with Do Not Track and an SSR consent cookie.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@12.22.0",
|
|
@@ -85,7 +85,6 @@
|
|
|
85
85
|
"react": "^18.0.0 || ^19.0.0"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
|
-
"@testing-library/jest-dom": "^8.0.0",
|
|
89
88
|
"@testing-library/react": "^16.3.3",
|
|
90
89
|
"@types/node": "^24.19.2",
|
|
91
90
|
"@types/react": "^19.3.0",
|
package/src/consent.ts
CHANGED
|
@@ -42,10 +42,12 @@ export function isStorageAvailable(): boolean {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
* Load consent state from localStorage
|
|
45
|
+
* Load consent state from localStorage.
|
|
46
|
+
* Reads directly (no write probe), so a stored choice is still found when the
|
|
47
|
+
* storage quota is full.
|
|
46
48
|
*/
|
|
47
49
|
export function loadConsent(): ConsentState | null {
|
|
48
|
-
if (
|
|
50
|
+
if (typeof window === "undefined") return null;
|
|
49
51
|
|
|
50
52
|
try {
|
|
51
53
|
const raw = localStorage.getItem(CONSENT_STORAGE_KEY);
|