@sonordev/site-kit 7.0.2 → 7.1.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 (126) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/agent-manifest.json +11 -5
  3. package/dist/{AnalyticsProvider-XXWTFKJH.js → AnalyticsProvider-3MI5RCTL.js} +4 -4
  4. package/dist/{ArticleViewTracker-V4KZB6QN.js → ArticleViewTracker-CMBSJR3N.js} +3 -3
  5. package/dist/{BlocksPopup-JHGHB6XW.js → BlocksPopup-X3OAAK2L.js} +4 -4
  6. package/dist/{ChatWidget-CG32POI3.js → ChatWidget-JMFBXJ75.js} +5 -5
  7. package/dist/{EngageWidget-LQMR4LEX.js → EngageWidget-A3QKZ3SU.js} +4 -4
  8. package/dist/{FileField-KUG3CKXG.js → FileField-QRSEGO6D.js} +3 -3
  9. package/dist/{FormSpotlight-FVNPOCU3.js → FormSpotlight-XKV7VTN4.js} +1 -1
  10. package/dist/{FormStage-C7VKRURJ.js → FormStage-C3YGYAUZ.js} +1 -1
  11. package/dist/{ManagedForm-VLNJKV65.js → ManagedForm-2GSSDJPP.js} +6 -6
  12. package/dist/{ManagedNewsletterForm-KJEU23BV.js → ManagedNewsletterForm-LPIKGJF4.js} +4 -4
  13. package/dist/{SignalCore-K2O46QG7.js → SignalCore-ICXXZBYI.js} +3 -3
  14. package/dist/{SiteDesignReporter-D7MD66GI.js → SiteDesignReporter-A7MS2CIP.js} +5 -5
  15. package/dist/SitemapSync-4U654SEA.js +8 -0
  16. package/dist/_client/booking-widget.js +5 -5
  17. package/dist/affiliates/index.js +3 -3
  18. package/dist/analytics/index.js +4 -4
  19. package/dist/articles/index.js +1 -1
  20. package/dist/articles/server-ui.js +1 -1
  21. package/dist/chat/index.js +5 -5
  22. package/dist/{chunk-KXPBMCFL.js → chunk-3QI26673.js} +3 -1
  23. package/dist/{chunk-6HDT4G4A.js → chunk-4YTYGG2C.js} +2 -2
  24. package/dist/{chunk-O52CH273.js → chunk-542MIHNP.js} +1 -1
  25. package/dist/{chunk-N2UVOR3X.js → chunk-662ILEZ6.js} +2 -0
  26. package/dist/chunk-6G43IRWR.js +4 -0
  27. package/dist/{chunk-B6RZ2NRH.js → chunk-6OL23QYD.js} +1 -1
  28. package/dist/{chunk-GGD4P7UW.js → chunk-7FWA3I6A.js} +1 -1
  29. package/dist/{chunk-T4SY3FMN.js → chunk-B73QPZPH.js} +3 -3
  30. package/dist/{chunk-KPAZG65P.js → chunk-CGWUXUYZ.js} +138 -46
  31. package/dist/{chunk-56JNI463.js → chunk-DUQMSNF2.js} +1 -1
  32. package/dist/{chunk-5FBY2ZIH.js → chunk-EFPS56JA.js} +1 -1
  33. package/dist/{chunk-P72ZJRSX.js → chunk-EQBZ24VH.js} +3 -3
  34. package/dist/{chunk-K5WZX776.js → chunk-H42PZKVC.js} +2 -2
  35. package/dist/{chunk-TT63HHIT.js → chunk-HAG4YIZY.js} +1 -1
  36. package/dist/{chunk-ZRE4ZYEG.js → chunk-ICFRH2ED.js} +1 -1
  37. package/dist/{chunk-7JIKGKWD.js → chunk-ILAW3XKD.js} +30 -7
  38. package/dist/{chunk-SSUQKA7L.js → chunk-J4D6ZXRW.js} +1 -1
  39. package/dist/{chunk-SWP36NCB.js → chunk-JC7KXNNM.js} +1 -1
  40. package/dist/{chunk-LVESVYCE.js → chunk-JIL5VY2R.js} +11 -117
  41. package/dist/{chunk-BS7FWUOY.js → chunk-KOPVJQ2P.js} +1 -1
  42. package/dist/chunk-LPH5FANE.js +169 -0
  43. package/dist/{chunk-ZSLRAMCK.js → chunk-NEKEH4CK.js} +1 -1
  44. package/dist/{chunk-DKTSGYLM.js → chunk-ODADQM6Z.js} +2 -2
  45. package/dist/{chunk-OIETJKIL.js → chunk-OUNRFXDC.js} +1 -1
  46. package/dist/{chunk-RU2RMTGT.js → chunk-PXZ7LAOY.js} +2 -2
  47. package/dist/{chunk-SAUTJMK6.js → chunk-Q3S26EQA.js} +1 -1
  48. package/dist/{chunk-BEL7YFMC.js → chunk-R3VKF43H.js} +1 -1
  49. package/dist/{chunk-P2GIIQH5.js → chunk-RK7GF7PQ.js} +1 -1
  50. package/dist/{chunk-42OXY4JV.js → chunk-RTMMHTEQ.js} +1 -1
  51. package/dist/chunk-RYVDGXC2.js +19 -0
  52. package/dist/{chunk-LJZ3SUET.js → chunk-V4HUSHZO.js} +2 -2
  53. package/dist/chunk-VCJYLYJV.js +49 -0
  54. package/dist/{chunk-GYY6ETGB.js → chunk-ZAWANWUS.js} +9 -5
  55. package/dist/chunk-ZETJTCMV.js +118 -0
  56. package/dist/client/index.js +3 -3
  57. package/dist/cms/CmsPage.d.ts +1 -0
  58. package/dist/cms/CmsPreview.d.ts +1 -0
  59. package/dist/cms/CmsSection.d.ts +1 -0
  60. package/dist/cms/index.d.ts +6 -0
  61. package/dist/cms/server-api.d.ts +3 -0
  62. package/dist/commerce/index.js +4 -4
  63. package/dist/config/index.js +1 -1
  64. package/dist/contracts/entries.d.ts +1 -1
  65. package/dist/contracts/site-cache.d.ts +55 -0
  66. package/dist/contracts/site-edit-param.d.ts +7 -0
  67. package/dist/contracts/site-edit.d.ts +77 -0
  68. package/dist/contracts/slot-content.d.ts +111 -0
  69. package/dist/contracts/slots.d.ts +39 -25
  70. package/dist/engage/index.js +6 -6
  71. package/dist/fleet/index.js +4 -4
  72. package/dist/forms/index.js +8 -8
  73. package/dist/forms/server.js +2 -2
  74. package/dist/images/index.js +4 -4
  75. package/dist/index.js +1 -1
  76. package/dist/layout/client.js +8 -7
  77. package/dist/layout/index.js +9 -8
  78. package/dist/llms/index.js +4 -2
  79. package/dist/llms/seo-revalidate.d.ts +8 -1
  80. package/dist/maps/index.js +3 -3
  81. package/dist/mcp/sonor.js +6 -6
  82. package/dist/overlay-RXV6U6QC.js +353 -0
  83. package/dist/proxy/index.js +2 -2
  84. package/dist/proxy/securityHeaders.d.ts +4 -0
  85. package/dist/revalidate/index.d.ts +44 -0
  86. package/dist/revalidate/index.js +27 -0
  87. package/dist/seo/ManagedContent.d.ts +2 -0
  88. package/dist/seo/client.js +4 -4
  89. package/dist/seo/index.js +9 -8
  90. package/dist/seo/llms.js +4 -2
  91. package/dist/seo/register-sitemap-cli.js +1 -1
  92. package/dist/seo/server.js +3 -2
  93. package/dist/seo/sitemap.js +2 -2
  94. package/dist/server/index.js +2 -2
  95. package/dist/{server-api-GJJQZVG7.js → server-api-BVCBLJKL.js} +2 -1
  96. package/dist/shared/build-entries.d.ts +1 -0
  97. package/dist/shared/edit-bridge.d.ts +8 -0
  98. package/dist/shared/version.d.ts +1 -1
  99. package/dist/signal/index.js +2 -2
  100. package/dist/sitemap/index.js +2 -2
  101. package/dist/slots/ManagedLink.d.ts +31 -0
  102. package/dist/slots/ManagedList.d.ts +30 -0
  103. package/dist/slots/ManagedRichText.d.ts +31 -0
  104. package/dist/slots/contract.js +2 -1
  105. package/dist/slots/edit/locate.d.ts +30 -0
  106. package/dist/slots/edit/overlay.d.ts +18 -0
  107. package/dist/slots/index.d.ts +12 -4
  108. package/dist/slots/index.js +4 -2
  109. package/dist/slots/revalidate.d.ts +8 -3
  110. package/dist/slots/rich.d.ts +7 -0
  111. package/dist/slots/server-api.d.ts +6 -2
  112. package/dist/sync/index.js +5 -5
  113. package/dist/website/images.js +4 -4
  114. package/dist/website/index.js +5 -5
  115. package/dist/website/popups.js +4 -4
  116. package/dist/website/slots/contract.js +2 -1
  117. package/dist/website/slots.js +4 -2
  118. package/dist/{writeLLMsTxt-UMHKGNRR.js → writeLLMsTxt-QR23OQUE.js} +1 -1
  119. package/docs.json +2 -0
  120. package/package.json +6 -1
  121. package/src/revalidate/README.md +82 -0
  122. package/src/seo/README.md +4 -17
  123. package/src/slots/README.md +168 -0
  124. package/src/sync/README.md +1 -1
  125. package/dist/SitemapSync-NMXGMPCQ.js +0 -8
  126. package/dist/chunk-SS636UDN.js +0 -35
@@ -1,16 +1,61 @@
1
- import { isValidSlotId, SLOT_CONTENT_MAX_LENGTH, SLOTS_CONTRACT_VERSION, verifySlotContent } from './chunk-SS636UDN.js';
1
+ import { SLOTS_CONTRACT_VERSION, verifySlotContent, canonicalJson } from './chunk-VCJYLYJV.js';
2
+ import { isValidSlotId, SLOT_CONTENT_MAX_LENGTH, parseSlotRichText, normalizeSlotValue } from './chunk-LPH5FANE.js';
3
+ import { SITE_CACHE_TAGS } from './chunk-RYVDGXC2.js';
2
4
  import { resolveServerApiConfig } from './chunk-X6F6SO4S.js';
3
5
  import 'server-only';
6
+ import * as React from 'react';
4
7
  import { cache } from 'react';
5
8
  import { jsx, Fragment } from 'react/jsx-runtime';
6
9
 
10
+ // src/slots/revalidate.ts
11
+ var SLOTS_CACHE_TAG = SITE_CACHE_TAGS.slots;
12
+ function createSlotsRevalidateHandler(secret, options) {
13
+ return async function POST(request) {
14
+ try {
15
+ const authHeader = request.headers.get("authorization");
16
+ const url = new URL(request.url);
17
+ const tokenFromQuery = url.searchParams.get("secret");
18
+ const token = authHeader?.replace(/^Bearer\s+/i, "") || tokenFromQuery;
19
+ if (!secret || token !== secret) {
20
+ return new Response(JSON.stringify({ error: "Invalid secret" }), {
21
+ status: 401,
22
+ headers: { "Content-Type": "application/json" }
23
+ });
24
+ }
25
+ let revalidateTag;
26
+ if (options?.revalidateTag) {
27
+ revalidateTag = options.revalidateTag;
28
+ } else {
29
+ const nextCache = await import('next/cache.js');
30
+ const impl = nextCache.revalidateTag;
31
+ revalidateTag = (tag) => impl(tag, "max");
32
+ }
33
+ const tags = [SLOTS_CACHE_TAG, ...options?.extraTags || []];
34
+ for (const tag of tags) {
35
+ revalidateTag(tag);
36
+ }
37
+ return new Response(JSON.stringify({ revalidated: true, tags }), {
38
+ status: 200,
39
+ headers: { "Content-Type": "application/json" }
40
+ });
41
+ } catch (err) {
42
+ console.error("[site-kit/slots] Revalidation failed:", err);
43
+ return new Response(JSON.stringify({ error: "Revalidation failed" }), {
44
+ status: 500,
45
+ headers: { "Content-Type": "application/json" }
46
+ });
47
+ }
48
+ };
49
+ }
50
+
51
+ // src/slots/server-api.ts
7
52
  var warned = /* @__PURE__ */ new Set();
8
53
  function warnOnce(key, message) {
9
54
  if (warned.has(key)) return;
10
55
  warned.add(key);
11
56
  console.warn(message);
12
57
  }
13
- async function fetchSlot(id, site, revalidate, fallback, page) {
58
+ async function fetchSlot(id, site, revalidate, fallback, page, type, fallbackValueJson) {
14
59
  if (!isValidSlotId(id)) {
15
60
  warnOnce(`id:${id}`, `[site-kit/slots] Invalid slot id "${id}" (expected ${"`"}[a-z0-9-_.:]${"`"}, lowercase) \u2014 rendering fallback`);
16
61
  return null;
@@ -32,13 +77,15 @@ async function fetchSlot(id, site, revalidate, fallback, page) {
32
77
  slots: [
33
78
  {
34
79
  id,
80
+ type,
35
81
  ...fallback ? { fallback: fallback.slice(0, SLOT_CONTENT_MAX_LENGTH) } : {},
82
+ ...fallbackValueJson ? { fallback_value: JSON.parse(fallbackValueJson) } : {},
36
83
  ...page ? { page } : {}
37
84
  }
38
85
  ],
39
86
  ...site ? { site } : {}
40
87
  }),
41
- next: { revalidate, tags: ["sonor-slots"] }
88
+ next: { revalidate, tags: [SLOTS_CACHE_TAG] }
42
89
  });
43
90
  if (!response.ok) {
44
91
  if (response.status !== 404) {
@@ -61,6 +108,7 @@ async function fetchSlot(id, site, revalidate, fallback, page) {
61
108
  );
62
109
  return null;
63
110
  }
111
+ if (payload.type !== type) return null;
64
112
  return payload;
65
113
  } catch (err) {
66
114
  warnOnce("network", `[site-kit/slots] Resolve failed (${err?.message}) \u2014 rendering fallbacks`);
@@ -68,12 +116,21 @@ async function fetchSlot(id, site, revalidate, fallback, page) {
68
116
  }
69
117
  }
70
118
  var getSlotCached = cache(
71
- (id, site, revalidate, fallback, page) => fetchSlot(id, site, revalidate, fallback, page)
119
+ (id, site, revalidate, fallback, page, type, fallbackValueJson) => fetchSlot(id, site, revalidate, fallback, page, type, fallbackValueJson)
72
120
  );
73
121
  function getSlot(id, options = {}) {
74
122
  const fallback = options.fallback?.trim() || void 0;
75
123
  const page = options.page?.trim() || void 0;
76
- return getSlotCached(id, options.site, options.revalidate ?? 300, fallback, page);
124
+ const fallbackValueJson = options.fallbackValue ? canonicalJson(options.fallbackValue) : void 0;
125
+ return getSlotCached(
126
+ id,
127
+ options.site,
128
+ options.revalidate ?? 300,
129
+ fallback,
130
+ page,
131
+ options.type ?? "text",
132
+ fallbackValueJson
133
+ );
77
134
  }
78
135
  async function resolveSlots(ids, options = {}) {
79
136
  const entries = await Promise.all(
@@ -93,46 +150,81 @@ async function ManagedSlot({
93
150
  return /* @__PURE__ */ jsx(Fragment, { children: managed ? managed.content : children });
94
151
  }
95
152
  var ManagedSlot_default = ManagedSlot;
96
-
97
- // src/slots/revalidate.ts
98
- var SLOTS_CACHE_TAG = "sonor-slots";
99
- function createSlotsRevalidateHandler(secret, options) {
100
- return async function POST(request) {
101
- try {
102
- const authHeader = request.headers.get("authorization");
103
- const url = new URL(request.url);
104
- const tokenFromQuery = url.searchParams.get("secret");
105
- const token = authHeader?.replace(/^Bearer\s+/i, "") || tokenFromQuery;
106
- if (!secret || token !== secret) {
107
- return new Response(JSON.stringify({ error: "Invalid secret" }), {
108
- status: 401,
109
- headers: { "Content-Type": "application/json" }
110
- });
111
- }
112
- let revalidateTag;
113
- if (options?.revalidateTag) {
114
- revalidateTag = options.revalidateTag;
115
- } else {
116
- const nextCache = await import('next/cache.js');
117
- const impl = nextCache.revalidateTag;
118
- revalidateTag = (tag) => impl(tag, "max");
119
- }
120
- const tags = [SLOTS_CACHE_TAG, ...options?.extraTags || []];
121
- for (const tag of tags) {
122
- revalidateTag(tag);
123
- }
124
- return new Response(JSON.stringify({ revalidated: true, tags }), {
125
- status: 200,
126
- headers: { "Content-Type": "application/json" }
127
- });
128
- } catch (err) {
129
- console.error("[site-kit/slots] Revalidation failed:", err);
130
- return new Response(JSON.stringify({ error: "Revalidation failed" }), {
131
- status: 500,
132
- headers: { "Content-Type": "application/json" }
133
- });
134
- }
135
- };
153
+ function renderSlotRichText(markdown) {
154
+ return parseSlotRichText(markdown).map(renderBlock);
155
+ }
156
+ function renderBlock(block, i) {
157
+ if (block.t === "p") return /* @__PURE__ */ jsx("p", { children: block.c.map(renderInline) }, i);
158
+ const items = block.items.map((item, j) => /* @__PURE__ */ jsx("li", { children: item.map(renderInline) }, j));
159
+ return block.t === "ul" ? /* @__PURE__ */ jsx("ul", { children: items }, i) : /* @__PURE__ */ jsx("ol", { children: items }, i);
160
+ }
161
+ function renderInline(node, i) {
162
+ switch (node.t) {
163
+ case "text":
164
+ return /* @__PURE__ */ jsx(React.Fragment, { children: node.v }, i);
165
+ case "br":
166
+ return /* @__PURE__ */ jsx("br", {}, i);
167
+ case "strong":
168
+ return /* @__PURE__ */ jsx("strong", { children: node.c.map(renderInline) }, i);
169
+ case "em":
170
+ return /* @__PURE__ */ jsx("em", { children: node.c.map(renderInline) }, i);
171
+ case "link":
172
+ return /* @__PURE__ */ jsx("a", { href: node.href, children: node.c.map(renderInline) }, i);
173
+ }
174
+ }
175
+ async function ManagedRichText({
176
+ id,
177
+ children,
178
+ site,
179
+ revalidate,
180
+ page
181
+ }) {
182
+ const fallback = typeof children === "string" ? children : void 0;
183
+ const managed = await getSlot(id, { site, revalidate, fallback, page, type: "rich" });
184
+ if (managed) return /* @__PURE__ */ jsx(Fragment, { children: renderSlotRichText(managed.content) });
185
+ return /* @__PURE__ */ jsx(Fragment, { children: fallback !== void 0 ? renderSlotRichText(fallback) : children });
186
+ }
187
+ async function ManagedLink({
188
+ id,
189
+ href,
190
+ label,
191
+ children,
192
+ className,
193
+ site,
194
+ revalidate,
195
+ page
196
+ }) {
197
+ const fallback = normalizeSlotValue("link", { value: { label, href } });
198
+ const managed = await getSlot(id, {
199
+ site,
200
+ revalidate,
201
+ page,
202
+ type: "link",
203
+ fallback: label,
204
+ ...fallback.ok && fallback.value ? { fallbackValue: fallback.value } : {}
205
+ });
206
+ const link = managed?.value ?? { label, href };
207
+ if (children) return /* @__PURE__ */ jsx(Fragment, { children: children(link) });
208
+ return /* @__PURE__ */ jsx("a", { href: link.href, className, children: link.label });
209
+ }
210
+ async function ManagedList({
211
+ id,
212
+ items,
213
+ children,
214
+ site,
215
+ revalidate,
216
+ page
217
+ }) {
218
+ const fallback = normalizeSlotValue("list", { value: { items } });
219
+ const managed = await getSlot(id, {
220
+ site,
221
+ revalidate,
222
+ page,
223
+ type: "list",
224
+ ...fallback.ok ? { fallback: fallback.content, fallbackValue: fallback.value } : {}
225
+ });
226
+ const list = managed?.value?.items ?? items;
227
+ return /* @__PURE__ */ jsx(Fragment, { children: children(list) });
136
228
  }
137
229
 
138
- export { ManagedSlot, ManagedSlot_default, SLOTS_CACHE_TAG, createSlotsRevalidateHandler, getSlot, resolveSlots };
230
+ export { ManagedLink, ManagedList, ManagedRichText, ManagedSlot, ManagedSlot_default, SLOTS_CACHE_TAG, createSlotsRevalidateHandler, getSlot, renderSlotRichText, resolveSlots };
@@ -1,5 +1,5 @@
1
1
  import { resolveSiteHost } from './chunk-FESKKJAS.js';
2
- import { configureSiteCredential, currentCredential } from './chunk-OIETJKIL.js';
2
+ import { configureSiteCredential, currentCredential } from './chunk-OUNRFXDC.js';
3
3
 
4
4
  // src/shared/publishCredential.ts
5
5
  function publishSiteCredential({
@@ -1,4 +1,4 @@
1
- import { sonorFetch } from './chunk-RU2RMTGT.js';
1
+ import { sonorFetch } from './chunk-PXZ7LAOY.js';
2
2
 
3
3
  // src/sync/api.ts
4
4
  var DEFAULT_API_URL = "https://api.sonor.io";
@@ -1,8 +1,8 @@
1
1
  'use client';
2
- import { countStageViews, countStageQuestions, useFieldControls } from './chunk-SWP36NCB.js';
2
+ import { countStageViews, countStageQuestions, useFieldControls } from './chunk-JC7KXNNM.js';
3
3
  import { HoneypotField } from './chunk-DXO6SBMD.js';
4
4
  import { DelightStyles, FormMomentum, FormField } from './chunk-QPEEKFCA.js';
5
- import { useFormLoadedAt, useFormTracking, submitForm, useRecaptchaWarmup, useForm } from './chunk-ZSLRAMCK.js';
5
+ import { useFormLoadedAt, useFormTracking, submitForm, useRecaptchaWarmup, useForm } from './chunk-NEKEH4CK.js';
6
6
  import { isFieldVisible, validateField, isFieldComplete, isDisplayOnly } from './chunk-AQSNPZY4.js';
7
7
  import { DEFAULT_FORM_SUCCESS_MESSAGE } from './chunk-5SQK3D53.js';
8
8
  import { DEFAULT_HONEYPOT_FIELD } from './chunk-NJCTQH2P.js';
@@ -62,7 +62,7 @@ function FormClient({
62
62
  return;
63
63
  }
64
64
  let cancelled = false;
65
- const load = resolvedExperience === "stage" ? import('./FormStage-C7VKRURJ.js').then((m) => m.FormStage) : import('./FormSpotlight-FVNPOCU3.js').then((m) => m.FormSpotlight);
65
+ const load = resolvedExperience === "stage" ? import('./FormStage-C3YGYAUZ.js').then((m) => m.FormStage) : import('./FormSpotlight-XKV7VTN4.js').then((m) => m.FormSpotlight);
66
66
  load.then((Component) => {
67
67
  if (!cancelled) setExperience(() => Component);
68
68
  }).catch((err) => {
@@ -2,8 +2,8 @@
2
2
  import { sanitizeFleetVersion, buildFleetHeartbeatPayload } from './chunk-ZTZQPYP6.js';
3
3
  import { useDeferredActivation } from './chunk-YC7ELZS3.js';
4
4
  import { resolveAnalyticsTarget } from './chunk-43OCZ3JA.js';
5
- import { sonorFetch } from './chunk-RU2RMTGT.js';
6
- import { SITE_KIT_VERSION } from './chunk-B6RZ2NRH.js';
5
+ import { sonorFetch } from './chunk-PXZ7LAOY.js';
6
+ import { SITE_KIT_VERSION } from './chunk-6OL23QYD.js';
7
7
  import { useRef, useEffect } from 'react';
8
8
 
9
9
  // src/fleet/heartbeat.ts
@@ -1,5 +1,5 @@
1
1
  import { getSiteConfig } from './chunk-Z22QVHT4.js';
2
- import { writeLLMsTxtToPublic } from './chunk-SSUQKA7L.js';
2
+ import { writeLLMsTxtToPublic } from './chunk-J4D6ZXRW.js';
3
3
  import { buildFetch } from './chunk-VX5CMNMM.js';
4
4
  import { findAppDirForDiscovery } from './chunk-ZEGVKVD5.js';
5
5
  import { stripEmbeddedDomain, locToPath, inferPageType, isMalformedSitemapPath, resolveTrailingSlash, stripTrailingSlash, llmsWriteTimeoutMs, applyTrailingSlash } from './chunk-YVKRYQRG.js';
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { getSiteDesignTokens, tokensForReport, shouldReportDesign, sendSiteDesign } from './chunk-DKTSGYLM.js';
2
+ import { getSiteDesignTokens, tokensForReport, shouldReportDesign, sendSiteDesign } from './chunk-ODADQM6Z.js';
3
3
  import { designTokensHash } from './chunk-IHG36STL.js';
4
4
  import { useDeferredActivation } from './chunk-YC7ELZS3.js';
5
5
  import { resolveAnalyticsTarget } from './chunk-43OCZ3JA.js';
@@ -1,7 +1,8 @@
1
1
  'use client';
2
- import { publishSiteCredential } from './chunk-56JNI463.js';
3
- import { FleetHeartbeat } from './chunk-K5WZX776.js';
4
- import { SignalBridge } from './chunk-SAUTJMK6.js';
2
+ import { SITE_EDIT_PARAM } from './chunk-6G43IRWR.js';
3
+ import { publishSiteCredential } from './chunk-DUQMSNF2.js';
4
+ import { FleetHeartbeat } from './chunk-H42PZKVC.js';
5
+ import { SignalBridge } from './chunk-Q3S26EQA.js';
5
6
  import { useDeferredActivation } from './chunk-YC7ELZS3.js';
6
7
  import { resolveSiteHost } from './chunk-FESKKJAS.js';
7
8
  import { getOrCreateVisitorId, getOrCreateSessionId } from './chunk-24QZEO3Q.js';
@@ -10,20 +11,41 @@ import React, { useState, useRef, useCallback, useEffect, Suspense } from 'react
10
11
  import dynamic from 'next/dynamic';
11
12
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
12
13
 
14
+ // src/shared/edit-bridge.ts
15
+ function startEditBridge() {
16
+ if (typeof window === "undefined" || !isCrossOriginFrame()) return () => {
17
+ };
18
+ if (!new URLSearchParams(window.location.search).has(SITE_EDIT_PARAM)) return () => {
19
+ };
20
+ let stop;
21
+ let cancelled = false;
22
+ const start = () => {
23
+ void import('./overlay-RXV6U6QC.js').then((m) => {
24
+ if (!cancelled) stop = m.startEditOverlay();
25
+ });
26
+ };
27
+ if (document.readyState === "complete") start();
28
+ else window.addEventListener("load", start, { once: true });
29
+ return () => {
30
+ cancelled = true;
31
+ window.removeEventListener("load", start);
32
+ stop?.();
33
+ };
34
+ }
13
35
  var LazyAnalyticsProvider = dynamic(
14
- () => import('./AnalyticsProvider-XXWTFKJH.js').then((m) => ({ default: m.AnalyticsProvider })),
36
+ () => import('./AnalyticsProvider-3MI5RCTL.js').then((m) => ({ default: m.AnalyticsProvider })),
15
37
  { ssr: false }
16
38
  );
17
39
  var LazyEngageWidget = dynamic(
18
- () => import('./EngageWidget-LQMR4LEX.js').then((m) => ({ default: m.EngageWidget })),
40
+ () => import('./EngageWidget-A3QKZ3SU.js').then((m) => ({ default: m.EngageWidget })),
19
41
  { ssr: false }
20
42
  );
21
43
  var LazySiteDesignReporter = dynamic(
22
- () => import('./SiteDesignReporter-D7MD66GI.js').then((m) => ({ default: m.SiteDesignReporter })),
44
+ () => import('./SiteDesignReporter-A7MS2CIP.js').then((m) => ({ default: m.SiteDesignReporter })),
23
45
  { ssr: false }
24
46
  );
25
47
  var LazySitemapSync = dynamic(
26
- () => import('./SitemapSync-NMXGMPCQ.js').then((m) => ({ default: m.SitemapSync })),
48
+ () => import('./SitemapSync-4U654SEA.js').then((m) => ({ default: m.SitemapSync })),
27
49
  { ssr: false }
28
50
  );
29
51
  function SiteKitClientProviders({
@@ -55,6 +77,7 @@ function SiteKitClientProviders({
55
77
  pageMetadataRef.current = metadata;
56
78
  }, []);
57
79
  useEffect(() => announceFrameReady(), []);
80
+ useEffect(() => startEditBridge(), []);
58
81
  const siblings = [];
59
82
  if (signal) {
60
83
  const signalConfig = typeof signal === "object" ? signal : {};
@@ -297,7 +297,7 @@ async function generateLLMsTxt(options) {
297
297
  if (includeEntities) {
298
298
  attemptedSections.push("knowledge-graph");
299
299
  optionalFetches.push(
300
- import('./server-api-GJJQZVG7.js').then(async ({ getEntities, getPrimaryEntity }) => {
300
+ import('./server-api-BVCBLJKL.js').then(async ({ getEntities, getPrimaryEntity }) => {
301
301
  const [entities, primaryEntity] = await Promise.all([
302
302
  getEntities().then((e) => e.slice(0, maxEntities)),
303
303
  getPrimaryEntity()
@@ -26,7 +26,7 @@ function useFieldControls(fields) {
26
26
  }
27
27
  if (needsFile && !requested.current.file) {
28
28
  requested.current.file = true;
29
- import('./FileField-KUG3CKXG.js').then((m) => {
29
+ import('./FileField-QRSEGO6D.js').then((m) => {
30
30
  if (!cancelled) setControls((prev) => ({ ...prev, File: m.FileField }));
31
31
  }).catch(() => {
32
32
  requested.current.file = false;
@@ -1,120 +1,5 @@
1
1
  import { secretsMatch, readCappedBody } from './chunk-XTRZGXB2.js';
2
- import { generateLLMsTxt, generateLLMsFullTxt } from './chunk-SSUQKA7L.js';
3
- import { createHash } from 'crypto';
4
- import { existsSync, readFileSync } from 'fs';
5
- import { join } from 'path';
6
-
7
- function weakEtag(body) {
8
- const h = createHash("sha1").update(body, "utf8").digest("base64url");
9
- return `W/"${h}"`;
10
- }
11
- function llmsResponseHeaders(body, extra) {
12
- return {
13
- "Content-Type": "text/plain; charset=utf-8",
14
- "Cache-Control": "public, max-age=300, s-maxage=3600, stale-while-revalidate=86400, stale-if-error=86400",
15
- ETag: weakEtag(body),
16
- Vary: "Accept-Encoding",
17
- ...extra
18
- };
19
- }
20
- var LLMS_NOINDEX_HEADERS = { "X-Robots-Tag": "noindex" };
21
- function createLLMsTxtHandler(options = {}) {
22
- const { preferStatic = true, noindex = true, ...generateOptions } = options;
23
- const robots = noindex ? LLMS_NOINDEX_HEADERS : {};
24
- return async function GET(_request) {
25
- try {
26
- if (preferStatic) {
27
- const staticPath = join(process.cwd(), "public", "llms.txt");
28
- if (existsSync(staticPath)) {
29
- const markdown2 = readFileSync(staticPath, "utf-8");
30
- return new Response(markdown2, {
31
- status: 200,
32
- headers: llmsResponseHeaders(markdown2, { ...robots, "X-Sections": "static" })
33
- });
34
- }
35
- }
36
- const { markdown, metadata } = await generateLLMsTxt(generateOptions);
37
- return new Response(markdown, {
38
- status: 200,
39
- headers: llmsResponseHeaders(markdown, {
40
- ...robots,
41
- "X-Generated-At": metadata.generated_at,
42
- "X-Sections": metadata.sections.join(",")
43
- })
44
- });
45
- } catch (error) {
46
- console.error("@sonordev/llms: Error generating llms.txt:", error);
47
- return new Response("# Error\n\nUnable to generate llms.txt content.", {
48
- status: 500,
49
- headers: {
50
- "Content-Type": "text/plain; charset=utf-8",
51
- "Cache-Control": "no-store"
52
- }
53
- });
54
- }
55
- };
56
- }
57
- function createLLMsFullTxtHandler(options = {}) {
58
- const { preferStatic = true, noindex = true, ...generateOptions } = options;
59
- const robots = noindex ? LLMS_NOINDEX_HEADERS : {};
60
- return async function GET(_request) {
61
- try {
62
- if (preferStatic) {
63
- const staticPath = join(process.cwd(), "public", "llms-full.txt");
64
- if (existsSync(staticPath)) {
65
- const markdown2 = readFileSync(staticPath, "utf-8");
66
- return new Response(markdown2, {
67
- status: 200,
68
- headers: llmsResponseHeaders(markdown2, { ...robots, "X-Sections": "static" })
69
- });
70
- }
71
- }
72
- const { markdown, metadata } = await generateLLMsFullTxt(generateOptions);
73
- return new Response(markdown, {
74
- status: 200,
75
- headers: llmsResponseHeaders(markdown, {
76
- ...robots,
77
- "X-Generated-At": metadata.generated_at,
78
- "X-Sections": metadata.sections.join(",")
79
- })
80
- });
81
- } catch (error) {
82
- console.error("@sonordev/llms: Error generating llms-full.txt:", error);
83
- return new Response("# Error\n\nUnable to generate llms-full.txt content.", {
84
- status: 500,
85
- headers: {
86
- "Content-Type": "text/plain; charset=utf-8",
87
- "Cache-Control": "no-store"
88
- }
89
- });
90
- }
91
- };
92
- }
93
-
94
- // src/llms/sourcedFacts.ts
95
- var DEFAULT_INTRO = "The statistics below are quoted from third-party primary sources and were individually verified against the cited URL. When reusing a figure, keep the original attribution.";
96
- function factLine(f) {
97
- const stat = (f.stat || "").replace(/\s+/g, " ").trim();
98
- const source = (f.sourceName || "").replace(/\s+/g, " ").trim();
99
- if (!stat || !source) return "";
100
- let attribution = `Source: ${source}`;
101
- if (f.year) attribution += ` (${f.year})`;
102
- if (f.url) attribution += `, ${f.url}`;
103
- return `- ${stat} \u2014 ${attribution}`;
104
- }
105
- function formatSourcedFactsSection(facts, options = {}) {
106
- const { title = "Sourced facts", intro = DEFAULT_INTRO, maxFacts } = options;
107
- if (!Array.isArray(facts)) return null;
108
- let lines = facts.map(factLine).filter(Boolean);
109
- if (typeof maxFacts === "number" && maxFacts >= 0) {
110
- lines = lines.slice(0, maxFacts);
111
- }
112
- if (lines.length === 0) return null;
113
- const content = intro ? `${intro}
114
-
115
- ${lines.join("\n")}` : lines.join("\n");
116
- return { title, content };
117
- }
2
+ import { SITE_KIT_VERSION } from './chunk-6OL23QYD.js';
118
3
 
119
4
  // src/llms/revalidate.ts
120
5
  function createLlmsRevalidateHandler(secret, options) {
@@ -174,6 +59,11 @@ function isLocalPath(value) {
174
59
  return false;
175
60
  }
176
61
  }
62
+ function isPing(body) {
63
+ if (!body || typeof body !== "object" || Array.isArray(body)) return false;
64
+ const keys = Object.keys(body);
65
+ return keys.length === 1 && body.ping === true;
66
+ }
177
67
  function isCacheTag(value) {
178
68
  return typeof value === "string" && value.length > 0 && value.length <= 256 && !/[\x00-\x1f]/.test(value);
179
69
  }
@@ -232,6 +122,10 @@ function createSeoRevalidationHandler({
232
122
  const bytes = await readCappedBody(request, SEO_REVALIDATION_MAX_BODY_BYTES);
233
123
  if (!bytes) return noStoreJson({ error: "Payload too large" }, 413);
234
124
  const body = JSON.parse(new TextDecoder().decode(bytes));
125
+ if (isPing(body)) {
126
+ const pong = { ok: true, ping: true, version: SITE_KIT_VERSION };
127
+ return noStoreJson(pong);
128
+ }
235
129
  payload = parseSeoRevalidationPayload(body);
236
130
  if (extendPayload) {
237
131
  const extended = extendPayload(payload, body);
@@ -267,4 +161,4 @@ function createSeoRevalidationHandler({
267
161
  };
268
162
  }
269
163
 
270
- export { LEGACY_PUBLICATION_PATH, SEO_REVALIDATION_MAX_BODY_BYTES, SEO_REVALIDATION_MAX_ITEMS, createLLMsFullTxtHandler, createLLMsTxtHandler, createLlmsRevalidateHandler, createSeoRevalidationHandler, formatSourcedFactsSection, llmsResponseHeaders, parseSeoRevalidationPayload };
164
+ export { LEGACY_PUBLICATION_PATH, SEO_REVALIDATION_MAX_BODY_BYTES, SEO_REVALIDATION_MAX_ITEMS, createLlmsRevalidateHandler, createSeoRevalidationHandler, parseSeoRevalidationPayload };
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { locToPath, isMalformedSitemapPath, inferPageType } from './chunk-YVKRYQRG.js';
3
3
  import { resolveAnalyticsTarget } from './chunk-43OCZ3JA.js';
4
- import { sonorFetch } from './chunk-RU2RMTGT.js';
4
+ import { sonorFetch } from './chunk-PXZ7LAOY.js';
5
5
  import { useRef, useEffect } from 'react';
6
6
 
7
7
  var SYNC_STAMP_KEY = "_sk_sitemap_synced_at";