@wealthreach/site-kit 0.0.0-stage → 1.0.1

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.
Files changed (42) hide show
  1. package/README.md +20 -2
  2. package/dist/a11y/client.d.ts +23 -0
  3. package/dist/a11y/client.js +72 -0
  4. package/dist/a11y/index.d.ts +43 -0
  5. package/dist/a11y/index.js +194 -0
  6. package/dist/a11y/shell-client.d.ts +19 -0
  7. package/dist/a11y/shell-client.js +45 -0
  8. package/dist/analytics/index.d.ts +47 -0
  9. package/dist/analytics/index.js +122 -0
  10. package/dist/attribution-DQaAWtA5.d.ts +41 -0
  11. package/dist/blog/index.d.ts +131 -0
  12. package/dist/blog/index.js +259 -0
  13. package/dist/chunk-4YRCSRZZ.js +32 -0
  14. package/dist/chunk-7GDXQ6UB.js +772 -0
  15. package/dist/chunk-QQP7VG2C.js +231 -0
  16. package/dist/chunk-Y77ARZE4.js +214 -0
  17. package/dist/config/index.d.ts +20 -0
  18. package/dist/config/index.js +445 -0
  19. package/dist/consent/index.d.ts +103 -0
  20. package/dist/consent/index.js +61 -0
  21. package/dist/disclosures/index.d.ts +57 -0
  22. package/dist/disclosures/index.js +361 -0
  23. package/dist/forms/index.d.ts +128 -0
  24. package/dist/forms/index.js +449 -0
  25. package/dist/mdx/index.d.ts +15 -0
  26. package/dist/mdx/index.js +45 -0
  27. package/dist/next/config.cjs +140 -0
  28. package/dist/next/config.d.cts +36 -0
  29. package/dist/next/config.d.ts +36 -0
  30. package/dist/next/config.js +111 -0
  31. package/dist/next/draft-route.d.ts +10 -0
  32. package/dist/next/draft-route.js +49 -0
  33. package/dist/next/leads-route.d.ts +138 -0
  34. package/dist/next/leads-route.js +771 -0
  35. package/dist/next/privacy-mode.d.ts +14 -0
  36. package/dist/next/privacy-mode.js +86 -0
  37. package/dist/next/proxy.d.ts +19 -0
  38. package/dist/next/proxy.js +93 -0
  39. package/dist/regulatory-schema-uDKNJ7q8.d.ts +1301 -0
  40. package/dist/schema-C1ixytx2.d.ts +2911 -0
  41. package/dist/schema-DD0nDOD0.d.ts +1744 -0
  42. package/package.json +85 -3
@@ -0,0 +1,14 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+
3
+ interface PrivacyModeHandlerOptions {
4
+ extraOptInUsRegions?: readonly string[];
5
+ }
6
+ /**
7
+ * Dynamic 304-revalidation fallback (`GET /api/privacy-mode`) mirrored from
8
+ * Brandywine Oak: static pages served as 304 do not re-run proxy Set-Cookie, so
9
+ * `<ConsentProvider>` calls this route whenever `privacy_mode` is missing.
10
+ */
11
+ declare function createPrivacyModeHandler(options?: PrivacyModeHandlerOptions): (request: NextRequest) => NextResponse;
12
+
13
+ export { createPrivacyModeHandler };
14
+ export type { PrivacyModeHandlerOptions };
@@ -0,0 +1,86 @@
1
+ // src/next/privacy-mode.ts
2
+ import { NextResponse } from "next/server";
3
+
4
+ // src/consent/core.ts
5
+ var MODE_COOKIE = "privacy_mode";
6
+ var CONSENT_MAX_AGE = 60 * 60 * 24 * 180;
7
+ var MODE_MAX_AGE = 60 * 60 * 24;
8
+ var OPT_IN_COUNTRIES = /* @__PURE__ */ new Set([
9
+ "AT",
10
+ "BE",
11
+ "BG",
12
+ "HR",
13
+ "CY",
14
+ "CZ",
15
+ "DK",
16
+ "EE",
17
+ "FI",
18
+ "FR",
19
+ "DE",
20
+ "GR",
21
+ "HU",
22
+ "IE",
23
+ "IT",
24
+ "LV",
25
+ "LT",
26
+ "LU",
27
+ "MT",
28
+ "NL",
29
+ "PL",
30
+ "PT",
31
+ "RO",
32
+ "SK",
33
+ "SI",
34
+ "ES",
35
+ "SE",
36
+ "IS",
37
+ "LI",
38
+ "NO",
39
+ "GB",
40
+ "CH"
41
+ ]);
42
+ var DEFAULT_OPT_IN_US_REGIONS = /* @__PURE__ */ new Set(["CA"]);
43
+ function privacyModeForLocation(country, region, extraOptInUsRegions = []) {
44
+ if (!country) return "opt-in";
45
+ const cc = country.trim().toUpperCase();
46
+ if (!cc || OPT_IN_COUNTRIES.has(cc)) return "opt-in";
47
+ if (cc === "US" && region) {
48
+ const r = region.trim().toUpperCase();
49
+ if (DEFAULT_OPT_IN_US_REGIONS.has(r) || extraOptInUsRegions.some((extra) => extra.trim().toUpperCase() === r)) {
50
+ return "opt-in";
51
+ }
52
+ }
53
+ return "opt-out";
54
+ }
55
+ function resolveGeoFromHeaders(headers) {
56
+ return {
57
+ country: headers.get("x-vercel-ip-country"),
58
+ region: headers.get("x-vercel-ip-country-region")
59
+ };
60
+ }
61
+
62
+ // src/next/privacy-mode.ts
63
+ function createPrivacyModeHandler(options) {
64
+ return function GET(request) {
65
+ const { country, region } = resolveGeoFromHeaders(request.headers);
66
+ const mode = privacyModeForLocation(
67
+ country,
68
+ region,
69
+ options?.extraOptInUsRegions ?? []
70
+ );
71
+ const response = NextResponse.json(
72
+ { mode },
73
+ { headers: { "Cache-Control": "no-store" } }
74
+ );
75
+ response.cookies.set(MODE_COOKIE, mode, {
76
+ maxAge: MODE_MAX_AGE,
77
+ path: "/",
78
+ sameSite: "lax",
79
+ secure: request.nextUrl.protocol === "https:"
80
+ });
81
+ return response;
82
+ };
83
+ }
84
+ export {
85
+ createPrivacyModeHandler
86
+ };
@@ -0,0 +1,19 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+
3
+ interface WealthReachProxyOptions {
4
+ /** Additional 2-letter US state codes that should default to opt-in beyond CA. */
5
+ extraOptInUsRegions?: readonly string[];
6
+ /** Optional site-specific middleware hook (e.g. canonical trailing-slash redirect). */
7
+ beforeNext?: (request: NextRequest) => NextResponse | null | undefined;
8
+ }
9
+ /**
10
+ * Creates a Next.js 16 Edge `proxy.ts` handler that tags every HTML navigation
11
+ * with the BrandywineOak `privacy_mode` cookie (`opt-in` vs `opt-out`).
12
+ */
13
+ declare function createWealthReachProxy(options?: WealthReachProxyOptions): (request: NextRequest) => NextResponse;
14
+ declare const defaultProxyConfig: {
15
+ matcher: string[];
16
+ };
17
+
18
+ export { createWealthReachProxy, defaultProxyConfig };
19
+ export type { WealthReachProxyOptions };
@@ -0,0 +1,93 @@
1
+ // src/next/proxy.ts
2
+ import { NextResponse } from "next/server";
3
+
4
+ // src/consent/core.ts
5
+ var MODE_COOKIE = "privacy_mode";
6
+ var CONSENT_MAX_AGE = 60 * 60 * 24 * 180;
7
+ var MODE_MAX_AGE = 60 * 60 * 24;
8
+ var OPT_IN_COUNTRIES = /* @__PURE__ */ new Set([
9
+ "AT",
10
+ "BE",
11
+ "BG",
12
+ "HR",
13
+ "CY",
14
+ "CZ",
15
+ "DK",
16
+ "EE",
17
+ "FI",
18
+ "FR",
19
+ "DE",
20
+ "GR",
21
+ "HU",
22
+ "IE",
23
+ "IT",
24
+ "LV",
25
+ "LT",
26
+ "LU",
27
+ "MT",
28
+ "NL",
29
+ "PL",
30
+ "PT",
31
+ "RO",
32
+ "SK",
33
+ "SI",
34
+ "ES",
35
+ "SE",
36
+ "IS",
37
+ "LI",
38
+ "NO",
39
+ "GB",
40
+ "CH"
41
+ ]);
42
+ var DEFAULT_OPT_IN_US_REGIONS = /* @__PURE__ */ new Set(["CA"]);
43
+ function privacyModeForLocation(country, region, extraOptInUsRegions = []) {
44
+ if (!country) return "opt-in";
45
+ const cc = country.trim().toUpperCase();
46
+ if (!cc || OPT_IN_COUNTRIES.has(cc)) return "opt-in";
47
+ if (cc === "US" && region) {
48
+ const r = region.trim().toUpperCase();
49
+ if (DEFAULT_OPT_IN_US_REGIONS.has(r) || extraOptInUsRegions.some((extra) => extra.trim().toUpperCase() === r)) {
50
+ return "opt-in";
51
+ }
52
+ }
53
+ return "opt-out";
54
+ }
55
+ function resolveGeoFromHeaders(headers) {
56
+ return {
57
+ country: headers.get("x-vercel-ip-country"),
58
+ region: headers.get("x-vercel-ip-country-region")
59
+ };
60
+ }
61
+
62
+ // src/next/proxy.ts
63
+ function createWealthReachProxy(options) {
64
+ return function wealthReachProxy(request) {
65
+ const early = options?.beforeNext?.(request);
66
+ if (early) return early;
67
+ const response = NextResponse.next();
68
+ const { country, region } = resolveGeoFromHeaders(request.headers);
69
+ const mode = privacyModeForLocation(
70
+ country,
71
+ region,
72
+ options?.extraOptInUsRegions ?? []
73
+ );
74
+ if (request.cookies.get(MODE_COOKIE)?.value !== mode) {
75
+ response.cookies.set(MODE_COOKIE, mode, {
76
+ maxAge: MODE_MAX_AGE,
77
+ path: "/",
78
+ sameSite: "lax",
79
+ secure: request.nextUrl.protocol === "https:"
80
+ });
81
+ }
82
+ return response;
83
+ };
84
+ }
85
+ var defaultProxyConfig = {
86
+ matcher: [
87
+ "/((?!api|_next/static|_next/image|favicon.ico|robots.txt|sitemap.xml|llms.txt|.*\\..*).*)"
88
+ ]
89
+ };
90
+ export {
91
+ createWealthReachProxy,
92
+ defaultProxyConfig
93
+ };