@wealthreach/site-kit 1.0.2 → 1.0.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.
@@ -79,10 +79,13 @@ var MODE_MAX_AGE = 60 * 60 * 24;
79
79
  var VISITOR_SCRIPT_ID = "wr-site-script";
80
80
  var GTM_SCRIPT_ID = "wr-gtm-script";
81
81
  var GA4_SCRIPT_ID = "wr-ga4-script";
82
+ function legacyConsentStorageKey(siteId) {
83
+ return `wr:consent:${siteId?.trim() || "site"}`;
84
+ }
82
85
 
83
86
  // src/consent/bootstrap.ts
84
87
  function safeJson(value) {
85
- return JSON.stringify(value).replace(/</g, "\\u003c");
88
+ return JSON.stringify(value).replace(/</g, "\\u003c").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
86
89
  }
87
90
  var GTM_ID_RE = /^GTM-[A-Z0-9]{4,16}$/;
88
91
  var GA4_ID_RE = /^G-[A-Z0-9]{4,16}$/;
@@ -116,6 +119,7 @@ function buildConsentBootstrapScript(options) {
116
119
  const ga4Id = sanitizeGa4Id(options.ga4MeasurementId);
117
120
  if (!visitorUrl && !gtmId && !ga4Id) return null;
118
121
  const legacy = options.legacyConsentCookies ?? [];
122
+ const legacyStorageCheck = options.siteId !== void 0 ? `if(!c){try{if(window.localStorage.getItem(${safeJson(legacyConsentStorageKey(options.siteId))})==='declined')c='analytics:no';}catch(e){}}` : "";
119
123
  const loaders = [];
120
124
  if (visitorUrl) {
121
125
  loaders.push(
@@ -132,7 +136,7 @@ function buildConsentBootstrapScript(options) {
132
136
  `if(!document.getElementById('${GA4_SCRIPT_ID}')){window.dataLayer=window.dataLayer||[];function gtag(){window.dataLayer.push(arguments);}window.gtag=window.gtag||gtag;gtag('js',new Date());gtag('config',${safeJson(ga4Id)});var a=document.createElement('script');a.id='${GA4_SCRIPT_ID}';a.async=true;a.src=${safeJson(`https://www.googletagmanager.com/gtag/js?id=${encodeURIComponent(ga4Id)}`)};a.setAttribute('data-consent-category','analytics');document.head.appendChild(a);}`
133
137
  );
134
138
  }
135
- return `(function(){try{var g=function(n){var p=document.cookie.split('; ').find(function(v){return v.indexOf(n+'=')===0});return p?decodeURIComponent(p.slice(n.length+1)):null};var c=g('${CONSENT_COOKIE}');if(!c){var leg=${safeJson(legacy)};for(var i=0;i<leg.length;i++){var lv=g(leg[i]);if(lv){c=lv.indexOf('analytics:yes')>-1?'analytics:yes':lv.indexOf('analytics:no')>-1?'analytics:no':null;if(c)break;}}}if(c==='analytics:no')return;var gpc=navigator.globalPrivacyControl===true;if(c!=='analytics:yes'&&!(g('${MODE_COOKIE}')==='opt-out'&&!gpc))return;${loaders.join("")}}catch(e){}})();`;
139
+ return `(function(){try{var g=function(n){var p=document.cookie.split('; ').find(function(v){return v.indexOf(n+'=')===0});return p?decodeURIComponent(p.slice(n.length+1)):null};var c=g('${CONSENT_COOKIE}');if(!c){var leg=${safeJson(legacy)};for(var i=0;i<leg.length;i++){var lv=g(leg[i]);if(lv){c=lv.indexOf('analytics:yes')>-1?'analytics:yes':lv.indexOf('analytics:no')>-1?'analytics:no':null;if(c)break;}}}${legacyStorageCheck}if(c==='analytics:no')return;var gpc=navigator.globalPrivacyControl===true;if(c!=='analytics:yes'&&!(g('${MODE_COOKIE}')==='opt-out'&&!gpc))return;${loaders.join("")}}catch(e){}})();`;
136
140
  }
137
141
 
138
142
  // src/a11y/site-shell.tsx
@@ -152,6 +156,7 @@ function SiteShell({
152
156
  children
153
157
  }) {
154
158
  const bootstrapScript = buildConsentBootstrapScript({
159
+ siteId: config.siteId,
155
160
  visitorScriptUrl: config.visitors?.enabled ? config.visitors.siteScriptUrl : void 0,
156
161
  gtmId: config.integrations?.gtmId,
157
162
  ga4MeasurementId: config.integrations?.ga4MeasurementId,
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { S as SiteConfig } from '../schema-DD0nDOD0.js';
2
+ import { S as SiteConfig } from '../schema-CYsBDpoU.js';
3
3
  import 'zod';
4
4
 
5
5
  interface SiteShellClientProps {
@@ -2,15 +2,15 @@
2
2
  "use client";
3
3
  import {
4
4
  ConsentBanner
5
- } from "../chunk-Y77ARZE4.js";
5
+ } from "../chunk-DHVKLLL7.js";
6
6
  import {
7
7
  PageTracker
8
- } from "../chunk-4YRCSRZZ.js";
9
- import "../chunk-QQP7VG2C.js";
8
+ } from "../chunk-SNTMH6M3.js";
9
+ import "../chunk-JPUCXNHR.js";
10
10
  import {
11
11
  ConsentGate,
12
12
  ConsentProvider
13
- } from "../chunk-7GDXQ6UB.js";
13
+ } from "../chunk-T4Q4VJ6K.js";
14
14
 
15
15
  // src/a11y/shell-client.tsx
16
16
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,5 +1,5 @@
1
- export { A as AttributionSnapshot, W as WebsiteVisitSnapshot, c as captureAttributionOnLanding, r as readAttributionSnapshot, a as readConsentedWebsiteVisit } from '../attribution-DQaAWtA5.js';
2
- import { S as SiteConfig } from '../schema-DD0nDOD0.js';
1
+ export { A as AttributionSnapshot, M as MAX_JOURNEY_SERIALIZED_BYTES, W as WebsiteVisitJourneyEntry, a as WebsiteVisitSnapshot, c as captureAttributionOnLanding, r as readAttributionSnapshot, b as readConsentedWebsiteVisit, s as sanitizeWebsiteJourney, d as sanitizeWebsiteVisit } from '../attribution-BajAl0tG.js';
2
+ import { S as SiteConfig } from '../schema-CYsBDpoU.js';
3
3
  import React__default from 'react';
4
4
  import 'zod';
5
5
 
@@ -1,21 +1,24 @@
1
1
  "use client";
2
2
  import {
3
3
  PageTracker
4
- } from "../chunk-4YRCSRZZ.js";
4
+ } from "../chunk-SNTMH6M3.js";
5
5
  import {
6
+ MAX_JOURNEY_SERIALIZED_BYTES,
6
7
  captureAttributionOnLanding,
7
8
  pushDataLayerEvent,
8
9
  readAttributionSnapshot,
9
10
  readConsentedWebsiteVisit,
11
+ sanitizeWebsiteJourney,
12
+ sanitizeWebsiteVisit,
10
13
  trackBookingCompleted,
11
14
  trackCtaClick,
12
15
  trackEvent,
13
16
  trackFormSubmission,
14
17
  trackPageView
15
- } from "../chunk-QQP7VG2C.js";
18
+ } from "../chunk-JPUCXNHR.js";
16
19
  import {
17
20
  useConsent
18
- } from "../chunk-7GDXQ6UB.js";
21
+ } from "../chunk-T4Q4VJ6K.js";
19
22
 
20
23
  // src/analytics/booking.tsx
21
24
  import { useEffect } from "react";
@@ -108,11 +111,14 @@ function BookingEmbed({
108
111
  }
109
112
  export {
110
113
  BookingEmbed,
114
+ MAX_JOURNEY_SERIALIZED_BYTES,
111
115
  PageTracker,
112
116
  captureAttributionOnLanding,
113
117
  pushDataLayerEvent,
114
118
  readAttributionSnapshot,
115
119
  readConsentedWebsiteVisit,
120
+ sanitizeWebsiteJourney,
121
+ sanitizeWebsiteVisit,
116
122
  trackBookingCompleted,
117
123
  trackCtaClick,
118
124
  trackEvent,
@@ -13,15 +13,18 @@ interface AttributionSnapshot {
13
13
  referrer_host?: string;
14
14
  captured_at?: string;
15
15
  }
16
+ interface WebsiteVisitJourneyEntry {
17
+ sessionId: string;
18
+ startedAt: string;
19
+ pages: string[];
20
+ referrer?: string | null;
21
+ activeMs?: number;
22
+ }
16
23
  interface WebsiteVisitSnapshot {
17
24
  visitorKey: string;
18
25
  sessionId: string;
19
26
  device: "desktop" | "mobile";
20
- journey?: {
21
- landingPath?: string;
22
- referrerHost?: string;
23
- pagesViewed?: string[];
24
- };
27
+ journey?: WebsiteVisitJourneyEntry[];
25
28
  }
26
29
  /**
27
30
  * Cookie-free first-touch attribution capture (stored in sessionStorage only).
@@ -31,11 +34,18 @@ interface WebsiteVisitSnapshot {
31
34
  */
32
35
  declare function captureAttributionOnLanding(): AttributionSnapshot;
33
36
  declare function readAttributionSnapshot(): AttributionSnapshot;
37
+ /** Cap serialized optional journey well below `/api/leads` 64 KiB body limit so history never blocks lead capture. */
38
+ declare const MAX_JOURNEY_SERIALIZED_BYTES = 16384;
39
+ declare function sanitizeWebsiteJourney(raw: unknown): WebsiteVisitJourneyEntry[] | undefined;
40
+ declare function sanitizeWebsiteVisit(raw: unknown): WebsiteVisitSnapshot | undefined;
34
41
  /**
35
42
  * Reads optional first-party website visitor identity ONLY when caller has
36
43
  * already verified BrandywineOak consent (`allowed === true`).
44
+ * Supports the served visitor script's `window.__wrVisitor.getVisitContext()`
45
+ * bridge as well as direct fallback to the script's persisted `wr_vid`,
46
+ * `wr:visitors:session:<siteId>`, and `wr:journey:<siteId>` records.
37
47
  */
38
48
  declare function readConsentedWebsiteVisit(siteId: string, consentAllowed: boolean): WebsiteVisitSnapshot | undefined;
39
49
 
40
- export { readConsentedWebsiteVisit as a, captureAttributionOnLanding as c, readAttributionSnapshot as r };
41
- export type { AttributionSnapshot as A, WebsiteVisitSnapshot as W };
50
+ export { MAX_JOURNEY_SERIALIZED_BYTES as M, readConsentedWebsiteVisit as b, captureAttributionOnLanding as c, sanitizeWebsiteVisit as d, readAttributionSnapshot as r, sanitizeWebsiteJourney as s };
51
+ export type { AttributionSnapshot as A, WebsiteVisitJourneyEntry as W, WebsiteVisitSnapshot as a };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  useConsent
4
- } from "./chunk-7GDXQ6UB.js";
4
+ } from "./chunk-T4Q4VJ6K.js";
5
5
 
6
6
  // src/consent/banner.tsx
7
7
  import { useEffect, useId, useRef } from "react";
@@ -62,6 +62,8 @@ function ConsentBanner({
62
62
  if (config.consent?.enabled === false) return null;
63
63
  const isOptOut = mode === "opt-out" && !gpc;
64
64
  const message = config.consent?.message?.trim() || (isOptOut ? "We use cookies to understand website visits. You can turn analytics off at any time." : "May we use cookies to understand website visits? Forms and core site features work either way.");
65
+ const rawPolicyUrl = config.consent?.policyUrl?.trim() ?? "";
66
+ const safePolicyUrl = rawPolicyUrl.startsWith("/") && !rawPolicyUrl.startsWith("//") || /^https?:\/\//i.test(rawPolicyUrl) ? rawPolicyUrl : "";
65
67
  return /* @__PURE__ */ jsxs(Fragment, { children: [
66
68
  !config.consent?.hideFloatingPrivacyButton && /* @__PURE__ */ jsx(
67
69
  PrivacyChoicesButton,
@@ -134,10 +136,10 @@ function ConsentBanner({
134
136
  /* @__PURE__ */ jsxs("p", { style: { margin: 0, fontSize: "0.875rem", lineHeight: 1.5 }, children: [
135
137
  message,
136
138
  " ",
137
- config.consent?.policyUrl && /* @__PURE__ */ jsx(
139
+ safePolicyUrl && /* @__PURE__ */ jsx(
138
140
  "a",
139
141
  {
140
- href: config.consent.policyUrl,
142
+ href: safePolicyUrl,
141
143
  style: { textDecoration: "underline", color: "inherit" },
142
144
  children: "Privacy policy"
143
145
  }
@@ -6,7 +6,7 @@ import {
6
6
  readBrowserCookie,
7
7
  readGpcSignal,
8
8
  readStoredConsent
9
- } from "./chunk-7GDXQ6UB.js";
9
+ } from "./chunk-T4Q4VJ6K.js";
10
10
 
11
11
  // src/analytics/attribution.ts
12
12
  var ATTRIBUTION_STORAGE_KEY = "wr:attribution:v1";
@@ -84,52 +84,142 @@ function readAttributionSnapshot() {
84
84
  return captureAttributionOnLanding();
85
85
  }
86
86
  var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
87
+ var VISITOR_KEY_RE = /^[a-zA-Z0-9_-]{16,128}$/;
88
+ var ISO_OFFSET_DATETIME_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/i;
89
+ var SESSION_IDLE_MS = 30 * 60 * 1e3;
90
+ var MAX_JOURNEY_SERIALIZED_BYTES = 16384;
91
+ function sanitizeWebsiteJourney(raw) {
92
+ if (!Array.isArray(raw)) return void 0;
93
+ const entries = [];
94
+ for (const item of raw.slice(-10)) {
95
+ if (!item || typeof item !== "object" || Array.isArray(item)) continue;
96
+ const row = item;
97
+ const sessionId = typeof row.sessionId === "string" ? row.sessionId.trim() : "";
98
+ const startedAt = typeof row.startedAt === "string" ? row.startedAt.trim() : "";
99
+ if (!UUID_RE.test(sessionId) || !ISO_OFFSET_DATETIME_RE.test(startedAt) || Number.isNaN(Date.parse(startedAt))) {
100
+ continue;
101
+ }
102
+ const pages = Array.isArray(row.pages) ? row.pages.filter(
103
+ (page) => typeof page === "string" && page.length > 0 && page.length <= 2048
104
+ ).slice(-100) : [];
105
+ const referrer = typeof row.referrer === "string" && row.referrer.length <= 2048 ? row.referrer : row.referrer === null ? null : void 0;
106
+ const activeMs = typeof row.activeMs === "number" && Number.isFinite(row.activeMs) && row.activeMs >= 0 ? Math.min(864e5, Math.round(row.activeMs)) : void 0;
107
+ entries.push({
108
+ sessionId,
109
+ startedAt,
110
+ pages,
111
+ ...referrer !== void 0 ? { referrer } : {},
112
+ ...activeMs !== void 0 ? { activeMs } : {}
113
+ });
114
+ }
115
+ while (entries.length > 1 && JSON.stringify(entries).length > MAX_JOURNEY_SERIALIZED_BYTES) {
116
+ entries.shift();
117
+ }
118
+ if (entries.length === 1 && JSON.stringify(entries).length > MAX_JOURNEY_SERIALIZED_BYTES) {
119
+ const latest = entries[0];
120
+ while (latest.pages.length > 0 && JSON.stringify(entries).length > MAX_JOURNEY_SERIALIZED_BYTES) {
121
+ latest.pages.shift();
122
+ }
123
+ if (JSON.stringify(entries).length > MAX_JOURNEY_SERIALIZED_BYTES) {
124
+ return void 0;
125
+ }
126
+ }
127
+ return entries.length > 0 ? entries : void 0;
128
+ }
129
+ function sanitizeWebsiteVisit(raw) {
130
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
131
+ const obj = raw;
132
+ const visitorKey = typeof obj.visitorKey === "string" ? obj.visitorKey.trim() : "";
133
+ const sessionId = typeof obj.sessionId === "string" ? obj.sessionId.trim() : "";
134
+ if (!VISITOR_KEY_RE.test(visitorKey) || !UUID_RE.test(sessionId)) {
135
+ return void 0;
136
+ }
137
+ const device = obj.device === "mobile" ? "mobile" : "desktop";
138
+ const journey = sanitizeWebsiteJourney(obj.journey);
139
+ return {
140
+ visitorKey,
141
+ sessionId,
142
+ device,
143
+ ...journey ? { journey } : {}
144
+ };
145
+ }
87
146
  function readConsentedWebsiteVisit(siteId, consentAllowed) {
88
147
  if (!consentAllowed || typeof window === "undefined") return void 0;
89
148
  const win = window;
90
149
  let visitorKey;
91
150
  let sessionId;
92
- let journey;
151
+ let device;
152
+ let rawJourney;
93
153
  try {
94
- const bridge = win.__wrVisitor?.getVisitContext?.();
95
- if (bridge) {
96
- visitorKey = bridge.visitorKey;
97
- sessionId = bridge.sessionId;
98
- journey = bridge.journey;
154
+ if (typeof win.__wrVisitor?.getVisitContext === "function") {
155
+ const bridge = win.__wrVisitor.getVisitContext();
156
+ if (bridge === null) return void 0;
157
+ if (bridge) {
158
+ visitorKey = bridge.visitorKey;
159
+ sessionId = bridge.sessionId;
160
+ if (bridge.device === "desktop" || bridge.device === "mobile") {
161
+ device = bridge.device;
162
+ }
163
+ rawJourney = bridge.journey;
164
+ }
99
165
  } else if (win.__wrVisitor) {
100
166
  visitorKey = win.__wrVisitor.visitorKey;
101
167
  sessionId = win.__wrVisitor.sessionId;
102
168
  }
103
169
  } catch {
104
170
  }
171
+ if (!visitorKey) {
172
+ try {
173
+ visitorKey = readBrowserCookie("wr_vid") ?? window.localStorage.getItem("wr_vid") ?? window.localStorage.getItem("wr_visitor_key") ?? void 0;
174
+ } catch {
175
+ visitorKey = readBrowserCookie("wr_vid") ?? void 0;
176
+ }
177
+ }
178
+ if (!sessionId && siteId) {
179
+ try {
180
+ const rawSession = window.localStorage.getItem(
181
+ `wr:visitors:session:${siteId}`
182
+ );
183
+ if (rawSession) {
184
+ const state = JSON.parse(rawSession);
185
+ if (state && typeof state.id === "string" && UUID_RE.test(state.id) && (typeof state.last !== "number" || Date.now() - state.last <= SESSION_IDLE_MS) && (!state.vid || !visitorKey || state.vid === visitorKey)) {
186
+ sessionId = state.id;
187
+ }
188
+ }
189
+ } catch {
190
+ }
191
+ }
105
192
  if (!sessionId && siteId) {
106
193
  try {
107
194
  sessionId = window.sessionStorage.getItem(`wr:session:${siteId}`) ?? void 0;
108
195
  } catch {
109
196
  }
110
197
  }
111
- if (!visitorKey) {
198
+ if (!rawJourney && siteId) {
112
199
  try {
113
- visitorKey = window.localStorage.getItem("wr_visitor_key") ?? void 0;
200
+ const raw = window.localStorage.getItem(`wr:journey:${siteId}`);
201
+ if (raw) rawJourney = JSON.parse(raw);
114
202
  } catch {
115
203
  }
116
204
  }
117
- if (!visitorKey || !sessionId || !UUID_RE.test(visitorKey) || !UUID_RE.test(sessionId)) {
118
- return void 0;
205
+ if (!device) {
206
+ device = typeof window.matchMedia === "function" && window.matchMedia("(max-width: 767px)").matches ? "mobile" : "desktop";
119
207
  }
120
- const device = typeof window.matchMedia === "function" && window.matchMedia("(max-width: 767px)").matches ? "mobile" : "desktop";
121
- return {
208
+ return sanitizeWebsiteVisit({
122
209
  visitorKey,
123
210
  sessionId,
124
211
  device,
125
- ...journey ? { journey } : {}
126
- };
212
+ journey: rawJourney
213
+ });
127
214
  }
128
215
 
129
216
  // src/analytics/tracker.ts
130
217
  var inMemorySessionId = null;
131
218
  function isConsentCurrentlyAllowed(config) {
132
- const decision = readStoredConsent(config.consent?.legacyConsentCookies ?? []);
219
+ const decision = readStoredConsent(
220
+ config.consent?.legacyConsentCookies ?? [],
221
+ config.siteId
222
+ );
133
223
  const rawMode = readBrowserCookie(MODE_COOKIE);
134
224
  const mode = rawMode === "opt-out" ? "opt-out" : "opt-in";
135
225
  return analyticsAllowed(decision, mode, readGpcSignal());
@@ -221,6 +311,9 @@ function pushDataLayerEvent(event, extra, configOverride) {
221
311
  export {
222
312
  captureAttributionOnLanding,
223
313
  readAttributionSnapshot,
314
+ MAX_JOURNEY_SERIALIZED_BYTES,
315
+ sanitizeWebsiteJourney,
316
+ sanitizeWebsiteVisit,
224
317
  readConsentedWebsiteVisit,
225
318
  trackPageView,
226
319
  trackEvent,
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  captureAttributionOnLanding,
4
4
  trackPageView
5
- } from "./chunk-QQP7VG2C.js";
5
+ } from "./chunk-JPUCXNHR.js";
6
6
  import {
7
7
  useConsent
8
- } from "./chunk-7GDXQ6UB.js";
8
+ } from "./chunk-T4Q4VJ6K.js";
9
9
 
10
10
  // src/analytics/page-tracker.tsx
11
11
  import { useEffect, useRef } from "react";
@@ -89,13 +89,25 @@ function readBrowserCookie(name) {
89
89
  return null;
90
90
  }
91
91
  }
92
- function readStoredConsent(legacyCookieNames = []) {
92
+ function legacyConsentStorageKey(siteId) {
93
+ return `wr:consent:${siteId?.trim() || "site"}`;
94
+ }
95
+ function readStoredConsent(legacyCookieNames = [], siteId) {
93
96
  const direct = parseConsentValue(readBrowserCookie(CONSENT_COOKIE));
94
97
  if (direct) return direct;
95
98
  for (const legacy of legacyCookieNames) {
96
99
  const migrated = parseConsentValue(readBrowserCookie(legacy));
97
100
  if (migrated) return migrated;
98
101
  }
102
+ if (siteId !== void 0 && typeof window !== "undefined") {
103
+ try {
104
+ const legacyChoice = window.localStorage.getItem(
105
+ legacyConsentStorageKey(siteId)
106
+ );
107
+ if (legacyChoice === "declined") return "analytics:no";
108
+ } catch {
109
+ }
110
+ }
99
111
  return null;
100
112
  }
101
113
  function writeConsentCookie(value) {
@@ -119,7 +131,7 @@ function resolveGeoFromHeaders(headers) {
119
131
 
120
132
  // src/consent/bootstrap.ts
121
133
  function safeJson(value) {
122
- return JSON.stringify(value).replace(/</g, "\\u003c");
134
+ return JSON.stringify(value).replace(/</g, "\\u003c").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
123
135
  }
124
136
  var GTM_ID_RE = /^GTM-[A-Z0-9]{4,16}$/;
125
137
  var GA4_ID_RE = /^G-[A-Z0-9]{4,16}$/;
@@ -153,6 +165,7 @@ function buildConsentBootstrapScript(options) {
153
165
  const ga4Id = sanitizeGa4Id(options.ga4MeasurementId);
154
166
  if (!visitorUrl && !gtmId && !ga4Id) return null;
155
167
  const legacy = options.legacyConsentCookies ?? [];
168
+ const legacyStorageCheck = options.siteId !== void 0 ? `if(!c){try{if(window.localStorage.getItem(${safeJson(legacyConsentStorageKey(options.siteId))})==='declined')c='analytics:no';}catch(e){}}` : "";
156
169
  const loaders = [];
157
170
  if (visitorUrl) {
158
171
  loaders.push(
@@ -169,7 +182,7 @@ function buildConsentBootstrapScript(options) {
169
182
  `if(!document.getElementById('${GA4_SCRIPT_ID}')){window.dataLayer=window.dataLayer||[];function gtag(){window.dataLayer.push(arguments);}window.gtag=window.gtag||gtag;gtag('js',new Date());gtag('config',${safeJson(ga4Id)});var a=document.createElement('script');a.id='${GA4_SCRIPT_ID}';a.async=true;a.src=${safeJson(`https://www.googletagmanager.com/gtag/js?id=${encodeURIComponent(ga4Id)}`)};a.setAttribute('data-consent-category','analytics');document.head.appendChild(a);}`
170
183
  );
171
184
  }
172
- return `(function(){try{var g=function(n){var p=document.cookie.split('; ').find(function(v){return v.indexOf(n+'=')===0});return p?decodeURIComponent(p.slice(n.length+1)):null};var c=g('${CONSENT_COOKIE}');if(!c){var leg=${safeJson(legacy)};for(var i=0;i<leg.length;i++){var lv=g(leg[i]);if(lv){c=lv.indexOf('analytics:yes')>-1?'analytics:yes':lv.indexOf('analytics:no')>-1?'analytics:no':null;if(c)break;}}}if(c==='analytics:no')return;var gpc=navigator.globalPrivacyControl===true;if(c!=='analytics:yes'&&!(g('${MODE_COOKIE}')==='opt-out'&&!gpc))return;${loaders.join("")}}catch(e){}})();`;
185
+ return `(function(){try{var g=function(n){var p=document.cookie.split('; ').find(function(v){return v.indexOf(n+'=')===0});return p?decodeURIComponent(p.slice(n.length+1)):null};var c=g('${CONSENT_COOKIE}');if(!c){var leg=${safeJson(legacy)};for(var i=0;i<leg.length;i++){var lv=g(leg[i]);if(lv){c=lv.indexOf('analytics:yes')>-1?'analytics:yes':lv.indexOf('analytics:no')>-1?'analytics:no':null;if(c)break;}}}${legacyStorageCheck}if(c==='analytics:no')return;var gpc=navigator.globalPrivacyControl===true;if(c!=='analytics:yes'&&!(g('${MODE_COOKIE}')==='opt-out'&&!gpc))return;${loaders.join("")}}catch(e){}})();`;
173
186
  }
174
187
 
175
188
  // src/consent/provider.tsx
@@ -404,7 +417,7 @@ var bookingConfigSchema = z2.object({
404
417
  var consentConfigSchema = z2.object({
405
418
  enabled: z2.boolean().default(true),
406
419
  message: z2.string().trim().optional().default(""),
407
- policyUrl: z2.string().trim().optional().default("/privacy-policy"),
420
+ policyUrl: z2.string().trim().optional().default(""),
408
421
  /** Legacy cookie names to migrate silently for returning visitors (e.g. Brandywine Oak). */
409
422
  legacyConsentCookies: z2.array(z2.string().trim().min(1)).optional().default([]),
410
423
  /** Additional US states requiring opt-in beyond California (CA is always opt-in). */
@@ -414,7 +427,8 @@ var consentConfigSchema = z2.object({
414
427
  });
415
428
  var visitorsConfigSchema = z2.object({
416
429
  enabled: z2.boolean().default(false),
417
- siteScriptUrl: z2.string().trim().optional().default("")
430
+ siteScriptUrl: z2.string().trim().optional().default(""),
431
+ recordings: z2.boolean().optional()
418
432
  });
419
433
  var blogConfigSchema = z2.object({
420
434
  enabled: z2.boolean().optional().default(true),
@@ -463,7 +477,7 @@ var siteConfigSchema = z2.object({
463
477
  consent: consentConfigSchema.optional().default({
464
478
  enabled: true,
465
479
  message: "",
466
- policyUrl: "/privacy-policy",
480
+ policyUrl: "",
467
481
  legacyConsentCookies: [],
468
482
  extraOptInUsRegions: [],
469
483
  hideFloatingPrivacyButton: false
@@ -622,7 +636,7 @@ function ConsentProvider({
622
636
  useEffect(() => {
623
637
  let cancelled = false;
624
638
  const legacyCookies = config.consent?.legacyConsentCookies ?? [];
625
- const storedDecision = readStoredConsent(legacyCookies);
639
+ const storedDecision = readStoredConsent(legacyCookies, config.siteId);
626
640
  const detectedGpc = readGpcSignal();
627
641
  const rawMode = readBrowserCookie(MODE_COOKIE);
628
642
  const finalize = (resolvedMode) => {
@@ -663,6 +677,18 @@ function ConsentProvider({
663
677
  (value2) => {
664
678
  const wasMounted = hasMountedThirdPartyScripts();
665
679
  writeConsentCookie(value2);
680
+ if (typeof window !== "undefined") {
681
+ try {
682
+ const legacyKey = legacyConsentStorageKey(config.siteId);
683
+ if (value2 === "analytics:yes" || readBrowserCookie(CONSENT_COOKIE) === value2) {
684
+ window.localStorage.removeItem(legacyKey);
685
+ }
686
+ } catch {
687
+ }
688
+ window.dispatchEvent(
689
+ new CustomEvent("wr:consent-changed", { detail: { consent: value2 } })
690
+ );
691
+ }
666
692
  setDecision(value2);
667
693
  setBannerOpen(false);
668
694
  setReopened(false);
@@ -757,6 +783,7 @@ export {
757
783
  parseConsentValue,
758
784
  readCookieFromString,
759
785
  readBrowserCookie,
786
+ legacyConsentStorageKey,
760
787
  readStoredConsent,
761
788
  writeConsentCookie,
762
789
  readGpcSignal,
@@ -1,5 +1,5 @@
1
- import { S as SiteConfig } from '../schema-C1ixytx2.js';
2
- export { B as BlogConfig, a as BookingConfig, C as ComplianceConfig, b as ConsentConfig, c as CtaLink, D as DEFAULT_ANALYTICS_ENDPOINT, d as DEFAULT_LEADS_API_URL, F as FooterGroup, I as IntegrationsConfig, N as NavItem, e as SocialLink, V as VisitorsConfig, f as blogConfigSchema, g as bookingConfigSchema, h as complianceConfigSchema, i as consentConfigSchema, j as ctaLinkSchema, k as displayNameFromLegal, l as footerGroupSchema, m as integrationsConfigSchema, n as navItemSchema, s as siteConfigSchema, o as socialLinkSchema, v as visitorsConfigSchema } from '../schema-C1ixytx2.js';
1
+ import { S as SiteConfig } from '../schema-AcsTlgUv.js';
2
+ export { B as BlogConfig, a as BookingConfig, C as ComplianceConfig, b as ConsentConfig, c as CtaLink, D as DEFAULT_ANALYTICS_ENDPOINT, d as DEFAULT_LEADS_API_URL, F as FooterGroup, I as IntegrationsConfig, N as NavItem, e as SocialLink, V as VisitorsConfig, f as blogConfigSchema, g as bookingConfigSchema, h as complianceConfigSchema, i as consentConfigSchema, j as ctaLinkSchema, k as displayNameFromLegal, l as footerGroupSchema, m as integrationsConfigSchema, n as navItemSchema, s as siteConfigSchema, o as socialLinkSchema, v as visitorsConfigSchema } from '../schema-AcsTlgUv.js';
3
3
  import { Metadata } from 'next';
4
4
  import 'zod';
5
5
  import '../regulatory-schema-uDKNJ7q8.js';
@@ -219,7 +219,7 @@ var bookingConfigSchema = z2.object({
219
219
  var consentConfigSchema = z2.object({
220
220
  enabled: z2.boolean().default(true),
221
221
  message: z2.string().trim().optional().default(""),
222
- policyUrl: z2.string().trim().optional().default("/privacy-policy"),
222
+ policyUrl: z2.string().trim().optional().default(""),
223
223
  /** Legacy cookie names to migrate silently for returning visitors (e.g. Brandywine Oak). */
224
224
  legacyConsentCookies: z2.array(z2.string().trim().min(1)).optional().default([]),
225
225
  /** Additional US states requiring opt-in beyond California (CA is always opt-in). */
@@ -229,7 +229,8 @@ var consentConfigSchema = z2.object({
229
229
  });
230
230
  var visitorsConfigSchema = z2.object({
231
231
  enabled: z2.boolean().default(false),
232
- siteScriptUrl: z2.string().trim().optional().default("")
232
+ siteScriptUrl: z2.string().trim().optional().default(""),
233
+ recordings: z2.boolean().optional()
233
234
  });
234
235
  var blogConfigSchema = z2.object({
235
236
  enabled: z2.boolean().optional().default(true),
@@ -278,7 +279,7 @@ var siteConfigSchema = z2.object({
278
279
  consent: consentConfigSchema.optional().default({
279
280
  enabled: true,
280
281
  message: "",
281
- policyUrl: "/privacy-policy",
282
+ policyUrl: "",
282
283
  legacyConsentCookies: [],
283
284
  extraOptInUsRegions: [],
284
285
  hideFloatingPrivacyButton: false
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { S as SiteConfig } from '../schema-DD0nDOD0.js';
2
+ import { S as SiteConfig } from '../schema-CYsBDpoU.js';
3
3
  import 'zod';
4
4
 
5
5
  /**
@@ -24,7 +24,8 @@ declare function analyticsAllowed(consent: ConsentValue | null, mode: PrivacyMod
24
24
  declare function parseConsentValue(raw: string | null): ConsentValue | null;
25
25
  declare function readCookieFromString(cookieHeader: string, name: string): string | null;
26
26
  declare function readBrowserCookie(name: string): string | null;
27
- declare function readStoredConsent(legacyCookieNames?: readonly string[]): ConsentValue | null;
27
+ declare function legacyConsentStorageKey(siteId?: string): string;
28
+ declare function readStoredConsent(legacyCookieNames?: readonly string[], siteId?: string): ConsentValue | null;
28
29
  declare function writeConsentCookie(value: ConsentValue): void;
29
30
  declare function readGpcSignal(): boolean;
30
31
  declare function resolveGeoFromHeaders(headers: Headers): {
@@ -33,6 +34,7 @@ declare function resolveGeoFromHeaders(headers: Headers): {
33
34
  };
34
35
 
35
36
  interface ConsentBootstrapOptions {
37
+ siteId?: string;
36
38
  visitorScriptUrl?: string;
37
39
  gtmId?: string;
38
40
  ga4MeasurementId?: string;
@@ -99,5 +101,5 @@ interface ConsentBannerProps {
99
101
  */
100
102
  declare function ConsentBanner({ floatingButtonClassName, bannerClassName, }?: ConsentBannerProps): React__default.JSX.Element | null;
101
103
 
102
- export { CONSENT_COOKIE, CONSENT_MAX_AGE, ConsentBanner, ConsentGate, ConsentProvider, DEFAULT_OPT_IN_US_REGIONS, GA4_SCRIPT_ID, GTM_SCRIPT_ID, MODE_COOKIE, MODE_MAX_AGE, OPT_IN_COUNTRIES, PrivacyChoicesButton, VISITOR_SCRIPT_ID, analyticsAllowed, buildConsentBootstrapScript, parseConsentValue, privacyModeForLocation, readBrowserCookie, readCookieFromString, readGpcSignal, readStoredConsent, resolveGeoFromHeaders, sanitizeGa4Id, sanitizeGtmId, sanitizeVisitorScriptUrl, useConsent, writeConsentCookie };
104
+ export { CONSENT_COOKIE, CONSENT_MAX_AGE, ConsentBanner, ConsentGate, ConsentProvider, DEFAULT_OPT_IN_US_REGIONS, GA4_SCRIPT_ID, GTM_SCRIPT_ID, MODE_COOKIE, MODE_MAX_AGE, OPT_IN_COUNTRIES, PrivacyChoicesButton, VISITOR_SCRIPT_ID, analyticsAllowed, buildConsentBootstrapScript, legacyConsentStorageKey, parseConsentValue, privacyModeForLocation, readBrowserCookie, readCookieFromString, readGpcSignal, readStoredConsent, resolveGeoFromHeaders, sanitizeGa4Id, sanitizeGtmId, sanitizeVisitorScriptUrl, useConsent, writeConsentCookie };
103
105
  export type { ConsentBannerProps, ConsentBootstrapOptions, ConsentContextValue, ConsentProviderProps, ConsentValue, PrivacyChoicesButtonProps, PrivacyMode };
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  ConsentBanner,
4
4
  PrivacyChoicesButton
5
- } from "../chunk-Y77ARZE4.js";
5
+ } from "../chunk-DHVKLLL7.js";
6
6
  import {
7
7
  CONSENT_COOKIE,
8
8
  CONSENT_MAX_AGE,
@@ -17,6 +17,7 @@ import {
17
17
  VISITOR_SCRIPT_ID,
18
18
  analyticsAllowed,
19
19
  buildConsentBootstrapScript,
20
+ legacyConsentStorageKey,
20
21
  parseConsentValue,
21
22
  privacyModeForLocation,
22
23
  readBrowserCookie,
@@ -29,7 +30,7 @@ import {
29
30
  sanitizeVisitorScriptUrl,
30
31
  useConsent,
31
32
  writeConsentCookie
32
- } from "../chunk-7GDXQ6UB.js";
33
+ } from "../chunk-T4Q4VJ6K.js";
33
34
  export {
34
35
  CONSENT_COOKIE,
35
36
  CONSENT_MAX_AGE,
@@ -46,6 +47,7 @@ export {
46
47
  VISITOR_SCRIPT_ID,
47
48
  analyticsAllowed,
48
49
  buildConsentBootstrapScript,
50
+ legacyConsentStorageKey,
49
51
  parseConsentValue,
50
52
  privacyModeForLocation,
51
53
  readBrowserCookie,