@sonordev/site-kit 8.10.0 → 8.12.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/CHANGELOG.md +8 -0
- package/agent-manifest.json +1 -1
- package/dist/{AddressAutocomplete-LQS6GQ4R.js → AddressAutocomplete-6DQ3IP5C.js} +1 -1
- package/dist/{AnalyticsProvider-JWS7BLFY.js → AnalyticsProvider-RC2RG4YW.js} +4 -4
- package/dist/{ArticleViewTracker-CDPVMUAO.js → ArticleViewTracker-FNCRH3SB.js} +1 -1
- package/dist/{BlocksPopup-C5PNJ7U6.js → BlocksPopup-AJCDT5WM.js} +3 -3
- package/dist/{ChatWidget-HEPOE3YC.js → ChatWidget-CM5OGMJQ.js} +5 -5
- package/dist/{FileField-6R5LS5NU.js → FileField-QWS5ASLB.js} +1 -1
- package/dist/{FormSpotlight-2BSE7PD2.js → FormSpotlight-7Y6B2YZM.js} +1 -1
- package/dist/{FormStage-3G46OPPO.js → FormStage-T3N27SID.js} +1 -1
- package/dist/{ManagedForm-LTXEU25N.js → ManagedForm-WUULZELM.js} +6 -6
- package/dist/{ManagedNewsletterForm-WE6P5DMV.js → ManagedNewsletterForm-GGA3JOOI.js} +8 -8
- package/dist/{SignalCore-IP7FE6SN.js → SignalCore-ZMKDW44U.js} +3 -3
- package/dist/{SiteChat-3FQYMHCP.js → SiteChat-PM4RIZR4.js} +1 -1
- package/dist/{SiteDesignReporter-HGTX4FX2.js → SiteDesignReporter-SALYTWV2.js} +4 -4
- package/dist/{SitePopups-V7MCNSGE.js → SitePopups-VDSDWZHD.js} +4 -4
- package/dist/{SitemapSync-OAJ7SIET.js → SitemapSync-6UDJHS2F.js} +2 -2
- package/dist/_client/booking-widget.js +3 -3
- package/dist/_client/reviewed-signal-experiment.js +1 -1
- package/dist/affiliates/index.js +1 -1
- package/dist/analytics/index.js +4 -4
- package/dist/api-4AAR6BZO.js +5 -0
- package/dist/articles/index.js +1 -1
- package/dist/articles/server-ui.js +3 -3
- package/dist/articles/server.js +2 -2
- package/dist/chat/index.js +6 -6
- package/dist/{chunk-YJ6PRJ7Y.js → chunk-27264MSX.js} +2 -2
- package/dist/{chunk-D4R3FQED.js → chunk-2MJYGVKB.js} +1 -1
- package/dist/{chunk-MKU5ZORB.js → chunk-2QAG7ALW.js} +1 -1
- package/dist/{chunk-NH7K252M.js → chunk-5UAX6PHO.js} +1 -1
- package/dist/{chunk-NBNDH2J6.js → chunk-675DTMSR.js} +1 -1
- package/dist/{chunk-RMPXSEEU.js → chunk-7PW7N7P4.js} +1 -1
- package/dist/{chunk-TLKLHSRJ.js → chunk-C55LIDVW.js} +1 -1
- package/dist/{chunk-NWEIHCSE.js → chunk-CNCAQEUJ.js} +1 -1
- package/dist/{chunk-ACZ5JNSL.js → chunk-DFCLELM2.js} +2 -2
- package/dist/{chunk-HNVLINPI.js → chunk-DICLVB5P.js} +1 -1
- package/dist/{chunk-HLN7A4GL.js → chunk-DUIGCLQM.js} +1 -1
- package/dist/{chunk-Q2OE32TH.js → chunk-GHW37LVB.js} +2 -2
- package/dist/{chunk-727353NY.js → chunk-H4KPWR7P.js} +3 -3
- package/dist/{chunk-Z4XJOVQX.js → chunk-M2ZGSI6K.js} +1 -1
- package/dist/{chunk-J4R7MHV2.js → chunk-M34VOQ5J.js} +8 -8
- package/dist/{chunk-OCNODBH4.js → chunk-M3VJAE24.js} +1 -1
- package/dist/{chunk-P7S45DD7.js → chunk-NX4FETUK.js} +1 -1
- package/dist/{chunk-OEHIXCYS.js → chunk-O3CAXGY5.js} +2 -2
- package/dist/{chunk-RUV6DCKL.js → chunk-T2Z7KEIH.js} +1 -1
- package/dist/{chunk-DW5X4BC7.js → chunk-TPB5PTWW.js} +2 -2
- package/dist/{chunk-75N2WALV.js → chunk-TXB4ULAM.js} +1 -1
- package/dist/{chunk-6CIO4X6P.js → chunk-UFHEND2H.js} +1 -1
- package/dist/{chunk-7PWXPN53.js → chunk-UTVFF7VT.js} +1 -1
- package/dist/{chunk-MIKVCYGX.js → chunk-VF2X5T4H.js} +2 -2
- package/dist/{chunk-533ZSRJF.js → chunk-VZSIIKLR.js} +1 -1
- package/dist/{chunk-XAPSYDVT.js → chunk-WX4XX3BZ.js} +1 -1
- package/dist/{chunk-Y7DZ2ND2.js → chunk-Y4MQTSYY.js} +3 -3
- package/dist/{chunk-3RBOES2C.js → chunk-YOPBFEDG.js} +1 -1
- package/dist/{chunk-UMF5OILQ.js → chunk-YPTUKSF7.js} +1 -1
- package/dist/{chunk-Z62W7Q3T.js → chunk-YYV3YHUX.js} +1 -1
- package/dist/{chunk-A66TIJWU.js → chunk-Z42KXUTK.js} +1 -1
- package/dist/contracts/entries.d.ts +1 -1
- package/dist/contracts/property-interest.d.ts +100 -0
- package/dist/contracts/resonance.d.ts +1705 -358
- package/dist/contracts/sales-call-prep.d.ts +666 -0
- package/dist/contracts/signal-experiments.d.ts +0 -1
- package/dist/contracts/wire-uuid.d.ts +5 -0
- package/dist/{controls-KLG6VQLO.js → controls-GLVRT5EM.js} +2 -2
- package/dist/fleet/index.js +3 -3
- package/dist/forms/index.js +8 -8
- package/dist/forms/server.js +2 -2
- package/dist/images/index.js +2 -2
- package/dist/index.js +1 -1
- package/dist/landing/server.js +5 -5
- package/dist/layout/client.js +6 -6
- package/dist/layout/index.js +7 -7
- package/dist/llms/index.js +4 -4
- package/dist/maps/index.js +3 -3
- package/dist/mcp/sonor.js +5 -5
- package/dist/resonance/ConsentPreferences.d.ts +12 -0
- package/dist/resonance/consent-adapter.d.ts +3 -0
- package/dist/resonance/consent-preferences-styles.d.ts +2 -0
- package/dist/resonance/first-party-consent.d.ts +22 -0
- package/dist/resonance/index.d.ts +1 -0
- package/dist/resonance/index.js +366 -2
- package/dist/revalidate/index.js +2 -2
- package/dist/runtime/index.js +1 -1
- package/dist/{runtime-core-EU2RZMOL.js → runtime-core-4WL4V4QE.js} +523 -7
- package/dist/seo/client.js +2 -2
- package/dist/seo/index.js +2 -2
- package/dist/seo/llms.js +4 -4
- package/dist/seo/register-sitemap-cli.js +1 -1
- package/dist/seo/sitemap.js +2 -2
- package/dist/server/index.js +2 -2
- package/dist/shared/version.d.ts +1 -1
- package/dist/signal/index.js +2 -2
- package/dist/sitemap/index.js +2 -2
- package/dist/{sonor-fetch-runtime-SLPBNZY4.js → sonor-fetch-runtime-QO4DR7GR.js} +2 -2
- package/dist/sync/index.js +3 -3
- package/dist/website/images.js +2 -2
- package/dist/website/index.js +4 -4
- package/dist/website/landing/server.js +5 -5
- package/dist/website/popups.js +4 -4
- package/dist/{writeLLMsTxt-2CBYGKZO.js → writeLLMsTxt-EKWOSHXU.js} +1 -1
- package/package.json +1 -1
- package/src/resonance/README.md +49 -0
- package/dist/api-X6N6V2H3.js +0 -5
- /package/dist/{chunk-ORSQKTMN.js → chunk-2YSX4ZUC.js} +0 -0
package/dist/resonance/index.js
CHANGED
|
@@ -1,9 +1,373 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { getConsentAdapter, registerResonanceConsentAdapter } from '../chunk-WYNDBJG7.js';
|
|
2
3
|
export { getResonanceMeasurementStatus, recordResonanceExposure, registerResonanceConsentAdapter } from '../chunk-WYNDBJG7.js';
|
|
3
|
-
export { ResonanceRuntime } from '../chunk-
|
|
4
|
+
export { ResonanceRuntime } from '../chunk-YOPBFEDG.js';
|
|
4
5
|
import '../chunk-MDBXGN6W.js';
|
|
5
6
|
import '../chunk-YC7ELZS3.js';
|
|
6
7
|
import '../chunk-KMNHNCVG.js';
|
|
7
8
|
import '../chunk-MOACHHOJ.js';
|
|
8
|
-
import '../chunk-FRY6PBT6.js';
|
|
9
|
+
import { MEASUREMENT_PURPOSES, unknownChoices } from '../chunk-FRY6PBT6.js';
|
|
9
10
|
import '../chunk-PKBMQBKP.js';
|
|
11
|
+
import { useState, useSyncExternalStore, useRef, useId, useEffect } from 'react';
|
|
12
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
13
|
+
|
|
14
|
+
// src/resonance/first-party-consent.ts
|
|
15
|
+
var storageKey = "sonor:privacy-preference:v1";
|
|
16
|
+
var dayMs = 864e5;
|
|
17
|
+
var initial = { contextReady: false, hasPreference: false, analytics: false, advertising: false };
|
|
18
|
+
function createFirstPartyConsentAdapter(options = {}) {
|
|
19
|
+
const days = options.maxAgeDays ?? 180;
|
|
20
|
+
if (!Number.isInteger(days) || days < 1 || days > 180) throw new Error("Consent preference lifetime must be 1\u2013180 days");
|
|
21
|
+
const now = options.now ?? Date.now;
|
|
22
|
+
let context;
|
|
23
|
+
let preference = null;
|
|
24
|
+
let snapshot = initial;
|
|
25
|
+
let timer;
|
|
26
|
+
const viewListeners = /* @__PURE__ */ new Set();
|
|
27
|
+
const adapterListeners = /* @__PURE__ */ new Set();
|
|
28
|
+
function storage() {
|
|
29
|
+
if (options.storage !== void 0) return options.storage;
|
|
30
|
+
try {
|
|
31
|
+
return typeof window === "undefined" ? null : window.localStorage;
|
|
32
|
+
} catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function scope() {
|
|
37
|
+
if (!context?.configEnabled || !context.projectId || !context.configRevision || !context.policyRevision || !context.configExpiresAt || Date.parse(context.configExpiresAt) <= now() || !Number.isFinite(Date.parse(context.configExpiresAt))) return null;
|
|
38
|
+
return JSON.stringify([context.projectId, context.site, context.configRevision, context.policyRevision]);
|
|
39
|
+
}
|
|
40
|
+
function current() {
|
|
41
|
+
return preference && preference.scope === scope() && Date.parse(preference.expiresAt) > now() ? preference : null;
|
|
42
|
+
}
|
|
43
|
+
function publish() {
|
|
44
|
+
const selected = current();
|
|
45
|
+
const next = {
|
|
46
|
+
contextReady: scope() !== null,
|
|
47
|
+
hasPreference: selected !== null,
|
|
48
|
+
analytics: selected?.choices.analytics_storage === "granted",
|
|
49
|
+
advertising: !!selected && ["ad_storage", "ad_user_data", "ad_personalization"].every((p) => selected.choices[p] === "granted")
|
|
50
|
+
};
|
|
51
|
+
if (Object.keys(next).some((key) => next[key] !== snapshot[key])) {
|
|
52
|
+
snapshot = next;
|
|
53
|
+
for (const listener of viewListeners) listener();
|
|
54
|
+
}
|
|
55
|
+
clearTimeout(timer);
|
|
56
|
+
const deadlines = [context?.configExpiresAt, selected?.expiresAt].map((value) => Date.parse(value ?? "")).filter(Number.isFinite);
|
|
57
|
+
const expiry = Math.min(...deadlines);
|
|
58
|
+
if (Number.isFinite(expiry) && expiry > now()) {
|
|
59
|
+
timer = setTimeout(() => {
|
|
60
|
+
publish();
|
|
61
|
+
for (const listener of adapterListeners) listener();
|
|
62
|
+
}, Math.min(expiry - now(), 2147483647));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function load() {
|
|
66
|
+
try {
|
|
67
|
+
const raw = storage()?.getItem(storageKey);
|
|
68
|
+
if (!raw || raw.length > 2e3) {
|
|
69
|
+
preference = null;
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const value = JSON.parse(raw);
|
|
73
|
+
if (!value || Object.keys(value).sort().join(",") !== "choices,expiresAt,observedAt,scope,version" || value.version !== 1 || typeof value.scope !== "string" || !value.choices || Object.keys(value.choices).sort().join(",") !== [...MEASUREMENT_PURPOSES].sort().join(",") || !MEASUREMENT_PURPOSES.every((p) => ["granted", "denied", "withdrawn"].includes(value.choices[p])) || !Number.isFinite(Date.parse(value.observedAt)) || !Number.isFinite(Date.parse(value.expiresAt)) || Date.parse(value.observedAt) > now() || Date.parse(value.expiresAt) <= Date.parse(value.observedAt) || Date.parse(value.expiresAt) - Date.parse(value.observedAt) > days * dayMs) {
|
|
74
|
+
preference = null;
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
preference = value;
|
|
78
|
+
} catch {
|
|
79
|
+
preference = null;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const adapter = {
|
|
83
|
+
requiredPurposes: MEASUREMENT_PURPOSES,
|
|
84
|
+
read(next) {
|
|
85
|
+
context = next;
|
|
86
|
+
if (!preference) load();
|
|
87
|
+
publish();
|
|
88
|
+
const selected = current();
|
|
89
|
+
return {
|
|
90
|
+
valid: selected !== null,
|
|
91
|
+
choices: selected ? { ...selected.choices } : unknownChoices(),
|
|
92
|
+
observedAt: selected?.observedAt ?? new Date(now()).toISOString(),
|
|
93
|
+
source: "user_preference"
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
subscribe(listener) {
|
|
97
|
+
adapterListeners.add(listener);
|
|
98
|
+
return () => {
|
|
99
|
+
adapterListeners.delete(listener);
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
return {
|
|
104
|
+
adapter,
|
|
105
|
+
getSnapshot: () => snapshot,
|
|
106
|
+
getServerSnapshot: () => initial,
|
|
107
|
+
subscribe(listener) {
|
|
108
|
+
viewListeners.add(listener);
|
|
109
|
+
return () => {
|
|
110
|
+
viewListeners.delete(listener);
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
save(analytics, advertising) {
|
|
114
|
+
const actualScope = scope();
|
|
115
|
+
if (!actualScope) return false;
|
|
116
|
+
const before = current()?.choices;
|
|
117
|
+
const choices = Object.fromEntries(MEASUREMENT_PURPOSES.map((purpose) => {
|
|
118
|
+
const granted = purpose === "analytics_storage" ? analytics : advertising;
|
|
119
|
+
return [purpose, granted ? "granted" : before?.[purpose] === "granted" ? "withdrawn" : "denied"];
|
|
120
|
+
}));
|
|
121
|
+
preference = {
|
|
122
|
+
version: 1,
|
|
123
|
+
scope: actualScope,
|
|
124
|
+
observedAt: new Date(now()).toISOString(),
|
|
125
|
+
expiresAt: new Date(now() + days * dayMs).toISOString(),
|
|
126
|
+
choices
|
|
127
|
+
};
|
|
128
|
+
try {
|
|
129
|
+
storage()?.setItem(storageKey, JSON.stringify(preference));
|
|
130
|
+
} catch {
|
|
131
|
+
}
|
|
132
|
+
publish();
|
|
133
|
+
for (const listener of adapterListeners) listener();
|
|
134
|
+
return true;
|
|
135
|
+
},
|
|
136
|
+
connect() {
|
|
137
|
+
const onStorage = (event) => {
|
|
138
|
+
if (event.key !== storageKey && event.key !== null) return;
|
|
139
|
+
load();
|
|
140
|
+
publish();
|
|
141
|
+
for (const listener of adapterListeners) listener();
|
|
142
|
+
};
|
|
143
|
+
if (typeof window !== "undefined") window.addEventListener("storage", onStorage);
|
|
144
|
+
return () => {
|
|
145
|
+
clearTimeout(timer);
|
|
146
|
+
if (typeof window !== "undefined") window.removeEventListener("storage", onStorage);
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// src/resonance/consent-preferences-styles.ts
|
|
153
|
+
var consentPreferencesStyles = `
|
|
154
|
+
.sk-consent { display: contents; }
|
|
155
|
+
.sk-consent button, .sk-consent input { font: inherit; }
|
|
156
|
+
.sk-consent button { min-height: 44px; cursor: pointer; }
|
|
157
|
+
.sk-consent button:disabled, .sk-consent fieldset:disabled { opacity: .55; }
|
|
158
|
+
.sk-consent button:disabled { cursor: default; }
|
|
159
|
+
.sk-consent :is(button, input, a):focus-visible {
|
|
160
|
+
outline: 2px solid var(--sk-consent-focus, #225588); outline-offset: 3px;
|
|
161
|
+
}
|
|
162
|
+
.sk-consent__launcher--floating {
|
|
163
|
+
position: fixed; bottom: max(12px, env(safe-area-inset-bottom)); left: 12px; z-index: 1000;
|
|
164
|
+
border: 1px solid var(--sk-consent-border, currentColor); border-radius: var(--sk-consent-radius, 6px);
|
|
165
|
+
padding: 10px 14px; background: var(--sk-consent-surface, #fff); color: var(--sk-consent-foreground, #222);
|
|
166
|
+
}
|
|
167
|
+
.sk-consent__launcher--inline {
|
|
168
|
+
display: inline-flex; align-items: center; border: 0; padding: 0; background: transparent;
|
|
169
|
+
color: inherit; text-decoration: underline; text-underline-offset: .2em;
|
|
170
|
+
}
|
|
171
|
+
.sk-consent__prompt, .sk-consent__dialog {
|
|
172
|
+
box-sizing: border-box; padding: 24px; border: 1px solid var(--sk-consent-border, #777);
|
|
173
|
+
border-radius: var(--sk-consent-radius, 10px); background: var(--sk-consent-surface, #fff);
|
|
174
|
+
color: var(--sk-consent-foreground, #222); font: var(--sk-consent-font, 16px/1.5 system-ui, sans-serif);
|
|
175
|
+
}
|
|
176
|
+
.sk-consent__dialog {
|
|
177
|
+
max-width: 460px; width: calc(100% - 32px); max-height: calc(100dvh - 32px);
|
|
178
|
+
overflow-y: auto; margin: auto;
|
|
179
|
+
}
|
|
180
|
+
.sk-consent__prompt {
|
|
181
|
+
position: fixed; z-index: 1000; width: min(420px, calc(100% - 32px));
|
|
182
|
+
left: var(--sk-consent-prompt-inset, 16px);
|
|
183
|
+
bottom: var(--sk-consent-prompt-bottom, max(16px, env(safe-area-inset-bottom)));
|
|
184
|
+
max-height: calc(100dvh - var(--sk-consent-prompt-bottom, 16px) - 16px);
|
|
185
|
+
overflow-y: auto;
|
|
186
|
+
}
|
|
187
|
+
.sk-consent__heading { color: var(--sk-consent-accent, inherit); font-size: 22px; line-height: 1.25; margin: 0 0 12px; }
|
|
188
|
+
.sk-consent__prompt .sk-consent__heading { font-size: 20px; padding-right: 32px; }
|
|
189
|
+
.sk-consent__prompt p, .sk-consent__dialog p { margin: 12px 0; }
|
|
190
|
+
.sk-consent__description, .sk-consent small { color: var(--sk-consent-muted, inherit); }
|
|
191
|
+
.sk-consent__fields { border: 0; margin: 16px 0; padding: 0; }
|
|
192
|
+
.sk-consent__fields legend { font-weight: 600; }
|
|
193
|
+
.sk-consent__setting { display: flex; align-items: start; gap: 10px; padding: 12px 0; min-height: 44px; box-sizing: border-box; }
|
|
194
|
+
.sk-consent__setting input { flex: 0 0 auto; margin-top: 5px; }
|
|
195
|
+
.sk-consent__actions { display: flex; flex-wrap: wrap; gap: 10px; }
|
|
196
|
+
.sk-consent__actions button, .sk-consent__dismiss {
|
|
197
|
+
border: 1px solid var(--sk-consent-border, currentColor); border-radius: var(--sk-consent-radius, 6px);
|
|
198
|
+
padding: 10px 14px; color: inherit; background: transparent;
|
|
199
|
+
}
|
|
200
|
+
.sk-consent__prompt .sk-consent__actions { display: grid; grid-template-columns: 1fr 1fr; }
|
|
201
|
+
.sk-consent__customize { grid-column: 1 / -1; }
|
|
202
|
+
.sk-consent__dismiss { position: absolute; right: 8px; top: 8px; width: 44px; padding: 8px; }
|
|
203
|
+
.sk-consent__policy { display: inline-block; color: inherit; margin-top: 16px; text-underline-offset: .2em; }
|
|
204
|
+
.sk-consent__status:empty { display: none; }
|
|
205
|
+
.sk-consent__status { font: inherit; }
|
|
206
|
+
`;
|
|
207
|
+
function ResonanceConsentPreferences({
|
|
208
|
+
privacyUrl = "/privacy",
|
|
209
|
+
maxAgeDays = 180,
|
|
210
|
+
launcherPlacement = "floating",
|
|
211
|
+
launcherLabel = "Privacy choices",
|
|
212
|
+
promptMode = "dialog",
|
|
213
|
+
className = ""
|
|
214
|
+
}) {
|
|
215
|
+
const [owner] = useState(() => createFirstPartyConsentAdapter({ maxAgeDays }));
|
|
216
|
+
const status = useSyncExternalStore(owner.subscribe, owner.getSnapshot, owner.getServerSnapshot);
|
|
217
|
+
const [active, setActive] = useState(false);
|
|
218
|
+
const [open, setOpen] = useState(false);
|
|
219
|
+
const [dismissed, setDismissed] = useState(false);
|
|
220
|
+
const [analytics, setAnalytics] = useState(false);
|
|
221
|
+
const [advertising, setAdvertising] = useState(false);
|
|
222
|
+
const [notice, setNotice] = useState("");
|
|
223
|
+
const dialog = useRef(null);
|
|
224
|
+
const launcher = useRef(null);
|
|
225
|
+
const prompt = useRef(null);
|
|
226
|
+
const invoker = useRef(null);
|
|
227
|
+
const titleId = useId();
|
|
228
|
+
const descriptionId = useId();
|
|
229
|
+
const promptTitleId = useId();
|
|
230
|
+
useEffect(() => {
|
|
231
|
+
if (getConsentAdapter()) return;
|
|
232
|
+
const unregister = registerResonanceConsentAdapter(owner.adapter);
|
|
233
|
+
const disconnect = owner.connect();
|
|
234
|
+
setActive(true);
|
|
235
|
+
return () => {
|
|
236
|
+
disconnect();
|
|
237
|
+
unregister();
|
|
238
|
+
};
|
|
239
|
+
}, [owner]);
|
|
240
|
+
useEffect(() => {
|
|
241
|
+
if (status.hasPreference) setDismissed(false);
|
|
242
|
+
if (promptMode === "dialog" && status.contextReady && !status.hasPreference && !dialog.current?.open) {
|
|
243
|
+
invoker.current = launcher.current;
|
|
244
|
+
setAnalytics(status.analytics);
|
|
245
|
+
setAdvertising(status.advertising);
|
|
246
|
+
setOpen(true);
|
|
247
|
+
}
|
|
248
|
+
}, [promptMode, status.contextReady, status.hasPreference, status.analytics, status.advertising]);
|
|
249
|
+
useEffect(() => {
|
|
250
|
+
const element = dialog.current;
|
|
251
|
+
if (!element || !active) return;
|
|
252
|
+
if (open && !element.open) element.showModal();
|
|
253
|
+
else if (!open && element.open) element.close();
|
|
254
|
+
}, [active, open]);
|
|
255
|
+
function restoreFocus() {
|
|
256
|
+
const target = invoker.current?.isConnected ? invoker.current : launcher.current;
|
|
257
|
+
if (target?.isConnected) target.focus({ preventScroll: true });
|
|
258
|
+
}
|
|
259
|
+
function close() {
|
|
260
|
+
dialog.current?.close();
|
|
261
|
+
setOpen(false);
|
|
262
|
+
restoreFocus();
|
|
263
|
+
}
|
|
264
|
+
function customize(source) {
|
|
265
|
+
invoker.current = source;
|
|
266
|
+
const current = owner.getSnapshot();
|
|
267
|
+
setAnalytics(current.analytics);
|
|
268
|
+
setAdvertising(current.advertising);
|
|
269
|
+
setNotice("");
|
|
270
|
+
setOpen(true);
|
|
271
|
+
}
|
|
272
|
+
function save(nextAnalytics, nextAdvertising) {
|
|
273
|
+
if (!owner.save(nextAnalytics, nextAdvertising)) {
|
|
274
|
+
setNotice("Settings changed. Review your choices and try again when settings are available.");
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
if (invoker.current && prompt.current?.contains(invoker.current)) invoker.current = launcher.current;
|
|
278
|
+
setNotice("Your choices are applied on this page.");
|
|
279
|
+
close();
|
|
280
|
+
}
|
|
281
|
+
function chooseFromPrompt(source, accepted) {
|
|
282
|
+
invoker.current = source;
|
|
283
|
+
save(accepted, accepted);
|
|
284
|
+
}
|
|
285
|
+
function dismissPrompt() {
|
|
286
|
+
setDismissed(true);
|
|
287
|
+
invoker.current = launcher.current;
|
|
288
|
+
restoreFocus();
|
|
289
|
+
}
|
|
290
|
+
if (!active) return null;
|
|
291
|
+
const showPrompt = promptMode === "panel" && status.contextReady && !status.hasPreference && !dismissed;
|
|
292
|
+
return /* @__PURE__ */ jsxs("div", { className: `sk-consent ${className}`, children: [
|
|
293
|
+
/* @__PURE__ */ jsx("style", { children: consentPreferencesStyles }),
|
|
294
|
+
/* @__PURE__ */ jsx(
|
|
295
|
+
"button",
|
|
296
|
+
{
|
|
297
|
+
ref: launcher,
|
|
298
|
+
type: "button",
|
|
299
|
+
onClick: (event) => customize(event.currentTarget),
|
|
300
|
+
"aria-haspopup": "dialog",
|
|
301
|
+
className: `sk-consent__launcher sk-consent__launcher--${launcherPlacement}`,
|
|
302
|
+
children: launcherLabel
|
|
303
|
+
}
|
|
304
|
+
),
|
|
305
|
+
showPrompt && /* @__PURE__ */ jsxs("section", { ref: prompt, className: "sk-consent__prompt", "aria-labelledby": promptTitleId, children: [
|
|
306
|
+
/* @__PURE__ */ jsx("h2", { id: promptTitleId, className: "sk-consent__heading", children: "Optional privacy settings" }),
|
|
307
|
+
/* @__PURE__ */ jsxs("p", { className: "sk-consent__description", children: [
|
|
308
|
+
"Choose whether to allow visit measurement and advertising. You can change your choices in ",
|
|
309
|
+
launcherLabel,
|
|
310
|
+
"."
|
|
311
|
+
] }),
|
|
312
|
+
/* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Dismiss privacy prompt", className: "sk-consent__dismiss", onClick: dismissPrompt, children: "\xD7" }),
|
|
313
|
+
/* @__PURE__ */ jsxs("div", { className: "sk-consent__actions", children: [
|
|
314
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: (event) => chooseFromPrompt(event.currentTarget, true), children: "Accept optional" }),
|
|
315
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: (event) => chooseFromPrompt(event.currentTarget, false), children: "Reject optional" }),
|
|
316
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "sk-consent__customize", onClick: (event) => customize(event.currentTarget), children: "Customize" })
|
|
317
|
+
] }),
|
|
318
|
+
/* @__PURE__ */ jsx("a", { className: "sk-consent__policy", href: privacyUrl, children: "Read our privacy policy" })
|
|
319
|
+
] }),
|
|
320
|
+
/* @__PURE__ */ jsxs(
|
|
321
|
+
"dialog",
|
|
322
|
+
{
|
|
323
|
+
ref: dialog,
|
|
324
|
+
className: "sk-consent__dialog",
|
|
325
|
+
"aria-labelledby": titleId,
|
|
326
|
+
"aria-describedby": descriptionId,
|
|
327
|
+
onCancel: (event) => {
|
|
328
|
+
event.preventDefault();
|
|
329
|
+
close();
|
|
330
|
+
},
|
|
331
|
+
onClose: (event) => {
|
|
332
|
+
if (event.currentTarget.open) return;
|
|
333
|
+
setOpen(false);
|
|
334
|
+
restoreFocus();
|
|
335
|
+
},
|
|
336
|
+
children: [
|
|
337
|
+
/* @__PURE__ */ jsx("h2", { id: titleId, className: "sk-consent__heading", children: "Your privacy choices" }),
|
|
338
|
+
/* @__PURE__ */ jsx("p", { id: descriptionId, className: "sk-consent__description", children: "Choose whether this site may measure visits and use advertising services. You can change your choices here at any time." }),
|
|
339
|
+
!status.contextReady && /* @__PURE__ */ jsx("p", { className: "sk-consent__status", role: "status", children: "Optional measurement settings are unavailable right now. Advertising stays off while settings load." }),
|
|
340
|
+
/* @__PURE__ */ jsxs("fieldset", { disabled: !status.contextReady, className: "sk-consent__fields", children: [
|
|
341
|
+
/* @__PURE__ */ jsx("legend", { children: "Optional purposes" }),
|
|
342
|
+
/* @__PURE__ */ jsxs("label", { className: "sk-consent__setting", children: [
|
|
343
|
+
/* @__PURE__ */ jsx("input", { type: "checkbox", checked: analytics, onChange: (event) => setAnalytics(event.target.checked) }),
|
|
344
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
345
|
+
"Visit measurement",
|
|
346
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
347
|
+
/* @__PURE__ */ jsx("small", { children: "Help this site understand page views and interactions." })
|
|
348
|
+
] })
|
|
349
|
+
] }),
|
|
350
|
+
/* @__PURE__ */ jsxs("label", { className: "sk-consent__setting", children: [
|
|
351
|
+
/* @__PURE__ */ jsx("input", { type: "checkbox", checked: advertising, onChange: (event) => setAdvertising(event.target.checked) }),
|
|
352
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
353
|
+
"Advertising",
|
|
354
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
355
|
+
/* @__PURE__ */ jsx("small", { children: "Allow advertising storage, matching and personalization for this site." })
|
|
356
|
+
] })
|
|
357
|
+
] })
|
|
358
|
+
] }),
|
|
359
|
+
/* @__PURE__ */ jsxs("div", { className: "sk-consent__actions", children: [
|
|
360
|
+
/* @__PURE__ */ jsx("button", { type: "button", disabled: !status.contextReady, onClick: () => save(analytics, advertising), children: promptMode === "panel" ? "Save preferences" : "Save choices" }),
|
|
361
|
+
/* @__PURE__ */ jsx("button", { type: "button", disabled: !status.contextReady, onClick: () => save(false, false), children: promptMode === "panel" ? "Reject optional" : "Decline optional" }),
|
|
362
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: close, children: "Close" })
|
|
363
|
+
] }),
|
|
364
|
+
/* @__PURE__ */ jsx("a", { className: "sk-consent__policy", href: privacyUrl, children: "Read our privacy policy" }),
|
|
365
|
+
notice && /* @__PURE__ */ jsx("p", { className: "sk-consent__status", role: "status", children: notice })
|
|
366
|
+
]
|
|
367
|
+
}
|
|
368
|
+
),
|
|
369
|
+
!open && notice && /* @__PURE__ */ jsx("span", { className: "sk-consent__status", role: "status", children: notice })
|
|
370
|
+
] });
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export { ResonanceConsentPreferences };
|
package/dist/revalidate/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createSeoRevalidationHandler } from '../chunk-
|
|
1
|
+
import { createSeoRevalidationHandler } from '../chunk-T2Z7KEIH.js';
|
|
2
2
|
import '../chunk-XTRZGXB2.js';
|
|
3
3
|
export { SITE_CACHE_TAGS, SITE_REVALIDATE_PATH, isSiteRevalidatePong } from '../chunk-HY7ZEU2C.js';
|
|
4
|
-
import '../chunk-
|
|
4
|
+
import '../chunk-2MJYGVKB.js';
|
|
5
5
|
import '../chunk-PKBMQBKP.js';
|
|
6
6
|
|
|
7
7
|
// src/revalidate/index.ts
|
package/dist/runtime/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../chunk-B7T2SFUF.js';
|
|
2
2
|
export { readAnalyticsIdentity } from '../chunk-PVY7X5UR.js';
|
|
3
3
|
import '../chunk-5IVD6G77.js';
|
|
4
|
-
export { sonorFetch } from '../chunk-
|
|
4
|
+
export { sonorFetch } from '../chunk-M2ZGSI6K.js';
|
|
5
5
|
export { DEFAULT_SONOR_API_URL, getClientApiConfig, readPublishedApiConfig } from '../chunk-W7OPEMGJ.js';
|
|
6
6
|
import '../chunk-FRY6PBT6.js';
|
|
7
7
|
import '../chunk-PKBMQBKP.js';
|